oh-my-opencode 0.1.25 → 0.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.ko.md +21 -5
  2. package/README.md +21 -5
  3. package/dist/hooks/directory-agents-injector/constants.d.ts +3 -0
  4. package/dist/hooks/directory-agents-injector/index.d.ts +22 -0
  5. package/dist/hooks/directory-agents-injector/storage.d.ts +3 -0
  6. package/dist/hooks/directory-agents-injector/types.d.ts +5 -0
  7. package/dist/hooks/empty-task-response-detector.d.ts +12 -0
  8. package/dist/hooks/grep-output-truncator.d.ts +12 -0
  9. package/dist/hooks/index.d.ts +4 -0
  10. package/dist/hooks/pulse-monitor.d.ts +10 -0
  11. package/dist/hooks/session-recovery/constants.d.ts +6 -0
  12. package/dist/hooks/session-recovery/index.d.ts +14 -0
  13. package/dist/hooks/session-recovery/storage.d.ts +14 -0
  14. package/dist/hooks/session-recovery/types.d.ts +75 -0
  15. package/dist/index.js +892 -297
  16. package/dist/tools/ast-grep/index.d.ts +8 -8
  17. package/dist/tools/ast-grep/tools.d.ts +12 -12
  18. package/dist/tools/glob/cli.d.ts +2 -0
  19. package/dist/tools/glob/constants.d.ts +6 -0
  20. package/dist/tools/glob/index.d.ts +2 -0
  21. package/dist/tools/glob/tools.d.ts +11 -0
  22. package/dist/tools/glob/types.d.ts +19 -0
  23. package/dist/tools/glob/utils.d.ts +2 -0
  24. package/dist/tools/grep/index.d.ts +2 -0
  25. package/dist/tools/{safe-grep → grep}/tools.d.ts +1 -1
  26. package/dist/tools/index.d.ts +20 -9
  27. package/dist/tools/lsp/client.d.ts +5 -1
  28. package/package.json +1 -1
  29. package/dist/hooks/grep-blocker.d.ts +0 -10
  30. package/dist/hooks/session-recovery.d.ts +0 -30
  31. package/dist/tools/safe-grep/index.d.ts +0 -2
  32. /package/dist/tools/{safe-grep → grep}/cli.d.ts +0 -0
  33. /package/dist/tools/{safe-grep → grep}/constants.d.ts +0 -0
  34. /package/dist/tools/{safe-grep → grep}/types.d.ts +0 -0
  35. /package/dist/tools/{safe-grep → grep}/utils.d.ts +0 -0
