@adhdev/daemon-core 0.9.82-rc.355 → 0.9.82-rc.356
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 +70 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +70 -11
- package/dist/index.mjs.map +1 -1
- package/dist/providers/spec/cli-adapter.d.ts +6 -0
- package/dist/providers/spec/evaluator.d.ts +1 -0
- package/dist/providers/spec/types.d.ts +38 -0
- package/package.json +2 -2
- package/src/providers/cli-provider-instance.ts +17 -0
- package/src/providers/spec/cli-adapter.ts +57 -7
- package/src/providers/spec/evaluator.ts +14 -4
- package/src/providers/spec/fsm-driver.ts +23 -1
- package/src/providers/spec/types.ts +32 -0
package/dist/index.js
CHANGED
|
@@ -316,10 +316,10 @@ function readInjected(value) {
|
|
|
316
316
|
}
|
|
317
317
|
function getDaemonBuildInfo() {
|
|
318
318
|
if (cached) return cached;
|
|
319
|
-
const commit = readInjected(true ? "
|
|
320
|
-
const commitShort = readInjected(true ? "
|
|
321
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
322
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
319
|
+
const commit = readInjected(true ? "91500e054cf2b6258f6041f90c18be03ad05a8ad" : void 0) ?? "unknown";
|
|
320
|
+
const commitShort = readInjected(true ? "91500e05" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
321
|
+
const version = readInjected(true ? "0.9.82-rc.356" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
322
|
+
const builtAt = readInjected(true ? "2026-06-22T22:47:29.082Z" : void 0);
|
|
323
323
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
324
324
|
return cached;
|
|
325
325
|
}
|
|
@@ -19744,6 +19744,7 @@ function extractButtonsFromRule(rule, hay) {
|
|
|
19744
19744
|
const idx = Number(m[1]);
|
|
19745
19745
|
let label = String(m[2] ?? "").trim();
|
|
19746
19746
|
if (!Number.isFinite(idx) || idx <= 0 || !label) continue;
|
|
19747
|
+
const current = hasCursorMarker(lines[i]);
|
|
19747
19748
|
let j = i + 1;
|
|
19748
19749
|
while (j < lines.length) {
|
|
19749
19750
|
const next = lines[j];
|
|
@@ -19755,7 +19756,7 @@ function extractButtonsFromRule(rule, hay) {
|
|
|
19755
19756
|
}
|
|
19756
19757
|
if (buttons.some((b) => b.index === idx)) continue;
|
|
19757
19758
|
const key = keyTemplate.replace(/\{index\}/g, String(idx));
|
|
19758
|
-
buttons.push({ index: idx, label, key });
|
|
19759
|
+
buttons.push({ index: idx, label, key, current });
|
|
19759
19760
|
i = j - 1;
|
|
19760
19761
|
}
|
|
19761
19762
|
} else {
|
|
@@ -19767,12 +19768,15 @@ function extractButtonsFromRule(rule, hay) {
|
|
|
19767
19768
|
if (!Number.isFinite(idx) || idx <= 0 || !label) continue;
|
|
19768
19769
|
if (buttons.some((b) => b.index === idx)) continue;
|
|
19769
19770
|
const key = keyTemplate.replace(/\{index\}/g, String(idx));
|
|
19770
|
-
buttons.push({ index: idx, label, key });
|
|
19771
|
+
buttons.push({ index: idx, label, key, current: hasCursorMarker(m[0]) });
|
|
19771
19772
|
}
|
|
19772
19773
|
}
|
|
19773
19774
|
buttons.sort((a, b) => a.index - b.index);
|
|
19774
19775
|
return buttons;
|
|
19775
19776
|
}
|
|
19777
|
+
function hasCursorMarker(text) {
|
|
19778
|
+
return /^\s*[❯›>]/.test(text);
|
|
19779
|
+
}
|
|
19776
19780
|
var init_evaluator = __esm({
|
|
19777
19781
|
"src/providers/spec/evaluator.ts"() {
|
|
19778
19782
|
"use strict";
|
|
@@ -34049,6 +34053,19 @@ var FsmDriver = class {
|
|
|
34049
34053
|
if (!m) return;
|
|
34050
34054
|
const btn = m.buttons.find((b) => b.index === index);
|
|
34051
34055
|
if (!btn) return;
|
|
34056
|
+
const rule = stateById(this.spec, this.currentStateId)?.extract?.buttons;
|
|
34057
|
+
if (rule?.select_mode === "arrow_keys") {
|
|
34058
|
+
const from = m.buttons.find((b) => b.current)?.index ?? 1;
|
|
34059
|
+
const up = rule.cursor_keys?.up ?? "\x1B[A";
|
|
34060
|
+
const down = rule.cursor_keys?.down ?? "\x1B[B";
|
|
34061
|
+
const delta = btn.index - from;
|
|
34062
|
+
const step = delta >= 0 ? down : up;
|
|
34063
|
+
const nav = step.repeat(Math.abs(delta));
|
|
34064
|
+
const confirm = (rule.key_for_index || "\r").replace(/\{index\}/g, "") || "\r";
|
|
34065
|
+
if (nav) this.adapter.send_keys(nav);
|
|
34066
|
+
this.adapter.send_keys(confirm);
|
|
34067
|
+
return;
|
|
34068
|
+
}
|
|
34052
34069
|
this.adapter.send_keys(btn.key);
|
|
34053
34070
|
}
|
|
34054
34071
|
handleAttachImage(blob, mime) {
|
|
@@ -35286,9 +35303,12 @@ var SpecCliAdapter = class _SpecCliAdapter {
|
|
|
35286
35303
|
* — not this code — decides how a selection is keyed for each CLI.
|
|
35287
35304
|
*/
|
|
35288
35305
|
async selectPickerChoice(ctl, action, choiceIndex, choiceLabel) {
|
|
35289
|
-
|
|
35290
|
-
|
|
35291
|
-
|
|
35306
|
+
let options = this.extractPickerChoicesIfRendered(action);
|
|
35307
|
+
if (!options) {
|
|
35308
|
+
this.driver.dispatch({ kind: "click_control", control_id: ctl.id });
|
|
35309
|
+
await this.waitForPickerRendered(action);
|
|
35310
|
+
options = this.extractPickerChoices(action);
|
|
35311
|
+
}
|
|
35292
35312
|
let index = choiceIndex;
|
|
35293
35313
|
if ((index == null || !Number.isFinite(index)) && choiceLabel) {
|
|
35294
35314
|
const needle = choiceLabel.trim().toLowerCase();
|
|
@@ -35301,8 +35321,27 @@ var SpecCliAdapter = class _SpecCliAdapter {
|
|
|
35301
35321
|
if (index == null || !Number.isFinite(index)) {
|
|
35302
35322
|
return { ok: false, error: "choiceIndex or choiceLabel required to select" };
|
|
35303
35323
|
}
|
|
35304
|
-
|
|
35305
|
-
|
|
35324
|
+
if (action.select_mode === "arrow_keys") {
|
|
35325
|
+
const current = options.find((o) => o.current);
|
|
35326
|
+
if (current == null) {
|
|
35327
|
+
return {
|
|
35328
|
+
ok: false,
|
|
35329
|
+
error: "arrow-nav picker: current cursor row not detected on screen",
|
|
35330
|
+
controlResult: { options: options.map((o) => ({ value: o.label, label: o.label, current: o.current })) }
|
|
35331
|
+
};
|
|
35332
|
+
}
|
|
35333
|
+
const up = action.cursor_keys?.up ?? "\x1B[A";
|
|
35334
|
+
const down = action.cursor_keys?.down ?? "\x1B[B";
|
|
35335
|
+
const delta = index - current.index;
|
|
35336
|
+
const step = delta >= 0 ? down : up;
|
|
35337
|
+
const nav = step.repeat(Math.abs(delta));
|
|
35338
|
+
const confirm = (action.submit_key || "\r").replace(/\{index\}/g, "") || "\r";
|
|
35339
|
+
if (nav) this.driver.dispatch({ kind: "pty_write", data: nav });
|
|
35340
|
+
this.driver.dispatch({ kind: "pty_write", data: confirm });
|
|
35341
|
+
} else {
|
|
35342
|
+
const keys = (action.submit_key || "{index}\r").replace(/\{index\}/g, String(index));
|
|
35343
|
+
this.driver.dispatch({ kind: "pty_write", data: keys });
|
|
35344
|
+
}
|
|
35306
35345
|
const selected = options.find((o) => o.index === index);
|
|
35307
35346
|
return {
|
|
35308
35347
|
ok: true,
|
|
@@ -35314,6 +35353,20 @@ var SpecCliAdapter = class _SpecCliAdapter {
|
|
|
35314
35353
|
}
|
|
35315
35354
|
};
|
|
35316
35355
|
}
|
|
35356
|
+
/** Parse the picker choices only if the picker already appears rendered on
|
|
35357
|
+
* the live screen (its `wait_for` condition currently matches and at least
|
|
35358
|
+
* one choice parses). Returns the parsed choices when open, else null so
|
|
35359
|
+
* the caller knows it must send the trigger to open it. Used to de-dup the
|
|
35360
|
+
* picker open in {@link selectPickerChoice}. */
|
|
35361
|
+
extractPickerChoicesIfRendered(action) {
|
|
35362
|
+
const wf = action.wait_for;
|
|
35363
|
+
if (wf?.regex) {
|
|
35364
|
+
const re = new RegExp(wf.regex, wf.flags ?? "i");
|
|
35365
|
+
if (!re.test(this.readScreenSectionText(wf.section))) return null;
|
|
35366
|
+
}
|
|
35367
|
+
const options = this.extractPickerChoices(action);
|
|
35368
|
+
return options.length > 0 ? options : null;
|
|
35369
|
+
}
|
|
35317
35370
|
/** Poll the live screen until the picker's `wait_for` condition matches,
|
|
35318
35371
|
* up to a short budget. Returns true if it rendered, false on timeout. */
|
|
35319
35372
|
async waitForPickerRendered(action) {
|
|
@@ -37337,6 +37390,12 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
37337
37390
|
workspace: typeof event.workspace === "string" && event.workspace.trim() ? event.workspace : this.workingDir,
|
|
37338
37391
|
providerSessionId: typeof event.providerSessionId === "string" && event.providerSessionId.trim() ? event.providerSessionId : this.providerSessionId
|
|
37339
37392
|
};
|
|
37393
|
+
if (this.isMeshWorkerSession() && this.settings.meshActiveTaskId) {
|
|
37394
|
+
const existingTaskId = typeof enrichedEvent.taskId === "string" && enrichedEvent.taskId.trim() ? enrichedEvent.taskId : void 0;
|
|
37395
|
+
if (!existingTaskId) {
|
|
37396
|
+
enrichedEvent.taskId = this.settings.meshActiveTaskId;
|
|
37397
|
+
}
|
|
37398
|
+
}
|
|
37340
37399
|
if (this.context?.emitProviderEvent) {
|
|
37341
37400
|
this.context.emitProviderEvent(enrichedEvent);
|
|
37342
37401
|
} else {
|