@aexhq/sdk 0.16.1 → 0.18.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.
- package/dist/_contracts/models.d.ts +91 -2
- package/dist/_contracts/models.js +85 -10
- package/dist/_contracts/provider-support.d.ts +34 -0
- package/dist/_contracts/provider-support.js +10 -0
- package/dist/_contracts/proxy-protocol.d.ts +17 -0
- package/dist/_contracts/proxy-protocol.js +23 -1
- package/dist/_contracts/submission.d.ts +64 -12
- package/dist/_contracts/submission.js +168 -7
- package/dist/cli.mjs +77 -13
- package/dist/cli.mjs.sha256 +1 -1
- package/dist/client.d.ts +25 -14
- package/dist/client.js +11 -2
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/proxy-endpoint.d.ts +3 -1
- package/dist/proxy-endpoint.js +2 -1
- package/dist/proxy-endpoint.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/credentials.md +12 -3
- package/docs/provider-runtime-capabilities.md +12 -1
- package/docs/run-config.md +2 -2
- package/package.json +2 -2
|
@@ -7,27 +7,116 @@ import type { RunProvider } from "./submission.js";
|
|
|
7
7
|
* first so SDK types, CLI validation, docs examples, and platform parsing move
|
|
8
8
|
* together.
|
|
9
9
|
*/
|
|
10
|
-
export declare const RUN_MODELS: readonly ["claude-haiku-4-5", "claude-3-5-haiku-latest", "claude-3-5-sonnet-latest", "deepseek-chat", "gpt-4.1", "gpt-4o-mini", "gemini-2.0-flash", "gemini-2.5-flash", "mistral-large-latest", "mistral-small-latest"];
|
|
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", "google/gemini-2.0-flash-001"];
|
|
11
11
|
export type RunModel = (typeof RUN_MODELS)[number];
|
|
12
|
+
/**
|
|
13
|
+
* Symbol-style accessors for the closed model set. Prefer these over raw
|
|
14
|
+
* 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.
|
|
18
|
+
*/
|
|
19
|
+
export declare const Models: {
|
|
20
|
+
/** Claude Haiku 4.5 — Anthropic. */
|
|
21
|
+
readonly CLAUDE_HAIKU_4_5: "claude-haiku-4-5";
|
|
22
|
+
/** Claude 3.5 Haiku (latest) — Anthropic. */
|
|
23
|
+
readonly CLAUDE_3_5_HAIKU_LATEST: "claude-3-5-haiku-latest";
|
|
24
|
+
/** Claude 3.5 Sonnet (latest) — Anthropic. */
|
|
25
|
+
readonly CLAUDE_3_5_SONNET_LATEST: "claude-3-5-sonnet-latest";
|
|
26
|
+
/** DeepSeek V4 Flash — DeepSeek (non-thinking, fast). */
|
|
27
|
+
readonly DEEPSEEK_V4_FLASH: "deepseek-v4-flash";
|
|
28
|
+
/** DeepSeek V4 Pro — DeepSeek (reasoning-heavy). */
|
|
29
|
+
readonly DEEPSEEK_V4_PRO: "deepseek-v4-pro";
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Legacy alias DeepSeek routes to `deepseek-v4-flash` (non-thinking).
|
|
32
|
+
* DeepSeek removes this name on 2026-07-24 15:59 UTC — migrate to
|
|
33
|
+
* {@link Models.DEEPSEEK_V4_FLASH}.
|
|
34
|
+
*/
|
|
35
|
+
readonly DEEPSEEK_CHAT: "deepseek-chat";
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Legacy alias DeepSeek routes to `deepseek-v4-flash` (thinking).
|
|
38
|
+
* DeepSeek removes this name on 2026-07-24 15:59 UTC — migrate to
|
|
39
|
+
* {@link Models.DEEPSEEK_V4_FLASH} (or {@link Models.DEEPSEEK_V4_PRO} for
|
|
40
|
+
* heavier reasoning).
|
|
41
|
+
*/
|
|
42
|
+
readonly DEEPSEEK_REASONER: "deepseek-reasoner";
|
|
43
|
+
/** GPT-4.1 — OpenAI. */
|
|
44
|
+
readonly GPT_4_1: "gpt-4.1";
|
|
45
|
+
/** GPT-4o mini — OpenAI. */
|
|
46
|
+
readonly GPT_4O_MINI: "gpt-4o-mini";
|
|
47
|
+
/** Gemini 2.0 Flash — Gemini. */
|
|
48
|
+
readonly GEMINI_2_0_FLASH: "gemini-2.0-flash";
|
|
49
|
+
/** Gemini 2.5 Flash — Gemini. */
|
|
50
|
+
readonly GEMINI_2_5_FLASH: "gemini-2.5-flash";
|
|
51
|
+
/** Mistral Large (latest) — Mistral. */
|
|
52
|
+
readonly MISTRAL_LARGE_LATEST: "mistral-large-latest";
|
|
53
|
+
/** Mistral Small (latest) — Mistral. */
|
|
54
|
+
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
|
+
/** Gemini 2.0 Flash via OpenRouter (provider-prefixed) — cheap, tool-obedient. */
|
|
58
|
+
readonly OPENROUTER_GEMINI_2_0_FLASH: "google/gemini-2.0-flash-001";
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Back-compat alias for {@link Models}. Existing imports of `RunModels`
|
|
62
|
+
* keep working; new code should prefer `Models`.
|
|
63
|
+
*/
|
|
12
64
|
export declare const RunModels: {
|
|
65
|
+
/** Claude Haiku 4.5 — Anthropic. */
|
|
13
66
|
readonly CLAUDE_HAIKU_4_5: "claude-haiku-4-5";
|
|
67
|
+
/** Claude 3.5 Haiku (latest) — Anthropic. */
|
|
14
68
|
readonly CLAUDE_3_5_HAIKU_LATEST: "claude-3-5-haiku-latest";
|
|
69
|
+
/** Claude 3.5 Sonnet (latest) — Anthropic. */
|
|
15
70
|
readonly CLAUDE_3_5_SONNET_LATEST: "claude-3-5-sonnet-latest";
|
|
71
|
+
/** DeepSeek V4 Flash — DeepSeek (non-thinking, fast). */
|
|
72
|
+
readonly DEEPSEEK_V4_FLASH: "deepseek-v4-flash";
|
|
73
|
+
/** DeepSeek V4 Pro — DeepSeek (reasoning-heavy). */
|
|
74
|
+
readonly DEEPSEEK_V4_PRO: "deepseek-v4-pro";
|
|
75
|
+
/**
|
|
76
|
+
* @deprecated Legacy alias DeepSeek routes to `deepseek-v4-flash` (non-thinking).
|
|
77
|
+
* DeepSeek removes this name on 2026-07-24 15:59 UTC — migrate to
|
|
78
|
+
* {@link Models.DEEPSEEK_V4_FLASH}.
|
|
79
|
+
*/
|
|
16
80
|
readonly DEEPSEEK_CHAT: "deepseek-chat";
|
|
81
|
+
/**
|
|
82
|
+
* @deprecated Legacy alias DeepSeek routes to `deepseek-v4-flash` (thinking).
|
|
83
|
+
* DeepSeek removes this name on 2026-07-24 15:59 UTC — migrate to
|
|
84
|
+
* {@link Models.DEEPSEEK_V4_FLASH} (or {@link Models.DEEPSEEK_V4_PRO} for
|
|
85
|
+
* heavier reasoning).
|
|
86
|
+
*/
|
|
87
|
+
readonly DEEPSEEK_REASONER: "deepseek-reasoner";
|
|
88
|
+
/** GPT-4.1 — OpenAI. */
|
|
17
89
|
readonly GPT_4_1: "gpt-4.1";
|
|
90
|
+
/** GPT-4o mini — OpenAI. */
|
|
18
91
|
readonly GPT_4O_MINI: "gpt-4o-mini";
|
|
92
|
+
/** Gemini 2.0 Flash — Gemini. */
|
|
19
93
|
readonly GEMINI_2_0_FLASH: "gemini-2.0-flash";
|
|
94
|
+
/** Gemini 2.5 Flash — Gemini. */
|
|
20
95
|
readonly GEMINI_2_5_FLASH: "gemini-2.5-flash";
|
|
96
|
+
/** Mistral Large (latest) — Mistral. */
|
|
21
97
|
readonly MISTRAL_LARGE_LATEST: "mistral-large-latest";
|
|
98
|
+
/** Mistral Small (latest) — Mistral. */
|
|
22
99
|
readonly MISTRAL_SMALL_LATEST: "mistral-small-latest";
|
|
100
|
+
/** GPT-4o mini via OpenRouter (provider-prefixed) — cheap, tool-obedient. */
|
|
101
|
+
readonly OPENROUTER_GPT_4O_MINI: "openai/gpt-4o-mini";
|
|
102
|
+
/** Gemini 2.0 Flash via OpenRouter (provider-prefixed) — cheap, tool-obedient. */
|
|
103
|
+
readonly OPENROUTER_GEMINI_2_0_FLASH: "google/gemini-2.0-flash-001";
|
|
23
104
|
};
|
|
24
105
|
export declare const RUN_MODELS_BY_PROVIDER: {
|
|
25
106
|
readonly anthropic: readonly ["claude-haiku-4-5", "claude-3-5-haiku-latest", "claude-3-5-sonnet-latest"];
|
|
26
|
-
readonly deepseek: readonly ["deepseek-chat"];
|
|
107
|
+
readonly deepseek: readonly ["deepseek-v4-flash", "deepseek-v4-pro", "deepseek-chat", "deepseek-reasoner"];
|
|
27
108
|
readonly openai: readonly ["gpt-4.1", "gpt-4o-mini"];
|
|
28
109
|
readonly gemini: readonly ["gemini-2.0-flash", "gemini-2.5-flash"];
|
|
29
110
|
readonly mistral: readonly ["mistral-large-latest", "mistral-small-latest"];
|
|
111
|
+
readonly openrouter: readonly ["openai/gpt-4o-mini", "google/gemini-2.0-flash-001"];
|
|
30
112
|
};
|
|
113
|
+
/**
|
|
114
|
+
* Resolve the upstream provider for a model id. Returns `undefined` when the
|
|
115
|
+
* input is not a known {@link RunModel} (so the SDK can fall back to the
|
|
116
|
+
* default and let the server reject the model). Total over the closed model
|
|
117
|
+
* set, so any `RunModel` resolves.
|
|
118
|
+
*/
|
|
119
|
+
export declare function providerForModel(model: string): RunProvider | undefined;
|
|
31
120
|
export declare function isRunModel(input: unknown): input is RunModel;
|
|
32
121
|
export declare function parseRunModel(input: unknown, field?: string): RunModel;
|
|
33
122
|
export declare function assertRunModelMatchesProvider(provider: RunProvider, model: RunModel, field?: string): void;
|
|
@@ -10,37 +10,112 @@ export const RUN_MODELS = [
|
|
|
10
10
|
"claude-haiku-4-5",
|
|
11
11
|
"claude-3-5-haiku-latest",
|
|
12
12
|
"claude-3-5-sonnet-latest",
|
|
13
|
+
"deepseek-v4-flash",
|
|
14
|
+
"deepseek-v4-pro",
|
|
13
15
|
"deepseek-chat",
|
|
16
|
+
"deepseek-reasoner",
|
|
14
17
|
"gpt-4.1",
|
|
15
18
|
"gpt-4o-mini",
|
|
16
19
|
"gemini-2.0-flash",
|
|
17
20
|
"gemini-2.5-flash",
|
|
18
21
|
"mistral-large-latest",
|
|
19
|
-
"mistral-small-latest"
|
|
22
|
+
"mistral-small-latest",
|
|
23
|
+
"openai/gpt-4o-mini",
|
|
24
|
+
"google/gemini-2.0-flash-001"
|
|
20
25
|
];
|
|
21
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Symbol-style accessors for the closed model set. Prefer these over raw
|
|
28
|
+
* strings so an invalid token is a compile error, not a runtime 400 — e.g.
|
|
29
|
+
* `Models.CLAUDE_HAIKU_4_5`. The upstream provider is a pure function of the
|
|
30
|
+
* model ({@link providerForModel}), so picking a model fully determines
|
|
31
|
+
* routing; callers never pass `provider` separately.
|
|
32
|
+
*/
|
|
33
|
+
export const Models = {
|
|
34
|
+
/** Claude Haiku 4.5 — Anthropic. */
|
|
22
35
|
CLAUDE_HAIKU_4_5: "claude-haiku-4-5",
|
|
36
|
+
/** Claude 3.5 Haiku (latest) — Anthropic. */
|
|
23
37
|
CLAUDE_3_5_HAIKU_LATEST: "claude-3-5-haiku-latest",
|
|
38
|
+
/** Claude 3.5 Sonnet (latest) — Anthropic. */
|
|
24
39
|
CLAUDE_3_5_SONNET_LATEST: "claude-3-5-sonnet-latest",
|
|
40
|
+
/** DeepSeek V4 Flash — DeepSeek (non-thinking, fast). */
|
|
41
|
+
DEEPSEEK_V4_FLASH: "deepseek-v4-flash",
|
|
42
|
+
/** DeepSeek V4 Pro — DeepSeek (reasoning-heavy). */
|
|
43
|
+
DEEPSEEK_V4_PRO: "deepseek-v4-pro",
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Legacy alias DeepSeek routes to `deepseek-v4-flash` (non-thinking).
|
|
46
|
+
* DeepSeek removes this name on 2026-07-24 15:59 UTC — migrate to
|
|
47
|
+
* {@link Models.DEEPSEEK_V4_FLASH}.
|
|
48
|
+
*/
|
|
25
49
|
DEEPSEEK_CHAT: "deepseek-chat",
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated Legacy alias DeepSeek routes to `deepseek-v4-flash` (thinking).
|
|
52
|
+
* DeepSeek removes this name on 2026-07-24 15:59 UTC — migrate to
|
|
53
|
+
* {@link Models.DEEPSEEK_V4_FLASH} (or {@link Models.DEEPSEEK_V4_PRO} for
|
|
54
|
+
* heavier reasoning).
|
|
55
|
+
*/
|
|
56
|
+
DEEPSEEK_REASONER: "deepseek-reasoner",
|
|
57
|
+
/** GPT-4.1 — OpenAI. */
|
|
26
58
|
GPT_4_1: "gpt-4.1",
|
|
59
|
+
/** GPT-4o mini — OpenAI. */
|
|
27
60
|
GPT_4O_MINI: "gpt-4o-mini",
|
|
61
|
+
/** Gemini 2.0 Flash — Gemini. */
|
|
28
62
|
GEMINI_2_0_FLASH: "gemini-2.0-flash",
|
|
63
|
+
/** Gemini 2.5 Flash — Gemini. */
|
|
29
64
|
GEMINI_2_5_FLASH: "gemini-2.5-flash",
|
|
65
|
+
/** Mistral Large (latest) — Mistral. */
|
|
30
66
|
MISTRAL_LARGE_LATEST: "mistral-large-latest",
|
|
31
|
-
|
|
67
|
+
/** Mistral Small (latest) — Mistral. */
|
|
68
|
+
MISTRAL_SMALL_LATEST: "mistral-small-latest",
|
|
69
|
+
/** GPT-4o mini via OpenRouter (provider-prefixed) — cheap, tool-obedient. */
|
|
70
|
+
OPENROUTER_GPT_4O_MINI: "openai/gpt-4o-mini",
|
|
71
|
+
/** Gemini 2.0 Flash via OpenRouter (provider-prefixed) — cheap, tool-obedient. */
|
|
72
|
+
OPENROUTER_GEMINI_2_0_FLASH: "google/gemini-2.0-flash-001"
|
|
32
73
|
};
|
|
74
|
+
/**
|
|
75
|
+
* Back-compat alias for {@link Models}. Existing imports of `RunModels`
|
|
76
|
+
* keep working; new code should prefer `Models`.
|
|
77
|
+
*/
|
|
78
|
+
export const RunModels = Models;
|
|
33
79
|
export const RUN_MODELS_BY_PROVIDER = {
|
|
34
80
|
anthropic: [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
81
|
+
Models.CLAUDE_HAIKU_4_5,
|
|
82
|
+
Models.CLAUDE_3_5_HAIKU_LATEST,
|
|
83
|
+
Models.CLAUDE_3_5_SONNET_LATEST
|
|
84
|
+
],
|
|
85
|
+
deepseek: [
|
|
86
|
+
Models.DEEPSEEK_V4_FLASH,
|
|
87
|
+
Models.DEEPSEEK_V4_PRO,
|
|
88
|
+
Models.DEEPSEEK_CHAT,
|
|
89
|
+
Models.DEEPSEEK_REASONER
|
|
38
90
|
],
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
91
|
+
openai: [Models.GPT_4_1, Models.GPT_4O_MINI],
|
|
92
|
+
gemini: [Models.GEMINI_2_0_FLASH, Models.GEMINI_2_5_FLASH],
|
|
93
|
+
mistral: [Models.MISTRAL_LARGE_LATEST, Models.MISTRAL_SMALL_LATEST],
|
|
94
|
+
openrouter: [Models.OPENROUTER_GPT_4O_MINI, Models.OPENROUTER_GEMINI_2_0_FLASH]
|
|
43
95
|
};
|
|
96
|
+
/**
|
|
97
|
+
* Reverse index: every model id → its single upstream provider. Derived from
|
|
98
|
+
* {@link RUN_MODELS_BY_PROVIDER} so the two never drift; each model appears
|
|
99
|
+
* under exactly one provider.
|
|
100
|
+
*/
|
|
101
|
+
const PROVIDER_BY_MODEL = (() => {
|
|
102
|
+
const map = {};
|
|
103
|
+
for (const [provider, models] of Object.entries(RUN_MODELS_BY_PROVIDER)) {
|
|
104
|
+
for (const model of models) {
|
|
105
|
+
map[model] = provider;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return map;
|
|
109
|
+
})();
|
|
110
|
+
/**
|
|
111
|
+
* Resolve the upstream provider for a model id. Returns `undefined` when the
|
|
112
|
+
* input is not a known {@link RunModel} (so the SDK can fall back to the
|
|
113
|
+
* default and let the server reject the model). Total over the closed model
|
|
114
|
+
* set, so any `RunModel` resolves.
|
|
115
|
+
*/
|
|
116
|
+
export function providerForModel(model) {
|
|
117
|
+
return PROVIDER_BY_MODEL[model];
|
|
118
|
+
}
|
|
44
119
|
export function isRunModel(input) {
|
|
45
120
|
return typeof input === "string" && RUN_MODELS.includes(input);
|
|
46
121
|
}
|
|
@@ -222,5 +222,39 @@ export declare const PROVIDER_PUBLIC_SUPPORT: {
|
|
|
222
222
|
}];
|
|
223
223
|
};
|
|
224
224
|
};
|
|
225
|
+
readonly openrouter: {
|
|
226
|
+
readonly displayName: "OpenRouter";
|
|
227
|
+
readonly status: "live-unverified";
|
|
228
|
+
readonly docsAnchor: "openrouter";
|
|
229
|
+
readonly docs: readonly [{
|
|
230
|
+
readonly label: "Credentials";
|
|
231
|
+
readonly href: "credentials.md";
|
|
232
|
+
}, {
|
|
233
|
+
readonly label: "Events";
|
|
234
|
+
readonly href: "events.md";
|
|
235
|
+
}];
|
|
236
|
+
readonly evidence: readonly [{
|
|
237
|
+
readonly label: "Submission parser and routing parity";
|
|
238
|
+
readonly href: "../../contracts/test/submission.test.ts";
|
|
239
|
+
}, {
|
|
240
|
+
readonly label: "Runtime support validator";
|
|
241
|
+
readonly href: "../../contracts/test/runtime-support.test.ts";
|
|
242
|
+
}, {
|
|
243
|
+
readonly label: "Generated matrix freshness";
|
|
244
|
+
readonly href: "../../../scripts/validate/capability-matrix.test.ts";
|
|
245
|
+
}];
|
|
246
|
+
readonly runtimeEvidence: {
|
|
247
|
+
readonly managed: readonly [{
|
|
248
|
+
readonly label: "Submission parser and routing parity";
|
|
249
|
+
readonly href: "../../contracts/test/submission.test.ts";
|
|
250
|
+
}, {
|
|
251
|
+
readonly label: "Runtime support validator";
|
|
252
|
+
readonly href: "../../contracts/test/runtime-support.test.ts";
|
|
253
|
+
}, {
|
|
254
|
+
readonly label: "Generated matrix freshness";
|
|
255
|
+
readonly href: "../../../scripts/validate/capability-matrix.test.ts";
|
|
256
|
+
}];
|
|
257
|
+
};
|
|
258
|
+
};
|
|
225
259
|
};
|
|
226
260
|
export declare function providerPublicSupport(provider: RunProvider): ProviderPublicSupport;
|
|
@@ -99,6 +99,16 @@ export const PROVIDER_PUBLIC_SUPPORT = {
|
|
|
99
99
|
runtimeEvidence: {
|
|
100
100
|
managed: COMMON_EVIDENCE
|
|
101
101
|
}
|
|
102
|
+
},
|
|
103
|
+
openrouter: {
|
|
104
|
+
displayName: "OpenRouter",
|
|
105
|
+
status: "live-unverified",
|
|
106
|
+
docsAnchor: "openrouter",
|
|
107
|
+
docs: COMMON_DOCS,
|
|
108
|
+
evidence: COMMON_EVIDENCE,
|
|
109
|
+
runtimeEvidence: {
|
|
110
|
+
managed: COMMON_EVIDENCE
|
|
111
|
+
}
|
|
102
112
|
}
|
|
103
113
|
};
|
|
104
114
|
export function providerPublicSupport(provider) {
|
|
@@ -65,6 +65,21 @@ export declare const PROXY_ALLOWED_METHODS: readonly ["GET", "POST", "PUT", "PAT
|
|
|
65
65
|
export type ProxyMethod = (typeof PROXY_ALLOWED_METHODS)[number];
|
|
66
66
|
export declare const PROXY_RESPONSE_MODES: readonly ["status_only", "headers_only", "full"];
|
|
67
67
|
export type ProxyResponseMode = (typeof PROXY_RESPONSE_MODES)[number];
|
|
68
|
+
export declare const PROXY_RETRY_JITTERS: readonly ["full", "none"];
|
|
69
|
+
export type ProxyRetryJitter = (typeof PROXY_RETRY_JITTERS)[number];
|
|
70
|
+
export interface ProxyRetryPolicy {
|
|
71
|
+
/** Total attempts, including the initial request. */
|
|
72
|
+
readonly maxAttempts?: number;
|
|
73
|
+
readonly initialDelayMs?: number;
|
|
74
|
+
readonly maxDelayMs?: number;
|
|
75
|
+
readonly jitter?: ProxyRetryJitter;
|
|
76
|
+
readonly retryOnStatuses?: readonly number[];
|
|
77
|
+
readonly retryOnMethods?: readonly ProxyMethod[];
|
|
78
|
+
readonly respectRetryAfter?: boolean;
|
|
79
|
+
}
|
|
80
|
+
export type ResolvedProxyRetryPolicy = Required<ProxyRetryPolicy>;
|
|
81
|
+
export declare const PROXY_RETRY_POLICY_DEFAULTS: ResolvedProxyRetryPolicy;
|
|
82
|
+
export declare function resolveProxyRetryPolicy(policy: ProxyRetryPolicy): ResolvedProxyRetryPolicy;
|
|
68
83
|
/**
|
|
69
84
|
* Returns the narrower of the two response modes (lower width wins).
|
|
70
85
|
* Pure function so the CLI and BFF can both call it without import cycles.
|
|
@@ -106,6 +121,7 @@ export interface ProxyIndexEntry {
|
|
|
106
121
|
readonly maxRequestBytes: number;
|
|
107
122
|
readonly maxResponseBytes: number;
|
|
108
123
|
readonly timeoutMs: number;
|
|
124
|
+
readonly retry?: ResolvedProxyRetryPolicy;
|
|
109
125
|
}
|
|
110
126
|
/**
|
|
111
127
|
* Default caps for a proxy endpoint when the submission doesn't specify one.
|
|
@@ -143,6 +159,7 @@ export interface ProxyEndpointPolicy {
|
|
|
143
159
|
readonly maxRequestBytes?: number;
|
|
144
160
|
readonly maxResponseBytes?: number;
|
|
145
161
|
readonly timeoutMs?: number;
|
|
162
|
+
readonly retry?: ProxyRetryPolicy;
|
|
146
163
|
}
|
|
147
164
|
export interface BuildProxyIndexFileInput {
|
|
148
165
|
readonly runId: string;
|
|
@@ -72,6 +72,27 @@ export const PROXY_HEADERS_HEADER = "x-aex-headers";
|
|
|
72
72
|
export const PROXY_RESPONSE_MODE_HEADER = "x-aex-response-mode";
|
|
73
73
|
export const PROXY_ALLOWED_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD"];
|
|
74
74
|
export const PROXY_RESPONSE_MODES = ["status_only", "headers_only", "full"];
|
|
75
|
+
export const PROXY_RETRY_JITTERS = ["full", "none"];
|
|
76
|
+
export const PROXY_RETRY_POLICY_DEFAULTS = {
|
|
77
|
+
maxAttempts: 3,
|
|
78
|
+
initialDelayMs: 250,
|
|
79
|
+
maxDelayMs: 5000,
|
|
80
|
+
jitter: "full",
|
|
81
|
+
retryOnStatuses: [408, 425, 429, 500, 502, 503, 504],
|
|
82
|
+
retryOnMethods: ["GET", "HEAD"],
|
|
83
|
+
respectRetryAfter: true
|
|
84
|
+
};
|
|
85
|
+
export function resolveProxyRetryPolicy(policy) {
|
|
86
|
+
return {
|
|
87
|
+
maxAttempts: policy.maxAttempts ?? PROXY_RETRY_POLICY_DEFAULTS.maxAttempts,
|
|
88
|
+
initialDelayMs: policy.initialDelayMs ?? PROXY_RETRY_POLICY_DEFAULTS.initialDelayMs,
|
|
89
|
+
maxDelayMs: policy.maxDelayMs ?? PROXY_RETRY_POLICY_DEFAULTS.maxDelayMs,
|
|
90
|
+
jitter: policy.jitter ?? PROXY_RETRY_POLICY_DEFAULTS.jitter,
|
|
91
|
+
retryOnStatuses: policy.retryOnStatuses ?? PROXY_RETRY_POLICY_DEFAULTS.retryOnStatuses,
|
|
92
|
+
retryOnMethods: policy.retryOnMethods ?? PROXY_RETRY_POLICY_DEFAULTS.retryOnMethods,
|
|
93
|
+
respectRetryAfter: policy.respectRetryAfter ?? PROXY_RETRY_POLICY_DEFAULTS.respectRetryAfter
|
|
94
|
+
};
|
|
95
|
+
}
|
|
75
96
|
/**
|
|
76
97
|
* Narrowing order: a request may only narrow below the policy ceiling.
|
|
77
98
|
* `status_only` is narrowest, `full` is widest. The BFF computes
|
|
@@ -162,7 +183,8 @@ export function buildProxyIndexFile(input) {
|
|
|
162
183
|
responseMode: e.responseMode ?? PROXY_ENDPOINT_DEFAULTS.responseMode,
|
|
163
184
|
maxRequestBytes: e.maxRequestBytes ?? PROXY_ENDPOINT_DEFAULTS.maxRequestBytes,
|
|
164
185
|
maxResponseBytes: e.maxResponseBytes ?? PROXY_ENDPOINT_DEFAULTS.maxResponseBytes,
|
|
165
|
-
timeoutMs: e.timeoutMs ?? PROXY_ENDPOINT_DEFAULTS.timeoutMs
|
|
186
|
+
timeoutMs: e.timeoutMs ?? PROXY_ENDPOINT_DEFAULTS.timeoutMs,
|
|
187
|
+
...(e.retry !== undefined ? { retry: resolveProxyRetryPolicy(e.retry) } : {})
|
|
166
188
|
}))
|
|
167
189
|
};
|
|
168
190
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PROXY_ENDPOINT_DEFAULTS, type ProxyAuthShape, type ProxyMethod, type ProxyResponseMode } from "./proxy-protocol.js";
|
|
1
|
+
import { PROXY_ENDPOINT_DEFAULTS, type ProxyAuthShape, type ProxyMethod, type ProxyRetryPolicy, type ProxyResponseMode } from "./proxy-protocol.js";
|
|
2
2
|
export { PROXY_ENDPOINT_DEFAULTS };
|
|
3
3
|
import type { AgentsMdRef, FileRef, McpServerRef, SkillRef } from "./run-config.js";
|
|
4
4
|
import { type RuntimeSize } from "./runtime-sizes.js";
|
|
@@ -105,9 +105,35 @@ export declare function packageInstallString(pkg: PlatformPackage): string;
|
|
|
105
105
|
* runtime; provider selection only decides which upstream model route
|
|
106
106
|
* the managed provider-proxy uses.
|
|
107
107
|
*/
|
|
108
|
-
export declare const RUN_PROVIDERS: readonly ["anthropic", "deepseek", "openai", "gemini", "mistral"];
|
|
108
|
+
export declare const RUN_PROVIDERS: readonly ["anthropic", "deepseek", "openai", "gemini", "mistral", "openrouter"];
|
|
109
109
|
export type RunProvider = (typeof RUN_PROVIDERS)[number];
|
|
110
110
|
export declare const DEFAULT_RUN_PROVIDER: RunProvider;
|
|
111
|
+
/**
|
|
112
|
+
* Symbol-style accessors for the closed provider set. Prefer these over raw
|
|
113
|
+
* strings so an invalid token is a compile error, not a runtime 400 — e.g.
|
|
114
|
+
* `Providers.DEEPSEEK`. The same model id can route through different upstream
|
|
115
|
+
* providers (official vs OpenRouter, etc.), so `provider` is a first-class
|
|
116
|
+
* submission field; name it explicitly with one of these constants rather than
|
|
117
|
+
* relying on the model alone to determine routing.
|
|
118
|
+
*
|
|
119
|
+
* Every value mirrors {@link RUN_PROVIDERS} exactly; a unit test asserts
|
|
120
|
+
* `Object.values(Providers)` deep-equals `RUN_PROVIDERS` so the two can never
|
|
121
|
+
* drift.
|
|
122
|
+
*/
|
|
123
|
+
export declare const Providers: {
|
|
124
|
+
/** Anthropic — Claude models. */
|
|
125
|
+
readonly ANTHROPIC: "anthropic";
|
|
126
|
+
/** DeepSeek. */
|
|
127
|
+
readonly DEEPSEEK: "deepseek";
|
|
128
|
+
/** OpenAI — GPT models. */
|
|
129
|
+
readonly OPENAI: "openai";
|
|
130
|
+
/** Google Gemini. */
|
|
131
|
+
readonly GEMINI: "gemini";
|
|
132
|
+
/** Mistral. */
|
|
133
|
+
readonly MISTRAL: "mistral";
|
|
134
|
+
/** OpenRouter — OpenAI-compatible aggregator routing to many upstream models. */
|
|
135
|
+
readonly OPENROUTER: "openrouter";
|
|
136
|
+
};
|
|
111
137
|
/**
|
|
112
138
|
* Customer-facing runtime selector. Optional on the wire; absent resolves
|
|
113
139
|
* to the same managed runtime as `"managed"`. `"native"` is no longer an
|
|
@@ -190,11 +216,13 @@ export interface PlatformProxyEndpoint {
|
|
|
190
216
|
readonly maxRequestBytes?: number;
|
|
191
217
|
readonly maxResponseBytes?: number;
|
|
192
218
|
readonly timeoutMs?: number;
|
|
219
|
+
readonly retry?: ProxyRetryPolicy;
|
|
193
220
|
}
|
|
194
221
|
export declare const SECRETS_KEY = "secrets";
|
|
195
222
|
export declare const PROXY_ENDPOINT_NAME_PATTERN: RegExp;
|
|
196
223
|
export declare const RESERVED_PROXY_ENDPOINT_NAMES: Set<string>;
|
|
197
224
|
export declare const deniedSecretFields: Set<string>;
|
|
225
|
+
export declare function parseProxyRetryPolicy(input: unknown, field: string): ProxyRetryPolicy | undefined;
|
|
198
226
|
export declare function parseProxyAuthShape(input: unknown, field: string): ProxyAuthShape;
|
|
199
227
|
export declare function parseProxyMethods(input: unknown, field: string): readonly ProxyMethod[];
|
|
200
228
|
export declare function parseProxyPathPrefixes(input: unknown, field: string): readonly string[];
|
|
@@ -246,23 +274,22 @@ export interface PlatformSubmission {
|
|
|
246
274
|
readonly outputs?: PlatformOutputCaptureConfig;
|
|
247
275
|
/**
|
|
248
276
|
* Optional override for the managed-runtime builtin extensions enabled
|
|
249
|
-
* inside the runner container. Each entry is
|
|
250
|
-
*
|
|
251
|
-
* default is `["developer"]` which gives the agent
|
|
252
|
-
* edit + tree tools (bash, grep via shell, file read via
|
|
253
|
-
* editor, file edit). To opt in to more tools (e.g. web
|
|
254
|
-
* the `computercontroller` extension), pass the full list. To opt
|
|
255
|
-
*
|
|
277
|
+
* inside the runner container. Each entry is one of the closed
|
|
278
|
+
* {@link BUILTINS} set (prefer the {@link Builtins} symbol
|
|
279
|
+
* const). The platform default is `["developer"]` which gives the agent
|
|
280
|
+
* shell + write + edit + tree tools (bash, grep via shell, file read via
|
|
281
|
+
* shell or editor, file edit). To opt in to more tools (e.g. web fetch via
|
|
282
|
+
* the `computercontroller` extension), pass the full list. To opt out of
|
|
283
|
+
* all builtins (pure-MCP setup), pass an empty array.
|
|
256
284
|
*
|
|
257
285
|
* Validation:
|
|
258
|
-
* - Each entry
|
|
259
|
-
* builtin naming convention).
|
|
286
|
+
* - Each entry must be a member of {@link BUILTINS}.
|
|
260
287
|
* - Max 16 entries.
|
|
261
288
|
* - Deduplicated.
|
|
262
289
|
*
|
|
263
290
|
* The dispatcher accepts and persists it for snapshot fidelity.
|
|
264
291
|
*/
|
|
265
|
-
readonly builtins?: readonly
|
|
292
|
+
readonly builtins?: readonly Builtin[];
|
|
266
293
|
/**
|
|
267
294
|
* Assistant-output granularity. `buffered` (the default) emits one event per
|
|
268
295
|
* assistant message; `stream` emits the agent's per-token text deltas as they
|
|
@@ -396,6 +423,31 @@ export declare function parseSubmission(input: unknown): PlatformSubmission;
|
|
|
396
423
|
export declare const OUTPUT_MODES: readonly ["buffered", "stream"];
|
|
397
424
|
export type OutputMode = (typeof OUTPUT_MODES)[number];
|
|
398
425
|
export declare const DEFAULT_OUTPUT_MODE: OutputMode;
|
|
426
|
+
/**
|
|
427
|
+
* Managed-runtime builtin extensions — the closed set the managed runtime
|
|
428
|
+
* accepts. Closed so an invalid name is a compile error via {@link Builtins},
|
|
429
|
+
* not a silent runtime no-op. `developer` is the platform default when
|
|
430
|
+
* `builtins` is omitted; pass an empty array to disable all builtins
|
|
431
|
+
* (pure-MCP setup).
|
|
432
|
+
*/
|
|
433
|
+
export declare const BUILTINS: readonly ["developer", "computercontroller", "memory", "autovisualiser", "tutorial"];
|
|
434
|
+
export type Builtin = (typeof BUILTINS)[number];
|
|
435
|
+
/**
|
|
436
|
+
* Symbol-style accessors for the closed builtin set, e.g.
|
|
437
|
+
* `Builtins.COMPUTER_CONTROLLER`.
|
|
438
|
+
*/
|
|
439
|
+
export declare const Builtins: {
|
|
440
|
+
/** Shell (bash + UNIX tools incl. grep), write, edit, tree. The default. */
|
|
441
|
+
readonly DEVELOPER: "developer";
|
|
442
|
+
/** Web fetch/scrape, scripting, general computer-control tools. */
|
|
443
|
+
readonly COMPUTER_CONTROLLER: "computercontroller";
|
|
444
|
+
/** Cross-session preference memory. */
|
|
445
|
+
readonly MEMORY: "memory";
|
|
446
|
+
/** Inline data-visualisation rendering. */
|
|
447
|
+
readonly AUTOVISUALISER: "autovisualiser";
|
|
448
|
+
/** Interactive guided tutorials. */
|
|
449
|
+
readonly TUTORIAL: "tutorial";
|
|
450
|
+
};
|
|
399
451
|
/**
|
|
400
452
|
* Codes emitted when a submission contains features the active runtime cannot
|
|
401
453
|
* serve. Code values are stable so dashboard / SDK error rendering can branch
|