Commit Graph

36 Commits

Author SHA1 Message Date
YeonGyu-Kim
0b5c8250ca fix(pulse-monitor): prevent false positive stalled detection after tool execution
Remove forced monitoring restart in tool.execute.after to avoid false positive
stalled session detection when LLM legitimately completes response after tool run.
Monitoring now resumes naturally on next session/message event.

🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
2025-12-08 17:51:06 +09:00
YeonGyu-Kim
6ece7476ef feat(hooks): add empty-task-response-detector hook 2025-12-08 17:00:02 +09:00
YeonGyu-Kim
9ed23d4037 feat(hooks): implement directory-agents-injector hook 2025-12-08 17:00:02 +09:00
YeonGyu-Kim
79b791117a fix(session-recovery): improve error message extraction 2025-12-08 17:00:02 +09:00
YeonGyu-Kim
4e328a937c feat(hooks): integrate directory-agents-injector hook into plugin pipeline
- Add directoryAgentsInjector to plugin event handlers
- Wire up tool.execute.after hook for directory agents injection
- Fix: Format src/index.ts with consistent semicolon style
2025-12-08 17:00:02 +09:00
YeonGyu-Kim
a500f0c9ad export(hooks): add directory-agents-injector hook to public API
- Export createDirectoryAgentsInjectorHook from hooks index
- Fix: Formatting (add semicolons to match code style)
2025-12-08 17:00:02 +09:00
YeonGyu-Kim
16806da615 refactor(session-recovery): process entire message history for empty/thinking block recovery
- Scan all non-final assistant messages for empty content, orphan thinking blocks, and disabled thinking
- Add storage utility functions: findMessagesWithThinkingBlocks, findMessagesWithOrphanThinking, stripThinkingParts, prependThinkingPart
- Fix: Previously only processed single failed message, now handles multiple broken messages in history
- Improve: Use filesystem-based recovery instead of unreliable SDK APIs
2025-12-08 17:00:02 +09:00
YeonGyu-Kim
c5f651c0a9 refactor(hooks): remove grep-blocker (grep tool now overrides built-in)
The grep tool now properly overrides OpenCode's built-in grep,
making the blocker hook unnecessary.

