@parcha/agentrun 0.2.1 → 0.3.4

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/index.d.cts DELETED
@@ -1,682 +0,0 @@
1
- /** Validate batch inputs and parse CSV into questions plus row data. */
2
- declare const MAX_INPUTS = 100;
3
- declare const MAX_INPUT_CHARS = 8000;
4
- declare const MAX_CSV_BYTES = 1000000;
5
- /** A CSV source for a batch. One column holds the input for each row; the rest come back as `row_data`. */
6
- interface BatchCSV {
7
- csv: string | Blob;
8
- /** Header of the column that holds each row's input. Default `"input"`. */
9
- inputColumn?: string;
10
- }
11
- /** Parse CSV text without losing quoted commas, escaped quotes, or embedded newlines. */
12
- declare function parseBatchCSV(csv: string, inputColumn?: string): {
13
- inputs: string[];
14
- rows: Record<string, string>[];
15
- };
16
-
17
- /**
18
- * HTTP plumbing. An `Op` describes one API call without performing it; the
19
- * transport sends it and decodes the response into the record it names.
20
- * Nothing here retries, follows redirects, or logs the API key.
21
- */
22
- declare const DEFAULT_BASE_URL = "https://api.grep.ai/api/v2";
23
- declare const VERSION = "0.2.1";
24
- interface Op<T> {
25
- method: "GET" | "POST" | "PATCH" | "DELETE";
26
- path: string;
27
- parse: (body: Record<string, unknown>) => T;
28
- params?: Record<string, string | number | boolean | null | undefined>;
29
- json?: Record<string, unknown>;
30
- idempotencyKey?: string | undefined;
31
- raw?: boolean;
32
- }
33
- interface RequestOptions {
34
- signal?: AbortSignal | undefined;
35
- }
36
- interface ClientOptions {
37
- /** Your AgentRun API key. Defaults to `AGENTRUN_API_KEY` in Node. */
38
- apiKey?: string;
39
- /** API root. Defaults to `AGENTRUN_BASE_URL` or the production API. HTTPS only, except localhost. */
40
- baseURL?: string;
41
- /** Milliseconds to wait for one HTTP response. Default 30000. */
42
- timeoutMs?: number;
43
- /** A `fetch` implementation, used by tests to fake the server. */
44
- fetch?: typeof fetch;
45
- }
46
- interface Config {
47
- apiKey: string;
48
- baseURL: string;
49
- timeoutMs: number;
50
- fetch: typeof fetch;
51
- }
52
- declare class Transport {
53
- readonly config: Config;
54
- constructor(config: Config);
55
- url(op: Op<unknown>): string;
56
- send<T>(op: Op<T>, options?: RequestOptions): Promise<T>;
57
- }
58
-
59
- /**
60
- * Records returned by the API, and the mapping from the API's field and
61
- * status vocabulary to the SDK's.
62
- *
63
- * Every record keeps unknown fields, so a newer server never breaks an older
64
- * SDK. Fields the API names differently (`job_id`, `batch_id`, `schedule_id`,
65
- * `campaign_id`, `expert_id`) are exposed as `id` or `agent_id`.
66
- */
67
- type Effort = "low" | "medium" | "high" | "build";
68
- type BuildDepth = "standard" | "deep";
69
- type LoopFrequency = "daily" | "weekly" | "monthly";
70
- type RowStatus = "queued" | "running" | "completed" | "failed";
71
- type PortfolioStatus = "accepted" | "pending" | "failed" | "excluded";
72
- type RunStatus = "queued" | "moderation" | "running" | "blocked" | "completed" | "failed" | "cancelled";
73
- type BatchStatus = "queued" | "running" | "completed" | "completed_with_errors" | "failed" | "cancelled";
74
- declare const RUN_TERMINAL_STATUSES: ReadonlySet<string>;
75
- declare const BATCH_TERMINAL_STATUSES: ReadonlySet<string>;
76
- declare const CAMPAIGN_TERMINAL_STATUSES: ReadonlySet<string>;
77
- declare const RUN_STATUS_MAP: Readonly<Record<string, RunStatus>>;
78
- declare const BATCH_STATUS_MAP: Readonly<Record<string, BatchStatus>>;
79
- declare const ROW_STATUS_MAP: Readonly<Record<string, RowStatus>>;
80
- type Wire$1 = Record<string, unknown>;
81
- interface InputField {
82
- label: string;
83
- type?: "text" | "textarea" | "number" | "date" | "email" | "url" | "address" | "boolean" | "file" | "single_select" | "multi_select" | "dropdown";
84
- required?: boolean;
85
- options?: string[] | null;
86
- selection_mode?: "single" | "multiple" | null;
87
- }
88
- interface LoopCadence {
89
- frequency: LoopFrequency;
90
- schedule_config?: {
91
- hour?: number;
92
- minute?: number;
93
- day_of_week?: number | string;
94
- day_of_month?: number;
95
- } & Wire$1;
96
- timezone?: string;
97
- }
98
- interface AgentRecord {
99
- id: string;
100
- name: string;
101
- status: string;
102
- slug?: string | null;
103
- description?: string | null;
104
- domain?: string | null;
105
- is_public?: boolean;
106
- /** The agent's instructions, as passed to `new Agent({ instructions })`. Same value as `system_prompt`. */
107
- instructions: string | null;
108
- /** Skill names, as passed to `new Agent({ skills })`. Same value as `skill_names`. */
109
- skills: string[];
110
- /** Tool names, as passed to `new Agent({ tools })`. Same value as `mcp_tool_names`. */
111
- tools: string[];
112
- skill_names: string[];
113
- mcp_tool_names: string[];
114
- system_prompt?: string | null;
115
- input_form: Wire$1[];
116
- run_mode?: string | null;
117
- campaign_plan?: Wire$1 | null;
118
- output_schema?: Wire$1 | null;
119
- max_cost_usd?: number | null;
120
- created_at?: string | null;
121
- [key: string]: unknown;
122
- }
123
- interface AgentBuild {
124
- id: string;
125
- status: string;
126
- domain?: string | null;
127
- depth?: string | null;
128
- error?: string | null;
129
- /** The generated agent, present once `status === "succeeded"`. */
130
- agent?: Wire$1 | null;
131
- /** ID of the generated agent, or null until the build succeeds. */
132
- agent_id: string | null;
133
- created_at?: string | null;
134
- completed_at?: string | null;
135
- [key: string]: unknown;
136
- }
137
- interface Report {
138
- markdown: string;
139
- revision_sha?: string | null;
140
- widgets?: unknown[] | null;
141
- }
142
- interface Run {
143
- id: string;
144
- /** SDK vocabulary. See `RunStatus`. */
145
- status: RunStatus | string;
146
- /** The status exactly as the API reported it. */
147
- raw_status: string | null;
148
- slug?: string | null;
149
- question?: string | null;
150
- agent_id?: string | null;
151
- effort?: string | null;
152
- report?: Report | null;
153
- structured_output?: Wire$1 | null;
154
- error_kind?: string | null;
155
- error_message?: string | null;
156
- budget_exhausted?: boolean | null;
157
- created_at?: string | null;
158
- started_at?: string | null;
159
- completed_at?: string | null;
160
- [key: string]: unknown;
161
- }
162
- interface RunSummary {
163
- id: string;
164
- status: RunStatus | string;
165
- raw_status: string | null;
166
- question: string;
167
- slug?: string | null;
168
- effort?: string | null;
169
- created_at?: string | null;
170
- completed_at?: string | null;
171
- [key: string]: unknown;
172
- }
173
- interface CancelResult {
174
- id: string;
175
- status: RunStatus | string;
176
- raw_status: string | null;
177
- previous_status?: string | null;
178
- already_terminal?: boolean;
179
- [key: string]: unknown;
180
- }
181
- interface BatchRow {
182
- row_number: number;
183
- status: RowStatus | string;
184
- raw_status: string | null;
185
- question?: string | null;
186
- run_id?: string | null;
187
- run_status?: string | null;
188
- row_data?: Wire$1 | null;
189
- error_code?: string | null;
190
- error_message?: string | null;
191
- structured_output?: Wire$1 | null;
192
- [key: string]: unknown;
193
- }
194
- /** A row from `getBatchResults`. Inputs (`question`, `row_data`) are on `getBatch(id).rows`. */
195
- interface BatchResultRow {
196
- row_number: number;
197
- status: RowStatus | string;
198
- raw_status: string | null;
199
- run_id?: string | null;
200
- headline?: string | null;
201
- excerpt?: string | null;
202
- report_link?: string | null;
203
- is_public?: boolean;
204
- structured_output?: Wire$1 | null;
205
- error_code?: string | null;
206
- error_message?: string | null;
207
- [key: string]: unknown;
208
- }
209
- interface Batch {
210
- id: string;
211
- /** SDK vocabulary. See `BatchStatus`. */
212
- status: BatchStatus | string;
213
- raw_status: string | null;
214
- name?: string | null;
215
- total_rows?: number;
216
- processed_rows?: number | null;
217
- paused_reason?: string | null;
218
- loop_id?: string | null;
219
- run_number?: number | null;
220
- credits_spent?: number | null;
221
- rows: BatchRow[];
222
- created_at?: string | null;
223
- [key: string]: unknown;
224
- }
225
- interface BatchResults extends Batch {
226
- results: BatchResultRow[];
227
- }
228
- interface RetryResult extends Batch {
229
- retried_rows?: number | null;
230
- }
231
- interface Loop {
232
- id: string;
233
- name: string;
234
- frequency: string;
235
- schedule_config: Wire$1;
236
- timezone: string;
237
- is_active: boolean;
238
- run_count: number;
239
- consecutive_failures: number;
240
- next_run_at?: string | null;
241
- last_run_at?: string | null;
242
- last_skip_reason?: string | null;
243
- latest_batch_id?: string | null;
244
- deleted_at?: string | null;
245
- [key: string]: unknown;
246
- }
247
- interface LoopRun {
248
- id: string;
249
- status: BatchStatus | string;
250
- raw_status: string | null;
251
- total_rows: number;
252
- processed_rows: number;
253
- run_number?: number | null;
254
- created_at?: string | null;
255
- [key: string]: unknown;
256
- }
257
- interface LoopDetail {
258
- loop: Loop;
259
- runs: LoopRun[];
260
- }
261
- /** Returned by `Agent.loop`. The first batch has already started. */
262
- interface LoopCreated {
263
- id: string;
264
- first_batch_id: string;
265
- status: string;
266
- }
267
- interface LoopRunNow {
268
- batch_id: string;
269
- run_number: number;
270
- }
271
- interface SkillSummary {
272
- name: string;
273
- category?: string | null;
274
- description?: string | null;
275
- is_custom?: boolean;
276
- tags?: string[];
277
- suggested_tools?: string[];
278
- [key: string]: unknown;
279
- }
280
- interface SkillList {
281
- skills: SkillSummary[];
282
- count: number;
283
- total: number;
284
- categories: string[];
285
- }
286
- interface SkillContent {
287
- name: string;
288
- content: string;
289
- source?: string | null;
290
- is_custom?: boolean;
291
- }
292
- /** Returned when a skill is created. `created` is false when an existing skill was updated. */
293
- interface SkillRecord {
294
- id: string;
295
- name: string;
296
- created: boolean;
297
- }
298
- interface Integration {
299
- name: string;
300
- short_name?: string | null;
301
- server?: string | null;
302
- category?: string | null;
303
- description?: string | null;
304
- always_on?: boolean;
305
- is_default?: boolean;
306
- [key: string]: unknown;
307
- }
308
- interface IntegrationList {
309
- tools: Integration[];
310
- servers: string[];
311
- count: number;
312
- total: number;
313
- }
314
- interface Campaign {
315
- id: string;
316
- name?: string | null;
317
- status: string;
318
- objective?: string | null;
319
- revision?: number | null;
320
- review_digest?: string | null;
321
- agent_id?: string | null;
322
- stages: Wire$1[];
323
- deliverables: Wire$1[];
324
- capabilities: string[];
325
- [key: string]: unknown;
326
- }
327
- interface CampaignPortfolio {
328
- campaign_id: string;
329
- stage_key: string;
330
- status: string;
331
- items: Wire$1[];
332
- fields: Wire$1[];
333
- coverage: Wire$1;
334
- next_cursor: string | null;
335
- [key: string]: unknown;
336
- }
337
- /** A campaign deliverable. A `Blob` (so `arrayBuffer()`, `bytes()`, `text()`, and `type` work) plus the server's filename. */
338
- declare class Artifact extends Blob {
339
- readonly filename: string | null;
340
- constructor(bytes: Uint8Array, contentType: string | null, filename: string | null);
341
- }
342
- interface Usage {
343
- total_credits_used: number;
344
- total_cents_spent: number;
345
- job_count: number;
346
- period_start?: string | null;
347
- period_end?: string | null;
348
- by_effort: Wire$1;
349
- [key: string]: unknown;
350
- }
351
- /** One page of a cursor-paginated list. Pass `next_cursor` back to fetch the next page. */
352
- interface Page<T> {
353
- items: T[];
354
- next_cursor: string | null;
355
- has_more: boolean;
356
- }
357
-
358
- /**
359
- * Builders for every API call the SDK makes. Each returns an `Op` naming the
360
- * v2 path, the body in the API's vocabulary, and how to parse the response.
361
- * A field rename on the server is a one-line change here.
362
- */
363
-
364
- type Wire = Record<string, unknown>;
365
- /** A JSON schema, or an object with a `toJSONSchema()` method, or a Standard JSON Schema `~standard` object. */
366
- type SchemaLike = Wire | {
367
- toJSONSchema(): Wire;
368
- };
369
- interface AgentDefinition {
370
- name: string;
371
- instructions: string;
372
- skills?: string[] | undefined;
373
- tools?: string[] | undefined;
374
- description?: string | undefined;
375
- run_mode?: "job" | "campaign" | undefined;
376
- campaign_plan?: Wire | null | undefined;
377
- input_form?: Wire[] | undefined;
378
- outputSchema?: SchemaLike | undefined;
379
- }
380
- interface RunOptions {
381
- effort?: Effort | undefined;
382
- maxCostUsd?: number | undefined;
383
- responseLanguage?: string | undefined;
384
- outputSchema?: SchemaLike | undefined;
385
- webhookUrl?: string | undefined;
386
- idempotencyKey?: string | undefined;
387
- }
388
- interface BatchOptions {
389
- name?: string | undefined;
390
- formInputs?: (Wire | null)[] | undefined;
391
- effort?: Effort | undefined;
392
- responseLanguage?: string | undefined;
393
- maxConcurrent?: number | undefined;
394
- maxCredits?: number | undefined;
395
- outputSchema?: SchemaLike | undefined;
396
- idempotencyKey?: string | undefined;
397
- }
398
- interface PortfolioFilter {
399
- cursor?: string | undefined;
400
- limit?: number | undefined;
401
- status?: PortfolioStatus | undefined;
402
- search?: string | undefined;
403
- entity_key?: string | undefined;
404
- filter_field?: string | undefined;
405
- filter_value?: string | undefined;
406
- }
407
-
408
- /** Bounded polling. A local deadline throws `PollTimeoutError` and never cancels remote work. */
409
- interface WaitOptions {
410
- signal?: AbortSignal | undefined;
411
- /** Give up after this many milliseconds. The remote work continues. */
412
- timeoutMs?: number | undefined;
413
- /** Milliseconds between polls. */
414
- intervalMs?: number | undefined;
415
- }
416
-
417
- /**
418
- * `AgentRun`: direct access to every API resource by ID.
419
- * Use `Agent` when you want one agent object that creates itself on first use.
420
- */
421
-
422
- declare class AgentRun {
423
- readonly http: Transport;
424
- constructor(options?: ClientOptions);
425
- /** The resolved base URL. */
426
- get baseURL(): string;
427
- listAgents(o?: RequestOptions & {
428
- includePublic?: boolean;
429
- }): Promise<AgentRecord[]>;
430
- getAgent(agentId: string, o?: RequestOptions): Promise<AgentRecord>;
431
- /** Save an agent definition. Not retried: a timed-out call may still have created it. */
432
- createAgent(definition: AgentDefinition, o?: RequestOptions): Promise<AgentRecord>;
433
- /** Change fields on an agent. Accepts `instructions`, `skills`, `tools`, `outputSchema` and any API field. */
434
- updateAgent(agentId: string, changes: Record<string, unknown>, o?: RequestOptions): Promise<AgentRecord>;
435
- deleteAgent(agentId: string, o?: RequestOptions): Promise<void>;
436
- getBuild(buildId: string, o?: RequestOptions): Promise<AgentBuild>;
437
- /** Poll a build until it succeeds or fails. Does not activate the agent; `Agent` does that. */
438
- waitBuild(buildId: string, o?: WaitOptions): Promise<AgentBuild>;
439
- /** Start a run and return at once. Pass the same `idempotencyKey` to retry safely. */
440
- run(question: string, o?: RunOptions & RequestOptions & {
441
- agentId?: string;
442
- }): Promise<Run>;
443
- getRun(runId: string, o?: RequestOptions): Promise<Run>;
444
- cancelRun(runId: string, o?: RequestOptions): Promise<CancelResult>;
445
- /** Poll until the run is completed, failed, cancelled, or blocked. Check `run.status`. */
446
- waitRun(runId: string, o?: WaitOptions): Promise<Run>;
447
- listRuns(o?: RequestOptions & {
448
- cursor?: string;
449
- limit?: number;
450
- }): Promise<Page<RunSummary>>;
451
- /** Walk every run, newest first, fetching pages as needed. */
452
- iterRuns(o?: RequestOptions & {
453
- pageSize?: number;
454
- }): AsyncGenerator<RunSummary>;
455
- /** Fetch a batch. Pass `includeRows: false` to skip per-row data on large batches. */
456
- getBatch(batchId: string, o?: RequestOptions & {
457
- includeRows?: boolean;
458
- }): Promise<Batch>;
459
- listBatches(o?: RequestOptions & {
460
- cursor?: string;
461
- limit?: number;
462
- status?: string;
463
- query?: string;
464
- }): Promise<Page<Batch>>;
465
- getBatchResults(batchId: string, o?: RequestOptions & {
466
- rowStatus?: RowStatus;
467
- }): Promise<BatchResults>;
468
- /** Stop dispatching new rows. Rows already running finish on their own. */
469
- cancelBatch(batchId: string, o?: RequestOptions): Promise<Batch>;
470
- /** Retry every failed row, or one row. Retries spend credits. */
471
- retryBatch(batchId: string, o?: RequestOptions & {
472
- rowNumber?: number;
473
- }): Promise<RetryResult>;
474
- /** Poll until the batch finishes, fails, is cancelled, or pauses for attention. */
475
- waitBatch(batchId: string, o?: WaitOptions): Promise<Batch>;
476
- getLoop(loopId: string, o?: RequestOptions): Promise<LoopDetail>;
477
- /** Rename a loop or change its cadence. Inputs are frozen at creation. */
478
- updateLoop(loopId: string, changes: Partial<LoopCadence> & {
479
- name?: string;
480
- }, o?: RequestOptions): Promise<Loop>;
481
- pauseLoop(loopId: string, o?: RequestOptions): Promise<Loop>;
482
- resumeLoop(loopId: string, o?: RequestOptions): Promise<Loop>;
483
- /** Start an extra batch without shifting the schedule. Conflicts if one is already running. */
484
- runLoopNow(loopId: string, o?: RequestOptions): Promise<LoopRunNow>;
485
- deleteLoop(loopId: string, o?: RequestOptions & {
486
- cancelActive?: boolean;
487
- }): Promise<Loop>;
488
- listSkills(o?: RequestOptions & {
489
- query?: string;
490
- category?: string;
491
- limit?: number;
492
- }): Promise<SkillList>;
493
- getSkill(name: string, o?: RequestOptions): Promise<SkillContent>;
494
- /** Save reusable Markdown. Reusing a name updates your existing skill (`created: false`). */
495
- createSkill(d: {
496
- name: string;
497
- description: string;
498
- content: string;
499
- }, o?: RequestOptions): Promise<SkillRecord>;
500
- listIntegrations(o?: RequestOptions & {
501
- query?: string;
502
- server?: string;
503
- category?: string;
504
- limit?: number;
505
- }): Promise<IntegrationList>;
506
- /** Save a campaign as a draft. Review it, then `approveCampaign` to start work. */
507
- createCampaign(plan: Record<string, unknown>, o?: RequestOptions & {
508
- records?: Record<string, unknown>[];
509
- idempotencyKey?: string;
510
- }): Promise<Campaign>;
511
- getCampaign(campaignId: string, o?: RequestOptions): Promise<Campaign>;
512
- listCampaigns(o?: RequestOptions & {
513
- cursor?: string;
514
- limit?: number;
515
- }): Promise<Page<Campaign>>;
516
- /** Start a draft. `reviewDigest` must match the plan you reviewed or the API returns 409. */
517
- approveCampaign(campaignId: string, reviewDigest: string, o?: RequestOptions): Promise<Campaign>;
518
- cancelCampaign(campaignId: string, o?: RequestOptions): Promise<Campaign>;
519
- /** Poll until the campaign is a draft, done, cancelled, failed, or needs attention. */
520
- waitCampaign(campaignId: string, o?: WaitOptions): Promise<Campaign>;
521
- getCampaignPortfolio(campaignId: string, stageKey: string, o?: RequestOptions & PortfolioFilter): Promise<CampaignPortfolio>;
522
- /** Fetch a finished deliverable. `artifact.content` holds the raw bytes. */
523
- downloadCampaignArtifact(campaignId: string, deliverableKey: string, o?: RequestOptions): Promise<Artifact>;
524
- getUsage(o?: RequestOptions & {
525
- period?: string;
526
- from?: string;
527
- to?: string;
528
- }): Promise<Usage>;
529
- }
530
-
531
- /**
532
- * `Agent`: one object that defines an agent and runs work with it.
533
- *
534
- * An agent comes from one of three places: an existing `id`, a `buildId`
535
- * from `Agent.create(prompt)`, or a `name` and `instructions` saved on first
536
- * use. Every method that needs the agent waits for it first, so
537
- * `agent.run(...)` is the only call most programs make.
538
- */
539
-
540
- interface AgentOptions extends ClientOptions, Partial<AgentDefinition> {
541
- /** Reuse a saved agent. */
542
- id?: string;
543
- /** Resume a build started by `Agent.create`. */
544
- buildId?: string;
545
- }
546
- /** A defined, built, or reused agent. Extends `AgentRun`, so every client method is available too. */
547
- declare class Agent extends AgentRun {
548
- #private;
549
- constructor(options: AgentOptions);
550
- /**
551
- * Start building an agent from a plain-English description. Returns at once.
552
- * Save `agent.buildId` if the process might stop, then resume with
553
- * `new Agent({ buildId })`. Building can take several minutes.
554
- */
555
- static create(prompt: string, options?: ClientOptions & {
556
- context?: string;
557
- depth?: BuildDepth;
558
- signal?: AbortSignal;
559
- }): Promise<Agent>;
560
- /** The agent ID, or undefined until the agent has been saved or built. */
561
- get id(): string | undefined;
562
- get buildId(): string | undefined;
563
- /**
564
- * Wait for a build to finish and activate the agent, or save a defined agent.
565
- * Throws `BuildError` if the build failed and `PollTimeoutError` at the local
566
- * deadline. A timeout does not stop the build.
567
- */
568
- waitUntilReady(o?: WaitOptions): Promise<this>;
569
- /** Save a defined agent without running it and return its ID. */
570
- save(o?: RequestOptions): Promise<string>;
571
- private ensureId;
572
- /** Start one run. Returns the queued run; call `wait` for the result. */
573
- run(question: string, o?: RunOptions & RequestOptions): Promise<Run>;
574
- /** Poll a run until it is completed, failed, cancelled, or blocked. */
575
- wait(runId: string, o?: WaitOptions): Promise<Run>;
576
- /** Run up to 100 inputs as one batch. Oversized batches are rejected before anything is sent. */
577
- batch(inputs: string[] | BatchCSV, o?: BatchOptions & RequestOptions): Promise<Batch>;
578
- /** Run the inputs now and again on a schedule. `maxCredits` caps each occurrence, not the total. */
579
- loop(inputs: string | string[] | BatchCSV, cadence: LoopCadence, o?: BatchOptions & RequestOptions): Promise<LoopCreated>;
580
- /** Start this agent's configured campaign template with form inputs. Work begins immediately. */
581
- campaign(inputs: Record<string, unknown>, o?: RequestOptions & {
582
- records?: Record<string, unknown>[];
583
- idempotencyKey?: string;
584
- }): Promise<Campaign>;
585
- }
586
- /** Shortcuts for reusable Markdown skills. Attach `record.name` to an agent's `skills`. */
587
- declare const Skill: {
588
- create(d: ClientOptions & {
589
- name: string;
590
- description: string;
591
- content: string;
592
- signal?: AbortSignal;
593
- }): Promise<SkillRecord>;
594
- read(name: string, options?: ClientOptions & {
595
- signal?: AbortSignal;
596
- }): Promise<SkillContent>;
597
- };
598
-
599
- /**
600
- * Errors thrown by the AgentRun SDK.
601
- *
602
- * Every SDK error extends `AgentRunError`. Catch that when you do not care
603
- * why a call failed, or a subclass when you do.
604
- */
605
- declare class AgentRunError extends Error {
606
- name: string;
607
- }
608
- /** The request never produced an HTTP response (DNS, TLS, or socket failure). */
609
- declare class APIConnectionError extends AgentRunError {
610
- name: string;
611
- }
612
- /** A single HTTP request exceeded the client's `timeoutMs`. */
613
- declare class APITimeoutError extends APIConnectionError {
614
- name: string;
615
- }
616
- /** The API answered with an error status. */
617
- declare class APIError extends AgentRunError {
618
- name: string;
619
- /** The HTTP status code. */
620
- readonly statusCode: number;
621
- /** The decoded JSON body, or the raw text when it was not JSON. */
622
- readonly body: unknown;
623
- /** The server's request ID when present. Include it when reporting a problem. */
624
- readonly requestId: string | null;
625
- constructor(message: string, statusCode: number, body: unknown, requestId: string | null);
626
- }
627
- /** 401. The API key is missing, malformed, or revoked. */
628
- declare class AuthenticationError extends APIError {
629
- name: string;
630
- }
631
- /** 403. The key is valid but lacks the scope or ownership this call needs. */
632
- declare class PermissionDeniedError extends APIError {
633
- name: string;
634
- }
635
- /** 404. */
636
- declare class NotFoundError extends APIError {
637
- name: string;
638
- }
639
- /** 409. The request conflicts with current state, for example a stale review digest. */
640
- declare class ConflictError extends APIError {
641
- name: string;
642
- }
643
- /** 422. The server rejected the body. `body.detail` lists the fields. */
644
- declare class UnprocessableEntityError extends APIError {
645
- name: string;
646
- }
647
- /** 429. Slow down and retry later. The SDK never retries for you. */
648
- declare class RateLimitError extends APIError {
649
- name: string;
650
- }
651
- /** 503. The service is down, or this feature is not enabled for your account. */
652
- declare class ServiceUnavailableError extends APIError {
653
- name: string;
654
- }
655
- /** Any other 5xx. */
656
- declare class InternalServerError extends APIError {
657
- name: string;
658
- }
659
- /** A 2xx response whose body is not what the SDK expects. Usually a wrong `baseURL`. */
660
- declare class InvalidResponseError extends AgentRunError {
661
- name: string;
662
- }
663
- /** An agent build finished with `status: "failed"`. Read `build.error` for the reason. */
664
- declare class BuildError extends AgentRunError {
665
- readonly build: {
666
- id: string;
667
- status: string;
668
- error?: string | null;
669
- };
670
- name: string;
671
- constructor(build: {
672
- id: string;
673
- status: string;
674
- error?: string | null;
675
- });
676
- }
677
- /** A `wait*` call reached its local deadline. The remote work was not cancelled. */
678
- declare class PollTimeoutError extends AgentRunError {
679
- name: string;
680
- }
681
-
682
- export { APIConnectionError, APIError, APITimeoutError, Agent, type AgentBuild, type AgentDefinition, type AgentOptions, type AgentRecord, AgentRun, AgentRunError, Artifact, AuthenticationError, BATCH_STATUS_MAP, BATCH_TERMINAL_STATUSES, type Batch, type BatchCSV, type BatchOptions, type BatchResultRow, type BatchResults, type BatchRow, type BatchStatus, type BuildDepth, BuildError, CAMPAIGN_TERMINAL_STATUSES, type Campaign, type CampaignPortfolio, type CancelResult, type ClientOptions, ConflictError, DEFAULT_BASE_URL, type Effort, type InputField, type Integration, type IntegrationList, InternalServerError, InvalidResponseError, type Loop, type LoopCadence, type LoopCreated, type LoopDetail, type LoopFrequency, type LoopRun, type LoopRunNow, MAX_CSV_BYTES, MAX_INPUTS, MAX_INPUT_CHARS, NotFoundError, type Page, PermissionDeniedError, PollTimeoutError, type PortfolioFilter, type PortfolioStatus, ROW_STATUS_MAP, RUN_STATUS_MAP, RUN_TERMINAL_STATUSES, RateLimitError, type Report, type RequestOptions, type RetryResult, type RowStatus, type Run, type RunOptions, type RunStatus, type RunSummary, type SchemaLike, ServiceUnavailableError, Skill, type SkillContent, type SkillList, type SkillRecord, type SkillSummary, UnprocessableEntityError, type Usage, VERSION, type WaitOptions, parseBatchCSV };