@adhdev/daemon-standalone 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 CHANGED
@@ -61348,7 +61348,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
61348
61348
  }
61349
61349
  function evaluate(spec, screenText, cursor) {
61350
61350
  const trace = [];
61351
- const lines = screenText.split("\n");
61351
+ const lines = screenText.split("\n").map((l) => l.endsWith("\r") ? l.slice(0, -1) : l);
61352
+ const cleanScreen = lines.join("\n");
61352
61353
  const sections = resolveSections(spec, lines);
61353
61354
  for (const s of sections) {
61354
61355
  trace.push({ kind: "section", text: `section[${s.id}] lines [${s.fromLine}, ${s.toLine}) (${s.toLine - s.fromLine} lines)` });
@@ -61359,9 +61360,9 @@ ${formatManifestValidationIssues2(validation.issues)}`,
61359
61360
  let activeState = null;
61360
61361
  let modal = null;
61361
61362
  for (const st of spec.states) {
61362
- const { matched, title } = matchState(st, sections, screenText, trace, cursor);
61363
+ const { matched, title } = matchState(st, sections, cleanScreen, trace, cursor);
61363
61364
  if (!matched) continue;
61364
- const extractedModal = extractModal(st, sections, screenText, title, trace);
61365
+ const extractedModal = extractModal(st, sections, cleanScreen, title, trace);
61365
61366
  if (st.modal_buttons && !extractedModal) {
61366
61367
  trace.push({ kind: "state_skip", text: `state[${st.id}] matched but modal_buttons extraction failed \u2014 not promoting` });
61367
61368
  continue;
@@ -63519,21 +63520,11 @@ ${formatManifestValidationIssues2(validation.issues)}`,
63519
63520
  let sections;
63520
63521
  try {
63521
63522
  screen = this.driver.snapshot();
63522
- const lines = screen.split("\n");
63523
- sections = {};
63524
- for (const sec of this.spec.layout?.sections ?? []) {
63525
- const from = sec.from_top;
63526
- const fromBottom = sec.from_bottom;
63527
- let start = 0;
63528
- let end = lines.length;
63529
- if (typeof from === "number") start = Math.max(0, from);
63530
- else if (typeof fromBottom === "number") start = Math.max(0, lines.length - fromBottom);
63531
- const until = sec.until;
63532
- if (until && typeof until === "object" && typeof until.section === "string") {
63533
- const ref = (this.spec.layout?.sections ?? []).find((s) => s.id === until.section);
63534
- if (ref && typeof ref.from_bottom === "number") end = Math.max(start, lines.length - ref.from_bottom);
63535
- }
63536
- sections[sec.id] = lines.slice(start, end).join("\n");
63523
+ const driverSections = this.driver.getSections?.();
63524
+ if (driverSections) {
63525
+ sections = Object.fromEntries(driverSections.map((s) => [s.id, s.text]));
63526
+ } else {
63527
+ sections = this.readCurrentScreenSections(screen);
63537
63528
  }
63538
63529
  } catch {
63539
63530
  }
@@ -87514,6 +87505,7 @@ var StandaloneServer = class {
87514
87505
  onStatusChange: () => {
87515
87506
  this.scheduleBroadcastStatus();
87516
87507
  void this.flushWsChatSubscriptions(void 0, { onlyActive: true });
87508
+ void this.flushWsSessionModalSubscriptions();
87517
87509
  },
87518
87510
  removeAgentTracking: () => {
87519
87511
  },
@@ -87543,6 +87535,7 @@ var StandaloneServer = class {
87543
87535
  onStatusChange: () => {
87544
87536
  this.scheduleBroadcastStatus();
87545
87537
  void this.flushWsChatSubscriptions(void 0, { onlyActive: true });
87538
+ void this.flushWsSessionModalSubscriptions();
87546
87539
  },
87547
87540
  sessionHostControl,
87548
87541
  onStreamsUpdated: (ideType, streams) => {