chainlesschain 0.45.67 → 0.45.74
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/package.json +1 -1
- package/src/assets/web-panel/.build-hash +1 -1
- package/src/assets/web-panel/assets/Analytics-B4OM8S8X.css +1 -0
- package/src/assets/web-panel/assets/Analytics-sBrYoc3A.js +3 -0
- package/src/assets/web-panel/assets/AppLayout-BhJ3YFWt.js +1 -0
- package/src/assets/web-panel/assets/AppLayout-Cr2lWhF-.css +1 -0
- package/src/assets/web-panel/assets/Backup-D68fenbD.js +1 -0
- package/src/assets/web-panel/assets/Backup-fZqtfC1m.css +1 -0
- package/src/assets/web-panel/assets/{Chat-DXtvKoM0.js → Chat-DaxTP3x8.js} +1 -1
- package/src/assets/web-panel/assets/{Cron-BJ4ODHOy.js → Cron-CNs03iHJ.js} +2 -2
- package/src/assets/web-panel/assets/{Dashboard-BZd4wDPQ.js → Dashboard-CjlX4CrX.js} +2 -2
- package/src/assets/web-panel/assets/Git-CCMVr3Y8.js +2 -0
- package/src/assets/web-panel/assets/Git-DGcuBXST.css +1 -0
- package/src/assets/web-panel/assets/{Logs-CSeKZEG_.js → Logs-BY6A0UNG.js} +2 -2
- package/src/assets/web-panel/assets/{McpTools-BYQAK11r.js → McpTools-CrBVYlg6.js} +2 -2
- package/src/assets/web-panel/assets/{Memory-gkUAPyuZ.js → Memory-CWx3SpUt.js} +2 -2
- package/src/assets/web-panel/assets/{Notes-bjNrQgAo.js → Notes-1LcGD49x.js} +2 -2
- package/src/assets/web-panel/assets/Organization-DdOOM4ic.css +1 -0
- package/src/assets/web-panel/assets/Organization-Dx2DhbkM.js +4 -0
- package/src/assets/web-panel/assets/P2P-B16fjqfJ.js +2 -0
- package/src/assets/web-panel/assets/P2P-OEzOeMZX.css +1 -0
- package/src/assets/web-panel/assets/Permissions-BQbC9FzG.js +4 -0
- package/src/assets/web-panel/assets/Permissions-C9WlkGl-.css +1 -0
- package/src/assets/web-panel/assets/Projects-CjhZbNYm.js +2 -0
- package/src/assets/web-panel/assets/Projects-DxKelI5h.css +1 -0
- package/src/assets/web-panel/assets/Providers-BEakqcO5.css +1 -0
- package/src/assets/web-panel/assets/Providers-ivOAQtHM.js +2 -0
- package/src/assets/web-panel/assets/RssFeed-BlFC20eg.css +1 -0
- package/src/assets/web-panel/assets/RssFeed-BrsErdrU.js +3 -0
- package/src/assets/web-panel/assets/Security-DnEvJU5h.js +4 -0
- package/src/assets/web-panel/assets/Security-Dwxw7rfP.css +1 -0
- package/src/assets/web-panel/assets/{Services-CS0oMdxh.js → Services-7jQywNbl.js} +2 -2
- package/src/assets/web-panel/assets/Skills-BCvgBkD3.js +1 -0
- package/src/assets/web-panel/assets/{Tasks-qULws8pc.js → Tasks-CmJBC1cf.js} +1 -1
- package/src/assets/web-panel/assets/Templates-DOY_oZnm.css +1 -0
- package/src/assets/web-panel/assets/Templates-RXT8-DNk.js +1 -0
- package/src/assets/web-panel/assets/Wallet-3iYASEx_.js +4 -0
- package/src/assets/web-panel/assets/Wallet-DnIumafl.css +1 -0
- package/src/assets/web-panel/assets/WebAuthn-CNPl2VQR.css +1 -0
- package/src/assets/web-panel/assets/WebAuthn-s3Hzd9db.js +5 -0
- package/src/assets/web-panel/assets/{antd-CJSBocer.js → antd-gZyc63Qr.js} +114 -114
- package/src/assets/web-panel/assets/chat-BmwHBi9M.js +1 -0
- package/src/assets/web-panel/assets/index-DrmEk9S3.js +2 -0
- package/src/assets/web-panel/assets/{markdown-Bo5cVN4u.js → markdown-Bv7nG63L.js} +1 -1
- package/src/assets/web-panel/assets/ws-CU7Gvoom.js +1 -0
- package/src/assets/web-panel/index.html +2 -2
- package/src/commands/doctor.js +33 -151
- package/src/commands/mcp.js +1 -1
- package/src/commands/plugin.js +1 -1
- package/src/commands/session.js +106 -7
- package/src/commands/status.js +39 -69
- package/src/gateways/ws/message-dispatcher.js +9 -0
- package/src/gateways/ws/session-protocol.js +368 -1
- package/src/gateways/ws/ws-agent-handler.js +484 -0
- package/src/gateways/ws/ws-server.js +758 -4
- package/src/gateways/ws/ws-session-gateway.js +1432 -1
- package/src/harness/mcp-client.js +417 -0
- package/src/harness/mock-llm-provider.js +167 -0
- package/src/harness/plugin-manager.js +434 -0
- package/src/lib/agent-core.js +25 -1902
- package/src/lib/hashline.js +208 -0
- package/src/lib/jsonl-session-store.js +11 -0
- package/src/lib/mcp-client.js +14 -412
- package/src/lib/plugin-manager.js +29 -428
- package/src/lib/prompt-compressor.js +11 -0
- package/src/lib/session-hooks.js +61 -0
- package/src/lib/skill-loader.js +4 -0
- package/src/lib/skill-mcp.js +190 -0
- package/src/lib/workflow-state-reader.js +94 -0
- package/src/lib/ws-agent-handler.js +8 -472
- package/src/lib/ws-server.js +12 -726
- package/src/lib/ws-session-manager.js +8 -1178
- package/src/repl/agent-repl.js +27 -3
- package/src/runtime/agent-core.js +1760 -0
- package/src/runtime/agent-runtime.js +3 -1
- package/src/runtime/coding-agent-contract-shared.cjs +496 -0
- package/src/runtime/coding-agent-contract.js +49 -229
- package/src/runtime/coding-agent-events.cjs +14 -0
- package/src/runtime/coding-agent-policy.cjs +54 -5
- package/src/runtime/diagnostics.js +317 -0
- package/src/runtime/index.js +3 -0
- package/src/tools/index.js +3 -0
- package/src/tools/legacy-agent-tools.js +5 -0
- package/src/assets/web-panel/assets/AppLayout-B_tkw3Pn.js +0 -1
- package/src/assets/web-panel/assets/AppLayout-CFP4dGIJ.css +0 -1
- package/src/assets/web-panel/assets/Providers-Brm-S_hS.css +0 -1
- package/src/assets/web-panel/assets/Providers-Dbf57Tbv.js +0 -1
- package/src/assets/web-panel/assets/Skills-B2fgruv8.js +0 -1
- package/src/assets/web-panel/assets/chat-DnH09sSR.js +0 -1
- package/src/assets/web-panel/assets/index-IK-oro0g.js +0 -2
- package/src/assets/web-panel/assets/ws-DjelKkD6.js +0 -1
|
@@ -1,193 +1,18 @@
|
|
|
1
1
|
import { ToolRegistry, createDefaultToolRegistry } from "../tools/registry.js";
|
|
2
|
-
import
|
|
2
|
+
import sharedContract from "./coding-agent-contract-shared.cjs";
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
CODING_AGENT_EXTENSION_TOOL_NAMES,
|
|
6
|
+
CODING_AGENT_MVP_TOOL_NAMES,
|
|
7
|
+
getCodingAgentFunctionToolDefinition,
|
|
8
|
+
getCodingAgentFunctionToolDefinitions,
|
|
9
|
+
getCodingAgentToolContract,
|
|
10
|
+
getCodingAgentToolContracts,
|
|
11
|
+
getCodingAgentToolPolicy,
|
|
12
|
+
isCodingAgentMvpTool,
|
|
13
|
+
listCodingAgentToolNames,
|
|
14
|
+
} = sharedContract;
|
|
3
15
|
|
|
4
|
-
const { TOOL_POLICY_METADATA } = sharedCodingAgentPolicy;
|
|
5
|
-
|
|
6
|
-
const CODING_AGENT_TOOL_CONTRACTS = Object.freeze([
|
|
7
|
-
{
|
|
8
|
-
name: "read_file",
|
|
9
|
-
title: "Read File",
|
|
10
|
-
kind: "filesystem",
|
|
11
|
-
tier: "mvp",
|
|
12
|
-
...TOOL_POLICY_METADATA.read_file,
|
|
13
|
-
permissions: {
|
|
14
|
-
level: "readonly",
|
|
15
|
-
scopes: ["filesystem:read"],
|
|
16
|
-
},
|
|
17
|
-
telemetry: {
|
|
18
|
-
category: "filesystem",
|
|
19
|
-
tags: ["tool:read_file", "contract:coding-agent", "tier:mvp"],
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: "write_file",
|
|
24
|
-
title: "Write File",
|
|
25
|
-
kind: "filesystem",
|
|
26
|
-
tier: "mvp",
|
|
27
|
-
...TOOL_POLICY_METADATA.write_file,
|
|
28
|
-
permissions: {
|
|
29
|
-
level: "elevated",
|
|
30
|
-
scopes: ["filesystem:write"],
|
|
31
|
-
},
|
|
32
|
-
telemetry: {
|
|
33
|
-
category: "filesystem",
|
|
34
|
-
tags: ["tool:write_file", "contract:coding-agent", "tier:mvp"],
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
name: "edit_file",
|
|
39
|
-
title: "Edit File",
|
|
40
|
-
kind: "filesystem",
|
|
41
|
-
tier: "mvp",
|
|
42
|
-
...TOOL_POLICY_METADATA.edit_file,
|
|
43
|
-
permissions: {
|
|
44
|
-
level: "elevated",
|
|
45
|
-
scopes: ["filesystem:write"],
|
|
46
|
-
},
|
|
47
|
-
telemetry: {
|
|
48
|
-
category: "filesystem",
|
|
49
|
-
tags: ["tool:edit_file", "contract:coding-agent", "tier:mvp"],
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: "run_shell",
|
|
54
|
-
title: "Run Shell",
|
|
55
|
-
kind: "shell",
|
|
56
|
-
tier: "mvp",
|
|
57
|
-
...TOOL_POLICY_METADATA.run_shell,
|
|
58
|
-
runtimeDescriptor: "shell",
|
|
59
|
-
permissions: {
|
|
60
|
-
level: "elevated",
|
|
61
|
-
scopes: ["process:spawn", "filesystem:workspace"],
|
|
62
|
-
},
|
|
63
|
-
telemetry: {
|
|
64
|
-
category: "shell",
|
|
65
|
-
tags: ["tool:run_shell", "contract:coding-agent", "tier:mvp"],
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: "git",
|
|
70
|
-
title: "Git",
|
|
71
|
-
kind: "git",
|
|
72
|
-
tier: "mvp",
|
|
73
|
-
...TOOL_POLICY_METADATA.git,
|
|
74
|
-
runtimeDescriptor: "git",
|
|
75
|
-
permissions: {
|
|
76
|
-
level: "elevated",
|
|
77
|
-
scopes: ["process:spawn", "filesystem:workspace", "vcs:git"],
|
|
78
|
-
},
|
|
79
|
-
telemetry: {
|
|
80
|
-
category: "git",
|
|
81
|
-
tags: ["tool:git", "contract:coding-agent", "tier:mvp"],
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: "search_files",
|
|
86
|
-
title: "Search Files",
|
|
87
|
-
kind: "filesystem",
|
|
88
|
-
tier: "mvp",
|
|
89
|
-
...TOOL_POLICY_METADATA.search_files,
|
|
90
|
-
permissions: {
|
|
91
|
-
level: "readonly",
|
|
92
|
-
scopes: ["filesystem:read", "search:content"],
|
|
93
|
-
},
|
|
94
|
-
telemetry: {
|
|
95
|
-
category: "filesystem",
|
|
96
|
-
tags: ["tool:search_files", "contract:coding-agent", "tier:mvp"],
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: "list_dir",
|
|
101
|
-
title: "List Directory",
|
|
102
|
-
kind: "filesystem",
|
|
103
|
-
tier: "mvp",
|
|
104
|
-
...TOOL_POLICY_METADATA.list_dir,
|
|
105
|
-
permissions: {
|
|
106
|
-
level: "readonly",
|
|
107
|
-
scopes: ["filesystem:read"],
|
|
108
|
-
},
|
|
109
|
-
telemetry: {
|
|
110
|
-
category: "filesystem",
|
|
111
|
-
tags: ["tool:list_dir", "contract:coding-agent", "tier:mvp"],
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
name: "run_skill",
|
|
116
|
-
title: "Run Skill",
|
|
117
|
-
kind: "skill",
|
|
118
|
-
tier: "extension",
|
|
119
|
-
...TOOL_POLICY_METADATA.run_skill,
|
|
120
|
-
permissions: {
|
|
121
|
-
level: "standard",
|
|
122
|
-
scopes: ["skill:invoke"],
|
|
123
|
-
},
|
|
124
|
-
telemetry: {
|
|
125
|
-
category: "skill",
|
|
126
|
-
tags: ["tool:run_skill", "contract:coding-agent", "tier:extension"],
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
name: "list_skills",
|
|
131
|
-
title: "List Skills",
|
|
132
|
-
kind: "skill",
|
|
133
|
-
tier: "extension",
|
|
134
|
-
...TOOL_POLICY_METADATA.list_skills,
|
|
135
|
-
permissions: {
|
|
136
|
-
level: "readonly",
|
|
137
|
-
scopes: ["skill:read"],
|
|
138
|
-
},
|
|
139
|
-
telemetry: {
|
|
140
|
-
category: "skill",
|
|
141
|
-
tags: ["tool:list_skills", "contract:coding-agent", "tier:extension"],
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
name: "run_code",
|
|
146
|
-
title: "Run Code",
|
|
147
|
-
kind: "code",
|
|
148
|
-
tier: "extension",
|
|
149
|
-
...TOOL_POLICY_METADATA.run_code,
|
|
150
|
-
permissions: {
|
|
151
|
-
level: "elevated",
|
|
152
|
-
scopes: ["process:spawn", "filesystem:workspace", "runtime:script"],
|
|
153
|
-
},
|
|
154
|
-
telemetry: {
|
|
155
|
-
category: "code",
|
|
156
|
-
tags: ["tool:run_code", "contract:coding-agent", "tier:extension"],
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
name: "spawn_sub_agent",
|
|
161
|
-
title: "Spawn Sub Agent",
|
|
162
|
-
kind: "agent",
|
|
163
|
-
tier: "extension",
|
|
164
|
-
...TOOL_POLICY_METADATA.spawn_sub_agent,
|
|
165
|
-
permissions: {
|
|
166
|
-
level: "elevated",
|
|
167
|
-
scopes: ["agent:spawn"],
|
|
168
|
-
},
|
|
169
|
-
telemetry: {
|
|
170
|
-
category: "agent",
|
|
171
|
-
tags: ["tool:spawn_sub_agent", "contract:coding-agent", "tier:extension"],
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
]);
|
|
175
|
-
|
|
176
|
-
export const CODING_AGENT_MVP_TOOL_NAMES = Object.freeze(
|
|
177
|
-
CODING_AGENT_TOOL_CONTRACTS.filter((tool) => tool.tier === "mvp").map(
|
|
178
|
-
(tool) => tool.name,
|
|
179
|
-
),
|
|
180
|
-
);
|
|
181
|
-
|
|
182
|
-
export const CODING_AGENT_EXTENSION_TOOL_NAMES = Object.freeze(
|
|
183
|
-
CODING_AGENT_TOOL_CONTRACTS.filter((tool) => tool.tier === "extension").map(
|
|
184
|
-
(tool) => tool.name,
|
|
185
|
-
),
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
const TOOL_CONTRACT_MAP = new Map(
|
|
189
|
-
CODING_AGENT_TOOL_CONTRACTS.map((tool) => [tool.name, tool]),
|
|
190
|
-
);
|
|
191
16
|
const runtimeRegistry = createDefaultToolRegistry();
|
|
192
17
|
|
|
193
18
|
function cloneValue(value) {
|
|
@@ -216,44 +41,17 @@ function getFallbackToolContract(name) {
|
|
|
216
41
|
};
|
|
217
42
|
}
|
|
218
43
|
|
|
219
|
-
export
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}).map(cloneValue);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
export function listCodingAgentToolNames({ tier = null } = {}) {
|
|
234
|
-
return getCodingAgentToolContracts({ tier }).map((tool) => tool.name);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
export function isCodingAgentMvpTool(name) {
|
|
238
|
-
return CODING_AGENT_MVP_TOOL_NAMES.includes(name);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export function getCodingAgentToolPolicy(name) {
|
|
242
|
-
const tool = TOOL_CONTRACT_MAP.get(name);
|
|
243
|
-
if (!tool) {
|
|
244
|
-
return null;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return {
|
|
248
|
-
tier: tool.tier,
|
|
249
|
-
riskLevel: tool.riskLevel,
|
|
250
|
-
availableInPlanMode: tool.availableInPlanMode,
|
|
251
|
-
planModeBehavior: tool.planModeBehavior || "standard",
|
|
252
|
-
requiresPlanApproval: tool.requiresPlanApproval,
|
|
253
|
-
approvalFlow: tool.approvalFlow,
|
|
254
|
-
permissions: cloneValue(tool.permissions),
|
|
255
|
-
};
|
|
256
|
-
}
|
|
44
|
+
export {
|
|
45
|
+
CODING_AGENT_EXTENSION_TOOL_NAMES,
|
|
46
|
+
CODING_AGENT_MVP_TOOL_NAMES,
|
|
47
|
+
getCodingAgentFunctionToolDefinition,
|
|
48
|
+
getCodingAgentFunctionToolDefinitions,
|
|
49
|
+
getCodingAgentToolContract,
|
|
50
|
+
getCodingAgentToolContracts,
|
|
51
|
+
getCodingAgentToolPolicy,
|
|
52
|
+
isCodingAgentMvpTool,
|
|
53
|
+
listCodingAgentToolNames,
|
|
54
|
+
};
|
|
257
55
|
|
|
258
56
|
export function mapCodingAgentToolDefinition(definition = {}, options = {}) {
|
|
259
57
|
const fn = definition.function || {};
|
|
@@ -269,8 +67,14 @@ export function mapCodingAgentToolDefinition(definition = {}, options = {}) {
|
|
|
269
67
|
name,
|
|
270
68
|
title: contract.title || name,
|
|
271
69
|
kind: contract.kind,
|
|
272
|
-
description: fn.description || "",
|
|
273
|
-
schema: fn.parameters ||
|
|
70
|
+
description: fn.description || contract.description || "",
|
|
71
|
+
schema: fn.parameters ||
|
|
72
|
+
(contract.inputSchema
|
|
73
|
+
? cloneValue(contract.inputSchema)
|
|
74
|
+
: {
|
|
75
|
+
type: "object",
|
|
76
|
+
properties: {},
|
|
77
|
+
}),
|
|
274
78
|
permissions: cloneValue(contract.permissions),
|
|
275
79
|
telemetry: cloneValue(contract.telemetry),
|
|
276
80
|
source: options.source || "agent-core",
|
|
@@ -286,9 +90,25 @@ export function createCodingAgentToolRegistry(definitions = [], options = {}) {
|
|
|
286
90
|
}
|
|
287
91
|
|
|
288
92
|
export function getCodingAgentRuntimeDescriptor(toolName) {
|
|
289
|
-
const descriptorName =
|
|
93
|
+
const descriptorName = getCodingAgentToolContract(toolName)?.runtimeDescriptor;
|
|
290
94
|
if (!descriptorName) {
|
|
291
95
|
return null;
|
|
292
96
|
}
|
|
293
97
|
return runtimeRegistry.get(descriptorName) || null;
|
|
294
98
|
}
|
|
99
|
+
|
|
100
|
+
export function getCodingAgentRuntimeDescriptorByCommand(command) {
|
|
101
|
+
const trimmed = String(command || "").trim();
|
|
102
|
+
if (!trimmed) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const parts = trimmed.split(/\s+/);
|
|
107
|
+
if (parts[0] === "git") {
|
|
108
|
+
return runtimeRegistry.get("git") || null;
|
|
109
|
+
}
|
|
110
|
+
if (parts[0] === "mcp" || parts.includes("mcp")) {
|
|
111
|
+
return runtimeRegistry.get("mcp") || null;
|
|
112
|
+
}
|
|
113
|
+
return runtimeRegistry.get("shell") || null;
|
|
114
|
+
}
|
|
@@ -108,6 +108,20 @@ const CODING_AGENT_EVENT_TYPES = Object.freeze({
|
|
|
108
108
|
PATCH_APPLIED: "patch.applied",
|
|
109
109
|
PATCH_REJECTED: "patch.rejected",
|
|
110
110
|
PATCH_SUMMARY: "patch.summary",
|
|
111
|
+
|
|
112
|
+
// Persistent task graph + orchestrator — a session-scoped DAG of tasks
|
|
113
|
+
// with dependencies. The runtime serializes the graph to session metadata
|
|
114
|
+
// so it survives CLI restarts; the orchestrator advances the graph by
|
|
115
|
+
// marking ready nodes as `running` when their dependencies complete.
|
|
116
|
+
TASK_GRAPH_CREATED: "task-graph.created",
|
|
117
|
+
TASK_GRAPH_UPDATED: "task-graph.updated",
|
|
118
|
+
TASK_GRAPH_NODE_ADDED: "task-graph.node.added",
|
|
119
|
+
TASK_GRAPH_NODE_UPDATED: "task-graph.node.updated",
|
|
120
|
+
TASK_GRAPH_NODE_COMPLETED: "task-graph.node.completed",
|
|
121
|
+
TASK_GRAPH_NODE_FAILED: "task-graph.node.failed",
|
|
122
|
+
TASK_GRAPH_ADVANCED: "task-graph.advanced",
|
|
123
|
+
TASK_GRAPH_COMPLETED: "task-graph.completed",
|
|
124
|
+
TASK_GRAPH_STATE: "task-graph.state",
|
|
111
125
|
});
|
|
112
126
|
|
|
113
127
|
const VALID_TYPE_SET = new Set(Object.values(CODING_AGENT_EVENT_TYPES));
|
|
@@ -74,6 +74,16 @@ const TOOL_POLICY_METADATA = Object.freeze({
|
|
|
74
74
|
approvalFlow: "plan",
|
|
75
75
|
isReadOnly: false,
|
|
76
76
|
},
|
|
77
|
+
edit_file_hashed: {
|
|
78
|
+
riskLevel: RISK_LEVELS.MEDIUM,
|
|
79
|
+
category: TOOL_CATEGORIES.WRITE,
|
|
80
|
+
availableInPlanMode: false,
|
|
81
|
+
planModeBehavior: "blocked",
|
|
82
|
+
requiresPlanApproval: true,
|
|
83
|
+
requiresConfirmation: false,
|
|
84
|
+
approvalFlow: "plan",
|
|
85
|
+
isReadOnly: false,
|
|
86
|
+
},
|
|
77
87
|
write_file: {
|
|
78
88
|
riskLevel: RISK_LEVELS.MEDIUM,
|
|
79
89
|
category: TOOL_CATEGORIES.WRITE,
|
|
@@ -193,14 +203,53 @@ function resolveToolPolicy(toolName, descriptor = null) {
|
|
|
193
203
|
base.riskLevel = normalizeRiskLevel(descriptor.riskLevel, base.riskLevel);
|
|
194
204
|
}
|
|
195
205
|
|
|
206
|
+
if (descriptor?.category) {
|
|
207
|
+
base.category = descriptor.category;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (typeof descriptor?.availableInPlanMode === "boolean") {
|
|
211
|
+
base.availableInPlanMode = descriptor.availableInPlanMode;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (descriptor?.planModeBehavior) {
|
|
215
|
+
base.planModeBehavior = descriptor.planModeBehavior;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (typeof descriptor?.requiresPlanApproval === "boolean") {
|
|
219
|
+
base.requiresPlanApproval = descriptor.requiresPlanApproval;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (typeof descriptor?.requiresConfirmation === "boolean") {
|
|
223
|
+
base.requiresConfirmation = descriptor.requiresConfirmation;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (descriptor?.approvalFlow) {
|
|
227
|
+
base.approvalFlow = descriptor.approvalFlow;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (Array.isArray(descriptor?.readOnlySubcommands)) {
|
|
231
|
+
base.readOnlySubcommands = [...descriptor.readOnlySubcommands];
|
|
232
|
+
}
|
|
233
|
+
|
|
196
234
|
if (descriptor?.isReadOnly === true) {
|
|
197
235
|
base.isReadOnly = true;
|
|
198
236
|
base.riskLevel = RISK_LEVELS.LOW;
|
|
199
|
-
base.
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
237
|
+
base.category = descriptor?.category || TOOL_CATEGORIES.READ;
|
|
238
|
+
if (typeof descriptor?.availableInPlanMode !== "boolean") {
|
|
239
|
+
base.availableInPlanMode = true;
|
|
240
|
+
}
|
|
241
|
+
if (!descriptor?.planModeBehavior) {
|
|
242
|
+
base.planModeBehavior = "allow";
|
|
243
|
+
}
|
|
244
|
+
if (typeof descriptor?.requiresPlanApproval !== "boolean") {
|
|
245
|
+
base.requiresPlanApproval = false;
|
|
246
|
+
}
|
|
247
|
+
if (typeof descriptor?.requiresConfirmation !== "boolean") {
|
|
248
|
+
base.requiresConfirmation = false;
|
|
249
|
+
}
|
|
250
|
+
if (!descriptor?.approvalFlow) {
|
|
251
|
+
base.approvalFlow = "auto";
|
|
252
|
+
}
|
|
204
253
|
}
|
|
205
254
|
|
|
206
255
|
return base;
|