@adhdev/daemon-core 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
@@ -9945,6 +9945,10 @@ var init_schema_gen = __esm({
9945
9945
  "type": "integer",
9946
9946
  "minimum": 1,
9947
9947
  "default": 2
9948
+ },
9949
+ "continuation_lines": {
9950
+ "type": "boolean",
9951
+ "default": false
9948
9952
  }
9949
9953
  }
9950
9954
  }
@@ -20126,6 +20130,11 @@ function pickApprovalButton(buttons, provider) {
20126
20130
  }
20127
20131
  return { index: -1, label: "" };
20128
20132
  }
20133
+ function pickAutoApprovalButton(buttons) {
20134
+ const labels = (buttons || []).map((button) => String(button || "").trim());
20135
+ const index = labels.findIndex(Boolean);
20136
+ return index >= 0 ? { index, label: labels[index] } : { index: -1, label: "" };
20137
+ }
20129
20138
  function formatAutoApprovalMessage(modalMessage, buttonLabel) {
20130
20139
  const lines = [`Auto-approved${buttonLabel ? `: ${buttonLabel}` : ""}`];
20131
20140
  const cleanMessage = String(modalMessage || "").trim();
@@ -20700,7 +20709,7 @@ ${effect.notification.body || ""}`.trim();
20700
20709
  }
20701
20710
  this.autoApproveBusy = true;
20702
20711
  try {
20703
- const { label: targetButton } = pickApprovalButton(_chatData?.activeModal?.buttons, this.provider);
20712
+ const { label: targetButton } = pickAutoApprovalButton(_chatData?.activeModal?.buttons);
20704
20713
  const script = scriptFn({ action: "approve", button: targetButton, buttonText: targetButton });
20705
20714
  if (!script) return;
20706
20715
  const now = Date.now();
@@ -27166,6 +27175,10 @@ function compilePattern(ref) {
27166
27175
  const flags = ref.flags ?? "gm";
27167
27176
  return new RegExp(ref.pattern, flags.includes("g") ? flags : flags + "g");
27168
27177
  }
27178
+ function compileLinePattern(ref) {
27179
+ const flags = (ref.flags ?? "m").replace(/g/g, "");
27180
+ return new RegExp(ref.pattern, flags);
27181
+ }
27169
27182
  function matchState(state, sections, fullScreen, trace) {
27170
27183
  const haystack = sectionText(sections, state.when.section, fullScreen);
27171
27184
  const re = compileRegex(state.when);
@@ -27186,16 +27199,41 @@ function matchState(state, sections, fullScreen, trace) {
27186
27199
  function extractModal(state, sections, fullScreen, title, trace) {
27187
27200
  if (!state.modal_buttons) return null;
27188
27201
  const hay = sectionText(sections, state.modal_buttons.section, fullScreen);
27189
- const re = compilePattern(state.modal_buttons);
27190
27202
  const buttons = [];
27191
- let m;
27192
- while ((m = re.exec(hay)) !== null) {
27193
- const idx = Number(m[1]);
27194
- const label = String(m[2] ?? "").trim();
27195
- if (!Number.isFinite(idx) || idx <= 0 || !label) continue;
27196
- if (buttons.some((b) => b.index === idx)) continue;
27197
- const key = state.modal_buttons.key_for_index.replace(/\{index\}/g, String(idx));
27198
- buttons.push({ index: idx, label, key });
27203
+ if (state.modal_buttons.continuation_lines) {
27204
+ const re = compileLinePattern(state.modal_buttons);
27205
+ const lines = hay.split("\n");
27206
+ for (let i = 0; i < lines.length; i += 1) {
27207
+ const m = re.exec(lines[i]);
27208
+ if (!m) continue;
27209
+ const idx = Number(m[1]);
27210
+ let label = String(m[2] ?? "").trim();
27211
+ if (!Number.isFinite(idx) || idx <= 0 || !label) continue;
27212
+ let j = i + 1;
27213
+ while (j < lines.length) {
27214
+ const next = lines[j];
27215
+ if (!next.trim()) break;
27216
+ if (re.test(next)) break;
27217
+ if (!/^\s+/.test(next)) break;
27218
+ label += " " + next.trim();
27219
+ j += 1;
27220
+ }
27221
+ if (buttons.some((b) => b.index === idx)) continue;
27222
+ const key = state.modal_buttons.key_for_index.replace(/\{index\}/g, String(idx));
27223
+ buttons.push({ index: idx, label, key });
27224
+ i = j - 1;
27225
+ }
27226
+ } else {
27227
+ const re = compilePattern(state.modal_buttons);
27228
+ let m;
27229
+ while ((m = re.exec(hay)) !== null) {
27230
+ const idx = Number(m[1]);
27231
+ const label = String(m[2] ?? "").trim();
27232
+ if (!Number.isFinite(idx) || idx <= 0 || !label) continue;
27233
+ if (buttons.some((b) => b.index === idx)) continue;
27234
+ const key = state.modal_buttons.key_for_index.replace(/\{index\}/g, String(idx));
27235
+ buttons.push({ index: idx, label, key });
27236
+ }
27199
27237
  }
27200
27238
  buttons.sort((a, b) => a.index - b.index);
27201
27239
  const minCount = state.modal_buttons.min_count ?? 2;
@@ -28703,7 +28741,7 @@ var CliProviderInstance = class {
28703
28741
  if (!modal || buttons.length === 0) {
28704
28742
  return autoApproveActive;
28705
28743
  }
28706
- const { index: buttonIndex, label: buttonLabel } = pickApprovalButton(buttons, this.provider);
28744
+ const { index: buttonIndex, label: buttonLabel } = pickAutoApprovalButton(buttons);
28707
28745
  if (buttonIndex < 0) {
28708
28746
  return autoApproveActive;
28709
28747
  }
@@ -41619,8 +41657,7 @@ var AgentStreamPoller = class {
41619
41657
  if (stream?.status === "waiting_approval") {
41620
41658
  const autoApprove = providerLoader.getSettings(stream.agentType).autoApprove !== false;
41621
41659
  if (autoApprove && resolvedActiveSessionId) {
41622
- const provider = providerLoader.getMeta(stream.agentType);
41623
- const { label: buttonLabel } = pickApprovalButton(stream.activeModal?.buttons, provider);
41660
+ const { label: buttonLabel } = pickAutoApprovalButton(stream.activeModal?.buttons);
41624
41661
  const approved = await agentStreamManager.resolveSessionAction(cdp, resolvedActiveSessionId, "approve", buttonLabel);
41625
41662
  if (approved) {
41626
41663
  const effectId = [