@aexhq/sdk 0.40.16 → 0.41.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 (130) hide show
  1. package/README.md +25 -25
  2. package/dist/_contracts/api-key.d.ts +6 -4
  3. package/dist/_contracts/api-key.js +20 -7
  4. package/dist/_contracts/connection-ticket.d.ts +5 -5
  5. package/dist/_contracts/connection-ticket.js +7 -7
  6. package/dist/_contracts/error-codes.d.ts +1 -1
  7. package/dist/_contracts/error-codes.js +4 -4
  8. package/dist/_contracts/error-factory.js +1 -1
  9. package/dist/_contracts/event-envelope.d.ts +41 -41
  10. package/dist/_contracts/event-envelope.js +49 -49
  11. package/dist/_contracts/event-stream-client.d.ts +9 -9
  12. package/dist/_contracts/event-stream-client.js +5 -5
  13. package/dist/_contracts/event-view.d.ts +6 -6
  14. package/dist/_contracts/event-view.js +12 -12
  15. package/dist/_contracts/http.js +1 -1
  16. package/dist/_contracts/index.d.ts +10 -10
  17. package/dist/_contracts/index.js +9 -9
  18. package/dist/_contracts/models.d.ts +17 -17
  19. package/dist/_contracts/models.js +14 -14
  20. package/dist/_contracts/operations.d.ts +79 -82
  21. package/dist/_contracts/operations.js +233 -243
  22. package/dist/_contracts/provider-support.d.ts +2 -2
  23. package/dist/_contracts/runner-event.d.ts +8 -8
  24. package/dist/_contracts/runner-event.js +9 -9
  25. package/dist/_contracts/runtime-manifest.d.ts +12 -12
  26. package/dist/_contracts/runtime-manifest.js +1 -1
  27. package/dist/_contracts/runtime-sizes.d.ts +12 -12
  28. package/dist/_contracts/runtime-sizes.js +18 -18
  29. package/dist/_contracts/runtime-types.d.ts +117 -117
  30. package/dist/_contracts/runtime-types.js +2 -2
  31. package/dist/_contracts/sdk-errors.d.ts +3 -3
  32. package/dist/_contracts/sdk-errors.js +4 -4
  33. package/dist/_contracts/sdk-secrets.js +10 -10
  34. package/dist/_contracts/session-artifacts.d.ts +151 -0
  35. package/dist/_contracts/session-artifacts.js +234 -0
  36. package/dist/_contracts/{run-config.d.ts → session-config.d.ts} +29 -29
  37. package/dist/_contracts/{run-config.js → session-config.js} +37 -37
  38. package/dist/_contracts/session-cost.d.ts +140 -0
  39. package/dist/_contracts/{run-cost.js → session-cost.js} +94 -94
  40. package/dist/_contracts/{run-custody.d.ts → session-custody.d.ts} +16 -16
  41. package/dist/_contracts/{run-custody.js → session-custody.js} +42 -42
  42. package/dist/_contracts/session-record.d.ts +112 -0
  43. package/dist/_contracts/{run-record.js → session-record.js} +23 -23
  44. package/dist/_contracts/session-retention.d.ts +209 -0
  45. package/dist/_contracts/{run-retention.js → session-retention.js} +116 -116
  46. package/dist/_contracts/{run-unit.d.ts → session-unit.d.ts} +38 -38
  47. package/dist/_contracts/{run-unit.js → session-unit.js} +33 -33
  48. package/dist/_contracts/side-effect-audit.d.ts +14 -14
  49. package/dist/_contracts/side-effect-audit.js +38 -38
  50. package/dist/_contracts/sse.d.ts +1 -1
  51. package/dist/_contracts/sse.js +0 -0
  52. package/dist/_contracts/stable.d.ts +1 -1
  53. package/dist/_contracts/stable.js +1 -1
  54. package/dist/_contracts/status.d.ts +18 -18
  55. package/dist/_contracts/status.js +19 -19
  56. package/dist/_contracts/submission.d.ts +101 -99
  57. package/dist/_contracts/submission.js +96 -96
  58. package/dist/_contracts/{run-trace.d.ts → turn-trace.d.ts} +1 -1
  59. package/dist/_contracts/webhook-verify.d.ts +1 -1
  60. package/dist/_contracts/webhook-verify.js +1 -1
  61. package/dist/agents-md.d.ts +4 -4
  62. package/dist/agents-md.js +5 -5
  63. package/dist/agents-md.js.map +1 -1
  64. package/dist/bundle.d.ts +1 -1
  65. package/dist/bundle.js +1 -1
  66. package/dist/bundle.js.map +1 -1
  67. package/dist/cli.mjs +578 -621
  68. package/dist/cli.mjs.sha256 +1 -1
  69. package/dist/client.d.ts +141 -155
  70. package/dist/client.js +236 -245
  71. package/dist/client.js.map +1 -1
  72. package/dist/fetch-archive.js +3 -3
  73. package/dist/file.d.ts +7 -7
  74. package/dist/file.js +8 -8
  75. package/dist/file.js.map +1 -1
  76. package/dist/index.d.ts +10 -10
  77. package/dist/index.js +8 -8
  78. package/dist/index.js.map +1 -1
  79. package/dist/mcp-server.d.ts +1 -1
  80. package/dist/retry.d.ts +1 -1
  81. package/dist/secret.d.ts +6 -6
  82. package/dist/secret.js +6 -6
  83. package/dist/secret.js.map +1 -1
  84. package/dist/skill.d.ts +2 -2
  85. package/dist/skill.js +3 -3
  86. package/dist/skill.js.map +1 -1
  87. package/dist/tool.js +2 -2
  88. package/dist/tool.js.map +1 -1
  89. package/dist/version.d.ts +1 -1
  90. package/dist/version.js +1 -1
  91. package/dist/version.js.map +1 -1
  92. package/docs/authentication.md +11 -11
  93. package/docs/billing.md +3 -3
  94. package/docs/cleanup.md +5 -5
  95. package/docs/concepts/agent-tools.md +5 -5
  96. package/docs/concepts/composition.md +3 -3
  97. package/docs/concepts/providers-and-runtimes.md +3 -3
  98. package/docs/concepts/{runs.md → sessions.md} +8 -8
  99. package/docs/concepts/subagents.md +16 -16
  100. package/docs/credentials.md +7 -7
  101. package/docs/defaults.md +14 -14
  102. package/docs/errors.md +10 -10
  103. package/docs/events.md +26 -26
  104. package/docs/files.md +267 -0
  105. package/docs/limits-and-quotas.md +35 -35
  106. package/docs/limits.md +6 -6
  107. package/docs/mcp.md +3 -3
  108. package/docs/networking.md +24 -24
  109. package/docs/provider-runtime-capabilities.md +1 -1
  110. package/docs/public-surface.json +6 -6
  111. package/docs/quickstart.md +13 -13
  112. package/docs/release.md +5 -5
  113. package/docs/retries.md +3 -3
  114. package/docs/secrets.md +16 -16
  115. package/docs/session-config.md +58 -0
  116. package/docs/{run-record.md → session-record.md} +16 -16
  117. package/docs/skills.md +9 -9
  118. package/docs/vision-skills.md +7 -7
  119. package/docs/webhooks.md +11 -11
  120. package/examples/feature-tour.ts +17 -17
  121. package/examples/spike-settle-latency.ts +11 -11
  122. package/package.json +1 -1
  123. package/dist/_contracts/run-artifacts.d.ts +0 -49
  124. package/dist/_contracts/run-artifacts.js +0 -102
  125. package/dist/_contracts/run-cost.d.ts +0 -140
  126. package/dist/_contracts/run-record.d.ts +0 -116
  127. package/dist/_contracts/run-retention.d.ts +0 -209
  128. package/docs/outputs.md +0 -267
  129. package/docs/run-config.md +0 -58
  130. /package/dist/_contracts/{run-trace.js → turn-trace.js} +0 -0
