@adhdev/daemon-standalone 1.0.45-rc.4 → 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 +140 -39
- 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 "";
|
|
@@ -78272,16 +78324,27 @@ ${lastSnapshot}`;
|
|
|
78272
78324
|
type: "object",
|
|
78273
78325
|
additionalProperties: false,
|
|
78274
78326
|
required: ["mode", "path"],
|
|
78275
|
-
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" } }
|
|
78276
78328
|
},
|
|
78277
78329
|
{
|
|
78278
78330
|
type: "object",
|
|
78279
78331
|
additionalProperties: false,
|
|
78280
78332
|
required: ["mode", "name"],
|
|
78281
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" } }
|
|
78282
78340
|
}
|
|
78283
78341
|
]
|
|
78284
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
|
+
},
|
|
78285
78348
|
delegatedWorkerIsolation: {
|
|
78286
78349
|
description: "Provider-declared launch isolation for coordinator-spawned worker sessions. Keeps worker-only sessions from inheriting coordinator MCP/tools/config.",
|
|
78287
78350
|
type: "object",
|
|
@@ -81327,8 +81390,8 @@ ${lastSnapshot}`;
|
|
|
81327
81390
|
if ((0, import_fs17.existsSync)(bundledCli)) resolvedCli = bundledCli;
|
|
81328
81391
|
}
|
|
81329
81392
|
if (!resolvedCli && appPath && os28 === "win32") {
|
|
81330
|
-
const { dirname:
|
|
81331
|
-
const appDir =
|
|
81393
|
+
const { dirname: dirname23 } = await import("path");
|
|
81394
|
+
const appDir = dirname23(appPath);
|
|
81332
81395
|
const candidates = [
|
|
81333
81396
|
`${appDir}\\\\bin\\\\${def.cli}.cmd`,
|
|
81334
81397
|
`${appDir}\\\\bin\\\\${def.cli}`,
|
|
@@ -109396,8 +109459,8 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
109396
109459
|
normalizeRepoMeshDeclarativeConfig: normalizeRepoMeshDeclarativeConfig2,
|
|
109397
109460
|
MESH_JSON_CONFIG_LOCATIONS: MESH_JSON_CONFIG_LOCATIONS2
|
|
109398
109461
|
} = await Promise.resolve().then(() => (init_mesh_json_config(), mesh_json_config_exports));
|
|
109399
|
-
const { mkdirSync:
|
|
109400
|
-
const { dirname:
|
|
109462
|
+
const { mkdirSync: mkdirSync30, writeFileSync: writeFileSync30 } = await import("fs");
|
|
109463
|
+
const { dirname: dirname23, join: join62 } = await import("path");
|
|
109401
109464
|
const scaffold = buildMeshJsonConfigScaffold2(mesh);
|
|
109402
109465
|
const scaffoldJson = serializeMeshJsonConfigScaffold2(scaffold);
|
|
109403
109466
|
const relativePath = MESH_JSON_CONFIG_LOCATIONS2[0];
|
|
@@ -109437,7 +109500,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
109437
109500
|
note: "Dry-run: nothing written. Re-run with write=true to persist to the repo (commit target). meshes.json is untouched."
|
|
109438
109501
|
};
|
|
109439
109502
|
}
|
|
109440
|
-
|
|
109503
|
+
mkdirSync30(dirname23(absolutePath), { recursive: true });
|
|
109441
109504
|
writeFileSync30(absolutePath, `${scaffoldJson}
|
|
109442
109505
|
`, "utf-8");
|
|
109443
109506
|
return {
|
|
@@ -109507,8 +109570,8 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
109507
109570
|
normalizeRepoMeshDeclarativeConfig: normalizeRepoMeshDeclarativeConfig2,
|
|
109508
109571
|
MESH_JSON_CONFIG_LOCATIONS: MESH_JSON_CONFIG_LOCATIONS2
|
|
109509
109572
|
} = await Promise.resolve().then(() => (init_mesh_json_config(), mesh_json_config_exports));
|
|
109510
|
-
const { existsSync: existsSync62, readFileSync: readFileSync53, mkdirSync:
|
|
109511
|
-
const { dirname:
|
|
109573
|
+
const { existsSync: existsSync62, readFileSync: readFileSync53, mkdirSync: mkdirSync30, writeFileSync: writeFileSync30 } = await import("fs");
|
|
109574
|
+
const { dirname: dirname23, join: join62 } = await import("path");
|
|
109512
109575
|
const yaml6 = await Promise.resolve().then(() => (init_js_yaml(), js_yaml_exports));
|
|
109513
109576
|
const relativePath = MESH_JSON_CONFIG_LOCATIONS2[0];
|
|
109514
109577
|
let baseDoc = { version: 1 };
|
|
@@ -109572,7 +109635,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
109572
109635
|
note: "Dry-run: nothing written. Re-run with write=true to persist. Only the providerDefaults zone is merged; other repo zones are preserved."
|
|
109573
109636
|
};
|
|
109574
109637
|
}
|
|
109575
|
-
|
|
109638
|
+
mkdirSync30(dirname23(absolutePath), { recursive: true });
|
|
109576
109639
|
writeFileSync30(absolutePath, serialized, "utf-8");
|
|
109577
109640
|
return {
|
|
109578
109641
|
success: true,
|
|
@@ -111588,6 +111651,8 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111588
111651
|
const cliCmdArgs = [];
|
|
111589
111652
|
const cliCmdEnv = {};
|
|
111590
111653
|
let cliCmdContextFilePath;
|
|
111654
|
+
let cliCmdContextFileOwned = false;
|
|
111655
|
+
let cliCmdAgentFilePath;
|
|
111591
111656
|
if (cliCmdSystemPrompt) {
|
|
111592
111657
|
const { applyMeshCoordinatorSystemPromptInjection: applyMeshCoordinatorSystemPromptInjection2 } = await Promise.resolve().then(() => (init_mesh_coordinator(), mesh_coordinator_exports));
|
|
111593
111658
|
const effect = applyMeshCoordinatorSystemPromptInjection2(
|
|
@@ -111596,6 +111661,12 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111596
111661
|
{ cliArgs: cliCmdArgs, launchEnv: cliCmdEnv, workspace, cliType }
|
|
111597
111662
|
);
|
|
111598
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()));
|
|
111599
111670
|
}
|
|
111600
111671
|
const cliCmdLaunch = await ctx.deps.cliManager.handleCliCommand("launch_cli", {
|
|
111601
111672
|
cliType,
|
|
@@ -111628,14 +111699,24 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111628
111699
|
});
|
|
111629
111700
|
if (cliCmdLaunch?.success && cliCmdContextFilePath) {
|
|
111630
111701
|
const stripPath = cliCmdContextFilePath;
|
|
111702
|
+
const stripOwned = cliCmdContextFileOwned;
|
|
111631
111703
|
setTimeout(() => {
|
|
111632
111704
|
void Promise.resolve().then(() => (init_mesh_coordinator(), mesh_coordinator_exports)).then(({ stripCoordinatorWrapperFile: stripCoordinatorWrapperFile2 }) => {
|
|
111633
|
-
stripCoordinatorWrapperFile2(stripPath);
|
|
111705
|
+
stripCoordinatorWrapperFile2(stripPath, stripOwned);
|
|
111634
111706
|
LOG2.info("MeshCoordinator", `Stripped wrapper from ${stripPath} after launch settle (cli_command)`);
|
|
111635
111707
|
}).catch(() => {
|
|
111636
111708
|
});
|
|
111637
111709
|
}, 5e3);
|
|
111638
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
|
+
}
|
|
111639
111720
|
if (!cliCmdLaunch?.success) {
|
|
111640
111721
|
return { success: false, error: cliCmdLaunch?.error || "Failed to launch CLI session" };
|
|
111641
111722
|
}
|
|
@@ -111653,7 +111734,8 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111653
111734
|
extraSystemPrompt: extraSystemPrompt || void 0,
|
|
111654
111735
|
injection: cliCmdInjectionDecl ? {
|
|
111655
111736
|
mode: cliCmdInjectionDecl.mode,
|
|
111656
|
-
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 } : {}
|
|
111657
111739
|
} : void 0
|
|
111658
111740
|
});
|
|
111659
111741
|
}
|
|
@@ -111708,8 +111790,8 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111708
111790
|
workspace
|
|
111709
111791
|
};
|
|
111710
111792
|
}
|
|
111711
|
-
const { existsSync: existsSync62, readFileSync: readFileSync53, writeFileSync: writeFileSync30, copyFileSync: copyFileSync3, mkdirSync:
|
|
111712
|
-
const { dirname:
|
|
111793
|
+
const { existsSync: existsSync62, readFileSync: readFileSync53, writeFileSync: writeFileSync30, copyFileSync: copyFileSync3, mkdirSync: mkdirSync30 } = await import("fs");
|
|
111794
|
+
const { dirname: dirname23 } = await import("path");
|
|
111713
111795
|
const mcpConfigPath = coordinatorSetup.configPath;
|
|
111714
111796
|
const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
|
|
111715
111797
|
let hermesBaseConfig = null;
|
|
@@ -111746,7 +111828,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111746
111828
|
...mcpServerEnv ? { env: mcpServerEnv } : {}
|
|
111747
111829
|
});
|
|
111748
111830
|
try {
|
|
111749
|
-
|
|
111831
|
+
mkdirSync30(dirname23(mcpConfigPath), { recursive: true });
|
|
111750
111832
|
} catch (error48) {
|
|
111751
111833
|
const message = `Could not prepare MCP config path for automatic setup: ${error48?.message || error48}`;
|
|
111752
111834
|
LOG2.error("MeshCoordinator", message);
|
|
@@ -111756,7 +111838,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111756
111838
|
const hadExistingMcpConfig = existsSync62(mcpConfigPath);
|
|
111757
111839
|
let existingMcpConfig = hermesBaseConfig?.config || {};
|
|
111758
111840
|
if (hermesBaseConfig) {
|
|
111759
|
-
copyHermesCoordinatorCredentialFiles(hermesBaseConfig.sourceHome,
|
|
111841
|
+
copyHermesCoordinatorCredentialFiles(hermesBaseConfig.sourceHome, dirname23(mcpConfigPath));
|
|
111760
111842
|
}
|
|
111761
111843
|
if (hadExistingMcpConfig) {
|
|
111762
111844
|
try {
|
|
@@ -111794,10 +111876,12 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111794
111876
|
const cliArgs = [];
|
|
111795
111877
|
const launchEnv = {};
|
|
111796
111878
|
if (configFormat === "hermes_config_yaml") {
|
|
111797
|
-
launchEnv.HERMES_HOME =
|
|
111879
|
+
launchEnv.HERMES_HOME = dirname23(mcpConfigPath);
|
|
111798
111880
|
launchEnv.HERMES_IGNORE_USER_CONFIG = "";
|
|
111799
111881
|
}
|
|
111800
111882
|
let autoImportContextFilePath;
|
|
111883
|
+
let autoImportContextFileOwned = false;
|
|
111884
|
+
let autoImportAgentFilePath;
|
|
111801
111885
|
if (systemPrompt) {
|
|
111802
111886
|
const { applyMeshCoordinatorSystemPromptInjection: applyMeshCoordinatorSystemPromptInjection2 } = await Promise.resolve().then(() => (init_mesh_coordinator(), mesh_coordinator_exports));
|
|
111803
111887
|
const effect = applyMeshCoordinatorSystemPromptInjection2(
|
|
@@ -111806,6 +111890,12 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111806
111890
|
{ cliArgs, launchEnv, workspace, cliType }
|
|
111807
111891
|
);
|
|
111808
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()));
|
|
111809
111899
|
}
|
|
111810
111900
|
if (cliType === "claude-cli") {
|
|
111811
111901
|
cliArgs.push("--mcp-config", coordinatorSetup.configPath);
|
|
@@ -111835,14 +111925,24 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111835
111925
|
});
|
|
111836
111926
|
if (launchResult?.success && autoImportContextFilePath) {
|
|
111837
111927
|
const stripPath = autoImportContextFilePath;
|
|
111928
|
+
const stripOwned = autoImportContextFileOwned;
|
|
111838
111929
|
setTimeout(() => {
|
|
111839
111930
|
void Promise.resolve().then(() => (init_mesh_coordinator(), mesh_coordinator_exports)).then(({ stripCoordinatorWrapperFile: stripCoordinatorWrapperFile2 }) => {
|
|
111840
|
-
stripCoordinatorWrapperFile2(stripPath);
|
|
111931
|
+
stripCoordinatorWrapperFile2(stripPath, stripOwned);
|
|
111841
111932
|
LOG2.info("MeshCoordinator", `Stripped wrapper from ${stripPath} after launch settle (auto_import)`);
|
|
111842
111933
|
}).catch(() => {
|
|
111843
111934
|
});
|
|
111844
111935
|
}, 5e3);
|
|
111845
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
|
+
}
|
|
111846
111946
|
if (!launchResult?.success) {
|
|
111847
111947
|
return { success: false, error: launchResult?.error || "Failed to launch CLI session" };
|
|
111848
111948
|
}
|
|
@@ -111861,7 +111961,8 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
111861
111961
|
mcpConfigPath,
|
|
111862
111962
|
injection: autoImportInjectionDecl ? {
|
|
111863
111963
|
mode: autoImportInjectionDecl.mode,
|
|
111864
|
-
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 } : {}
|
|
111865
111966
|
} : void 0
|
|
111866
111967
|
});
|
|
111867
111968
|
}
|