@aexhq/sdk 0.35.0 → 0.37.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 (72) hide show
  1. package/README.md +17 -16
  2. package/dist/_contracts/event-envelope.d.ts +22 -1
  3. package/dist/_contracts/event-envelope.js +26 -2
  4. package/dist/_contracts/event-stream-client.js +7 -1
  5. package/dist/_contracts/index.d.ts +3 -4
  6. package/dist/_contracts/index.js +1 -4
  7. package/dist/_contracts/operations.d.ts +31 -1
  8. package/dist/_contracts/operations.js +64 -1
  9. package/dist/_contracts/run-config.d.ts +2 -4
  10. package/dist/_contracts/run-config.js +2 -7
  11. package/dist/_contracts/run-trace.d.ts +0 -86
  12. package/dist/_contracts/run-trace.js +1 -184
  13. package/dist/_contracts/run-unit.d.ts +14 -25
  14. package/dist/_contracts/run-unit.js +56 -2
  15. package/dist/_contracts/runtime-manifest.d.ts +1 -1
  16. package/dist/_contracts/runtime-security-profile.d.ts +0 -2
  17. package/dist/_contracts/runtime-security-profile.js +0 -9
  18. package/dist/_contracts/runtime-sizes.d.ts +2 -2
  19. package/dist/_contracts/runtime-sizes.js +5 -5
  20. package/dist/_contracts/runtime-types.d.ts +123 -4
  21. package/dist/_contracts/stable.d.ts +1 -1
  22. package/dist/_contracts/stable.js +1 -1
  23. package/dist/_contracts/submission.d.ts +8 -76
  24. package/dist/_contracts/submission.js +5 -472
  25. package/dist/cli.mjs +574 -511
  26. package/dist/cli.mjs.sha256 +1 -1
  27. package/dist/client.d.ts +69 -25
  28. package/dist/client.js +338 -68
  29. package/dist/client.js.map +1 -1
  30. package/dist/index.d.ts +8 -16
  31. package/dist/index.js +5 -17
  32. package/dist/index.js.map +1 -1
  33. package/dist/secret.d.ts +2 -2
  34. package/dist/secret.js +1 -1
  35. package/dist/version.d.ts +1 -1
  36. package/dist/version.js +1 -1
  37. package/docs/authentication.md +92 -0
  38. package/docs/billing.md +112 -0
  39. package/docs/concepts/agent-tools.md +4 -4
  40. package/docs/concepts/composition.md +8 -14
  41. package/docs/concepts/providers-and-runtimes.md +4 -1
  42. package/docs/concepts/runs.md +2 -1
  43. package/docs/concepts/subagents.md +85 -0
  44. package/docs/credentials.md +78 -96
  45. package/docs/defaults.md +9 -15
  46. package/docs/errors.md +132 -0
  47. package/docs/events.md +44 -32
  48. package/docs/limits-and-quotas.md +30 -17
  49. package/docs/limits.md +4 -8
  50. package/docs/mcp.md +5 -6
  51. package/docs/networking.md +75 -59
  52. package/docs/outputs.md +4 -7
  53. package/docs/public-surface.json +4 -4
  54. package/docs/quickstart.md +12 -13
  55. package/docs/run-config.md +7 -4
  56. package/docs/secrets.md +6 -1
  57. package/docs/skills.md +3 -3
  58. package/docs/vision-skills.md +52 -101
  59. package/docs/webhooks.md +132 -0
  60. package/examples/feature-tour.ts +4 -21
  61. package/package.json +1 -1
  62. package/dist/_contracts/proxy-protocol.d.ts +0 -305
  63. package/dist/_contracts/proxy-protocol.js +0 -297
  64. package/dist/_contracts/proxy-validation.d.ts +0 -19
  65. package/dist/_contracts/proxy-validation.js +0 -51
  66. package/dist/data-tools.d.ts +0 -82
  67. package/dist/data-tools.js +0 -251
  68. package/dist/data-tools.js.map +0 -1
  69. package/dist/proxy-endpoint.d.ts +0 -131
  70. package/dist/proxy-endpoint.js +0 -144
  71. package/dist/proxy-endpoint.js.map +0 -1
  72. package/examples/chat-corpus.ts +0 -84
@@ -1 +1 @@
1
- ebfa6eb1106a2447b2462511c45f0c96874889e3189a78fd4a66521d663bde76 cli.mjs
1
+ 0b259b81011fcda9d15954453cc67f17d1b28add9a32903218d068c3dd1c2e9d cli.mjs
package/dist/client.d.ts CHANGED
@@ -1,16 +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 BillingCheckoutRequest, type BillingHostedSession, type BillingLedgerPage, type BillingLedgerQuery, type BillingPortalRequest, type BillingSummary, 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 WebhookSigningSecret, 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";
7
6
  import { type RetryOptions } from "./retry.js";
