@adhdev/daemon-core 0.9.76-rc.22 → 0.9.76-rc.24
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
|
@@ -63,6 +63,17 @@ type CliStartOptions = {
|
|
|
63
63
|
settingsOverride?: Record<string, any>;
|
|
64
64
|
extraEnv?: Record<string, string>;
|
|
65
65
|
};
|
|
66
|
+
export interface CoordinatorDelegatedCliLaunchOptionsInput {
|
|
67
|
+
cliType: string;
|
|
68
|
+
workspace: string;
|
|
69
|
+
cliArgs?: string[];
|
|
70
|
+
env?: Record<string, string>;
|
|
71
|
+
}
|
|
72
|
+
export interface CoordinatorDelegatedCliLaunchOptions {
|
|
73
|
+
cliArgs: string[];
|
|
74
|
+
env: Record<string, string>;
|
|
75
|
+
}
|
|
76
|
+
export declare function buildCoordinatorDelegatedCliLaunchOptions(input: CoordinatorDelegatedCliLaunchOptionsInput): CoordinatorDelegatedCliLaunchOptions;
|
|
66
77
|
export declare function supportsExplicitSessionResume(resume?: ProviderResumeCapability): boolean;
|
|
67
78
|
export declare function resolveCliSessionBinding(provider: ProviderModule | undefined, normalizedType: string, cliArgs?: string[], requestedResumeSessionId?: string): CliSessionBinding;
|
|
68
79
|
export declare class DaemonCliManager {
|
package/dist/index.js
CHANGED
|
@@ -17040,6 +17040,35 @@ function colorize(color, text) {
|
|
|
17040
17040
|
const fn = chalkApi?.[color];
|
|
17041
17041
|
return typeof fn === "function" ? fn(text) : text;
|
|
17042
17042
|
}
|
|
17043
|
+
var COORDINATOR_DELEGATED_ENV_UNSETS = {
|
|
17044
|
+
ADHDEV_INLINE_MESH: "",
|
|
17045
|
+
ADHDEV_MCP_TRANSPORT: "",
|
|
17046
|
+
ADHDEV_MESH_ID: "",
|
|
17047
|
+
HERMES_EPHEMERAL_SYSTEM_PROMPT: ""
|
|
17048
|
+
};
|
|
17049
|
+
function hasCliArg(args, flag) {
|
|
17050
|
+
return args.some((arg) => arg === flag || arg.startsWith(`${flag}=`));
|
|
17051
|
+
}
|
|
17052
|
+
function ensureEmptyDelegatedMcpConfig(workspace) {
|
|
17053
|
+
const baseDir = path17.join(os13.tmpdir(), "adhdev-delegated-agent-empty-mcp");
|
|
17054
|
+
(0, import_fs6.mkdirSync)(baseDir, { recursive: true });
|
|
17055
|
+
const workspaceHash = crypto4.createHash("sha256").update(path17.resolve(workspace || os13.tmpdir())).digest("hex").slice(0, 16);
|
|
17056
|
+
const filePath = path17.join(baseDir, `${workspaceHash}.json`);
|
|
17057
|
+
(0, import_fs6.writeFileSync)(filePath, JSON.stringify({ mcpServers: {} }, null, 2), "utf-8");
|
|
17058
|
+
return filePath;
|
|
17059
|
+
}
|
|
17060
|
+
function buildCoordinatorDelegatedCliLaunchOptions(input) {
|
|
17061
|
+
const cliType = String(input.cliType || "").trim();
|
|
17062
|
+
const cliArgs = Array.isArray(input.cliArgs) ? [...input.cliArgs] : [];
|
|
17063
|
+
const env = { ...input.env || {}, ...COORDINATOR_DELEGATED_ENV_UNSETS };
|
|
17064
|
+
if (cliType === "hermes-cli" && !hasCliArg(cliArgs, "--ignore-user-config")) {
|
|
17065
|
+
cliArgs.unshift("--ignore-user-config");
|
|
17066
|
+
}
|
|
17067
|
+
if (cliType === "claude-cli" && !hasCliArg(cliArgs, "--mcp-config")) {
|
|
17068
|
+
cliArgs.unshift("--mcp-config", ensureEmptyDelegatedMcpConfig(input.workspace));
|
|
17069
|
+
}
|
|
17070
|
+
return { cliArgs, env };
|
|
17071
|
+
}
|
|
17043
17072
|
function isUuid(value) {
|
|
17044
17073
|
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
|
|
17045
17074
|
}
|
|
@@ -17673,12 +17702,23 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
17673
17702
|
const dir = resolved.path;
|
|
17674
17703
|
const launchSource = resolved.source;
|
|
17675
17704
|
if (!cliType) throw new Error("cliType required");
|
|
17705
|
+
const settingsOverride = args?.settings && typeof args.settings === "object" ? args.settings : void 0;
|
|
17706
|
+
const delegatedLaunch = settingsOverride?.launchedByCoordinator === true ? buildCoordinatorDelegatedCliLaunchOptions({
|
|
17707
|
+
cliType,
|
|
17708
|
+
workspace: dir,
|
|
17709
|
+
cliArgs: args?.cliArgs,
|
|
17710
|
+
env: args?.env
|
|
17711
|
+
}) : null;
|
|
17676
17712
|
const started = await this.startSession(
|
|
17677
17713
|
cliType,
|
|
17678
17714
|
dir,
|
|
17679
|
-
args?.cliArgs,
|
|
17715
|
+
delegatedLaunch ? delegatedLaunch.cliArgs : args?.cliArgs,
|
|
17680
17716
|
args?.initialModel,
|
|
17681
|
-
{
|
|
17717
|
+
{
|
|
17718
|
+
resumeSessionId: args?.resumeSessionId,
|
|
17719
|
+
settingsOverride,
|
|
17720
|
+
extraEnv: delegatedLaunch ? delegatedLaunch.env : args?.env
|
|
17721
|
+
}
|
|
17682
17722
|
);
|
|
17683
17723
|
return {
|
|
17684
17724
|
success: true,
|
|
@@ -22159,7 +22199,7 @@ var DaemonCommandRouter = class {
|
|
|
22159
22199
|
workspace
|
|
22160
22200
|
};
|
|
22161
22201
|
}
|
|
22162
|
-
const { existsSync: existsSync23, readFileSync: readFileSync15, writeFileSync:
|
|
22202
|
+
const { existsSync: existsSync23, readFileSync: readFileSync15, writeFileSync: writeFileSync13, copyFileSync: copyFileSync3, mkdirSync: mkdirSync15 } = await import("fs");
|
|
22163
22203
|
const { dirname: dirname9 } = await import("path");
|
|
22164
22204
|
const mcpConfigPath = coordinatorSetup.configPath;
|
|
22165
22205
|
const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
|
|
@@ -22183,7 +22223,7 @@ var DaemonCommandRouter = class {
|
|
|
22183
22223
|
};
|
|
22184
22224
|
}
|
|
22185
22225
|
try {
|
|
22186
|
-
|
|
22226
|
+
mkdirSync15(dirname9(mcpConfigPath), { recursive: true });
|
|
22187
22227
|
} catch (error) {
|
|
22188
22228
|
const message = `Could not prepare MCP config path for automatic setup: ${error?.message || error}`;
|
|
22189
22229
|
LOG.error("MeshCoordinator", message);
|
|
@@ -22215,7 +22255,7 @@ var DaemonCommandRouter = class {
|
|
|
22215
22255
|
}
|
|
22216
22256
|
};
|
|
22217
22257
|
try {
|
|
22218
|
-
|
|
22258
|
+
writeFileSync13(mcpConfigPath, serializeMeshCoordinatorMcpConfig(mcpConfig, configFormat), "utf-8");
|
|
22219
22259
|
} catch (error) {
|
|
22220
22260
|
const message = `Could not write MCP config for automatic setup: ${error?.message || error}`;
|
|
22221
22261
|
LOG.error("MeshCoordinator", message);
|