@aexhq/sdk 0.18.1 → 0.20.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 (47) hide show
  1. package/README.md +2 -2
  2. package/dist/_contracts/models.d.ts +133 -38
  3. package/dist/_contracts/models.js +114 -69
  4. package/dist/_contracts/operations.d.ts +17 -1
  5. package/dist/_contracts/operations.js +50 -0
  6. package/dist/_contracts/provider-support.d.ts +68 -0
  7. package/dist/_contracts/provider-support.js +28 -0
  8. package/dist/_contracts/run-config.d.ts +1 -1
  9. package/dist/_contracts/run-cost.d.ts +27 -0
  10. package/dist/_contracts/run-cost.js +34 -1
  11. package/dist/_contracts/runtime-types.d.ts +32 -0
  12. package/dist/_contracts/submission.d.ts +58 -2
  13. package/dist/_contracts/submission.js +106 -7
  14. package/dist/agents-md.d.ts +3 -3
  15. package/dist/agents-md.js +6 -6
  16. package/dist/agents-md.js.map +1 -1
  17. package/dist/cli.mjs +116 -86
  18. package/dist/cli.mjs.sha256 +1 -1
  19. package/dist/client.d.ts +90 -10
  20. package/dist/client.js +121 -40
  21. package/dist/client.js.map +1 -1
  22. package/dist/fetch-archive.js +1 -1
  23. package/dist/file.d.ts +3 -3
  24. package/dist/file.js +6 -6
  25. package/dist/file.js.map +1 -1
  26. package/dist/index.d.ts +6 -4
  27. package/dist/index.js +3 -2
  28. package/dist/index.js.map +1 -1
  29. package/dist/proxy-endpoint.d.ts +2 -2
  30. package/dist/proxy-endpoint.js +1 -1
  31. package/dist/secret.d.ts +102 -0
  32. package/dist/secret.js +148 -0
  33. package/dist/secret.js.map +1 -0
  34. package/dist/skill.d.ts +8 -8
  35. package/dist/skill.js +10 -10
  36. package/dist/skill.js.map +1 -1
  37. package/dist/version.d.ts +1 -1
  38. package/dist/version.js +1 -1
  39. package/docs/cleanup.md +1 -1
  40. package/docs/credentials.md +4 -4
  41. package/docs/events.md +2 -2
  42. package/docs/outputs.md +3 -3
  43. package/docs/provider-runtime-capabilities.md +23 -1
  44. package/docs/quickstart.md +7 -7
  45. package/docs/run-config.md +4 -4
  46. package/docs/skills.md +4 -4
  47. package/package.json +2 -2
package/README.md CHANGED
@@ -63,7 +63,7 @@ const aex = new AgentExecutor({
63
63
  // baseUrl defaults to https://api.aex.dev - set it for local or staging planes.
64
64
  });
65
65
 
