@kisev/skills-opencode 1.1.1 → 2.0.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.md +134 -108
- package/README.ru.md +242 -0
- package/dist/agent-profiles.d.ts +1 -1
- package/dist/agent-profiles.js +21 -10
- package/dist/assets/agents/architect.md +67 -0
- package/{assets → dist/assets}/agents/critic.md +17 -2
- package/dist/assets/agents/manager.md +36 -0
- package/{assets → dist/assets}/agents/mapper.md +2 -2
- package/dist/assets/agents/review.md +25 -0
- package/{assets → dist/assets}/agents/worker.md +7 -5
- package/dist/assets/commands/agent-profiles.md +9 -0
- package/dist/assets/commands/agents-md.md +10 -0
- package/dist/assets/commands/askme.md +10 -0
- package/dist/assets/commands/ast-grep.md +10 -0
- package/dist/assets/commands/capabilities.md +9 -0
- package/dist/assets/commands/code-explain.md +10 -0
- package/dist/assets/commands/code-review.md +10 -0
- package/dist/assets/commands/commit-msg.md +10 -0
- package/dist/assets/commands/docs-prepare.md +10 -0
- package/dist/assets/commands/docs-review.md +10 -0
- package/dist/assets/commands/doctor.md +9 -0
- package/dist/assets/commands/doit.md +10 -0
- package/dist/assets/commands/goal.md +10 -0
- package/dist/assets/commands/humanize.md +10 -0
- package/dist/assets/commands/lsp-report.md +10 -0
- package/dist/assets/commands/mattermost.md +10 -0
- package/dist/assets/commands/mr-prepare.md +10 -0
- package/dist/assets/commands/reconcile.md +9 -0
- package/dist/assets/commands/release-prepare.md +10 -0
- package/dist/assets/commands/release-review.md +10 -0
- package/dist/assets/commands/rtk.md +10 -0
- package/dist/assets/commands/skill-improve.md +10 -0
- package/dist/assets/commands/slides-prompts-prepare.md +10 -0
- package/dist/assets/commands/spec-manage.md +10 -0
- package/dist/assets/commands/stopit.md +10 -0
- package/dist/assets/commands/summary.md +10 -0
- package/dist/assets/commands/task-prepare.md +10 -0
- package/dist/assets/commands/task-review.md +10 -0
- package/dist/assets/commands/task-triage.md +10 -0
- package/dist/assets/commands/team-retro.md +10 -0
- package/dist/assets/commands/team-roadmap.md +10 -0
- package/dist/assets/commands/team-sprint-close.md +10 -0
- package/dist/assets/commands/team-sprint-start.md +10 -0
- package/dist/assets/lsp-catalog.json +30 -0
- package/dist/assets/migration-inventory.json +294 -0
- package/dist/catalog.d.ts +8 -0
- package/dist/catalog.js +38 -0
- package/dist/cli-output.d.ts +7 -0
- package/dist/cli-output.js +68 -1
- package/dist/cli.js +256 -59
- package/dist/contracts.d.ts +52 -0
- package/dist/contracts.js +98 -0
- package/dist/doctor.d.ts +44 -0
- package/dist/doctor.js +595 -0
- package/dist/generate-assets.js +17 -2
- package/dist/index.d.ts +84 -55
- package/dist/index.js +170 -37
- package/dist/installer.d.ts +33 -5
- package/dist/installer.js +252 -28
- package/dist/lifecycle.d.ts +3 -0
- package/dist/lifecycle.js +49 -17
- package/dist/plugins/rtk.js +4 -1
- package/dist/reconcile.d.ts +43 -0
- package/dist/reconcile.js +507 -0
- package/dist/registry.d.ts +7 -4
- package/dist/registry.js +28 -88
- package/dist/routing.d.ts +97 -3
- package/dist/routing.js +470 -18
- package/dist/runtime/state.d.ts +1 -0
- package/dist/runtime/state.js +12 -5
- package/dist/runtime/worktree.d.ts +33 -0
- package/dist/runtime/worktree.js +220 -0
- package/dist/terminal-wizard.d.ts +2 -0
- package/dist/terminal-wizard.js +125 -0
- package/package.json +10 -26
- package/assets/agents/architect.md +0 -33
- package/assets/agents/manager.md +0 -82
- package/assets/agents/review.md +0 -25
- package/assets/commands/agent-list.md +0 -9
- package/assets/commands/agent-model-set.md +0 -9
- package/assets/commands/askme.md +0 -10
- package/assets/commands/ast-grep-rewrite.md +0 -10
- package/assets/commands/ast-grep-search.md +0 -10
- package/assets/commands/attempt-cancel.md +0 -10
- package/assets/commands/attempt-list.md +0 -10
- package/assets/commands/attempt-result.md +0 -10
- package/assets/commands/attempt-show.md +0 -10
- package/assets/commands/capabilities.md +0 -9
- package/assets/commands/code-review.md +0 -10
- package/assets/commands/commit-msg.md +0 -10
- package/assets/commands/critic-add.md +0 -9
- package/assets/commands/critic-remove.md +0 -9
- package/assets/commands/docs-prepare.md +0 -10
- package/assets/commands/docs-review.md +0 -10
- package/assets/commands/doctor.md +0 -9
- package/assets/commands/doit.md +0 -10
- package/assets/commands/goal-list.md +0 -10
- package/assets/commands/goal-pause.md +0 -10
- package/assets/commands/goal-prepare.md +0 -10
- package/assets/commands/goal-remove.md +0 -10
- package/assets/commands/goal-show.md +0 -10
- package/assets/commands/goal-start.md +0 -10
- package/assets/commands/lsp-report.md +0 -10
- package/assets/commands/mattermost.md +0 -10
- package/assets/commands/mr-prepare.md +0 -10
- package/assets/commands/mr-review.md +0 -10
- package/assets/commands/multi-run-cancel.md +0 -10
- package/assets/commands/multi-run-compare.md +0 -10
- package/assets/commands/multi-run-fusion.md +0 -10
- package/assets/commands/multi-run-start.md +0 -10
- package/assets/commands/multi-run-status.md +0 -10
- package/assets/commands/overview.md +0 -10
- package/assets/commands/release-prepare.md +0 -10
- package/assets/commands/release-review.md +0 -10
- package/assets/commands/route.md +0 -9
- package/assets/commands/schedule-add.md +0 -10
- package/assets/commands/schedule-disable.md +0 -10
- package/assets/commands/schedule-enable.md +0 -10
- package/assets/commands/schedule-list.md +0 -10
- package/assets/commands/schedule-remove.md +0 -10
- package/assets/commands/schedule-status.md +0 -10
- package/assets/commands/skill-improver.md +0 -10
- package/assets/commands/spec-audit.md +0 -10
- package/assets/commands/spec-init.md +0 -10
- package/assets/commands/spec-onboard.md +0 -10
- package/assets/commands/spec-update.md +0 -10
- package/assets/commands/stopit.md +0 -10
- package/assets/commands/summary.md +0 -10
- package/assets/commands/task-prepare-batch.md +0 -10
- package/assets/commands/task-prepare.md +0 -10
- package/assets/commands/task-review.md +0 -10
- package/assets/commands/task-triage.md +0 -10
- package/assets/commands/team-planning.md +0 -10
- package/assets/commands/team-retro.md +0 -10
- package/assets/commands/team-roadmap.md +0 -10
- package/assets/commands/team-slides-prompts.md +0 -10
- package/assets/commands/team-sprint-close.md +0 -10
- package/assets/commands/team-sprint-status.md +0 -10
- package/assets/commands/walkthrough.md +0 -10
- package/assets/plugins/autonomy-policy.js +0 -3
- package/assets/plugins/background-attempts.js +0 -3
- package/assets/plugins/goal-loop.js +0 -3
- package/assets/plugins/schedule.js +0 -3
- package/assets/plugins/zed-clickable-paths.js +0 -3
- package/dist/plugins/autonomy-policy.d.ts +0 -21
- package/dist/plugins/autonomy-policy.js +0 -71
- package/dist/plugins/background-attempts.d.ts +0 -76
- package/dist/plugins/background-attempts.js +0 -113
- package/dist/plugins/goal-loop.d.ts +0 -51
- package/dist/plugins/goal-loop.js +0 -87
- package/dist/plugins/schedule.d.ts +0 -36
- package/dist/plugins/schedule.js +0 -100
- package/dist/plugins/zed-clickable-paths.d.ts +0 -11
- package/dist/plugins/zed-clickable-paths.js +0 -10
- /package/{assets → dist/assets}/plugins/rtk.js +0 -0
- /package/{assets → dist/assets}/plugins/rules-injector.js +0 -0
- /package/{assets → dist/assets}/plugins/zed-bell.js +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,29 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import goalLoop, { type GoalLoopOptions } from "./plugins/goal-loop.js";
|
|
3
|
-
import scheduler, { type SchedulerOptions } from "./plugins/schedule.js";
|
|
4
|
-
import autonomyPolicy, { type AutonomyPolicyOptions } from "./plugins/autonomy-policy.js";
|
|
1
|
+
import { type PluginInput } from "@opencode-ai/plugin";
|
|
5
2
|
import rulesInjector, { type RulesInjectorOptions } from "./plugins/rules-injector.js";
|
|
6
3
|
import rtk, { type RtkOptions } from "./plugins/rtk.js";
|
|
7
4
|
import zedBell, { type ZedBellOptions } from "./plugins/zed-bell.js";
|
|
8
|
-
|
|
9
|
-
export { COMMAND_REGISTRY, renderCommand } from "./registry.js";
|
|
10
|
-
export { CATEGORIES, resolveRouting, RoutingGate } from "./routing.js";
|
|
11
|
-
export { AgentProfileError, FIXED_AGENT_ROLES, applyAgentProfileChange, availableModels, availableModelVariants, listAgentProfiles, previewAgentProfileChange, renderAgentProfile, validateAgentName, validateModel, validateVariant, } from "./agent-profiles.js";
|
|
12
|
-
export type { AgentInventory, AgentModelSelection, AgentOwnership, AgentProfileAction, AgentProfileConfig, AgentProfileOperation, AgentProfilePlan, AgentProfileRecord, AgentProfileRequest, AgentProfileResult, AgentProfileScope, AgentState, DeploymentManifest, DeploymentRecord, FixedAgentRole, } from "./agent-profiles.js";
|
|
13
|
-
export { backgroundAttempts, goalLoop, scheduler, autonomyPolicy, rulesInjector, rtk, zedBell, zedClickablePaths };
|
|
5
|
+
export { rulesInjector, rtk, zedBell, };
|
|
14
6
|
export type OpenCodeOptions = {
|
|
15
|
-
backgroundAttempts?: BackgroundAttemptsOptions;
|
|
16
|
-
goalLoop?: GoalLoopOptions;
|
|
17
|
-
scheduler?: SchedulerOptions;
|
|
18
|
-
autonomyPolicy?: AutonomyPolicyOptions;
|
|
19
7
|
rulesInjector?: RulesInjectorOptions;
|
|
20
8
|
rtk?: RtkOptions;
|
|
21
9
|
zedBell?: ZedBellOptions;
|
|
22
|
-
zedClickablePaths?: ZedClickablePathsOptions;
|
|
23
10
|
};
|
|
24
|
-
declare const plugin: (input: {
|
|
25
|
-
directory?: string;
|
|
26
|
-
}) => Promise<{
|
|
11
|
+
declare const plugin: (input: PluginInput) => Promise<{
|
|
27
12
|
tool: {
|
|
28
13
|
route: {
|
|
29
14
|
description: string;
|
|
@@ -37,18 +22,12 @@ declare const plugin: (input: {
|
|
|
37
22
|
exploration: "exploration";
|
|
38
23
|
architecture: "architecture";
|
|
39
24
|
implementation: "implementation";
|
|
40
|
-
documentation: "documentation";
|
|
41
|
-
quick: "quick";
|
|
42
25
|
}>;
|
|
43
26
|
task: import("zod").ZodString;
|
|
44
27
|
requirements: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
45
|
-
|
|
46
|
-
agent: import("zod").ZodString;
|
|
47
|
-
available: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
48
|
-
capabilities: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
49
|
-
tools: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
50
|
-
}, import("zod/v4/core").$strip>>;
|
|
28
|
+
execution_card: import("zod").ZodOptional<import("zod").ZodAny>;
|
|
51
29
|
override: import("zod").ZodOptional<import("zod").ZodString>;
|
|
30
|
+
trusted_override: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
52
31
|
budget: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
53
32
|
cost_class: import("zod").ZodOptional<import("zod").ZodString>;
|
|
54
33
|
latency_class: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -57,16 +36,12 @@ declare const plugin: (input: {
|
|
|
57
36
|
};
|
|
58
37
|
execute(args: {
|
|
59
38
|
action: "preview" | "dispatch";
|
|
60
|
-
category: "review" | "exploration" | "architecture" | "implementation"
|
|
39
|
+
category: "review" | "exploration" | "architecture" | "implementation";
|
|
61
40
|
task: string;
|
|
62
41
|
requirements: string[];
|
|
63
|
-
|
|
64
|
-
agent: string;
|
|
65
|
-
available?: boolean | undefined;
|
|
66
|
-
capabilities?: string[] | undefined;
|
|
67
|
-
tools?: string[] | undefined;
|
|
68
|
-
}[];
|
|
42
|
+
execution_card?: any;
|
|
69
43
|
override?: string | undefined;
|
|
44
|
+
trusted_override?: boolean | undefined;
|
|
70
45
|
budget?: {
|
|
71
46
|
cost_class?: string | undefined;
|
|
72
47
|
latency_class?: string | undefined;
|
|
@@ -81,8 +56,15 @@ declare const plugin: (input: {
|
|
|
81
56
|
};
|
|
82
57
|
doctor: {
|
|
83
58
|
description: string;
|
|
84
|
-
args: {
|
|
85
|
-
|
|
59
|
+
args: {
|
|
60
|
+
scope: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
61
|
+
global: "global";
|
|
62
|
+
project: "project";
|
|
63
|
+
}>>;
|
|
64
|
+
};
|
|
65
|
+
execute(args: {
|
|
66
|
+
scope: "global" | "project";
|
|
67
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
86
68
|
};
|
|
87
69
|
agent_profiles: {
|
|
88
70
|
description: string;
|
|
@@ -116,6 +98,25 @@ declare const plugin: (input: {
|
|
|
116
98
|
confirmation_digest?: string | undefined;
|
|
117
99
|
}, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
118
100
|
};
|
|
101
|
+
reconcile: {
|
|
102
|
+
description: string;
|
|
103
|
+
args: {
|
|
104
|
+
phase: import("zod").ZodEnum<{
|
|
105
|
+
preview: "preview";
|
|
106
|
+
apply: "apply";
|
|
107
|
+
}>;
|
|
108
|
+
scope: import("zod").ZodEnum<{
|
|
109
|
+
global: "global";
|
|
110
|
+
project: "project";
|
|
111
|
+
}>;
|
|
112
|
+
confirmation_digest: import("zod").ZodOptional<import("zod").ZodString>;
|
|
113
|
+
};
|
|
114
|
+
execute(args: {
|
|
115
|
+
phase: "preview" | "apply";
|
|
116
|
+
scope: "global" | "project";
|
|
117
|
+
confirmation_digest?: string | undefined;
|
|
118
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
119
|
+
};
|
|
119
120
|
};
|
|
120
121
|
"tool.execute.before": (input: {
|
|
121
122
|
tool: string;
|
|
@@ -123,10 +124,15 @@ declare const plugin: (input: {
|
|
|
123
124
|
}, output: {
|
|
124
125
|
args: unknown;
|
|
125
126
|
}) => Promise<void>;
|
|
127
|
+
"tool.execute.after": (input: {
|
|
128
|
+
tool: string;
|
|
129
|
+
sessionID: string;
|
|
130
|
+
args: unknown;
|
|
131
|
+
}, output: {
|
|
132
|
+
output: string;
|
|
133
|
+
}) => Promise<void>;
|
|
126
134
|
}>;
|
|
127
|
-
export declare const server: (input: {
|
|
128
|
-
directory?: string;
|
|
129
|
-
}) => Promise<{
|
|
135
|
+
export declare const server: (input: PluginInput) => Promise<{
|
|
130
136
|
tool: {
|
|
131
137
|
route: {
|
|
132
138
|
description: string;
|
|
@@ -140,18 +146,12 @@ export declare const server: (input: {
|
|
|
140
146
|
exploration: "exploration";
|
|
141
147
|
architecture: "architecture";
|
|
142
148
|
implementation: "implementation";
|
|
143
|
-
documentation: "documentation";
|
|
144
|
-
quick: "quick";
|
|
145
149
|
}>;
|
|
146
150
|
task: import("zod").ZodString;
|
|
147
151
|
requirements: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
148
|
-
|
|
149
|
-
agent: import("zod").ZodString;
|
|
150
|
-
available: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
151
|
-
capabilities: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
152
|
-
tools: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
153
|
-
}, import("zod/v4/core").$strip>>;
|
|
152
|
+
execution_card: import("zod").ZodOptional<import("zod").ZodAny>;
|
|
154
153
|
override: import("zod").ZodOptional<import("zod").ZodString>;
|
|
154
|
+
trusted_override: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
155
155
|
budget: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
156
156
|
cost_class: import("zod").ZodOptional<import("zod").ZodString>;
|
|
157
157
|
latency_class: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -160,16 +160,12 @@ export declare const server: (input: {
|
|
|
160
160
|
};
|
|
161
161
|
execute(args: {
|
|
162
162
|
action: "preview" | "dispatch";
|
|
163
|
-
category: "review" | "exploration" | "architecture" | "implementation"
|
|
163
|
+
category: "review" | "exploration" | "architecture" | "implementation";
|
|
164
164
|
task: string;
|
|
165
165
|
requirements: string[];
|
|
166
|
-
|
|
167
|
-
agent: string;
|
|
168
|
-
available?: boolean | undefined;
|
|
169
|
-
capabilities?: string[] | undefined;
|
|
170
|
-
tools?: string[] | undefined;
|
|
171
|
-
}[];
|
|
166
|
+
execution_card?: any;
|
|
172
167
|
override?: string | undefined;
|
|
168
|
+
trusted_override?: boolean | undefined;
|
|
173
169
|
budget?: {
|
|
174
170
|
cost_class?: string | undefined;
|
|
175
171
|
latency_class?: string | undefined;
|
|
@@ -184,8 +180,15 @@ export declare const server: (input: {
|
|
|
184
180
|
};
|
|
185
181
|
doctor: {
|
|
186
182
|
description: string;
|
|
187
|
-
args: {
|
|
188
|
-
|
|
183
|
+
args: {
|
|
184
|
+
scope: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
185
|
+
global: "global";
|
|
186
|
+
project: "project";
|
|
187
|
+
}>>;
|
|
188
|
+
};
|
|
189
|
+
execute(args: {
|
|
190
|
+
scope: "global" | "project";
|
|
191
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
189
192
|
};
|
|
190
193
|
agent_profiles: {
|
|
191
194
|
description: string;
|
|
@@ -219,6 +222,25 @@ export declare const server: (input: {
|
|
|
219
222
|
confirmation_digest?: string | undefined;
|
|
220
223
|
}, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
221
224
|
};
|
|
225
|
+
reconcile: {
|
|
226
|
+
description: string;
|
|
227
|
+
args: {
|
|
228
|
+
phase: import("zod").ZodEnum<{
|
|
229
|
+
preview: "preview";
|
|
230
|
+
apply: "apply";
|
|
231
|
+
}>;
|
|
232
|
+
scope: import("zod").ZodEnum<{
|
|
233
|
+
global: "global";
|
|
234
|
+
project: "project";
|
|
235
|
+
}>;
|
|
236
|
+
confirmation_digest: import("zod").ZodOptional<import("zod").ZodString>;
|
|
237
|
+
};
|
|
238
|
+
execute(args: {
|
|
239
|
+
phase: "preview" | "apply";
|
|
240
|
+
scope: "global" | "project";
|
|
241
|
+
confirmation_digest?: string | undefined;
|
|
242
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
243
|
+
};
|
|
222
244
|
};
|
|
223
245
|
"tool.execute.before": (input: {
|
|
224
246
|
tool: string;
|
|
@@ -226,5 +248,12 @@ export declare const server: (input: {
|
|
|
226
248
|
}, output: {
|
|
227
249
|
args: unknown;
|
|
228
250
|
}) => Promise<void>;
|
|
251
|
+
"tool.execute.after": (input: {
|
|
252
|
+
tool: string;
|
|
253
|
+
sessionID: string;
|
|
254
|
+
args: unknown;
|
|
255
|
+
}, output: {
|
|
256
|
+
output: string;
|
|
257
|
+
}) => Promise<void>;
|
|
229
258
|
}>;
|
|
230
259
|
export default plugin;
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,52 @@
|
|
|
1
1
|
import { tool } from "@opencode-ai/plugin";
|
|
2
|
-
import { CATEGORIES, RoutingGate } from "./routing.js";
|
|
3
|
-
import backgroundAttempts from "./plugins/background-attempts.js";
|
|
4
|
-
import goalLoop from "./plugins/goal-loop.js";
|
|
5
|
-
import scheduler from "./plugins/schedule.js";
|
|
6
|
-
import autonomyPolicy from "./plugins/autonomy-policy.js";
|
|
2
|
+
import { CATEGORIES, RoutingGate, } from "./routing.js";
|
|
7
3
|
import rulesInjector from "./plugins/rules-injector.js";
|
|
8
4
|
import rtk from "./plugins/rtk.js";
|
|
9
5
|
import zedBell from "./plugins/zed-bell.js";
|
|
10
|
-
import zedClickablePaths from "./plugins/zed-clickable-paths.js";
|
|
11
6
|
import { applyAgentProfileChange, listAgentProfiles, previewAgentProfileChange, } from "./agent-profiles.js";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
skills: ["attempt", "goal", "schedule", "multi-run", "usage", "overview", "lsp-report"],
|
|
18
|
-
plugins: ["background-attempts", "goal-loop", "schedule", "autonomy-policy", "rules-injector", "rtk", "zed-bell", "zed-clickable-paths"],
|
|
19
|
-
replacements: ["capabilities", "route", "doctor", "agent_profiles"],
|
|
20
|
-
version: "1.1.1",
|
|
21
|
-
};
|
|
7
|
+
import { applyReconcile, previewReconcile } from "./reconcile.js";
|
|
8
|
+
import { collectDoctorFacts } from "./doctor.js";
|
|
9
|
+
import { CATALOG } from "./catalog.js";
|
|
10
|
+
import { digest } from "./lifecycle.js";
|
|
11
|
+
export { rulesInjector, rtk, zedBell, };
|
|
22
12
|
const plugin = (async (input) => {
|
|
23
13
|
const gate = new RoutingGate();
|
|
14
|
+
const hostInventory = async () => {
|
|
15
|
+
if (!input.client?.app?.agents)
|
|
16
|
+
throw new Error("Resolved OpenCode agent inventory is unavailable");
|
|
17
|
+
const response = await input.client.app.agents({ query: { directory: input.directory } });
|
|
18
|
+
const raw = response.data;
|
|
19
|
+
if (!Array.isArray(raw))
|
|
20
|
+
throw new Error("Resolved OpenCode agent inventory is malformed");
|
|
21
|
+
const capabilities = {
|
|
22
|
+
mapper: ["read", "search"],
|
|
23
|
+
architect: ["read", "architecture"],
|
|
24
|
+
worker: ["read", "write", "verify"],
|
|
25
|
+
review: ["read", "review"],
|
|
26
|
+
critic: ["read", "review"],
|
|
27
|
+
};
|
|
28
|
+
const agents = raw.map((value) => {
|
|
29
|
+
const agent = value;
|
|
30
|
+
if (typeof agent.name !== "string" || !agent.name)
|
|
31
|
+
throw new Error("Resolved OpenCode agent has no name");
|
|
32
|
+
return {
|
|
33
|
+
agent: agent.name,
|
|
34
|
+
available: true,
|
|
35
|
+
capabilities: capabilities[agent.name] ?? ["read"],
|
|
36
|
+
tools: [
|
|
37
|
+
"read",
|
|
38
|
+
...(agent.permission?.edit !== "deny" ? ["edit"] : []),
|
|
39
|
+
...Object.entries(agent.tools ?? {})
|
|
40
|
+
.filter(([, enabled]) => enabled)
|
|
41
|
+
.map(([name]) => name),
|
|
42
|
+
...Object.entries(agent.permission?.bash ?? {})
|
|
43
|
+
.filter(([, mode]) => mode !== "deny")
|
|
44
|
+
.map(() => "bash"),
|
|
45
|
+
].filter((name, index, list) => list.indexOf(name) === index),
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
return { agents, revision: digest(raw) };
|
|
49
|
+
};
|
|
24
50
|
const route = tool({
|
|
25
51
|
description: "Resolve a capability category and dispatch one eligible agent through a one-use Task receipt gate.",
|
|
26
52
|
args: {
|
|
@@ -28,30 +54,61 @@ const plugin = (async (input) => {
|
|
|
28
54
|
category: tool.schema.enum(CATEGORIES),
|
|
29
55
|
task: tool.schema.string(),
|
|
30
56
|
requirements: tool.schema.array(tool.schema.string()).default([]),
|
|
31
|
-
|
|
57
|
+
execution_card: tool.schema.any().optional(),
|
|
32
58
|
override: tool.schema.string().optional(),
|
|
33
|
-
|
|
34
|
-
|
|
59
|
+
trusted_override: tool.schema.boolean().optional(),
|
|
60
|
+
budget: tool.schema
|
|
61
|
+
.object({
|
|
62
|
+
cost_class: tool.schema.string().optional(),
|
|
63
|
+
latency_class: tool.schema.string().optional(),
|
|
64
|
+
})
|
|
65
|
+
.optional(),
|
|
66
|
+
decision: tool.schema.any().optional(),
|
|
35
67
|
},
|
|
36
68
|
async execute(args, context) {
|
|
37
|
-
const
|
|
69
|
+
const inventory = await hostInventory();
|
|
70
|
+
const input = {
|
|
71
|
+
category: args.category,
|
|
72
|
+
task: args.task,
|
|
73
|
+
requirements: args.requirements,
|
|
74
|
+
agents: inventory.agents,
|
|
75
|
+
inventory_revision: inventory.revision,
|
|
76
|
+
execution_card: args.execution_card,
|
|
77
|
+
override: args.override,
|
|
78
|
+
trusted_override: args.trusted_override,
|
|
79
|
+
budget: args.budget,
|
|
80
|
+
};
|
|
38
81
|
if (args.action === "preview")
|
|
39
82
|
return JSON.stringify(gate.preview(input));
|
|
40
83
|
const decision = gate.dispatch(input, args.decision);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
84
|
+
if (decision.agent === "worker" && args.execution_card === undefined)
|
|
85
|
+
throw new Error("implementation dispatch requires a confirmed execution card");
|
|
86
|
+
const receipt = gate.grant(context.sessionID, decision, {
|
|
87
|
+
task: args.task,
|
|
88
|
+
requirements: args.requirements,
|
|
89
|
+
card: args.execution_card,
|
|
90
|
+
});
|
|
91
|
+
return JSON.stringify({ decision, receipt, status: "routed" });
|
|
92
|
+
},
|
|
44
93
|
});
|
|
45
94
|
const capabilities = tool({
|
|
46
95
|
description: "Show the bundled OpenCode capability catalog without installing or changing anything.",
|
|
47
96
|
args: {},
|
|
48
|
-
async execute() {
|
|
97
|
+
async execute() {
|
|
98
|
+
return JSON.stringify({ schema_version: 1, status: "ok", ...CATALOG });
|
|
99
|
+
},
|
|
49
100
|
});
|
|
50
101
|
const doctor = tool({
|
|
51
102
|
description: "Read package health and opt-in defaults without installing or repairing anything.",
|
|
52
|
-
args: {},
|
|
53
|
-
async execute() {
|
|
54
|
-
|
|
103
|
+
args: { scope: tool.schema.enum(["global", "project"]).default("project") },
|
|
104
|
+
async execute(args, context) {
|
|
105
|
+
const host = input.client
|
|
106
|
+
? {
|
|
107
|
+
config: async () => (await input.client.config.get({ query: { directory: context.directory } })).data,
|
|
108
|
+
lsp: async () => (await input.client.lsp.status({ query: { directory: context.directory } })).data,
|
|
109
|
+
}
|
|
110
|
+
: undefined;
|
|
111
|
+
return JSON.stringify(await collectDoctorFacts(args.scope ?? "project", context.directory, undefined, host));
|
|
55
112
|
},
|
|
56
113
|
});
|
|
57
114
|
const agentProfiles = tool({
|
|
@@ -68,32 +125,108 @@ const plugin = (async (input) => {
|
|
|
68
125
|
async execute(args) {
|
|
69
126
|
const cwd = input.directory ?? process.cwd();
|
|
70
127
|
if (args.action === "list") {
|
|
71
|
-
if (args.phase ||
|
|
128
|
+
if (args.phase ||
|
|
129
|
+
args.name ||
|
|
130
|
+
args.model ||
|
|
131
|
+
args.variant !== undefined ||
|
|
132
|
+
args.confirmation_digest)
|
|
72
133
|
throw new Error("agent_profiles list accepts only scope");
|
|
73
|
-
return JSON.stringify({
|
|
134
|
+
return JSON.stringify({
|
|
135
|
+
status: "ok",
|
|
136
|
+
inventory: await listAgentProfiles(args.scope, cwd),
|
|
137
|
+
});
|
|
74
138
|
}
|
|
75
139
|
if (!args.phase)
|
|
76
140
|
throw new Error("agent_profiles mutation requires preview or apply phase");
|
|
77
|
-
const action = {
|
|
78
|
-
|
|
141
|
+
const action = {
|
|
142
|
+
model_set: "model-set",
|
|
143
|
+
critic_add: "critic-add",
|
|
144
|
+
critic_remove: "critic-remove",
|
|
145
|
+
}[args.action];
|
|
146
|
+
const request = {
|
|
147
|
+
action,
|
|
148
|
+
...(args.name ? { name: args.name } : {}),
|
|
149
|
+
...(args.model ? { model: args.model } : {}),
|
|
150
|
+
...(args.variant !== undefined ? { variant: args.variant } : {}),
|
|
151
|
+
};
|
|
79
152
|
if (args.phase === "preview")
|
|
80
|
-
return JSON.stringify({
|
|
153
|
+
return JSON.stringify({
|
|
154
|
+
status: "ok",
|
|
155
|
+
applied: false,
|
|
156
|
+
requires_restart: false,
|
|
157
|
+
plan: await previewAgentProfileChange(request, args.scope, cwd),
|
|
158
|
+
});
|
|
81
159
|
if (!args.confirmation_digest)
|
|
82
160
|
throw new Error("agent_profiles apply requires confirmation_digest");
|
|
83
161
|
return JSON.stringify(await applyAgentProfileChange(request, args.scope, args.confirmation_digest, cwd));
|
|
84
162
|
},
|
|
85
163
|
});
|
|
164
|
+
const reconcile = tool({
|
|
165
|
+
description: "Preview or apply scope-isolated removal of retired public assets without touching unknown sources or runtime state.",
|
|
166
|
+
args: {
|
|
167
|
+
phase: tool.schema.enum(["preview", "apply"]),
|
|
168
|
+
scope: tool.schema.enum(["global", "project"]),
|
|
169
|
+
confirmation_digest: tool.schema.string().optional(),
|
|
170
|
+
},
|
|
171
|
+
async execute(args) {
|
|
172
|
+
const cwd = input.directory ?? process.cwd();
|
|
173
|
+
if (args.phase === "preview")
|
|
174
|
+
return JSON.stringify({
|
|
175
|
+
status: "ok",
|
|
176
|
+
applied: false,
|
|
177
|
+
plan: await previewReconcile(args.scope, cwd),
|
|
178
|
+
});
|
|
179
|
+
if (!args.confirmation_digest)
|
|
180
|
+
throw new Error("reconcile apply requires confirmation_digest");
|
|
181
|
+
return JSON.stringify(await applyReconcile(args.scope, args.confirmation_digest, cwd));
|
|
182
|
+
},
|
|
183
|
+
});
|
|
86
184
|
return {
|
|
87
|
-
tool: { route, capabilities, doctor, agent_profiles: agentProfiles },
|
|
185
|
+
tool: { route, capabilities, doctor, agent_profiles: agentProfiles, reconcile },
|
|
88
186
|
"tool.execute.before": async (input, output) => {
|
|
89
187
|
if (input.tool !== "task")
|
|
90
188
|
return;
|
|
91
|
-
const args = output.args && typeof output.args === "object"
|
|
92
|
-
|
|
189
|
+
const args = output.args && typeof output.args === "object"
|
|
190
|
+
? output.args
|
|
191
|
+
: {};
|
|
192
|
+
const agent = typeof args.agent === "string"
|
|
193
|
+
? args.agent
|
|
194
|
+
: typeof args.subagent_type === "string"
|
|
195
|
+
? args.subagent_type
|
|
196
|
+
: undefined;
|
|
93
197
|
if (!agent)
|
|
94
198
|
throw new Error("Native Task requires an explicit agent and an active routing receipt");
|
|
95
|
-
|
|
96
|
-
|
|
199
|
+
const hasBinding = "task" in args || "requirements" in args || "execution_card" in args;
|
|
200
|
+
if (!hasBinding)
|
|
201
|
+
gate.consume(input.sessionID, agent);
|
|
202
|
+
else {
|
|
203
|
+
const task = typeof args.task === "string" ? args.task : "";
|
|
204
|
+
const requirements = Array.isArray(args.requirements)
|
|
205
|
+
? args.requirements
|
|
206
|
+
: [];
|
|
207
|
+
gate.consume(input.sessionID, agent, { task, requirements, card: args.execution_card });
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"tool.execute.after": async (input, output) => {
|
|
211
|
+
if (input.tool !== "task")
|
|
212
|
+
return;
|
|
213
|
+
const args = input.args && typeof input.args === "object" ? input.args : {};
|
|
214
|
+
const agent = typeof args.agent === "string"
|
|
215
|
+
? args.agent
|
|
216
|
+
: typeof args.subagent_type === "string"
|
|
217
|
+
? args.subagent_type
|
|
218
|
+
: undefined;
|
|
219
|
+
if (!agent)
|
|
220
|
+
throw new Error("Task result requires an explicit agent");
|
|
221
|
+
let result;
|
|
222
|
+
try {
|
|
223
|
+
result = JSON.parse(output.output);
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
throw new Error("Task result must be JSON structured report");
|
|
227
|
+
}
|
|
228
|
+
gate.complete(input.sessionID, agent, result);
|
|
229
|
+
},
|
|
97
230
|
};
|
|
98
231
|
});
|
|
99
232
|
export const server = plugin;
|
package/dist/installer.d.ts
CHANGED
|
@@ -1,26 +1,54 @@
|
|
|
1
|
-
import { LifecycleError, type Scope, type TransactionOptions } from "./lifecycle.js";
|
|
1
|
+
import { LifecycleError, type FileMutation, type Scope, type TransactionOptions } from "./lifecycle.js";
|
|
2
|
+
import { CATALOG } from "./catalog.js";
|
|
3
|
+
import { type FixedAgentRole } from "./agent-profiles.js";
|
|
2
4
|
export type { Scope } from "./lifecycle.js";
|
|
3
5
|
export type Action = "install" | "uninstall";
|
|
4
|
-
export type Operation = "create" | "update" | "remove" | "unchanged" | "missing" | "conflict";
|
|
6
|
+
export type Operation = "create" | "update" | "remove" | "unchanged" | "missing" | "conflict" | "archive-pending";
|
|
5
7
|
export type PlanItem = {
|
|
6
8
|
path: string;
|
|
7
9
|
operation: Operation;
|
|
8
10
|
reason?: string;
|
|
9
11
|
sha256?: string;
|
|
10
12
|
};
|
|
13
|
+
export type SelectablePlugin = (typeof CATALOG.plugins)[number];
|
|
14
|
+
export type InstallerSelection = {
|
|
15
|
+
commands: string[];
|
|
16
|
+
agents: FixedAgentRole[];
|
|
17
|
+
plugins: SelectablePlugin[];
|
|
18
|
+
core_activation: boolean;
|
|
19
|
+
};
|
|
11
20
|
export type Plan = {
|
|
12
|
-
schema_version:
|
|
21
|
+
schema_version: 2;
|
|
13
22
|
action: Action;
|
|
14
23
|
scope: Scope;
|
|
15
24
|
root: string;
|
|
16
25
|
package_version: string;
|
|
26
|
+
selection: InstallerSelection;
|
|
17
27
|
operations: PlanItem[];
|
|
18
28
|
digest: string;
|
|
19
29
|
receipt_expires_at?: string;
|
|
20
30
|
requires_restart: boolean;
|
|
21
31
|
};
|
|
32
|
+
type ManifestFile = {
|
|
33
|
+
sha256: string;
|
|
34
|
+
mode: number;
|
|
35
|
+
kind: "command" | "agent" | "plugin" | "state";
|
|
36
|
+
};
|
|
37
|
+
export type ArchiveCandidate = {
|
|
38
|
+
path: string;
|
|
39
|
+
record: ManifestFile;
|
|
40
|
+
content: Buffer;
|
|
41
|
+
reason: string;
|
|
42
|
+
kind: "command" | "agent" | "plugin" | "state";
|
|
43
|
+
};
|
|
44
|
+
export declare const SELECTABLE_PLUGINS: SelectablePlugin[];
|
|
45
|
+
export declare const PACKAGE_COMMANDS: string[];
|
|
46
|
+
export declare const SKILL_COMMANDS: string[];
|
|
47
|
+
export declare function defaultSelection(): InstallerSelection;
|
|
48
|
+
export declare function normalizeSelection(value?: Partial<InstallerSelection>): InstallerSelection;
|
|
22
49
|
export declare class InstallerError extends LifecycleError {
|
|
23
50
|
}
|
|
24
|
-
export declare function
|
|
25
|
-
export declare function
|
|
51
|
+
export declare function archiveMutations(candidates: readonly ArchiveCandidate[], scope: Scope, cwd: string, home: string, sourceVersion: string): Promise<FileMutation[]>;
|
|
52
|
+
export declare function preview(action: Action, scope: Scope, cwd?: string, home?: string, selection?: Partial<InstallerSelection>): Promise<Plan>;
|
|
53
|
+
export declare function apply(action: Action, scope: Scope, confirmationDigest: string, cwd?: string, home?: string, options?: TransactionOptions, selection?: Partial<InstallerSelection>): Promise<Plan>;
|
|
26
54
|
export declare function result(plan: Plan, applied: boolean): string;
|