@adhdev/daemon-standalone 1.0.45-rc.5 → 1.0.45-rc.6
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 +138 -27
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -37020,10 +37020,10 @@ var require_dist3 = __commonJS({
|
|
|
37020
37020
|
}
|
|
37021
37021
|
function getDaemonBuildInfo() {
|
|
37022
37022
|
if (cached2) return cached2;
|
|
37023
|
-
const commit = readInjected(true ? "
|
|
37024
|
-
const commitShort = readInjected(true ? "
|
|
37025
|
-
const version2 = readInjected(true ? "1.0.45-rc.
|
|
37026
|
-
const builtAt = readInjected(true ? "2026-08-
|
|
37023
|
+
const commit = readInjected(true ? "ad6b5dfbb762ac45467586208d4393788832ad7a" : void 0) ?? "unknown";
|
|
37024
|
+
const commitShort = readInjected(true ? "ad6b5dfb" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
37025
|
+
const version2 = readInjected(true ? "1.0.45-rc.6" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
37026
|
+
const builtAt = readInjected(true ? "2026-08-12T05:35:42.422Z" : void 0);
|
|
37027
37027
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
37028
37028
|
return cached2;
|
|
37029
37029
|
}
|
|
@@ -72410,7 +72410,109 @@ ${cleanBody}`;
|
|
|
72410
72410
|
if (!event || typeof event !== "object") return null;
|
|
72411
72411
|
return event;
|
|
72412
72412
|
}
|
|
72413
|
+
function parseSelectorRow(line) {
|
|
72414
|
+
const m = line.match(/^\s*(?:❯\s*)?(\S[\s\S]*?)\s*$/);
|
|
72415
|
+
if (!m) return null;
|
|
72416
|
+
const parts = m[1].split(/\s{2,}/);
|
|
72417
|
+
const label = (parts[0] ?? "").trim();
|
|
72418
|
+
if (!label) return null;
|
|
72419
|
+
const description = parts.length > 1 ? parts.slice(1).join(" ").trim() : void 0;
|
|
72420
|
+
return { label, ...description ? { description } : {} };
|
|
72421
|
+
}
|
|
72422
|
+
function detectKimiIdleSelectorPrompt(screenText) {
|
|
72423
|
+
if (!screenText) return null;
|
|
72424
|
+
const lines = screenText.split("\n");
|
|
72425
|
+
let titleIdx = -1;
|
|
72426
|
+
for (let i = lines.length - 1; i >= 0; i -= 1) {
|
|
72427
|
+
if (IDLE_SELECTOR_TITLE.test(lines[i])) {
|
|
72428
|
+
titleIdx = i;
|
|
72429
|
+
break;
|
|
72430
|
+
}
|
|
72431
|
+
}
|
|
72432
|
+
if (titleIdx < 0) return null;
|
|
72433
|
+
let hintIdx = -1;
|
|
72434
|
+
for (let i = titleIdx + 1; i <= Math.min(lines.length - 1, titleIdx + 4); i += 1) {
|
|
72435
|
+
if (IDLE_SELECTOR_HINT.test(lines[i])) {
|
|
72436
|
+
hintIdx = i;
|
|
72437
|
+
break;
|
|
72438
|
+
}
|
|
72439
|
+
}
|
|
72440
|
+
if (hintIdx < 0) return null;
|
|
72441
|
+
let cursorIdx = -1;
|
|
72442
|
+
for (let i = hintIdx + 1; i < lines.length; i += 1) {
|
|
72443
|
+
const t = lines[i].trim();
|
|
72444
|
+
if (!t) continue;
|
|
72445
|
+
if (/^─+$/.test(t)) break;
|
|
72446
|
+
if (t.startsWith("\u276F")) {
|
|
72447
|
+
cursorIdx = i;
|
|
72448
|
+
break;
|
|
72449
|
+
}
|
|
72450
|
+
}
|
|
72451
|
+
if (cursorIdx < 0) return null;
|
|
72452
|
+
const options = [];
|
|
72453
|
+
for (let i = cursorIdx; i < lines.length; i += 1) {
|
|
72454
|
+
const t = lines[i].trim();
|
|
72455
|
+
if (!t || /^─+$/.test(t)) break;
|
|
72456
|
+
const row = parseSelectorRow(lines[i]);
|
|
72457
|
+
if (!row) break;
|
|
72458
|
+
options.push(row);
|
|
72459
|
+
}
|
|
72460
|
+
if (options.length < 2) return null;
|
|
72461
|
+
let question = "";
|
|
72462
|
+
for (let i = cursorIdx - 1; i > hintIdx; i -= 1) {
|
|
72463
|
+
const t = lines[i].trim();
|
|
72464
|
+
if (!t || /^─+$/.test(t)) continue;
|
|
72465
|
+
question = t;
|
|
72466
|
+
break;
|
|
72467
|
+
}
|
|
72468
|
+
if (!question) return null;
|
|
72469
|
+
const questions = [{
|
|
72470
|
+
questionId: "q1",
|
|
72471
|
+
question,
|
|
72472
|
+
header: lines[titleIdx].trim(),
|
|
72473
|
+
multiSelect: false,
|
|
72474
|
+
options
|
|
72475
|
+
}];
|
|
72476
|
+
return {
|
|
72477
|
+
promptId: `${KIMI_TUI_SELECTOR_PROMPT_PREFIX}${interactivePromptContentFingerprint(questions)}`,
|
|
72478
|
+
origin: "cli",
|
|
72479
|
+
providerType: "kimi",
|
|
72480
|
+
createdAt: Date.now(),
|
|
72481
|
+
questions
|
|
72482
|
+
};
|
|
72483
|
+
}
|
|
72484
|
+
function buildKimiSelectorAnswerSteps(prompt, response, screenText) {
|
|
72485
|
+
if (response.promptId !== prompt.promptId) throw new Error("Interactive prompt response does not match active prompt");
|
|
72486
|
+
if (prompt.questions.length !== 1) throw new Error("kimi built-in selector prompt must have exactly one question");
|
|
72487
|
+
const question = prompt.questions[0];
|
|
72488
|
+
const answer = response.answers[question.questionId];
|
|
72489
|
+
if (!answer) throw new Error(`Missing answer for ${question.questionId}`);
|
|
72490
|
+
if (answer.freeformText?.trim()) throw new Error("kimi built-in selector has no freeform input");
|
|
72491
|
+
if (answer.selectedLabels.length !== 1) throw new Error(`Expected one selected label for ${question.questionId}`);
|
|
72492
|
+
const target = question.options.findIndex((o) => o.label === answer.selectedLabels[0]);
|
|
72493
|
+
if (target < 0) throw new Error(`Unknown option for ${question.questionId}: ${answer.selectedLabels[0]}`);
|
|
72494
|
+
let cursor = 0;
|
|
72495
|
+
for (const line of (screenText ?? "").split("\n")) {
|
|
72496
|
+
if (!line.trim().startsWith("\u276F")) continue;
|
|
72497
|
+
const row = parseSelectorRow(line);
|
|
72498
|
+
if (!row) continue;
|
|
72499
|
+
const idx = question.options.findIndex((o) => o.label === row.label);
|
|
72500
|
+
if (idx >= 0) {
|
|
72501
|
+
cursor = idx;
|
|
72502
|
+
break;
|
|
72503
|
+
}
|
|
72504
|
+
}
|
|
72505
|
+
const steps = [];
|
|
72506
|
+
const diff = target - cursor;
|
|
72507
|
+
const key2 = diff > 0 ? "\x1B[B" : "\x1B[A";
|
|
72508
|
+
for (let i = 0; i < Math.abs(diff); i += 1) steps.push(key2);
|
|
72509
|
+
steps.push("\r");
|
|
72510
|
+
return steps;
|
|
72511
|
+
}
|
|
72413
72512
|
var TAIL_BYTES2;
|
|
72513
|
+
var KIMI_TUI_SELECTOR_PROMPT_PREFIX;
|
|
72514
|
+
var IDLE_SELECTOR_TITLE;
|
|
72515
|
+
var IDLE_SELECTOR_HINT;
|
|
72414
72516
|
var init_kimi_pending_question = __esm2({
|
|
72415
72517
|
"src/providers/kimi-pending-question.ts"() {
|
|
72416
72518
|
"use strict";
|
|
@@ -72419,6 +72521,9 @@ ${cleanBody}`;
|
|
|
72419
72521
|
init_background_task_detector();
|
|
72420
72522
|
init_interactive_prompt();
|
|
72421
72523
|
TAIL_BYTES2 = 512 * 1024;
|
|
72524
|
+
KIMI_TUI_SELECTOR_PROMPT_PREFIX = "kimi-tui-selector-";
|
|
72525
|
+
IDLE_SELECTOR_TITLE = /This session has been idle for/i;
|
|
72526
|
+
IDLE_SELECTOR_HINT = /↑↓\s*navigate\s*·\s*Enter\s+select/i;
|
|
72422
72527
|
}
|
|
72423
72528
|
});
|
|
72424
72529
|
var pty_transport_exports = {};
|
|
@@ -75493,12 +75598,13 @@ ${cont}` : cont;
|
|
|
75493
75598
|
// it. Reset to 0 the instant any poll is ineligible.
|
|
75494
75599
|
staticIdlePollStreak = 0;
|
|
75495
75600
|
/**
|
|
75496
|
-
* kimi
|
|
75497
|
-
*
|
|
75498
|
-
* classify, so the session reads 'generating' while parked
|
|
75499
|
-
*
|
|
75500
|
-
*
|
|
75501
|
-
*
|
|
75601
|
+
* kimi interactive-picker hold. Covers (a) the AskUserQuestion picker
|
|
75602
|
+
* (wire.jsonl authority — kimi renders it as a TUI picker the modal/spinner
|
|
75603
|
+
* matchers do NOT classify, so the session reads 'generating' while parked)
|
|
75604
|
+
* and (b) kimi's built-in idle/cache-expired selector (screen authority —
|
|
75605
|
+
* a TUI built-in the wire never carries). Refreshed on each
|
|
75606
|
+
* getScriptParsedStatus()/getStatus() poll (refreshKimiPendingQuestion —
|
|
75607
|
+
* same cadence/rationale as the background-task passthrough), surfaced on
|
|
75502
75608
|
* getStatus() as activeInteractivePrompt so CliProviderInstance overlays
|
|
75503
75609
|
* waiting_choice and the status-transition layer emits agent:waiting_choice,
|
|
75504
75610
|
* and consumed by setInteractivePromptResponse (mesh_answer_question) to
|
|
@@ -76395,23 +76501,28 @@ ${lastSnapshot}`;
|
|
|
76395
76501
|
*/
|
|
76396
76502
|
refreshKimiPendingQuestion() {
|
|
76397
76503
|
if (this.cliType !== "kimi") return;
|
|
76398
|
-
const nativeHistory = this.provider?.nativeHistory;
|
|
76399
|
-
if (!nativeHistory?.source) return;
|
|
76400
76504
|
try {
|
|
76401
|
-
const
|
|
76402
|
-
|
|
76403
|
-
|
|
76404
|
-
|
|
76405
|
-
|
|
76406
|
-
|
|
76407
|
-
|
|
76408
|
-
|
|
76409
|
-
|
|
76410
|
-
|
|
76411
|
-
|
|
76412
|
-
|
|
76413
|
-
|
|
76414
|
-
|
|
76505
|
+
const nativeHistory = this.provider?.nativeHistory;
|
|
76506
|
+
let prompt = null;
|
|
76507
|
+
if (nativeHistory?.source) {
|
|
76508
|
+
prompt = detectKimiPendingQuestion(nativeHistory, {
|
|
76509
|
+
agentType: this.cliType,
|
|
76510
|
+
providerSessionId: this.providerSessionId || void 0,
|
|
76511
|
+
sessionStartedAtMs: this.spawnAt,
|
|
76512
|
+
envOverrides: this.extraEnv,
|
|
76513
|
+
workspace: this.workingDir,
|
|
76514
|
+
// Sidecar-claim owner token (== session registry sessionId ==
|
|
76515
|
+
// the read path's targetSessionId). WITHOUT it claiming is
|
|
76516
|
+
// skipped and the sidecar resolution fails closed on
|
|
76517
|
+
// ambiguity — any second kimi session dir in the workspace
|
|
76518
|
+
// (e.g. a probe session) made detection silently dead
|
|
76519
|
+
// (live: coordinator AskUserQuestion never surfaced).
|
|
76520
|
+
instanceId: this.owningSessionId || void 0
|
|
76521
|
+
});
|
|
76522
|
+
}
|
|
76523
|
+
if (!prompt && this.engine.currentStatus !== "generating") {
|
|
76524
|
+
prompt = detectKimiIdleSelectorPrompt(this.terminalScreen.getText());
|
|
76525
|
+
}
|
|
76415
76526
|
if ((prompt?.promptId ?? null) !== (this.activeInteractivePrompt?.promptId ?? null)) {
|
|
76416
76527
|
this.activeInteractivePrompt = prompt;
|
|
76417
76528
|
this.onStatusChange?.();
|
|
@@ -76471,7 +76582,7 @@ ${lastSnapshot}`;
|
|
|
76471
76582
|
if (!prompt || prompt.promptId !== response.promptId) {
|
|
76472
76583
|
throw new Error("Interactive prompt response does not match active prompt");
|
|
76473
76584
|
}
|
|
76474
|
-
const steps = buildKimiInteractiveTuiAnswerSteps(prompt, response);
|
|
76585
|
+
const steps = prompt.promptId.startsWith(KIMI_TUI_SELECTOR_PROMPT_PREFIX) ? buildKimiSelectorAnswerSteps(prompt, response, this.terminalScreen.getText()) : buildKimiInteractiveTuiAnswerSteps(prompt, response);
|
|
76475
76586
|
for (const step of steps) {
|
|
76476
76587
|
await this.writeToPty(step);
|
|
76477
76588
|
await new Promise((resolve29) => setTimeout(resolve29, 180));
|