@adhdev/daemon-standalone 0.9.82-rc.168 → 0.9.82-rc.169

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
@@ -44756,6 +44756,10 @@ ${lastSnapshot}`;
44756
44756
  "type": "integer",
44757
44757
  "minimum": 1,
44758
44758
  "default": 2
44759
+ },
44760
+ "continuation_lines": {
44761
+ "type": "boolean",
44762
+ "default": false
44759
44763
  }
44760
44764
  }
44761
44765
  }
@@ -54855,6 +54859,11 @@ ${effect.notification.body || ""}`.trim();
54855
54859
  }
54856
54860
  return { index: -1, label: "" };
54857
54861
  }
54862
+ function pickAutoApprovalButton(buttons) {
54863
+ const labels = (buttons || []).map((button) => String(button || "").trim());
54864
+ const index = labels.findIndex(Boolean);
54865
+ return index >= 0 ? { index, label: labels[index] } : { index: -1, label: "" };
54866
+ }
54858
54867
  function formatAutoApprovalMessage(modalMessage, buttonLabel) {
54859
54868
  const lines = [`Auto-approved${buttonLabel ? `: ${buttonLabel}` : ""}`];
54860
54869
  const cleanMessage = String(modalMessage || "").trim();
@@ -55427,7 +55436,7 @@ ${effect.notification.body || ""}`.trim();
55427
55436
  }
55428
55437
  this.autoApproveBusy = true;
55429
55438
  try {
55430
- const { label: targetButton } = pickApprovalButton(_chatData?.activeModal?.buttons, this.provider);
55439
+ const { label: targetButton } = pickAutoApprovalButton(_chatData?.activeModal?.buttons);
55431
55440
  const script = scriptFn({ action: "approve", button: targetButton, buttonText: targetButton });
55432
55441
  if (!script) return;
55433
55442
  const now = Date.now();
@@ -61831,6 +61840,10 @@ ${formatManifestValidationIssues2(validation.issues)}`,
61831
61840
  const flags = ref.flags ?? "gm";
61832
61841
  return new RegExp(ref.pattern, flags.includes("g") ? flags : flags + "g");
61833
61842
  }
61843
+ function compileLinePattern(ref) {
61844
+ const flags = (ref.flags ?? "m").replace(/g/g, "");
61845
+ return new RegExp(ref.pattern, flags);
61846
+ }
61834
61847
  function matchState(state, sections, fullScreen, trace) {
61835
61848
  const haystack = sectionText(sections, state.when.section, fullScreen);
61836
61849
  const re = compileRegex(state.when);
@@ -61851,16 +61864,41 @@ ${formatManifestValidationIssues2(validation.issues)}`,
61851
61864
  function extractModal(state, sections, fullScreen, title, trace) {
61852
61865
  if (!state.modal_buttons) return null;
61853
61866
  const hay = sectionText(sections, state.modal_buttons.section, fullScreen);
61854
- const re = compilePattern(state.modal_buttons);
61855
61867
  const buttons = [];
61856
- let m;
61857
- while ((m = re.exec(hay)) !== null) {
61858
- const idx = Number(m[1]);
61859
- const label = String(m[2] ?? "").trim();
61860
- if (!Number.isFinite(idx) || idx <= 0 || !label) continue;
61861
- if (buttons.some((b) => b.index === idx)) continue;
61862
- const key = state.modal_buttons.key_for_index.replace(/\{index\}/g, String(idx));
61863
- buttons.push({ index: idx, label, key });
61868
+ if (state.modal_buttons.continuation_lines) {
61869
+ const re = compileLinePattern(state.modal_buttons);
61870
+ const lines = hay.split("\n");
61871
+ for (let i = 0; i < lines.length; i += 1) {
61872
+ const m = re.exec(lines[i]);
61873
+ if (!m) continue;
61874
+ const idx = Number(m[1]);
61875
+ let label = String(m[2] ?? "").trim();
61876
+ if (!Number.isFinite(idx) || idx <= 0 || !label) continue;
61877
+ let j = i + 1;
61878
+ while (j < lines.length) {
61879
+ const next = lines[j];
61880
+ if (!next.trim()) break;
61881
+ if (re.test(next)) break;
61882
+ if (!/^\s+/.test(next)) break;
61883
+ label += " " + next.trim();
61884
+ j += 1;
61885
+ }
61886
+ if (buttons.some((b) => b.index === idx)) continue;
61887
+ const key = state.modal_buttons.key_for_index.replace(/\{index\}/g, String(idx));
61888
+ buttons.push({ index: idx, label, key });
61889
+ i = j - 1;
61890
+ }
61891
+ } else {
61892
+ const re = compilePattern(state.modal_buttons);
61893
+ let m;
61894
+ while ((m = re.exec(hay)) !== null) {
61895
+ const idx = Number(m[1]);
61896
+ const label = String(m[2] ?? "").trim();
61897
+ if (!Number.isFinite(idx) || idx <= 0 || !label) continue;
61898
+ if (buttons.some((b) => b.index === idx)) continue;
61899
+ const key = state.modal_buttons.key_for_index.replace(/\{index\}/g, String(idx));
61900
+ buttons.push({ index: idx, label, key });
61901
+ }
61864
61902
  }
61865
61903
  buttons.sort((a, b) => a.index - b.index);
61866
61904
  const minCount = state.modal_buttons.min_count ?? 2;
@@ -63356,7 +63394,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
63356
63394
  if (!modal || buttons.length === 0) {
63357
63395
  return autoApproveActive;
63358
63396
  }
63359
- const { index: buttonIndex, label: buttonLabel } = pickApprovalButton(buttons, this.provider);
63397
+ const { index: buttonIndex, label: buttonLabel } = pickAutoApprovalButton(buttons);
63360
63398
  if (buttonIndex < 0) {
63361
63399
  return autoApproveActive;
63362
63400
  }
@@ -76222,8 +76260,7 @@ ${ptyResult.output.slice(-2e3)}`);
76222
76260
  if (stream?.status === "waiting_approval") {
76223
76261
  const autoApprove = providerLoader.getSettings(stream.agentType).autoApprove !== false;
76224
76262
  if (autoApprove && resolvedActiveSessionId) {
76225
- const provider = providerLoader.getMeta(stream.agentType);
76226
- const { label: buttonLabel } = pickApprovalButton(stream.activeModal?.buttons, provider);
76263
+ const { label: buttonLabel } = pickAutoApprovalButton(stream.activeModal?.buttons);
76227
76264
  const approved = await agentStreamManager.resolveSessionAction(cdp, resolvedActiveSessionId, "approve", buttonLabel);
76228
76265
  if (approved) {
76229
76266
  const effectId = [