@adhdev/daemon-core 0.9.82-rc.202 → 0.9.82-rc.204
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 +9 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/providers/spec/cli-adapter.ts +5 -15
- package/src/providers/spec/evaluator.ts +7 -3
- package/src/providers/spec/schema.json +18 -1
package/dist/index.js
CHANGED
|
@@ -26682,7 +26682,8 @@ function extractModal(state, sections, fullScreen, title, trace) {
|
|
|
26682
26682
|
}
|
|
26683
26683
|
function evaluate(spec, screenText, cursor) {
|
|
26684
26684
|
const trace = [];
|
|
26685
|
-
const lines = screenText.split("\n");
|
|
26685
|
+
const lines = screenText.split("\n").map((l) => l.endsWith("\r") ? l.slice(0, -1) : l);
|
|
26686
|
+
const cleanScreen = lines.join("\n");
|
|
26686
26687
|
const sections = resolveSections(spec, lines);
|
|
26687
26688
|
for (const s of sections) {
|
|
26688
26689
|
trace.push({ kind: "section", text: `section[${s.id}] lines [${s.fromLine}, ${s.toLine}) (${s.toLine - s.fromLine} lines)` });
|
|
@@ -26693,9 +26694,9 @@ function evaluate(spec, screenText, cursor) {
|
|
|
26693
26694
|
let activeState = null;
|
|
26694
26695
|
let modal = null;
|
|
26695
26696
|
for (const st of spec.states) {
|
|
26696
|
-
const { matched, title } = matchState(st, sections,
|
|
26697
|
+
const { matched, title } = matchState(st, sections, cleanScreen, trace, cursor);
|
|
26697
26698
|
if (!matched) continue;
|
|
26698
|
-
const extractedModal = extractModal(st, sections,
|
|
26699
|
+
const extractedModal = extractModal(st, sections, cleanScreen, title, trace);
|
|
26699
26700
|
if (st.modal_buttons && !extractedModal) {
|
|
26700
26701
|
trace.push({ kind: "state_skip", text: `state[${st.id}] matched but modal_buttons extraction failed \u2014 not promoting` });
|
|
26701
26702
|
continue;
|
|
@@ -28865,21 +28866,11 @@ var SpecCliAdapter = class {
|
|
|
28865
28866
|
let sections;
|
|
28866
28867
|
try {
|
|
28867
28868
|
screen = this.driver.snapshot();
|
|
28868
|
-
const
|
|
28869
|
-
|
|
28870
|
-
|
|
28871
|
-
|
|
28872
|
-
|
|
28873
|
-
let start = 0;
|
|
28874
|
-
let end = lines.length;
|
|
28875
|
-
if (typeof from === "number") start = Math.max(0, from);
|
|
28876
|
-
else if (typeof fromBottom === "number") start = Math.max(0, lines.length - fromBottom);
|
|
28877
|
-
const until = sec.until;
|
|
28878
|
-
if (until && typeof until === "object" && typeof until.section === "string") {
|
|
28879
|
-
const ref = (this.spec.layout?.sections ?? []).find((s) => s.id === until.section);
|
|
28880
|
-
if (ref && typeof ref.from_bottom === "number") end = Math.max(start, lines.length - ref.from_bottom);
|
|
28881
|
-
}
|
|
28882
|
-
sections[sec.id] = lines.slice(start, end).join("\n");
|
|
28869
|
+
const driverSections = this.driver.getSections?.();
|
|
28870
|
+
if (driverSections) {
|
|
28871
|
+
sections = Object.fromEntries(driverSections.map((s) => [s.id, s.text]));
|
|
28872
|
+
} else {
|
|
28873
|
+
sections = this.readCurrentScreenSections(screen);
|
|
28883
28874
|
}
|
|
28884
28875
|
} catch {
|
|
28885
28876
|
}
|