@adhdev/daemon-core 0.9.76-rc.22 → 0.9.76-rc.23
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/commands/cli-manager.d.ts +11 -0
- package/dist/index.js +45 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/commands/cli-manager.ts +66 -3
package/dist/index.mjs
CHANGED
|
@@ -14664,7 +14664,7 @@ init_provider_cli_adapter();
|
|
|
14664
14664
|
import * as os13 from "os";
|
|
14665
14665
|
import * as path17 from "path";
|
|
14666
14666
|
import * as crypto4 from "crypto";
|
|
14667
|
-
import { existsSync as existsSync12 } from "fs";
|
|
14667
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync7, writeFileSync as writeFileSync7 } from "fs";
|
|
14668
14668
|
import { execFileSync } from "child_process";
|
|
14669
14669
|
import chalk from "chalk";
|
|
14670
14670
|
init_config();
|
|
@@ -16848,6 +16848,35 @@ function colorize(color, text) {
|
|
|
16848
16848
|
const fn = chalkApi?.[color];
|
|
16849
16849
|
return typeof fn === "function" ? fn(text) : text;
|
|
16850
16850
|
}
|
|
16851
|
+
var COORDINATOR_DELEGATED_ENV_UNSETS = {
|
|
16852
|
+
ADHDEV_INLINE_MESH: "",
|
|
16853
|
+
ADHDEV_MCP_TRANSPORT: "",
|
|
16854
|
+
ADHDEV_MESH_ID: "",
|
|
16855
|
+
HERMES_EPHEMERAL_SYSTEM_PROMPT: ""
|
|
16856
|
+
};
|
|
16857
|
+
function hasCliArg(args, flag) {
|
|
16858
|
+
return args.some((arg) => arg === flag || arg.startsWith(`${flag}=`));
|
|
16859
|
+
}
|
|
16860
|
+
function ensureEmptyDelegatedMcpConfig(workspace) {
|
|
16861
|
+
const baseDir = path17.join(os13.tmpdir(), "adhdev-delegated-agent-empty-mcp");
|
|
16862
|
+
mkdirSync7(baseDir, { recursive: true });
|
|
16863
|
+
const workspaceHash = crypto4.createHash("sha256").update(path17.resolve(workspace || os13.tmpdir())).digest("hex").slice(0, 16);
|
|
16864
|
+
const filePath = path17.join(baseDir, `${workspaceHash}.json`);
|
|
16865
|
+
writeFileSync7(filePath, JSON.stringify({ mcpServers: {} }, null, 2), "utf-8");
|
|
16866
|
+
return filePath;
|
|
16867
|
+
}
|
|
16868
|
+
function buildCoordinatorDelegatedCliLaunchOptions(input) {
|
|
16869
|
+
const cliType = String(input.cliType || "").trim();
|
|
16870
|
+
const cliArgs = Array.isArray(input.cliArgs) ? [...input.cliArgs] : [];
|
|
16871
|
+
const env = { ...input.env || {}, ...COORDINATOR_DELEGATED_ENV_UNSETS };
|
|
16872
|
+
if (cliType === "hermes-cli" && !hasCliArg(cliArgs, "--ignore-user-config")) {
|
|
16873
|
+
cliArgs.unshift("--ignore-user-config");
|
|
16874
|
+
}
|
|
16875
|
+
if (cliType === "claude-cli" && !hasCliArg(cliArgs, "--mcp-config")) {
|
|
16876
|
+
cliArgs.unshift("--mcp-config", ensureEmptyDelegatedMcpConfig(input.workspace));
|
|
16877
|
+
}
|
|
16878
|
+
return { cliArgs, env };
|
|
16879
|
+
}
|
|
16851
16880
|
function isUuid(value) {
|
|
16852
16881
|
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
|
|
16853
16882
|
}
|
|
@@ -17481,12 +17510,23 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
17481
17510
|
const dir = resolved.path;
|
|
17482
17511
|
const launchSource = resolved.source;
|
|
17483
17512
|
if (!cliType) throw new Error("cliType required");
|
|
17513
|
+
const settingsOverride = args?.settings && typeof args.settings === "object" ? args.settings : void 0;
|
|
17514
|
+
const delegatedLaunch = settingsOverride?.launchedByCoordinator === true ? buildCoordinatorDelegatedCliLaunchOptions({
|
|
17515
|
+
cliType,
|
|
17516
|
+
workspace: dir,
|
|
17517
|
+
cliArgs: args?.cliArgs,
|
|
17518
|
+
env: args?.env
|
|
17519
|
+
}) : null;
|
|
17484
17520
|
const started = await this.startSession(
|
|
17485
17521
|
cliType,
|
|
17486
17522
|
dir,
|
|
17487
|
-
args?.cliArgs,
|
|
17523
|
+
delegatedLaunch ? delegatedLaunch.cliArgs : args?.cliArgs,
|
|
17488
17524
|
args?.initialModel,
|
|
17489
|
-
{
|
|
17525
|
+
{
|
|
17526
|
+
resumeSessionId: args?.resumeSessionId,
|
|
17527
|
+
settingsOverride,
|
|
17528
|
+
extraEnv: delegatedLaunch ? delegatedLaunch.env : args?.env
|
|
17529
|
+
}
|
|
17490
17530
|
);
|
|
17491
17531
|
return {
|
|
17492
17532
|
success: true,
|
|
@@ -21967,7 +22007,7 @@ var DaemonCommandRouter = class {
|
|
|
21967
22007
|
workspace
|
|
21968
22008
|
};
|
|
21969
22009
|
}
|
|
21970
|
-
const { existsSync: existsSync23, readFileSync: readFileSync15, writeFileSync:
|
|
22010
|
+
const { existsSync: existsSync23, readFileSync: readFileSync15, writeFileSync: writeFileSync13, copyFileSync: copyFileSync3, mkdirSync: mkdirSync15 } = await import("fs");
|
|
21971
22011
|
const { dirname: dirname9 } = await import("path");
|
|
21972
22012
|
const mcpConfigPath = coordinatorSetup.configPath;
|
|
21973
22013
|
const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
|
|
@@ -21991,7 +22031,7 @@ var DaemonCommandRouter = class {
|
|
|
21991
22031
|
};
|
|
21992
22032
|
}
|
|
21993
22033
|
try {
|
|
21994
|
-
|
|
22034
|
+
mkdirSync15(dirname9(mcpConfigPath), { recursive: true });
|
|
21995
22035
|
} catch (error) {
|
|
21996
22036
|
const message = `Could not prepare MCP config path for automatic setup: ${error?.message || error}`;
|
|
21997
22037
|
LOG.error("MeshCoordinator", message);
|
|
@@ -22023,7 +22063,7 @@ var DaemonCommandRouter = class {
|
|
|
22023
22063
|
}
|
|
22024
22064
|
};
|
|
22025
22065
|
try {
|
|
22026
|
-
|
|
22066
|
+
writeFileSync13(mcpConfigPath, serializeMeshCoordinatorMcpConfig(mcpConfig, configFormat), "utf-8");
|
|
22027
22067
|
} catch (error) {
|
|
22028
22068
|
const message = `Could not write MCP config for automatic setup: ${error?.message || error}`;
|
|
22029
22069
|
LOG.error("MeshCoordinator", message);
|