@clawos-dev/clawd 0.2.72 → 0.2.73-beta.142.96910a0
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/cli.cjs +20 -5
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -24587,6 +24587,16 @@ function spawnPty(opts) {
|
|
|
24587
24587
|
|
|
24588
24588
|
// src/tools/claude-tui.ts
|
|
24589
24589
|
var { Terminal } = import_headless.default;
|
|
24590
|
+
var POPUP_FOOTER_PATTERNS = [
|
|
24591
|
+
{ kind: "permission", regex: /Tab to amend|Do you want to proceed/i },
|
|
24592
|
+
{ kind: "question", regex: /Enter to select|↑\/↓ to navigate/i }
|
|
24593
|
+
];
|
|
24594
|
+
function matchPopupFooterKind(bufferText) {
|
|
24595
|
+
for (const p2 of POPUP_FOOTER_PATTERNS) {
|
|
24596
|
+
if (p2.regex.test(bufferText)) return p2.kind;
|
|
24597
|
+
}
|
|
24598
|
+
return null;
|
|
24599
|
+
}
|
|
24590
24600
|
function hasInputFrame(bufferText) {
|
|
24591
24601
|
const lines = bufferText.split("\n");
|
|
24592
24602
|
for (let i = 1; i < lines.length; i++) {
|
|
@@ -24601,6 +24611,7 @@ var READY_SIGNATURE_PATTERNS = [
|
|
|
24601
24611
|
{ name: "input-frame", match: hasInputFrame }
|
|
24602
24612
|
];
|
|
24603
24613
|
function isReadySignature(bufferText) {
|
|
24614
|
+
if (matchPopupFooterKind(bufferText) !== null) return false;
|
|
24604
24615
|
return READY_SIGNATURE_PATTERNS.some((p2) => p2.match(bufferText));
|
|
24605
24616
|
}
|
|
24606
24617
|
function createPopupDetector(opts) {
|
|
@@ -24616,7 +24627,7 @@ function createPopupDetector(opts) {
|
|
|
24616
24627
|
let pendingClear = null;
|
|
24617
24628
|
let quietTimer = null;
|
|
24618
24629
|
const QUIET_MS = opts.quietMs ?? 300;
|
|
24619
|
-
const
|
|
24630
|
+
const scanScreen = () => {
|
|
24620
24631
|
const buf = term.buffer.active;
|
|
24621
24632
|
const lines = [];
|
|
24622
24633
|
for (let i = 0; i < buf.length; i++) {
|
|
@@ -24624,16 +24635,20 @@ function createPopupDetector(opts) {
|
|
|
24624
24635
|
if (!line) continue;
|
|
24625
24636
|
lines.push(line.translateToString(true));
|
|
24626
24637
|
}
|
|
24627
|
-
|
|
24638
|
+
const text = lines.join("\n");
|
|
24639
|
+
return { ready: isReadySignature(text), footerKind: matchPopupFooterKind(text) };
|
|
24628
24640
|
};
|
|
24629
24641
|
const tick = () => {
|
|
24630
24642
|
if (quietTimer) clearTimeout(quietTimer);
|
|
24631
24643
|
quietTimer = setTimeout(() => {
|
|
24632
24644
|
quietTimer = null;
|
|
24633
|
-
const ready =
|
|
24645
|
+
const { ready, footerKind } = scanScreen();
|
|
24646
|
+
const popupKind = footerKind ?? "unknown";
|
|
24647
|
+
console.log("[BUGHUNT-READYGATE] quietTick", { ready, prevVisible: visible, popupKind });
|
|
24634
24648
|
if (!ready && visible === null) {
|
|
24635
|
-
visible =
|
|
24636
|
-
|
|
24649
|
+
visible = popupKind;
|
|
24650
|
+
console.log("[BUGHUNT-READYGATE] emit popup_open", { popupKind });
|
|
24651
|
+
opts.onTransition(popupKind, true);
|
|
24637
24652
|
} else if (!ready && visible !== null) {
|
|
24638
24653
|
if (pendingClear) {
|
|
24639
24654
|
clearTimeout(pendingClear);
|
package/package.json
CHANGED