@aexhq/sdk 0.25.0 → 0.25.2

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 (52) hide show
  1. package/README.md +2 -2
  2. package/dist/_contracts/event-stream-client.js +4 -2
  3. package/dist/_contracts/index.d.ts +0 -1
  4. package/dist/_contracts/index.js +0 -1
  5. package/dist/_contracts/operations.d.ts +11 -3
  6. package/dist/_contracts/operations.js +216 -6
  7. package/dist/_contracts/provider-support.d.ts +2 -13
  8. package/dist/_contracts/provider-support.js +2 -14
  9. package/dist/_contracts/proxy-protocol.d.ts +4 -2
  10. package/dist/_contracts/proxy-protocol.js +10 -3
  11. package/dist/_contracts/run-config.d.ts +7 -5
  12. package/dist/_contracts/run-config.js +10 -7
  13. package/dist/_contracts/run-cost.d.ts +3 -11
  14. package/dist/_contracts/run-cost.js +2 -57
  15. package/dist/_contracts/run-custody.d.ts +1 -52
  16. package/dist/_contracts/run-custody.js +3 -87
  17. package/dist/_contracts/run-retention.d.ts +1 -5
  18. package/dist/_contracts/run-retention.js +2 -14
  19. package/dist/_contracts/run-unit.d.ts +2 -2
  20. package/dist/_contracts/runtime-security-profile.js +1 -1
  21. package/dist/_contracts/runtime-types.d.ts +36 -10
  22. package/dist/_contracts/side-effect-audit.d.ts +4 -5
  23. package/dist/_contracts/side-effect-audit.js +1 -4
  24. package/dist/_contracts/status.d.ts +3 -4
  25. package/dist/_contracts/status.js +3 -8
  26. package/dist/_contracts/submission.d.ts +97 -42
  27. package/dist/_contracts/submission.js +109 -29
  28. package/dist/cli.mjs +256 -48
  29. package/dist/cli.mjs.sha256 +1 -1
  30. package/dist/client.d.ts +25 -17
  31. package/dist/client.js +29 -10
  32. package/dist/client.js.map +1 -1
  33. package/dist/index.d.ts +5 -5
  34. package/dist/index.js +4 -4
  35. package/dist/index.js.map +1 -1
  36. package/dist/version.d.ts +1 -1
  37. package/dist/version.js +1 -1
  38. package/docs/concepts/agent-tools.md +30 -23
  39. package/docs/concepts/runs.md +6 -0
  40. package/docs/credentials.md +5 -3
  41. package/docs/events.md +18 -0
  42. package/docs/limits.md +10 -1
  43. package/docs/outputs.md +58 -0
  44. package/docs/provider-runtime-capabilities.md +1 -1
  45. package/docs/public-surface.json +1 -1
  46. package/docs/release.md +1 -1
  47. package/docs/run-config.md +7 -2
  48. package/docs/skills.md +9 -8
  49. package/docs/vision-skills.md +11 -13
  50. package/package.json +2 -2
  51. package/dist/_contracts/managed-key.d.ts +0 -101
  52. package/dist/_contracts/managed-key.js +0 -181
@@ -1,14 +1,13 @@
1
- export declare const RUN_STATUSES: readonly ["queued", "claiming", "provisioning", "session_created", "dispatched", "provider_running", "provider_idle", "provider_rescheduled", "cancelling", "capturing_outputs", "cleaning_up", "succeeded", "failed", "timed_out", "cancelled", "cleanup_failed", "pending_delete", "deleted"];
1
+ export declare const RUN_STATUSES: readonly ["queued", "claiming", "provisioning", "session_created", "dispatched", "provider_running", "provider_idle", "provider_rescheduled", "cancelling", "capturing_outputs", "cleaning_up", "succeeded", "failed", "timed_out", "cancelled", "cleanup_failed"];
2
2
  export type RunStatus = typeof RUN_STATUSES[number];
3
3
  export type RunStatusKind = "active" | "terminal";
4
- export declare const TERMINAL_RUN_STATUSES: readonly ["succeeded", "failed", "timed_out", "cancelled", "cleanup_failed", "pending_delete", "deleted"];
4
+ export declare const TERMINAL_RUN_STATUSES: readonly ["succeeded", "failed", "timed_out", "cancelled", "cleanup_failed"];
5
5
  export declare function isTerminalRunStatus(status: RunStatus): boolean;
