@aexhq/sdk 0.33.0 → 0.34.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 +19 -27
- package/dist/_contracts/operations.d.ts +2 -54
- package/dist/_contracts/operations.js +2 -87
- package/dist/_contracts/run-config.d.ts +19 -13
- package/dist/_contracts/run-config.js +6 -33
- package/dist/_contracts/run-unit.d.ts +1 -33
- package/dist/_contracts/run-unit.js +2 -21
- package/dist/_contracts/runtime-sizes.d.ts +2 -2
- package/dist/_contracts/runtime-sizes.js +2 -2
- package/dist/_contracts/status.d.ts +2 -2
- package/dist/_contracts/status.js +3 -0
- package/dist/_contracts/submission.d.ts +22 -18
- package/dist/_contracts/submission.js +60 -42
- package/dist/agents-md.d.ts +5 -5
- package/dist/agents-md.js +7 -7
- package/dist/agents-md.js.map +1 -1
- package/dist/asset-upload.d.ts +4 -4
- package/dist/asset-upload.js +4 -4
- package/dist/bundle.d.ts +2 -2
- package/dist/bundle.js +2 -2
- package/dist/cli.mjs +354 -12982
- package/dist/cli.mjs.sha256 +1 -1
- package/dist/client.d.ts +218 -386
- package/dist/client.js +375 -645
- package/dist/client.js.map +1 -1
- package/dist/data-tools.d.ts +25 -22
- package/dist/data-tools.js +75 -62
- package/dist/data-tools.js.map +1 -1
- package/dist/fetch-archive.js +16 -16
- package/dist/fetch-archive.js.map +1 -1
- package/dist/file.d.ts +5 -5
- package/dist/file.js +7 -7
- package/dist/file.js.map +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +14 -13
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.d.ts +4 -4
- package/dist/mcp-server.js +4 -4
- package/dist/proxy-endpoint.d.ts +4 -4
- package/dist/proxy-endpoint.js +1 -1
- package/dist/secret.d.ts +8 -8
- package/dist/secret.js +8 -8
- package/dist/secret.js.map +1 -1
- package/dist/skill-tool.d.ts +102 -0
- package/dist/skill-tool.js +190 -0
- package/dist/skill-tool.js.map +1 -0
- package/dist/tool.d.ts +1 -1
- package/dist/tool.js +3 -3
- package/dist/tool.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/cleanup.md +3 -3
- package/docs/concepts/agent-tools.md +6 -25
- package/docs/concepts/composition.md +15 -12
- package/docs/concepts/providers-and-runtimes.md +3 -3
- package/docs/concepts/runs.md +27 -22
- package/docs/credentials.md +52 -84
- package/docs/defaults.md +6 -6
- package/docs/events.md +65 -44
- package/docs/limits-and-quotas.md +3 -4
- package/docs/mcp.md +3 -3
- package/docs/networking.md +8 -8
- package/docs/outputs.md +44 -40
- package/docs/provider-runtime-capabilities.md +1 -1
- package/docs/public-surface.json +2 -2
- package/docs/quickstart.md +20 -10
- package/docs/run-config.md +12 -14
- package/docs/run-record.md +8 -8
- package/docs/secrets.md +16 -26
- package/docs/skills.md +55 -110
- package/docs/vision-skills.md +29 -40
- package/examples/chat-corpus.ts +8 -9
- package/package.json +1 -1
- package/dist/skill.d.ts +0 -149
- package/dist/skill.js +0 -198
- package/dist/skill.js.map +0 -1
package/README.md
CHANGED
|
@@ -10,8 +10,8 @@ The package ships:
|
|
|
10
10
|
|
|
11
11
|
- `Aex` / `AgentExecutor` for sessions, one-shot runs, inspect, download, cancel, and delete.
|
|
12
12
|
- `sessions` / `openSession()` for durable, resumable agent sessions.
|
|
13
|
-
- Typed run primitives: `Models`, `Providers`, `
|
|
14
|
-
- A bundled `aex` CLI with the same run, status, events, outputs, download, cancel, delete,
|
|
13
|
+
- Typed run primitives: `Models`, `Providers`, `Sizes`, `Tool` / `Tools` (skill-tools), `AgentsMd`, `File`, `McpServer`, `ProxyEndpoint`, and `Secret`.
|
|
14
|
+
- A bundled `aex` CLI with the same run, status, events, outputs, download, cancel, delete, and whoami operations.
|
|
15
15
|
|
|
16
16
|
## Install
|
|
17
17
|
|
|
@@ -109,40 +109,32 @@ by default, machine JSON under `--json`):
|
|
|
109
109
|
```bash
|
|
110
110
|
aex models list # canonical models + their default provider
|
|
111
111
|
aex providers list # providers + the models each serves
|
|
112
|
-
aex tools list # builtin
|
|
112
|
+
aex tools list # complete builtin tool set
|
|
113
113
|
aex runtime-sizes list # managed runtime presets (cpus / memory / default)
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
-
Errors are typed and actionable. Every `
|
|
117
|
-
a `RunConfigValidationError` (`err.code === "RUN_CONFIG_INVALID"`)
|
|
118
|
-
by code; CLI failures print a JSON envelope carrying the HTTP
|
|
119
|
-
`remedy`, and the `runId` where known, and a wrong `--model`,
|
|
120
|
-
`--runtime-size` gets a "did you mean?" suggestion.
|
|
116
|
+
Errors are typed and actionable. Every `openSession()` / `run()` config-validation
|
|
117
|
+
failure throws a `RunConfigValidationError` (`err.code === "RUN_CONFIG_INVALID"`)
|
|
118
|
+
you can `catch` by code; CLI failures print a JSON envelope carrying the HTTP
|
|
119
|
+
`status`, a one-line `remedy`, and the `runId` where known, and a wrong `--model`,
|
|
120
|
+
`--provider`, or `--runtime-size` gets a "did you mean?" suggestion.
|
|
121
121
|
|
|
122
|
-
## Chat over a corpus of
|
|
122
|
+
## Chat over a corpus of sessions
|
|
123
123
|
|
|
124
|
-
Turn a selected set of
|
|
125
|
-
returns vendor-neutral, corpus-scoped
|
|
126
|
-
`
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
124
|
+
Turn a selected set of sessions into a read-only chat.
|
|
125
|
+
`createCorpusTools(client, { sessionIds })` returns vendor-neutral, corpus-scoped
|
|
126
|
+
read tools (`list_sessions` / `get_session` / `list_outputs` / `read_output` /
|
|
127
|
+
`search_outputs`) — every tool refuses a session outside the corpus. Drive them
|
|
128
|
+
with any LLM; `examples/chat-corpus.ts` shows the direct-Claude loop
|
|
129
|
+
(`@anthropic-ai/sdk`) on top of the LLM-vendor-free SDK.
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
--model claude-opus-4-8 \
|
|
135
|
-
--prompt "Across these runs, which produced a report.md and what's its headline finding?" \
|
|
136
|
-
--api-token "$AEX_API_TOKEN"
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
`AgentExecutor.searchOutputs({ runIds, filename, extension, contentType, limit })`
|
|
140
|
-
finds output files across runs and returns references (no bytes) you then
|
|
141
|
-
`readOutputText`.
|
|
131
|
+
`aex.sessions.searchOutputs({ runIds, filename, extension, contentType, limit })`
|
|
132
|
+
finds output files across sessions (scope with the `runIds` session-id allow-list)
|
|
133
|
+
and returns references (no bytes) you then read with `aex.sessions.outputs(id).read(...)`.
|
|
142
134
|
|
|
143
135
|
## Feature Areas
|
|
144
136
|
|
|
145
|
-
- **Agent runtime:** managed autonomous runs with filesystem read/edit, grep/glob/head/tail, open web fetch/search
|
|
137
|
+
- **Agent runtime:** managed autonomous runs with filesystem read/edit, grep/glob/head/tail, open web fetch/search, background commands, code execution, git, and subagents.
|
|
146
138
|
- **Durable infrastructure:** run records, status, wait/cancel/delete, idempotency, typed events, output capture, downloads, timeouts, and runtime sizes.
|
|
147
139
|
- **Agent composition:** skills, files, AGENTS.md, remote MCP servers, proxy endpoints, environment variables, packages, and networking controls.
|
|
148
140
|
- **Subagents:** typed parent/child lineage for async child runs, output handoff, and bounded agent delegation.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HttpClient } from "./http.js";
|
|
2
2
|
import type { RunUnit } from "./run-unit.js";
|
|
3
|
-
import type { AgentsMdRecord, FileRecord, Output, OutputLink, OutputLinkOptions, OutputFileDownload, OutputFileSelector, OutputFileType, OutputQuery, OutputText, ReadOutputTextOptions, Run, RunEvent, RunListPage, RunListQuery, Session, SessionCreateRequest, SessionEvent, SessionListPage, SessionListQuery, SessionMessageAccepted, SessionMessageRequest, SessionStateChangeAccepted, RunWebhookDelivery, SecretRecord, SecretReveal,
|
|
3
|
+
import type { AgentsMdRecord, FileRecord, Output, OutputLink, OutputLinkOptions, OutputFileDownload, OutputFileSelector, OutputFileType, OutputQuery, OutputText, ReadOutputTextOptions, Run, RunEvent, RunListPage, RunListQuery, Session, SessionCreateRequest, SessionEvent, SessionListPage, SessionListQuery, SessionMessageAccepted, SessionMessageRequest, SessionStateChangeAccepted, RunWebhookDelivery, SecretRecord, SecretReveal, WhoAmI } from "./runtime-types.js";
|
|
4
4
|
import type { PlatformRunSubmissionInput } from "./submission.js";
|
|
5
5
|
/**
|
|
6
6
|
* The single source of truth for SDK<->BFF transport. The SDK class
|
|
@@ -18,8 +18,7 @@ export declare function getRun(http: HttpClient, runId: string): Promise<Run>;
|
|
|
18
18
|
* Strongly-typed accessor for the full self-contained run unit:
|
|
19
19
|
* parsed submission inputs, attempts, indexed events (with
|
|
20
20
|
* pagination cursor for large runs), raw-event Storage manifest,
|
|
21
|
-
* outputs, capture failures, proxy-call audit
|
|
22
|
-
* provider skills, inline skills.
|
|
21
|
+
* outputs, capture failures, and the proxy-call audit.
|
|
23
22
|
*
|
|
24
23
|
* Backed by the same `GET /api/runs/:runId` endpoint that
|
|
25
24
|
* `getRun` calls; this variant just narrows the return type to
|
|
@@ -146,57 +145,6 @@ export declare function downloadEvents(http: HttpClient, runId: string): Promise
|
|
|
146
145
|
*/
|
|
147
146
|
export declare function downloadMetadata(http: HttpClient, runId: string): Promise<Uint8Array>;
|
|
148
147
|
export declare function submitRun(http: HttpClient, request: PlatformRunSubmissionInput): Promise<Run>;
|
|
149
|
-
/**
|
|
150
|
-
* Upload a workspace skill bundle DIRECTLY to object storage via the presign
|
|
151
|
-
* flow, so the bytes never transit the hosted API (bundle size bounded by the
|
|
152
|
-
* object store, not API memory). Presign errors are terminal.
|
|
153
|
-
*
|
|
154
|
-
* 1. POST /api/skills/presign { name, hash, sizeBytes } → { uploadUrl, requiredHeaders, skillId }
|
|
155
|
-
* 2. PUT bytes → uploadUrl (signed checksum; the store rejects a mismatch)
|
|
156
|
-
* 3. POST /api/skills/:id/finalize { manifest } → finalized Skill
|
|
157
|
-
*
|
|
158
|
-
* `manifest` is the client-computed bundle manifest (the caller already
|
|
159
|
-
* validated the zip shape before hashing); the hosted API records it on finalize
|
|
160
|
-
* without re-buffering the object.
|
|
161
|
-
*/
|
|
162
|
-
export declare function createSkillBundleDirect(http: HttpClient, fetchImpl: (input: string, init?: RequestInit) => Promise<{
|
|
163
|
-
ok: boolean;
|
|
164
|
-
status: number;
|
|
165
|
-
text(): Promise<string>;
|
|
166
|
-
}>, args: {
|
|
167
|
-
readonly name: string;
|
|
168
|
-
readonly body: Uint8Array;
|
|
169
|
-
readonly contentHash: string;
|
|
170
|
-
readonly manifest: ReadonlyArray<{
|
|
171
|
-
readonly path: string;
|
|
172
|
-
readonly size: number;
|
|
173
|
-
readonly mode?: number;
|
|
174
|
-
}>;
|
|
175
|
-
readonly contentType?: string;
|
|
176
|
-
}): Promise<Skill>;
|
|
177
|
-
export declare function listSkills(http: HttpClient): Promise<readonly Skill[]>;
|
|
178
|
-
export declare function getSkill(http: HttpClient, skillId: string): Promise<Skill>;
|
|
179
|
-
export declare function deleteSkill(http: HttpClient, skillId: string): Promise<void>;
|
|
180
|
-
/**
|
|
181
|
-
* Lookup a live workspace skill by `(name, contentHash)`. Returns the
|
|
182
|
-
* matching `Skill` record or null when no live row carries that hash.
|
|
183
|
-
*
|
|
184
|
-
* `contentHash` is the wire format `sha256:<hex>` as returned by
|
|
185
|
-
* `hashSkillBundle`. This powers `Skill.uploadIfChanged` — the SDK
|
|
186
|
-
* computes the hash locally and calls this function to skip the upload
|
|
187
|
-
* when the bytes already exist.
|
|
188
|
-
*/
|
|
189
|
-
export declare function findSkillByHash(http: HttpClient, args: {
|
|
190
|
-
readonly name: string;
|
|
191
|
-
readonly contentHash: string;
|
|
192
|
-
}): Promise<Skill | null>;
|
|
193
|
-
/**
|
|
194
|
-
* Lookup a live workspace skill by `name`. Returns the matching `Skill`
|
|
195
|
-
* record or null when no live row carries that name. Implemented as a
|
|
196
|
-
* list-and-filter on the existing `/api/skills` endpoint — the
|
|
197
|
-
* indexed by-hash route is reserved for `uploadIfChanged`.
|
|
198
|
-
*/
|
|
199
|
-
export declare function findSkillByName(http: HttpClient, name: string): Promise<Skill | null>;
|
|
200
148
|
export declare function listAgentsMd(http: HttpClient): Promise<readonly AgentsMdRecord[]>;
|
|
201
149
|
export declare function getAgentsMd(http: HttpClient, agentsMdId: string): Promise<AgentsMdRecord>;
|
|
202
150
|
export declare function deleteAgentsMd(http: HttpClient, agentsMdId: string): Promise<void>;
|
|
@@ -20,8 +20,7 @@ export async function getRun(http, runId) {
|
|
|
20
20
|
* Strongly-typed accessor for the full self-contained run unit:
|
|
21
21
|
* parsed submission inputs, attempts, indexed events (with
|
|
22
22
|
* pagination cursor for large runs), raw-event Storage manifest,
|
|
23
|
-
* outputs, capture failures, proxy-call audit
|
|
24
|
-
* provider skills, inline skills.
|
|
23
|
+
* outputs, capture failures, and the proxy-call audit.
|
|
25
24
|
*
|
|
26
25
|
* Backed by the same `GET /api/runs/:runId` endpoint that
|
|
27
26
|
* `getRun` calls; this variant just narrows the return type to
|
|
@@ -693,7 +692,7 @@ function isRecord(value) {
|
|
|
693
692
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
694
693
|
}
|
|
695
694
|
// ===========================================================================
|
|
696
|
-
// Run submission operations (
|
|
695
|
+
// Run submission operations (McpServer / run config composition)
|
|
697
696
|
// ===========================================================================
|
|
698
697
|
export async function submitRun(http, request) {
|
|
699
698
|
return http.request("/api/runs", {
|
|
@@ -701,84 +700,6 @@ export async function submitRun(http, request) {
|
|
|
701
700
|
body: JSON.stringify(request)
|
|
702
701
|
});
|
|
703
702
|
}
|
|
704
|
-
/**
|
|
705
|
-
* Upload a workspace skill bundle DIRECTLY to object storage via the presign
|
|
706
|
-
* flow, so the bytes never transit the hosted API (bundle size bounded by the
|
|
707
|
-
* object store, not API memory). Presign errors are terminal.
|
|
708
|
-
*
|
|
709
|
-
* 1. POST /api/skills/presign { name, hash, sizeBytes } → { uploadUrl, requiredHeaders, skillId }
|
|
710
|
-
* 2. PUT bytes → uploadUrl (signed checksum; the store rejects a mismatch)
|
|
711
|
-
* 3. POST /api/skills/:id/finalize { manifest } → finalized Skill
|
|
712
|
-
*
|
|
713
|
-
* `manifest` is the client-computed bundle manifest (the caller already
|
|
714
|
-
* validated the zip shape before hashing); the hosted API records it on finalize
|
|
715
|
-
* without re-buffering the object.
|
|
716
|
-
*/
|
|
717
|
-
export async function createSkillBundleDirect(http, fetchImpl, args) {
|
|
718
|
-
const presign = await http.request("/api/skills/presign", {
|
|
719
|
-
method: "POST",
|
|
720
|
-
headers: { "content-type": "application/json" },
|
|
721
|
-
body: JSON.stringify({ name: args.name, hash: args.contentHash, sizeBytes: args.body.byteLength })
|
|
722
|
-
});
|
|
723
|
-
const putRes = await fetchImpl(presign.uploadUrl, {
|
|
724
|
-
method: "PUT",
|
|
725
|
-
headers: { "content-type": args.contentType ?? "application/zip", ...(presign.requiredHeaders ?? {}) },
|
|
726
|
-
body: args.body
|
|
727
|
-
});
|
|
728
|
-
if (!putRes.ok) {
|
|
729
|
-
const detail = await putRes.text().catch(() => "");
|
|
730
|
-
throw new Error(`createSkillBundleDirect: direct upload PUT failed (status ${putRes.status})${detail ? `: ${detail.slice(0, 500)}` : ""}`);
|
|
731
|
-
}
|
|
732
|
-
const result = await http.request(`/api/skills/${encodeURIComponent(presign.skillId)}/finalize`, {
|
|
733
|
-
method: "POST",
|
|
734
|
-
headers: { "content-type": "application/json" },
|
|
735
|
-
body: JSON.stringify({ manifest: args.manifest })
|
|
736
|
-
});
|
|
737
|
-
return unwrapSkill(result);
|
|
738
|
-
}
|
|
739
|
-
export async function listSkills(http) {
|
|
740
|
-
const result = await http.request("/api/skills");
|
|
741
|
-
if (Array.isArray(result)) {
|
|
742
|
-
return result;
|
|
743
|
-
}
|
|
744
|
-
return result.skills;
|
|
745
|
-
}
|
|
746
|
-
export async function getSkill(http, skillId) {
|
|
747
|
-
const result = await http.request(`/api/skills/${encodeURIComponent(skillId)}`);
|
|
748
|
-
return unwrapSkill(result);
|
|
749
|
-
}
|
|
750
|
-
export async function deleteSkill(http, skillId) {
|
|
751
|
-
await http.request(`/api/skills/${encodeURIComponent(skillId)}`, {
|
|
752
|
-
method: "DELETE"
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
/**
|
|
756
|
-
* Lookup a live workspace skill by `(name, contentHash)`. Returns the
|
|
757
|
-
* matching `Skill` record or null when no live row carries that hash.
|
|
758
|
-
*
|
|
759
|
-
* `contentHash` is the wire format `sha256:<hex>` as returned by
|
|
760
|
-
* `hashSkillBundle`. This powers `Skill.uploadIfChanged` — the SDK
|
|
761
|
-
* computes the hash locally and calls this function to skip the upload
|
|
762
|
-
* when the bytes already exist.
|
|
763
|
-
*/
|
|
764
|
-
export async function findSkillByHash(http, args) {
|
|
765
|
-
const params = new URLSearchParams({
|
|
766
|
-
name: args.name,
|
|
767
|
-
content_hash: args.contentHash
|
|
768
|
-
});
|
|
769
|
-
const result = await http.request(`/api/skills/by-hash?${params.toString()}`);
|
|
770
|
-
return result.skill ?? null;
|
|
771
|
-
}
|
|
772
|
-
/**
|
|
773
|
-
* Lookup a live workspace skill by `name`. Returns the matching `Skill`
|
|
774
|
-
* record or null when no live row carries that name. Implemented as a
|
|
775
|
-
* list-and-filter on the existing `/api/skills` endpoint — the
|
|
776
|
-
* indexed by-hash route is reserved for `uploadIfChanged`.
|
|
777
|
-
*/
|
|
778
|
-
export async function findSkillByName(http, name) {
|
|
779
|
-
const skills = await listSkills(http);
|
|
780
|
-
return skills.find((skill) => skill.name === name) ?? null;
|
|
781
|
-
}
|
|
782
703
|
// ===========================================================================
|
|
783
704
|
// AgentsMd read/delete helpers. Launch submissions use content-addressed asset refs.
|
|
784
705
|
// ===========================================================================
|
|
@@ -879,12 +800,6 @@ function unwrapSecret(result) {
|
|
|
879
800
|
}
|
|
880
801
|
return result;
|
|
881
802
|
}
|
|
882
|
-
function unwrapSkill(result) {
|
|
883
|
-
if (result && typeof result === "object" && "skill" in result) {
|
|
884
|
-
return result.skill;
|
|
885
|
-
}
|
|
886
|
-
return result;
|
|
887
|
-
}
|
|
888
803
|
function hasRun(value) {
|
|
889
804
|
return Boolean(value && typeof value === "object" && "run" in value);
|
|
890
805
|
}
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Public composition concepts:
|
|
5
5
|
*
|
|
6
|
-
* - `
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* - `SkillToolRef` is the wire-level reference to a skill, re-expressed as a
|
|
7
|
+
* synthetic no-arg "load-tool" the model calls to pull in the skill's
|
|
8
|
+
* `SKILL.md` body. It carries the uploaded bundle's `assetId` (produced by
|
|
9
|
+
* the SDK upload path) plus the tool `name` + `description`, and travels in
|
|
10
|
+
* `submission.tools`.
|
|
9
11
|
*
|
|
10
12
|
* - `McpServerRef` is the non-secret part of an MCP server declaration:
|
|
11
13
|
* `name` and `url`. Bearer / cookie / per-request headers travel in
|
|
@@ -79,7 +81,18 @@ export declare const SKILL_BUNDLE_LIMITS: {
|
|
|
79
81
|
/** Stored directory mode. */
|
|
80
82
|
readonly defaultDirMode: 493;
|
|
81
83
|
};
|
|
82
|
-
|
|
84
|
+
/**
|
|
85
|
+
* A skill re-expressed as a TOOL. The model calls this no-arg load-tool to pull
|
|
86
|
+
* the skill's `SKILL.md` body into context; the bundle's files are eagerly
|
|
87
|
+
* staged to `/workspace/skills/<name>/`. It travels in `submission.tools`
|
|
88
|
+
* alongside builtin names and custom {@link ToolRef}s.
|
|
89
|
+
*/
|
|
90
|
+
export interface SkillToolRef {
|
|
91
|
+
readonly kind: "skill";
|
|
92
|
+
readonly assetId: string;
|
|
93
|
+
readonly name: string;
|
|
94
|
+
readonly description: string;
|
|
95
|
+
}
|
|
83
96
|
/**
|
|
84
97
|
* Storage-neutral uploaded asset reference. Runtime materialization resolves
|
|
85
98
|
* `assetId` privately; public callers never name object-store paths.
|
|
@@ -109,7 +122,7 @@ export interface ToolRef extends AssetRef {
|
|
|
109
122
|
}
|
|
110
123
|
/** Content-hash format: `sha256:<64 lowercase hex>`. */
|
|
111
124
|
export declare const INLINE_CONTENT_HASH_PATTERN: RegExp;
|
|
112
|
-
export declare function isAssetRef(ref:
|
|
125
|
+
export declare function isAssetRef(ref: AgentsMdRef | FileRef): ref is AssetRef;
|
|
113
126
|
/**
|
|
114
127
|
* Asset ids are storage-neutral product ids. Current uploads derive the id from
|
|
115
128
|
* the content digest (`asset_<sha256hex>`), but callers must treat it as opaque.
|
|
@@ -143,12 +156,7 @@ export declare const MOUNT_PATH_MAX_LENGTH = 512;
|
|
|
143
156
|
*/
|
|
144
157
|
export declare function assertValidMountPath(value: string, field: string): void;
|
|
145
158
|
/**
|
|
146
|
-
*
|
|
147
|
-
* accepted on the public surface.
|
|
148
|
-
*/
|
|
149
|
-
export declare function parseSkillRef(input: unknown, path: string): SkillRef;
|
|
150
|
-
/**
|
|
151
|
-
* Common parser for any `kind: "asset"` ref (skill / agentsMd / file).
|
|
159
|
+
* Common parser for any `kind: "asset"` ref (agentsMd / file / tool bundle).
|
|
152
160
|
*/
|
|
153
161
|
export declare function parseAssetRefFields(record: Record<string, unknown>, path: string): AssetRef;
|
|
154
162
|
/**
|
|
@@ -291,7 +299,6 @@ export interface RunRequestConfig {
|
|
|
291
299
|
readonly model: RunModel;
|
|
292
300
|
readonly system?: string;
|
|
293
301
|
readonly prompt: string | readonly string[];
|
|
294
|
-
readonly skills?: readonly SkillRef[];
|
|
295
302
|
readonly mcpServers?: readonly RunConfigMcpServer[];
|
|
296
303
|
readonly environment?: PlatformEnvironment;
|
|
297
304
|
/** Managed runtime size preset (see {@link RuntimeSize}). */
|
|
@@ -322,7 +329,6 @@ export interface NormalisedRunRequestConfig {
|
|
|
322
329
|
readonly model: RunModel;
|
|
323
330
|
readonly system?: string;
|
|
324
331
|
readonly prompt: readonly string[];
|
|
325
|
-
readonly skills: readonly SkillRef[];
|
|
326
332
|
readonly mcpServers: readonly McpServerRef[];
|
|
327
333
|
readonly environment?: PlatformEnvironment;
|
|
328
334
|
readonly proxyEndpoints?: readonly PlatformProxyEndpoint[];
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Public composition concepts:
|
|
5
5
|
*
|
|
6
|
-
* - `
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* - `SkillToolRef` is the wire-level reference to a skill, re-expressed as a
|
|
7
|
+
* synthetic no-arg "load-tool" the model calls to pull in the skill's
|
|
8
|
+
* `SKILL.md` body. It carries the uploaded bundle's `assetId` (produced by
|
|
9
|
+
* the SDK upload path) plus the tool `name` + `description`, and travels in
|
|
10
|
+
* `submission.tools`.
|
|
9
11
|
*
|
|
10
12
|
* - `McpServerRef` is the non-secret part of an MCP server declaration:
|
|
11
13
|
* `name` and `url`. Bearer / cookie / per-request headers travel in
|
|
@@ -139,22 +141,7 @@ export function assertValidMountPath(value, field) {
|
|
|
139
141
|
}
|
|
140
142
|
}
|
|
141
143
|
/**
|
|
142
|
-
*
|
|
143
|
-
* accepted on the public surface.
|
|
144
|
-
*/
|
|
145
|
-
export function parseSkillRef(input, path) {
|
|
146
|
-
if (input === null || typeof input !== "object" || Array.isArray(input)) {
|
|
147
|
-
throw new Error(`${path} must be a SkillRef object`);
|
|
148
|
-
}
|
|
149
|
-
const record = input;
|
|
150
|
-
const kind = record.kind;
|
|
151
|
-
if (kind === "asset") {
|
|
152
|
-
return parseAssetRefFields(record, path);
|
|
153
|
-
}
|
|
154
|
-
throw new Error(`${path}.kind must be 'asset'`);
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Common parser for any `kind: "asset"` ref (skill / agentsMd / file).
|
|
144
|
+
* Common parser for any `kind: "asset"` ref (agentsMd / file / tool bundle).
|
|
158
145
|
*/
|
|
159
146
|
export function parseAssetRefFields(record, path) {
|
|
160
147
|
for (const key of Object.keys(record)) {
|
|
@@ -611,7 +598,6 @@ export function parseRunRequestConfig(input) {
|
|
|
611
598
|
"model",
|
|
612
599
|
"system",
|
|
613
600
|
"prompt",
|
|
614
|
-
"skills",
|
|
615
601
|
"mcpServers",
|
|
616
602
|
"environment",
|
|
617
603
|
"runtimeSize",
|
|
@@ -630,13 +616,11 @@ export function parseRunRequestConfig(input) {
|
|
|
630
616
|
throw new Error("run request config system, when provided, must be a string");
|
|
631
617
|
}
|
|
632
618
|
const prompt = parseRunRequestConfigPrompt(record.prompt);
|
|
633
|
-
const skills = parseRunRequestConfigSkills(record.skills);
|
|
634
619
|
const mcpServers = parseRunRequestConfigMcpServers(record.mcpServers);
|
|
635
620
|
return {
|
|
636
621
|
model,
|
|
637
622
|
...(system !== undefined ? { system } : {}),
|
|
638
623
|
prompt,
|
|
639
|
-
...(skills !== undefined ? { skills } : {}),
|
|
640
624
|
...(mcpServers !== undefined ? { mcpServers } : {}),
|
|
641
625
|
// environment / proxyEndpoints / metadata: passed through
|
|
642
626
|
// as-is — the BFF revalidates them via `parseRunSubmissionRequest`,
|
|
@@ -682,15 +666,6 @@ function parseRunRequestConfigPrompt(value) {
|
|
|
682
666
|
}
|
|
683
667
|
throw new Error("run request config prompt must be a string or array of strings");
|
|
684
668
|
}
|
|
685
|
-
function parseRunRequestConfigSkills(value) {
|
|
686
|
-
if (value === undefined) {
|
|
687
|
-
return undefined;
|
|
688
|
-
}
|
|
689
|
-
if (!Array.isArray(value)) {
|
|
690
|
-
throw new Error("run request config skills must be an array");
|
|
691
|
-
}
|
|
692
|
-
return value.map((item, index) => parseSkillRef(item, `run request config skills[${index}]`));
|
|
693
|
-
}
|
|
694
669
|
function parseRunRequestConfigMcpServers(value) {
|
|
695
670
|
if (value === undefined) {
|
|
696
671
|
return undefined;
|
|
@@ -710,7 +685,6 @@ function parseRunRequestConfigMcpServers(value) {
|
|
|
710
685
|
}
|
|
711
686
|
export function normaliseRunRequestConfig(config) {
|
|
712
687
|
const prompt = typeof config.prompt === "string" ? [config.prompt] : config.prompt;
|
|
713
|
-
const skills = config.skills ?? [];
|
|
714
688
|
const mcpServers = [];
|
|
715
689
|
const mcpServerSecrets = [];
|
|
716
690
|
for (const entry of config.mcpServers ?? []) {
|
|
@@ -723,7 +697,6 @@ export function normaliseRunRequestConfig(config) {
|
|
|
723
697
|
model: config.model,
|
|
724
698
|
...(config.system !== undefined ? { system: config.system } : {}),
|
|
725
699
|
prompt,
|
|
726
|
-
skills,
|
|
727
700
|
mcpServers,
|
|
728
701
|
...(config.environment !== undefined ? { environment: config.environment } : {}),
|
|
729
702
|
...(config.proxyEndpoints !== undefined ? { proxyEndpoints: config.proxyEndpoints } : {}),
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* One canonical struct that captures every non-secret artifact persisted
|
|
5
5
|
* for a single run: parsed submission inputs, status/lifecycle, attempts,
|
|
6
6
|
* indexed events, raw-event Storage manifest, outputs (+ capture
|
|
7
|
-
* failures), proxy-call audit log
|
|
8
|
-
* built-in skills, and transient (Anthropic Files) skill records.
|
|
7
|
+
* failures), and the proxy-call audit log.
|
|
9
8
|
*
|
|
10
9
|
* Wire contract for `GET /api/runs/:runId`, the per-run archive's
|
|
11
10
|
* `run.json`/`submission.json`/`caps.json`, and the SDK/CLI
|
|
@@ -118,34 +117,6 @@ export interface RunUnitProxyCallPage {
|
|
|
118
117
|
readonly truncated: boolean;
|
|
119
118
|
readonly nextCursor?: string;
|
|
120
119
|
}
|
|
121
|
-
/**
|
|
122
|
-
* Workspace skill bundle pinned at submission. `liveSkillId` is `null`
|
|
123
|
-
* when the corresponding `skill_bundles` row no longer exists after a
|
|
124
|
-
* hard delete; run snapshots keep the submitted metadata.
|
|
125
|
-
*/
|
|
126
|
-
export interface RunUnitSkillSnapshot {
|
|
127
|
-
readonly skillId: string;
|
|
128
|
-
readonly name: string;
|
|
129
|
-
readonly hash: string;
|
|
130
|
-
readonly sizeBytes: number;
|
|
131
|
-
readonly fileCount: number;
|
|
132
|
-
readonly liveSkillId: string | null;
|
|
133
|
-
}
|
|
134
|
-
export interface RunUnitProviderSkill {
|
|
135
|
-
readonly vendor: string;
|
|
136
|
-
readonly skillId: string;
|
|
137
|
-
readonly version?: string;
|
|
138
|
-
}
|
|
139
|
-
export interface RunUnitInlineSkill {
|
|
140
|
-
readonly id: string;
|
|
141
|
-
readonly slotId: string;
|
|
142
|
-
readonly skillName: string;
|
|
143
|
-
readonly contentHash: string;
|
|
144
|
-
readonly anthropicFileId: string | null;
|
|
145
|
-
readonly status: string;
|
|
146
|
-
readonly createdAt: string;
|
|
147
|
-
readonly updatedAt: string;
|
|
148
|
-
}
|
|
149
120
|
export interface RunUnit {
|
|
150
121
|
readonly id: string;
|
|
151
122
|
readonly workspaceId: string;
|
|
@@ -168,9 +139,6 @@ export interface RunUnit {
|
|
|
168
139
|
readonly outputCaptureFailures: readonly RunUnitOutputCaptureFailure[];
|
|
169
140
|
readonly costTelemetry?: import("./run-cost.js").RunCostTelemetry;
|
|
170
141
|
readonly proxyCalls: RunUnitProxyCallPage;
|
|
171
|
-
readonly skillSnapshots: readonly RunUnitSkillSnapshot[];
|
|
172
|
-
readonly providerSkills: readonly RunUnitProviderSkill[];
|
|
173
|
-
readonly inlineSkills: readonly RunUnitInlineSkill[];
|
|
174
142
|
/**
|
|
175
143
|
* Per-run, per-provider runtime manifest — derived from the validated
|
|
176
144
|
* submission + the chosen provider (`buildRuntimeManifest`). Tells
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* One canonical struct that captures every non-secret artifact persisted
|
|
5
5
|
* for a single run: parsed submission inputs, status/lifecycle, attempts,
|
|
6
6
|
* indexed events, raw-event Storage manifest, outputs (+ capture
|
|
7
|
-
* failures), proxy-call audit log
|
|
8
|
-
* built-in skills, and transient (Anthropic Files) skill records.
|
|
7
|
+
* failures), and the proxy-call audit log.
|
|
9
8
|
*
|
|
10
9
|
* Wire contract for `GET /api/runs/:runId`, the per-run archive's
|
|
11
10
|
* `run.json`/`submission.json`/`caps.json`, and the SDK/CLI
|
|
@@ -19,7 +18,7 @@
|
|
|
19
18
|
* `rawEventPages` (manifest only; bytes downloaded out-of-band so the
|
|
20
19
|
* detail response stays bounded). The archive zip carries the bytes.
|
|
21
20
|
*/
|
|
22
|
-
import { parseMcpServerRef
|
|
21
|
+
import { parseMcpServerRef } from "./run-config.js";
|
|
23
22
|
import { Models, parseRunModel } from "./models.js";
|
|
24
23
|
import { PLATFORM_PACKAGE_ECOSYSTEMS } from "./submission.js";
|
|
25
24
|
// ---------------------------------------------------------------------------
|
|
@@ -60,7 +59,6 @@ function parseFlatProjection(value) {
|
|
|
60
59
|
model: coerceRunUnitModel(submissionRaw.model),
|
|
61
60
|
...(typeof submissionRaw.system === "string" ? { system: submissionRaw.system } : {}),
|
|
62
61
|
prompt: toStringArray(submissionRaw.prompt),
|
|
63
|
-
skills: toSkillRefArray(submissionRaw.skills),
|
|
64
62
|
agentsMd: [],
|
|
65
63
|
files: [],
|
|
66
64
|
mcpServers: toMcpServerRefArray(submissionRaw.mcpServers),
|
|
@@ -107,7 +105,6 @@ function fallbackFlat() {
|
|
|
107
105
|
submission: {
|
|
108
106
|
model: Models.CLAUDE_HAIKU_4_5,
|
|
109
107
|
prompt: [],
|
|
110
|
-
skills: [],
|
|
111
108
|
agentsMd: [],
|
|
112
109
|
files: [],
|
|
113
110
|
mcpServers: [],
|
|
@@ -149,22 +146,6 @@ function toOptionalStringArray(value) {
|
|
|
149
146
|
const filtered = value.filter((item) => typeof item === "string");
|
|
150
147
|
return filtered.length === 0 ? undefined : filtered;
|
|
151
148
|
}
|
|
152
|
-
function toSkillRefArray(value) {
|
|
153
|
-
if (!Array.isArray(value)) {
|
|
154
|
-
return [];
|
|
155
|
-
}
|
|
156
|
-
const out = [];
|
|
157
|
-
for (let i = 0; i < value.length; i++) {
|
|
158
|
-
try {
|
|
159
|
-
out.push(parseSkillRef(value[i], `submission.skills[${i}]`));
|
|
160
|
-
}
|
|
161
|
-
catch {
|
|
162
|
-
// Skip malformed entries rather than failing the whole detail
|
|
163
|
-
// read. Hosted API enrichment may add fields we don't recognise.
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return out;
|
|
167
|
-
}
|
|
168
149
|
function toMcpServerRefArray(value) {
|
|
169
150
|
if (!Array.isArray(value)) {
|
|
170
151
|
return [];
|
|
@@ -47,8 +47,8 @@ export declare const RUNTIME_SIZES: readonly RuntimeSize[];
|
|
|
47
47
|
/** Default when `runtimeSize` is omitted (the 1 GB tier). */
|
|
48
48
|
export declare const DEFAULT_RUNTIME_SIZE: RuntimeSize;
|
|
49
49
|
/**
|
|
50
|
-
* Symbol-style accessors for TS callers
|
|
51
|
-
*
|
|
50
|
+
* Symbol-style accessors for TS callers: the `SHARED_2X_8GB` member resolves to
|
|
51
|
+
* the wire token `"shared-2x-8gb"`. Re-exported by the SDK as `Sizes`.
|
|
52
52
|
*/
|
|
53
53
|
export declare const RuntimeSizes: {
|
|
54
54
|
readonly SHARED_0_06X_256MB: "shared-0.06x-256mb";
|
|
@@ -23,8 +23,8 @@ export const RUNTIME_SIZES = Object.keys(RUNTIME_SIZE_PRESETS);
|
|
|
23
23
|
/** Default when `runtimeSize` is omitted (the 1 GB tier). */
|
|
24
24
|
export const DEFAULT_RUNTIME_SIZE = "shared-0.25x-1gb";
|
|
25
25
|
/**
|
|
26
|
-
* Symbol-style accessors for TS callers
|
|
27
|
-
*
|
|
26
|
+
* Symbol-style accessors for TS callers: the `SHARED_2X_8GB` member resolves to
|
|
27
|
+
* the wire token `"shared-2x-8gb"`. Re-exported by the SDK as `Sizes`.
|
|
28
28
|
*/
|
|
29
29
|
export const RuntimeSizes = {
|
|
30
30
|
SHARED_0_06X_256MB: "shared-0.06x-256mb",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare const RUN_STATUSES: readonly ["queued", "claiming", "provisioning", "session_created", "dispatched", "provider_running", "provider_idle", "provider_rescheduled", "idle", "suspending", "suspended", "deleting", "deleted", "expired", "cancelling", "capturing_outputs", "cleaning_up", "succeeded", "failed", "timed_out", "cancelled", "cleanup_failed"];
|
|
2
2
|
export type RunStatus = typeof RUN_STATUSES[number];
|
|
3
|
-
export declare const SESSION_STATUSES: readonly ["creating", "running", "idle", "suspending", "suspended", "cancelling", "deleting", "deleted", "error"];
|
|
3
|
+
export declare const SESSION_STATUSES: readonly ["creating", "running", "idle", "suspending", "suspended", "cancelling", "deleting", "deleted", "expired", "error"];
|
|
4
4
|
export type SessionStatus = typeof SESSION_STATUSES[number];
|
|
5
5
|
export type RunStatusKind = "active" | "terminal";
|
|
6
|
-
export declare const TERMINAL_RUN_STATUSES: readonly ["succeeded", "failed", "timed_out", "cancelled", "cleanup_failed"];
|
|
6
|
+
export declare const TERMINAL_RUN_STATUSES: readonly ["succeeded", "failed", "timed_out", "cancelled", "deleted", "expired", "cleanup_failed"];
|
|
7
7
|
export declare function isTerminalRunStatus(status: RunStatus): boolean;
|
|
8
8
|
/**
|
|
9
9
|
* The closed set of terminal OUTCOMES the run-lifecycle funnel writes via
|
|
@@ -31,6 +31,7 @@ export const SESSION_STATUSES = [
|
|
|
31
31
|
"cancelling",
|
|
32
32
|
"deleting",
|
|
33
33
|
"deleted",
|
|
34
|
+
"expired",
|
|
34
35
|
"error"
|
|
35
36
|
];
|
|
36
37
|
export const TERMINAL_RUN_STATUSES = [
|
|
@@ -38,6 +39,8 @@ export const TERMINAL_RUN_STATUSES = [
|
|
|
38
39
|
"failed",
|
|
39
40
|
"timed_out",
|
|
40
41
|
"cancelled",
|
|
42
|
+
"deleted",
|
|
43
|
+
"expired",
|
|
41
44
|
"cleanup_failed"
|
|
42
45
|
];
|
|
43
46
|
const terminalRunStatuses = new Set(TERMINAL_RUN_STATUSES);
|