@clawos-dev/clawd 0.2.150 → 0.2.151
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 +38 -10
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -37189,40 +37189,68 @@ function observeReady(surface, opts) {
|
|
|
37189
37189
|
}
|
|
37190
37190
|
};
|
|
37191
37191
|
}
|
|
37192
|
+
var BYPASS_SETTLE_MS = 300;
|
|
37192
37193
|
function createBootGate(pty, logger) {
|
|
37193
37194
|
const stripAnsi = (s) => s.replace(/\x1b\[[0-9;?]*C/g, " ").replace(/\x1b\[[0-9;?]*[a-zA-Z]/g, "").replace(/\x1b\][^\x07]*\x07/g, "").replace(/\x1b[NOPM=>78]/g, "").replace(/[\x00-\x1f\x7f]/g, " ");
|
|
37194
37195
|
const popups = {
|
|
37195
|
-
trust: {
|
|
37196
|
+
trust: {
|
|
37197
|
+
handled: false,
|
|
37198
|
+
fired: false,
|
|
37199
|
+
timer: void 0,
|
|
37200
|
+
regex: /trust\s*this\s*folder/i,
|
|
37201
|
+
accept: "\r",
|
|
37202
|
+
settleMs: 0,
|
|
37203
|
+
label: "trust-folder"
|
|
37204
|
+
},
|
|
37196
37205
|
bypass: {
|
|
37197
37206
|
handled: false,
|
|
37198
|
-
|
|
37207
|
+
fired: false,
|
|
37208
|
+
timer: void 0,
|
|
37209
|
+
regex: /Bypass\s*Permissions\s*mode|By\s*proceeding/i,
|
|
37199
37210
|
accept: "2\r",
|
|
37211
|
+
settleMs: BYPASS_SETTLE_MS,
|
|
37200
37212
|
label: "bypass-warning"
|
|
37201
37213
|
}
|
|
37202
37214
|
};
|
|
37203
37215
|
let scanBuf = "";
|
|
37216
|
+
const press = (popup) => {
|
|
37217
|
+
popup.fired = true;
|
|
37218
|
+
logger?.debug(`${popup.label} popup auto-yes`);
|
|
37219
|
+
try {
|
|
37220
|
+
pty.write(popup.accept);
|
|
37221
|
+
} catch (err) {
|
|
37222
|
+
logger?.warn(`${popup.label} auto-yes write failed`, {
|
|
37223
|
+
error: err.message
|
|
37224
|
+
});
|
|
37225
|
+
}
|
|
37226
|
+
};
|
|
37227
|
+
let disposed = false;
|
|
37204
37228
|
return {
|
|
37205
37229
|
feedBytes(data) {
|
|
37230
|
+
if (disposed) return;
|
|
37206
37231
|
scanBuf += data.toString("utf8");
|
|
37207
37232
|
const cleanBuf = stripAnsi(scanBuf).replace(/\s+/g, " ");
|
|
37208
37233
|
for (const popup of Object.values(popups)) {
|
|
37209
37234
|
if (popup.handled) continue;
|
|
37210
37235
|
if (popup.regex.test(cleanBuf)) {
|
|
37211
37236
|
popup.handled = true;
|
|
37212
|
-
logger?.debug(`${popup.label} popup auto-yes`);
|
|
37213
|
-
try {
|
|
37214
|
-
pty.write(popup.accept);
|
|
37215
|
-
} catch (err) {
|
|
37216
|
-
logger?.warn(`${popup.label} auto-yes write failed`, {
|
|
37217
|
-
error: err.message
|
|
37218
|
-
});
|
|
37219
|
-
}
|
|
37220
37237
|
scanBuf = "";
|
|
37238
|
+
if (popup.settleMs === 0) press(popup);
|
|
37239
|
+
}
|
|
37240
|
+
}
|
|
37241
|
+
for (const popup of Object.values(popups)) {
|
|
37242
|
+
if (popup.handled && popup.settleMs > 0 && !popup.fired) {
|
|
37243
|
+
if (popup.timer) clearTimeout(popup.timer);
|
|
37244
|
+
popup.timer = setTimeout(() => press(popup), popup.settleMs);
|
|
37221
37245
|
}
|
|
37222
37246
|
}
|
|
37223
37247
|
if (scanBuf.length > 8192) scanBuf = scanBuf.slice(-4096);
|
|
37224
37248
|
},
|
|
37225
37249
|
dispose() {
|
|
37250
|
+
disposed = true;
|
|
37251
|
+
for (const popup of Object.values(popups)) {
|
|
37252
|
+
if (popup.timer) clearTimeout(popup.timer);
|
|
37253
|
+
}
|
|
37226
37254
|
}
|
|
37227
37255
|
};
|
|
37228
37256
|
}
|