6
6
  /**
7
7
  * The closed set of terminal OUTCOMES the run-lifecycle funnel writes via
8
8
  * `markRunTerminal` (and that a `run/terminal` event carries). This is a
9
9
  * STRICT SUBSET of {@link TERMINAL_RUN_STATUSES}: the read-terminal set also
10
- * includes the post-terminal housekeeping states (`cleanup_failed`,
11
- * `pending_delete`, `deleted`) which the funnel never writes as an outcome.
10
+ * includes `cleanup_failed`, which the funnel never writes as an outcome.
12
11
  * The worker's `TerminalRunStatus` and the workflow `TerminalOutcome` both
13
12
  * derive from this so the four call sites can't drift.
14
13
  */
@@ -14,18 +14,14 @@ export const RUN_STATUSES = [
14
14
  "failed",
15
15
  "timed_out",
16
16
  "cancelled",
17
- "cleanup_failed",
18
- "pending_delete",
19
- "deleted"
17
+ "cleanup_failed"
20
18
  ];
21
19
  export const TERMINAL_RUN_STATUSES = [
22
20
  "succeeded",
23
21
  "failed",
24
22
  "timed_out",
25
23
  "cancelled",
26
- "cleanup_failed",
27
- "pending_delete",
28
- "deleted"
24
+ "cleanup_failed"
29
25
  ];
30
26
  const terminalRunStatuses = new Set(TERMINAL_RUN_STATUSES);
