agents 0.31.0 → 0.33.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/{agent-routing-wS1TimZ_.d.ts → agent-routing-vVMA7m8Y.d.ts} +6 -6
- package/dist/agent-routing.d.ts +1 -1
- package/dist/agent-tool-types.d.ts +1 -1
- package/dist/{agent-tools-Bamxxb6Y.d.ts → agent-tools-gGXXkf1z.d.ts} +2 -2
- package/dist/agent-tools.d.ts +1 -1
- package/dist/agent-tools.js +0 -1
- package/dist/agent-tools.js.map +1 -1
- package/dist/{ai-sdk-hW3vntnk.d.ts → ai-sdk-CpuRsjP5.d.ts} +2 -2
- package/dist/browser/ai.js +2 -3
- package/dist/browser/ai.js.map +1 -1
- package/dist/browser/index.d.ts +29 -21
- package/dist/browser/index.js +937 -4
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/tools/ai-sdk.d.ts +5 -5
- package/dist/browser/tools/ai-sdk.js +9 -3
- package/dist/browser/tools/ai-sdk.js.map +1 -1
- package/dist/browser/tools/pi.d.ts +11 -8
- package/dist/browser/tools/pi.js +58 -11
- package/dist/browser/tools/pi.js.map +1 -1
- package/dist/browser/tools/tanstack-ai.d.ts +6 -6
- package/dist/browser/tools/tanstack-ai.js +3 -3
- package/dist/browser/tools/tanstack-ai.js.map +1 -1
- package/dist/{browser-D9RNpJuT.d.ts → browser-CI97khiJ.d.ts} +222 -94
- package/dist/{browser-tool-BhjCcNVE.d.ts → browser-tool-Cxtiwfua.d.ts} +2 -2
- package/dist/browser-tool-DOqT1oSD.js +360 -0
- package/dist/browser-tool-DOqT1oSD.js.map +1 -0
- package/dist/catalog-BpOejOsE.js +239 -0
- package/dist/catalog-BpOejOsE.js.map +1 -0
- package/dist/catalog-BpiVV1OF.d.ts +173 -0
- package/dist/chat/index.d.ts +2 -2
- package/dist/chat/react.js +1 -0
- package/dist/chat/react.js.map +1 -1
- package/dist/chat-sdk/index.d.ts +1 -1
- package/dist/chat-sdk/index.js +1 -1
- package/dist/cli.js +63 -62
- package/dist/{client-wn4-yqGz.d.ts → client-eSfgYvd3.d.ts} +2 -2
- package/dist/client.d.ts +1 -1
- package/dist/{cloudflare-Dzvc7V2N.js → cloudflare-CUUm_9q9.js} +26 -4
- package/dist/cloudflare-CUUm_9q9.js.map +1 -0
- package/dist/{connector-CM-uuxKM.js → connector-Dl098To-.js} +402 -3
- package/dist/connector-Dl098To-.js.map +1 -0
- package/dist/{do-oauth-client-provider-DfsUcpc3.d.ts → do-oauth-client-provider-DtNqv7oj.d.ts} +26 -2
- package/dist/{index-YSKgfgg9.d.ts → emitter-BJZtCVjQ.d.ts} +6 -140
- package/dist/emitter-DPOVcCln.js +15 -0
- package/dist/emitter-DPOVcCln.js.map +1 -0
- package/dist/experimental/channels/web/index.js +1 -1
- package/dist/experimental/webmcp.js +1 -1
- package/dist/harness/container/index.js +0 -1
- package/dist/harness/container/index.js.map +1 -1
- package/dist/harness/container/runtime/index.js +2 -2
- package/dist/harness/opencode/index.js +0 -1
- package/dist/harness/opencode/index.js.map +1 -1
- package/dist/harness/pi/index.d.ts +84 -30
- package/dist/harness/pi/index.js +120 -224
- package/dist/harness/pi/index.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -2
- package/dist/{input-schema-BQykTEp_.js → input-schema-0uUu392-.js} +2 -2
- package/dist/input-schema-0uUu392-.js.map +1 -0
- package/dist/{input-schema-B0Etuo-o.js → input-schema-waggtYrH.js} +2 -2
- package/dist/input-schema-waggtYrH.js.map +1 -0
- package/dist/markdown-BZ-VLtA1.js +86 -0
- package/dist/markdown-BZ-VLtA1.js.map +1 -0
- package/dist/mcp/client/do-oauth-client-provider.d.ts +4 -2
- package/dist/mcp/client/do-oauth-client-provider.js +15 -1
- package/dist/mcp/client/do-oauth-client-provider.js.map +1 -1
- package/dist/mcp/client/index.d.ts +1 -1
- package/dist/mcp/client/x402.d.ts +8 -8
- package/dist/mcp/index.d.ts +2 -2
- package/dist/mcp/index.js +4 -4
- package/dist/mcp/index.js.map +1 -1
- package/dist/models/pi-ai/index.js +12 -15
- package/dist/models/pi-ai/index.js.map +1 -1
- package/dist/observability/ai/index.js +1 -2
- package/dist/observability/ai/index.js.map +1 -1
- package/dist/observability/index.d.ts +170 -9
- package/dist/observability/index.js +386 -11
- package/dist/observability/index.js.map +1 -1
- package/dist/react.d.ts +2 -2
- package/dist/resource-B59OV2a2.js +325 -0
- package/dist/resource-B59OV2a2.js.map +1 -0
- package/dist/routing/index.d.ts +1 -1
- package/dist/script-CFDLTk5b.d.ts +91 -0
- package/dist/script-workspace-BpdAYq1R.d.ts +41 -0
- package/dist/serializable.d.ts +1 -1
- package/dist/{session-7CDgVE0z.js → session-CRY0bGiI.js} +423 -411
- package/dist/session-CRY0bGiI.js.map +1 -0
- package/dist/skill-DRBcIBjC.d.ts +221 -0
- package/dist/skills/index.d.ts +275 -36
- package/dist/skills/index.js +265 -1534
- package/dist/skills/index.js.map +1 -1
- package/dist/skills/runner.d.ts +37 -0
- package/dist/skills/runner.js +912 -0
- package/dist/skills/runner.js.map +1 -0
- package/dist/skills/tools/ai-sdk.d.ts +36 -0
- package/dist/skills/tools/ai-sdk.js +94 -0
- package/dist/skills/tools/ai-sdk.js.map +1 -0
- package/dist/source-9RQzlEhM.d.ts +112 -0
- package/dist/{src-BGolXG_H.js → src-DoGNJ4Ud.js} +4 -5
- package/dist/src-DoGNJ4Ud.js.map +1 -0
- package/dist/sub-routing.d.ts +1 -1
- package/dist/tool-CxKsvxjm.js.map +1 -1
- package/dist/tool-DkT_DJBm.js.map +1 -1
- package/dist/{tool-helpers-BodWi4gd.js → tool-helpers-F3_Wy2YX.js} +2 -3
- package/dist/{tool-helpers-BodWi4gd.js.map → tool-helpers-F3_Wy2YX.js.map} +1 -1
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +10 -258
- package/dist/vite.js.map +1 -1
- package/dist/voice/index.d.ts +1 -1
- package/dist/web/fetch/tools/ai-sdk.js +1 -1
- package/dist/web/fetch/tools/pi.d.ts +4 -7
- package/dist/web/fetch/tools/pi.js +7 -6
- package/dist/web/fetch/tools/pi.js.map +1 -1
- package/dist/web/fetch/tools/tanstack-ai.js +1 -1
- package/dist/web/search/tools/ai-sdk.js +1 -1
- package/dist/web/search/tools/pi.d.ts +5 -4
- package/dist/web/search/tools/pi.js +5 -10
- package/dist/web/search/tools/pi.js.map +1 -1
- package/dist/web/search/tools/tanstack-ai.js +1 -1
- package/dist/websockets/index.js +1 -1
- package/dist/{websockets-CyoeosdO.js → websockets-C6SJtWCJ.js} +1 -2
- package/dist/{websockets-CyoeosdO.js.map → websockets-C6SJtWCJ.js.map} +1 -1
- package/dist/workflow-types.d.ts +1 -1
- package/dist/workflows.d.ts +1 -1
- package/dist/workflows.js +0 -1
- package/dist/workflows.js.map +1 -1
- package/docs/browse-the-web.md +36 -3
- package/docs/harnesses/pi.md +59 -33
- package/docs/mcp-client.md +23 -1
- package/docs/mcp-servers.md +2 -2
- package/docs/models-pi-ai.md +1 -1
- package/docs/observability.md +5 -3
- package/package.json +37 -22
- package/dist/browser-1eUbPvC2.js +0 -931
- package/dist/browser-1eUbPvC2.js.map +0 -1
- package/dist/browser-tool-lGnvEBLJ.js +0 -497
- package/dist/browser-tool-lGnvEBLJ.js.map +0 -1
- package/dist/cloudflare-Dzvc7V2N.js.map +0 -1
- package/dist/connector-CM-uuxKM.js.map +0 -1
- package/dist/index-iv9FTXX9.d.ts +0 -311
- package/dist/input-schema-B0Etuo-o.js.map +0 -1
- package/dist/input-schema-BQykTEp_.js.map +0 -1
- package/dist/session-7CDgVE0z.js.map +0 -1
- package/dist/skills/compile.d.ts +0 -40
- package/dist/skills/compile.js +0 -65
- package/dist/skills/compile.js.map +0 -1
- package/dist/src-BGolXG_H.js.map +0 -1
- package/skills-module.d.ts +0 -22
|
@@ -94,74 +94,6 @@ interface CdpSpecSource {
|
|
|
94
94
|
/** Load the (cached) searchable CDP spec for a browser source. */
|
|
95
95
|
declare function loadCdpSpec(source: CdpSpecSource): Promise<SearchableCdpSpec>;
|
|
96
96
|
//#endregion
|
|
97
|
-
//#region src/browser/providers/browser-run.d.ts
|
|
98
|
-
/**
|
|
99
|
-
* Browser Run settings applied every time a browser is created — including
|
|
100
|
-
* when a lost browser is replaced — so options like guardrails survive a
|
|
101
|
-
* restart.
|
|
102
|
-
*/
|
|
103
|
-
interface BrowserRunOptions<S = Record<string, unknown>> {
|
|
104
|
-
/**
|
|
105
|
-
* Platform `keep_alive` in milliseconds: how long an idle browser lives.
|
|
106
|
-
* Defaults to {@link BROWSER_SESSION_KEEP_ALIVE_DEFAULT_MS} (10 minutes).
|
|
107
|
-
* Browser Run accepts up to {@link BROWSER_SESSION_KEEP_ALIVE_MAX_MS}
|
|
108
|
-
* (20 minutes).
|
|
109
|
-
*/
|
|
110
|
-
keepAliveMs?: number;
|
|
111
|
-
/** Opt into Browser Run session recording (rrweb capture). */
|
|
112
|
-
recording?: boolean;
|
|
113
|
-
/**
|
|
114
|
-
* Hostname guardrails, fixed at launch for every connection. They don't
|
|
115
|
-
* apply to `internalHosts`: `allowedDomains: []` leaves the browser able
|
|
116
|
-
* to open internal hostnames only.
|
|
117
|
-
*/
|
|
118
|
-
guardrails?: BrowserSessionGuardrails;
|
|
119
|
-
/**
|
|
120
|
-
* Hostnames only this browser can open, served by your agent or a Worker
|
|
121
|
-
* instead of the internet. Plain http on port 80; no HTTPS or WebSockets.
|
|
122
|
-
* Deployed Workers only: in local dev the browser starts without them.
|
|
123
|
-
*
|
|
124
|
-
* Any http page open in the browser can send requests to these hosts, so
|
|
125
|
-
* a host whose requests have side effects should check `Origin` (see
|
|
126
|
-
* `InternalHost.fetch`).
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* ```ts
|
|
130
|
-
* browserRun(this.env.BROWSER, {
|
|
131
|
-
* internalHosts: {
|
|
132
|
-
* router: this.ctx.exports.InternalHostRouter,
|
|
133
|
-
* hosts: {
|
|
134
|
-
* "preview.internal": {
|
|
135
|
-
* description: "A dev server in your sandbox",
|
|
136
|
-
* target: z.object({ port: z.number().int() }),
|
|
137
|
-
* fetch: (request, { port }) => this.sandboxPort(port, request)
|
|
138
|
-
* }
|
|
139
|
-
* }
|
|
140
|
-
* }
|
|
141
|
-
* });
|
|
142
|
-
* ```
|
|
143
|
-
*/
|
|
144
|
-
internalHosts?: InternalHostsOptions<S>;
|
|
145
|
-
}
|
|
146
|
-
/** A {@link Browser} provider backed by Cloudflare Browser Run. */
|
|
147
|
-
interface BrowserRunProvider {
|
|
148
|
-
readonly kind: "browser-run";
|
|
149
|
-
readonly binding: BrowserBinding;
|
|
150
|
-
readonly options: BrowserRunOptions;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Run the browser on Cloudflare Browser Run.
|
|
154
|
-
*
|
|
155
|
-
* @example
|
|
156
|
-
* ```ts
|
|
157
|
-
* new Browser({ provider: browserRun(env.BROWSER, { recording: true }) });
|
|
158
|
-
* ```
|
|
159
|
-
*/
|
|
160
|
-
declare function browserRun<const S extends Record<string, unknown> = {}>(
|
|
161
|
-
binding: BrowserBinding,
|
|
162
|
-
options?: BrowserRunOptions<S>
|
|
163
|
-
): BrowserRunProvider;
|
|
164
|
-
//#endregion
|
|
165
97
|
//#region src/browser/session.d.ts
|
|
166
98
|
/**
|
|
167
99
|
* What a {@link BrowserSession} connects to. Usually a `Browser` installed on
|
|
@@ -177,8 +109,8 @@ interface BrowserSource {
|
|
|
177
109
|
*/
|
|
178
110
|
connect(options?: BrowserConnectOptions): Promise<BrowserConnection>;
|
|
179
111
|
/**
|
|
180
|
-
* The browser's internal hostnames, when it has any.
|
|
181
|
-
*
|
|
112
|
+
* The browser's internal hostnames, when it has any. The docs list them,
|
|
113
|
+
* and {@link BrowserSession.functions} adds the hosts functions.
|
|
182
114
|
*/
|
|
183
115
|
readonly internalHosts?: BrowserInternalHosts;
|
|
184
116
|
}
|
|
@@ -194,6 +126,35 @@ interface BrowserSessionOptions {
|
|
|
194
126
|
* JSON. Defaults to 1,000,000 bytes.
|
|
195
127
|
*/
|
|
196
128
|
maxResultBytes?: number;
|
|
129
|
+
/**
|
|
130
|
+
* Lock the scope on this browser: the session takes the scope's lock at
|
|
131
|
+
* its first call (or at {@link BrowserSession.lock}) and holds it until it
|
|
132
|
+
* closes. Other locking sessions in the scope wait for the lock, in order,
|
|
133
|
+
* rather than fail, so their calls never interleave. Sessions without it
|
|
134
|
+
* don't wait and aren't waited for. Locks are per isolate, which is per
|
|
135
|
+
* Durable Object.
|
|
136
|
+
*
|
|
137
|
+
* Use it when several runs in one scope can start together (parallel
|
|
138
|
+
* tool calls, say) and must not see each other's navigation.
|
|
139
|
+
*
|
|
140
|
+
* Only `close()` releases the lock: not aborting a signal, losing the
|
|
141
|
+
* browser, or dropping the session. Close a locking session in `finally`,
|
|
142
|
+
* even when connecting failed, or its scope stays locked until the
|
|
143
|
+
* isolate restarts.
|
|
144
|
+
*/
|
|
145
|
+
lock?: boolean;
|
|
146
|
+
}
|
|
147
|
+
/** {@link BrowserSession.lock}'s options. */
|
|
148
|
+
interface BrowserLockOptions {
|
|
149
|
+
/**
|
|
150
|
+
* Bounds this call's wait: when it aborts, this call rejects with its
|
|
151
|
+
* reason. The session keeps waiting while other calls still are; once
|
|
152
|
+
* none is, it leaves the queue at once, so it doesn't hold up the
|
|
153
|
+
* sessions behind it. A call without a signal, including the wait a
|
|
154
|
+
* session's first function call makes, never gives up. The signal does
|
|
155
|
+
* nothing once the lock is held: only `close()` releases it.
|
|
156
|
+
*/
|
|
157
|
+
signal?: AbortSignal;
|
|
197
158
|
}
|
|
198
159
|
/** `send`'s input. */
|
|
199
160
|
interface BrowserSendInput {
|
|
@@ -242,6 +203,11 @@ interface BrowserSessionReport {
|
|
|
242
203
|
tabClosed: boolean;
|
|
243
204
|
/** Another scope is working in this scope's active tab too. */
|
|
244
205
|
tabShared: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* The report as sentences for the model, one per thing that happened,
|
|
208
|
+
* empty when nothing did. Show them after the run's result.
|
|
209
|
+
*/
|
|
210
|
+
notices: string[];
|
|
245
211
|
}
|
|
246
212
|
/** `sessionId` value that addresses the tab the agent is working in. */
|
|
247
213
|
declare const ACTIVE_PAGE_SESSION = "active";
|
|
@@ -254,13 +220,42 @@ declare const ACTIVE_PAGE_SESSION = "active";
|
|
|
254
220
|
* usually comes from model-written code.
|
|
255
221
|
*
|
|
256
222
|
* Create one per run with `browser.session({ scope })`, and close it when
|
|
257
|
-
* the run ends. The browser itself stays open.
|
|
223
|
+
* the run ends. The browser itself stays open. Pass `lock: true` when
|
|
224
|
+
* runs in one scope may overlap; see {@link BrowserSessionOptions.lock}.
|
|
258
225
|
*
|
|
259
226
|
* @experimental The API surface may change before stabilizing.
|
|
260
227
|
*/
|
|
261
228
|
declare class BrowserSession {
|
|
262
229
|
#private;
|
|
263
230
|
constructor(browser: BrowserSource, options?: BrowserSessionOptions);
|
|
231
|
+
/**
|
|
232
|
+
* The `browser.*` functions bound to this session, by name: the ones
|
|
233
|
+
* `Browser.functionDocs()` describes. Each takes one input object and
|
|
234
|
+
* validates it, so model-written code can call them directly. Like the
|
|
235
|
+
* session's methods, every one rejects once the session is closed, and
|
|
236
|
+
* waits for the scope's lock when the session locks.
|
|
237
|
+
*/
|
|
238
|
+
get functions(): Readonly<Record<string, BrowserFunction>>;
|
|
239
|
+
/**
|
|
240
|
+
* Take this scope's lock now rather than at the first call, and hold it
|
|
241
|
+
* until {@link close}. For sessions opened with `lock: true`; a
|
|
242
|
+
* caller with its own time limit calls it first, so the wait doesn't count
|
|
243
|
+
* against the limit, or passes `signal` to bound the wait.
|
|
244
|
+
*
|
|
245
|
+
* Resolves once the session holds the lock, after the locking sessions
|
|
246
|
+
* ahead of it close; later and concurrent calls resolve with the same
|
|
247
|
+
* lock. Rejects when the session closes while waiting. Each call's
|
|
248
|
+
* `signal` bounds only that call's wait: it rejects with the signal's
|
|
249
|
+
* reason, and the session leaves the queue once no call is still
|
|
250
|
+
* waiting (see {@link BrowserLockOptions.signal}); a later call or first
|
|
251
|
+
* call waits again.
|
|
252
|
+
*/
|
|
253
|
+
lock(options?: BrowserLockOptions): Promise<void>;
|
|
254
|
+
/**
|
|
255
|
+
* How long this session waited for its lock, in milliseconds: `0` until
|
|
256
|
+
* it has waited, and for sessions that don't lock.
|
|
257
|
+
*/
|
|
258
|
+
get waitedForLockMs(): number;
|
|
264
259
|
/**
|
|
265
260
|
* Send a CDP command and resolve with its result, without the JSON-RPC
|
|
266
261
|
* envelope. `sessionId: "active"` runs it in the scope's tab.
|
|
@@ -287,16 +282,137 @@ declare class BrowserSession {
|
|
|
287
282
|
* connected. Never rejects: failures to read the browser's state are
|
|
288
283
|
* logged and leave the report incomplete. Later calls resolve with
|
|
289
284
|
* `undefined`, and other methods reject.
|
|
285
|
+
*
|
|
286
|
+
* A locking session releases the lock once the active tab is saved, or
|
|
287
|
+
* stops waiting for it if it was still waiting.
|
|
290
288
|
*/
|
|
291
289
|
close(): Promise<BrowserSessionReport | undefined>;
|
|
292
290
|
}
|
|
293
291
|
//#endregion
|
|
294
|
-
//#region src/browser/browser.d.ts
|
|
292
|
+
//#region src/browser/browser-functions.d.ts
|
|
293
|
+
/**
|
|
294
|
+
* One function on the `browser` object, as the host runs it: it takes one
|
|
295
|
+
* input object (usually from model-written code, so it's validated) and
|
|
296
|
+
* resolves with a JSON-safe result.
|
|
297
|
+
*
|
|
298
|
+
* @experimental The API surface may change before stabilizing.
|
|
299
|
+
*/
|
|
300
|
+
type BrowserFunction = (input: unknown) => Promise<unknown>;
|
|
301
|
+
/**
|
|
302
|
+
* What the model needs to know to use the `browser` object, for a tool or
|
|
303
|
+
* module description. `Browser.functionDocs()` returns it.
|
|
304
|
+
*
|
|
305
|
+
* @experimental The API surface may change before stabilizing.
|
|
306
|
+
*/
|
|
307
|
+
interface BrowserFunctionDocs {
|
|
308
|
+
/**
|
|
309
|
+
* The `browser.*` functions in Markdown, one bullet per function, then the
|
|
310
|
+
* browser's internal sites when it has any.
|
|
311
|
+
*/
|
|
312
|
+
functions: string;
|
|
313
|
+
/**
|
|
314
|
+
* How to use the browser, one rule per entry, without bullets. Rules about
|
|
315
|
+
* how the code runs (timeouts, how screenshots reach the model) belong to
|
|
316
|
+
* whatever runs it, so add those yourself.
|
|
317
|
+
*/
|
|
318
|
+
rules: string[];
|
|
319
|
+
}
|
|
320
|
+
//#endregion
|
|
321
|
+
//#region src/browser/providers/browser-run.d.ts
|
|
322
|
+
/**
|
|
323
|
+
* Browser Run settings applied every time a browser is created — including
|
|
324
|
+
* when a lost browser is replaced — so options like guardrails survive a
|
|
325
|
+
* restart.
|
|
326
|
+
*/
|
|
327
|
+
interface BrowserRunOptions<S = Record<string, unknown>> {
|
|
328
|
+
/**
|
|
329
|
+
* Platform `keep_alive` in milliseconds: how long an idle browser lives.
|
|
330
|
+
* Defaults to {@link BROWSER_SESSION_KEEP_ALIVE_DEFAULT_MS} (10 minutes).
|
|
331
|
+
* Browser Run accepts up to {@link BROWSER_SESSION_KEEP_ALIVE_MAX_MS}
|
|
332
|
+
* (20 minutes).
|
|
333
|
+
*/
|
|
334
|
+
keepAliveMs?: number;
|
|
335
|
+
/** Opt into Browser Run session recording (rrweb capture). */
|
|
336
|
+
recording?: boolean;
|
|
337
|
+
/**
|
|
338
|
+
* Hostname guardrails, fixed at launch for every connection. They don't
|
|
339
|
+
* apply to `internalHosts`: `allowedDomains: []` leaves the browser able
|
|
340
|
+
* to open internal hostnames only.
|
|
341
|
+
*/
|
|
342
|
+
guardrails?: BrowserSessionGuardrails;
|
|
343
|
+
/**
|
|
344
|
+
* Hostnames only this browser can open, served by your agent or a Worker
|
|
345
|
+
* instead of the internet. Plain http on port 80; no HTTPS or WebSockets.
|
|
346
|
+
* Deployed Workers only: in local dev the browser starts without them.
|
|
347
|
+
*
|
|
348
|
+
* Any http page open in the browser can send requests to these hosts, so
|
|
349
|
+
* a host whose requests have side effects should check `Origin` (see
|
|
350
|
+
* `InternalHost.fetch`).
|
|
351
|
+
*
|
|
352
|
+
* @example
|
|
353
|
+
* ```ts
|
|
354
|
+
* browserRun(this.env.BROWSER, {
|
|
355
|
+
* internalHosts: {
|
|
356
|
+
* router: this.ctx.exports.InternalHostRouter,
|
|
357
|
+
* hosts: {
|
|
358
|
+
* "preview.internal": {
|
|
359
|
+
* description: "A dev server in your sandbox",
|
|
360
|
+
* target: z.object({ port: z.number().int() }),
|
|
361
|
+
* fetch: (request, { port }) => this.sandboxPort(port, request)
|
|
362
|
+
* }
|
|
363
|
+
* }
|
|
364
|
+
* }
|
|
365
|
+
* });
|
|
366
|
+
* ```
|
|
367
|
+
*/
|
|
368
|
+
internalHosts?: InternalHostsOptions<S>;
|
|
369
|
+
}
|
|
370
|
+
/** A {@link Browser} provider backed by Cloudflare Browser Run. */
|
|
371
|
+
interface BrowserRunProvider {
|
|
372
|
+
readonly kind: "browser-run";
|
|
373
|
+
readonly binding: BrowserBinding;
|
|
374
|
+
readonly options: BrowserRunOptions;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Run the browser on Cloudflare Browser Run.
|
|
378
|
+
*
|
|
379
|
+
* @example
|
|
380
|
+
* ```ts
|
|
381
|
+
* new Browser({ provider: browserRun(env.BROWSER, { recording: true }) });
|
|
382
|
+
* ```
|
|
383
|
+
*/
|
|
384
|
+
declare function browserRun<const S extends Record<string, unknown> = {}>(
|
|
385
|
+
binding: BrowserBinding,
|
|
386
|
+
options?: BrowserRunOptions<S>
|
|
387
|
+
): BrowserRunProvider;
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/browser/scope.d.ts
|
|
390
|
+
/**
|
|
391
|
+
* Browser scopes: who is driving a shared `Browser`. Sessions with the same
|
|
392
|
+
* scope share an active tab (and, when they lock, a lock); each scope
|
|
393
|
+
* keeps its own. Cookies and logins are shared by every scope.
|
|
394
|
+
*/
|
|
295
395
|
/**
|
|
296
396
|
* The scope used when a caller doesn't pick one: every caller that leaves
|
|
297
|
-
* `scope` out shares this one active tab. See
|
|
397
|
+
* `scope` out shares this one active tab. See `BrowserConnectOptions`.
|
|
298
398
|
*/
|
|
299
399
|
declare const DEFAULT_BROWSER_SCOPE = "shared";
|
|
400
|
+
/**
|
|
401
|
+
* The scope for one conversation: `conversation:<id>`. pi's `browserTool`
|
|
402
|
+
* gives each conversation this scope by default, so app code that opens
|
|
403
|
+
* sessions with the same scope (a Workspace's `codemode:browser`, say) lands
|
|
404
|
+
* in the same tab as the tool. pi's conversation ids are numbers: pass
|
|
405
|
+
* `String(conversationId)`.
|
|
406
|
+
*
|
|
407
|
+
* Throws on a missing or empty id rather than returning
|
|
408
|
+
* `"conversation:undefined"`, which would quietly put every conversation
|
|
409
|
+
* without an id in one tab.
|
|
410
|
+
*
|
|
411
|
+
* @experimental The API surface may change before stabilizing.
|
|
412
|
+
*/
|
|
413
|
+
declare function conversationScope(id: string): string;
|
|
414
|
+
//#endregion
|
|
415
|
+
//#region src/browser/browser.d.ts
|
|
300
416
|
/**
|
|
301
417
|
* Scope records kept per browser. Writing a new one past the cap deletes the
|
|
302
418
|
* least recently used; a scope that comes back afterwards starts fresh.
|
|
@@ -459,6 +575,14 @@ declare class Browser extends LifecycleCapability {
|
|
|
459
575
|
* one per run.
|
|
460
576
|
*/
|
|
461
577
|
session(options?: BrowserSessionOptions): BrowserSession;
|
|
578
|
+
/**
|
|
579
|
+
* What the model needs to know to use this browser's `browser.*`
|
|
580
|
+
* functions ({@link BrowserSession.functions}): the functions in Markdown,
|
|
581
|
+
* including the internal sites and hosts functions this browser has, and
|
|
582
|
+
* the rules for using them. For a tool or module description; add rules
|
|
583
|
+
* about how your code runs (timeouts, screenshots) yourself.
|
|
584
|
+
*/
|
|
585
|
+
functionDocs(): BrowserFunctionDocs;
|
|
462
586
|
/**
|
|
463
587
|
* Close the browser: retire the record (so the next resolve reports
|
|
464
588
|
* `restarted: true`) and close its provider session. Returns `false` when
|
|
@@ -509,31 +633,35 @@ declare class Browser extends LifecycleCapability {
|
|
|
509
633
|
}
|
|
510
634
|
//#endregion
|
|
511
635
|
export {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
636
|
+
loadCdpSpec as A,
|
|
637
|
+
BrowserSessionOptions as C,
|
|
638
|
+
CdpItems as D,
|
|
639
|
+
CdpField as E,
|
|
640
|
+
CdpSpecSource as O,
|
|
641
|
+
BrowserSession as S,
|
|
642
|
+
BrowserSource as T,
|
|
643
|
+
BrowserAttachInput as _,
|
|
517
644
|
BrowserOptions as a,
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
645
|
+
BrowserNewTab as b,
|
|
646
|
+
ResolvedBrowser as c,
|
|
647
|
+
BrowserRunOptions as d,
|
|
648
|
+
BrowserRunProvider as f,
|
|
649
|
+
ACTIVE_PAGE_SESSION as g,
|
|
650
|
+
BrowserFunctionDocs as h,
|
|
524
651
|
BrowserInternalHosts as i,
|
|
525
|
-
|
|
526
|
-
|
|
652
|
+
SearchableCdpSpec as k,
|
|
653
|
+
DEFAULT_BROWSER_SCOPE as l,
|
|
654
|
+
BrowserFunction as m,
|
|
527
655
|
BrowserConnectOptions as n,
|
|
528
656
|
BrowserProvider as o,
|
|
529
|
-
|
|
657
|
+
browserRun as p,
|
|
530
658
|
BrowserConnection as r,
|
|
531
|
-
|
|
659
|
+
MAX_BROWSER_SCOPES as s,
|
|
532
660
|
Browser as t,
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
661
|
+
conversationScope as u,
|
|
662
|
+
BrowserDebugLogInput as v,
|
|
663
|
+
BrowserSessionReport as w,
|
|
664
|
+
BrowserSendInput as x,
|
|
665
|
+
BrowserLockOptions as y
|
|
538
666
|
};
|
|
539
|
-
//# sourceMappingURL=browser-
|
|
667
|
+
//# sourceMappingURL=browser-CI97khiJ.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as BrowserSource } from "./browser-CI97khiJ.js";
|
|
2
2
|
|
|
3
3
|
//#region src/browser/browser-tool.d.ts
|
|
4
4
|
interface BrowserToolOptions {
|
|
@@ -68,4 +68,4 @@ export {
|
|
|
68
68
|
BrowserToolOutput as r,
|
|
69
69
|
BrowserToolInput as t
|
|
70
70
|
};
|
|
71
|
-
//# sourceMappingURL=browser-tool-
|
|
71
|
+
//# sourceMappingURL=browser-tool-Cxtiwfua.d.ts.map
|