@aexhq/sdk 0.45.1-canary → 1.0.0-canary

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 (41) hide show
  1. package/dist/_contracts/index.d.ts +2 -3
  2. package/dist/_contracts/index.js +1 -2
  3. package/dist/_contracts/models.d.ts +27 -158
  4. package/dist/_contracts/models.js +19 -183
  5. package/dist/_contracts/runtime-kind.d.ts +2 -2
  6. package/dist/_contracts/runtime-kind.js +3 -3
  7. package/dist/_contracts/runtime-types.d.ts +2 -3
  8. package/dist/_contracts/session-config.js +2 -2
  9. package/dist/_contracts/submission.d.ts +17 -89
  10. package/dist/_contracts/submission.js +6 -152
  11. package/dist/cli.mjs +58 -311
  12. package/dist/cli.mjs.sha256 +1 -1
  13. package/dist/client-types.d.ts +11 -19
  14. package/dist/client.js +7 -23
  15. package/dist/client.js.map +1 -1
  16. package/dist/index.d.ts +3 -3
  17. package/dist/index.js +8 -6
  18. package/dist/index.js.map +1 -1
  19. package/dist/session-validate.d.ts +3 -4
  20. package/dist/session-validate.js +2 -8
  21. package/dist/session-validate.js.map +1 -1
  22. package/dist/version.d.ts +1 -1
  23. package/dist/version.js +1 -1
  24. package/dist/version.js.map +1 -1
  25. package/docs/cleanup.md +2 -3
  26. package/docs/concepts/composition.md +2 -3
  27. package/docs/concepts/providers-and-runtimes.md +24 -27
  28. package/docs/credentials.md +14 -18
  29. package/docs/files.md +0 -1
  30. package/docs/limits.md +1 -1
  31. package/docs/networking.md +3 -6
  32. package/docs/provider-runtime-capabilities.md +15 -80
  33. package/docs/public-surface.json +9 -20
  34. package/docs/quickstart.md +7 -11
  35. package/docs/secrets.md +14 -20
  36. package/docs/session-config.md +5 -7
  37. package/docs/vision-skills.md +2 -3
  38. package/docs/webhooks.md +3 -5
  39. package/package.json +3 -3
  40. package/dist/_contracts/provider-support.d.ts +0 -202
  41. package/dist/_contracts/provider-support.js +0 -86
@@ -1,10 +1,9 @@
1
- export * from "./provider-support.js";
2
1
  export * from "./provider-fault.js";
3
2
  export * from "./models.js";
4
3
  export { SESSION_LIFECYCLE_STATUSES, SESSION_STATUSES, SESSION_TERMINAL_OUTCOMES, isTerminalSessionStatus } from "./status.js";
5
4
  export type { SessionLifecycleStatus, SessionStatus, SessionTerminalOutcome } from "./status.js";
6
- export { AEX_RESERVED_ENV_PREFIX, BUILTIN_TOOL_NAMES, BuiltinTools, DEFAULT_BUILTIN_TOOLS, DEFAULT_OUTPUT_MODE, DEFAULT_PROVIDER, ENV_VARS_MAX_ENTRIES, ENV_VARS_MAX_TOTAL_BYTES, ENV_VARS_MAX_VALUE_BYTES, OUTPUT_MODES, PLATFORM_PACKAGE_ECOSYSTEMS, Providers, RESPONSE_FORMAT_KINDS, PROVIDERS, SECRETS_KEY, SECRET_ENV_NAME_PATTERN, SECRET_HANDLE_PATTERN, SKILLS_TOOL_DEFINITION, SKILLS_TOOL_NAME, STREAMABLE_SHAPES, assertStreamableOutputMode, crossValidateSecretEnvAndValues, isStreamableProvider, packageInstallString, parseApprovalGate, parseInlineSecrets, parseResponseFormat, parseSessionLimits, parseProviderName, parseSessionWebhook, parseSubmission, resolveBuiltinToolNames } from "./submission.js";
7
- export type { ApprovalGate, BuiltinToolName, JsonPrimitive, JsonValue, OutputMode, PlatformEnvironment, PlatformEnvironmentInput, PlatformInlineSecrets, PlatformInjectionConfig, PlatformMcpServerSecret, PlatformNetworking, PlatformFileCaptureConfig, PlatformPackage, PlatformPackageEcosystem, PlatformPackageInput, PlatformSecretEnvEntry, PlatformSubmission, ResponseFormat, ResponseFormatKind, SessionLimits, ProviderName, SessionWebhookSpec, StreamableShape } from "./submission.js";
5
+ export { AEX_RESERVED_ENV_PREFIX, BUILTIN_TOOL_NAMES, BuiltinTools, DEFAULT_BUILTIN_TOOLS, DEFAULT_OUTPUT_MODE, ENV_VARS_MAX_ENTRIES, ENV_VARS_MAX_TOTAL_BYTES, ENV_VARS_MAX_VALUE_BYTES, OUTPUT_MODES, PLATFORM_PACKAGE_ECOSYSTEMS, RESPONSE_FORMAT_KINDS, SECRETS_KEY, SECRET_ENV_NAME_PATTERN, SECRET_HANDLE_PATTERN, SKILLS_TOOL_DEFINITION, SKILLS_TOOL_NAME, crossValidateSecretEnvAndValues, packageInstallString, parseApprovalGate, parseInlineSecrets, parseResponseFormat, parseSessionLimits, parseSessionWebhook, parseSubmission, resolveBuiltinToolNames } from "./submission.js";
6
+ export type { ApprovalGate, BuiltinToolName, JsonPrimitive, JsonValue, OutputMode, PlatformEnvironment, PlatformEnvironmentInput, PlatformInlineSecrets, PlatformInjectionConfig, PlatformMcpServerSecret, PlatformNetworking, PlatformFileCaptureConfig, PlatformPackage, PlatformPackageEcosystem, PlatformPackageInput, PlatformSecretEnvEntry, PlatformSubmission, ResponseFormat, ResponseFormatKind, SessionLimits, ProviderName, SessionWebhookSpec } from "./submission.js";
8
7
  export * from "./runtime-sizes.js";
