instar 1.3.1255 → 1.3.1256

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.
@@ -1,10 +1,21 @@
1
1
  import type { ReloginBrowserPort, ReloginBrowserSnapshot } from './AnthropicReloginBrowserDriver.js';
2
+ import { type OriginPolicy } from './PasskeyBrowserPolicy.js';
2
3
  export interface ChromeCdpReloginBrowserOptions {
3
4
  userDataDir: string;
4
5
  chromePath?: string;
5
6
  headless?: boolean;
6
7
  launchTimeoutMs?: number;
7
8
  operationTimeoutMs?: number;
9
+ /**
10
+ * Passkey mode (spec agent-held-google-passkey §3.5): CDP over the debugging
11
+ * PIPE (no TCP port, no DevToolsActivePort), extensions and prerendering off,
12
+ * every target created at about:blank and given a virtual authenticator BEFORE
13
+ * its first navigation, popups auto-attached and paused until prepared,
14
+ * service workers bypassed, and request-time credential removal.
15
+ */
16
+ passkeyMode?: boolean;
17
+ /** Where the credential may be present. Production: the Google policy (default). */
18
+ originPolicy?: OriginPolicy;
8
19
  }
9
20
  /** Closed structural floor for OpenAI's device confirmation; consent prose can never enter this class. */
