@aexhq/sdk 0.34.0 → 0.36.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 (63) hide show
  1. package/README.md +16 -15
  2. package/dist/_contracts/index.d.ts +3 -4
  3. package/dist/_contracts/index.js +1 -4
  4. package/dist/_contracts/operations.d.ts +2 -1
  5. package/dist/_contracts/operations.js +10 -0
  6. package/dist/_contracts/run-config.d.ts +1 -3
  7. package/dist/_contracts/run-config.js +2 -7
  8. package/dist/_contracts/run-trace.d.ts +0 -86
  9. package/dist/_contracts/run-trace.js +1 -184
  10. package/dist/_contracts/run-unit.d.ts +2 -25
  11. package/dist/_contracts/run-unit.js +1 -2
  12. package/dist/_contracts/runtime-manifest.d.ts +1 -1
  13. package/dist/_contracts/runtime-security-profile.d.ts +0 -2
  14. package/dist/_contracts/runtime-security-profile.js +0 -9
  15. package/dist/_contracts/runtime-types.d.ts +25 -4
  16. package/dist/_contracts/stable.d.ts +1 -1
  17. package/dist/_contracts/stable.js +1 -1
  18. package/dist/_contracts/submission.d.ts +62 -95
  19. package/dist/_contracts/submission.js +59 -482
  20. package/dist/cli.mjs +99 -442
  21. package/dist/cli.mjs.sha256 +1 -1
  22. package/dist/client.d.ts +49 -25
  23. package/dist/client.js +341 -70
  24. package/dist/client.js.map +1 -1
  25. package/dist/index.d.ts +9 -15
  26. package/dist/index.js +11 -17
  27. package/dist/index.js.map +1 -1
  28. package/dist/retry.d.ts +162 -0
  29. package/dist/retry.js +320 -0
  30. package/dist/retry.js.map +1 -0
  31. package/dist/secret.d.ts +2 -2
  32. package/dist/secret.js +1 -1
  33. package/dist/version.d.ts +1 -1
  34. package/dist/version.js +1 -1
  35. package/docs/concepts/composition.md +8 -14
  36. package/docs/credentials.md +59 -101
  37. package/docs/defaults.md +0 -8
  38. package/docs/events.md +8 -9
  39. package/docs/limits-and-quotas.md +1 -4
  40. package/docs/limits.md +2 -6
  41. package/docs/mcp.md +4 -5
  42. package/docs/networking.md +6 -16
  43. package/docs/outputs.md +0 -4
  44. package/docs/public-surface.json +3 -3
  45. package/docs/quickstart.md +3 -7
  46. package/docs/retries.md +129 -0
  47. package/docs/run-config.md +6 -3
  48. package/docs/secrets.md +1 -1
  49. package/docs/skills.md +3 -3
  50. package/docs/vision-skills.md +52 -101
  51. package/examples/feature-tour.ts +284 -0
  52. package/package.json +1 -1
  53. package/dist/_contracts/proxy-protocol.d.ts +0 -305
  54. package/dist/_contracts/proxy-protocol.js +0 -297
  55. package/dist/_contracts/proxy-validation.d.ts +0 -19
  56. package/dist/_contracts/proxy-validation.js +0 -51
  57. package/dist/data-tools.d.ts +0 -82
  58. package/dist/data-tools.js +0 -251
  59. package/dist/data-tools.js.map +0 -1
  60. package/dist/proxy-endpoint.d.ts +0 -131
  61. package/dist/proxy-endpoint.js +0 -144
  62. package/dist/proxy-endpoint.js.map +0 -1
  63. package/examples/chat-corpus.ts +0 -84
