@adhdev/daemon-standalone 1.0.58-rc.59 → 1.0.58-rc.60
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 +127 -10
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -36911,10 +36911,10 @@ var require_dist3 = __commonJS({
|
|
|
36911
36911
|
}
|
|
36912
36912
|
function getDaemonBuildInfo() {
|
|
36913
36913
|
if (cached2) return cached2;
|
|
36914
|
-
const commit = readInjected(true ? "
|
|
36915
|
-
const commitShort = readInjected(true ? "
|
|
36916
|
-
const version2 = readInjected(true ? "1.0.58-rc.
|
|
36917
|
-
const builtAt = readInjected(true ? "2026-09-
|
|
36914
|
+
const commit = readInjected(true ? "678c61dbf9ca5cc67af12ff40ea17210ef9ff661" : void 0) ?? "unknown";
|
|
36915
|
+
const commitShort = readInjected(true ? "678c61db" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
36916
|
+
const version2 = readInjected(true ? "1.0.58-rc.60" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
36917
|
+
const builtAt = readInjected(true ? "2026-09-02T02:49:21.672Z" : void 0);
|
|
36918
36918
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
36919
36919
|
return cached2;
|
|
36920
36920
|
}
|
|
@@ -102054,7 +102054,10 @@ ${e?.stderr || ""}`;
|
|
|
102054
102054
|
if (!option) continue;
|
|
102055
102055
|
const { label } = option;
|
|
102056
102056
|
if (/^Chat about this$/i.test(label)) continue;
|
|
102057
|
-
if (/^Type something\.?$/i.test(label))
|
|
102057
|
+
if (/^Type something\.?$/i.test(label)) {
|
|
102058
|
+
allowFreeform = true;
|
|
102059
|
+
continue;
|
|
102060
|
+
}
|
|
102058
102061
|
options.push(option);
|
|
102059
102062
|
}
|
|
102060
102063
|
if (options.length === 0) return null;
|
|
@@ -102185,7 +102188,7 @@ ${e?.stderr || ""}`;
|
|
|
102185
102188
|
steps.push(" ");
|
|
102186
102189
|
} else if (freeformText) {
|
|
102187
102190
|
const typeOptionIndex = question.options.findIndex((o) => /^Type something\.?$/i.test(o.label));
|
|
102188
|
-
const optionNumber = typeOptionIndex >= 0 ? typeOptionIndex + 1 : question.options.length;
|
|
102191
|
+
const optionNumber = typeOptionIndex >= 0 ? typeOptionIndex + 1 : question.options.length + 1;
|
|
102189
102192
|
steps.push(String(optionNumber));
|
|
102190
102193
|
for (const ch of freeformText) steps.push(ch);
|
|
102191
102194
|
steps.push("\r");
|
|
@@ -123579,6 +123582,80 @@ ${text}` : text;
|
|
|
123579
123582
|
steps.push("\r");
|
|
123580
123583
|
return steps;
|
|
123581
123584
|
}
|
|
123585
|
+
init_logger();
|
|
123586
|
+
var TAIL_BYTES3 = 512 * 1024;
|
|
123587
|
+
function detectClaudePendingQuestion(cfg, input) {
|
|
123588
|
+
if ((input.agentType ?? "").trim() !== "claude-cli") return null;
|
|
123589
|
+
if (!cfg?.source || cfg.source.kind !== "jsonl") return null;
|
|
123590
|
+
let sourcePath;
|
|
123591
|
+
try {
|
|
123592
|
+
sourcePath = resolveJsonlSourcePath(cfg.source, input);
|
|
123593
|
+
} catch {
|
|
123594
|
+
return null;
|
|
123595
|
+
}
|
|
123596
|
+
if (!sourcePath) return null;
|
|
123597
|
+
let records;
|
|
123598
|
+
try {
|
|
123599
|
+
records = readTailJsonlLines(sourcePath, TAIL_BYTES3);
|
|
123600
|
+
} catch {
|
|
123601
|
+
return null;
|
|
123602
|
+
}
|
|
123603
|
+
return detectClaudePendingQuestionFromRecords(records);
|
|
123604
|
+
}
|
|
123605
|
+
function detectClaudePendingQuestionFromRecords(records) {
|
|
123606
|
+
let latestIdx = -1;
|
|
123607
|
+
let latestPrompt = null;
|
|
123608
|
+
for (let i = 0; i < records.length; i++) {
|
|
123609
|
+
const prompt = detectClaudeAskUserQuestionPromptFromJson(records[i]);
|
|
123610
|
+
if (!prompt) continue;
|
|
123611
|
+
applyClaudeFreeformEscape(prompt);
|
|
123612
|
+
if (!prompt.promptId.startsWith("toolu_")) continue;
|
|
123613
|
+
latestIdx = i;
|
|
123614
|
+
latestPrompt = prompt;
|
|
123615
|
+
}
|
|
123616
|
+
if (latestIdx < 0 || !latestPrompt) return null;
|
|
123617
|
+
for (let i = latestIdx + 1; i < records.length; i++) {
|
|
123618
|
+
if (readClaudeToolResultIds(records[i]).includes(latestPrompt.promptId)) return null;
|
|
123619
|
+
}
|
|
123620
|
+
const createdAt = readRecordTimestamp(records[latestIdx]);
|
|
123621
|
+
if (createdAt) latestPrompt.createdAt = createdAt;
|
|
123622
|
+
LOG2.info(
|
|
123623
|
+
"ClaudeQuestion",
|
|
123624
|
+
`pending AskUserQuestion from native JSONL: promptId=${latestPrompt.promptId} questions=${latestPrompt.questions.length}`
|
|
123625
|
+
);
|
|
123626
|
+
return latestPrompt;
|
|
123627
|
+
}
|
|
123628
|
+
function applyClaudeFreeformEscape(prompt) {
|
|
123629
|
+
for (const question of prompt.questions) question.allowFreeform = true;
|
|
123630
|
+
}
|
|
123631
|
+
function readClaudeToolResultIds(record2) {
|
|
123632
|
+
if (!record2 || typeof record2 !== "object") return [];
|
|
123633
|
+
const r = record2;
|
|
123634
|
+
const blocks = [];
|
|
123635
|
+
if (Array.isArray(r.content)) blocks.push(...r.content);
|
|
123636
|
+
const message = r.message;
|
|
123637
|
+
if (message && typeof message === "object" && Array.isArray(message.content)) {
|
|
123638
|
+
blocks.push(...message.content);
|
|
123639
|
+
}
|
|
123640
|
+
if (r.type === "tool_result") blocks.push(r);
|
|
123641
|
+
const ids = [];
|
|
123642
|
+
for (const block2 of blocks) {
|
|
123643
|
+
if (!block2 || typeof block2 !== "object") continue;
|
|
123644
|
+
const b = block2;
|
|
123645
|
+
if (b.type !== "tool_result") continue;
|
|
123646
|
+
const id = typeof b.tool_use_id === "string" ? b.tool_use_id.trim() : "";
|
|
123647
|
+
if (id) ids.push(id);
|
|
123648
|
+
}
|
|
123649
|
+
return ids;
|
|
123650
|
+
}
|
|
123651
|
+
function readRecordTimestamp(record2) {
|
|
123652
|
+
if (!record2 || typeof record2 !== "object") return 0;
|
|
123653
|
+
const value = record2.timestamp;
|
|
123654
|
+
if (typeof value === "number" && Number.isFinite(value) && value > 0) return value;
|
|
123655
|
+
if (typeof value !== "string") return 0;
|
|
123656
|
+
const parsed = Date.parse(value);
|
|
123657
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
|
|
123658
|
+
}
|
|
123582
123659
|
init_dist();
|
|
123583
123660
|
var ANSI_OSC_DCS_RE = /\x1B\][^\x07]*(?:\x07|\x1B\\)|\x1B[P^_X][\s\S]*?(?:\x07|\x1B\\)/g;
|
|
123584
123661
|
var ANSI_CSI_RE = /\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g;
|
|
@@ -124821,6 +124898,34 @@ ${text}` : text;
|
|
|
124821
124898
|
}
|
|
124822
124899
|
return ids;
|
|
124823
124900
|
}
|
|
124901
|
+
/**
|
|
124902
|
+
* Read the pending AskUserQuestion off claude's native JSONL transcript, or
|
|
124903
|
+
* null when there is none / it cannot be read.
|
|
124904
|
+
*
|
|
124905
|
+
* `ADHDEV_DISABLE_CLAUDE_JSONL_PROMPT=1` forces the legacy screen-scrape
|
|
124906
|
+
* path. It exists so the fallback stays exercisable — both in the injection
|
|
124907
|
+
* test that proves the scrape still produces the (broken) split labels, and
|
|
124908
|
+
* on a live machine where a transcript-format change would otherwise need a
|
|
124909
|
+
* downgrade to diagnose.
|
|
124910
|
+
*/
|
|
124911
|
+
detectClaudeNativePendingQuestion() {
|
|
124912
|
+
if (process.env.ADHDEV_DISABLE_CLAUDE_JSONL_PROMPT === "1") return null;
|
|
124913
|
+
if (!this.spec.native_history?.source) return null;
|
|
124914
|
+
try {
|
|
124915
|
+
return detectClaudePendingQuestion(this.spec.native_history, {
|
|
124916
|
+
agentType: this.cliType,
|
|
124917
|
+
providerSessionId: this.providerSessionId || void 0,
|
|
124918
|
+
sessionStartedAtMs: this.spawnedAtMs,
|
|
124919
|
+
envOverrides: this.spawnedEnv,
|
|
124920
|
+
workspace: this.workingDir,
|
|
124921
|
+
// Sidecar-claim owner token — without it resolution fails closed
|
|
124922
|
+
// on ambiguity, same as the kimi wire call site.
|
|
124923
|
+
instanceId: this.owningSessionId || void 0
|
|
124924
|
+
});
|
|
124925
|
+
} catch {
|
|
124926
|
+
return null;
|
|
124927
|
+
}
|
|
124928
|
+
}
|
|
124824
124929
|
maybeCaptureClaudeTuiPrompt() {
|
|
124825
124930
|
if (this.interactivePromptScheme() !== "claude_tui" || this.activeInteractivePrompt || this.claudeTuiPromptCaptureInFlight) return;
|
|
124826
124931
|
if (this.latestState?.status === "generating") return;
|
|
@@ -124835,6 +124940,14 @@ ${text}` : text;
|
|
|
124835
124940
|
return;
|
|
124836
124941
|
}
|
|
124837
124942
|
this.claudeTuiCaptureFooterAbsentAt = null;
|
|
124943
|
+
const nativePrompt = this.detectClaudeNativePendingQuestion();
|
|
124944
|
+
if (nativePrompt) {
|
|
124945
|
+
this.activeInteractivePrompt = nativePrompt;
|
|
124946
|
+
this.interactivePromptTransport = "tui";
|
|
124947
|
+
this.interactivePromptLostAt = null;
|
|
124948
|
+
this.statusCallback?.();
|
|
124949
|
+
return;
|
|
124950
|
+
}
|
|
124838
124951
|
const headers = this.readClaudeTuiHeaders(screenText);
|
|
124839
124952
|
if (headers.length === 0) {
|
|
124840
124953
|
const prompt = detectClaudeAskUserQuestionPromptFromTuiPages([{ screenText }], {
|
|
@@ -125548,6 +125661,9 @@ ${text}` : text;
|
|
|
125548
125661
|
init_mesh_event_trace();
|
|
125549
125662
|
init_mesh_events_utils();
|
|
125550
125663
|
init_runtime_defaults();
|
|
125664
|
+
function meshTaskAttachments(history) {
|
|
125665
|
+
return history ?? [];
|
|
125666
|
+
}
|
|
125551
125667
|
var MESH_TASK_ATTACHMENT_HISTORY_CAP = 8;
|
|
125552
125668
|
function pushMeshTaskAttachment(history, attachment) {
|
|
125553
125669
|
history.push(attachment);
|
|
@@ -127877,7 +127993,7 @@ ${buttons.join("\n")}`;
|
|
|
127877
127993
|
// injected since boot (ad-hoc/non-mesh turns fall back to the plain turn-started check).
|
|
127878
127994
|
meshTaskInjectedAt = 0;
|
|
127879
127995
|
meshTaskAttachmentHistory = [];
|
|
127880
|
-
// WORKER-MCP T2 precursor — mesh-task-attachment.ts, flag-gated, byte-identical off.
|
|
127996
|
+
// WORKER-MCP T2 precursor — mesh-task-attachment.ts, flag-gated, byte-identical off. Always read via meshTaskAttachments(this.meshTaskAttachmentHistory), never raw — see that module's "Constructor-bypassed instances".
|
|
127881
127997
|
settings = {};
|
|
127882
127998
|
monitor;
|
|
127883
127999
|
generatingDebounceTimer = null;
|
|
@@ -128336,6 +128452,7 @@ ${buttons.join("\n")}`;
|
|
|
128336
128452
|
if (assignment.taskId && assignment.taskId.trim()) {
|
|
128337
128453
|
this.meshTaskInjectedAt = Date.now();
|
|
128338
128454
|
if (isWorkerMcpEnabled()) {
|
|
128455
|
+
this.meshTaskAttachmentHistory = meshTaskAttachments(this.meshTaskAttachmentHistory);
|
|
128339
128456
|
const { droppedTaskId } = pushMeshTaskAttachment(this.meshTaskAttachmentHistory, { taskId: assignment.taskId, attemptId: assignment.attemptId, dispatchNonce: assignment.dispatchNonce, injectedAt: this.meshTaskInjectedAt });
|
|
128340
128457
|
if (droppedTaskId) LOG2.warn("MeshTaskAttach", `[${this.instanceId}] turn-aware attachment history exceeded cap \u2014 dropped task ${droppedTaskId}.`);
|
|
128341
128458
|
}
|
|
@@ -128392,7 +128509,7 @@ ${buttons.join("\n")}`;
|
|
|
128392
128509
|
* keeps the original full clear so an ad-hoc session is never left pinned.
|
|
128393
128510
|
*/
|
|
128394
128511
|
detachMeshAssignment() {
|
|
128395
|
-
const pending = isWorkerMcpEnabled() ? popCompletedMeshTaskAttachment(this.meshTaskAttachmentHistory) : void 0;
|
|
128512
|
+
const pending = isWorkerMcpEnabled() ? popCompletedMeshTaskAttachment(meshTaskAttachments(this.meshTaskAttachmentHistory)) : void 0;
|
|
128396
128513
|
if (!this.settings.meshNodeFor && !this.settings.meshActiveTaskId && !this.settings.meshNodeId) return;
|
|
128397
128514
|
if (this.settings.launchedByCoordinator === true) {
|
|
128398
128515
|
if (!this.settings.meshActiveTaskId) return;
|
|
@@ -129408,7 +129525,7 @@ ${buttons.join("\n")}`;
|
|
|
129408
129525
|
* turn completes overwrites it. Returns undefined for a non-task ad-hoc turn.
|
|
129409
129526
|
*/
|
|
129410
129527
|
completingTurnTaskId() {
|
|
129411
|
-
const fromHistory = isWorkerMcpEnabled() ? resolveCompletingTaskId(this.meshTaskAttachmentHistory) : void 0;
|
|
129528
|
+
const fromHistory = isWorkerMcpEnabled() ? resolveCompletingTaskId(meshTaskAttachments(this.meshTaskAttachmentHistory)) : void 0;
|
|
129412
129529
|
if (fromHistory) return fromHistory;
|
|
129413
129530
|
const turnTaskId = this.adapter?.currentTurnTaskId;
|
|
129414
129531
|
if (typeof turnTaskId === "string" && turnTaskId.trim()) return turnTaskId;
|
|
@@ -129442,7 +129559,7 @@ ${buttons.join("\n")}`;
|
|
|
129442
129559
|
injectedTaskHasStartedGenerating() {
|
|
129443
129560
|
const turnStartedAt = typeof this.adapter?.currentTurnStartedAt === "number" ? this.adapter.currentTurnStartedAt : 0;
|
|
129444
129561
|
const turnStarted = Number.isFinite(turnStartedAt) && turnStartedAt > 0;
|
|
129445
|
-
const injectedAt = (isWorkerMcpEnabled() ? resolvePendingInjectedAt(this.meshTaskAttachmentHistory) : void 0) ?? this.meshTaskInjectedAt;
|
|
129562
|
+
const injectedAt = (isWorkerMcpEnabled() ? resolvePendingInjectedAt(meshTaskAttachments(this.meshTaskAttachmentHistory)) : void 0) ?? this.meshTaskInjectedAt;
|
|
129446
129563
|
if (injectedAt <= 0) {
|
|
129447
129564
|
return turnStarted;
|
|
129448
129565
|
}
|