@aexhq/sdk 0.29.0 → 0.31.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.
Files changed (90) hide show
  1. package/README.md +95 -8
  2. package/dist/_contracts/connection-ticket.d.ts +1 -1
  3. package/dist/_contracts/connection-ticket.js +1 -1
  4. package/dist/_contracts/event-envelope.d.ts +5 -8
  5. package/dist/_contracts/event-envelope.js +5 -6
  6. package/dist/_contracts/event-guards.d.ts +67 -0
  7. package/dist/_contracts/event-guards.js +36 -0
  8. package/dist/_contracts/event-stream-client.d.ts +1 -1
  9. package/dist/_contracts/http.js +1 -1
  10. package/dist/_contracts/index.d.ts +2 -0
  11. package/dist/_contracts/index.js +6 -0
  12. package/dist/_contracts/operations.d.ts +2 -47
  13. package/dist/_contracts/operations.js +7 -112
  14. package/dist/_contracts/provider-support.d.ts +48 -138
  15. package/dist/_contracts/provider-support.js +10 -41
  16. package/dist/_contracts/proxy-protocol.d.ts +7 -7
  17. package/dist/_contracts/proxy-protocol.js +8 -8
  18. package/dist/_contracts/run-config.d.ts +7 -20
  19. package/dist/_contracts/run-config.js +8 -46
  20. package/dist/_contracts/run-cost.d.ts +1 -5
  21. package/dist/_contracts/run-cost.js +0 -8
  22. package/dist/_contracts/run-custody.d.ts +4 -6
  23. package/dist/_contracts/run-custody.js +0 -8
  24. package/dist/_contracts/run-trace.d.ts +7 -0
  25. package/dist/_contracts/run-trace.js +9 -0
  26. package/dist/_contracts/run-unit.d.ts +1 -1
  27. package/dist/_contracts/run-unit.js +2 -2
  28. package/dist/_contracts/runner-event.d.ts +1 -1
  29. package/dist/_contracts/runner-event.js +1 -1
  30. package/dist/_contracts/runtime-manifest.d.ts +13 -26
  31. package/dist/_contracts/runtime-manifest.js +6 -35
  32. package/dist/_contracts/runtime-types.d.ts +32 -1
  33. package/dist/_contracts/sdk-secrets.js +4 -4
  34. package/dist/_contracts/side-effect-audit.d.ts +2 -4
  35. package/dist/_contracts/side-effect-audit.js +2 -4
  36. package/dist/_contracts/status.d.ts +1 -1
  37. package/dist/_contracts/status.js +1 -1
  38. package/dist/_contracts/submission.d.ts +19 -126
  39. package/dist/_contracts/submission.js +31 -185
  40. package/dist/_contracts/webhook-verify.d.ts +1 -1
  41. package/dist/_contracts/webhook-verify.js +1 -1
  42. package/dist/agents-md.d.ts +4 -1
  43. package/dist/agents-md.js +10 -9
  44. package/dist/agents-md.js.map +1 -1
  45. package/dist/asset-upload.d.ts +4 -10
  46. package/dist/asset-upload.js +4 -47
  47. package/dist/asset-upload.js.map +1 -1
  48. package/dist/cli.mjs +17647 -3950
  49. package/dist/cli.mjs.sha256 +1 -1
  50. package/dist/client.d.ts +79 -61
  51. package/dist/client.js +207 -125
  52. package/dist/client.js.map +1 -1
  53. package/dist/data-tools.d.ts +23 -0
  54. package/dist/data-tools.js +102 -13
  55. package/dist/data-tools.js.map +1 -1
  56. package/dist/file.d.ts +4 -1
  57. package/dist/file.js +10 -9
  58. package/dist/file.js.map +1 -1
  59. package/dist/index.d.ts +9 -8
  60. package/dist/index.js +10 -8
  61. package/dist/index.js.map +1 -1
  62. package/dist/skill.d.ts +9 -7
  63. package/dist/skill.js +15 -15
  64. package/dist/skill.js.map +1 -1
  65. package/dist/tool.d.ts +4 -1
  66. package/dist/tool.js +10 -8
  67. package/dist/tool.js.map +1 -1
  68. package/dist/version.d.ts +1 -1
  69. package/dist/version.js +1 -1
  70. package/docs/cleanup.md +2 -2
  71. package/docs/concepts/agent-tools.md +9 -5
  72. package/docs/concepts/composition.md +1 -1
  73. package/docs/concepts/providers-and-runtimes.md +2 -4
  74. package/docs/concepts/runs.md +3 -6
  75. package/docs/credentials.md +2 -5
  76. package/docs/defaults.md +22 -22
  77. package/docs/events.md +32 -9
  78. package/docs/limits-and-quotas.md +40 -40
  79. package/docs/limits.md +1 -1
  80. package/docs/networking.md +141 -0
  81. package/docs/outputs.md +1 -1
  82. package/docs/provider-runtime-capabilities.md +36 -64
  83. package/docs/public-surface.json +2 -3
  84. package/docs/quickstart.md +32 -11
  85. package/docs/run-config.md +3 -4
  86. package/docs/secrets.md +7 -5
  87. package/docs/skills.md +4 -12
  88. package/docs/vision-skills.md +1 -1
  89. package/examples/chat-corpus.ts +85 -0
  90. package/package.json +2 -2
