local-operator-ui 0.47.1 → 0.47.2
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/out/main/index.js +764 -90
- package/out/renderer/assets/{_basePickBy-cBt3C7Mm.js → _basePickBy-EqA-lyNr.js} +1 -1
- package/out/renderer/assets/{_baseUniq-BPAvTjjw.js → _baseUniq-BLgoOCrk.js} +1 -1
- package/out/renderer/assets/{agent-details-page-B9WQ68z3.js → agent-details-page-2H3QKmn4.js} +1 -1
- package/out/renderer/assets/{agent-hub-page-C-UV58tJ.js → agent-hub-page-C9NPxFvM.js} +1 -1
- package/out/renderer/assets/{agents-page-CSQOyTDS.js → agents-page-BQ52N82v.js} +3 -3
- package/out/renderer/assets/{arc-RoFzSfxq.js → arc-9AYlAgb-.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-KlQWIO4I.js → architectureDiagram-IEHRJDOE-DQdvlWFp.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-CUIG5pQc.js → blockDiagram-JOT3LUYC-BW3miOqQ.js} +1 -1
- package/out/renderer/assets/{book-open-CJGaJB5s.js → book-open-BN9Q0QD0.js} +1 -1
- package/out/renderer/assets/browser-page-Bw_APhwi.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-CH3nbvN4.js → browser-webauthn-prompt-CJWzdqpH.js} +1 -1
- package/out/renderer/assets/{building-2-CbHZ2q0R.js → building-2-DYJ6F3fw.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-BtzkHJj8.js → c4Diagram-VJAJSXHY-DhEmnoe8.js} +1 -1
- package/out/renderer/assets/channel-CSFvOzgB.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-rvmjs7-X.js → chunk-4BMEZGHF-mcXDS2wE.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-CDQJ7DrH.js → chunk-A2AXSNBT-Dq3Y8VUK.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-BblqzOjK.js → chunk-AEK57VVT-DpibnjST.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-CwhcoQLc.js → chunk-D6G4REZN-B_Juz_Ld.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-CeARX8pW.js → chunk-RZ5BOZE2-Cqs_zckD.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-C2Z6kJVH.js → chunk-XZIHB7SX-DuUMP_AP.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-DeVLljAJ.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-DeVLljAJ.js +1 -0
- package/out/renderer/assets/clone-gMaoIpSm.js +1 -0
- package/out/renderer/assets/{console-mirror-Df9e_9IL.js → console-mirror-QYMQ2oMk.js} +1 -1
- package/out/renderer/assets/{consoleCapture-CEWo4h66.js → consoleCapture-BmEfl0qP.js} +1 -1
- package/out/renderer/assets/{conversation-input-sync-BsdkPoIA.js → conversation-input-sync-BXe0XySA.js} +4 -4
- package/out/renderer/assets/{dagre-OKDRZEBW-jshmXRqe.js → dagre-OKDRZEBW-Dh9tNLaI.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-B6z3h0LO.js → diagram-SSKATNLV-By1kP-Qy.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-C1EoDciD.js → diagram-VNBRO52H-DZ2-6zmm.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-cbQwdE8b.js → erDiagram-Q7BY3M3F-hEItxZIQ.js} +1 -1
- package/out/renderer/assets/{error-boundary-ByCPkFsK.js → error-boundary-BMkaJRQG.js} +1 -1
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-bLcnhccs.js → flowDiagram-4HSFHLVR-CSo4rOLb.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-CQ1hiJNI.js → ganttDiagram-APWFNJXF-CJ658-n4.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-Djrozblc.js → gitGraphDiagram-7IBYFJ6S-CXbIBabL.js} +1 -1
- package/out/renderer/assets/{graph-BDU7ZxXp.js → graph-C6bGJrBt.js} +1 -1
- package/out/renderer/assets/{hash-CY36bXoG.js → hash-DiimSDl0.js} +1 -1
- package/out/renderer/assets/{heart-DTUFqrqu.js → heart-CqKaBtlh.js} +1 -1
- package/out/renderer/assets/{image-plus-DmG9Cnvq.js → image-plus-lDPgOpNP.js} +1 -1
- package/out/renderer/assets/{index-Dz49kEuI.js → index-Cl6-DwcF.js} +1 -1
- package/out/renderer/assets/index-DNOzYQss.css +1 -0
- package/out/renderer/assets/{index-BABrThFM.js → index-DonfgCam.js} +4 -4
- package/out/renderer/assets/{index-BwVoBwoc.js → index-Dw40dBjw.js} +1 -1
- package/out/renderer/assets/infoDiagram-PH2N3AL5-VbDpNl_C.js +2 -0
- package/out/renderer/assets/{installer-DBgMBOUt.js → installer-C5WMkCnz.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-B9EaYOUJ.js → journeyDiagram-U35MCT3I-Dxo2XRpD.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-D_w2NByn.js → kanban-definition-NDS4AKOZ-_iR1Keaq.js} +1 -1
- package/out/renderer/assets/{layout-CWAYrBQg.js → layout-DkSGJUjL.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-B9wR_UC9.js → legacy-agents-page-BsTxWWCJ.js} +1 -1
- package/out/renderer/assets/{library-page-D-CE1ZCg.js → library-page-DYuFgJMi.js} +3 -3
- package/out/renderer/assets/{mermaid.core-CynzcDYk.js → mermaid.core-BLqJs5Mm.js} +5 -5
- package/out/renderer/assets/{mesh-page-CR_KErFC.js → mesh-page-CGfJy25z.js} +1 -1
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-BA2W15tE.js → mindmap-definition-ALO5MXBD-DE3jYvdg.js} +1 -1
- package/out/renderer/assets/{mini-BpsHkXJs.js → mini-8paKkmHy.js} +1 -1
- package/out/renderer/assets/{notebook-pen-jwZCAOYl.js → notebook-pen-BO1weM_5.js} +1 -1
- package/out/renderer/assets/{notifications-page-SK5NqB-7.js → notifications-page-CR9hkgko.js} +1 -1
- package/out/renderer/assets/{org-access-Bg27Z8x2.js → org-access-RJercT9z.js} +1 -1
- package/out/renderer/assets/{org-surface-gate-CQxklQ-G.js → org-surface-gate-D0vYcdDx.js} +1 -1
- package/out/renderer/assets/{page-header-BHM4h2fS.js → page-header-DKHWJJoS.js} +1 -1
- package/out/renderer/assets/{path-utils-Bf8RCJbS.js → path-utils-CgkpwzSI.js} +1 -1
- package/out/renderer/assets/{pieDiagram-IB7DONF6-DW77nNiO.js → pieDiagram-IB7DONF6-Bw2WGAQd.js} +1 -1
- package/out/renderer/assets/{project-markdown-BTsnM7OU.js → project-markdown-DP8F_D7W.js} +1 -1
- package/out/renderer/assets/{projects-page-Br5DSkr6.js → projects-page-CAziBDff.js} +1 -1
- package/out/renderer/assets/{publication-validation-BPaO06Dy.js → publication-validation-BTZxXgFZ.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-CDj60YNy.js → quadrantDiagram-7GDLP6J5-NExo9jd9.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-CyccF--S.js → radar-MK3ICKWK-CVdP1QHU.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-BCtJNYf5.js → radient-auth-buttons-x4nqFWHZ.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-sFj0_2m1.js → requirementDiagram-KVF5MWMF-D3iNwTbN.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-DsEIhN9c.js → sankeyDiagram-QLVOVGJD-nrZJ05oE.js} +1 -1
- package/out/renderer/assets/{schedules-page-DAwa60MB.js → schedules-page-D1DyGowS.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-CZ0uz7Vj.js → sequenceDiagram-X6HHIX6F-D-zvwDzx.js} +1 -1
- package/out/renderer/assets/{settings-page-Db00UHjC.js → settings-page-AJ0WetEN.js} +1 -1
- package/out/renderer/assets/{smartart-D5JzCfoV.js → smartart-DIvtzeyi.js} +1 -1
- package/out/renderer/assets/{stateDiagram-DGXRK772-BJy4s7Hy.js → stateDiagram-DGXRK772-Dxg8pb6V.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-BCsjs512.js +1 -0
- package/out/renderer/assets/{team-bridge-page-HYbbsoUb.js → team-bridge-page-D7gX4utS.js} +1 -1
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-rp4x17fE.js → timeline-definition-BDJGKUSR-RuykyZ_l.js} +1 -1
- package/out/renderer/assets/{use-default-on-banner-bwSRinka.js → use-default-on-banner-Bd7U99zb.js} +1 -1
- package/out/renderer/assets/{use-download-agent-mutation-Dgwa2p9-.js → use-download-agent-mutation-C6dhzXX0.js} +1 -1
- package/out/renderer/assets/{use-session-snapshot-QkR7pjNd.js → use-session-snapshot-CLpUx0Y3.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-CDpmuteS.js → xychartDiagram-VJFVF3MP-5ObNWT45.js} +1 -1
- package/out/renderer/console-capture.html +5 -5
- package/out/renderer/index.html +7 -7
- package/out/renderer/installer.html +4 -4
- package/out/renderer/mini.html +7 -7
- package/package.json +2 -2
- package/out/renderer/assets/browser-page-Db4cYtxn.js +0 -1
- package/out/renderer/assets/channel-QUwfyg33.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-BGCwsHyk.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-BGCwsHyk.js +0 -1
- package/out/renderer/assets/clone-B3p2Fvp_.js +0 -1
- package/out/renderer/assets/index-C8UzEgJt.css +0 -1
- package/out/renderer/assets/infoDiagram-PH2N3AL5-C5S1bkLb.js +0 -2
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-DyjFY3o5.js +0 -1
- /package/out/renderer/assets/{index-D312rJYs.js → index--tr15tXr.js} +0 -0
package/out/main/index.js
CHANGED
|
@@ -74386,9 +74386,9 @@ async function resolveLoginShellPath(options = {}) {
|
|
|
74386
74386
|
);
|
|
74387
74387
|
});
|
|
74388
74388
|
try {
|
|
74389
|
-
const
|
|
74390
|
-
if (
|
|
74391
|
-
return
|
|
74389
|
+
const settled2 = await Promise.race([attempt, expired]);
|
|
74390
|
+
if (settled2 === "timeout") return { ok: false, reason: "timeout", shell };
|
|
74391
|
+
return settled2;
|
|
74392
74392
|
} finally {
|
|
74393
74393
|
if (timer) clearTimeout(timer);
|
|
74394
74394
|
}
|
|
@@ -75827,15 +75827,15 @@ function runBounded(command, args, env, bounds) {
|
|
|
75827
75827
|
child.stderr?.on("data", (chunk) => {
|
|
75828
75828
|
stderr += chunk.toString();
|
|
75829
75829
|
});
|
|
75830
|
-
let
|
|
75830
|
+
let settled2 = false;
|
|
75831
75831
|
let timedOut = false;
|
|
75832
75832
|
const timers = [];
|
|
75833
|
-
const settle2 = (
|
|
75834
|
-
if (
|
|
75835
|
-
|
|
75833
|
+
const settle2 = (finish2) => {
|
|
75834
|
+
if (settled2) return;
|
|
75835
|
+
settled2 = true;
|
|
75836
75836
|
for (const timer of timers) clearTimeout(timer);
|
|
75837
75837
|
timers.length = 0;
|
|
75838
|
-
|
|
75838
|
+
finish2();
|
|
75839
75839
|
};
|
|
75840
75840
|
timers.push(
|
|
75841
75841
|
setTimeout(() => {
|
|
@@ -80977,15 +80977,15 @@ ${result.stdout}`,
|
|
|
80977
80977
|
* into whichever generation the last retry left behind.
|
|
80978
80978
|
*/
|
|
80979
80979
|
async runInstallScript(venvPath, cmd, args) {
|
|
80980
|
-
let
|
|
80980
|
+
let settled2 = false;
|
|
80981
80981
|
return new Promise((resolve) => {
|
|
80982
80982
|
let captured = "";
|
|
80983
80983
|
let capturedErrors = "";
|
|
80984
80984
|
let markerCarry = "";
|
|
80985
80985
|
let subCarry = "";
|
|
80986
80986
|
const settle2 = (ok, exitCode) => {
|
|
80987
|
-
if (
|
|
80988
|
-
|
|
80987
|
+
if (settled2) return;
|
|
80988
|
+
settled2 = true;
|
|
80989
80989
|
resolve({ ok, exitCode, stdout: captured, stderr: capturedErrors });
|
|
80990
80990
|
};
|
|
80991
80991
|
try {
|
|
@@ -81174,6 +81174,9 @@ const METHODS$1 = [
|
|
|
81174
81174
|
"screenshot",
|
|
81175
81175
|
"click",
|
|
81176
81176
|
"type",
|
|
81177
|
+
// Trusted desktop key input; the core mirror must add this at the same
|
|
81178
|
+
// position because this list is the closed admission gate, not discovery.
|
|
81179
|
+
"press",
|
|
81177
81180
|
"close",
|
|
81178
81181
|
"status",
|
|
81179
81182
|
"tabs",
|
|
@@ -81215,7 +81218,12 @@ const METHODS$1 = [
|
|
|
81215
81218
|
"network_start",
|
|
81216
81219
|
"network_stop",
|
|
81217
81220
|
"network_read",
|
|
81218
|
-
"network_clear"
|
|
81221
|
+
"network_clear",
|
|
81222
|
+
// Desktop-only video recording. Appended after the network family in the order
|
|
81223
|
+
// `protocol.py`'s METHODS tuple carries them, so the hand-kept mirror stays
|
|
81224
|
+
// comparable by eye (D8).
|
|
81225
|
+
"record_start",
|
|
81226
|
+
"record_stop"
|
|
81219
81227
|
];
|
|
81220
81228
|
const METHOD_SET = new Set(METHODS$1);
|
|
81221
81229
|
function isMethod(value) {
|
|
@@ -81248,6 +81256,8 @@ const ERROR_CODES = [
|
|
|
81248
81256
|
// direction (daemon -> session), a browser host is not, which is exactly why a
|
|
81249
81257
|
// policy refusal travels as an `ok: true` result here.
|
|
81250
81258
|
"capability_unsupported",
|
|
81259
|
+
// Paired with the core press follow-up before callers use this new method.
|
|
81260
|
+
"unsupported_key",
|
|
81251
81261
|
"internal",
|
|
81252
81262
|
// The console namespace's own additions (design 10.6). Spread rather than copied
|
|
81253
81263
|
// for the same reason METHODS is: this list is what `rpc.ts` narrows a raised
|
|
@@ -81264,6 +81274,9 @@ const HOST_CAPABILITIES = [
|
|
|
81264
81274
|
"query",
|
|
81265
81275
|
"download",
|
|
81266
81276
|
"upload",
|
|
81277
|
+
// Desktop-only trusted keys. Core must capability-gate extension/cmux and
|
|
81278
|
+
// older desktop hosts instead of sending them an unknown method.
|
|
81279
|
+
"press",
|
|
81267
81280
|
// Session-scoped network capture. DESKTOP-ONLY: the extension's debugger is
|
|
81268
81281
|
// attached only for the duration of an action, so it holds no standing session
|
|
81269
81282
|
// to keep a `Network` subscription on. The backend therefore gates these four
|
|
@@ -81271,7 +81284,13 @@ const HOST_CAPABILITIES = [
|
|
|
81271
81284
|
"network_start",
|
|
81272
81285
|
"network_stop",
|
|
81273
81286
|
"network_read",
|
|
81274
|
-
"network_clear"
|
|
81287
|
+
"network_clear",
|
|
81288
|
+
// Video recording is served by this host build because it ships on a runtime
|
|
81289
|
+
// with `Page.startScreenRecording` (D8): the Electron bump is the ordering
|
|
81290
|
+
// PR-A owns, so a build that predates the bump advertises nothing it cannot
|
|
81291
|
+
// do.
|
|
81292
|
+
"record_start",
|
|
81293
|
+
"record_stop"
|
|
81275
81294
|
];
|
|
81276
81295
|
const RUN_DIRNAME = path$1.join("run", "ui-browser");
|
|
81277
81296
|
const STATE_FILENAME = "host.json";
|
|
@@ -89219,7 +89238,7 @@ class ConsoleCaptureView {
|
|
|
89219
89238
|
for (let attempt = 1; attempt <= 2; attempt++) {
|
|
89220
89239
|
this.feedSeq += 1;
|
|
89221
89240
|
const nonce = this.feedSeq;
|
|
89222
|
-
const
|
|
89241
|
+
const settled2 = await waitForCapture(
|
|
89223
89242
|
contents,
|
|
89224
89243
|
"console-capture-settled",
|
|
89225
89244
|
() => contents.send("console-capture-feed", {
|
|
@@ -89233,7 +89252,7 @@ class ConsoleCaptureView {
|
|
|
89233
89252
|
this.options.settleTimeoutMs
|
|
89234
89253
|
);
|
|
89235
89254
|
const renderer = stringOr(
|
|
89236
|
-
|
|
89255
|
+
settled2.renderer,
|
|
89237
89256
|
"unknown"
|
|
89238
89257
|
);
|
|
89239
89258
|
if (renderer !== "dom") {
|
|
@@ -97867,6 +97886,543 @@ function stopNetworkCapture(webContentsId) {
|
|
|
97867
97886
|
capture.unsubscribe();
|
|
97868
97887
|
captures.delete(webContentsId);
|
|
97869
97888
|
}
|
|
97889
|
+
const CDP_DEADLINE_MS = 15e3;
|
|
97890
|
+
const CDP_ATTACH_DEADLINE_MS = 5e3;
|
|
97891
|
+
const SCRIPTING_DEADLINE_MS = 15e3;
|
|
97892
|
+
function deadline(op, ms, what) {
|
|
97893
|
+
return new Promise((resolve, reject) => {
|
|
97894
|
+
const timer = setTimeout(() => {
|
|
97895
|
+
reject(
|
|
97896
|
+
new BridgeCommandError("internal", `${what} did not respond within ${ms}ms`, {
|
|
97897
|
+
stalled: what
|
|
97898
|
+
})
|
|
97899
|
+
);
|
|
97900
|
+
}, ms);
|
|
97901
|
+
op.then(
|
|
97902
|
+
(value) => {
|
|
97903
|
+
clearTimeout(timer);
|
|
97904
|
+
resolve(value);
|
|
97905
|
+
},
|
|
97906
|
+
(error) => {
|
|
97907
|
+
clearTimeout(timer);
|
|
97908
|
+
reject(error);
|
|
97909
|
+
}
|
|
97910
|
+
);
|
|
97911
|
+
});
|
|
97912
|
+
}
|
|
97913
|
+
const RECORD_WIDTH = 1280;
|
|
97914
|
+
const RECORD_HEIGHT = 720;
|
|
97915
|
+
const RECORD_FPS = 10;
|
|
97916
|
+
const MAX_NAME_BYTES$1 = 255;
|
|
97917
|
+
const RECORD_DEFAULT_DURATION_S = 120;
|
|
97918
|
+
const RECORD_MAX_DURATION_S = 600;
|
|
97919
|
+
const RECORD_MAX_BYTES = 64 * 1024 * 1024;
|
|
97920
|
+
const MAX_CONCURRENT_RECORDINGS = 2;
|
|
97921
|
+
const RECORD_START_DEADLINE_MS = 2e4;
|
|
97922
|
+
const RECORD_STOP_DEADLINE_MS = 2e4;
|
|
97923
|
+
const RECORD_STOP_BUDGET_MS = 45e3;
|
|
97924
|
+
const RECORD_ABORT_DEADLINE_MS = 2e3;
|
|
97925
|
+
const RECORD_READ_BYTES = 1024 * 1024;
|
|
97926
|
+
const RECORD_FIRST_CHROMIUM_MAJOR = 153;
|
|
97927
|
+
const recordings = /* @__PURE__ */ new Map();
|
|
97928
|
+
const settled = /* @__PURE__ */ new Map();
|
|
97929
|
+
const reservations = /* @__PURE__ */ new Map();
|
|
97930
|
+
function notActive() {
|
|
97931
|
+
return new BridgeCommandError(
|
|
97932
|
+
"internal",
|
|
97933
|
+
"no recording is running on this tab for this requester; start one with record_start",
|
|
97934
|
+
{ reason: "record_not_active" }
|
|
97935
|
+
);
|
|
97936
|
+
}
|
|
97937
|
+
function abortedWhileSaving() {
|
|
97938
|
+
return new BridgeCommandError(
|
|
97939
|
+
"internal",
|
|
97940
|
+
"the recording was discarded while it was being saved; nothing was written",
|
|
97941
|
+
{ reason: "record_aborted" }
|
|
97942
|
+
);
|
|
97943
|
+
}
|
|
97944
|
+
function typedFailure(error) {
|
|
97945
|
+
if (error instanceof BridgeCommandError) return error;
|
|
97946
|
+
return new BridgeCommandError(
|
|
97947
|
+
"internal",
|
|
97948
|
+
error instanceof Error ? error.message : String(error),
|
|
97949
|
+
{ reason: "record_failed" }
|
|
97950
|
+
);
|
|
97951
|
+
}
|
|
97952
|
+
function chromiumMajor() {
|
|
97953
|
+
const version = process.versions.chrome ?? "";
|
|
97954
|
+
const major = Number.parseInt(version.split(".")[0] ?? "", 10);
|
|
97955
|
+
return Number.isFinite(major) ? major : 0;
|
|
97956
|
+
}
|
|
97957
|
+
function pathRefusal(path2, detail) {
|
|
97958
|
+
return new BridgeCommandError("internal", detail, {
|
|
97959
|
+
reason: "record_path",
|
|
97960
|
+
path: path2
|
|
97961
|
+
});
|
|
97962
|
+
}
|
|
97963
|
+
function preflightPath(params) {
|
|
97964
|
+
const path2 = stringParam(params, "path");
|
|
97965
|
+
if (!path2) {
|
|
97966
|
+
throw pathRefusal(
|
|
97967
|
+
"",
|
|
97968
|
+
"record_start requires the harness-chosen output path: an absolute path ending in .mp4"
|
|
97969
|
+
);
|
|
97970
|
+
}
|
|
97971
|
+
if (!path$1.isAbsolute(path2)) {
|
|
97972
|
+
throw pathRefusal(path2, `the recording path must be absolute: ${path2}`);
|
|
97973
|
+
}
|
|
97974
|
+
const name = path$1.basename(path2);
|
|
97975
|
+
if (!name.toLowerCase().endsWith(".mp4") || name.length === ".mp4".length) {
|
|
97976
|
+
throw pathRefusal(path2, `the recording path must end in .mp4: ${path2}`);
|
|
97977
|
+
}
|
|
97978
|
+
if (Buffer.byteLength(`.${name}.part`, "utf8") > MAX_NAME_BYTES$1) {
|
|
97979
|
+
throw pathRefusal(
|
|
97980
|
+
path2,
|
|
97981
|
+
`the recording file name is too long: it must be at most ${MAX_NAME_BYTES$1 - 6} bytes, so that its temporary ".part" file also fits`
|
|
97982
|
+
);
|
|
97983
|
+
}
|
|
97984
|
+
const dir = path$1.dirname(path2);
|
|
97985
|
+
let parentIsDirectory = false;
|
|
97986
|
+
try {
|
|
97987
|
+
parentIsDirectory = fs.statSync(dir).isDirectory();
|
|
97988
|
+
} catch {
|
|
97989
|
+
parentIsDirectory = false;
|
|
97990
|
+
}
|
|
97991
|
+
if (!parentIsDirectory) {
|
|
97992
|
+
throw pathRefusal(
|
|
97993
|
+
path2,
|
|
97994
|
+
`the recording path's parent directory does not exist or is not a directory: ${dir}`
|
|
97995
|
+
);
|
|
97996
|
+
}
|
|
97997
|
+
try {
|
|
97998
|
+
fs.accessSync(dir, fs.constants.W_OK);
|
|
97999
|
+
} catch {
|
|
98000
|
+
throw pathRefusal(
|
|
98001
|
+
path2,
|
|
98002
|
+
`the recording path's parent directory is not writable: ${dir}`
|
|
98003
|
+
);
|
|
98004
|
+
}
|
|
98005
|
+
let present = true;
|
|
98006
|
+
try {
|
|
98007
|
+
fs.lstatSync(path2);
|
|
98008
|
+
} catch {
|
|
98009
|
+
present = false;
|
|
98010
|
+
}
|
|
98011
|
+
if (present) {
|
|
98012
|
+
throw pathRefusal(
|
|
98013
|
+
path2,
|
|
98014
|
+
`the recording path already exists and is never overwritten: ${path2}`
|
|
98015
|
+
);
|
|
98016
|
+
}
|
|
98017
|
+
return path2;
|
|
98018
|
+
}
|
|
98019
|
+
function durationOf(params) {
|
|
98020
|
+
const raw = params.max_duration_s;
|
|
98021
|
+
if (raw === void 0) return RECORD_DEFAULT_DURATION_S;
|
|
98022
|
+
const seconds = Number(raw);
|
|
98023
|
+
if (!Number.isInteger(seconds) || seconds < 1 || seconds > RECORD_MAX_DURATION_S) {
|
|
98024
|
+
throw new BridgeCommandError(
|
|
98025
|
+
"internal",
|
|
98026
|
+
`record_start max_duration_s takes WHOLE SECONDS only: give an integer from 1 to ${RECORD_MAX_DURATION_S}. Nothing was started.`,
|
|
98027
|
+
{ reason: "record_failed", param: "max_duration_s" }
|
|
98028
|
+
);
|
|
98029
|
+
}
|
|
98030
|
+
return seconds;
|
|
98031
|
+
}
|
|
98032
|
+
function maxBytesOf(params) {
|
|
98033
|
+
const raw = params.max_bytes;
|
|
98034
|
+
if (raw === void 0) return RECORD_MAX_BYTES;
|
|
98035
|
+
const bytes = Number(raw);
|
|
98036
|
+
if (!Number.isInteger(bytes) || bytes < 1 || bytes > RECORD_MAX_BYTES) {
|
|
98037
|
+
throw new BridgeCommandError(
|
|
98038
|
+
"internal",
|
|
98039
|
+
`record_start max_bytes must be a whole number of bytes from 1 to ${RECORD_MAX_BYTES}; nothing was started`,
|
|
98040
|
+
{ reason: "record_failed", param: "max_bytes" }
|
|
98041
|
+
);
|
|
98042
|
+
}
|
|
98043
|
+
return bytes;
|
|
98044
|
+
}
|
|
98045
|
+
function capWords(bytes) {
|
|
98046
|
+
return bytes >= 1024 * 1024 ? `${Math.floor(bytes / (1024 * 1024))} MiB` : `${Math.round(bytes / 1024)} KiB`;
|
|
98047
|
+
}
|
|
98048
|
+
function classifyStartFailure(error) {
|
|
98049
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
98050
|
+
const major = chromiumMajor();
|
|
98051
|
+
if (major > 0 && major < RECORD_FIRST_CHROMIUM_MAJOR) {
|
|
98052
|
+
return new BridgeCommandError(
|
|
98053
|
+
"internal",
|
|
98054
|
+
`the desktop app's browser engine (Chromium ${major}) has no video recording; it needs Chromium ${RECORD_FIRST_CHROMIUM_MAJOR} or newer. Update the desktop app and retry. Screenshots still work. Nothing was written.`,
|
|
98055
|
+
{ reason: "record_unsupported", chromium: major }
|
|
98056
|
+
);
|
|
98057
|
+
}
|
|
98058
|
+
if (/AV1\/libaom|libaom/i.test(message)) {
|
|
98059
|
+
return new BridgeCommandError(
|
|
98060
|
+
"internal",
|
|
98061
|
+
"this browser engine build cannot encode AV1, which video recording needs. Nothing was written.",
|
|
98062
|
+
{ reason: "record_av1_unavailable", detail: message }
|
|
98063
|
+
);
|
|
98064
|
+
}
|
|
98065
|
+
if (/not found|wasn't found|was not found|unknown method|-32601/i.test(message)) {
|
|
98066
|
+
return new BridgeCommandError(
|
|
98067
|
+
"internal",
|
|
98068
|
+
`this browser engine has no video recording (${message}); it needs Chromium ${RECORD_FIRST_CHROMIUM_MAJOR} or newer. Nothing was written.`,
|
|
98069
|
+
{ reason: "record_unsupported", detail: message }
|
|
98070
|
+
);
|
|
98071
|
+
}
|
|
98072
|
+
return new BridgeCommandError("internal", message, {
|
|
98073
|
+
reason: "record_failed"
|
|
98074
|
+
});
|
|
98075
|
+
}
|
|
98076
|
+
function captureShape() {
|
|
98077
|
+
return {
|
|
98078
|
+
fps: RECORD_FPS,
|
|
98079
|
+
container: "mp4",
|
|
98080
|
+
codec: "av1"
|
|
98081
|
+
};
|
|
98082
|
+
}
|
|
98083
|
+
async function readStream(recording, handle2, budgetAt, fd) {
|
|
98084
|
+
let bytes = 0;
|
|
98085
|
+
for (; ; ) {
|
|
98086
|
+
if (recording.aborted) throw abortedWhileSaving();
|
|
98087
|
+
if (Date.now() > budgetAt) {
|
|
98088
|
+
throw new BridgeCommandError(
|
|
98089
|
+
"internal",
|
|
98090
|
+
`the recording did not finish within ${RECORD_STOP_BUDGET_MS / 1e3} s; nothing was saved`,
|
|
98091
|
+
{ reason: "record_failed" }
|
|
98092
|
+
);
|
|
98093
|
+
}
|
|
98094
|
+
const remaining = recording.maxBytes - bytes;
|
|
98095
|
+
const page = await recording.cdp.send(
|
|
98096
|
+
recording.contents,
|
|
98097
|
+
"IO.read",
|
|
98098
|
+
{ handle: handle2, size: Math.min(RECORD_READ_BYTES, remaining + 1) },
|
|
98099
|
+
{ deadlineMs: CDP_DEADLINE_MS }
|
|
98100
|
+
);
|
|
98101
|
+
const data = typeof page?.data === "string" ? page.data : "";
|
|
98102
|
+
const chunk = data ? Buffer.from(data, page?.base64Encoded === false ? "utf8" : "base64") : Buffer.alloc(0);
|
|
98103
|
+
if (chunk.length > 0) {
|
|
98104
|
+
fs.writeSync(fd, chunk);
|
|
98105
|
+
bytes += chunk.length;
|
|
98106
|
+
}
|
|
98107
|
+
if (bytes > recording.maxBytes) {
|
|
98108
|
+
throw new BridgeCommandError(
|
|
98109
|
+
"internal",
|
|
98110
|
+
`the recording is larger than ${capWords(recording.maxBytes)}; nothing was saved. Record a shorter span (timeout_s) and retry.`,
|
|
98111
|
+
{ reason: "record_too_large", max_bytes: recording.maxBytes }
|
|
98112
|
+
);
|
|
98113
|
+
}
|
|
98114
|
+
if (page?.eof === true || chunk.length === 0) break;
|
|
98115
|
+
}
|
|
98116
|
+
return bytes;
|
|
98117
|
+
}
|
|
98118
|
+
async function runFinalize(recording, autoStopped) {
|
|
98119
|
+
const { contents, cdp, path: path2, partPath } = recording;
|
|
98120
|
+
const budgetAt = Date.now() + RECORD_STOP_BUDGET_MS;
|
|
98121
|
+
let handle2 = "";
|
|
98122
|
+
let fd = null;
|
|
98123
|
+
let createdPart = false;
|
|
98124
|
+
let endedAt = recording.startedAt;
|
|
98125
|
+
try {
|
|
98126
|
+
const stopped = await cdp.send(
|
|
98127
|
+
contents,
|
|
98128
|
+
"Page.stopScreenRecording",
|
|
98129
|
+
{},
|
|
98130
|
+
{ deadlineMs: RECORD_STOP_DEADLINE_MS }
|
|
98131
|
+
);
|
|
98132
|
+
endedAt = Date.now();
|
|
98133
|
+
handle2 = typeof stopped?.stream === "string" ? stopped.stream : "";
|
|
98134
|
+
if (recording.aborted) throw abortedWhileSaving();
|
|
98135
|
+
if (!handle2) {
|
|
98136
|
+
throw new BridgeCommandError(
|
|
98137
|
+
"internal",
|
|
98138
|
+
"the browser engine returned no recording stream; nothing was saved",
|
|
98139
|
+
{ reason: "record_failed" }
|
|
98140
|
+
);
|
|
98141
|
+
}
|
|
98142
|
+
fd = fs.openSync(partPath, "wx", 384);
|
|
98143
|
+
createdPart = true;
|
|
98144
|
+
const bytes = await readStream(recording, handle2, budgetAt, fd);
|
|
98145
|
+
if (bytes === 0) {
|
|
98146
|
+
throw new BridgeCommandError(
|
|
98147
|
+
"internal",
|
|
98148
|
+
"the recording produced no bytes; nothing was saved",
|
|
98149
|
+
{ reason: "record_failed" }
|
|
98150
|
+
);
|
|
98151
|
+
}
|
|
98152
|
+
if (recording.aborted) throw abortedWhileSaving();
|
|
98153
|
+
fs.fsyncSync(fd);
|
|
98154
|
+
fs.closeSync(fd);
|
|
98155
|
+
fd = null;
|
|
98156
|
+
try {
|
|
98157
|
+
fs.linkSync(partPath, path2);
|
|
98158
|
+
} catch (error) {
|
|
98159
|
+
const code = error?.code;
|
|
98160
|
+
if (code === "EEXIST") {
|
|
98161
|
+
throw pathRefusal(
|
|
98162
|
+
path2,
|
|
98163
|
+
`the recording path appeared while recording and is never overwritten: ${path2}`
|
|
98164
|
+
);
|
|
98165
|
+
}
|
|
98166
|
+
throw error;
|
|
98167
|
+
}
|
|
98168
|
+
try {
|
|
98169
|
+
fs.unlinkSync(partPath);
|
|
98170
|
+
} catch {
|
|
98171
|
+
}
|
|
98172
|
+
return {
|
|
98173
|
+
path: path2,
|
|
98174
|
+
bytes,
|
|
98175
|
+
duration_ms: endedAt - recording.startedAt,
|
|
98176
|
+
auto_stopped: autoStopped,
|
|
98177
|
+
...captureShape()
|
|
98178
|
+
};
|
|
98179
|
+
} catch (error) {
|
|
98180
|
+
throw typedFailure(error);
|
|
98181
|
+
} finally {
|
|
98182
|
+
if (fd !== null) {
|
|
98183
|
+
try {
|
|
98184
|
+
fs.closeSync(fd);
|
|
98185
|
+
} catch {
|
|
98186
|
+
}
|
|
98187
|
+
}
|
|
98188
|
+
if (createdPart) {
|
|
98189
|
+
try {
|
|
98190
|
+
fs.unlinkSync(partPath);
|
|
98191
|
+
} catch {
|
|
98192
|
+
}
|
|
98193
|
+
}
|
|
98194
|
+
if (handle2) {
|
|
98195
|
+
try {
|
|
98196
|
+
await cdp.send(
|
|
98197
|
+
contents,
|
|
98198
|
+
"IO.close",
|
|
98199
|
+
{ handle: handle2 },
|
|
98200
|
+
{ deadlineMs: CDP_DEADLINE_MS }
|
|
98201
|
+
);
|
|
98202
|
+
} catch {
|
|
98203
|
+
}
|
|
98204
|
+
}
|
|
98205
|
+
}
|
|
98206
|
+
}
|
|
98207
|
+
function settle$1(webContentsId, recording, outcome) {
|
|
98208
|
+
if (recordings.get(webContentsId) === recording) {
|
|
98209
|
+
recordings.delete(webContentsId);
|
|
98210
|
+
}
|
|
98211
|
+
if (recording.timer !== void 0) {
|
|
98212
|
+
clearTimeout(recording.timer);
|
|
98213
|
+
recording.timer = void 0;
|
|
98214
|
+
}
|
|
98215
|
+
if (recording.aborted) return;
|
|
98216
|
+
settled.set(webContentsId, { owner: recording.owner, ...outcome });
|
|
98217
|
+
}
|
|
98218
|
+
async function endReplaced(recording) {
|
|
98219
|
+
try {
|
|
98220
|
+
await recording.cdp.attach(recording.contents).catch(() => void 0);
|
|
98221
|
+
const stopped = await recording.cdp.send(
|
|
98222
|
+
recording.contents,
|
|
98223
|
+
"Page.stopScreenRecording",
|
|
98224
|
+
{},
|
|
98225
|
+
{ deadlineMs: RECORD_ABORT_DEADLINE_MS }
|
|
98226
|
+
);
|
|
98227
|
+
const handle2 = typeof stopped?.stream === "string" ? stopped.stream : "";
|
|
98228
|
+
if (handle2) {
|
|
98229
|
+
await recording.cdp.send(
|
|
98230
|
+
recording.contents,
|
|
98231
|
+
"IO.close",
|
|
98232
|
+
{ handle: handle2 },
|
|
98233
|
+
{ deadlineMs: RECORD_ABORT_DEADLINE_MS }
|
|
98234
|
+
).catch(() => void 0);
|
|
98235
|
+
}
|
|
98236
|
+
} catch {
|
|
98237
|
+
}
|
|
98238
|
+
}
|
|
98239
|
+
async function abortAndEnd(webContentsId, reason) {
|
|
98240
|
+
const recording = recordings.get(webContentsId);
|
|
98241
|
+
if (!recording) {
|
|
98242
|
+
abortRecording(webContentsId, reason);
|
|
98243
|
+
return;
|
|
98244
|
+
}
|
|
98245
|
+
abortRecording(webContentsId, reason);
|
|
98246
|
+
await endReplaced(recording);
|
|
98247
|
+
}
|
|
98248
|
+
function finish(webContentsId, recording, autoStopped) {
|
|
98249
|
+
if (!recording.finishing) {
|
|
98250
|
+
recording.finishing = runFinalize(recording, autoStopped);
|
|
98251
|
+
void recording.finishing.then(
|
|
98252
|
+
(result) => settle$1(webContentsId, recording, { result }),
|
|
98253
|
+
(error) => settle$1(webContentsId, recording, { error: typedFailure(error) })
|
|
98254
|
+
);
|
|
98255
|
+
}
|
|
98256
|
+
return recording.finishing;
|
|
98257
|
+
}
|
|
98258
|
+
async function recordStart(ctx, params, requestId2) {
|
|
98259
|
+
const tab = ctx.registry.requireSurface(String(params.tab ?? ""));
|
|
98260
|
+
const contents = tab.view.webContents;
|
|
98261
|
+
const id2 = contents.id;
|
|
98262
|
+
const owner = requesterOf(params, requestId2);
|
|
98263
|
+
const active = recordings.get(id2);
|
|
98264
|
+
if (active) {
|
|
98265
|
+
if (active.owner === owner) {
|
|
98266
|
+
const ageMs = Math.max(0, Math.round(Date.now() - active.startedAt));
|
|
98267
|
+
throw new BridgeCommandError(
|
|
98268
|
+
"busy",
|
|
98269
|
+
`a recording is already running on this tab for this session: ${active.path} (${Math.round(ageMs / 1e3)}s into its ${active.maxDurationS}s cap). Stop it with record_stop before starting another.`,
|
|
98270
|
+
{ reason: "record_active", path: active.path, age_ms: ageMs }
|
|
98271
|
+
);
|
|
98272
|
+
}
|
|
98273
|
+
}
|
|
98274
|
+
const path2 = preflightPath(params);
|
|
98275
|
+
const maxDurationS = durationOf(params);
|
|
98276
|
+
const maxBytes = maxBytesOf(params);
|
|
98277
|
+
const inFlight = [...reservations.values()].some(
|
|
98278
|
+
(entry2) => entry2.webContentsId === id2
|
|
98279
|
+
);
|
|
98280
|
+
if (inFlight) {
|
|
98281
|
+
throw new BridgeCommandError(
|
|
98282
|
+
"busy",
|
|
98283
|
+
"a recording is already starting on this tab; wait for that start to finish, then use record_stop before starting another. Nothing was started twice.",
|
|
98284
|
+
{ reason: "record_active", path: path2 }
|
|
98285
|
+
);
|
|
98286
|
+
}
|
|
98287
|
+
const canonicalPath2 = path$1.resolve(path2);
|
|
98288
|
+
const pathTaken = [...recordings.values()].some(
|
|
98289
|
+
(other) => path$1.resolve(other.path) === canonicalPath2
|
|
98290
|
+
) || [...reservations.values()].some(
|
|
98291
|
+
(entry2) => path$1.resolve(entry2.path) === canonicalPath2
|
|
98292
|
+
);
|
|
98293
|
+
if (pathTaken) {
|
|
98294
|
+
throw pathRefusal(
|
|
98295
|
+
path2,
|
|
98296
|
+
`this path is already being recorded: ${path2}. Choose another name; a recording is never overwritten or shared.`
|
|
98297
|
+
);
|
|
98298
|
+
}
|
|
98299
|
+
const effective = recordings.size - (active ? 1 : 0) + reservations.size;
|
|
98300
|
+
if (effective >= MAX_CONCURRENT_RECORDINGS) {
|
|
98301
|
+
throw new BridgeCommandError(
|
|
98302
|
+
"busy",
|
|
98303
|
+
`${MAX_CONCURRENT_RECORDINGS} recordings are already running, which is this host's cap; stop one with record_stop and retry. Nothing was started.`,
|
|
98304
|
+
{ reason: "record_limit", limit: MAX_CONCURRENT_RECORDINGS }
|
|
98305
|
+
);
|
|
98306
|
+
}
|
|
98307
|
+
if (active) {
|
|
98308
|
+
abortRecording(id2, "replaced_by_another_owner");
|
|
98309
|
+
}
|
|
98310
|
+
const reservation = `${Date.now()}-${Math.random()}`;
|
|
98311
|
+
const entry = { webContentsId: id2, path: path2, cancelled: false };
|
|
98312
|
+
reservations.set(reservation, entry);
|
|
98313
|
+
let started = false;
|
|
98314
|
+
try {
|
|
98315
|
+
if (active) await endReplaced(active);
|
|
98316
|
+
await ctx.cdp.attach(contents);
|
|
98317
|
+
try {
|
|
98318
|
+
await ctx.cdp.send(
|
|
98319
|
+
contents,
|
|
98320
|
+
"Page.startScreenRecording",
|
|
98321
|
+
{
|
|
98322
|
+
audio: false,
|
|
98323
|
+
maxWidth: RECORD_WIDTH,
|
|
98324
|
+
maxHeight: RECORD_HEIGHT,
|
|
98325
|
+
frameRate: RECORD_FPS
|
|
98326
|
+
},
|
|
98327
|
+
{ deadlineMs: RECORD_START_DEADLINE_MS }
|
|
98328
|
+
);
|
|
98329
|
+
started = true;
|
|
98330
|
+
} catch (error) {
|
|
98331
|
+
throw classifyStartFailure(error);
|
|
98332
|
+
}
|
|
98333
|
+
} catch (error) {
|
|
98334
|
+
reservations.delete(reservation);
|
|
98335
|
+
throw error;
|
|
98336
|
+
}
|
|
98337
|
+
if (entry.cancelled) {
|
|
98338
|
+
reservations.delete(reservation);
|
|
98339
|
+
if (started) await endReplaced({ cdp: ctx.cdp, contents });
|
|
98340
|
+
throw new BridgeCommandError(
|
|
98341
|
+
"internal",
|
|
98342
|
+
"that browser tab was released while the recording was starting; nothing was saved. Use 'open' with a URL to get a new tab.",
|
|
98343
|
+
{ reason: "record_failed" }
|
|
98344
|
+
);
|
|
98345
|
+
}
|
|
98346
|
+
const recording = {
|
|
98347
|
+
owner,
|
|
98348
|
+
contents,
|
|
98349
|
+
cdp: ctx.cdp,
|
|
98350
|
+
path: path2,
|
|
98351
|
+
partPath: `${path$1.dirname(path2)}/.${path$1.basename(path2)}.part`,
|
|
98352
|
+
startedAt: Date.now(),
|
|
98353
|
+
maxBytes,
|
|
98354
|
+
maxDurationS,
|
|
98355
|
+
timer: void 0,
|
|
98356
|
+
finishing: null,
|
|
98357
|
+
aborted: false
|
|
98358
|
+
};
|
|
98359
|
+
recordings.set(id2, recording);
|
|
98360
|
+
reservations.delete(reservation);
|
|
98361
|
+
recording.timer = setTimeout(() => {
|
|
98362
|
+
void finish(id2, recording, true).catch(() => void 0);
|
|
98363
|
+
}, maxDurationS * 1e3);
|
|
98364
|
+
recording.timer.unref?.();
|
|
98365
|
+
return {
|
|
98366
|
+
recording: true,
|
|
98367
|
+
path: path2,
|
|
98368
|
+
max_duration_s: maxDurationS,
|
|
98369
|
+
max_bytes: maxBytes,
|
|
98370
|
+
...captureShape()
|
|
98371
|
+
};
|
|
98372
|
+
}
|
|
98373
|
+
async function recordStop(ctx, params, requestId2) {
|
|
98374
|
+
const tab = ctx.registry.requireSurface(String(params.tab ?? ""));
|
|
98375
|
+
const id2 = tab.view.webContents.id;
|
|
98376
|
+
const owner = requesterOf(params, requestId2);
|
|
98377
|
+
const recording = recordings.get(id2);
|
|
98378
|
+
if (recording) {
|
|
98379
|
+
if (recording.owner !== owner) throw notActive();
|
|
98380
|
+
try {
|
|
98381
|
+
return await finish(id2, recording, false);
|
|
98382
|
+
} finally {
|
|
98383
|
+
settled.delete(id2);
|
|
98384
|
+
}
|
|
98385
|
+
}
|
|
98386
|
+
const pending = settled.get(id2);
|
|
98387
|
+
if (settled.has(id2) && pending?.owner === owner) {
|
|
98388
|
+
settled.delete(id2);
|
|
98389
|
+
if ("error" in pending) throw pending.error;
|
|
98390
|
+
return pending.result;
|
|
98391
|
+
}
|
|
98392
|
+
throw notActive();
|
|
98393
|
+
}
|
|
98394
|
+
function detachExplanation() {
|
|
98395
|
+
return "The debugger connection to the tab ended (the page went away, or DevTools took it)";
|
|
98396
|
+
}
|
|
98397
|
+
function abortRecording(webContentsId, reason, options = {}) {
|
|
98398
|
+
for (const [token, entry] of reservations) {
|
|
98399
|
+
if (entry.webContentsId === webContentsId) {
|
|
98400
|
+
entry.cancelled = true;
|
|
98401
|
+
reservations.delete(token);
|
|
98402
|
+
}
|
|
98403
|
+
}
|
|
98404
|
+
const recording = recordings.get(webContentsId);
|
|
98405
|
+
if (recording) {
|
|
98406
|
+
recording.aborted = true;
|
|
98407
|
+
if (recording.timer !== void 0) {
|
|
98408
|
+
clearTimeout(recording.timer);
|
|
98409
|
+
recording.timer = void 0;
|
|
98410
|
+
}
|
|
98411
|
+
recordings.delete(webContentsId);
|
|
98412
|
+
}
|
|
98413
|
+
if (options.tombstone && recording) {
|
|
98414
|
+
settled.set(webContentsId, {
|
|
98415
|
+
owner: recording.owner,
|
|
98416
|
+
error: new BridgeCommandError(
|
|
98417
|
+
"internal",
|
|
98418
|
+
`${detachExplanation()}; the recording was discarded (${reason}). Nothing was written.`,
|
|
98419
|
+
{ reason: "record_aborted", detail: reason }
|
|
98420
|
+
)
|
|
98421
|
+
});
|
|
98422
|
+
return;
|
|
98423
|
+
}
|
|
98424
|
+
if (recording || options.clearSettled) settled.delete(webContentsId);
|
|
98425
|
+
}
|
|
97870
98426
|
const MAX_ENTRIES = 200;
|
|
97871
98427
|
const MAX_BYTES = 256 * 1024;
|
|
97872
98428
|
const MAX_ARG_CHARS = 2e3;
|
|
@@ -98003,30 +98559,6 @@ function routeDebuggerEvent(webContentsId, method, rawParams) {
|
|
|
98003
98559
|
});
|
|
98004
98560
|
}
|
|
98005
98561
|
}
|
|
98006
|
-
const CDP_DEADLINE_MS = 15e3;
|
|
98007
|
-
const CDP_ATTACH_DEADLINE_MS = 5e3;
|
|
98008
|
-
const SCRIPTING_DEADLINE_MS = 15e3;
|
|
98009
|
-
function deadline(op, ms, what) {
|
|
98010
|
-
return new Promise((resolve, reject) => {
|
|
98011
|
-
const timer = setTimeout(() => {
|
|
98012
|
-
reject(
|
|
98013
|
-
new BridgeCommandError("internal", `${what} did not respond within ${ms}ms`, {
|
|
98014
|
-
stalled: what
|
|
98015
|
-
})
|
|
98016
|
-
);
|
|
98017
|
-
}, ms);
|
|
98018
|
-
op.then(
|
|
98019
|
-
(value) => {
|
|
98020
|
-
clearTimeout(timer);
|
|
98021
|
-
resolve(value);
|
|
98022
|
-
},
|
|
98023
|
-
(error) => {
|
|
98024
|
-
clearTimeout(timer);
|
|
98025
|
-
reject(error);
|
|
98026
|
-
}
|
|
98027
|
-
);
|
|
98028
|
-
});
|
|
98029
|
-
}
|
|
98030
98562
|
const PROTOCOL_VERSION = "1.3";
|
|
98031
98563
|
const ALREADY_ATTACHED = /another debugger|already attached/i;
|
|
98032
98564
|
const STALE_SESSION = /no session|session with given id|no target|target closed/i;
|
|
@@ -98143,7 +98675,7 @@ class CdpPool {
|
|
|
98143
98675
|
const detachListener = (_event, reason) => {
|
|
98144
98676
|
attachment.detachedReason = reason || "detached";
|
|
98145
98677
|
this.frames.delete(contents.id);
|
|
98146
|
-
|
|
98678
|
+
this.dropCaptures(contents.id, reason || "detached");
|
|
98147
98679
|
this.options.log?.(
|
|
98148
98680
|
`[browser] debugger detached from view ${contents.id}: ${reason}`
|
|
98149
98681
|
);
|
|
@@ -98340,6 +98872,33 @@ class CdpPool {
|
|
|
98340
98872
|
attachment.listeners.detach
|
|
98341
98873
|
);
|
|
98342
98874
|
}
|
|
98875
|
+
/**
|
|
98876
|
+
* End every capture this view owns, at one debugger boundary.
|
|
98877
|
+
*
|
|
98878
|
+
* WHY ONE HELPER. The network buffer and a recording die at the same four
|
|
98879
|
+
* boundaries (`forget`, `detach`, the detach EVENT, and `close` through
|
|
98880
|
+
* `detach`), and each was hand-listed at each site. That is how a fourth capture
|
|
98881
|
+
* drifts: one boundary is missed, and a stale subscription or a running encoder
|
|
98882
|
+
* outlives the attachment that fed it.
|
|
98883
|
+
*
|
|
98884
|
+
* THE LOG RING IS THE EXCEPTION, and it is deliberate: the detach EVENT is a
|
|
98885
|
+
* DevTools hand-over of a view that stays open, and `logs` is defined as
|
|
98886
|
+
* "everything since the surface opened" — so the ring must survive it, which is
|
|
98887
|
+
* exactly what the re-attach case in `browser-host.test.mjs` asserts. `forget`
|
|
98888
|
+
* and `detach` end the view's drive and drop it. The detach event passes the
|
|
98889
|
+
* reason, which is what turns a recording's abort into the tombstone a later
|
|
98890
|
+
* `record_stop` reads.
|
|
98891
|
+
*/
|
|
98892
|
+
dropCaptures(webContentsId, detachedReason) {
|
|
98893
|
+
if (detachedReason === void 0) stopLogCapture(webContentsId);
|
|
98894
|
+
stopNetworkCapture(webContentsId);
|
|
98895
|
+
abortRecording(webContentsId, detachedReason ?? "detached", {
|
|
98896
|
+
tombstone: detachedReason !== void 0,
|
|
98897
|
+
// `forget`/`detach` end the handle, so an uncollected result dies with it;
|
|
98898
|
+
// the detach EVENT hands a live tab over and must leave it alone.
|
|
98899
|
+
clearSettled: detachedReason === void 0
|
|
98900
|
+
});
|
|
98901
|
+
}
|
|
98343
98902
|
/** Drop the attachment record and its log buffer, without talking to the view.
|
|
98344
98903
|
* Used when the view is already gone. */
|
|
98345
98904
|
forget(webContentsId) {
|
|
@@ -98348,8 +98907,7 @@ class CdpPool {
|
|
|
98348
98907
|
this.attachments.delete(webContentsId);
|
|
98349
98908
|
this.subscribers.delete(webContentsId);
|
|
98350
98909
|
this.frames.delete(webContentsId);
|
|
98351
|
-
|
|
98352
|
-
stopNetworkCapture(webContentsId);
|
|
98910
|
+
this.dropCaptures(webContentsId);
|
|
98353
98911
|
}
|
|
98354
98912
|
/** Detach cleanly: release the debugger session and the log buffer. */
|
|
98355
98913
|
async detach(webContentsId) {
|
|
@@ -98358,8 +98916,7 @@ class CdpPool {
|
|
|
98358
98916
|
this.attachments.delete(webContentsId);
|
|
98359
98917
|
this.subscribers.delete(webContentsId);
|
|
98360
98918
|
this.frames.delete(webContentsId);
|
|
98361
|
-
|
|
98362
|
-
stopNetworkCapture(webContentsId);
|
|
98919
|
+
this.dropCaptures(webContentsId);
|
|
98363
98920
|
if (!attachment) return;
|
|
98364
98921
|
try {
|
|
98365
98922
|
if (attachment.contents.debugger.isAttached()) {
|
|
@@ -98390,7 +98947,7 @@ const ERR_ABORTED = -3;
|
|
|
98390
98947
|
function settle(contents, timeoutMs = 3e4) {
|
|
98391
98948
|
return new Promise((resolve, reject) => {
|
|
98392
98949
|
let done = false;
|
|
98393
|
-
const
|
|
98950
|
+
const finish2 = (error) => {
|
|
98394
98951
|
if (done) return;
|
|
98395
98952
|
done = true;
|
|
98396
98953
|
clearTimeout(timer);
|
|
@@ -98401,15 +98958,15 @@ function settle(contents, timeoutMs = 3e4) {
|
|
|
98401
98958
|
if (error) reject(error);
|
|
98402
98959
|
else resolve();
|
|
98403
98960
|
};
|
|
98404
|
-
const onFinish = () =>
|
|
98961
|
+
const onFinish = () => finish2();
|
|
98405
98962
|
const onInPage = (_event, _url, isMainFrame) => {
|
|
98406
98963
|
if (!isMainFrame) return;
|
|
98407
|
-
|
|
98964
|
+
finish2();
|
|
98408
98965
|
};
|
|
98409
98966
|
const onFail = (_event, errorCode, errorDescription, _url, isMainFrame) => {
|
|
98410
98967
|
if (!isMainFrame) return;
|
|
98411
98968
|
if (errorCode === ERR_ABORTED) return;
|
|
98412
|
-
|
|
98969
|
+
finish2(
|
|
98413
98970
|
new BridgeCommandError(
|
|
98414
98971
|
"nav_failed",
|
|
98415
98972
|
errorDescription ?? "navigation failed",
|
|
@@ -98417,14 +98974,14 @@ function settle(contents, timeoutMs = 3e4) {
|
|
|
98417
98974
|
)
|
|
98418
98975
|
);
|
|
98419
98976
|
};
|
|
98420
|
-
const onDestroyed = () =>
|
|
98977
|
+
const onDestroyed = () => finish2(
|
|
98421
98978
|
new BridgeCommandError(
|
|
98422
98979
|
"tab_closed",
|
|
98423
98980
|
"that browser tab closed while it was loading; dropped the handle. Use 'open' with a URL to get a new tab"
|
|
98424
98981
|
)
|
|
98425
98982
|
);
|
|
98426
98983
|
const timer = setTimeout(
|
|
98427
|
-
() =>
|
|
98984
|
+
() => finish2(
|
|
98428
98985
|
new BridgeCommandError("nav_timeout", "navigation timed out", {
|
|
98429
98986
|
timeout_ms: timeoutMs
|
|
98430
98987
|
})
|
|
@@ -98550,8 +99107,8 @@ async function withOriginGate(ctx, view, requester, approved, operation) {
|
|
|
98550
99107
|
async function navigateView(ctx, view, url, requester, approved, timeoutMs = 3e4) {
|
|
98551
99108
|
const contents = view.webContents;
|
|
98552
99109
|
return withOriginGate(ctx, view, requester, approved, async () => {
|
|
98553
|
-
const
|
|
98554
|
-
await Promise.race([
|
|
99110
|
+
const settled2 = settle(contents, timeoutMs);
|
|
99111
|
+
await Promise.race([settled2, loadFailure(contents.loadURL(url.href))]);
|
|
98555
99112
|
return { url: contents.getURL(), title: contents.getTitle() };
|
|
98556
99113
|
});
|
|
98557
99114
|
}
|
|
@@ -100018,6 +100575,87 @@ async function click(ctx, params) {
|
|
|
100018
100575
|
...after
|
|
100019
100576
|
};
|
|
100020
100577
|
}
|
|
100578
|
+
const PRESS_KEYS = /* @__PURE__ */ new Map([
|
|
100579
|
+
["Tab", { key: "Tab", code: "Tab", virtualKeyCode: 9, modifiers: 0 }],
|
|
100580
|
+
["Shift+Tab", { key: "Tab", code: "Tab", virtualKeyCode: 9, modifiers: 8 }],
|
|
100581
|
+
["Enter", { key: "Enter", code: "Enter", virtualKeyCode: 13, modifiers: 0 }],
|
|
100582
|
+
[
|
|
100583
|
+
"Escape",
|
|
100584
|
+
{ key: "Escape", code: "Escape", virtualKeyCode: 27, modifiers: 0 }
|
|
100585
|
+
],
|
|
100586
|
+
[
|
|
100587
|
+
"ArrowUp",
|
|
100588
|
+
{ key: "ArrowUp", code: "ArrowUp", virtualKeyCode: 38, modifiers: 0 }
|
|
100589
|
+
],
|
|
100590
|
+
[
|
|
100591
|
+
"ArrowDown",
|
|
100592
|
+
{ key: "ArrowDown", code: "ArrowDown", virtualKeyCode: 40, modifiers: 0 }
|
|
100593
|
+
],
|
|
100594
|
+
[
|
|
100595
|
+
"ArrowLeft",
|
|
100596
|
+
{ key: "ArrowLeft", code: "ArrowLeft", virtualKeyCode: 37, modifiers: 0 }
|
|
100597
|
+
],
|
|
100598
|
+
[
|
|
100599
|
+
"ArrowRight",
|
|
100600
|
+
{ key: "ArrowRight", code: "ArrowRight", virtualKeyCode: 39, modifiers: 0 }
|
|
100601
|
+
]
|
|
100602
|
+
]);
|
|
100603
|
+
async function press(ctx, params) {
|
|
100604
|
+
const named = typeof params.key === "string" ? PRESS_KEYS.get(params.key) : void 0;
|
|
100605
|
+
if (!named) {
|
|
100606
|
+
throw new BridgeCommandError(
|
|
100607
|
+
"unsupported_key",
|
|
100608
|
+
`unsupported key: ${String(params.key)}`,
|
|
100609
|
+
{
|
|
100610
|
+
key: params.key ?? null
|
|
100611
|
+
}
|
|
100612
|
+
);
|
|
100613
|
+
}
|
|
100614
|
+
const record = ctx.registry.requireSurface(params.tab);
|
|
100615
|
+
const contents = record.view.webContents;
|
|
100616
|
+
const event = {
|
|
100617
|
+
key: named.key,
|
|
100618
|
+
code: named.code,
|
|
100619
|
+
windowsVirtualKeyCode: named.virtualKeyCode,
|
|
100620
|
+
modifiers: named.modifiers
|
|
100621
|
+
};
|
|
100622
|
+
const before = pageOf(record.view).url;
|
|
100623
|
+
let navigationSeen = false;
|
|
100624
|
+
const onStart = (...args) => {
|
|
100625
|
+
if (args[2] !== false) navigationSeen = true;
|
|
100626
|
+
};
|
|
100627
|
+
contents.on("did-start-navigation", onStart);
|
|
100628
|
+
try {
|
|
100629
|
+
let keyDownFailed = true;
|
|
100630
|
+
try {
|
|
100631
|
+
await ctx.cdp.send(contents, "Input.dispatchKeyEvent", {
|
|
100632
|
+
...event,
|
|
100633
|
+
type: "keyDown",
|
|
100634
|
+
...named.key === "Enter" ? { text: "\r", unmodifiedText: "\r" } : {}
|
|
100635
|
+
});
|
|
100636
|
+
keyDownFailed = false;
|
|
100637
|
+
} finally {
|
|
100638
|
+
const release = ctx.cdp.send(contents, "Input.dispatchKeyEvent", {
|
|
100639
|
+
...event,
|
|
100640
|
+
type: "keyUp"
|
|
100641
|
+
});
|
|
100642
|
+
if (keyDownFailed) await release.catch(() => void 0);
|
|
100643
|
+
else await release;
|
|
100644
|
+
}
|
|
100645
|
+
await sleep(1200);
|
|
100646
|
+
if (navigationSeen)
|
|
100647
|
+
await settle(contents, 1e4).catch(() => void 0);
|
|
100648
|
+
ctx.registry.touch(record);
|
|
100649
|
+
const after = pageOf(record.view);
|
|
100650
|
+
return {
|
|
100651
|
+
key: params.key,
|
|
100652
|
+
navigated: navigationSeen || after.url !== before,
|
|
100653
|
+
...after
|
|
100654
|
+
};
|
|
100655
|
+
} finally {
|
|
100656
|
+
contents.removeListener("did-start-navigation", onStart);
|
|
100657
|
+
}
|
|
100658
|
+
}
|
|
100021
100659
|
async function type(ctx, params) {
|
|
100022
100660
|
const record = ctx.registry.requireSurface(params.tab);
|
|
100023
100661
|
const contents = record.view.webContents;
|
|
@@ -100113,17 +100751,17 @@ async function typeInto(ctx, contents, node, text2, target2) {
|
|
|
100113
100751
|
const setValue = set2?.result?.value;
|
|
100114
100752
|
if (setValue === null) return null;
|
|
100115
100753
|
await sleep(SETTLE_BEFORE_REREAD_MS);
|
|
100116
|
-
const
|
|
100117
|
-
if (holdsTypedText(
|
|
100754
|
+
const settled2 = await conversationReadBack(ctx, node, contents);
|
|
100755
|
+
if (holdsTypedText(settled2, text2)) {
|
|
100118
100756
|
return {
|
|
100119
|
-
value:
|
|
100757
|
+
value: settled2,
|
|
100120
100758
|
via: "value_setter",
|
|
100121
100759
|
insert_text_readback: readBack2
|
|
100122
100760
|
};
|
|
100123
100761
|
}
|
|
100124
100762
|
throw new BridgeCommandError(
|
|
100125
100763
|
"element_not_found",
|
|
100126
|
-
`${target2} took the value-setter write but does not hold the text (read back ${quoteReadBack(
|
|
100764
|
+
`${target2} took the value-setter write but does not hold the text (read back ${quoteReadBack(settled2)}), so nothing was reported typed`
|
|
100127
100765
|
);
|
|
100128
100766
|
}
|
|
100129
100767
|
async function iframeScopeOf(ctx, contents, node) {
|
|
@@ -102219,6 +102857,7 @@ const DOCUMENT_SCOPED = /* @__PURE__ */ new Set([
|
|
|
102219
102857
|
"screenshot",
|
|
102220
102858
|
"click",
|
|
102221
102859
|
"type",
|
|
102860
|
+
"press",
|
|
102222
102861
|
"scroll",
|
|
102223
102862
|
"logs",
|
|
102224
102863
|
// `download` names a control on the CURRENT document (the link or button that
|
|
@@ -102230,15 +102869,27 @@ const DOCUMENT_SCOPED = /* @__PURE__ */ new Set([
|
|
|
102230
102869
|
// say why, and the pair is what replaced the single post-hoc check the round-1
|
|
102231
102870
|
// review refused (M2).
|
|
102232
102871
|
"download",
|
|
102233
|
-
"upload"
|
|
102872
|
+
"upload",
|
|
102873
|
+
// `record_start` captures PIXELS of the current document, which is the same
|
|
102874
|
+
// class of data `screenshot` gates, so it is authorized against that document
|
|
102875
|
+
// on entry and again on the result (D8). `record_stop` reveals nothing new —
|
|
102876
|
+
// it ends a capture the current document already authorized and writes bytes
|
|
102877
|
+
// whose destination was approved at start — so it is deliberately NOT in this
|
|
102878
|
+
// set. NEITHER is a NAVIGATING_ACTION: a recording does not drive the page.
|
|
102879
|
+
"record_start"
|
|
102234
102880
|
]);
|
|
102235
102881
|
const NAVIGATING_ACTIONS = /* @__PURE__ */ new Set([
|
|
102236
102882
|
"click",
|
|
102237
102883
|
"type",
|
|
102884
|
+
"press",
|
|
102238
102885
|
"download",
|
|
102239
102886
|
"upload"
|
|
102240
102887
|
]);
|
|
102241
|
-
const NAVIGATION_ACTIONS = /* @__PURE__ */ new Set([
|
|
102888
|
+
const NAVIGATION_ACTIONS = /* @__PURE__ */ new Set([
|
|
102889
|
+
"click",
|
|
102890
|
+
"type",
|
|
102891
|
+
"press"
|
|
102892
|
+
]);
|
|
102242
102893
|
const TAB_SCOPED = /* @__PURE__ */ new Set([
|
|
102243
102894
|
"goto",
|
|
102244
102895
|
"read",
|
|
@@ -102250,6 +102901,7 @@ const TAB_SCOPED = /* @__PURE__ */ new Set([
|
|
|
102250
102901
|
"screenshot",
|
|
102251
102902
|
"click",
|
|
102252
102903
|
"type",
|
|
102904
|
+
"press",
|
|
102253
102905
|
"scroll",
|
|
102254
102906
|
"logs",
|
|
102255
102907
|
"close",
|
|
@@ -102270,7 +102922,13 @@ const TAB_SCOPED = /* @__PURE__ */ new Set([
|
|
|
102270
102922
|
"network_start",
|
|
102271
102923
|
"network_stop",
|
|
102272
102924
|
"network_read",
|
|
102273
|
-
"network_clear"
|
|
102925
|
+
"network_clear",
|
|
102926
|
+
// Both recording verbs are TAB-scoped: a recording is the tab's own capture,
|
|
102927
|
+
// and the finalize reads a stream that belongs to that tab's session. The
|
|
102928
|
+
// stop can hold the lane for up to 45 s while it drains, which is the same
|
|
102929
|
+
// bargain `download` already makes (D7).
|
|
102930
|
+
"record_start",
|
|
102931
|
+
"record_stop"
|
|
102274
102932
|
]);
|
|
102275
102933
|
const RESTORE_CONCURRENCY = 4;
|
|
102276
102934
|
const RESTORE_TAB_TIMEOUT_MS = 1e4;
|
|
@@ -102433,7 +103091,17 @@ class BrowserHost {
|
|
|
102433
103091
|
const operation = async () => {
|
|
102434
103092
|
assertDocument();
|
|
102435
103093
|
const result = await this.perform(method, params, requestId2);
|
|
102436
|
-
|
|
103094
|
+
try {
|
|
103095
|
+
assertDocument();
|
|
103096
|
+
} catch (error) {
|
|
103097
|
+
if (method === "record_start") {
|
|
103098
|
+
await abortAndEnd(
|
|
103099
|
+
record.view.webContents.id,
|
|
103100
|
+
"document_refused_after_start"
|
|
103101
|
+
);
|
|
103102
|
+
}
|
|
103103
|
+
throw error;
|
|
103104
|
+
}
|
|
102437
103105
|
return result;
|
|
102438
103106
|
};
|
|
102439
103107
|
if (!NAVIGATION_ACTIONS.has(method)) return operation();
|
|
@@ -102502,6 +103170,8 @@ class BrowserHost {
|
|
|
102502
103170
|
return click(this, params);
|
|
102503
103171
|
case "type":
|
|
102504
103172
|
return type(this, params);
|
|
103173
|
+
case "press":
|
|
103174
|
+
return press(this, params);
|
|
102505
103175
|
case "download":
|
|
102506
103176
|
return download(this, params);
|
|
102507
103177
|
case "upload":
|
|
@@ -102514,6 +103184,10 @@ class BrowserHost {
|
|
|
102514
103184
|
return networkRead(this, params, requestId2);
|
|
102515
103185
|
case "network_clear":
|
|
102516
103186
|
return networkClear(this, params, requestId2);
|
|
103187
|
+
case "record_start":
|
|
103188
|
+
return recordStart(this, params, requestId2);
|
|
103189
|
+
case "record_stop":
|
|
103190
|
+
return recordStop(this, params, requestId2);
|
|
102517
103191
|
case "request_access":
|
|
102518
103192
|
return this.approvals.requestAccess(
|
|
102519
103193
|
params.url,
|
|
@@ -104695,10 +105369,10 @@ function registerBrowserIpc(options) {
|
|
|
104695
105369
|
if (!owner || owner.isDestroyed() || !owner.isVisible()) return null;
|
|
104696
105370
|
const zoom = owner.webContents.getZoomFactor();
|
|
104697
105371
|
return new Promise((resolve) => {
|
|
104698
|
-
let
|
|
105372
|
+
let settled2 = false;
|
|
104699
105373
|
const settle2 = (selection) => {
|
|
104700
|
-
if (
|
|
104701
|
-
|
|
105374
|
+
if (settled2) return;
|
|
105375
|
+
settled2 = true;
|
|
104702
105376
|
resolve(tabActionsMenuSelectionOrNull(selection));
|
|
104703
105377
|
};
|
|
104704
105378
|
const menu = electron.Menu.buildFromTemplate(
|
|
@@ -112464,16 +113138,16 @@ function runInOwnProcessGroup(input) {
|
|
|
112464
113138
|
const log2 = input.log ?? (() => {
|
|
112465
113139
|
});
|
|
112466
113140
|
return new Promise((resolve) => {
|
|
112467
|
-
let
|
|
113141
|
+
let settled2 = false;
|
|
112468
113142
|
let timedOut = false;
|
|
112469
113143
|
let stdout = "";
|
|
112470
113144
|
let stderr = "";
|
|
112471
113145
|
let groupPid = null;
|
|
112472
113146
|
let timer = null;
|
|
112473
113147
|
let escalation = null;
|
|
112474
|
-
const
|
|
112475
|
-
if (
|
|
112476
|
-
|
|
113148
|
+
const finish2 = (result) => {
|
|
113149
|
+
if (settled2) return;
|
|
113150
|
+
settled2 = true;
|
|
112477
113151
|
if (timer) clearTimeout(timer);
|
|
112478
113152
|
dropStream(child?.stdout);
|
|
112479
113153
|
dropStream(child?.stderr);
|
|
@@ -112494,7 +113168,7 @@ function runInOwnProcessGroup(input) {
|
|
|
112494
113168
|
`Could not start ${input.command}: ${error.message}`,
|
|
112495
113169
|
"error"
|
|
112496
113170
|
);
|
|
112497
|
-
|
|
113171
|
+
finish2({
|
|
112498
113172
|
exitCode: null,
|
|
112499
113173
|
stdout,
|
|
112500
113174
|
stderr: error.message,
|
|
@@ -112518,7 +113192,7 @@ function runInOwnProcessGroup(input) {
|
|
|
112518
113192
|
child.stderr?.on("data", (chunk) => record(chunk, "stderr"));
|
|
112519
113193
|
child.on("error", (error) => {
|
|
112520
113194
|
log2(`The updater could not be run: ${error.message}`, "error");
|
|
112521
|
-
|
|
113195
|
+
finish2({
|
|
112522
113196
|
exitCode: null,
|
|
112523
113197
|
stdout,
|
|
112524
113198
|
stderr: stderr.length > 0 ? stderr : error.message,
|
|
@@ -112528,7 +113202,7 @@ function runInOwnProcessGroup(input) {
|
|
|
112528
113202
|
});
|
|
112529
113203
|
});
|
|
112530
113204
|
child.on("close", (code) => {
|
|
112531
|
-
|
|
113205
|
+
finish2({
|
|
112532
113206
|
exitCode: code,
|
|
112533
113207
|
stdout,
|
|
112534
113208
|
stderr,
|
|
@@ -112553,7 +113227,7 @@ function runInOwnProcessGroup(input) {
|
|
|
112553
113227
|
signalInstallGroup(groupPid, "SIGKILL");
|
|
112554
113228
|
}, graceMs);
|
|
112555
113229
|
escalation.unref?.();
|
|
112556
|
-
|
|
113230
|
+
finish2({
|
|
112557
113231
|
exitCode: null,
|
|
112558
113232
|
stdout,
|
|
112559
113233
|
stderr,
|
|
@@ -112776,11 +113450,11 @@ async function fetchServerReleaseNotes(version, options) {
|
|
|
112776
113450
|
}
|
|
112777
113451
|
function getJson(url, timeoutMs) {
|
|
112778
113452
|
return new Promise((resolve, reject) => {
|
|
112779
|
-
let
|
|
112780
|
-
const settle2 = (
|
|
112781
|
-
if (
|
|
112782
|
-
|
|
112783
|
-
|
|
113453
|
+
let settled2 = false;
|
|
113454
|
+
const settle2 = (finish2) => {
|
|
113455
|
+
if (settled2) return;
|
|
113456
|
+
settled2 = true;
|
|
113457
|
+
finish2();
|
|
112784
113458
|
};
|
|
112785
113459
|
const fail = (error) => settle2(
|
|
112786
113460
|
() => reject(error instanceof Error ? error : new Error(String(error)))
|
|
@@ -112939,10 +113613,10 @@ function runExtraction(zipPath, stagingRoot, options = {}) {
|
|
|
112939
113613
|
const command = options.command ?? DITTO_PATH;
|
|
112940
113614
|
const timeoutMs = options.timeoutMs ?? EXTRACTION_TIMEOUT_MS;
|
|
112941
113615
|
return new Promise((resolve) => {
|
|
112942
|
-
let
|
|
112943
|
-
const
|
|
112944
|
-
if (
|
|
112945
|
-
|
|
113616
|
+
let settled2 = false;
|
|
113617
|
+
const finish2 = (result) => {
|
|
113618
|
+
if (settled2) return;
|
|
113619
|
+
settled2 = true;
|
|
112946
113620
|
clearTimeout(timer);
|
|
112947
113621
|
resolve(result);
|
|
112948
113622
|
};
|
|
@@ -112971,15 +113645,15 @@ function runExtraction(zipPath, stagingRoot, options = {}) {
|
|
|
112971
113645
|
child.pid,
|
|
112972
113646
|
(message) => logger.warn(message, LogFileType.UPDATE_SERVICE)
|
|
112973
113647
|
);
|
|
112974
|
-
|
|
113648
|
+
finish2({
|
|
112975
113649
|
ok: false,
|
|
112976
113650
|
reason: `it was still running after ${timeoutMs} ms`
|
|
112977
113651
|
});
|
|
112978
113652
|
}, timeoutMs);
|
|
112979
|
-
child.on("error", (error) =>
|
|
113653
|
+
child.on("error", (error) => finish2({ ok: false, reason: String(error) }));
|
|
112980
113654
|
child.on(
|
|
112981
113655
|
"close",
|
|
112982
|
-
(code) =>
|
|
113656
|
+
(code) => finish2(
|
|
112983
113657
|
code === 0 ? { ok: true } : {
|
|
112984
113658
|
ok: false,
|
|
112985
113659
|
reason: `ditto exited ${code}${stderr.trim() ? `: ${stderr.trim()}` : ""}`
|
|
@@ -115525,10 +116199,10 @@ ${heal.removed.join("\n")}`,
|
|
|
115525
116199
|
rememberAbandonedAppFeedFetch(fetch2) {
|
|
115526
116200
|
if (this.appFeedAbandonedFetches.has(fetch2)) return;
|
|
115527
116201
|
this.appFeedAbandonedFetches.add(fetch2);
|
|
115528
|
-
const
|
|
116202
|
+
const settled2 = () => {
|
|
115529
116203
|
this.appFeedAbandonedFetches.delete(fetch2);
|
|
115530
116204
|
};
|
|
115531
|
-
fetch2.then(
|
|
116205
|
+
fetch2.then(settled2, settled2);
|
|
115532
116206
|
}
|
|
115533
116207
|
/**
|
|
115534
116208
|
* Arm the download's stall watchdog for a fresh attempt.
|
|
@@ -119236,21 +119910,21 @@ class ViewerEndpoint {
|
|
|
119236
119910
|
let buffer = "";
|
|
119237
119911
|
let closed = false;
|
|
119238
119912
|
let chain = Promise.resolve();
|
|
119239
|
-
const
|
|
119913
|
+
const finish2 = () => {
|
|
119240
119914
|
closed = true;
|
|
119241
119915
|
socket.destroy();
|
|
119242
119916
|
};
|
|
119243
119917
|
const authTimer = setTimeout(() => {
|
|
119244
|
-
if (!authenticated)
|
|
119918
|
+
if (!authenticated) finish2();
|
|
119245
119919
|
}, AUTH_TIMEOUT_MS);
|
|
119246
119920
|
socket.setEncoding("utf8");
|
|
119247
|
-
socket.on("error",
|
|
119921
|
+
socket.on("error", finish2);
|
|
119248
119922
|
socket.on("close", () => clearTimeout(authTimer));
|
|
119249
119923
|
socket.on("data", (chunk) => {
|
|
119250
119924
|
if (closed) return;
|
|
119251
119925
|
buffer += chunk;
|
|
119252
119926
|
if (buffer.length > MAX_FRAME_BYTES) {
|
|
119253
|
-
|
|
119927
|
+
finish2();
|
|
119254
119928
|
return;
|
|
119255
119929
|
}
|
|
119256
119930
|
for (; ; ) {
|
|
@@ -119265,7 +119939,7 @@ class ViewerEndpoint {
|
|
|
119265
119939
|
authenticated = true;
|
|
119266
119940
|
clearTimeout(authTimer);
|
|
119267
119941
|
},
|
|
119268
|
-
finish
|
|
119942
|
+
finish: finish2
|
|
119269
119943
|
}).catch(() => void 0)
|
|
119270
119944
|
);
|
|
119271
119945
|
}
|