local-operator-ui 0.47.0 → 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 +804 -101
- 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") {
|
|
@@ -94020,6 +94039,11 @@ function addressListViewModel(projection) {
|
|
|
94020
94039
|
theme
|
|
94021
94040
|
};
|
|
94022
94041
|
}
|
|
94042
|
+
function setBrowserViewPresented(parent, view, presented) {
|
|
94043
|
+
const attached = parent.children.includes(view);
|
|
94044
|
+
if (presented && !attached) parent.addChildView(view);
|
|
94045
|
+
else if (!presented && attached) parent.removeChildView(view);
|
|
94046
|
+
}
|
|
94023
94047
|
const ADDRESS_OVERLAY_S1_ENV = "LOCAL_OPERATOR_UI_BROWSER_ADDRESS_OVERLAY_S1";
|
|
94024
94048
|
const ADDRESS_OVERLAY_VISIBLE_ENV = "LOCAL_OPERATOR_UI_BROWSER_ADDRESS_OVERLAY_VISIBLE";
|
|
94025
94049
|
const ADDRESS_OVERLAY_VISIBLE_MAX_MS = 12e4;
|
|
@@ -94477,7 +94501,7 @@ class AddressOverlayController {
|
|
|
94477
94501
|
const view = this.view;
|
|
94478
94502
|
if (!view || this.viewUsable(view) === false) return;
|
|
94479
94503
|
try {
|
|
94480
|
-
|
|
94504
|
+
this.hideNativeChild(view);
|
|
94481
94505
|
} catch {
|
|
94482
94506
|
}
|
|
94483
94507
|
}
|
|
@@ -94605,7 +94629,7 @@ class AddressOverlayController {
|
|
|
94605
94629
|
const view = this.view;
|
|
94606
94630
|
if (view && this.viewUsable(view)) {
|
|
94607
94631
|
try {
|
|
94608
|
-
|
|
94632
|
+
this.hideNativeChild(view);
|
|
94609
94633
|
} catch {
|
|
94610
94634
|
}
|
|
94611
94635
|
}
|
|
@@ -94931,10 +94955,7 @@ class AddressOverlayController {
|
|
|
94931
94955
|
const view = this.view;
|
|
94932
94956
|
if (bounds === null || !view || !this.viewUsable(view)) return;
|
|
94933
94957
|
try {
|
|
94934
|
-
const wasVisible = view.getVisible();
|
|
94935
|
-
if (!wasVisible) view.setVisible(true);
|
|
94936
94958
|
view.setBounds(bounds);
|
|
94937
|
-
if (!wasVisible) view.setVisible(false);
|
|
94938
94959
|
} catch (error) {
|
|
94939
94960
|
this.releaseChild(`layout_error:${String(error)}`);
|
|
94940
94961
|
}
|
|
@@ -95140,6 +95161,13 @@ class AddressOverlayController {
|
|
|
95140
95161
|
return refuse("child_error");
|
|
95141
95162
|
}
|
|
95142
95163
|
}
|
|
95164
|
+
/** Hidden native siblings can take first responder at navigation commit. */
|
|
95165
|
+
hideNativeChild(view) {
|
|
95166
|
+
view.setVisible(false);
|
|
95167
|
+
if (!this.window.isDestroyed()) {
|
|
95168
|
+
setBrowserViewPresented(this.window.contentView, view, false);
|
|
95169
|
+
}
|
|
95170
|
+
}
|
|
95143
95171
|
createChild(bounds) {
|
|
95144
95172
|
let view;
|
|
95145
95173
|
try {
|
|
@@ -95158,7 +95186,7 @@ class AddressOverlayController {
|
|
|
95158
95186
|
try {
|
|
95159
95187
|
this.window.contentView.addChildView(view);
|
|
95160
95188
|
view.setBounds(bounds);
|
|
95161
|
-
|
|
95189
|
+
this.hideNativeChild(view);
|
|
95162
95190
|
} catch (error) {
|
|
95163
95191
|
this.failChild(`child_attach_failed:${String(error)}`);
|
|
95164
95192
|
return false;
|
|
@@ -95355,7 +95383,11 @@ class AddressOverlayController {
|
|
|
95355
95383
|
this.disposingChild = false;
|
|
95356
95384
|
}
|
|
95357
95385
|
raiseChild(view) {
|
|
95358
|
-
this.window.
|
|
95386
|
+
if (this.window.isDestroyed()) return;
|
|
95387
|
+
const children = this.window.contentView.children;
|
|
95388
|
+
if (children[children.length - 1] !== view) {
|
|
95389
|
+
this.window.contentView.addChildView(view);
|
|
95390
|
+
}
|
|
95359
95391
|
}
|
|
95360
95392
|
viewUsable(view) {
|
|
95361
95393
|
try {
|
|
@@ -97192,8 +97224,6 @@ class ApprovalsOverlayController {
|
|
|
97192
97224
|
const view = this.view;
|
|
97193
97225
|
if (!view) return;
|
|
97194
97226
|
view.setBounds(bounds.view);
|
|
97195
|
-
view.setVisible(true);
|
|
97196
|
-
this.visible = true;
|
|
97197
97227
|
}
|
|
97198
97228
|
releaseView(reason) {
|
|
97199
97229
|
const view = this.view;
|
|
@@ -97272,7 +97302,7 @@ class ApprovalsOverlayController {
|
|
|
97272
97302
|
height: 0
|
|
97273
97303
|
};
|
|
97274
97304
|
view.setBounds(initial);
|
|
97275
|
-
|
|
97305
|
+
this.hideNativeChild(view);
|
|
97276
97306
|
this.view = view;
|
|
97277
97307
|
this.ready = false;
|
|
97278
97308
|
const onFinish = () => {
|
|
@@ -97397,10 +97427,16 @@ class ApprovalsOverlayController {
|
|
|
97397
97427
|
void view.webContents.executeJavaScript(`window.__approvalsCard?.setModel(${payload})`).catch(() => {
|
|
97398
97428
|
});
|
|
97399
97429
|
}
|
|
97430
|
+
hideNativeChild(view) {
|
|
97431
|
+
view.setVisible(false);
|
|
97432
|
+
if (!this.window.isDestroyed()) {
|
|
97433
|
+
setBrowserViewPresented(this.window.contentView, view, false);
|
|
97434
|
+
}
|
|
97435
|
+
}
|
|
97400
97436
|
hide() {
|
|
97401
97437
|
if (this.view) {
|
|
97402
97438
|
try {
|
|
97403
|
-
this.view
|
|
97439
|
+
this.hideNativeChild(this.view);
|
|
97404
97440
|
} catch {
|
|
97405
97441
|
}
|
|
97406
97442
|
}
|
|
@@ -97850,6 +97886,543 @@ function stopNetworkCapture(webContentsId) {
|
|
|
97850
97886
|
capture.unsubscribe();
|
|
97851
97887
|
captures.delete(webContentsId);
|
|
97852
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
|
+
}
|
|
97853
98426
|
const MAX_ENTRIES = 200;
|
|
97854
98427
|
const MAX_BYTES = 256 * 1024;
|
|
97855
98428
|
const MAX_ARG_CHARS = 2e3;
|
|
@@ -97986,30 +98559,6 @@ function routeDebuggerEvent(webContentsId, method, rawParams) {
|
|
|
97986
98559
|
});
|
|
97987
98560
|
}
|
|
97988
98561
|
}
|
|
97989
|
-
const CDP_DEADLINE_MS = 15e3;
|
|
97990
|
-
const CDP_ATTACH_DEADLINE_MS = 5e3;
|
|
97991
|
-
const SCRIPTING_DEADLINE_MS = 15e3;
|
|
97992
|
-
function deadline(op, ms, what) {
|
|
97993
|
-
return new Promise((resolve, reject) => {
|
|
97994
|
-
const timer = setTimeout(() => {
|
|
97995
|
-
reject(
|
|
97996
|
-
new BridgeCommandError("internal", `${what} did not respond within ${ms}ms`, {
|
|
97997
|
-
stalled: what
|
|
97998
|
-
})
|
|
97999
|
-
);
|
|
98000
|
-
}, ms);
|
|
98001
|
-
op.then(
|
|
98002
|
-
(value) => {
|
|
98003
|
-
clearTimeout(timer);
|
|
98004
|
-
resolve(value);
|
|
98005
|
-
},
|
|
98006
|
-
(error) => {
|
|
98007
|
-
clearTimeout(timer);
|
|
98008
|
-
reject(error);
|
|
98009
|
-
}
|
|
98010
|
-
);
|
|
98011
|
-
});
|
|
98012
|
-
}
|
|
98013
98562
|
const PROTOCOL_VERSION = "1.3";
|
|
98014
98563
|
const ALREADY_ATTACHED = /another debugger|already attached/i;
|
|
98015
98564
|
const STALE_SESSION = /no session|session with given id|no target|target closed/i;
|
|
@@ -98126,7 +98675,7 @@ class CdpPool {
|
|
|
98126
98675
|
const detachListener = (_event, reason) => {
|
|
98127
98676
|
attachment.detachedReason = reason || "detached";
|
|
98128
98677
|
this.frames.delete(contents.id);
|
|
98129
|
-
|
|
98678
|
+
this.dropCaptures(contents.id, reason || "detached");
|
|
98130
98679
|
this.options.log?.(
|
|
98131
98680
|
`[browser] debugger detached from view ${contents.id}: ${reason}`
|
|
98132
98681
|
);
|
|
@@ -98323,6 +98872,33 @@ class CdpPool {
|
|
|
98323
98872
|
attachment.listeners.detach
|
|
98324
98873
|
);
|
|
98325
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
|
+
}
|
|
98326
98902
|
/** Drop the attachment record and its log buffer, without talking to the view.
|
|
98327
98903
|
* Used when the view is already gone. */
|
|
98328
98904
|
forget(webContentsId) {
|
|
@@ -98331,8 +98907,7 @@ class CdpPool {
|
|
|
98331
98907
|
this.attachments.delete(webContentsId);
|
|
98332
98908
|
this.subscribers.delete(webContentsId);
|
|
98333
98909
|
this.frames.delete(webContentsId);
|
|
98334
|
-
|
|
98335
|
-
stopNetworkCapture(webContentsId);
|
|
98910
|
+
this.dropCaptures(webContentsId);
|
|
98336
98911
|
}
|
|
98337
98912
|
/** Detach cleanly: release the debugger session and the log buffer. */
|
|
98338
98913
|
async detach(webContentsId) {
|
|
@@ -98341,8 +98916,7 @@ class CdpPool {
|
|
|
98341
98916
|
this.attachments.delete(webContentsId);
|
|
98342
98917
|
this.subscribers.delete(webContentsId);
|
|
98343
98918
|
this.frames.delete(webContentsId);
|
|
98344
|
-
|
|
98345
|
-
stopNetworkCapture(webContentsId);
|
|
98919
|
+
this.dropCaptures(webContentsId);
|
|
98346
98920
|
if (!attachment) return;
|
|
98347
98921
|
try {
|
|
98348
98922
|
if (attachment.contents.debugger.isAttached()) {
|
|
@@ -98373,7 +98947,7 @@ const ERR_ABORTED = -3;
|
|
|
98373
98947
|
function settle(contents, timeoutMs = 3e4) {
|
|
98374
98948
|
return new Promise((resolve, reject) => {
|
|
98375
98949
|
let done = false;
|
|
98376
|
-
const
|
|
98950
|
+
const finish2 = (error) => {
|
|
98377
98951
|
if (done) return;
|
|
98378
98952
|
done = true;
|
|
98379
98953
|
clearTimeout(timer);
|
|
@@ -98384,15 +98958,15 @@ function settle(contents, timeoutMs = 3e4) {
|
|
|
98384
98958
|
if (error) reject(error);
|
|
98385
98959
|
else resolve();
|
|
98386
98960
|
};
|
|
98387
|
-
const onFinish = () =>
|
|
98961
|
+
const onFinish = () => finish2();
|
|
98388
98962
|
const onInPage = (_event, _url, isMainFrame) => {
|
|
98389
98963
|
if (!isMainFrame) return;
|
|
98390
|
-
|
|
98964
|
+
finish2();
|
|
98391
98965
|
};
|
|
98392
98966
|
const onFail = (_event, errorCode, errorDescription, _url, isMainFrame) => {
|
|
98393
98967
|
if (!isMainFrame) return;
|
|
98394
98968
|
if (errorCode === ERR_ABORTED) return;
|
|
98395
|
-
|
|
98969
|
+
finish2(
|
|
98396
98970
|
new BridgeCommandError(
|
|
98397
98971
|
"nav_failed",
|
|
98398
98972
|
errorDescription ?? "navigation failed",
|
|
@@ -98400,14 +98974,14 @@ function settle(contents, timeoutMs = 3e4) {
|
|
|
98400
98974
|
)
|
|
98401
98975
|
);
|
|
98402
98976
|
};
|
|
98403
|
-
const onDestroyed = () =>
|
|
98977
|
+
const onDestroyed = () => finish2(
|
|
98404
98978
|
new BridgeCommandError(
|
|
98405
98979
|
"tab_closed",
|
|
98406
98980
|
"that browser tab closed while it was loading; dropped the handle. Use 'open' with a URL to get a new tab"
|
|
98407
98981
|
)
|
|
98408
98982
|
);
|
|
98409
98983
|
const timer = setTimeout(
|
|
98410
|
-
() =>
|
|
98984
|
+
() => finish2(
|
|
98411
98985
|
new BridgeCommandError("nav_timeout", "navigation timed out", {
|
|
98412
98986
|
timeout_ms: timeoutMs
|
|
98413
98987
|
})
|
|
@@ -98533,8 +99107,8 @@ async function withOriginGate(ctx, view, requester, approved, operation) {
|
|
|
98533
99107
|
async function navigateView(ctx, view, url, requester, approved, timeoutMs = 3e4) {
|
|
98534
99108
|
const contents = view.webContents;
|
|
98535
99109
|
return withOriginGate(ctx, view, requester, approved, async () => {
|
|
98536
|
-
const
|
|
98537
|
-
await Promise.race([
|
|
99110
|
+
const settled2 = settle(contents, timeoutMs);
|
|
99111
|
+
await Promise.race([settled2, loadFailure(contents.loadURL(url.href))]);
|
|
98538
99112
|
return { url: contents.getURL(), title: contents.getTitle() };
|
|
98539
99113
|
});
|
|
98540
99114
|
}
|
|
@@ -100001,6 +100575,87 @@ async function click(ctx, params) {
|
|
|
100001
100575
|
...after
|
|
100002
100576
|
};
|
|
100003
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
|
+
}
|
|
100004
100659
|
async function type(ctx, params) {
|
|
100005
100660
|
const record = ctx.registry.requireSurface(params.tab);
|
|
100006
100661
|
const contents = record.view.webContents;
|
|
@@ -100096,17 +100751,17 @@ async function typeInto(ctx, contents, node, text2, target2) {
|
|
|
100096
100751
|
const setValue = set2?.result?.value;
|
|
100097
100752
|
if (setValue === null) return null;
|
|
100098
100753
|
await sleep(SETTLE_BEFORE_REREAD_MS);
|
|
100099
|
-
const
|
|
100100
|
-
if (holdsTypedText(
|
|
100754
|
+
const settled2 = await conversationReadBack(ctx, node, contents);
|
|
100755
|
+
if (holdsTypedText(settled2, text2)) {
|
|
100101
100756
|
return {
|
|
100102
|
-
value:
|
|
100757
|
+
value: settled2,
|
|
100103
100758
|
via: "value_setter",
|
|
100104
100759
|
insert_text_readback: readBack2
|
|
100105
100760
|
};
|
|
100106
100761
|
}
|
|
100107
100762
|
throw new BridgeCommandError(
|
|
100108
100763
|
"element_not_found",
|
|
100109
|
-
`${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`
|
|
100110
100765
|
);
|
|
100111
100766
|
}
|
|
100112
100767
|
async function iframeScopeOf(ctx, contents, node) {
|
|
@@ -100405,11 +101060,13 @@ class TabRegistry {
|
|
|
100405
101060
|
* never leave pages unlaid-out.
|
|
100406
101061
|
*/
|
|
100407
101062
|
constructor(viewFactory, onRemove, onChanged, onLayout = () => {
|
|
101063
|
+
}, onPresentation = () => {
|
|
100408
101064
|
}) {
|
|
100409
101065
|
this.viewFactory = viewFactory;
|
|
100410
101066
|
this.onRemove = onRemove;
|
|
100411
101067
|
this.onChanged = onChanged;
|
|
100412
101068
|
this.onLayout = onLayout;
|
|
101069
|
+
this.onPresentation = onPresentation;
|
|
100413
101070
|
}
|
|
100414
101071
|
tabs = /* @__PURE__ */ new Map();
|
|
100415
101072
|
nextTabId = 1;
|
|
@@ -100794,6 +101451,7 @@ class TabRegistry {
|
|
|
100794
101451
|
isActive && this.contentRect ? this.contentRect : BACKGROUND_VIEWPORT
|
|
100795
101452
|
);
|
|
100796
101453
|
record.view.setVisible(record.presented);
|
|
101454
|
+
this.onPresentation(record.view, record.presented);
|
|
100797
101455
|
}
|
|
100798
101456
|
this.layoutRevision += 1;
|
|
100799
101457
|
const rect2 = this.contentRect;
|
|
@@ -102199,6 +102857,7 @@ const DOCUMENT_SCOPED = /* @__PURE__ */ new Set([
|
|
|
102199
102857
|
"screenshot",
|
|
102200
102858
|
"click",
|
|
102201
102859
|
"type",
|
|
102860
|
+
"press",
|
|
102202
102861
|
"scroll",
|
|
102203
102862
|
"logs",
|
|
102204
102863
|
// `download` names a control on the CURRENT document (the link or button that
|
|
@@ -102210,15 +102869,27 @@ const DOCUMENT_SCOPED = /* @__PURE__ */ new Set([
|
|
|
102210
102869
|
// say why, and the pair is what replaced the single post-hoc check the round-1
|
|
102211
102870
|
// review refused (M2).
|
|
102212
102871
|
"download",
|
|
102213
|
-
"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"
|
|
102214
102880
|
]);
|
|
102215
102881
|
const NAVIGATING_ACTIONS = /* @__PURE__ */ new Set([
|
|
102216
102882
|
"click",
|
|
102217
102883
|
"type",
|
|
102884
|
+
"press",
|
|
102218
102885
|
"download",
|
|
102219
102886
|
"upload"
|
|
102220
102887
|
]);
|
|
102221
|
-
const NAVIGATION_ACTIONS = /* @__PURE__ */ new Set([
|
|
102888
|
+
const NAVIGATION_ACTIONS = /* @__PURE__ */ new Set([
|
|
102889
|
+
"click",
|
|
102890
|
+
"type",
|
|
102891
|
+
"press"
|
|
102892
|
+
]);
|
|
102222
102893
|
const TAB_SCOPED = /* @__PURE__ */ new Set([
|
|
102223
102894
|
"goto",
|
|
102224
102895
|
"read",
|
|
@@ -102230,6 +102901,7 @@ const TAB_SCOPED = /* @__PURE__ */ new Set([
|
|
|
102230
102901
|
"screenshot",
|
|
102231
102902
|
"click",
|
|
102232
102903
|
"type",
|
|
102904
|
+
"press",
|
|
102233
102905
|
"scroll",
|
|
102234
102906
|
"logs",
|
|
102235
102907
|
"close",
|
|
@@ -102250,7 +102922,13 @@ const TAB_SCOPED = /* @__PURE__ */ new Set([
|
|
|
102250
102922
|
"network_start",
|
|
102251
102923
|
"network_stop",
|
|
102252
102924
|
"network_read",
|
|
102253
|
-
"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"
|
|
102254
102932
|
]);
|
|
102255
102933
|
const RESTORE_CONCURRENCY = 4;
|
|
102256
102934
|
const RESTORE_TAB_TIMEOUT_MS = 1e4;
|
|
@@ -102413,7 +103091,17 @@ class BrowserHost {
|
|
|
102413
103091
|
const operation = async () => {
|
|
102414
103092
|
assertDocument();
|
|
102415
103093
|
const result = await this.perform(method, params, requestId2);
|
|
102416
|
-
|
|
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
|
+
}
|
|
102417
103105
|
return result;
|
|
102418
103106
|
};
|
|
102419
103107
|
if (!NAVIGATION_ACTIONS.has(method)) return operation();
|
|
@@ -102482,6 +103170,8 @@ class BrowserHost {
|
|
|
102482
103170
|
return click(this, params);
|
|
102483
103171
|
case "type":
|
|
102484
103172
|
return type(this, params);
|
|
103173
|
+
case "press":
|
|
103174
|
+
return press(this, params);
|
|
102485
103175
|
case "download":
|
|
102486
103176
|
return download(this, params);
|
|
102487
103177
|
case "upload":
|
|
@@ -102494,6 +103184,10 @@ class BrowserHost {
|
|
|
102494
103184
|
return networkRead(this, params, requestId2);
|
|
102495
103185
|
case "network_clear":
|
|
102496
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);
|
|
102497
103191
|
case "request_access":
|
|
102498
103192
|
return this.approvals.requestAccess(
|
|
102499
103193
|
params.url,
|
|
@@ -104675,10 +105369,10 @@ function registerBrowserIpc(options) {
|
|
|
104675
105369
|
if (!owner || owner.isDestroyed() || !owner.isVisible()) return null;
|
|
104676
105370
|
const zoom = owner.webContents.getZoomFactor();
|
|
104677
105371
|
return new Promise((resolve) => {
|
|
104678
|
-
let
|
|
105372
|
+
let settled2 = false;
|
|
104679
105373
|
const settle2 = (selection) => {
|
|
104680
|
-
if (
|
|
104681
|
-
|
|
105374
|
+
if (settled2) return;
|
|
105375
|
+
settled2 = true;
|
|
104682
105376
|
resolve(tabActionsMenuSelectionOrNull(selection));
|
|
104683
105377
|
};
|
|
104684
105378
|
const menu = electron.Menu.buildFromTemplate(
|
|
@@ -107340,6 +108034,7 @@ async function initializeBrowserHost(options, bindings) {
|
|
|
107340
108034
|
window.contentView.addChildView(view);
|
|
107341
108035
|
view.setBounds(BACKGROUND_VIEWPORT);
|
|
107342
108036
|
view.setVisible(false);
|
|
108037
|
+
setBrowserViewPresented(window.contentView, view, false);
|
|
107343
108038
|
return view;
|
|
107344
108039
|
}, wireView = function(view, tabId) {
|
|
107345
108040
|
const contents = view.webContents;
|
|
@@ -107957,6 +108652,14 @@ async function initializeBrowserHost(options, bindings) {
|
|
|
107957
108652
|
(snapshot2) => {
|
|
107958
108653
|
addressOverlay?.onLayout(snapshot2);
|
|
107959
108654
|
approvalsOverlay?.onLayout(snapshot2);
|
|
108655
|
+
},
|
|
108656
|
+
(view, presented) => {
|
|
108657
|
+
if (options.window.isDestroyed()) return;
|
|
108658
|
+
setBrowserViewPresented(
|
|
108659
|
+
options.window.contentView,
|
|
108660
|
+
view,
|
|
108661
|
+
presented
|
|
108662
|
+
);
|
|
107960
108663
|
}
|
|
107961
108664
|
);
|
|
107962
108665
|
registryForDownloads = registry;
|
|
@@ -112435,16 +113138,16 @@ function runInOwnProcessGroup(input) {
|
|
|
112435
113138
|
const log2 = input.log ?? (() => {
|
|
112436
113139
|
});
|
|
112437
113140
|
return new Promise((resolve) => {
|
|
112438
|
-
let
|
|
113141
|
+
let settled2 = false;
|
|
112439
113142
|
let timedOut = false;
|
|
112440
113143
|
let stdout = "";
|
|
112441
113144
|
let stderr = "";
|
|
112442
113145
|
let groupPid = null;
|
|
112443
113146
|
let timer = null;
|
|
112444
113147
|
let escalation = null;
|
|
112445
|
-
const
|
|
112446
|
-
if (
|
|
112447
|
-
|
|
113148
|
+
const finish2 = (result) => {
|
|
113149
|
+
if (settled2) return;
|
|
113150
|
+
settled2 = true;
|
|
112448
113151
|
if (timer) clearTimeout(timer);
|
|
112449
113152
|
dropStream(child?.stdout);
|
|
112450
113153
|
dropStream(child?.stderr);
|
|
@@ -112465,7 +113168,7 @@ function runInOwnProcessGroup(input) {
|
|
|
112465
113168
|
`Could not start ${input.command}: ${error.message}`,
|
|
112466
113169
|
"error"
|
|
112467
113170
|
);
|
|
112468
|
-
|
|
113171
|
+
finish2({
|
|
112469
113172
|
exitCode: null,
|
|
112470
113173
|
stdout,
|
|
112471
113174
|
stderr: error.message,
|
|
@@ -112489,7 +113192,7 @@ function runInOwnProcessGroup(input) {
|
|
|
112489
113192
|
child.stderr?.on("data", (chunk) => record(chunk, "stderr"));
|
|
112490
113193
|
child.on("error", (error) => {
|
|
112491
113194
|
log2(`The updater could not be run: ${error.message}`, "error");
|
|
112492
|
-
|
|
113195
|
+
finish2({
|
|
112493
113196
|
exitCode: null,
|
|
112494
113197
|
stdout,
|
|
112495
113198
|
stderr: stderr.length > 0 ? stderr : error.message,
|
|
@@ -112499,7 +113202,7 @@ function runInOwnProcessGroup(input) {
|
|
|
112499
113202
|
});
|
|
112500
113203
|
});
|
|
112501
113204
|
child.on("close", (code) => {
|
|
112502
|
-
|
|
113205
|
+
finish2({
|
|
112503
113206
|
exitCode: code,
|
|
112504
113207
|
stdout,
|
|
112505
113208
|
stderr,
|
|
@@ -112524,7 +113227,7 @@ function runInOwnProcessGroup(input) {
|
|
|
112524
113227
|
signalInstallGroup(groupPid, "SIGKILL");
|
|
112525
113228
|
}, graceMs);
|
|
112526
113229
|
escalation.unref?.();
|
|
112527
|
-
|
|
113230
|
+
finish2({
|
|
112528
113231
|
exitCode: null,
|
|
112529
113232
|
stdout,
|
|
112530
113233
|
stderr,
|
|
@@ -112747,11 +113450,11 @@ async function fetchServerReleaseNotes(version, options) {
|
|
|
112747
113450
|
}
|
|
112748
113451
|
function getJson(url, timeoutMs) {
|
|
112749
113452
|
return new Promise((resolve, reject) => {
|
|
112750
|
-
let
|
|
112751
|
-
const settle2 = (
|
|
112752
|
-
if (
|
|
112753
|
-
|
|
112754
|
-
|
|
113453
|
+
let settled2 = false;
|
|
113454
|
+
const settle2 = (finish2) => {
|
|
113455
|
+
if (settled2) return;
|
|
113456
|
+
settled2 = true;
|
|
113457
|
+
finish2();
|
|
112755
113458
|
};
|
|
112756
113459
|
const fail = (error) => settle2(
|
|
112757
113460
|
() => reject(error instanceof Error ? error : new Error(String(error)))
|
|
@@ -112910,10 +113613,10 @@ function runExtraction(zipPath, stagingRoot, options = {}) {
|
|
|
112910
113613
|
const command = options.command ?? DITTO_PATH;
|
|
112911
113614
|
const timeoutMs = options.timeoutMs ?? EXTRACTION_TIMEOUT_MS;
|
|
112912
113615
|
return new Promise((resolve) => {
|
|
112913
|
-
let
|
|
112914
|
-
const
|
|
112915
|
-
if (
|
|
112916
|
-
|
|
113616
|
+
let settled2 = false;
|
|
113617
|
+
const finish2 = (result) => {
|
|
113618
|
+
if (settled2) return;
|
|
113619
|
+
settled2 = true;
|
|
112917
113620
|
clearTimeout(timer);
|
|
112918
113621
|
resolve(result);
|
|
112919
113622
|
};
|
|
@@ -112942,15 +113645,15 @@ function runExtraction(zipPath, stagingRoot, options = {}) {
|
|
|
112942
113645
|
child.pid,
|
|
112943
113646
|
(message) => logger.warn(message, LogFileType.UPDATE_SERVICE)
|
|
112944
113647
|
);
|
|
112945
|
-
|
|
113648
|
+
finish2({
|
|
112946
113649
|
ok: false,
|
|
112947
113650
|
reason: `it was still running after ${timeoutMs} ms`
|
|
112948
113651
|
});
|
|
112949
113652
|
}, timeoutMs);
|
|
112950
|
-
child.on("error", (error) =>
|
|
113653
|
+
child.on("error", (error) => finish2({ ok: false, reason: String(error) }));
|
|
112951
113654
|
child.on(
|
|
112952
113655
|
"close",
|
|
112953
|
-
(code) =>
|
|
113656
|
+
(code) => finish2(
|
|
112954
113657
|
code === 0 ? { ok: true } : {
|
|
112955
113658
|
ok: false,
|
|
112956
113659
|
reason: `ditto exited ${code}${stderr.trim() ? `: ${stderr.trim()}` : ""}`
|
|
@@ -115496,10 +116199,10 @@ ${heal.removed.join("\n")}`,
|
|
|
115496
116199
|
rememberAbandonedAppFeedFetch(fetch2) {
|
|
115497
116200
|
if (this.appFeedAbandonedFetches.has(fetch2)) return;
|
|
115498
116201
|
this.appFeedAbandonedFetches.add(fetch2);
|
|
115499
|
-
const
|
|
116202
|
+
const settled2 = () => {
|
|
115500
116203
|
this.appFeedAbandonedFetches.delete(fetch2);
|
|
115501
116204
|
};
|
|
115502
|
-
fetch2.then(
|
|
116205
|
+
fetch2.then(settled2, settled2);
|
|
115503
116206
|
}
|
|
115504
116207
|
/**
|
|
115505
116208
|
* Arm the download's stall watchdog for a fresh attempt.
|
|
@@ -119207,21 +119910,21 @@ class ViewerEndpoint {
|
|
|
119207
119910
|
let buffer = "";
|
|
119208
119911
|
let closed = false;
|
|
119209
119912
|
let chain = Promise.resolve();
|
|
119210
|
-
const
|
|
119913
|
+
const finish2 = () => {
|
|
119211
119914
|
closed = true;
|
|
119212
119915
|
socket.destroy();
|
|
119213
119916
|
};
|
|
119214
119917
|
const authTimer = setTimeout(() => {
|
|
119215
|
-
if (!authenticated)
|
|
119918
|
+
if (!authenticated) finish2();
|
|
119216
119919
|
}, AUTH_TIMEOUT_MS);
|
|
119217
119920
|
socket.setEncoding("utf8");
|
|
119218
|
-
socket.on("error",
|
|
119921
|
+
socket.on("error", finish2);
|
|
119219
119922
|
socket.on("close", () => clearTimeout(authTimer));
|
|
119220
119923
|
socket.on("data", (chunk) => {
|
|
119221
119924
|
if (closed) return;
|
|
119222
119925
|
buffer += chunk;
|
|
119223
119926
|
if (buffer.length > MAX_FRAME_BYTES) {
|
|
119224
|
-
|
|
119927
|
+
finish2();
|
|
119225
119928
|
return;
|
|
119226
119929
|
}
|
|
119227
119930
|
for (; ; ) {
|
|
@@ -119236,7 +119939,7 @@ class ViewerEndpoint {
|
|
|
119236
119939
|
authenticated = true;
|
|
119237
119940
|
clearTimeout(authTimer);
|
|
119238
119941
|
},
|
|
119239
|
-
finish
|
|
119942
|
+
finish: finish2
|
|
119240
119943
|
}).catch(() => void 0)
|
|
119241
119944
|
);
|
|
119242
119945
|
}
|