9
8
  export * from "./runtime-kind.js";
10
9
  export * from "./runner-event.js";
@@ -1,8 +1,7 @@
1
- export * from "./provider-support.js";
2
1
  export * from "./provider-fault.js";
3
2
  export * from "./models.js";
4
3
  export { SESSION_LIFECYCLE_STATUSES, SESSION_STATUSES, SESSION_TERMINAL_OUTCOMES, isTerminalSessionStatus } from "./status.js";
5
- export { AEX_RESERVED_ENV_PREFIX, BUILTIN_TOOL_NAMES, BuiltinTools, DEFAULT_BUILTIN_TOOLS, DEFAULT_OUTPUT_MODE, DEFAULT_PROVIDER, ENV_VARS_MAX_ENTRIES, ENV_VARS_MAX_TOTAL_BYTES, ENV_VARS_MAX_VALUE_BYTES, OUTPUT_MODES, PLATFORM_PACKAGE_ECOSYSTEMS, Providers, RESPONSE_FORMAT_KINDS, PROVIDERS, SECRETS_KEY, SECRET_ENV_NAME_PATTERN, SECRET_HANDLE_PATTERN, SKILLS_TOOL_DEFINITION, SKILLS_TOOL_NAME, STREAMABLE_SHAPES, assertStreamableOutputMode, crossValidateSecretEnvAndValues, isStreamableProvider, packageInstallString, parseApprovalGate, parseInlineSecrets, parseResponseFormat, parseSessionLimits, parseProviderName, parseSessionWebhook, parseSubmission, resolveBuiltinToolNames } from "./submission.js";
4
+ export { AEX_RESERVED_ENV_PREFIX, BUILTIN_TOOL_NAMES, BuiltinTools, DEFAULT_BUILTIN_TOOLS, DEFAULT_OUTPUT_MODE, ENV_VARS_MAX_ENTRIES, ENV_VARS_MAX_TOTAL_BYTES, ENV_VARS_MAX_VALUE_BYTES, OUTPUT_MODES, PLATFORM_PACKAGE_ECOSYSTEMS, RESPONSE_FORMAT_KINDS, SECRETS_KEY, SECRET_ENV_NAME_PATTERN, SECRET_HANDLE_PATTERN, SKILLS_TOOL_DEFINITION, SKILLS_TOOL_NAME, crossValidateSecretEnvAndValues, packageInstallString, parseApprovalGate, parseInlineSecrets, parseResponseFormat, parseSessionLimits, parseSessionWebhook, parseSubmission, resolveBuiltinToolNames } from "./submission.js";
6
5
  export * from "./runtime-sizes.js";
7
6
  export * from "./runtime-kind.js";
8
7
  export * from "./runner-event.js";
