@conto_finance/sdk 0.3.1 → 0.5.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.
@@ -0,0 +1,255 @@
1
+ import { Browser, Page } from 'playwright-core';
2
+ import { GuardedCheckoutInput, PrivilegedBrowserCheckoutDriver, RunGuardedCheckoutResult, AgentCheckoutActionKind, CommerceCheckoutMethod, BrowserCheckoutAction } from './index.mjs';
3
+
4
+ interface PlaywrightCheckoutTargetRegistration {
5
+ browserSessionId: string;
6
+ targetFingerprint: string;
7
+ locator: string;
8
+ /** Absolute expiry enforced by both the adapter and durable store wrapper. */
9
+ expiresAt: string;
10
+ }
11
+ /**
12
+ * The target store belongs to the privileged runtime. Do not expose it to the
13
+ * model or place raw DOM data in Conto proposal metadata.
14
+ */
15
+ interface PlaywrightCheckoutTargetStore {
16
+ put(registration: PlaywrightCheckoutTargetRegistration): Promise<void>;
17
+ get(input: {
18
+ browserSessionId: string;
19
+ targetFingerprint: string;
20
+ }): Promise<PlaywrightCheckoutTargetRegistration | null>;
21
+ delete(input: {
22
+ browserSessionId: string;
23
+ targetFingerprint: string;
24
+ }): Promise<void>;
25
+ }
26
+ /** Minimal durable blob port. Redis, Postgres, or another runtime store can implement it. */
27
+ interface PlaywrightCheckoutTargetBlobStore {
28
+ put(input: {
29
+ key: string;
30
+ value: string;
31
+ expiresAt: string;
32
+ }): Promise<void>;
33
+ get(key: string): Promise<string | null>;
34
+ delete(key: string): Promise<void>;
35
+ }
36
+ interface EncryptedPlaywrightCheckoutTargetStoreConfig {
37
+ blobStore: PlaywrightCheckoutTargetBlobStore;
38
+ /** Exactly 32 random bytes. Keep this key only in the privileged runtime. */
39
+ encryptionKey: Uint8Array;
40
+ namespace?: string;
41
+ now?: () => Date;
42
+ }
43
+ interface PlaywrightCheckoutAdapterConfig {
44
+ /** Resolves an already isolated Page owned by the exact browser session. */
45
+ pageForSession(browserSessionId: string): Promise<Page | null>;
46
+ targetStore?: PlaywrightCheckoutTargetStore;
47
+ clickTimeoutMs?: number;
48
+ popupTimeoutMs?: number;
49
+ targetTtlMs?: number;
50
+ now?: () => Date;
51
+ }
52
+ interface DiscoverPlaywrightCheckoutTargetInput {
53
+ browserSessionId: string;
54
+ /** Exact Playwright locator expression retained only by the privileged runtime. */
55
+ locator: string;
56
+ kind: AgentCheckoutActionKind;
57
+ checkoutMethod: CommerceCheckoutMethod;
58
+ }
59
+ interface DiscoveredPlaywrightCheckoutTarget {
60
+ action: BrowserCheckoutAction;
61
+ targetFingerprint: string;
62
+ }
63
+ interface PlaywrightCheckoutDispatchResult {
64
+ clicked: true;
65
+ pageUrl: string;
66
+ targetFingerprint: string;
67
+ /** Browser evidence only. It never asserts that the merchant settled payment. */
68
+ browserOutcome: {
69
+ kind: 'NEW_PAGE' | 'PAGE_NAVIGATION' | 'SAME_PAGE';
70
+ observedAt: string;
71
+ settlement: 'UNVERIFIED';
72
+ };
73
+ }
74
+ interface PlaywrightCheckoutAdapter {
75
+ discover(input: DiscoverPlaywrightCheckoutTargetInput): Promise<DiscoveredPlaywrightCheckoutTarget>;
76
+ driver: PrivilegedBrowserCheckoutDriver<PlaywrightCheckoutDispatchResult>;
77
+ }
78
+ interface GuardedPlaywrightCheckoutClient {
79
+ runGuardedCheckoutWithDriver(input: GuardedCheckoutInput, runtime: {
80
+ dispatchAttemptId: string;
81
+ driver: PrivilegedBrowserCheckoutDriver<PlaywrightCheckoutDispatchResult>;
82
+ }): Promise<RunGuardedCheckoutResult<PlaywrightCheckoutDispatchResult>>;
83
+ }
84
+ interface GuardedPlaywrightCheckoutRuntimeConfig extends PlaywrightCheckoutAdapterConfig {
85
+ conto: GuardedPlaywrightCheckoutClient;
86
+ /** Required so runtime owners deliberately choose process-local or durable storage. */
87
+ targetStore: PlaywrightCheckoutTargetStore;
88
+ /** Atomically loads or creates a stable attempt ID in the caller's durable runtime store. */
89
+ dispatchAttemptFor(input: {
90
+ idempotencyKey: string;
91
+ browserSessionId: string;
92
+ targetFingerprint: string;
93
+ }): Promise<string>;
94
+ }
95
+ /**
96
+ * Safe façade to expose as the agent's checkout capability. It intentionally
97
+ * does not expose Page, locator registrations, or the raw dispatch driver.
98
+ */
99
+ interface GuardedPlaywrightCheckoutRuntime {
100
+ discover(input: DiscoverPlaywrightCheckoutTargetInput): Promise<DiscoveredPlaywrightCheckoutTarget>;
101
+ run(input: GuardedCheckoutInput): Promise<RunGuardedCheckoutResult<PlaywrightCheckoutDispatchResult>>;
102
+ }
103
+ /**
104
+ * Agent-prepared checkout handoff. The agent owns shopping and cart construction; this request
105
+ * gives the privileged runtime only the exact proposed payment action and policy facts.
106
+ */
107
+ interface GuardedPlaywrightCheckoutHttpRequest {
108
+ idempotencyKey: string;
109
+ browserSessionId: string;
110
+ locator: string;
111
+ actionKind: AgentCheckoutActionKind;
112
+ checkoutMethod: CommerceCheckoutMethod;
113
+ amountMinor: number;
114
+ currency: 'USD';
115
+ purpose: string;
116
+ category?: string;
117
+ counterparty: {
118
+ canonicalId: string;
119
+ displayName: string;
120
+ checkoutUrl: string;
121
+ };
122
+ cart: GuardedCheckoutInput['cart'];
123
+ providerPresentation: GuardedCheckoutInput['providerPresentation'];
124
+ }
125
+ interface GuardedPlaywrightCheckoutHttpHandlerConfig {
126
+ runtime: GuardedPlaywrightCheckoutRuntime;
127
+ /** Dedicated service credential. Conto API keys are rejected. */
128
+ token: string;
129
+ /** Defaults to 64 KiB and may not exceed 1 MiB. */
130
+ maxBodyBytes?: number;
131
+ }
132
+ type GuardedPlaywrightCheckoutHttpHandler = (request: Request) => Promise<Response>;
133
+ interface PlaywrightCdpSessionRegistryConfig {
134
+ /**
135
+ * Returns a fresh provider connection URL only when this runtime owns the session.
136
+ * Never expose this URL to the model or include it in logs.
137
+ */
138
+ connectUrlForSession(browserSessionId: string): Promise<string | null>;
139
+ /** Usually `(url) => chromium.connectOverCDP(url)`. Injected to keep Playwright optional. */
140
+ connectOverCDP(connectUrl: string): Promise<Browser>;
141
+ /** Exact secure origins accepted for provider connection URLs. */
142
+ allowedConnectOrigins: readonly string[];
143
+ /** Defaults to requiring exactly one open page in the remote browser. */
144
+ selectPage?(input: {
145
+ browserSessionId: string;
146
+ pages: readonly Page[];
147
+ }): Page | null | Promise<Page | null>;
148
+ /** Maximum simultaneously connected remote sessions. Defaults to 100. */
149
+ maxSessions?: number;
150
+ }
151
+ interface PlaywrightCdpSessionRegistry {
152
+ pageForSession(browserSessionId: string): Promise<Page | null>;
153
+ /** Closes the Playwright browser connection and may end the provider session. */
154
+ closeSession(browserSessionId: string): Promise<void>;
155
+ /** Closes every tracked browser connection. */
156
+ close(): Promise<void>;
157
+ }
158
+ interface PlaywrightSessionInteractiveTarget {
159
+ /** Opaque positional locator for the guarded checkout request; it is not an execution grant. */
160
+ locator: string;
161
+ role: 'BUTTON' | 'LINK';
162
+ label: string;
163
+ disabled: boolean;
164
+ /** Exact HTTPS origin only. Paths, queries, fragments, and credentials are never returned. */
165
+ destinationOrigin?: string;
166
+ }
167
+ /**
168
+ * Deliberately narrow model-visible projection of one owned page. It excludes page text, DOM,
169
+ * form values, screenshots, cookies, storage, URL paths/queries, and provider capabilities.
170
+ */
171
+ interface PlaywrightSessionObservation {
172
+ browserSessionId: string;
173
+ pageOrigin: string | null;
174
+ title: string;
175
+ targets: readonly PlaywrightSessionInteractiveTarget[];
176
+ truncated: boolean;
177
+ observedAt: string;
178
+ }
179
+ interface PlaywrightSessionObserverConfig {
180
+ pageForSession(browserSessionId: string): Promise<Page | null>;
181
+ now?: () => Date;
182
+ }
183
+ interface PlaywrightSessionObserver {
184
+ observe(browserSessionId: string): Promise<PlaywrightSessionObservation>;
185
+ }
186
+ interface GuardedPlaywrightCheckoutRuntimeHostConfig {
187
+ conto: GuardedPlaywrightCheckoutClient;
188
+ /** Privileged provider connection and session-ownership boundary. */
189
+ browserSessions: PlaywrightCdpSessionRegistryConfig;
190
+ /** Encrypted durable target storage retained only by this host. */
191
+ targetStore: EncryptedPlaywrightCheckoutTargetStoreConfig;
192
+ /** Atomically loads or creates one stable attempt for the checkout intent. */
193
+ dispatchAttemptFor: GuardedPlaywrightCheckoutRuntimeConfig['dispatchAttemptFor'];
194
+ /** Dedicated service credential. Conto API keys are rejected. */
195
+ token: string;
196
+ maxBodyBytes?: number;
197
+ clickTimeoutMs?: number;
198
+ popupTimeoutMs?: number;
199
+ targetTtlMs?: number;
200
+ now?: () => Date;
201
+ }
202
+ /**
203
+ * Closed façade for a separately operated browser runtime. It intentionally
204
+ * exposes no page, target store, discovery primitive, or raw dispatch driver.
205
+ */
206
+ interface GuardedPlaywrightCheckoutRuntimeHost {
207
+ handler: GuardedPlaywrightCheckoutHttpHandler;
208
+ /** Read-only, bounded projection of the exact runtime-owned page. */
209
+ observeSession(browserSessionId: string): Promise<PlaywrightSessionObservation>;
210
+ closeSession(browserSessionId: string): Promise<void>;
211
+ close(): Promise<void>;
212
+ }
213
+ declare function createInMemoryPlaywrightCheckoutTargetStore(): PlaywrightCheckoutTargetStore;
214
+ /**
215
+ * Encrypts locator registrations before writing them to caller-owned durable
216
+ * storage. Blob keys are hashed so session IDs and fingerprints are not stored
217
+ * in plaintext. Expired records are deleted and fail closed.
218
+ */
219
+ declare function createEncryptedPlaywrightCheckoutTargetStore(config: EncryptedPlaywrightCheckoutTargetStoreConfig): PlaywrightCheckoutTargetStore;
220
+ /**
221
+ * Playwright and Browserbase-compatible adapter. The model receives only the
222
+ * discovered action and the caller's guarded checkout tool; Page, locator,
223
+ * element handle, store, and driver remain in the privileged process.
224
+ */
225
+ declare function createPlaywrightCheckoutAdapter(config: PlaywrightCheckoutAdapterConfig): PlaywrightCheckoutAdapter;
226
+ /**
227
+ * Composes target discovery and Conto's one-use sequence without returning the
228
+ * low-level driver. Expose `run` to the model, not the underlying adapter.
229
+ */
230
+ declare function createGuardedPlaywrightCheckoutRuntime(config: GuardedPlaywrightCheckoutRuntimeConfig): GuardedPlaywrightCheckoutRuntime;
231
+ /**
232
+ * Resolves agent-owned remote CDP sessions into Playwright pages without ever
233
+ * returning provider connection URLs to the caller. The ownership callback is
234
+ * the authorization boundary: it must return null for every unowned session.
235
+ */
236
+ declare function createPlaywrightCdpSessionRegistry(config: PlaywrightCdpSessionRegistryConfig): PlaywrightCdpSessionRegistry;
237
+ /**
238
+ * Creates a read-only observer for the runtime-owned page. This is the first safe building block
239
+ * for agent exploration: it returns a small interactive outline, while retaining every browser
240
+ * mutation behind a separate privileged capability.
241
+ */
242
+ declare function createPlaywrightSessionObserver(config: PlaywrightSessionObserverConfig): PlaywrightSessionObserver;
243
+ /**
244
+ * Composes the secure CDP registry, encrypted target store, guarded runtime,
245
+ * and authenticated HTTP handler without returning any bypass-capable piece.
246
+ */
247
+ declare function createGuardedPlaywrightCheckoutRuntimeHost(config: GuardedPlaywrightCheckoutRuntimeHostConfig): GuardedPlaywrightCheckoutRuntimeHost;
248
+ /**
249
+ * Mounts a guarded Playwright runtime behind the authenticated HTTP contract
250
+ * consumed by @conto_finance/mcp-server. The handler owns discovery and run as
251
+ * one request and returns only the evidence needed by the MCP projection.
252
+ */
253
+ declare function createGuardedPlaywrightCheckoutHttpHandler(config: GuardedPlaywrightCheckoutHttpHandlerConfig): GuardedPlaywrightCheckoutHttpHandler;
254
+
255
+ export { type DiscoverPlaywrightCheckoutTargetInput, type DiscoveredPlaywrightCheckoutTarget, type EncryptedPlaywrightCheckoutTargetStoreConfig, type GuardedPlaywrightCheckoutClient, type GuardedPlaywrightCheckoutHttpHandler, type GuardedPlaywrightCheckoutHttpHandlerConfig, type GuardedPlaywrightCheckoutHttpRequest, type GuardedPlaywrightCheckoutRuntime, type GuardedPlaywrightCheckoutRuntimeConfig, type GuardedPlaywrightCheckoutRuntimeHost, type GuardedPlaywrightCheckoutRuntimeHostConfig, type PlaywrightCdpSessionRegistry, type PlaywrightCdpSessionRegistryConfig, type PlaywrightCheckoutAdapter, type PlaywrightCheckoutAdapterConfig, type PlaywrightCheckoutDispatchResult, type PlaywrightCheckoutTargetBlobStore, type PlaywrightCheckoutTargetRegistration, type PlaywrightCheckoutTargetStore, type PlaywrightSessionInteractiveTarget, type PlaywrightSessionObservation, type PlaywrightSessionObserver, type PlaywrightSessionObserverConfig, createEncryptedPlaywrightCheckoutTargetStore, createGuardedPlaywrightCheckoutHttpHandler, createGuardedPlaywrightCheckoutRuntime, createGuardedPlaywrightCheckoutRuntimeHost, createInMemoryPlaywrightCheckoutTargetStore, createPlaywrightCdpSessionRegistry, createPlaywrightCheckoutAdapter, createPlaywrightSessionObserver };
@@ -0,0 +1,255 @@
1
+ import { Browser, Page } from 'playwright-core';
2
+ import { GuardedCheckoutInput, PrivilegedBrowserCheckoutDriver, RunGuardedCheckoutResult, AgentCheckoutActionKind, CommerceCheckoutMethod, BrowserCheckoutAction } from './index.js';
3
+
4
+ interface PlaywrightCheckoutTargetRegistration {
5
+ browserSessionId: string;
6
+ targetFingerprint: string;
7
+ locator: string;
8
+ /** Absolute expiry enforced by both the adapter and durable store wrapper. */
9
+ expiresAt: string;
10
+ }
11
+ /**
12
+ * The target store belongs to the privileged runtime. Do not expose it to the
13
+ * model or place raw DOM data in Conto proposal metadata.
14
+ */
15
+ interface PlaywrightCheckoutTargetStore {
16
+ put(registration: PlaywrightCheckoutTargetRegistration): Promise<void>;
17
+ get(input: {
18
+ browserSessionId: string;
19
+ targetFingerprint: string;
20
+ }): Promise<PlaywrightCheckoutTargetRegistration | null>;
21
+ delete(input: {
22
+ browserSessionId: string;
23
+ targetFingerprint: string;
24
+ }): Promise<void>;
25
+ }
26
+ /** Minimal durable blob port. Redis, Postgres, or another runtime store can implement it. */
27
+ interface PlaywrightCheckoutTargetBlobStore {
28
+ put(input: {
29
+ key: string;
30
+ value: string;
31
+ expiresAt: string;
32
+ }): Promise<void>;
33
+ get(key: string): Promise<string | null>;
34
+ delete(key: string): Promise<void>;
35
+ }
36
+ interface EncryptedPlaywrightCheckoutTargetStoreConfig {
37
+ blobStore: PlaywrightCheckoutTargetBlobStore;
38
+ /** Exactly 32 random bytes. Keep this key only in the privileged runtime. */
39
+ encryptionKey: Uint8Array;
40
+ namespace?: string;
41
+ now?: () => Date;
42
+ }
43
+ interface PlaywrightCheckoutAdapterConfig {
44
+ /** Resolves an already isolated Page owned by the exact browser session. */
45
+ pageForSession(browserSessionId: string): Promise<Page | null>;
46
+ targetStore?: PlaywrightCheckoutTargetStore;
47
+ clickTimeoutMs?: number;
48
+ popupTimeoutMs?: number;
49
+ targetTtlMs?: number;
50
+ now?: () => Date;
51
+ }
52
+ interface DiscoverPlaywrightCheckoutTargetInput {
53
+ browserSessionId: string;
54
+ /** Exact Playwright locator expression retained only by the privileged runtime. */
55
+ locator: string;
56
+ kind: AgentCheckoutActionKind;
57
+ checkoutMethod: CommerceCheckoutMethod;
58
+ }
59
+ interface DiscoveredPlaywrightCheckoutTarget {
60
+ action: BrowserCheckoutAction;
61
+ targetFingerprint: string;
62
+ }
63
+ interface PlaywrightCheckoutDispatchResult {
64
+ clicked: true;
65
+ pageUrl: string;
66
+ targetFingerprint: string;
67
+ /** Browser evidence only. It never asserts that the merchant settled payment. */
68
+ browserOutcome: {
69
+ kind: 'NEW_PAGE' | 'PAGE_NAVIGATION' | 'SAME_PAGE';
70
+ observedAt: string;
71
+ settlement: 'UNVERIFIED';
72
+ };
73
+ }
74
+ interface PlaywrightCheckoutAdapter {
75
+ discover(input: DiscoverPlaywrightCheckoutTargetInput): Promise<DiscoveredPlaywrightCheckoutTarget>;
76
+ driver: PrivilegedBrowserCheckoutDriver<PlaywrightCheckoutDispatchResult>;
77
+ }
78
+ interface GuardedPlaywrightCheckoutClient {
79
+ runGuardedCheckoutWithDriver(input: GuardedCheckoutInput, runtime: {
80
+ dispatchAttemptId: string;
81
+ driver: PrivilegedBrowserCheckoutDriver<PlaywrightCheckoutDispatchResult>;
82
+ }): Promise<RunGuardedCheckoutResult<PlaywrightCheckoutDispatchResult>>;
83
+ }
84
+ interface GuardedPlaywrightCheckoutRuntimeConfig extends PlaywrightCheckoutAdapterConfig {
85
+ conto: GuardedPlaywrightCheckoutClient;
86
+ /** Required so runtime owners deliberately choose process-local or durable storage. */
87
+ targetStore: PlaywrightCheckoutTargetStore;
88
+ /** Atomically loads or creates a stable attempt ID in the caller's durable runtime store. */
89
+ dispatchAttemptFor(input: {
90
+ idempotencyKey: string;
91
+ browserSessionId: string;
92
+ targetFingerprint: string;
93
+ }): Promise<string>;
94
+ }
95
+ /**
96
+ * Safe façade to expose as the agent's checkout capability. It intentionally
97
+ * does not expose Page, locator registrations, or the raw dispatch driver.
98
+ */
99
+ interface GuardedPlaywrightCheckoutRuntime {
100
+ discover(input: DiscoverPlaywrightCheckoutTargetInput): Promise<DiscoveredPlaywrightCheckoutTarget>;
101
+ run(input: GuardedCheckoutInput): Promise<RunGuardedCheckoutResult<PlaywrightCheckoutDispatchResult>>;
102
+ }
103
+ /**
104
+ * Agent-prepared checkout handoff. The agent owns shopping and cart construction; this request
105
+ * gives the privileged runtime only the exact proposed payment action and policy facts.
106
+ */
107
+ interface GuardedPlaywrightCheckoutHttpRequest {
108
+ idempotencyKey: string;
109
+ browserSessionId: string;
110
+ locator: string;
111
+ actionKind: AgentCheckoutActionKind;
112
+ checkoutMethod: CommerceCheckoutMethod;
113
+ amountMinor: number;
114
+ currency: 'USD';
115
+ purpose: string;
116
+ category?: string;
117
+ counterparty: {
118
+ canonicalId: string;
119
+ displayName: string;
120
+ checkoutUrl: string;
121
+ };
122
+ cart: GuardedCheckoutInput['cart'];
123
+ providerPresentation: GuardedCheckoutInput['providerPresentation'];
124
+ }
125
+ interface GuardedPlaywrightCheckoutHttpHandlerConfig {
126
+ runtime: GuardedPlaywrightCheckoutRuntime;
127
+ /** Dedicated service credential. Conto API keys are rejected. */
128
+ token: string;
129
+ /** Defaults to 64 KiB and may not exceed 1 MiB. */
130
+ maxBodyBytes?: number;
131
+ }
132
+ type GuardedPlaywrightCheckoutHttpHandler = (request: Request) => Promise<Response>;
133
+ interface PlaywrightCdpSessionRegistryConfig {
134
+ /**
135
+ * Returns a fresh provider connection URL only when this runtime owns the session.
136
+ * Never expose this URL to the model or include it in logs.
137
+ */
138
+ connectUrlForSession(browserSessionId: string): Promise<string | null>;
139
+ /** Usually `(url) => chromium.connectOverCDP(url)`. Injected to keep Playwright optional. */
140
+ connectOverCDP(connectUrl: string): Promise<Browser>;
141
+ /** Exact secure origins accepted for provider connection URLs. */
142
+ allowedConnectOrigins: readonly string[];
143
+ /** Defaults to requiring exactly one open page in the remote browser. */
144
+ selectPage?(input: {
145
+ browserSessionId: string;
146
+ pages: readonly Page[];
147
+ }): Page | null | Promise<Page | null>;
148
+ /** Maximum simultaneously connected remote sessions. Defaults to 100. */
149
+ maxSessions?: number;
150
+ }
151
+ interface PlaywrightCdpSessionRegistry {
152
+ pageForSession(browserSessionId: string): Promise<Page | null>;
153
+ /** Closes the Playwright browser connection and may end the provider session. */
154
+ closeSession(browserSessionId: string): Promise<void>;
155
+ /** Closes every tracked browser connection. */
156
+ close(): Promise<void>;
157
+ }
158
+ interface PlaywrightSessionInteractiveTarget {
159
+ /** Opaque positional locator for the guarded checkout request; it is not an execution grant. */
160
+ locator: string;
161
+ role: 'BUTTON' | 'LINK';
162
+ label: string;
163
+ disabled: boolean;
164
+ /** Exact HTTPS origin only. Paths, queries, fragments, and credentials are never returned. */
165
+ destinationOrigin?: string;
166
+ }
167
+ /**
168
+ * Deliberately narrow model-visible projection of one owned page. It excludes page text, DOM,
169
+ * form values, screenshots, cookies, storage, URL paths/queries, and provider capabilities.
170
+ */
171
+ interface PlaywrightSessionObservation {
172
+ browserSessionId: string;
173
+ pageOrigin: string | null;
174
+ title: string;
175
+ targets: readonly PlaywrightSessionInteractiveTarget[];
176
+ truncated: boolean;
177
+ observedAt: string;
178
+ }
179
+ interface PlaywrightSessionObserverConfig {
180
+ pageForSession(browserSessionId: string): Promise<Page | null>;
181
+ now?: () => Date;
182
+ }
183
+ interface PlaywrightSessionObserver {
184
+ observe(browserSessionId: string): Promise<PlaywrightSessionObservation>;
185
+ }
186
+ interface GuardedPlaywrightCheckoutRuntimeHostConfig {
187
+ conto: GuardedPlaywrightCheckoutClient;
188
+ /** Privileged provider connection and session-ownership boundary. */
189
+ browserSessions: PlaywrightCdpSessionRegistryConfig;
190
+ /** Encrypted durable target storage retained only by this host. */
191
+ targetStore: EncryptedPlaywrightCheckoutTargetStoreConfig;
192
+ /** Atomically loads or creates one stable attempt for the checkout intent. */
193
+ dispatchAttemptFor: GuardedPlaywrightCheckoutRuntimeConfig['dispatchAttemptFor'];
194
+ /** Dedicated service credential. Conto API keys are rejected. */
195
+ token: string;
196
+ maxBodyBytes?: number;
197
+ clickTimeoutMs?: number;
198
+ popupTimeoutMs?: number;
199
+ targetTtlMs?: number;
200
+ now?: () => Date;
201
+ }
202
+ /**
203
+ * Closed façade for a separately operated browser runtime. It intentionally
204
+ * exposes no page, target store, discovery primitive, or raw dispatch driver.
205
+ */
206
+ interface GuardedPlaywrightCheckoutRuntimeHost {
207
+ handler: GuardedPlaywrightCheckoutHttpHandler;
208
+ /** Read-only, bounded projection of the exact runtime-owned page. */
209
+ observeSession(browserSessionId: string): Promise<PlaywrightSessionObservation>;
210
+ closeSession(browserSessionId: string): Promise<void>;
211
+ close(): Promise<void>;
212
+ }
213
+ declare function createInMemoryPlaywrightCheckoutTargetStore(): PlaywrightCheckoutTargetStore;
214
+ /**
215
+ * Encrypts locator registrations before writing them to caller-owned durable
216
+ * storage. Blob keys are hashed so session IDs and fingerprints are not stored
217
+ * in plaintext. Expired records are deleted and fail closed.
218
+ */
219
+ declare function createEncryptedPlaywrightCheckoutTargetStore(config: EncryptedPlaywrightCheckoutTargetStoreConfig): PlaywrightCheckoutTargetStore;
220
+ /**
221
+ * Playwright and Browserbase-compatible adapter. The model receives only the
222
+ * discovered action and the caller's guarded checkout tool; Page, locator,
223
+ * element handle, store, and driver remain in the privileged process.
224
+ */
225
+ declare function createPlaywrightCheckoutAdapter(config: PlaywrightCheckoutAdapterConfig): PlaywrightCheckoutAdapter;
226
+ /**
227
+ * Composes target discovery and Conto's one-use sequence without returning the
228
+ * low-level driver. Expose `run` to the model, not the underlying adapter.
229
+ */
230
+ declare function createGuardedPlaywrightCheckoutRuntime(config: GuardedPlaywrightCheckoutRuntimeConfig): GuardedPlaywrightCheckoutRuntime;
231
+ /**
232
+ * Resolves agent-owned remote CDP sessions into Playwright pages without ever
233
+ * returning provider connection URLs to the caller. The ownership callback is
234
+ * the authorization boundary: it must return null for every unowned session.
235
+ */
236
+ declare function createPlaywrightCdpSessionRegistry(config: PlaywrightCdpSessionRegistryConfig): PlaywrightCdpSessionRegistry;
237
+ /**
238
+ * Creates a read-only observer for the runtime-owned page. This is the first safe building block
239
+ * for agent exploration: it returns a small interactive outline, while retaining every browser
240
+ * mutation behind a separate privileged capability.
241
+ */
242
+ declare function createPlaywrightSessionObserver(config: PlaywrightSessionObserverConfig): PlaywrightSessionObserver;
243
+ /**
244
+ * Composes the secure CDP registry, encrypted target store, guarded runtime,
245
+ * and authenticated HTTP handler without returning any bypass-capable piece.
246
+ */
247
+ declare function createGuardedPlaywrightCheckoutRuntimeHost(config: GuardedPlaywrightCheckoutRuntimeHostConfig): GuardedPlaywrightCheckoutRuntimeHost;
248
+ /**
249
+ * Mounts a guarded Playwright runtime behind the authenticated HTTP contract
250
+ * consumed by @conto_finance/mcp-server. The handler owns discovery and run as
251
+ * one request and returns only the evidence needed by the MCP projection.
252
+ */
253
+ declare function createGuardedPlaywrightCheckoutHttpHandler(config: GuardedPlaywrightCheckoutHttpHandlerConfig): GuardedPlaywrightCheckoutHttpHandler;
254
+
255
+ export { type DiscoverPlaywrightCheckoutTargetInput, type DiscoveredPlaywrightCheckoutTarget, type EncryptedPlaywrightCheckoutTargetStoreConfig, type GuardedPlaywrightCheckoutClient, type GuardedPlaywrightCheckoutHttpHandler, type GuardedPlaywrightCheckoutHttpHandlerConfig, type GuardedPlaywrightCheckoutHttpRequest, type GuardedPlaywrightCheckoutRuntime, type GuardedPlaywrightCheckoutRuntimeConfig, type GuardedPlaywrightCheckoutRuntimeHost, type GuardedPlaywrightCheckoutRuntimeHostConfig, type PlaywrightCdpSessionRegistry, type PlaywrightCdpSessionRegistryConfig, type PlaywrightCheckoutAdapter, type PlaywrightCheckoutAdapterConfig, type PlaywrightCheckoutDispatchResult, type PlaywrightCheckoutTargetBlobStore, type PlaywrightCheckoutTargetRegistration, type PlaywrightCheckoutTargetStore, type PlaywrightSessionInteractiveTarget, type PlaywrightSessionObservation, type PlaywrightSessionObserver, type PlaywrightSessionObserverConfig, createEncryptedPlaywrightCheckoutTargetStore, createGuardedPlaywrightCheckoutHttpHandler, createGuardedPlaywrightCheckoutRuntime, createGuardedPlaywrightCheckoutRuntimeHost, createInMemoryPlaywrightCheckoutTargetStore, createPlaywrightCdpSessionRegistry, createPlaywrightCheckoutAdapter, createPlaywrightSessionObserver };