@adhdev/daemon-core 0.9.82-rc.94 → 0.9.82-rc.96
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 +124 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +125 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/commands/chat-commands.ts +8 -2
- package/src/commands/cli-manager.ts +10 -0
- package/src/commands/router.ts +134 -3
package/dist/index.mjs
CHANGED
|
@@ -15865,7 +15865,7 @@ var RECENT_SEND_WINDOW_MS = 1200;
|
|
|
15865
15865
|
var READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS = 25e3;
|
|
15866
15866
|
var HERMES_CLI_STARTING_SEND_SETTLE_MS = 2e3;
|
|
15867
15867
|
var CLI_NATIVE_HISTORY_FRESH_MS = 5 * 6e4;
|
|
15868
|
-
var CLI_NATIVE_TRANSCRIPT_PROVIDERS = /* @__PURE__ */ new Set(["codex-cli", "claude-cli", "hermes-cli"]);
|
|
15868
|
+
var CLI_NATIVE_TRANSCRIPT_PROVIDERS = /* @__PURE__ */ new Set(["codex-cli", "claude-cli", "hermes-cli", "antigravity-cli"]);
|
|
15869
15869
|
var recentSendByTarget = /* @__PURE__ */ new Map();
|
|
15870
15870
|
function getCurrentProviderType(h, fallback = "") {
|
|
15871
15871
|
return h.currentSession?.providerType || h.currentProviderType || fallback;
|
|
@@ -16920,7 +16920,7 @@ async function handleReadChat(h, args) {
|
|
|
16920
16920
|
returnedStatus: String(returnedStatus || ""),
|
|
16921
16921
|
selectedMessageSource: messageSource.selected,
|
|
16922
16922
|
messageSource,
|
|
16923
|
-
shouldPreferAdapterMessages: supportsCliNativeTranscript(providerType, provider) && messageSource.selected !== "native-history",
|
|
16923
|
+
shouldPreferAdapterMessages: supportsCliNativeTranscript(providerType, provider) && isNativeSourceCanonicalHistory(provider?.canonicalHistory) && messageSource.selected !== "native-history" && typeof messageSource.fallbackReason === "string" && messageSource.fallbackReason.startsWith("native_history_") && messageSource.fallbackReason !== "native_history_not_checked" && !(selectedTranscriptAuthority === "provider" && selectedCoverage === "full"),
|
|
16924
16924
|
parsedMsgCount: parsedRecord.messages.length,
|
|
16925
16925
|
returnedMsgCount: selectedMessages.length
|
|
16926
16926
|
},
|
|
@@ -22059,10 +22059,14 @@ function detectExplicitProviderSessionId(provider, args) {
|
|
|
22059
22059
|
}
|
|
22060
22060
|
const subcommands = resume?.sessionIdFromSubcommand;
|
|
22061
22061
|
if (Array.isArray(subcommands) && subcommands.length > 0) {
|
|
22062
|
+
const hasResumeSubcommand = args.some((arg) => subcommands.includes(arg));
|
|
22062
22063
|
const subcommandSessionId = readSubcommandSessionId(args, subcommands);
|
|
22063
22064
|
if (subcommandSessionId) {
|
|
22064
22065
|
return { providerSessionId: subcommandSessionId, launchMode: "resume" };
|
|
22065
22066
|
}
|
|
22067
|
+
if (hasResumeSubcommand) {
|
|
22068
|
+
return { launchMode: "resume" };
|
|
22069
|
+
}
|
|
22066
22070
|
}
|
|
22067
22071
|
return { launchMode: "manual" };
|
|
22068
22072
|
}
|
|
@@ -22086,6 +22090,12 @@ function resolveCliSessionBinding(provider, normalizedType, cliArgs, requestedRe
|
|
|
22086
22090
|
launchMode: explicit.launchMode
|
|
22087
22091
|
};
|
|
22088
22092
|
}
|
|
22093
|
+
if (explicit.launchMode === "resume") {
|
|
22094
|
+
return {
|
|
22095
|
+
cliArgs: baseArgs,
|
|
22096
|
+
launchMode: "resume"
|
|
22097
|
+
};
|
|
22098
|
+
}
|
|
22089
22099
|
if (explicit.launchMode === "manual" && hasArg(baseArgs || [], ["--session-id"])) {
|
|
22090
22100
|
return {
|
|
22091
22101
|
cliArgs: baseArgs,
|
|
@@ -26086,7 +26096,7 @@ async function maybeRunDaemonUpgradeHelperFromEnv() {
|
|
|
26086
26096
|
|
|
26087
26097
|
// src/commands/router.ts
|
|
26088
26098
|
init_mesh_work_queue();
|
|
26089
|
-
import { homedir as homedir19 } from "os";
|
|
26099
|
+
import { homedir as homedir19, hostname as osHostname } from "os";
|
|
26090
26100
|
import { basename as pathBasename, join as pathJoin, resolve as pathResolve } from "path";
|
|
26091
26101
|
import * as fs11 from "fs";
|
|
26092
26102
|
var CHANNEL_NPM_TAG = { stable: "latest", preview: "next" };
|
|
@@ -26235,12 +26245,114 @@ function buildMeshNodeDisplayLabel(node, nodeId, providerPriority) {
|
|
|
26235
26245
|
if (explicit) return explicit;
|
|
26236
26246
|
const workspace = readStringValue(node.workspace, node.repoRoot, node.repo_root);
|
|
26237
26247
|
const workspaceName = workspace ? pathBasename(workspace) : void 0;
|
|
26238
|
-
const host = readStringValue(node.hostname, node.host, node.daemonId, node.daemon_id, node.machineId, node.machine_id);
|
|
26248
|
+
const host = readStringValue(node.machineName, node.machine_name, node.hostname, node.host, node.daemonId, node.daemon_id, node.machineId, node.machine_id);
|
|
26239
26249
|
const provider = providerPriority[0] || (Array.isArray(node.providers) ? readStringValue(...node.providers) : void 0);
|
|
26240
26250
|
const parts = [workspaceName, host, provider].filter(Boolean);
|
|
26241
26251
|
if (parts.length > 0) return parts.join(" \xB7 ");
|
|
26242
26252
|
return nodeId || "unidentified mesh node";
|
|
26243
26253
|
}
|
|
26254
|
+
function normalizeMeshHostname(value) {
|
|
26255
|
+
const hostname2 = readStringValue(value);
|
|
26256
|
+
if (!hostname2) return void 0;
|
|
26257
|
+
return hostname2.toLowerCase().replace(/\.$/, "");
|
|
26258
|
+
}
|
|
26259
|
+
function readMeshNodeMachineId(node) {
|
|
26260
|
+
return readStringValue(
|
|
26261
|
+
node.machineId,
|
|
26262
|
+
node.machine_id,
|
|
26263
|
+
readObjectRecord(node.machine)?.id,
|
|
26264
|
+
readObjectRecord(node.machine)?.machineId,
|
|
26265
|
+
readObjectRecord(node.lastProbe)?.machineId,
|
|
26266
|
+
readObjectRecord(node.last_probe)?.machine_id,
|
|
26267
|
+
readObjectRecord(readObjectRecord(node.lastProbe)?.machine)?.id,
|
|
26268
|
+
readObjectRecord(readObjectRecord(node.lastProbe)?.machine)?.machineId,
|
|
26269
|
+
readObjectRecord(readObjectRecord(node.last_probe)?.machine)?.id,
|
|
26270
|
+
readObjectRecord(readObjectRecord(node.last_probe)?.machine)?.machine_id
|
|
26271
|
+
);
|
|
26272
|
+
}
|
|
26273
|
+
function readMeshNodeDaemonId(node) {
|
|
26274
|
+
return readStringValue(
|
|
26275
|
+
node.daemonId,
|
|
26276
|
+
node.daemon_id,
|
|
26277
|
+
readObjectRecord(node.machine)?.daemonId,
|
|
26278
|
+
readObjectRecord(node.machine)?.daemon_id,
|
|
26279
|
+
readObjectRecord(node.lastProbe)?.daemonId,
|
|
26280
|
+
readObjectRecord(node.last_probe)?.daemon_id,
|
|
26281
|
+
readObjectRecord(readObjectRecord(node.lastProbe)?.machine)?.daemonId,
|
|
26282
|
+
readObjectRecord(readObjectRecord(node.lastProbe)?.machine)?.daemon_id,
|
|
26283
|
+
readObjectRecord(readObjectRecord(node.last_probe)?.machine)?.daemonId,
|
|
26284
|
+
readObjectRecord(readObjectRecord(node.last_probe)?.machine)?.daemon_id
|
|
26285
|
+
);
|
|
26286
|
+
}
|
|
26287
|
+
function readMeshNodeHostname(node) {
|
|
26288
|
+
return readStringValue(
|
|
26289
|
+
node.hostname,
|
|
26290
|
+
node.host,
|
|
26291
|
+
node.machineHostname,
|
|
26292
|
+
node.machine_hostname,
|
|
26293
|
+
readObjectRecord(node.machine)?.hostname,
|
|
26294
|
+
readObjectRecord(node.machine)?.host,
|
|
26295
|
+
readObjectRecord(node.lastProbe)?.hostname,
|
|
26296
|
+
readObjectRecord(node.last_probe)?.hostname,
|
|
26297
|
+
readObjectRecord(readObjectRecord(node.lastProbe)?.machine)?.hostname,
|
|
26298
|
+
readObjectRecord(readObjectRecord(node.last_probe)?.machine)?.hostname
|
|
26299
|
+
);
|
|
26300
|
+
}
|
|
26301
|
+
function readMeshNodeDisplayMachineName(node) {
|
|
26302
|
+
return readStringValue(
|
|
26303
|
+
node.machineName,
|
|
26304
|
+
node.machine_name,
|
|
26305
|
+
node.machineLabel,
|
|
26306
|
+
node.machine_label,
|
|
26307
|
+
node.machineNickname,
|
|
26308
|
+
node.machine_nickname,
|
|
26309
|
+
node.alias,
|
|
26310
|
+
readObjectRecord(node.machine)?.name,
|
|
26311
|
+
readObjectRecord(node.machine)?.displayName,
|
|
26312
|
+
readObjectRecord(node.machine)?.display_name,
|
|
26313
|
+
readObjectRecord(node.lastProbe)?.machineName,
|
|
26314
|
+
readObjectRecord(node.last_probe)?.machine_name,
|
|
26315
|
+
readObjectRecord(readObjectRecord(node.lastProbe)?.machine)?.name,
|
|
26316
|
+
readObjectRecord(readObjectRecord(node.last_probe)?.machine)?.name,
|
|
26317
|
+
readMeshNodeHostname(node)
|
|
26318
|
+
);
|
|
26319
|
+
}
|
|
26320
|
+
function compactMeshIdentityEvidence(value) {
|
|
26321
|
+
if (!value) return void 0;
|
|
26322
|
+
return value.length > 24 ? `${value.slice(0, 12)}\u2026${value.slice(-8)}` : value;
|
|
26323
|
+
}
|
|
26324
|
+
function buildMeshNodeMachineIdentity(node, opts) {
|
|
26325
|
+
const machineId = readMeshNodeMachineId(node);
|
|
26326
|
+
const daemonId = readMeshNodeDaemonId(node);
|
|
26327
|
+
const hostname2 = readMeshNodeHostname(node);
|
|
26328
|
+
const machineName = readMeshNodeDisplayMachineName(node);
|
|
26329
|
+
const coordinatorHostname = readStringValue(opts.coordinatorHostname);
|
|
26330
|
+
const machineIdMatches = Boolean(opts.localMachineId && machineId && opts.localMachineId === machineId);
|
|
26331
|
+
const daemonIdMatches = Boolean(opts.localDaemonId && daemonId && opts.localDaemonId === daemonId);
|
|
26332
|
+
const hostnameMatches = Boolean(
|
|
26333
|
+
normalizeMeshHostname(hostname2) && normalizeMeshHostname(coordinatorHostname) && normalizeMeshHostname(hostname2) === normalizeMeshHostname(coordinatorHostname)
|
|
26334
|
+
);
|
|
26335
|
+
const sameMachine = opts.isSelfNode === true || machineIdMatches || daemonIdMatches || hostnameMatches;
|
|
26336
|
+
const evidence = [];
|
|
26337
|
+
for (const [label, value] of [["machineName", machineName], ["hostname", hostname2], ["machineId", machineId], ["daemonId", daemonId]]) {
|
|
26338
|
+
const compact = compactMeshIdentityEvidence(value);
|
|
26339
|
+
if (compact) evidence.push(`${label}:${compact}`);
|
|
26340
|
+
}
|
|
26341
|
+
const locality = sameMachine ? "same_machine" : evidence.length > 0 ? "remote_known" : "remote_or_unknown";
|
|
26342
|
+
const localityReason = sameMachine ? machineIdMatches ? "matched coordinator machine id" : daemonIdMatches ? "matched coordinator daemon id" : hostnameMatches ? "matched coordinator hostname" : "selected coordinator node" : evidence.length > 0 ? `known remote/other machine identity; no local coordinator match (${evidence.join(", ")})` : "no useful machine identity evidence available";
|
|
26343
|
+
return {
|
|
26344
|
+
daemonId,
|
|
26345
|
+
machineId,
|
|
26346
|
+
hostname: hostname2,
|
|
26347
|
+
machineName,
|
|
26348
|
+
displayName: machineName || hostname2 || daemonId || machineId,
|
|
26349
|
+
coordinatorHostname,
|
|
26350
|
+
sameMachine,
|
|
26351
|
+
locality,
|
|
26352
|
+
localityReason,
|
|
26353
|
+
identityEvidence: evidence
|
|
26354
|
+
};
|
|
26355
|
+
}
|
|
26244
26356
|
function normalizeInlineMeshGitStatus(status, node, options) {
|
|
26245
26357
|
const isGitRepo = readBooleanValue(status.isGitRepo);
|
|
26246
26358
|
if (!Object.keys(status).length || isGitRepo === void 0) return void 0;
|
|
@@ -30299,6 +30411,7 @@ ${block2}`);
|
|
|
30299
30411
|
return failureResult;
|
|
30300
30412
|
}
|
|
30301
30413
|
const directTruthUnavailableNodeIds = new Set(effectiveDirectTruth.unavailableNodeIds);
|
|
30414
|
+
const coordinatorHostname = osHostname();
|
|
30302
30415
|
const selectedCoordinatorNodeId = readStringValue(
|
|
30303
30416
|
mesh.coordinator?.preferredNodeId,
|
|
30304
30417
|
mesh.nodes?.[0]?.id,
|
|
@@ -30316,6 +30429,12 @@ ${block2}`);
|
|
|
30316
30429
|
) || Boolean(
|
|
30317
30430
|
daemonId && (daemonId === localMachineId || daemonId === this.deps.statusInstanceId)
|
|
30318
30431
|
) || Boolean(meshRecord?.inline && nodeIndex === 0);
|
|
30432
|
+
const machineIdentity = buildMeshNodeMachineIdentity(node, {
|
|
30433
|
+
localMachineId,
|
|
30434
|
+
localDaemonId: this.deps.statusInstanceId,
|
|
30435
|
+
coordinatorHostname,
|
|
30436
|
+
isSelfNode
|
|
30437
|
+
});
|
|
30319
30438
|
const status = {
|
|
30320
30439
|
nodeId,
|
|
30321
30440
|
machineLabel: buildMeshNodeDisplayLabel(node, nodeId, providerPriority),
|
|
@@ -30326,7 +30445,8 @@ ${block2}`);
|
|
|
30326
30445
|
worktreeBranch: node.worktreeBranch,
|
|
30327
30446
|
role: normalizeMeshDaemonRole(node.role) || (meshHost.hostNodeId && nodeId === meshHost.hostNodeId ? "host" : void 0),
|
|
30328
30447
|
daemonId,
|
|
30329
|
-
machineId: node.machineId,
|
|
30448
|
+
machineId: readMeshNodeMachineId(node) || node.machineId,
|
|
30449
|
+
machine: machineIdentity,
|
|
30330
30450
|
machineStatus: node.machineStatus,
|
|
30331
30451
|
health: "unknown",
|
|
30332
30452
|
providers: node.providers || [],
|