@prompteryx/sdk 0.4.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,541 @@
1
+ import { H as HttpClient, A as AutopilotRunOptions, a as AutopilotRunResult, b as AutopilotStep, C as CreateSessionOptions, c as CloudSession, d as CloudSessionSummary, e as CloudFetchOptions, f as CloudFetchResult, g as CloudSearchResult, E as ExecutionRecord, h as ExecutionLogEvent, P as ProfileSummary, S as ScheduleSummary, i as CreateScheduleOptions, j as SubscriptionStatus, W as WorkflowSummary, R as RunWorkflowOptions, k as RunWorkflowResult, l as CopilotHelpers, m as PageLike, n as CopilotDoResult, D as DiscoveredAction, o as PrompteryxClientOptions } from './page-8LsjwpEo.js';
2
+ export { p as AUTOPILOT_MODELS, q as ApiKeySummary, r as AutopilotModel, s as AutopilotModelId, t as ConnectHubActionSummary, u as ConnectHubAppSummary, v as CustomNodeSummary, w as DEFAULT_AUTOPILOT_MODEL, x as ExecutionStatus, y as ExecutionTarget, z as ProxyLocation, B as Region, F as RunConnectHubActionOptions, G as SessionRecording, T as TemplateSummary, I as WorkflowExecutionOptions } from './page-8LsjwpEo.js';
3
+
4
+ /**
5
+ * `px.autopilot.*` — autonomous browser agent.
6
+ *
7
+ * **Autopilot** is the autonomous, multi-step surface. You hand it
8
+ * a goal in plain English; it drives the browser end-to-end and
9
+ * returns a step-by-step trace. Counterpart to **Copilot** which
10
+ * helps with one step at a time (see ../page.ts).
11
+ *
12
+ * Built on the existing AI Browser Agent runtime. Every option the
13
+ * in-app UI exposes — model, max steps, system-prompt override,
14
+ * tool restrictions, viewport, region, proxy, CAPTCHA, recording —
15
+ * is available via the SDK. New options added to the runtime ride
16
+ * through `passthrough` without an SDK release.
17
+ *
18
+ * **Action caching superpower** — set `saveAsWorkflow: true` and the
19
+ * autopilot's discovered action sequence is captured as a permanent
20
+ * Visual Studio workflow you can replay for free forever. The
21
+ * response includes `savedWorkflowId`. Subsequent calls to
22
+ * `px.workflows.run(savedWorkflowId)` cost no AI Credits and benefit
23
+ * from multi-option-selector resilience to UI changes.
24
+ */
25
+
26
+ declare class AutopilotResource {
27
+ private readonly http;
28
+ constructor(http: HttpClient);
29
+ /**
30
+ * Run the autopilot. Blocks until the task finishes (success, step
31
+ * limit, or error). Returns the trace plus optionally the saved
32
+ * workflow id.
33
+ *
34
+ * ```ts
35
+ * const result = await px.autopilot.run({
36
+ * goal: 'Apply for the Senior Engineer role at OpenAI',
37
+ * startUrl: 'https://openai.com/careers',
38
+ * maxSteps: 40,
39
+ * saveAsWorkflow: true, // Replay-forever, zero AI cost
40
+ * session: { useProxy: true, useCaptcha: true },
41
+ * })
42
+ * if (result.savedWorkflowId) {
43
+ * console.log('Saved as workflow:', result.savedWorkflowId)
44
+ * // Run it later for free:
45
+ * await px.workflows.run(result.savedWorkflowId)
46
+ * }
47
+ * ```
48
+ */
49
+ run(opts: AutopilotRunOptions): Promise<AutopilotRunResult>;
50
+ /** The task params shared by the sync, swarm, and async request bodies. */
51
+ private cloudTaskBody;
52
+ /** Multi-agent swarm — one synchronous request; the server merges all lanes. */
53
+ private runSwarm;
54
+ /**
55
+ * Async single-agent run: POST { mode:'start' } to set up the job (returns a
56
+ * jobId immediately), then POST { mode:'run' } in a loop — each advances the job
57
+ * for up to ~230s server-side and returns the current status — until the job is
58
+ * terminal or `opts.timeoutMs` elapses. No single request is long, so the gateway
59
+ * timeout is never hit. Same `AutopilotRunResult` shape as before.
60
+ */
61
+ private runAsync;
62
+ /** Map an execute-endpoint payload (sync result, swarm result, or async status
63
+ * view — they share finalAnswer / steps / usage / savedWorkflowId / status) into
64
+ * the public AutopilotRunResult shape. */
65
+ private mapResult;
66
+ /**
67
+ * Local Chrome autopilot — talks DIRECTLY to the Prompteryx desktop app on
68
+ * this machine (localhost:61337): opens your local Chrome, runs the agent
69
+ * loop there, polls until done. Same options as `run` (model, aiVision
70
+ * preset, maxSteps, maxCredits, costSaving). Credits still apply; cloud
71
+ * minutes do not. The tab stays open after the run for follow-ups.
72
+ */
73
+ private runLocal;
74
+ /**
75
+ * Ask a running async job to stop at its next step boundary
76
+ * (`POST { jobId, mode: 'stop' }`). Use it to wind down a job you
77
+ * started via the raw API (or a run you're abandoning) instead of
78
+ * leaving it stepping against a dead browser session until the step
79
+ * cap — an abandoned job burns a model call + timeout per step.
80
+ *
81
+ * ```ts
82
+ * const { stopRequested, status } = await px.autopilot.stop(jobId)
83
+ * ```
84
+ */
85
+ stop(jobId: string): Promise<{
86
+ jobId: string;
87
+ stopRequested: boolean;
88
+ status?: string;
89
+ }>;
90
+ /**
91
+ * Run the autopilot over the keep-alive stream endpoint and yield the
92
+ * step trace. Ends with a `{ step: -1, action: 'done' }` sentinel whose
93
+ * `result` field carries the full `AutopilotRunResult`.
94
+ *
95
+ * ```ts
96
+ * for await (const step of px.autopilot.stream({ goal: 'Buy a ticket' })) {
97
+ * console.log('Step', step.step, '→', step.action)
98
+ * if (step.action === 'done') break
99
+ * }
100
+ * ```
101
+ *
102
+ * PROTOCOL (matches /api/v1/ai-browser/execute-stream — it is NOT SSE):
103
+ * the server emits a 1-space heartbeat every 15s while the run executes,
104
+ * then the complete execute-route JSON as the final chunk, i.e. the body
105
+ * is `<heartbeats>\n<json>`. The heartbeats exist to defeat the ~300s
106
+ * infra idle timeout on long synchronous runs; per-step live events are
107
+ * not available on this route, so steps arrive together when the run
108
+ * finishes. Prefer `run()` unless you specifically want the keep-alive
109
+ * transport for a long single-request run.
110
+ */
111
+ stream(opts: AutopilotRunOptions & {
112
+ signal?: AbortSignal;
113
+ }): AsyncGenerator<AutopilotStep, void, void>;
114
+ }
115
+
116
+ /**
117
+ * `px.cloudBrowser.*` — sessions, one-shot fetch, search.
118
+ *
119
+ * The most-used path: `sessions.create()` returns a `connectUrl` you
120
+ * pass to Playwright's `chromium.connectOverCDP(connectUrl)`. Your own
121
+ * Playwright code drives the browser from there; we handle the
122
+ * infrastructure (residential proxies, recording, persistence).
123
+ *
124
+ * ⚠️ KEY FAMILY (verified live 2026-09-03): every /api/v1/cloud-browser/*
125
+ * route authenticates with a CLOUD BROWSER key (`pcb_live_…`) sent as
126
+ * `x-api-key` — NOT the platform `px_live_…` Bearer key the rest of the
127
+ * SDK uses. Pass it as `new Prompteryx({ apiKey, cloudBrowserKey })`;
128
+ * calls throw a descriptive AuthError when it's missing.
129
+ */
130
+
131
+ /** Sub-resource: cloud browser sessions. */
132
+ declare class SessionsResource {
133
+ private readonly http;
134
+ constructor(http: HttpClient);
135
+ /** Headers for the pcb_live_ key family (throws a clear error if absent). */
136
+ private cbAuth;
137
+ private cbRequest;
138
+ /** Create a new browser session.
139
+ *
140
+ * Cloud (default):
141
+ * ```ts
142
+ * const s = await px.cloudBrowser.sessions.create()
143
+ * // s.connectUrl → Prompteryx Cloud CDP. Bills cloud-browser minutes.
144
+ * ```
145
+ *
146
+ * Local — uses YOUR machine's Chrome via the Prompteryx plugin +
147
+ * Electron runner. ZERO cloud-browser minutes. Requires the plugin
148
+ * to be running on the same machine as the SDK consumer; the call
149
+ * short-circuits to localhost and never reaches the API.
150
+ * ```ts
151
+ * const s = await px.cloudBrowser.sessions.create({ target: 'local' })
152
+ * // s.connectUrl → http://localhost:9222 (your Chrome's debug port)
153
+ * ```
154
+ *
155
+ * When `target: 'local'` is set, cloud-only fields (recordSession,
156
+ * proxy, profileId) are ignored — you're driving your own Chrome
157
+ * with whatever cookies/extensions you've already installed.
158
+ */
159
+ create(opts?: CreateSessionOptions): Promise<CloudSession>;
160
+ /** Retrieve a session's history record (status/duration/recording flag).
161
+ * Note: this is durable history, not a live handle — it has no
162
+ * `connectUrl`. Keep the `create()` response for connecting. */
163
+ get(sessionId: string): Promise<CloudSessionSummary>;
164
+ /** List recent sessions for your account, newest first. */
165
+ list(opts?: {
166
+ limit?: number;
167
+ }): Promise<CloudSessionSummary[]>;
168
+ /** Close a session, finalising the recording (if any) + releasing the
169
+ * cloud-browser slot. Idempotent. No-op for local sessions
170
+ * (target: 'local') — those don't have a slot to release. */
171
+ close(sessionId: string): Promise<{
172
+ ok: boolean;
173
+ proxyMB?: number;
174
+ }>;
175
+ }
176
+ declare class CloudBrowserResource {
177
+ private readonly http;
178
+ readonly sessions: SessionsResource;
179
+ constructor(http: HttpClient);
180
+ private cbAuth;
181
+ /**
182
+ * One-shot fetch through the cloud browser. Spins up a short-lived
183
+ * session, loads the page in real Chromium (so JS-rendered sites work),
184
+ * extracts the content, and tears down. Use this when you only need ONE
185
+ * page and don't want to manage Playwright yourself.
186
+ *
187
+ * ```ts
188
+ * const page = await px.cloudBrowser.fetch({
189
+ * url: 'https://example.com/pricing',
190
+ * format: 'markdown', // 'text' (default) | 'markdown' | 'html' | 'links'
191
+ * waitForSelector: '.pricing-table', // for JS-rendered content
192
+ * selectors: ['.pricing-table .plan'], // deterministic CSS extraction
193
+ * })
194
+ * // page.content, page.extracted, page.title, page.finalUrl …
195
+ * ```
196
+ */
197
+ fetch(opts: CloudFetchOptions): Promise<CloudFetchResult>;
198
+ /**
199
+ * Search the web through the cloud browser and get structured results
200
+ * (title/url/snippet). Runs the query against DuckDuckGo's server-rendered
201
+ * HTML endpoint in a real browser — there is no engine choice today.
202
+ */
203
+ search(opts: {
204
+ query: string;
205
+ /** Max results, 1–25. Default 10. */
206
+ limit?: number;
207
+ /** Route through a residential proxy. */
208
+ proxy?: boolean;
209
+ /** Proxy exit country (with `proxy: true`), e.g. 'us'. */
210
+ country?: string;
211
+ }): Promise<CloudSearchResult[]>;
212
+ }
213
+
214
+ /**
215
+ * `px.executions.*` — status, logs (polled OR streamed), wait.
216
+ */
217
+
218
+ declare class ExecutionsResource {
219
+ private readonly http;
220
+ constructor(http: HttpClient);
221
+ /** Get current execution record. */
222
+ get(executionId: string): Promise<ExecutionRecord>;
223
+ /**
224
+ * Block until the execution reaches a terminal state. Polls every
225
+ * `pollIntervalMs` (default 2s) until it's `completed`/`failed`/
226
+ * `cancelled`/`timed_out`, OR until `timeoutMs` elapses (default 5min).
227
+ *
228
+ * Throws `TimeoutError` on timeout; otherwise returns the final record.
229
+ */
230
+ wait(executionId: string, opts?: {
231
+ timeoutMs?: number;
232
+ pollIntervalMs?: number;
233
+ signal?: AbortSignal;
234
+ }): Promise<ExecutionRecord>;
235
+ /**
236
+ * Get the logs for a finished (or in-progress) execution as a one-shot
237
+ * fetch. For real-time streaming use `stream(executionId)` instead.
238
+ */
239
+ logs(executionId: string): Promise<ExecutionLogEvent[]>;
240
+ /**
241
+ * Stream log events as they arrive. Async iterable:
242
+ *
243
+ * for await (const ev of px.executions.stream(execId)) {
244
+ * console.log(ev.message)
245
+ * if (ev.type === 'done') break
246
+ * }
247
+ */
248
+ stream(executionId: string, opts?: {
249
+ signal?: AbortSignal;
250
+ }): AsyncGenerator<ExecutionLogEvent, void, void>;
251
+ /** Get a single node's output from a finished execution. */
252
+ getNodeOutput(executionId: string, nodeId: string): Promise<unknown>;
253
+ }
254
+
255
+ /**
256
+ * `px.profiles.*` — Chrome profile management.
257
+ *
258
+ * Profiles are persistent browser identities — they store cookies,
259
+ * local storage, extensions, and login state across sessions. Two
260
+ * kinds:
261
+ * • `cloud` — lives on the Prompteryx cloud browser infrastructure.
262
+ * Accessible from any device, but starts logged out (you have to
263
+ * log in once after creating).
264
+ * • `local` — runs on the user's own Chrome via the Prompteryx
265
+ * plugin. Reuses whatever Chrome profile the user is already
266
+ * signed into (Gmail, banking, internal SSO). Cloud-only
267
+ * workloads can't access this.
268
+ */
269
+
270
+ declare class ProfilesResource {
271
+ private readonly http;
272
+ constructor(http: HttpClient);
273
+ list(opts?: {
274
+ kind?: 'cloud' | 'local';
275
+ }): Promise<ProfileSummary[]>;
276
+ get(profileId: string): Promise<ProfileSummary>;
277
+ /** Create a new CLOUD profile. Local profiles are managed by the
278
+ * plugin and cannot be created via the API. */
279
+ create(opts: {
280
+ name: string;
281
+ }): Promise<ProfileSummary>;
282
+ delete(profileId: string): Promise<{
283
+ ok: true;
284
+ }>;
285
+ }
286
+
287
+ /**
288
+ * `px.schedules.*` — server-side workflow scheduling.
289
+ *
290
+ * Set a workflow to run on cron / interval; the platform's Cloud
291
+ * Scheduler will fire it on schedule even when no client is connected.
292
+ * Wraps the same scheduling primitive the Visual Studio "Active"
293
+ * toggle uses.
294
+ */
295
+
296
+ declare class SchedulesResource {
297
+ private readonly http;
298
+ constructor(http: HttpClient);
299
+ list(opts?: {
300
+ active?: boolean;
301
+ workflowId?: string;
302
+ }): Promise<ScheduleSummary[]>;
303
+ get(scheduleId: string): Promise<ScheduleSummary>;
304
+ /** Create a new schedule. Returns the created record. */
305
+ create(opts: CreateScheduleOptions): Promise<ScheduleSummary>;
306
+ /** Pause / resume / change cron / timezone. */
307
+ update(scheduleId: string, patch: Partial<CreateScheduleOptions> & {
308
+ active?: boolean;
309
+ }): Promise<ScheduleSummary>;
310
+ delete(scheduleId: string): Promise<{
311
+ ok: true;
312
+ }>;
313
+ }
314
+
315
+ /**
316
+ * `px.subscription.*` — plan + balance + usage telemetry.
317
+ *
318
+ * Programmatic access to the same numbers the in-app `/subscription`
319
+ * and `/cloud-platform/plans` pages display. Use this to:
320
+ * • Check the user's remaining AI Credits before kicking off a
321
+ * long workflow.
322
+ * • Read monthly execution counts for your own dashboards.
323
+ * • Detect a plan downgrade and react in your code.
324
+ */
325
+
326
+ declare class SubscriptionResource {
327
+ private readonly http;
328
+ constructor(http: HttpClient);
329
+ /** Get the current plan + balances + usage. */
330
+ get(): Promise<SubscriptionStatus>;
331
+ }
332
+
333
+ /**
334
+ * `px.workflows.*` — Visual Studio workflows.
335
+ *
336
+ * Trigger workflows you (or anyone you share with) built in Visual
337
+ * Studio. Workflows are first-class platform objects: they have
338
+ * permanent IDs, can be scheduled, shared, templated, and edited
339
+ * visually. Triggering one via the SDK is fully equivalent to
340
+ * pressing Run in the UI — same runtime, same node executor, same
341
+ * billing path.
342
+ */
343
+
344
+ declare class WorkflowsResource {
345
+ private readonly http;
346
+ constructor(http: HttpClient);
347
+ list(opts?: {
348
+ limit?: number;
349
+ search?: string;
350
+ tag?: string;
351
+ }): Promise<WorkflowSummary[]>;
352
+ get(workflowId: string): Promise<WorkflowSummary & {
353
+ nodes?: unknown[];
354
+ }>;
355
+ /**
356
+ * Trigger a workflow. Returns immediately with `executionId`. Use
357
+ * `px.executions.wait(id)` to block until completion or
358
+ * `px.executions.stream(id)` to follow log events live.
359
+ *
360
+ * The `execution` options override the workflow's saved settings
361
+ * for this one run — you don't have to edit the workflow in VS to
362
+ * change the proxy, region, profile, etc.
363
+ */
364
+ run(workflowId: string, opts?: RunWorkflowOptions): Promise<RunWorkflowResult>;
365
+ /**
366
+ * Run + block. Returns the final ExecutionRecord. Throws
367
+ * `TimeoutError` if the run takes longer than `timeoutMs`
368
+ * (default 5 minutes).
369
+ */
370
+ runAndWait(workflowId: string, opts?: RunWorkflowOptions & {
371
+ timeoutMs?: number;
372
+ pollIntervalMs?: number;
373
+ }): Promise<ExecutionRecord>;
374
+ private waitInternal;
375
+ }
376
+
377
+ /**
378
+ * Typed error hierarchy for the Prompteryx SDK.
379
+ *
380
+ * Every error from the SDK is an instance of `PrompteryxError`. Subclass
381
+ * by HTTP status family so callers can `if (err instanceof QuotaError)`
382
+ * without parsing strings. Network/parse errors get their own classes
383
+ * too so retries can fork on category.
384
+ */
385
+ /** Base class — every SDK error inherits from this. */
386
+ declare class PrompteryxError extends Error {
387
+ readonly status?: number;
388
+ readonly code?: string;
389
+ readonly requestId?: string;
390
+ readonly raw?: unknown;
391
+ constructor(message: string, opts?: {
392
+ status?: number;
393
+ code?: string;
394
+ requestId?: string;
395
+ raw?: unknown;
396
+ });
397
+ }
398
+ /** 401 / 403 — bad or revoked API key, or insufficient scope. */
399
+ declare class AuthError extends PrompteryxError {
400
+ constructor(message: string, opts?: ConstructorParameters<typeof PrompteryxError>[1]);
401
+ }
402
+ /** 402 — plan allowance exhausted (AI Credits, cloud minutes, etc.). */
403
+ declare class QuotaError extends PrompteryxError {
404
+ /** Which resources are exhausted, when known. */
405
+ readonly resources?: string[];
406
+ constructor(message: string, opts?: ConstructorParameters<typeof PrompteryxError>[1] & {
407
+ resources?: string[];
408
+ });
409
+ }
410
+ /** 404 — resource doesn't exist (workflow id, execution id, session id). */
411
+ declare class NotFoundError extends PrompteryxError {
412
+ constructor(message: string, opts?: ConstructorParameters<typeof PrompteryxError>[1]);
413
+ }
414
+ /** 422 — request body shape was wrong. */
415
+ declare class ValidationError extends PrompteryxError {
416
+ constructor(message: string, opts?: ConstructorParameters<typeof PrompteryxError>[1]);
417
+ }
418
+ /** 429 — rate-limited. Caller can retry after `retryAfterSeconds`. */
419
+ declare class RateLimitError extends PrompteryxError {
420
+ readonly retryAfterSeconds?: number;
421
+ constructor(message: string, opts?: ConstructorParameters<typeof PrompteryxError>[1] & {
422
+ retryAfterSeconds?: number;
423
+ });
424
+ }
425
+ /** 5xx — server-side failure. SDK retries these by default for idempotent ops. */
426
+ declare class ServerError extends PrompteryxError {
427
+ constructor(message: string, opts?: ConstructorParameters<typeof PrompteryxError>[1]);
428
+ }
429
+ /** Network / DNS / socket / aborted — never reached the server. */
430
+ declare class NetworkError extends PrompteryxError {
431
+ constructor(message: string, opts?: ConstructorParameters<typeof PrompteryxError>[1]);
432
+ }
433
+ /** Response body parse failure (server returned a non-JSON 500 page, etc.). */
434
+ declare class ParseError extends PrompteryxError {
435
+ constructor(message: string, opts?: ConstructorParameters<typeof PrompteryxError>[1]);
436
+ }
437
+ /** Timed-out waiting for a long-running op (execution polling, agent run). */
438
+ declare class TimeoutError extends PrompteryxError {
439
+ constructor(message: string, opts?: ConstructorParameters<typeof PrompteryxError>[1]);
440
+ }
441
+
442
+ /**
443
+ * @prompteryx/sdk
444
+ *
445
+ * Official TypeScript SDK for the Prompteryx platform.
446
+ *
447
+ * Two AI surfaces:
448
+ *
449
+ * • **Copilot** — helps with ONE step you describe in plain English.
450
+ * Your code drives Playwright; copilot just figures out the
451
+ * selector to click / the data to pull / what's on the page.
452
+ *
453
+ * ```ts
454
+ * await px.copilot.do(page, 'click the Sign up button')
455
+ * const product = await px.copilot.read(page, productSchema)
456
+ * const actions = await px.copilot.scan(page, 'checkout buttons')
457
+ * ```
458
+ *
459
+ * • **Autopilot** — runs an autonomous multi-step task end-to-end
460
+ * with no per-action involvement from you.
461
+ *
462
+ * ```ts
463
+ * const result = await px.autopilot.run({
464
+ * goal: 'Apply for the Senior Engineer role at OpenAI',
465
+ * saveAsWorkflow: true, // permanent zero-AI-cost replay
466
+ * })
467
+ * ```
468
+ *
469
+ * Plus workflows, executions, cloud browser sessions / fetch / search,
470
+ * schedules, profiles, and subscription telemetry.
471
+ *
472
+ * TWO KEY FAMILIES:
473
+ * • `apiKey` (`px_live_…`) — the platform API key; sent as
474
+ * `Authorization: Bearer`. 60 requests/minute, 10,000/day.
475
+ * • `cloudBrowserKey` (`pcb_live_…`) — the Cloud Browser key; required
476
+ * only for `px.cloudBrowser.*`, sent as `x-api-key`.
477
+ *
478
+ * Quick start:
479
+ *
480
+ * ```ts
481
+ * import { Prompteryx } from '@prompteryx/sdk'
482
+ * import { chromium } from 'playwright-core'
483
+ *
484
+ * const px = new Prompteryx({
485
+ * apiKey: process.env.PROMPTERYX_API_KEY!, // px_live_…
486
+ * cloudBrowserKey: process.env.PROMPTERYX_CLOUD_BROWSER_KEY, // pcb_live_…
487
+ * })
488
+ *
489
+ * // 1. Cloud browser session
490
+ * const session = await px.cloudBrowser.sessions.create({
491
+ * useProxy: true, proxyLocation: 'us',
492
+ * })
493
+ * const browser = await chromium.connectOverCDP(session.connectUrl)
494
+ * const page = browser.contexts()[0].pages()[0]
495
+ *
496
+ * // 2. Copilot on top of Playwright
497
+ * await page.goto('https://news.ycombinator.com')
498
+ * const top = await px.copilot.read(page, z.object({
499
+ * stories: z.array(z.object({ title: z.string(), url: z.string() })),
500
+ * }))
501
+ * ```
502
+ *
503
+ * See PROMPTERYX_SDK.md in docs/ for the full design + reference.
504
+ */
505
+
506
+ /**
507
+ * Copilot surface — bundles the three on-page primitives behind a
508
+ * single namespace so calling code reads as
509
+ * `px.copilot.do(...)` / `px.copilot.read(...)` / `px.copilot.scan(...)`.
510
+ * Used internally by the Prompteryx class.
511
+ */
512
+ declare class Copilot {
513
+ private readonly helpers;
514
+ constructor(helpers: CopilotHelpers);
515
+ /** Execute a natural-language action on a connected Playwright page. */
516
+ do(page: PageLike, instruction: string, opts?: {
517
+ timeout?: number;
518
+ }): Promise<CopilotDoResult>;
519
+ /** Pull typed data from the page (Zod schema or raw JSON Schema). */
520
+ read<T>(page: PageLike, schema: {
521
+ parse(input: unknown): T;
522
+ } | {
523
+ jsonSchema: unknown;
524
+ }): Promise<T>;
525
+ /** Discover available actions on the page; useful pre-`do` step. */
526
+ scan(page: PageLike, hint?: string): Promise<DiscoveredAction[]>;
527
+ }
528
+ declare class Prompteryx {
529
+ private readonly http;
530
+ readonly workflows: WorkflowsResource;
531
+ readonly executions: ExecutionsResource;
532
+ readonly cloudBrowser: CloudBrowserResource;
533
+ readonly autopilot: AutopilotResource;
534
+ readonly copilot: Copilot;
535
+ readonly schedules: SchedulesResource;
536
+ readonly profiles: ProfilesResource;
537
+ readonly subscription: SubscriptionResource;
538
+ constructor(opts: PrompteryxClientOptions);
539
+ }
540
+
541
+ export { AuthError, AutopilotRunOptions, AutopilotRunResult, AutopilotStep, CloudFetchOptions, CloudFetchResult, CloudSearchResult, CloudSession, CloudSessionSummary, CopilotDoResult, CreateScheduleOptions, CreateSessionOptions, DiscoveredAction, ExecutionLogEvent, ExecutionRecord, NetworkError, NotFoundError, PageLike, ParseError, ProfileSummary, Prompteryx, PrompteryxClientOptions, PrompteryxError, QuotaError, RateLimitError, RunWorkflowOptions, RunWorkflowResult, ScheduleSummary, ServerError, SubscriptionStatus, TimeoutError, ValidationError, WorkflowSummary, Prompteryx as default };