@adhdev/daemon-standalone 1.0.45-rc.4 → 1.0.45-rc.6
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/index.js +274 -62
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/public/assets/{index-Bw8QFLvo.js → index-Bf3SwIU_.js} +42 -42
- package/public/index.html +1 -1
package/dist/index.js
CHANGED
|
@@ -31423,9 +31423,9 @@ var require_streamx = __commonJS({
|
|
|
31423
31423
|
}
|
|
31424
31424
|
});
|
|
31425
31425
|
|
|
31426
|
-
//
|
|
31426
|
+
// ../../node_modules/tar-stream/node_modules/b4a/index.js
|
|
31427
31427
|
var require_b4a2 = __commonJS({
|
|
31428
|
-
"
|
|
31428
|
+
"../../node_modules/tar-stream/node_modules/b4a/index.js"(exports2, module2) {
|
|
31429
31429
|
"use strict";
|
|
31430
31430
|
function isBuffer(value) {
|
|
31431
31431
|
return Buffer.isBuffer(value) || value instanceof Uint8Array;
|
|
@@ -31581,9 +31581,9 @@ var require_b4a2 = __commonJS({
|
|
|
31581
31581
|
}
|
|
31582
31582
|
});
|
|
31583
31583
|
|
|
31584
|
-
//
|
|
31584
|
+
// ../../node_modules/tar-stream/headers.js
|
|
31585
31585
|
var require_headers = __commonJS({
|
|
31586
|
-
"
|
|
31586
|
+
"../../node_modules/tar-stream/headers.js"(exports2) {
|
|
31587
31587
|
"use strict";
|
|
31588
31588
|
var b4a = require_b4a2();
|
|
31589
31589
|
var ZEROS = "0000000000000000000";
|
|
@@ -31844,9 +31844,9 @@ var require_headers = __commonJS({
|
|
|
31844
31844
|
}
|
|
31845
31845
|
});
|
|
31846
31846
|
|
|
31847
|
-
//
|
|
31847
|
+
// ../../node_modules/tar-stream/extract.js
|
|
31848
31848
|
var require_extract = __commonJS({
|
|
31849
|
-
"
|
|
31849
|
+
"../../node_modules/tar-stream/extract.js"(exports2, module2) {
|
|
31850
31850
|
"use strict";
|
|
31851
31851
|
var { Writable, Readable, getStreamError } = require_streamx();
|
|
31852
31852
|
var FIFO = require_fast_fifo();
|
|
@@ -32189,9 +32189,9 @@ var require_extract = __commonJS({
|
|
|
32189
32189
|
}
|
|
32190
32190
|
});
|
|
32191
32191
|
|
|
32192
|
-
//
|
|
32192
|
+
// ../../node_modules/tar-stream/constants.js
|
|
32193
32193
|
var require_constants = __commonJS({
|
|
32194
|
-
"
|
|
32194
|
+
"../../node_modules/tar-stream/constants.js"(exports2, module2) {
|
|
32195
32195
|
"use strict";
|
|
32196
32196
|
var constants = {
|
|
32197
32197
|
// just for envs without fs
|
|
@@ -32210,9 +32210,9 @@ var require_constants = __commonJS({
|
|
|
32210
32210
|
}
|
|
32211
32211
|
});
|
|
32212
32212
|
|
|
32213
|
-
//
|
|
32213
|
+
// ../../node_modules/tar-stream/pack.js
|
|
32214
32214
|
var require_pack = __commonJS({
|
|
32215
|
-
"
|
|
32215
|
+
"../../node_modules/tar-stream/pack.js"(exports2, module2) {
|
|
32216
32216
|
"use strict";
|
|
32217
32217
|
var { Readable, Writable, getStreamError } = require_streamx();
|
|
32218
32218
|
var b4a = require_b4a2();
|
|
@@ -32445,9 +32445,9 @@ var require_pack = __commonJS({
|
|
|
32445
32445
|
}
|
|
32446
32446
|
});
|
|
32447
32447
|
|
|
32448
|
-
//
|
|
32448
|
+
// ../../node_modules/tar-stream/index.js
|
|
32449
32449
|
var require_tar_stream = __commonJS({
|
|
32450
|
-
"
|
|
32450
|
+
"../../node_modules/tar-stream/index.js"(exports2) {
|
|
32451
32451
|
"use strict";
|
|
32452
32452
|
exports2.extract = require_extract();
|
|
32453
32453
|
exports2.pack = require_pack();
|
|
@@ -32690,9 +32690,9 @@ var require_pump = __commonJS({
|
|
|
32690
32690
|
}
|
|
32691
32691
|
});
|
|
32692
32692
|
|
|
32693
|
-
//
|
|
32693
|
+
// ../../node_modules/tar-fs/index.js
|
|
32694
32694
|
var require_tar_fs = __commonJS({
|
|
32695
|
-
"
|
|
32695
|
+
"../../node_modules/tar-fs/index.js"(exports2) {
|
|
32696
32696
|
"use strict";
|
|
32697
32697
|
var tar = require_tar_stream();
|
|
32698
32698
|
var pump = require_pump();
|
|
@@ -37020,10 +37020,10 @@ var require_dist3 = __commonJS({
|
|
|
37020
37020
|
}
|
|
37021
37021
|
function getDaemonBuildInfo() {
|
|
37022
37022
|
if (cached2) return cached2;
|
|
37023
|
-
const commit = readInjected(true ? "
|
|
37024
|
-
const commitShort = readInjected(true ? "
|
|
37025
|
-
const version2 = readInjected(true ? "1.0.45-rc.
|
|
37026
|
-
const builtAt = readInjected(true ? "2026-08-
|
|
37023
|
+
const commit = readInjected(true ? "ad6b5dfbb762ac45467586208d4393788832ad7a" : void 0) ?? "unknown";
|
|
37024
|
+
const commitShort = readInjected(true ? "ad6b5dfb" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
37025
|
+
const version2 = readInjected(true ? "1.0.45-rc.6" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
37026
|
+
const builtAt = readInjected(true ? "2026-08-12T05:35:42.422Z" : void 0);
|
|
37027
37027
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
37028
37028
|
return cached2;
|
|
37029
37029
|
}
|
|
@@ -53763,6 +53763,7 @@ When the user asks to **set up / configure / onboard** this repo for Repo Mesh (
|
|
|
53763
53763
|
__export2(mesh_coordinator_exports, {
|
|
53764
53764
|
applyMeshCoordinatorSystemPromptInjection: () => applyMeshCoordinatorSystemPromptInjection,
|
|
53765
53765
|
buildMeshCoordinatorRegistrationPlan: () => buildMeshCoordinatorRegistrationPlan,
|
|
53766
|
+
cleanupCoordinatorAgentFile: () => cleanupCoordinatorAgentFile,
|
|
53766
53767
|
createHermesManualMeshCoordinatorSetup: () => createHermesManualMeshCoordinatorSetup,
|
|
53767
53768
|
execUnderPty: () => execUnderPty,
|
|
53768
53769
|
resolveMeshCoordinatorSetup: () => resolveMeshCoordinatorSetup,
|
|
@@ -54012,6 +54013,22 @@ ${(0, import_node_path3.resolve)(workspace || os7.tmpdir())}`;
|
|
|
54012
54013
|
ctx.launchEnv[injection.name] = systemPrompt;
|
|
54013
54014
|
return {};
|
|
54014
54015
|
}
|
|
54016
|
+
case "agent_file": {
|
|
54017
|
+
if (!injection.flag) return {};
|
|
54018
|
+
const template = injection.template && injection.template.includes("{prompt}") ? injection.template : "{prompt}";
|
|
54019
|
+
const body = template.replace(/\{prompt\}/g, systemPrompt);
|
|
54020
|
+
try {
|
|
54021
|
+
const dir = (0, import_node_fs3.mkdtempSync)((0, import_node_path3.join)(os7.tmpdir(), `adhdev-coord-${ctx.cliType}-`));
|
|
54022
|
+
const filePath = (0, import_node_path3.join)(dir, "coordinator-agent.md");
|
|
54023
|
+
(0, import_node_fs3.writeFileSync)(filePath, body, "utf-8");
|
|
54024
|
+
ctx.cliArgs.push(injection.flag, filePath);
|
|
54025
|
+
LOG2.info("MeshCoordinator", `Wrote coordinator agent file to ${filePath} (${ctx.cliType})`);
|
|
54026
|
+
return { agentFilePath: filePath };
|
|
54027
|
+
} catch (error48) {
|
|
54028
|
+
LOG2.warn("MeshCoordinator", `Could not write coordinator agent file: ${error48?.message || error48}`);
|
|
54029
|
+
return {};
|
|
54030
|
+
}
|
|
54031
|
+
}
|
|
54015
54032
|
case "context_file": {
|
|
54016
54033
|
if (!injection.path) return {};
|
|
54017
54034
|
const target = (0, import_node_path3.isAbsolute)(injection.path) ? injection.path : (0, import_node_path3.join)(ctx.workspace, injection.path);
|
|
@@ -54023,6 +54040,7 @@ ${systemPrompt}`;
|
|
|
54023
54040
|
const rendered = wrapper.replace(/\{prompt\}/g, promptWithNote);
|
|
54024
54041
|
const sentinel = wrapper.split("{prompt}")[0].trim();
|
|
54025
54042
|
try {
|
|
54043
|
+
(0, import_node_fs3.mkdirSync)((0, import_node_path3.dirname)(target), { recursive: true });
|
|
54026
54044
|
if ((0, import_node_fs3.existsSync)(target)) {
|
|
54027
54045
|
const existing = (0, import_node_fs3.readFileSync)(target, "utf-8");
|
|
54028
54046
|
if (sentinel && existing.includes(sentinel)) {
|
|
@@ -54040,7 +54058,7 @@ ${rendered}`, "utf-8");
|
|
|
54040
54058
|
(0, import_node_fs3.writeFileSync)(target, rendered, "utf-8");
|
|
54041
54059
|
}
|
|
54042
54060
|
LOG2.info("MeshCoordinator", `Wrote coordinator prompt to ${target} (${ctx.cliType})`);
|
|
54043
|
-
return { contextFilePath: target };
|
|
54061
|
+
return { contextFilePath: target, contextFileOwned: injection.owned === true };
|
|
54044
54062
|
} catch (error48) {
|
|
54045
54063
|
LOG2.warn("MeshCoordinator", `Could not write ${target}: ${error48?.message || error48}`);
|
|
54046
54064
|
return {};
|
|
@@ -54050,11 +54068,19 @@ ${rendered}`, "utf-8");
|
|
|
54050
54068
|
return {};
|
|
54051
54069
|
}
|
|
54052
54070
|
}
|
|
54053
|
-
function stripCoordinatorWrapperFile(filePath) {
|
|
54071
|
+
function stripCoordinatorWrapperFile(filePath, owned = false) {
|
|
54054
54072
|
const OPEN = "<!-- adhdev-mesh-coordinator-prompt -->";
|
|
54055
54073
|
const CLOSE = "<!-- /adhdev-mesh-coordinator-prompt -->";
|
|
54056
54074
|
try {
|
|
54057
54075
|
if (!(0, import_node_fs3.existsSync)(filePath)) return;
|
|
54076
|
+
if (owned) {
|
|
54077
|
+
try {
|
|
54078
|
+
const fs56 = require("fs");
|
|
54079
|
+
fs56.unlinkSync(filePath);
|
|
54080
|
+
} catch {
|
|
54081
|
+
}
|
|
54082
|
+
return;
|
|
54083
|
+
}
|
|
54058
54084
|
const existing = (0, import_node_fs3.readFileSync)(filePath, "utf-8");
|
|
54059
54085
|
const openIdx = existing.indexOf(OPEN);
|
|
54060
54086
|
if (openIdx < 0) return;
|
|
@@ -54073,6 +54099,13 @@ ${rendered}`, "utf-8");
|
|
|
54073
54099
|
} catch {
|
|
54074
54100
|
}
|
|
54075
54101
|
}
|
|
54102
|
+
function cleanupCoordinatorAgentFile(filePath) {
|
|
54103
|
+
try {
|
|
54104
|
+
if (!(0, import_node_fs3.existsSync)(filePath)) return;
|
|
54105
|
+
(0, import_node_fs3.rmSync)((0, import_node_path3.dirname)(filePath), { recursive: true, force: true });
|
|
54106
|
+
} catch {
|
|
54107
|
+
}
|
|
54108
|
+
}
|
|
54076
54109
|
function buildMeshCoordinatorRegistrationPlan(cliType, serverName, registrationCommand) {
|
|
54077
54110
|
const commandParts = registrationCommand.trim().split(/\s+/).filter(Boolean);
|
|
54078
54111
|
const [command, ...args] = commandParts;
|
|
@@ -54206,12 +54239,13 @@ ${rendered}`, "utf-8");
|
|
|
54206
54239
|
saveRegistry();
|
|
54207
54240
|
if (!entry) return;
|
|
54208
54241
|
const workspace = entry.workspace;
|
|
54242
|
+
const owned = entry.injection?.owned === true;
|
|
54209
54243
|
const target = entry.injection?.mode === "context_file" && typeof entry.injection.target === "string" ? entry.injection.target : "";
|
|
54210
54244
|
if (!workspace || !target) return;
|
|
54211
54245
|
const filePath = `${workspace.replace(/\/$/, "")}/${target}`;
|
|
54212
54246
|
try {
|
|
54213
54247
|
const { stripCoordinatorWrapperFile: stripCoordinatorWrapperFile2 } = (init_mesh_coordinator(), __toCommonJS2(mesh_coordinator_exports));
|
|
54214
|
-
stripCoordinatorWrapperFile2(filePath);
|
|
54248
|
+
stripCoordinatorWrapperFile2(filePath, owned);
|
|
54215
54249
|
} catch {
|
|
54216
54250
|
}
|
|
54217
54251
|
}
|
|
@@ -70887,6 +70921,7 @@ ${cleanBody}`;
|
|
|
70887
70921
|
};
|
|
70888
70922
|
}
|
|
70889
70923
|
function extractBuiltinTurnTerminalMarkers(agentType, lines) {
|
|
70924
|
+
if (agentType === "kimi") return extractKimiTurnTerminalMarkers(lines);
|
|
70890
70925
|
if (agentType !== "codex-cli") return [];
|
|
70891
70926
|
const markers = [];
|
|
70892
70927
|
for (const rec of lines) {
|
|
@@ -70910,6 +70945,23 @@ ${cleanBody}`;
|
|
|
70910
70945
|
}
|
|
70911
70946
|
return markers;
|
|
70912
70947
|
}
|
|
70948
|
+
function extractKimiTurnTerminalMarkers(lines) {
|
|
70949
|
+
const markers = [];
|
|
70950
|
+
for (const rec of lines) {
|
|
70951
|
+
if (String(rec?.type ?? "") !== "turn.ended") continue;
|
|
70952
|
+
const receivedAt = parseTimestamp(rec?.time) ?? Date.now();
|
|
70953
|
+
const reason = String(rec?.reason ?? "").trim();
|
|
70954
|
+
const rawTurnId = rec?.turnId;
|
|
70955
|
+
const turnId = typeof rawTurnId === "number" && Number.isFinite(rawTurnId) ? String(rawTurnId) : typeof rawTurnId === "string" && rawTurnId.trim() ? rawTurnId.trim() : "";
|
|
70956
|
+
markers.push({
|
|
70957
|
+
receivedAt,
|
|
70958
|
+
outcome: reason === "cancelled" ? "aborted" : "completed",
|
|
70959
|
+
summary: "",
|
|
70960
|
+
...turnId ? { turnId } : {}
|
|
70961
|
+
});
|
|
70962
|
+
}
|
|
70963
|
+
return markers;
|
|
70964
|
+
}
|
|
70913
70965
|
function flattenJsonlText(value) {
|
|
70914
70966
|
if (typeof value === "string") return value.trim();
|
|
70915
70967
|
if (value == null) return "";
|
|
@@ -72358,7 +72410,109 @@ ${cleanBody}`;
|
|
|
72358
72410
|
if (!event || typeof event !== "object") return null;
|
|
72359
72411
|
return event;
|
|
72360
72412
|
}
|
|
72413
|
+
function parseSelectorRow(line) {
|
|
72414
|
+
const m = line.match(/^\s*(?:❯\s*)?(\S[\s\S]*?)\s*$/);
|
|
72415
|
+
if (!m) return null;
|
|
72416
|
+
const parts = m[1].split(/\s{2,}/);
|
|
72417
|
+
const label = (parts[0] ?? "").trim();
|
|
72418
|
+
if (!label) return null;
|
|
72419
|
+
const description = parts.length > 1 ? parts.slice(1).join(" ").trim() : void 0;
|
|
72420
|
+
return { label, ...description ? { description } : {} };
|
|
72421
|
+
}
|
|
72422
|
+
function detectKimiIdleSelectorPrompt(screenText) {
|
|
72423
|
+
if (!screenText) return null;
|
|
72424
|
+
const lines = screenText.split("\n");
|
|
72425
|
+
let titleIdx = -1;
|
|
72426
|
+
for (let i = lines.length - 1; i >= 0; i -= 1) {
|
|
72427
|
+
if (IDLE_SELECTOR_TITLE.test(lines[i])) {
|
|
72428
|
+
titleIdx = i;
|
|
72429
|
+
break;
|
|
72430
|
+
}
|
|
72431
|
+
}
|
|
72432
|
+
if (titleIdx < 0) return null;
|
|
72433
|
+
let hintIdx = -1;
|
|
72434
|
+
for (let i = titleIdx + 1; i <= Math.min(lines.length - 1, titleIdx + 4); i += 1) {
|
|
72435
|
+
if (IDLE_SELECTOR_HINT.test(lines[i])) {
|
|
72436
|
+
hintIdx = i;
|
|
72437
|
+
break;
|
|
72438
|
+
}
|
|
72439
|
+
}
|
|
72440
|
+
if (hintIdx < 0) return null;
|
|
72441
|
+
let cursorIdx = -1;
|
|
72442
|
+
for (let i = hintIdx + 1; i < lines.length; i += 1) {
|
|
72443
|
+
const t = lines[i].trim();
|
|
72444
|
+
if (!t) continue;
|
|
72445
|
+
if (/^─+$/.test(t)) break;
|
|
72446
|
+
if (t.startsWith("\u276F")) {
|
|
72447
|
+
cursorIdx = i;
|
|
72448
|
+
break;
|
|
72449
|
+
}
|
|
72450
|
+
}
|
|
72451
|
+
if (cursorIdx < 0) return null;
|
|
72452
|
+
const options = [];
|
|
72453
|
+
for (let i = cursorIdx; i < lines.length; i += 1) {
|
|
72454
|
+
const t = lines[i].trim();
|
|
72455
|
+
if (!t || /^─+$/.test(t)) break;
|
|
72456
|
+
const row = parseSelectorRow(lines[i]);
|
|
72457
|
+
if (!row) break;
|
|
72458
|
+
options.push(row);
|
|
72459
|
+
}
|
|
72460
|
+
if (options.length < 2) return null;
|
|
72461
|
+
let question = "";
|
|
72462
|
+
for (let i = cursorIdx - 1; i > hintIdx; i -= 1) {
|
|
72463
|
+
const t = lines[i].trim();
|
|
72464
|
+
if (!t || /^─+$/.test(t)) continue;
|
|
72465
|
+
question = t;
|
|
72466
|
+
break;
|
|
72467
|
+
}
|
|
72468
|
+
if (!question) return null;
|
|
72469
|
+
const questions = [{
|
|
72470
|
+
questionId: "q1",
|
|
72471
|
+
question,
|
|
72472
|
+
header: lines[titleIdx].trim(),
|
|
72473
|
+
multiSelect: false,
|
|
72474
|
+
options
|
|
72475
|
+
}];
|
|
72476
|
+
return {
|
|
72477
|
+
promptId: `${KIMI_TUI_SELECTOR_PROMPT_PREFIX}${interactivePromptContentFingerprint(questions)}`,
|
|
72478
|
+
origin: "cli",
|
|
72479
|
+
providerType: "kimi",
|
|
72480
|
+
createdAt: Date.now(),
|
|
72481
|
+
questions
|
|
72482
|
+
};
|
|
72483
|
+
}
|
|
72484
|
+
function buildKimiSelectorAnswerSteps(prompt, response, screenText) {
|
|
72485
|
+
if (response.promptId !== prompt.promptId) throw new Error("Interactive prompt response does not match active prompt");
|
|
72486
|
+
if (prompt.questions.length !== 1) throw new Error("kimi built-in selector prompt must have exactly one question");
|
|
72487
|
+
const question = prompt.questions[0];
|
|
72488
|
+
const answer = response.answers[question.questionId];
|
|
72489
|
+
if (!answer) throw new Error(`Missing answer for ${question.questionId}`);
|
|
72490
|
+
if (answer.freeformText?.trim()) throw new Error("kimi built-in selector has no freeform input");
|
|
72491
|
+
if (answer.selectedLabels.length !== 1) throw new Error(`Expected one selected label for ${question.questionId}`);
|
|
72492
|
+
const target = question.options.findIndex((o) => o.label === answer.selectedLabels[0]);
|
|
72493
|
+
if (target < 0) throw new Error(`Unknown option for ${question.questionId}: ${answer.selectedLabels[0]}`);
|
|
72494
|
+
let cursor = 0;
|
|
72495
|
+
for (const line of (screenText ?? "").split("\n")) {
|
|
72496
|
+
if (!line.trim().startsWith("\u276F")) continue;
|
|
72497
|
+
const row = parseSelectorRow(line);
|
|
72498
|
+
if (!row) continue;
|
|
72499
|
+
const idx = question.options.findIndex((o) => o.label === row.label);
|
|
72500
|
+
if (idx >= 0) {
|
|
72501
|
+
cursor = idx;
|
|
72502
|
+
break;
|
|
72503
|
+
}
|
|
72504
|
+
}
|
|
72505
|
+
const steps = [];
|
|
72506
|
+
const diff = target - cursor;
|
|
72507
|
+
const key2 = diff > 0 ? "\x1B[B" : "\x1B[A";
|
|
72508
|
+
for (let i = 0; i < Math.abs(diff); i += 1) steps.push(key2);
|
|
72509
|
+
steps.push("\r");
|
|
72510
|
+
return steps;
|
|
72511
|
+
}
|
|
72361
72512
|
var TAIL_BYTES2;
|
|
72513
|
+
var KIMI_TUI_SELECTOR_PROMPT_PREFIX;
|
|
72514
|
+
var IDLE_SELECTOR_TITLE;
|
|
72515
|
+
var IDLE_SELECTOR_HINT;
|
|
72362
72516
|
var init_kimi_pending_question = __esm2({
|
|
72363
72517
|
"src/providers/kimi-pending-question.ts"() {
|
|
72364
72518
|
"use strict";
|
|
@@ -72367,6 +72521,9 @@ ${cleanBody}`;
|
|
|
72367
72521
|
init_background_task_detector();
|
|
72368
72522
|
init_interactive_prompt();
|
|
72369
72523
|
TAIL_BYTES2 = 512 * 1024;
|
|
72524
|
+
KIMI_TUI_SELECTOR_PROMPT_PREFIX = "kimi-tui-selector-";
|
|
72525
|
+
IDLE_SELECTOR_TITLE = /This session has been idle for/i;
|
|
72526
|
+
IDLE_SELECTOR_HINT = /↑↓\s*navigate\s*·\s*Enter\s+select/i;
|
|
72370
72527
|
}
|
|
72371
72528
|
});
|
|
72372
72529
|
var pty_transport_exports = {};
|
|
@@ -75441,12 +75598,13 @@ ${cont}` : cont;
|
|
|
75441
75598
|
// it. Reset to 0 the instant any poll is ineligible.
|
|
75442
75599
|
staticIdlePollStreak = 0;
|
|
75443
75600
|
/**
|
|
75444
|
-
* kimi
|
|
75445
|
-
*
|
|
75446
|
-
* classify, so the session reads 'generating' while parked
|
|
75447
|
-
*
|
|
75448
|
-
*
|
|
75449
|
-
*
|
|
75601
|
+
* kimi interactive-picker hold. Covers (a) the AskUserQuestion picker
|
|
75602
|
+
* (wire.jsonl authority — kimi renders it as a TUI picker the modal/spinner
|
|
75603
|
+
* matchers do NOT classify, so the session reads 'generating' while parked)
|
|
75604
|
+
* and (b) kimi's built-in idle/cache-expired selector (screen authority —
|
|
75605
|
+
* a TUI built-in the wire never carries). Refreshed on each
|
|
75606
|
+
* getScriptParsedStatus()/getStatus() poll (refreshKimiPendingQuestion —
|
|
75607
|
+
* same cadence/rationale as the background-task passthrough), surfaced on
|
|
75450
75608
|
* getStatus() as activeInteractivePrompt so CliProviderInstance overlays
|
|
75451
75609
|
* waiting_choice and the status-transition layer emits agent:waiting_choice,
|
|
75452
75610
|
* and consumed by setInteractivePromptResponse (mesh_answer_question) to
|
|
@@ -76343,23 +76501,28 @@ ${lastSnapshot}`;
|
|
|
76343
76501
|
*/
|
|
76344
76502
|
refreshKimiPendingQuestion() {
|
|
76345
76503
|
if (this.cliType !== "kimi") return;
|
|
76346
|
-
const nativeHistory = this.provider?.nativeHistory;
|
|
76347
|
-
if (!nativeHistory?.source) return;
|
|
76348
76504
|
try {
|
|
76349
|
-
const
|
|
76350
|
-
|
|
76351
|
-
|
|
76352
|
-
|
|
76353
|
-
|
|
76354
|
-
|
|
76355
|
-
|
|
76356
|
-
|
|
76357
|
-
|
|
76358
|
-
|
|
76359
|
-
|
|
76360
|
-
|
|
76361
|
-
|
|
76362
|
-
|
|
76505
|
+
const nativeHistory = this.provider?.nativeHistory;
|
|
76506
|
+
let prompt = null;
|
|
76507
|
+
if (nativeHistory?.source) {
|
|
76508
|
+
prompt = detectKimiPendingQuestion(nativeHistory, {
|
|
76509
|
+
agentType: this.cliType,
|
|
76510
|
+
providerSessionId: this.providerSessionId || void 0,
|
|
76511
|
+
sessionStartedAtMs: this.spawnAt,
|
|
76512
|
+
envOverrides: this.extraEnv,
|
|
76513
|
+
workspace: this.workingDir,
|
|
76514
|
+
// Sidecar-claim owner token (== session registry sessionId ==
|
|
76515
|
+
// the read path's targetSessionId). WITHOUT it claiming is
|
|
76516
|
+
// skipped and the sidecar resolution fails closed on
|
|
76517
|
+
// ambiguity — any second kimi session dir in the workspace
|
|
76518
|
+
// (e.g. a probe session) made detection silently dead
|
|
76519
|
+
// (live: coordinator AskUserQuestion never surfaced).
|
|
76520
|
+
instanceId: this.owningSessionId || void 0
|
|
76521
|
+
});
|
|
76522
|
+
}
|
|
76523
|
+
if (!prompt && this.engine.currentStatus !== "generating") {
|
|
76524
|
+
prompt = detectKimiIdleSelectorPrompt(this.terminalScreen.getText());
|
|
76525
|
+
}
|
|
76363
76526
|
if ((prompt?.promptId ?? null) !== (this.activeInteractivePrompt?.promptId ?? null)) {
|
|
76364
76527
|
this.activeInteractivePrompt = prompt;
|
|
76365
76528
|
this.onStatusChange?.();
|
|
@@ -76419,7 +76582,7 @@ ${lastSnapshot}`;
|
|
|
76419
76582
|
if (!prompt || prompt.promptId !== response.promptId) {
|
|
76420
76583
|
throw new Error("Interactive prompt response does not match active prompt");
|
|
76421
76584
|
}
|
|
76422
|
-
const steps = buildKimiInteractiveTuiAnswerSteps(prompt, response);
|
|
76585
|
+
const steps = prompt.promptId.startsWith(KIMI_TUI_SELECTOR_PROMPT_PREFIX) ? buildKimiSelectorAnswerSteps(prompt, response, this.terminalScreen.getText()) : buildKimiInteractiveTuiAnswerSteps(prompt, response);
|
|
76423
76586
|
for (const step of steps) {
|
|
76424
76587
|
await this.writeToPty(step);
|
|
76425
76588
|
await new Promise((resolve29) => setTimeout(resolve29, 180));
|
|
@@ -78272,16 +78435,27 @@ ${lastSnapshot}`;
|
|
|
78272
78435
|
type: "object",
|
|
78273
78436
|
additionalProperties: false,
|
|
78274
78437
|
required: ["mode", "path"],
|
|
78275
|
-
properties: { mode: { const: "context_file" }, path: { type: "string" }, wrapper: { type: "string" } }
|
|
78438
|
+
properties: { mode: { const: "context_file" }, path: { type: "string" }, wrapper: { type: "string" }, owned: { type: "boolean" } }
|
|
78276
78439
|
},
|
|
78277
78440
|
{
|
|
78278
78441
|
type: "object",
|
|
78279
78442
|
additionalProperties: false,
|
|
78280
78443
|
required: ["mode", "name"],
|
|
78281
78444
|
properties: { mode: { const: "env_var" }, name: { type: "string" } }
|
|
78445
|
+
},
|
|
78446
|
+
{
|
|
78447
|
+
type: "object",
|
|
78448
|
+
additionalProperties: false,
|
|
78449
|
+
required: ["mode", "flag"],
|
|
78450
|
+
properties: { mode: { const: "agent_file" }, flag: { type: "string" }, template: { type: "string" } }
|
|
78282
78451
|
}
|
|
78283
78452
|
]
|
|
78284
78453
|
},
|
|
78454
|
+
launchArgs: {
|
|
78455
|
+
description: "Extra spawn args appended ONLY for coordinator launches (e.g. cursor-agent's --approve-mcps accepts the daemon-written .cursor/mcp.json without parking on the MCP-approval modal).",
|
|
78456
|
+
type: "array",
|
|
78457
|
+
items: { type: "string", minLength: 1 }
|
|
78458
|
+
},
|
|
78285
78459
|
delegatedWorkerIsolation: {
|
|
78286
78460
|
description: "Provider-declared launch isolation for coordinator-spawned worker sessions. Keeps worker-only sessions from inheriting coordinator MCP/tools/config.",
|
|
78287
78461
|
type: "object",
|
|
@@ -81327,8 +81501,8 @@ ${lastSnapshot}`;
|
|
|
81327
81501
|
if ((0, import_fs17.existsSync)(bundledCli)) resolvedCli = bundledCli;
|
|
81328
81502
|
}
|
|
81329
81503
|
if (!resolvedCli && appPath && os28 === "win32") {
|
|
81330
|
-
const { dirname:
|
|
81331
|
-
const appDir =
|
|
81504
|
+
const { dirname: dirname23 } = await import("path");
|
|
81505
|
+
const appDir = dirname23(appPath);
|
|
81332
81506
|
const candidates = [
|
|
81333
81507
|
`${appDir}\\\\bin\\\\${def.cli}.cmd`,
|
|
81334
81508
|
`${appDir}\\\\bin\\\\${def.cli}`,
|
|
@@ -109396,8 +109570,8 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
109396
109570
|
normalizeRepoMeshDeclarativeConfig: normalizeRepoMeshDeclarativeConfig2,
|
|
109397
109571
|
MESH_JSON_CONFIG_LOCATIONS: MESH_JSON_CONFIG_LOCATIONS2
|
|
109398
109572
|
} = await Promise.resolve().then(() => (init_mesh_json_config(), mesh_json_config_exports));
|
|
109399
|
-
const { mkdirSync:
|
|
109400
|
-
const { dirname:
|
|
109573
|
+
const { mkdirSync: mkdirSync30, writeFileSync: writeFileSync30 } = await import("fs");
|
|
109574
|
+
const { dirname: dirname23, join: join62 } = await import("path");
|
|
109401
109575
|
const scaffold = buildMeshJsonConfigScaffold2(mesh);
|
|
109402
109576
|
const scaffoldJson = serializeMeshJsonConfigScaffold2(scaffold);
|
|
109403
109577
|
const relativePath = MESH_JSON_CONFIG_LOCATIONS2[0];
|
|
@@ -109437,7 +109611,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
109437
109611
|
note: "Dry-run: nothing written. Re-run with write=true to persist to the repo (commit target). meshes.json is untouched."
|
|
109438
109612
|
};
|
|
109439
109613
|
}
|
|
109440
|
-
|
|
109614
|
+
mkdirSync30(dirname23(absolutePath), { recursive: true });
|
|
109441
109615
|
writeFileSync30(absolutePath, `${scaffoldJson}
|
|
109442
109616
|
`, "utf-8");
|
|
109443
109617
|
return {
|
|
@@ -109507,8 +109681,8 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
109507
109681
|
normalizeRepoMeshDeclarativeConfig: normalizeRepoMeshDeclarativeConfig2,
|
|
109508
109682
|
MESH_JSON_CONFIG_LOCATIONS: MESH_JSON_CONFIG_LOCATIONS2
|
|
109509
109683
|
} = await Promise.resolve().then(() => (init_mesh_json_config(), mesh_json_config_exports));
|
|
109510
|
-
const { existsSync: existsSync62, readFileSync: readFileSync53, mkdirSync:
|
|
109511
|
-
const { dirname:
|
|
109684
|
+
const { existsSync: existsSync62, readFileSync: readFileSync53, mkdirSync: mkdirSync30, writeFileSync: writeFileSync30 } = await import("fs");
|
|
109685
|
+
const { dirname: dirname23, join: join62 } = await import("path");
|
|
109512
109686
|
const yaml6 = await Promise.resolve().then(() => (init_js_yaml(), js_yaml_exports));
|
|
109513
109687
|
const relativePath = MESH_JSON_CONFIG_LOCATIONS2[0];
|
|
109514
109688
|
let baseDoc = { version: 1 };
|
|
@@ -109572,7 +109746,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
109572
109746
|
note: "Dry-run: nothing written. Re-run with write=true to persist. Only the providerDefaults zone is merged; other repo zones are preserved."
|
|
109573
109747
|
};
|
|
109574
109748
|
}
|
|
109575
|
-
|
|
109749
|
+
mkdirSync30(dirname23(absolutePath), { recursive: true });
|
|
109576
109750
|
writeFileSync30(absolutePath, serialized, "utf-8");
|
|
109577
109751
|
return {
|
|
109578
109752
|
success: true,
|
|
@@ -111588,6 +111762,8 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111588
111762
|
const cliCmdArgs = [];
|
|
111589
111763
|
const cliCmdEnv = {};
|
|
111590
111764
|
let cliCmdContextFilePath;
|
|
111765
|
+
let cliCmdContextFileOwned = false;
|
|
111766
|
+
let cliCmdAgentFilePath;
|
|
111591
111767
|
if (cliCmdSystemPrompt) {
|
|
111592
111768
|
const { applyMeshCoordinatorSystemPromptInjection: applyMeshCoordinatorSystemPromptInjection2 } = await Promise.resolve().then(() => (init_mesh_coordinator(), mesh_coordinator_exports));
|
|
111593
111769
|
const effect = applyMeshCoordinatorSystemPromptInjection2(
|
|
@@ -111596,6 +111772,12 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111596
111772
|
{ cliArgs: cliCmdArgs, launchEnv: cliCmdEnv, workspace, cliType }
|
|
111597
111773
|
);
|
|
111598
111774
|
cliCmdContextFilePath = effect.contextFilePath;
|
|
111775
|
+
cliCmdContextFileOwned = effect.contextFileOwned === true;
|
|
111776
|
+
cliCmdAgentFilePath = effect.agentFilePath;
|
|
111777
|
+
}
|
|
111778
|
+
const cliCmdProviderLaunchArgs = providerMeta?.meshCoordinator?.launchArgs;
|
|
111779
|
+
if (Array.isArray(cliCmdProviderLaunchArgs)) {
|
|
111780
|
+
cliCmdArgs.push(...cliCmdProviderLaunchArgs.filter((a) => typeof a === "string" && a.trim()));
|
|
111599
111781
|
}
|
|
111600
111782
|
const cliCmdLaunch = await ctx.deps.cliManager.handleCliCommand("launch_cli", {
|
|
111601
111783
|
cliType,
|
|
@@ -111628,14 +111810,24 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111628
111810
|
});
|
|
111629
111811
|
if (cliCmdLaunch?.success && cliCmdContextFilePath) {
|
|
111630
111812
|
const stripPath = cliCmdContextFilePath;
|
|
111813
|
+
const stripOwned = cliCmdContextFileOwned;
|
|
111631
111814
|
setTimeout(() => {
|
|
111632
111815
|
void Promise.resolve().then(() => (init_mesh_coordinator(), mesh_coordinator_exports)).then(({ stripCoordinatorWrapperFile: stripCoordinatorWrapperFile2 }) => {
|
|
111633
|
-
stripCoordinatorWrapperFile2(stripPath);
|
|
111816
|
+
stripCoordinatorWrapperFile2(stripPath, stripOwned);
|
|
111634
111817
|
LOG2.info("MeshCoordinator", `Stripped wrapper from ${stripPath} after launch settle (cli_command)`);
|
|
111635
111818
|
}).catch(() => {
|
|
111636
111819
|
});
|
|
111637
111820
|
}, 5e3);
|
|
111638
111821
|
}
|
|
111822
|
+
if (cliCmdLaunch?.success && cliCmdAgentFilePath) {
|
|
111823
|
+
const agentPath = cliCmdAgentFilePath;
|
|
111824
|
+
setTimeout(() => {
|
|
111825
|
+
void Promise.resolve().then(() => (init_mesh_coordinator(), mesh_coordinator_exports)).then(({ cleanupCoordinatorAgentFile: cleanupCoordinatorAgentFile2 }) => {
|
|
111826
|
+
cleanupCoordinatorAgentFile2(agentPath);
|
|
111827
|
+
}).catch(() => {
|
|
111828
|
+
});
|
|
111829
|
+
}, 5e3);
|
|
111830
|
+
}
|
|
111639
111831
|
if (!cliCmdLaunch?.success) {
|
|
111640
111832
|
return { success: false, error: cliCmdLaunch?.error || "Failed to launch CLI session" };
|
|
111641
111833
|
}
|
|
@@ -111653,7 +111845,8 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111653
111845
|
extraSystemPrompt: extraSystemPrompt || void 0,
|
|
111654
111846
|
injection: cliCmdInjectionDecl ? {
|
|
111655
111847
|
mode: cliCmdInjectionDecl.mode,
|
|
111656
|
-
target: "flag" in cliCmdInjectionDecl ? cliCmdInjectionDecl.flag : "name" in cliCmdInjectionDecl ? cliCmdInjectionDecl.name : "path" in cliCmdInjectionDecl ? cliCmdInjectionDecl.path : void 0
|
|
111848
|
+
target: "flag" in cliCmdInjectionDecl ? cliCmdInjectionDecl.flag : "name" in cliCmdInjectionDecl ? cliCmdInjectionDecl.name : "path" in cliCmdInjectionDecl ? cliCmdInjectionDecl.path : void 0,
|
|
111849
|
+
..."owned" in cliCmdInjectionDecl ? { owned: cliCmdInjectionDecl.owned === true } : {}
|
|
111657
111850
|
} : void 0
|
|
111658
111851
|
});
|
|
111659
111852
|
}
|
|
@@ -111708,8 +111901,8 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111708
111901
|
workspace
|
|
111709
111902
|
};
|
|
111710
111903
|
}
|
|
111711
|
-
const { existsSync: existsSync62, readFileSync: readFileSync53, writeFileSync: writeFileSync30, copyFileSync: copyFileSync3, mkdirSync:
|
|
111712
|
-
const { dirname:
|
|
111904
|
+
const { existsSync: existsSync62, readFileSync: readFileSync53, writeFileSync: writeFileSync30, copyFileSync: copyFileSync3, mkdirSync: mkdirSync30 } = await import("fs");
|
|
111905
|
+
const { dirname: dirname23 } = await import("path");
|
|
111713
111906
|
const mcpConfigPath = coordinatorSetup.configPath;
|
|
111714
111907
|
const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
|
|
111715
111908
|
let hermesBaseConfig = null;
|
|
@@ -111746,7 +111939,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111746
111939
|
...mcpServerEnv ? { env: mcpServerEnv } : {}
|
|
111747
111940
|
});
|
|
111748
111941
|
try {
|
|
111749
|
-
|
|
111942
|
+
mkdirSync30(dirname23(mcpConfigPath), { recursive: true });
|
|
111750
111943
|
} catch (error48) {
|
|
111751
111944
|
const message = `Could not prepare MCP config path for automatic setup: ${error48?.message || error48}`;
|
|
111752
111945
|
LOG2.error("MeshCoordinator", message);
|
|
@@ -111756,7 +111949,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111756
111949
|
const hadExistingMcpConfig = existsSync62(mcpConfigPath);
|
|
111757
111950
|
let existingMcpConfig = hermesBaseConfig?.config || {};
|
|
111758
111951
|
if (hermesBaseConfig) {
|
|
111759
|
-
copyHermesCoordinatorCredentialFiles(hermesBaseConfig.sourceHome,
|
|
111952
|
+
copyHermesCoordinatorCredentialFiles(hermesBaseConfig.sourceHome, dirname23(mcpConfigPath));
|
|
111760
111953
|
}
|
|
111761
111954
|
if (hadExistingMcpConfig) {
|
|
111762
111955
|
try {
|
|
@@ -111794,10 +111987,12 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111794
111987
|
const cliArgs = [];
|
|
111795
111988
|
const launchEnv = {};
|
|
111796
111989
|
if (configFormat === "hermes_config_yaml") {
|
|
111797
|
-
launchEnv.HERMES_HOME =
|
|
111990
|
+
launchEnv.HERMES_HOME = dirname23(mcpConfigPath);
|
|
111798
111991
|
launchEnv.HERMES_IGNORE_USER_CONFIG = "";
|
|
111799
111992
|
}
|
|
111800
111993
|
let autoImportContextFilePath;
|
|
111994
|
+
let autoImportContextFileOwned = false;
|
|
111995
|
+
let autoImportAgentFilePath;
|
|
111801
111996
|
if (systemPrompt) {
|
|
111802
111997
|
const { applyMeshCoordinatorSystemPromptInjection: applyMeshCoordinatorSystemPromptInjection2 } = await Promise.resolve().then(() => (init_mesh_coordinator(), mesh_coordinator_exports));
|
|
111803
111998
|
const effect = applyMeshCoordinatorSystemPromptInjection2(
|
|
@@ -111806,6 +112001,12 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111806
112001
|
{ cliArgs, launchEnv, workspace, cliType }
|
|
111807
112002
|
);
|
|
111808
112003
|
autoImportContextFilePath = effect.contextFilePath;
|
|
112004
|
+
autoImportContextFileOwned = effect.contextFileOwned === true;
|
|
112005
|
+
autoImportAgentFilePath = effect.agentFilePath;
|
|
112006
|
+
}
|
|
112007
|
+
const autoImportProviderLaunchArgs = providerMeta?.meshCoordinator?.launchArgs;
|
|
112008
|
+
if (Array.isArray(autoImportProviderLaunchArgs)) {
|
|
112009
|
+
cliArgs.push(...autoImportProviderLaunchArgs.filter((a) => typeof a === "string" && a.trim()));
|
|
111809
112010
|
}
|
|
111810
112011
|
if (cliType === "claude-cli") {
|
|
111811
112012
|
cliArgs.push("--mcp-config", coordinatorSetup.configPath);
|
|
@@ -111835,14 +112036,24 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111835
112036
|
});
|
|
111836
112037
|
if (launchResult?.success && autoImportContextFilePath) {
|
|
111837
112038
|
const stripPath = autoImportContextFilePath;
|
|
112039
|
+
const stripOwned = autoImportContextFileOwned;
|
|
111838
112040
|
setTimeout(() => {
|
|
111839
112041
|
void Promise.resolve().then(() => (init_mesh_coordinator(), mesh_coordinator_exports)).then(({ stripCoordinatorWrapperFile: stripCoordinatorWrapperFile2 }) => {
|
|
111840
|
-
stripCoordinatorWrapperFile2(stripPath);
|
|
112042
|
+
stripCoordinatorWrapperFile2(stripPath, stripOwned);
|
|
111841
112043
|
LOG2.info("MeshCoordinator", `Stripped wrapper from ${stripPath} after launch settle (auto_import)`);
|
|
111842
112044
|
}).catch(() => {
|
|
111843
112045
|
});
|
|
111844
112046
|
}, 5e3);
|
|
111845
112047
|
}
|
|
112048
|
+
if (launchResult?.success && autoImportAgentFilePath) {
|
|
112049
|
+
const agentPath = autoImportAgentFilePath;
|
|
112050
|
+
setTimeout(() => {
|
|
112051
|
+
void Promise.resolve().then(() => (init_mesh_coordinator(), mesh_coordinator_exports)).then(({ cleanupCoordinatorAgentFile: cleanupCoordinatorAgentFile2 }) => {
|
|
112052
|
+
cleanupCoordinatorAgentFile2(agentPath);
|
|
112053
|
+
}).catch(() => {
|
|
112054
|
+
});
|
|
112055
|
+
}, 5e3);
|
|
112056
|
+
}
|
|
111846
112057
|
if (!launchResult?.success) {
|
|
111847
112058
|
return { success: false, error: launchResult?.error || "Failed to launch CLI session" };
|
|
111848
112059
|
}
|
|
@@ -111861,7 +112072,8 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111861
112072
|
mcpConfigPath,
|
|
111862
112073
|
injection: autoImportInjectionDecl ? {
|
|
111863
112074
|
mode: autoImportInjectionDecl.mode,
|
|
111864
|
-
target: "flag" in autoImportInjectionDecl ? autoImportInjectionDecl.flag : "name" in autoImportInjectionDecl ? autoImportInjectionDecl.name : "path" in autoImportInjectionDecl ? autoImportInjectionDecl.path : void 0
|
|
112075
|
+
target: "flag" in autoImportInjectionDecl ? autoImportInjectionDecl.flag : "name" in autoImportInjectionDecl ? autoImportInjectionDecl.name : "path" in autoImportInjectionDecl ? autoImportInjectionDecl.path : void 0,
|
|
112076
|
+
..."owned" in autoImportInjectionDecl ? { owned: autoImportInjectionDecl.owned === true } : {}
|
|
111865
112077
|
} : void 0
|
|
111866
112078
|
});
|
|
111867
112079
|
}
|