@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,4 +1,4 @@
1
- import type { RunProvider } from "./submission.js";
1
+ import type { ProviderName } from "./submission.js";
2
2
  export interface SupportPointer {
3
3
  readonly label: string;
4
4
  /** Markdown href, relative to `packages/sdk/docs/provider-runtime-capabilities.md`. */
@@ -224,4 +224,4 @@ export declare const PROVIDER_PUBLIC_SUPPORT: {
224
224
  }];
225
225
  };
226
226
  };
227
- export declare function providerPublicSupport(provider: RunProvider): ProviderPublicSupport;
227
+ export declare function providerPublicSupport(provider: ProviderName): ProviderPublicSupport;
@@ -2,8 +2,8 @@
2
2
  * Unified runner event schema. The managed runtime feeds one shape into
3
3
  * the hosted aex event pipeline:
4
4
  *
5
- * - The per-run managed runtime POSTs batches of NDJSON events to
6
- * `/runs/{id}/runner/events`; the runtime adapter translates each
5
+ * - The per-session managed runtime POSTs batches of NDJSON events to
6
+ * `/sessions/{id}/runner/events`; the runtime adapter translates each
7
7
  * event into one or more `RunnerEvent`s.
8
8
  *
9
9
  * The downstream subscribers (dashboard, SDK `streamEvents`, observable
@@ -37,9 +37,9 @@ export declare const RUNNER_EVENT_VERSION: 1;
37
37
  * - `notification` — runtime/extension notification; catch-all
38
38
  * for diagnostic data.
39
39
  * - `stream_error` — stream-level error (non-fatal). Subscribers
40
- * may surface this as a UI warning; the run
40
+ * may surface this as a UI warning; the session
41
41
  * continues unless `runtime_terminal` follows.
42
- * - `runtime_terminal` — the run reached a terminal state. The
42
+ * - `runtime_terminal` — the session reached a terminal state. The
43
43
  * adapter MUST emit exactly one of these per
44
44
  * run; subscribers gate on it for end-of-stream.
45
45
  */
@@ -48,7 +48,7 @@ export type RunnerEventKind = (typeof RUNNER_EVENT_KINDS)[number];
48
48
  /**
49
49
  * One event in the unified stream. `seq` is monotonically increasing
50
50
  * within a single run (the adapter is responsible for assigning seqs
51
- * — no two events with the same `seq` for the same `runId`); `tMs` is
51
+ * — no two events with the same `seq` for the same `sessionId`); `tMs` is
52
52
  * a millisecond-resolution timestamp that is also monotonically
53
53
  * non-decreasing within a single run (an event's `tMs` is never less
54
54
  * than the previous event's `tMs`). `data` carries the runtime- and
@@ -69,7 +69,7 @@ export interface RunnerEvent {
69
69
  */
70
70
  export interface RunnerEventBatch {
71
71
  readonly v: typeof RUNNER_EVENT_VERSION;
72
- readonly runId: string;
72
+ readonly sessionId: string;
73
73
  readonly events: readonly RunnerEvent[];
74
74
  }
75
75
  /**
@@ -93,7 +93,7 @@ export type RunnerEventBatchValidation = {
93
93
  readonly code: RunnerEventBatchValidationCode;
94
94
  readonly message: string;
95
95
  };
96
- export declare const RUNNER_EVENT_BATCH_VALIDATION_CODES: readonly ["invalid_envelope", "version_mismatch", "missing_run_id", "empty_batch", "batch_too_large", "invalid_event", "seq_not_monotonic", "t_ms_not_monotonic"];
96
+ export declare const RUNNER_EVENT_BATCH_VALIDATION_CODES: readonly ["invalid_envelope", "version_mismatch", "missing_session_id", "empty_batch", "batch_too_large", "invalid_event", "seq_not_monotonic", "t_ms_not_monotonic"];
97
97
  export type RunnerEventBatchValidationCode = (typeof RUNNER_EVENT_BATCH_VALIDATION_CODES)[number];
98
98
  /**
99
99
  * Parse + validate an inbound runner event batch (untrusted input).
@@ -103,7 +103,7 @@ export type RunnerEventBatchValidationCode = (typeof RUNNER_EVENT_BATCH_VALIDATI
103
103
  * Successful validation guarantees:
104
104
  * - top-level envelope matches {@link RunnerEventBatch}
105
105
  * - `v === RUNNER_EVENT_VERSION`
106
- * - `runId` is a non-empty string
106
+ * - `sessionId` is a non-empty string
107
107
  * - `events` is a non-empty array of at most
108
108
  * {@link RUNNER_EVENT_BATCH_MAX_EVENTS} entries
109
109
  * - each event is a {@link RunnerEvent} with a known `kind`
@@ -2,8 +2,8 @@
2
2
  * Unified runner event schema. The managed runtime feeds one shape into
3
3
  * the hosted aex event pipeline:
4
4
  *
5
- * - The per-run managed runtime POSTs batches of NDJSON events to
6
- * `/runs/{id}/runner/events`; the runtime adapter translates each
5
+ * - The per-session managed runtime POSTs batches of NDJSON events to
6
+ * `/sessions/{id}/runner/events`; the runtime adapter translates each
7
7
  * event into one or more `RunnerEvent`s.
8
8
  *
9
9
  * The downstream subscribers (dashboard, SDK `streamEvents`, observable
@@ -36,9 +36,9 @@ export const RUNNER_EVENT_VERSION = 1;
36
36
  * - `notification` — runtime/extension notification; catch-all
37
37
  * for diagnostic data.
38
38
  * - `stream_error` — stream-level error (non-fatal). Subscribers
39
- * may surface this as a UI warning; the run
39
+ * may surface this as a UI warning; the session
40
40
  * continues unless `runtime_terminal` follows.
41
- * - `runtime_terminal` — the run reached a terminal state. The
41
+ * - `runtime_terminal` — the session reached a terminal state. The
42
42
  * adapter MUST emit exactly one of these per
43
43
  * run; subscribers gate on it for end-of-stream.
44
44
  */
@@ -63,7 +63,7 @@ export const RUNNER_EVENT_BATCH_MAX_EVENTS = 256;
63
63
  export const RUNNER_EVENT_BATCH_VALIDATION_CODES = [
64
64
  "invalid_envelope",
65
65
  "version_mismatch",
66
- "missing_run_id",
66
+ "missing_session_id",
67
67
  "empty_batch",
68
68
  "batch_too_large",
69
69
  "invalid_event",
@@ -78,7 +78,7 @@ export const RUNNER_EVENT_BATCH_VALIDATION_CODES = [
78
78
  * Successful validation guarantees:
79
79
  * - top-level envelope matches {@link RunnerEventBatch}
80
80
  * - `v === RUNNER_EVENT_VERSION`
81
- * - `runId` is a non-empty string
81
+ * - `sessionId` is a non-empty string
82
82
  * - `events` is a non-empty array of at most
83
83
  * {@link RUNNER_EVENT_BATCH_MAX_EVENTS} entries
84
84
  * - each event is a {@link RunnerEvent} with a known `kind`
@@ -92,8 +92,8 @@ export function validateRunnerEventBatch(input) {
92
92
  if (input.v !== RUNNER_EVENT_VERSION) {
93
93
  return invalid("version_mismatch", `batch.v must equal ${RUNNER_EVENT_VERSION} (got ${JSON.stringify(input.v)})`);
94
94
  }
95
- if (typeof input.runId !== "string" || input.runId.length === 0) {
96
- return invalid("missing_run_id", "batch.runId must be a non-empty string");
95
+ if (typeof input.sessionId !== "string" || input.sessionId.length === 0) {
96
+ return invalid("missing_session_id", "batch.sessionId must be a non-empty string");
97
97
  }
98
98
  if (!Array.isArray(input.events) || input.events.length === 0) {
99
99
  return invalid("empty_batch", "batch.events must be a non-empty array");
@@ -148,7 +148,7 @@ export function validateRunnerEventBatch(input) {
148
148
  }
149
149
  return {
150
150
  ok: true,
151
- batch: { v: RUNNER_EVENT_VERSION, runId: input.runId, events: Object.freeze(events) }
151
+ batch: { v: RUNNER_EVENT_VERSION, sessionId: input.sessionId, events: Object.freeze(events) }
152
152
  };
153
153
  }
154
154
  function invalid(code, message) {
@@ -1,13 +1,13 @@
1
- import type { RunProvider } from "./submission.js";
1
+ import type { ProviderName } from "./submission.js";
2
2
  /**
3
- * Runtime manifest: the per-run description of where
3
+ * Runtime manifest: the per-session description of where
4
4
  * aex places things inside the agent container, plus the merged
5
5
  * env-var bag delivered via `RUNTIME.env` / `RUNTIME.json`.
6
6
  *
7
- * The hosted API computes a manifest at submitRun-response time
7
+ * The hosted API computes a manifest at startSessionRecord-response time
8
8
  * from the validated submission via {@link buildRuntimeManifest} and
9
9
  * echoes it on the wire as
10
- * `Run.runtimeManifest`, so caller code (anyone rendering catalog markdown
10
+ * `SessionRecord.runtimeManifest`, so caller code (anyone rendering catalog markdown
11
11
  * pre-submission, or resolving aex's in-container path strings) doesn't
12
12
  * have to guess.
13
13
  * The managed runtime materialises the actual `RUNTIME.env` / `RUNTIME.json`
@@ -16,7 +16,7 @@ import type { RunProvider } from "./submission.js";
16
16
  *
17
17
  * Manifest values are derived, never persisted separately — the source
18
18
  * of truth for the customer half remains `submission.environment.envVars`
19
- * on the run row; the aex half is constant for a given SDK version.
19
+ * on the session row; the aex half is constant for a given SDK version.
20
20
  */
21
21
  /**
22
22
  * The in-container paths the agent and skill code reference at
@@ -30,18 +30,18 @@ import type { RunProvider } from "./submission.js";
30
30
  * under `/mnt/session/uploads/`.
31
31
  */
32
32
  export interface RuntimeManifest {
33
- readonly provider: RunProvider | string;
33
+ readonly provider: ProviderName | string;
34
34
  /** Where skill bundles auto-discover in the managed runner. */
35
35
  readonly skillsRoot: string;
36
36
  /** Parent dir of File mounts: `<filesRoot>/<f_id>/<rel-path>`. */
37
37
  readonly filesRoot: string;
38
38
  /** Parent dir of non-SKILL.md asset mounts: `<assetsRoot>/<skl_id>/<rel-path>`. */
39
39
  readonly assetsRoot: string;
40
- /** Absolute path of the in-container aex runtime bridge (invoke via `bun`). */
40
+ /** Absolute path of the in-container aex starttime bridge (invoke via `bun`). */
41
41
  readonly aexCli: string;
42
- /** Absolute path of the in-container aex runtime index. */
42
+ /** Absolute path of the in-container aex starttime index. */
43
43
  readonly indexJson: string;
44
- /** Absolute path of the always-mounted aex runtime contract README. */
44
+ /** Absolute path of the always-mounted aex starttime contract README. */
45
45
  readonly readme: string;
46
46
  /** Absolute path of the machine-readable manifest mirror. */
47
47
  readonly runtimeJson: string;
@@ -60,11 +60,11 @@ export interface RuntimeManifest {
60
60
  * caller can learn where a handed file landed. `mountPath` is the validated
61
61
  * directory the archive unzipped into (the SDK default is `/workspace`); a
62
62
  * single file lands at `<mountPath>/<realFilename>`, a folder lands its entries
63
- * under `<mountPath>/`. Empty when the run carried no files.
63
+ * under `<mountPath>/`. Empty when the session carried no files.
64
64
  */
65
65
  readonly mountedFiles: readonly MountedFileManifest[];
66
66
  }
67
- /** One submitted `File`'s resolved mount directory (surfaced on the Run record). */
67
+ /** One submitted `File`'s resolved mount directory (surfaced on the Session record). */
68
68
  export interface MountedFileManifest {
69
69
  /** The file's storage slug (`FileRef.name`). */
70
70
  readonly name: string;
@@ -89,7 +89,7 @@ declare const RUNTIME_PATHS: Readonly<{
89
89
  }>;
90
90
  export declare function runtimePaths(): typeof RUNTIME_PATHS;
91
91
  export interface BuildRuntimeManifestInput {
92
- readonly provider: RunProvider | string;
92
+ readonly provider: ProviderName | string;
93
93
  /**
94
94
  * Customer-supplied `environment.envVars` from the validated
95
95
  * submission. Keys with the reserved `AEX_` prefix are
@@ -26,7 +26,7 @@ export function runtimePaths() {
26
26
  const AEX_PREFIX = "AEX_";
27
27
  /**
28
28
  * Default mount DIRECTORY for a `File` with no explicit `mountPath`. Mirrors
29
- * `DEFAULT_FILE_MOUNT_PATH` in `run-config.ts`; duplicated here so this module
29
+ * `DEFAULT_FILE_MOUNT_PATH` in `session-config.ts`; duplicated here so this module
30
30
  * stays self-contained (tree-shakeable) — the same reason {@link AEX_PREFIX}
31
31
  * is inlined rather than imported from the submission parser.
32
32
  */
@@ -12,7 +12,7 @@ export interface RuntimeResources {
12
12
  /**
13
13
  * The single source of truth: every offered preset, keyed by its wire token.
14
14
  * Tokens intentionally remain stable product presets. The smallest
15
- * (`shared-0.06x-256mb`) tier is for light / IO-bound runs only.
15
+ * (`shared-0.06x-256mb`) tier is for light / IO-bound sessions only.
16
16
  */
17
17
  export declare const RUNTIME_SIZE_PRESETS: {
18
18
  readonly "shared-0.06x-256mb": {
@@ -65,12 +65,12 @@ export declare function runtimeResources(size: RuntimeSize): RuntimeResources;
65
65
  * consumers apply {@link DEFAULT_RUNTIME_SIZE}.
66
66
  */
67
67
  export declare function parseRuntimeSize(input: unknown): RuntimeSize | undefined;
68
- /** Default run deadline when `timeout` is omitted (8 hours). */
69
- export declare const DEFAULT_RUN_TIMEOUT_MS: number;
70
- /** Hard ceiling on a run deadline (8 hours). */
71
- export declare const MAX_RUN_TIMEOUT_MS: number;
72
- /** Floor on a run deadline (1 minute). */
73
- export declare const MIN_RUN_TIMEOUT_MS: number;
68
+ /** Default session deadline when `timeout` is omitted (8 hours). */
69
+ export declare const DEFAULT_SESSION_TIMEOUT_MS: number;
70
+ /** Hard ceiling on a session deadline (8 hours). */
71
+ export declare const MAX_SESSION_TIMEOUT_MS: number;
72
+ /** Floor on a session deadline (1 minute). */
73
+ export declare const MIN_SESSION_TIMEOUT_MS: number;
74
74
  /**
75
75
  * Parse a human duration string (`"1h"`, `"90m"`, `"3600s"`, `"500ms"`, or a
76
76
  * bare-ms integer) into milliseconds. Throws on malformed input.
@@ -79,17 +79,17 @@ export declare function parseDurationToMs(input: string): number;
79
79
  /**
80
80
  * Validate the wire `timeout` field (a duration string) into a bounded ms
81
81
  * value. `undefined` (omitted) returns `undefined`; the consumer applies
82
- * {@link DEFAULT_RUN_TIMEOUT_MS}.
82
+ * {@link DEFAULT_SESSION_TIMEOUT_MS}.
83
83
  */
84
- export declare function parseRunTimeout(input: unknown): number | undefined;
84
+ export declare function parseSessionTimeout(input: unknown): number | undefined;
85
85
  /** Apply the default when a parsed `timeoutMs` is absent. */
86
- export declare function resolveRunTimeoutMs(timeoutMs: number | undefined): number;
86
+ export declare function resolveSessionTimeoutMs(timeoutMs: number | undefined): number;
87
87
  /** Format a millisecond deadline as a second-granularity duration string. */
88
88
  export declare function orchestrationTimeoutString(ms: number): string;
89
89
  /** Runtime process: time to wait after graceful interrupt before hard kill. */
90
- export declare const RUN_PROCESS_KILL_GRACE_MS: number;
90
+ export declare const SESSION_PROCESS_KILL_GRACE_MS: number;
91
91
  /**
92
92
  * Orchestrator: extra window past `timeoutMs` to wait for terminal callback
93
93
  * before host-level cleanup.
94
94
  */
95
- export declare const RUN_TERMINAL_GRACE_MS: number;
95
+ export declare const SESSION_TERMINAL_GRACE_MS: number;
@@ -8,7 +8,7 @@
8
8
  /**
9
9
  * The single source of truth: every offered preset, keyed by its wire token.
10
10
  * Tokens intentionally remain stable product presets. The smallest
11
- * (`shared-0.06x-256mb`) tier is for light / IO-bound runs only.
11
+ * (`shared-0.06x-256mb`) tier is for light / IO-bound sessions only.
12
12
  */
13
13
  export const RUNTIME_SIZE_PRESETS = {
14
14
  "shared-0.06x-256mb": { cpus: 0.0625, memoryMb: 256 },
@@ -52,14 +52,14 @@ export function parseRuntimeSize(input) {
52
52
  return input;
53
53
  }
54
54
  // ===========================================================================
55
- // Run timeout
55
+ // SessionRecord timeout
56
56
  // ===========================================================================
57
- /** Default run deadline when `timeout` is omitted (8 hours). */
58
- export const DEFAULT_RUN_TIMEOUT_MS = 8 * 60 * 60 * 1000;
59
- /** Hard ceiling on a run deadline (8 hours). */
60
- export const MAX_RUN_TIMEOUT_MS = 8 * 60 * 60 * 1000;
61
- /** Floor on a run deadline (1 minute). */
62
- export const MIN_RUN_TIMEOUT_MS = 60 * 1000;
57
+ /** Default session deadline when `timeout` is omitted (8 hours). */
58
+ export const DEFAULT_SESSION_TIMEOUT_MS = 8 * 60 * 60 * 1000;
59
+ /** Hard ceiling on a session deadline (8 hours). */
60
+ export const MAX_SESSION_TIMEOUT_MS = 8 * 60 * 60 * 1000;
61
+ /** Floor on a session deadline (1 minute). */
62
+ export const MIN_SESSION_TIMEOUT_MS = 60 * 1000;
63
63
  const DURATION_PATTERN = /^(\d+(?:\.\d+)?)(ms|s|m|h)?$/;
64
64
  /**
65
65
  * Parse a human duration string (`"1h"`, `"90m"`, `"3600s"`, `"500ms"`, or a
@@ -81,9 +81,9 @@ export function parseDurationToMs(input) {
81
81
  /**
82
82
  * Validate the wire `timeout` field (a duration string) into a bounded ms
83
83
  * value. `undefined` (omitted) returns `undefined`; the consumer applies
84
- * {@link DEFAULT_RUN_TIMEOUT_MS}.
84
+ * {@link DEFAULT_SESSION_TIMEOUT_MS}.
85
85
  */
86
- export function parseRunTimeout(input) {
86
+ export function parseSessionTimeout(input) {
87
87
  if (input === undefined) {
88
88
  return undefined;
89
89
  }
@@ -91,26 +91,26 @@ export function parseRunTimeout(input) {
91
91
  throw new Error(`timeout must be a duration string (e.g. "1h", "30m"); got ${JSON.stringify(input)}`);
92
92
  }
93
93
  const ms = parseDurationToMs(input);
94
- if (ms < MIN_RUN_TIMEOUT_MS) {
95
- throw new Error(`timeout must be at least ${MIN_RUN_TIMEOUT_MS}ms (1m); got ${ms}ms`);
94
+ if (ms < MIN_SESSION_TIMEOUT_MS) {
95
+ throw new Error(`timeout must be at least ${MIN_SESSION_TIMEOUT_MS}ms (1m); got ${ms}ms`);
96
96
  }
97
- if (ms > MAX_RUN_TIMEOUT_MS) {
98
- throw new Error(`timeout must be at most ${MAX_RUN_TIMEOUT_MS}ms (8h); got ${ms}ms`);
97
+ if (ms > MAX_SESSION_TIMEOUT_MS) {
98
+ throw new Error(`timeout must be at most ${MAX_SESSION_TIMEOUT_MS}ms (8h); got ${ms}ms`);
99
99
  }
100
100
  return ms;
101
101
  }
102
102
  /** Apply the default when a parsed `timeoutMs` is absent. */
103
- export function resolveRunTimeoutMs(timeoutMs) {
104
- return timeoutMs ?? DEFAULT_RUN_TIMEOUT_MS;
103
+ export function resolveSessionTimeoutMs(timeoutMs) {
104
+ return timeoutMs ?? DEFAULT_SESSION_TIMEOUT_MS;
105
105
  }
106
106
  /** Format a millisecond deadline as a second-granularity duration string. */
107
107
  export function orchestrationTimeoutString(ms) {
108
108
  return `${Math.max(1, Math.ceil(ms / 1000))}s`;
109
109
  }
110
110
  /** Runtime process: time to wait after graceful interrupt before hard kill. */
111
- export const RUN_PROCESS_KILL_GRACE_MS = 60 * 1000;
111
+ export const SESSION_PROCESS_KILL_GRACE_MS = 60 * 1000;
112
112
  /**
113
113
  * Orchestrator: extra window past `timeoutMs` to wait for terminal callback
114
114
  * before host-level cleanup.
115
115
  */
116
- export const RUN_TERMINAL_GRACE_MS = 90 * 1000;
116
+ export const SESSION_TERMINAL_GRACE_MS = 90 * 1000;