@@ -1,160 +1,29 @@
1
- import type { ProviderName } from "./submission.js";
2
1
  /**
3
- * Source of truth for the closed model set: each canonical model id maps to the
4
- * upstream providers that can serve it and the **provider-native** model string
5
- * each one expects.
2
+ * Public model ids are plain **Vercel AI Gateway `creator/model` slug strings**.
6
3
  *
7
- * `Models.*` / `SUPPORTED_MODELS` are aex's own **canonical, provider-neutral**
8
- * identifiers — they are NOT the strings sent to a provider. The platform
9
- * translates a `(canonical model, provider)` pair to the native id via
10
- * {@link resolveProviderModelId} when it builds the session's session manifest. The
11
- * same canonical model can therefore be served by more than one provider (e.g.
12
- * `gpt-4o-mini` via `openai` *or* `openrouter`), with a different native string
13
- * per provider.
14
- *
15
- * Ordering matters: the **first** provider listed for a model is its default
16
- * (see {@link providerForModel}) — list the native vendor before `openrouter`.
17
- * Additions belong here first so SDK types, CLI validation, docs examples, and
18
- * platform parsing all move together.
19
- */
20
- export declare const MODEL_PROVIDER_IDS: {
21
- readonly "claude-haiku-4-5": {
22
- readonly anthropic: "claude-haiku-4-5";
23
- };
24
- readonly "claude-3-5-haiku-latest": {
25
- readonly anthropic: "claude-3-5-haiku-latest";
26
- };
27
- readonly "claude-3-5-sonnet-latest": {
28
- readonly anthropic: "claude-3-5-sonnet-latest";
29
- };
30
- readonly "claude-sonnet-4-6": {
31
- readonly anthropic: "claude-sonnet-4-6";
32
- };
33
- readonly "deepseek-v4-flash": {
34
- readonly deepseek: "deepseek-v4-flash";
35
- };
36
- readonly "deepseek-v4-pro": {
37
- readonly deepseek: "deepseek-v4-pro";
38
- };
39
- readonly "gpt-4.1": {
40
- readonly openai: "gpt-4.1";
41
- };
42
- readonly "gpt-4o-mini": {
43
- readonly openai: "gpt-4o-mini";
44
- readonly openrouter: "openai/gpt-4o-mini";
45
- };
46
- readonly "gpt-4o": {
47
- readonly openrouter: "openai/gpt-4o";
48
- };
49
- readonly "gemini-2.0-flash": {
50
- readonly openrouter: "google/gemini-2.0-flash-001";
51
- };
52
- readonly "gemini-2.5-flash": {
53
- readonly gemini: "gemini-2.5-flash";
54
- };
55
- readonly "mistral-large-latest": {
56
- readonly mistral: "mistral-large-latest";
57
- };
58
- readonly "mistral-small-latest": {
59
- readonly mistral: "mistral-small-latest";
60
- };
61
- readonly "doubao-seed-pro": {
62
- readonly doubao: "doubao-seed-1-8-251228";
63
- };
64
- readonly "doubao-seed-flash": {
65
- readonly doubao: "doubao-seed-1-6-flash-250828";
66
- };
67
- };
68
- /**
69
- * Closed set of canonical model ids accepted by the public session-submission
70
- * schema. Derived from {@link MODEL_PROVIDER_IDS} so the two never drift.
71
- */
72
- export type ModelName = keyof typeof MODEL_PROVIDER_IDS;
73
- export declare const SUPPORTED_MODELS: readonly ModelName[];
74
- /**
75
- * Symbol-style accessors for the closed model set. Prefer these over raw
76
- * strings so an invalid token is a compile error, not a runtime 400 — e.g.
77
- * `Models.CLAUDE_HAIKU_4_5`. These are aex's **canonical** ids, not the native
78
- * strings sent upstream; the platform translates them per provider (see
79
- * {@link MODEL_PROVIDER_IDS} / {@link resolveProviderModelId}). When a model is
80
- * served by more than one provider, pair it with an explicit {@link Providers}
81
- * value; otherwise the single (default) provider is used.
82
- */
83
- export declare const Models: {
84
- /** Claude Haiku 4.5 — Anthropic. */
85
- readonly CLAUDE_HAIKU_4_5: "claude-haiku-4-5";
86
- /** Claude 3.5 Haiku (latest) — Anthropic. */
87
- readonly CLAUDE_3_5_HAIKU_LATEST: "claude-3-5-haiku-latest";
88
- /** Claude 3.5 Sonnet (latest) — Anthropic. */
89
- readonly CLAUDE_3_5_SONNET_LATEST: "claude-3-5-sonnet-latest";
90
- /** Claude Sonnet 4.6 — Anthropic (1M context, reasoning-capable). */
91
- readonly CLAUDE_SONNET_4_6: "claude-sonnet-4-6";
92
- /** DeepSeek V4 Flash — DeepSeek (non-thinking, fast). */
93
- readonly DEEPSEEK_V4_FLASH: "deepseek-v4-flash";
94
- /** DeepSeek V4 Pro — DeepSeek (reasoning-heavy). */
95
- readonly DEEPSEEK_V4_PRO: "deepseek-v4-pro";
96
- /** GPT-4.1 — OpenAI. */
97
- readonly GPT_4_1: "gpt-4.1";
98
- /** GPT-4o mini — OpenAI, or via OpenRouter (`provider: Providers.OPENROUTER`). */
99
- readonly GPT_4O_MINI: "gpt-4o-mini";
100
- /** GPT-4o — via OpenRouter (`provider: Providers.OPENROUTER`). */
101
- readonly GPT_4O: "gpt-4o";
102
- /** Gemini 2.0 Flash — via OpenRouter (`provider: Providers.OPENROUTER`). */
103
- readonly GEMINI_2_0_FLASH: "gemini-2.0-flash";
104
- /** Gemini 2.5 Flash — Gemini. */
105
- readonly GEMINI_2_5_FLASH: "gemini-2.5-flash";
106
- /** Mistral Large (latest) — Mistral. */
107
- readonly MISTRAL_LARGE_LATEST: "mistral-large-latest";
108
- /** Mistral Small (latest) — Mistral. */
109
- readonly MISTRAL_SMALL_LATEST: "mistral-small-latest";
110
- /**
111
- * Doubao Seed 1.8 — ByteDance, via the international BytePlus gateway.
112
- */
113
- readonly DOUBAO_SEED_PRO: "doubao-seed-pro";
114
- /**
115
- * Doubao Seed 1.6 Flash — ByteDance, via BytePlus (fast/cheap).
116
- */
117
- readonly DOUBAO_SEED_FLASH: "doubao-seed-flash";
118
- };
119
- /**
120
- * Provider → canonical models that provider can serve. Derived from
121
- * {@link MODEL_PROVIDER_IDS}; every provider currently serves at least one
122
- * model, so all {@link ProviderName} keys are present.
123
- */
124
- export declare const SUPPORTED_MODELS_BY_PROVIDER: Readonly<Record<ProviderName, readonly ModelName[]>>;
125
- /**
126
- * All upstream providers that can serve a model id, in declaration order.
127
- * Returns `[]` for an unknown model.
128
- */
129
- export declare function providersForModel(model: string): readonly ProviderName[];
130
- /**
131
- * The default upstream provider for a model id — the first provider declared
132
- * for it in {@link MODEL_PROVIDER_IDS}. Returns `undefined` when the input is
133
- * not a known {@link ModelName} (so the SDK can fall back to the default and let
134
- * the server reject the model).
135
- */
136
- export declare function providerForModel(model: string): ProviderName | undefined;
137
- /**
138
- * Translate a canonical model id + provider into the provider-native model
139
- * string the upstream API expects (e.g. `("gpt-4o-mini", "openrouter")` →
140
- * `"openai/gpt-4o-mini"`). Throws when the provider does not serve the model.
141
- */
142
- export declare function resolveProviderModelId(model: string, provider: ProviderName): string;
143
- /**
144
- * The single model→provider resolver shared by the SDK and the CLI, wrapping
145
- * {@link providersForModel} with the forward-compat unknown-model allowance:
146
- *
147
- * - `provider` given: it is honored. If `model` is a KNOWN id, the provider
148
- * must serve it (else throw). If `model` is UNKNOWN, it is allowed through
149
- * so a slightly-old client can still run a newly-launched model (the server
150
- * arbitrates).
151
- * - `provider` omitted: a known model resolves to its DEFAULT provider (first
152
- * declared). An UNKNOWN model with no provider throws a `did you mean?`
153
- * hint — you must name a provider to run a model this client doesn't know.
154
- *
155
- * Returns the resolved {@link ProviderName}.
156
- */
157
- export declare function resolveModelProvider(model: string, provider?: ProviderName): ProviderName;
158
- export declare function isModelName(input: unknown): input is ModelName;
159
- export declare function parseModelName(input: unknown, field?: string): ModelName;
160
- export declare function assertModelNameMatchesProvider(provider: ProviderName, model: ModelName, field?: string): void;
4
+ * There is no closed model set and no provider concept: a customer names any
5
+ * slug the managed gateway catalog serves (e.g. `anthropic/claude-haiku-4-5`,
6
+ * `deepseek/deepseek-v4-flash`) and the platform routes it through the single
7
+ * managed gateway key. Adding a catalog model is a ZERO-code change — the slug
8
+ * just works. The boundary validation is purely structural (see
9
+ * {@link parseModelSlug}); an unknown-but-well-formed slug is allowed through so
10
+ * a slightly-old client can still run a newly-launched model (the gateway
11
+ * arbitrates at submit time).
12
+ */
13
+ export type ModelName = string;
14
+ /**
15
+ * Structural gateway model-slug shape: a lowercase `creator`, a `/`, then the
16
+ * model segment. Matches Vercel AI Gateway `creator/model` slugs
17
+ * (e.g. `anthropic/claude-sonnet-4-6`, `openai/gpt-4.1`, `x-ai/grok-2`).
18
+ */
19
+ export declare const MODEL_SLUG_PATTERN: RegExp;
20
+ /** True when `input` is a structurally valid `creator/model` gateway slug. */
21
+ export declare function isModelSlug(input: unknown): input is string;
22
+ /**
23
+ * Validate a public model id as a gateway `creator/model` slug string. This is
24
+ * a boundary shape gate ONLY — it does not consult a catalog, so a well-formed
25
+ * slug the running client does not recognize is accepted (the gateway rejects a
26
+ * truly-absent model at submit time). Throws a {@link import("./contract-parse-error.js").ContractParseError}
27
+ * with `field` context on a malformed value.
28
+ */
29
+ export declare function parseModelSlug(input: unknown, field?: string): string;
@@ -1,196 +1,32 @@
1
- import { suggest } from "./suggest.js";
2
1
  import { rethrowContractParseError } from "./contract-parse-error.js";
