@aexhq/sdk 0.28.1 → 0.30.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/README.md +80 -7
- package/dist/_contracts/event-guards.d.ts +67 -0
- package/dist/_contracts/event-guards.js +36 -0
- package/dist/_contracts/index.d.ts +2 -0
- package/dist/_contracts/index.js +6 -0
- package/dist/_contracts/run-config.d.ts +3 -3
- package/dist/_contracts/run-config.js +2 -2
- package/dist/_contracts/run-trace.d.ts +7 -0
- package/dist/_contracts/run-trace.js +9 -0
- package/dist/_contracts/runtime-sizes.d.ts +25 -79
- package/dist/_contracts/runtime-sizes.js +18 -39
- package/dist/_contracts/runtime-types.d.ts +31 -0
- package/dist/_contracts/submission.d.ts +40 -17
- package/dist/_contracts/submission.js +45 -18
- package/dist/agents-md.d.ts +4 -1
- package/dist/agents-md.js +10 -9
- package/dist/agents-md.js.map +1 -1
- package/dist/cli.mjs +17823 -3963
- package/dist/cli.mjs.sha256 +1 -1
- package/dist/client.d.ts +96 -17
- package/dist/client.js +238 -79
- package/dist/client.js.map +1 -1
- package/dist/data-tools.d.ts +23 -0
- package/dist/data-tools.js +102 -13
- package/dist/data-tools.js.map +1 -1
- package/dist/file.d.ts +4 -1
- package/dist/file.js +10 -9
- package/dist/file.js.map +1 -1
- package/dist/index.d.ts +9 -8
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/dist/skill.d.ts +8 -6
- package/dist/skill.js +14 -14
- package/dist/skill.js.map +1 -1
- package/dist/tool.d.ts +4 -1
- package/dist/tool.js +10 -8
- package/dist/tool.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/concepts/agent-tools.md +7 -3
- package/docs/concepts/runs.md +1 -1
- package/docs/defaults.md +3 -2
- package/docs/events.md +32 -9
- package/docs/limits-and-quotas.md +2 -2
- package/docs/networking.md +141 -0
- package/docs/quickstart.md +19 -10
- package/docs/run-config.md +2 -2
- package/examples/chat-corpus.ts +85 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ aex is an agent execution platform for launching autonomous agents from a simple
|
|
|
9
9
|
The package ships:
|
|
10
10
|
|
|
11
11
|
- `AgentExecutor` for submit, run, wait, stream, inspect, download, cancel, and delete.
|
|
12
|
-
- Typed run primitives: `Models`, `Providers`, `
|
|
12
|
+
- Typed run primitives: `Models`, `Providers`, `Regions`, `RuntimeSizes`, `Skill`, `AgentsMd`, `File`, `McpServer`, `ProxyEndpoint`, and `Secret`.
|
|
13
13
|
- A bundled `aex` CLI with the same run, status, events, outputs, download, cancel, delete, whoami, and skills operations.
|
|
14
14
|
|
|
15
15
|
## Install
|
|
@@ -21,17 +21,28 @@ bun add @aexhq/sdk
|
|
|
21
21
|
## First Run
|
|
22
22
|
|
|
23
23
|
```ts
|
|
24
|
-
import { AgentExecutor, Models
|
|
24
|
+
import { AgentExecutor, Models } from "@aexhq/sdk";
|
|
25
25
|
|
|
26
|
-
const aex = new AgentExecutor({
|
|
27
|
-
|
|
26
|
+
const aex = new AgentExecutor({ apiToken: process.env.AEX_API_TOKEN! });
|
|
27
|
+
|
|
28
|
+
// run() submits, waits for the run to settle, and returns the result —
|
|
29
|
+
// no manual poll loop. `provider` is derived from the model.
|
|
30
|
+
const { text, ok } = await aex.run({
|
|
31
|
+
model: Models.CLAUDE_HAIKU_4_5,
|
|
32
|
+
apiKey: process.env.ANTHROPIC_API_KEY!,
|
|
33
|
+
prompt: "Summarize this repo."
|
|
28
34
|
});
|
|
29
35
|
|
|
36
|
+
console.log(ok, text);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Need the run id, live events, or downloads? Use `submit` + `stream` + `wait`:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
30
42
|
const runId = await aex.submit({
|
|
31
|
-
provider: Providers.ANTHROPIC,
|
|
32
43
|
model: Models.CLAUDE_HAIKU_4_5,
|
|
33
|
-
|
|
34
|
-
|
|
44
|
+
apiKey: process.env.ANTHROPIC_API_KEY!,
|
|
45
|
+
prompt: "Write the report and save outputs."
|
|
35
46
|
});
|
|
36
47
|
|
|
37
48
|
for await (const event of aex.stream(runId)) {
|
|
@@ -44,6 +55,17 @@ console.log(run.status);
|
|
|
44
55
|
await aex.download(runId, { to: "./run.zip" });
|
|
45
56
|
```
|
|
46
57
|
|
|
58
|
+
For multiple providers (e.g. subagents on a different model family), pass a
|
|
59
|
+
`credentials` map instead of `apiKey`:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
await aex.run({
|
|
63
|
+
model: Models.CLAUDE_HAIKU_4_5,
|
|
64
|
+
credentials: { anthropic: process.env.ANTHROPIC_API_KEY!, openai: process.env.OPENAI_API_KEY! },
|
|
65
|
+
prompt: "Delegate research to a subagent."
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
47
69
|
The same request can run from the CLI:
|
|
48
70
|
|
|
49
71
|
```bash
|
|
@@ -55,6 +77,57 @@ aex run \
|
|
|
55
77
|
--follow
|
|
56
78
|
```
|
|
57
79
|
|
|
80
|
+
## CLI: login, discovery, typed errors
|
|
81
|
+
|
|
82
|
+
Stop re-passing `--api-token` on every command — log in once and the token (plus
|
|
83
|
+
your default `--aex-url`) is persisted to a `0600` config file
|
|
84
|
+
(`$XDG_CONFIG_HOME/aex/config.json` or `~/.config/aex/config.json`; `%APPDATA%\aex\config.json`
|
|
85
|
+
on Windows). An explicit `--api-token` flag always overrides the stored one.
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
aex login --api-token "$AEX_API_TOKEN" [--aex-url https://api.aex.dev]
|
|
89
|
+
aex whoami # no --api-token needed after login
|
|
90
|
+
aex auth status # show the resolved config (the token value is never printed)
|
|
91
|
+
aex logout # clear the stored token
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Discover the closed sets the platform accepts — no token, no network (human table
|
|
95
|
+
by default, machine JSON under `--json`):
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
aex models list # canonical models + their default provider
|
|
99
|
+
aex providers list # providers + the models each serves
|
|
100
|
+
aex tools list # builtin tools (default vs opt-in, e.g. notebook_edit)
|
|
101
|
+
aex runtime-sizes list # managed runtime presets (cpus / memory / default)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Errors are typed and actionable. Every `submit()` config-validation failure throws
|
|
105
|
+
a `RunConfigValidationError` (`err.code === "RUN_CONFIG_INVALID"`) you can `catch`
|
|
106
|
+
by code; CLI failures print a JSON envelope carrying the HTTP `status`, a one-line
|
|
107
|
+
`remedy`, and the `runId` where known, and a wrong `--model`/`--provider`/
|
|
108
|
+
`--runtime-size`/`--region` gets a "did you mean?" suggestion.
|
|
109
|
+
|
|
110
|
+
## Chat over a corpus of runs
|
|
111
|
+
|
|
112
|
+
Turn a selected set of runs into a read-only chat. `createCorpusTools(client, { runIds })`
|
|
113
|
+
returns vendor-neutral, corpus-scoped read tools (`list_runs` / `get_run` /
|
|
114
|
+
`list_outputs` / `read_output` / `search_outputs`) — every tool refuses a run
|
|
115
|
+
outside the corpus. Drive them with any LLM; `examples/chat-corpus.ts` shows the
|
|
116
|
+
direct-Claude loop (`@anthropic-ai/sdk`), and the CLI ships it as a one-shot
|
|
117
|
+
command (BYOK; the importable SDK stays LLM-vendor-free):
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
aex chat --run run_<A> --run run_<B> \
|
|
121
|
+
--anthropic-api-key "$ANTHROPIC_API_KEY" \
|
|
122
|
+
--model claude-opus-4-8 \
|
|
123
|
+
--prompt "Across these runs, which produced a report.md and what's its headline finding?" \
|
|
124
|
+
--api-token "$AEX_API_TOKEN"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
`AgentExecutor.searchOutputs({ runIds, filename, extension, contentType, limit })`
|
|
128
|
+
finds output files across runs and returns references (no bytes) you then
|
|
129
|
+
`readOutputText`.
|
|
130
|
+
|
|
58
131
|
## Feature Areas
|
|
59
132
|
|
|
60
133
|
- **Agent runtime:** managed autonomous runs with filesystem read/edit, grep/glob/head/tail, open web fetch/search defaults, optional notebook tools, and post-hook repair.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-narrowing guards over the loose {@link RunEvent} `listEvents` shape.
|
|
3
|
+
*
|
|
4
|
+
* The envelope guards in `event-envelope.ts` operate on the coordinator
|
|
5
|
+
* {@link import("./event-envelope.js").AexEvent} and return a plain `boolean`.
|
|
6
|
+
* These mirror the same AG-UI discriminants but operate on the {@link RunEvent}
|
|
7
|
+
* snapshot shape returned by `listEvents` / `RunResult.events` and NARROW
|
|
8
|
+
* `event.data` to the fields that event type carries, so a consumer reads
|
|
9
|
+
* `event.data.text` (etc.) without a manual cast.
|
|
10
|
+
*
|
|
11
|
+
* They are DISCRIMINANT-only at runtime (they test `event.type`), matching the
|
|
12
|
+
* envelope guards: the narrowed `data` shape is a typing convenience, not a deep
|
|
13
|
+
* runtime validation. Parse/verify the payload fields before trusting them when
|
|
14
|
+
* the producer is untrusted.
|
|
15
|
+
*
|
|
16
|
+
* The parameter is the minimal `{ type }` discriminant both the {@link RunEvent}
|
|
17
|
+
* snapshot and the coordinator `AexEvent` envelope satisfy, so the guards accept
|
|
18
|
+
* either shape while narrowing to the {@link RunEvent}-typed payloads.
|
|
19
|
+
*/
|
|
20
|
+
import type { RunEvent } from "./runtime-types.js";
|
|
21
|
+
/** A `TEXT_MESSAGE_CONTENT` run event with its assistant-text payload narrowed. */
|
|
22
|
+
export interface TextMessageRunEvent extends RunEvent {
|
|
23
|
+
readonly type: "TEXT_MESSAGE_CONTENT";
|
|
24
|
+
readonly data: {
|
|
25
|
+
readonly text: string;
|
|
26
|
+
readonly messageId?: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** A `TOOL_CALL_START` run event with the tool-call id/name/args narrowed. */
|
|
30
|
+
export interface ToolCallStartRunEvent extends RunEvent {
|
|
31
|
+
readonly type: "TOOL_CALL_START";
|
|
32
|
+
readonly data: {
|
|
33
|
+
readonly id: string;
|
|
34
|
+
readonly name: string;
|
|
35
|
+
readonly arguments?: Record<string, unknown>;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** A `TOOL_CALL_RESULT` run event with the correlating id + result narrowed. */
|
|
39
|
+
export interface ToolCallResultRunEvent extends RunEvent {
|
|
40
|
+
readonly type: "TOOL_CALL_RESULT";
|
|
41
|
+
readonly data: {
|
|
42
|
+
readonly id: string;
|
|
43
|
+
readonly content?: unknown;
|
|
44
|
+
readonly isError?: boolean;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/** A terminal `RUN_FINISHED` run event. */
|
|
48
|
+
export interface RunFinishedRunEvent extends RunEvent {
|
|
49
|
+
readonly type: "RUN_FINISHED";
|
|
50
|
+
readonly data: Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
/** True for an assistant text event; narrows `event.data.text` to `string`. */
|
|
53
|
+
export declare function isTextMessage(event: {
|
|
54
|
+
readonly type: string;
|
|
55
|
+
}): event is TextMessageRunEvent;
|
|
56
|
+
/** True for a tool-call start event; narrows `event.data` to `{ id, name }`. */
|
|
57
|
+
export declare function isToolCallStart(event: {
|
|
58
|
+
readonly type: string;
|
|
59
|
+
}): event is ToolCallStartRunEvent;
|
|
60
|
+
/** True for a tool-call result event; narrows `event.data` to `{ id, content }`. */
|
|
61
|
+
export declare function isToolCallResult(event: {
|
|
62
|
+
readonly type: string;
|
|
63
|
+
}): event is ToolCallResultRunEvent;
|
|
64
|
+
/** True for the terminal success event; narrows `event.data` to a record. */
|
|
65
|
+
export declare function isRunFinished(event: {
|
|
66
|
+
readonly type: string;
|
|
67
|
+
}): event is RunFinishedRunEvent;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-narrowing guards over the loose {@link RunEvent} `listEvents` shape.
|
|
3
|
+
*
|
|
4
|
+
* The envelope guards in `event-envelope.ts` operate on the coordinator
|
|
5
|
+
* {@link import("./event-envelope.js").AexEvent} and return a plain `boolean`.
|
|
6
|
+
* These mirror the same AG-UI discriminants but operate on the {@link RunEvent}
|
|
7
|
+
* snapshot shape returned by `listEvents` / `RunResult.events` and NARROW
|
|
8
|
+
* `event.data` to the fields that event type carries, so a consumer reads
|
|
9
|
+
* `event.data.text` (etc.) without a manual cast.
|
|
10
|
+
*
|
|
11
|
+
* They are DISCRIMINANT-only at runtime (they test `event.type`), matching the
|
|
12
|
+
* envelope guards: the narrowed `data` shape is a typing convenience, not a deep
|
|
13
|
+
* runtime validation. Parse/verify the payload fields before trusting them when
|
|
14
|
+
* the producer is untrusted.
|
|
15
|
+
*
|
|
16
|
+
* The parameter is the minimal `{ type }` discriminant both the {@link RunEvent}
|
|
17
|
+
* snapshot and the coordinator `AexEvent` envelope satisfy, so the guards accept
|
|
18
|
+
* either shape while narrowing to the {@link RunEvent}-typed payloads.
|
|
19
|
+
*/
|
|
20
|
+
/** True for an assistant text event; narrows `event.data.text` to `string`. */
|
|
21
|
+
export function isTextMessage(event) {
|
|
22
|
+
return event.type === "TEXT_MESSAGE_CONTENT";
|
|
23
|
+
}
|
|
24
|
+
/** True for a tool-call start event; narrows `event.data` to `{ id, name }`. */
|
|
25
|
+
export function isToolCallStart(event) {
|
|
26
|
+
return event.type === "TOOL_CALL_START";
|
|
27
|
+
}
|
|
28
|
+
/** True for a tool-call result event; narrows `event.data` to `{ id, content }`. */
|
|
29
|
+
export function isToolCallResult(event) {
|
|
30
|
+
return event.type === "TOOL_CALL_RESULT";
|
|
31
|
+
}
|
|
32
|
+
/** True for the terminal success event; narrows `event.data` to a record. */
|
|
33
|
+
export function isRunFinished(event) {
|
|
34
|
+
return event.type === "RUN_FINISHED";
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=event-guards.js.map
|
|
@@ -29,3 +29,5 @@ export * from "./run-artifacts.js";
|
|
|
29
29
|
export * as operations from "./operations.js";
|
|
30
30
|
export * from "./proxy-validation.js";
|
|
31
31
|
export * from "./sse.js";
|
|
32
|
+
export { isRunFinished, isTextMessage, isToolCallResult, isToolCallStart } from "./event-guards.js";
|
|
33
|
+
export type { RunFinishedRunEvent, TextMessageRunEvent, ToolCallResultRunEvent, ToolCallStartRunEvent } from "./event-guards.js";
|
package/dist/_contracts/index.js
CHANGED
|
@@ -29,4 +29,10 @@ export * from "./run-artifacts.js";
|
|
|
29
29
|
export * as operations from "./operations.js";
|
|
30
30
|
export * from "./proxy-validation.js";
|
|
31
31
|
export * from "./sse.js";
|
|
32
|
+
// Explicit re-export (shadows the same-named `AexEvent` guards from
|
|
33
|
+
// `event-envelope.js`): the public `is*` guards narrow the loose `RunEvent`
|
|
34
|
+
// snapshot shape `listEvents` returns. An `AexEvent` is assignable to `RunEvent`,
|
|
35
|
+
// so envelope consumers keep working; the envelope-typed guards stay reachable
|
|
36
|
+
// via the direct `event-envelope.js` module.
|
|
37
|
+
export { isRunFinished, isTextMessage, isToolCallResult, isToolCallStart } from "./event-guards.js";
|
|
32
38
|
//# sourceMappingURL=index.js.map
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* Keep this as the public source of truth for the SDK/CLI composition
|
|
31
31
|
* boundary.
|
|
32
32
|
*/
|
|
33
|
-
import { type JsonValue, type PlatformProxyEndpoint, type PlatformEnvironment, type
|
|
33
|
+
import { type JsonValue, type PlatformProxyEndpoint, type PlatformEnvironment, type Region } from "./submission.js";
|
|
34
34
|
import { type RunModel } from "./models.js";
|
|
35
35
|
import type { RuntimeSize } from "./runtime-sizes.js";
|
|
36
36
|
import { type PlatformPostHookInput } from "./post-hook.js";
|
|
@@ -308,8 +308,8 @@ export interface RunRequestConfig {
|
|
|
308
308
|
readonly environment?: PlatformEnvironment;
|
|
309
309
|
/** Managed runtime size preset (see {@link RuntimeSize}). */
|
|
310
310
|
readonly runtimeSize?: RuntimeSize;
|
|
311
|
-
/** Product placement
|
|
312
|
-
readonly region?:
|
|
311
|
+
/** Product placement region. Omitted lets the hosted platform infer/fallback. */
|
|
312
|
+
readonly region?: Region;
|
|
313
313
|
/** Run deadline as a duration string (`"1h"`, `"30m"`); bounded [1m, 6h] server-side. */
|
|
314
314
|
readonly timeout?: string;
|
|
315
315
|
/** Post-agent-run verifier command. Empty command is treated as omitted. */
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* Keep this as the public source of truth for the SDK/CLI composition
|
|
31
31
|
* boundary.
|
|
32
32
|
*/
|
|
33
|
-
import {
|
|
33
|
+
import { parseRegion, } from "./submission.js";
|
|
34
34
|
import { parseRunModel } from "./models.js";
|
|
35
35
|
import { parsePostHook } from "./post-hook.js";
|
|
36
36
|
// ---------------------------------------------------------------------------
|
|
@@ -670,7 +670,7 @@ export function parseRunRequestConfig(input) {
|
|
|
670
670
|
const prompt = parseRunRequestConfigPrompt(record.prompt);
|
|
671
671
|
const skills = parseRunRequestConfigSkills(record.skills);
|
|
672
672
|
const mcpServers = parseRunRequestConfigMcpServers(record.mcpServers);
|
|
673
|
-
const region =
|
|
673
|
+
const region = parseRegion(record.region);
|
|
674
674
|
const postHook = parsePostHook(record.postHook, "run request config postHook");
|
|
675
675
|
return {
|
|
676
676
|
model,
|
|
@@ -96,6 +96,13 @@ export declare function decodeToolCalls(events: readonly TraceEvent[]): readonly
|
|
|
96
96
|
* `totalTokens` is the sum of input + output tokens. Pure.
|
|
97
97
|
*/
|
|
98
98
|
export declare function summarizeRunUsage(events: readonly TraceEvent[]): UsageSummary;
|
|
99
|
+
/**
|
|
100
|
+
* The run's final assistant text: every `TEXT_MESSAGE_CONTENT` block in stream
|
|
101
|
+
* order, concatenated. The one-line "what did the agent say" accessor over
|
|
102
|
+
* {@link decodeAssistantText} (buffered mode yields whole messages, stream mode
|
|
103
|
+
* yields token deltas — both concatenate correctly). Pure.
|
|
104
|
+
*/
|
|
105
|
+
export declare function textOf(events: readonly TraceEvent[]): string;
|
|
99
106
|
/** Decode the assistant text blocks (`TEXT_MESSAGE_CONTENT`) in stream order. Pure. */
|
|
100
107
|
export declare function decodeAssistantText(events: readonly TraceEvent[]): readonly AssistantTextEntry[];
|
|
101
108
|
/**
|
|
@@ -123,6 +123,15 @@ export function summarizeRunUsage(events) {
|
|
|
123
123
|
totalTokens: totals.inputTokens + totals.outputTokens
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* The run's final assistant text: every `TEXT_MESSAGE_CONTENT` block in stream
|
|
128
|
+
* order, concatenated. The one-line "what did the agent say" accessor over
|
|
129
|
+
* {@link decodeAssistantText} (buffered mode yields whole messages, stream mode
|
|
130
|
+
* yields token deltas — both concatenate correctly). Pure.
|
|
131
|
+
*/
|
|
132
|
+
export function textOf(events) {
|
|
133
|
+
return decodeAssistantText(events).map((entry) => entry.text).join("");
|
|
134
|
+
}
|
|
126
135
|
/** Decode the assistant text blocks (`TEXT_MESSAGE_CONTENT`) in stream order. Pure. */
|
|
127
136
|
export function decodeAssistantText(events) {
|
|
128
137
|
const out = [];
|
|
@@ -11,106 +11,52 @@ export interface RuntimeResources {
|
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* The single source of truth: every offered preset, keyed by its wire token.
|
|
14
|
-
* Tokens intentionally remain stable product presets.
|
|
14
|
+
* Tokens intentionally remain stable product presets. The smallest
|
|
15
|
+
* (`shared-0.06x-256mb`) tier is for light / IO-bound runs only.
|
|
15
16
|
*/
|
|
16
17
|
export declare const RUNTIME_SIZE_PRESETS: {
|
|
17
|
-
readonly "shared-
|
|
18
|
-
readonly cpus:
|
|
19
|
-
readonly memoryMb: 128;
|
|
20
|
-
};
|
|
21
|
-
readonly "shared-1x-256mb": {
|
|
22
|
-
readonly cpus: 1;
|
|
18
|
+
readonly "shared-0.06x-256mb": {
|
|
19
|
+
readonly cpus: 0.0625;
|
|
23
20
|
readonly memoryMb: 256;
|
|
24
21
|
};
|
|
25
|
-
readonly "shared-
|
|
26
|
-
readonly cpus:
|
|
27
|
-
readonly memoryMb: 512;
|
|
28
|
-
};
|
|
29
|
-
readonly "shared-1x-1gb": {
|
|
30
|
-
readonly cpus: 1;
|
|
31
|
-
readonly memoryMb: 1024;
|
|
32
|
-
};
|
|
33
|
-
readonly "shared-1x-2gb": {
|
|
34
|
-
readonly cpus: 1;
|
|
35
|
-
readonly memoryMb: 2048;
|
|
36
|
-
};
|
|
37
|
-
readonly "shared-2x-512mb": {
|
|
38
|
-
readonly cpus: 2;
|
|
39
|
-
readonly memoryMb: 512;
|
|
40
|
-
};
|
|
41
|
-
readonly "shared-2x-1gb": {
|
|
42
|
-
readonly cpus: 2;
|
|
43
|
-
readonly memoryMb: 1024;
|
|
44
|
-
};
|
|
45
|
-
readonly "shared-2x-2gb": {
|
|
46
|
-
readonly cpus: 2;
|
|
47
|
-
readonly memoryMb: 2048;
|
|
48
|
-
};
|
|
49
|
-
readonly "shared-2x-4gb": {
|
|
50
|
-
readonly cpus: 2;
|
|
51
|
-
readonly memoryMb: 4096;
|
|
52
|
-
};
|
|
53
|
-
readonly "shared-4x-1gb": {
|
|
54
|
-
readonly cpus: 4;
|
|
22
|
+
readonly "shared-0.25x-1gb": {
|
|
23
|
+
readonly cpus: 0.25;
|
|
55
24
|
readonly memoryMb: 1024;
|
|
56
25
|
};
|
|
57
|
-
readonly "shared-
|
|
58
|
-
readonly cpus:
|
|
59
|
-
readonly memoryMb: 2048;
|
|
60
|
-
};
|
|
61
|
-
readonly "shared-4x-4gb": {
|
|
62
|
-
readonly cpus: 4;
|
|
26
|
+
readonly "shared-0.5x-4gb": {
|
|
27
|
+
readonly cpus: 0.5;
|
|
63
28
|
readonly memoryMb: 4096;
|
|
64
29
|
};
|
|
65
|
-
readonly "shared-
|
|
66
|
-
readonly cpus:
|
|
67
|
-
readonly memoryMb:
|
|
68
|
-
};
|
|
69
|
-
readonly "shared-8x-2gb": {
|
|
70
|
-
readonly cpus: 8;
|
|
71
|
-
readonly memoryMb: 2048;
|
|
72
|
-
};
|
|
73
|
-
readonly "shared-8x-4gb": {
|
|
74
|
-
readonly cpus: 8;
|
|
75
|
-
readonly memoryMb: 4096;
|
|
30
|
+
readonly "shared-1x-6gb": {
|
|
31
|
+
readonly cpus: 1;
|
|
32
|
+
readonly memoryMb: 6144;
|
|
76
33
|
};
|
|
77
|
-
readonly "shared-
|
|
78
|
-
readonly cpus:
|
|
34
|
+
readonly "shared-2x-8gb": {
|
|
35
|
+
readonly cpus: 2;
|
|
79
36
|
readonly memoryMb: 8192;
|
|
80
37
|
};
|
|
81
|
-
readonly "shared-
|
|
82
|
-
readonly cpus:
|
|
83
|
-
readonly memoryMb:
|
|
38
|
+
readonly "shared-4x-12gb": {
|
|
39
|
+
readonly cpus: 4;
|
|
40
|
+
readonly memoryMb: 12288;
|
|
84
41
|
};
|
|
85
42
|
};
|
|
86
43
|
/** The accepted runtime-size values (the wire/CLI tokens). */
|
|
87
44
|
export type RuntimeSize = keyof typeof RUNTIME_SIZE_PRESETS;
|
|
88
45
|
/** All preset tokens, ordered as declared. Handy for CLI help + validation. */
|
|
89
46
|
export declare const RUNTIME_SIZES: readonly RuntimeSize[];
|
|
90
|
-
/** Default when `runtimeSize` is omitted. */
|
|
47
|
+
/** Default when `runtimeSize` is omitted (the 1 GB tier). */
|
|
91
48
|
export declare const DEFAULT_RUNTIME_SIZE: RuntimeSize;
|
|
92
49
|
/**
|
|
93
|
-
* Symbol-style accessors for TS callers. `RuntimeSizes.
|
|
94
|
-
* resolves to the wire token `"shared-2x-
|
|
50
|
+
* Symbol-style accessors for TS callers. `RuntimeSizes.SHARED_2X_8GB`
|
|
51
|
+
* resolves to the wire token `"shared-2x-8gb"`.
|
|
95
52
|
*/
|
|
96
53
|
export declare const RuntimeSizes: {
|
|
97
|
-
readonly
|
|
98
|
-
readonly
|
|
99
|
-
readonly
|
|
100
|
-
readonly
|
|
101
|
-
readonly
|
|
102
|
-
readonly
|
|
103
|
-
readonly SHARED_2X_1GB: "shared-2x-1gb";
|
|
104
|
-
readonly SHARED_2X_2GB: "shared-2x-2gb";
|
|
105
|
-
readonly SHARED_2X_4GB: "shared-2x-4gb";
|
|
106
|
-
readonly SHARED_4X_1GB: "shared-4x-1gb";
|
|
107
|
-
readonly SHARED_4X_2GB: "shared-4x-2gb";
|
|
108
|
-
readonly SHARED_4X_4GB: "shared-4x-4gb";
|
|
109
|
-
readonly SHARED_4X_8GB: "shared-4x-8gb";
|
|
110
|
-
readonly SHARED_8X_2GB: "shared-8x-2gb";
|
|
111
|
-
readonly SHARED_8X_4GB: "shared-8x-4gb";
|
|
112
|
-
readonly SHARED_8X_8GB: "shared-8x-8gb";
|
|
113
|
-
readonly SHARED_8X_16GB: "shared-8x-16gb";
|
|
54
|
+
readonly SHARED_0_06X_256MB: "shared-0.06x-256mb";
|
|
55
|
+
readonly SHARED_0_25X_1GB: "shared-0.25x-1gb";
|
|
56
|
+
readonly SHARED_0_5X_4GB: "shared-0.5x-4gb";
|
|
57
|
+
readonly SHARED_1X_6GB: "shared-1x-6gb";
|
|
58
|
+
readonly SHARED_2X_8GB: "shared-2x-8gb";
|
|
59
|
+
readonly SHARED_4X_12GB: "shared-4x-12gb";
|
|
114
60
|
};
|
|
115
61
|
/** Resolve a preset token to its product-level resource descriptor. */
|
|
116
62
|
export declare function runtimeResources(size: RuntimeSize): RuntimeResources;
|
|
@@ -7,53 +7,32 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* The single source of truth: every offered preset, keyed by its wire token.
|
|
10
|
-
* Tokens intentionally remain stable product presets.
|
|
10
|
+
* Tokens intentionally remain stable product presets. The smallest
|
|
11
|
+
* (`shared-0.06x-256mb`) tier is for light / IO-bound runs only.
|
|
11
12
|
*/
|
|
12
13
|
export const RUNTIME_SIZE_PRESETS = {
|
|
13
|
-
"shared-
|
|
14
|
-
"shared-
|
|
15
|
-
"shared-
|
|
16
|
-
"shared-1x-
|
|
17
|
-
"shared-
|
|
18
|
-
"shared-
|
|
19
|
-
"shared-2x-1gb": { cpus: 2, memoryMb: 1024 },
|
|
20
|
-
"shared-2x-2gb": { cpus: 2, memoryMb: 2048 },
|
|
21
|
-
"shared-2x-4gb": { cpus: 2, memoryMb: 4096 },
|
|
22
|
-
"shared-4x-1gb": { cpus: 4, memoryMb: 1024 },
|
|
23
|
-
"shared-4x-2gb": { cpus: 4, memoryMb: 2048 },
|
|
24
|
-
"shared-4x-4gb": { cpus: 4, memoryMb: 4096 },
|
|
25
|
-
"shared-4x-8gb": { cpus: 4, memoryMb: 8192 },
|
|
26
|
-
"shared-8x-2gb": { cpus: 8, memoryMb: 2048 },
|
|
27
|
-
"shared-8x-4gb": { cpus: 8, memoryMb: 4096 },
|
|
28
|
-
"shared-8x-8gb": { cpus: 8, memoryMb: 8192 },
|
|
29
|
-
"shared-8x-16gb": { cpus: 8, memoryMb: 16384 }
|
|
14
|
+
"shared-0.06x-256mb": { cpus: 0.0625, memoryMb: 256 },
|
|
15
|
+
"shared-0.25x-1gb": { cpus: 0.25, memoryMb: 1024 },
|
|
16
|
+
"shared-0.5x-4gb": { cpus: 0.5, memoryMb: 4096 },
|
|
17
|
+
"shared-1x-6gb": { cpus: 1, memoryMb: 6144 },
|
|
18
|
+
"shared-2x-8gb": { cpus: 2, memoryMb: 8192 },
|
|
19
|
+
"shared-4x-12gb": { cpus: 4, memoryMb: 12288 }
|
|
30
20
|
};
|
|
31
21
|
/** All preset tokens, ordered as declared. Handy for CLI help + validation. */
|
|
32
22
|
export const RUNTIME_SIZES = Object.keys(RUNTIME_SIZE_PRESETS);
|
|
33
|
-
/** Default when `runtimeSize` is omitted. */
|
|
34
|
-
export const DEFAULT_RUNTIME_SIZE = "shared-
|
|
23
|
+
/** Default when `runtimeSize` is omitted (the 1 GB tier). */
|
|
24
|
+
export const DEFAULT_RUNTIME_SIZE = "shared-0.25x-1gb";
|
|
35
25
|
/**
|
|
36
|
-
* Symbol-style accessors for TS callers. `RuntimeSizes.
|
|
37
|
-
* resolves to the wire token `"shared-2x-
|
|
26
|
+
* Symbol-style accessors for TS callers. `RuntimeSizes.SHARED_2X_8GB`
|
|
27
|
+
* resolves to the wire token `"shared-2x-8gb"`.
|
|
38
28
|
*/
|
|
39
29
|
export const RuntimeSizes = {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
SHARED_2X_1GB: "shared-2x-1gb",
|
|
47
|
-
SHARED_2X_2GB: "shared-2x-2gb",
|
|
48
|
-
SHARED_2X_4GB: "shared-2x-4gb",
|
|
49
|
-
SHARED_4X_1GB: "shared-4x-1gb",
|
|
50
|
-
SHARED_4X_2GB: "shared-4x-2gb",
|
|
51
|
-
SHARED_4X_4GB: "shared-4x-4gb",
|
|
52
|
-
SHARED_4X_8GB: "shared-4x-8gb",
|
|
53
|
-
SHARED_8X_2GB: "shared-8x-2gb",
|
|
54
|
-
SHARED_8X_4GB: "shared-8x-4gb",
|
|
55
|
-
SHARED_8X_8GB: "shared-8x-8gb",
|
|
56
|
-
SHARED_8X_16GB: "shared-8x-16gb"
|
|
30
|
+
SHARED_0_06X_256MB: "shared-0.06x-256mb",
|
|
31
|
+
SHARED_0_25X_1GB: "shared-0.25x-1gb",
|
|
32
|
+
SHARED_0_5X_4GB: "shared-0.5x-4gb",
|
|
33
|
+
SHARED_1X_6GB: "shared-1x-6gb",
|
|
34
|
+
SHARED_2X_8GB: "shared-2x-8gb",
|
|
35
|
+
SHARED_4X_12GB: "shared-4x-12gb"
|
|
57
36
|
};
|
|
58
37
|
/** Resolve a preset token to its product-level resource descriptor. */
|
|
59
38
|
export function runtimeResources(size) {
|
|
@@ -79,6 +79,37 @@ export interface RunListPage {
|
|
|
79
79
|
readonly runs: readonly RunSummary[];
|
|
80
80
|
readonly nextCursor?: string;
|
|
81
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Cross-run output search query (`AgentExecutor.searchOutputs`). Restrict to a
|
|
84
|
+
* corpus with `runIds`; filter by filename substring / extension / content type.
|
|
85
|
+
* The MVP composes this client-side (per-run `listOutputs` + filter) — a future
|
|
86
|
+
* server-side `GET /api/outputs/search` can back the same contract with a real
|
|
87
|
+
* cross-run index, body-only swap.
|
|
88
|
+
*/
|
|
89
|
+
export interface OutputSearchQuery {
|
|
90
|
+
/** Restrict the search to these runs (the chat corpus allow-list). */
|
|
91
|
+
readonly runIds?: readonly string[];
|
|
92
|
+
/** Case-insensitive substring match on the output filename. */
|
|
93
|
+
readonly filename?: string;
|
|
94
|
+
/** File extension, with or without a leading dot. Case-insensitive. */
|
|
95
|
+
readonly extension?: string;
|
|
96
|
+
/** Exact content type or a prefix wildcard such as `image/*`. */
|
|
97
|
+
readonly contentType?: string;
|
|
98
|
+
/** Cap the number of hits returned (default 100). */
|
|
99
|
+
readonly limit?: number;
|
|
100
|
+
}
|
|
101
|
+
/** One output-search hit — a reference only (no bytes); read with `readOutputText`. */
|
|
102
|
+
export interface OutputSearchHit {
|
|
103
|
+
readonly runId: string;
|
|
104
|
+
readonly outputId: string;
|
|
105
|
+
readonly filename?: string;
|
|
106
|
+
readonly sizeBytes?: number;
|
|
107
|
+
readonly contentType?: string;
|
|
108
|
+
}
|
|
109
|
+
/** A page of output-search hits. */
|
|
110
|
+
export interface OutputSearchPage {
|
|
111
|
+
readonly hits: readonly OutputSearchHit[];
|
|
112
|
+
}
|
|
82
113
|
/**
|
|
83
114
|
* A run event as recorded by the dashboard. Includes the `type` field
|
|
84
115
|
* that the `is*Event` type guards narrow on plus any provider payload.
|
|
@@ -138,19 +138,28 @@ export declare const Providers: {
|
|
|
138
138
|
readonly DOUBAO_CN: "doubao-cn";
|
|
139
139
|
};
|
|
140
140
|
/**
|
|
141
|
-
* Product placement
|
|
142
|
-
* city guarantees: the hosted platform maps
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
141
|
+
* Product placement regions accepted on run submission. These are
|
|
142
|
+
* product-level tokens, not exact city guarantees: the hosted platform maps
|
|
143
|
+
* each region to co-located managed Postgres, object storage, run-state
|
|
144
|
+
* placement, and sandbox backing.
|
|
145
|
+
*
|
|
146
|
+
* eu-west → London (Western Europe)
|
|
147
|
+
* us-west → N. California (Western North America)
|
|
148
|
+
* ap-northeast → Seoul (Northeast Asia)
|
|
149
|
+
*
|
|
150
|
+
* Prefer the {@link Regions} accessors over raw strings so a typo is a compile
|
|
151
|
+
* error, not a runtime 400.
|
|
152
|
+
*/
|
|
153
|
+
export declare const REGIONS: readonly ["eu-west", "us-west", "ap-northeast"];
|
|
154
|
+
export type Region = (typeof REGIONS)[number];
|
|
155
|
+
/** Symbol-style accessors for the closed region set — e.g. `Regions.EU_WEST`. */
|
|
156
|
+
export declare const Regions: {
|
|
157
|
+
/** Western Europe — London. */
|
|
158
|
+
readonly EU_WEST: "eu-west";
|
|
159
|
+
/** Western North America — N. California. */
|
|
160
|
+
readonly US_WEST: "us-west";
|
|
161
|
+
/** Northeast Asia — Seoul. */
|
|
162
|
+
readonly AP_NORTHEAST: "ap-northeast";
|
|
154
163
|
};
|
|
155
164
|
/**
|
|
156
165
|
* Customer-facing runtime selector. Optional on the wire; absent resolves
|
|
@@ -315,6 +324,11 @@ export declare function requireString(input: unknown, field: string): string;
|
|
|
315
324
|
export declare function optionalString(input: unknown, field: string): string | undefined;
|
|
316
325
|
export declare function optionalEnum<const T extends readonly string[]>(input: unknown, field: string, allowed: T): T[number] | undefined;
|
|
317
326
|
export declare function optionalPositiveInt(input: unknown, field: string): number | undefined;
|
|
327
|
+
/**
|
|
328
|
+
* A finite positive NUMBER (fractional allowed — e.g. a USD amount like `2.5`), or
|
|
329
|
+
* undefined when absent. Rejects non-numbers, NaN/Infinity, and `<= 0`.
|
|
330
|
+
*/
|
|
331
|
+
export declare function optionalPositiveNumber(input: unknown, field: string): number | undefined;
|
|
318
332
|
/**
|
|
319
333
|
* Wire-level submission posted to /api/runs in the flat surface. The
|
|
320
334
|
* `prompt` is always an array internally so the worker, the audit log,
|
|
@@ -444,7 +458,7 @@ export interface PlatformRunSubmissionRequest {
|
|
|
444
458
|
* falls back to its default region. Accepted tokens do not promise exact
|
|
445
459
|
* city-level placement.
|
|
446
460
|
*/
|
|
447
|
-
readonly region?:
|
|
461
|
+
readonly region?: Region;
|
|
448
462
|
readonly submission: PlatformSubmission;
|
|
449
463
|
readonly secrets: PlatformInlineSecrets;
|
|
450
464
|
readonly proxyEndpoints?: readonly PlatformProxyEndpoint[];
|
|
@@ -508,6 +522,15 @@ export interface RunWebhookSpec {
|
|
|
508
522
|
export interface RunLimits {
|
|
509
523
|
readonly maxConcurrentChildRuns?: number;
|
|
510
524
|
readonly maxSubagentDepth?: number;
|
|
525
|
+
/**
|
|
526
|
+
* Per-run spend cap in USD (defense-in-depth). The platform converts it to a
|
|
527
|
+
* wall-clock budget (priced compute is wall-time; BYOK provider tokens cost the
|
|
528
|
+
* platform nothing) and kills the run once it would out-spend the cap. A
|
|
529
|
+
* positive number; omitted ⇒ unbounded per-run (only the run's wall-clock
|
|
530
|
+
* `timeout` + the per-workspace spend cap apply). Only shape/positivity are
|
|
531
|
+
* validated here.
|
|
532
|
+
*/
|
|
533
|
+
readonly maxSpendUsd?: number;
|
|
511
534
|
}
|
|
512
535
|
/**
|
|
513
536
|
* Wire shape posted by the SDK and CLI. `workspaceId` is **omitted by
|
|
@@ -533,10 +556,10 @@ export type PlatformRunSubmissionInput = Omit<PlatformRunSubmissionRequest, "wor
|
|
|
533
556
|
*/
|
|
534
557
|
readonly runtime?: RuntimeKind;
|
|
535
558
|
/**
|
|
536
|
-
* Optional product placement
|
|
559
|
+
* Optional product placement region. Invalid explicit values are rejected;
|
|
537
560
|
* omission lets the platform infer/fallback.
|
|
538
561
|
*/
|
|
539
|
-
readonly region?:
|
|
562
|
+
readonly region?: Region;
|
|
540
563
|
/**
|
|
541
564
|
* Run deadline as a human duration string (`"1h"`, `"90m"`, `"30s"`).
|
|
542
565
|
* Parsed + bounded to [1m, 6h] server-side into
|
|
@@ -569,7 +592,7 @@ export declare function parseRunWebhook(input: unknown): RunWebhookSpec | undefi
|
|
|
569
592
|
* collapses to `undefined` so it carries no signal onto the request.
|
|
570
593
|
*/
|
|
571
594
|
export declare function parseRunLimits(input: unknown): RunLimits | undefined;
|
|
572
|
-
export declare function
|
|
595
|
+
export declare function parseRegion(input: unknown): Region | undefined;
|
|
573
596
|
export declare function parseRuntimeKind(input: unknown): RuntimeKind | undefined;
|
|
574
597
|
export declare function parseRunProvider(input: unknown): RunProvider;
|
|
575
598
|
/**
|