@yukino.js/yukino 0.0.1 → 0.0.3-dev
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 +34 -27
- package/dist/{acp-IVY5HZR4.js → acp-J6EPN6TP.js} +6 -6
- package/dist/{agent-QANDY7FO.js → agent-LA65FOAB.js} +1 -1
- package/dist/anthropic-YP6DY2F3.js +4 -0
- package/dist/{chunk-UPNNYP7M.js → chunk-2UNWKNDU.js} +1 -1
- package/dist/{chunk-T4O4GQVL.js → chunk-675L7SRF.js} +98 -98
- package/dist/{chunk-VWUGGYUP.js → chunk-7CVY4FXY.js} +1 -1
- package/dist/{chunk-SOO5OXX2.js → chunk-CT773IEX.js} +3 -3
- package/dist/{chunk-RAS3ORX3.js → chunk-JEOQXHOX.js} +29 -29
- package/dist/chunk-M5H5EYXN.js +5 -0
- package/dist/{chunk-SAJCBGHL.js → chunk-P77AEADG.js} +1 -1
- package/dist/{chunk-XO7ITAWR.js → chunk-Y6COQ5UY.js} +1 -1
- package/dist/{chunk-RCXKUD3Y.js → chunk-ZQP5DTJA.js} +1 -1
- package/dist/{esm-ZTIYTMTS.js → esm-NCEEJIH3.js} +3 -3
- package/dist/lib/{agent-6FZX4P2Y.js → agent-KDWPLLAV.js} +5 -5
- package/dist/lib/{anthropic-IP23YZ3P.js → anthropic-OJALXK4E.js} +4 -6
- package/dist/lib/{chunk-O7ELJUEK.js → chunk-24L3QT3J.js} +8 -2
- package/dist/lib/{chunk-KA6POJKI.js → chunk-2DEH6DOX.js} +9 -11
- package/dist/lib/{chunk-I34MAQRE.js → chunk-6AKRDUQF.js} +6 -2
- package/dist/lib/{chunk-2VF3XTGH.js → chunk-77FSPN6Y.js} +148 -60
- package/dist/lib/{chunk-5TGXH7BX.js → chunk-7G4AI2PP.js} +5 -55
- package/dist/lib/{chunk-6OMQD7MK.js → chunk-7SU77J32.js} +9 -1
- package/dist/lib/{chunk-FFM2LB4C.js → chunk-EFNPK4SJ.js} +7 -2
- package/dist/lib/{chunk-QYBQT2DM.js → chunk-SS7OJYHN.js} +27 -9
- package/dist/lib/{chunk-AZRC67RW.js → chunk-WOMWIFSN.js} +2 -2
- package/dist/lib/{chunk-5DVQ64YL.js → chunk-ZF52ER22.js} +3 -3
- package/dist/lib/index.d.ts +69 -52
- package/dist/lib/index.js +331 -123
- package/dist/lib/{openai-EMJ6U4FW.js → openai-FB7BBZVN.js} +3 -3
- package/dist/lib/{permissions-KZ5ACZAX.js → permissions-BZRN4RES.js} +3 -3
- package/dist/lib/{providers-2CGZPBFI.js → providers-7ZGRBCQ4.js} +1 -1
- package/dist/lib/{sandbox-runtime-CCQ3X3SM.js → sandbox-runtime-QDN5SXPM.js} +1 -1
- package/dist/lib/{tool-filter-CKHZUUBQ.js → tool-filter-PY6XY254.js} +1 -1
- package/dist/main.js +223 -217
- package/dist/{openai-YXYO5OW6.js → openai-2FE77NB2.js} +14 -14
- package/dist/{permissions-VCDMNX3L.js → permissions-R7P7RWZU.js} +1 -1
- package/dist/{providers-HNMBGGW6.js → providers-EZFC2EPW.js} +1 -1
- package/dist/{server-ZHQILOBP.js → server-54LNMGWU.js} +1 -1
- package/package.json +19 -12
- package/postinstall.mjs +80 -0
- package/dist/anthropic-6YLT4JZR.js +0 -4
- package/dist/chunk-5VOCXSSX.js +0 -5
package/dist/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sandbox_runtime_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EFNPK4SJ.js";
|
|
4
4
|
import {
|
|
5
5
|
seatbelt_exports
|
|
6
6
|
} from "./chunk-FLKB4BK7.js";
|
|
@@ -42,23 +42,23 @@ import {
|
|
|
42
42
|
spillDir,
|
|
43
43
|
telemetry_exports,
|
|
44
44
|
tool_result_exports
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-77FSPN6Y.js";
|
|
46
46
|
import {
|
|
47
47
|
version,
|
|
48
48
|
version_exports
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-WOMWIFSN.js";
|
|
50
50
|
import {
|
|
51
51
|
anthropic_exports,
|
|
52
52
|
decideAndApply,
|
|
53
53
|
strategy_exports
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-7G4AI2PP.js";
|
|
55
55
|
import {
|
|
56
56
|
SKIP_DIRS,
|
|
57
57
|
types_exports
|
|
58
58
|
} from "./chunk-F2YJG72O.js";
|
|
59
59
|
import {
|
|
60
60
|
openai_exports
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-2DEH6DOX.js";
|
|
62
62
|
import {
|
|
63
63
|
DEFAULT_CONTEXT_WINDOW,
|
|
64
64
|
DEFAULT_MAX_OUTPUT_TOKENS,
|
|
@@ -76,19 +76,19 @@ import {
|
|
|
76
76
|
isValidThinkingLevel,
|
|
77
77
|
loadConfig,
|
|
78
78
|
withProjectMcpServers
|
|
79
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-SS7OJYHN.js";
|
|
80
80
|
import {
|
|
81
81
|
PermissionChecker,
|
|
82
82
|
isSafeCommand,
|
|
83
83
|
permissions_exports
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-ZF52ER22.js";
|
|
85
85
|
import {
|
|
86
86
|
MCPToolWrapper,
|
|
87
87
|
MCP_TOOL_PREFIX,
|
|
88
88
|
McpCallTool,
|
|
89
89
|
mcp_call_exports,
|
|
90
90
|
tool_wrapper_exports
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-6AKRDUQF.js";
|
|
92
92
|
import {
|
|
93
93
|
asErrorString,
|
|
94
94
|
asRecord,
|
|
@@ -108,7 +108,7 @@ import {
|
|
|
108
108
|
strArg,
|
|
109
109
|
strList,
|
|
110
110
|
utils_exports
|
|
111
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-7SU77J32.js";
|
|
112
112
|
import {
|
|
113
113
|
SUBAGENT_DISALLOWED_TOOLS,
|
|
114
114
|
TEAMMATE_DISALLOWED_TOOLS,
|
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
filterToolsForAgent,
|
|
117
117
|
registry_exports,
|
|
118
118
|
tool_filter_exports
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-24L3QT3J.js";
|
|
120
120
|
import {
|
|
121
121
|
bwrap_exports
|
|
122
122
|
} from "./chunk-YIWNQ7OA.js";
|
|
@@ -185,16 +185,28 @@ function promptToText(prompt) {
|
|
|
185
185
|
${block.resource.text}`);
|
|
186
186
|
break;
|
|
187
187
|
}
|
|
188
|
-
throw RequestError.invalidParams(
|
|
188
|
+
throw RequestError.invalidParams(
|
|
189
|
+
void 0,
|
|
190
|
+
"Binary resources are not supported."
|
|
191
|
+
);
|
|
189
192
|
case "image":
|
|
190
|
-
throw RequestError.invalidParams(
|
|
193
|
+
throw RequestError.invalidParams(
|
|
194
|
+
void 0,
|
|
195
|
+
"Image prompts are not supported."
|
|
196
|
+
);
|
|
191
197
|
case "audio":
|
|
192
|
-
throw RequestError.invalidParams(
|
|
198
|
+
throw RequestError.invalidParams(
|
|
199
|
+
void 0,
|
|
200
|
+
"Audio prompts are not supported."
|
|
201
|
+
);
|
|
193
202
|
}
|
|
194
203
|
}
|
|
195
204
|
const text = parts.join("\n\n").trim();
|
|
196
205
|
if (!text) {
|
|
197
|
-
throw RequestError.invalidParams(
|
|
206
|
+
throw RequestError.invalidParams(
|
|
207
|
+
void 0,
|
|
208
|
+
"Prompt must contain text or a resource link."
|
|
209
|
+
);
|
|
198
210
|
}
|
|
199
211
|
return text;
|
|
200
212
|
}
|
|
@@ -265,7 +277,12 @@ function agentEventToUpdate(event, workDir, contextWindow) {
|
|
|
265
277
|
case "tool_use":
|
|
266
278
|
return toolCallUpdate(event.toolName, event.toolId, event.args, workDir);
|
|
267
279
|
case "tool_result":
|
|
268
|
-
return toolResultUpdate(
|
|
280
|
+
return toolResultUpdate(
|
|
281
|
+
event.toolId,
|
|
282
|
+
event.output,
|
|
283
|
+
event.isError,
|
|
284
|
+
event.elapsed
|
|
285
|
+
);
|
|
269
286
|
case "usage":
|
|
270
287
|
return {
|
|
271
288
|
sessionUpdate: "usage_update",
|
|
@@ -331,14 +348,23 @@ function* historyNotifications(sessionId, messages, workDir) {
|
|
|
331
348
|
for (const tool of message.tool_uses ?? []) {
|
|
332
349
|
yield {
|
|
333
350
|
sessionId,
|
|
334
|
-
update: toolCallUpdate(
|
|
351
|
+
update: toolCallUpdate(
|
|
352
|
+
tool.tool_name,
|
|
353
|
+
tool.tool_use_id,
|
|
354
|
+
tool.arguments ?? {},
|
|
355
|
+
workDir
|
|
356
|
+
)
|
|
335
357
|
};
|
|
336
358
|
}
|
|
337
359
|
for (const result of message.tool_results ?? []) {
|
|
338
360
|
const output = contentToText(result.content);
|
|
339
361
|
yield {
|
|
340
362
|
sessionId,
|
|
341
|
-
update: toolResultUpdate(
|
|
363
|
+
update: toolResultUpdate(
|
|
364
|
+
result.tool_use_id,
|
|
365
|
+
output,
|
|
366
|
+
result.is_error ?? false
|
|
367
|
+
)
|
|
342
368
|
};
|
|
343
369
|
}
|
|
344
370
|
}
|
|
@@ -886,7 +912,7 @@ function commandName(base, full) {
|
|
|
886
912
|
const rel = full.slice(base.length + 1).replace(/\.md$/, "");
|
|
887
913
|
return rel.split(/[/\\]/).map((p) => p.toLowerCase().replace(/ /g, "-")).join(":");
|
|
888
914
|
}
|
|
889
|
-
var YamlFrontmatterSchema = z.
|
|
915
|
+
var YamlFrontmatterSchema = z.looseObject({
|
|
890
916
|
description: z.string().optional(),
|
|
891
917
|
"argument-hint": z.string().optional(),
|
|
892
918
|
aliases: z.array(z.string()).optional()
|
|
@@ -945,6 +971,7 @@ ${args}`;
|
|
|
945
971
|
var provider_login_exports = {};
|
|
946
972
|
__export(provider_login_exports, {
|
|
947
973
|
ProviderLoginSchema: () => ProviderLoginSchema,
|
|
974
|
+
persistDefaultProvider: () => persistDefaultProvider,
|
|
948
975
|
persistThinkingLevel: () => persistThinkingLevel,
|
|
949
976
|
saveProvider: () => saveProvider
|
|
950
977
|
});
|
|
@@ -1063,6 +1090,14 @@ function persistThinkingLevel(baseUrl, level) {
|
|
|
1063
1090
|
}
|
|
1064
1091
|
writeConfigAtomic(path, { ...config, providers });
|
|
1065
1092
|
}
|
|
1093
|
+
function persistDefaultProvider(index) {
|
|
1094
|
+
const path = globalConfigPath();
|
|
1095
|
+
const config = readConfigRaw(path);
|
|
1096
|
+
if (config.default_provider === index) {
|
|
1097
|
+
return;
|
|
1098
|
+
}
|
|
1099
|
+
writeConfigAtomic(path, { ...config, default_provider: index });
|
|
1100
|
+
}
|
|
1066
1101
|
|
|
1067
1102
|
// src/hooks/index.ts
|
|
1068
1103
|
var hooks_exports = {};
|
|
@@ -1429,21 +1464,21 @@ __export(client_exports, {
|
|
|
1429
1464
|
async function createClient(config, systemPrompt) {
|
|
1430
1465
|
switch (config.protocol) {
|
|
1431
1466
|
case "anthropic": {
|
|
1432
|
-
const { AnthropicClient } = await import("./anthropic-
|
|
1467
|
+
const { AnthropicClient } = await import("./anthropic-OJALXK4E.js");
|
|
1433
1468
|
return registerLlmClient(new AnthropicClient(config, systemPrompt), {
|
|
1434
1469
|
model: config.model,
|
|
1435
1470
|
protocol: config.protocol
|
|
1436
1471
|
});
|
|
1437
1472
|
}
|
|
1438
1473
|
case "openai": {
|
|
1439
|
-
const { OpenAIClient } = await import("./openai-
|
|
1474
|
+
const { OpenAIClient } = await import("./openai-FB7BBZVN.js");
|
|
1440
1475
|
return registerLlmClient(new OpenAIClient(config, systemPrompt), {
|
|
1441
1476
|
model: config.model,
|
|
1442
1477
|
protocol: config.protocol
|
|
1443
1478
|
});
|
|
1444
1479
|
}
|
|
1445
1480
|
case "openai-compat": {
|
|
1446
|
-
const { OpenAICompatClient } = await import("./openai-
|
|
1481
|
+
const { OpenAICompatClient } = await import("./openai-FB7BBZVN.js");
|
|
1447
1482
|
return registerLlmClient(new OpenAICompatClient(config, systemPrompt), {
|
|
1448
1483
|
model: config.model,
|
|
1449
1484
|
protocol: config.protocol
|
|
@@ -2050,7 +2085,10 @@ function buildDiff(oldContent, newContent) {
|
|
|
2050
2085
|
const addedLines = newLines.slice(prefixLen, newLines.length - suffixLen);
|
|
2051
2086
|
const contextStart = Math.max(0, prefixLen - CONTEXT_LINES);
|
|
2052
2087
|
const contextBefore = oldLines.slice(contextStart, prefixLen);
|
|
2053
|
-
const contextEnd = Math.min(
|
|
2088
|
+
const contextEnd = Math.min(
|
|
2089
|
+
oldLines.length,
|
|
2090
|
+
oldLines.length - suffixLen + CONTEXT_LINES
|
|
2091
|
+
);
|
|
2054
2092
|
const contextAfter = oldLines.slice(oldLines.length - suffixLen, contextEnd);
|
|
2055
2093
|
const out = [];
|
|
2056
2094
|
let oldLineNo = contextStart + 1;
|
|
@@ -2105,7 +2143,10 @@ async function canonicalPath2(filePath) {
|
|
|
2105
2143
|
return await realpath(absolutePath);
|
|
2106
2144
|
} catch {
|
|
2107
2145
|
try {
|
|
2108
|
-
return join4(
|
|
2146
|
+
return join4(
|
|
2147
|
+
await realpath(dirname2(absolutePath)),
|
|
2148
|
+
basename(absolutePath)
|
|
2149
|
+
);
|
|
2109
2150
|
} catch {
|
|
2110
2151
|
return absolutePath;
|
|
2111
2152
|
}
|
|
@@ -2237,7 +2278,11 @@ var EditFileTool = class {
|
|
|
2237
2278
|
try {
|
|
2238
2279
|
await writeFile(filePath, newContent, "utf-8");
|
|
2239
2280
|
ctx.fileStateCache?.update(filePath);
|
|
2240
|
-
const {
|
|
2281
|
+
const {
|
|
2282
|
+
text: diffText,
|
|
2283
|
+
additions,
|
|
2284
|
+
removals
|
|
2285
|
+
} = buildDiff(content, newContent);
|
|
2241
2286
|
const summary = replaceAll && count > 1 ? `Updated ${filePath} with ${String(additions)} addition${additions === 1 ? "" : "s"} and ${String(removals)} removal${removals === 1 ? "" : "s"} (${String(count)} replacements)` : `Updated ${filePath} with ${String(additions)} addition${additions === 1 ? "" : "s"} and ${String(removals)} removal${removals === 1 ? "" : "s"}`;
|
|
2242
2287
|
return { output: `${summary}
|
|
2243
2288
|
${diffText}`, isError: false };
|
|
@@ -2338,7 +2383,9 @@ var GlobTool = class {
|
|
|
2338
2383
|
}
|
|
2339
2384
|
mtimes.set(match, mtime);
|
|
2340
2385
|
}
|
|
2341
|
-
matches.sort(
|
|
2386
|
+
matches.sort(
|
|
2387
|
+
(a, b) => (mtimes.get(b) ?? 0) - (mtimes.get(a) ?? 0) || a.localeCompare(b)
|
|
2388
|
+
);
|
|
2342
2389
|
let output = matches.join("\n");
|
|
2343
2390
|
if (matches.length >= maxResults) {
|
|
2344
2391
|
output += `
|
|
@@ -2468,7 +2515,9 @@ var GrepTool = class {
|
|
|
2468
2515
|
}
|
|
2469
2516
|
}
|
|
2470
2517
|
const includeMatcher = include ? new Minimatch(include, { dot: true, matchBase: true }) : null;
|
|
2471
|
-
const matchesInclude = (fullPath) => includeMatcher === null || includeMatcher.match(
|
|
2518
|
+
const matchesInclude = (fullPath) => includeMatcher === null || includeMatcher.match(
|
|
2519
|
+
relative(ctx.workDir, fullPath).split(sep).join("/")
|
|
2520
|
+
);
|
|
2472
2521
|
const results = [];
|
|
2473
2522
|
const walk = async (dir) => {
|
|
2474
2523
|
if (results.length >= MAX_RESULTS) {
|
|
@@ -3168,7 +3217,7 @@ function formatFileSize(bytes) {
|
|
|
3168
3217
|
}
|
|
3169
3218
|
return `${(bytes / 1024 / 1024).toFixed(1)}MB`;
|
|
3170
3219
|
}
|
|
3171
|
-
var SelectedMemoriesSchema = z3.
|
|
3220
|
+
var SelectedMemoriesSchema = z3.looseObject({
|
|
3172
3221
|
selected_memories: z3.array(z3.string())
|
|
3173
3222
|
});
|
|
3174
3223
|
var SELECT_MEMORIES_SYSTEM_PROMPT = `# Task
|
|
@@ -3542,7 +3591,6 @@ var MemoryExtractor = class {
|
|
|
3542
3591
|
inProgress = false;
|
|
3543
3592
|
pendingContext = null;
|
|
3544
3593
|
turnsSinceLastExtraction = 0;
|
|
3545
|
-
lastMemoryMessageIdx = 0;
|
|
3546
3594
|
constructor(client, workDir) {
|
|
3547
3595
|
this.client = client;
|
|
3548
3596
|
this.workDir = workDir;
|
|
@@ -4207,7 +4255,10 @@ var SkillCatalog = class {
|
|
|
4207
4255
|
this.load(this.workDir);
|
|
4208
4256
|
}
|
|
4209
4257
|
snapshotDirModTimes() {
|
|
4210
|
-
for (const dir of /* @__PURE__ */ new Set([
|
|
4258
|
+
for (const dir of /* @__PURE__ */ new Set([
|
|
4259
|
+
...this.skillDirPaths(),
|
|
4260
|
+
...this.dirModTimes.keys()
|
|
4261
|
+
])) {
|
|
4211
4262
|
try {
|
|
4212
4263
|
this.dirModTimes.set(dir, statSync7(dir).mtimeMs);
|
|
4213
4264
|
} catch {
|
|
@@ -4331,7 +4382,9 @@ var YamlFrontmatterSchema2 = z4.looseObject({
|
|
|
4331
4382
|
});
|
|
4332
4383
|
function parseSkillFile(content) {
|
|
4333
4384
|
const normalized = content.replace(/^\uFEFF/, "");
|
|
4334
|
-
const match = /^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/.exec(
|
|
4385
|
+
const match = /^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/.exec(
|
|
4386
|
+
normalized
|
|
4387
|
+
);
|
|
4335
4388
|
if (!match) {
|
|
4336
4389
|
return null;
|
|
4337
4390
|
}
|
|
@@ -4432,7 +4485,9 @@ async function runFork(skill, args, host) {
|
|
|
4432
4485
|
let prompt = buildSkillPrompt(skill, args);
|
|
4433
4486
|
const contextMode = skill.meta.forkContext ?? "none";
|
|
4434
4487
|
if (contextMode !== "none") {
|
|
4435
|
-
const context = host.snapshotParentMessages(
|
|
4488
|
+
const context = host.snapshotParentMessages(
|
|
4489
|
+
contextMode === "recent" ? 5 : 100
|
|
4490
|
+
);
|
|
4436
4491
|
prompt = `<parent-context>
|
|
4437
4492
|
${escapeSkillXml(context)}
|
|
4438
4493
|
</parent-context>
|
|
@@ -4487,7 +4542,10 @@ var LoadSkillTool = class {
|
|
|
4487
4542
|
}
|
|
4488
4543
|
if (skill.meta.mode === "fork" && this.forkHost) {
|
|
4489
4544
|
try {
|
|
4490
|
-
return {
|
|
4545
|
+
return {
|
|
4546
|
+
output: await runFork(skill, "", this.forkHost),
|
|
4547
|
+
isError: false
|
|
4548
|
+
};
|
|
4491
4549
|
} catch (err) {
|
|
4492
4550
|
return {
|
|
4493
4551
|
output: `Skill '${name}' fork execution failed: ${asErrorString(err)}`,
|
|
@@ -4726,7 +4784,9 @@ var TaskManager = class {
|
|
|
4726
4784
|
return stopped;
|
|
4727
4785
|
}
|
|
4728
4786
|
async stopAll() {
|
|
4729
|
-
const running = this.list().filter(
|
|
4787
|
+
const running = this.list().filter(
|
|
4788
|
+
(task) => this.pendingTaskIds.has(task.id)
|
|
4789
|
+
);
|
|
4730
4790
|
for (const task of running) {
|
|
4731
4791
|
this.stop(task.id);
|
|
4732
4792
|
}
|
|
@@ -4773,7 +4833,12 @@ __export(task_tools_exports, {
|
|
|
4773
4833
|
TeamTaskListTool: () => TeamTaskListTool,
|
|
4774
4834
|
TeamTaskUpdateTool: () => TeamTaskUpdateTool
|
|
4775
4835
|
});
|
|
4776
|
-
var VALID_STATUSES = /* @__PURE__ */ new Set([
|
|
4836
|
+
var VALID_STATUSES = /* @__PURE__ */ new Set([
|
|
4837
|
+
"pending",
|
|
4838
|
+
"in_progress",
|
|
4839
|
+
"completed",
|
|
4840
|
+
"blocked"
|
|
4841
|
+
]);
|
|
4777
4842
|
var TeamTaskCreateTool = class {
|
|
4778
4843
|
constructor(mgr, teamName, agentName = "") {
|
|
4779
4844
|
this.mgr = mgr;
|
|
@@ -5124,7 +5189,12 @@ function typed(from, type, requestId, text, approve) {
|
|
|
5124
5189
|
}
|
|
5125
5190
|
function shutdownRequest(from, reason = "") {
|
|
5126
5191
|
const why = reason || "team is wrapping up";
|
|
5127
|
-
return typed(
|
|
5192
|
+
return typed(
|
|
5193
|
+
from,
|
|
5194
|
+
MSG_SHUTDOWN_REQUEST,
|
|
5195
|
+
newRequestId(),
|
|
5196
|
+
`${SHUTDOWN_PREFIX} ${why}`
|
|
5197
|
+
);
|
|
5128
5198
|
}
|
|
5129
5199
|
function shutdownResponse(from, requestId, approve, reason = "") {
|
|
5130
5200
|
return typed(from, MSG_SHUTDOWN_RESPONSE, requestId, reason, approve);
|
|
@@ -5375,7 +5445,12 @@ var SendMessageTool = class {
|
|
|
5375
5445
|
isError: true
|
|
5376
5446
|
};
|
|
5377
5447
|
}
|
|
5378
|
-
structured = shutdownResponse(
|
|
5448
|
+
structured = shutdownResponse(
|
|
5449
|
+
this.senderName,
|
|
5450
|
+
requestId,
|
|
5451
|
+
approve,
|
|
5452
|
+
message
|
|
5453
|
+
);
|
|
5379
5454
|
break;
|
|
5380
5455
|
case MSG_PLAN_APPROVAL_RESPONSE:
|
|
5381
5456
|
if (!requestId || approve === void 0) {
|
|
@@ -5384,7 +5459,12 @@ var SendMessageTool = class {
|
|
|
5384
5459
|
isError: true
|
|
5385
5460
|
};
|
|
5386
5461
|
}
|
|
5387
|
-
structured = planApprovalResponse(
|
|
5462
|
+
structured = planApprovalResponse(
|
|
5463
|
+
this.senderName,
|
|
5464
|
+
requestId,
|
|
5465
|
+
approve,
|
|
5466
|
+
message
|
|
5467
|
+
);
|
|
5388
5468
|
break;
|
|
5389
5469
|
default:
|
|
5390
5470
|
return {
|
|
@@ -5413,6 +5493,10 @@ var SendMessageTool = class {
|
|
|
5413
5493
|
isError: false
|
|
5414
5494
|
};
|
|
5415
5495
|
}
|
|
5496
|
+
if (to === "lead") {
|
|
5497
|
+
await t.leadMailbox.send(this.senderName, message);
|
|
5498
|
+
return { output: `Message sent to '${to}'.`, isError: false };
|
|
5499
|
+
}
|
|
5416
5500
|
const recipient = getNameRegistry().resolve(to) ?? to;
|
|
5417
5501
|
try {
|
|
5418
5502
|
await t.sendMessage(this.senderName, recipient, message);
|
|
@@ -6287,7 +6371,7 @@ ${prompt}`;
|
|
|
6287
6371
|
permissionChecker: ctx.permissionChecker?.forWorkDir(worktree.path)
|
|
6288
6372
|
};
|
|
6289
6373
|
}
|
|
6290
|
-
const { cloneRegistryForFork } = await import("./tool-filter-
|
|
6374
|
+
const { cloneRegistryForFork } = await import("./tool-filter-PY6XY254.js");
|
|
6291
6375
|
const forkedRegistry = cloneRegistryForFork(this.registry);
|
|
6292
6376
|
const snapshot = conversationSnapshot ?? this.conversation.fork();
|
|
6293
6377
|
const output = await this.forkHandler(
|
|
@@ -6616,7 +6700,7 @@ import {
|
|
|
6616
6700
|
import { join as join14 } from "path";
|
|
6617
6701
|
import z6, { safeParse } from "zod";
|
|
6618
6702
|
var log20 = createChildLogger({ module: "teams" });
|
|
6619
|
-
var FileMailMessageSchema = z6.
|
|
6703
|
+
var FileMailMessageSchema = z6.looseObject({
|
|
6620
6704
|
from: z6.string(),
|
|
6621
6705
|
text: z6.string(),
|
|
6622
6706
|
timestamp: z6.string(),
|
|
@@ -6818,17 +6902,17 @@ __export(progress_exports, {
|
|
|
6818
6902
|
summarizeActivities: () => summarizeActivities
|
|
6819
6903
|
});
|
|
6820
6904
|
import { z as z7 } from "zod";
|
|
6821
|
-
var ToolActivitySchema = z7.
|
|
6905
|
+
var ToolActivitySchema = z7.looseObject({
|
|
6822
6906
|
toolName: z7.string(),
|
|
6823
6907
|
input: z7.record(z7.string(), z7.unknown()),
|
|
6824
6908
|
activityDescription: z7.string()
|
|
6825
6909
|
// e.g. "Reading src/foo.ts"
|
|
6826
6910
|
});
|
|
6827
|
-
var ActiveToolSchema = z7.
|
|
6911
|
+
var ActiveToolSchema = z7.looseObject({
|
|
6828
6912
|
toolId: z7.string(),
|
|
6829
6913
|
toolName: z7.string()
|
|
6830
6914
|
});
|
|
6831
|
-
var AgentProgressSchema = z7.
|
|
6915
|
+
var AgentProgressSchema = z7.looseObject({
|
|
6832
6916
|
toolUseCount: z7.number(),
|
|
6833
6917
|
turnCount: z7.number(),
|
|
6834
6918
|
tokenCount: z7.number(),
|
|
@@ -6837,7 +6921,7 @@ var AgentProgressSchema = z7.object({
|
|
|
6837
6921
|
recentActivities: z7.array(ToolActivitySchema)
|
|
6838
6922
|
// circular buffer, max 5
|
|
6839
6923
|
});
|
|
6840
|
-
var TeammateUIStateSchema = z7.
|
|
6924
|
+
var TeammateUIStateSchema = z7.looseObject({
|
|
6841
6925
|
name: z7.string(),
|
|
6842
6926
|
teamName: z7.string(),
|
|
6843
6927
|
status: z7.enum(["running", "idle", "completed", "failed", "stopped"]),
|
|
@@ -6872,7 +6956,10 @@ function recordToolUse(p, toolName, input) {
|
|
|
6872
6956
|
}
|
|
6873
6957
|
function recordToolStart(p, toolId, toolName, input) {
|
|
6874
6958
|
recordToolUse(p, toolName, input);
|
|
6875
|
-
p.activeTools = [
|
|
6959
|
+
p.activeTools = [
|
|
6960
|
+
...p.activeTools.filter((tool) => tool.toolId !== toolId),
|
|
6961
|
+
{ toolId, toolName }
|
|
6962
|
+
];
|
|
6876
6963
|
}
|
|
6877
6964
|
function recordToolResult(p, toolId) {
|
|
6878
6965
|
p.activeTools = p.activeTools.filter((tool) => tool.toolId !== toolId);
|
|
@@ -6934,7 +7021,7 @@ __export(shared_task_exports, {
|
|
|
6934
7021
|
import { readFileSync as readFileSync11, writeFileSync as writeFileSync7, mkdirSync as mkdirSync7, existsSync as existsSync12 } from "fs";
|
|
6935
7022
|
import { dirname as dirname6 } from "path";
|
|
6936
7023
|
import z8, { parse as parse5 } from "zod";
|
|
6937
|
-
var SerializedTaskSchema = z8.
|
|
7024
|
+
var SerializedTaskSchema = z8.looseObject({
|
|
6938
7025
|
id: z8.string(),
|
|
6939
7026
|
title: z8.string(),
|
|
6940
7027
|
description: z8.string().default(""),
|
|
@@ -6944,7 +7031,7 @@ var SerializedTaskSchema = z8.object({
|
|
|
6944
7031
|
blocked_by: z8.array(z8.string()).default([]),
|
|
6945
7032
|
created_by: z8.string().default("")
|
|
6946
7033
|
});
|
|
6947
|
-
var StoreDataSchema = z8.
|
|
7034
|
+
var StoreDataSchema = z8.looseObject({
|
|
6948
7035
|
next_id: z8.number().int().positive().default(1),
|
|
6949
7036
|
tasks: z8.array(SerializedTaskSchema).default([])
|
|
6950
7037
|
});
|
|
@@ -7090,7 +7177,7 @@ import {
|
|
|
7090
7177
|
import { homedir as homedir9 } from "os";
|
|
7091
7178
|
import { dirname as dirname7, join as join15 } from "path";
|
|
7092
7179
|
import z9 from "zod";
|
|
7093
|
-
var TeamMemberEntrySchema = z9.
|
|
7180
|
+
var TeamMemberEntrySchema = z9.looseObject({
|
|
7094
7181
|
agentId: z9.string(),
|
|
7095
7182
|
name: z9.string(),
|
|
7096
7183
|
agentType: z9.string().optional(),
|
|
@@ -7100,7 +7187,7 @@ var TeamMemberEntrySchema = z9.object({
|
|
|
7100
7187
|
backendType: z9.string().optional(),
|
|
7101
7188
|
isActive: z9.boolean().optional()
|
|
7102
7189
|
});
|
|
7103
|
-
var TeamFileSchema = z9.
|
|
7190
|
+
var TeamFileSchema = z9.looseObject({
|
|
7104
7191
|
name: z9.string(),
|
|
7105
7192
|
description: z9.string().optional(),
|
|
7106
7193
|
createdAt: z9.number(),
|
|
@@ -7157,17 +7244,17 @@ import { mkdirSync as mkdirSync9, readFileSync as readFileSync13, writeFileSync
|
|
|
7157
7244
|
import { join as join16 } from "path";
|
|
7158
7245
|
import z10, { parse as parse6 } from "zod";
|
|
7159
7246
|
var log21 = createChildLogger({ module: "teams" });
|
|
7160
|
-
var TranscriptToolUseSchema = z10.
|
|
7247
|
+
var TranscriptToolUseSchema = z10.looseObject({
|
|
7161
7248
|
tool_use_id: z10.string(),
|
|
7162
7249
|
tool_name: z10.string(),
|
|
7163
7250
|
arguments: z10.record(z10.string(), z10.unknown())
|
|
7164
7251
|
});
|
|
7165
|
-
var TranscriptToolResultSchema = z10.
|
|
7252
|
+
var TranscriptToolResultSchema = z10.looseObject({
|
|
7166
7253
|
tool_use_id: z10.string(),
|
|
7167
7254
|
content: z10.string(),
|
|
7168
7255
|
is_error: z10.boolean().optional()
|
|
7169
7256
|
});
|
|
7170
|
-
var TranscriptEntrySchema = z10.
|
|
7257
|
+
var TranscriptEntrySchema = z10.looseObject({
|
|
7171
7258
|
role: z10.string(),
|
|
7172
7259
|
content: z10.string().optional(),
|
|
7173
7260
|
tool_uses: z10.array(TranscriptToolUseSchema).optional(),
|
|
@@ -7248,7 +7335,7 @@ var TaskStopTool = class {
|
|
|
7248
7335
|
properties: {
|
|
7249
7336
|
teammate: {
|
|
7250
7337
|
type: "string",
|
|
7251
|
-
description: "Name of the teammate to stop, exactly as it appears in the from= field of a
|
|
7338
|
+
description: "Name of the teammate to stop, exactly as it appears in the from= field of a task-notification"
|
|
7252
7339
|
},
|
|
7253
7340
|
task_id: {
|
|
7254
7341
|
type: "string",
|
|
@@ -7262,13 +7349,19 @@ var TaskStopTool = class {
|
|
|
7262
7349
|
const name = strArg(args, "teammate", "");
|
|
7263
7350
|
const taskId = strArg(args, "task_id", "");
|
|
7264
7351
|
if (!name && !taskId || name && taskId) {
|
|
7265
|
-
return {
|
|
7352
|
+
return {
|
|
7353
|
+
output: "Error: pass exactly one of teammate or task_id",
|
|
7354
|
+
isError: true
|
|
7355
|
+
};
|
|
7266
7356
|
}
|
|
7267
7357
|
if (taskId) {
|
|
7268
7358
|
const manager = ctx.taskManager?.get(taskId) ? ctx.taskManager : this.taskManager;
|
|
7269
7359
|
const task = manager?.get(taskId);
|
|
7270
7360
|
if (!task) {
|
|
7271
|
-
return {
|
|
7361
|
+
return {
|
|
7362
|
+
output: `Error: background task '${taskId}' not found`,
|
|
7363
|
+
isError: true
|
|
7364
|
+
};
|
|
7272
7365
|
}
|
|
7273
7366
|
if (task.status !== "running") {
|
|
7274
7367
|
return {
|
|
@@ -7485,13 +7578,22 @@ var Team = class _Team {
|
|
|
7485
7578
|
const onEvent = (event) => {
|
|
7486
7579
|
switch (event.type) {
|
|
7487
7580
|
case "tool_use":
|
|
7488
|
-
recordToolStart(
|
|
7581
|
+
recordToolStart(
|
|
7582
|
+
uiState.progress,
|
|
7583
|
+
event.toolId,
|
|
7584
|
+
event.toolName,
|
|
7585
|
+
event.args
|
|
7586
|
+
);
|
|
7489
7587
|
break;
|
|
7490
7588
|
case "tool_result":
|
|
7491
7589
|
recordToolResult(uiState.progress, event.toolId);
|
|
7492
7590
|
break;
|
|
7493
7591
|
case "usage":
|
|
7494
|
-
recordTokens(
|
|
7592
|
+
recordTokens(
|
|
7593
|
+
uiState.progress,
|
|
7594
|
+
event.usage.inputTokens,
|
|
7595
|
+
event.usage.outputTokens
|
|
7596
|
+
);
|
|
7495
7597
|
break;
|
|
7496
7598
|
case "turn_complete":
|
|
7497
7599
|
recordTurnComplete(uiState.progress);
|
|
@@ -7513,12 +7615,18 @@ var Team = class _Team {
|
|
|
7513
7615
|
uiState.lastMessage = result.length > 200 ? result.slice(0, 200) + "..." : result;
|
|
7514
7616
|
if (abortController.signal.aborted || !member.active) {
|
|
7515
7617
|
uiState.status = "stopped";
|
|
7516
|
-
await this.leadMailbox.send(
|
|
7618
|
+
await this.leadMailbox.send(
|
|
7619
|
+
name,
|
|
7620
|
+
`[idle] ${name} (reason: stopped)`
|
|
7621
|
+
);
|
|
7517
7622
|
break;
|
|
7518
7623
|
}
|
|
7519
7624
|
if (member.checker?.mode === "plan") {
|
|
7520
7625
|
uiState.status = "idle";
|
|
7521
|
-
const next = await this.runPlanApproval(
|
|
7626
|
+
const next = await this.runPlanApproval(
|
|
7627
|
+
member,
|
|
7628
|
+
this.readPlanForReview()
|
|
7629
|
+
);
|
|
7522
7630
|
if (next === null) {
|
|
7523
7631
|
break;
|
|
7524
7632
|
}
|
|
@@ -7526,7 +7634,10 @@ var Team = class _Team {
|
|
|
7526
7634
|
continue;
|
|
7527
7635
|
}
|
|
7528
7636
|
uiState.status = "idle";
|
|
7529
|
-
await this.leadMailbox.send(
|
|
7637
|
+
await this.leadMailbox.send(
|
|
7638
|
+
name,
|
|
7639
|
+
`[idle] ${name} (reason: ${idleReason})`
|
|
7640
|
+
);
|
|
7530
7641
|
idleReason = "available";
|
|
7531
7642
|
const pollResult = await this.waitForNextPromptOrShutdown(member);
|
|
7532
7643
|
if (pollResult.shutdown || !member.active) {
|
|
@@ -7659,7 +7770,9 @@ Please revise the plan accordingly and resubmit.`;
|
|
|
7659
7770
|
}
|
|
7660
7771
|
}
|
|
7661
7772
|
async stopAll() {
|
|
7662
|
-
await Promise.allSettled(
|
|
7773
|
+
await Promise.allSettled(
|
|
7774
|
+
[...this.members.values()].map((member) => this.stopOne(member))
|
|
7775
|
+
);
|
|
7663
7776
|
}
|
|
7664
7777
|
/**
|
|
7665
7778
|
* Stops a single teammate: marks it inactive and updates UI state.
|
|
@@ -7685,7 +7798,9 @@ Please revise the plan accordingly and resubmit.`;
|
|
|
7685
7798
|
return [...this.members.values()];
|
|
7686
7799
|
}
|
|
7687
7800
|
getTeammateStates() {
|
|
7688
|
-
return this.listMembers().flatMap(
|
|
7801
|
+
return this.listMembers().flatMap(
|
|
7802
|
+
(member) => member.uiState ? [member.uiState] : []
|
|
7803
|
+
);
|
|
7689
7804
|
}
|
|
7690
7805
|
};
|
|
7691
7806
|
var TeamManager = class {
|
|
@@ -7727,7 +7842,11 @@ var TeamManager = class {
|
|
|
7727
7842
|
return void 0;
|
|
7728
7843
|
}
|
|
7729
7844
|
const mode = tf.members.find((m) => m.backendType)?.backendType;
|
|
7730
|
-
const team = new Team(
|
|
7845
|
+
const team = new Team(
|
|
7846
|
+
tf.name,
|
|
7847
|
+
isTeamMode(mode) ? mode : "in-process",
|
|
7848
|
+
this.workDir
|
|
7849
|
+
);
|
|
7731
7850
|
team.leadAgentId = tf.leadAgentId;
|
|
7732
7851
|
team.description = tf.description;
|
|
7733
7852
|
team.createdAt = tf.createdAt;
|
|
@@ -7749,7 +7868,9 @@ var TeamManager = class {
|
|
|
7749
7868
|
if (cached) {
|
|
7750
7869
|
return cached;
|
|
7751
7870
|
}
|
|
7752
|
-
const store = new SharedTaskStore(
|
|
7871
|
+
const store = new SharedTaskStore(
|
|
7872
|
+
join17(this.teamDir(teamName), "tasks.json")
|
|
7873
|
+
);
|
|
7753
7874
|
this.taskStores.set(teamName, store);
|
|
7754
7875
|
return store;
|
|
7755
7876
|
}
|
|
@@ -8031,7 +8152,15 @@ var TaskUpdateTool = class {
|
|
|
8031
8152
|
isError: true
|
|
8032
8153
|
};
|
|
8033
8154
|
}
|
|
8034
|
-
const {
|
|
8155
|
+
const {
|
|
8156
|
+
taskId,
|
|
8157
|
+
status,
|
|
8158
|
+
subject,
|
|
8159
|
+
description,
|
|
8160
|
+
owner,
|
|
8161
|
+
addBlocks,
|
|
8162
|
+
addBlockedBy
|
|
8163
|
+
} = result.data;
|
|
8035
8164
|
if (!taskId) {
|
|
8036
8165
|
return Promise.resolve({
|
|
8037
8166
|
output: "Error: taskId is required",
|
|
@@ -8071,7 +8200,7 @@ var TaskUpdateTool = class {
|
|
|
8071
8200
|
return { output: `Updated task #${taskId} status`, isError: false };
|
|
8072
8201
|
}
|
|
8073
8202
|
};
|
|
8074
|
-
var TaskUpdateArgsSchema = z12.
|
|
8203
|
+
var TaskUpdateArgsSchema = z12.looseObject({
|
|
8075
8204
|
taskId: z12.string(),
|
|
8076
8205
|
subject: z12.string().optional(),
|
|
8077
8206
|
description: z12.string().optional(),
|
|
@@ -8191,7 +8320,7 @@ __export(ask_user_exports, {
|
|
|
8191
8320
|
AskUserQuestionTool: () => AskUserQuestionTool
|
|
8192
8321
|
});
|
|
8193
8322
|
import { safeParseAsync as safeParseAsync2, z as z13 } from "zod";
|
|
8194
|
-
var QuestionOptionSchema = z13.
|
|
8323
|
+
var QuestionOptionSchema = z13.looseObject({
|
|
8195
8324
|
label: z13.string(),
|
|
8196
8325
|
description: z13.string().optional()
|
|
8197
8326
|
});
|
|
@@ -8281,7 +8410,10 @@ var AskUserQuestionTool = class {
|
|
|
8281
8410
|
success,
|
|
8282
8411
|
data: argsData,
|
|
8283
8412
|
error
|
|
8284
|
-
} = await safeParseAsync2(
|
|
8413
|
+
} = await safeParseAsync2(
|
|
8414
|
+
z13.looseObject({ questions: z13.array(QuestionSchema) }),
|
|
8415
|
+
args
|
|
8416
|
+
);
|
|
8285
8417
|
if (!success) {
|
|
8286
8418
|
return {
|
|
8287
8419
|
output: error.message,
|
|
@@ -8468,7 +8600,10 @@ var EXIT_CODE_HINTS = /* @__PURE__ */ new Map([
|
|
|
8468
8600
|
[2, "syntax error"]
|
|
8469
8601
|
])
|
|
8470
8602
|
],
|
|
8471
|
-
[
|
|
8603
|
+
[
|
|
8604
|
+
"find",
|
|
8605
|
+
/* @__PURE__ */ new Map([[1, "partial success \u2014 some inputs could not be processed"]])
|
|
8606
|
+
],
|
|
8472
8607
|
// Process / batch helpers
|
|
8473
8608
|
[
|
|
8474
8609
|
"xargs",
|
|
@@ -8519,7 +8654,10 @@ var EXIT_CODE_HINTS = /* @__PURE__ */ new Map([
|
|
|
8519
8654
|
["python", /* @__PURE__ */ new Map([[1, "unhandled exception"]])],
|
|
8520
8655
|
["python3", /* @__PURE__ */ new Map([[1, "unhandled exception"]])],
|
|
8521
8656
|
// Network / remote tools
|
|
8522
|
-
[
|
|
8657
|
+
[
|
|
8658
|
+
"git",
|
|
8659
|
+
/* @__PURE__ */ new Map([[128, "fatal error (e.g. invalid ref or not a git repository)"]])
|
|
8660
|
+
],
|
|
8523
8661
|
["ssh", /* @__PURE__ */ new Map([[255, "ssh error"]])],
|
|
8524
8662
|
[
|
|
8525
8663
|
"wget",
|
|
@@ -8636,14 +8774,22 @@ function readOutputFile(path, maxBytes) {
|
|
|
8636
8774
|
const buf = Buffer.alloc(readLen);
|
|
8637
8775
|
let bytesRead = 0;
|
|
8638
8776
|
while (bytesRead < readLen) {
|
|
8639
|
-
const count = readSync(
|
|
8777
|
+
const count = readSync(
|
|
8778
|
+
fd,
|
|
8779
|
+
buf,
|
|
8780
|
+
bytesRead,
|
|
8781
|
+
readLen - bytesRead,
|
|
8782
|
+
bytesRead
|
|
8783
|
+
);
|
|
8640
8784
|
if (count === 0) {
|
|
8641
8785
|
break;
|
|
8642
8786
|
}
|
|
8643
8787
|
bytesRead += count;
|
|
8644
8788
|
}
|
|
8645
8789
|
return {
|
|
8646
|
-
text: sliceUtf8Safe(buf.subarray(0, bytesRead), maxBytes).toString(
|
|
8790
|
+
text: sliceUtf8Safe(buf.subarray(0, bytesRead), maxBytes).toString(
|
|
8791
|
+
"utf-8"
|
|
8792
|
+
),
|
|
8647
8793
|
size,
|
|
8648
8794
|
truncated: size > maxBytes
|
|
8649
8795
|
};
|
|
@@ -8729,7 +8875,14 @@ function buildBackgroundBody(prompt, command, exit, outputPath, timeout, annotat
|
|
|
8729
8875
|
if (size <= BACKGROUND_NOTIFICATION_CHARS) {
|
|
8730
8876
|
const read = readOutputFile(outputPath, MAX_SHELL_OUTPUT_BYTES);
|
|
8731
8877
|
const merged = annotate ? annotate(read.text) : read.text;
|
|
8732
|
-
result = formatFinalResult(
|
|
8878
|
+
result = formatFinalResult(
|
|
8879
|
+
prompt,
|
|
8880
|
+
command,
|
|
8881
|
+
exit,
|
|
8882
|
+
merged,
|
|
8883
|
+
read.truncated,
|
|
8884
|
+
timeout
|
|
8885
|
+
);
|
|
8733
8886
|
unlinkQuiet(outputPath);
|
|
8734
8887
|
} else {
|
|
8735
8888
|
const header = formatFinalResult(prompt, command, exit, "", false, timeout);
|
|
@@ -9242,7 +9395,7 @@ __export(snippets_exports, {
|
|
|
9242
9395
|
WINDOWS_PWSH_INCLUDES_CSHARP_SNIPPET: () => WINDOWS_PWSH_INCLUDES_CSHARP_SNIPPET,
|
|
9243
9396
|
WINDOWS_PWSH_SNIPPET: () => WINDOWS_PWSH_SNIPPET
|
|
9244
9397
|
});
|
|
9245
|
-
var MACOS_SNIPPET = `
|
|
9398
|
+
var MACOS_SNIPPET = String.raw`
|
|
9246
9399
|
import AppKit
|
|
9247
9400
|
import ApplicationServices
|
|
9248
9401
|
import Foundation
|
|
@@ -9319,13 +9472,13 @@ func mouseEvent(_ type: CGEventType, _ point: CGPoint, _ button: CGMouseButton,
|
|
|
9319
9472
|
|
|
9320
9473
|
if action == "screen_size" {
|
|
9321
9474
|
let bounds = CGDisplayBounds(CGMainDisplayID())
|
|
9322
|
-
print("
|
|
9475
|
+
print("\(Int(bounds.width)),\(Int(bounds.height))")
|
|
9323
9476
|
exit(0)
|
|
9324
9477
|
}
|
|
9325
9478
|
|
|
9326
9479
|
if action == "cursor_position" {
|
|
9327
9480
|
guard let event = CGEvent(source: nil) else { fail("Unable to read cursor position.") }
|
|
9328
|
-
print("
|
|
9481
|
+
print("\(Int(event.location.x)),\(Int(event.location.y))")
|
|
9329
9482
|
exit(0)
|
|
9330
9483
|
}
|
|
9331
9484
|
|
|
@@ -9614,7 +9767,7 @@ var CoordinateSchema = z14.tuple([
|
|
|
9614
9767
|
z14.number().int().nonnegative(),
|
|
9615
9768
|
z14.number().int().nonnegative()
|
|
9616
9769
|
]);
|
|
9617
|
-
var PathPointSchema = z14.
|
|
9770
|
+
var PathPointSchema = z14.looseObject({
|
|
9618
9771
|
x: z14.number().int().nonnegative(),
|
|
9619
9772
|
y: z14.number().int().nonnegative()
|
|
9620
9773
|
});
|
|
@@ -9630,7 +9783,7 @@ var OPENAI_ACTION_TYPES = [
|
|
|
9630
9783
|
"wait"
|
|
9631
9784
|
];
|
|
9632
9785
|
var MAX_BATCH_ACTIONS = 100;
|
|
9633
|
-
var OpenAIActionSchema = z14.
|
|
9786
|
+
var OpenAIActionSchema = z14.looseObject({
|
|
9634
9787
|
type: z14.enum(OPENAI_ACTION_TYPES),
|
|
9635
9788
|
button: z14.enum(["left", "right", "wheel", "back", "forward"]).optional(),
|
|
9636
9789
|
x: z14.number().int().nonnegative().optional(),
|
|
@@ -9641,12 +9794,12 @@ var OpenAIActionSchema = z14.object({
|
|
|
9641
9794
|
scrollY: z14.number().optional(),
|
|
9642
9795
|
text: z14.string().max(1e4).optional()
|
|
9643
9796
|
});
|
|
9644
|
-
var SafetyCheckSchema = z14.
|
|
9797
|
+
var SafetyCheckSchema = z14.looseObject({
|
|
9645
9798
|
id: z14.string().min(1),
|
|
9646
9799
|
code: z14.string().optional(),
|
|
9647
9800
|
message: z14.string().optional()
|
|
9648
9801
|
});
|
|
9649
|
-
var ComputerUseInputSchema = z14.
|
|
9802
|
+
var ComputerUseInputSchema = z14.looseObject({
|
|
9650
9803
|
action: z14.enum(ACTIONS).optional(),
|
|
9651
9804
|
actions: z14.array(OpenAIActionSchema).min(1).max(MAX_BATCH_ACTIONS).optional(),
|
|
9652
9805
|
pendingSafetyChecks: z14.array(SafetyCheckSchema).optional(),
|
|
@@ -11249,7 +11402,10 @@ var SyntheticOutputTool = class {
|
|
|
11249
11402
|
}
|
|
11250
11403
|
execute(_ctx, args) {
|
|
11251
11404
|
if (!("output" in args)) {
|
|
11252
|
-
return Promise.resolve({
|
|
11405
|
+
return Promise.resolve({
|
|
11406
|
+
output: "Error: output is required",
|
|
11407
|
+
isError: true
|
|
11408
|
+
});
|
|
11253
11409
|
}
|
|
11254
11410
|
const output = args.output;
|
|
11255
11411
|
const err = this.validateSchema(output);
|
|
@@ -11263,7 +11419,10 @@ var SyntheticOutputTool = class {
|
|
|
11263
11419
|
return Promise.resolve({ output, isError: false });
|
|
11264
11420
|
}
|
|
11265
11421
|
try {
|
|
11266
|
-
return Promise.resolve({
|
|
11422
|
+
return Promise.resolve({
|
|
11423
|
+
output: JSON.stringify(output, null, 2),
|
|
11424
|
+
isError: false
|
|
11425
|
+
});
|
|
11267
11426
|
} catch (e) {
|
|
11268
11427
|
return Promise.resolve({
|
|
11269
11428
|
output: `Error: output is not serializable: ${asErrorString(e)}`,
|
|
@@ -11296,7 +11455,9 @@ var SyntheticOutputTool = class {
|
|
|
11296
11455
|
}
|
|
11297
11456
|
const required = this.jsonSchema.required;
|
|
11298
11457
|
if (Array.isArray(required) && typeof data === "object" && data !== null && !Array.isArray(data)) {
|
|
11299
|
-
const missing = required.filter(
|
|
11458
|
+
const missing = required.filter(
|
|
11459
|
+
(k) => typeof k === "string" && !(k in data)
|
|
11460
|
+
);
|
|
11300
11461
|
if (missing.length > 0) {
|
|
11301
11462
|
return `Missing required fields: ${missing.join(", ")}`;
|
|
11302
11463
|
}
|
|
@@ -11352,7 +11513,10 @@ var ToolSearchTool = class {
|
|
|
11352
11513
|
const selection = query.startsWith("select:");
|
|
11353
11514
|
const tools = selection ? this.registry.findDeferredByNames(
|
|
11354
11515
|
query.slice("select:".length).split(",").map((name) => name.trim()).filter(Boolean)
|
|
11355
|
-
) : this.registry.searchDeferred(
|
|
11516
|
+
) : this.registry.searchDeferred(
|
|
11517
|
+
query,
|
|
11518
|
+
Math.max(1, Math.min(maxResults, 50))
|
|
11519
|
+
);
|
|
11356
11520
|
if (tools.length === 0) {
|
|
11357
11521
|
return Promise.resolve({
|
|
11358
11522
|
output: "No deferred tools matched the query.",
|
|
@@ -11360,12 +11524,16 @@ var ToolSearchTool = class {
|
|
|
11360
11524
|
});
|
|
11361
11525
|
}
|
|
11362
11526
|
const mcp = tools.filter((tool) => tool.name.startsWith(MCP_TOOL_PREFIX));
|
|
11363
|
-
const local = tools.filter(
|
|
11527
|
+
const local = tools.filter(
|
|
11528
|
+
(tool) => !tool.name.startsWith(MCP_TOOL_PREFIX)
|
|
11529
|
+
);
|
|
11364
11530
|
for (const tool of local) {
|
|
11365
11531
|
this.registry.markDiscovered(tool.name);
|
|
11366
11532
|
}
|
|
11367
11533
|
const native = this.registry.mcpLoadingMode === "native";
|
|
11368
|
-
const schemas = (native ? local : tools).map(
|
|
11534
|
+
const schemas = (native ? local : tools).map(
|
|
11535
|
+
(tool) => JSON.stringify(tool.schema(), null, 2)
|
|
11536
|
+
);
|
|
11369
11537
|
const routing = mcp.length === 0 ? "" : this.registry.mcpLoadingMode === "dispatch" ? "\n\nInvoke MCP tools through McpCall with the server name, full tool name, and an arguments object matching the target input_schema, including JSON types." : "\n\nThese MCP tools can be called directly by their full names.";
|
|
11370
11538
|
const output = [
|
|
11371
11539
|
`Loaded ${String(tools.length)} tool(s): ${tools.map((tool) => tool.name).join(", ")}.`,
|
|
@@ -11377,12 +11545,10 @@ var ToolSearchTool = class {
|
|
|
11377
11545
|
...native && mcp.length > 0 ? {
|
|
11378
11546
|
contentBlocks: [
|
|
11379
11547
|
{ type: "text", text: output },
|
|
11380
|
-
...mcp.map(
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
})
|
|
11385
|
-
)
|
|
11548
|
+
...mcp.map((tool) => ({
|
|
11549
|
+
type: "tool_reference",
|
|
11550
|
+
tool_name: tool.name
|
|
11551
|
+
}))
|
|
11386
11552
|
]
|
|
11387
11553
|
} : {}
|
|
11388
11554
|
});
|
|
@@ -11391,18 +11557,18 @@ var ToolSearchTool = class {
|
|
|
11391
11557
|
|
|
11392
11558
|
// src/remote/server.ts
|
|
11393
11559
|
var log26 = createChildLogger({ module: "remote" });
|
|
11394
|
-
var WsInboundSchema = z15.
|
|
11560
|
+
var WsInboundSchema = z15.looseObject({
|
|
11395
11561
|
type: z15.string(),
|
|
11396
11562
|
data: z15.unknown()
|
|
11397
11563
|
});
|
|
11398
|
-
var UserMessageSchema = z15.
|
|
11564
|
+
var UserMessageSchema = z15.looseObject({
|
|
11399
11565
|
content: z15.string()
|
|
11400
11566
|
});
|
|
11401
|
-
var PermissionResponseSchema = z15.
|
|
11567
|
+
var PermissionResponseSchema = z15.looseObject({
|
|
11402
11568
|
id: z15.string(),
|
|
11403
11569
|
response: z15.enum(["allow", "deny", "allowAlways"])
|
|
11404
11570
|
});
|
|
11405
|
-
var AskUserResponseSchema = z15.
|
|
11571
|
+
var AskUserResponseSchema = z15.looseObject({
|
|
11406
11572
|
id: z15.string(),
|
|
11407
11573
|
answers: z15.record(z15.string(), z15.string())
|
|
11408
11574
|
});
|
|
@@ -11599,8 +11765,8 @@ async function createRemoteAgent(opts) {
|
|
|
11599
11765
|
if (!client) {
|
|
11600
11766
|
throw new Error("no llm client (provider not initialized)");
|
|
11601
11767
|
}
|
|
11602
|
-
const { PermissionChecker: PC } = await import("./permissions-
|
|
11603
|
-
const { Agent: AgentClass } = await import("./agent-
|
|
11768
|
+
const { PermissionChecker: PC } = await import("./permissions-BZRN4RES.js");
|
|
11769
|
+
const { Agent: AgentClass } = await import("./agent-KDWPLLAV.js");
|
|
11604
11770
|
const subConv = new ConversationManager();
|
|
11605
11771
|
subConv.addUserMessage(prompt);
|
|
11606
11772
|
const taskManager = new TaskManager();
|
|
@@ -11689,7 +11855,10 @@ async function createRemoteAgent(opts) {
|
|
|
11689
11855
|
const forkEnv = detectEnvironment(forkWorkDir);
|
|
11690
11856
|
forkEnv.model = resolvedModel;
|
|
11691
11857
|
const forkSystemPrompt = buildSystemPrompt(forkEnv);
|
|
11692
|
-
const forkClient = modelOverride ? await createClient(
|
|
11858
|
+
const forkClient = modelOverride ? await createClient(
|
|
11859
|
+
{ ...provider, model: resolvedModel },
|
|
11860
|
+
forkSystemPrompt
|
|
11861
|
+
) : client;
|
|
11693
11862
|
const checker = context?.permissionChecker ?? new PermissionChecker(forkWorkDir, "acceptEdits");
|
|
11694
11863
|
forkConv.addUserMessage(prompt);
|
|
11695
11864
|
const forkTaskManager = new TaskManager();
|
|
@@ -12465,15 +12634,19 @@ Explore the codebase and design your approach.`
|
|
|
12465
12634
|
this.broadcast({ type: "command_done", data: null });
|
|
12466
12635
|
return;
|
|
12467
12636
|
}
|
|
12468
|
-
const lines = [
|
|
12469
|
-
`
|
|
12637
|
+
const lines = [
|
|
12638
|
+
`Available sessions (${String(sessions.length)}):
|
|
12639
|
+
`
|
|
12640
|
+
];
|
|
12470
12641
|
for (let i = 0; i < Math.min(sessions.length, 20); i++) {
|
|
12471
12642
|
const sess = sessions[i];
|
|
12472
12643
|
let first = sess.firstMessage;
|
|
12473
12644
|
if (first.length > 60) {
|
|
12474
12645
|
first = first.slice(0, 60) + "...";
|
|
12475
12646
|
}
|
|
12476
|
-
lines.push(
|
|
12647
|
+
lines.push(
|
|
12648
|
+
` ${String(i + 1)}. [${sess.id}] ${first} (${String(sess.messageCount)} msgs)`
|
|
12649
|
+
);
|
|
12477
12650
|
}
|
|
12478
12651
|
if (sessions.length > 20) {
|
|
12479
12652
|
lines.push(` ... and ${String(sessions.length - 20)} more`);
|
|
@@ -13711,7 +13884,13 @@ var ReviewSession = class {
|
|
|
13711
13884
|
}
|
|
13712
13885
|
evaluateCommentByCritic(requestId, commentId, criticName, isReasonable, reasoning) {
|
|
13713
13886
|
const evaluation = isReasonable ? "reasonable" : "unreasonable";
|
|
13714
|
-
return this.addCriticAssessment(
|
|
13887
|
+
return this.addCriticAssessment(
|
|
13888
|
+
requestId,
|
|
13889
|
+
commentId,
|
|
13890
|
+
criticName,
|
|
13891
|
+
evaluation,
|
|
13892
|
+
reasoning
|
|
13893
|
+
);
|
|
13715
13894
|
}
|
|
13716
13895
|
getCriticSummary(requestId) {
|
|
13717
13896
|
const request = this.requests.get(requestId);
|
|
@@ -13794,8 +13973,12 @@ var ReviewSession = class {
|
|
|
13794
13973
|
if (!request) {
|
|
13795
13974
|
throw new Error(`Request '${requestId}' not found`);
|
|
13796
13975
|
}
|
|
13797
|
-
const acceptedCount = request.comments.filter(
|
|
13798
|
-
|
|
13976
|
+
const acceptedCount = request.comments.filter(
|
|
13977
|
+
(c) => c.resolution === "accepted"
|
|
13978
|
+
).length;
|
|
13979
|
+
const rejectedCount = request.comments.filter(
|
|
13980
|
+
(c) => c.resolution === "rejected"
|
|
13981
|
+
).length;
|
|
13799
13982
|
const pendingCount = request.comments.filter(
|
|
13800
13983
|
(c) => !c.resolution || c.resolution === "pending"
|
|
13801
13984
|
).length;
|
|
@@ -14291,7 +14474,7 @@ var CodeReviewMemberSchema = z16.object({
|
|
|
14291
14474
|
expertise: z16.array(z16.string()),
|
|
14292
14475
|
active: z16.boolean()
|
|
14293
14476
|
});
|
|
14294
|
-
var CodeReviewTeamSchema = z16.
|
|
14477
|
+
var CodeReviewTeamSchema = z16.looseObject({
|
|
14295
14478
|
name: z16.string(),
|
|
14296
14479
|
members: z16.array(CodeReviewMemberSchema),
|
|
14297
14480
|
createdAt: z16.string(),
|
|
@@ -14475,7 +14658,7 @@ import { readFileSync as readFileSync18, writeFileSync as writeFileSync12, mkdir
|
|
|
14475
14658
|
import { join as join23, dirname as dirname9 } from "path";
|
|
14476
14659
|
import { safeParse as safeParse3, z as z17 } from "zod";
|
|
14477
14660
|
var log31 = createChildLogger({ module: "commands" });
|
|
14478
|
-
var UsageEntrySchema = z17.
|
|
14661
|
+
var UsageEntrySchema = z17.looseObject({
|
|
14479
14662
|
usageCount: z17.coerce.number(),
|
|
14480
14663
|
lastUsedAt: z17.coerce.number()
|
|
14481
14664
|
});
|
|
@@ -14620,12 +14803,12 @@ import { z as z19 } from "zod";
|
|
|
14620
14803
|
var DISCOVERY_TIMEOUT_MS = 5e3;
|
|
14621
14804
|
var MAX_MODEL_PAGES = 10;
|
|
14622
14805
|
var HttpUrlSchema = z19.url();
|
|
14623
|
-
var ModelSchema = z19.
|
|
14806
|
+
var ModelSchema = z19.looseObject({
|
|
14624
14807
|
id: z19.string().trim().min(1),
|
|
14625
14808
|
display_name: z19.string().optional(),
|
|
14626
14809
|
name: z19.string().optional()
|
|
14627
14810
|
});
|
|
14628
|
-
var ModelListSchema = z19.
|
|
14811
|
+
var ModelListSchema = z19.looseObject({
|
|
14629
14812
|
data: z19.array(ModelSchema),
|
|
14630
14813
|
has_more: z19.boolean().optional(),
|
|
14631
14814
|
last_id: z19.string().trim().min(1).nullable().optional()
|
|
@@ -14640,7 +14823,10 @@ function modelListUrl(protocol, baseUrl) {
|
|
|
14640
14823
|
return void 0;
|
|
14641
14824
|
}
|
|
14642
14825
|
let path = url.pathname.replace(/\/+$/, "");
|
|
14643
|
-
path = path.replace(
|
|
14826
|
+
path = path.replace(
|
|
14827
|
+
/\/(?:chat\/completions|completions|responses|messages|models)$/,
|
|
14828
|
+
""
|
|
14829
|
+
);
|
|
14644
14830
|
if (!path || protocol === "anthropic" && !path.endsWith("/v1")) {
|
|
14645
14831
|
path += "/v1";
|
|
14646
14832
|
}
|
|
@@ -14652,7 +14838,9 @@ function modelListUrl(protocol, baseUrl) {
|
|
|
14652
14838
|
async function discoverModels(config, signal) {
|
|
14653
14839
|
const endpoint = modelListUrl(config.protocol, config.base_url);
|
|
14654
14840
|
if (!endpoint) {
|
|
14655
|
-
throw new Error(
|
|
14841
|
+
throw new Error(
|
|
14842
|
+
"Model discovery requires an HTTP(S) URL without embedded credentials"
|
|
14843
|
+
);
|
|
14656
14844
|
}
|
|
14657
14845
|
const controller = new AbortController();
|
|
14658
14846
|
const abort = () => {
|
|
@@ -14708,7 +14896,10 @@ async function discoverModels(config, signal) {
|
|
|
14708
14896
|
throw new Error("Model discovery failed");
|
|
14709
14897
|
} catch {
|
|
14710
14898
|
if (controller.signal.aborted) {
|
|
14711
|
-
throw new DOMException(
|
|
14899
|
+
throw new DOMException(
|
|
14900
|
+
"Model discovery cancelled or timed out",
|
|
14901
|
+
"AbortError"
|
|
14902
|
+
);
|
|
14712
14903
|
}
|
|
14713
14904
|
throw new Error("Model discovery failed");
|
|
14714
14905
|
} finally {
|
|
@@ -14769,7 +14960,7 @@ __export(sandbox_exports, {
|
|
|
14769
14960
|
import os from "os";
|
|
14770
14961
|
async function createSandbox(backend = "native") {
|
|
14771
14962
|
if (backend === "sandbox-runtime") {
|
|
14772
|
-
const { SandboxRuntimeSandbox } = await import("./sandbox-runtime-
|
|
14963
|
+
const { SandboxRuntimeSandbox } = await import("./sandbox-runtime-QDN5SXPM.js");
|
|
14773
14964
|
return new SandboxRuntimeSandbox();
|
|
14774
14965
|
}
|
|
14775
14966
|
const platform2 = os.platform();
|
|
@@ -14857,7 +15048,10 @@ var InstallSkillTool = class {
|
|
|
14857
15048
|
const timeout = new AbortController();
|
|
14858
15049
|
const timer = setTimeout(() => {
|
|
14859
15050
|
timeout.abort(
|
|
14860
|
-
new DOMException(
|
|
15051
|
+
new DOMException(
|
|
15052
|
+
"Skill download timed out after 30 seconds",
|
|
15053
|
+
"TimeoutError"
|
|
15054
|
+
)
|
|
14861
15055
|
);
|
|
14862
15056
|
}, 3e4);
|
|
14863
15057
|
timer.unref();
|
|
@@ -14906,7 +15100,9 @@ ${parsed.body}
|
|
|
14906
15100
|
const stat4 = lstatSync(dir, { throwIfNoEntry: false });
|
|
14907
15101
|
if (stat4) {
|
|
14908
15102
|
if (stat4.isSymbolicLink() || !stat4.isDirectory()) {
|
|
14909
|
-
throw new Error(
|
|
15103
|
+
throw new Error(
|
|
15104
|
+
`Installation directory must be a real directory: ${dir}`
|
|
15105
|
+
);
|
|
14910
15106
|
}
|
|
14911
15107
|
} else {
|
|
14912
15108
|
mkdirSync16(dir);
|
|
@@ -14915,7 +15111,9 @@ ${parsed.body}
|
|
|
14915
15111
|
const destination = join25(dir, "SKILL.md");
|
|
14916
15112
|
const stat3 = lstatSync(destination, { throwIfNoEntry: false });
|
|
14917
15113
|
if (stat3 && (stat3.isSymbolicLink() || !stat3.isFile())) {
|
|
14918
|
-
throw new Error(
|
|
15114
|
+
throw new Error(
|
|
15115
|
+
`Installation target must be a regular file: ${destination}`
|
|
15116
|
+
);
|
|
14919
15117
|
}
|
|
14920
15118
|
const temporary = join25(dir, `.SKILL-${randomUUID2()}.tmp`);
|
|
14921
15119
|
const fd = openSync3(temporary, "wx", stat3?.mode ?? 438);
|
|
@@ -15024,7 +15222,7 @@ import { homedir as homedir10 } from "os";
|
|
|
15024
15222
|
import { join as join26, resolve as resolve11, sep as sep2 } from "path";
|
|
15025
15223
|
import { z as z20 } from "zod";
|
|
15026
15224
|
var log34 = createChildLogger({ module: "vscode" });
|
|
15027
|
-
var LockfileSchema = z20.
|
|
15225
|
+
var LockfileSchema = z20.looseObject({
|
|
15028
15226
|
workspaceFolders: z20.array(z20.string()).optional(),
|
|
15029
15227
|
pid: z20.number().optional(),
|
|
15030
15228
|
ideName: z20.string().optional(),
|
|
@@ -15097,7 +15295,9 @@ async function detectIde(cwd2) {
|
|
|
15097
15295
|
return byPort;
|
|
15098
15296
|
}
|
|
15099
15297
|
}
|
|
15100
|
-
const byWorkspace = lockfiles.filter(
|
|
15298
|
+
const byWorkspace = lockfiles.filter(
|
|
15299
|
+
(l) => cwdInWorkspace(cwd2, l.workspaceFolders)
|
|
15300
|
+
);
|
|
15101
15301
|
return byWorkspace.length === 1 ? byWorkspace[0] : null;
|
|
15102
15302
|
}
|
|
15103
15303
|
|
|
@@ -15106,7 +15306,9 @@ var ws_transport_exports = {};
|
|
|
15106
15306
|
__export(ws_transport_exports, {
|
|
15107
15307
|
WebSocketTransport: () => WebSocketTransport
|
|
15108
15308
|
});
|
|
15109
|
-
import {
|
|
15309
|
+
import {
|
|
15310
|
+
JSONRPCMessageSchema
|
|
15311
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
15110
15312
|
import WebSocket2 from "ws";
|
|
15111
15313
|
var WebSocketTransport = class {
|
|
15112
15314
|
constructor(url, headers = {}) {
|
|
@@ -15186,9 +15388,9 @@ var WebSocketTransport = class {
|
|
|
15186
15388
|
|
|
15187
15389
|
// src/vscode/ide-client.ts
|
|
15188
15390
|
var log35 = createChildLogger({ module: "vscode" });
|
|
15189
|
-
var AtMentionedSchema = z21.
|
|
15391
|
+
var AtMentionedSchema = z21.looseObject({
|
|
15190
15392
|
method: z21.literal("at_mentioned"),
|
|
15191
|
-
params: z21.
|
|
15393
|
+
params: z21.looseObject({
|
|
15192
15394
|
filePath: z21.string(),
|
|
15193
15395
|
lineStart: z21.number().optional(),
|
|
15194
15396
|
lineEnd: z21.number().optional()
|
|
@@ -15291,7 +15493,9 @@ function parsePrintFlags(args) {
|
|
|
15291
15493
|
if (fmt === "stream-json") {
|
|
15292
15494
|
outputFormat = "stream-json";
|
|
15293
15495
|
} else if (fmt !== "text") {
|
|
15294
|
-
console.error(
|
|
15496
|
+
console.error(
|
|
15497
|
+
`Error: unknown output format '${fmt}', expected 'text' or 'stream-json'`
|
|
15498
|
+
);
|
|
15295
15499
|
process.exit(1);
|
|
15296
15500
|
}
|
|
15297
15501
|
}
|
|
@@ -15472,7 +15676,9 @@ Error: ${event.error.message}`);
|
|
|
15472
15676
|
break;
|
|
15473
15677
|
}
|
|
15474
15678
|
}
|
|
15475
|
-
await backgroundTaskManager.waitAll(
|
|
15679
|
+
await backgroundTaskManager.waitAll(
|
|
15680
|
+
(task) => (task.kind ?? "agent") === "agent"
|
|
15681
|
+
);
|
|
15476
15682
|
const backgroundNotifications = backgroundTaskManager.drainNotifications();
|
|
15477
15683
|
const durationMs = Date.now() - startTime;
|
|
15478
15684
|
if (args.outputFormat === "text" && resultText && !resultText.endsWith("\n")) {
|
|
@@ -15481,7 +15687,9 @@ Error: ${event.error.message}`);
|
|
|
15481
15687
|
for (const task of backgroundNotifications) {
|
|
15482
15688
|
const notification = formatAgentTaskNotification(task);
|
|
15483
15689
|
if (args.outputFormat === "stream-json") {
|
|
15484
|
-
console.log(
|
|
15690
|
+
console.log(
|
|
15691
|
+
JSON.stringify({ type: "task_notification", notification })
|
|
15692
|
+
);
|
|
15485
15693
|
} else {
|
|
15486
15694
|
process.stdout.write(`${notification}
|
|
15487
15695
|
`);
|