@@ -1 +1 @@
1
- fe0642cff5926cbaf21e48544c4e022a183f284d8e4c25818784fc84b1df2c5a cli.mjs
1
+ 07c9307bf82f025b845d4495eb41039ac3f684c4a75244af85871809206bf704 cli.mjs
package/dist/client.d.ts CHANGED
@@ -1,15 +1,17 @@
1
- import { HttpClient, SecretString, type AexEvent, type AgentsMdRecord, type AssistantTextEntry, type DebugSink, type FetchLike, type FileRecord, type Output, type OutputFileType, type OutputLink, type OutputLinkOptions, type OutputQuery, type OutputText, type OutputMode, type ReadOutputTextOptions, type OutputSearchQuery, type OutputSearchPage, type Session, type SessionCreateRequest, type SessionEvent, type SessionListPage, type SessionListQuery, type SessionStateChangeAccepted, type SessionTurn, type PlatformEnvironmentInput, type PlatformSubmission, type PlatformProxyEndpoint, type PlatformProxyEndpointAuth, type Run, type RunModel, type RunEvent, type RunTrace, type UsageSummary, type RunWebhookDelivery, type RunProvider, type SecretRecord, type RunUnit, type BuiltinToolName, type RuntimeSize, type WebSocketFactory, 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 OutputSearchQuery, type OutputSearchPage, type Session, type SessionCreateRequest, type SessionEvent, type SessionListPage, type SessionListQuery, type SessionMessage, type SessionStateChangeAccepted, type SessionTurn, type PlatformEnvironmentInput, type PlatformSubmission, type Run, type RunModel, type RunEvent, type RunTrace, type UsageSummary, type RunWebhookDelivery, type RunProvider, type SecretRecord, type RunUnit, type BuiltinToolName, type RuntimeSize, type WebSocketFactory, 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";
5
5
  import { McpServer } from "./mcp-server.js";
6
- import { ProxyEndpoint } from "./proxy-endpoint.js";
6
+ import { type RetryOptions } from "./retry.js";
7
7
  import { Secret } from "./secret.js";
8
8
  import { SkillTool } from "./skill-tool.js";
9
9
  import { Tool } from "./tool.js";
10
- export interface AgentExecutorOptions {
10
+ export interface AexOptions {
11
11
  /** Workspace-scoped SDK API token. */
12
- readonly apiToken: string;
12
+ readonly apiKey?: string;
13
+ /** @deprecated Use `apiKey`; kept as a source-compatible alias during launch. */
14
+ readonly apiToken?: string;
13
15
  /**
14
16
  * API plane root, e.g. `https://aex.example.com`. Optional —
15
17
  * defaults to the canonical hosted URL (`https://api.aex.dev`).
@@ -24,9 +26,19 @@ export interface AgentExecutorOptions {
24
26
  * route the traces elsewhere. Purely local — nothing is uploaded.
25
27
  */
26
28
  readonly debug?: boolean | DebugSink;
29
+ /**
30
+ * Built-in transport retry policy. Every BFF request is retried on transient
31
+ * failures (HTTP 429/500/502/503/504/529 and network errors) with bounded
32
+ * exponential backoff + jitter, honoring `Retry-After`. Billable submits carry
33
+ * a stable idempotency key, so a retry never creates a duplicate billable run.
34
+ *
35
+ * Omit for sensible defaults (4 attempts, ~2 min budget); pass an object to
36
+ * tune `maxAttempts` / delays / `maxElapsedMs`; pass `false` to disable.
37
+ */
38
+ readonly retry?: RetryOptions | false;
27
39
  }
28
40
  /**
29
- * The settle-consistent result of {@link AgentExecutor.run}:
41
+ * The settle-consistent result of {@link Aex.run}:
30
42
  * the one-shot session record plus its events, decoded trace, assistant text,
31
43
  * and captured outputs — everything a "do it and give me the result" caller
32
44
  * needs without hand-rolling a session/message/stream loop.
@@ -46,6 +58,8 @@ export interface RunResult {
46
58
  readonly ok: boolean;
47
59
  /** The assistant's final text. */
48
60
  readonly text: string;
61
+ /** Assistant messages projected from the settled event stream. */
62
+ readonly messages: readonly Message[];
49
63
  /** The session turn event stream. */
50
64
  readonly events: readonly RunEvent[];
51
65
  /** Decoded view of the events: tool calls + usage + assistant text. */
@@ -59,7 +73,7 @@ export interface RunResult {
59
73
  /** The run's error message when `!ok`. */
60
74
  readonly error?: string;
61
75
  }
62
- /** Options for {@link AgentExecutor.run}. */
76
+ /** Options for {@link Aex.run}. */
63
77
  export interface RunCollectOptions {
64
78
  /** Overall wait budget (ms) for the one-shot session turn to park. */
65
79
  readonly timeoutMs?: number;
@@ -91,9 +105,8 @@ export interface SessionOverrides {
91
105
  * - `agentsMd` / `files` — local composition instances
92
106
  * (`AgentsMd.fromContent` / `File.fromBytes`, …), materialized to the
93
107
  * hosted asset store before the session lands.
94
- * - `mcpServers` / `proxyEndpoints` — instances whose secrets are split into
95
- * the vaulted secrets channel server-side; the public submission carries
96
- * only the declarations.
108
+ * - `mcpServers` — instances whose secrets are split into the vaulted secrets
109
+ * channel server-side; the public submission carries only the declarations.
97
110
  * - `apiKeys` — the BYOK provider key(s), keyed by provider. A key for the
98
111
  * selected provider is REQUIRED. The platform never holds a long-lived
99
112
  * provider key on your behalf.
@@ -147,7 +160,6 @@ export interface SessionCreateOptions {
147
160
  readonly outputMode?: OutputMode;
148
161
  readonly metadata?: PlatformSubmission["metadata"];
149
162
  readonly idempotencyKey?: string;
150
- readonly proxyEndpoints?: readonly ProxyEndpoint[];
151
163
  /** BYOK provider key(s), keyed by provider. */
152
164
  readonly apiKeys?: Partial<Record<RunProvider, string>>;
153
165
  readonly environment?: SessionEnvironmentOptions;
@@ -188,6 +200,7 @@ export interface SessionTurnResult {
188
200
  readonly text: string;
189
201
  readonly events: readonly SessionEvent[];
190
202
  readonly outputs: readonly Output[];
203
+ readonly messages: readonly Message[];
191
204
  }
192
205
  export interface SessionRunResult extends SessionTurnResult {
193
206
  }
@@ -197,14 +210,18 @@ export declare class SessionTurnStream implements AsyncIterable<SessionEvent> {
197
210
  [Symbol.asyncIterator](): AsyncIterator<SessionEvent>;
198
211
  done(): Promise<SessionTurnResult>;
199
212
  }
213
+ type CallableSessionMessages = SessionMessages & (() => SessionMessages);
214
+ export type Message = SessionMessage;
200
215
  /**
201
- * Accessor over the session's decoded assistant messages. `session.messages()`
202
- * returns this synchronously; each method fetches on call.
216
+ * Accessor over the session's assistant messages. `session.messages` returns
217
+ * this synchronously; each method fetches on call.
203
218
  */
204
219
  export interface SessionMessages {
205
- list(): Promise<readonly AssistantTextEntry[]>;
206
- last(): Promise<AssistantTextEntry | undefined>;
207
- first(): Promise<AssistantTextEntry | undefined>;
220
+ all(): Promise<readonly Message[]>;
221
+ /** Compatibility alias for {@link SessionMessages.all}. */
222
+ list(): Promise<readonly Message[]>;
223
+ last(): Promise<Message | undefined>;
224
+ first(): Promise<Message | undefined>;
208
225
  }
209
226
  /**
210
227
  * Accessor over the session's event stream (`session.events()`): the buffered
@@ -250,16 +267,25 @@ export declare class SessionHandle {
250
267
  get id(): string;
251
268
  get record(): Session;
252
269
  send(input: SessionInput, options?: SessionSendOptions): SessionTurnStream;
270
+ /**
271
+ * Re-send the last message on this session — the clean way to retry a turn a
272
+ * throttle or transient failure interrupted. By default it REUSES the previous
273
+ * message's idempotency key, so if the original turn actually landed
274
+ * server-side the replay de-duplicates instead of creating a second billable
275
+ * turn; pass a fresh `idempotencyKey` to force a brand-new turn.
276
+ */
277
+ replayLast(options?: SessionSendOptions): SessionTurnStream;
253
278
  suspend(options?: Pick<SessionSendOptions, "idempotencyKey">): Promise<SessionStateChangeAccepted>;
254
279
  cancel(options?: Pick<SessionSendOptions, "idempotencyKey">): Promise<SessionStateChangeAccepted>;
255
280
  resume(options?: Pick<SessionSendOptions, "idempotencyKey">): Promise<SessionStateChangeAccepted>;
256
281
  delete(options?: Pick<SessionSendOptions, "idempotencyKey">): Promise<void>;
257
282
  /**
258
- * Accessor for the session's decoded assistant messages (buffered output
259
- * mode: one entry per assistant message). `list()` returns them oldest-first;
260
- * `last()`/`first()` return a single entry or `undefined` when empty.
283
+ * Accessor for the session's assistant messages. `all()` returns them
284
+ * oldest-first; `last()`/`first()` return a single entry or `undefined` when
285
+ * empty. The accessor is callable as a compatibility shim for older
286
+ * `session.messages().list()` callers.
261
287
  */
262
- messages(): SessionMessages;
288
+ get messages(): CallableSessionMessages;
263
289
  /**
264
290
  * Accessor for the session's event stream: the buffered `SessionEvent`
265
291
  * snapshots (`list`/`last`/`first`), the polling `RunEvent` iterator
@@ -454,13 +480,14 @@ export declare class SecretsClient {
454
480
  * `client.whoami()` if you want to introspect which workspace the
455
481
  * token resolves to.
456
482
  */
457
- export declare class AgentExecutor {
483
+ export declare class Aex {
458
484
  #private;
459
485
  readonly agentsMd: AgentsMdClient;
460
486
  readonly files: FilesClient;
461
487
  readonly secrets: SecretsClient;
462
488
  readonly sessions: SessionClient;
463
- constructor(options: AgentExecutorOptions);
489
+ constructor(apiKey: string, options?: Omit<AexOptions, "apiKey" | "apiToken">);
490
+ constructor(options: AexOptions);
464
491
  /**
465
492
  * Internal: satisfies the `SecretUploader` surface so a
466
493
  * `Secret.value(...).upload(client, { name })` promotes an ephemeral secret
@@ -503,7 +530,4 @@ export declare class AgentExecutor {
503
530
  deleteWorkspaceAsset(hash: string): Promise<void>;
504
531
  whoami(): Promise<WhoAmI>;
505
532
  }
506
- /** Canonical SDK client name. `AgentExecutor` remains as a compatibility alias. */
507
- export declare class Aex extends AgentExecutor {
508
- }
509
- export type { OutputFileType, OutputLink, OutputLinkOptions, OutputQuery, PlatformProxyEndpoint, PlatformProxyEndpointAuth };
533
+ export type { OutputFileType, OutputLink, OutputLinkOptions, OutputQuery };