@adhdev/daemon-core 0.9.76-rc.21 → 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/git/git-types.d.ts +1 -1
- package/dist/index.js +70 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +71 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/commands/cli-manager.ts +66 -3
- package/src/git/git-commands.ts +5 -1
- package/src/git/git-types.ts +1 -0
- package/src/providers/cli-provider-instance.ts +26 -5
package/dist/index.mjs
CHANGED
|
@@ -4693,6 +4693,7 @@ var FAILURE_REASONS = /* @__PURE__ */ new Set([
|
|
|
4693
4693
|
"dirty_index_required",
|
|
4694
4694
|
"conflict",
|
|
4695
4695
|
"invalid_args",
|
|
4696
|
+
"nothing_to_commit",
|
|
4696
4697
|
"git_command_failed"
|
|
4697
4698
|
]);
|
|
4698
4699
|
function failure(reason, error) {
|
|
@@ -4937,7 +4938,10 @@ async function gitCheckpoint(workspace, message, includeUntracked) {
|
|
|
4937
4938
|
} catch (err) {
|
|
4938
4939
|
const output = (err?.stdout || "") + (err?.stderr || "");
|
|
4939
4940
|
if (/nothing to commit/i.test(output)) {
|
|
4940
|
-
throw new GitCommandError("
|
|
4941
|
+
throw new GitCommandError("nothing_to_commit", "Nothing to commit \u2014 working tree is clean.", {
|
|
4942
|
+
stdout: err?.stdout,
|
|
4943
|
+
stderr: err?.stderr
|
|
4944
|
+
});
|
|
4941
4945
|
}
|
|
4942
4946
|
throw err;
|
|
4943
4947
|
}
|
|
@@ -14660,7 +14664,7 @@ init_provider_cli_adapter();
|
|
|
14660
14664
|
import * as os13 from "os";
|
|
14661
14665
|
import * as path17 from "path";
|
|
14662
14666
|
import * as crypto4 from "crypto";
|
|
14663
|
-
import { existsSync as existsSync12 } from "fs";
|
|
14667
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync7, writeFileSync as writeFileSync7 } from "fs";
|
|
14664
14668
|
import { execFileSync } from "child_process";
|
|
14665
14669
|
import chalk from "chalk";
|
|
14666
14670
|
init_config();
|
|
@@ -15468,10 +15472,26 @@ ${effect.notification.body || ""}`.trim();
|
|
|
15468
15472
|
}
|
|
15469
15473
|
mergeConversationMessages(parsedMessages) {
|
|
15470
15474
|
if (this.runtimeMessages.length === 0) return normalizeChatMessages(parsedMessages);
|
|
15471
|
-
|
|
15472
|
-
|
|
15473
|
-
|
|
15474
|
-
|
|
15475
|
+
const parsedEntries = parsedMessages.map((message, index) => ({
|
|
15476
|
+
message,
|
|
15477
|
+
index,
|
|
15478
|
+
source: "parsed"
|
|
15479
|
+
}));
|
|
15480
|
+
const runtimeEntries = this.runtimeMessages.map((entry, index) => ({
|
|
15481
|
+
message: entry.message,
|
|
15482
|
+
index: parsedMessages.length + index,
|
|
15483
|
+
source: "runtime"
|
|
15484
|
+
}));
|
|
15485
|
+
const getTime = (message) => {
|
|
15486
|
+
const value = typeof message.receivedAt === "number" ? message.receivedAt : typeof message.timestamp === "number" ? message.timestamp : 0;
|
|
15487
|
+
return Number.isFinite(value) && value > 0 ? value : 0;
|
|
15488
|
+
};
|
|
15489
|
+
return normalizeChatMessages([...parsedEntries, ...runtimeEntries].sort((a, b) => {
|
|
15490
|
+
const aTime = getTime(a.message);
|
|
15491
|
+
const bTime = getTime(b.message);
|
|
15492
|
+
if (aTime && bTime && aTime !== bTime) return aTime - bTime;
|
|
15493
|
+
if (aTime && !bTime && a.source === "runtime" && b.source === "parsed") return -1;
|
|
15494
|
+
if (!aTime && bTime && a.source === "parsed" && b.source === "runtime") return 1;
|
|
15475
15495
|
return a.index - b.index;
|
|
15476
15496
|
}).map((entry) => entry.message));
|
|
15477
15497
|
}
|
|
@@ -16828,6 +16848,35 @@ function colorize(color, text) {
|
|
|
16828
16848
|
const fn = chalkApi?.[color];
|
|
16829
16849
|
return typeof fn === "function" ? fn(text) : text;
|
|
16830
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
|
+
}
|
|
16831
16880
|
function isUuid(value) {
|
|
16832
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);
|
|
16833
16882
|
}
|
|
@@ -17461,12 +17510,23 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
17461
17510
|
const dir = resolved.path;
|
|
17462
17511
|
const launchSource = resolved.source;
|
|
17463
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;
|
|
17464
17520
|
const started = await this.startSession(
|
|
17465
17521
|
cliType,
|
|
17466
17522
|
dir,
|
|
17467
|
-
args?.cliArgs,
|
|
17523
|
+
delegatedLaunch ? delegatedLaunch.cliArgs : args?.cliArgs,
|
|
17468
17524
|
args?.initialModel,
|
|
17469
|
-
{
|
|
17525
|
+
{
|
|
17526
|
+
resumeSessionId: args?.resumeSessionId,
|
|
17527
|
+
settingsOverride,
|
|
17528
|
+
extraEnv: delegatedLaunch ? delegatedLaunch.env : args?.env
|
|
17529
|
+
}
|
|
17470
17530
|
);
|
|
17471
17531
|
return {
|
|
17472
17532
|
success: true,
|
|
@@ -21947,7 +22007,7 @@ var DaemonCommandRouter = class {
|
|
|
21947
22007
|
workspace
|
|
21948
22008
|
};
|
|
21949
22009
|
}
|
|
21950
|
-
const { existsSync: existsSync23, readFileSync: readFileSync15, writeFileSync:
|
|
22010
|
+
const { existsSync: existsSync23, readFileSync: readFileSync15, writeFileSync: writeFileSync13, copyFileSync: copyFileSync3, mkdirSync: mkdirSync15 } = await import("fs");
|
|
21951
22011
|
const { dirname: dirname9 } = await import("path");
|
|
21952
22012
|
const mcpConfigPath = coordinatorSetup.configPath;
|
|
21953
22013
|
const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
|
|
@@ -21971,7 +22031,7 @@ var DaemonCommandRouter = class {
|
|
|
21971
22031
|
};
|
|
21972
22032
|
}
|
|
21973
22033
|
try {
|
|
21974
|
-
|
|
22034
|
+
mkdirSync15(dirname9(mcpConfigPath), { recursive: true });
|
|
21975
22035
|
} catch (error) {
|
|
21976
22036
|
const message = `Could not prepare MCP config path for automatic setup: ${error?.message || error}`;
|
|
21977
22037
|
LOG.error("MeshCoordinator", message);
|
|
@@ -22003,7 +22063,7 @@ var DaemonCommandRouter = class {
|
|
|
22003
22063
|
}
|
|
22004
22064
|
};
|
|
22005
22065
|
try {
|
|
22006
|
-
|
|
22066
|
+
writeFileSync13(mcpConfigPath, serializeMeshCoordinatorMcpConfig(mcpConfig, configFormat), "utf-8");
|
|
22007
22067
|
} catch (error) {
|
|
22008
22068
|
const message = `Could not write MCP config for automatic setup: ${error?.message || error}`;
|
|
22009
22069
|
LOG.error("MeshCoordinator", message);
|