66
- const runId = await aex.submitRun({
66
+ const runId = await aex.submit({
67
67
  model: RunModels.CLAUDE_HAIKU_4_5,
68
68
  system: "You are a concise automation agent.",
69
69
  prompt: "Write a short answer about agent-first SDK design.",
@@ -94,7 +94,7 @@ function summarise(topic: string) {
94
94
  };
95
95
  }
96
96
 
97
- const runId = await aex.submitRun({
97
+ const runId = await aex.submit({
98
98
  ...summarise("agent-first SDK design"),
99
99
  secrets: { apiKey: process.env.ANTHROPIC_API_KEY! }
100
100
  });
@@ -1,20 +1,90 @@
1
1
  import type { RunProvider } from "./submission.js";
2
2
  /**
3
- * Closed set of model ids accepted by the public run-submission schema.
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.
4
6
  *
5
- * The provider-proxy still sends the model id through to the selected upstream
6
- * provider, but callers cannot submit arbitrary strings. Additions belong here
7
- * first so SDK types, CLI validation, docs examples, and platform parsing move
8
- * together.
7
+ * `Models.*` / `RUN_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 run'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.
9
19
  */
10
- export declare const RUN_MODELS: readonly ["claude-haiku-4-5", "claude-3-5-haiku-latest", "claude-3-5-sonnet-latest", "deepseek-v4-flash", "deepseek-v4-pro", "deepseek-chat", "deepseek-reasoner", "gpt-4.1", "gpt-4o-mini", "gemini-2.0-flash", "gemini-2.5-flash", "mistral-large-latest", "mistral-small-latest", "openai/gpt-4o-mini", "openai/gpt-4o", "google/gemini-2.0-flash-001"];
11
- export type RunModel = (typeof RUN_MODELS)[number];
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 "deepseek-v4-flash": {
31
+ readonly deepseek: "deepseek-v4-flash";
32
+ };
33
+ readonly "deepseek-v4-pro": {
34
+ readonly deepseek: "deepseek-v4-pro";
35
+ };
36
+ readonly "deepseek-chat": {
37
+ readonly deepseek: "deepseek-chat";
38
+ };
39
+ readonly "deepseek-reasoner": {
40
+ readonly deepseek: "deepseek-reasoner";
41
+ };
42
+ readonly "gpt-4.1": {
43
+ readonly openai: "gpt-4.1";
44
+ };
45
+ readonly "gpt-4o-mini": {
46
+ readonly openai: "gpt-4o-mini";
47
+ readonly openrouter: "openai/gpt-4o-mini";
48
+ };
49
+ readonly "gpt-4o": {
50
+ readonly openrouter: "openai/gpt-4o";
51
+ };
52
+ readonly "gemini-2.0-flash": {
53
+ readonly gemini: "gemini-2.0-flash";
54
+ readonly openrouter: "google/gemini-2.0-flash-001";
55
+ };
56
+ readonly "gemini-2.5-flash": {
57
+ readonly gemini: "gemini-2.5-flash";
58
+ };
59
+ readonly "mistral-large-latest": {
60
+ readonly mistral: "mistral-large-latest";
61
+ };
62
+ readonly "mistral-small-latest": {
63
+ readonly mistral: "mistral-small-latest";
64
+ };
65
+ readonly "doubao-seed-pro": {
66
+ readonly doubao: "doubao-seed-1-8-251228";
67
+ readonly "doubao-cn": "doubao-seed-1-8-251228";
68
+ };
69
+ readonly "doubao-seed-flash": {
70
+ readonly doubao: "doubao-seed-1-6-flash-250828";
71
+ readonly "doubao-cn": "doubao-seed-1-6-flash-250828";
72
+ };
73
+ };
74
+ /**
75
+ * Closed set of canonical model ids accepted by the public run-submission
76
+ * schema. Derived from {@link MODEL_PROVIDER_IDS} so the two never drift.
77
+ */
78
+ export type RunModel = keyof typeof MODEL_PROVIDER_IDS;
79
+ export declare const RUN_MODELS: readonly RunModel[];
12
80
  /**
13
81
  * Symbol-style accessors for the closed model set. Prefer these over raw
14
82
  * strings so an invalid token is a compile error, not a runtime 400 — e.g.
15
- * `Models.CLAUDE_HAIKU_4_5`. The upstream provider is a pure function of the
16
- * model ({@link providerForModel}), so picking a model fully determines
17
- * routing; callers never pass `provider` separately.
83
+ * `Models.CLAUDE_HAIKU_4_5`. These are aex's **canonical** ids, not the native
84
+ * strings sent upstream; the platform translates them per provider (see
85
+ * {@link MODEL_PROVIDER_IDS} / {@link resolveProviderModelId}). When a model is
86
+ * served by more than one provider, pair it with an explicit {@link Providers}
87
+ * value; otherwise the single (default) provider is used.
18
88
  */
19
89
  export declare const Models: {
20
90
  /** Claude Haiku 4.5 — Anthropic. */
@@ -42,9 +112,11 @@ export declare const Models: {
42
112
  readonly DEEPSEEK_REASONER: "deepseek-reasoner";
43
113
  /** GPT-4.1 — OpenAI. */
44
114
  readonly GPT_4_1: "gpt-4.1";
45
- /** GPT-4o mini — OpenAI. */
115
+ /** GPT-4o mini — OpenAI, or via OpenRouter (`provider: Providers.OPENROUTER`). */
46
116
  readonly GPT_4O_MINI: "gpt-4o-mini";
47
- /** Gemini 2.0 Flash Gemini. */
117
+ /** GPT-4o via OpenRouter (`provider: Providers.OPENROUTER`). */
118
+ readonly GPT_4O: "gpt-4o";
119
+ /** Gemini 2.0 Flash — Gemini, or via OpenRouter (`provider: Providers.OPENROUTER`). */
48
120
  readonly GEMINI_2_0_FLASH: "gemini-2.0-flash";
49
121
  /** Gemini 2.5 Flash — Gemini. */
50
122
  readonly GEMINI_2_5_FLASH: "gemini-2.5-flash";
@@ -52,12 +124,18 @@ export declare const Models: {
52
124
  readonly MISTRAL_LARGE_LATEST: "mistral-large-latest";
53
125
  /** Mistral Small (latest) — Mistral. */
54
126
  readonly MISTRAL_SMALL_LATEST: "mistral-small-latest";
55
- /** GPT-4o mini via OpenRouter (provider-prefixed) — cheap, tool-obedient. */
56
- readonly OPENROUTER_GPT_4O_MINI: "openai/gpt-4o-mini";
57
- /** GPT-4o via OpenRouter (provider-prefixed) stronger, tool-obedient. */
58
- readonly OPENROUTER_GPT_4O: "openai/gpt-4o";
59
- /** Gemini 2.0 Flash via OpenRouter (provider-prefixed) — cheap, tool-obedient. */
60
- readonly OPENROUTER_GEMINI_2_0_FLASH: "google/gemini-2.0-flash-001";
127
+ /**
128
+ * Doubao Seed 1.8 — ByteDance, via the official Ark API. Default routes
129
+ * through the international BytePlus gateway (`Providers.DOUBAO`); pair with
130
+ * `Providers.DOUBAO_CN` for the China Volcengine gateway.
131
+ */
132
+ readonly DOUBAO_SEED_PRO: "doubao-seed-pro";
133
+ /**
134
+ * Doubao Seed 1.6 Flash — ByteDance, via the official Ark API (fast/cheap).
135
+ * Default `Providers.DOUBAO` (international); pair with `Providers.DOUBAO_CN`
136
+ * for China.
137
+ */
138
+ readonly DOUBAO_SEED_FLASH: "doubao-seed-flash";
61
139
  };
62
140
  /**
63
141
  * Back-compat alias for {@link Models}. Existing imports of `RunModels`
@@ -89,9 +167,11 @@ export declare const RunModels: {
89
167
  readonly DEEPSEEK_REASONER: "deepseek-reasoner";
90
168
  /** GPT-4.1 — OpenAI. */
91
169
  readonly GPT_4_1: "gpt-4.1";
92
- /** GPT-4o mini — OpenAI. */
170
+ /** GPT-4o mini — OpenAI, or via OpenRouter (`provider: Providers.OPENROUTER`). */
93
171
  readonly GPT_4O_MINI: "gpt-4o-mini";
94
- /** Gemini 2.0 Flash Gemini. */
172
+ /** GPT-4o via OpenRouter (`provider: Providers.OPENROUTER`). */
173
+ readonly GPT_4O: "gpt-4o";
174
+ /** Gemini 2.0 Flash — Gemini, or via OpenRouter (`provider: Providers.OPENROUTER`). */
95
175
  readonly GEMINI_2_0_FLASH: "gemini-2.0-flash";
96
176
  /** Gemini 2.5 Flash — Gemini. */
97
177
  readonly GEMINI_2_5_FLASH: "gemini-2.5-flash";
@@ -99,28 +179,43 @@ export declare const RunModels: {
99
179
  readonly MISTRAL_LARGE_LATEST: "mistral-large-latest";
100
180
  /** Mistral Small (latest) — Mistral. */
101
181
  readonly MISTRAL_SMALL_LATEST: "mistral-small-latest";
102
- /** GPT-4o mini via OpenRouter (provider-prefixed) — cheap, tool-obedient. */
103
- readonly OPENROUTER_GPT_4O_MINI: "openai/gpt-4o-mini";
104
- /** GPT-4o via OpenRouter (provider-prefixed) stronger, tool-obedient. */
105
- readonly OPENROUTER_GPT_4O: "openai/gpt-4o";
106
- /** Gemini 2.0 Flash via OpenRouter (provider-prefixed) — cheap, tool-obedient. */
107
- readonly OPENROUTER_GEMINI_2_0_FLASH: "google/gemini-2.0-flash-001";
108
- };
109
- export declare const RUN_MODELS_BY_PROVIDER: {
110
- readonly anthropic: readonly ["claude-haiku-4-5", "claude-3-5-haiku-latest", "claude-3-5-sonnet-latest"];
111
- readonly deepseek: readonly ["deepseek-v4-flash", "deepseek-v4-pro", "deepseek-chat", "deepseek-reasoner"];
112
- readonly openai: readonly ["gpt-4.1", "gpt-4o-mini"];
113
- readonly gemini: readonly ["gemini-2.0-flash", "gemini-2.5-flash"];
114
- readonly mistral: readonly ["mistral-large-latest", "mistral-small-latest"];
115
- readonly openrouter: readonly ["openai/gpt-4o-mini", "openai/gpt-4o", "google/gemini-2.0-flash-001"];
182
+ /**
183
+ * Doubao Seed 1.8 — ByteDance, via the official Ark API. Default routes
184
+ * through the international BytePlus gateway (`Providers.DOUBAO`); pair with
185
+ * `Providers.DOUBAO_CN` for the China Volcengine gateway.
186
+ */
187
+ readonly DOUBAO_SEED_PRO: "doubao-seed-pro";
188
+ /**
189
+ * Doubao Seed 1.6 Flash — ByteDance, via the official Ark API (fast/cheap).
190
+ * Default `Providers.DOUBAO` (international); pair with `Providers.DOUBAO_CN`
191
+ * for China.
192
+ */
193
+ readonly DOUBAO_SEED_FLASH: "doubao-seed-flash";
116
194
  };
117
195
  /**
118
- * Resolve the upstream provider for a model id. Returns `undefined` when the
119
- * input is not a known {@link RunModel} (so the SDK can fall back to the
120
- * default and let the server reject the model). Total over the closed model
121
- * set, so any `RunModel` resolves.
196
+ * Provider canonical models that provider can serve. Derived from
197
+ * {@link MODEL_PROVIDER_IDS}; every provider currently serves at least one
198
+ * model, so all {@link RunProvider} keys are present.
199
+ */
200
+ export declare const RUN_MODELS_BY_PROVIDER: Readonly<Record<RunProvider, readonly RunModel[]>>;
201
+ /**
202
+ * All upstream providers that can serve a model id, in declaration order.
203
+ * Returns `[]` for an unknown model.
204
+ */
205
+ export declare function providersForModel(model: string): readonly RunProvider[];
206
+ /**
207
+ * The default upstream provider for a model id — the first provider declared
208
+ * for it in {@link MODEL_PROVIDER_IDS}. Returns `undefined` when the input is
209
+ * not a known {@link RunModel} (so the SDK can fall back to the default and let
210
+ * the server reject the model).
122
211
  */
123
212
  export declare function providerForModel(model: string): RunProvider | undefined;
213
+ /**
214
+ * Translate a canonical model id + provider into the provider-native model
215
+ * string the upstream API expects (e.g. `("gpt-4o-mini", "openrouter")` →
216
+ * `"openai/gpt-4o-mini"`). Throws when the provider does not serve the model.
217
+ */
218
+ export declare function resolveProviderModelId(model: string, provider: RunProvider): string;
124
219
  export declare function isRunModel(input: unknown): input is RunModel;
125
220
  export declare function parseRunModel(input: unknown, field?: string): RunModel;
126
221
  export declare function assertRunModelMatchesProvider(provider: RunProvider, model: RunModel, field?: string): void;
@@ -1,35 +1,60 @@
1
1
  /**
2
- * Closed set of model ids accepted by the public run-submission schema.
2
+ * Source of truth for the closed model set: each canonical model id maps to the
3
+ * upstream providers that can serve it and the **provider-native** model string
4
+ * each one expects.
3
5
  *
4
- * The provider-proxy still sends the model id through to the selected upstream
5
- * provider, but callers cannot submit arbitrary strings. Additions belong here
6
- * first so SDK types, CLI validation, docs examples, and platform parsing move
7
- * together.
6
+ * `Models.*` / `RUN_MODELS` are aex's own **canonical, provider-neutral**
7
+ * identifiers they are NOT the strings sent to a provider. The platform
8
+ * translates a `(canonical model, provider)` pair to the native id via
9
+ * {@link resolveProviderModelId} when it builds the run's session manifest. The
10
+ * same canonical model can therefore be served by more than one provider (e.g.
11
+ * `gpt-4o-mini` via `openai` *or* `openrouter`), with a different native string
12
+ * per provider.
13
+ *
14
+ * Ordering matters: the **first** provider listed for a model is its default
15
+ * (see {@link providerForModel}) — list the native vendor before `openrouter`.
16
+ * Additions belong here first so SDK types, CLI validation, docs examples, and
17
+ * platform parsing all move together.
8
18
  */
9
- export const RUN_MODELS = [
10
- "claude-haiku-4-5",
11
- "claude-3-5-haiku-latest",
12
- "claude-3-5-sonnet-latest",
13
- "deepseek-v4-flash",
14
- "deepseek-v4-pro",
15
- "deepseek-chat",
16
- "deepseek-reasoner",
17
- "gpt-4.1",
18
- "gpt-4o-mini",
19
- "gemini-2.0-flash",
20
- "gemini-2.5-flash",
21
- "mistral-large-latest",
22
- "mistral-small-latest",
23
- "openai/gpt-4o-mini",
24
- "openai/gpt-4o",
25
- "google/gemini-2.0-flash-001"
26
- ];
19
+ export const MODEL_PROVIDER_IDS = {
20
+ "claude-haiku-4-5": { anthropic: "claude-haiku-4-5" },
21
+ "claude-3-5-haiku-latest": { anthropic: "claude-3-5-haiku-latest" },
22
+ "claude-3-5-sonnet-latest": { anthropic: "claude-3-5-sonnet-latest" },
23
+ "deepseek-v4-flash": { deepseek: "deepseek-v4-flash" },
24
+ "deepseek-v4-pro": { deepseek: "deepseek-v4-pro" },
25
+ "deepseek-chat": { deepseek: "deepseek-chat" },
26
+ "deepseek-reasoner": { deepseek: "deepseek-reasoner" },
27
+ "gpt-4.1": { openai: "gpt-4.1" },
28
+ "gpt-4o-mini": { openai: "gpt-4o-mini", openrouter: "openai/gpt-4o-mini" },
29
+ "gpt-4o": { openrouter: "openai/gpt-4o" },
30
+ "gemini-2.0-flash": { gemini: "gemini-2.0-flash", openrouter: "google/gemini-2.0-flash-001" },
31
+ "gemini-2.5-flash": { gemini: "gemini-2.5-flash" },
32
+ "mistral-large-latest": { mistral: "mistral-large-latest" },
33
+ "mistral-small-latest": { mistral: "mistral-small-latest" },
34
+ // Doubao (ByteDance) via the official Ark API. Served by both the
35
+ // international BytePlus ModelArk gateway (`doubao`, the default) and the
36
+ // China Volcengine Ark gateway (`doubao-cn`). Ark accepts the API-format
37
+ // model NAME directly in the chat-completions `model` field (no `ep-…`
38
+ // inference-endpoint id). The native strings are the same Ark catalog ids on
39
+ // both gateways; BytePlus per-account availability is confirmed at live-verify
40
+ // (both providers ship `live-unverified` until then — provider-support.ts).
41
+ // pro — Doubao Seed 1.8 (flagship, 256K context).
42
+ // flash — Doubao Seed 1.6 Flash (fast/cheap, 256K context).
43
+ "doubao-seed-pro": { doubao: "doubao-seed-1-8-251228", "doubao-cn": "doubao-seed-1-8-251228" },
44
+ "doubao-seed-flash": {
45
+ doubao: "doubao-seed-1-6-flash-250828",
46
+ "doubao-cn": "doubao-seed-1-6-flash-250828"
47
+ }
48
+ };
49
+ export const RUN_MODELS = Object.keys(MODEL_PROVIDER_IDS);
27
50
  /**
28
51
  * Symbol-style accessors for the closed model set. Prefer these over raw
29
52
  * strings so an invalid token is a compile error, not a runtime 400 — e.g.
30
- * `Models.CLAUDE_HAIKU_4_5`. The upstream provider is a pure function of the
31
- * model ({@link providerForModel}), so picking a model fully determines
32
- * routing; callers never pass `provider` separately.
53
+ * `Models.CLAUDE_HAIKU_4_5`. These are aex's **canonical** ids, not the native
54
+ * strings sent upstream; the platform translates them per provider (see
55
+ * {@link MODEL_PROVIDER_IDS} / {@link resolveProviderModelId}). When a model is
56
+ * served by more than one provider, pair it with an explicit {@link Providers}
57
+ * value; otherwise the single (default) provider is used.
33
58
  */
34
59
  export const Models = {
35
60
  /** Claude Haiku 4.5 — Anthropic. */
@@ -57,9 +82,11 @@ export const Models = {
57
82
  DEEPSEEK_REASONER: "deepseek-reasoner",
58
83
  /** GPT-4.1 — OpenAI. */
59
84
  GPT_4_1: "gpt-4.1",
60
- /** GPT-4o mini — OpenAI. */
85
+ /** GPT-4o mini — OpenAI, or via OpenRouter (`provider: Providers.OPENROUTER`). */
61
86
  GPT_4O_MINI: "gpt-4o-mini",
62
- /** Gemini 2.0 Flash Gemini. */
87
+ /** GPT-4o via OpenRouter (`provider: Providers.OPENROUTER`). */
88
+ GPT_4O: "gpt-4o",
89
+ /** Gemini 2.0 Flash — Gemini, or via OpenRouter (`provider: Providers.OPENROUTER`). */
63
90
  GEMINI_2_0_FLASH: "gemini-2.0-flash",
64
91
  /** Gemini 2.5 Flash — Gemini. */
65
92
  GEMINI_2_5_FLASH: "gemini-2.5-flash",
@@ -67,61 +94,78 @@ export const Models = {
67
94
  MISTRAL_LARGE_LATEST: "mistral-large-latest",
68
95
  /** Mistral Small (latest) — Mistral. */
69
96
  MISTRAL_SMALL_LATEST: "mistral-small-latest",
70
- /** GPT-4o mini via OpenRouter (provider-prefixed) — cheap, tool-obedient. */
71
- OPENROUTER_GPT_4O_MINI: "openai/gpt-4o-mini",
72
- /** GPT-4o via OpenRouter (provider-prefixed) stronger, tool-obedient. */
73
- OPENROUTER_GPT_4O: "openai/gpt-4o",
74
- /** Gemini 2.0 Flash via OpenRouter (provider-prefixed) — cheap, tool-obedient. */
75
- OPENROUTER_GEMINI_2_0_FLASH: "google/gemini-2.0-flash-001"
97
+ /**
98
+ * Doubao Seed 1.8 — ByteDance, via the official Ark API. Default routes
99
+ * through the international BytePlus gateway (`Providers.DOUBAO`); pair with
100
+ * `Providers.DOUBAO_CN` for the China Volcengine gateway.
101
+ */
102
+ DOUBAO_SEED_PRO: "doubao-seed-pro",
103
+ /**
104
+ * Doubao Seed 1.6 Flash — ByteDance, via the official Ark API (fast/cheap).
105
+ * Default `Providers.DOUBAO` (international); pair with `Providers.DOUBAO_CN`
106
+ * for China.
107
+ */
108
+ DOUBAO_SEED_FLASH: "doubao-seed-flash"
76
109
  };
77
110
  /**
78
111
  * Back-compat alias for {@link Models}. Existing imports of `RunModels`
79
112
  * keep working; new code should prefer `Models`.
80
113
  */
81
114
  export const RunModels = Models;
82
- export const RUN_MODELS_BY_PROVIDER = {
83
- anthropic: [
84
- Models.CLAUDE_HAIKU_4_5,
85
- Models.CLAUDE_3_5_HAIKU_LATEST,
86
- Models.CLAUDE_3_5_SONNET_LATEST
87
- ],
88
- deepseek: [
89
- Models.DEEPSEEK_V4_FLASH,
90
- Models.DEEPSEEK_V4_PRO,
91
- Models.DEEPSEEK_CHAT,
92
- Models.DEEPSEEK_REASONER
93
- ],
94
- openai: [Models.GPT_4_1, Models.GPT_4O_MINI],
95
- gemini: [Models.GEMINI_2_0_FLASH, Models.GEMINI_2_5_FLASH],
96
- mistral: [Models.MISTRAL_LARGE_LATEST, Models.MISTRAL_SMALL_LATEST],
97
- openrouter: [
98
- Models.OPENROUTER_GPT_4O_MINI,
99
- Models.OPENROUTER_GPT_4O,
100
- Models.OPENROUTER_GEMINI_2_0_FLASH
101
- ]
102
- };
103
115
  /**
104
- * Reverse index: every model id its single upstream provider. Derived from
105
- * {@link RUN_MODELS_BY_PROVIDER} so the two never drift; each model appears
106
- * under exactly one provider.
116
+ * Per-model provider lists, in declaration order. Derived from
117
+ * {@link MODEL_PROVIDER_IDS} so the two never drift.
107
118
  */
108
- const PROVIDER_BY_MODEL = (() => {
119
+ const PROVIDERS_BY_MODEL = (() => {
109
120
  const map = {};
110
- for (const [provider, models] of Object.entries(RUN_MODELS_BY_PROVIDER)) {
111
- for (const model of models) {
112
- map[model] = provider;
121
+ for (const [model, providers] of Object.entries(MODEL_PROVIDER_IDS)) {
122
+ map[model] = Object.keys(providers);
123
+ }
124
+ return map;
125
+ })();
126
+ /**
127
+ * Provider → canonical models that provider can serve. Derived from
128
+ * {@link MODEL_PROVIDER_IDS}; every provider currently serves at least one
129
+ * model, so all {@link RunProvider} keys are present.
130
+ */
131
+ export const RUN_MODELS_BY_PROVIDER = (() => {
132
+ const map = {};
133
+ for (const [model, providers] of Object.entries(MODEL_PROVIDER_IDS)) {
134
+ for (const provider of Object.keys(providers)) {
135
+ (map[provider] ??= []).push(model);
113
136
  }
114
137
  }
115
138
  return map;
116
139
  })();
117
140
  /**
118
- * Resolve the upstream provider for a model id. Returns `undefined` when the
119
- * input is not a known {@link RunModel} (so the SDK can fall back to the
120
- * default and let the server reject the model). Total over the closed model
121
- * set, so any `RunModel` resolves.
141
+ * All upstream providers that can serve a model id, in declaration order.
142
+ * Returns `[]` for an unknown model.
143
+ */
144
+ export function providersForModel(model) {
145
+ return PROVIDERS_BY_MODEL[model] ?? [];
146
+ }
147
+ /**
148
+ * The default upstream provider for a model id — the first provider declared
149
+ * for it in {@link MODEL_PROVIDER_IDS}. Returns `undefined` when the input is
150
+ * not a known {@link RunModel} (so the SDK can fall back to the default and let
151
+ * the server reject the model).
122
152
  */
123
153
  export function providerForModel(model) {
124
- return PROVIDER_BY_MODEL[model];
154
+ return providersForModel(model)[0];
155
+ }
156
+ /**
157
+ * Translate a canonical model id + provider into the provider-native model
158
+ * string the upstream API expects (e.g. `("gpt-4o-mini", "openrouter")` →
159
+ * `"openai/gpt-4o-mini"`). Throws when the provider does not serve the model.
160
+ */
161
+ export function resolveProviderModelId(model, provider) {
162
+ const entry = MODEL_PROVIDER_IDS[model];
163
+ const native = entry?.[provider];
164
+ if (native === undefined) {
165
+ throw new Error(`resolveProviderModelId: model ${JSON.stringify(model)} is not available for provider ${JSON.stringify(provider)}; ` +
166
+ `available: ${providersForModel(model).join(", ") || "(none)"}`);
167
+ }
168
+ return native;
125
169
  }
126
170
  export function isRunModel(input) {
127
171
  return typeof input === "string" && RUN_MODELS.includes(input);
@@ -133,9 +177,10 @@ export function parseRunModel(input, field = "submission.model") {
133
177
  return input;
134
178
  }
135
179
  export function assertRunModelMatchesProvider(provider, model, field = "submission.model") {
136
- if (!RUN_MODELS_BY_PROVIDER[provider].includes(model)) {
180
+ const providers = providersForModel(model);
181
+ if (!providers.includes(provider)) {
137
182
  throw new Error(`${field} ${JSON.stringify(model)} is not supported for provider ${provider}; ` +
138
- `expected one of: ${RUN_MODELS_BY_PROVIDER[provider].join(", ")}`);
183
+ `expected one of: ${providers.join(", ")}`);
139
184
  }
140
185
  }
141
186
  //# sourceMappingURL=models.js.map
@@ -1,6 +1,6 @@
1
1
  import type { HttpClient } from "./http.js";
2
2
  import type { RunUnit } from "./run-unit.js";
3
- import type { AgentsMdRecord, FileRecord, Output, OutputFileDownload, OutputFileSelector, Run, RunEvent, SignedOutputLink, Skill, WhoAmI } from "./runtime-types.js";
3
+ import type { AgentsMdRecord, FileRecord, Output, OutputFileDownload, OutputFileSelector, Run, RunEvent, SecretRecord, SecretReveal, SignedOutputLink, Skill, WhoAmI } from "./runtime-types.js";
4
4
  import type { PlatformRunSubmissionInput } from "./submission.js";
5
5
  /**
6
6
  * The single source of truth for SDK<->BFF transport. The SDK class
@@ -207,6 +207,22 @@ export declare function createFile(http: HttpClient, args: {
207
207
  export declare function listFiles(http: HttpClient): Promise<readonly FileRecord[]>;
208
208
  export declare function getFile(http: HttpClient, fileId: string): Promise<FileRecord>;
209
209
  export declare function deleteFile(http: HttpClient, fileId: string): Promise<void>;
210
+ /** Create a named workspace secret. The value travels in the body. */
211
+ export declare function createSecret(http: HttpClient, args: {
212
+ readonly name: string;
213
+ readonly value: string;
214
+ }): Promise<SecretRecord>;
215
+ export declare function listSecrets(http: HttpClient): Promise<readonly SecretRecord[]>;
216
+ /** Metadata for one workspace secret by name. Never returns the value. */
217
+ export declare function getSecret(http: HttpClient, name: string): Promise<SecretRecord>;
218
+ /** Audited value read — the only path that returns a workspace secret value. */
219
+ export declare function revealSecret(http: HttpClient, name: string): Promise<SecretReveal>;
220
+ /** Replace the value of an existing workspace secret; bumps its version. */
221
+ export declare function rotateSecret(http: HttpClient, args: {
222
+ readonly name: string;
223
+ readonly value: string;
224
+ }): Promise<SecretRecord>;
225
+ export declare function deleteSecret(http: HttpClient, name: string): Promise<void>;
210
226
  export interface AssetUploadResult {
211
227
  readonly assetId: string;
212
228
  readonly contentHash: string;
@@ -541,6 +541,56 @@ function unwrapFile(result) {
541
541
  }
542
542
  return result;
543
543
  }
544
+ // ===========================================================================
545
+ // Workspace secret operations
546
+ //
547
+ // Value-bearing requests (create/rotate) carry the value in the JSON BODY,
548
+ // never the URL/query, so it never lands in logs or the request line. Reads
549
+ // split by sensitivity: `getSecret`/`listSecrets` return METADATA only;
550
+ // `revealSecret` is the audited value read (POST so it's a logged action).
551
+ // ===========================================================================
552
+ /** Create a named workspace secret. The value travels in the body. */
553
+ export async function createSecret(http, args) {
554
+ const result = await http.request("/api/secrets", {
555
+ method: "POST",
556
+ body: JSON.stringify({ name: args.name, value: args.value })
557
+ });
558
+ return unwrapSecret(result);
559
+ }
560
+ export async function listSecrets(http) {
561
+ const result = await http.request("/api/secrets");
562
+ if (Array.isArray(result)) {
563
+ return result;
564
+ }
565
+ return result.secrets;
566
+ }
567
+ /** Metadata for one workspace secret by name. Never returns the value. */
568
+ export async function getSecret(http, name) {
569
+ const result = await http.request(`/api/secrets/${encodeURIComponent(name)}`);
570
+ return unwrapSecret(result);
571
+ }
572
+ /** Audited value read — the only path that returns a workspace secret value. */
573
+ export async function revealSecret(http, name) {
574
+ return http.request(`/api/secrets/${encodeURIComponent(name)}/reveal`, {
575
+ method: "POST"
576
+ });
577
+ }
578
+ /** Replace the value of an existing workspace secret; bumps its version. */
579
+ export async function rotateSecret(http, args) {
580
+ const result = await http.request(`/api/secrets/${encodeURIComponent(args.name)}/rotate`, { method: "POST", body: JSON.stringify({ value: args.value }) });
581
+ return unwrapSecret(result);
582
+ }
583
+ export async function deleteSecret(http, name) {
584
+ await http.request(`/api/secrets/${encodeURIComponent(name)}`, {
585
+ method: "DELETE"
586
+ });
587
+ }
588
+ function unwrapSecret(result) {
589
+ if (result && typeof result === "object" && "secret" in result) {
590
+ return result.secret;
591
+ }
592
+ return result;
593
+ }
544
594
  function unwrapSkill(result) {
545
595
  if (result && typeof result === "object" && "skill" in result) {
546
596
  return result.skill;
@@ -256,5 +256,73 @@ export declare const PROVIDER_PUBLIC_SUPPORT: {
256
256
  }];
257
257
  };
258
258
  };
259
+ readonly doubao: {
260
+ readonly displayName: "Doubao";
261
+ readonly status: "live-unverified";
262
+ readonly docsAnchor: "doubao";
263
+ readonly docs: readonly [{
264
+ readonly label: "Credentials";
265
+ readonly href: "credentials.md";
266
+ }, {
267
+ readonly label: "Events";
268
+ readonly href: "events.md";
269
+ }];
270
+ readonly evidence: readonly [{
271
+ readonly label: "Submission parser and routing parity";
272
+ readonly href: "../../contracts/test/submission.test.ts";
273
+ }, {
274
+ readonly label: "Runtime support validator";
275
+ readonly href: "../../contracts/test/runtime-support.test.ts";
276
+ }, {
277
+ readonly label: "Generated matrix freshness";
278
+ readonly href: "../../../scripts/validate/capability-matrix.test.ts";
279
+ }];
280
+ readonly runtimeEvidence: {
281
+ readonly managed: readonly [{
282
+ readonly label: "Submission parser and routing parity";
283
+ readonly href: "../../contracts/test/submission.test.ts";
284
+ }, {
285
+ readonly label: "Runtime support validator";
286
+ readonly href: "../../contracts/test/runtime-support.test.ts";
287
+ }, {
288
+ readonly label: "Generated matrix freshness";
289
+ readonly href: "../../../scripts/validate/capability-matrix.test.ts";
290
+ }];
291
+ };
292
+ };
293
+ readonly "doubao-cn": {
294
+ readonly displayName: "Doubao (China)";
295
+ readonly status: "live-unverified";
296
+ readonly docsAnchor: "doubao-cn";
297
+ readonly docs: readonly [{
298
+ readonly label: "Credentials";
299
+ readonly href: "credentials.md";
300
+ }, {
301
+ readonly label: "Events";
302
+ readonly href: "events.md";
303
+ }];
304
+ readonly evidence: readonly [{
305
+ readonly label: "Submission parser and routing parity";
306
+ readonly href: "../../contracts/test/submission.test.ts";
307
+ }, {
308
+ readonly label: "Runtime support validator";
309
+ readonly href: "../../contracts/test/runtime-support.test.ts";
310
+ }, {
311
+ readonly label: "Generated matrix freshness";
312
+ readonly href: "../../../scripts/validate/capability-matrix.test.ts";
313
+ }];
314
+ readonly runtimeEvidence: {
315
+ readonly managed: readonly [{
316
+ readonly label: "Submission parser and routing parity";
317
+ readonly href: "../../contracts/test/submission.test.ts";
318
+ }, {
319
+ readonly label: "Runtime support validator";
320
+ readonly href: "../../contracts/test/runtime-support.test.ts";
321
+ }, {
322
+ readonly label: "Generated matrix freshness";
323
+ readonly href: "../../../scripts/validate/capability-matrix.test.ts";
324
+ }];
325
+ };
326
+ };
259
327
  };
260
328
  export declare function providerPublicSupport(provider: RunProvider): ProviderPublicSupport;