@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.mjs
CHANGED
|
@@ -311,10 +311,10 @@ function readInjected(value) {
|
|
|
311
311
|
}
|
|
312
312
|
function getDaemonBuildInfo() {
|
|
313
313
|
if (cached) return cached;
|
|
314
|
-
const commit = readInjected(true ? "
|
|
315
|
-
const commitShort = readInjected(true ? "
|
|
316
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
317
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
314
|
+
const commit = readInjected(true ? "91500e054cf2b6258f6041f90c18be03ad05a8ad" : void 0) ?? "unknown";
|
|
315
|
+
const commitShort = readInjected(true ? "91500e05" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
316
|
+
const version = readInjected(true ? "0.9.82-rc.356" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
317
|
+
const builtAt = readInjected(true ? "2026-06-22T22:47:29.082Z" : void 0);
|
|
318
318
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
319
319
|
return cached;
|
|
320
320
|
}
|
|
@@ -19739,6 +19739,7 @@ function extractButtonsFromRule(rule, hay) {
|
|
|
19739
19739
|
const idx = Number(m[1]);
|
|
19740
19740
|
let label = String(m[2] ?? "").trim();
|
|
19741
19741
|
if (!Number.isFinite(idx) || idx <= 0 || !label) continue;
|
|
19742
|
+
const current = hasCursorMarker(lines[i]);
|
|
19742
19743
|
let j = i + 1;
|
|
19743
19744
|
while (j < lines.length) {
|
|
19744
19745
|
const next = lines[j];
|
|
@@ -19750,7 +19751,7 @@ function extractButtonsFromRule(rule, hay) {
|
|
|
19750
19751
|
}
|
|
19751
19752
|
if (buttons.some((b) => b.index === idx)) continue;
|
|
19752
19753
|
const key = keyTemplate.replace(/\{index\}/g, String(idx));
|
|
19753
|
-
buttons.push({ index: idx, label, key });
|
|
19754
|
+
buttons.push({ index: idx, label, key, current });
|
|
19754
19755
|
i = j - 1;
|
|
19755
19756
|
}
|
|
19756
19757
|
} else {
|
|
@@ -19762,12 +19763,15 @@ function extractButtonsFromRule(rule, hay) {
|
|
|
19762
19763
|
if (!Number.isFinite(idx) || idx <= 0 || !label) continue;
|
|
19763
19764
|
if (buttons.some((b) => b.index === idx)) continue;
|
|
19764
19765
|
const key = keyTemplate.replace(/\{index\}/g, String(idx));
|
|
19765
|
-
buttons.push({ index: idx, label, key });
|
|
19766
|
+
buttons.push({ index: idx, label, key, current: hasCursorMarker(m[0]) });
|
|
19766
19767
|
}
|
|
19767
19768
|
}
|
|
19768
19769
|
buttons.sort((a, b) => a.index - b.index);
|
|
19769
19770
|
return buttons;
|
|
19770
19771
|
}
|
|
19772
|
+
function hasCursorMarker(text) {
|
|
19773
|
+
return /^\s*[❯›>]/.test(text);
|
|
19774
|
+
}
|
|
19771
19775
|
var init_evaluator = __esm({
|
|
19772
19776
|
"src/providers/spec/evaluator.ts"() {
|
|
19773
19777
|
"use strict";
|
|
@@ -33681,6 +33685,19 @@ var FsmDriver = class {
|
|
|
33681
33685
|
if (!m) return;
|
|
33682
33686
|
const btn = m.buttons.find((b) => b.index === index);
|
|
33683
33687
|
if (!btn) return;
|
|
33688
|
+
const rule = stateById(this.spec, this.currentStateId)?.extract?.buttons;
|
|
33689
|
+
if (rule?.select_mode === "arrow_keys") {
|
|
33690
|
+
const from = m.buttons.find((b) => b.current)?.index ?? 1;
|
|
33691
|
+
const up = rule.cursor_keys?.up ?? "\x1B[A";
|
|
33692
|
+
const down = rule.cursor_keys?.down ?? "\x1B[B";
|
|
33693
|
+
const delta = btn.index - from;
|
|
33694
|
+
const step = delta >= 0 ? down : up;
|
|
33695
|
+
const nav = step.repeat(Math.abs(delta));
|
|
33696
|
+
const confirm = (rule.key_for_index || "\r").replace(/\{index\}/g, "") || "\r";
|
|
33697
|
+
if (nav) this.adapter.send_keys(nav);
|
|
33698
|
+
this.adapter.send_keys(confirm);
|
|
33699
|
+
return;
|
|
33700
|
+
}
|
|
33684
33701
|
this.adapter.send_keys(btn.key);
|
|
33685
33702
|
}
|
|
33686
33703
|
handleAttachImage(blob, mime) {
|
|
@@ -34918,9 +34935,12 @@ var SpecCliAdapter = class _SpecCliAdapter {
|
|
|
34918
34935
|
* — not this code — decides how a selection is keyed for each CLI.
|
|
34919
34936
|
*/
|
|
34920
34937
|
async selectPickerChoice(ctl, action, choiceIndex, choiceLabel) {
|
|
34921
|
-
|
|
34922
|
-
|
|
34923
|
-
|
|
34938
|
+
let options = this.extractPickerChoicesIfRendered(action);
|
|
34939
|
+
if (!options) {
|
|
34940
|
+
this.driver.dispatch({ kind: "click_control", control_id: ctl.id });
|
|
34941
|
+
await this.waitForPickerRendered(action);
|
|
34942
|
+
options = this.extractPickerChoices(action);
|
|
34943
|
+
}
|
|
34924
34944
|
let index = choiceIndex;
|
|
34925
34945
|
if ((index == null || !Number.isFinite(index)) && choiceLabel) {
|
|
34926
34946
|
const needle = choiceLabel.trim().toLowerCase();
|
|
@@ -34933,8 +34953,27 @@ var SpecCliAdapter = class _SpecCliAdapter {
|
|
|
34933
34953
|
if (index == null || !Number.isFinite(index)) {
|
|
34934
34954
|
return { ok: false, error: "choiceIndex or choiceLabel required to select" };
|
|
34935
34955
|
}
|
|
34936
|
-
|
|
34937
|
-
|
|
34956
|
+
if (action.select_mode === "arrow_keys") {
|
|
34957
|
+
const current = options.find((o) => o.current);
|
|
34958
|
+
if (current == null) {
|
|
34959
|
+
return {
|
|
34960
|
+
ok: false,
|
|
34961
|
+
error: "arrow-nav picker: current cursor row not detected on screen",
|
|
34962
|
+
controlResult: { options: options.map((o) => ({ value: o.label, label: o.label, current: o.current })) }
|
|
34963
|
+
};
|
|
34964
|
+
}
|
|
34965
|
+
const up = action.cursor_keys?.up ?? "\x1B[A";
|
|
34966
|
+
const down = action.cursor_keys?.down ?? "\x1B[B";
|
|
34967
|
+
const delta = index - current.index;
|
|
34968
|
+
const step = delta >= 0 ? down : up;
|
|
34969
|
+
const nav = step.repeat(Math.abs(delta));
|
|
34970
|
+
const confirm = (action.submit_key || "\r").replace(/\{index\}/g, "") || "\r";
|
|
34971
|
+
if (nav) this.driver.dispatch({ kind: "pty_write", data: nav });
|
|
34972
|
+
this.driver.dispatch({ kind: "pty_write", data: confirm });
|
|
34973
|
+
} else {
|
|
34974
|
+
const keys = (action.submit_key || "{index}\r").replace(/\{index\}/g, String(index));
|
|
34975
|
+
this.driver.dispatch({ kind: "pty_write", data: keys });
|
|
34976
|
+
}
|
|
34938
34977
|
const selected = options.find((o) => o.index === index);
|
|
34939
34978
|
return {
|
|
34940
34979
|
ok: true,
|
|
@@ -34946,6 +34985,20 @@ var SpecCliAdapter = class _SpecCliAdapter {
|
|
|
34946
34985
|
}
|
|
34947
34986
|
};
|
|
34948
34987
|
}
|
|
34988
|
+
/** Parse the picker choices only if the picker already appears rendered on
|
|
34989
|
+
* the live screen (its `wait_for` condition currently matches and at least
|
|
34990
|
+
* one choice parses). Returns the parsed choices when open, else null so
|
|
34991
|
+
* the caller knows it must send the trigger to open it. Used to de-dup the
|
|
34992
|
+
* picker open in {@link selectPickerChoice}. */
|
|
34993
|
+
extractPickerChoicesIfRendered(action) {
|
|
34994
|
+
const wf = action.wait_for;
|
|
34995
|
+
if (wf?.regex) {
|
|
34996
|
+
const re = new RegExp(wf.regex, wf.flags ?? "i");
|
|
34997
|
+
if (!re.test(this.readScreenSectionText(wf.section))) return null;
|
|
34998
|
+
}
|
|
34999
|
+
const options = this.extractPickerChoices(action);
|
|
35000
|
+
return options.length > 0 ? options : null;
|
|
35001
|
+
}
|
|
34949
35002
|
/** Poll the live screen until the picker's `wait_for` condition matches,
|
|
34950
35003
|
* up to a short budget. Returns true if it rendered, false on timeout. */
|
|
34951
35004
|
async waitForPickerRendered(action) {
|
|
@@ -36969,6 +37022,12 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
36969
37022
|
workspace: typeof event.workspace === "string" && event.workspace.trim() ? event.workspace : this.workingDir,
|
|
36970
37023
|
providerSessionId: typeof event.providerSessionId === "string" && event.providerSessionId.trim() ? event.providerSessionId : this.providerSessionId
|
|
36971
37024
|
};
|
|
37025
|
+
if (this.isMeshWorkerSession() && this.settings.meshActiveTaskId) {
|
|
37026
|
+
const existingTaskId = typeof enrichedEvent.taskId === "string" && enrichedEvent.taskId.trim() ? enrichedEvent.taskId : void 0;
|
|
37027
|
+
if (!existingTaskId) {
|
|
37028
|
+
enrichedEvent.taskId = this.settings.meshActiveTaskId;
|
|
37029
|
+
}
|
|
37030
|
+
}
|
|
36972
37031
|
if (this.context?.emitProviderEvent) {
|
|
36973
37032
|
this.context.emitProviderEvent(enrichedEvent);
|
|
36974
37033
|
} else {
|