oh-my-opencode 2.5.3 → 2.6.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/README.ja.md +27 -20
- package/README.ko.md +27 -20
- package/README.md +57 -20
- package/README.zh-cn.md +27 -20
- package/dist/cli/get-local-version/formatter.d.ts +3 -0
- package/dist/cli/get-local-version/index.d.ts +3 -0
- package/dist/cli/get-local-version/types.d.ts +13 -0
- package/dist/cli/index.js +1422 -129
- package/dist/cli/run/events.d.ts +4 -0
- package/dist/cli/run/types.d.ts +26 -0
- package/dist/config/index.d.ts +1 -1
- package/dist/config/schema.d.ts +92 -7
- package/dist/features/background-agent/manager.d.ts +1 -0
- package/dist/features/background-agent/types.d.ts +8 -0
- package/dist/features/claude-code-plugin-loader/index.d.ts +3 -0
- package/dist/features/claude-code-plugin-loader/loader.d.ts +20 -0
- package/dist/features/claude-code-plugin-loader/types.d.ts +173 -0
- package/dist/hooks/anthropic-auto-compact/executor.test.d.ts +1 -0
- package/dist/hooks/anthropic-auto-compact/index.d.ts +1 -1
- package/dist/hooks/anthropic-auto-compact/pruning-deduplication.d.ts +7 -0
- package/dist/hooks/anthropic-auto-compact/pruning-deduplication.test.d.ts +1 -0
- package/dist/hooks/anthropic-auto-compact/pruning-executor.d.ts +3 -0
- package/dist/hooks/anthropic-auto-compact/pruning-purge-errors.d.ts +7 -0
- package/dist/hooks/anthropic-auto-compact/pruning-storage.d.ts +2 -0
- package/dist/hooks/anthropic-auto-compact/pruning-supersede.d.ts +6 -0
- package/dist/hooks/anthropic-auto-compact/pruning-types.d.ts +36 -0
- package/dist/hooks/anthropic-auto-compact/types.d.ts +5 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/session-notification-utils.d.ts +9 -0
- package/dist/hooks/thinking-block-validator/index.d.ts +30 -0
- package/dist/index.js +2946 -814
- package/dist/shared/claude-config-dir.d.ts +1 -0
- package/dist/shared/claude-config-dir.test.d.ts +1 -0
- package/dist/shared/index.d.ts +2 -0
- package/dist/shared/jsonc-parser.d.ts +15 -0
- package/dist/shared/jsonc-parser.test.d.ts +1 -0
- package/dist/tools/ast-grep/index.d.ts +2 -90
- package/dist/tools/ast-grep/tools.d.ts +3 -88
- package/dist/tools/background-task/tools.d.ts +4 -38
- package/dist/tools/call-omo-agent/tools.d.ts +2 -21
- package/dist/tools/glob/tools.d.ts +2 -11
- package/dist/tools/grep/tools.d.ts +2 -13
- package/dist/tools/index.d.ts +3 -367
- package/dist/tools/interactive-bash/tools.d.ts +2 -9
- package/dist/tools/look-at/tools.d.ts +2 -12
- package/dist/tools/lsp/tools.d.ts +12 -152
- package/dist/tools/session-manager/tools.d.ts +5 -52
- package/dist/tools/slashcommand/tools.d.ts +2 -9
- package/package.json +2 -1
package/dist/cli/run/events.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { RunContext } from "./types";
|
|
2
2
|
export interface EventState {
|
|
3
3
|
mainSessionIdle: boolean;
|
|
4
|
+
mainSessionError: boolean;
|
|
5
|
+
lastError: string | null;
|
|
4
6
|
lastOutput: string;
|
|
7
|
+
lastPartText: string;
|
|
8
|
+
currentTool: string | null;
|
|
5
9
|
}
|
|
6
10
|
export declare function createEventState(): EventState;
|
|
7
11
|
export declare function processEvents(ctx: RunContext, stream: AsyncIterable<unknown>, state: EventState): Promise<void>;
|
package/dist/cli/run/types.d.ts
CHANGED
|
@@ -43,3 +43,29 @@ export interface MessageUpdatedProps {
|
|
|
43
43
|
};
|
|
44
44
|
content?: string;
|
|
45
45
|
}
|
|
46
|
+
export interface MessagePartUpdatedProps {
|
|
47
|
+
info?: {
|
|
48
|
+
sessionID?: string;
|
|
49
|
+
role?: string;
|
|
50
|
+
};
|
|
51
|
+
part?: {
|
|
52
|
+
type?: string;
|
|
53
|
+
text?: string;
|
|
54
|
+
name?: string;
|
|
55
|
+
input?: unknown;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export interface ToolExecuteProps {
|
|
59
|
+
sessionID?: string;
|
|
60
|
+
name?: string;
|
|
61
|
+
input?: Record<string, unknown>;
|
|
62
|
+
}
|
|
63
|
+
export interface ToolResultProps {
|
|
64
|
+
sessionID?: string;
|
|
65
|
+
name?: string;
|
|
66
|
+
output?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface SessionErrorProps {
|
|
69
|
+
sessionID?: string;
|
|
70
|
+
error?: unknown;
|
|
71
|
+
}
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { OhMyOpenCodeConfigSchema, AgentOverrideConfigSchema, AgentOverridesSchema, McpNameSchema, AgentNameSchema, HookNameSchema, SisyphusAgentConfigSchema, ExperimentalConfigSchema, } from "./schema";
|
|
2
|
-
export type { OhMyOpenCodeConfig, AgentOverrideConfig, AgentOverrides, McpName, AgentName, HookName, SisyphusAgentConfig, ExperimentalConfig, } from "./schema";
|
|
2
|
+
export type { OhMyOpenCodeConfig, AgentOverrideConfig, AgentOverrides, McpName, AgentName, HookName, SisyphusAgentConfig, ExperimentalConfig, DynamicContextPruningConfig, } from "./schema";
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare const OverridableAgentNameSchema: z.ZodEnum<{
|
|
|
18
18
|
"multimodal-looker": "multimodal-looker";
|
|
19
19
|
build: "build";
|
|
20
20
|
plan: "plan";
|
|
21
|
-
"Builder
|
|
21
|
+
"OpenCode-Builder": "OpenCode-Builder";
|
|
22
22
|
"Planner-Sisyphus": "Planner-Sisyphus";
|
|
23
23
|
}>;
|
|
24
24
|
export declare const AgentNameSchema: z.ZodEnum<{
|
|
@@ -52,6 +52,7 @@ export declare const HookNameSchema: z.ZodEnum<{
|
|
|
52
52
|
"non-interactive-env": "non-interactive-env";
|
|
53
53
|
"interactive-bash-session": "interactive-bash-session";
|
|
54
54
|
"empty-message-sanitizer": "empty-message-sanitizer";
|
|
55
|
+
"thinking-block-validator": "thinking-block-validator";
|
|
55
56
|
}>;
|
|
56
57
|
export declare const AgentOverrideConfigSchema: z.ZodObject<{
|
|
57
58
|
model: z.ZodOptional<z.ZodString>;
|
|
@@ -242,7 +243,7 @@ export declare const AgentOverridesSchema: z.ZodObject<{
|
|
|
242
243
|
}>>;
|
|
243
244
|
}, z.core.$strip>>;
|
|
244
245
|
}, z.core.$strip>>;
|
|
245
|
-
"Builder
|
|
246
|
+
"OpenCode-Builder": z.ZodOptional<z.ZodObject<{
|
|
246
247
|
model: z.ZodOptional<z.ZodString>;
|
|
247
248
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
248
249
|
top_p: z.ZodOptional<z.ZodNumber>;
|
|
@@ -625,20 +626,74 @@ export declare const ClaudeCodeConfigSchema: z.ZodObject<{
|
|
|
625
626
|
skills: z.ZodOptional<z.ZodBoolean>;
|
|
626
627
|
agents: z.ZodOptional<z.ZodBoolean>;
|
|
627
628
|
hooks: z.ZodOptional<z.ZodBoolean>;
|
|
629
|
+
plugins: z.ZodOptional<z.ZodBoolean>;
|
|
630
|
+
plugins_override: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
628
631
|
}, z.core.$strip>;
|
|
629
632
|
export declare const SisyphusAgentConfigSchema: z.ZodObject<{
|
|
630
633
|
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
631
|
-
|
|
634
|
+
default_builder_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
632
635
|
planner_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
633
|
-
replace_build: z.ZodOptional<z.ZodBoolean>;
|
|
634
636
|
replace_plan: z.ZodOptional<z.ZodBoolean>;
|
|
635
637
|
}, z.core.$strip>;
|
|
638
|
+
export declare const DynamicContextPruningConfigSchema: z.ZodObject<{
|
|
639
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
640
|
+
notification: z.ZodDefault<z.ZodEnum<{
|
|
641
|
+
off: "off";
|
|
642
|
+
minimal: "minimal";
|
|
643
|
+
detailed: "detailed";
|
|
644
|
+
}>>;
|
|
645
|
+
turn_protection: z.ZodOptional<z.ZodObject<{
|
|
646
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
647
|
+
turns: z.ZodDefault<z.ZodNumber>;
|
|
648
|
+
}, z.core.$strip>>;
|
|
649
|
+
protected_tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
650
|
+
strategies: z.ZodOptional<z.ZodObject<{
|
|
651
|
+
deduplication: z.ZodOptional<z.ZodObject<{
|
|
652
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
653
|
+
}, z.core.$strip>>;
|
|
654
|
+
supersede_writes: z.ZodOptional<z.ZodObject<{
|
|
655
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
656
|
+
aggressive: z.ZodDefault<z.ZodBoolean>;
|
|
657
|
+
}, z.core.$strip>>;
|
|
658
|
+
purge_errors: z.ZodOptional<z.ZodObject<{
|
|
659
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
660
|
+
turns: z.ZodDefault<z.ZodNumber>;
|
|
661
|
+
}, z.core.$strip>>;
|
|
662
|
+
}, z.core.$strip>>;
|
|
663
|
+
}, z.core.$strip>;
|
|
636
664
|
export declare const ExperimentalConfigSchema: z.ZodObject<{
|
|
637
665
|
aggressive_truncation: z.ZodOptional<z.ZodBoolean>;
|
|
638
666
|
auto_resume: z.ZodOptional<z.ZodBoolean>;
|
|
639
667
|
preemptive_compaction: z.ZodOptional<z.ZodBoolean>;
|
|
640
668
|
preemptive_compaction_threshold: z.ZodOptional<z.ZodNumber>;
|
|
641
669
|
truncate_all_tool_outputs: z.ZodDefault<z.ZodBoolean>;
|
|
670
|
+
dynamic_context_pruning: z.ZodOptional<z.ZodObject<{
|
|
671
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
672
|
+
notification: z.ZodDefault<z.ZodEnum<{
|
|
673
|
+
off: "off";
|
|
674
|
+
minimal: "minimal";
|
|
675
|
+
detailed: "detailed";
|
|
676
|
+
}>>;
|
|
677
|
+
turn_protection: z.ZodOptional<z.ZodObject<{
|
|
678
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
679
|
+
turns: z.ZodDefault<z.ZodNumber>;
|
|
680
|
+
}, z.core.$strip>>;
|
|
681
|
+
protected_tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
682
|
+
strategies: z.ZodOptional<z.ZodObject<{
|
|
683
|
+
deduplication: z.ZodOptional<z.ZodObject<{
|
|
684
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
685
|
+
}, z.core.$strip>>;
|
|
686
|
+
supersede_writes: z.ZodOptional<z.ZodObject<{
|
|
687
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
688
|
+
aggressive: z.ZodDefault<z.ZodBoolean>;
|
|
689
|
+
}, z.core.$strip>>;
|
|
690
|
+
purge_errors: z.ZodOptional<z.ZodObject<{
|
|
691
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
692
|
+
turns: z.ZodDefault<z.ZodNumber>;
|
|
693
|
+
}, z.core.$strip>>;
|
|
694
|
+
}, z.core.$strip>>;
|
|
695
|
+
}, z.core.$strip>>;
|
|
696
|
+
dcp_on_compaction_failure: z.ZodOptional<z.ZodBoolean>;
|
|
642
697
|
}, z.core.$strip>;
|
|
643
698
|
export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
644
699
|
$schema: z.ZodOptional<z.ZodString>;
|
|
@@ -678,6 +733,7 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
678
733
|
"non-interactive-env": "non-interactive-env";
|
|
679
734
|
"interactive-bash-session": "interactive-bash-session";
|
|
680
735
|
"empty-message-sanitizer": "empty-message-sanitizer";
|
|
736
|
+
"thinking-block-validator": "thinking-block-validator";
|
|
681
737
|
}>>>;
|
|
682
738
|
agents: z.ZodOptional<z.ZodObject<{
|
|
683
739
|
build: z.ZodOptional<z.ZodObject<{
|
|
@@ -821,7 +877,7 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
821
877
|
}>>;
|
|
822
878
|
}, z.core.$strip>>;
|
|
823
879
|
}, z.core.$strip>>;
|
|
824
|
-
"Builder
|
|
880
|
+
"OpenCode-Builder": z.ZodOptional<z.ZodObject<{
|
|
825
881
|
model: z.ZodOptional<z.ZodString>;
|
|
826
882
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
827
883
|
top_p: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1204,13 +1260,14 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
1204
1260
|
skills: z.ZodOptional<z.ZodBoolean>;
|
|
1205
1261
|
agents: z.ZodOptional<z.ZodBoolean>;
|
|
1206
1262
|
hooks: z.ZodOptional<z.ZodBoolean>;
|
|
1263
|
+
plugins: z.ZodOptional<z.ZodBoolean>;
|
|
1264
|
+
plugins_override: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
1207
1265
|
}, z.core.$strip>>;
|
|
1208
1266
|
google_auth: z.ZodOptional<z.ZodBoolean>;
|
|
1209
1267
|
sisyphus_agent: z.ZodOptional<z.ZodObject<{
|
|
1210
1268
|
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
1211
|
-
|
|
1269
|
+
default_builder_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
1212
1270
|
planner_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
1213
|
-
replace_build: z.ZodOptional<z.ZodBoolean>;
|
|
1214
1271
|
replace_plan: z.ZodOptional<z.ZodBoolean>;
|
|
1215
1272
|
}, z.core.$strip>>;
|
|
1216
1273
|
experimental: z.ZodOptional<z.ZodObject<{
|
|
@@ -1219,6 +1276,33 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
1219
1276
|
preemptive_compaction: z.ZodOptional<z.ZodBoolean>;
|
|
1220
1277
|
preemptive_compaction_threshold: z.ZodOptional<z.ZodNumber>;
|
|
1221
1278
|
truncate_all_tool_outputs: z.ZodDefault<z.ZodBoolean>;
|
|
1279
|
+
dynamic_context_pruning: z.ZodOptional<z.ZodObject<{
|
|
1280
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1281
|
+
notification: z.ZodDefault<z.ZodEnum<{
|
|
1282
|
+
off: "off";
|
|
1283
|
+
minimal: "minimal";
|
|
1284
|
+
detailed: "detailed";
|
|
1285
|
+
}>>;
|
|
1286
|
+
turn_protection: z.ZodOptional<z.ZodObject<{
|
|
1287
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1288
|
+
turns: z.ZodDefault<z.ZodNumber>;
|
|
1289
|
+
}, z.core.$strip>>;
|
|
1290
|
+
protected_tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1291
|
+
strategies: z.ZodOptional<z.ZodObject<{
|
|
1292
|
+
deduplication: z.ZodOptional<z.ZodObject<{
|
|
1293
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1294
|
+
}, z.core.$strip>>;
|
|
1295
|
+
supersede_writes: z.ZodOptional<z.ZodObject<{
|
|
1296
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1297
|
+
aggressive: z.ZodDefault<z.ZodBoolean>;
|
|
1298
|
+
}, z.core.$strip>>;
|
|
1299
|
+
purge_errors: z.ZodOptional<z.ZodObject<{
|
|
1300
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1301
|
+
turns: z.ZodDefault<z.ZodNumber>;
|
|
1302
|
+
}, z.core.$strip>>;
|
|
1303
|
+
}, z.core.$strip>>;
|
|
1304
|
+
}, z.core.$strip>>;
|
|
1305
|
+
dcp_on_compaction_failure: z.ZodOptional<z.ZodBoolean>;
|
|
1222
1306
|
}, z.core.$strip>>;
|
|
1223
1307
|
auto_update: z.ZodOptional<z.ZodBoolean>;
|
|
1224
1308
|
}, z.core.$strip>;
|
|
@@ -1229,4 +1313,5 @@ export type AgentName = z.infer<typeof AgentNameSchema>;
|
|
|
1229
1313
|
export type HookName = z.infer<typeof HookNameSchema>;
|
|
1230
1314
|
export type SisyphusAgentConfig = z.infer<typeof SisyphusAgentConfigSchema>;
|
|
1231
1315
|
export type ExperimentalConfig = z.infer<typeof ExperimentalConfigSchema>;
|
|
1316
|
+
export type DynamicContextPruningConfig = z.infer<typeof DynamicContextPruningConfigSchema>;
|
|
1232
1317
|
export { McpNameSchema, type McpName } from "../mcp/types";
|
|
@@ -20,6 +20,10 @@ export interface BackgroundTask {
|
|
|
20
20
|
result?: string;
|
|
21
21
|
error?: string;
|
|
22
22
|
progress?: TaskProgress;
|
|
23
|
+
parentModel?: {
|
|
24
|
+
providerID: string;
|
|
25
|
+
modelID: string;
|
|
26
|
+
};
|
|
23
27
|
}
|
|
24
28
|
export interface LaunchInput {
|
|
25
29
|
description: string;
|
|
@@ -27,4 +31,8 @@ export interface LaunchInput {
|
|
|
27
31
|
agent: string;
|
|
28
32
|
parentSessionID: string;
|
|
29
33
|
parentMessageID: string;
|
|
34
|
+
parentModel?: {
|
|
35
|
+
providerID: string;
|
|
36
|
+
modelID: string;
|
|
37
|
+
};
|
|
30
38
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AgentConfig } from "@opencode-ai/sdk";
|
|
2
|
+
import type { CommandDefinition } from "../claude-code-command-loader/types";
|
|
3
|
+
import type { McpServerConfig } from "../claude-code-mcp-loader/types";
|
|
4
|
+
import type { LoadedPlugin, PluginLoadResult, PluginLoadError, HooksConfig, PluginLoaderOptions } from "./types";
|
|
5
|
+
export declare function discoverInstalledPlugins(options?: PluginLoaderOptions): PluginLoadResult;
|
|
6
|
+
export declare function loadPluginCommands(plugins: LoadedPlugin[]): Record<string, CommandDefinition>;
|
|
7
|
+
export declare function loadPluginSkillsAsCommands(plugins: LoadedPlugin[]): Record<string, CommandDefinition>;
|
|
8
|
+
export declare function loadPluginAgents(plugins: LoadedPlugin[]): Record<string, AgentConfig>;
|
|
9
|
+
export declare function loadPluginMcpServers(plugins: LoadedPlugin[]): Promise<Record<string, McpServerConfig>>;
|
|
10
|
+
export declare function loadPluginHooksConfigs(plugins: LoadedPlugin[]): HooksConfig[];
|
|
11
|
+
export interface PluginComponentsResult {
|
|
12
|
+
commands: Record<string, CommandDefinition>;
|
|
13
|
+
skills: Record<string, CommandDefinition>;
|
|
14
|
+
agents: Record<string, AgentConfig>;
|
|
15
|
+
mcpServers: Record<string, McpServerConfig>;
|
|
16
|
+
hooksConfigs: HooksConfig[];
|
|
17
|
+
plugins: LoadedPlugin[];
|
|
18
|
+
errors: PluginLoadError[];
|
|
19
|
+
}
|
|
20
|
+
export declare function loadAllPluginComponents(options?: PluginLoaderOptions): Promise<PluginComponentsResult>;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code Plugin Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for Claude Code plugin system compatibility.
|
|
5
|
+
* Based on https://code.claude.com/docs/en/plugins-reference
|
|
6
|
+
*/
|
|
7
|
+
export type PluginScope = "user" | "project" | "local" | "managed";
|
|
8
|
+
/**
|
|
9
|
+
* Plugin installation entry in installed_plugins.json
|
|
10
|
+
*/
|
|
11
|
+
export interface PluginInstallation {
|
|
12
|
+
scope: PluginScope;
|
|
13
|
+
installPath: string;
|
|
14
|
+
version: string;
|
|
15
|
+
installedAt: string;
|
|
16
|
+
lastUpdated: string;
|
|
17
|
+
gitCommitSha?: string;
|
|
18
|
+
isLocal?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Installed plugins database structure
|
|
22
|
+
* Located at ~/.claude/plugins/installed_plugins.json
|
|
23
|
+
*/
|
|
24
|
+
export interface InstalledPluginsDatabase {
|
|
25
|
+
version: number;
|
|
26
|
+
plugins: Record<string, PluginInstallation[]>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Plugin author information
|
|
30
|
+
*/
|
|
31
|
+
export interface PluginAuthor {
|
|
32
|
+
name?: string;
|
|
33
|
+
email?: string;
|
|
34
|
+
url?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Plugin manifest (plugin.json)
|
|
38
|
+
* Located at <plugin_root>/.claude-plugin/plugin.json
|
|
39
|
+
*/
|
|
40
|
+
export interface PluginManifest {
|
|
41
|
+
name: string;
|
|
42
|
+
version?: string;
|
|
43
|
+
description?: string;
|
|
44
|
+
author?: PluginAuthor;
|
|
45
|
+
homepage?: string;
|
|
46
|
+
repository?: string;
|
|
47
|
+
license?: string;
|
|
48
|
+
keywords?: string[];
|
|
49
|
+
commands?: string | string[];
|
|
50
|
+
agents?: string | string[];
|
|
51
|
+
skills?: string | string[];
|
|
52
|
+
hooks?: string | HooksConfig;
|
|
53
|
+
mcpServers?: string | McpServersConfig;
|
|
54
|
+
lspServers?: string | LspServersConfig;
|
|
55
|
+
outputStyles?: string | string[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Hooks configuration
|
|
59
|
+
*/
|
|
60
|
+
export interface HookEntry {
|
|
61
|
+
type: "command" | "prompt" | "agent";
|
|
62
|
+
command?: string;
|
|
63
|
+
prompt?: string;
|
|
64
|
+
agent?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface HookMatcher {
|
|
67
|
+
matcher?: string;
|
|
68
|
+
hooks: HookEntry[];
|
|
69
|
+
}
|
|
70
|
+
export interface HooksConfig {
|
|
71
|
+
hooks?: {
|
|
72
|
+
PreToolUse?: HookMatcher[];
|
|
73
|
+
PostToolUse?: HookMatcher[];
|
|
74
|
+
PostToolUseFailure?: HookMatcher[];
|
|
75
|
+
PermissionRequest?: HookMatcher[];
|
|
76
|
+
UserPromptSubmit?: HookMatcher[];
|
|
77
|
+
Notification?: HookMatcher[];
|
|
78
|
+
Stop?: HookMatcher[];
|
|
79
|
+
SubagentStart?: HookMatcher[];
|
|
80
|
+
SubagentStop?: HookMatcher[];
|
|
81
|
+
SessionStart?: HookMatcher[];
|
|
82
|
+
SessionEnd?: HookMatcher[];
|
|
83
|
+
PreCompact?: HookMatcher[];
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* MCP servers configuration in plugin
|
|
88
|
+
*/
|
|
89
|
+
export interface PluginMcpServer {
|
|
90
|
+
command?: string;
|
|
91
|
+
args?: string[];
|
|
92
|
+
env?: Record<string, string>;
|
|
93
|
+
cwd?: string;
|
|
94
|
+
url?: string;
|
|
95
|
+
type?: "stdio" | "http" | "sse";
|
|
96
|
+
disabled?: boolean;
|
|
97
|
+
}
|
|
98
|
+
export interface McpServersConfig {
|
|
99
|
+
mcpServers?: Record<string, PluginMcpServer>;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* LSP server configuration
|
|
103
|
+
*/
|
|
104
|
+
export interface LspServerConfig {
|
|
105
|
+
command: string;
|
|
106
|
+
args?: string[];
|
|
107
|
+
extensionToLanguage: Record<string, string>;
|
|
108
|
+
transport?: "stdio" | "socket";
|
|
109
|
+
env?: Record<string, string>;
|
|
110
|
+
initializationOptions?: Record<string, unknown>;
|
|
111
|
+
settings?: Record<string, unknown>;
|
|
112
|
+
workspaceFolder?: string;
|
|
113
|
+
startupTimeout?: number;
|
|
114
|
+
shutdownTimeout?: number;
|
|
115
|
+
restartOnCrash?: boolean;
|
|
116
|
+
maxRestarts?: number;
|
|
117
|
+
loggingConfig?: {
|
|
118
|
+
args?: string[];
|
|
119
|
+
env?: Record<string, string>;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export interface LspServersConfig {
|
|
123
|
+
[language: string]: LspServerConfig;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Loaded plugin with all resolved components
|
|
127
|
+
*/
|
|
128
|
+
export interface LoadedPlugin {
|
|
129
|
+
name: string;
|
|
130
|
+
version: string;
|
|
131
|
+
scope: PluginScope;
|
|
132
|
+
installPath: string;
|
|
133
|
+
manifest?: PluginManifest;
|
|
134
|
+
pluginKey: string;
|
|
135
|
+
commandsDir?: string;
|
|
136
|
+
agentsDir?: string;
|
|
137
|
+
skillsDir?: string;
|
|
138
|
+
hooksPath?: string;
|
|
139
|
+
mcpPath?: string;
|
|
140
|
+
lspPath?: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Plugin load result with all components
|
|
144
|
+
*/
|
|
145
|
+
export interface PluginLoadResult {
|
|
146
|
+
plugins: LoadedPlugin[];
|
|
147
|
+
errors: PluginLoadError[];
|
|
148
|
+
}
|
|
149
|
+
export interface PluginLoadError {
|
|
150
|
+
pluginKey: string;
|
|
151
|
+
installPath: string;
|
|
152
|
+
error: string;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Claude settings from ~/.claude/settings.json
|
|
156
|
+
*/
|
|
157
|
+
export interface ClaudeSettings {
|
|
158
|
+
enabledPlugins?: Record<string, boolean>;
|
|
159
|
+
[key: string]: unknown;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Plugin loader options
|
|
163
|
+
*/
|
|
164
|
+
export interface PluginLoaderOptions {
|
|
165
|
+
/**
|
|
166
|
+
* Override enabled plugins from oh-my-opencode config.
|
|
167
|
+
* Key format: "pluginName@marketplace" (e.g., "shell-scripting@claude-code-workflows")
|
|
168
|
+
* Value: true = enabled, false = disabled
|
|
169
|
+
*
|
|
170
|
+
* This takes precedence over ~/.claude/settings.json enabledPlugins
|
|
171
|
+
*/
|
|
172
|
+
enabledPluginsOverride?: Record<string, boolean>;
|
|
173
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -11,6 +11,6 @@ export declare function createAnthropicAutoCompactHook(ctx: PluginInput, options
|
|
|
11
11
|
};
|
|
12
12
|
}) => Promise<void>;
|
|
13
13
|
};
|
|
14
|
-
export type { AutoCompactState, FallbackState, ParsedTokenLimitError, TruncateState } from "./types";
|
|
14
|
+
export type { AutoCompactState, DcpState, FallbackState, ParsedTokenLimitError, TruncateState } from "./types";
|
|
15
15
|
export { parseAnthropicTokenLimitError } from "./parser";
|
|
16
16
|
export { executeCompact, getLastAssistant } from "./executor";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PruningState } from "./pruning-types";
|
|
2
|
+
export interface DeduplicationConfig {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
protectedTools?: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare function createToolSignature(toolName: string, input: unknown): string;
|
|
7
|
+
export declare function executeDeduplication(sessionID: string, state: PruningState, config: DeduplicationConfig, protectedTools: Set<string>): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PruningState } from "./pruning-types";
|
|
2
|
+
export interface PurgeErrorsConfig {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
turns: number;
|
|
5
|
+
protectedTools?: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function executePurgeErrors(sessionID: string, state: PruningState, config: PurgeErrorsConfig, protectedTools: Set<string>): number;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PruningState } from "./pruning-types";
|
|
2
|
+
export interface SupersedeWritesConfig {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
aggressive: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function executeSupersedeWrites(sessionID: string, state: PruningState, config: SupersedeWritesConfig, protectedTools: Set<string>): number;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface ToolCallSignature {
|
|
2
|
+
toolName: string;
|
|
3
|
+
signature: string;
|
|
4
|
+
callID: string;
|
|
5
|
+
turn: number;
|
|
6
|
+
}
|
|
7
|
+
export interface FileOperation {
|
|
8
|
+
callID: string;
|
|
9
|
+
tool: string;
|
|
10
|
+
filePath: string;
|
|
11
|
+
turn: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ErroredToolCall {
|
|
14
|
+
callID: string;
|
|
15
|
+
toolName: string;
|
|
16
|
+
turn: number;
|
|
17
|
+
errorAge: number;
|
|
18
|
+
}
|
|
19
|
+
export interface PruningResult {
|
|
20
|
+
itemsPruned: number;
|
|
21
|
+
totalTokensSaved: number;
|
|
22
|
+
strategies: {
|
|
23
|
+
deduplication: number;
|
|
24
|
+
supersedeWrites: number;
|
|
25
|
+
purgeErrors: number;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface PruningState {
|
|
29
|
+
toolIdsToPrune: Set<string>;
|
|
30
|
+
currentTurn: number;
|
|
31
|
+
fileOperations: Map<string, FileOperation[]>;
|
|
32
|
+
toolSignatures: Map<string, ToolCallSignature[]>;
|
|
33
|
+
erroredTools: Map<string, ErroredToolCall>;
|
|
34
|
+
}
|
|
35
|
+
export declare const CHARS_PER_TOKEN = 4;
|
|
36
|
+
export declare function estimateTokens(text: string): number;
|
|
@@ -19,12 +19,17 @@ export interface TruncateState {
|
|
|
19
19
|
truncateAttempt: number;
|
|
20
20
|
lastTruncatedPartId?: string;
|
|
21
21
|
}
|
|
22
|
+
export interface DcpState {
|
|
23
|
+
attempted: boolean;
|
|
24
|
+
itemsPruned: number;
|
|
25
|
+
}
|
|
22
26
|
export interface AutoCompactState {
|
|
23
27
|
pendingCompact: Set<string>;
|
|
24
28
|
errorDataBySession: Map<string, ParsedTokenLimitError>;
|
|
25
29
|
retryStateBySession: Map<string, RetryState>;
|
|
26
30
|
fallbackStateBySession: Map<string, FallbackState>;
|
|
27
31
|
truncateStateBySession: Map<string, TruncateState>;
|
|
32
|
+
dcpStateBySession: Map<string, DcpState>;
|
|
28
33
|
emptyContentAttemptBySession: Map<string, number>;
|
|
29
34
|
compactionInProgress: Set<string>;
|
|
30
35
|
}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -20,3 +20,4 @@ export { createKeywordDetectorHook } from "./keyword-detector";
|
|
|
20
20
|
export { createNonInteractiveEnvHook } from "./non-interactive-env";
|
|
21
21
|
export { createInteractiveBashSessionHook } from "./interactive-bash-session";
|
|
22
22
|
export { createEmptyMessageSanitizerHook } from "./empty-message-sanitizer";
|
|
23
|
+
export { createThinkingBlockValidatorHook } from "./thinking-block-validator";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type Platform = "darwin" | "linux" | "win32" | "unsupported";
|
|
2
|
+
export declare function getNotifySendPath(): Promise<string | null>;
|
|
3
|
+
export declare function getOsascriptPath(): Promise<string | null>;
|
|
4
|
+
export declare function getPowershellPath(): Promise<string | null>;
|
|
5
|
+
export declare function getAfplayPath(): Promise<string | null>;
|
|
6
|
+
export declare function getPaplayPath(): Promise<string | null>;
|
|
7
|
+
export declare function getAplayPath(): Promise<string | null>;
|
|
8
|
+
export declare function startBackgroundCheck(platform: Platform): void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proactive Thinking Block Validator Hook
|
|
3
|
+
*
|
|
4
|
+
* Prevents "Expected thinking/redacted_thinking but found tool_use" errors
|
|
5
|
+
* by validating and fixing message structure BEFORE sending to Anthropic API.
|
|
6
|
+
*
|
|
7
|
+
* This hook runs on the "experimental.chat.messages.transform" hook point,
|
|
8
|
+
* which is called before messages are converted to ModelMessage format and
|
|
9
|
+
* sent to the API.
|
|
10
|
+
*
|
|
11
|
+
* Key differences from session-recovery hook:
|
|
12
|
+
* - PROACTIVE (prevents error) vs REACTIVE (fixes after error)
|
|
13
|
+
* - Runs BEFORE API call vs AFTER API error
|
|
14
|
+
* - User never sees the error vs User sees error then recovery
|
|
15
|
+
*/
|
|
16
|
+
import type { Message, Part } from "@opencode-ai/sdk";
|
|
17
|
+
interface MessageWithParts {
|
|
18
|
+
info: Message;
|
|
19
|
+
parts: Part[];
|
|
20
|
+
}
|
|
21
|
+
type MessagesTransformHook = {
|
|
22
|
+
"experimental.chat.messages.transform"?: (input: Record<string, never>, output: {
|
|
23
|
+
messages: MessageWithParts[];
|
|
24
|
+
}) => Promise<void>;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Validate and fix assistant messages that have tool_use but no thinking block
|
|
28
|
+
*/
|
|
29
|
+
export declare function createThinkingBlockValidatorHook(): MessagesTransformHook;
|
|
30
|
+
export {};
|