@adhdev/daemon-standalone 0.9.82-rc.366 → 0.9.82-rc.367
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 +167 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-DqCY6Aye.js +113 -0
- package/public/index.html +1 -1
package/dist/index.js
CHANGED
|
@@ -30036,10 +30036,10 @@ var require_dist3 = __commonJS({
|
|
|
30036
30036
|
}
|
|
30037
30037
|
function getDaemonBuildInfo() {
|
|
30038
30038
|
if (cached2) return cached2;
|
|
30039
|
-
const commit = readInjected(true ? "
|
|
30040
|
-
const commitShort = readInjected(true ? "
|
|
30041
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
30042
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
30039
|
+
const commit = readInjected(true ? "bb7e66dbc483232a27d1de42cf8ecba3eb0a818c" : void 0) ?? "unknown";
|
|
30040
|
+
const commitShort = readInjected(true ? "bb7e66db" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
30041
|
+
const version2 = readInjected(true ? "0.9.82-rc.367" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
30042
|
+
const builtAt = readInjected(true ? "2026-06-24T04:45:42.045Z" : void 0);
|
|
30043
30043
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
30044
30044
|
return cached2;
|
|
30045
30045
|
}
|
|
@@ -32634,6 +32634,16 @@ ${error48.message || ""}`;
|
|
|
32634
32634
|
if (!trimmed) return false;
|
|
32635
32635
|
return normalizeMeshNodeId(node) === trimmed;
|
|
32636
32636
|
}
|
|
32637
|
+
function normalizeMeshWorkspaceForCompare(dir) {
|
|
32638
|
+
if (typeof dir !== "string") return "";
|
|
32639
|
+
return dir.trim().replace(/[\\/]+/g, "/").replace(/\/+$/, "").toLowerCase();
|
|
32640
|
+
}
|
|
32641
|
+
function meshWorkspacesEquivalent(a, b) {
|
|
32642
|
+
const left = normalizeMeshWorkspaceForCompare(a);
|
|
32643
|
+
const right = normalizeMeshWorkspaceForCompare(b);
|
|
32644
|
+
if (!left || !right) return false;
|
|
32645
|
+
return left === right;
|
|
32646
|
+
}
|
|
32637
32647
|
function machineCoreFromDaemonId(id) {
|
|
32638
32648
|
const trimmed = readString3(id);
|
|
32639
32649
|
if (!trimmed) return void 0;
|
|
@@ -42642,10 +42652,6 @@ ${cleanBody}`;
|
|
|
42642
42652
|
}
|
|
42643
42653
|
});
|
|
42644
42654
|
}
|
|
42645
|
-
function normalizeMeshWorkspaceForCompare(dir) {
|
|
42646
|
-
if (typeof dir !== "string") return "";
|
|
42647
|
-
return dir.trim().replace(/[\\/]+/g, "/").replace(/\/+$/, "").toLowerCase();
|
|
42648
|
-
}
|
|
42649
42655
|
function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType) {
|
|
42650
42656
|
const mesh = getMeshWithCache(components, meshId);
|
|
42651
42657
|
const node = mesh?.nodes.find((n) => readMeshNodeId(n) === nodeId);
|
|
@@ -43497,7 +43503,10 @@ ${cleanBody}`;
|
|
|
43497
43503
|
if (terminal?.kind === "task_completed" && !sessionHasActiveAssignment(args.meshId, eventSessionId)) {
|
|
43498
43504
|
const newDispatchAfterTerminal = hasDispatchAfterTerminal(args.meshId, eventSessionId, terminal.id);
|
|
43499
43505
|
const supersedesWeakTerminal = isWeakTerminalLedgerPayload(terminal.payload) && isGenuineCompletionEvidence(args.metadataEvent);
|
|
43500
|
-
|
|
43506
|
+
const terminalTaskId = readNonEmptyString2(terminal.payload.taskId);
|
|
43507
|
+
const eventTaskId = readNonEmptyString2(args.metadataEvent.taskId);
|
|
43508
|
+
const distinctTaskCompletion = !!eventTaskId && !!terminalTaskId && eventTaskId !== terminalTaskId;
|
|
43509
|
+
if (!newDispatchAfterTerminal && !supersedesWeakTerminal && !distinctTaskCompletion) {
|
|
43501
43510
|
const terminalProviderSessionId = readNonEmptyString2(terminal.payload.providerSessionId);
|
|
43502
43511
|
const terminalFinalSummary = readNonEmptyString2(terminal.payload.finalSummary);
|
|
43503
43512
|
const eventProviderSessionId = readNonEmptyString2(args.metadataEvent.providerSessionId);
|
|
@@ -43943,6 +43952,16 @@ ${cleanBody}`;
|
|
|
43943
43952
|
nodeId: readNonEmptyString2(routing.nodeId) || readNonEmptyString2(event.meshNodeId) || void 0,
|
|
43944
43953
|
workspace: readNonEmptyString2(routing.workspace) || readNonEmptyString2(event.workspace) || void 0
|
|
43945
43954
|
};
|
|
43955
|
+
const selfDaemonIds = resolveCoordinatorDrainDaemonIds(components);
|
|
43956
|
+
if (selfDaemonIds.some((self) => daemonIdsEquivalent(self, coordinatorDaemonId))) {
|
|
43957
|
+
try {
|
|
43958
|
+
handleMeshForwardEvent(components, payload);
|
|
43959
|
+
LOG2.info("MeshEvents", `Self-addressed unresolved-delegate ${eventName} routed via local router (coordinator ${coordinatorDaemonId} is self) \u2014 outbox skipped`);
|
|
43960
|
+
} catch (e) {
|
|
43961
|
+
LOG2.warn("MeshEvents", `Local route of self-addressed unresolved-delegate ${eventName} failed: ${e?.message || e}`);
|
|
43962
|
+
}
|
|
43963
|
+
return true;
|
|
43964
|
+
}
|
|
43946
43965
|
const persisted = enqueueUnresolvedDelegateForward(coordinatorDaemonId, eventName, payload);
|
|
43947
43966
|
const fwdTraceCtx = {
|
|
43948
43967
|
taskId: payload.taskId,
|
|
@@ -44466,6 +44485,8 @@ ${cleanBody}`;
|
|
|
44466
44485
|
expireStaleUnresolvedDelegateForwards();
|
|
44467
44486
|
const entries = peekUnresolvedDelegateForwards();
|
|
44468
44487
|
if (entries.length === 0) return;
|
|
44488
|
+
const selfIds = resolveCoordinatorDaemonIds(components);
|
|
44489
|
+
const isSelfCoordinatorId = (id) => selfIds.some((self) => daemonIdsEquivalent(self, id));
|
|
44469
44490
|
for (const entry of entries) {
|
|
44470
44491
|
const entryTraceCtx = {
|
|
44471
44492
|
taskId: entry.payload.taskId,
|
|
@@ -44473,6 +44494,23 @@ ${cleanBody}`;
|
|
|
44473
44494
|
nodeId: readNonEmptyString2(entry.payload.nodeId),
|
|
44474
44495
|
event: readNonEmptyString2(entry.payload.event)
|
|
44475
44496
|
};
|
|
44497
|
+
if (isSelfCoordinatorId(entry.coordinatorDaemonId)) {
|
|
44498
|
+
let localResult;
|
|
44499
|
+
try {
|
|
44500
|
+
traceMeshEventStage("forward_send", entryTraceCtx, `self \u2192 local router (${entry.coordinatorDaemonId})`);
|
|
44501
|
+
localResult = handleMeshForwardEvent(components, entry.payload);
|
|
44502
|
+
} catch (e) {
|
|
44503
|
+
LOG2.warn("MeshReconcile", `Local route of self-addressed forward to ${entry.coordinatorDaemonId} threw: ${e?.message || e} \u2014 draining anyway to break the retry loop`);
|
|
44504
|
+
}
|
|
44505
|
+
ackUnresolvedDelegateForward(entry.id);
|
|
44506
|
+
if (localResult && localResult.success === false) {
|
|
44507
|
+
LOG2.warn("MeshReconcile", `Self-addressed unresolved-delegate ${readNonEmptyString2(entry.payload.event)} rejected by local router (${readNonEmptyString2(localResult.error) || "no reason"}) \u2014 drained to break the self-forward retry loop`);
|
|
44508
|
+
traceMeshEventDrop("self_forward_local_rejected", entryTraceCtx, readNonEmptyString2(localResult.error) || "no reason");
|
|
44509
|
+
} else {
|
|
44510
|
+
LOG2.info("MeshReconcile", `Self-addressed unresolved-delegate ${readNonEmptyString2(entry.payload.event)} routed via local router (coordinator ${entry.coordinatorDaemonId} is self) \u2014 drained`);
|
|
44511
|
+
}
|
|
44512
|
+
continue;
|
|
44513
|
+
}
|
|
44476
44514
|
let result;
|
|
44477
44515
|
try {
|
|
44478
44516
|
traceMeshEventStage("forward_send", entryTraceCtx, `retry \u2192 ${entry.coordinatorDaemonId}`);
|
|
@@ -57924,6 +57962,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
57924
57962
|
}
|
|
57925
57963
|
var CHAT_SOURCE_REGISTRY = new ChatSourceRegistry();
|
|
57926
57964
|
init_chat_message_normalization();
|
|
57965
|
+
init_dist();
|
|
57927
57966
|
var RECENT_SEND_WINDOW_MS = 1200;
|
|
57928
57967
|
var READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS = 25e3;
|
|
57929
57968
|
var HOT_TAIL_MIN_LIMIT = 60;
|
|
@@ -58485,6 +58524,24 @@ ${effect.notification.body || ""}`.trim();
|
|
|
58485
58524
|
if (!text) return "";
|
|
58486
58525
|
return path16.resolve(text);
|
|
58487
58526
|
}
|
|
58527
|
+
function evaluateReadChatNodeWorkspaceScope(args) {
|
|
58528
|
+
const targetSessionId = typeof args.targetSessionId === "string" ? args.targetSessionId.trim() : "";
|
|
58529
|
+
if (!targetSessionId) return { scoped: false };
|
|
58530
|
+
const intended = normalizeMeshWorkspaceForCompare(args.intendedWorkspace);
|
|
58531
|
+
const actual = normalizeMeshWorkspaceForCompare(args.sessionWorkspace);
|
|
58532
|
+
if (!intended || !actual) return { scoped: false };
|
|
58533
|
+
if (intended === actual) return { scoped: false };
|
|
58534
|
+
return { scoped: true, intended, actual };
|
|
58535
|
+
}
|
|
58536
|
+
function resolveTargetSessionActualWorkspace(h, targetSessionId) {
|
|
58537
|
+
const registryWorkspace = h.ctx?.sessionRegistry?.get?.(targetSessionId)?.workspace;
|
|
58538
|
+
if (typeof registryWorkspace === "string" && registryWorkspace.trim()) return registryWorkspace;
|
|
58539
|
+
const adapter = h.getCliAdapter?.(targetSessionId);
|
|
58540
|
+
if (adapter && typeof adapter.workingDir === "string" && adapter.workingDir.trim()) return adapter.workingDir;
|
|
58541
|
+
const instanceWorkspace = getTargetInstance(h, { targetSessionId })?.getState?.()?.workspace;
|
|
58542
|
+
if (typeof instanceWorkspace === "string" && instanceWorkspace.trim()) return instanceWorkspace;
|
|
58543
|
+
return "";
|
|
58544
|
+
}
|
|
58488
58545
|
function isCurrentRuntimePtySafelyAttributed(args) {
|
|
58489
58546
|
if (args.adapter.cliType !== "codex-cli") return false;
|
|
58490
58547
|
if (!Array.isArray(args.ptyMessages) || args.ptyMessages.length === 0) return false;
|
|
@@ -59299,6 +59356,24 @@ ${effect.notification.body || ""}`.trim();
|
|
|
59299
59356
|
}
|
|
59300
59357
|
}
|
|
59301
59358
|
async function handleReadChat(h, args) {
|
|
59359
|
+
{
|
|
59360
|
+
const guardSessionId = typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : "";
|
|
59361
|
+
if (guardSessionId && typeof args?.workspace === "string" && args.workspace.trim()) {
|
|
59362
|
+
const verdict = evaluateReadChatNodeWorkspaceScope({
|
|
59363
|
+
targetSessionId: guardSessionId,
|
|
59364
|
+
intendedWorkspace: args.workspace,
|
|
59365
|
+
sessionWorkspace: resolveTargetSessionActualWorkspace(h, guardSessionId)
|
|
59366
|
+
});
|
|
59367
|
+
if (verdict.scoped) {
|
|
59368
|
+
LOG2.info("Command", `[read_chat] node scope mismatch: session ${guardSessionId} workspace "${verdict.actual}" \u2260 requested node workspace "${verdict.intended}" \u2014 refusing cross-worktree transcript`);
|
|
59369
|
+
return {
|
|
59370
|
+
success: false,
|
|
59371
|
+
code: "read_chat_session_node_scope_mismatch",
|
|
59372
|
+
error: `Session ${guardSessionId} belongs to a different worktree (workspace "${verdict.actual}") than the requested node (workspace "${verdict.intended}"). Refusing to return a cross-worktree transcript \u2014 target the node that owns this session.`
|
|
59373
|
+
};
|
|
59374
|
+
}
|
|
59375
|
+
}
|
|
59376
|
+
}
|
|
59302
59377
|
let providerHint = args?.agentType || args?.providerType;
|
|
59303
59378
|
if (!providerHint) {
|
|
59304
59379
|
const targetSessionId = typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : "";
|
|
@@ -59687,10 +59762,19 @@ ${effect.notification.body || ""}`.trim();
|
|
|
59687
59762
|
ptyStatusApprovalOnly: false
|
|
59688
59763
|
});
|
|
59689
59764
|
if (supportsNative && !decision.nativeSelected) {
|
|
59765
|
+
LOG2.debug("Command", `[read_chat] soft pending: no live adapter and native history not safely mappable target=${String(args?.targetSessionId || "")} provider=${agentStr} reason=native_history_not_safely_available`);
|
|
59690
59766
|
return {
|
|
59691
|
-
success:
|
|
59767
|
+
success: true,
|
|
59768
|
+
pending: true,
|
|
59769
|
+
// Both signals are true here: we reached the history-only path
|
|
59770
|
+
// because no live adapter was found (`live_adapter_not_found`),
|
|
59771
|
+
// and native history is not safely mappable
|
|
59772
|
+
// (`native_history_not_safely_available`).
|
|
59773
|
+
reason: "native_history_not_safely_available",
|
|
59774
|
+
reasons: ["live_adapter_not_found", "native_history_not_safely_available"],
|
|
59692
59775
|
code: "native_history_not_safely_available",
|
|
59693
|
-
|
|
59776
|
+
messages: [],
|
|
59777
|
+
status: "idle",
|
|
59694
59778
|
providerSessionId: historyProviderSessionId,
|
|
59695
59779
|
messageSource: decision.messageSource,
|
|
59696
59780
|
transcriptProvenance: decision.messageSource
|
|
@@ -79034,6 +79118,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
79034
79118
|
}
|
|
79035
79119
|
var MESH_DIRECT_PROBE_TIMEOUT_MS = readMeshTimeoutEnvMs("MESH_DIRECT_PROBE_TIMEOUT_MS", 25e3);
|
|
79036
79120
|
var MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS = readMeshTimeoutEnvMs("MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS", 25e3);
|
|
79121
|
+
var MESH_DIRECT_PROBE_CONNECT_TIMEOUT_MS = readMeshTimeoutEnvMs("MESH_DIRECT_PROBE_CONNECT_TIMEOUT_MS", 45e3);
|
|
79037
79122
|
var MESH_DIRECT_PROBE_REUSE_MS = readMeshTimeoutEnvMs("MESH_DIRECT_PROBE_REUSE_MS", 12e3);
|
|
79038
79123
|
var MeshGitProbeCache = class {
|
|
79039
79124
|
constructor(reuseMs, now = Date.now) {
|
|
@@ -79071,12 +79156,73 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
79071
79156
|
}
|
|
79072
79157
|
}
|
|
79073
79158
|
};
|
|
79159
|
+
function awaitWithWarmupDeadline(work, opts) {
|
|
79160
|
+
const pollMs = Math.max(1, Math.min(opts.pollIntervalMs ?? 200, opts.connectTimeoutMs));
|
|
79161
|
+
return new Promise((resolve24, reject) => {
|
|
79162
|
+
let done = false;
|
|
79163
|
+
let poll;
|
|
79164
|
+
let responseTimer;
|
|
79165
|
+
const startedAt = Date.now();
|
|
79166
|
+
const cleanup = () => {
|
|
79167
|
+
if (poll) {
|
|
79168
|
+
clearInterval(poll);
|
|
79169
|
+
poll = void 0;
|
|
79170
|
+
}
|
|
79171
|
+
if (responseTimer) {
|
|
79172
|
+
clearTimeout(responseTimer);
|
|
79173
|
+
responseTimer = void 0;
|
|
79174
|
+
}
|
|
79175
|
+
};
|
|
79176
|
+
const settle = (fn) => {
|
|
79177
|
+
if (done) return;
|
|
79178
|
+
done = true;
|
|
79179
|
+
cleanup();
|
|
79180
|
+
fn();
|
|
79181
|
+
};
|
|
79182
|
+
const armResponse = () => {
|
|
79183
|
+
if (responseTimer || done) return;
|
|
79184
|
+
responseTimer = setTimeout(
|
|
79185
|
+
() => settle(() => reject(new Error("timeout"))),
|
|
79186
|
+
opts.responseTimeoutMs
|
|
79187
|
+
);
|
|
79188
|
+
if (typeof responseTimer.unref === "function") responseTimer.unref();
|
|
79189
|
+
};
|
|
79190
|
+
const onPoll = () => {
|
|
79191
|
+
if (done) return;
|
|
79192
|
+
if (opts.isConnected()) {
|
|
79193
|
+
if (poll) {
|
|
79194
|
+
clearInterval(poll);
|
|
79195
|
+
poll = void 0;
|
|
79196
|
+
}
|
|
79197
|
+
armResponse();
|
|
79198
|
+
return;
|
|
79199
|
+
}
|
|
79200
|
+
if (Date.now() - startedAt >= opts.connectTimeoutMs) {
|
|
79201
|
+
settle(() => reject(new Error("timeout")));
|
|
79202
|
+
}
|
|
79203
|
+
};
|
|
79204
|
+
if (opts.isConnected()) {
|
|
79205
|
+
armResponse();
|
|
79206
|
+
} else {
|
|
79207
|
+
poll = setInterval(onPoll, pollMs);
|
|
79208
|
+
if (typeof poll.unref === "function") poll.unref();
|
|
79209
|
+
}
|
|
79210
|
+
work.then(
|
|
79211
|
+
(val) => settle(() => resolve24(val)),
|
|
79212
|
+
(err) => settle(() => reject(err))
|
|
79213
|
+
);
|
|
79214
|
+
});
|
|
79215
|
+
}
|
|
79074
79216
|
async function probeRemoteMeshGitStatus(args) {
|
|
79075
79217
|
if (!args.dispatchMeshCommand) return null;
|
|
79076
|
-
const
|
|
79077
|
-
|
|
79078
|
-
|
|
79079
|
-
|
|
79218
|
+
const dispatch = args.dispatchMeshCommand(args.daemonId, "git_status", { workspace: args.workspace, refreshUpstream: true });
|
|
79219
|
+
const getConnection = args.getConnection;
|
|
79220
|
+
const isConnected = getConnection ? () => readMeshConnectionState(getConnection(args.daemonId)) === "connected" : () => true;
|
|
79221
|
+
const remoteResult = await awaitWithWarmupDeadline(dispatch, {
|
|
79222
|
+
isConnected,
|
|
79223
|
+
connectTimeoutMs: args.connectTimeoutMs,
|
|
79224
|
+
responseTimeoutMs: args.responseTimeoutMs
|
|
79225
|
+
});
|
|
79080
79226
|
const remoteGit = remoteResult?.status ?? remoteResult?.git ?? remoteResult;
|
|
79081
79227
|
if (!remoteGit || typeof remoteGit !== "object" || typeof remoteGit.isGitRepo !== "boolean") return null;
|
|
79082
79228
|
const reporterPlatform = readStringValue(remoteResult?.reporterPlatform);
|
|
@@ -79111,7 +79257,9 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
79111
79257
|
dispatchMeshCommand: args.dispatchMeshCommand,
|
|
79112
79258
|
daemonId: args.daemonId,
|
|
79113
79259
|
workspace: args.workspace,
|
|
79114
|
-
|
|
79260
|
+
responseTimeoutMs: attempt === 0 ? args.timeoutMs : args.retryTimeoutMs ?? args.timeoutMs,
|
|
79261
|
+
connectTimeoutMs: args.connectTimeoutMs ?? MESH_DIRECT_PROBE_CONNECT_TIMEOUT_MS,
|
|
79262
|
+
getConnection: args.getConnection
|
|
79115
79263
|
});
|
|
79116
79264
|
if (remoteGit) return remoteGit;
|
|
79117
79265
|
} catch {
|
|
@@ -79194,6 +79342,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
79194
79342
|
workspace,
|
|
79195
79343
|
timeoutMs: MESH_DIRECT_PROBE_TIMEOUT_MS,
|
|
79196
79344
|
retryTimeoutMs: MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS,
|
|
79345
|
+
connectTimeoutMs: MESH_DIRECT_PROBE_CONNECT_TIMEOUT_MS,
|
|
79197
79346
|
getConnection: args.getMeshPeerConnectionStatus
|
|
79198
79347
|
});
|
|
79199
79348
|
const remoteGit = args.probeCache ? await args.probeCache.probe(daemonId, workspace, runProbe) : await runProbe();
|
|
@@ -79245,13 +79394,13 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
79245
79394
|
if (!recordNodeId || recordNodeId !== nodeId) return false;
|
|
79246
79395
|
if (nodeIsMissingLocalWorktree) return false;
|
|
79247
79396
|
const recordWorkspace = readStringValue(record2?.workspace);
|
|
79248
|
-
if (nodeWorkspace && recordWorkspace && recordWorkspace
|
|
79397
|
+
if (nodeWorkspace && recordWorkspace && !meshWorkspacesEquivalent(recordWorkspace, nodeWorkspace)) return false;
|
|
79249
79398
|
const recordMeshId = readStringValue(record2?.meta?.meshNodeFor);
|
|
79250
79399
|
return !recordMeshId || recordMeshId === meshId;
|
|
79251
79400
|
}
|
|
79252
79401
|
function liveSessionRecordMatchesMeshWorkspace(record2, meshId, workspace) {
|
|
79253
79402
|
const recordWorkspace = readStringValue(record2?.workspace);
|
|
79254
|
-
if (!recordWorkspace || !workspace || recordWorkspace
|
|
79403
|
+
if (!recordWorkspace || !workspace || !meshWorkspacesEquivalent(recordWorkspace, workspace)) return false;
|
|
79255
79404
|
const recordMeshId = readStringValue(record2?.meta?.meshNodeFor);
|
|
79256
79405
|
if (recordMeshId) return recordMeshId === meshId;
|
|
79257
79406
|
return record2?.meta?.launchedByCoordinator === true || !!readStringValue(record2?.meta?.meshNodeId);
|