@webhands/core 0.1.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/cookies-export.d.ts +56 -0
- package/dist/cookies-export.d.ts.map +1 -0
- package/dist/cookies-export.js +69 -0
- package/dist/cookies-export.js.map +1 -0
- package/dist/errors.d.ts +126 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +135 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/playwright-attach-transport.d.ts +28 -0
- package/dist/playwright-attach-transport.d.ts.map +1 -0
- package/dist/playwright-attach-transport.js +175 -0
- package/dist/playwright-attach-transport.js.map +1 -0
- package/dist/playwright-launch-transport.d.ts +90 -0
- package/dist/playwright-launch-transport.d.ts.map +1 -0
- package/dist/playwright-launch-transport.js +305 -0
- package/dist/playwright-launch-transport.js.map +1 -0
- package/dist/profile-location.d.ts +61 -0
- package/dist/profile-location.d.ts.map +1 -0
- package/dist/profile-location.js +61 -0
- package/dist/profile-location.js.map +1 -0
- package/dist/remote-session.d.ts +22 -0
- package/dist/remote-session.d.ts.map +1 -0
- package/dist/remote-session.js +57 -0
- package/dist/remote-session.js.map +1 -0
- package/dist/seam.d.ts +212 -0
- package/dist/seam.d.ts.map +1 -0
- package/dist/seam.js +25 -0
- package/dist/seam.js.map +1 -0
- package/dist/session-endpoint.d.ts +53 -0
- package/dist/session-endpoint.d.ts.map +1 -0
- package/dist/session-endpoint.js +75 -0
- package/dist/session-endpoint.js.map +1 -0
- package/dist/session-rpc.d.ts +82 -0
- package/dist/session-rpc.d.ts.map +1 -0
- package/dist/session-rpc.js +107 -0
- package/dist/session-rpc.js.map +1 -0
- package/dist/session-server.d.ts +79 -0
- package/dist/session-server.d.ts.map +1 -0
- package/dist/session-server.js +141 -0
- package/dist/session-server.js.map +1 -0
- package/dist/setup-profile.d.ts +84 -0
- package/dist/setup-profile.d.ts.map +1 -0
- package/dist/setup-profile.js +52 -0
- package/dist/setup-profile.js.map +1 -0
- package/dist/stub-transport.d.ts +26 -0
- package/dist/stub-transport.d.ts.map +1 -0
- package/dist/stub-transport.js +76 -0
- package/dist/stub-transport.js.map +1 -0
- package/dist/test-fixtures/fixture-pages.d.ts +12 -0
- package/dist/test-fixtures/fixture-pages.d.ts.map +1 -0
- package/dist/test-fixtures/fixture-pages.js +204 -0
- package/dist/test-fixtures/fixture-pages.js.map +1 -0
- package/dist/test-fixtures/fixture-server.d.ts +19 -0
- package/dist/test-fixtures/fixture-server.d.ts.map +1 -0
- package/dist/test-fixtures/fixture-server.js +41 -0
- package/dist/test-fixtures/fixture-server.js.map +1 -0
- package/package.json +34 -0
- package/src/cookies-export.ts +91 -0
- package/src/errors.ts +185 -0
- package/src/index.ts +89 -0
- package/src/playwright-attach-transport.ts +214 -0
- package/src/playwright-launch-transport.ts +363 -0
- package/src/profile-location.ts +92 -0
- package/src/remote-session.ts +66 -0
- package/src/seam.ts +222 -0
- package/src/session-endpoint.ts +104 -0
- package/src/session-rpc.ts +143 -0
- package/src/session-server.ts +231 -0
- package/src/setup-profile.ts +134 -0
- package/src/stub-transport.ts +100 -0
- package/src/test-fixtures/fixture-pages.ts +210 -0
- package/src/test-fixtures/fixture-server.ts +54 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `cookies export` / `cookies import` verb's FILE FORMAT (PRD story 11).
|
|
3
|
+
*
|
|
4
|
+
* The seam already carries the transport-neutral cookie primitives:
|
|
5
|
+
* {@link Page.cookies} reads the active context's cookies and
|
|
6
|
+
* {@link Page.setCookies} loads cookies into it. The export/import VERB is built
|
|
7
|
+
* ON TOP of those two methods (the forward-note: refine the existing seam,
|
|
8
|
+
* do NOT add a parallel cookie path). What this module adds is only the
|
|
9
|
+
* SERIALIZATION the verb needs to move a session to/from disk: how a
|
|
10
|
+
* `Cookie[]` is written to (and read back from) an export file.
|
|
11
|
+
*
|
|
12
|
+
* The format is deliberately transport-neutral JSON of the seam's own
|
|
13
|
+
* {@link Cookie} type (no CDP/Playwright type, ADR-0003): a small envelope
|
|
14
|
+
* (`{version, cookies}`) so the file is self-describing and a future format
|
|
15
|
+
* change can be detected rather than silently mis-parsed. Both the CLI verb and
|
|
16
|
+
* the round-trip test share THIS one source of truth for the format, so the
|
|
17
|
+
* thing a user backs up and the thing import reads back can never drift apart.
|
|
18
|
+
*/
|
|
19
|
+
import type { Cookie } from './seam.js';
|
|
20
|
+
/**
|
|
21
|
+
* The current export-file schema version. Bumped only on a
|
|
22
|
+
* backwards-INCOMPATIBLE format change; {@link deserializeCookies} rejects an
|
|
23
|
+
* unknown version rather than guessing.
|
|
24
|
+
*/
|
|
25
|
+
export declare const COOKIES_EXPORT_VERSION: 1;
|
|
26
|
+
/**
|
|
27
|
+
* The on-disk shape of an exported session: a versioned envelope around the
|
|
28
|
+
* transport-neutral {@link Cookie} list. Self-describing so import can verify
|
|
29
|
+
* it is reading a format it understands.
|
|
30
|
+
*/
|
|
31
|
+
export interface CookiesExport {
|
|
32
|
+
/** Format version (see {@link COOKIES_EXPORT_VERSION}). */
|
|
33
|
+
readonly version: typeof COOKIES_EXPORT_VERSION;
|
|
34
|
+
/** The exported cookies, exactly as the seam's {@link Page.cookies} returns them. */
|
|
35
|
+
readonly cookies: readonly Cookie[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Serialize the cookies read from the seam ({@link Page.cookies}) into the
|
|
39
|
+
* export file's text. Pretty-printed JSON so a human can read/diff a backed-up
|
|
40
|
+
* session. This is pure: it does NO disk I/O, so the caller (the CLI verb, a
|
|
41
|
+
* test) owns WHERE the file lands — which is what lets a test keep its export
|
|
42
|
+
* file in its own temp dir.
|
|
43
|
+
*/
|
|
44
|
+
export declare function serializeCookies(cookies: readonly Cookie[]): string;
|
|
45
|
+
/**
|
|
46
|
+
* Parse an export file's text back into the cookies to hand to the seam's
|
|
47
|
+
* {@link Page.setCookies} ({@link parse} is pure; the caller does the disk read
|
|
48
|
+
* and the `setCookies` call). Rejects anything that is not a recognised export
|
|
49
|
+
* envelope so a corrupt or wrong-version file surfaces as a clear error rather
|
|
50
|
+
* than silently importing nothing or a half-parsed list.
|
|
51
|
+
*
|
|
52
|
+
* @throws Error if the text is not valid JSON, not the expected envelope shape,
|
|
53
|
+
* or carries an unknown {@link COOKIES_EXPORT_VERSION}.
|
|
54
|
+
*/
|
|
55
|
+
export declare function deserializeCookies(text: string): readonly Cookie[];
|
|
56
|
+
//# sourceMappingURL=cookies-export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookies-export.d.ts","sourceRoot":"","sources":["../src/cookies-export.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAG,CAAU,CAAC;AAEjD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC7B,2DAA2D;IAC3D,QAAQ,CAAC,OAAO,EAAE,OAAO,sBAAsB,CAAC;IAChD,qFAAqF;IACrF,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAMnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAyBlE"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `cookies export` / `cookies import` verb's FILE FORMAT (PRD story 11).
|
|
3
|
+
*
|
|
4
|
+
* The seam already carries the transport-neutral cookie primitives:
|
|
5
|
+
* {@link Page.cookies} reads the active context's cookies and
|
|
6
|
+
* {@link Page.setCookies} loads cookies into it. The export/import VERB is built
|
|
7
|
+
* ON TOP of those two methods (the forward-note: refine the existing seam,
|
|
8
|
+
* do NOT add a parallel cookie path). What this module adds is only the
|
|
9
|
+
* SERIALIZATION the verb needs to move a session to/from disk: how a
|
|
10
|
+
* `Cookie[]` is written to (and read back from) an export file.
|
|
11
|
+
*
|
|
12
|
+
* The format is deliberately transport-neutral JSON of the seam's own
|
|
13
|
+
* {@link Cookie} type (no CDP/Playwright type, ADR-0003): a small envelope
|
|
14
|
+
* (`{version, cookies}`) so the file is self-describing and a future format
|
|
15
|
+
* change can be detected rather than silently mis-parsed. Both the CLI verb and
|
|
16
|
+
* the round-trip test share THIS one source of truth for the format, so the
|
|
17
|
+
* thing a user backs up and the thing import reads back can never drift apart.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* The current export-file schema version. Bumped only on a
|
|
21
|
+
* backwards-INCOMPATIBLE format change; {@link deserializeCookies} rejects an
|
|
22
|
+
* unknown version rather than guessing.
|
|
23
|
+
*/
|
|
24
|
+
export const COOKIES_EXPORT_VERSION = 1;
|
|
25
|
+
/**
|
|
26
|
+
* Serialize the cookies read from the seam ({@link Page.cookies}) into the
|
|
27
|
+
* export file's text. Pretty-printed JSON so a human can read/diff a backed-up
|
|
28
|
+
* session. This is pure: it does NO disk I/O, so the caller (the CLI verb, a
|
|
29
|
+
* test) owns WHERE the file lands — which is what lets a test keep its export
|
|
30
|
+
* file in its own temp dir.
|
|
31
|
+
*/
|
|
32
|
+
export function serializeCookies(cookies) {
|
|
33
|
+
const payload = {
|
|
34
|
+
version: COOKIES_EXPORT_VERSION,
|
|
35
|
+
cookies,
|
|
36
|
+
};
|
|
37
|
+
return JSON.stringify(payload, null, '\t') + '\n';
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Parse an export file's text back into the cookies to hand to the seam's
|
|
41
|
+
* {@link Page.setCookies} ({@link parse} is pure; the caller does the disk read
|
|
42
|
+
* and the `setCookies` call). Rejects anything that is not a recognised export
|
|
43
|
+
* envelope so a corrupt or wrong-version file surfaces as a clear error rather
|
|
44
|
+
* than silently importing nothing or a half-parsed list.
|
|
45
|
+
*
|
|
46
|
+
* @throws Error if the text is not valid JSON, not the expected envelope shape,
|
|
47
|
+
* or carries an unknown {@link COOKIES_EXPORT_VERSION}.
|
|
48
|
+
*/
|
|
49
|
+
export function deserializeCookies(text) {
|
|
50
|
+
let parsed;
|
|
51
|
+
try {
|
|
52
|
+
parsed = JSON.parse(text);
|
|
53
|
+
}
|
|
54
|
+
catch (cause) {
|
|
55
|
+
throw new Error('cookies import: file is not valid JSON', { cause });
|
|
56
|
+
}
|
|
57
|
+
if (typeof parsed !== 'object' || parsed === null) {
|
|
58
|
+
throw new Error('cookies import: file is not a cookies export envelope');
|
|
59
|
+
}
|
|
60
|
+
const envelope = parsed;
|
|
61
|
+
if (envelope.version !== COOKIES_EXPORT_VERSION) {
|
|
62
|
+
throw new Error(`cookies import: unsupported export version ${String(envelope.version)} (expected ${COOKIES_EXPORT_VERSION})`);
|
|
63
|
+
}
|
|
64
|
+
if (!Array.isArray(envelope.cookies)) {
|
|
65
|
+
throw new Error('cookies import: export envelope has no cookies array');
|
|
66
|
+
}
|
|
67
|
+
return envelope.cookies;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=cookies-export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookies-export.js","sourceRoot":"","sources":["../src/cookies-export.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAU,CAAC;AAcjD;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAA0B;IAC1D,MAAM,OAAO,GAAkB;QAC9B,OAAO,EAAE,sBAAsB;QAC/B,OAAO;KACP,CAAC;IACF,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC;AACnD,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC9C,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACJ,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,wCAAwC,EAAE,EAAC,KAAK,EAAC,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC1E,CAAC;IAED,MAAM,QAAQ,GAAG,MAAgD,CAAC;IAClE,IAAI,QAAQ,CAAC,OAAO,KAAK,sBAAsB,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CACd,8CAA8C,MAAM,CACnD,QAAQ,CAAC,OAAO,CAChB,cAAc,sBAAsB,GAAG,CACxC,CAAC;IACH,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACzE,CAAC;IAED,OAAO,QAAQ,CAAC,OAA4B,CAAC;AAC9C,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed, identifiable `core` error conditions.
|
|
3
|
+
*
|
|
4
|
+
* These are raised by the concrete transports (the v1 Playwright launch
|
|
5
|
+
* transport, and later `attach`/`setup-profile`) so that the `cli` package
|
|
6
|
+
* (`cli-incur-wiring-and-errors`, PRD story 17) can render the EXACT
|
|
7
|
+
* fix-command message without re-detecting the condition. This module OWNS the
|
|
8
|
+
* typed condition; the CLI owns the user-facing message text.
|
|
9
|
+
*
|
|
10
|
+
* The discriminator is the string-literal {@link ControllerError.code}. A
|
|
11
|
+
* caller branches on `code` (a stable, machine-readable tag) rather than
|
|
12
|
+
* matching on a message string, which is presentation and may change. Each
|
|
13
|
+
* error also carries the structured context the CLI needs to compose its fix
|
|
14
|
+
* command (e.g. the profile name, the resolved profile dir) so the CLI never
|
|
15
|
+
* has to re-derive paths.
|
|
16
|
+
*/
|
|
17
|
+
/** The closed set of identifiable `core` error conditions. */
|
|
18
|
+
export type ControllerErrorCode = 'missing-browser-binary' | 'missing-profile' | 'attach-not-chromium' | 'attach-no-context' | 'no-live-server' | 'session-already-active';
|
|
19
|
+
/**
|
|
20
|
+
* Base class for every identifiable `core` error. Branch on {@link code}.
|
|
21
|
+
*
|
|
22
|
+
* Use {@link isControllerError} to narrow an `unknown` caught value to this
|
|
23
|
+
* type across a package/bundle boundary (where `instanceof` can be unreliable);
|
|
24
|
+
* the `code` tag is the contract, not the class identity.
|
|
25
|
+
*/
|
|
26
|
+
export declare abstract class ControllerError extends Error {
|
|
27
|
+
/** Machine-readable discriminator; stable across versions. */
|
|
28
|
+
abstract readonly code: ControllerErrorCode;
|
|
29
|
+
/** Brand so {@link isControllerError} can narrow across bundle boundaries. */
|
|
30
|
+
readonly isControllerError: true;
|
|
31
|
+
constructor(message: string, options?: {
|
|
32
|
+
cause?: unknown;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The browser binary Playwright needs is not installed (e.g.
|
|
37
|
+
* `playwright install chromium` was never run). Surfaced so the CLI can tell
|
|
38
|
+
* the user the exact install command.
|
|
39
|
+
*/
|
|
40
|
+
export declare class MissingBrowserBinaryError extends ControllerError {
|
|
41
|
+
readonly code = "missing-browser-binary";
|
|
42
|
+
/** The browser whose binary is missing (e.g. `chromium`). */
|
|
43
|
+
readonly browser: string;
|
|
44
|
+
constructor(browser: string, message?: string, options?: {
|
|
45
|
+
cause?: unknown;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The named profile has not been set up yet: its dedicated profile directory
|
|
50
|
+
* does not exist on disk. A profile is created by the headed `setup-profile`
|
|
51
|
+
* flow; `launch` against a not-yet-set-up profile raises this so the CLI can
|
|
52
|
+
* tell the user to run `setup-profile` first.
|
|
53
|
+
*/
|
|
54
|
+
export declare class MissingProfileError extends ControllerError {
|
|
55
|
+
readonly code = "missing-profile";
|
|
56
|
+
/** The name of the profile that is not set up. */
|
|
57
|
+
readonly profile: string;
|
|
58
|
+
/** The dedicated profile directory that was expected to exist. */
|
|
59
|
+
readonly profileDir: string;
|
|
60
|
+
constructor(profile: string, profileDir: string, message?: string, options?: {
|
|
61
|
+
cause?: unknown;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The `attach` transport connected to a browser that is NOT Chromium. CDP-attach
|
|
66
|
+
* (`connectOverCDP`) is Chromium-only (ADR-0002/0003: Firefox attaches via a
|
|
67
|
+
* different mechanism), so attaching to anything else cannot reuse the live
|
|
68
|
+
* context and is refused. Surfaced as a typed condition so the CLI can tell the
|
|
69
|
+
* user attach is Chromium-only WITHOUT the seam ever naming CDP/Chromium types.
|
|
70
|
+
*/
|
|
71
|
+
export declare class AttachNotChromiumError extends ControllerError {
|
|
72
|
+
readonly code = "attach-not-chromium";
|
|
73
|
+
/** The browser engine actually reached at the endpoint (e.g. `firefox`). */
|
|
74
|
+
readonly browser: string;
|
|
75
|
+
constructor(browser: string, message?: string, options?: {
|
|
76
|
+
cause?: unknown;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The browser reached at the attach endpoint exposes no browser context to
|
|
81
|
+
* reuse. attach deliberately reuses the user's EXISTING authenticated context
|
|
82
|
+
* (`contexts()[0]`) and never opens a fresh one (ADR-0002), so a browser with
|
|
83
|
+
* zero contexts is a refusal, not a silent `newContext()`.
|
|
84
|
+
*/
|
|
85
|
+
export declare class AttachNoContextError extends ControllerError {
|
|
86
|
+
readonly code = "attach-no-context";
|
|
87
|
+
/** The endpoint that exposed no reusable context. */
|
|
88
|
+
readonly endpoint: string;
|
|
89
|
+
constructor(endpoint: string, message?: string, options?: {
|
|
90
|
+
cause?: unknown;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* No long-lived served session is running (no endpoint file under the config
|
|
95
|
+
* dir), so a thin-client verb has nothing to drive (ADR-0005). Surfaced so the
|
|
96
|
+
* CLI can tell the user to run `serve` first rather than auto-spawning a browser
|
|
97
|
+
* (lifecycle is EXPLICIT in v1). This is the cross-invocation analogue of
|
|
98
|
+
* {@link MissingProfileError}: a precondition the user resolves with one named
|
|
99
|
+
* command.
|
|
100
|
+
*/
|
|
101
|
+
export declare class NoLiveServerError extends ControllerError {
|
|
102
|
+
readonly code = "no-live-server";
|
|
103
|
+
constructor(message?: string, options?: {
|
|
104
|
+
cause?: unknown;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* A second `serve`/`launch`/`attach` was requested while one session is already
|
|
109
|
+
* live. v1 holds EXACTLY ONE session (ADR-0005, single session); a concurrent
|
|
110
|
+
* open is a clear refusal, not a second browser. Surfaced so the CLI can tell
|
|
111
|
+
* the user to stop the active session first.
|
|
112
|
+
*/
|
|
113
|
+
export declare class SessionAlreadyActiveError extends ControllerError {
|
|
114
|
+
readonly code = "session-already-active";
|
|
115
|
+
constructor(message?: string, options?: {
|
|
116
|
+
cause?: unknown;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Narrow an unknown caught value to a {@link ControllerError}. Prefer this over
|
|
121
|
+
* `instanceof` at package boundaries: it checks the {@link ControllerError.isControllerError}
|
|
122
|
+
* brand and a known {@link ControllerErrorCode}, so it survives duplicate
|
|
123
|
+
* copies of this module in different bundles.
|
|
124
|
+
*/
|
|
125
|
+
export declare function isControllerError(value: unknown): value is ControllerError;
|
|
126
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,8DAA8D;AAC9D,MAAM,MAAM,mBAAmB,GAC5B,wBAAwB,GACxB,iBAAiB,GACjB,qBAAqB,GACrB,mBAAmB,GACnB,gBAAgB,GAChB,wBAAwB,CAAC;AAE5B;;;;;;GAMG;AACH,8BAAsB,eAAgB,SAAQ,KAAK;IAClD,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IAC5C,8EAA8E;IAC9E,QAAQ,CAAC,iBAAiB,EAAG,IAAI,CAAU;gBAE/B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAC;CAMxD;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,eAAe;IAC7D,QAAQ,CAAC,IAAI,4BAA4B;IACzC,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAGxB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,MAA0D,EACnE,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAC;CAK5B;AAED;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,eAAe;IACvD,QAAQ,CAAC,IAAI,qBAAqB;IAClC,kDAAkD;IAClD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kEAAkE;IAClE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAG3B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,MAA0F,EACnG,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAC;CAM5B;AAED;;;;;;GAMG;AACH,qBAAa,sBAAuB,SAAQ,eAAe;IAC1D,QAAQ,CAAC,IAAI,yBAAyB;IACtC,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAGxB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,MAAuJ,EAChK,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAC;CAK5B;AAED;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,eAAe;IACxD,QAAQ,CAAC,IAAI,uBAAuB;IACpC,qDAAqD;IACrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBAGzB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,MAA+H,EACxI,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAC;CAK5B;AAED;;;;;;;GAOG;AACH,qBAAa,iBAAkB,SAAQ,eAAe;IACrD,QAAQ,CAAC,IAAI,oBAAoB;gBAGhC,OAAO,GAAE,MAAoF,EAC7F,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAC;CAI5B;AAED;;;;;GAKG;AACH,qBAAa,yBAA0B,SAAQ,eAAe;IAC7D,QAAQ,CAAC,IAAI,4BAA4B;gBAGxC,OAAO,GAAE,MAAmE,EAC5E,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAC;CAI5B;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAO1E"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed, identifiable `core` error conditions.
|
|
3
|
+
*
|
|
4
|
+
* These are raised by the concrete transports (the v1 Playwright launch
|
|
5
|
+
* transport, and later `attach`/`setup-profile`) so that the `cli` package
|
|
6
|
+
* (`cli-incur-wiring-and-errors`, PRD story 17) can render the EXACT
|
|
7
|
+
* fix-command message without re-detecting the condition. This module OWNS the
|
|
8
|
+
* typed condition; the CLI owns the user-facing message text.
|
|
9
|
+
*
|
|
10
|
+
* The discriminator is the string-literal {@link ControllerError.code}. A
|
|
11
|
+
* caller branches on `code` (a stable, machine-readable tag) rather than
|
|
12
|
+
* matching on a message string, which is presentation and may change. Each
|
|
13
|
+
* error also carries the structured context the CLI needs to compose its fix
|
|
14
|
+
* command (e.g. the profile name, the resolved profile dir) so the CLI never
|
|
15
|
+
* has to re-derive paths.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Base class for every identifiable `core` error. Branch on {@link code}.
|
|
19
|
+
*
|
|
20
|
+
* Use {@link isControllerError} to narrow an `unknown` caught value to this
|
|
21
|
+
* type across a package/bundle boundary (where `instanceof` can be unreliable);
|
|
22
|
+
* the `code` tag is the contract, not the class identity.
|
|
23
|
+
*/
|
|
24
|
+
export class ControllerError extends Error {
|
|
25
|
+
/** Brand so {@link isControllerError} can narrow across bundle boundaries. */
|
|
26
|
+
isControllerError = true;
|
|
27
|
+
constructor(message, options) {
|
|
28
|
+
super(message, options);
|
|
29
|
+
// Preserve the concrete subclass name (Error's constructor sets it to
|
|
30
|
+
// `Error` under some transpile targets).
|
|
31
|
+
this.name = new.target.name;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The browser binary Playwright needs is not installed (e.g.
|
|
36
|
+
* `playwright install chromium` was never run). Surfaced so the CLI can tell
|
|
37
|
+
* the user the exact install command.
|
|
38
|
+
*/
|
|
39
|
+
export class MissingBrowserBinaryError extends ControllerError {
|
|
40
|
+
code = 'missing-browser-binary';
|
|
41
|
+
/** The browser whose binary is missing (e.g. `chromium`). */
|
|
42
|
+
browser;
|
|
43
|
+
constructor(browser, message = `The ${browser} browser binary is not installed.`, options) {
|
|
44
|
+
super(message, options);
|
|
45
|
+
this.browser = browser;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The named profile has not been set up yet: its dedicated profile directory
|
|
50
|
+
* does not exist on disk. A profile is created by the headed `setup-profile`
|
|
51
|
+
* flow; `launch` against a not-yet-set-up profile raises this so the CLI can
|
|
52
|
+
* tell the user to run `setup-profile` first.
|
|
53
|
+
*/
|
|
54
|
+
export class MissingProfileError extends ControllerError {
|
|
55
|
+
code = 'missing-profile';
|
|
56
|
+
/** The name of the profile that is not set up. */
|
|
57
|
+
profile;
|
|
58
|
+
/** The dedicated profile directory that was expected to exist. */
|
|
59
|
+
profileDir;
|
|
60
|
+
constructor(profile, profileDir, message = `The "${profile}" profile is not set up (no profile directory at ${profileDir}).`, options) {
|
|
61
|
+
super(message, options);
|
|
62
|
+
this.profile = profile;
|
|
63
|
+
this.profileDir = profileDir;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The `attach` transport connected to a browser that is NOT Chromium. CDP-attach
|
|
68
|
+
* (`connectOverCDP`) is Chromium-only (ADR-0002/0003: Firefox attaches via a
|
|
69
|
+
* different mechanism), so attaching to anything else cannot reuse the live
|
|
70
|
+
* context and is refused. Surfaced as a typed condition so the CLI can tell the
|
|
71
|
+
* user attach is Chromium-only WITHOUT the seam ever naming CDP/Chromium types.
|
|
72
|
+
*/
|
|
73
|
+
export class AttachNotChromiumError extends ControllerError {
|
|
74
|
+
code = 'attach-not-chromium';
|
|
75
|
+
/** The browser engine actually reached at the endpoint (e.g. `firefox`). */
|
|
76
|
+
browser;
|
|
77
|
+
constructor(browser, message = `attach is Chromium-only; the endpoint exposes a "${browser}" browser. Start Chromium/Chrome with --remote-debugging-port and attach to that.`, options) {
|
|
78
|
+
super(message, options);
|
|
79
|
+
this.browser = browser;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The browser reached at the attach endpoint exposes no browser context to
|
|
84
|
+
* reuse. attach deliberately reuses the user's EXISTING authenticated context
|
|
85
|
+
* (`contexts()[0]`) and never opens a fresh one (ADR-0002), so a browser with
|
|
86
|
+
* zero contexts is a refusal, not a silent `newContext()`.
|
|
87
|
+
*/
|
|
88
|
+
export class AttachNoContextError extends ControllerError {
|
|
89
|
+
code = 'attach-no-context';
|
|
90
|
+
/** The endpoint that exposed no reusable context. */
|
|
91
|
+
endpoint;
|
|
92
|
+
constructor(endpoint, message = `attach found no existing browser context at ${endpoint} to reuse. Open a window/tab in the browser before attaching.`, options) {
|
|
93
|
+
super(message, options);
|
|
94
|
+
this.endpoint = endpoint;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* No long-lived served session is running (no endpoint file under the config
|
|
99
|
+
* dir), so a thin-client verb has nothing to drive (ADR-0005). Surfaced so the
|
|
100
|
+
* CLI can tell the user to run `serve` first rather than auto-spawning a browser
|
|
101
|
+
* (lifecycle is EXPLICIT in v1). This is the cross-invocation analogue of
|
|
102
|
+
* {@link MissingProfileError}: a precondition the user resolves with one named
|
|
103
|
+
* command.
|
|
104
|
+
*/
|
|
105
|
+
export class NoLiveServerError extends ControllerError {
|
|
106
|
+
code = 'no-live-server';
|
|
107
|
+
constructor(message = 'No live webhands session server is running. Start one with `serve` first.', options) {
|
|
108
|
+
super(message, options);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* A second `serve`/`launch`/`attach` was requested while one session is already
|
|
113
|
+
* live. v1 holds EXACTLY ONE session (ADR-0005, single session); a concurrent
|
|
114
|
+
* open is a clear refusal, not a second browser. Surfaced so the CLI can tell
|
|
115
|
+
* the user to stop the active session first.
|
|
116
|
+
*/
|
|
117
|
+
export class SessionAlreadyActiveError extends ControllerError {
|
|
118
|
+
code = 'session-already-active';
|
|
119
|
+
constructor(message = 'A session is already active; stop it first (run `stop`).', options) {
|
|
120
|
+
super(message, options);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Narrow an unknown caught value to a {@link ControllerError}. Prefer this over
|
|
125
|
+
* `instanceof` at package boundaries: it checks the {@link ControllerError.isControllerError}
|
|
126
|
+
* brand and a known {@link ControllerErrorCode}, so it survives duplicate
|
|
127
|
+
* copies of this module in different bundles.
|
|
128
|
+
*/
|
|
129
|
+
export function isControllerError(value) {
|
|
130
|
+
return (typeof value === 'object' &&
|
|
131
|
+
value !== null &&
|
|
132
|
+
value.isControllerError === true &&
|
|
133
|
+
typeof value.code === 'string');
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAWH;;;;;;GAMG;AACH,MAAM,OAAgB,eAAgB,SAAQ,KAAK;IAGlD,8EAA8E;IACrE,iBAAiB,GAAG,IAAa,CAAC;IAE3C,YAAY,OAAe,EAAE,OAA2B;QACvD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,sEAAsE;QACtE,yCAAyC;QACzC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;IAC7B,CAAC;CACD;AAED;;;;GAIG;AACH,MAAM,OAAO,yBAA0B,SAAQ,eAAe;IACpD,IAAI,GAAG,wBAAwB,CAAC;IACzC,6DAA6D;IACpD,OAAO,CAAS;IAEzB,YACC,OAAe,EACf,UAAkB,OAAO,OAAO,mCAAmC,EACnE,OAA2B;QAE3B,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;CACD;AAED;;;;;GAKG;AACH,MAAM,OAAO,mBAAoB,SAAQ,eAAe;IAC9C,IAAI,GAAG,iBAAiB,CAAC;IAClC,kDAAkD;IACzC,OAAO,CAAS;IACzB,kEAAkE;IACzD,UAAU,CAAS;IAE5B,YACC,OAAe,EACf,UAAkB,EAClB,UAAkB,QAAQ,OAAO,oDAAoD,UAAU,IAAI,EACnG,OAA2B;QAE3B,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC9B,CAAC;CACD;AAED;;;;;;GAMG;AACH,MAAM,OAAO,sBAAuB,SAAQ,eAAe;IACjD,IAAI,GAAG,qBAAqB,CAAC;IACtC,4EAA4E;IACnE,OAAO,CAAS;IAEzB,YACC,OAAe,EACf,UAAkB,oDAAoD,OAAO,mFAAmF,EAChK,OAA2B;QAE3B,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;CACD;AAED;;;;;GAKG;AACH,MAAM,OAAO,oBAAqB,SAAQ,eAAe;IAC/C,IAAI,GAAG,mBAAmB,CAAC;IACpC,qDAAqD;IAC5C,QAAQ,CAAS;IAE1B,YACC,QAAgB,EAChB,UAAkB,+CAA+C,QAAQ,+DAA+D,EACxI,OAA2B;QAE3B,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,CAAC;CACD;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,iBAAkB,SAAQ,eAAe;IAC5C,IAAI,GAAG,gBAAgB,CAAC;IAEjC,YACC,UAAkB,2EAA2E,EAC7F,OAA2B;QAE3B,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACzB,CAAC;CACD;AAED;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,eAAe;IACpD,IAAI,GAAG,wBAAwB,CAAC;IAEzC,YACC,UAAkB,0DAA0D,EAC5E,OAA2B;QAE3B,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACzB,CAAC;CACD;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC/C,OAAO,CACN,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAAuC,CAAC,iBAAiB,KAAK,IAAI;QACnE,OAAQ,KAA0B,CAAC,IAAI,KAAK,QAAQ,CACpD,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type { Cookie, Driver, LocatorString, OpenTarget, Page, Session, Snapshot, SnapshotOptions, SnapshotView, Transport, WaitCondition, } from './seam.js';
|
|
2
|
+
export { locator } from './seam.js';
|
|
3
|
+
export { serializeCookies, deserializeCookies, COOKIES_EXPORT_VERSION, type CookiesExport, } from './cookies-export.js';
|
|
4
|
+
export { StubTransport, type StubCall } from './stub-transport.js';
|
|
5
|
+
export { PlaywrightLaunchTransport } from './playwright-launch-transport.js';
|
|
6
|
+
export { PlaywrightAttachTransport } from './playwright-attach-transport.js';
|
|
7
|
+
export { setupProfile, buildPrompt, type PromptSink, type SetupProfileOptions, type SetupProfileResult, } from './setup-profile.js';
|
|
8
|
+
export { ControllerError, MissingBrowserBinaryError, MissingProfileError, AttachNotChromiumError, AttachNoContextError, NoLiveServerError, SessionAlreadyActiveError, isControllerError, type ControllerErrorCode, } from './errors.js';
|
|
9
|
+
export { resolveSessionEndpointPath, writeSessionEndpoint, readSessionEndpoint, clearSessionEndpoint, SESSION_ENDPOINT_FILENAME, type SessionEndpoint, } from './session-endpoint.js';
|
|
10
|
+
export { startSessionServer, sessionAlreadyActive, type SessionServerOptions, type RunningSessionServer, } from './session-server.js';
|
|
11
|
+
export { connectRemoteSession } from './remote-session.js';
|
|
12
|
+
export { SESSION_RPC_PATH, applySessionRpc, makeRpcPage, type SessionRpcRequest, type SessionRpcResponse, } from './session-rpc.js';
|
|
13
|
+
export { resolveHomeRoot, resolveProfileLocation, CONTROLLER_HOME_ENV, DEFAULT_HOME_DIRNAME, PROFILES_DIRNAME, type ProfileLocation, type ProfileLocationOptions, } from './profile-location.js';
|
|
14
|
+
export { startFixtureServer, type FixtureServer, } from './test-fixtures/fixture-server.js';
|
|
15
|
+
export { FIXTURE_PAGES } from './test-fixtures/fixture-pages.js';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,MAAM,EACN,MAAM,EACN,aAAa,EACb,UAAU,EACV,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,SAAS,EACT,aAAa,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAElC,OAAO,EACN,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,aAAa,GAClB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAC,aAAa,EAAE,KAAK,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAEjE,OAAO,EAAC,yBAAyB,EAAC,MAAM,kCAAkC,CAAC;AAE3E,OAAO,EAAC,yBAAyB,EAAC,MAAM,kCAAkC,CAAC;AAE3E,OAAO,EACN,YAAY,EACZ,WAAW,EACX,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACN,eAAe,EACf,yBAAyB,EACzB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,iBAAiB,EACjB,KAAK,mBAAmB,GACxB,MAAM,aAAa,CAAC;AAErB,OAAO,EACN,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,EACzB,KAAK,eAAe,GACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACN,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GACzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAC,oBAAoB,EAAC,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EACN,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,KAAK,eAAe,EACpB,KAAK,sBAAsB,GAC3B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACN,kBAAkB,EAClB,KAAK,aAAa,GAClB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAC,aAAa,EAAC,MAAM,kCAAkC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { locator } from './seam.js';
|
|
2
|
+
export { serializeCookies, deserializeCookies, COOKIES_EXPORT_VERSION, } from './cookies-export.js';
|
|
3
|
+
export { StubTransport } from './stub-transport.js';
|
|
4
|
+
export { PlaywrightLaunchTransport } from './playwright-launch-transport.js';
|
|
5
|
+
export { PlaywrightAttachTransport } from './playwright-attach-transport.js';
|
|
6
|
+
export { setupProfile, buildPrompt, } from './setup-profile.js';
|
|
7
|
+
export { ControllerError, MissingBrowserBinaryError, MissingProfileError, AttachNotChromiumError, AttachNoContextError, NoLiveServerError, SessionAlreadyActiveError, isControllerError, } from './errors.js';
|
|
8
|
+
export { resolveSessionEndpointPath, writeSessionEndpoint, readSessionEndpoint, clearSessionEndpoint, SESSION_ENDPOINT_FILENAME, } from './session-endpoint.js';
|
|
9
|
+
export { startSessionServer, sessionAlreadyActive, } from './session-server.js';
|
|
10
|
+
export { connectRemoteSession } from './remote-session.js';
|
|
11
|
+
export { SESSION_RPC_PATH, applySessionRpc, makeRpcPage, } from './session-rpc.js';
|
|
12
|
+
export { resolveHomeRoot, resolveProfileLocation, CONTROLLER_HOME_ENV, DEFAULT_HOME_DIRNAME, PROFILES_DIRNAME, } from './profile-location.js';
|
|
13
|
+
export { startFixtureServer, } from './test-fixtures/fixture-server.js';
|
|
14
|
+
export { FIXTURE_PAGES } from './test-fixtures/fixture-pages.js';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAElC,OAAO,EACN,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,GAEtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAC,aAAa,EAAgB,MAAM,qBAAqB,CAAC;AAEjE,OAAO,EAAC,yBAAyB,EAAC,MAAM,kCAAkC,CAAC;AAE3E,OAAO,EAAC,yBAAyB,EAAC,MAAM,kCAAkC,CAAC;AAE3E,OAAO,EACN,YAAY,EACZ,WAAW,GAIX,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACN,eAAe,EACf,yBAAyB,EACzB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,iBAAiB,GAEjB,MAAM,aAAa,CAAC;AAErB,OAAO,EACN,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,GAEzB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACN,kBAAkB,EAClB,oBAAoB,GAGpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAC,oBAAoB,EAAC,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EACN,gBAAgB,EAChB,eAAe,EACf,WAAW,GAGX,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,GAGhB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACN,kBAAkB,GAElB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAC,aAAa,EAAC,MAAM,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { OpenTarget, Session, Transport } from './seam.js';
|
|
2
|
+
/**
|
|
3
|
+
* The `attach` concrete transport: connect (`chromium.connectOverCDP`) to a
|
|
4
|
+
* browser the USER already started with remote debugging enabled, and reuse the
|
|
5
|
+
* user's EXISTING authenticated context — `browser.contexts()[0]`, never
|
|
6
|
+
* `newContext()` — so the controller drives the live, logged-in tabs on the
|
|
7
|
+
* user's real fingerprint and IP (PRD "Solution, attach"; ADR-0002).
|
|
8
|
+
*
|
|
9
|
+
* CDP-attach is Chromium-only (ADR-0003: Firefox attaches via a different
|
|
10
|
+
* mechanism). That constraint is SURFACED as a typed `core` error
|
|
11
|
+
* ({@link AttachNotChromiumError}) rather than leaking any CDP/Chromium-only
|
|
12
|
+
* type into the seam: the Playwright/CDP types are confined to this module and
|
|
13
|
+
* the seam stays transport-neutral (ADR-0003).
|
|
14
|
+
*
|
|
15
|
+
* It handles ONLY `mode: 'attach'`. `mode: 'launch'` is a SEPARATE transport
|
|
16
|
+
* ({@link PlaywrightLaunchTransport}); calling `open` with `mode: 'launch'`
|
|
17
|
+
* here throws, because mixing the two open mechanisms in one transport is what
|
|
18
|
+
* ADR-0003's seam exists to avoid.
|
|
19
|
+
*
|
|
20
|
+
* There is NO browser-relaunch helper: a settled PRD decision is that the user
|
|
21
|
+
* starts their own browser with `--remote-debugging-port` and supplies the
|
|
22
|
+
* resulting endpoint (PRD "needsAnswers" #5). This transport only connects to a
|
|
23
|
+
* running one.
|
|
24
|
+
*/
|
|
25
|
+
export declare class PlaywrightAttachTransport implements Transport {
|
|
26
|
+
open(target: OpenTarget): Promise<Session>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=playwright-attach-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playwright-attach-transport.d.ts","sourceRoot":"","sources":["../src/playwright-attach-transport.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAEX,UAAU,EAEV,OAAO,EAGP,SAAS,EAET,MAAM,WAAW,CAAC;AAEnB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,yBAA0B,YAAW,SAAS;IACpD,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;CA0ChD"}
|