@getpaseo/server 0.1.29 → 0.1.30
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/server/server/agent/provider-manifest.d.ts +10 -1
- package/dist/server/server/agent/provider-manifest.d.ts.map +1 -1
- package/dist/server/server/agent/provider-manifest.js +16 -45
- package/dist/server/server/agent/provider-manifest.js.map +1 -1
- package/dist/server/server/agent/providers/claude/partial-json.d.ts +5 -0
- package/dist/server/server/agent/providers/claude/partial-json.d.ts.map +1 -0
- package/dist/server/server/agent/providers/claude/partial-json.js +306 -0
- package/dist/server/server/agent/providers/claude/partial-json.js.map +1 -0
- package/dist/server/server/agent/providers/claude-agent.d.ts.map +1 -1
- package/dist/server/server/agent/providers/claude-agent.js +22 -7
- package/dist/server/server/agent/providers/claude-agent.js.map +1 -1
- package/dist/src/server/agent/provider-manifest.js +16 -45
- package/dist/src/server/agent/provider-manifest.js.map +1 -1
- package/dist/src/server/agent/providers/claude/partial-json.js +306 -0
- package/dist/src/server/agent/providers/claude/partial-json.js.map +1 -0
- package/dist/src/server/agent/providers/claude-agent.js +22 -7
- package/dist/src/server/agent/providers/claude-agent.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,54 +1,18 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
const CLAUDE_MODES = [
|
|
3
|
-
{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
id: "acceptEdits",
|
|
10
|
-
label: "Accept File Edits",
|
|
11
|
-
description: "Automatically approves edit-focused tools without prompting",
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
id: "plan",
|
|
15
|
-
label: "Plan Mode",
|
|
16
|
-
description: "Analyze the codebase without executing tools or edits",
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
id: "bypassPermissions",
|
|
20
|
-
label: "Bypass",
|
|
21
|
-
description: "Skip all permission prompts (use with caution)",
|
|
22
|
-
},
|
|
3
|
+
{ id: "default", label: "Always Ask", description: "Prompts for permission the first time a tool is used", icon: "ShieldCheck", colorTier: "safe" },
|
|
4
|
+
{ id: "acceptEdits", label: "Accept File Edits", description: "Automatically approves edit-focused tools without prompting", icon: "ShieldAlert", colorTier: "moderate" },
|
|
5
|
+
{ id: "plan", label: "Plan Mode", description: "Analyze the codebase without executing tools or edits", icon: "ShieldCheck", colorTier: "readonly" },
|
|
6
|
+
{ id: "bypassPermissions", label: "Bypass", description: "Skip all permission prompts (use with caution)", icon: "ShieldAlert", colorTier: "dangerous" },
|
|
23
7
|
];
|
|
24
8
|
const CODEX_MODES = [
|
|
25
|
-
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
description: "Read files and answer questions. Manual approval required for edits, commands, or network ops.",
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
id: "auto",
|
|
32
|
-
label: "Auto",
|
|
33
|
-
description: "Edit files and run commands but still request approval before escalating scope.",
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
id: "full-access",
|
|
37
|
-
label: "Full Access",
|
|
38
|
-
description: "Edit files, run commands, and access the network without additional prompts.",
|
|
39
|
-
},
|
|
9
|
+
{ id: "read-only", label: "Read Only", description: "Read files and answer questions. Manual approval required for edits, commands, or network ops.", icon: "ShieldCheck", colorTier: "readonly" },
|
|
10
|
+
{ id: "auto", label: "Auto", description: "Edit files and run commands but still request approval before escalating scope.", icon: "ShieldAlert", colorTier: "moderate" },
|
|
11
|
+
{ id: "full-access", label: "Full Access", description: "Edit files, run commands, and access the network without additional prompts.", icon: "ShieldAlert", colorTier: "dangerous" },
|
|
40
12
|
];
|
|
41
13
|
const OPENCODE_MODES = [
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
label: "Build",
|
|
45
|
-
description: "Allows edits and tool execution for implementation work",
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
id: "plan",
|
|
49
|
-
label: "Plan",
|
|
50
|
-
description: "Read-only planning mode that avoids file edits",
|
|
51
|
-
},
|
|
14
|
+
{ id: "build", label: "Build", description: "Allows edits and tool execution for implementation work", icon: "ShieldCheck", colorTier: "default" },
|
|
15
|
+
{ id: "plan", label: "Plan", description: "Read-only planning mode that avoids file edits", icon: "ShieldCheck", colorTier: "readonly" },
|
|
52
16
|
];
|
|
53
17
|
export const AGENT_PROVIDER_DEFINITIONS = [
|
|
54
18
|
{
|
|
@@ -99,4 +63,11 @@ export const AgentProviderSchema = z.enum(AGENT_PROVIDER_IDS);
|
|
|
99
63
|
export function isValidAgentProvider(value) {
|
|
100
64
|
return AGENT_PROVIDER_IDS.includes(value);
|
|
101
65
|
}
|
|
66
|
+
export function getModeVisuals(provider, modeId) {
|
|
67
|
+
const definition = AGENT_PROVIDER_DEFINITIONS.find((entry) => entry.id === provider);
|
|
68
|
+
const mode = definition?.modes.find((m) => m.id === modeId);
|
|
69
|
+
if (!mode)
|
|
70
|
+
return undefined;
|
|
71
|
+
return { icon: mode.icon, colorTier: mode.colorTier };
|
|
72
|
+
}
|
|
102
73
|
//# sourceMappingURL=provider-manifest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-manifest.js","sourceRoot":"","sources":["../../../../src/server/agent/provider-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"provider-manifest.js","sourceRoot":"","sources":["../../../../src/server/agent/provider-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0BxB,MAAM,YAAY,GAAkC;IAClD,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,sDAAsD,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE;IACnJ,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,6DAA6D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,MAAc;IAC7D,MAAM,UAAU,GAAG,0BAA0B,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC;IACrF,MAAM,IAAI,GAAG,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC;IAC5D,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
function skipWhitespace(input, index) {
|
|
2
|
+
let currentIndex = index;
|
|
3
|
+
while (currentIndex < input.length && /\s/u.test(input[currentIndex] ?? "")) {
|
|
4
|
+
currentIndex += 1;
|
|
5
|
+
}
|
|
6
|
+
return currentIndex;
|
|
7
|
+
}
|
|
8
|
+
function parsePartialString(input, index) {
|
|
9
|
+
if (input[index] !== "\"") {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
let currentIndex = index + 1;
|
|
13
|
+
let value = "";
|
|
14
|
+
while (currentIndex < input.length) {
|
|
15
|
+
const character = input[currentIndex];
|
|
16
|
+
if (character === "\"") {
|
|
17
|
+
return {
|
|
18
|
+
value,
|
|
19
|
+
nextIndex: currentIndex + 1,
|
|
20
|
+
complete: true,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
if (character === "\\") {
|
|
24
|
+
const escapeCharacter = input[currentIndex + 1];
|
|
25
|
+
if (escapeCharacter === undefined) {
|
|
26
|
+
return {
|
|
27
|
+
value,
|
|
28
|
+
nextIndex: input.length,
|
|
29
|
+
complete: false,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
switch (escapeCharacter) {
|
|
33
|
+
case "\"":
|
|
34
|
+
case "\\":
|
|
35
|
+
case "/":
|
|
36
|
+
value += escapeCharacter;
|
|
37
|
+
currentIndex += 2;
|
|
38
|
+
continue;
|
|
39
|
+
case "b":
|
|
40
|
+
value += "\b";
|
|
41
|
+
currentIndex += 2;
|
|
42
|
+
continue;
|
|
43
|
+
case "f":
|
|
44
|
+
value += "\f";
|
|
45
|
+
currentIndex += 2;
|
|
46
|
+
continue;
|
|
47
|
+
case "n":
|
|
48
|
+
value += "\n";
|
|
49
|
+
currentIndex += 2;
|
|
50
|
+
continue;
|
|
51
|
+
case "r":
|
|
52
|
+
value += "\r";
|
|
53
|
+
currentIndex += 2;
|
|
54
|
+
continue;
|
|
55
|
+
case "t":
|
|
56
|
+
value += "\t";
|
|
57
|
+
currentIndex += 2;
|
|
58
|
+
continue;
|
|
59
|
+
case "u": {
|
|
60
|
+
const hex = input.slice(currentIndex + 2, currentIndex + 6);
|
|
61
|
+
if (hex.length < 4 || !/^[0-9a-fA-F]{4}$/u.test(hex)) {
|
|
62
|
+
return {
|
|
63
|
+
value,
|
|
64
|
+
nextIndex: input.length,
|
|
65
|
+
complete: false,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
value += String.fromCodePoint(Number.parseInt(hex, 16));
|
|
69
|
+
currentIndex += 6;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
default:
|
|
73
|
+
return {
|
|
74
|
+
value,
|
|
75
|
+
nextIndex: input.length,
|
|
76
|
+
complete: false,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
value += character;
|
|
81
|
+
currentIndex += 1;
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
value,
|
|
85
|
+
nextIndex: input.length,
|
|
86
|
+
complete: false,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function parsePartialLiteral(input, index) {
|
|
90
|
+
const remaining = input.slice(index);
|
|
91
|
+
if (remaining.startsWith("true")) {
|
|
92
|
+
return { value: true, nextIndex: index + 4, complete: true };
|
|
93
|
+
}
|
|
94
|
+
if (remaining.startsWith("false")) {
|
|
95
|
+
return { value: false, nextIndex: index + 5, complete: true };
|
|
96
|
+
}
|
|
97
|
+
if (remaining.startsWith("null")) {
|
|
98
|
+
return { value: null, nextIndex: index + 4, complete: true };
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
function parsePartialNumber(input, index) {
|
|
103
|
+
const match = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/u.exec(input.slice(index));
|
|
104
|
+
if (!match?.[0]) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
value: Number(match[0]),
|
|
109
|
+
nextIndex: index + match[0].length,
|
|
110
|
+
complete: true,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function parsePartialArray(input, index) {
|
|
114
|
+
if (input[index] !== "[") {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
const values = [];
|
|
118
|
+
let currentIndex = index + 1;
|
|
119
|
+
while (currentIndex <= input.length) {
|
|
120
|
+
currentIndex = skipWhitespace(input, currentIndex);
|
|
121
|
+
const nextCharacter = input[currentIndex];
|
|
122
|
+
if (nextCharacter === "]") {
|
|
123
|
+
return {
|
|
124
|
+
value: values,
|
|
125
|
+
nextIndex: currentIndex + 1,
|
|
126
|
+
complete: true,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
if (nextCharacter === undefined) {
|
|
130
|
+
return {
|
|
131
|
+
value: values,
|
|
132
|
+
nextIndex: input.length,
|
|
133
|
+
complete: false,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const parsedValue = parsePartialJsonValue(input, currentIndex);
|
|
137
|
+
if (!parsedValue) {
|
|
138
|
+
return {
|
|
139
|
+
value: values,
|
|
140
|
+
nextIndex: currentIndex,
|
|
141
|
+
complete: false,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
values.push(parsedValue.value);
|
|
145
|
+
currentIndex = skipWhitespace(input, parsedValue.nextIndex);
|
|
146
|
+
if (!parsedValue.complete) {
|
|
147
|
+
return {
|
|
148
|
+
value: values,
|
|
149
|
+
nextIndex: currentIndex,
|
|
150
|
+
complete: false,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
const delimiter = input[currentIndex];
|
|
154
|
+
if (delimiter === ",") {
|
|
155
|
+
currentIndex += 1;
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
if (delimiter === "]") {
|
|
159
|
+
return {
|
|
160
|
+
value: values,
|
|
161
|
+
nextIndex: currentIndex + 1,
|
|
162
|
+
complete: true,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
if (delimiter === undefined) {
|
|
166
|
+
return {
|
|
167
|
+
value: values,
|
|
168
|
+
nextIndex: input.length,
|
|
169
|
+
complete: false,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
value: values,
|
|
174
|
+
nextIndex: currentIndex,
|
|
175
|
+
complete: false,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
value: values,
|
|
180
|
+
nextIndex: input.length,
|
|
181
|
+
complete: false,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function parsePartialObject(input, index) {
|
|
185
|
+
if (input[index] !== "{") {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
const value = {};
|
|
189
|
+
let currentIndex = index + 1;
|
|
190
|
+
while (currentIndex <= input.length) {
|
|
191
|
+
currentIndex = skipWhitespace(input, currentIndex);
|
|
192
|
+
const nextCharacter = input[currentIndex];
|
|
193
|
+
if (nextCharacter === "}") {
|
|
194
|
+
return {
|
|
195
|
+
value,
|
|
196
|
+
nextIndex: currentIndex + 1,
|
|
197
|
+
complete: true,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
if (nextCharacter === undefined) {
|
|
201
|
+
return {
|
|
202
|
+
value,
|
|
203
|
+
nextIndex: input.length,
|
|
204
|
+
complete: false,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
const parsedKey = parsePartialString(input, currentIndex);
|
|
208
|
+
if (!parsedKey?.complete) {
|
|
209
|
+
return {
|
|
210
|
+
value,
|
|
211
|
+
nextIndex: parsedKey?.nextIndex ?? currentIndex,
|
|
212
|
+
complete: false,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
currentIndex = skipWhitespace(input, parsedKey.nextIndex);
|
|
216
|
+
if (input[currentIndex] !== ":") {
|
|
217
|
+
return {
|
|
218
|
+
value,
|
|
219
|
+
nextIndex: currentIndex,
|
|
220
|
+
complete: false,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
currentIndex = skipWhitespace(input, currentIndex + 1);
|
|
224
|
+
const parsedMemberValue = parsePartialJsonValue(input, currentIndex);
|
|
225
|
+
if (!parsedMemberValue) {
|
|
226
|
+
return {
|
|
227
|
+
value,
|
|
228
|
+
nextIndex: currentIndex,
|
|
229
|
+
complete: false,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
value[parsedKey.value] = parsedMemberValue.value;
|
|
233
|
+
currentIndex = skipWhitespace(input, parsedMemberValue.nextIndex);
|
|
234
|
+
if (!parsedMemberValue.complete) {
|
|
235
|
+
return {
|
|
236
|
+
value,
|
|
237
|
+
nextIndex: currentIndex,
|
|
238
|
+
complete: false,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
const delimiter = input[currentIndex];
|
|
242
|
+
if (delimiter === ",") {
|
|
243
|
+
currentIndex += 1;
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
if (delimiter === "}") {
|
|
247
|
+
return {
|
|
248
|
+
value,
|
|
249
|
+
nextIndex: currentIndex + 1,
|
|
250
|
+
complete: true,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
if (delimiter === undefined) {
|
|
254
|
+
return {
|
|
255
|
+
value,
|
|
256
|
+
nextIndex: input.length,
|
|
257
|
+
complete: false,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
return {
|
|
261
|
+
value,
|
|
262
|
+
nextIndex: currentIndex,
|
|
263
|
+
complete: false,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
return {
|
|
267
|
+
value,
|
|
268
|
+
nextIndex: input.length,
|
|
269
|
+
complete: false,
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
function parsePartialJsonValue(input, index) {
|
|
273
|
+
const currentIndex = skipWhitespace(input, index);
|
|
274
|
+
const character = input[currentIndex];
|
|
275
|
+
if (character === undefined) {
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
if (character === "\"") {
|
|
279
|
+
return parsePartialString(input, currentIndex);
|
|
280
|
+
}
|
|
281
|
+
if (character === "{") {
|
|
282
|
+
return parsePartialObject(input, currentIndex);
|
|
283
|
+
}
|
|
284
|
+
if (character === "[") {
|
|
285
|
+
return parsePartialArray(input, currentIndex);
|
|
286
|
+
}
|
|
287
|
+
if (character === "t" || character === "f" || character === "n") {
|
|
288
|
+
return parsePartialLiteral(input, currentIndex);
|
|
289
|
+
}
|
|
290
|
+
if (character === "-" || /\d/u.test(character)) {
|
|
291
|
+
return parsePartialNumber(input, currentIndex);
|
|
292
|
+
}
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
export function parsePartialJsonObject(input) {
|
|
296
|
+
const currentIndex = skipWhitespace(input, 0);
|
|
297
|
+
const parsed = parsePartialObject(input, currentIndex);
|
|
298
|
+
if (!parsed) {
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
return {
|
|
302
|
+
value: parsed.value,
|
|
303
|
+
complete: parsed.complete && skipWhitespace(input, parsed.nextIndex) === input.length,
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=partial-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partial-json.js","sourceRoot":"","sources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E,CAAC;QAChE,OAAO,mBAAmB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IAClD,CAAC;IACD,IAAI,SAAS,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/C,OAAO,kBAAkB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,KAAa;IAEb,MAAM,YAAY,GAAG,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,kBAAkB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IACvD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,QAAQ,EACN,MAAM,CAAC,QAAQ,IAAI,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK,KAAK,CAAC,MAAM;KAC9E,CAAC;AACJ,CAAC"}
|
|
@@ -8,6 +8,7 @@ import { query, } from "@anthropic-ai/claude-agent-sdk";
|
|
|
8
8
|
import { mapClaudeCanceledToolCall, mapClaudeCompletedToolCall, mapClaudeFailedToolCall, mapClaudeRunningToolCall, } from "./claude/tool-call-mapper.js";
|
|
9
9
|
import { isTaskNotificationUserContent, mapTaskNotificationSystemRecordToToolCall, mapTaskNotificationUserContentToToolCall, } from "./claude/task-notification-tool-call.js";
|
|
10
10
|
import { buildClaudeModelFamilyAliases, buildClaudeSelectableModelIds, listClaudeCatalogModels, } from "./claude/model-catalog.js";
|
|
11
|
+
import { parsePartialJsonObject } from "./claude/partial-json.js";
|
|
11
12
|
import { buildToolCallDisplayModel } from "../../../shared/tool-call-display.js";
|
|
12
13
|
import { applyProviderEnv, } from "../provider-launch-config.js";
|
|
13
14
|
import { getOrchestratorModeInstructions } from "../orchestrator-instructions.js";
|
|
@@ -3407,16 +3408,19 @@ class ClaudeAgentSession {
|
|
|
3407
3408
|
}
|
|
3408
3409
|
const buffer = (this.toolUseInputBuffers.get(toolId) ?? "") + partialJson;
|
|
3409
3410
|
this.toolUseInputBuffers.set(toolId, buffer);
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3411
|
+
const entry = this.toolUseCache.get(toolId);
|
|
3412
|
+
const parsed = parsePartialJsonObject(buffer);
|
|
3413
|
+
if (!entry || !parsed) {
|
|
3414
|
+
return;
|
|
3413
3415
|
}
|
|
3414
|
-
|
|
3416
|
+
const normalized = this.normalizeToolInput(parsed.value);
|
|
3417
|
+
if (!normalized) {
|
|
3415
3418
|
return;
|
|
3416
3419
|
}
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
+
if (!parsed.complete && Object.keys(normalized).length === 0) {
|
|
3421
|
+
return;
|
|
3422
|
+
}
|
|
3423
|
+
if (this.areToolInputsEqual(entry.input ?? undefined, normalized)) {
|
|
3420
3424
|
return;
|
|
3421
3425
|
}
|
|
3422
3426
|
this.applyToolInput(entry, normalized);
|
|
@@ -3434,6 +3438,17 @@ class ClaudeAgentSession {
|
|
|
3434
3438
|
}
|
|
3435
3439
|
return input;
|
|
3436
3440
|
}
|
|
3441
|
+
areToolInputsEqual(left, right) {
|
|
3442
|
+
if (!left) {
|
|
3443
|
+
return false;
|
|
3444
|
+
}
|
|
3445
|
+
const leftKeys = Object.keys(left);
|
|
3446
|
+
const rightKeys = Object.keys(right);
|
|
3447
|
+
if (leftKeys.length !== rightKeys.length) {
|
|
3448
|
+
return false;
|
|
3449
|
+
}
|
|
3450
|
+
return rightKeys.every((key) => left[key] === right[key]);
|
|
3451
|
+
}
|
|
3437
3452
|
applyToolInput(entry, input) {
|
|
3438
3453
|
entry.input = input;
|
|
3439
3454
|
if (this.isCommandTool(entry.name, input)) {
|