10
21
  export declare function isClosedOpenAiDeviceApproval(input: {
@@ -14,6 +25,15 @@ export declare function isClosedOpenAiDeviceApproval(input: {
14
25
  body: string;
15
26
  }): boolean;
16
27
  export declare function resolveChromeExecutable(): string | null;
28
+ /** An exported WebAuthn credential, in the shape CDP's WebAuthn domain uses. */
29
+ export interface WebAuthnCredential {
30
+ credentialId: string;
31
+ isResidentCredential: boolean;
32
+ rpId: string;
33
+ privateKey: string;
34
+ userHandle?: string;
35
+ signCount: number;
36
+ }
17
37
  /**
18
38
  * Narrow Chrome DevTools implementation of ReloginBrowserPort.
19
39
  * It returns only a closed page classification; raw DOM, URLs-with-query,
@@ -25,25 +45,113 @@ export declare class ChromeCdpReloginBrowser implements ReloginBrowserPort {
25
45
  private readonly headless;
26
46
  private readonly launchTimeoutMs;
27
47
  private readonly operationTimeoutMs;
48
+ private readonly passkeyMode;
49
+ private readonly policy;
28
50
  private child;
29
- private socket;
51
+ private transport;
30
52
  private requestId;
31
53
  private pending;
54
+ private readonly eventHandlers;
55
+ /** Pipe mode: every attached target by sessionId. */
56
+ private readonly sessions;
57
+ private mainSessionId;
58
+ private mainSessionReady;
59
+ /** The credential currently loaded into the authenticators, or null. */
60
+ private credential;
61
+ /**
62
+ * Every credential id this browser has EVER loaded into an authenticator. Removal
63
+ * sweeps these from every authenticator regardless of the in-memory flag, so a
64
+ * target that received the key during a prepare/remove interleave can never keep it.
65
+ */
66
+ private readonly knownCredentialIds;
67
+ /** Serialises add / remove / prepare-time load so they can never interleave. */
68
+ private credentialLock;
69
+ private readonly assertedCredentialIds;
70
+ /** True if a Google-origin document navigation was ever seen before an attach completed. */
71
+ private navigationBeforeAttach;
32
72
  constructor(options: ChromeCdpReloginBrowserOptions);
33
73
  open(url: string): Promise<void>;
74
+ /** Legacy transport: TCP debugging port + a page-level WebSocket (non-passkey sessions). */
75
+ private openTcp;
76
+ /**
77
+ * Passkey transport: the debugging pipe. The initial about:blank page is
78
+ * auto-attached and PREPARED (authenticator, interception, service-worker
79
+ * bypass) before the first navigation; popups are paused until prepared.
80
+ */
81
+ private openPipe;
82
+ private onAttached;
83
+ /** Everything a target needs BEFORE it is allowed to navigate. */
84
+ private prepareSession;
85
+ private onRequestPaused;
86
+ /**
87
+ * Add the credential to every prepared authenticator. Allowed only while the
88
+ * main target's frames satisfy the origin policy (top-level on the holder
89
+ * origin, no other RP-family frame). The value stays inside this process.
90
+ */
91
+ addCredential(credential: WebAuthnCredential): Promise<void>;
92
+ /**
93
+ * Remove every credential this browser ever loaded from EVERY authenticator, and
94
+ * forget the current one. Does not trust the in-memory flag: the sweep runs whenever
95
+ * any id is known, so no target can keep a key the flag says is gone. Idempotent.
96
+ */
97
+ removeCredential(): Promise<void>;
98
+ /** Run `fn` with exclusive access to the credential state (add / remove / prepare-time load). */
99
+ private withCredentialLock;
100
+ /** Whether the credential is currently loaded into the authenticators. */
101
+ hasCredential(): boolean;
102
+ /** True once Google (or the fixture) actually asked for and received an assertion from this credential. */
103
+ observedAssertion(credentialId: string): boolean;
104
+ /** Export every credential in the MAIN target's authenticator (used at mint). */
105
+ exportCredentials(): Promise<WebAuthnCredential[]>;
106
+ /** Credential COUNT per prepared target (never material) — proves every attached target's authenticator is loaded. */
107
+ credentialCountsByTarget(): Promise<number[]>;
108
+ /** Number of credentials the MAIN authenticator holds (a count, never material). */
109
+ credentialCount(): Promise<number>;
110
+ /**
111
+ * Compare the signed-in identity shown on the current page with the expected
112
+ * email INSIDE the browser; only the boolean leaves. Structural first
113
+ * (`data-email` / `data-identifier` / `aria-label`), then an exact-text element.
114
+ */
115
+ readSignedInIdentityMatches(expected: string): Promise<boolean>;
116
+ /**
117
+ * Whether any target was seen navigating before its authenticator was attached. A
118
+ * DIAGNOSTIC only: it observes from `Page.enable` onward, so it can confirm a breach
119
+ * it saw but not prove absence. The guarantee itself is Chrome's
120
+ * `waitForDebuggerOnStart` pause, which the popup test exercises.
121
+ */
122
+ sawNavigationBeforeAttach(): boolean;
123
+ /**
124
+ * Run an expression in the main page. FIXTURE-ONLY: refused under the production
125
+ * Google policy so no caller can turn the repair browser into an arbitrary-evaluate
126
+ * surface on a real account page.
127
+ */
128
+ runInPage<T>(expression: string): Promise<T>;
129
+ private assertFixturePolicy;
130
+ /** Origins of every frame in ONE page target (its own tree plus its out-of-process iframes). */
131
+ private frameOrigins;
34
132
  snapshot(expectedIdentity: string): Promise<ReloginBrowserSnapshot>;
35
133
  chooseExpectedAccount(expectedIdentity: string): Promise<void>;
36
134
  fillPublic(field: 'email' | 'device-code', value: string): Promise<void>;
37
135
  fillSecret(field: 'password' | 'totp', value: string): Promise<void>;
38
136
  click(action: 'next' | 'authorize' | 'google'): Promise<void>;
137
+ /** Click a fixture/test element by CSS selector with a REAL pointer event. FIXTURE-ONLY (see runInPage). */
138
+ clickSelector(selector: string): Promise<void>;
39
139
  readPasteCode(): Promise<string | null>;
40
140
  wait(ms: number): Promise<void>;
41
141
  close(): Promise<void>;
42
142
  private waitForChildExit;
143
+ /**
144
+ * Real pointer click: resolve the element with `finderExpression` (must
145
+ * evaluate to an HTMLElement or null), scroll it into view, read its centre,
146
+ * and dispatch mouse pressed/released through the Input domain.
147
+ */
148
+ private clickReal;
43
149
  private fillAndSubmit;
44
150
  private evaluate;
45
151
  private waitForPort;
46
- private connect;
152
+ private connectWs;
153
+ private attachTransport;
154
+ private on;
47
155
  private send;
48
156
  }
49
157
  //# sourceMappingURL=ChromeCdpReloginBrowser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChromeCdpReloginBrowser.d.ts","sourceRoot":"","sources":["../../src/core/ChromeCdpReloginBrowser.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,oCAAoC,CAAC;AAE5C,MAAM,WAAW,8BAA8B;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,0GAA0G;AAC1G,wBAAgB,4BAA4B,CAAC,KAAK,EAAE;IAClD,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;CACvE,GAAG,OAAO,CAOV;AAYD,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAEvD;AAID;;;;GAIG;AACH,qBAAa,uBAAwB,YAAW,kBAAkB;IAChE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;I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