@descryy/runtime-browser 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-action-collector.d.ts +181 -0
- package/dist/browser-action-collector.d.ts.map +1 -0
- package/dist/browser-action-collector.js +427 -0
- package/dist/browser-action-collector.js.map +1 -0
- package/dist/browser-console-collector.d.ts +33 -0
- package/dist/browser-console-collector.d.ts.map +1 -0
- package/dist/browser-console-collector.js +185 -0
- package/dist/browser-console-collector.js.map +1 -0
- package/dist/browser-network-collector.d.ts +112 -0
- package/dist/browser-network-collector.d.ts.map +1 -0
- package/dist/browser-network-collector.js +682 -0
- package/dist/browser-network-collector.js.map +1 -0
- package/dist/browser-session.d.ts +144 -0
- package/dist/browser-session.d.ts.map +1 -0
- package/dist/browser-session.js +136 -0
- package/dist/browser-session.js.map +1 -0
- package/dist/collector-version.d.ts +10 -0
- package/dist/collector-version.d.ts.map +1 -0
- package/dist/collector-version.js +12 -0
- package/dist/collector-version.js.map +1 -0
- package/dist/dom-evidence.d.ts +20 -0
- package/dist/dom-evidence.d.ts.map +1 -0
- package/dist/dom-evidence.js +32 -0
- package/dist/dom-evidence.js.map +1 -0
- package/dist/frontend-initiator-capture.d.ts +87 -0
- package/dist/frontend-initiator-capture.d.ts.map +1 -0
- package/dist/frontend-initiator-capture.js +142 -0
- package/dist/frontend-initiator-capture.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/network-correlation.d.ts +15 -0
- package/dist/network-correlation.d.ts.map +1 -0
- package/dist/network-correlation.js +29 -0
- package/dist/network-correlation.js.map +1 -0
- package/dist/script-url-mapping.d.ts +40 -0
- package/dist/script-url-mapping.d.ts.map +1 -0
- package/dist/script-url-mapping.js +96 -0
- package/dist/script-url-mapping.js.map +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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|
3
|
+
* Playwright (see `documents/decisions-inbox/PROPOSAL-B-playwright-for-
|
|
4
|
+
* browser-runtime.md` for why Playwright over raw CDP). One
|
|
5
|
+
* `BrowserSession` = one Playwright `BrowserContext` (Playwright's own
|
|
6
|
+
* isolation unit -- separate cookies/storage/cache per context) plus its
|
|
7
|
+
* one page, which is what plan §7's "isolated context/session · page
|
|
8
|
+
* creation" already asks for; nothing here re-derives isolation Playwright
|
|
9
|
+
* already gives structurally.
|
|
10
|
+
*
|
|
11
|
+
* Deliberately does NOT itself turn browser-session launch into Evidence.
|
|
12
|
+
* `BrowserSessionHandle` (`execution.ts`) already carries `sessionId` /
|
|
13
|
+
* `targetUrl` / `startedAt` / `endedAt` structurally on `Execution`, the
|
|
14
|
+
* same relationship `ProcessHandle` has to process lifecycle --
|
|
15
|
+
* `backend-observation/collector.ts` declared that an equivalent non-goal
|
|
16
|
+
* for `ProcessCollector`, for the identical reason: whether session
|
|
17
|
+
* lifecycle becomes Evidence at all is an orchestration-layer question,
|
|
18
|
+
* not this seam's. Both non-goals now have an answer, in each package's
|
|
19
|
+
* own collector — `createProcessCollector` (`@descryy/runtime-controller`)
|
|
20
|
+
* and `BrowserActionCollector.start()` (`browser-action-collector.ts`,
|
|
21
|
+
* PAGE_CREATED) — never here. `startedAt` is captured below only so that
|
|
22
|
+
* answer has a real creation timestamp to report rather than "whenever a
|
|
23
|
+
* collector got around to starting."
|
|
24
|
+
*/
|
|
25
|
+
import { type Page } from "playwright-core";
|
|
26
|
+
import type { BrowserConfiguration } from "@descryy/runtime-contracts";
|
|
27
|
+
/**
|
|
28
|
+
* RT-068: this used to be its own interface, declared independently of
|
|
29
|
+
* `ExecutionConfiguration.browser`. Two shapes with the same one field would
|
|
30
|
+
* have been exactly the "parallel copy that could drift" this codebase
|
|
31
|
+
* already refuses elsewhere (see `InstrumentedExecutionInput.execution`'s
|
|
32
|
+
* own comment) -- so this is the contracts type, not a look-alike of it.
|
|
33
|
+
*/
|
|
34
|
+
export type BrowserSessionOptions = BrowserConfiguration;
|
|
35
|
+
export interface BrowserSession {
|
|
36
|
+
readonly sessionId: string;
|
|
37
|
+
readonly page: Page;
|
|
38
|
+
/** When the page was actually created — the real fact `PAGE_CREATED` Evidence reports, not the later moment a collector happened to start observing it. */
|
|
39
|
+
readonly startedAt: string;
|
|
40
|
+
/**
|
|
41
|
+
* False once the page has crashed or closed. Every collector's `start()`
|
|
42
|
+
* consults this before reporting `{available: true}` -- `page.isClosed()`
|
|
43
|
+
* alone is not sufficient: verified directly that it still reports
|
|
44
|
+
* `false` after a real `chrome://crash`, so a collector checking only
|
|
45
|
+
* `isClosed()` would report itself available against a page that can no
|
|
46
|
+
* longer run a single action. The `'crash'` event is the only signal
|
|
47
|
+
* that actually fires for that case, so it's tracked here once, for
|
|
48
|
+
* every collector sharing this session, rather than each collector
|
|
49
|
+
* re-attaching its own listener.
|
|
50
|
+
*/
|
|
51
|
+
isUsable(): boolean;
|
|
52
|
+
close(): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* The finished `recordVideo` file's bytes, or `null` when this session was
|
|
55
|
+
* never launched with `recordVideo: true`.
|
|
56
|
+
*
|
|
57
|
+
* **Still deliberately not Evidence** -- same non-goal this file's own
|
|
58
|
+
* header already states for session launch, applied to session teardown:
|
|
59
|
+
* turning a raw fact into Evidence is a collector's job
|
|
60
|
+
* (`BrowserActionCollector.captureVideo()`), never this module's.
|
|
61
|
+
*
|
|
62
|
+
* **Must be called after `close()` has resolved.** Playwright's own
|
|
63
|
+
* contract for `Video.path()` is that it does not resolve until the
|
|
64
|
+
* browser context that recorded it has closed -- calling this first would
|
|
65
|
+
* hang waiting for a close that this method does not itself trigger, so it
|
|
66
|
+
* throws immediately instead of hanging on a caller's mistake.
|
|
67
|
+
*
|
|
68
|
+
* Reads the file fully into memory and removes the temp directory it was
|
|
69
|
+
* written to -- the same "whole file in memory" tradeoff `screenshot()`
|
|
70
|
+
* already makes at a smaller scale (this module's sibling,
|
|
71
|
+
* `browser-action-collector.ts`), and once the bytes are safely returned
|
|
72
|
+
* here the on-disk copy has no further purpose.
|
|
73
|
+
*/
|
|
74
|
+
finishedVideo(): Promise<Uint8Array | null>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Why this exists, and why it is not a `throw`.
|
|
78
|
+
*
|
|
79
|
+
* This package depends on `playwright-core`, not `playwright`. The two ship
|
|
80
|
+
* the same driver; only `playwright` carries a postinstall that downloads
|
|
81
|
+
* Chromium. That postinstall is transitive, so every install of a package
|
|
82
|
+
* that has this one anywhere in its closure -- `@descryy/mcp`, whose users
|
|
83
|
+
* overwhelmingly never call a browser tool -- paid several hundred megabytes
|
|
84
|
+
* for a browser it would never launch. `playwright-core` removes the download
|
|
85
|
+
* and, with it, the guarantee that a browser is present at all.
|
|
86
|
+
*
|
|
87
|
+
* So absence is now a normal, expected state rather than a broken install,
|
|
88
|
+
* and it gets the shape this codebase already gives an expected inability:
|
|
89
|
+
* `ServiceRootLookup`'s `{ found: false, refusal, message }` (contracts,
|
|
90
|
+
* `source-root.ts`). One field is added to it -- `remedy` -- because the
|
|
91
|
+
* caller mapping this onto a user-visible refusal must be able to print the
|
|
92
|
+
* exact command rather than paraphrase it, and a remedy buried in prose is a
|
|
93
|
+
* remedy the caller has to parse back out.
|
|
94
|
+
*
|
|
95
|
+
* The check is `existsSync` on the path `playwright-core` itself computes.
|
|
96
|
+
* `chromium.executablePath()` does not verify existence -- it returns the
|
|
97
|
+
* path this build *would* use, resolved against `PLAYWRIGHT_BROWSERS_PATH`
|
|
98
|
+
* when that is set -- so the check and the launch below are handed the same
|
|
99
|
+
* string, and cannot disagree about which binary was meant.
|
|
100
|
+
*/
|
|
101
|
+
export interface ChromiumUnavailable {
|
|
102
|
+
readonly refusal: "chromiumNotInstalled";
|
|
103
|
+
readonly message: string;
|
|
104
|
+
/** The exact command that fixes it -- named, not described. */
|
|
105
|
+
readonly remedy: string;
|
|
106
|
+
/** Where this build of `playwright-core` expected the executable to be. Included so a report can say *which* path was empty. */
|
|
107
|
+
readonly expectedExecutablePath: string;
|
|
108
|
+
}
|
|
109
|
+
export type ChromiumAvailability = {
|
|
110
|
+
readonly available: true;
|
|
111
|
+
readonly executablePath: string;
|
|
112
|
+
} | ({
|
|
113
|
+
readonly available: false;
|
|
114
|
+
} & ChromiumUnavailable);
|
|
115
|
+
export type BrowserSessionLaunch = {
|
|
116
|
+
readonly launched: true;
|
|
117
|
+
readonly session: BrowserSession;
|
|
118
|
+
} | ({
|
|
119
|
+
readonly launched: false;
|
|
120
|
+
} & ChromiumUnavailable);
|
|
121
|
+
export declare const CHROMIUM_INSTALL_REMEDY = "npx playwright install chromium";
|
|
122
|
+
/**
|
|
123
|
+
* Resolved at launch time, deliberately not at import time. A module-level
|
|
124
|
+
* check would make merely importing this package fail on a machine with no
|
|
125
|
+
* browser -- including for a consumer that imports it only to read a type,
|
|
126
|
+
* which is the exact cost `playwright-core` was adopted to remove.
|
|
127
|
+
*/
|
|
128
|
+
export declare function resolveChromiumExecutable(): ChromiumAvailability;
|
|
129
|
+
/** Thrown by `launchBrowserSession` when `resolveChromiumExecutable()` refuses. Carries the refusal whole, so a caller that catches rather than branching still gets the remedy. */
|
|
130
|
+
export declare class BrowserUnavailableError extends Error {
|
|
131
|
+
readonly refusal: ChromiumUnavailable["refusal"];
|
|
132
|
+
readonly remedy: string;
|
|
133
|
+
readonly expectedExecutablePath: string;
|
|
134
|
+
constructor(unavailable: ChromiumUnavailable);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The refusal-returning launch. Prefer this wherever a missing browser is a
|
|
138
|
+
* reportable outcome rather than a bug -- an MCP tool mapping it onto its own
|
|
139
|
+
* `refused` state, for instance. `launchBrowserSession` below is the same
|
|
140
|
+
* call for callers that would only rethrow.
|
|
141
|
+
*/
|
|
142
|
+
export declare function launchBrowserSessionOrRefuse(options?: BrowserSessionOptions): Promise<BrowserSessionLaunch>;
|
|
143
|
+
export declare function launchBrowserSession(options?: BrowserSessionOptions): Promise<BrowserSession>;
|
|
144
|
+
//# sourceMappingURL=browser-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-session.d.ts","sourceRoot":"","sources":["../src/browser-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAA+C,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAMzF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEvE;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AAEzD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,2JAA2J;IAC3J,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;;;;;;;OAUG;IACH,QAAQ,IAAI,OAAO,CAAC;IACpB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,aAAa,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,+DAA+D;IAC/D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gIAAgI;IAChI,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;CACzC;AAED,MAAM,MAAM,oBAAoB,GAC5B;IAAE,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GAC7D,CAAC;IAAE,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAA;CAAE,GAAG,mBAAmB,CAAC,CAAC;AAE1D,MAAM,MAAM,oBAAoB,GAC5B;IAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;CAAE,GAC7D,CAAC;IAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAA;CAAE,GAAG,mBAAmB,CAAC,CAAC;AAEzD,eAAO,MAAM,uBAAuB,oCAAoC,CAAC;AAEzE;;;;;GAKG;AACH,wBAAgB,yBAAyB,IAAI,oBAAoB,CAYhE;AAED,oLAAoL;AACpL,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;gBAE5B,WAAW,EAAE,mBAAmB;CAO7C;AAED;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAAC,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAOrH;AAED,wBAAsB,oBAAoB,CAAC,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,cAAc,CAAC,CAOvG"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* §7's launch / isolated context / page creation, as a thin wrapper over
|
|
3
|
+
* Playwright (see `documents/decisions-inbox/PROPOSAL-B-playwright-for-
|
|
4
|
+
* browser-runtime.md` for why Playwright over raw CDP). One
|
|
5
|
+
* `BrowserSession` = one Playwright `BrowserContext` (Playwright's own
|
|
6
|
+
* isolation unit -- separate cookies/storage/cache per context) plus its
|
|
7
|
+
* one page, which is what plan §7's "isolated context/session · page
|
|
8
|
+
* creation" already asks for; nothing here re-derives isolation Playwright
|
|
9
|
+
* already gives structurally.
|
|
10
|
+
*
|
|
11
|
+
* Deliberately does NOT itself turn browser-session launch into Evidence.
|
|
12
|
+
* `BrowserSessionHandle` (`execution.ts`) already carries `sessionId` /
|
|
13
|
+
* `targetUrl` / `startedAt` / `endedAt` structurally on `Execution`, the
|
|
14
|
+
* same relationship `ProcessHandle` has to process lifecycle --
|
|
15
|
+
* `backend-observation/collector.ts` declared that an equivalent non-goal
|
|
16
|
+
* for `ProcessCollector`, for the identical reason: whether session
|
|
17
|
+
* lifecycle becomes Evidence at all is an orchestration-layer question,
|
|
18
|
+
* not this seam's. Both non-goals now have an answer, in each package's
|
|
19
|
+
* own collector — `createProcessCollector` (`@descryy/runtime-controller`)
|
|
20
|
+
* and `BrowserActionCollector.start()` (`browser-action-collector.ts`,
|
|
21
|
+
* PAGE_CREATED) — never here. `startedAt` is captured below only so that
|
|
22
|
+
* answer has a real creation timestamp to report rather than "whenever a
|
|
23
|
+
* collector got around to starting."
|
|
24
|
+
*/
|
|
25
|
+
import { chromium } from "playwright-core";
|
|
26
|
+
import { randomUUID } from "node:crypto";
|
|
27
|
+
import { existsSync } from "node:fs";
|
|
28
|
+
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
|
29
|
+
import { tmpdir } from "node:os";
|
|
30
|
+
import { join } from "node:path";
|
|
31
|
+
export const CHROMIUM_INSTALL_REMEDY = "npx playwright install chromium";
|
|
32
|
+
/**
|
|
33
|
+
* Resolved at launch time, deliberately not at import time. A module-level
|
|
34
|
+
* check would make merely importing this package fail on a machine with no
|
|
35
|
+
* browser -- including for a consumer that imports it only to read a type,
|
|
36
|
+
* which is the exact cost `playwright-core` was adopted to remove.
|
|
37
|
+
*/
|
|
38
|
+
export function resolveChromiumExecutable() {
|
|
39
|
+
const executablePath = chromium.executablePath();
|
|
40
|
+
if (existsSync(executablePath))
|
|
41
|
+
return { available: true, executablePath };
|
|
42
|
+
return {
|
|
43
|
+
available: false,
|
|
44
|
+
refusal: "chromiumNotInstalled",
|
|
45
|
+
message: `No Chromium executable at ${executablePath}. This package depends on playwright-core, which ` +
|
|
46
|
+
"does not download a browser on install, so one has to be installed once before a browser session can launch.",
|
|
47
|
+
remedy: CHROMIUM_INSTALL_REMEDY,
|
|
48
|
+
expectedExecutablePath: executablePath,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** Thrown by `launchBrowserSession` when `resolveChromiumExecutable()` refuses. Carries the refusal whole, so a caller that catches rather than branching still gets the remedy. */
|
|
52
|
+
export class BrowserUnavailableError extends Error {
|
|
53
|
+
refusal;
|
|
54
|
+
remedy;
|
|
55
|
+
expectedExecutablePath;
|
|
56
|
+
constructor(unavailable) {
|
|
57
|
+
super(`${unavailable.message} Remedy: ${unavailable.remedy}`);
|
|
58
|
+
this.name = "BrowserUnavailableError";
|
|
59
|
+
this.refusal = unavailable.refusal;
|
|
60
|
+
this.remedy = unavailable.remedy;
|
|
61
|
+
this.expectedExecutablePath = unavailable.expectedExecutablePath;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The refusal-returning launch. Prefer this wherever a missing browser is a
|
|
66
|
+
* reportable outcome rather than a bug -- an MCP tool mapping it onto its own
|
|
67
|
+
* `refused` state, for instance. `launchBrowserSession` below is the same
|
|
68
|
+
* call for callers that would only rethrow.
|
|
69
|
+
*/
|
|
70
|
+
export async function launchBrowserSessionOrRefuse(options = {}) {
|
|
71
|
+
const chromiumBinary = resolveChromiumExecutable();
|
|
72
|
+
if (!chromiumBinary.available) {
|
|
73
|
+
const { available: _available, ...unavailable } = chromiumBinary;
|
|
74
|
+
return { launched: false, ...unavailable };
|
|
75
|
+
}
|
|
76
|
+
return { launched: true, session: await launchWithExecutable(options, chromiumBinary.executablePath) };
|
|
77
|
+
}
|
|
78
|
+
export async function launchBrowserSession(options = {}) {
|
|
79
|
+
const launch = await launchBrowserSessionOrRefuse(options);
|
|
80
|
+
if (!launch.launched) {
|
|
81
|
+
const { launched: _launched, ...unavailable } = launch;
|
|
82
|
+
throw new BrowserUnavailableError(unavailable);
|
|
83
|
+
}
|
|
84
|
+
return launch.session;
|
|
85
|
+
}
|
|
86
|
+
async function launchWithExecutable(options, executablePath) {
|
|
87
|
+
const browser = await chromium.launch({ headless: options.headless ?? true, executablePath });
|
|
88
|
+
const sessionId = randomUUID();
|
|
89
|
+
// A session-scoped temp dir, never a caller-supplied path -- see
|
|
90
|
+
// `BrowserConfiguration.recordVideo`'s own comment on why only the toggle
|
|
91
|
+
// is exposed. Created before newContext() because Playwright's
|
|
92
|
+
// `recordVideo.dir` must already exist and be known at context-creation
|
|
93
|
+
// time; there is no way to attach recording after the fact.
|
|
94
|
+
const videoDir = options.recordVideo === true ? await mkdtemp(join(tmpdir(), `descry-video-${sessionId}-`)) : null;
|
|
95
|
+
const context = await browser.newContext(videoDir !== null ? { recordVideo: { dir: videoDir } } : {});
|
|
96
|
+
const page = await context.newPage();
|
|
97
|
+
const startedAt = new Date().toISOString();
|
|
98
|
+
let crashed = false;
|
|
99
|
+
page.on("crash", () => {
|
|
100
|
+
crashed = true;
|
|
101
|
+
});
|
|
102
|
+
return {
|
|
103
|
+
sessionId,
|
|
104
|
+
page,
|
|
105
|
+
startedAt,
|
|
106
|
+
isUsable: () => !crashed && !page.isClosed(),
|
|
107
|
+
async close() {
|
|
108
|
+
await context.close();
|
|
109
|
+
await browser.close();
|
|
110
|
+
},
|
|
111
|
+
async finishedVideo() {
|
|
112
|
+
if (videoDir === null)
|
|
113
|
+
return null;
|
|
114
|
+
if (!page.isClosed()) {
|
|
115
|
+
throw new Error("finishedVideo() called before close() -- Playwright only finalizes a recordVideo file once its " +
|
|
116
|
+
"browser context has closed (Video.path() would otherwise hang forever waiting for a close this " +
|
|
117
|
+
"method does not itself perform). Call session.close() first.");
|
|
118
|
+
}
|
|
119
|
+
const video = page.video();
|
|
120
|
+
// Should not happen given videoDir !== null above (recordVideo was
|
|
121
|
+
// requested, so Playwright always attaches a Video to a page created
|
|
122
|
+
// under that context) -- guarded rather than asserted with `!`,
|
|
123
|
+
// because a null here would otherwise surface as a confusing crash
|
|
124
|
+
// inside readFile(undefined) instead of a clear "nothing to return."
|
|
125
|
+
if (video === null)
|
|
126
|
+
return null;
|
|
127
|
+
const videoFilePath = await video.path();
|
|
128
|
+
const bytes = await readFile(videoFilePath);
|
|
129
|
+
// Best-effort: the bytes are already safely captured above, so a
|
|
130
|
+
// cleanup failure here (e.g. already removed) must not fail the call.
|
|
131
|
+
await rm(videoDir, { recursive: true, force: true }).catch(() => { });
|
|
132
|
+
return bytes;
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=browser-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-session.js","sourceRoot":"","sources":["../src/browser-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,QAAQ,EAAgD,MAAM,iBAAiB,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAgGjC,MAAM,CAAC,MAAM,uBAAuB,GAAG,iCAAiC,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB;IACvC,MAAM,cAAc,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAC;IACjD,IAAI,UAAU,CAAC,cAAc,CAAC;QAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;IAC3E,OAAO;QACL,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,sBAAsB;QAC/B,OAAO,EACL,6BAA6B,cAAc,mDAAmD;YAC9F,8GAA8G;QAChH,MAAM,EAAE,uBAAuB;QAC/B,sBAAsB,EAAE,cAAc;KACvC,CAAC;AACJ,CAA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;QACD,KAAK,CAAC,aAAa;YACjB,IAAI,QAAQ,KAAK,IAAI;gBAAE,OAAO,IAAI,CAAC;YACnC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;gBACrB,MAAM,IAAI,KAAK,CACb,iGAAiG;oBAC/F,iGAAiG;oBACjG,8DAA8D,CACjE,CAAC;YACJ,CAAC;YACD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;YAC3B,mEAAmE;YACnE,qEAAqE;YACrE,gEAAgE;YAChE,mEAAmE;YACnE,qEAAqE;YACrE,IAAI,KAAK,KAAK,IAAI;gBAAE,OAAO,IAAI,CAAC;YAChC,MAAM,aAAa,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;YACzC,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,CAAC;YAC5C,iEAAiE;YACjE,sEAAsE;YACtE,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YACrE,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Evidence.collectorVersion`'s source for every collector in this package:
|
|
3
|
+
* this package's own `package.json` "version", read from the artifact
|
|
4
|
+
* itself rather than hand-duplicated into a second string that can drift
|
|
5
|
+
* from what actually shipped. Same idea as `nodeVersion` elsewhere in this
|
|
6
|
+
* repo (`process.version`, always known, never probed) applied to a
|
|
7
|
+
* package instead of the Node runtime.
|
|
8
|
+
*/
|
|
9
|
+
export declare const COLLECTOR_VERSION: string;
|
|
10
|
+
//# sourceMappingURL=collector-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collector-version.d.ts","sourceRoot":"","sources":["../src/collector-version.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,eAAO,MAAM,iBAAiB,EAAE,MAA6E,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Evidence.collectorVersion`'s source for every collector in this package:
|
|
3
|
+
* this package's own `package.json` "version", read from the artifact
|
|
4
|
+
* itself rather than hand-duplicated into a second string that can drift
|
|
5
|
+
* from what actually shipped. Same idea as `nodeVersion` elsewhere in this
|
|
6
|
+
* repo (`process.version`, always known, never probed) applied to a
|
|
7
|
+
* package instead of the Node runtime.
|
|
8
|
+
*/
|
|
9
|
+
import { createRequire } from "node:module";
|
|
10
|
+
const require = createRequire(import.meta.url);
|
|
11
|
+
export const COLLECTOR_VERSION = require("../package.json").version;
|
|
12
|
+
//# sourceMappingURL=collector-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collector-version.js","sourceRoot":"","sources":["../src/collector-version.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAAY,OAAO,CAAC,iBAAiB,CAAkC,CAAC,OAAO,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* §8's DOM evidence bucket: "relevant element · selector/locator · text/
|
|
3
|
+
* value when safe · accessibility information when useful." Captured
|
|
4
|
+
* alongside an action (click/type/wait) rather than as its own streamed
|
|
5
|
+
* event type -- the frozen `RuntimeEventType` vocabulary has no dedicated
|
|
6
|
+
* DOM-snapshot type, and a DOM fact is naturally "what did the element
|
|
7
|
+
* this action touched look like," not an independent stream.
|
|
8
|
+
*/
|
|
9
|
+
import type { Page } from "playwright-core";
|
|
10
|
+
export interface DomElementSnapshot {
|
|
11
|
+
readonly selector: string;
|
|
12
|
+
/** Null when the selector matched nothing -- honestly absent, not guessed. */
|
|
13
|
+
readonly tagName: string | null;
|
|
14
|
+
readonly text: string | null;
|
|
15
|
+
/** Null for non-input elements, or withheld for a password field -- "when safe" (plan §8). */
|
|
16
|
+
readonly value: string | null;
|
|
17
|
+
readonly accessibilitySnapshot: string | null;
|
|
18
|
+
}
|
|
19
|
+
export declare function captureElementSnapshot(page: Page, selector: string): Promise<DomElementSnapshot>;
|
|
20
|
+
//# sourceMappingURL=dom-evidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-evidence.d.ts","sourceRoot":"","sources":["../src/dom-evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,8FAA8F;IAC9F,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/C;AAWD,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAetG"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* §8's DOM evidence bucket: "relevant element · selector/locator · text/
|
|
3
|
+
* value when safe · accessibility information when useful." Captured
|
|
4
|
+
* alongside an action (click/type/wait) rather than as its own streamed
|
|
5
|
+
* event type -- the frozen `RuntimeEventType` vocabulary has no dedicated
|
|
6
|
+
* DOM-snapshot type, and a DOM fact is naturally "what did the element
|
|
7
|
+
* this action touched look like," not an independent stream.
|
|
8
|
+
*/
|
|
9
|
+
const VALUE_BEARING_TAGS = new Set(["input", "textarea", "select"]);
|
|
10
|
+
async function safeValue(locator, tagName) {
|
|
11
|
+
if (tagName === null || !VALUE_BEARING_TAGS.has(tagName))
|
|
12
|
+
return null;
|
|
13
|
+
const inputType = await locator.getAttribute("type").catch(() => null);
|
|
14
|
+
if (inputType === "password")
|
|
15
|
+
return null;
|
|
16
|
+
return locator.inputValue().catch(() => null);
|
|
17
|
+
}
|
|
18
|
+
export async function captureElementSnapshot(page, selector) {
|
|
19
|
+
const locator = page.locator(selector).first();
|
|
20
|
+
const matched = (await locator.count().catch(() => 0)) > 0;
|
|
21
|
+
if (!matched) {
|
|
22
|
+
return { selector, tagName: null, text: null, value: null, accessibilitySnapshot: null };
|
|
23
|
+
}
|
|
24
|
+
const tagName = await locator.evaluate((el) => el.tagName.toLowerCase()).catch(() => null);
|
|
25
|
+
const [text, value, accessibilitySnapshot] = await Promise.all([
|
|
26
|
+
locator.textContent().catch(() => null),
|
|
27
|
+
safeValue(locator, tagName),
|
|
28
|
+
locator.ariaSnapshot().catch(() => null),
|
|
29
|
+
]);
|
|
30
|
+
return { selector, tagName, text, value, accessibilitySnapshot };
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=dom-evidence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-evidence.js","sourceRoot":"","sources":["../src/dom-evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAcH,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEpE,KAAK,UAAU,SAAS,CAAC,OAAgB,EAAE,OAAsB;IAC/D,IAAI,OAAO,KAAK,IAAI,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IACtE,MAAM,SAAS,GAAG,MAAM,OAA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AE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch-initiator capture — the page-side half of resolving *which*
|
|
3
|
+
* frontend function issued an observed request, not merely which functions
|
|
4
|
+
* the graph says are capable of it (`resolveFrontendCallers`'s own
|
|
5
|
+
* structural limit, `@descryy/runtime-graph-correlator`).
|
|
6
|
+
*
|
|
7
|
+
* **This is a write, not a read**, in the sense
|
|
8
|
+
* `PROPOSAL-code-injection-into-observed-processes.md` asks every injection
|
|
9
|
+
* mechanism to state for itself: the wrapped `fetch()` adds a real header
|
|
10
|
+
* (`x-descry-initiator-id`) to a real outgoing request. That line does not
|
|
11
|
+
* run when Descry is not attached — a same-origin request can pick up a
|
|
12
|
+
* fresh CORS preflight it would not otherwise have had. That side effect is
|
|
13
|
+
* the one `PROPOSAL-observed-frontend-caller-needs-initiator-capture.md`
|
|
14
|
+
* asked a human to sign off on before this was built; nothing here reopens
|
|
15
|
+
* that call.
|
|
16
|
+
*
|
|
17
|
+
* The call-site stack itself never travels over the wire that carries the
|
|
18
|
+
* application's own traffic — only a short, opaque per-call id does, as the
|
|
19
|
+
* header value. The stack text instead travels over Playwright's own CDP
|
|
20
|
+
* binding channel (`page.exposeFunction`), straight to `take()` below,
|
|
21
|
+
* keyed by that same id.
|
|
22
|
+
*
|
|
23
|
+
* **Why the real `fetch()` is held until the exposed call returns.** Firing
|
|
24
|
+
* the buffering call and the real request concurrently would make
|
|
25
|
+
* correctness depend on which of two independent async channels — the CDP
|
|
26
|
+
* binding call, and Chromium's own network stack — happens to land at this
|
|
27
|
+
* process first. That is exactly the kind of timing assumption §27's
|
|
28
|
+
* "similarity must never be treated as causality" rules out. Awaiting the
|
|
29
|
+
* binding call before dispatching `fetch` makes the ordering true by
|
|
30
|
+
* construction instead: the real request cannot be sent until this module
|
|
31
|
+
* has already buffered the stack it will be looked up by.
|
|
32
|
+
*
|
|
33
|
+
* Chromium only — `page.addInitScript` + `page.exposeFunction` is the
|
|
34
|
+
* mechanism, and no non-CDP-based engine here exposes an equivalent pair.
|
|
35
|
+
* `fetch()` only, not `XMLHttpRequest`. Both boundaries are the scope
|
|
36
|
+
* `PROPOSAL-observed-frontend-caller-needs-initiator-capture.md` drew, not
|
|
37
|
+
* an oversight of this module.
|
|
38
|
+
*/
|
|
39
|
+
import type { Page } from "playwright-core";
|
|
40
|
+
export declare const INITIATOR_HEADER_NAME = "x-descry-initiator-id";
|
|
41
|
+
export interface FrontendInitiatorCapture {
|
|
42
|
+
/**
|
|
43
|
+
* Wraps `window.fetch` in every document this page loads from this point
|
|
44
|
+
* forward — `page.addInitScript`'s own contract: it does not retroactively
|
|
45
|
+
* reach a document already loaded. Call before navigating to whatever the
|
|
46
|
+
* caller wants covered, exactly like `BrowserConsoleCollector`'s own
|
|
47
|
+
* `page.on(...)` registration ordering.
|
|
48
|
+
*/
|
|
49
|
+
install(page: Page): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Pops the buffered raw `Error.stack` text captured for `id`, or
|
|
52
|
+
* `undefined` — the header never reached this collector, the id was never
|
|
53
|
+
* issued by this capture (a stale id, a different page), or the buffer
|
|
54
|
+
* evicted it under `MAX_BUFFERED_STACKS`. Popped rather than peeked: a
|
|
55
|
+
* captured stack is consumed by the one request it was captured for, and
|
|
56
|
+
* leaving it behind would let a second, unrelated lookup of a reused id
|
|
57
|
+
* (impossible by construction here, but not worth relying on) read
|
|
58
|
+
* another request's call site.
|
|
59
|
+
*/
|
|
60
|
+
take(id: string): string | undefined;
|
|
61
|
+
}
|
|
62
|
+
export declare function createFrontendInitiatorCapture(): FrontendInitiatorCapture;
|
|
63
|
+
/**
|
|
64
|
+
* Strips `descryFetch`'s own frame from a raw V8 stack, so the remaining
|
|
65
|
+
* text's first frame is the real call site rather than this module's own
|
|
66
|
+
* wrapper.
|
|
67
|
+
*
|
|
68
|
+
* **Why this can be a fixed "drop the first frame line" rule rather than a
|
|
69
|
+
* search for a named function.** `new Error().stack` is captured
|
|
70
|
+
* synchronously, as the wrapper's first statement — before the `await`-
|
|
71
|
+
* shaped `.then(dispatch)` chain below it ever runs. V8's stack is built
|
|
72
|
+
* from the synchronous call chain live at capture time, so the innermost
|
|
73
|
+
* frame is deterministically `descryFetch` itself, every time, regardless
|
|
74
|
+
* of what called it. Stripping by *position* (first frame line) rather than
|
|
75
|
+
* by *name* also survives minification of this wrapper's own name, which a
|
|
76
|
+
* name-based strip would not.
|
|
77
|
+
*
|
|
78
|
+
* Applied to raw text, before parsing — same reasoning
|
|
79
|
+
* `rewriteScriptUrls`'s own doc gives for rewriting before rather than
|
|
80
|
+
* after: `createV8StackTraceParser` already treats frame 0 of whatever it
|
|
81
|
+
* receives as `primaryFrameIndex`, so removing the wrapper's line here
|
|
82
|
+
* means the parser's existing, already-tested convention does the right
|
|
83
|
+
* thing unmodified, instead of teaching every consumer a second index to
|
|
84
|
+
* skip.
|
|
85
|
+
*/
|
|
86
|
+
export declare function stripInitiatorWrapperFrame(rawStackText: string): string;
|
|
87
|
+
//# sourceMappingURL=frontend-initiator-capture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontend-initiator-capture.d.ts","sourceRoot":"","sources":["../src/frontend-initiator-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAc7D,MAAM,WAAW,wBAAwB;IACvC;;;;;;OAMG;IACH,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACtC;AAED,wBAAgB,8BAA8B,IAAI,wBAAwB,CAsBzE;AA4CD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAKvE"}
|