@adhdev/daemon-standalone 1.0.45-rc.3 → 1.0.45-rc.5
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 +148 -40
- 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 ? "fc7a3adae844e18bc983aeb8089edad7ff38d116" : void 0) ?? "unknown";
|
|
37024
|
+
const commitShort = readInjected(true ? "fc7a3ada" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
37025
|
+
const version2 = readInjected(true ? "1.0.45-rc.5" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
37026
|
+
const builtAt = readInjected(true ? "2026-08-12T03:20:09.297Z" : 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 "";
|
|
@@ -76351,7 +76403,14 @@ ${lastSnapshot}`;
|
|
|
76351
76403
|
providerSessionId: this.providerSessionId || void 0,
|
|
76352
76404
|
sessionStartedAtMs: this.spawnAt,
|
|
76353
76405
|
envOverrides: this.extraEnv,
|
|
76354
|
-
workspace: this.workingDir
|
|
76406
|
+
workspace: this.workingDir,
|
|
76407
|
+
// Sidecar-claim owner token (== session registry sessionId ==
|
|
76408
|
+
// the read path's targetSessionId). WITHOUT it claiming is
|
|
76409
|
+
// skipped and the sidecar resolution fails closed on
|
|
76410
|
+
// ambiguity — any second kimi session dir in the workspace
|
|
76411
|
+
// (e.g. a probe session) made detection silently dead
|
|
76412
|
+
// (live: coordinator AskUserQuestion never surfaced).
|
|
76413
|
+
instanceId: this.owningSessionId || void 0
|
|
76355
76414
|
});
|
|
76356
76415
|
if ((prompt?.promptId ?? null) !== (this.activeInteractivePrompt?.promptId ?? null)) {
|
|
76357
76416
|
this.activeInteractivePrompt = prompt;
|
|
@@ -78265,16 +78324,27 @@ ${lastSnapshot}`;
|
|
|
78265
78324
|
type: "object",
|
|
78266
78325
|
additionalProperties: false,
|
|
78267
78326
|
required: ["mode", "path"],
|
|
78268
|
-
properties: { mode: { const: "context_file" }, path: { type: "string" }, wrapper: { type: "string" } }
|
|
78327
|
+
properties: { mode: { const: "context_file" }, path: { type: "string" }, wrapper: { type: "string" }, owned: { type: "boolean" } }
|
|
78269
78328
|
},
|
|
78270
78329
|
{
|
|
78271
78330
|
type: "object",
|
|
78272
78331
|
additionalProperties: false,
|
|
78273
78332
|
required: ["mode", "name"],
|
|
78274
78333
|
properties: { mode: { const: "env_var" }, name: { type: "string" } }
|
|
78334
|
+
},
|
|
78335
|
+
{
|
|
78336
|
+
type: "object",
|
|
78337
|
+
additionalProperties: false,
|
|
78338
|
+
required: ["mode", "flag"],
|
|
78339
|
+
properties: { mode: { const: "agent_file" }, flag: { type: "string" }, template: { type: "string" } }
|
|
78275
78340
|
}
|
|
78276
78341
|
]
|
|
78277
78342
|
},
|
|
78343
|
+
launchArgs: {
|
|
78344
|
+
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).",
|
|
78345
|
+
type: "array",
|
|
78346
|
+
items: { type: "string", minLength: 1 }
|
|
78347
|
+
},
|
|
78278
78348
|
delegatedWorkerIsolation: {
|
|
78279
78349
|
description: "Provider-declared launch isolation for coordinator-spawned worker sessions. Keeps worker-only sessions from inheriting coordinator MCP/tools/config.",
|
|
78280
78350
|
type: "object",
|
|
@@ -81320,8 +81390,8 @@ ${lastSnapshot}`;
|
|
|
81320
81390
|
if ((0, import_fs17.existsSync)(bundledCli)) resolvedCli = bundledCli;
|
|
81321
81391
|
}
|
|
81322
81392
|
if (!resolvedCli && appPath && os28 === "win32") {
|
|
81323
|
-
const { dirname:
|
|
81324
|
-
const appDir =
|
|
81393
|
+
const { dirname: dirname23 } = await import("path");
|
|
81394
|
+
const appDir = dirname23(appPath);
|
|
81325
81395
|
const candidates = [
|
|
81326
81396
|
`${appDir}\\\\bin\\\\${def.cli}.cmd`,
|
|
81327
81397
|
`${appDir}\\\\bin\\\\${def.cli}`,
|
|
@@ -109389,8 +109459,8 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
109389
109459
|
normalizeRepoMeshDeclarativeConfig: normalizeRepoMeshDeclarativeConfig2,
|
|
109390
109460
|
MESH_JSON_CONFIG_LOCATIONS: MESH_JSON_CONFIG_LOCATIONS2
|
|
109391
109461
|
} = await Promise.resolve().then(() => (init_mesh_json_config(), mesh_json_config_exports));
|
|
109392
|
-
const { mkdirSync:
|
|
109393
|
-
const { dirname:
|
|
109462
|
+
const { mkdirSync: mkdirSync30, writeFileSync: writeFileSync30 } = await import("fs");
|
|
109463
|
+
const { dirname: dirname23, join: join62 } = await import("path");
|
|
109394
109464
|
const scaffold = buildMeshJsonConfigScaffold2(mesh);
|
|
109395
109465
|
const scaffoldJson = serializeMeshJsonConfigScaffold2(scaffold);
|
|
109396
109466
|
const relativePath = MESH_JSON_CONFIG_LOCATIONS2[0];
|
|
@@ -109430,7 +109500,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
109430
109500
|
note: "Dry-run: nothing written. Re-run with write=true to persist to the repo (commit target). meshes.json is untouched."
|
|
109431
109501
|
};
|
|
109432
109502
|
}
|
|
109433
|
-
|
|
109503
|
+
mkdirSync30(dirname23(absolutePath), { recursive: true });
|
|
109434
109504
|
writeFileSync30(absolutePath, `${scaffoldJson}
|
|
109435
109505
|
`, "utf-8");
|
|
109436
109506
|
return {
|
|
@@ -109500,8 +109570,8 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
109500
109570
|
normalizeRepoMeshDeclarativeConfig: normalizeRepoMeshDeclarativeConfig2,
|
|
109501
109571
|
MESH_JSON_CONFIG_LOCATIONS: MESH_JSON_CONFIG_LOCATIONS2
|
|
109502
109572
|
} = await Promise.resolve().then(() => (init_mesh_json_config(), mesh_json_config_exports));
|
|
109503
|
-
const { existsSync: existsSync62, readFileSync: readFileSync53, mkdirSync:
|
|
109504
|
-
const { dirname:
|
|
109573
|
+
const { existsSync: existsSync62, readFileSync: readFileSync53, mkdirSync: mkdirSync30, writeFileSync: writeFileSync30 } = await import("fs");
|
|
109574
|
+
const { dirname: dirname23, join: join62 } = await import("path");
|
|
109505
109575
|
const yaml6 = await Promise.resolve().then(() => (init_js_yaml(), js_yaml_exports));
|
|
109506
109576
|
const relativePath = MESH_JSON_CONFIG_LOCATIONS2[0];
|
|
109507
109577
|
let baseDoc = { version: 1 };
|
|
@@ -109565,7 +109635,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
109565
109635
|
note: "Dry-run: nothing written. Re-run with write=true to persist. Only the providerDefaults zone is merged; other repo zones are preserved."
|
|
109566
109636
|
};
|
|
109567
109637
|
}
|
|
109568
|
-
|
|
109638
|
+
mkdirSync30(dirname23(absolutePath), { recursive: true });
|
|
109569
109639
|
writeFileSync30(absolutePath, serialized, "utf-8");
|
|
109570
109640
|
return {
|
|
109571
109641
|
success: true,
|
|
@@ -111581,6 +111651,8 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111581
111651
|
const cliCmdArgs = [];
|
|
111582
111652
|
const cliCmdEnv = {};
|
|
111583
111653
|
let cliCmdContextFilePath;
|
|
111654
|
+
let cliCmdContextFileOwned = false;
|
|
111655
|
+
let cliCmdAgentFilePath;
|
|
111584
111656
|
if (cliCmdSystemPrompt) {
|
|
111585
111657
|
const { applyMeshCoordinatorSystemPromptInjection: applyMeshCoordinatorSystemPromptInjection2 } = await Promise.resolve().then(() => (init_mesh_coordinator(), mesh_coordinator_exports));
|
|
111586
111658
|
const effect = applyMeshCoordinatorSystemPromptInjection2(
|
|
@@ -111589,6 +111661,12 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111589
111661
|
{ cliArgs: cliCmdArgs, launchEnv: cliCmdEnv, workspace, cliType }
|
|
111590
111662
|
);
|
|
111591
111663
|
cliCmdContextFilePath = effect.contextFilePath;
|
|
111664
|
+
cliCmdContextFileOwned = effect.contextFileOwned === true;
|
|
111665
|
+
cliCmdAgentFilePath = effect.agentFilePath;
|
|
111666
|
+
}
|
|
111667
|
+
const cliCmdProviderLaunchArgs = providerMeta?.meshCoordinator?.launchArgs;
|
|
111668
|
+
if (Array.isArray(cliCmdProviderLaunchArgs)) {
|
|
111669
|
+
cliCmdArgs.push(...cliCmdProviderLaunchArgs.filter((a) => typeof a === "string" && a.trim()));
|
|
111592
111670
|
}
|
|
111593
111671
|
const cliCmdLaunch = await ctx.deps.cliManager.handleCliCommand("launch_cli", {
|
|
111594
111672
|
cliType,
|
|
@@ -111621,14 +111699,24 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111621
111699
|
});
|
|
111622
111700
|
if (cliCmdLaunch?.success && cliCmdContextFilePath) {
|
|
111623
111701
|
const stripPath = cliCmdContextFilePath;
|
|
111702
|
+
const stripOwned = cliCmdContextFileOwned;
|
|
111624
111703
|
setTimeout(() => {
|
|
111625
111704
|
void Promise.resolve().then(() => (init_mesh_coordinator(), mesh_coordinator_exports)).then(({ stripCoordinatorWrapperFile: stripCoordinatorWrapperFile2 }) => {
|
|
111626
|
-
stripCoordinatorWrapperFile2(stripPath);
|
|
111705
|
+
stripCoordinatorWrapperFile2(stripPath, stripOwned);
|
|
111627
111706
|
LOG2.info("MeshCoordinator", `Stripped wrapper from ${stripPath} after launch settle (cli_command)`);
|
|
111628
111707
|
}).catch(() => {
|
|
111629
111708
|
});
|
|
111630
111709
|
}, 5e3);
|
|
111631
111710
|
}
|
|
111711
|
+
if (cliCmdLaunch?.success && cliCmdAgentFilePath) {
|
|
111712
|
+
const agentPath = cliCmdAgentFilePath;
|
|
111713
|
+
setTimeout(() => {
|
|
111714
|
+
void Promise.resolve().then(() => (init_mesh_coordinator(), mesh_coordinator_exports)).then(({ cleanupCoordinatorAgentFile: cleanupCoordinatorAgentFile2 }) => {
|
|
111715
|
+
cleanupCoordinatorAgentFile2(agentPath);
|
|
111716
|
+
}).catch(() => {
|
|
111717
|
+
});
|
|
111718
|
+
}, 5e3);
|
|
111719
|
+
}
|
|
111632
111720
|
if (!cliCmdLaunch?.success) {
|
|
111633
111721
|
return { success: false, error: cliCmdLaunch?.error || "Failed to launch CLI session" };
|
|
111634
111722
|
}
|
|
@@ -111646,7 +111734,8 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111646
111734
|
extraSystemPrompt: extraSystemPrompt || void 0,
|
|
111647
111735
|
injection: cliCmdInjectionDecl ? {
|
|
111648
111736
|
mode: cliCmdInjectionDecl.mode,
|
|
111649
|
-
target: "flag" in cliCmdInjectionDecl ? cliCmdInjectionDecl.flag : "name" in cliCmdInjectionDecl ? cliCmdInjectionDecl.name : "path" in cliCmdInjectionDecl ? cliCmdInjectionDecl.path : void 0
|
|
111737
|
+
target: "flag" in cliCmdInjectionDecl ? cliCmdInjectionDecl.flag : "name" in cliCmdInjectionDecl ? cliCmdInjectionDecl.name : "path" in cliCmdInjectionDecl ? cliCmdInjectionDecl.path : void 0,
|
|
111738
|
+
..."owned" in cliCmdInjectionDecl ? { owned: cliCmdInjectionDecl.owned === true } : {}
|
|
111650
111739
|
} : void 0
|
|
111651
111740
|
});
|
|
111652
111741
|
}
|
|
@@ -111701,8 +111790,8 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111701
111790
|
workspace
|
|
111702
111791
|
};
|
|
111703
111792
|
}
|
|
111704
|
-
const { existsSync: existsSync62, readFileSync: readFileSync53, writeFileSync: writeFileSync30, copyFileSync: copyFileSync3, mkdirSync:
|
|
111705
|
-
const { dirname:
|
|
111793
|
+
const { existsSync: existsSync62, readFileSync: readFileSync53, writeFileSync: writeFileSync30, copyFileSync: copyFileSync3, mkdirSync: mkdirSync30 } = await import("fs");
|
|
111794
|
+
const { dirname: dirname23 } = await import("path");
|
|
111706
111795
|
const mcpConfigPath = coordinatorSetup.configPath;
|
|
111707
111796
|
const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
|
|
111708
111797
|
let hermesBaseConfig = null;
|
|
@@ -111739,7 +111828,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111739
111828
|
...mcpServerEnv ? { env: mcpServerEnv } : {}
|
|
111740
111829
|
});
|
|
111741
111830
|
try {
|
|
111742
|
-
|
|
111831
|
+
mkdirSync30(dirname23(mcpConfigPath), { recursive: true });
|
|
111743
111832
|
} catch (error48) {
|
|
111744
111833
|
const message = `Could not prepare MCP config path for automatic setup: ${error48?.message || error48}`;
|
|
111745
111834
|
LOG2.error("MeshCoordinator", message);
|
|
@@ -111749,7 +111838,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111749
111838
|
const hadExistingMcpConfig = existsSync62(mcpConfigPath);
|
|
111750
111839
|
let existingMcpConfig = hermesBaseConfig?.config || {};
|
|
111751
111840
|
if (hermesBaseConfig) {
|
|
111752
|
-
copyHermesCoordinatorCredentialFiles(hermesBaseConfig.sourceHome,
|
|
111841
|
+
copyHermesCoordinatorCredentialFiles(hermesBaseConfig.sourceHome, dirname23(mcpConfigPath));
|
|
111753
111842
|
}
|
|
111754
111843
|
if (hadExistingMcpConfig) {
|
|
111755
111844
|
try {
|
|
@@ -111787,10 +111876,12 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111787
111876
|
const cliArgs = [];
|
|
111788
111877
|
const launchEnv = {};
|
|
111789
111878
|
if (configFormat === "hermes_config_yaml") {
|
|
111790
|
-
launchEnv.HERMES_HOME =
|
|
111879
|
+
launchEnv.HERMES_HOME = dirname23(mcpConfigPath);
|
|
111791
111880
|
launchEnv.HERMES_IGNORE_USER_CONFIG = "";
|
|
111792
111881
|
}
|
|
111793
111882
|
let autoImportContextFilePath;
|
|
111883
|
+
let autoImportContextFileOwned = false;
|
|
111884
|
+
let autoImportAgentFilePath;
|
|
111794
111885
|
if (systemPrompt) {
|
|
111795
111886
|
const { applyMeshCoordinatorSystemPromptInjection: applyMeshCoordinatorSystemPromptInjection2 } = await Promise.resolve().then(() => (init_mesh_coordinator(), mesh_coordinator_exports));
|
|
111796
111887
|
const effect = applyMeshCoordinatorSystemPromptInjection2(
|
|
@@ -111799,6 +111890,12 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111799
111890
|
{ cliArgs, launchEnv, workspace, cliType }
|
|
111800
111891
|
);
|
|
111801
111892
|
autoImportContextFilePath = effect.contextFilePath;
|
|
111893
|
+
autoImportContextFileOwned = effect.contextFileOwned === true;
|
|
111894
|
+
autoImportAgentFilePath = effect.agentFilePath;
|
|
111895
|
+
}
|
|
111896
|
+
const autoImportProviderLaunchArgs = providerMeta?.meshCoordinator?.launchArgs;
|
|
111897
|
+
if (Array.isArray(autoImportProviderLaunchArgs)) {
|
|
111898
|
+
cliArgs.push(...autoImportProviderLaunchArgs.filter((a) => typeof a === "string" && a.trim()));
|
|
111802
111899
|
}
|
|
111803
111900
|
if (cliType === "claude-cli") {
|
|
111804
111901
|
cliArgs.push("--mcp-config", coordinatorSetup.configPath);
|
|
@@ -111828,14 +111925,24 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111828
111925
|
});
|
|
111829
111926
|
if (launchResult?.success && autoImportContextFilePath) {
|
|
111830
111927
|
const stripPath = autoImportContextFilePath;
|
|
111928
|
+
const stripOwned = autoImportContextFileOwned;
|
|
111831
111929
|
setTimeout(() => {
|
|
111832
111930
|
void Promise.resolve().then(() => (init_mesh_coordinator(), mesh_coordinator_exports)).then(({ stripCoordinatorWrapperFile: stripCoordinatorWrapperFile2 }) => {
|
|
111833
|
-
stripCoordinatorWrapperFile2(stripPath);
|
|
111931
|
+
stripCoordinatorWrapperFile2(stripPath, stripOwned);
|
|
111834
111932
|
LOG2.info("MeshCoordinator", `Stripped wrapper from ${stripPath} after launch settle (auto_import)`);
|
|
111835
111933
|
}).catch(() => {
|
|
111836
111934
|
});
|
|
111837
111935
|
}, 5e3);
|
|
111838
111936
|
}
|
|
111937
|
+
if (launchResult?.success && autoImportAgentFilePath) {
|
|
111938
|
+
const agentPath = autoImportAgentFilePath;
|
|
111939
|
+
setTimeout(() => {
|
|
111940
|
+
void Promise.resolve().then(() => (init_mesh_coordinator(), mesh_coordinator_exports)).then(({ cleanupCoordinatorAgentFile: cleanupCoordinatorAgentFile2 }) => {
|
|
111941
|
+
cleanupCoordinatorAgentFile2(agentPath);
|
|
111942
|
+
}).catch(() => {
|
|
111943
|
+
});
|
|
111944
|
+
}, 5e3);
|
|
111945
|
+
}
|
|
111839
111946
|
if (!launchResult?.success) {
|
|
111840
111947
|
return { success: false, error: launchResult?.error || "Failed to launch CLI session" };
|
|
111841
111948
|
}
|
|
@@ -111854,7 +111961,8 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111854
111961
|
mcpConfigPath,
|
|
111855
111962
|
injection: autoImportInjectionDecl ? {
|
|
111856
111963
|
mode: autoImportInjectionDecl.mode,
|
|
111857
|
-
target: "flag" in autoImportInjectionDecl ? autoImportInjectionDecl.flag : "name" in autoImportInjectionDecl ? autoImportInjectionDecl.name : "path" in autoImportInjectionDecl ? autoImportInjectionDecl.path : void 0
|
|
111964
|
+
target: "flag" in autoImportInjectionDecl ? autoImportInjectionDecl.flag : "name" in autoImportInjectionDecl ? autoImportInjectionDecl.name : "path" in autoImportInjectionDecl ? autoImportInjectionDecl.path : void 0,
|
|
111965
|
+
..."owned" in autoImportInjectionDecl ? { owned: autoImportInjectionDecl.owned === true } : {}
|
|
111858
111966
|
} : void 0
|
|
111859
111967
|
});
|
|
111860
111968
|
}
|