@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.
Files changed (112) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +160 -0
  3. package/dist/_contracts/connection-ticket.d.ts +21 -0
  4. package/dist/_contracts/connection-ticket.js +49 -0
  5. package/dist/_contracts/event-envelope.d.ts +276 -0
  6. package/dist/_contracts/event-envelope.js +324 -0
  7. package/dist/_contracts/event-stream-client.d.ts +47 -0
  8. package/dist/_contracts/event-stream-client.js +141 -0
  9. package/dist/_contracts/http.d.ts +35 -0
  10. package/dist/_contracts/http.js +114 -0
  11. package/dist/_contracts/index.d.ts +28 -0
  12. package/dist/_contracts/index.js +29 -0
  13. package/dist/_contracts/managed-key.d.ts +74 -0
  14. package/dist/_contracts/managed-key.js +110 -0
  15. package/dist/_contracts/operations.d.ts +237 -0
  16. package/dist/_contracts/operations.js +632 -0
  17. package/dist/_contracts/provider-support.d.ts +220 -0
  18. package/dist/_contracts/provider-support.js +90 -0
  19. package/dist/_contracts/proxy-protocol.d.ts +257 -0
  20. package/dist/_contracts/proxy-protocol.js +234 -0
  21. package/dist/_contracts/proxy-validation.d.ts +19 -0
  22. package/dist/_contracts/proxy-validation.js +51 -0
  23. package/dist/_contracts/run-artifacts.d.ts +47 -0
  24. package/dist/_contracts/run-artifacts.js +101 -0
  25. package/dist/_contracts/run-config.d.ts +304 -0
  26. package/dist/_contracts/run-config.js +659 -0
  27. package/dist/_contracts/run-cost.d.ts +125 -0
  28. package/dist/_contracts/run-cost.js +616 -0
  29. package/dist/_contracts/run-custody.d.ts +226 -0
  30. package/dist/_contracts/run-custody.js +465 -0
  31. package/dist/_contracts/run-record.d.ts +127 -0
  32. package/dist/_contracts/run-record.js +177 -0
  33. package/dist/_contracts/run-retention.d.ts +213 -0
  34. package/dist/_contracts/run-retention.js +484 -0
  35. package/dist/_contracts/run-unit.d.ts +194 -0
  36. package/dist/_contracts/run-unit.js +215 -0
  37. package/dist/_contracts/runner-event.d.ts +114 -0
  38. package/dist/_contracts/runner-event.js +187 -0
  39. package/dist/_contracts/runtime-manifest.d.ts +106 -0
  40. package/dist/_contracts/runtime-manifest.js +98 -0
  41. package/dist/_contracts/runtime-security-profile.d.ts +27 -0
  42. package/dist/_contracts/runtime-security-profile.js +82 -0
  43. package/dist/_contracts/runtime-sizes.d.ts +144 -0
  44. package/dist/_contracts/runtime-sizes.js +136 -0
  45. package/dist/_contracts/runtime-types.d.ts +212 -0
  46. package/dist/_contracts/runtime-types.js +2 -0
  47. package/dist/_contracts/sdk-errors.d.ts +34 -0
  48. package/dist/_contracts/sdk-errors.js +52 -0
  49. package/dist/_contracts/sdk-secrets.d.ts +31 -0
  50. package/dist/_contracts/sdk-secrets.js +220 -0
  51. package/dist/_contracts/side-effect-audit.d.ts +129 -0
  52. package/dist/_contracts/side-effect-audit.js +494 -0
  53. package/dist/_contracts/sse.d.ts +74 -0
  54. package/dist/_contracts/sse.js +0 -0
  55. package/dist/_contracts/stable.d.ts +26 -0
  56. package/dist/_contracts/stable.js +44 -0
  57. package/dist/_contracts/status.d.ts +19 -0
  58. package/dist/_contracts/status.js +61 -0
  59. package/dist/_contracts/submission.d.ts +383 -0
  60. package/dist/_contracts/submission.js +1380 -0
  61. package/dist/agents-md.d.ts +46 -0
  62. package/dist/agents-md.js +83 -0
  63. package/dist/agents-md.js.map +1 -0
  64. package/dist/asset-upload.d.ts +66 -0
  65. package/dist/asset-upload.js +168 -0
  66. package/dist/asset-upload.js.map +1 -0
  67. package/dist/bundle.d.ts +33 -0
  68. package/dist/bundle.js +89 -0
  69. package/dist/bundle.js.map +1 -0
  70. package/dist/cli.mjs +4140 -0
  71. package/dist/cli.mjs.sha256 +1 -0
  72. package/dist/client.d.ts +460 -0
  73. package/dist/client.js +857 -0
  74. package/dist/client.js.map +1 -0
  75. package/dist/fetch-archive.d.ts +16 -0
  76. package/dist/fetch-archive.js +170 -0
  77. package/dist/fetch-archive.js.map +1 -0
  78. package/dist/file.d.ts +57 -0
  79. package/dist/file.js +153 -0
  80. package/dist/file.js.map +1 -0
  81. package/dist/index.d.ts +30 -0
  82. package/dist/index.js +34 -0
  83. package/dist/index.js.map +1 -0
  84. package/dist/mcp-server.d.ts +84 -0
  85. package/dist/mcp-server.js +114 -0
  86. package/dist/mcp-server.js.map +1 -0
  87. package/dist/node-fs.d.ts +12 -0
  88. package/dist/node-fs.js +44 -0
  89. package/dist/node-fs.js.map +1 -0
  90. package/dist/proxy-endpoint.d.ts +131 -0
  91. package/dist/proxy-endpoint.js +147 -0
  92. package/dist/proxy-endpoint.js.map +1 -0
  93. package/dist/skill.d.ts +117 -0
  94. package/dist/skill.js +169 -0
  95. package/dist/skill.js.map +1 -0
  96. package/dist/version.d.ts +9 -0
  97. package/dist/version.js +10 -0
  98. package/dist/version.js.map +1 -0
  99. package/docs/cleanup.md +38 -0
  100. package/docs/credentials.md +153 -0
  101. package/docs/events.md +76 -0
  102. package/docs/mcp.md +47 -0
  103. package/docs/outputs.md +157 -0
  104. package/docs/product-boundaries.md +57 -0
  105. package/docs/provider-runtime-capabilities.md +103 -0
  106. package/docs/quickstart.md +110 -0
  107. package/docs/release.md +99 -0
  108. package/docs/run-config.md +53 -0
  109. package/docs/run-record.md +39 -0
  110. package/docs/skills.md +139 -0
  111. package/docs/testing.md +29 -0
  112. 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>;