3
2
  /**
4
- * Source of truth for the closed model set: each canonical model id maps to the
5
- * upstream providers that can serve it and the **provider-native** model string
6
- * each one expects.
7
- *
8
- * `Models.*` / `SUPPORTED_MODELS` are aex's own **canonical, provider-neutral**
9
- * identifiers — they are NOT the strings sent to a provider. The platform
10
- * translates a `(canonical model, provider)` pair to the native id via
11
- * {@link resolveProviderModelId} when it builds the session's session manifest. The
12
- * same canonical model can therefore be served by more than one provider (e.g.
13
- * `gpt-4o-mini` via `openai` *or* `openrouter`), with a different native string
14
- * per provider.
15
- *
16
- * Ordering matters: the **first** provider listed for a model is its default
17
- * (see {@link providerForModel}) — list the native vendor before `openrouter`.
18
- * Additions belong here first so SDK types, CLI validation, docs examples, and
19
- * platform parsing all move together.
3
+ * Structural gateway model-slug shape: a lowercase `creator`, a `/`, then the
4
+ * model segment. Matches Vercel AI Gateway `creator/model` slugs
5
+ * (e.g. `anthropic/claude-sonnet-4-6`, `openai/gpt-4.1`, `x-ai/grok-2`).
20
6
  */