Generated by [OpenCode](https://opencode.ai/)
2025-12-08 17:00:02 +09:00
YeonGyu-Kim
64b3564760 refactor(session-recovery): extract storage utilities to separate module
Split session-recovery.ts into modular structure:
- types.ts: SDK-aligned type definitions
- constants.ts: storage paths and part type sets
- storage.ts: reusable read/write operations
- index.ts: main recovery hook logic
2025-12-08 17:00:02 +09:00
YeonGyu-Kim
0df7e9b10b fix(session-recovery): recognize 'tool' type as valid content
OpenCode storage uses 'tool' type for tool calls, but the hasContent
check only recognized 'tool_use' (Anthropic API format). This caused
messages with tool calls to be incorrectly identified as empty.
2025-12-08 17:00:02 +09:00
YeonGyu-Kim
aa35f2eab6 fix(session-recovery): detect empty messages with zero parts
Previously, findEmptyContentMessageFromStorage only detected messages
with parts.length > 0 that had no content. This missed the case where
a message has zero parts entirely, causing infinite recovery loops.
2025-12-08 17:00:02 +09:00
YeonGyu-Kim
4debb57402 feat(hooks): add pulse-monitor for token stall detection and auto-recovery
- Detect token stalls via message.part.updated heartbeat monitoring
- Support thinking/reasoning block detection with extended timeout
- Auto-recover: abort + 'continue' prompt on 5min stall
- Pause monitoring during tool execution
2025-12-06 11:17:55 +09:00
YeonGyu-Kim
a763db61cf improve(hooks): refine todo-continuation-enforcer message tone and status format 2025-12-06 10:54:36 +09:00
YeonGyu-Kim
341e5a959d feat(hooks): add grep-output-truncator for context-aware output limiting 2025-12-06 10:54:22 +09:00
YeonGyu-Kim
a287e59262 feat(session-recovery): add filesystem-based empty content recovery
- Replace API-based recovery with direct JSON file editing for empty content messages
- Add cross-platform storage path support via xdg-basedir (Linux/macOS/Windows)
- Inject '(interrupted)' text part to fix messages with only thinking/meta blocks
- Update README docs with detailed session recovery scenarios
2025-12-05 23:24:20 +09:00
YeonGyu-Kim
143dd8aaa9 fix(session-recovery): improve error detection and add continue prompt
- Enhance error type detection for thinking block order issues
- Add continue prompt after successful session recovery
- Improve error message matching logic
2025-12-05 20:01:47 +09:00
YeonGyu-Kim
8f39575264 fix(session-recovery): handle empty content from interrupted reasoning (#6)
* fix(publish): make git operations idempotent

- Check for staged changes before commit
- Check if tag exists before creating
- Check if release exists before creating

* fix(session-recovery): handle empty content from interrupted reasoning

- Add THINKING_TYPES set including 'reasoning' type (OpenCode's thinking)
- Add hasNonEmptyOutput() to detect messages with only thinking/meta parts
- Add findEmptyContentMessage() to scan all messages for empty content
- Handle step-start/step-finish meta parts in empty content detection
- Patch interrupted messages with '(interrupted)' text before falling back to revert
2025-12-05 15:28:22 +09:00
YeonGyu-Kim
1b0a8adb2b refactor(comment-checker): remove WASM fallback, use CLI-only with lazy download
- Remove tree-sitter-wasms and web-tree-sitter dependencies
- Delete detector.ts (320 lines of WASM implementation)
- Add downloader.ts for lazy binary download from GitHub Releases
- Simplify index.ts to CLI-only mode
- Cache binary at ~/.cache/oh-my-opencode/bin/
- Fall back to 'Comment checking disabled' when binary unavailable
2025-12-05 14:51:47 +09:00
YeonGyu-Kim
b277d96de8 fix: remove Windows ARM64 support 2025-12-05 13:47:21 +09:00
YeonGyu-Kim
2c223d96a1 feat(comment-checker): add Windows support 2025-12-05 13:44:52 +09:00
YeonGyu-Kim
695aeafb86 fix(comment-checker): change npm scope to @code-yeongyu 2025-12-05 11:40:16 +09:00
YeonGyu-Kim
812c544bfa feat(comment-checker): add native CLI support with WASM fallback
- Add cli.ts for native binary resolution and spawning
- Update index.ts to use CLI when available, WASM as fallback
- Add Edit/MultiEdit support to types.ts for proper CLI input
2025-12-05 11:31:52 +09:00
YeonGyu-Kim
baa7fadab1 fix(comment-checker): use runtime wasm path resolution instead of require.resolve
require.resolve() was evaluated at build time, hardcoding CI paths.
Now uses import.meta.resolve() at runtime to find wasm files.
2025-12-05 11:09:41 +09:00
YeonGyu-Kim
fd6e230889 perf(comment-checker): add LSP-style background language warming
- Warmup common languages (python, typescript, javascript, tsx, go, rust, java) on plugin init
- Non-blocking background initialization using Promise.then() pattern
- First parse call uses pre-cached language - zero user wait time
- Refactor parser manager with ManagedLanguage interface for better state tracking
2025-12-05 11:02:35 +09:00
YeonGyu-Kim
f5f2053b7a fix(comment-checker): fix error skip bug and add parser/language caching
- Fix overly broad error detection that skipped comments when LSP warnings present
- Add Parser class and language WASM caching for ~3.5x faster subsequent parses
- Add debug logging controlled by COMMENT_CHECKER_DEBUG=1 env var
2025-12-05 10:56:08 +09:00
YeonGyu-Kim
2ad7e193fd fix(comment-checker): support args.path for OpenCode Write/Edit tools 2025-12-05 09:57:50 +09:00
YeonGyu-Kim
aff7cad615 fix: resolve tree-sitter wasm initialization error with locateFile option 2025-12-05 09:45:04 +09:00
YeonGyu-Kim
180d16b977 fix: prevent plugin crash by removing non-function exports from barrel files
BREAKING: OpenCode plugin loader calls all exports as functions.
Exporting non-function values (schemas, constants, types) causes TypeError.

Changes:
- Remove OhMyOpenCodeConfigSchema export from root index.ts
- Replace 'export *' with explicit function exports in hooks/index.ts
- Remove 'export *' from comment-checker/index.ts
2025-12-05 04:08:59 +09:00
YeonGyu-Kim
a1a2d2fdb3 hotfix: add empty content message recovery to session recovery 2025-12-05 03:54:51 +09:00
YeonGyu-Kim
02a9402472 feat(hooks): add comment-checker hook for detecting unnecessary comments
- Port Go comment-checker to TypeScript using web-tree-sitter
- Support 38 programming languages via tree-sitter-wasms
- Filter out valid comments: BDD patterns, lint directives, docstrings, shebangs
- Integrate with OpenCode's tool.execute.before/after hooks
- Attach feedback to Write/Edit/MultiEdit tool output
2025-12-05 02:49:47 +09:00
YeonGyu-Kim
7ac580566a feat(hook): add session-recovery for automatic API error recovery 2025-12-05 02:12:52 +09:00
YeonGyu-Kim
3d29214c29 refactor: move grep blocking from hook to config 2025-12-05 01:19:15 +09:00
YeonGyu-Kim
b397dd6655 feat(hook): block grep tool and guide to safe-grep 2025-12-04 18:20:01 +09:00
YeonGyu-Kim
b01050ab30 feat(hook): add session-notification hook for agent idle state notifications
- Implement createSessionNotification() for macOS/Linux/Windows notifications
- Debounce timer to confirm session still idle after 1.5s (prevents false alerts from todo-continuation)
- Skip notification if incomplete todos exist (smart coordination with todo-continuation-enforcer)
- Support cross-platform alerts (osascript, notify-send, PowerShell)
- Configurable title, message, sound, and idle confirmation delay
2025-12-04 16:19:12 +09:00
YeonGyu-Kim
9a11901590 feat(hook): add context window monitor for Anthropic token usage tracking 2025-12-04 16:19:12 +09:00
YeonGyu-Kim
a562a78050 feat(hook): add todo-continuation-enforcer for automatic task resumption 2025-12-04 16:19:12 +09:00