@aexhq/sdk 0.13.6
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/LICENSE +201 -0
- package/README.md +160 -0
- package/dist/_contracts/connection-ticket.d.ts +21 -0
- package/dist/_contracts/connection-ticket.js +49 -0
- package/dist/_contracts/event-envelope.d.ts +276 -0
- package/dist/_contracts/event-envelope.js +324 -0
- package/dist/_contracts/event-stream-client.d.ts +47 -0
- package/dist/_contracts/event-stream-client.js +141 -0
- package/dist/_contracts/http.d.ts +35 -0
- package/dist/_contracts/http.js +114 -0
- package/dist/_contracts/index.d.ts +28 -0
- package/dist/_contracts/index.js +29 -0
- package/dist/_contracts/managed-key.d.ts +74 -0
- package/dist/_contracts/managed-key.js +110 -0
- package/dist/_contracts/operations.d.ts +237 -0
- package/dist/_contracts/operations.js +632 -0
- package/dist/_contracts/provider-support.d.ts +220 -0
- package/dist/_contracts/provider-support.js +90 -0
- package/dist/_contracts/proxy-protocol.d.ts +257 -0
- package/dist/_contracts/proxy-protocol.js +234 -0
- package/dist/_contracts/proxy-validation.d.ts +19 -0
- package/dist/_contracts/proxy-validation.js +51 -0
- package/dist/_contracts/run-artifacts.d.ts +47 -0
- package/dist/_contracts/run-artifacts.js +101 -0
- package/dist/_contracts/run-config.d.ts +304 -0
- package/dist/_contracts/run-config.js +659 -0
- package/dist/_contracts/run-cost.d.ts +125 -0
- package/dist/_contracts/run-cost.js +616 -0
- package/dist/_contracts/run-custody.d.ts +226 -0
- package/dist/_contracts/run-custody.js +465 -0
- package/dist/_contracts/run-record.d.ts +127 -0
- package/dist/_contracts/run-record.js +177 -0
- package/dist/_contracts/run-retention.d.ts +213 -0
- package/dist/_contracts/run-retention.js +484 -0
- package/dist/_contracts/run-unit.d.ts +194 -0
- package/dist/_contracts/run-unit.js +215 -0
- package/dist/_contracts/runner-event.d.ts +114 -0
- package/dist/_contracts/runner-event.js +187 -0
- package/dist/_contracts/runtime-manifest.d.ts +106 -0
- package/dist/_contracts/runtime-manifest.js +98 -0
- package/dist/_contracts/runtime-security-profile.d.ts +27 -0
- package/dist/_contracts/runtime-security-profile.js +82 -0
- package/dist/_contracts/runtime-sizes.d.ts +144 -0
- package/dist/_contracts/runtime-sizes.js +136 -0
- package/dist/_contracts/runtime-types.d.ts +212 -0
- package/dist/_contracts/runtime-types.js +2 -0
- package/dist/_contracts/sdk-errors.d.ts +34 -0
- package/dist/_contracts/sdk-errors.js +52 -0
- package/dist/_contracts/sdk-secrets.d.ts +31 -0
- package/dist/_contracts/sdk-secrets.js +220 -0
- package/dist/_contracts/side-effect-audit.d.ts +129 -0
- package/dist/_contracts/side-effect-audit.js +494 -0
- package/dist/_contracts/sse.d.ts +74 -0
- package/dist/_contracts/sse.js +0 -0
- package/dist/_contracts/stable.d.ts +26 -0
- package/dist/_contracts/stable.js +44 -0
- package/dist/_contracts/status.d.ts +19 -0
- package/dist/_contracts/status.js +61 -0
- package/dist/_contracts/submission.d.ts +383 -0
- package/dist/_contracts/submission.js +1380 -0
- package/dist/agents-md.d.ts +46 -0
- package/dist/agents-md.js +83 -0
- package/dist/agents-md.js.map +1 -0
- package/dist/asset-upload.d.ts +66 -0
- package/dist/asset-upload.js +168 -0
- package/dist/asset-upload.js.map +1 -0
- package/dist/bundle.d.ts +33 -0
- package/dist/bundle.js +89 -0
- package/dist/bundle.js.map +1 -0
- package/dist/cli.mjs +4140 -0
- package/dist/cli.mjs.sha256 +1 -0
- package/dist/client.d.ts +460 -0
- package/dist/client.js +857 -0
- package/dist/client.js.map +1 -0
- package/dist/fetch-archive.d.ts +16 -0
- package/dist/fetch-archive.js +170 -0
- package/dist/fetch-archive.js.map +1 -0
- package/dist/file.d.ts +57 -0
- package/dist/file.js +153 -0
- package/dist/file.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server.d.ts +84 -0
- package/dist/mcp-server.js +114 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/node-fs.d.ts +12 -0
- package/dist/node-fs.js +44 -0
- package/dist/node-fs.js.map +1 -0
- package/dist/proxy-endpoint.d.ts +131 -0
- package/dist/proxy-endpoint.js +147 -0
- package/dist/proxy-endpoint.js.map +1 -0
- package/dist/skill.d.ts +117 -0
- package/dist/skill.js +169 -0
- package/dist/skill.js.map +1 -0
- package/dist/version.d.ts +9 -0
- package/dist/version.js +10 -0
- package/dist/version.js.map +1 -0
- package/docs/cleanup.md +38 -0
- package/docs/credentials.md +153 -0
- package/docs/events.md +76 -0
- package/docs/mcp.md +47 -0
- package/docs/outputs.md +157 -0
- package/docs/product-boundaries.md +57 -0
- package/docs/provider-runtime-capabilities.md +103 -0
- package/docs/quickstart.md +110 -0
- package/docs/release.md +99 -0
- package/docs/run-config.md +53 -0
- package/docs/run-record.md +39 -0
- package/docs/skills.md +139 -0
- package/docs/testing.md +29 -0
- package/package.json +47 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import type { HttpClient } from "./http.js";
|
|
2
|
+
import type { RunUnit } from "./run-unit.js";
|
|
3
|
+
import type { AgentsMdRecord, FileRecord, Output, OutputFileDownload, OutputFileSelector, Run, RunEvent, SignedOutputLink, Skill, WhoAmI } from "./runtime-types.js";
|
|
4
|
+
import type { PlatformRunSubmissionInput } from "./submission.js";
|
|
5
|
+
/**
|
|
6
|
+
* The single source of truth for SDK<->BFF transport. The SDK class
|
|
7
|
+
* AND the CLI subcommands both call these functions; neither
|
|
8
|
+
* surface re-implements HTTP requests against the dashboard.
|
|
9
|
+
*
|
|
10
|
+
* Every function takes an HttpClient (so callers control auth + fetch
|
|
11
|
+
* injection) and returns parsed responses.
|
|
12
|
+
*
|
|
13
|
+
* Workspace identity is derived server-side from the API token on
|
|
14
|
+
* every request; callers do not pass `workspaceId`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getRun(http: HttpClient, runId: string): Promise<Run>;
|
|
17
|
+
/**
|
|
18
|
+
* Strongly-typed accessor for the full self-contained run unit:
|
|
19
|
+
* parsed submission inputs, attempts, indexed events (with
|
|
20
|
+
* pagination cursor for large runs), raw-event Storage manifest,
|
|
21
|
+
* outputs, capture failures, proxy-call audit, pinned skills,
|
|
22
|
+
* provider skills, inline skills.
|
|
23
|
+
*
|
|
24
|
+
* Backed by the same `GET /api/runs/:runId` endpoint that
|
|
25
|
+
* `getRun` calls; this variant just narrows the return type to
|
|
26
|
+
* the documented wire shape. Prefer this for new code; `getRun`
|
|
27
|
+
* stays for callers that only need the loose record.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getRunUnit(http: HttpClient, runId: string): Promise<RunUnit>;
|
|
30
|
+
export declare function listRunEvents(http: HttpClient, runId: string, options?: {
|
|
31
|
+
readonly channel?: "event" | "log" | "all";
|
|
32
|
+
}): Promise<readonly RunEvent[]>;
|
|
33
|
+
/** A coordinator WS connection grant minted by the hosted API's ticket broker. */
|
|
34
|
+
export interface CoordinatorTicket {
|
|
35
|
+
readonly wsUrl: string;
|
|
36
|
+
readonly ticket: string;
|
|
37
|
+
readonly expiresAtMs: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Mint a short-lived coordinator WS ticket via the workspace-token-gated
|
|
41
|
+
* broker (`/api/runs/:id/events/ticket`). The returned `wsUrl` + `ticket`
|
|
42
|
+
* open the live event stream directly against the coordinator. Throws if no
|
|
43
|
+
* coordinator is configured for the deployment (HTTP 503).
|
|
44
|
+
*/
|
|
45
|
+
export declare function getCoordinatorTicket(http: HttpClient, runId: string): Promise<CoordinatorTicket>;
|
|
46
|
+
export declare function listOutputs(http: HttpClient, runId: string): Promise<readonly Output[]>;
|
|
47
|
+
/**
|
|
48
|
+
* List the run's platform diagnostics (the `logs` namespace). Legacy stored
|
|
49
|
+
* filenames are normalized to canonical public namespaces.
|
|
50
|
+
*/
|
|
51
|
+
export declare function listLogs(http: HttpClient, runId: string): Promise<readonly Output[]>;
|
|
52
|
+
export declare function createOutputLink(http: HttpClient, runId: string, outputId: string): Promise<SignedOutputLink>;
|
|
53
|
+
export declare function resolveOutputFileSelector(outputs: readonly Output[], selector: OutputFileSelector, runId?: string): Output;
|
|
54
|
+
export declare function downloadOutput(http: HttpClient, runId: string, selector: OutputFileSelector): Promise<OutputFileDownload>;
|
|
55
|
+
export declare function cancelRun(http: HttpClient, runId: string): Promise<void>;
|
|
56
|
+
export declare function deleteRun(http: HttpClient, runId: string): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Delete a workspace asset cache entry. Accepts an `asset_<id>` value,
|
|
59
|
+
* `sha256:<hex>`, or a bare 64-hex digest. Workspace is derived server-side
|
|
60
|
+
* from the token; idempotent.
|
|
61
|
+
* Does NOT affect runs that already snapshotted the asset.
|
|
62
|
+
*/
|
|
63
|
+
export declare function deleteWorkspaceAsset(http: HttpClient, hash: string): Promise<void>;
|
|
64
|
+
export declare function whoami(http: HttpClient): Promise<WhoAmI>;
|
|
65
|
+
/**
|
|
66
|
+
* Download EVERYTHING about a run as one zip, organised into the four
|
|
67
|
+
* namespace folders:
|
|
68
|
+
*
|
|
69
|
+
* metadata/run.json — the run record.
|
|
70
|
+
* events/events.jsonl — typed event-channel records.
|
|
71
|
+
* events/logs.jsonl — log-channel records, when the API serves them.
|
|
72
|
+
* events/all.jsonl — full unified stream, when the API serves it.
|
|
73
|
+
* outputs/<rel> — the run's deliverables.
|
|
74
|
+
* logs/<rel> — platform diagnostics.
|
|
75
|
+
* manifest.json — `RunRecordManifestV1`.
|
|
76
|
+
*/
|
|
77
|
+
export declare function download(http: HttpClient, runId: string): Promise<Uint8Array>;
|
|
78
|
+
/**
|
|
79
|
+
* Download only the run's deliverables (the `outputs` namespace). Zip
|
|
80
|
+
* layout: `<rel>` per file plus a `manifest.json`
|
|
81
|
+
* (`{ runId, namespace: "outputs", outputs[], errors[] }`).
|
|
82
|
+
*/
|
|
83
|
+
export declare function downloadOutputs(http: HttpClient, runId: string): Promise<Uint8Array>;
|
|
84
|
+
/**
|
|
85
|
+
* Download only the platform diagnostics (the `logs` namespace). Zip
|
|
86
|
+
* layout: `<rel>` per file plus a `manifest.json`
|
|
87
|
+
* (`{ runId, namespace: "logs", logs[], errors[] }`).
|
|
88
|
+
*/
|
|
89
|
+
export declare function downloadLogs(http: HttpClient, runId: string): Promise<Uint8Array>;
|
|
90
|
+
/**
|
|
91
|
+
* Download only the event archive (the `events` namespace). Always includes
|
|
92
|
+
* typed `events.jsonl`; includes `logs.jsonl` / `all.jsonl` when the deployed
|
|
93
|
+
* event API proves those channel exports are available.
|
|
94
|
+
*/
|
|
95
|
+
export declare function downloadEvents(http: HttpClient, runId: string): Promise<Uint8Array>;
|
|
96
|
+
/**
|
|
97
|
+
* Download only the run record (the `metadata` namespace) as a zip
|
|
98
|
+
* containing `run.json`.
|
|
99
|
+
*/
|
|
100
|
+
export declare function downloadMetadata(http: HttpClient, runId: string): Promise<Uint8Array>;
|
|
101
|
+
export declare function submitRun(http: HttpClient, request: PlatformRunSubmissionInput): Promise<Run>;
|
|
102
|
+
/**
|
|
103
|
+
* Multipart variant of `submitRun` for runs that carry transient
|
|
104
|
+
* (per-run) skill bundles and/or transient AgentsMd content.
|
|
105
|
+
*
|
|
106
|
+
* The JSON submission travels as the `submission` part; each
|
|
107
|
+
* `InlineSkillRef.slot` in `request.submission.skills` MUST be
|
|
108
|
+
* mirrored by exactly one `skill:<slot>` part with the bundle bytes.
|
|
109
|
+
* Each `InlineAgentsMdRef.slot` in `request.submission.agentsMd`
|
|
110
|
+
* MUST be mirrored by exactly one `agentsmd:<slot>` part with the
|
|
111
|
+
* markdown text.
|
|
112
|
+
*
|
|
113
|
+
* The BFF re-canonicalises and re-hashes each bundle/file; a
|
|
114
|
+
* `contentHash` mismatch is rejected with a deterministic error.
|
|
115
|
+
*
|
|
116
|
+
* At least one of `bundles` or `agentsMdParts` must be non-empty.
|
|
117
|
+
*/
|
|
118
|
+
export declare function submitRunMultipart(http: HttpClient, request: PlatformRunSubmissionInput, bundles: ReadonlyArray<{
|
|
119
|
+
readonly slot: string;
|
|
120
|
+
readonly bytes: Uint8Array;
|
|
121
|
+
readonly filename: string;
|
|
122
|
+
}>, agentsMdParts?: ReadonlyArray<{
|
|
123
|
+
readonly slot: string;
|
|
124
|
+
readonly content: string;
|
|
125
|
+
readonly filename: string;
|
|
126
|
+
}>, fileParts?: ReadonlyArray<{
|
|
127
|
+
readonly slot: string;
|
|
128
|
+
readonly bytes: Uint8Array;
|
|
129
|
+
readonly filename: string;
|
|
130
|
+
}>): Promise<Run>;
|
|
131
|
+
/**
|
|
132
|
+
* Upload a workspace skill bundle as a zip blob. The hosted API runs
|
|
133
|
+
* the two-phase flow internally (insert pending row, stream bytes into
|
|
134
|
+
* object storage, validate manifest, transition to ready) and returns
|
|
135
|
+
* the finalized `Skill`. Use `Skill.fromPath` / `Skill.upload` in the
|
|
136
|
+
* SDK to build the body; this transport function only knows about
|
|
137
|
+
* bytes.
|
|
138
|
+
*/
|
|
139
|
+
export declare function createSkillBundle(http: HttpClient, args: {
|
|
140
|
+
readonly name: string;
|
|
141
|
+
readonly body: Blob | ArrayBuffer | Uint8Array;
|
|
142
|
+
readonly contentType?: string;
|
|
143
|
+
readonly filename?: string;
|
|
144
|
+
}): Promise<Skill>;
|
|
145
|
+
/**
|
|
146
|
+
* Upload a workspace skill bundle DIRECTLY to object storage via the presign
|
|
147
|
+
* flow, so the bytes never transit the hosted API (bundle size bounded by the
|
|
148
|
+
* object store, not API memory). Falls back to the buffered multipart
|
|
149
|
+
* `createSkillBundle` when the hosted API has no object-store upload
|
|
150
|
+
* credentials (503 `presign_unconfigured`).
|
|
151
|
+
*
|
|
152
|
+
* 1. POST /api/skills/presign { name, hash, sizeBytes } → { uploadUrl, requiredHeaders, skillId }
|
|
153
|
+
* 2. PUT bytes → uploadUrl (signed checksum; the store rejects a mismatch)
|
|
154
|
+
* 3. POST /api/skills/:id/finalize { manifest } → finalized Skill
|
|
155
|
+
*
|
|
156
|
+
* `manifest` is the client-computed bundle manifest (the caller already
|
|
157
|
+
* validated the zip shape before hashing); the Worker records it on finalize
|
|
158
|
+
* without re-buffering the object.
|
|
159
|
+
*/
|
|
160
|
+
export declare function createSkillBundleDirect(http: HttpClient, fetchImpl: (input: string, init?: RequestInit) => Promise<{
|
|
161
|
+
ok: boolean;
|
|
162
|
+
status: number;
|
|
163
|
+
text(): Promise<string>;
|
|
164
|
+
}>, args: {
|
|
165
|
+
readonly name: string;
|
|
166
|
+
readonly body: Uint8Array;
|
|
167
|
+
readonly contentHash: string;
|
|
168
|
+
readonly manifest: ReadonlyArray<{
|
|
169
|
+
readonly path: string;
|
|
170
|
+
readonly size: number;
|
|
171
|
+
readonly mode?: number;
|
|
172
|
+
}>;
|
|
173
|
+
readonly contentType?: string;
|
|
174
|
+
}): Promise<Skill>;
|
|
175
|
+
export declare function listSkills(http: HttpClient): Promise<readonly Skill[]>;
|
|
176
|
+
export declare function getSkill(http: HttpClient, skillId: string): Promise<Skill>;
|
|
177
|
+
export declare function deleteSkill(http: HttpClient, skillId: string): Promise<void>;
|
|
178
|
+
/**
|
|
179
|
+
* Lookup a live workspace skill by `(name, contentHash)`. Returns the
|
|
180
|
+
* matching `Skill` record or null when no live row carries that hash.
|
|
181
|
+
*
|
|
182
|
+
* `contentHash` is the wire format `sha256:<hex>` as returned by
|
|
183
|
+
* `hashSkillBundle`. This powers `Skill.uploadIfChanged` — the SDK
|
|
184
|
+
* computes the hash locally and calls this function to skip the upload
|
|
185
|
+
* when the bytes already exist.
|
|
186
|
+
*/
|
|
187
|
+
export declare function findSkillByHash(http: HttpClient, args: {
|
|
188
|
+
readonly name: string;
|
|
189
|
+
readonly contentHash: string;
|
|
190
|
+
}): Promise<Skill | null>;
|
|
191
|
+
/**
|
|
192
|
+
* Lookup a live workspace skill by `name`. Returns the matching `Skill`
|
|
193
|
+
* record or null when no live row carries that name. Implemented as a
|
|
194
|
+
* list-and-filter on the existing `/api/skills` endpoint — the
|
|
195
|
+
* indexed by-hash route is reserved for `uploadIfChanged`.
|
|
196
|
+
*/
|
|
197
|
+
export declare function findSkillByName(http: HttpClient, name: string): Promise<Skill | null>;
|
|
198
|
+
/**
|
|
199
|
+
* Upload a workspace AgentsMd file as a markdown string. The BFF
|
|
200
|
+
* canonicalises the content into a deterministic zip with AGENTS.md at
|
|
201
|
+
* root and runs the two-phase pending → ready upload.
|
|
202
|
+
*/
|
|
203
|
+
export declare function createAgentsMd(http: HttpClient, args: {
|
|
204
|
+
readonly name: string;
|
|
205
|
+
readonly content: string;
|
|
206
|
+
}): Promise<AgentsMdRecord>;
|
|
207
|
+
export declare function listAgentsMd(http: HttpClient): Promise<readonly AgentsMdRecord[]>;
|
|
208
|
+
export declare function getAgentsMd(http: HttpClient, agentsMdId: string): Promise<AgentsMdRecord>;
|
|
209
|
+
export declare function deleteAgentsMd(http: HttpClient, agentsMdId: string): Promise<void>;
|
|
210
|
+
/**
|
|
211
|
+
* Upload a workspace File as a zip bundle. The BFF canonicalises the
|
|
212
|
+
* content and runs the two-phase pending → ready upload.
|
|
213
|
+
*/
|
|
214
|
+
export declare function createFile(http: HttpClient, args: {
|
|
215
|
+
readonly name: string;
|
|
216
|
+
readonly bytes: Uint8Array;
|
|
217
|
+
}): Promise<FileRecord>;
|
|
218
|
+
export declare function listFiles(http: HttpClient): Promise<readonly FileRecord[]>;
|
|
219
|
+
export declare function getFile(http: HttpClient, fileId: string): Promise<FileRecord>;
|
|
220
|
+
export declare function deleteFile(http: HttpClient, fileId: string): Promise<void>;
|
|
221
|
+
export interface AssetUploadResult {
|
|
222
|
+
readonly assetId: string;
|
|
223
|
+
readonly contentHash: string;
|
|
224
|
+
readonly sizeBytes: number;
|
|
225
|
+
readonly exists: boolean;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Upload bytes to the hosted API's content-addressable asset endpoint.
|
|
229
|
+
* Returns a storage-neutral asset id suitable for `kind:"asset"` refs in a
|
|
230
|
+
* later run submission.
|
|
231
|
+
*/
|
|
232
|
+
export declare function uploadWorkspaceAsset(http: HttpClient, input: {
|
|
233
|
+
readonly bytes: Uint8Array;
|
|
234
|
+
/** Optional `sha256:<hex>` advisory hash; the server verifies it. */
|
|
235
|
+
readonly contentHash?: string;
|
|
236
|
+
readonly contentType?: string;
|
|
237
|
+
}): Promise<AssetUploadResult>;
|