@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 +50 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -13
- package/dist/index.mjs.map +1 -1
- package/dist/providers/approval-utils.d.ts +4 -0
- package/dist/providers/spec/schema.gen.d.ts +4 -0
- package/dist/providers/spec/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/agent-stream/poller.ts +2 -3
- package/src/providers/approval-utils.d.ts +4 -0
- package/src/providers/approval-utils.ts +8 -0
- package/src/providers/cli-provider-instance.ts +3 -3
- package/src/providers/ide-provider-instance.ts +2 -2
- package/src/providers/spec/evaluator.ts +39 -9
- package/src/providers/spec/schema.gen.ts +4 -0
- package/src/providers/spec/schema.json +2 -1
- package/src/providers/spec/types.ts +1 -0
package/dist/index.mjs
CHANGED
|
@@ -9940,6 +9940,10 @@ var init_schema_gen = __esm({
|
|
|
9940
9940
|
"type": "integer",
|
|
9941
9941
|
"minimum": 1,
|
|
9942
9942
|
"default": 2
|
|
9943
|
+
},
|
|
9944
|
+
"continuation_lines": {
|
|
9945
|
+
"type": "boolean",
|
|
9946
|
+
"default": false
|
|
9943
9947
|
}
|
|
9944
9948
|
}
|
|
9945
9949
|
}
|
|
@@ -19825,6 +19829,11 @@ function pickApprovalButton(buttons, provider) {
|
|
|
19825
19829
|
}
|
|
19826
19830
|
return { index: -1, label: "" };
|
|
19827
19831
|
}
|
|
19832
|
+
function pickAutoApprovalButton(buttons) {
|
|
19833
|
+
const labels = (buttons || []).map((button) => String(button || "").trim());
|
|
19834
|
+
const index = labels.findIndex(Boolean);
|
|
19835
|
+
return index >= 0 ? { index, label: labels[index] } : { index: -1, label: "" };
|
|
19836
|
+
}
|
|
19828
19837
|
function formatAutoApprovalMessage(modalMessage, buttonLabel) {
|
|
19829
19838
|
const lines = [`Auto-approved${buttonLabel ? `: ${buttonLabel}` : ""}`];
|
|
19830
19839
|
const cleanMessage = String(modalMessage || "").trim();
|
|
@@ -20399,7 +20408,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
20399
20408
|
}
|
|
20400
20409
|
this.autoApproveBusy = true;
|
|
20401
20410
|
try {
|
|
20402
|
-
const { label: targetButton } =
|
|
20411
|
+
const { label: targetButton } = pickAutoApprovalButton(_chatData?.activeModal?.buttons);
|
|
20403
20412
|
const script = scriptFn({ action: "approve", button: targetButton, buttonText: targetButton });
|
|
20404
20413
|
if (!script) return;
|
|
20405
20414
|
const now = Date.now();
|
|
@@ -26865,6 +26874,10 @@ function compilePattern(ref) {
|
|
|
26865
26874
|
const flags = ref.flags ?? "gm";
|
|
26866
26875
|
return new RegExp(ref.pattern, flags.includes("g") ? flags : flags + "g");
|
|
26867
26876
|
}
|
|
26877
|
+
function compileLinePattern(ref) {
|
|
26878
|
+
const flags = (ref.flags ?? "m").replace(/g/g, "");
|
|
26879
|
+
return new RegExp(ref.pattern, flags);
|
|
26880
|
+
}
|
|
26868
26881
|
function matchState(state, sections, fullScreen, trace) {
|
|
26869
26882
|
const haystack = sectionText(sections, state.when.section, fullScreen);
|
|
26870
26883
|
const re = compileRegex(state.when);
|
|
@@ -26885,16 +26898,41 @@ function matchState(state, sections, fullScreen, trace) {
|
|
|
26885
26898
|
function extractModal(state, sections, fullScreen, title, trace) {
|
|
26886
26899
|
if (!state.modal_buttons) return null;
|
|
26887
26900
|
const hay = sectionText(sections, state.modal_buttons.section, fullScreen);
|
|
26888
|
-
const re = compilePattern(state.modal_buttons);
|
|
26889
26901
|
const buttons = [];
|
|
26890
|
-
|
|
26891
|
-
|
|
26892
|
-
const
|
|
26893
|
-
|
|
26894
|
-
|
|
26895
|
-
|
|
26896
|
-
|
|
26897
|
-
|
|
26902
|
+
if (state.modal_buttons.continuation_lines) {
|
|
26903
|
+
const re = compileLinePattern(state.modal_buttons);
|
|
26904
|
+
const lines = hay.split("\n");
|
|
26905
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
26906
|
+
const m = re.exec(lines[i]);
|
|
26907
|
+
if (!m) continue;
|
|
26908
|
+
const idx = Number(m[1]);
|
|
26909
|
+
let label = String(m[2] ?? "").trim();
|
|
26910
|
+
if (!Number.isFinite(idx) || idx <= 0 || !label) continue;
|
|
26911
|
+
let j = i + 1;
|
|
26912
|
+
while (j < lines.length) {
|
|
26913
|
+
const next = lines[j];
|
|
26914
|
+
if (!next.trim()) break;
|
|
26915
|
+
if (re.test(next)) break;
|
|
26916
|
+
if (!/^\s+/.test(next)) break;
|
|
26917
|
+
label += " " + next.trim();
|
|
26918
|
+
j += 1;
|
|
26919
|
+
}
|
|
26920
|
+
if (buttons.some((b) => b.index === idx)) continue;
|
|
26921
|
+
const key = state.modal_buttons.key_for_index.replace(/\{index\}/g, String(idx));
|
|
26922
|
+
buttons.push({ index: idx, label, key });
|
|
26923
|
+
i = j - 1;
|
|
26924
|
+
}
|
|
26925
|
+
} else {
|
|
26926
|
+
const re = compilePattern(state.modal_buttons);
|
|
26927
|
+
let m;
|
|
26928
|
+
while ((m = re.exec(hay)) !== null) {
|
|
26929
|
+
const idx = Number(m[1]);
|
|
26930
|
+
const label = String(m[2] ?? "").trim();
|
|
26931
|
+
if (!Number.isFinite(idx) || idx <= 0 || !label) continue;
|
|
26932
|
+
if (buttons.some((b) => b.index === idx)) continue;
|
|
26933
|
+
const key = state.modal_buttons.key_for_index.replace(/\{index\}/g, String(idx));
|
|
26934
|
+
buttons.push({ index: idx, label, key });
|
|
26935
|
+
}
|
|
26898
26936
|
}
|
|
26899
26937
|
buttons.sort((a, b) => a.index - b.index);
|
|
26900
26938
|
const minCount = state.modal_buttons.min_count ?? 2;
|
|
@@ -28402,7 +28440,7 @@ var CliProviderInstance = class {
|
|
|
28402
28440
|
if (!modal || buttons.length === 0) {
|
|
28403
28441
|
return autoApproveActive;
|
|
28404
28442
|
}
|
|
28405
|
-
const { index: buttonIndex, label: buttonLabel } =
|
|
28443
|
+
const { index: buttonIndex, label: buttonLabel } = pickAutoApprovalButton(buttons);
|
|
28406
28444
|
if (buttonIndex < 0) {
|
|
28407
28445
|
return autoApproveActive;
|
|
28408
28446
|
}
|
|
@@ -41323,8 +41361,7 @@ var AgentStreamPoller = class {
|
|
|
41323
41361
|
if (stream?.status === "waiting_approval") {
|
|
41324
41362
|
const autoApprove = providerLoader.getSettings(stream.agentType).autoApprove !== false;
|
|
41325
41363
|
if (autoApprove && resolvedActiveSessionId) {
|
|
41326
|
-
const
|
|
41327
|
-
const { label: buttonLabel } = pickApprovalButton(stream.activeModal?.buttons, provider);
|
|
41364
|
+
const { label: buttonLabel } = pickAutoApprovalButton(stream.activeModal?.buttons);
|
|
41328
41365
|
const approved = await agentStreamManager.resolveSessionAction(cdp, resolvedActiveSessionId, "approve", buttonLabel);
|
|
41329
41366
|
if (approved) {
|
|
41330
41367
|
const effectId = [
|