@@ -1 +1 @@
1
- 03e2640ecfc2afaed33effd74cb0fb3cea62e049193e566c16eb3d80340ddfff cli.mjs
1
+ 6fdbb02bcedc98dc959c46f14b44bc0d061c799e01627d2550e58980d954e722 cli.mjs
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { HttpClient, SecretString, type AexEvent, type AgentsMdRecord, type CredentialMode, type DebugSink, type FetchLike, type FileRecord, type Output, type OutputFileType, type OutputLink, type OutputLinkOptions, type OutputQuery, type OutputText, type OutputMode, type ReadOutputTextOptions, type RunListPage, type RunListQuery, type PlatformEnvironmentInput, type PlatformSubmission, type PlatformInlineSecrets, type PlatformProxyEndpoint, type PlatformProxyEndpointAuth, type PlatformPostHookInput, type Run, type RunModel, type RunEvent, type RunLimits, type RunWebhookDelivery, type RunProvider, type Region, type SecretRecord, type SecretReveal, type RunUnit, type BuiltinToolName, type RuntimeSize, type RuntimeKind, type Skill as SkillRecord, type WhoAmI } from "./_contracts/index.js";
1
+ import { HttpClient, SecretString, type AexEvent, type AgentsMdRecord, type DebugSink, type FetchLike, type FileRecord, type Output, type OutputFileType, type OutputLink, type OutputLinkOptions, type OutputQuery, type OutputText, type OutputMode, type ReadOutputTextOptions, type RunListPage, type RunListQuery, type OutputSearchQuery, type OutputSearchPage, type PlatformEnvironmentInput, type PlatformSubmission, type PlatformInlineSecrets, type PlatformProxyEndpoint, type PlatformProxyEndpointAuth, type PlatformPostHookInput, type Run, type RunModel, type RunEvent, type RunTrace, type UsageSummary, type RunLimits, type RunWebhookDelivery, type RunProvider, type SecretRecord, type SecretReveal, type RunUnit, type BuiltinToolName, type RuntimeSize, type Skill as SkillRecord, type WhoAmI } from "./_contracts/index.js";
2
2
  import { AgentsMd } from "./agents-md.js";
3
3
  import { type UploadedAsset } from "./asset-upload.js";
4
4
  import { File } from "./file.js";
