@eigenpal/sdk 0.7.1 → 0.8.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/CHANGELOG.md +70 -3
- package/README.md +56 -152
- package/package.json +1 -1
- package/src/client.ts +34 -19
- package/src/generated/index.ts +2 -2
- package/src/generated/sdk.gen.ts +161 -284
- package/src/generated/types.gen.ts +1008 -1273
- package/src/index.ts +20 -44
- package/src/resources/auth.ts +18 -0
- package/src/resources/automations.ts +284 -7
- package/src/resources/files.ts +51 -0
- package/src/resources/runs.ts +66 -463
- package/src/telemetry.ts +1 -1
- package/src/resources/agents.ts +0 -221
- package/src/resources/executions.ts +0 -142
- package/src/resources/source.ts +0 -101
- package/src/resources/workflows.ts +0 -82
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,72 @@
|
|
|
1
1
|
# @eigenpal/sdk
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d620a00: Expose the clean public automation API around automations, runs, files/artifacts, datasets, evaluators, experiments, evaluation results, and run promotion. This intentionally breaks the pre-v1 SDK/CLI surface that exposed workflow- and agent-specific top-level resources outside the explicit legacy compatibility routes.
|
|
8
|
+
|
|
9
|
+
> [!WARNING]
|
|
10
|
+
> **Breaking change (pre-v1).** The workflow- and agent-specific top-level
|
|
11
|
+
> resources have been removed in favor of a single automation-centric surface.
|
|
12
|
+
> These packages are still 0.x, so this breaking redesign ships as a `minor`
|
|
13
|
+
> bump. Update your integration before upgrading.
|
|
14
|
+
|
|
15
|
+
#### Removed
|
|
16
|
+
- Top-level workflow resources, e.g. `client.workflows.*`, including
|
|
17
|
+
`client.workflows.executions.runAndWait(...)` and the rest of the
|
|
18
|
+
`client.workflows.executions.*` tree.
|
|
19
|
+
- Top-level agent resources, e.g. `client.agents.*` (runs, feedback, traces,
|
|
20
|
+
files, expected artifacts).
|
|
21
|
+
- Top-level source/git resources, e.g. `client.sources.*`.
|
|
22
|
+
|
|
23
|
+
#### New equivalents
|
|
24
|
+
- **Start a run:** use `client.run('workflows.<slug>', input, options)` (and
|
|
25
|
+
`client.run('agents.<slug>', ...)`). In the TypeScript SDK, `run-and-wait`
|
|
26
|
+
is `client.run(target, input, { waitForCompletion })`; in the Python SDK use
|
|
27
|
+
`client.run_and_wait(target, input=...)`.
|
|
28
|
+
- **Browse automations** (workflows + agents): `client.automations.list()`,
|
|
29
|
+
`client.automations.get(id)`, `client.automations.versions(id)`,
|
|
30
|
+
`client.automations.triggers(id)`, plus
|
|
31
|
+
`client.automations.dataset|examples|evaluators|experiments.*`.
|
|
32
|
+
- **Inspect & control runs:** `client.runs.list()`, `client.runs.get(id)`,
|
|
33
|
+
`client.runs.cancel(id)`, `client.runs.rerun(id)`, `client.runs.promote(id)`,
|
|
34
|
+
`client.runs.usage(id)`, `client.runs.steps(id)`, `client.runs.events(id)`,
|
|
35
|
+
and `client.runs.artifacts|eval_results|feedback|trace.*`.
|
|
36
|
+
- **Manage reusable files:** `client.files.upload(...)`, `client.files.get(id)`,
|
|
37
|
+
`client.files.download(id)`, `client.files.delete(id)`.
|
|
38
|
+
|
|
39
|
+
#### Migration
|
|
40
|
+
- `client.workflows.executions.runAndWait('<slug>', input)` →
|
|
41
|
+
`client.run('workflows.<slug>', input, { waitForCompletion })` (TS) /
|
|
42
|
+
`client.run_and_wait('workflows.<slug>', input=...)` (Python).
|
|
43
|
+
- `client.workflows.executions.create('<slug>', input)` →
|
|
44
|
+
`client.run('workflows.<slug>', input)`.
|
|
45
|
+
- `client.agents.runs.create('<slug>', input)` →
|
|
46
|
+
`client.run('agents.<slug>', input)`.
|
|
47
|
+
- `client.workflows.get('<slug>')` / `client.agents.get('<slug>')` →
|
|
48
|
+
`client.automations.get('workflows.<slug>')` /
|
|
49
|
+
`client.automations.get('agents.<slug>')`.
|
|
50
|
+
- Listing/inspecting executions previously under
|
|
51
|
+
`client.workflows.executions.*` / `client.agents.runs.*` →
|
|
52
|
+
`client.runs.*` (e.g. `client.runs.list()`, `client.runs.get(id)`).
|
|
53
|
+
- `eigenpal runs promote` now accepts only `--name` (optional). Use
|
|
54
|
+
`eigenpal runs feedback update` to set expected JSON before promoting.
|
|
55
|
+
Feedback and expected commands work for both workflow and agent runs.
|
|
56
|
+
|
|
57
|
+
#### DX fixes
|
|
58
|
+
- `client.runs.*` read methods are now typed against the generated OpenAPI
|
|
59
|
+
models; use `isRunFinished()` to narrow `run()` / `rerun()` responses before
|
|
60
|
+
accessing `output`.
|
|
61
|
+
- `eigenpal agents dataset push --file` accepts a `.zip` archive (matching
|
|
62
|
+
`pull` output) as well as a directory.
|
|
63
|
+
|
|
64
|
+
## 0.7.2
|
|
65
|
+
|
|
66
|
+
### Minor Changes
|
|
67
|
+
|
|
68
|
+
- c5a709c: Public workflow list/detail responses include `apiEnabled` and `triggers`; run definition docs note workflow-only scope.
|
|
69
|
+
|
|
3
70
|
## 0.7.1
|
|
4
71
|
|
|
5
72
|
### Patch Changes
|
|
@@ -90,7 +157,7 @@
|
|
|
90
157
|
string callers actually want, replacing the internal `currentHistoryId`.
|
|
91
158
|
|
|
92
159
|
Heads-up: workflow `name` is no longer surfaced as a top-level field
|
|
93
|
-
(it was previously leaked via `currentVersion.definition.name`). It
|
|
160
|
+
(it was previously leaked via `currentVersion.definition.name`). It is
|
|
94
161
|
authoritative inside the YAML, so fetch it via
|
|
95
162
|
`client.workflows.versions(id)[0].yamlContent` and parse, or treat the
|
|
96
163
|
workflow `id` as the canonical identifier.
|
|
@@ -114,8 +181,8 @@
|
|
|
114
181
|
v1 paths resolve, the trimmed public shape is enforced on the wire,
|
|
115
182
|
and the HTML-host guard fires.
|
|
116
183
|
|
|
117
|
-
`defineRoute` rejects paths that
|
|
118
|
-
mismatch
|
|
184
|
+
`defineRoute` rejects paths that do not start with `/api/` so the
|
|
185
|
+
mismatch cannot reappear by accident.
|
|
119
186
|
|
|
120
187
|
## Unreleased
|
|
121
188
|
|
package/README.md
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
# @eigenpal/sdk
|
|
2
2
|
|
|
3
|
-
Trigger
|
|
3
|
+
Trigger and inspect Eigenpal automations from TypeScript.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@eigenpal/sdk)
|
|
6
6
|
[](https://www.npmjs.com/package/@eigenpal/sdk)
|
|
7
7
|
[](https://github.com/eigenpal/sdk-typescript/blob/main/LICENSE)
|
|
8
|
-
[](https://github.com/eigenpal/sdk-typescript)
|
|
9
8
|
|
|
10
9
|
## Install
|
|
11
10
|
|
|
@@ -13,202 +12,107 @@ Trigger EigenPal workflows from TypeScript.
|
|
|
13
12
|
npm i @eigenpal/sdk
|
|
14
13
|
```
|
|
15
14
|
|
|
16
|
-
Requires a TypeScript-aware runtime: Bun, Deno, Node 22+ (native TS), `tsx`, Next.js, Vite, or any modern bundler. Plain `node script.js`
|
|
15
|
+
Requires a TypeScript-aware runtime: Bun, Deno, Node 22+ (native TS), `tsx`, Next.js, Vite, or any modern bundler. Plain `node script.js` will not work; see [Configuration](./docs/configuration.md#typescript-runtime).
|
|
17
16
|
|
|
18
|
-
Get an API key at **studio.eigenpal.com
|
|
17
|
+
Get an API key at **studio.eigenpal.com -> Settings -> API Keys**.
|
|
19
18
|
|
|
20
|
-
## Quick
|
|
19
|
+
## Quick Start
|
|
21
20
|
|
|
22
21
|
```ts
|
|
23
|
-
import { EigenpalClient
|
|
22
|
+
import { EigenpalClient } from '@eigenpal/sdk';
|
|
24
23
|
|
|
25
24
|
const client = new EigenpalClient({ apiKey: process.env.EIGENPAL_API_KEY });
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
console.log(result.finished, result.output);
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Authentication
|
|
36
|
-
|
|
37
|
-
Generate an API key from the dashboard under **Settings → API Keys**, then pass it explicitly:
|
|
26
|
+
const result = await client.run(
|
|
27
|
+
'workflows.extract-invoice',
|
|
28
|
+
{ contract_document: file },
|
|
29
|
+
{ waitForCompletion: 60 }
|
|
30
|
+
);
|
|
38
31
|
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
if (result.finished) {
|
|
33
|
+
console.log(result.output);
|
|
34
|
+
}
|
|
41
35
|
```
|
|
42
36
|
|
|
43
|
-
|
|
37
|
+
`target` is always typed: `workflows.<slug>` or `agents.<slug>`. That keeps workflow and agent slugs unambiguous.
|
|
44
38
|
|
|
45
|
-
##
|
|
39
|
+
## Automations
|
|
46
40
|
|
|
47
|
-
|
|
41
|
+
Workflows and agents are exposed as automations.
|
|
48
42
|
|
|
49
43
|
```ts
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
const { data } = await client.automations.list({ search: 'invoice' });
|
|
45
|
+
const automation = await client.automations.get('workflows.extract-invoice');
|
|
46
|
+
const versions = await client.automations.versions('workflows.extract-invoice');
|
|
47
|
+
const triggers = await client.automations.triggers('workflows.extract-invoice');
|
|
54
48
|
```
|
|
55
49
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
## Starting runs
|
|
59
|
-
|
|
60
|
-
`client.run(target, input?, options?)` starts a workflow or agent run. Targets can be strings such as `workflows.extract-invoice` / `agents.invoice-agent` or structured objects like `{ type: 'workflow', slug: 'extract-invoice' }`.
|
|
50
|
+
## Runs
|
|
61
51
|
|
|
62
52
|
```ts
|
|
63
|
-
|
|
64
|
-
const { id: runId } = await client.run('workflows.extract-invoice', {
|
|
65
|
-
contract_document: file,
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// Sync: server holds the connection up to 60 seconds.
|
|
69
|
-
const result = await client.run(
|
|
70
|
-
{ type: 'workflow', slug: 'extract-invoice', version: 'latest' },
|
|
71
|
-
{ contract_document: file },
|
|
72
|
-
{ waitForCompletion: 60 }
|
|
73
|
-
);
|
|
74
|
-
console.log(result.finished, result.output);
|
|
75
|
-
|
|
76
|
-
// Long-running: client-side polling, default 5min cap.
|
|
77
|
-
const final = await client.workflows.executions.runAndWait('extract-invoice', {
|
|
78
|
-
contract_document: file,
|
|
79
|
-
});
|
|
80
|
-
```
|
|
53
|
+
const { id } = await client.run('agents.invoice-agent', { invoice: file });
|
|
81
54
|
|
|
82
|
-
|
|
55
|
+
const run = await client.runs.get(id, { expand: ['usage', 'execution'] });
|
|
56
|
+
const usage = await client.runs.usage(id);
|
|
57
|
+
const steps = await client.runs.steps(id);
|
|
58
|
+
const events = await client.runs.events(id);
|
|
59
|
+
const trace = await client.runs.trace.get(id);
|
|
83
60
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
When a workflow input is a file, pass a `File`, `Blob`, or explicit `{ content, filename, mimeType }` descriptor. The SDK auto-detects them and uploads the request as `multipart/form-data` (the same shape as `curl -F`, no base64 round-trip):
|
|
87
|
-
|
|
88
|
-
```ts
|
|
89
|
-
// Browser: File from <input type="file">
|
|
90
|
-
await client.run('workflows.extract-invoice', { contract_document: file });
|
|
91
|
-
|
|
92
|
-
// Node: Buffer from fs
|
|
93
|
-
import { readFile } from 'node:fs/promises';
|
|
94
|
-
const buffer = await readFile('contract.pdf');
|
|
95
|
-
await client.run('workflows.extract-invoice', {
|
|
96
|
-
contract_document: {
|
|
97
|
-
content: buffer,
|
|
98
|
-
filename: 'contract.pdf',
|
|
99
|
-
mimeType: 'application/pdf',
|
|
100
|
-
},
|
|
101
|
-
});
|
|
61
|
+
await client.runs.cancel(id);
|
|
62
|
+
await client.rerun(id, { waitForCompletion: 60 });
|
|
102
63
|
```
|
|
103
64
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
## Execution polling
|
|
65
|
+
List calls use the same run API for workflows, agents, manual runs, and eval runs:
|
|
107
66
|
|
|
108
67
|
```ts
|
|
109
|
-
const
|
|
68
|
+
const recentFailures = await client.runs.list({
|
|
110
69
|
type: 'workflow',
|
|
111
|
-
source: 'extract-invoice',
|
|
112
70
|
status: 'failed,cancelled',
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
const run = await client.runs.get(runId);
|
|
116
|
-
// { id, type, finished, output, files, error, timing, ... }
|
|
117
|
-
|
|
118
|
-
// Add heavier optional sections with `expand`.
|
|
119
|
-
const withUsage = await client.runs.get(runId, { expand: ['usage', 'execution'] });
|
|
120
|
-
console.log(
|
|
121
|
-
withUsage.output,
|
|
122
|
-
withUsage.files,
|
|
123
|
-
withUsage.error,
|
|
124
|
-
withUsage.usage,
|
|
125
|
-
withUsage.execution
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
const list = await client.runs.list({
|
|
129
|
-
type: 'workflow',
|
|
130
|
-
source: 'extract-invoice',
|
|
131
|
-
status: ['failed', 'cancelled'],
|
|
132
|
-
from: 'now()-7d',
|
|
133
71
|
limit: 50,
|
|
134
72
|
});
|
|
135
|
-
|
|
136
|
-
await client.runs.cancel(runId);
|
|
137
73
|
```
|
|
138
74
|
|
|
139
|
-
|
|
140
|
-
and `source=<workflowId-or-agentId>` to scope list calls.
|
|
75
|
+
## Files And Artifacts
|
|
141
76
|
|
|
142
|
-
|
|
77
|
+
Use `client.files` for reusable upload-first blobs. When referenced by a run input, Eigenpal snapshots the file into run-scoped artifacts.
|
|
143
78
|
|
|
144
79
|
```ts
|
|
145
|
-
await client.
|
|
146
|
-
await client.workflows.get('extract-invoice');
|
|
147
|
-
await client.workflows.versions('extract-invoice');
|
|
148
|
-
```
|
|
80
|
+
const uploaded = await client.files.upload(file);
|
|
149
81
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
```ts
|
|
153
|
-
await client.agents.list({ search: 'invoice' });
|
|
154
|
-
await client.agents.get('invoice-agent');
|
|
155
|
-
|
|
156
|
-
const { id: agentRunId } = await client.run('agents.invoice-agent', {
|
|
157
|
-
invoice: file,
|
|
82
|
+
const started = await client.run('workflows.extract-invoice', {
|
|
83
|
+
contract_document: { fileId: uploaded.id },
|
|
158
84
|
});
|
|
159
85
|
|
|
160
|
-
await client.runs.
|
|
161
|
-
await client.runs.
|
|
86
|
+
const artifacts = await client.runs.artifacts.list(started.id);
|
|
87
|
+
const pdf = await client.runs.artifacts.download(started.id, artifacts.artifacts[0].path);
|
|
162
88
|
```
|
|
163
89
|
|
|
164
|
-
|
|
165
|
-
`source`.
|
|
90
|
+
You can also pass a `File`, `Blob`, or `{ content, filename, mimeType }` directly to `client.run`; the SDK sends multipart form data automatically.
|
|
166
91
|
|
|
167
92
|
## Errors
|
|
168
93
|
|
|
169
94
|
Every non-2xx response throws a typed subclass of `EigenpalError`:
|
|
170
95
|
|
|
171
|
-
| HTTP | Class |
|
|
172
|
-
| --------------- | ------------------------- |
|
|
173
|
-
| 400 | `EigenpalValidationError` |
|
|
174
|
-
| 401 | `EigenpalAuthError` |
|
|
175
|
-
| 403 | `EigenpalForbiddenError` |
|
|
176
|
-
| 404 | `EigenpalNotFoundError` |
|
|
177
|
-
| 429 | `EigenpalRateLimitError` |
|
|
178
|
-
| 5xx | `EigenpalServerError` |
|
|
179
|
-
| timeout / abort | `EigenpalTimeoutError` |
|
|
180
|
-
|
|
181
|
-
```ts
|
|
182
|
-
import { EigenpalClient, EigenpalValidationError } from '@eigenpal/sdk';
|
|
183
|
-
|
|
184
|
-
const client = new EigenpalClient({ apiKey: process.env.EIGENPAL_API_KEY });
|
|
185
|
-
|
|
186
|
-
try {
|
|
187
|
-
// First arg accepts the workflow slug ('extract-invoice') or id ('wf_abc123').
|
|
188
|
-
const result = await client.workflows.executions.runAndWait('extract-invoice', {
|
|
189
|
-
language: 'en',
|
|
190
|
-
});
|
|
191
|
-
console.log(result.finished, result.output);
|
|
192
|
-
} catch (err) {
|
|
193
|
-
if (err instanceof EigenpalValidationError) {
|
|
194
|
-
for (const issue of err.issues) console.error(`${issue.field}: ${issue.message}`);
|
|
195
|
-
}
|
|
196
|
-
throw err;
|
|
197
|
-
}
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
For file inputs, see [docs/files.md](./docs/files.md).
|
|
96
|
+
| HTTP | Class |
|
|
97
|
+
| --------------- | ------------------------- |
|
|
98
|
+
| 400 | `EigenpalValidationError` |
|
|
99
|
+
| 401 | `EigenpalAuthError` |
|
|
100
|
+
| 403 | `EigenpalForbiddenError` |
|
|
101
|
+
| 404 | `EigenpalNotFoundError` |
|
|
102
|
+
| 429 | `EigenpalRateLimitError` |
|
|
103
|
+
| 5xx | `EigenpalServerError` |
|
|
104
|
+
| timeout / abort | `EigenpalTimeoutError` |
|
|
201
105
|
|
|
202
106
|
## Reference
|
|
203
107
|
|
|
204
|
-
| Topic | What
|
|
205
|
-
| ----------------------------------------- |
|
|
206
|
-
| [
|
|
207
|
-
| [
|
|
208
|
-
| [File inputs](./docs/files.md) | Multipart upload from File, Blob, Buffer, or path.
|
|
209
|
-
| [Errors](./docs/errors.md) | Typed exceptions, retries, request ids.
|
|
210
|
-
| [Configuration](./docs/configuration.md) | API key, baseUrl, timeouts, headers.
|
|
211
|
-
| [Full API reference](./docs/reference.md) | Every method, generated from
|
|
108
|
+
| Topic | What is in it |
|
|
109
|
+
| ----------------------------------------- | ------------------------------------------------------------------- |
|
|
110
|
+
| [Automations](./docs/workflows.md) | List, inspect, versions, triggers. |
|
|
111
|
+
| [Runs](./docs/executions.md) | Start, poll, cancel, rerun, usage, steps, events, traces, feedback. |
|
|
112
|
+
| [File inputs](./docs/files.md) | Multipart upload from File, Blob, Buffer, or path. |
|
|
113
|
+
| [Errors](./docs/errors.md) | Typed exceptions, retries, request ids. |
|
|
114
|
+
| [Configuration](./docs/configuration.md) | API key, baseUrl, timeouts, headers. |
|
|
115
|
+
| [Full API reference](./docs/reference.md) | Every method, generated from OpenAPI. |
|
|
212
116
|
|
|
213
117
|
## License
|
|
214
118
|
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -3,13 +3,13 @@ import { createClient, createConfig, type Client, type Config } from './generate
|
|
|
3
3
|
import type {
|
|
4
4
|
ApiErrorEnvelope,
|
|
5
5
|
RunStartResponse as GeneratedRunStartResponse,
|
|
6
|
+
Run,
|
|
6
7
|
} from './generated/types.gen';
|
|
7
8
|
import { buildRunJsonBody, buildRunMultipart, hasFileInput } from './lib/files';
|
|
8
|
-
import {
|
|
9
|
+
import { AuthResource } from './resources/auth';
|
|
9
10
|
import { AutomationsResource } from './resources/automations';
|
|
11
|
+
import { FilesResource } from './resources/files';
|
|
10
12
|
import { RunsResource } from './resources/runs';
|
|
11
|
-
import { SourceResource } from './resources/source';
|
|
12
|
-
import { WorkflowsResource } from './resources/workflows';
|
|
13
13
|
import { buildTelemetryHeaders } from './telemetry';
|
|
14
14
|
|
|
15
15
|
export interface EigenpalOptions {
|
|
@@ -70,6 +70,7 @@ export type RunInput = Record<string, unknown>;
|
|
|
70
70
|
export interface RunCallOptions {
|
|
71
71
|
waitForCompletion?: number;
|
|
72
72
|
overrides?: { steps?: Record<string, Record<string, unknown>> };
|
|
73
|
+
metadata?: Record<string, unknown>;
|
|
73
74
|
signal?: AbortSignal;
|
|
74
75
|
}
|
|
75
76
|
|
|
@@ -88,6 +89,11 @@ export interface RerunOptions {
|
|
|
88
89
|
*/
|
|
89
90
|
export type RunStartResponse = GeneratedRunStartResponse;
|
|
90
91
|
|
|
92
|
+
/** Narrow `RunStartResponse` to a terminal run with `output` and related fields. */
|
|
93
|
+
export function isRunFinished(run: RunStartResponse): run is Run {
|
|
94
|
+
return run.finished === true;
|
|
95
|
+
}
|
|
96
|
+
|
|
91
97
|
/**
|
|
92
98
|
* The EigenPal SDK client.
|
|
93
99
|
*
|
|
@@ -107,21 +113,19 @@ export type RunStartResponse = GeneratedRunStartResponse;
|
|
|
107
113
|
* { waitForCompletion: 60 }
|
|
108
114
|
* );
|
|
109
115
|
*
|
|
110
|
-
* //
|
|
111
|
-
* const final = await client.
|
|
116
|
+
* // Inspect the final run later.
|
|
117
|
+
* const final = await client.runs.get(id);
|
|
112
118
|
* ```
|
|
113
119
|
*/
|
|
114
120
|
export class EigenpalClient {
|
|
115
|
-
/**
|
|
116
|
-
public readonly
|
|
117
|
-
/**
|
|
118
|
-
public readonly agents: AgentsResource;
|
|
119
|
-
/** Source repository operations: repository metadata, raw files, releases, lockfiles, and secret decrypt. */
|
|
120
|
-
public readonly source: SourceResource;
|
|
121
|
-
/** Automation operations: sync public automation metadata from source. */
|
|
121
|
+
/** API key identity and current tenant context. */
|
|
122
|
+
public readonly auth: AuthResource;
|
|
123
|
+
/** Automation metadata across workflows and agents. Start runs with `client.run(...)`. */
|
|
122
124
|
public readonly automations: AutomationsResource;
|
|
123
125
|
/** Tenant-wide run operations across workflow, agent, manual, and eval runs. */
|
|
124
126
|
public readonly runs: RunsResource;
|
|
127
|
+
/** Reusable uploaded files that can be referenced by later runs. */
|
|
128
|
+
public readonly files: FilesResource;
|
|
125
129
|
|
|
126
130
|
/** Underlying hey-api client. Use `getRawClient()` for advanced cases. */
|
|
127
131
|
private readonly client: Client;
|
|
@@ -162,11 +166,10 @@ export class EigenpalClient {
|
|
|
162
166
|
}
|
|
163
167
|
this.installTimeoutInterceptor();
|
|
164
168
|
|
|
165
|
-
this.
|
|
166
|
-
this.agents = new AgentsResource(this.client, this._request.bind(this));
|
|
167
|
-
this.source = new SourceResource(this.client, this._request.bind(this));
|
|
169
|
+
this.auth = new AuthResource(this.client, this._request.bind(this));
|
|
168
170
|
this.automations = new AutomationsResource(this.client, this._request.bind(this));
|
|
169
171
|
this.runs = new RunsResource(this.client, this._request.bind(this));
|
|
172
|
+
this.files = new FilesResource(this.client, this._request.bind(this));
|
|
170
173
|
}
|
|
171
174
|
|
|
172
175
|
/** Expose the underlying hey-api client for advanced use (custom interceptors, etc.). */
|
|
@@ -193,6 +196,7 @@ export class EigenpalClient {
|
|
|
193
196
|
target: pathTarget,
|
|
194
197
|
input,
|
|
195
198
|
overrides: options.overrides,
|
|
199
|
+
metadata: options.metadata,
|
|
196
200
|
});
|
|
197
201
|
return this._request<RunStartResponse>(
|
|
198
202
|
() =>
|
|
@@ -207,7 +211,7 @@ export class EigenpalClient {
|
|
|
207
211
|
);
|
|
208
212
|
}
|
|
209
213
|
|
|
210
|
-
const body = buildRunJsonBody(pathTarget, input, options.overrides);
|
|
214
|
+
const body = buildRunJsonBody(pathTarget, input, options.overrides, options.metadata);
|
|
211
215
|
return this._request<RunStartResponse>(
|
|
212
216
|
() =>
|
|
213
217
|
this.client.post({
|
|
@@ -363,7 +367,13 @@ function assertJsonResponse(response: Response): void {
|
|
|
363
367
|
const contentType = response.headers.get('content-type')?.toLowerCase() ?? '';
|
|
364
368
|
// Match `application/json`, `application/problem+json`, etc. Empty
|
|
365
369
|
// Content-Type is tolerated since some proxies strip it on small bodies.
|
|
366
|
-
if (
|
|
370
|
+
if (
|
|
371
|
+
contentType === '' ||
|
|
372
|
+
contentType.includes('json') ||
|
|
373
|
+
contentType.includes('octet-stream') ||
|
|
374
|
+
contentType.includes('zip')
|
|
375
|
+
)
|
|
376
|
+
return;
|
|
367
377
|
throw new EigenpalError(
|
|
368
378
|
`Expected a JSON response from the API but got Content-Type "${contentType}". ` +
|
|
369
379
|
`This usually means \`baseUrl\` points at a non-API host (e.g. the marketing site or ` +
|
|
@@ -385,9 +395,14 @@ function assertRunTarget(target: RunTarget): void {
|
|
|
385
395
|
|
|
386
396
|
function assertInputNotOptionsBag(input: RunInput | undefined): void {
|
|
387
397
|
if (!input || typeof input !== 'object') return;
|
|
388
|
-
if (
|
|
398
|
+
if (
|
|
399
|
+
'waitForCompletion' in input ||
|
|
400
|
+
'overrides' in input ||
|
|
401
|
+
'metadata' in input ||
|
|
402
|
+
'signal' in input
|
|
403
|
+
) {
|
|
389
404
|
throw new EigenpalError(
|
|
390
|
-
'Pass workflow/agent input as the second argument and { waitForCompletion, overrides, signal } as the third.',
|
|
405
|
+
'Pass workflow/agent input as the second argument and { waitForCompletion, overrides, metadata, signal } as the third.',
|
|
391
406
|
{ status: 0 }
|
|
392
407
|
);
|
|
393
408
|
}
|
package/src/generated/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
|
|
3
|
-
export {
|
|
4
|
-
export type { AgentRunExecution,
|
|
3
|
+
export { authCheck, automationsDatasetExport, automationsDatasetImport, automationsEvaluatorsGet, automationsEvaluatorsUpdate, automationsExamplesCreate, automationsExamplesDelete, automationsExamplesGet, automationsExamplesList, automationsExamplesRun, automationsExamplesUpdate, automationsExperimentsCancel, automationsExperimentsCreate, automationsExperimentsGet, automationsExperimentsList, automationsGet, automationsList, automationsTriggersGet, automationsVersionsList, filesContentGet, filesCreate, filesDelete, filesGet, type Options, runsArtifactsGet, runsArtifactsList, runsCancel, runsEvalResultsList, runsEventsList, runsFeedbackClear, runsFeedbackGet, runsFeedbackUpdate, runsGet, runsList, runsPromote, runsRerun, runsStart, runsStepsList, runsTraceGet, runsUsageGet } from './sdk.gen';
|
|
4
|
+
export type { AgentRunExecution, ApiErrorEnvelope, ApiErrorIssue, AuthCheckData, AuthCheckError, AuthCheckErrors, AuthCheckResponse, AuthCheckResponse2, AuthCheckResponses, AutomationDatasetImportMultipartRequest, AutomationDetail, AutomationsDatasetExportData, AutomationsDatasetExportError, AutomationsDatasetExportErrors, AutomationsDatasetExportResponse, AutomationsDatasetExportResponses, AutomationsDatasetImportData, AutomationsDatasetImportError, AutomationsDatasetImportErrors, AutomationsDatasetImportResponse, AutomationsDatasetImportResponses, AutomationsEvaluatorsGetData, AutomationsEvaluatorsGetError, AutomationsEvaluatorsGetErrors, AutomationsEvaluatorsGetResponse, AutomationsEvaluatorsGetResponses, AutomationsEvaluatorsUpdateData, AutomationsEvaluatorsUpdateError, AutomationsEvaluatorsUpdateErrors, AutomationsEvaluatorsUpdateResponse, AutomationsEvaluatorsUpdateResponses, AutomationsExamplesCreateData, AutomationsExamplesCreateError, AutomationsExamplesCreateErrors, AutomationsExamplesCreateResponse, AutomationsExamplesCreateResponses, AutomationsExamplesDeleteData, AutomationsExamplesDeleteError, AutomationsExamplesDeleteErrors, AutomationsExamplesDeleteResponse, AutomationsExamplesDeleteResponses, AutomationsExamplesGetData, AutomationsExamplesGetError, AutomationsExamplesGetErrors, AutomationsExamplesGetResponse, AutomationsExamplesGetResponses, AutomationsExamplesListData, AutomationsExamplesListError, AutomationsExamplesListErrors, AutomationsExamplesListResponse, AutomationsExamplesListResponses, AutomationsExamplesRunData, AutomationsExamplesRunError, AutomationsExamplesRunErrors, AutomationsExamplesRunResponse, AutomationsExamplesRunResponses, AutomationsExamplesUpdateData, AutomationsExamplesUpdateError, AutomationsExamplesUpdateErrors, AutomationsExamplesUpdateResponse, AutomationsExamplesUpdateResponses, AutomationsExperimentsCancelData, AutomationsExperimentsCancelError, AutomationsExperimentsCancelErrors, AutomationsExperimentsCancelResponse, AutomationsExperimentsCancelResponses, AutomationsExperimentsCreateData, AutomationsExperimentsCreateError, AutomationsExperimentsCreateErrors, AutomationsExperimentsCreateResponse, AutomationsExperimentsCreateResponses, AutomationsExperimentsGetData, AutomationsExperimentsGetError, AutomationsExperimentsGetErrors, AutomationsExperimentsGetResponse, AutomationsExperimentsGetResponses, AutomationsExperimentsListData, AutomationsExperimentsListError, AutomationsExperimentsListErrors, AutomationsExperimentsListResponse, AutomationsExperimentsListResponses, AutomationsGetData, AutomationsGetError, AutomationsGetErrors, AutomationsGetResponse, AutomationsGetResponses, AutomationsListData, AutomationsListError, AutomationsListErrors, AutomationsListResponse, AutomationsListResponses, AutomationsTriggersGetData, AutomationsTriggersGetError, AutomationsTriggersGetErrors, AutomationsTriggersGetResponse, AutomationsTriggersGetResponses, AutomationSummary, AutomationsVersionsListData, AutomationsVersionsListError, AutomationsVersionsListErrors, AutomationsVersionsListResponse, AutomationsVersionsListResponses, AutomationTriggersResponse, AutomationTriggerState, AutomationType, AutomationVersion, ClientOptions, CreateFileMultipartRequest, DatasetExample, DatasetExampleList, DatasetExampleMutation, DatasetExampleUpdate, DatasetImportResponse, DeleteFileResponse, EvalResult, EvalResultsResponse, EvaluatorConfigResponse, EvaluatorConfigUpdate, ExampleRunResponse, ExecutionStatus, Experiment, ExperimentCreate, ExperimentCreateResponse, ExperimentDetail, File, FilesContentGetData, FilesContentGetError, FilesContentGetErrors, FilesContentGetResponses, FilesCreateData, FilesCreateError, FilesCreateErrors, FilesCreateResponse, FilesCreateResponses, FilesDeleteData, FilesDeleteError, FilesDeleteErrors, FilesDeleteResponse, FilesDeleteResponses, FilesGetData, FilesGetError, FilesGetErrors, FilesGetResponse, FilesGetResponses, ListAutomationsResponse, ListAutomationVersionsResponse, PromoteRunRequest, PromoteRunResponse, Run, RunAccepted, RunArtifact, RunArtifactsResponse, RunCancelResponse, RunDebug, RunError, RunEval, RunEvent, RunEventsResponse, RunExecution, RunExecutionMeta, RunExecutionRetry, RunFeedback, RunFeedbackDetail, RunFeedbackRequest, RunFile, RunInput, RunListItem, RunRerunResponse, RunsArtifactsGetData, RunsArtifactsGetError, RunsArtifactsGetErrors, RunsArtifactsGetResponses, RunsArtifactsListData, RunsArtifactsListError, RunsArtifactsListErrors, RunsArtifactsListResponse, RunsArtifactsListResponses, RunsCancelData, RunsCancelError, RunsCancelErrors, RunsCancelResponse, RunsCancelResponses, RunsEvalResultsListData, RunsEvalResultsListError, RunsEvalResultsListErrors, RunsEvalResultsListResponse, RunsEvalResultsListResponses, RunsEventsListData, RunsEventsListError, RunsEventsListErrors, RunsEventsListResponse, RunsEventsListResponses, RunsFeedbackClearData, RunsFeedbackClearError, RunsFeedbackClearErrors, RunsFeedbackClearResponse, RunsFeedbackClearResponses, RunsFeedbackGetData, RunsFeedbackGetError, RunsFeedbackGetErrors, RunsFeedbackGetResponse, RunsFeedbackGetResponses, RunsFeedbackUpdateData, RunsFeedbackUpdateError, RunsFeedbackUpdateErrors, RunsFeedbackUpdateResponse, RunsFeedbackUpdateResponses, RunsGetData, RunsGetError, RunsGetErrors, RunsGetResponse, RunsGetResponses, RunsListData, RunsListError, RunsListErrors, RunsListResponse, RunsListResponse2, RunsListResponses, RunSource, RunSourceGit, RunsPromoteData, RunsPromoteError, RunsPromoteErrors, RunsPromoteResponse, RunsPromoteResponses, RunsRerunData, RunsRerunError, RunsRerunErrors, RunsRerunResponse, RunsRerunResponses, RunsStartData, RunsStartError, RunsStartErrors, RunsStartResponse, RunsStartResponses, RunsStepsListData, RunsStepsListError, RunsStepsListErrors, RunsStepsListResponse, RunsStepsListResponses, RunStartBody, RunStartMultipartRequest, RunStartResponse, RunStepsResponse, RunsTraceGetData, RunsTraceGetError, RunsTraceGetErrors, RunsTraceGetResponse, RunsTraceGetResponses, RunsUsageGetData, RunsUsageGetError, RunsUsageGetErrors, RunsUsageGetResponse, RunsUsageGetResponses, RunTiming, RunTrigger, RunUsage, RunUsageResponse, WorkflowRunExecution } from './types.gen';
|