31
27
  export function isTerminalRunStatus(status) {
@@ -35,8 +31,7 @@ export function isTerminalRunStatus(status) {
35
31
  * The closed set of terminal OUTCOMES the run-lifecycle funnel writes via
36
32
  * `markRunTerminal` (and that a `run/terminal` event carries). This is a
37
33
  * STRICT SUBSET of {@link TERMINAL_RUN_STATUSES}: the read-terminal set also
38
- * includes the post-terminal housekeeping states (`cleanup_failed`,
39
- * `pending_delete`, `deleted`) which the funnel never writes as an outcome.
34
+ * includes `cleanup_failed`, which the funnel never writes as an outcome.
40
35
  * The worker's `TerminalRunStatus` and the workflow `TerminalOutcome` both
41
36
  * derive from this so the four call sites can't drift.
42
37
  */
@@ -5,7 +5,6 @@ import { type RuntimeSize } from "./runtime-sizes.js";
5
5
  import { type PlatformPostHook, type PlatformPostHookInput } from "./post-hook.js";
6
6
  import { type RunModel } from "./models.js";
7
7
  import { type RuntimeSecurityProfileName } from "./runtime-security-profile.js";
8
- import { type CredentialMode, type ManagedKeyPolicyV1 } from "./managed-key.js";
9
8
  export type JsonPrimitive = string | number | boolean | null;
10
9
  export type JsonValue = JsonPrimitive | JsonValue[] | {
11
10
  readonly [key: string]: JsonValue;
@@ -138,6 +137,21 @@ export declare const Providers: {
138
137
  /** Doubao (ByteDance) via the official China Volcengine Ark gateway. */
139
138
  readonly DOUBAO_CN: "doubao-cn";
140
139
  };
140
+ /**
141
+ * Product placement tokens accepted on run submission. These are not exact
142
+ * city guarantees: the hosted platform maps each token to the configured
143
+ * database, object store, Durable Object, and sandbox backing available for
144
+ * that product region.
145
+ */
146
+ export declare const RUN_REGIONS: readonly ["lhr", "iad", "sfo", "bom"];
147
+ export type RunRegion = (typeof RUN_REGIONS)[number];
148
+ /** Symbol-style accessors for the closed run-region set. */
149
+ export declare const RunRegions: {
150
+ readonly LHR: "lhr";
151
+ readonly IAD: "iad";
152
+ readonly SFO: "sfo";
153
+ readonly BOM: "bom";
154
+ };
141
155
  /**
142
156
  * Customer-facing runtime selector. Optional on the wire; absent resolves
143
157
  * to the same managed runtime as `"managed"`. `"native"` is no longer an
@@ -145,6 +159,17 @@ export declare const Providers: {
145
159
  */
146
160
  export declare const RUNTIME_KINDS: readonly ["managed"];
147
161
  export type RuntimeKind = (typeof RUNTIME_KINDS)[number];
162
+ /**
163
+ * Credential source for upstream provider access. Launch accepts only BYOK:
164
+ * callers may omit `credentialMode` or pass `"byok"`. Other strings, including
165
+ * `"managed"`, are invalid submission values rather than reserved product
166
+ * promises.
167
+ */
168
+ export declare const CREDENTIAL_MODES: readonly ["byok"];
169
+ export type CredentialMode = (typeof CREDENTIAL_MODES)[number];
170
+ export declare const DEFAULT_CREDENTIAL_MODE: CredentialMode;
171
+ export declare function parseCredentialMode(input: unknown): CredentialMode;
172
+ export declare function credentialModeOrDefault(input: CredentialMode | undefined): CredentialMode;
148
173
  /** Outcome of the centralized runtime-support check. */
149
174
  export interface RuntimeSupportCheck {
150
175
  readonly ok: boolean;
@@ -188,11 +213,10 @@ export type PlatformProxyAuthValue = {
188
213
  };
189
214
  /**
190
215
  * Per-run inline secrets bundle. `apiKey` is the BYOK provider key for the
191
- * run's selected `provider` (required in `"byok"` credential mode, rejected
192
- * in `"managed"` mode). A run targets exactly one provider, so the key is a
193
- * single flat field rather than a per-provider block. `mcpServers` and
194
- * `proxyEndpointAuth` are cross-provider (an MCP credential is the same
195
- * secret whichever model is driving the MCP client).
216
+ * run's selected `provider`. A run targets exactly one provider, so the key is
217
+ * a single flat field rather than a per-provider block. `mcpServers` and
218
+ * `proxyEndpointAuth` are cross-provider (an MCP credential is the same secret
219
+ * whichever model is driving the MCP client).
196
220
  */
197
221
  export interface PlatformInlineSecrets {
198
222
  readonly apiKey?: string;
@@ -289,9 +313,9 @@ export declare function optionalPositiveInt(input: unknown, field: string): numb
289
313
  * only the non-secret half; bearer headers travel in
290
314
  * `secrets.mcpServers` keyed by `name`.
291
315
  *
292
- * `skills` is a list of `SkillRef`s workspace refs point at
293
- * `skill_bundles.id` (validated by the BFF before acceptance and pinned
294
- * into `run_skill_snapshots`), provider refs pass through unchanged.
316
+ * `skills` is a list of `SkillRef`s. Launch workspace skills use
317
+ * content-addressed asset refs; run submission snapshots the bytes into the
318
+ * run-owned prefix before dispatch.
295
319
  */
296
320
  export interface PlatformSubmission {
297
321
  readonly model: RunModel;
@@ -321,14 +345,14 @@ export interface PlatformSubmission {
321
345
  */
322
346
  readonly outputs?: PlatformOutputCaptureConfig;
323
347
  /**
324
- * Optional override for the managed-runtime builtin extensions enabled
325
- * inside the runner container. Each entry is one of the closed
326
- * {@link BUILTINS} set (prefer the {@link Builtins} symbol
327
- * const). The platform default is `["developer"]` which gives the agent
328
- * shell + write + edit + tree tools (bash, grep via shell, file read via
329
- * shell or editor, file edit). To opt in to more tools (e.g. web fetch via
330
- * the `computercontroller` extension), pass the full list. To opt out of
331
- * all builtins (pure-MCP setup), pass an empty array.
348
+ * Optional override for the managed-runtime builtins enabled inside the
349
+ * runner container. Each entry is one of the closed {@link BUILTINS} set
350
+ * (prefer the {@link Builtins} symbol const).
351
+ *
352
+ * Omit the field for {@link DEFAULT_BUILTINS}: web search, web fetch,
353
+ * file read/edit, glob, grep, head, and tail. Pass an empty array to opt out
354
+ * of all builtins for pure-MCP runs. Pass a custom list to narrow or extend
355
+ * the tool surface, for example `[Builtins.WEB_SEARCH, Builtins.NOTEBOOK]`.
332
356
  *
333
357
  * Validation:
334
358
  * - Each entry must be a member of {@link BUILTINS}.
@@ -389,9 +413,7 @@ export interface PlatformRunSubmissionRequest {
389
413
  readonly idempotencyKey: string;
390
414
  /**
391
415
  * Credential source for upstream provider access. Omitted means
392
- * `"byok"` for compatibility with the current production path.
393
- * `"managed"` is a public contract value but remains fail-closed until
394
- * credential resolution and billing admission are available.
416
+ * `"byok"`; launch does not accept managed provider credentials.
395
417
  */
396
418
  readonly credentialMode: CredentialMode;
397
419
  /**
@@ -406,6 +428,13 @@ export interface PlatformRunSubmissionRequest {
406
428
  * `parseRunSubmissionRequest`.
407
429
  */
408
430
  readonly runtime?: RuntimeKind;
431
+ /**
432
+ * Optional product placement token requested by the caller. Omitted means
433
+ * the hosted platform infers a configured region from request geography and
434
+ * falls back to its default region. Accepted tokens do not promise exact
435
+ * city-level placement.
436
+ */
437
+ readonly region?: RunRegion;
409
438
  readonly submission: PlatformSubmission;
410
439
  readonly secrets: PlatformInlineSecrets;
411
440
  readonly proxyEndpoints?: readonly PlatformProxyEndpoint[];
@@ -451,7 +480,7 @@ export interface PlatformRunSubmissionRequest {
451
480
  * {@link DEFAULT_RUN_PROVIDER} (`anthropic`). The parser fills it in
452
481
  * before the value enters the run snapshot.
453
482
  */
454
- export type PlatformRunSubmissionInput = Omit<PlatformRunSubmissionRequest, "workspaceId" | "credentialMode" | "provider" | "runtime" | "timeoutMs" | "postHook"> & {
483
+ export type PlatformRunSubmissionInput = Omit<PlatformRunSubmissionRequest, "workspaceId" | "credentialMode" | "provider" | "runtime" | "region" | "timeoutMs" | "postHook"> & {
455
484
  readonly workspaceId?: string;
456
485
  readonly credentialMode?: CredentialMode;
457
486
  readonly provider?: RunProvider;
@@ -461,6 +490,11 @@ export type PlatformRunSubmissionInput = Omit<PlatformRunSubmissionRequest, "wor
461
490
  * accepted.
462
491
  */
463
492
  readonly runtime?: RuntimeKind;
493
+ /**
494
+ * Optional product placement token. Invalid explicit values are rejected;
495
+ * omission lets the platform infer/fallback.
496
+ */
497
+ readonly region?: RunRegion;
464
498
  /**
465
499
  * Run deadline as a human duration string (`"1h"`, `"90m"`, `"30s"`).
466
500
  * Parsed + bounded to [1m, 6h] server-side into
@@ -470,20 +504,15 @@ export type PlatformRunSubmissionInput = Omit<PlatformRunSubmissionRequest, "wor
470
504
  readonly postHook?: PlatformPostHookInput;
471
505
  };
472
506
  export interface ParseRunSubmissionOptions {
473
- readonly managedKeyPolicy?: ManagedKeyPolicyV1;
474
507
  }
475
508
  export declare function parseRunSubmissionRequest(input: unknown, options?: ParseRunSubmissionOptions): PlatformRunSubmissionRequest;
509
+ export declare function parseRunRegion(input: unknown): RunRegion | undefined;
476
510
  export declare function parseRuntimeKind(input: unknown): RuntimeKind | undefined;
477
511
  export declare function parseRunProvider(input: unknown): RunProvider;
478
512
  /**
479
- * Cross-check the supplied secrets bundle against the credential mode.
480
- *
481
- * - `"byok"`: `secrets.apiKey` (the provider key for the run's `provider`)
482
- * MUST be present.
483
- * - `"managed"`: `secrets.apiKey` MUST be absent — provider access is
484
- * resolved by the managed-key policy, not a caller-supplied key.
485
- * - MCP / proxy endpoint auth carry across providers and are not
486
- * checked here.
513
+ * Cross-check the supplied secrets bundle against the credential mode. BYOK
514
+ * requires `secrets.apiKey` (the provider key for the run's `provider`). MCP /
515
+ * proxy endpoint auth carry across providers and are not checked here.
487
516
  */
488
517
  export declare function enforceCredentialSecretPolicy(credentialMode: CredentialMode, secrets: PlatformInlineSecrets): void;
489
518
  export declare function parseSubmission(input: unknown): PlatformSubmission;
@@ -492,28 +521,54 @@ export declare const OUTPUT_MODES: readonly ["buffered", "stream"];
492
521
  export type OutputMode = (typeof OUTPUT_MODES)[number];
493
522
  export declare const DEFAULT_OUTPUT_MODE: OutputMode;
494
523
  /**
495
- * Managed-runtime builtin extensions — the closed set the managed runtime
496
- * accepts. Closed so an invalid name is a compile error via {@link Builtins},
497
- * not a silent runtime no-op. `developer` is the platform default when
498
- * `builtins` is omitted; pass an empty array to disable all builtins
499
- * (pure-MCP setup).
524
+ * Managed-runtime builtins — the closed set the managed runtime accepts.
525
+ * Closed so an invalid name is a compile error via {@link Builtins}, not a
526
+ * silent runtime no-op.
527
+ *
528
+ * The first entries are the recommended concrete builtins. The legacy aggregate
529
+ * extension names remain accepted for existing callers, but are not the default.
500
530
  */
501
- export declare const BUILTINS: readonly ["developer", "computercontroller", "memory", "autovisualiser", "tutorial"];
531
+ export declare const BUILTINS: readonly ["web_search", "web_fetch", "read", "edit", "glob", "grep", "head", "tail", "bash", "notebook", "developer", "computercontroller", "memory", "autovisualiser", "tutorial"];
502
532
  export type Builtin = (typeof BUILTINS)[number];
533
+ /**
534
+ * DX-first managed-runtime defaults. Omitted `builtins` resolves to this list.
535
+ * Notebook support remains opt-in through {@link Builtins.NOTEBOOK}.
536
+ */
537
+ export declare const DEFAULT_BUILTINS: readonly ["web_search", "web_fetch", "read", "edit", "glob", "grep", "head", "tail", "bash"];
503
538
  /**
504
539
  * Symbol-style accessors for the closed builtin set, e.g.
505
- * `Builtins.COMPUTER_CONTROLLER`.
540
+ * `Builtins.WEB_SEARCH`.
506
541
  */
507
542
  export declare const Builtins: {
508
- /** Shell (bash + UNIX tools incl. grep), write, edit, tree. The default. */
543
+ /** Managed web search. Included in {@link DEFAULT_BUILTINS}. */
544
+ readonly WEB_SEARCH: "web_search";
545
+ /** Fetch a URL and return readable text. Included in {@link DEFAULT_BUILTINS}. */
546
+ readonly WEB_FETCH: "web_fetch";
547
+ /** Read files. Included in {@link DEFAULT_BUILTINS}. */
548
+ readonly READ: "read";
549
+ /** Create/modify files. Included in {@link DEFAULT_BUILTINS}. */
550
+ readonly EDIT: "edit";
551
+ /** Search paths by glob. Included in {@link DEFAULT_BUILTINS}. */
552
+ readonly GLOB: "glob";
553
+ /** Search file contents. Included in {@link DEFAULT_BUILTINS}. */
554
+ readonly GREP: "grep";
555
+ /** Read the first lines of a file. Included in {@link DEFAULT_BUILTINS}. */
556
+ readonly HEAD: "head";
557
+ /** Read the last lines of a file. Included in {@link DEFAULT_BUILTINS}. */
558
+ readonly TAIL: "tail";
559
+ /** Shell command execution. Included in {@link DEFAULT_BUILTINS}. */
560
+ readonly BASH: "bash";
561
+ /** Jupyter notebook editing. Optional; not in {@link DEFAULT_BUILTINS}. */
562
+ readonly NOTEBOOK: "notebook";
563
+ /** Legacy aggregate: shell/filesystem/navigation/web/notebook tools. */
509
564
  readonly DEVELOPER: "developer";
510
- /** Web fetch/scrape, scripting, general computer-control tools. */
565
+ /** Legacy aggregate alias retained for existing callers. */
511
566
  readonly COMPUTER_CONTROLLER: "computercontroller";
512
- /** Cross-session preference memory. */
567
+ /** Legacy aggregate alias retained for existing callers. */
513
568
  readonly MEMORY: "memory";
514
- /** Inline data-visualisation rendering. */
569
+ /** Legacy aggregate alias retained for existing callers. */
515
570
  readonly AUTOVISUALISER: "autovisualiser";
516
- /** Interactive guided tutorials. */
571
+ /** Legacy aggregate alias retained for existing callers. */
517
572
  readonly TUTORIAL: "tutorial";
518
573
  };
519
574
  /**
@@ -9,7 +9,6 @@ import { parseRunTimeout, parseRuntimeSize } from "./runtime-sizes.js";
9
9
  import { parsePostHook } from "./post-hook.js";
10
10
  import { assertRunModelMatchesProvider, parseRunModel } from "./models.js";
11
11
  import { parseRuntimeSecurityProfile } from "./runtime-security-profile.js";
12
- import { assertManagedKeyAdmissionAllowed, parseCredentialMode } from "./managed-key.js";
13
12
  /**
14
13
  * Reserved prefix for aex-set runtime env vars (`AEX_CLI`,
15
14
  * `AEX_RUNTIME_JSON`, …). Customer `environment.envVars` keys carrying this
@@ -115,12 +114,46 @@ export const Providers = {
115
114
  /** Doubao (ByteDance) via the official China Volcengine Ark gateway. */
116
115
  DOUBAO_CN: "doubao-cn"
117
116
  };
117
+ /**
118
+ * Product placement tokens accepted on run submission. These are not exact
119
+ * city guarantees: the hosted platform maps each token to the configured
120
+ * database, object store, Durable Object, and sandbox backing available for
121
+ * that product region.
122
+ */
123
+ export const RUN_REGIONS = ["lhr", "iad", "sfo", "bom"];
124
+ /** Symbol-style accessors for the closed run-region set. */
125
+ export const RunRegions = {
126
+ LHR: "lhr",
127
+ IAD: "iad",
128
+ SFO: "sfo",
129
+ BOM: "bom"
130
+ };
118
131
  /**
119
132
  * Customer-facing runtime selector. Optional on the wire; absent resolves
120
133
  * to the same managed runtime as `"managed"`. `"native"` is no longer an
121
134
  * accepted submission value and fails schema validation.
122
135
  */
123
136
  export const RUNTIME_KINDS = ["managed"];
137
+ /**
138
+ * Credential source for upstream provider access. Launch accepts only BYOK:
139
+ * callers may omit `credentialMode` or pass `"byok"`. Other strings, including
140
+ * `"managed"`, are invalid submission values rather than reserved product
141
+ * promises.
142
+ */
143
+ export const CREDENTIAL_MODES = ["byok"];
144
+ export const DEFAULT_CREDENTIAL_MODE = "byok";
145
+ export function parseCredentialMode(input) {
146
+ if (input === undefined) {
147
+ return DEFAULT_CREDENTIAL_MODE;
148
+ }
149
+ if (typeof input !== "string" || !CREDENTIAL_MODES.includes(input)) {
150
+ throw new Error(`credentialMode must be one of: ${CREDENTIAL_MODES.join(", ")} (got ${JSON.stringify(input)})`);
151
+ }
152
+ return input;
153
+ }
154
+ export function credentialModeOrDefault(input) {
155
+ return input ?? DEFAULT_CREDENTIAL_MODE;
156
+ }
124
157
  /**
125
158
  * Centralized runtime-support validator. Native is removed from the public
126
159
  * runtime enum, so an absent runtime and `"managed"` are the only supported
@@ -971,6 +1004,7 @@ export function parseRunSubmissionRequest(input, options = {}) {
971
1004
  "credentialMode",
972
1005
  "provider",
973
1006
  "runtime",
1007
+ "region",
974
1008
  "submission",
975
1009
  "runtimeSize",
976
1010
  "timeout",
@@ -998,10 +1032,9 @@ export function parseRunSubmissionRequest(input, options = {}) {
998
1032
  }
999
1033
  const provider = parseRunProvider(value.provider);
1000
1034
  const runtime = parseRuntimeKind(value.runtime);
1035
+ const region = parseRunRegion(value.region);
1001
1036
  const credentialMode = parseCredentialMode(value.credentialMode);
1002
- if (credentialMode === "managed") {
1003
- assertManagedKeyAdmissionAllowed(options.managedKeyPolicy);
1004
- }
1037
+ void options;
1005
1038
  // Cross-field validation via the centralized runtime-support validator.
1006
1039
  const runtimeSupport = checkRuntimeSupported(provider, runtime);
1007
1040
  if (!runtimeSupport.ok) {
@@ -1044,6 +1077,7 @@ export function parseRunSubmissionRequest(input, options = {}) {
1044
1077
  credentialMode,
1045
1078
  provider,
1046
1079
  ...(runtime ? { runtime } : {}),
1080
+ ...(region ? { region } : {}),
1047
1081
  submission,
1048
1082
  secrets
1049
1083
  };
@@ -1058,6 +1092,7 @@ export function parseRunSubmissionRequest(input, options = {}) {
1058
1092
  credentialMode,
1059
1093
  provider,
1060
1094
  ...(runtime ? { runtime } : {}),
1095
+ ...(region ? { region } : {}),
1061
1096
  submission,
1062
1097
  ...(runtimeSize ? { runtimeSize } : {}),
1063
1098
  ...(timeoutMs !== undefined ? { timeoutMs } : {}),
@@ -1067,6 +1102,15 @@ export function parseRunSubmissionRequest(input, options = {}) {
1067
1102
  secrets
1068
1103
  };
1069
1104
  }
1105
+ export function parseRunRegion(input) {
1106
+ if (input === undefined) {
1107
+ return undefined;
1108
+ }
1109
+ if (typeof input !== "string" || !RUN_REGIONS.includes(input)) {
1110
+ throw new Error(`region must be one of: ${RUN_REGIONS.join(", ")} (got ${JSON.stringify(input)})`);
1111
+ }
1112
+ return input;
1113
+ }
1070
1114
  export function parseRuntimeKind(input) {
1071
1115
  if (input === undefined) {
1072
1116
  return undefined;
@@ -1086,22 +1130,12 @@ export function parseRunProvider(input) {
1086
1130
  return input;
1087
1131
  }
1088
1132
  /**
1089
- * Cross-check the supplied secrets bundle against the credential mode.
1090
- *
1091
- * - `"byok"`: `secrets.apiKey` (the provider key for the run's `provider`)
1092
- * MUST be present.
1093
- * - `"managed"`: `secrets.apiKey` MUST be absent — provider access is
1094
- * resolved by the managed-key policy, not a caller-supplied key.
1095
- * - MCP / proxy endpoint auth carry across providers and are not
1096
- * checked here.
1133
+ * Cross-check the supplied secrets bundle against the credential mode. BYOK
1134
+ * requires `secrets.apiKey` (the provider key for the run's `provider`). MCP /
1135
+ * proxy endpoint auth carry across providers and are not checked here.
1097
1136
  */
1098
1137
  export function enforceCredentialSecretPolicy(credentialMode, secrets) {
1099
- if (credentialMode === "managed") {
1100
- if (secrets.apiKey !== undefined) {
1101
- throw new Error(`secrets.apiKey is not allowed when credentialMode is managed; provider access is resolved by the managed-key policy`);
1102
- }
1103
- return;
1104
- }
1138
+ void credentialMode;
1105
1139
  if (!secrets.apiKey) {
1106
1140
  throw new Error(`secrets.apiKey is required when credentialMode is byok`);
1107
1141
  }
@@ -1225,33 +1259,79 @@ function parseOutputMode(input) {
1225
1259
  return input;
1226
1260
  }
1227
1261
  /**
1228
- * Managed-runtime builtin extensions — the closed set the managed runtime
1229
- * accepts. Closed so an invalid name is a compile error via {@link Builtins},
1230
- * not a silent runtime no-op. `developer` is the platform default when
1231
- * `builtins` is omitted; pass an empty array to disable all builtins
1232
- * (pure-MCP setup).
1262
+ * Managed-runtime builtins — the closed set the managed runtime accepts.
1263
+ * Closed so an invalid name is a compile error via {@link Builtins}, not a
1264
+ * silent runtime no-op.
1265
+ *
1266
+ * The first entries are the recommended concrete builtins. The legacy aggregate
1267
+ * extension names remain accepted for existing callers, but are not the default.
1233
1268
  */
1234
1269
  export const BUILTINS = [
1270
+ "web_search",
1271
+ "web_fetch",
1272
+ "read",
1273
+ "edit",
1274
+ "glob",
1275
+ "grep",
1276
+ "head",
1277
+ "tail",
1278
+ "bash",
1279
+ "notebook",
1235
1280
  "developer",
1236
1281
  "computercontroller",
1237
1282
  "memory",
1238
1283
  "autovisualiser",
1239
1284
  "tutorial"
1240
1285
  ];
1286
+ /**
1287
+ * DX-first managed-runtime defaults. Omitted `builtins` resolves to this list.
1288
+ * Notebook support remains opt-in through {@link Builtins.NOTEBOOK}.
1289
+ */
1290
+ export const DEFAULT_BUILTINS = [
1291
+ "web_search",
1292
+ "web_fetch",
1293
+ "read",
1294
+ "edit",
1295
+ "glob",
1296
+ "grep",
1297
+ "head",
1298
+ "tail",
1299
+ "bash"
1300
+ ];
1241
1301
  /**
1242
1302
  * Symbol-style accessors for the closed builtin set, e.g.
1243
- * `Builtins.COMPUTER_CONTROLLER`.
1303
+ * `Builtins.WEB_SEARCH`.
1244
1304
  */
1245
1305
  export const Builtins = {
1246
- /** Shell (bash + UNIX tools incl. grep), write, edit, tree. The default. */
1306
+ /** Managed web search. Included in {@link DEFAULT_BUILTINS}. */
1307
+ WEB_SEARCH: "web_search",
1308
+ /** Fetch a URL and return readable text. Included in {@link DEFAULT_BUILTINS}. */
1309
+ WEB_FETCH: "web_fetch",
1310
+ /** Read files. Included in {@link DEFAULT_BUILTINS}. */
1311
+ READ: "read",
1312
+ /** Create/modify files. Included in {@link DEFAULT_BUILTINS}. */
1313
+ EDIT: "edit",
1314
+ /** Search paths by glob. Included in {@link DEFAULT_BUILTINS}. */
1315
+ GLOB: "glob",
1316
+ /** Search file contents. Included in {@link DEFAULT_BUILTINS}. */
1317
+ GREP: "grep",
1318
+ /** Read the first lines of a file. Included in {@link DEFAULT_BUILTINS}. */
1319
+ HEAD: "head",
1320
+ /** Read the last lines of a file. Included in {@link DEFAULT_BUILTINS}. */
1321
+ TAIL: "tail",
1322
+ /** Shell command execution. Included in {@link DEFAULT_BUILTINS}. */
1323
+ BASH: "bash",
1324
+ /** Jupyter notebook editing. Optional; not in {@link DEFAULT_BUILTINS}. */
1325
+ NOTEBOOK: "notebook",
1326
+ /** Legacy aggregate: shell/filesystem/navigation/web/notebook tools. */
1247
1327
  DEVELOPER: "developer",
1248
- /** Web fetch/scrape, scripting, general computer-control tools. */
1328
+ /** Legacy aggregate alias retained for existing callers. */
1249
1329
  COMPUTER_CONTROLLER: "computercontroller",
1250
- /** Cross-session preference memory. */
1330
+ /** Legacy aggregate alias retained for existing callers. */
1251
1331
  MEMORY: "memory",
1252
- /** Inline data-visualisation rendering. */
1332
+ /** Legacy aggregate alias retained for existing callers. */
1253
1333
  AUTOVISUALISER: "autovisualiser",
1254
- /** Interactive guided tutorials. */
1334
+ /** Legacy aggregate alias retained for existing callers. */
1255
1335
  TUTORIAL: "tutorial"
1256
1336
  };
1257
1337
  const MAX_BUILTINS = 16;