oh-my-opencode 3.2.4 → 3.3.0
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.
- package/dist/agents/atlas/default.d.ts +1 -1
- package/dist/agents/atlas/gpt.d.ts +1 -1
- package/dist/agents/atlas/index.d.ts +1 -1
- package/dist/agents/prometheus/high-accuracy-mode.d.ts +1 -1
- package/dist/agents/prometheus/index.d.ts +1 -1
- package/dist/agents/prometheus/interview-mode.d.ts +1 -1
- package/dist/agents/prometheus/plan-generation.d.ts +1 -1
- package/dist/agents/prometheus/plan-template.d.ts +1 -1
- package/dist/cli/index.js +2248 -2062
- package/dist/cli/run/agent-resolver.d.ts +5 -0
- package/dist/cli/run/events.d.ts +2 -0
- package/dist/cli/run/index.d.ts +6 -1
- package/dist/cli/run/json-output.d.ts +12 -0
- package/dist/cli/run/on-complete-hook.d.ts +7 -0
- package/dist/cli/run/runner.d.ts +2 -4
- package/dist/cli/run/server-connection.d.ts +6 -0
- package/dist/cli/run/session-resolver.d.ts +5 -0
- package/dist/cli/run/types.d.ts +17 -0
- package/dist/config/schema.d.ts +156 -2
- package/dist/features/background-agent/manager.d.ts +2 -1
- package/dist/features/builtin-commands/templates/init-deep.d.ts +1 -1
- package/dist/features/tool-metadata-store/index.d.ts +39 -0
- package/dist/hooks/agent-usage-reminder/constants.d.ts +1 -1
- package/dist/hooks/anthropic-context-window-limit-recovery/deduplication-recovery.d.ts +3 -0
- package/dist/hooks/anthropic-context-window-limit-recovery/index.d.ts +2 -13
- package/dist/hooks/anthropic-context-window-limit-recovery/pruning-tool-output-truncation.d.ts +3 -0
- package/dist/hooks/anthropic-context-window-limit-recovery/recovery-hook.d.ts +13 -0
- package/dist/hooks/anthropic-effort/index.d.ts +26 -0
- package/dist/hooks/atlas/index.d.ts +1 -0
- package/dist/hooks/compaction-todo-preserver/index.d.ts +11 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/keyword-detector/ultrawork/default.d.ts +2 -2
- package/dist/hooks/keyword-detector/ultrawork/gpt5.2.d.ts +1 -1
- package/dist/hooks/keyword-detector/ultrawork/planner.d.ts +1 -1
- package/dist/hooks/tasks-todowrite-disabler/constants.d.ts +1 -1
- package/dist/hooks/unstable-agent-babysitter/index.d.ts +19 -0
- package/dist/index.js +1864 -1214
- package/dist/shared/index.d.ts +2 -0
- package/dist/shared/migration/agent-category.d.ts +19 -0
- package/dist/shared/migration/agent-names.d.ts +6 -0
- package/dist/shared/migration/config-migration.d.ts +1 -0
- package/dist/shared/migration/hook-names.d.ts +6 -0
- package/dist/shared/migration/model-versions.d.ts +13 -0
- package/dist/shared/migration.d.ts +5 -44
- package/dist/shared/safe-create-hook.d.ts +5 -0
- package/dist/shared/truncate-description.d.ts +1 -0
- package/dist/tools/ast-grep/constants.d.ts +1 -1
- package/dist/tools/ast-grep/index.d.ts +1 -4
- package/dist/tools/ast-grep/tools.d.ts +2 -2
- package/dist/tools/call-omo-agent/constants.d.ts +1 -1
- package/dist/tools/delegate-task/constants.d.ts +1 -1
- package/dist/tools/delegate-task/types.d.ts +6 -1
- package/dist/tools/glob/index.d.ts +1 -2
- package/dist/tools/glob/tools.d.ts +2 -1
- package/dist/tools/grep/index.d.ts +1 -2
- package/dist/tools/grep/tools.d.ts +2 -1
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/session-manager/index.d.ts +1 -1
- package/dist/tools/session-manager/tools.d.ts +2 -4
- package/package.json +8 -8
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RunOptions } from "./types";
|
|
2
|
+
import type { OhMyOpenCodeConfig } from "../../config";
|
|
3
|
+
type EnvVars = Record<string, string | undefined>;
|
|
4
|
+
export declare const resolveRunAgent: (options: RunOptions, pluginConfig: OhMyOpenCodeConfig, env?: EnvVars) => string;
|
|
5
|
+
export {};
|
package/dist/cli/run/events.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export interface EventState {
|
|
|
9
9
|
currentTool: string | null;
|
|
10
10
|
/** Set to true when the main session has produced meaningful work (text, tool call, or tool result) */
|
|
11
11
|
hasReceivedMeaningfulWork: boolean;
|
|
12
|
+
/** Count of assistant messages for the main session */
|
|
13
|
+
messageCount: number;
|
|
12
14
|
}
|
|
13
15
|
export declare function createEventState(): EventState;
|
|
14
16
|
export declare function processEvents(ctx: RunContext, stream: AsyncIterable<unknown>, state: EventState): Promise<void>;
|
package/dist/cli/run/index.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
export { run } from "./runner";
|
|
2
|
-
export
|
|
2
|
+
export { resolveRunAgent } from "./agent-resolver";
|
|
3
|
+
export { createServerConnection } from "./server-connection";
|
|
4
|
+
export { resolveSession } from "./session-resolver";
|
|
5
|
+
export { createJsonOutputManager } from "./json-output";
|
|
6
|
+
export { executeOnCompleteHook } from "./on-complete-hook";
|
|
7
|
+
export type { RunOptions, RunContext, RunResult, ServerConnection } from "./types";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RunResult } from "./types";
|
|
2
|
+
export interface JsonOutputManager {
|
|
3
|
+
redirectToStderr: () => void;
|
|
4
|
+
restore: () => void;
|
|
5
|
+
emitResult: (result: RunResult) => void;
|
|
6
|
+
}
|
|
7
|
+
interface JsonOutputManagerOptions {
|
|
8
|
+
stdout?: NodeJS.WriteStream;
|
|
9
|
+
stderr?: NodeJS.WriteStream;
|
|
10
|
+
}
|
|
11
|
+
export declare function createJsonOutputManager(options?: JsonOutputManagerOptions): JsonOutputManager;
|
|
12
|
+
export {};
|
package/dist/cli/run/runner.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { RunOptions } from "./types";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export declare const resolveRunAgent: (options: RunOptions, pluginConfig: OhMyOpenCodeConfig, env?: EnvVars) => string;
|
|
2
|
+
import { resolveRunAgent } from "./agent-resolver";
|
|
3
|
+
export { resolveRunAgent };
|
|
5
4
|
export declare function run(options: RunOptions): Promise<number>;
|
|
6
|
-
export {};
|
package/dist/cli/run/types.d.ts
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
import type { OpencodeClient } from "@opencode-ai/sdk";
|
|
2
|
+
export type { OpencodeClient };
|
|
2
3
|
export interface RunOptions {
|
|
3
4
|
message: string;
|
|
4
5
|
agent?: string;
|
|
5
6
|
directory?: string;
|
|
6
7
|
timeout?: number;
|
|
8
|
+
port?: number;
|
|
9
|
+
attach?: string;
|
|
10
|
+
onComplete?: string;
|
|
11
|
+
json?: boolean;
|
|
12
|
+
sessionId?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ServerConnection {
|
|
15
|
+
client: OpencodeClient;
|
|
16
|
+
cleanup: () => void;
|
|
17
|
+
}
|
|
18
|
+
export interface RunResult {
|
|
19
|
+
sessionId: string;
|
|
20
|
+
success: boolean;
|
|
21
|
+
durationMs: number;
|
|
22
|
+
messageCount: number;
|
|
23
|
+
summary: string;
|
|
7
24
|
}
|
|
8
25
|
export interface RunContext {
|
|
9
26
|
client: OpencodeClient;
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ export declare const HookNameSchema: z.ZodEnum<{
|
|
|
75
75
|
"ralph-loop": "ralph-loop";
|
|
76
76
|
"category-skill-reminder": "category-skill-reminder";
|
|
77
77
|
"compaction-context-injector": "compaction-context-injector";
|
|
78
|
+
"compaction-todo-preserver": "compaction-todo-preserver";
|
|
78
79
|
"claude-code-hooks": "claude-code-hooks";
|
|
79
80
|
"auto-slash-command": "auto-slash-command";
|
|
80
81
|
"edit-error-recovery": "edit-error-recovery";
|
|
@@ -88,6 +89,7 @@ export declare const HookNameSchema: z.ZodEnum<{
|
|
|
88
89
|
"stop-continuation-guard": "stop-continuation-guard";
|
|
89
90
|
"tasks-todowrite-disabler": "tasks-todowrite-disabler";
|
|
90
91
|
"write-existing-file-guard": "write-existing-file-guard";
|
|
92
|
+
"anthropic-effort": "anthropic-effort";
|
|
91
93
|
}>;
|
|
92
94
|
export declare const BuiltinCommandNameSchema: z.ZodEnum<{
|
|
93
95
|
"ralph-loop": "ralph-loop";
|
|
@@ -136,6 +138,11 @@ export declare const AgentOverrideConfigSchema: z.ZodObject<{
|
|
|
136
138
|
deny: "deny";
|
|
137
139
|
ask: "ask";
|
|
138
140
|
}>>;
|
|
141
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
142
|
+
allow: "allow";
|
|
143
|
+
deny: "deny";
|
|
144
|
+
ask: "ask";
|
|
145
|
+
}>>;
|
|
139
146
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
140
147
|
allow: "allow";
|
|
141
148
|
deny: "deny";
|
|
@@ -207,6 +214,11 @@ export declare const AgentOverridesSchema: z.ZodObject<{
|
|
|
207
214
|
deny: "deny";
|
|
208
215
|
ask: "ask";
|
|
209
216
|
}>>;
|
|
217
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
218
|
+
allow: "allow";
|
|
219
|
+
deny: "deny";
|
|
220
|
+
ask: "ask";
|
|
221
|
+
}>>;
|
|
210
222
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
211
223
|
allow: "allow";
|
|
212
224
|
deny: "deny";
|
|
@@ -277,6 +289,11 @@ export declare const AgentOverridesSchema: z.ZodObject<{
|
|
|
277
289
|
deny: "deny";
|
|
278
290
|
ask: "ask";
|
|
279
291
|
}>>;
|
|
292
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
293
|
+
allow: "allow";
|
|
294
|
+
deny: "deny";
|
|
295
|
+
ask: "ask";
|
|
296
|
+
}>>;
|
|
280
297
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
281
298
|
allow: "allow";
|
|
282
299
|
deny: "deny";
|
|
@@ -347,6 +364,11 @@ export declare const AgentOverridesSchema: z.ZodObject<{
|
|
|
347
364
|
deny: "deny";
|
|
348
365
|
ask: "ask";
|
|
349
366
|
}>>;
|
|
367
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
368
|
+
allow: "allow";
|
|
369
|
+
deny: "deny";
|
|
370
|
+
ask: "ask";
|
|
371
|
+
}>>;
|
|
350
372
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
351
373
|
allow: "allow";
|
|
352
374
|
deny: "deny";
|
|
@@ -417,6 +439,11 @@ export declare const AgentOverridesSchema: z.ZodObject<{
|
|
|
417
439
|
deny: "deny";
|
|
418
440
|
ask: "ask";
|
|
419
441
|
}>>;
|
|
442
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
443
|
+
allow: "allow";
|
|
444
|
+
deny: "deny";
|
|
445
|
+
ask: "ask";
|
|
446
|
+
}>>;
|
|
420
447
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
421
448
|
allow: "allow";
|
|
422
449
|
deny: "deny";
|
|
@@ -487,6 +514,11 @@ export declare const AgentOverridesSchema: z.ZodObject<{
|
|
|
487
514
|
deny: "deny";
|
|
488
515
|
ask: "ask";
|
|
489
516
|
}>>;
|
|
517
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
518
|
+
allow: "allow";
|
|
519
|
+
deny: "deny";
|
|
520
|
+
ask: "ask";
|
|
521
|
+
}>>;
|
|
490
522
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
491
523
|
allow: "allow";
|
|
492
524
|
deny: "deny";
|
|
@@ -557,6 +589,11 @@ export declare const AgentOverridesSchema: z.ZodObject<{
|
|
|
557
589
|
deny: "deny";
|
|
558
590
|
ask: "ask";
|
|
559
591
|
}>>;
|
|
592
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
593
|
+
allow: "allow";
|
|
594
|
+
deny: "deny";
|
|
595
|
+
ask: "ask";
|
|
596
|
+
}>>;
|
|
560
597
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
561
598
|
allow: "allow";
|
|
562
599
|
deny: "deny";
|
|
@@ -627,6 +664,11 @@ export declare const AgentOverridesSchema: z.ZodObject<{
|
|
|
627
664
|
deny: "deny";
|
|
628
665
|
ask: "ask";
|
|
629
666
|
}>>;
|
|
667
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
668
|
+
allow: "allow";
|
|
669
|
+
deny: "deny";
|
|
670
|
+
ask: "ask";
|
|
671
|
+
}>>;
|
|
630
672
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
631
673
|
allow: "allow";
|
|
632
674
|
deny: "deny";
|
|
@@ -697,6 +739,11 @@ export declare const AgentOverridesSchema: z.ZodObject<{
|
|
|
697
739
|
deny: "deny";
|
|
698
740
|
ask: "ask";
|
|
699
741
|
}>>;
|
|
742
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
743
|
+
allow: "allow";
|
|
744
|
+
deny: "deny";
|
|
745
|
+
ask: "ask";
|
|
746
|
+
}>>;
|
|
700
747
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
701
748
|
allow: "allow";
|
|
702
749
|
deny: "deny";
|
|
@@ -767,6 +814,11 @@ export declare const AgentOverridesSchema: z.ZodObject<{
|
|
|
767
814
|
deny: "deny";
|
|
768
815
|
ask: "ask";
|
|
769
816
|
}>>;
|
|
817
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
818
|
+
allow: "allow";
|
|
819
|
+
deny: "deny";
|
|
820
|
+
ask: "ask";
|
|
821
|
+
}>>;
|
|
770
822
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
771
823
|
allow: "allow";
|
|
772
824
|
deny: "deny";
|
|
@@ -837,6 +889,11 @@ export declare const AgentOverridesSchema: z.ZodObject<{
|
|
|
837
889
|
deny: "deny";
|
|
838
890
|
ask: "ask";
|
|
839
891
|
}>>;
|
|
892
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
893
|
+
allow: "allow";
|
|
894
|
+
deny: "deny";
|
|
895
|
+
ask: "ask";
|
|
896
|
+
}>>;
|
|
840
897
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
841
898
|
allow: "allow";
|
|
842
899
|
deny: "deny";
|
|
@@ -907,6 +964,11 @@ export declare const AgentOverridesSchema: z.ZodObject<{
|
|
|
907
964
|
deny: "deny";
|
|
908
965
|
ask: "ask";
|
|
909
966
|
}>>;
|
|
967
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
968
|
+
allow: "allow";
|
|
969
|
+
deny: "deny";
|
|
970
|
+
ask: "ask";
|
|
971
|
+
}>>;
|
|
910
972
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
911
973
|
allow: "allow";
|
|
912
974
|
deny: "deny";
|
|
@@ -977,6 +1039,11 @@ export declare const AgentOverridesSchema: z.ZodObject<{
|
|
|
977
1039
|
deny: "deny";
|
|
978
1040
|
ask: "ask";
|
|
979
1041
|
}>>;
|
|
1042
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
1043
|
+
allow: "allow";
|
|
1044
|
+
deny: "deny";
|
|
1045
|
+
ask: "ask";
|
|
1046
|
+
}>>;
|
|
980
1047
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
981
1048
|
allow: "allow";
|
|
982
1049
|
deny: "deny";
|
|
@@ -1047,6 +1114,11 @@ export declare const AgentOverridesSchema: z.ZodObject<{
|
|
|
1047
1114
|
deny: "deny";
|
|
1048
1115
|
ask: "ask";
|
|
1049
1116
|
}>>;
|
|
1117
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
1118
|
+
allow: "allow";
|
|
1119
|
+
deny: "deny";
|
|
1120
|
+
ask: "ask";
|
|
1121
|
+
}>>;
|
|
1050
1122
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
1051
1123
|
allow: "allow";
|
|
1052
1124
|
deny: "deny";
|
|
@@ -1117,6 +1189,11 @@ export declare const AgentOverridesSchema: z.ZodObject<{
|
|
|
1117
1189
|
deny: "deny";
|
|
1118
1190
|
ask: "ask";
|
|
1119
1191
|
}>>;
|
|
1192
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
1193
|
+
allow: "allow";
|
|
1194
|
+
deny: "deny";
|
|
1195
|
+
ask: "ask";
|
|
1196
|
+
}>>;
|
|
1120
1197
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
1121
1198
|
allow: "allow";
|
|
1122
1199
|
deny: "deny";
|
|
@@ -1294,6 +1371,8 @@ export declare const ExperimentalConfigSchema: z.ZodObject<{
|
|
|
1294
1371
|
}, z.core.$strip>>;
|
|
1295
1372
|
}, z.core.$strip>>;
|
|
1296
1373
|
task_system: z.ZodOptional<z.ZodBoolean>;
|
|
1374
|
+
plugin_load_timeout_ms: z.ZodOptional<z.ZodNumber>;
|
|
1375
|
+
safe_hook_creation: z.ZodOptional<z.ZodBoolean>;
|
|
1297
1376
|
}, z.core.$strip>;
|
|
1298
1377
|
export declare const SkillSourceSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
1299
1378
|
path: z.ZodString;
|
|
@@ -1368,7 +1447,7 @@ export declare const BabysittingConfigSchema: z.ZodObject<{
|
|
|
1368
1447
|
timeout_ms: z.ZodDefault<z.ZodNumber>;
|
|
1369
1448
|
}, z.core.$strip>;
|
|
1370
1449
|
export declare const GitMasterConfigSchema: z.ZodObject<{
|
|
1371
|
-
commit_footer: z.ZodDefault<z.ZodBoolean
|
|
1450
|
+
commit_footer: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
|
|
1372
1451
|
include_co_authored_by: z.ZodDefault<z.ZodBoolean>;
|
|
1373
1452
|
}, z.core.$strip>;
|
|
1374
1453
|
export declare const BrowserAutomationProviderSchema: z.ZodEnum<{
|
|
@@ -1478,6 +1557,7 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
1478
1557
|
"ralph-loop": "ralph-loop";
|
|
1479
1558
|
"category-skill-reminder": "category-skill-reminder";
|
|
1480
1559
|
"compaction-context-injector": "compaction-context-injector";
|
|
1560
|
+
"compaction-todo-preserver": "compaction-todo-preserver";
|
|
1481
1561
|
"claude-code-hooks": "claude-code-hooks";
|
|
1482
1562
|
"auto-slash-command": "auto-slash-command";
|
|
1483
1563
|
"edit-error-recovery": "edit-error-recovery";
|
|
@@ -1491,6 +1571,7 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
1491
1571
|
"stop-continuation-guard": "stop-continuation-guard";
|
|
1492
1572
|
"tasks-todowrite-disabler": "tasks-todowrite-disabler";
|
|
1493
1573
|
"write-existing-file-guard": "write-existing-file-guard";
|
|
1574
|
+
"anthropic-effort": "anthropic-effort";
|
|
1494
1575
|
}>>>;
|
|
1495
1576
|
disabled_commands: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1496
1577
|
"ralph-loop": "ralph-loop";
|
|
@@ -1541,6 +1622,11 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
1541
1622
|
deny: "deny";
|
|
1542
1623
|
ask: "ask";
|
|
1543
1624
|
}>>;
|
|
1625
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
1626
|
+
allow: "allow";
|
|
1627
|
+
deny: "deny";
|
|
1628
|
+
ask: "ask";
|
|
1629
|
+
}>>;
|
|
1544
1630
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
1545
1631
|
allow: "allow";
|
|
1546
1632
|
deny: "deny";
|
|
@@ -1611,6 +1697,11 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
1611
1697
|
deny: "deny";
|
|
1612
1698
|
ask: "ask";
|
|
1613
1699
|
}>>;
|
|
1700
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
1701
|
+
allow: "allow";
|
|
1702
|
+
deny: "deny";
|
|
1703
|
+
ask: "ask";
|
|
1704
|
+
}>>;
|
|
1614
1705
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
1615
1706
|
allow: "allow";
|
|
1616
1707
|
deny: "deny";
|
|
@@ -1681,6 +1772,11 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
1681
1772
|
deny: "deny";
|
|
1682
1773
|
ask: "ask";
|
|
1683
1774
|
}>>;
|
|
1775
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
1776
|
+
allow: "allow";
|
|
1777
|
+
deny: "deny";
|
|
1778
|
+
ask: "ask";
|
|
1779
|
+
}>>;
|
|
1684
1780
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
1685
1781
|
allow: "allow";
|
|
1686
1782
|
deny: "deny";
|
|
@@ -1751,6 +1847,11 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
1751
1847
|
deny: "deny";
|
|
1752
1848
|
ask: "ask";
|
|
1753
1849
|
}>>;
|
|
1850
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
1851
|
+
allow: "allow";
|
|
1852
|
+
deny: "deny";
|
|
1853
|
+
ask: "ask";
|
|
1854
|
+
}>>;
|
|
1754
1855
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
1755
1856
|
allow: "allow";
|
|
1756
1857
|
deny: "deny";
|
|
@@ -1821,6 +1922,11 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
1821
1922
|
deny: "deny";
|
|
1822
1923
|
ask: "ask";
|
|
1823
1924
|
}>>;
|
|
1925
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
1926
|
+
allow: "allow";
|
|
1927
|
+
deny: "deny";
|
|
1928
|
+
ask: "ask";
|
|
1929
|
+
}>>;
|
|
1824
1930
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
1825
1931
|
allow: "allow";
|
|
1826
1932
|
deny: "deny";
|
|
@@ -1891,6 +1997,11 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
1891
1997
|
deny: "deny";
|
|
1892
1998
|
ask: "ask";
|
|
1893
1999
|
}>>;
|
|
2000
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
2001
|
+
allow: "allow";
|
|
2002
|
+
deny: "deny";
|
|
2003
|
+
ask: "ask";
|
|
2004
|
+
}>>;
|
|
1894
2005
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
1895
2006
|
allow: "allow";
|
|
1896
2007
|
deny: "deny";
|
|
@@ -1961,6 +2072,11 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
1961
2072
|
deny: "deny";
|
|
1962
2073
|
ask: "ask";
|
|
1963
2074
|
}>>;
|
|
2075
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
2076
|
+
allow: "allow";
|
|
2077
|
+
deny: "deny";
|
|
2078
|
+
ask: "ask";
|
|
2079
|
+
}>>;
|
|
1964
2080
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
1965
2081
|
allow: "allow";
|
|
1966
2082
|
deny: "deny";
|
|
@@ -2031,6 +2147,11 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
2031
2147
|
deny: "deny";
|
|
2032
2148
|
ask: "ask";
|
|
2033
2149
|
}>>;
|
|
2150
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
2151
|
+
allow: "allow";
|
|
2152
|
+
deny: "deny";
|
|
2153
|
+
ask: "ask";
|
|
2154
|
+
}>>;
|
|
2034
2155
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
2035
2156
|
allow: "allow";
|
|
2036
2157
|
deny: "deny";
|
|
@@ -2101,6 +2222,11 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
2101
2222
|
deny: "deny";
|
|
2102
2223
|
ask: "ask";
|
|
2103
2224
|
}>>;
|
|
2225
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
2226
|
+
allow: "allow";
|
|
2227
|
+
deny: "deny";
|
|
2228
|
+
ask: "ask";
|
|
2229
|
+
}>>;
|
|
2104
2230
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
2105
2231
|
allow: "allow";
|
|
2106
2232
|
deny: "deny";
|
|
@@ -2171,6 +2297,11 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
2171
2297
|
deny: "deny";
|
|
2172
2298
|
ask: "ask";
|
|
2173
2299
|
}>>;
|
|
2300
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
2301
|
+
allow: "allow";
|
|
2302
|
+
deny: "deny";
|
|
2303
|
+
ask: "ask";
|
|
2304
|
+
}>>;
|
|
2174
2305
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
2175
2306
|
allow: "allow";
|
|
2176
2307
|
deny: "deny";
|
|
@@ -2241,6 +2372,11 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
2241
2372
|
deny: "deny";
|
|
2242
2373
|
ask: "ask";
|
|
2243
2374
|
}>>;
|
|
2375
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
2376
|
+
allow: "allow";
|
|
2377
|
+
deny: "deny";
|
|
2378
|
+
ask: "ask";
|
|
2379
|
+
}>>;
|
|
2244
2380
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
2245
2381
|
allow: "allow";
|
|
2246
2382
|
deny: "deny";
|
|
@@ -2311,6 +2447,11 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
2311
2447
|
deny: "deny";
|
|
2312
2448
|
ask: "ask";
|
|
2313
2449
|
}>>;
|
|
2450
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
2451
|
+
allow: "allow";
|
|
2452
|
+
deny: "deny";
|
|
2453
|
+
ask: "ask";
|
|
2454
|
+
}>>;
|
|
2314
2455
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
2315
2456
|
allow: "allow";
|
|
2316
2457
|
deny: "deny";
|
|
@@ -2381,6 +2522,11 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
2381
2522
|
deny: "deny";
|
|
2382
2523
|
ask: "ask";
|
|
2383
2524
|
}>>;
|
|
2525
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
2526
|
+
allow: "allow";
|
|
2527
|
+
deny: "deny";
|
|
2528
|
+
ask: "ask";
|
|
2529
|
+
}>>;
|
|
2384
2530
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
2385
2531
|
allow: "allow";
|
|
2386
2532
|
deny: "deny";
|
|
@@ -2451,6 +2597,11 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
2451
2597
|
deny: "deny";
|
|
2452
2598
|
ask: "ask";
|
|
2453
2599
|
}>>;
|
|
2600
|
+
task: z.ZodOptional<z.ZodEnum<{
|
|
2601
|
+
allow: "allow";
|
|
2602
|
+
deny: "deny";
|
|
2603
|
+
ask: "ask";
|
|
2604
|
+
}>>;
|
|
2454
2605
|
doom_loop: z.ZodOptional<z.ZodEnum<{
|
|
2455
2606
|
allow: "allow";
|
|
2456
2607
|
deny: "deny";
|
|
@@ -2563,6 +2714,8 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
2563
2714
|
}, z.core.$strip>>;
|
|
2564
2715
|
}, z.core.$strip>>;
|
|
2565
2716
|
task_system: z.ZodOptional<z.ZodBoolean>;
|
|
2717
|
+
plugin_load_timeout_ms: z.ZodOptional<z.ZodNumber>;
|
|
2718
|
+
safe_hook_creation: z.ZodOptional<z.ZodBoolean>;
|
|
2566
2719
|
}, z.core.$strip>>;
|
|
2567
2720
|
auto_update: z.ZodOptional<z.ZodBoolean>;
|
|
2568
2721
|
skills: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
@@ -2605,7 +2758,7 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
2605
2758
|
timeout_ms: z.ZodDefault<z.ZodNumber>;
|
|
2606
2759
|
}, z.core.$strip>>;
|
|
2607
2760
|
git_master: z.ZodOptional<z.ZodObject<{
|
|
2608
|
-
commit_footer: z.ZodDefault<z.ZodBoolean
|
|
2761
|
+
commit_footer: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
|
|
2609
2762
|
include_co_authored_by: z.ZodDefault<z.ZodBoolean>;
|
|
2610
2763
|
}, z.core.$strip>>;
|
|
2611
2764
|
browser_automation_engine: z.ZodOptional<z.ZodObject<{
|
|
@@ -2641,6 +2794,7 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
2641
2794
|
claude_code_compat: z.ZodDefault<z.ZodBoolean>;
|
|
2642
2795
|
}, z.core.$strip>>;
|
|
2643
2796
|
}, z.core.$strip>>;
|
|
2797
|
+
_migrations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2644
2798
|
}, z.core.$strip>;
|
|
2645
2799
|
export type OhMyOpenCodeConfig = z.infer<typeof OhMyOpenCodeConfigSchema>;
|
|
2646
2800
|
export type AgentOverrideConfig = z.infer<typeof AgentOverrideConfigSchema>;
|
|
@@ -37,6 +37,7 @@ export declare class BackgroundManager {
|
|
|
37
37
|
private queuesByKey;
|
|
38
38
|
private processingKeys;
|
|
39
39
|
private completionTimers;
|
|
40
|
+
private idleDeferralTimers;
|
|
40
41
|
constructor(ctx: PluginInput, config?: BackgroundTaskConfig, options?: {
|
|
41
42
|
tmuxConfig?: TmuxConfig;
|
|
42
43
|
onSubagentSessionCreated?: OnSubagentSessionCreated;
|
|
@@ -51,7 +52,7 @@ export declare class BackgroundManager {
|
|
|
51
52
|
findBySession(sessionID: string): BackgroundTask | undefined;
|
|
52
53
|
private getConcurrencyKeyFromInput;
|
|
53
54
|
/**
|
|
54
|
-
* Track a task created elsewhere (e.g., from
|
|
55
|
+
* Track a task created elsewhere (e.g., from task) for notification tracking.
|
|
55
56
|
* This allows tasks created by other tools to receive the same toast/prompt notifications.
|
|
56
57
|
*/
|
|
57
58
|
trackTask(input: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const INIT_DEEP_TEMPLATE = "# /init-deep\n\nGenerate hierarchical AGENTS.md files. Root + complexity-scored subdirectories.\n\n## Usage\n\n```\n/init-deep # Update mode: modify existing + create new where warranted\n/init-deep --create-new # Read existing \u2192 remove all \u2192 regenerate from scratch\n/init-deep --max-depth=2 # Limit directory depth (default: 3)\n```\n\n---\n\n## Workflow (High-Level)\n\n1. **Discovery + Analysis** (concurrent)\n - Fire background explore agents immediately\n - Main session: bash structure + LSP codemap + read existing AGENTS.md\n2. **Score & Decide** - Determine AGENTS.md locations from merged findings\n3. **Generate** - Root first, then subdirs in parallel\n4. **Review** - Deduplicate, trim, validate\n\n<critical>\n**TodoWrite ALL phases. Mark in_progress \u2192 completed in real-time.**\n```\nTodoWrite([\n { id: \"discovery\", content: \"Fire explore agents + LSP codemap + read existing\", status: \"pending\", priority: \"high\" },\n { id: \"scoring\", content: \"Score directories, determine locations\", status: \"pending\", priority: \"high\" },\n { id: \"generate\", content: \"Generate AGENTS.md files (root + subdirs)\", status: \"pending\", priority: \"high\" },\n { id: \"review\", content: \"Deduplicate, validate, trim\", status: \"pending\", priority: \"medium\" }\n])\n```\n</critical>\n\n---\n\n## Phase 1: Discovery + Analysis (Concurrent)\n\n**Mark \"discovery\" as in_progress.**\n\n### Fire Background Explore Agents IMMEDIATELY\n\nDon't wait\u2014these run async while main session works.\n\n```\n// Fire all at once, collect results later\ndelegate_task(agent=\"explore\", prompt=\"Project structure: PREDICT standard patterns for detected language \u2192 REPORT deviations only\")\ndelegate_task(agent=\"explore\", prompt=\"Entry points: FIND main files \u2192 REPORT non-standard organization\")\ndelegate_task(agent=\"explore\", prompt=\"Conventions: FIND config files (.eslintrc, pyproject.toml, .editorconfig) \u2192 REPORT project-specific rules\")\ndelegate_task(agent=\"explore\", prompt=\"Anti-patterns: FIND 'DO NOT', 'NEVER', 'ALWAYS', 'DEPRECATED' comments \u2192 LIST forbidden patterns\")\ndelegate_task(agent=\"explore\", prompt=\"Build/CI: FIND .github/workflows, Makefile \u2192 REPORT non-standard patterns\")\ndelegate_task(agent=\"explore\", prompt=\"Test patterns: FIND test configs, test structure \u2192 REPORT unique conventions\")\n```\n\n<dynamic-agents>\n**DYNAMIC AGENT SPAWNING**: After bash analysis, spawn ADDITIONAL explore agents based on project scale:\n\n| Factor | Threshold | Additional Agents |\n|--------|-----------|-------------------|\n| **Total files** | >100 | +1 per 100 files |\n| **Total lines** | >10k | +1 per 10k lines |\n| **Directory depth** | \u22654 | +2 for deep exploration |\n| **Large files (>500 lines)** | >10 files | +1 for complexity hotspots |\n| **Monorepo** | detected | +1 per package/workspace |\n| **Multiple languages** | >1 | +1 per language |\n\n```bash\n# Measure project scale first\ntotal_files=$(find . -type f -not -path '*/node_modules/*' -not -path '*/.git/*' | wc -l)\ntotal_lines=$(find . -type f \\( -name \"*.ts\" -o -name \"*.py\" -o -name \"*.go\" \\) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | tail -1 | awk '{print $1}')\nlarge_files=$(find . -type f \\( -name \"*.ts\" -o -name \"*.py\" \\) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | awk '$1 > 500 {count++} END {print count+0}')\nmax_depth=$(find . -type d -not -path '*/node_modules/*' -not -path '*/.git/*' | awk -F/ '{print NF}' | sort -rn | head -1)\n```\n\nExample spawning:\n```\n// 500 files, 50k lines, depth 6, 15 large files \u2192 spawn 5+5+2+1 = 13 additional agents\ndelegate_task(agent=\"explore\", prompt=\"Large file analysis: FIND files >500 lines, REPORT complexity hotspots\")\ndelegate_task(agent=\"explore\", prompt=\"Deep modules at depth 4+: FIND hidden patterns, internal conventions\")\ndelegate_task(agent=\"explore\", prompt=\"Cross-cutting concerns: FIND shared utilities across directories\")\n// ... more based on calculation\n```\n</dynamic-agents>\n\n### Main Session: Concurrent Analysis\n\n**While background agents run**, main session does:\n\n#### 1. Bash Structural Analysis\n```bash\n# Directory depth + file counts\nfind . -type d -not -path '*/\\.*' -not -path '*/node_modules/*' -not -path '*/venv/*' -not -path '*/dist/*' -not -path '*/build/*' | awk -F/ '{print NF-1}' | sort -n | uniq -c\n\n# Files per directory (top 30)\nfind . -type f -not -path '*/\\.*' -not -path '*/node_modules/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -30\n\n# Code concentration by extension\nfind . -type f \\( -name \"*.py\" -o -name \"*.ts\" -o -name \"*.tsx\" -o -name \"*.js\" -o -name \"*.go\" -o -name \"*.rs\" \\) -not -path '*/node_modules/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -20\n\n# Existing AGENTS.md / CLAUDE.md\nfind . -type f \\( -name \"AGENTS.md\" -o -name \"CLAUDE.md\" \\) -not -path '*/node_modules/*' 2>/dev/null\n```\n\n#### 2. Read Existing AGENTS.md\n```\nFor each existing file found:\n Read(filePath=file)\n Extract: key insights, conventions, anti-patterns\n Store in EXISTING_AGENTS map\n```\n\nIf `--create-new`: Read all existing first (preserve context) \u2192 then delete all \u2192 regenerate.\n\n#### 3. LSP Codemap (if available)\n```\nLspServers() # Check availability\n\n# Entry points (parallel)\nLspDocumentSymbols(filePath=\"src/index.ts\")\nLspDocumentSymbols(filePath=\"main.py\")\n\n# Key symbols (parallel)\nLspWorkspaceSymbols(filePath=\".\", query=\"class\")\nLspWorkspaceSymbols(filePath=\".\", query=\"interface\")\nLspWorkspaceSymbols(filePath=\".\", query=\"function\")\n\n# Centrality for top exports\nLspFindReferences(filePath=\"...\", line=X, character=Y)\n```\n\n**LSP Fallback**: If unavailable, rely on explore agents + AST-grep.\n\n### Collect Background Results\n\n```\n// After main session analysis done, collect all task results\nfor each task_id: background_output(task_id=\"...\")\n```\n\n**Merge: bash + LSP + existing + explore findings. Mark \"discovery\" as completed.**\n\n---\n\n## Phase 2: Scoring & Location Decision\n\n**Mark \"scoring\" as in_progress.**\n\n### Scoring Matrix\n\n| Factor | Weight | High Threshold | Source |\n|--------|--------|----------------|--------|\n| File count | 3x | >20 | bash |\n| Subdir count | 2x | >5 | bash |\n| Code ratio | 2x | >70% | bash |\n| Unique patterns | 1x | Has own config | explore |\n| Module boundary | 2x | Has index.ts/__init__.py | bash |\n| Symbol density | 2x | >30 symbols | LSP |\n| Export count | 2x | >10 exports | LSP |\n| Reference centrality | 3x | >20 refs | LSP |\n\n### Decision Rules\n\n| Score | Action |\n|-------|--------|\n| **Root (.)** | ALWAYS create |\n| **>15** | Create AGENTS.md |\n| **8-15** | Create if distinct domain |\n| **<8** | Skip (parent covers) |\n\n### Output\n```\nAGENTS_LOCATIONS = [\n { path: \".\", type: \"root\" },\n { path: \"src/hooks\", score: 18, reason: \"high complexity\" },\n { path: \"src/api\", score: 12, reason: \"distinct domain\" }\n]\n```\n\n**Mark \"scoring\" as completed.**\n\n---\n\n## Phase 3: Generate AGENTS.md\n\n**Mark \"generate\" as in_progress.**\n\n### Root AGENTS.md (Full Treatment)\n\n```markdown\n# PROJECT KNOWLEDGE BASE\n\n**Generated:** {TIMESTAMP}\n**Commit:** {SHORT_SHA}\n**Branch:** {BRANCH}\n\n## OVERVIEW\n{1-2 sentences: what + core stack}\n\n## STRUCTURE\n\\`\\`\\`\n{root}/\n\u251C\u2500\u2500 {dir}/ # {non-obvious purpose only}\n\u2514\u2500\u2500 {entry}\n\\`\\`\\`\n\n## WHERE TO LOOK\n| Task | Location | Notes |\n|------|----------|-------|\n\n## CODE MAP\n{From LSP - skip if unavailable or project <10 files}\n\n| Symbol | Type | Location | Refs | Role |\n|--------|------|----------|------|------|\n\n## CONVENTIONS\n{ONLY deviations from standard}\n\n## ANTI-PATTERNS (THIS PROJECT)\n{Explicitly forbidden here}\n\n## UNIQUE STYLES\n{Project-specific}\n\n## COMMANDS\n\\`\\`\\`bash\n{dev/test/build}\n\\`\\`\\`\n\n## NOTES\n{Gotchas}\n```\n\n**Quality gates**: 50-150 lines, no generic advice, no obvious info.\n\n### Subdirectory AGENTS.md (Parallel)\n\nLaunch writing tasks for each location:\n\n```\nfor loc in AGENTS_LOCATIONS (except root):\n delegate_task(category=\"writing\", load_skills=[], run_in_background=false, prompt=\\`\n Generate AGENTS.md for: ${loc.path}\n - Reason: ${loc.reason}\n - 30-80 lines max\n - NEVER repeat parent content\n - Sections: OVERVIEW (1 line), STRUCTURE (if >5 subdirs), WHERE TO LOOK, CONVENTIONS (if different), ANTI-PATTERNS\n \\`)\n```\n\n**Wait for all. Mark \"generate\" as completed.**\n\n---\n\n## Phase 4: Review & Deduplicate\n\n**Mark \"review\" as in_progress.**\n\nFor each generated file:\n- Remove generic advice\n- Remove parent duplicates\n- Trim to size limits\n- Verify telegraphic style\n\n**Mark \"review\" as completed.**\n\n---\n\n## Final Report\n\n```\n=== init-deep Complete ===\n\nMode: {update | create-new}\n\nFiles:\n [OK] ./AGENTS.md (root, {N} lines)\n [OK] ./src/hooks/AGENTS.md ({N} lines)\n\nDirs Analyzed: {N}\nAGENTS.md Created: {N}\nAGENTS.md Updated: {N}\n\nHierarchy:\n ./AGENTS.md\n \u2514\u2500\u2500 src/hooks/AGENTS.md\n```\n\n---\n\n## Anti-Patterns\n\n- **Static agent count**: MUST vary agents based on project size/depth\n- **Sequential execution**: MUST parallel (explore + LSP concurrent)\n- **Ignoring existing**: ALWAYS read existing first, even with --create-new\n- **Over-documenting**: Not every dir needs AGENTS.md\n- **Redundancy**: Child never repeats parent\n- **Generic content**: Remove anything that applies to ALL projects\n- **Verbose style**: Telegraphic or die";
|
|
1
|
+
export declare const INIT_DEEP_TEMPLATE = "# /init-deep\n\nGenerate hierarchical AGENTS.md files. Root + complexity-scored subdirectories.\n\n## Usage\n\n```\n/init-deep # Update mode: modify existing + create new where warranted\n/init-deep --create-new # Read existing \u2192 remove all \u2192 regenerate from scratch\n/init-deep --max-depth=2 # Limit directory depth (default: 3)\n```\n\n---\n\n## Workflow (High-Level)\n\n1. **Discovery + Analysis** (concurrent)\n - Fire background explore agents immediately\n - Main session: bash structure + LSP codemap + read existing AGENTS.md\n2. **Score & Decide** - Determine AGENTS.md locations from merged findings\n3. **Generate** - Root first, then subdirs in parallel\n4. **Review** - Deduplicate, trim, validate\n\n<critical>\n**TodoWrite ALL phases. Mark in_progress \u2192 completed in real-time.**\n```\nTodoWrite([\n { id: \"discovery\", content: \"Fire explore agents + LSP codemap + read existing\", status: \"pending\", priority: \"high\" },\n { id: \"scoring\", content: \"Score directories, determine locations\", status: \"pending\", priority: \"high\" },\n { id: \"generate\", content: \"Generate AGENTS.md files (root + subdirs)\", status: \"pending\", priority: \"high\" },\n { id: \"review\", content: \"Deduplicate, validate, trim\", status: \"pending\", priority: \"medium\" }\n])\n```\n</critical>\n\n---\n\n## Phase 1: Discovery + Analysis (Concurrent)\n\n**Mark \"discovery\" as in_progress.**\n\n### Fire Background Explore Agents IMMEDIATELY\n\nDon't wait\u2014these run async while main session works.\n\n```\n// Fire all at once, collect results later\ntask(subagent_type=\"explore\", load_skills=[], description=\"Explore project structure\", run_in_background=true, prompt=\"Project structure: PREDICT standard patterns for detected language \u2192 REPORT deviations only\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find entry points\", run_in_background=true, prompt=\"Entry points: FIND main files \u2192 REPORT non-standard organization\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find conventions\", run_in_background=true, prompt=\"Conventions: FIND config files (.eslintrc, pyproject.toml, .editorconfig) \u2192 REPORT project-specific rules\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find anti-patterns\", run_in_background=true, prompt=\"Anti-patterns: FIND 'DO NOT', 'NEVER', 'ALWAYS', 'DEPRECATED' comments \u2192 LIST forbidden patterns\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Explore build/CI\", run_in_background=true, prompt=\"Build/CI: FIND .github/workflows, Makefile \u2192 REPORT non-standard patterns\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find test patterns\", run_in_background=true, prompt=\"Test patterns: FIND test configs, test structure \u2192 REPORT unique conventions\")\n```\n\n<dynamic-agents>\n**DYNAMIC AGENT SPAWNING**: After bash analysis, spawn ADDITIONAL explore agents based on project scale:\n\n| Factor | Threshold | Additional Agents |\n|--------|-----------|-------------------|\n| **Total files** | >100 | +1 per 100 files |\n| **Total lines** | >10k | +1 per 10k lines |\n| **Directory depth** | \u22654 | +2 for deep exploration |\n| **Large files (>500 lines)** | >10 files | +1 for complexity hotspots |\n| **Monorepo** | detected | +1 per package/workspace |\n| **Multiple languages** | >1 | +1 per language |\n\n```bash\n# Measure project scale first\ntotal_files=$(find . -type f -not -path '*/node_modules/*' -not -path '*/.git/*' | wc -l)\ntotal_lines=$(find . -type f \\( -name \"*.ts\" -o -name \"*.py\" -o -name \"*.go\" \\) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | tail -1 | awk '{print $1}')\nlarge_files=$(find . -type f \\( -name \"*.ts\" -o -name \"*.py\" \\) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | awk '$1 > 500 {count++} END {print count+0}')\nmax_depth=$(find . -type d -not -path '*/node_modules/*' -not -path '*/.git/*' | awk -F/ '{print NF}' | sort -rn | head -1)\n```\n\nExample spawning:\n```\n// 500 files, 50k lines, depth 6, 15 large files \u2192 spawn 5+5+2+1 = 13 additional agents\ntask(subagent_type=\"explore\", load_skills=[], description=\"Analyze large files\", run_in_background=true, prompt=\"Large file analysis: FIND files >500 lines, REPORT complexity hotspots\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Explore deep modules\", run_in_background=true, prompt=\"Deep modules at depth 4+: FIND hidden patterns, internal conventions\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find shared utilities\", run_in_background=true, prompt=\"Cross-cutting concerns: FIND shared utilities across directories\")\n// ... more based on calculation\n```\n</dynamic-agents>\n\n### Main Session: Concurrent Analysis\n\n**While background agents run**, main session does:\n\n#### 1. Bash Structural Analysis\n```bash\n# Directory depth + file counts\nfind . -type d -not -path '*/\\.*' -not -path '*/node_modules/*' -not -path '*/venv/*' -not -path '*/dist/*' -not -path '*/build/*' | awk -F/ '{print NF-1}' | sort -n | uniq -c\n\n# Files per directory (top 30)\nfind . -type f -not -path '*/\\.*' -not -path '*/node_modules/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -30\n\n# Code concentration by extension\nfind . -type f \\( -name \"*.py\" -o -name \"*.ts\" -o -name \"*.tsx\" -o -name \"*.js\" -o -name \"*.go\" -o -name \"*.rs\" \\) -not -path '*/node_modules/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -20\n\n# Existing AGENTS.md / CLAUDE.md\nfind . -type f \\( -name \"AGENTS.md\" -o -name \"CLAUDE.md\" \\) -not -path '*/node_modules/*' 2>/dev/null\n```\n\n#### 2. Read Existing AGENTS.md\n```\nFor each existing file found:\n Read(filePath=file)\n Extract: key insights, conventions, anti-patterns\n Store in EXISTING_AGENTS map\n```\n\nIf `--create-new`: Read all existing first (preserve context) \u2192 then delete all \u2192 regenerate.\n\n#### 3. LSP Codemap (if available)\n```\nLspServers() # Check availability\n\n# Entry points (parallel)\nLspDocumentSymbols(filePath=\"src/index.ts\")\nLspDocumentSymbols(filePath=\"main.py\")\n\n# Key symbols (parallel)\nLspWorkspaceSymbols(filePath=\".\", query=\"class\")\nLspWorkspaceSymbols(filePath=\".\", query=\"interface\")\nLspWorkspaceSymbols(filePath=\".\", query=\"function\")\n\n# Centrality for top exports\nLspFindReferences(filePath=\"...\", line=X, character=Y)\n```\n\n**LSP Fallback**: If unavailable, rely on explore agents + AST-grep.\n\n### Collect Background Results\n\n```\n// After main session analysis done, collect all task results\nfor each task_id: background_output(task_id=\"...\")\n```\n\n**Merge: bash + LSP + existing + explore findings. Mark \"discovery\" as completed.**\n\n---\n\n## Phase 2: Scoring & Location Decision\n\n**Mark \"scoring\" as in_progress.**\n\n### Scoring Matrix\n\n| Factor | Weight | High Threshold | Source |\n|--------|--------|----------------|--------|\n| File count | 3x | >20 | bash |\n| Subdir count | 2x | >5 | bash |\n| Code ratio | 2x | >70% | bash |\n| Unique patterns | 1x | Has own config | explore |\n| Module boundary | 2x | Has index.ts/__init__.py | bash |\n| Symbol density | 2x | >30 symbols | LSP |\n| Export count | 2x | >10 exports | LSP |\n| Reference centrality | 3x | >20 refs | LSP |\n\n### Decision Rules\n\n| Score | Action |\n|-------|--------|\n| **Root (.)** | ALWAYS create |\n| **>15** | Create AGENTS.md |\n| **8-15** | Create if distinct domain |\n| **<8** | Skip (parent covers) |\n\n### Output\n```\nAGENTS_LOCATIONS = [\n { path: \".\", type: \"root\" },\n { path: \"src/hooks\", score: 18, reason: \"high complexity\" },\n { path: \"src/api\", score: 12, reason: \"distinct domain\" }\n]\n```\n\n**Mark \"scoring\" as completed.**\n\n---\n\n## Phase 3: Generate AGENTS.md\n\n**Mark \"generate\" as in_progress.**\n\n<critical>\n**File Writing Rule**: If AGENTS.md already exists at the target path \u2192 use `Edit` tool. If it does NOT exist \u2192 use `Write` tool.\nNEVER use Write to overwrite an existing file. ALWAYS check existence first via `Read` or discovery results.\n</critical>\n\n### Root AGENTS.md (Full Treatment)\n\n```markdown\n# PROJECT KNOWLEDGE BASE\n\n**Generated:** {TIMESTAMP}\n**Commit:** {SHORT_SHA}\n**Branch:** {BRANCH}\n\n## OVERVIEW\n{1-2 sentences: what + core stack}\n\n## STRUCTURE\n\\`\\`\\`\n{root}/\n\u251C\u2500\u2500 {dir}/ # {non-obvious purpose only}\n\u2514\u2500\u2500 {entry}\n\\`\\`\\`\n\n## WHERE TO LOOK\n| Task | Location | Notes |\n|------|----------|-------|\n\n## CODE MAP\n{From LSP - skip if unavailable or project <10 files}\n\n| Symbol | Type | Location | Refs | Role |\n|--------|------|----------|------|------|\n\n## CONVENTIONS\n{ONLY deviations from standard}\n\n## ANTI-PATTERNS (THIS PROJECT)\n{Explicitly forbidden here}\n\n## UNIQUE STYLES\n{Project-specific}\n\n## COMMANDS\n\\`\\`\\`bash\n{dev/test/build}\n\\`\\`\\`\n\n## NOTES\n{Gotchas}\n```\n\n**Quality gates**: 50-150 lines, no generic advice, no obvious info.\n\n### Subdirectory AGENTS.md (Parallel)\n\nLaunch writing tasks for each location:\n\n```\nfor loc in AGENTS_LOCATIONS (except root):\n task(category=\"writing\", load_skills=[], run_in_background=false, description=\"Generate AGENTS.md\", prompt=\\`\n Generate AGENTS.md for: ${loc.path}\n - Reason: ${loc.reason}\n - 30-80 lines max\n - NEVER repeat parent content\n - Sections: OVERVIEW (1 line), STRUCTURE (if >5 subdirs), WHERE TO LOOK, CONVENTIONS (if different), ANTI-PATTERNS\n \\`)\n```\n\n**Wait for all. Mark \"generate\" as completed.**\n\n---\n\n## Phase 4: Review & Deduplicate\n\n**Mark \"review\" as in_progress.**\n\nFor each generated file:\n- Remove generic advice\n- Remove parent duplicates\n- Trim to size limits\n- Verify telegraphic style\n\n**Mark \"review\" as completed.**\n\n---\n\n## Final Report\n\n```\n=== init-deep Complete ===\n\nMode: {update | create-new}\n\nFiles:\n [OK] ./AGENTS.md (root, {N} lines)\n [OK] ./src/hooks/AGENTS.md ({N} lines)\n\nDirs Analyzed: {N}\nAGENTS.md Created: {N}\nAGENTS.md Updated: {N}\n\nHierarchy:\n ./AGENTS.md\n \u2514\u2500\u2500 src/hooks/AGENTS.md\n```\n\n---\n\n## Anti-Patterns\n\n- **Static agent count**: MUST vary agents based on project size/depth\n- **Sequential execution**: MUST parallel (explore + LSP concurrent)\n- **Ignoring existing**: ALWAYS read existing first, even with --create-new\n- **Over-documenting**: Not every dir needs AGENTS.md\n- **Redundancy**: Child never repeats parent\n- **Generic content**: Remove anything that applies to ALL projects\n- **Verbose style**: Telegraphic or die";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pending tool metadata store.
|
|
3
|
+
*
|
|
4
|
+
* OpenCode's `fromPlugin()` wrapper always replaces the metadata returned by
|
|
5
|
+
* plugin tools with `{ truncated, outputPath }`, discarding any sessionId,
|
|
6
|
+
* title, or custom metadata set during `execute()`.
|
|
7
|
+
*
|
|
8
|
+
* This store captures metadata written via `ctx.metadata()` inside execute(),
|
|
9
|
+
* then the `tool.execute.after` hook consumes it and merges it back into the
|
|
10
|
+
* result *before* the processor writes the final part to the session store.
|
|
11
|
+
*
|
|
12
|
+
* Flow:
|
|
13
|
+
* execute() → storeToolMetadata(sessionID, callID, data)
|
|
14
|
+
* fromPlugin() → overwrites metadata with { truncated }
|
|
15
|
+
* tool.execute.after → consumeToolMetadata(sessionID, callID) → merges back
|
|
16
|
+
* processor → Session.updatePart(status:"completed", metadata: result.metadata)
|
|
17
|
+
*/
|
|
18
|
+
export interface PendingToolMetadata {
|
|
19
|
+
title?: string;
|
|
20
|
+
metadata?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Store metadata to be restored after fromPlugin() overwrites it.
|
|
24
|
+
* Called from tool execute() functions alongside ctx.metadata().
|
|
25
|
+
*/
|
|
26
|
+
export declare function storeToolMetadata(sessionID: string, callID: string, data: PendingToolMetadata): void;
|
|
27
|
+
/**
|
|
28
|
+
* Consume stored metadata (one-time read, removes from store).
|
|
29
|
+
* Called from tool.execute.after hook.
|
|
30
|
+
*/
|
|
31
|
+
export declare function consumeToolMetadata(sessionID: string, callID: string): PendingToolMetadata | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Get current store size (for testing/debugging).
|
|
34
|
+
*/
|
|
35
|
+
export declare function getPendingStoreSize(): number;
|
|
36
|
+
/**
|
|
37
|
+
* Clear all pending metadata (for testing).
|
|
38
|
+
*/
|
|
39
|
+
export declare function clearPendingStore(): void;
|
|
@@ -2,4 +2,4 @@ export declare const OPENCODE_STORAGE: string;
|
|
|
2
2
|
export declare const AGENT_USAGE_REMINDER_STORAGE: string;
|
|
3
3
|
export declare const TARGET_TOOLS: Set<string>;
|
|
4
4
|
export declare const AGENT_TOOLS: Set<string>;
|
|
5
|
-
export declare const REMINDER_MESSAGE = "\n[Agent Usage Reminder]\n\nYou called a search/fetch tool directly without leveraging specialized agents.\n\nRECOMMENDED: Use
|
|
5
|
+
export declare const REMINDER_MESSAGE = "\n[Agent Usage Reminder]\n\nYou called a search/fetch tool directly without leveraging specialized agents.\n\nRECOMMENDED: Use task with explore/librarian agents for better results:\n\n```\n// Parallel exploration - fire multiple agents simultaneously\ntask(agent=\"explore\", prompt=\"Find all files matching pattern X\")\ntask(agent=\"explore\", prompt=\"Search for implementation of Y\") \ntask(agent=\"librarian\", prompt=\"Lookup documentation for Z\")\n\n// Then continue your work while they run in background\n// System will notify you when each completes\n```\n\nWHY:\n- Agents can perform deeper, more thorough searches\n- Background tasks run in parallel, saving time\n- Specialized agents have domain expertise\n- Reduces context window usage in main session\n\nALWAYS prefer: Multiple parallel task calls > Direct tool calls\n";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ParsedTokenLimitError } from "./types";
|
|
2
|
+
import type { ExperimentalConfig } from "../../config";
|
|
3
|
+
export declare function attemptDeduplicationRecovery(sessionID: string, parsed: ParsedTokenLimitError, experimental: ExperimentalConfig | undefined): Promise<void>;
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface AnthropicContextWindowLimitRecoveryOptions {
|
|
4
|
-
experimental?: ExperimentalConfig;
|
|
5
|
-
}
|
|
6
|
-
export declare function createAnthropicContextWindowLimitRecoveryHook(ctx: PluginInput, options?: AnthropicContextWindowLimitRecoveryOptions): {
|
|
7
|
-
event: ({ event }: {
|
|
8
|
-
event: {
|
|
9
|
-
type: string;
|
|
10
|
-
properties?: unknown;
|
|
11
|
-
};
|
|
12
|
-
}) => Promise<void>;
|
|
13
|
-
};
|
|
1
|
+
export { createAnthropicContextWindowLimitRecoveryHook } from "./recovery-hook";
|
|
2
|
+
export type { AnthropicContextWindowLimitRecoveryOptions } from "./recovery-hook";
|
|
14
3
|
export type { AutoCompactState, ParsedTokenLimitError, TruncateState } from "./types";
|
|
15
4
|
export { parseAnthropicTokenLimitError } from "./parser";
|
|
16
5
|
export { executeCompact, getLastAssistant } from "./executor";
|