@parcha/agentrun 0.1.0 → 0.2.1
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/CHANGELOG.md +27 -0
- package/README.md +141 -113
- package/dist/index.cjs +1182 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +682 -0
- package/dist/index.d.ts +682 -0
- package/dist/index.js +1150 -0
- package/dist/index.js.map +1 -0
- package/package.json +46 -6
- package/dist/agent.d.ts +0 -434
- package/dist/agent.js +0 -653
package/dist/agent.d.ts
DELETED
|
@@ -1,434 +0,0 @@
|
|
|
1
|
-
export interface ClientOptions {
|
|
2
|
-
apiKey: string;
|
|
3
|
-
baseURL?: string;
|
|
4
|
-
timeoutMs?: number;
|
|
5
|
-
}
|
|
6
|
-
export interface AgentInputField {
|
|
7
|
-
label: string;
|
|
8
|
-
type?: "text" | "textarea" | "number" | "date" | "email" | "url" | "address" | "boolean" | "file" | "single_select" | "multi_select";
|
|
9
|
-
required?: boolean;
|
|
10
|
-
options?: string[];
|
|
11
|
-
}
|
|
12
|
-
export interface AgentDefinition {
|
|
13
|
-
run_mode?: "job" | "campaign";
|
|
14
|
-
campaign_plan?: Record<string, unknown> | null;
|
|
15
|
-
input_form?: AgentInputField[];
|
|
16
|
-
buildId?: string;
|
|
17
|
-
id?: string;
|
|
18
|
-
name?: string;
|
|
19
|
-
instructions?: string;
|
|
20
|
-
skills?: string[];
|
|
21
|
-
tools?: string[];
|
|
22
|
-
}
|
|
23
|
-
export interface AgentOptions extends ClientOptions, AgentDefinition {
|
|
24
|
-
}
|
|
25
|
-
export interface AgentRecord {
|
|
26
|
-
run_mode?: "job" | "campaign";
|
|
27
|
-
campaign_plan?: Record<string, unknown> | null;
|
|
28
|
-
input_form?: AgentInputField[];
|
|
29
|
-
id: string;
|
|
30
|
-
name: string;
|
|
31
|
-
status: string;
|
|
32
|
-
instructions?: string | null;
|
|
33
|
-
skills: string[];
|
|
34
|
-
tools?: string[];
|
|
35
|
-
[key: string]: unknown;
|
|
36
|
-
}
|
|
37
|
-
export interface AgentBuild {
|
|
38
|
-
id: string;
|
|
39
|
-
status: "queued" | "running" | "registering" | "succeeded" | "failed";
|
|
40
|
-
agent?: {
|
|
41
|
-
agent_id?: string | null;
|
|
42
|
-
status?: string | null;
|
|
43
|
-
} | null;
|
|
44
|
-
error?: string | null;
|
|
45
|
-
}
|
|
46
|
-
export interface WaitOptions {
|
|
47
|
-
signal?: AbortSignal;
|
|
48
|
-
timeoutMs?: number;
|
|
49
|
-
intervalMs?: number;
|
|
50
|
-
}
|
|
51
|
-
export declare class AgentBuildError extends Error {
|
|
52
|
-
readonly build: AgentBuild;
|
|
53
|
-
constructor(build: AgentBuild);
|
|
54
|
-
}
|
|
55
|
-
export interface Run {
|
|
56
|
-
id: string;
|
|
57
|
-
status: string;
|
|
58
|
-
report?: {
|
|
59
|
-
markdown: string;
|
|
60
|
-
revision_sha?: string | null;
|
|
61
|
-
widgets?: unknown[] | null;
|
|
62
|
-
} | null;
|
|
63
|
-
structured_output?: Record<string, unknown> | null;
|
|
64
|
-
error_kind?: string | null;
|
|
65
|
-
[key: string]: unknown;
|
|
66
|
-
}
|
|
67
|
-
export interface Campaign {
|
|
68
|
-
id: string;
|
|
69
|
-
name: string;
|
|
70
|
-
status: string;
|
|
71
|
-
revision: number;
|
|
72
|
-
objective: string;
|
|
73
|
-
review_digest: string;
|
|
74
|
-
agent_id?: string | null;
|
|
75
|
-
agent_name?: string | null;
|
|
76
|
-
stages: Record<string, unknown>[];
|
|
77
|
-
deliverables: Record<string, unknown>[];
|
|
78
|
-
artifacts?: {
|
|
79
|
-
deliverable_key: string;
|
|
80
|
-
filename: string;
|
|
81
|
-
media_type: string;
|
|
82
|
-
byte_size: number;
|
|
83
|
-
sha256: string;
|
|
84
|
-
}[];
|
|
85
|
-
}
|
|
86
|
-
export interface CampaignPortfolio {
|
|
87
|
-
id: string;
|
|
88
|
-
revision: number;
|
|
89
|
-
status: string;
|
|
90
|
-
stage_key: string;
|
|
91
|
-
output_schema?: Record<string, unknown> | null;
|
|
92
|
-
fields: Record<string, unknown>[];
|
|
93
|
-
entity_key_field?: string | null;
|
|
94
|
-
coverage: {
|
|
95
|
-
entity_count: number;
|
|
96
|
-
accepted: number;
|
|
97
|
-
pending: number;
|
|
98
|
-
failed: number;
|
|
99
|
-
excluded_count: number;
|
|
100
|
-
scope_complete: boolean;
|
|
101
|
-
};
|
|
102
|
-
items: {
|
|
103
|
-
entity_key: string;
|
|
104
|
-
stage_key: string;
|
|
105
|
-
status: "accepted" | "pending" | "failed" | "excluded";
|
|
106
|
-
content?: Record<string, unknown> | null;
|
|
107
|
-
run_id?: string | null;
|
|
108
|
-
batch_id?: string | null;
|
|
109
|
-
run_path?: string | null;
|
|
110
|
-
row_number?: number | null;
|
|
111
|
-
rejection_reason?: string | null;
|
|
112
|
-
result_id?: string | null;
|
|
113
|
-
retry_eligible?: boolean;
|
|
114
|
-
}[];
|
|
115
|
-
next_cursor: string | null;
|
|
116
|
-
}
|
|
117
|
-
export interface CampaignOptions {
|
|
118
|
-
signal?: AbortSignal;
|
|
119
|
-
idempotencyKey?: string;
|
|
120
|
-
}
|
|
121
|
-
export interface LoopCadence {
|
|
122
|
-
frequency: "daily" | "weekly" | "monthly";
|
|
123
|
-
schedule_config: {
|
|
124
|
-
hour: number;
|
|
125
|
-
minute: number;
|
|
126
|
-
day_of_week?: number | string;
|
|
127
|
-
day_of_month?: number;
|
|
128
|
-
};
|
|
129
|
-
timezone?: string;
|
|
130
|
-
}
|
|
131
|
-
export interface Loop extends LoopCadence {
|
|
132
|
-
id: string;
|
|
133
|
-
name: string;
|
|
134
|
-
is_active: boolean;
|
|
135
|
-
deleted_at?: string | null;
|
|
136
|
-
next_run_at?: string | null;
|
|
137
|
-
last_run_at?: string | null;
|
|
138
|
-
run_count: number;
|
|
139
|
-
consecutive_failures: number;
|
|
140
|
-
latest_batch_id?: string | null;
|
|
141
|
-
last_skip_reason?: string | null;
|
|
142
|
-
}
|
|
143
|
-
export interface LoopCreated {
|
|
144
|
-
id: string;
|
|
145
|
-
first_batch_id: string;
|
|
146
|
-
status: string;
|
|
147
|
-
}
|
|
148
|
-
export interface Batch {
|
|
149
|
-
loop_id?: string | null;
|
|
150
|
-
loop?: Loop | null;
|
|
151
|
-
id: string;
|
|
152
|
-
status: string;
|
|
153
|
-
total_rows: number;
|
|
154
|
-
processed_rows?: number;
|
|
155
|
-
paused_reason?: string | null;
|
|
156
|
-
rows?: BatchRow[];
|
|
157
|
-
credits_spent?: number;
|
|
158
|
-
[key: string]: unknown;
|
|
159
|
-
}
|
|
160
|
-
export interface BatchRow {
|
|
161
|
-
row_number: number;
|
|
162
|
-
status: string;
|
|
163
|
-
input?: string;
|
|
164
|
-
run_id?: string | null;
|
|
165
|
-
error_code?: string | null;
|
|
166
|
-
structured_output?: Record<string, unknown> | null;
|
|
167
|
-
[key: string]: unknown;
|
|
168
|
-
}
|
|
169
|
-
export interface BatchOptions {
|
|
170
|
-
name?: string;
|
|
171
|
-
signal?: AbortSignal;
|
|
172
|
-
idempotencyKey?: string;
|
|
173
|
-
effort?: "low" | "medium" | "high" | "build";
|
|
174
|
-
responseLanguage?: string;
|
|
175
|
-
maxConcurrent?: number;
|
|
176
|
-
maxCredits?: number;
|
|
177
|
-
outputSchema?: Record<string, unknown>;
|
|
178
|
-
}
|
|
179
|
-
/** Parse CSV cells without losing quoted commas, escaped quotes, or embedded newlines. */
|
|
180
|
-
export declare function parseBatchCSV(csv: string, inputColumn: string): {
|
|
181
|
-
inputs: string[];
|
|
182
|
-
rows: Record<string, string>[];
|
|
183
|
-
};
|
|
184
|
-
export interface Skill {
|
|
185
|
-
name: string;
|
|
186
|
-
category: string;
|
|
187
|
-
description?: string | null;
|
|
188
|
-
suggested_tools: string[];
|
|
189
|
-
tags: string[];
|
|
190
|
-
is_custom: boolean;
|
|
191
|
-
}
|
|
192
|
-
export interface SkillDefinition {
|
|
193
|
-
name: string;
|
|
194
|
-
description: string;
|
|
195
|
-
content: string;
|
|
196
|
-
}
|
|
197
|
-
export interface SkillRecord {
|
|
198
|
-
name: string;
|
|
199
|
-
skill_id: string;
|
|
200
|
-
created: boolean;
|
|
201
|
-
}
|
|
202
|
-
export interface SkillContent {
|
|
203
|
-
name: string;
|
|
204
|
-
content: string;
|
|
205
|
-
is_custom: boolean;
|
|
206
|
-
source: "catalog" | "custom";
|
|
207
|
-
}
|
|
208
|
-
/** Create or update a reusable skill in the caller's library. */
|
|
209
|
-
export declare const Skill: {
|
|
210
|
-
create(options: ClientOptions & SkillDefinition & {
|
|
211
|
-
signal?: AbortSignal;
|
|
212
|
-
}): Promise<SkillRecord>;
|
|
213
|
-
};
|
|
214
|
-
export interface Integration {
|
|
215
|
-
name: string;
|
|
216
|
-
short_name: string;
|
|
217
|
-
server: string;
|
|
218
|
-
category: string;
|
|
219
|
-
description?: string | null;
|
|
220
|
-
is_default: boolean;
|
|
221
|
-
always_on: boolean;
|
|
222
|
-
}
|
|
223
|
-
export interface CatalogFilter {
|
|
224
|
-
query?: string;
|
|
225
|
-
category?: string;
|
|
226
|
-
limit?: number;
|
|
227
|
-
}
|
|
228
|
-
export declare class AgentAPIError extends Error {
|
|
229
|
-
readonly status: number;
|
|
230
|
-
constructor(status: number, message: string);
|
|
231
|
-
}
|
|
232
|
-
/** Headless agentrun client. Credentials belong in server-side code. */
|
|
233
|
-
export declare class AgentRun {
|
|
234
|
-
private readonly baseURL;
|
|
235
|
-
protected readonly options: ClientOptions;
|
|
236
|
-
constructor(options: ClientOptions);
|
|
237
|
-
protected response(path: string, init?: RequestInit): Promise<Response>;
|
|
238
|
-
protected request<T>(path: string, init?: RequestInit): Promise<T>;
|
|
239
|
-
agent(definition: AgentDefinition): Agent;
|
|
240
|
-
private query;
|
|
241
|
-
listAgents(options?: {
|
|
242
|
-
signal?: AbortSignal;
|
|
243
|
-
}): Promise<{
|
|
244
|
-
agents: AgentRecord[];
|
|
245
|
-
count: number;
|
|
246
|
-
}>;
|
|
247
|
-
getBuild(id: string, options?: {
|
|
248
|
-
signal?: AbortSignal;
|
|
249
|
-
}): Promise<AgentBuild>;
|
|
250
|
-
getAgent(id: string): Promise<AgentRecord>;
|
|
251
|
-
updateAgent(id: string, definition: Omit<AgentDefinition, "id">): Promise<AgentRecord>;
|
|
252
|
-
deleteAgent(id: string): Promise<{
|
|
253
|
-
success: boolean;
|
|
254
|
-
agent_id: string;
|
|
255
|
-
status: string;
|
|
256
|
-
}>;
|
|
257
|
-
createSkill(definition: SkillDefinition, options?: {
|
|
258
|
-
signal?: AbortSignal;
|
|
259
|
-
}): Promise<SkillRecord>;
|
|
260
|
-
getSkill(name: string, options?: {
|
|
261
|
-
signal?: AbortSignal;
|
|
262
|
-
}): Promise<SkillContent>;
|
|
263
|
-
listSkills(filter?: CatalogFilter, options?: {
|
|
264
|
-
signal?: AbortSignal;
|
|
265
|
-
}): Promise<{
|
|
266
|
-
skills: Skill[];
|
|
267
|
-
categories: string[];
|
|
268
|
-
count: number;
|
|
269
|
-
total: number;
|
|
270
|
-
}>;
|
|
271
|
-
listIntegrations(filter?: CatalogFilter & {
|
|
272
|
-
server?: string;
|
|
273
|
-
}, options?: {
|
|
274
|
-
signal?: AbortSignal;
|
|
275
|
-
}): Promise<{
|
|
276
|
-
tools: Integration[];
|
|
277
|
-
servers: string[];
|
|
278
|
-
count: number;
|
|
279
|
-
total: number;
|
|
280
|
-
}>;
|
|
281
|
-
listRuns(filter?: {
|
|
282
|
-
cursor?: string;
|
|
283
|
-
limit?: number;
|
|
284
|
-
}, options?: {
|
|
285
|
-
signal?: AbortSignal;
|
|
286
|
-
}): Promise<{
|
|
287
|
-
items: Run[];
|
|
288
|
-
next_cursor: string | null;
|
|
289
|
-
}>;
|
|
290
|
-
createCampaign(plan: Record<string, unknown>, options?: CampaignOptions & {
|
|
291
|
-
records?: Record<string, unknown>[];
|
|
292
|
-
}): Promise<Campaign>;
|
|
293
|
-
listCampaigns(filter?: {
|
|
294
|
-
cursor?: string;
|
|
295
|
-
limit?: number;
|
|
296
|
-
}, options?: {
|
|
297
|
-
signal?: AbortSignal;
|
|
298
|
-
}): Promise<{
|
|
299
|
-
items: Campaign[];
|
|
300
|
-
next_cursor: string | null;
|
|
301
|
-
}>;
|
|
302
|
-
getCampaign(id: string, options?: {
|
|
303
|
-
signal?: AbortSignal;
|
|
304
|
-
}): Promise<Campaign>;
|
|
305
|
-
getCampaignPortfolio(id: string, stageKey: string, filter?: {
|
|
306
|
-
cursor?: string;
|
|
307
|
-
limit?: number;
|
|
308
|
-
entity_key?: string;
|
|
309
|
-
status?: "accepted" | "pending" | "failed" | "excluded";
|
|
310
|
-
search?: string;
|
|
311
|
-
filter_field?: string;
|
|
312
|
-
filter_value?: string;
|
|
313
|
-
}, options?: {
|
|
314
|
-
signal?: AbortSignal;
|
|
315
|
-
}): Promise<CampaignPortfolio>;
|
|
316
|
-
waitCampaign(id: string, options?: WaitOptions): Promise<Campaign>;
|
|
317
|
-
approveCampaign(id: string, reviewDigest: string, options?: {
|
|
318
|
-
signal?: AbortSignal;
|
|
319
|
-
}): Promise<Campaign>;
|
|
320
|
-
cancelCampaign(id: string, options?: {
|
|
321
|
-
signal?: AbortSignal;
|
|
322
|
-
}): Promise<Campaign>;
|
|
323
|
-
downloadCampaignArtifact(id: string, deliverableKey: string, options?: {
|
|
324
|
-
signal?: AbortSignal;
|
|
325
|
-
}): Promise<Blob>;
|
|
326
|
-
getLoop(id: string, options?: {
|
|
327
|
-
signal?: AbortSignal;
|
|
328
|
-
}): Promise<{
|
|
329
|
-
loop: Loop;
|
|
330
|
-
runs: Batch[];
|
|
331
|
-
}>;
|
|
332
|
-
updateLoop(id: string, changes: Partial<LoopCadence> & {
|
|
333
|
-
name?: string;
|
|
334
|
-
}, options?: {
|
|
335
|
-
signal?: AbortSignal;
|
|
336
|
-
}): Promise<Loop>;
|
|
337
|
-
pauseLoop(id: string, options?: {
|
|
338
|
-
signal?: AbortSignal;
|
|
339
|
-
}): Promise<Loop>;
|
|
340
|
-
resumeLoop(id: string, options?: {
|
|
341
|
-
signal?: AbortSignal;
|
|
342
|
-
}): Promise<Loop>;
|
|
343
|
-
runLoopNow(id: string, options?: {
|
|
344
|
-
signal?: AbortSignal;
|
|
345
|
-
}): Promise<{
|
|
346
|
-
batch_id: string;
|
|
347
|
-
run_number: number;
|
|
348
|
-
}>;
|
|
349
|
-
private loopAction;
|
|
350
|
-
deleteLoop(id: string, options?: {
|
|
351
|
-
cancelActive?: boolean;
|
|
352
|
-
signal?: AbortSignal;
|
|
353
|
-
}): Promise<Loop>;
|
|
354
|
-
listBatches(filter?: {
|
|
355
|
-
cursor?: string;
|
|
356
|
-
limit?: number;
|
|
357
|
-
status?: string;
|
|
358
|
-
}, options?: {
|
|
359
|
-
signal?: AbortSignal;
|
|
360
|
-
}): Promise<{
|
|
361
|
-
items: Batch[];
|
|
362
|
-
next_cursor: string | null;
|
|
363
|
-
}>;
|
|
364
|
-
getBatch(id: string, options?: {
|
|
365
|
-
signal?: AbortSignal;
|
|
366
|
-
includeRows?: boolean;
|
|
367
|
-
}): Promise<Batch>;
|
|
368
|
-
getBatchResults(id: string, options?: {
|
|
369
|
-
signal?: AbortSignal;
|
|
370
|
-
rowStatus?: "queued" | "running" | "completed" | "failed";
|
|
371
|
-
}): Promise<Batch & {
|
|
372
|
-
results: BatchRow[];
|
|
373
|
-
}>;
|
|
374
|
-
cancelBatch(id: string, options?: {
|
|
375
|
-
signal?: AbortSignal;
|
|
376
|
-
}): Promise<Batch>;
|
|
377
|
-
retryBatch(id: string, options?: {
|
|
378
|
-
signal?: AbortSignal;
|
|
379
|
-
rowNumber?: number;
|
|
380
|
-
}): Promise<Batch>;
|
|
381
|
-
waitBatch(id: string, options?: WaitOptions): Promise<Batch>;
|
|
382
|
-
getRun(jobId: string, options?: {
|
|
383
|
-
signal?: AbortSignal;
|
|
384
|
-
}): Promise<Run>;
|
|
385
|
-
cancelRun(runId: string, options?: {
|
|
386
|
-
signal?: AbortSignal;
|
|
387
|
-
}): Promise<Run>;
|
|
388
|
-
/** Poll to a terminal state. Failed/cancelled/blocked runs are returned for inspection. */
|
|
389
|
-
wait(runId: string, options?: {
|
|
390
|
-
signal?: AbortSignal;
|
|
391
|
-
timeoutMs?: number;
|
|
392
|
-
intervalMs?: number;
|
|
393
|
-
}): Promise<Run>;
|
|
394
|
-
}
|
|
395
|
-
/** Define an agent and call run(). Creation is lazy and shared across concurrent calls. */
|
|
396
|
-
export declare class Agent extends AgentRun {
|
|
397
|
-
private readonly definition;
|
|
398
|
-
private agentId?;
|
|
399
|
-
private creation?;
|
|
400
|
-
constructor(definition: AgentOptions);
|
|
401
|
-
/** Start a managed build from plain English. Save buildId to resume waiting later. */
|
|
402
|
-
static create(options: ClientOptions & {
|
|
403
|
-
prompt: string;
|
|
404
|
-
context?: string;
|
|
405
|
-
depth?: "standard" | "deep";
|
|
406
|
-
signal?: AbortSignal;
|
|
407
|
-
}): Promise<Agent>;
|
|
408
|
-
get buildId(): string | undefined;
|
|
409
|
-
/** Wait for generation and activation. A local timeout does not cancel the build. */
|
|
410
|
-
waitUntilReady(options?: WaitOptions): Promise<this>;
|
|
411
|
-
get id(): string | undefined;
|
|
412
|
-
/** Persist the definition without starting a run. */
|
|
413
|
-
create(): Promise<string>;
|
|
414
|
-
private ensureAgent;
|
|
415
|
-
/** Runs an existing agent's configured campaign template with its form inputs. */
|
|
416
|
-
campaign(inputs: Record<string, unknown>, options?: CampaignOptions): Promise<Campaign>;
|
|
417
|
-
batch(input: string[] | {
|
|
418
|
-
csv: string | Blob;
|
|
419
|
-
inputColumn: string;
|
|
420
|
-
}, options?: BatchOptions): Promise<Batch>;
|
|
421
|
-
loop(input: string | string[] | {
|
|
422
|
-
csv: string | Blob;
|
|
423
|
-
inputColumn: string;
|
|
424
|
-
}, cadence: LoopCadence, options?: BatchOptions): Promise<LoopCreated>;
|
|
425
|
-
private submitBatch;
|
|
426
|
-
run(question: string, options?: {
|
|
427
|
-
signal?: AbortSignal;
|
|
428
|
-
idempotencyKey?: string;
|
|
429
|
-
effort?: "low" | "medium" | "high" | "build";
|
|
430
|
-
maxCostUsd?: number;
|
|
431
|
-
responseLanguage?: string;
|
|
432
|
-
outputSchema?: Record<string, unknown>;
|
|
433
|
-
}): Promise<Run>;
|
|
434
|
-
}
|