21
- export const MODEL_PROVIDER_IDS = {
22
- "claude-haiku-4-5": { anthropic: "claude-haiku-4-5" },
23
- "claude-3-5-haiku-latest": { anthropic: "claude-3-5-haiku-latest" },
24
- "claude-3-5-sonnet-latest": { anthropic: "claude-3-5-sonnet-latest" },
25
- "claude-sonnet-4-6": { anthropic: "claude-sonnet-4-6" },
26
- "deepseek-v4-flash": { deepseek: "deepseek-v4-flash" },
27
- "deepseek-v4-pro": { deepseek: "deepseek-v4-pro" },
28
- "gpt-4.1": { openai: "gpt-4.1" },
29
- "gpt-4o-mini": { openai: "gpt-4o-mini", openrouter: "openai/gpt-4o-mini" },
30
- "gpt-4o": { openrouter: "openai/gpt-4o" },
31
- "gemini-2.0-flash": { openrouter: "google/gemini-2.0-flash-001" },
32
- "gemini-2.5-flash": { gemini: "gemini-2.5-flash" },
33
- "mistral-large-latest": { mistral: "mistral-large-latest" },
34
- "mistral-small-latest": { mistral: "mistral-small-latest" },
35
- // Doubao (ByteDance) via the official international BytePlus ModelArk API.
36
- // Ark accepts the API-format model NAME directly in the chat-completions
37
- // `model` field (no `ep-…` inference-endpoint id).
38
- // pro — Doubao Seed 1.8 (flagship, 256K context).
39
- // flash — Doubao Seed 1.6 Flash (fast/cheap, 256K context).
40
- "doubao-seed-pro": { doubao: "doubao-seed-1-8-251228" },
41
- "doubao-seed-flash": { doubao: "doubao-seed-1-6-flash-250828" }
42
- };
43
- export const SUPPORTED_MODELS = Object.keys(MODEL_PROVIDER_IDS);
44
- /**
45
- * Symbol-style accessors for the closed model set. Prefer these over raw
46
- * strings so an invalid token is a compile error, not a runtime 400 — e.g.
47
- * `Models.CLAUDE_HAIKU_4_5`. These are aex's **canonical** ids, not the native
48
- * strings sent upstream; the platform translates them per provider (see
49
- * {@link MODEL_PROVIDER_IDS} / {@link resolveProviderModelId}). When a model is
50
- * served by more than one provider, pair it with an explicit {@link Providers}
51
- * value; otherwise the single (default) provider is used.
52
- */
53
- export const Models = {
54
- /** Claude Haiku 4.5 — Anthropic. */
55
- CLAUDE_HAIKU_4_5: "claude-haiku-4-5",
56
- /** Claude 3.5 Haiku (latest) — Anthropic. */
57
- CLAUDE_3_5_HAIKU_LATEST: "claude-3-5-haiku-latest",
58
- /** Claude 3.5 Sonnet (latest) — Anthropic. */
59
- CLAUDE_3_5_SONNET_LATEST: "claude-3-5-sonnet-latest",
60
- /** Claude Sonnet 4.6 — Anthropic (1M context, reasoning-capable). */
61
- CLAUDE_SONNET_4_6: "claude-sonnet-4-6",
62
- /** DeepSeek V4 Flash — DeepSeek (non-thinking, fast). */
63
- DEEPSEEK_V4_FLASH: "deepseek-v4-flash",
64
- /** DeepSeek V4 Pro — DeepSeek (reasoning-heavy). */
65
- DEEPSEEK_V4_PRO: "deepseek-v4-pro",
66
- /** GPT-4.1 — OpenAI. */
67
- GPT_4_1: "gpt-4.1",
68
- /** GPT-4o mini — OpenAI, or via OpenRouter (`provider: Providers.OPENROUTER`). */
69
- GPT_4O_MINI: "gpt-4o-mini",
70
- /** GPT-4o — via OpenRouter (`provider: Providers.OPENROUTER`). */
71
- GPT_4O: "gpt-4o",
72
- /** Gemini 2.0 Flash — via OpenRouter (`provider: Providers.OPENROUTER`). */
73
- GEMINI_2_0_FLASH: "gemini-2.0-flash",
74
- /** Gemini 2.5 Flash — Gemini. */
75
- GEMINI_2_5_FLASH: "gemini-2.5-flash",
76
- /** Mistral Large (latest) — Mistral. */
77
- MISTRAL_LARGE_LATEST: "mistral-large-latest",
78
- /** Mistral Small (latest) — Mistral. */
79
- MISTRAL_SMALL_LATEST: "mistral-small-latest",
80
- /**
81
- * Doubao Seed 1.8 — ByteDance, via the international BytePlus gateway.
82
- */
83
- DOUBAO_SEED_PRO: "doubao-seed-pro",
84
- /**
85
- * Doubao Seed 1.6 Flash — ByteDance, via BytePlus (fast/cheap).
86
- */
87
- DOUBAO_SEED_FLASH: "doubao-seed-flash"
88
- };
89
- /**
90
- * Per-model provider lists, in declaration order. Derived from
91
- * {@link MODEL_PROVIDER_IDS} so the two never drift.
92
- */
93
- const PROVIDERS_BY_MODEL = (() => {
94
- const map = {};
95
- for (const [model, providers] of Object.entries(MODEL_PROVIDER_IDS)) {
96
- map[model] = Object.keys(providers);
97
- }
98
- return map;
99
- })();
100
- /**
101
- * Provider → canonical models that provider can serve. Derived from
102
- * {@link MODEL_PROVIDER_IDS}; every provider currently serves at least one
103
- * model, so all {@link ProviderName} keys are present.
104
- */
105
- export const SUPPORTED_MODELS_BY_PROVIDER = (() => {
106
- const map = {};
107
- for (const [model, providers] of Object.entries(MODEL_PROVIDER_IDS)) {
108
- for (const provider of Object.keys(providers)) {
109
- (map[provider] ??= []).push(model);
110
- }
111
- }
112
- return map;
113
- })();
114
- /**
115
- * All upstream providers that can serve a model id, in declaration order.
116
- * Returns `[]` for an unknown model.
117
- */
118
- export function providersForModel(model) {
119
- return PROVIDERS_BY_MODEL[model] ?? [];
120
- }
121
- /**
122
- * The default upstream provider for a model id — the first provider declared
123
- * for it in {@link MODEL_PROVIDER_IDS}. Returns `undefined` when the input is
124
- * not a known {@link ModelName} (so the SDK can fall back to the default and let
125
- * the server reject the model).
126
- */
127
- export function providerForModel(model) {
128
- return providersForModel(model)[0];
7
+ export const MODEL_SLUG_PATTERN = /^[a-z0-9-]+\/[A-Za-z0-9._:-]+$/;
8
+ /** True when `input` is a structurally valid `creator/model` gateway slug. */
9
+ export function isModelSlug(input) {
10
+ return typeof input === "string" && MODEL_SLUG_PATTERN.test(input);
129
11
  }
130
12
  /**
131
- * Translate a canonical model id + provider into the provider-native model
132
- * string the upstream API expects (e.g. `("gpt-4o-mini", "openrouter")`
133
- * `"openai/gpt-4o-mini"`). Throws when the provider does not serve the model.
13
+ * Validate a public model id as a gateway `creator/model` slug string. This is
14
+ * a boundary shape gate ONLY it does not consult a catalog, so a well-formed
15
+ * slug the running client does not recognize is accepted (the gateway rejects a
16
+ * truly-absent model at submit time). Throws a {@link import("./contract-parse-error.js").ContractParseError}
17
+ * with `field` context on a malformed value.
134
18
  */
135
- export function resolveProviderModelId(model, provider) {
136
- const entry = MODEL_PROVIDER_IDS[model];
137
- const native = entry?.[provider];
138
- if (native === undefined) {
139
- throw new Error(`resolveProviderModelId: model ${JSON.stringify(model)} is not available for provider ${JSON.stringify(provider)}; ` +
140
- `available: ${providersForModel(model).join(", ") || "(none)"}`);
141
- }
142
- return native;
143
- }
144
- /**
145
- * The single model→provider resolver shared by the SDK and the CLI, wrapping
146
- * {@link providersForModel} with the forward-compat unknown-model allowance:
147
- *
148
- * - `provider` given: it is honored. If `model` is a KNOWN id, the provider
149
- * must serve it (else throw). If `model` is UNKNOWN, it is allowed through
150
- * so a slightly-old client can still run a newly-launched model (the server
151
- * arbitrates).
152
- * - `provider` omitted: a known model resolves to its DEFAULT provider (first
153
- * declared). An UNKNOWN model with no provider throws a `did you mean?`
154
- * hint — you must name a provider to run a model this client doesn't know.
155
- *
156
- * Returns the resolved {@link ProviderName}.
157
- */
158
- export function resolveModelProvider(model, provider) {
159
- const providers = providersForModel(model);
160
- if (provider !== undefined) {
161
- if (providers.length > 0 && !providers.includes(provider)) {
162
- throw new Error(`model ${JSON.stringify(model)} is not available for provider ${provider}; ` +
163
- `available: ${providers.join(", ")}`);
164
- }
165
- return provider;
166
- }
167
- const inferred = providers[0];
168
- if (inferred === undefined) {
169
- const hint = suggest(model, SUPPORTED_MODELS);
170
- throw new Error(`${JSON.stringify(model)} is not a known model id` +
171
- (hint ? ` (did you mean ${JSON.stringify(hint)}?)` : "") +
172
- "; pass provider explicitly to run it");
173
- }
174
- return inferred;
175
- }
176
- export function isModelName(input) {
177
- return typeof input === "string" && SUPPORTED_MODELS.includes(input);
178
- }
179
- export function parseModelName(input, field = "submission.model") {
19
+ export function parseModelSlug(input, field = "submission.model") {
180
20
  try {
181
- if (!isModelName(input)) {
182
- throw new Error(`${field} must be one of: ${SUPPORTED_MODELS.join(", ")}`);
21
+ if (typeof input !== "string" || input.length === 0) {
22
+ throw new Error(`${field} must be a non-empty gateway model slug string ("creator/model")`);
23
+ }
24
+ if (!MODEL_SLUG_PATTERN.test(input)) {
25
+ throw new Error(`${field} must be a gateway model slug of the form "creator/model" matching ${MODEL_SLUG_PATTERN.source} (got ${JSON.stringify(input)})`);
183
26
  }
184
27
  return input;
185
28
  }
186
29
  catch (error) {
187
- rethrowContractParseError(error, "parseModelName");
188
- }
189
- }
190
- export function assertModelNameMatchesProvider(provider, model, field = "submission.model") {
191
- const providers = providersForModel(model);
192
- if (!providers.includes(provider)) {
193
- throw new Error(`${field} ${JSON.stringify(model)} is not supported for provider ${provider}; ` +
194
- `expected one of: ${providers.join(", ")}`);
30
+ rethrowContractParseError(error, "parseModelSlug");
195
31
  }
196
32
  }
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Three product runtimes, selected per session (feature addition, not a
10
10
  * migration — see `references/microvm-migration-2026-07-15/00`§0):
11
- * - `container` — today's co-located Fargate (on-demand). Default.
11
+ * - `container` — today's co-located Fargate (on-demand). Explicit opt-in.
12
12
  * - `spot_container` — the same behavior on Fargate Spot: cheaper and
13
13
  * interruption tolerant through durable recovery.
14
14
  * - `lambda` — event-driven Lambda + on-demand MicroVM sandbox;
@@ -20,7 +20,7 @@
20
20
  export declare const RUNTIME_KINDS: readonly ["container", "spot_container", "lambda"];
21
21
  /** One of the closed {@link RUNTIME_KINDS} tokens. */
22
22
  export type RuntimeKind = (typeof RUNTIME_KINDS)[number];
23
- /** Default when `runtimeKind` is omitted (today's co-located Fargate path). */
23
+ /** Default when `runtimeKind` is omitted (the event-driven Lambda path). */
24
24
  export declare const DEFAULT_RUNTIME_KIND: RuntimeKind;
25
25
  /**
26
26
  * Symbol-style accessors for TS callers: `RuntimeKinds.SPOT_CONTAINER` resolves
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Three product runtimes, selected per session (feature addition, not a
10
10
  * migration — see `references/microvm-migration-2026-07-15/00`§0):
11
- * - `container` — today's co-located Fargate (on-demand). Default.
11
+ * - `container` — today's co-located Fargate (on-demand). Explicit opt-in.
12
12
  * - `spot_container` — the same behavior on Fargate Spot: cheaper and
13
13
  * interruption tolerant through durable recovery.
14
14
  * - `lambda` — event-driven Lambda + on-demand MicroVM sandbox;
@@ -20,8 +20,8 @@
20
20
  /** The accepted execution-runtime values (the wire/CLI tokens). */
21
21
  import { rethrowContractParseError } from "./contract-parse-error.js";
22
22
  export const RUNTIME_KINDS = ["container", "spot_container", "lambda"];
23
- /** Default when `runtimeKind` is omitted (today's co-located Fargate path). */
24
- export const DEFAULT_RUNTIME_KIND = "container";
23
+ /** Default when `runtimeKind` is omitted (the event-driven Lambda path). */
24
+ export const DEFAULT_RUNTIME_KIND = "lambda";
25
25
  /**
26
26
  * Symbol-style accessors for TS callers: `RuntimeKinds.SPOT_CONTAINER` resolves
27
27
  * to the wire token `"spot_container"`. Re-exported by the SDK as
@@ -3,7 +3,7 @@ import type { RuntimeSize } from "./runtime-sizes.js";
3
3
  import type { RuntimeKind } from "./runtime-kind.js";
4
4
  import type { SessionCostProviderUsage } from "./session-cost.js";
5
5
  import type { ProviderFault } from "./provider-fault.js";
6
- import type { PlatformInlineSecrets, PlatformSubmission, ProviderName, SessionLimits, SessionWebhookSpec } from "./submission.js";
6
+ import type { PlatformInlineSecrets, PlatformSubmission, SessionLimits, SessionWebhookSpec } from "./submission.js";
7
7
  /** Public run phases. Internal finalization remains behind the consistency barrier. */
8
8
  export declare const SESSION_RUN_PHASES: readonly ["queued", "starting", "running", "finished", "error"];
9
9
  export type SessionRunPhase = (typeof SESSION_RUN_PHASES)[number];
@@ -22,7 +22,7 @@ export interface SessionRun {
22
22
  /**
23
23
  * The execution runtime a session runs on. Both fields are optional (the
24
24
  * platform applies defaults): `kind` selects the backend
25
- * (`container` (default) | `spot_container` | `lambda`), `size` selects the
25
+ * (`lambda` (default) | `spot_container` | `container`), `size` selects the
26
26
  * managed box preset. Grouped so the SDK surface reads
27
27
  * `runtime: { kind: "lambda", size: Sizes.CPU_2_8GB }`.
28
28
  */
@@ -114,7 +114,6 @@ export type SessionSubmission = Omit<PlatformSubmission, "prompt"> & {
114
114
  readonly prompt?: readonly string[];
115
115
  };
116
116
  export interface SessionCreateRequest {
117
- readonly provider: ProviderName;
118
117
  readonly submission: SessionSubmission;
119
118
  readonly runtimeSize?: RuntimeSize;
120
119
  readonly runtimeKind?: RuntimeKind;
@@ -30,7 +30,7 @@
30
30
  * boundary.
31
31
  */
32
32
  import { rethrowContractParseError, withContractParseError } from "./contract-parse-error.js";
33
- import { parseModelName } from "./models.js";
33
+ import { parseModelSlug } from "./models.js";
34
34
  import { assertAllowedKeys, defineAllowedKeys } from "./allowed-keys.js";
35
35
  // ---------------------------------------------------------------------------
36
36
  // Skill ID + name format
@@ -630,7 +630,7 @@ export function parseSessionRequestConfig(input) {
630
630
  const record = input;
631
631
  const allowed = defineAllowedKeys()("model", "system", "prompt", "mcpServers", "environment", "runtimeSize", "timeout", "metadata");
632
632
  assertAllowedKeys(record, allowed, (key) => new Error(`session request config contains unexpected field: ${key}`));
633
- const model = parseModelName(record.model, "session request config model");
633
+ const model = parseModelSlug(record.model, "session request config model");
634
634
  const system = record.system;
635
635
  if (system !== undefined && typeof system !== "string") {
636
636
  throw new Error("session request config system, when provided, must be a string");