@eigenpal/sdk 0.4.17 → 0.5.2
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 +2 -1
- package/package.json +1 -1
- package/src/generated/index.ts +85 -0
- package/src/generated/sdk.gen.ts +289 -0
- package/src/generated/types.gen.ts +833 -1
- package/src/index.ts +3 -0
- package/src/resources/agents.ts +269 -0
- package/src/telemetry.ts +1 -1
package/src/index.ts
CHANGED
|
@@ -53,6 +53,9 @@ export type { ListExecutionsOptions, RunAndWaitOptions } from './resources/execu
|
|
|
53
53
|
// Re-export the canonical generated types so users can type their own
|
|
54
54
|
// callbacks and helpers without reaching into `./generated`.
|
|
55
55
|
export type {
|
|
56
|
+
AgentExecutionExpectedArtifacts,
|
|
57
|
+
AgentExecutionFeedback,
|
|
58
|
+
AgentExecutionFeedbackDetail,
|
|
56
59
|
AgentExecutionResponse,
|
|
57
60
|
AgentExecutionSummary,
|
|
58
61
|
AgentSummary,
|
package/src/resources/agents.ts
CHANGED
|
@@ -1,17 +1,36 @@
|
|
|
1
1
|
import type { OperationResult } from '../client';
|
|
2
|
+
import { EigenpalError } from '../errors';
|
|
2
3
|
import type { Client } from '../generated/client';
|
|
3
4
|
import {
|
|
4
5
|
agentsCreate,
|
|
5
6
|
agentsExecutionsCancel,
|
|
7
|
+
agentsExecutionsExpectedCreate,
|
|
8
|
+
agentsExecutionsExpectedDelete,
|
|
9
|
+
agentsExecutionsExpectedDownload,
|
|
10
|
+
agentsExecutionsExpectedList,
|
|
11
|
+
agentsExecutionsExpectedRename,
|
|
12
|
+
agentsExecutionsFeedbackDelete,
|
|
13
|
+
agentsExecutionsFeedbackGet,
|
|
14
|
+
agentsExecutionsFeedbackUpdate,
|
|
15
|
+
agentsExecutionsFilesDownload,
|
|
6
16
|
agentsExecutionsGet,
|
|
7
17
|
agentsExecutionsList,
|
|
18
|
+
agentsExecutionsRerun,
|
|
19
|
+
agentsFilesListOrGet,
|
|
20
|
+
agentsFilesPut,
|
|
21
|
+
agentsFilesUploadBatch,
|
|
8
22
|
agentsGet,
|
|
9
23
|
agentsList,
|
|
10
24
|
agentsRun,
|
|
11
25
|
agentsUpdate,
|
|
12
26
|
} from '../generated/sdk.gen';
|
|
13
27
|
import type {
|
|
28
|
+
AgentExecutionExpectedArtifacts,
|
|
29
|
+
AgentExecutionFeedbackDetail,
|
|
14
30
|
AgentExecutionResponse,
|
|
31
|
+
AgentFileBody,
|
|
32
|
+
AgentFilesBody,
|
|
33
|
+
CopyAgentExecutionOutputToExpectedBody,
|
|
15
34
|
CreateAgentBody,
|
|
16
35
|
CreateAgentResponse,
|
|
17
36
|
GetAgentResponse,
|
|
@@ -19,7 +38,10 @@ import type {
|
|
|
19
38
|
ListAgentsResponse,
|
|
20
39
|
PatchAgentBody,
|
|
21
40
|
PatchAgentResponse,
|
|
41
|
+
RenameExpectedFileBody,
|
|
42
|
+
RerunAgentExecutionResponse,
|
|
22
43
|
RunAgentResponse,
|
|
44
|
+
UpdateAgentExecutionFeedbackBody,
|
|
23
45
|
} from '../generated/types.gen';
|
|
24
46
|
import { buildAgentMultipart, hasFileInput } from '../lib/files';
|
|
25
47
|
import type { WorkflowInput } from './workflows';
|
|
@@ -41,11 +63,40 @@ export interface RunAgentOptions {
|
|
|
41
63
|
export interface ListAgentExecutionsOptions {
|
|
42
64
|
status?: string;
|
|
43
65
|
batchId?: string;
|
|
66
|
+
exampleName?: string;
|
|
67
|
+
exampleNameContains?: string;
|
|
68
|
+
createdAfter?: string;
|
|
69
|
+
createdBefore?: string;
|
|
70
|
+
completedAfter?: string;
|
|
71
|
+
completedBefore?: string;
|
|
72
|
+
feedbackStatus?: 'open' | 'resolved' | 'ignored';
|
|
73
|
+
feedbackRating?: 'pass' | 'fail' | 'partial' | 'none';
|
|
74
|
+
hasFeedback?: boolean;
|
|
75
|
+
noFeedback?: boolean;
|
|
76
|
+
hasExpected?: boolean;
|
|
77
|
+
hasExpectedJson?: boolean;
|
|
78
|
+
hasExpectedFiles?: boolean;
|
|
79
|
+
feedbackBodyContains?: string;
|
|
80
|
+
feedbackCreatedAfter?: string;
|
|
81
|
+
feedbackCreatedBefore?: string;
|
|
82
|
+
feedbackUpdatedAfter?: string;
|
|
83
|
+
feedbackUpdatedBefore?: string;
|
|
84
|
+
feedbackResolvedAfter?: string;
|
|
85
|
+
feedbackResolvedBefore?: string;
|
|
86
|
+
promotedToExample?: boolean;
|
|
87
|
+
promotedExampleName?: string;
|
|
88
|
+
sinceLastResolved?: boolean;
|
|
89
|
+
include?: string;
|
|
90
|
+
sort?: 'createdAt' | 'completedAt' | 'status' | 'exampleName';
|
|
91
|
+
order?: 'asc' | 'desc';
|
|
92
|
+
scanLimit?: number;
|
|
44
93
|
limit?: number;
|
|
45
94
|
offset?: number;
|
|
46
95
|
signal?: AbortSignal;
|
|
47
96
|
}
|
|
48
97
|
|
|
98
|
+
export type AgentExecutionFileKind = 'input' | 'output' | 'issues' | 'trace';
|
|
99
|
+
|
|
49
100
|
export class AgentExecutionsResource {
|
|
50
101
|
constructor(
|
|
51
102
|
private readonly client: Client,
|
|
@@ -89,6 +140,182 @@ export class AgentExecutionsResource {
|
|
|
89
140
|
})
|
|
90
141
|
);
|
|
91
142
|
}
|
|
143
|
+
|
|
144
|
+
async rerun(
|
|
145
|
+
executionId: string,
|
|
146
|
+
options: { signal?: AbortSignal } = {}
|
|
147
|
+
): Promise<RerunAgentExecutionResponse> {
|
|
148
|
+
return this.dispatch(() =>
|
|
149
|
+
agentsExecutionsRerun({
|
|
150
|
+
client: this.client,
|
|
151
|
+
path: { executionId },
|
|
152
|
+
signal: options.signal,
|
|
153
|
+
})
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
async getFeedback(
|
|
158
|
+
executionId: string,
|
|
159
|
+
options: { signal?: AbortSignal } = {}
|
|
160
|
+
): Promise<AgentExecutionFeedbackDetail> {
|
|
161
|
+
return this.dispatch(() =>
|
|
162
|
+
agentsExecutionsFeedbackGet({
|
|
163
|
+
client: this.client,
|
|
164
|
+
path: { executionId },
|
|
165
|
+
signal: options.signal,
|
|
166
|
+
})
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
async updateFeedback(
|
|
171
|
+
executionId: string,
|
|
172
|
+
body: UpdateAgentExecutionFeedbackBody,
|
|
173
|
+
options: { signal?: AbortSignal } = {}
|
|
174
|
+
): Promise<AgentExecutionFeedbackDetail> {
|
|
175
|
+
return this.dispatch(() =>
|
|
176
|
+
agentsExecutionsFeedbackUpdate({
|
|
177
|
+
client: this.client,
|
|
178
|
+
path: { executionId },
|
|
179
|
+
body,
|
|
180
|
+
signal: options.signal,
|
|
181
|
+
})
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
async clearFeedback(
|
|
186
|
+
executionId: string,
|
|
187
|
+
options: { signal?: AbortSignal } = {}
|
|
188
|
+
): Promise<AgentExecutionFeedbackDetail> {
|
|
189
|
+
return this.dispatch(() =>
|
|
190
|
+
agentsExecutionsFeedbackDelete({
|
|
191
|
+
client: this.client,
|
|
192
|
+
path: { executionId },
|
|
193
|
+
signal: options.signal,
|
|
194
|
+
})
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
async listExpected(
|
|
199
|
+
executionId: string,
|
|
200
|
+
options: { signal?: AbortSignal } = {}
|
|
201
|
+
): Promise<AgentExecutionExpectedArtifacts> {
|
|
202
|
+
return this.dispatch(() =>
|
|
203
|
+
agentsExecutionsExpectedList({
|
|
204
|
+
client: this.client,
|
|
205
|
+
path: { executionId },
|
|
206
|
+
signal: options.signal,
|
|
207
|
+
})
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
async copyOutputToExpected(
|
|
212
|
+
executionId: string,
|
|
213
|
+
body: CopyAgentExecutionOutputToExpectedBody,
|
|
214
|
+
options: { signal?: AbortSignal } = {}
|
|
215
|
+
): Promise<{ name: string }> {
|
|
216
|
+
return this.dispatch(() =>
|
|
217
|
+
agentsExecutionsExpectedCreate({
|
|
218
|
+
client: this.client,
|
|
219
|
+
path: { executionId },
|
|
220
|
+
body,
|
|
221
|
+
signal: options.signal,
|
|
222
|
+
})
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async renameExpected(
|
|
227
|
+
executionId: string,
|
|
228
|
+
filename: string,
|
|
229
|
+
body: RenameExpectedFileBody,
|
|
230
|
+
options: { signal?: AbortSignal } = {}
|
|
231
|
+
): Promise<{ name: string }> {
|
|
232
|
+
return this.dispatch(() =>
|
|
233
|
+
agentsExecutionsExpectedRename({
|
|
234
|
+
client: this.client,
|
|
235
|
+
path: { executionId, filename },
|
|
236
|
+
body,
|
|
237
|
+
signal: options.signal,
|
|
238
|
+
})
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
async deleteExpected(
|
|
243
|
+
executionId: string,
|
|
244
|
+
filename: string,
|
|
245
|
+
options: { signal?: AbortSignal } = {}
|
|
246
|
+
): Promise<void> {
|
|
247
|
+
await this.dispatch(() =>
|
|
248
|
+
agentsExecutionsExpectedDelete({
|
|
249
|
+
client: this.client,
|
|
250
|
+
path: { executionId, filename },
|
|
251
|
+
signal: options.signal,
|
|
252
|
+
})
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
async uploadExpected(
|
|
257
|
+
executionId: string,
|
|
258
|
+
file: Blob,
|
|
259
|
+
options: { name?: string; signal?: AbortSignal } = {}
|
|
260
|
+
): Promise<{ name: string }> {
|
|
261
|
+
const formData = new FormData();
|
|
262
|
+
formData.set('file', file);
|
|
263
|
+
if (options.name) formData.set('name', options.name);
|
|
264
|
+
return this.dispatch(
|
|
265
|
+
() =>
|
|
266
|
+
this.client.post({
|
|
267
|
+
url: '/api/v1/agents/executions/{executionId}/expected',
|
|
268
|
+
path: { executionId },
|
|
269
|
+
body: formData,
|
|
270
|
+
bodySerializer: null,
|
|
271
|
+
headers: { 'Content-Type': null },
|
|
272
|
+
signal: options.signal,
|
|
273
|
+
}) as Promise<OperationResult<{ name: string }>>
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
async downloadExpected(
|
|
278
|
+
executionId: string,
|
|
279
|
+
filename: string,
|
|
280
|
+
options: { signal?: AbortSignal } = {}
|
|
281
|
+
): Promise<Blob> {
|
|
282
|
+
return this.downloadBlob(
|
|
283
|
+
() =>
|
|
284
|
+
agentsExecutionsExpectedDownload({
|
|
285
|
+
client: this.client,
|
|
286
|
+
path: { executionId, filename },
|
|
287
|
+
parseAs: 'blob',
|
|
288
|
+
signal: options.signal,
|
|
289
|
+
}) as Promise<OperationResult<Blob>>
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
async downloadFile(
|
|
294
|
+
executionId: string,
|
|
295
|
+
kind: AgentExecutionFileKind,
|
|
296
|
+
filename: string,
|
|
297
|
+
options: { signal?: AbortSignal } = {}
|
|
298
|
+
): Promise<Blob> {
|
|
299
|
+
return this.downloadBlob(
|
|
300
|
+
() =>
|
|
301
|
+
agentsExecutionsFilesDownload({
|
|
302
|
+
client: this.client,
|
|
303
|
+
path: { executionId, kind, filename },
|
|
304
|
+
parseAs: 'blob',
|
|
305
|
+
signal: options.signal,
|
|
306
|
+
}) as Promise<OperationResult<Blob>>
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
private async downloadBlob(call: () => Promise<OperationResult<Blob>>): Promise<Blob> {
|
|
311
|
+
const result = await call();
|
|
312
|
+
if (result.response?.ok && result.data instanceof Blob) {
|
|
313
|
+
return result.data;
|
|
314
|
+
}
|
|
315
|
+
throw new EigenpalError('Failed to download agent execution artifact.', {
|
|
316
|
+
status: result.response?.status ?? 0,
|
|
317
|
+
});
|
|
318
|
+
}
|
|
92
319
|
}
|
|
93
320
|
|
|
94
321
|
export class AgentsResource {
|
|
@@ -112,6 +339,48 @@ export class AgentsResource {
|
|
|
112
339
|
);
|
|
113
340
|
}
|
|
114
341
|
|
|
342
|
+
async listFiles(
|
|
343
|
+
agentId: string,
|
|
344
|
+
options: { path?: string; prefix?: string; signal?: AbortSignal } = {}
|
|
345
|
+
): Promise<unknown> {
|
|
346
|
+
const { signal, ...query } = options;
|
|
347
|
+
return this.dispatch(() =>
|
|
348
|
+
agentsFilesListOrGet({ client: this.client, path: { agentId }, query, signal })
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
async putFile(
|
|
353
|
+
agentId: string,
|
|
354
|
+
path: string,
|
|
355
|
+
body: AgentFileBody,
|
|
356
|
+
options: { signal?: AbortSignal } = {}
|
|
357
|
+
): Promise<{ ok: boolean; path: string }> {
|
|
358
|
+
return this.dispatch(() =>
|
|
359
|
+
agentsFilesPut({
|
|
360
|
+
client: this.client,
|
|
361
|
+
path: { agentId },
|
|
362
|
+
query: { path },
|
|
363
|
+
body,
|
|
364
|
+
signal: options.signal,
|
|
365
|
+
})
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
async uploadFiles(
|
|
370
|
+
agentId: string,
|
|
371
|
+
body: AgentFilesBody,
|
|
372
|
+
options: { signal?: AbortSignal } = {}
|
|
373
|
+
): Promise<{ ok: boolean; files: string[] }> {
|
|
374
|
+
return this.dispatch(() =>
|
|
375
|
+
agentsFilesUploadBatch({
|
|
376
|
+
client: this.client,
|
|
377
|
+
path: { agentId },
|
|
378
|
+
body,
|
|
379
|
+
signal: options.signal,
|
|
380
|
+
})
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
|
|
115
384
|
async create(
|
|
116
385
|
body: CreateAgentBody,
|
|
117
386
|
options: { signal?: AbortSignal } = {}
|
package/src/telemetry.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
export const SDK_LANGUAGE = 'typescript';
|
|
20
20
|
// Rewritten at publish time by scripts/render-sdk-versions.sh.
|
|
21
21
|
// Keep this string literal exactly stable — sed matches on it.
|
|
22
|
-
export const SDK_VERSION = '0.
|
|
22
|
+
export const SDK_VERSION = '0.5.2';
|
|
23
23
|
|
|
24
24
|
function detectRuntime(): string {
|
|
25
25
|
const g = globalThis as unknown as {
|