@@ -1,6 +1,6 @@
1
- import type { AgentsMdRef, FileRef, McpServerRef, ResolvedSkillRef, SkillRef, ToolRef } from "./run-config.js";
1
+ import type { AgentsMdRef, FileRef, McpServerRef, ResolvedSkillRef, SkillRef, ToolRef } from "./session-config.js";
2
2
  import { type RuntimeSize } from "./runtime-sizes.js";
3
- import { type RunModel } from "./models.js";
3
+ import { type ModelName } from "./models.js";
4
4
  import { type RuntimeSecurityProfileName } from "./runtime-security-profile.js";
5
5
  export type JsonPrimitive = string | number | boolean | null;
6
6
  export type JsonValue = JsonPrimitive | JsonValue[] | {
@@ -8,9 +8,9 @@ export type JsonValue = JsonPrimitive | JsonValue[] | {
8
8
  };
9
9
  /**
10
10
  * Networking + runtime-package snapshot carried inside a flat submission
11
- * so the hosted API can deep-clone and mutate it per run (e.g. injecting the
11
+ * so the hosted API can deep-clone and mutate it per session (e.g. injecting the
12
12
  * proxy hostname into `allowed_hosts`) without sharing state across
13
- * concurrent runs.
13
+ * concurrent sessions.
14
14
  *
15
15
  * `envVars` is the customer-controlled key/value bag delivered into the
16
16
  * managed container process and mirrored in the mounted `RUNTIME.env` /
@@ -96,14 +96,14 @@ export interface PlatformPackageInput {
96
96
  */
97
97
  export declare function packageInstallString(pkg: PlatformPackage): string;
98
98
  /**
99
- * Run-time provider selector. Aex exposes one customer interface
99
+ * SessionRecord-time provider selector. Aex exposes one customer interface
100
100
  * for every provider. All new submissions execute through the managed
101
101
  * runtime; provider selection only decides which upstream model route
102
102
  * the managed provider-proxy uses.
103
103
  */
104
- export declare const RUN_PROVIDERS: readonly ["anthropic", "deepseek", "openai", "gemini", "mistral", "openrouter", "doubao", "doubao-cn"];
105
- export type RunProvider = (typeof RUN_PROVIDERS)[number];
106
- export declare const DEFAULT_RUN_PROVIDER: RunProvider;
104
+ export declare const PROVIDERS: readonly ["anthropic", "deepseek", "openai", "gemini", "mistral", "openrouter", "doubao", "doubao-cn"];
105
+ export type ProviderName = (typeof PROVIDERS)[number];
106
+ export declare const DEFAULT_PROVIDER: ProviderName;
107
107
  /**
108
108
  * Symbol-style accessors for the closed provider set. Prefer these over raw
109
109
  * strings so an invalid token is a compile error, not a runtime 400 — e.g.
@@ -112,8 +112,8 @@ export declare const DEFAULT_RUN_PROVIDER: RunProvider;
112
112
  * submission field; name it explicitly with one of these constants rather than
113
113
  * relying on the model alone to determine routing.
114
114
  *
115
- * Every value mirrors {@link RUN_PROVIDERS} exactly; a unit test asserts
116
- * `Object.values(Providers)` deep-equals `RUN_PROVIDERS` so the two can never
115
+ * Every value mirrors {@link PROVIDERS} exactly; a unit test asserts
116
+ * `Object.values(Providers)` deep-equals `PROVIDERS` so the two can never
117
117
  * drift.
118
118
  */
119
119
  export declare const Providers: {
@@ -140,8 +140,8 @@ export interface PlatformMcpServerSecret {
140
140
  readonly headers?: Record<string, string>;
141
141
  }
142
142
  /**
143
- * Per-run inline secrets bundle. `apiKeys` holds the BYOK provider keys, keyed
144
- * by {@link RunProvider}. A run REQUIRES a key for its own `provider`; it MAY
143
+ * Per-session inline secrets bundle. `apiKeys` holds the BYOK provider keys, keyed
144
+ * by {@link ProviderName}. A session REQUIRES a key for its own `provider`; it MAY
145
145
  * carry keys for additional providers so a subagent spawned with a
146
146
  * different-family model inherits them server-side from the vault (the keys
147
147
  * never transit the container). `mcpServers` credentials are cross-provider
@@ -149,14 +149,14 @@ export interface PlatformMcpServerSecret {
149
149
  * client).
150
150
  */
151
151
  export interface PlatformInlineSecrets {
152
- readonly apiKeys?: Partial<Record<RunProvider, string>>;
152
+ readonly apiKeys?: Partial<Record<ProviderName, string>>;
153
153
  readonly mcpServers?: readonly PlatformMcpServerSecret[];
154
154
  /**
155
- * Per-run env-var secret VALUES, keyed by env name. Each entry pairs with a
155
+ * Per-session env-var secret VALUES, keyed by env name. Each entry pairs with a
156
156
  * `submission.secretEnv[<envName>] = { ephemeral: true }` declaration. Lives
157
157
  * in the secrets channel so it is vaulted and excluded from the idempotency
158
158
  * hash; the runtime injects it as the named env var and it is deleted at the
159
- * run's terminal. Workspace `{ ref }` bindings resolve server-side and never
159
+ * session's terminal. Workspace `{ ref }` bindings resolve server-side and never
160
160
  * appear here.
161
161
  */
162
162
  readonly envSecrets?: Readonly<Record<string, string>>;
@@ -170,7 +170,7 @@ export declare const SECRET_HANDLE_PATTERN: RegExp;
170
170
  * One `submission.secretEnv` entry — VALUE-FREE, so it rides the (hashed)
171
171
  * submission safely. `{ ref }` resolves a workspace secret server-side;
172
172
  * `{ ephemeral: true }` pairs with a `secrets.envSecrets[<envName>]` value
173
- * (per-run, vaulted, deleted at the run's terminal).
173
+ * (per-session, vaulted, deleted at the session's terminal).
174
174
  */
175
175
  export type PlatformSecretEnvEntry = {
176
176
  readonly ref: string;
@@ -201,7 +201,7 @@ export declare function optionalPositiveInt(input: unknown, field: string): numb
201
201
  */
202
202
  export declare function optionalPositiveNumber(input: unknown, field: string): number | undefined;
203
203
  /**
204
- * Wire-level submission posted to /api/runs in the flat surface. The
204
+ * Wire-level submission posted to /api/sessions in the flat surface. The
205
205
  * `prompt` is always an array internally so the hosted API, the audit log,
206
206
  * and the BFF idempotency hash all see one shape. `mcpServers` carries
207
207
  * only the non-secret half; bearer headers travel in
@@ -212,7 +212,7 @@ export declare function optionalPositiveNumber(input: unknown, field: string): n
212
212
  * first-class input on `skills` (by-name refs), NOT part of `tools`.
213
213
  */
214
214
  export interface PlatformSubmission {
215
- readonly model: RunModel;
215
+ readonly model: ModelName;
216
216
  readonly system?: string;
217
217
  readonly prompt: readonly string[];
218
218
  readonly tools?: readonly ToolRef[];
@@ -221,7 +221,7 @@ export interface PlatformSubmission {
221
221
  * public ingress shape the SDK sends and the ONLY skill field the idempotency
222
222
  * hash covers. The platform resolves each name to the workspace skill's
223
223
  * current bytes at submit time; a re-upload under the same name changes what
224
- * later runs see (the name-only ref, and therefore the hash, is unchanged).
224
+ * later sessions see (the name-only ref, and therefore the hash, is unchanged).
225
225
  */
226
226
  readonly skills?: readonly SkillRef[];
227
227
  /**
@@ -240,7 +240,7 @@ export interface PlatformSubmission {
240
240
  * value is `{ ref }` (resolve a workspace secret server-side) or
241
241
  * `{ ephemeral: true }` (value supplied in `secrets.envSecrets`, vaulted and
242
242
  * deleted at terminal). The runtime injects the resolved value as the named
243
- * env var. Lifecycle parity with skills/files: per-run by default, persisted
243
+ * env var. Lifecycle parity with skills/files: per-session by default, persisted
244
244
  * only when promoted to the workspace store.
245
245
  */
246
246
  readonly secretEnv?: Readonly<Record<string, PlatformSecretEnvEntry>>;
@@ -248,16 +248,17 @@ export interface PlatformSubmission {
248
248
  readonly securityProfile?: RuntimeSecurityProfileName;
249
249
  readonly metadata?: Record<string, JsonValue>;
250
250
  /**
251
- * Output capture policy. Omit `outputs.allowedDirs` to capture the whole
252
- * filesystem delta; provide it to narrow capture to the listed roots.
253
- * `outputs.deniedDirs` subtracts denied roots/patterns from the allowed set.
251
+ * File capture policy. Omit `fileCapture.allowedDirs` to expose regular
252
+ * workspace files from the latest complete checkpoint; provide it to narrow
253
+ * capture to the listed roots. `fileCapture.deniedDirs` subtracts denied
254
+ * roots/patterns from the allowed set.
254
255
  */
255
- readonly outputs?: PlatformOutputCaptureConfig;
256
+ readonly fileCapture?: PlatformFileCaptureConfig;
256
257
  /**
257
258
  * Whether to inject the standard builtin tool set ({@link DEFAULT_BUILTIN_TOOLS}).
258
259
  *
259
260
  * - omitted / `true` (default): inject the standard builtins.
260
- * - `false`: inject NO builtins — useful for a pure-MCP / pure-custom run.
261
+ * - `false`: inject NO builtins — useful for a pure-MCP / pure-custom session.
261
262
  *
262
263
  * Pick a narrow subset alongside `includeBuiltinTools: false` by listing
263
264
  * builtin names in `tools` (a bare-string builtin reference; prefer
@@ -268,7 +269,7 @@ export interface PlatformSubmission {
268
269
  * Explicit builtin tool NAME references the caller listed in the wire `tools`
269
270
  * union (the bare-string members), extracted at parse time. Each is a member
270
271
  * of {@link BUILTIN_TOOL_NAMES}. Composed with {@link includeBuiltinTools} via
271
- * {@link resolveBuiltinToolNames} to produce the run's final builtin tool set.
272
+ * {@link resolveBuiltinToolNames} to produce the session's final builtin tool set.
272
273
  * `tools` itself carries only the custom tool bundles ({@link ToolRef}).
273
274
  */
274
275
  readonly builtinTools?: readonly BuiltinToolName[];
@@ -284,7 +285,7 @@ export interface PlatformSubmission {
284
285
  /**
285
286
  * Structured-output policy. `{ kind: 'text' }` (default) is free-form; a
286
287
  * `{ kind: 'json_schema', … }` requests provider-native constrained decode.
287
- * The run's typed outcome is then `decoded | refused` — no untyped path yields
288
+ * The session's typed outcome is then `decoded | refused` — no untyped path yields
288
289
  * a hallucinated object. Fail-closed for a provider lacking the capability.
289
290
  */
290
291
  readonly responseFormat?: ResponseFormat;
@@ -298,21 +299,22 @@ export interface PlatformSubmission {
298
299
  /**
299
300
  * Platform-injection controls. The platform prepends a small system
300
301
  * prompt (see `platformSystemPrompt`) ahead of `system` to explain
301
- * managed-run expectations such as durable file capture. Set
302
+ * managed-session expectations such as durable file capture. Set
302
303
  * `systemPrompt: "off"` to suppress that injection and have the runtime
303
304
  * see only the customer's own `system`. Omitting the field (or
304
305
  * `systemPrompt: "default"`) keeps the injection on.
305
306
  *
306
- * This does not change output capture scope. Omitted
307
- * `outputs.allowedDirs` means capture all created/modified files; explicit
308
- * `outputs.allowedDirs` narrows it.
307
+ * This does not change file capture scope. Omitted
308
+ * `fileCapture.allowedDirs` means expose regular workspace files from the
309
+ * latest complete checkpoint; explicit `fileCapture.allowedDirs` narrows it.
309
310
  */
310
311
  readonly platform?: PlatformInjectionConfig;
311
312
  }
312
- export interface PlatformOutputCaptureConfig {
313
+ export interface PlatformFileCaptureConfig {
313
314
  /**
314
- * Allowed capture roots. Omit or pass an empty list to use the default
315
- * whole-filesystem delta capture. Entries are absolute UNIX paths.
315
+ * Allowed capture roots. Omit or pass an empty list to expose regular
316
+ * workspace files from the latest complete checkpoint. Entries are absolute
317
+ * UNIX paths.
316
318
  */
317
319
  readonly allowedDirs?: readonly string[];
318
320
  /**
@@ -321,29 +323,29 @@ export interface PlatformOutputCaptureConfig {
321
323
  */
322
324
  readonly deniedDirs?: readonly string[];
323
325
  /**
324
- * Maximum time the platform may spend capturing outputs after the agent exits.
326
+ * Maximum time the platform may spend capturing files after the agent exits.
325
327
  * Positive integer milliseconds; values above the platform maximum are clamped.
326
328
  */
327
329
  readonly captureTimeoutMs?: number;
328
330
  /** Maximum size of a single captured file in bytes. Positive integer. */
329
331
  readonly maxFileBytes?: number;
330
- /** Maximum total captured output bytes for the run. Positive integer. */
332
+ /** Maximum total captured file bytes for the session. Positive integer. */
331
333
  readonly maxTotalBytes?: number;
332
- /** Maximum number of captured files for the run. Positive integer. */
334
+ /** Maximum number of captured files for the session. Positive integer. */
333
335
  readonly maxFiles?: number;
334
336
  }
335
337
  export interface PlatformInjectionConfig {
336
338
  readonly systemPrompt?: "default" | "off";
337
339
  }
338
- export interface PlatformRunSubmissionRequest {
340
+ export interface PlatformSessionSubmissionRequest {
339
341
  readonly workspaceId: string;
340
342
  readonly idempotencyKey: string;
341
343
  /**
342
344
  * Provider selector. Always populated after parsing — absent on the
343
- * wire means {@link DEFAULT_RUN_PROVIDER}. All providers are dispatched
345
+ * wire means {@link DEFAULT_PROVIDER}. All providers are dispatched
344
346
  * through the managed runtime.
345
347
  */
346
- readonly provider: RunProvider;
348
+ readonly provider: ProviderName;
347
349
  readonly submission: PlatformSubmission;
348
350
  readonly secrets: PlatformInlineSecrets;
349
351
  /**
@@ -352,55 +354,55 @@ export interface PlatformRunSubmissionRequest {
352
354
  */
353
355
  readonly runtimeSize?: RuntimeSize;
354
356
  /**
355
- * Run deadline in milliseconds, normalised by the parser from the wire
357
+ * SessionRecord deadline in milliseconds, normalised by the parser from the wire
356
358
  * `timeout` duration string (bounded to [1m, 8h]). Absent ⇒
357
- * {@link DEFAULT_RUN_TIMEOUT_MS} (8h). Applies to the managed runner's
359
+ * {@link DEFAULT_SESSION_TIMEOUT_MS} (8h). Applies to the managed runner's
358
360
  * terminal wait window and self-kill deadline.
359
361
  */
360
362
  readonly timeoutMs?: number;
361
363
  /**
362
- * Optional per-run callback URL. The platform delivers exactly the terminal
363
- * `run.finished` event to this URL at the settle-consistent barrier, signed
364
+ * Optional per-session callback URL. The platform delivers exactly the terminal
365
+ * `session.finished` event to this URL at the settle-consistent barrier, signed
364
366
  * Standard-Webhooks style. It is a sibling of {@link idempotencyKey} — an
365
367
  * operational/delivery concern, NOT part of the hashed submission brief, so
366
368
  * the same idempotency key with a different callback URL never 409s and the
367
369
  * field never enters `request_hash`.
368
370
  */
369
- readonly webhook?: RunWebhookSpec;
371
+ readonly webhook?: SessionWebhookSpec;
370
372
  /**
371
- * Optional per-run override of the lineage limits (max concurrent child runs,
372
- * max subagent depth, per-run spend cap). These are dials the client may
373
+ * Optional per-session override of the lineage limits (max concurrent child sessions,
374
+ * max subagent depth, per-session spend cap). These are dials the client may
373
375
  * *request*; the server resolves them against the per-workspace ceiling and
374
376
  * the hard platform ceiling (clamping happens in the resolver, NOT this
375
377
  * parser). Absent fields fall back to the platform defaults. Only shape +
376
378
  * positivity are validated here.
377
379
  */
378
- readonly limits?: RunLimits;
380
+ readonly limits?: SessionLimits;
379
381
  /**
380
- * Optional capacity intent for the run's managed machine. `spot: true` opts
381
- * the run into interruptible capacity; absent / `spot: false` requests
382
+ * Optional capacity intent for the session's managed machine. `spot: true` opts
383
+ * the session into interruptible capacity; absent / `spot: false` requests
382
384
  * standard capacity (the default). Intent only — the managed runtime selects
383
385
  * capacity from it.
384
386
  */
385
- readonly machine?: RunMachine;
387
+ readonly machine?: SessionMachine;
386
388
  }
387
- /** Per-run webhook callback. v1: terminal-only; the URL must be https. */
388
- export interface RunWebhookSpec {
389
+ /** Per-session webhook callback. v1: terminal-only; the URL must be https. */
390
+ export interface SessionWebhookSpec {
389
391
  readonly url: string;
390
392
  }
391
393
  /**
392
- * Per-run override of the lineage limits. Both fields are optional; an absent
393
- * field means "use the platform default". The parser ({@link parseRunLimits})
394
+ * Per-session override of the lineage limits. Both fields are optional; an absent
395
+ * field means "use the platform default". The parser ({@link parseSessionLimits})
394
396
  * only validates positivity/shape — clamping to the workspace + platform
395
- * ceilings is the resolver's job (see `resolveRunLimits` in `@aexhq/shared`).
397
+ * ceilings is the resolver's job (see `resolveSessionLimits` in `@aexhq/shared`).
396
398
  */
397
- export interface RunLimits {
398
- readonly maxConcurrentChildRuns?: number;
399
+ export interface SessionLimits {
400
+ readonly maxConcurrentChildSessions?: number;
399
401
  readonly maxSubagentDepth?: number;
400
402
  /**
401
- * Per-run spend cap in USD (defense-in-depth). The platform kills the run once
402
- * it would out-spend the cap. A positive number; omitted ⇒ unbounded per-run
403
- * (only the run's wall-clock `timeout` + the per-workspace spend cap apply).
403
+ * Per-session spend cap in USD (defense-in-depth). The platform kills the session once
404
+ * it would out-spend the cap. A positive number; omitted ⇒ unbounded per-session
405
+ * (only the session's wall-clock `timeout` + the per-workspace spend cap apply).
404
406
  * Only shape/positivity are validated here.
405
407
  *
406
408
  * The frozen boot session config the managed runtime folds the loop against
@@ -409,9 +411,9 @@ export interface RunLimits {
409
411
  */
410
412
  readonly maxSpendUsd?: number;
411
413
  /**
412
- * Maximum number of agent ITERATIONS (turns) the run may take before the
414
+ * Maximum number of agent ITERATIONS (turns) the session may take before the
413
415
  * platform parks it terminal. A positive integer; omitted ⇒ the platform
414
- * default (`RUN_DEFAULT_MAX_TURNS`). Previously a bare server literal absent
416
+ * default (`SESSION_DEFAULT_MAX_TURNS`). Previously a bare server literal absent
415
417
  * from both the public contract and the limits SSoT — now a settable dial.
416
418
  * Only shape/positivity are validated here; clamping to the ceiling is the
417
419
  * resolver's job.
@@ -419,12 +421,12 @@ export interface RunLimits {
419
421
  readonly maxTurns?: number;
420
422
  }
421
423
  /**
422
- * Per-run machine/capacity intent. v1 exposes only `spot`: opt the run into
424
+ * Per-session machine/capacity intent. v1 exposes only `spot`: opt the session into
423
425
  * interruptible capacity (`spot: true`) vs standard capacity (absent /
424
426
  * `spot: false`, the default). Only the boolean intent is public — capacity
425
427
  * selection is a runtime concern.
426
428
  */
427
- export interface RunMachine {
429
+ export interface SessionMachine {
428
430
  readonly spot?: boolean;
429
431
  }
430
432
  /**
@@ -437,20 +439,20 @@ export interface RunMachine {
437
439
  * itself.
438
440
  *
439
441
  * `provider` is also optional on the wire — absent means
440
- * {@link DEFAULT_RUN_PROVIDER} (`anthropic`). The parser fills it in
441
- * before the value enters the run snapshot.
442
+ * {@link DEFAULT_PROVIDER} (`anthropic`). The parser fills it in
443
+ * before the value enters the session snapshot.
442
444
  */
443
- export type PlatformRunSubmissionInput = Omit<PlatformRunSubmissionRequest, "workspaceId" | "provider" | "timeoutMs"> & {
445
+ export type PlatformSessionSubmissionInput = Omit<PlatformSessionSubmissionRequest, "workspaceId" | "provider" | "timeoutMs"> & {
444
446
  readonly workspaceId?: string;
445
- readonly provider?: RunProvider;
447
+ readonly provider?: ProviderName;
446
448
  /**
447
- * Run deadline as a human duration string (`"1h"`, `"90m"`, `"30s"`).
449
+ * SessionRecord deadline as a human duration string (`"1h"`, `"90m"`, `"30s"`).
448
450
  * Parsed + bounded to [1m, 8h] server-side into
449
- * {@link PlatformRunSubmissionRequest.timeoutMs}. Absent ⇒ 8h default.
451
+ * {@link PlatformSessionSubmissionRequest.timeoutMs}. Absent ⇒ 8h default.
450
452
  */
451
453
  readonly timeout?: string;
452
454
  };
453
- export interface ParseRunSubmissionOptions {
455
+ export interface ParseSessionSubmissionOptions {
454
456
  /**
455
457
  * Set by the in-container re-parse of the boot record (`aws-compose.ts`) to
456
458
  * accept trusted-only fields the BFF resolver wrote after ingress — currently
@@ -459,68 +461,68 @@ export interface ParseRunSubmissionOptions {
459
461
  */
460
462
  readonly trustedReparse?: boolean;
461
463
  }
462
- export declare function parseRunSubmissionRequest(input: unknown, options?: ParseRunSubmissionOptions): PlatformRunSubmissionRequest;
464
+ export declare function parseSessionSubmissionRequest(input: unknown, options?: ParseSessionSubmissionOptions): PlatformSessionSubmissionRequest;
463
465
  /**
464
- * Parse + SSRF-shape-validate the optional per-run `webhook`. The URL must be
466
+ * Parse + SSRF-shape-validate the optional per-session `webhook`. The URL must be
465
467
  * https with no userinfo (a `user:pass@host` URL is rejected — credentials must
466
468
  * not ride in a callback URL). Unknown subfields are rejected so the strict
467
469
  * top-level allow-list extends to the nested object. Returns `undefined` when
468
470
  * absent. Delivery-time re-resolution + IP-deny checks live server-side; this
469
471
  * is the submit-time shape gate.
470
472
  */
471
- export declare function parseRunWebhook(input: unknown): RunWebhookSpec | undefined;
473
+ export declare function parseSessionWebhook(input: unknown): SessionWebhookSpec | undefined;
472
474
  /**
473
- * Parse the optional per-run `limits` override. Mirrors {@link parseRunWebhook}:
475
+ * Parse the optional per-session `limits` override. Mirrors {@link parseSessionWebhook}:
474
476
  * absent ⇒ `undefined`; a non-object or any unknown subfield is rejected so the
475
477
  * strict top-level allow-list extends to the nested object. Each present field
476
478
  * is validated as a positive safe integer via {@link optionalPositiveInt}.
477
479
  *
478
480
  * This is a SHAPE/positivity gate only — it does NOT clamp to the workspace or
479
- * platform ceilings (that precedence lives in the resolver, `resolveRunLimits`).
481
+ * platform ceilings (that precedence lives in the resolver, `resolveSessionLimits`).
480
482
  * Only the present fields are returned; an all-absent override (e.g. `{}`)
481
483
  * collapses to `undefined` so it carries no signal onto the request.
482
484
  */
483
- export declare function parseRunLimits(input: unknown): RunLimits | undefined;
485
+ export declare function parseSessionLimits(input: unknown): SessionLimits | undefined;
484
486
  /**
485
- * Boot-session budget fragment. The public submit surface names a run's spend
487
+ * Boot-session budget fragment. The public submit surface names a session's spend
486
488
  * cap `limits.maxSpendUsd`; the frozen boot session config the managed runtime
487
489
  * folds the loop against names the SAME USD value `budgetUsd` — the field the
488
- * session planner reads to enforce/terminate a run that would out-spend its cap.
490
+ * session planner reads to enforce/terminate a session that would out-spend its cap.
489
491
  * This is the single source of truth for that wire→boot name mapping so the two
490
492
  * layers can never drift.
491
493
  *
492
494
  * Returns a fragment safe to spread into `sessionConfig.limits`: `{ budgetUsd }`
493
- * when a cap is set, `{}` when none is (an absent cap stays absent — the run is
494
- * unbounded per-run, subject only to the run timeout + the per-workspace cap).
495
+ * when a cap is set, `{}` when none is (an absent cap stays absent — the session is
496
+ * unbounded per-session, subject only to the session timeout + the per-workspace cap).
495
497
  * Pure: same input ⇒ same output.
496
498
  */
497
- export declare function sessionBudgetLimits(limits: RunLimits | undefined): {
499
+ export declare function sessionBudgetLimits(limits: SessionLimits | undefined): {
498
500
  budgetUsd?: number;
499
501
  };
500
502
  /**
501
- * Parse the optional per-run `machine` capacity intent. Mirrors
502
- * {@link parseRunWebhook}: absent ⇒ `undefined`; a non-object or any unknown
503
+ * Parse the optional per-session `machine` capacity intent. Mirrors
504
+ * {@link parseSessionWebhook}: absent ⇒ `undefined`; a non-object or any unknown
503
505
  * subfield is rejected so the strict top-level allow-list extends to the nested
504
506
  * object. `spot` must be a boolean when present. A no-signal object (e.g.
505
507
  * `machine: {}`) collapses to `undefined` so it never lands an empty object on
506
508
  * the request. An explicit `spot` (true or false) is preserved verbatim. Only
507
509
  * shape is validated here — capacity selection is a runtime concern.
508
510
  */
509
- export declare function parseRunMachine(input: unknown): RunMachine | undefined;
510
- export declare function parseRunProvider(input: unknown): RunProvider;
511
+ export declare function parseSessionMachine(input: unknown): SessionMachine | undefined;
512
+ export declare function parseProviderName(input: unknown): ProviderName;
511
513
  /**
512
514
  * Cross-check the supplied secrets bundle against the credential mode. BYOK
513
- * requires `secrets.apiKeys[provider]` (the key for the run's own `provider`).
514
- * Additional provider keys are optional (validated for shape only) so the run
515
+ * requires `secrets.apiKeys[provider]` (the key for the session's own `provider`).
516
+ * Additional provider keys are optional (validated for shape only) so the session
515
517
  * can supply keys for the other providers its subagents may use. MCP / proxy
516
518
  * endpoint auth carry across providers and are not checked here.
517
519
  *
518
- * A CHILD run (`inheritsFromParent`) is exempt from the own-key requirement: it
520
+ * A CHILD session (`inheritsFromParent`) is exempt from the own-key requirement: it
519
521
  * inherits its provider keys server-side from the parent's vaulted bundle, so
520
522
  * it need not carry any of its own. The server still verifies, at admission,
521
523
  * that the parent actually holds a key for the child's provider.
522
524
  */
523
- export declare function enforceCredentialSecretPolicy(secrets: PlatformInlineSecrets, provider: RunProvider, opts?: {
525
+ export declare function enforceCredentialSecretPolicy(secrets: PlatformInlineSecrets, provider: ProviderName, opts?: {
524
526
  readonly inheritsFromParent?: boolean;
525
527
  }): void;
526
528
  export declare function parseSubmission(input: unknown, options?: {
@@ -539,13 +541,13 @@ export declare const DEFAULT_OUTPUT_MODE: OutputMode;
539
541
  export declare const STREAMABLE_SHAPES: readonly ["anthropic", "openai_chat"];
540
542
  export type StreamableShape = (typeof STREAMABLE_SHAPES)[number];
541
543
  /** True when a provider has a streaming producer wired (a {@link STREAMABLE_SHAPES} shape). */
542
- export declare function isStreamableProvider(provider: RunProvider): boolean;
544
+ export declare function isStreamableProvider(provider: ProviderName): boolean;
543
545
  /**
544
546
  * Fail-closed streaming gate: `outputMode:'stream'` on a NON-streamable provider
545
547
  * throws (a HARD reject — no silent downgrade to buffered). Called by
546
- * {@link parseRunSubmissionRequest} once mode + provider are both known.
548
+ * {@link parseSessionSubmissionRequest} once mode + provider are both known.
547
549
  */
548
- export declare function assertStreamableOutputMode(outputMode: OutputMode | undefined, provider: RunProvider): void;
550
+ export declare function assertStreamableOutputMode(outputMode: OutputMode | undefined, provider: ProviderName): void;
549
551
  /** Response-format kinds: free-form `text` (default) or provider-native `json_schema`. */
550
552
  export declare const RESPONSE_FORMAT_KINDS: readonly ["text", "json_schema"];
551
553
  export type ResponseFormatKind = (typeof RESPONSE_FORMAT_KINDS)[number];
@@ -632,14 +634,14 @@ export declare const DEFAULT_BUILTIN_TOOLS: readonly BuiltinToolName[];
632
634
  * Fixed name of the single skills meta-tool. Deliberately NOT a member of
633
635
  * {@link BUILTIN_TOOL_NAMES} (that closed set is the customer-cherry-pickable
634
636
  * toggle surface, pinned equal to `HANDS_TOOLS`) — the skills tool is IMPLIED by
635
- * a run having ≥1 skill, not chosen, and is injected platform-side. Kept in
637
+ * a session having ≥1 skill, not chosen, and is injected platform-side. Kept in
636
638
  * lockstep with {@link SKILL_RESERVED_NAMES} so it can never be shadowed by a
637
639
  * custom tool or skill of the same name.
638
640
  */
639
641
  export declare const SKILLS_TOOL_NAME = "skills";
640
642
  /**
641
643
  * The single default `skills` meta-tool (list/load) the platform injects when a
642
- * run references ≥1 workspace skill. Shared by the platform tool composer and
644
+ * session references ≥1 workspace skill. Shared by the platform tool composer and
643
645
  * kept adjacent to the reserved-name guard so the model-visible contract and the
644
646
  * name reservation stay in one place. It replaces the former N per-skill no-arg
645
647
  * load-tools with one arg-taking dispatcher.
@@ -678,9 +680,9 @@ export declare const SKILLS_TOOL_DEFINITION: {
678
680
  */
679
681
  export declare function resolveBuiltinToolNames(includeBuiltinTools: boolean | undefined, toolRefs?: readonly string[]): readonly BuiltinToolName[];
680
682
  /**
681
- * Upper bound on the number of workspace skills a single run may reference.
682
- * A run's skill list is a discovery surface, not a bulk-mount channel; 64 is
683
- * generous headroom over any realistic per-run set while capping the meta-tool
683
+ * Upper bound on the number of workspace skills a single session may reference.
684
+ * A session's skill list is a discovery surface, not a bulk-mount channel; 64 is
685
+ * generous headroom over any realistic per-session set while capping the meta-tool
684
686
  * `list` payload and the submit-time resolution fan-out.
685
687
  */
686
688
  export declare const SKILLS_MAX = 64;