@@ -40,29 +40,22 @@ export interface AgentExecutorOptions {
40
40
  * secret is bundled into the constructor and split into
41
41
  * `secrets.proxyEndpointAuth` server-side; the public submission
42
42
  * only carries the declaration (`{ name, baseUrl, authShape, … }`).
43
- * - `secrets.apiKey` or `secrets.apiKeys[provider]` REQUIRED: the provider
44
- * key for the selected provider. `apiKeys` MAY carry keys for additional
45
- * providers so subagents spawned with a different-family model can use them
46
- * (the child inherits the parent's keys server-side). The platform never
47
- * holds a long-lived provider key on your behalf.
43
+ * - `secrets.apiKeys` the BYOK provider key(s), keyed by provider. A key
44
+ * for the selected provider is REQUIRED unless this is an admitted child
45
+ * run inheriting keys from its parent. The platform never holds a
46
+ * long-lived provider key on your behalf.
48
47
  *
49
48
  * `idempotencyKey` is auto-generated when omitted; pass one explicitly
50
49
  * if you want client-driven retry safety across process restarts.
51
50
  */
52
51
  export interface SubmitOptions {
53
- /**
54
- * Credential source for upstream provider access. Omitted defaults to
55
- * `"byok"`, which requires `secrets.apiKey` or
56
- * `secrets.apiKeys[provider]`.
57
- */
58
- readonly credentialMode?: CredentialMode;
59
52
  /**
60
53
  * Upstream provider selector. Prefer naming it explicitly with the
61
54
  * {@link Providers} symbol const, e.g. `provider: Providers.DEEPSEEK`. The
62
55
  * same model id can route through different providers, so `provider` is a
63
56
  * first-class field — pass it alongside `model` rather than letting the model
64
57
  * alone decide routing. The BYOK key for the selected provider is supplied as
65
- * `secrets.apiKey` or `secrets.apiKeys[provider]`.
58
+ * `secrets.apiKeys[provider]`.
66
59
  *
67
60
  * Optional today: when omitted it is derived from `model` (each currently
68
61
  * supported model maps to a single provider), so existing call sites keep
@@ -70,18 +63,6 @@ export interface SubmitOptions {
70
63
  * throws.
71
64
  */
72
65
  readonly provider?: RunProvider;
73
- /**
74
- * Optional runtime selector. Omit it or pass `"managed"`; both run on
75
- * the managed runtime through the hosted BYOK provider-proxy. `"native"`
76
- * is no longer accepted.
77
- */
78
- readonly runtime?: RuntimeKind;
79
- /**
80
- * Optional hosted-platform placement region for this run. These are
81
- * product-level tokens, not exact city guarantees; omit to let the platform
82
- * infer a configured region and fall back when no hint matches.
83
- */
84
- readonly region?: Region;
85
66
  /**
86
67
  * Closed public model id. Prefer the {@link Models} symbol const, e.g.
87
68
  * `Models.CLAUDE_HAIKU_4_5`. Pair it with an explicit {@link Providers} value
@@ -171,7 +152,11 @@ export interface SubmitOptions {
171
152
  * typing UIs.
172
153
  */
173
154
  readonly outputMode?: OutputMode;
174
- readonly secrets: PlatformInlineSecrets;
155
+ /**
156
+ * Advanced inline secrets bundle (per-provider `apiKeys`, MCP headers, proxy
157
+ * auth, env secrets). Provider keys must use `secrets.apiKeys`.
158
+ */
159
+ readonly secrets?: PlatformInlineSecrets;
175
160
  readonly idempotencyKey?: string;
176
161
  /**
177
162
  * Lineage parent (agent-session §9). When set, the server admits this run as
@@ -203,8 +188,42 @@ export interface SubmitOptions {
203
188
  readonly limits?: RunLimits;
204
189
  readonly signal?: AbortSignal;
205
190
  }
206
- /** @deprecated Renamed to {@link SubmitOptions}. Kept for one release. */
207
- export type SubmitRunOptions = SubmitOptions;
191
+ /**
192
+ * The settle-consistent result of {@link AgentExecutor.run} / `runAndCollect`:
193
+ * the terminal run record plus its settle-bracketed events, decoded trace,
194
+ * assistant text, and captured outputs — everything a "do it and give me the
195
+ * result" caller needs without hand-rolling a poll loop.
196
+ */
197
+ export interface RunResult {
198
+ readonly runId: string;
199
+ /** The full terminal run record (status, costTelemetry, timings). */
200
+ readonly run: Run;
201
+ readonly status: string;
202
+ /** `true` when `status === "succeeded"`. */
203
+ readonly ok: boolean;
204
+ /** The assistant's final text (decoded over the settled events). */
205
+ readonly text: string;
206
+ /** The settle-bracketed event stream (RUN_STARTED … terminal). */
207
+ readonly events: readonly RunEvent[];
208
+ /** Decoded view of the events: tool calls + usage + assistant text. */
209
+ readonly trace: RunTrace;
210
+ /** The run's captured output files. */
211
+ readonly outputs: readonly Output[];
212
+ /** Aggregate token usage when the deployment exposes it on the record. */
213
+ readonly usage?: UsageSummary;
214
+ /** Settle-time showback estimate (USD), from `run.costTelemetry`. */
215
+ readonly costUsd?: number;
216
+ /** The run's error message when `!ok`. */
217
+ readonly error?: string;
218
+ }
219
+ /** Options for {@link AgentExecutor.run} / `runAndCollect`. */
220
+ export interface RunCollectOptions {
221
+ /** Overall wait budget (ms) for the run to reach a terminal record. */
222
+ readonly timeoutMs?: number;
223
+ readonly signal?: AbortSignal;
224
+ /** Throw a {@link RunStateError} when the run does not succeed. Default false. */
225
+ readonly throwOnFailure?: boolean;
226
+ }
208
227
  export interface StreamEventsOptions {
209
228
  /** Poll interval in ms for the `RunEvent` snapshot loop. Default 1000. */
210
229
  readonly intervalMs?: number;
@@ -284,14 +303,6 @@ export declare class SkillsClient {
284
303
  * the cost is negligible.
285
304
  */
286
305
  findByName(name: string): Promise<SkillRecord | null>;
287
- /**
288
- * Internal: post a pre-bundled skill zip to the BFF. Only
289
- * `Skill.upload` calls this. NOT part of the public API.
290
- */
291
- _uploadSkillBundle(args: {
292
- readonly name: string;
293
- readonly body: Uint8Array;
294
- }): Promise<SkillRecord>;
295
306
  }
296
307
  /**
297
308
  * Workspace AgentsMd admin operations exposed under `client.agentsMd`.
@@ -405,22 +416,6 @@ export declare class AgentExecutor {
405
416
  readonly files: FilesClient;
406
417
  readonly secrets: SecretsClient;
407
418
  constructor(options: AgentExecutorOptions);
408
- /**
409
- * Internal: forwards to `SkillsClient._uploadSkillBundle`. NOT part of
410
- * the public API.
411
- *
412
- * NOTE (tech-debt): this is part of the legacy workspace-skill upload
413
- * surface (`SkillsClient` + `operations.createSkillBundle` + the TUS
414
- * chunked path in asset-upload.ts). The live submit path materializes
415
- * inline skills via `uploadAsset` instead; `Skill.upload(client)`
416
- * pre-stages a draft explicitly for reuse. This surface is retained
417
- * pending a deliberate deprecation pass (it still threads into the CLI
418
- * host commands), tracked in the remediation plan as item 4a.
419
- */
420
- _uploadSkillBundle(args: {
421
- readonly name: string;
422
- readonly body: Uint8Array;
423
- }): Promise<SkillRecord>;
424
419
  /**
425
420
  * Internal: an `AgentsMd.upload(this)` shortcut that bypasses
426
421
  * `client.agentsMd` indirection. Forwarded to
@@ -463,15 +458,26 @@ export declare class AgentExecutor {
463
458
  readonly contentType?: string;
464
459
  }): Promise<UploadedAsset>;
465
460
  /**
466
- * Submit a run and wait until its RECORD is terminal the settle-consistent
467
- * "do it and give me the result" primitive. Returns the final `Run`, so on
468
- * resolve a subsequent `getRun`/`listOutputs` is guaranteed consistent (it
469
- * polls `getRun` via {@link waitForRun}, NOT the RUN_FINISHED event, which the
470
- * runner emits before the platform commits the record). For long-running flows
471
- * that need live events, prefer `submit` + `streamEnvelopes(runId, {
472
- * settleConsistent: true })`, or `submit` + `stream(runId)` + `wait(runId)`.
461
+ * Submit a run, wait until its RECORD is terminal, and collect the full
462
+ * {@link RunResult} — the settle-consistent "do it and give me the result"
463
+ * primitive. Folds the poll loop every consumer hand-rolled into one call:
464
+ * submit {@link waitForRun} (polls `getRun`, NOT the earlier RUN_FINISHED
465
+ * event) poll `listEvents` until the snapshot is settle-bracketed
466
+ * (RUN_STARTED + a terminal event present) → `listOutputs` decode the trace
467
+ * and assistant text. On resolve, `getRun`/`listOutputs` are guaranteed
468
+ * consistent.
469
+ *
470
+ * Uses polling (portable across backends), NOT the coordinator WebSocket. By
471
+ * default a failed run resolves with `ok: false` and a populated `error`; pass
472
+ * `{ throwOnFailure: true }` to throw instead. For live events prefer `submit`
473
+ * + `streamEnvelopes(runId, { settleConsistent: true })`.
474
+ */
475
+ run(options: SubmitOptions, opts?: RunCollectOptions): Promise<RunResult>;
476
+ /**
477
+ * Explicit, discoverable alias for {@link run}: submit, wait, and collect the
478
+ * full {@link RunResult} in one call.
473
479
  */
474
- run(options: SubmitOptions): Promise<Run>;
480
+ runAndCollect(options: SubmitOptions, opts?: RunCollectOptions): Promise<RunResult>;
475
481
  /**
476
482
  * Submit a run and return its run id immediately. Use that id with
477
483
  * `wait`, `stream`, `outputs`, `download`, `cancel`, or `delete`.
@@ -503,6 +509,18 @@ export declare class AgentExecutor {
503
509
  * `listOutputs` / `readOutputText` to reach any run's deliverables.
504
510
  */
505
511
  listRuns(query?: RunListQuery): Promise<RunListPage>;
512
+ /**
513
+ * Find output files across runs by filename / extension / content type.
514
+ * Returns lean REFERENCE hits (runId, outputId, filename, size, content type)
515
+ * — never bytes; fetch content with {@link readOutputText}. Scope the search
516
+ * to a corpus with `query.runIds`; omit it to scan the whole workspace (needs
517
+ * the owner-gated `listRuns`). Composed client-side for the MVP (per-run
518
+ * `listOutputs` + the contracts output filter), so it works against any
519
+ * already-terminal run with no new server endpoint. Bounded by
520
+ * `query.limit` (default 100) — for very large corpora prefer the deferred
521
+ * server-side index.
522
+ */
523
+ searchOutputs(query?: OutputSearchQuery): Promise<OutputSearchPage>;
506
524
  /**
507
525
  * Fetch the self-contained `RunUnit`: parsed submission inputs,
508
526
  * attempts, indexed events (inline + cursor for the tail), raw
@@ -532,7 +550,7 @@ export declare class AgentExecutor {
532
550
  stream(runId: string, options?: StreamEventsOptions): AsyncIterable<RunEvent>;
533
551
  /**
534
552
  * Stream the unified {@link AexEvent} envelope live over the coordinator
535
- * WebSocket. The Worker's ticket broker authorizes the connection (workspace
553
+ * WebSocket. The hosted API's ticket broker authorizes the connection (workspace
536
554
  * token → short-lived coordinator ticket); the shared client replays from
537
555
  * the cursor, tails live, and resumes exactly-once across reconnects. The
538
556
  * ticket is re-minted on each (re)connect so a long run never outlives it.