8
7
  import { Secret } from "./secret.js";
9
8
  import { SkillTool } from "./skill-tool.js";
10
9
  import { Tool } from "./tool.js";
11
- export interface AgentExecutorOptions {
10
+ export interface AexOptions {
12
11
  /** Workspace-scoped SDK API token. */
13
- readonly apiToken: string;
12
+ readonly apiKey?: string;
13
+ /** @deprecated Use `apiKey`; kept as a source-compatible alias during launch. */
14
+ readonly apiToken?: string;
14
15
  /**
15
16
  * API plane root, e.g. `https://aex.example.com`. Optional —
16
17
  * defaults to the canonical hosted URL (`https://api.aex.dev`).
@@ -37,7 +38,7 @@ export interface AgentExecutorOptions {
37
38
  readonly retry?: RetryOptions | false;
38
39
  }
39
40
  /**
40
- * The settle-consistent result of {@link AgentExecutor.run}:
41
+ * The settle-consistent result of {@link Aex.run}:
41
42
  * the one-shot session record plus its events, decoded trace, assistant text,
42
43
  * and captured outputs — everything a "do it and give me the result" caller
43
44
  * needs without hand-rolling a session/message/stream loop.
@@ -57,6 +58,8 @@ export interface RunResult {
57
58
  readonly ok: boolean;
58
59
  /** The assistant's final text. */
59
60
  readonly text: string;
61
+ /** Assistant messages projected from the settled event stream. */
62
+ readonly messages: readonly Message[];
60
63
  /** The session turn event stream. */
61
64
  readonly events: readonly RunEvent[];
62
65
  /** Decoded view of the events: tool calls + usage + assistant text. */
@@ -70,7 +73,7 @@ export interface RunResult {
70
73
  /** The run's error message when `!ok`. */
71
74
  readonly error?: string;
72
75
  }
73
- /** Options for {@link AgentExecutor.run}. */
76
+ /** Options for {@link Aex.run}. */
74
77
  export interface RunCollectOptions {
75
78
  /** Overall wait budget (ms) for the one-shot session turn to park. */
76
79
  readonly timeoutMs?: number;
@@ -102,9 +105,8 @@ export interface SessionOverrides {
102
105
  * - `agentsMd` / `files` — local composition instances
103
106
  * (`AgentsMd.fromContent` / `File.fromBytes`, …), materialized to the
104
107
  * hosted asset store before the session lands.
105
- * - `mcpServers` / `proxyEndpoints` — instances whose secrets are split into
106
- * the vaulted secrets channel server-side; the public submission carries
107
- * 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.
108
110
  * - `apiKeys` — the BYOK provider key(s), keyed by provider. A key for the
109
111
  * selected provider is REQUIRED. The platform never holds a long-lived
110
112
  * provider key on your behalf.
@@ -158,7 +160,6 @@ export interface SessionCreateOptions {
158
160
  readonly outputMode?: OutputMode;
159
161
  readonly metadata?: PlatformSubmission["metadata"];
160
162
  readonly idempotencyKey?: string;
161
- readonly proxyEndpoints?: readonly ProxyEndpoint[];
162
163
  /** BYOK provider key(s), keyed by provider. */
163
164
  readonly apiKeys?: Partial<Record<RunProvider, string>>;
164
165
  readonly environment?: SessionEnvironmentOptions;
@@ -199,6 +200,7 @@ export interface SessionTurnResult {
199
200
  readonly text: string;
200
201
  readonly events: readonly SessionEvent[];
201
202
  readonly outputs: readonly Output[];
203
+ readonly messages: readonly Message[];
202
204
  }
203
205
  export interface SessionRunResult extends SessionTurnResult {
204
206
  }
@@ -208,14 +210,18 @@ export declare class SessionTurnStream implements AsyncIterable<SessionEvent> {
208
210
  [Symbol.asyncIterator](): AsyncIterator<SessionEvent>;
209
211
  done(): Promise<SessionTurnResult>;
210
212
  }
213
+ type CallableSessionMessages = SessionMessages & (() => SessionMessages);
214
+ export type Message = SessionMessage;
211
215
  /**
212
- * Accessor over the session's decoded assistant messages. `session.messages()`
213
- * 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.
214
218
  */
215
219
  export interface SessionMessages {
216
- list(): Promise<readonly AssistantTextEntry[]>;
217
- last(): Promise<AssistantTextEntry | undefined>;
218
- 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>;
219
225
  }
220
226
  /**
221
227
  * Accessor over the session's event stream (`session.events()`): the buffered
@@ -274,11 +280,12 @@ export declare class SessionHandle {
274
280
  resume(options?: Pick<SessionSendOptions, "idempotencyKey">): Promise<SessionStateChangeAccepted>;
275
281
  delete(options?: Pick<SessionSendOptions, "idempotencyKey">): Promise<void>;
276
282
  /**
277
- * Accessor for the session's decoded assistant messages (buffered output
278
- * mode: one entry per assistant message). `list()` returns them oldest-first;
279
- * `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.
280
287
  */
281
- messages(): SessionMessages;
288
+ get messages(): CallableSessionMessages;
282
289
  /**
283
290
  * Accessor for the session's event stream: the buffered `SessionEvent`
284
291
  * snapshots (`list`/`last`/`first`), the polling `RunEvent` iterator
@@ -311,6 +318,12 @@ export declare class SessionHandle {
311
318
  * Fetch the self-contained `RunUnit` for this session: parsed submission,
312
319
  * attempts, indexed events, outputs, capture failures, proxy-call audit, and
313
320
  * resolved skills. Use this when you need fields beyond the session record.
321
+ *
322
+ * On the managed plane this is a LEAN summary — the aggregate collections
323
+ * (`attempts` / `events.entries` / `outputs` / `rawEventPages`) default to
324
+ * empty. For authoritative per-run data use `outputs()` / `events()` /
325
+ * `messages()`. The returned shape is always type-valid (never `undefined`
326
+ * where the type promises an array/page), so array/page access is safe.
314
327
  */
315
328
  unit(): Promise<RunUnit>;
316
329
  /**
@@ -473,13 +486,14 @@ export declare class SecretsClient {
473
486
  * `client.whoami()` if you want to introspect which workspace the
474
487
  * token resolves to.
475
488
  */
476
- export declare class AgentExecutor {
489
+ export declare class Aex {
477
490
  #private;
478
491
  readonly agentsMd: AgentsMdClient;
479
492
  readonly files: FilesClient;
480
493
  readonly secrets: SecretsClient;
481
494
  readonly sessions: SessionClient;
482
- constructor(options: AgentExecutorOptions);
495
+ constructor(apiKey: string, options?: Omit<AexOptions, "apiKey" | "apiToken">);
496
+ constructor(options: AexOptions);
483
497
  /**
484
498
  * Internal: satisfies the `SecretUploader` surface so a
485
499
  * `Secret.value(...).upload(client, { name })` promotes an ephemeral secret
@@ -521,8 +535,38 @@ export declare class AgentExecutor {
521
535
  */
522
536
  deleteWorkspaceAsset(hash: string): Promise<void>;
523
537
  whoami(): Promise<WhoAmI>;
538
+ /**
539
+ * Read the workspace billing summary: prepaid `balanceUsd`, current-month
540
+ * `monthSpendUsd`, the enforced `spendCapUsd`, and plan fields. Backed by
541
+ * `GET /api/billing` (scope `billing:read`). The result is additive-tolerant:
542
+ * fields a newer deployment reports that this SDK does not know yet pass
543
+ * through on the returned object.
544
+ */
545
+ billing(): Promise<BillingSummary>;
546
+ /**
547
+ * Create a hosted checkout session for a paid plan (`pro` or `team`).
548
+ * Open the returned `url` in a browser. Plan activation happens after
549
+ * checkout completes.
550
+ */
551
+ billingCheckout(request: BillingCheckoutRequest): Promise<BillingHostedSession>;
552
+ /**
553
+ * Create a hosted billing-portal session for the workspace customer.
554
+ * Open the returned `url` in a browser.
555
+ */
556
+ billingPortal(request?: BillingPortalRequest): Promise<BillingHostedSession>;
557
+ /**
558
+ * Read recent workspace credit-ledger rows, newest first — top-ups, run
559
+ * charges, and redemptions with signed `amountUsd`. Backed by
560
+ * `GET /api/billing/ledger`; `limit` is clamped server-side to [1, 100]
561
+ * (default 25). Not cursor-paged.
562
+ */
563
+ billingLedger(query?: BillingLedgerQuery): Promise<BillingLedgerPage>;
564
+ /**
565
+ * Reveal the workspace webhook signing secret (creating one on first use) —
566
+ * the `whsec_<base64>` value `verifyAexWebhook` takes as `secret`. Backed by
567
+ * `POST /api/webhook/signing-secret`; repeat calls return the SAME value (the
568
+ * hosted API does not rotate it). Treat the reveal as sensitive: never log it.
569
+ */
570
+ webhookSigningSecret(): Promise<WebhookSigningSecret>;
524
571
  }
525
- /** Canonical SDK client name. `AgentExecutor` remains as a compatibility alias. */
526
- export declare class Aex extends AgentExecutor {
527
- }
528
- export type { OutputFileType, OutputLink, OutputLinkOptions, OutputQuery, PlatformProxyEndpoint, PlatformProxyEndpointAuth };
572
+ export type { OutputFileType, OutputLink, OutputLinkOptions, OutputQuery };