package/README.ko.md CHANGED
@@ -13,7 +13,7 @@
13
13
  - [Tools](#tools)
14
14
  - [내장 LSP Tools](#내장-lsp-tools)
15
15
  - [내장 AST-Grep Tools](#내장-ast-grep-tools)
16
- - [Safe Grep](#safe-grep)
16
+ - [Grep](#grep)
17
17
  - [내장 MCPs](#내장-mcps)
18
18
  - [기타 편의 기능](#기타-편의-기능)
19
19
  - [설정](#설정)
@@ -142,6 +142,7 @@ OpenCode 는 아주 확장가능하고 아주 커스터마이저블합니다.
142
142
  - **Thinking Disabled Violation**: thinking 이 비활성화인데 thinking 블록이 있을 때 → thinking 블록 제거
143
143
  - **Empty Content Message**: 메시지가 thinking/meta 블록만 있고 실제 내용이 없을 때 → 파일시스템을 통해 "(interrupted)" 텍스트 주입
144
144
  - **Comment Checker**: 코드 수정 후 불필요한 주석을 감지하여 보고합니다. BDD 패턴, 지시어, 독스트링 등 유효한 주석은 똑똑하게 제외하고, AI가 남긴 흔적을 제거하여 코드를 깨끗하게 유지합니다.
145
+ - **Directory AGENTS.md Injector**: 파일을 읽을 때 `AGENTS.md` 내용을 자동으로 주입합니다. 파일 디렉토리부터 프로젝트 루트까지 탐색하며, 디렉토리별 컨텍스트를 에이전트에게 제공합니다. Claude Code의 CLAUDE.md 기능에서 영감을 받았습니다.
145
146
 
146
147
  ### Agents
147
148
 
@@ -151,12 +152,22 @@ OpenCode 는 아주 확장가능하고 아주 커스터마이저블합니다.
151
152
  - **frontend-ui-ux-engineer** (`google/gemini-3-pro-preview`): 개발자로 전향한 디자이너라는 설정을 갖고 있습니다. 멋진 UI를 만듭니다. 아름답고 창의적인 UI 코드를 생성하는 데 탁월한 Gemini를 사용합니다.
152
153
  - **document-writer** (`google/gemini-3-pro-preview`): 기술 문서 전문가라는 설정을 갖고 있습니다. Gemini 는 문학가입니다. 글을 기가막히게 씁니다.
153
154
 
155
+ 각 에이전트는 메인 에이전트가 알아서 호출하지만, 명시적으로 요청할 수도 있습니다:
156
+
157
+ ```
158
+ @oracle 한테 이 부분 설계 고민하고서 아키텍쳐 제안을 부탁해줘
159
+ @librarian 한테 이 부분 어떻게 구현돼있길래 자꾸 안에서 동작이 바뀌는지 알려달라고 해줘
160
+ @explore 한테 이 기능 정책 알려달라고 해줘
161
+ ```
162
+
154
163
  에이전트의 모델, 프롬프트, 권한은 `oh-my-opencode.json`에서 커스텀할 수 있습니다. 자세한 내용은 [설정](#설정)을 참고하세요.
155
164
 
156
165
  ### Tools
157
166
 
158
167
  #### 내장 LSP Tools
159
168
 
169
+ 당신이 에디터에서 사용하는 그 기능을 다른 에이전트들은 사용하지 못합니다. Oh My OpenCode 는 당신만의 그 도구를 LLM Agent 에게 쥐어줍니다. 리팩토링하고, 탐색하고, 분석하는 모든 작업을 OpenCode 의 설정값을 그대로 사용하여 지원합니다.
170
+
160
171
  [OpenCode 는 LSP 를 제공하지만](https://opencode.ai/docs/lsp/), 오로지 분석용으로만 제공합니다. 탐색과 리팩토링을 위한 도구는 OpenCode 와 동일한 스펙과 설정으로 Oh My OpenCode 가 제공합니다.
161
172
 
162
173
  - **lsp_hover**: 위치의 타입 정보, 문서, 시그니처 가져오기
@@ -175,11 +186,16 @@ OpenCode 는 아주 확장가능하고 아주 커스터마이저블합니다.
175
186
  - **ast_grep_search**: AST 인식 코드 패턴 검색 (25개 언어)
176
187
  - **ast_grep_replace**: AST 인식 코드 교체
177
188
 
178
- #### Safe Grep
179
- - **safe_grep**: 안전 제한이 있는 콘텐츠 검색 (5분 타임아웃, 10MB 출력 제한).
189
+ #### Grep
190
+ - **grep**: 안전 제한이 있는 콘텐츠 검색 (5분 타임아웃, 10MB 출력 제한). OpenCode의 내장 `grep` 도구를 대체합니다.
180
191
  - 기본 grep 도구는 시간제한이 걸려있지 않습니다. 대형 코드베이스에서 광범위한 패턴을 검색하면 CPU가 폭발하고 무한히 멈출 수 있습니다.
181
- - safe_grep timeout 엄격한 출력 제한을 적용합니다.
182
- - **주의**: 기본 grep 도구는 Agent 를 햇갈리게 하지 않기 위해 비활성화됩니다. 그러나 SafeGrep 은 Grep 이 제공하는 모든 기능을 제공합니다.
192
+ - 도구는 엄격한 제한을 적용하며, 내장 `grep`을 완전히 대체합니다.
193
+
194
+ #### Glob
195
+
196
+ - **glob**: 타임아웃 보호가 있는 파일 패턴 매칭 (60초). OpenCode 내장 `glob` 도구를 대체합니다.
197
+ - 기본 `glob`은 타임아웃이 없습니다. ripgrep이 멈추면 무한정 대기합니다.
198
+ - 이 도구는 타임아웃을 강제하고 만료 시 프로세스를 종료합니다.
183
199
 
184
200
  #### 내장 MCPs
185
201
 
package/README.md CHANGED
@@ -13,7 +13,7 @@ English | [한국어](README.ko.md)
13
13
  - [Tools](#tools)
14
14
  - [Built-in LSP Tools](#built-in-lsp-tools)
15
15
  - [Built-in AST-Grep Tools](#built-in-ast-grep-tools)
16
- - [Safe Grep](#safe-grep)
16
+ - [Grep](#grep)
17
17
  - [Built-in MCPs](#built-in-mcps)
18
18
  - [Other Features](#other-features)
19
19
  - [Configuration](#configuration)
@@ -138,6 +138,7 @@ I believe in the right tool for the job. For your wallet's sake, use CLIProxyAPI
138
138
  - **Thinking Disabled Violation**: When thinking blocks exist but thinking is disabled → strips thinking blocks
139
139
  - **Empty Content Message**: When message has only thinking/meta blocks without actual content → injects "(interrupted)" text via filesystem
140
140
  - **Comment Checker**: Detects and reports unnecessary comments after code modifications. Smartly ignores valid patterns (BDD, directives, docstrings, shebangs) to keep the codebase clean from AI-generated artifacts.
141
+ - **Directory AGENTS.md Injector**: Automatically injects `AGENTS.md` contents when reading files. Searches upward from the file's directory to project root, providing directory-level context to the agent. Inspired by Claude Code's CLAUDE.md feature.
141
142
 
142
143
  ### Agents
143
144
  - **oracle** (`openai/gpt-5.1`): The architect. Expert in code reviews and strategy. Uses GPT-5.1 for its unmatched logic and reasoning capabilities. Inspired by AmpCode.
@@ -146,12 +147,22 @@ I believe in the right tool for the job. For your wallet's sake, use CLIProxyAPI
146
147
  - **frontend-ui-ux-engineer** (`google/gemini-3-pro-preview`): A designer turned developer. Creates stunning UIs. Uses Gemini because its creativity and UI code generation are superior.
147
148
  - **document-writer** (`google/gemini-3-pro-preview`): A technical writing expert. Gemini is a wordsmith; it writes prose that flows naturally.
148
149
 
150
+ Each agent is automatically invoked by the main agent, but you can also explicitly request them:
151
+
152
+ ```
153
+ @oracle Please think through the design of this part and suggest an architecture.
154
+ @librarian Tell me how this is implemented — why does the behavior keep changing internally?
155
+ @explore Tell me about the policy for this feature.
156
+ ```
157
+
149
158
  Agent models, prompts, and permissions can be customized via `oh-my-opencode.json`. See [Configuration](#configuration) for details.
150
159
 
151
160
  ### Tools
152
161
 
153
162
  #### Built-in LSP Tools
154
163
 
164
+ The features you use in your editor—other agents cannot access them. Oh My OpenCode hands those very tools to your LLM Agent. Refactoring, navigation, and analysis are all supported using the same OpenCode configuration.
165
+
155
166
  [OpenCode provides LSP](https://opencode.ai/docs/lsp/), but only for analysis. Oh My OpenCode equips you with navigation and refactoring tools matching the same specification.
156
167
 
157
168
  - **lsp_hover**: Get type info, docs, signatures at position
@@ -171,12 +182,17 @@ Agent models, prompts, and permissions can be customized via `oh-my-opencode.jso
171
182
  - **ast_grep_search**: AST-aware code pattern search (25 languages)
172
183
  - **ast_grep_replace**: AST-aware code replacement
173
184
 
174
- #### Safe Grep
185
+ #### Grep
175
186
 
176
- - **safe_grep**: Content search with safety limits (5min timeout, 10MB output).
187
+ - **grep**: Content search with safety limits (5min timeout, 10MB output). Overrides OpenCode's built-in `grep` tool.
177
188
  - The default `grep` lacks safeguards. On a large codebase, a broad pattern can cause CPU overload and indefinite hanging.
178
- - `safe_grep` enforces strict limits.
179
- - **Note**: Default `grep` is disabled to prevent Agent confusion. `safe_grep` delivers full `grep` functionality with safety assurance.
189
+ - This tool enforces strict limits and completely replaces the built-in `grep`.
190
+
191
+ #### Glob
192
+
193
+ - **glob**: File pattern matching with timeout protection (60s). Overrides OpenCode's built-in `glob` tool.
194
+ - The default `glob` lacks timeout. If ripgrep hangs, it waits indefinitely.
195
+ - This tool enforces timeouts and kills the process on expiration.
180
196
 
181
197
  #### Built-in MCPs
182
198
 
@@ -0,0 +1,3 @@
1
+ export declare const OPENCODE_STORAGE: string;
2
+ export declare const AGENTS_INJECTOR_STORAGE: string;
3
+ export declare const AGENTS_FILENAME = "AGENTS.md";
@@ -0,0 +1,22 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ interface ToolExecuteInput {
3
+ tool: string;
4
+ sessionID: string;
5
+ callID: string;
6
+ }
7
+ interface ToolExecuteOutput {
8
+ title: string;
9
+ output: string;
10
+ metadata: unknown;
11
+ }
12
+ interface EventInput {
13
+ event: {
14
+ type: string;
15
+ properties?: unknown;
16
+ };
17
+ }
18
+ export declare function createDirectoryAgentsInjectorHook(ctx: PluginInput): {
19
+ "tool.execute.after": (input: ToolExecuteInput, output: ToolExecuteOutput) => Promise<void>;
20
+ event: ({ event }: EventInput) => Promise<void>;
21
+ };
22
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare function loadInjectedPaths(sessionID: string): Set<string>;
2
+ export declare function saveInjectedPaths(sessionID: string, paths: Set<string>): void;
3
+ export declare function clearInjectedPaths(sessionID: string): void;
@@ -0,0 +1,5 @@
1
+ export interface InjectedPathsData {
2
+ sessionID: string;
3
+ injectedPaths: string[];
4
+ updatedAt: number;
5
+ }
@@ -0,0 +1,12 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ export declare function createEmptyTaskResponseDetectorHook(_ctx: PluginInput): {
3
+ "tool.execute.after": (input: {
4
+ tool: string;
5
+ sessionID: string;
6
+ callID: string;
7
+ }, output: {
8
+ title: string;
9
+ output: string;
10
+ metadata: unknown;
11
+ }) => Promise<void>;
12
+ };
@@ -0,0 +1,12 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ export declare function createGrepOutputTruncatorHook(ctx: PluginInput): {
3
+ "tool.execute.after": (input: {
4
+ tool: string;
5
+ sessionID: string;
6
+ callID: string;
7
+ }, output: {
8
+ title: string;
9
+ output: string;
10
+ metadata: unknown;
11
+ }) => Promise<void>;
12
+ };
@@ -3,3 +3,7 @@ export { createContextWindowMonitorHook } from "./context-window-monitor";
3
3
  export { createSessionNotification } from "./session-notification";
4
4
  export { createSessionRecoveryHook } from "./session-recovery";
5
5
  export { createCommentCheckerHooks } from "./comment-checker";
6
+ export { createGrepOutputTruncatorHook } from "./grep-output-truncator";
7
+ export { createPulseMonitorHook } from "./pulse-monitor";
8
+ export { createDirectoryAgentsInjectorHook } from "./directory-agents-injector";
9
+ export { createEmptyTaskResponseDetectorHook } from "./empty-task-response-detector";
@@ -0,0 +1,10 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ export declare function createPulseMonitorHook(ctx: PluginInput): {
3
+ event: (input: {
4
+ event: any;
5
+ }) => Promise<void>;
6
+ "tool.execute.before": () => Promise<void>;
7
+ "tool.execute.after": (input: {
8
+ sessionID: string;
9
+ }) => Promise<void>;
10
+ };
@@ -0,0 +1,6 @@
1
+ export declare const OPENCODE_STORAGE: string;
2
+ export declare const MESSAGE_STORAGE: string;
3
+ export declare const PART_STORAGE: string;
4
+ export declare const THINKING_TYPES: Set<string>;
5
+ export declare const META_TYPES: Set<string>;
6
+ export declare const CONTENT_TYPES: Set<string>;
@@ -0,0 +1,14 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ interface MessageInfo {
3
+ id?: string;
4
+ role?: string;
5
+ sessionID?: string;
6
+ parentID?: string;
7
+ error?: unknown;
8
+ }
9
+ export declare function createSessionRecoveryHook(ctx: PluginInput): {
10
+ handleSessionRecovery: (info: MessageInfo) => Promise<boolean>;
11
+ isRecoverableError: (error: unknown) => boolean;
12
+ setOnAbortCallback: (callback: (sessionID: string) => void) => void;
13
+ };
14
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { StoredMessageMeta, StoredPart } from "./types";
2
+ export declare function generatePartId(): string;
3
+ export declare function getMessageDir(sessionID: string): string;
4
+ export declare function readMessages(sessionID: string): StoredMessageMeta[];
5
+ export declare function readParts(messageID: string): StoredPart[];
6
+ export declare function hasContent(part: StoredPart): boolean;
7
+ export declare function messageHasContent(messageID: string): boolean;
8
+ export declare function injectTextPart(sessionID: string, messageID: string, text: string): boolean;
9
+ export declare function findEmptyMessages(sessionID: string): string[];
10
+ export declare function findFirstEmptyMessage(sessionID: string): string | null;
11
+ export declare function findMessagesWithThinkingBlocks(sessionID: string): string[];
12
+ export declare function findMessagesWithOrphanThinking(sessionID: string): string[];
13
+ export declare function prependThinkingPart(sessionID: string, messageID: string): boolean;
14
+ export declare function stripThinkingParts(messageID: string): boolean;
@@ -0,0 +1,75 @@
1
+ export type ThinkingPartType = "thinking" | "redacted_thinking" | "reasoning";
2
+ export type MetaPartType = "step-start" | "step-finish";
3
+ export type ContentPartType = "text" | "tool" | "tool_use" | "tool_result";
4
+ export interface StoredMessageMeta {
5
+ id: string;
6
+ sessionID: string;
7
+ role: "user" | "assistant";
8
+ parentID?: string;
9
+ time?: {
10
+ created: number;
11
+ completed?: number;
12
+ };
13
+ error?: unknown;
14
+ }
15
+ export interface StoredTextPart {
16
+ id: string;
17
+ sessionID: string;
18
+ messageID: string;
19
+ type: "text";
20
+ text: string;
21
+ synthetic?: boolean;
22
+ ignored?: boolean;
23
+ }
24
+ export interface StoredToolPart {
25
+ id: string;
26
+ sessionID: string;
27
+ messageID: string;
28
+ type: "tool";
29
+ callID: string;
30
+ tool: string;
31
+ state: {
32
+ status: "pending" | "running" | "completed" | "error";
33
+ input: Record<string, unknown>;
34
+ output?: string;
35
+ error?: string;
36
+ };
37
+ }
38
+ export interface StoredReasoningPart {
39
+ id: string;
40
+ sessionID: string;
41
+ messageID: string;
42
+ type: "reasoning";
43
+ text: string;
44
+ }
45
+ export interface StoredStepPart {
46
+ id: string;
47
+ sessionID: string;
48
+ messageID: string;
49
+ type: "step-start" | "step-finish";
50
+ }
51
+ export type StoredPart = StoredTextPart | StoredToolPart | StoredReasoningPart | StoredStepPart | {
52
+ id: string;
53
+ sessionID: string;
54
+ messageID: string;
55
+ type: string;
56
+ [key: string]: unknown;
57
+ };
58
+ export interface MessageData {
59
+ info?: {
60
+ id?: string;
61
+ role?: string;
62
+ sessionID?: string;
63
+ parentID?: string;
64
+ error?: unknown;
65
+ };
66
+ parts?: Array<{
67
+ type: string;
68
+ id?: string;
69
+ text?: string;
70
+ thinking?: string;
71
+ name?: string;
72
+ input?: Record<string, unknown>;
73
+ callID?: string;
74
+ }>;
75
+ }