@hasna/switcher 0.2.6 → 0.2.8
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/README.md +148 -8
- package/dist/antigravity-config.d.ts +7 -0
- package/dist/bedrock.d.ts +2 -0
- package/dist/chatgpt-launch.d.ts +2 -1
- package/dist/cli/index.js +1665 -267
- package/dist/codex-session-discovery.d.ts +24 -0
- package/dist/codex-state-bridge.d.ts +14 -0
- package/dist/codex-state-bridge.js +568 -0
- package/dist/domain.d.ts +18 -8
- package/dist/generated/api.d.ts +17 -5
- package/dist/harness-arguments.d.ts +8 -0
- package/dist/harness-types.d.ts +2 -0
- package/dist/harnesses.d.ts +2 -2
- package/dist/index.js +23 -4
- package/dist/junie-config.d.ts +8 -0
- package/dist/launcher.d.ts +4 -1
- package/dist/mcp/index.js +88 -11
- package/dist/model-policy-schema.d.ts +3 -0
- package/dist/model-policy.d.ts +1 -0
- package/dist/native-cli-settings.d.ts +6 -0
- package/dist/native-model-policy.d.ts +1 -1
- package/dist/native-state-import.d.ts +44 -0
- package/dist/native-state.d.ts +32 -0
- package/dist/sdk.d.ts +18 -9
- package/dist/sdk.js +23 -4
- package/dist/serve/index.js +78 -7
- package/docs/MODEL-POLICY.md +6 -2
- package/openapi.json +53 -1
- package/package.json +1 -1
package/dist/mcp/index.js
CHANGED
|
@@ -35,6 +35,7 @@ var fallbacksSchema = z2.record(policyModelIdSchema, z2.array(policyModelIdSchem
|
|
|
35
35
|
});
|
|
36
36
|
var modelPolicySchema = z2.object({
|
|
37
37
|
version: z2.literal(1).default(1),
|
|
38
|
+
selection: z2.enum(["restricted", "catalog"]).optional(),
|
|
38
39
|
roles: z2.object({
|
|
39
40
|
subagent: policyModelIdSchema.optional(),
|
|
40
41
|
fast: policyModelIdSchema.optional(),
|
|
@@ -69,8 +70,8 @@ function canonicalPolicyJSON(value) {
|
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
// src/domain.ts
|
|
72
|
-
var VERSION = "0.2.
|
|
73
|
-
var harnessSchema = z3.enum(["claude", "codex", "grok", "opencode", "opencode2", "pi", "omp", "dsh", "cline", "hermes", "prime-agent", "gemini", "aider", "kilo"]);
|
|
73
|
+
var VERSION = "0.2.7";
|
|
74
|
+
var harnessSchema = z3.enum(["claude", "codex", "grok", "opencode", "opencode2", "pi", "omp", "dsh", "cline", "hermes", "prime-agent", "gemini", "antigravity", "junie", "aider", "kilo"]);
|
|
74
75
|
var protocolSchema = z3.enum(["anthropic-messages", "openai-responses", "openai-chat", "gemini-generate-content"]);
|
|
75
76
|
var idSchema = z3.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$/);
|
|
76
77
|
var label = z3.string().min(1).max(200);
|
|
@@ -202,7 +203,7 @@ function compatible(harness, protocol) {
|
|
|
202
203
|
return protocol === "anthropic-messages";
|
|
203
204
|
if (harness === "codex")
|
|
204
205
|
return protocol === "openai-responses";
|
|
205
|
-
if (harness === "gemini")
|
|
206
|
+
if (harness === "gemini" || harness === "antigravity")
|
|
206
207
|
return protocol === "gemini-generate-content";
|
|
207
208
|
if (protocol === "gemini-generate-content")
|
|
208
209
|
return false;
|
|
@@ -211,7 +212,7 @@ function compatible(harness, protocol) {
|
|
|
211
212
|
function validateHarnessProvider(harness, provider) {
|
|
212
213
|
if (!compatible(harness, provider.protocol))
|
|
213
214
|
throw new Fault(422, "protocol_mismatch", "Harness does not support this provider protocol.");
|
|
214
|
-
if (harness === "gemini" && provider.authStyle !== "x-api-key")
|
|
215
|
+
if ((harness === "gemini" || harness === "antigravity") && provider.authStyle !== "x-api-key")
|
|
215
216
|
throw new Fault(422, "auth_mismatch", "Gemini CLI requires x-api-key authentication for its native generateContent protocol.");
|
|
216
217
|
}
|
|
217
218
|
function modelExpired(model, now = new Date) {
|
|
@@ -261,6 +262,19 @@ async function boundedJson(response, maxBytes = MAX_BYTES) {
|
|
|
261
262
|
// src/sdk.ts
|
|
262
263
|
import { createClientTransport } from "@hasna/contracts/client";
|
|
263
264
|
|
|
265
|
+
// src/bedrock.ts
|
|
266
|
+
function bedrockMantleOrigin(value) {
|
|
267
|
+
let url;
|
|
268
|
+
try {
|
|
269
|
+
url = new URL(value);
|
|
270
|
+
} catch {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
if (url.protocol !== "https:" || url.port || url.username || url.password || url.search || url.hash || url.pathname.replace(/\/+$/, "") !== "/anthropic/v1")
|
|
274
|
+
return;
|
|
275
|
+
return /^bedrock-mantle\.[a-z]{2}(?:-[a-z]+)+-\d+\.api\.aws$/.test(url.hostname) ? url.origin : undefined;
|
|
276
|
+
}
|
|
277
|
+
|
|
264
278
|
// src/presets.ts
|
|
265
279
|
var route = (protocol, baseUrl, options = {}) => ({
|
|
266
280
|
protocol,
|
|
@@ -293,8 +307,10 @@ var providerPresets = [
|
|
|
293
307
|
], ["https://api-docs.deepseek.com/guides/anthropic_api", "https://api-docs.deepseek.com/api/list-models", "https://api-docs.deepseek.com/updates/", "https://api-docs.deepseek.com/guides/responses_api/"], "DEEPSEEK_API_KEY"),
|
|
294
308
|
preset("openrouter", "OpenRouter", ["openai-chat", "openai-responses", "anthropic-messages"].map((protocol) => route(protocol, "https://openrouter.ai/api/v1", { catalogAuthStyle: "none", credentialCheck: { method: "GET", path: "key" } })), ["https://openrouter.ai/docs/api/api-reference/models/list-all-models-and-their-properties", "https://openrouter.ai/docs/guides/overview"], "OPENROUTER_API_KEY"),
|
|
295
309
|
preset("anthropic", "Anthropic", [route("anthropic-messages", "https://api.anthropic.com/v1", { authStyle: "x-api-key" })], ["https://platform.claude.com/docs/en/api/overview", "https://platform.claude.com/docs/en/api/models/list"], "ANTHROPIC_API_KEY"),
|
|
310
|
+
preset("bedrock", "Amazon Bedrock (Mantle)", [route("anthropic-messages", undefined, { authStyle: "x-api-key", catalogAuthStyle: "bearer", notes: ["Pass the regional https://bedrock-mantle.<region>.api.aws/anthropic/v1 endpoint and a Bedrock API key. The authenticated catalog is /v1/models on that same origin. Model access and regional availability remain controlled by the AWS account; this route does not distribute or inherit AWS administrative credentials."] })], ["https://docs.aws.amazon.com/bedrock/latest/userguide/inference-messages-api.html", "https://docs.aws.amazon.com/bedrock/latest/userguide/api-keys.html"], "AWS_BEARER_TOKEN_BEDROCK"),
|
|
296
311
|
preset("gemini", "Google Gemini", [route("gemini-generate-content", "https://generativelanguage.googleapis.com/v1beta", {
|
|
297
312
|
authStyle: "x-api-key",
|
|
313
|
+
credentialCheck: { method: "GET", path: "models" },
|
|
298
314
|
catalogBaseUrl: "https://generativelanguage.googleapis.com/v1beta",
|
|
299
315
|
catalogFormat: "gemini",
|
|
300
316
|
catalogAuthStyle: "x-api-key",
|
|
@@ -362,7 +378,7 @@ function providerCredential(provider, env = process.env) {
|
|
|
362
378
|
return;
|
|
363
379
|
let value = env[provider.credentialEnv];
|
|
364
380
|
if (!value) {
|
|
365
|
-
const preset2 = providerPresets.find((p) => p.credentialEnv === provider.credentialEnv && p.protocols.some((route2) => route2.protocol === provider.protocol && (route2.baseUrl ? new URL(route2.baseUrl).origin === new URL(provider.baseUrl).origin : p.id === "azure-openai")));
|
|
381
|
+
const preset2 = providerPresets.find((p) => p.credentialEnv === provider.credentialEnv && p.protocols.some((route2) => route2.protocol === provider.protocol && (route2.baseUrl ? new URL(route2.baseUrl).origin === new URL(provider.baseUrl).origin : p.id === "azure-openai" || p.id === "bedrock" && !!bedrockMantleOrigin(provider.baseUrl))));
|
|
366
382
|
value = preset2?.credentialAliases.map((name) => env[name]).find(Boolean);
|
|
367
383
|
}
|
|
368
384
|
if (value && /[\r\n]/.test(value))
|
|
@@ -976,6 +992,8 @@ async function discoverBase(provider, env = process.env, resolveCredential) {
|
|
|
976
992
|
reasoningEfforts: row.reasoning?.supported_efforts,
|
|
977
993
|
...provider.catalogFormat === "gemini" && row.supportedGenerationMethods !== undefined ? { supportedGenerationMethods: row.supportedGenerationMethods } : {}
|
|
978
994
|
};
|
|
995
|
+
if (provider.protocol === "anthropic-messages" && bedrockMantleOrigin(provider.baseUrl) && !id.startsWith("anthropic."))
|
|
996
|
+
candidate.available = false;
|
|
979
997
|
if (provider.catalogFormat === "mistral") {
|
|
980
998
|
const capabilities = row.capabilities;
|
|
981
999
|
if (typeof capabilities?.function_calling === "boolean")
|
|
@@ -1141,6 +1159,7 @@ function compileModelPolicy(model, catalog, policy) {
|
|
|
1141
1159
|
throw new Fault(400, "invalid_model_policy", "Model policy allowedModels is too large.");
|
|
1142
1160
|
for (const value of explicitAllowed)
|
|
1143
1161
|
requireAvailable(value, "An allowed model is not present in the eligible catalog.");
|
|
1162
|
+
const catalogAllowed = p.selection === "catalog" ? [...available] : [];
|
|
1144
1163
|
const aliases = Object.create(null);
|
|
1145
1164
|
for (const [name, target] of Object.entries(p.aliases ?? {})) {
|
|
1146
1165
|
if (Object.keys(aliases).length >= 200 || !/^[A-Za-z0-9._/-]{1,120}$/.test(name) || ["__proto__", "prototype", "constructor"].includes(name))
|
|
@@ -1152,7 +1171,7 @@ function compileModelPolicy(model, catalog, policy) {
|
|
|
1152
1171
|
aliases[name] = canonical;
|
|
1153
1172
|
}
|
|
1154
1173
|
const fallbacks = Object.create(null);
|
|
1155
|
-
const allowedSources = new Set([selected, ...Object.values(compiledRoles), ...explicitAllowed]);
|
|
1174
|
+
const allowedSources = new Set([selected, ...Object.values(compiledRoles), ...explicitAllowed, ...catalogAllowed]);
|
|
1156
1175
|
for (const [source, targets] of Object.entries(p.fallbacks ?? {})) {
|
|
1157
1176
|
if (!allowedSources.has(source) || !available.has(source) || !Array.isArray(targets) || Object.keys(fallbacks).length >= 200 || targets.length > 20)
|
|
1158
1177
|
throw new Fault(400, "invalid_model_policy", "Fallback source or list is invalid.");
|
|
@@ -1163,7 +1182,7 @@ function compileModelPolicy(model, catalog, policy) {
|
|
|
1163
1182
|
throw new Fault(400, "invalid_model_policy", "A model cannot fall back to itself.");
|
|
1164
1183
|
fallbacks[source] = uniq(values);
|
|
1165
1184
|
}
|
|
1166
|
-
const allowedModels = uniq([selected, ...Object.values(compiledRoles), ...explicitAllowed, ...Object.values(fallbacks).flat()]).sort();
|
|
1185
|
+
const allowedModels = uniq([selected, ...Object.values(compiledRoles), ...explicitAllowed, ...catalogAllowed, ...Object.values(fallbacks).flat()]).sort();
|
|
1167
1186
|
if (Object.values(aliases).some((value) => !allowedModels.includes(value)))
|
|
1168
1187
|
throw new Fault(422, "model_not_allowed", "A model alias target must be explicitly allowed by the launch policy.");
|
|
1169
1188
|
const result = { version: 1, model: selected, roles: compiledRoles, allowedModels, aliases, fallbacks };
|
|
@@ -1174,7 +1193,7 @@ var openapi_default = {
|
|
|
1174
1193
|
openapi: "3.0.3",
|
|
1175
1194
|
info: {
|
|
1176
1195
|
title: "Switcher API",
|
|
1177
|
-
version: "0.2.
|
|
1196
|
+
version: "0.2.7",
|
|
1178
1197
|
description: "Authenticated provider/profile/catalog control plane. Launches run locally; the API never returns provider credentials."
|
|
1179
1198
|
},
|
|
1180
1199
|
security: [
|
|
@@ -3247,6 +3266,8 @@ var openapi_default = {
|
|
|
3247
3266
|
"hermes",
|
|
3248
3267
|
"prime-agent",
|
|
3249
3268
|
"gemini",
|
|
3269
|
+
"antigravity",
|
|
3270
|
+
"junie",
|
|
3250
3271
|
"aider",
|
|
3251
3272
|
"kilo"
|
|
3252
3273
|
]
|
|
@@ -3266,6 +3287,13 @@ var openapi_default = {
|
|
|
3266
3287
|
],
|
|
3267
3288
|
default: 1
|
|
3268
3289
|
},
|
|
3290
|
+
selection: {
|
|
3291
|
+
type: "string",
|
|
3292
|
+
enum: [
|
|
3293
|
+
"restricted",
|
|
3294
|
+
"catalog"
|
|
3295
|
+
]
|
|
3296
|
+
},
|
|
3269
3297
|
roles: {
|
|
3270
3298
|
type: "object",
|
|
3271
3299
|
properties: {
|
|
@@ -3396,6 +3424,8 @@ var openapi_default = {
|
|
|
3396
3424
|
"hermes",
|
|
3397
3425
|
"prime-agent",
|
|
3398
3426
|
"gemini",
|
|
3427
|
+
"antigravity",
|
|
3428
|
+
"junie",
|
|
3399
3429
|
"aider",
|
|
3400
3430
|
"kilo"
|
|
3401
3431
|
]
|
|
@@ -3415,6 +3445,13 @@ var openapi_default = {
|
|
|
3415
3445
|
],
|
|
3416
3446
|
default: 1
|
|
3417
3447
|
},
|
|
3448
|
+
selection: {
|
|
3449
|
+
type: "string",
|
|
3450
|
+
enum: [
|
|
3451
|
+
"restricted",
|
|
3452
|
+
"catalog"
|
|
3453
|
+
]
|
|
3454
|
+
},
|
|
3418
3455
|
roles: {
|
|
3419
3456
|
type: "object",
|
|
3420
3457
|
properties: {
|
|
@@ -3625,6 +3662,13 @@ var openapi_default = {
|
|
|
3625
3662
|
],
|
|
3626
3663
|
default: 1
|
|
3627
3664
|
},
|
|
3665
|
+
selection: {
|
|
3666
|
+
type: "string",
|
|
3667
|
+
enum: [
|
|
3668
|
+
"restricted",
|
|
3669
|
+
"catalog"
|
|
3670
|
+
]
|
|
3671
|
+
},
|
|
3628
3672
|
roles: {
|
|
3629
3673
|
type: "object",
|
|
3630
3674
|
properties: {
|
|
@@ -4394,6 +4438,8 @@ var openapi_default = {
|
|
|
4394
4438
|
"hermes",
|
|
4395
4439
|
"prime-agent",
|
|
4396
4440
|
"gemini",
|
|
4441
|
+
"antigravity",
|
|
4442
|
+
"junie",
|
|
4397
4443
|
"aider",
|
|
4398
4444
|
"kilo"
|
|
4399
4445
|
]
|
|
@@ -4413,6 +4459,13 @@ var openapi_default = {
|
|
|
4413
4459
|
],
|
|
4414
4460
|
default: 1
|
|
4415
4461
|
},
|
|
4462
|
+
selection: {
|
|
4463
|
+
type: "string",
|
|
4464
|
+
enum: [
|
|
4465
|
+
"restricted",
|
|
4466
|
+
"catalog"
|
|
4467
|
+
]
|
|
4468
|
+
},
|
|
4416
4469
|
roles: {
|
|
4417
4470
|
type: "object",
|
|
4418
4471
|
properties: {
|
|
@@ -4686,6 +4739,8 @@ var openapi_default = {
|
|
|
4686
4739
|
"hermes",
|
|
4687
4740
|
"prime-agent",
|
|
4688
4741
|
"gemini",
|
|
4742
|
+
"antigravity",
|
|
4743
|
+
"junie",
|
|
4689
4744
|
"aider",
|
|
4690
4745
|
"kilo"
|
|
4691
4746
|
]
|
|
@@ -4705,6 +4760,13 @@ var openapi_default = {
|
|
|
4705
4760
|
],
|
|
4706
4761
|
default: 1
|
|
4707
4762
|
},
|
|
4763
|
+
selection: {
|
|
4764
|
+
type: "string",
|
|
4765
|
+
enum: [
|
|
4766
|
+
"restricted",
|
|
4767
|
+
"catalog"
|
|
4768
|
+
]
|
|
4769
|
+
},
|
|
4708
4770
|
roles: {
|
|
4709
4771
|
type: "object",
|
|
4710
4772
|
properties: {
|
|
@@ -4951,6 +5013,8 @@ var openapi_default = {
|
|
|
4951
5013
|
"hermes",
|
|
4952
5014
|
"prime-agent",
|
|
4953
5015
|
"gemini",
|
|
5016
|
+
"antigravity",
|
|
5017
|
+
"junie",
|
|
4954
5018
|
"aider",
|
|
4955
5019
|
"kilo"
|
|
4956
5020
|
]
|
|
@@ -4970,6 +5034,13 @@ var openapi_default = {
|
|
|
4970
5034
|
],
|
|
4971
5035
|
default: 1
|
|
4972
5036
|
},
|
|
5037
|
+
selection: {
|
|
5038
|
+
type: "string",
|
|
5039
|
+
enum: [
|
|
5040
|
+
"restricted",
|
|
5041
|
+
"catalog"
|
|
5042
|
+
]
|
|
5043
|
+
},
|
|
4973
5044
|
roles: {
|
|
4974
5045
|
type: "object",
|
|
4975
5046
|
properties: {
|
|
@@ -6166,6 +6237,7 @@ import { z as z6 } from "zod";
|
|
|
6166
6237
|
import { createHash as createHash5 } from "crypto";
|
|
6167
6238
|
import { createInterface } from "readline/promises";
|
|
6168
6239
|
var absent = (error) => error instanceof SwitcherError && error.status === 404;
|
|
6240
|
+
var MAX_CREDENTIAL_MATCHES = 256;
|
|
6169
6241
|
var secretMetadataSchema = z6.object({
|
|
6170
6242
|
key: vaultKeySchema,
|
|
6171
6243
|
type: z6.enum(["api_key", "password", "token", "credential", "other"]),
|
|
@@ -6205,7 +6277,7 @@ async function discoverVaultReferences(provider, env = process.env, vaultExecuta
|
|
|
6205
6277
|
const operator2 = await resolveVaultOperatorEnvironment(provisional, env);
|
|
6206
6278
|
const entries = new Map;
|
|
6207
6279
|
for (const query of searchTerms(provider)) {
|
|
6208
|
-
const output = await runVaultCommand(provisional, ["search", query, "--json"], env, {}, {
|
|
6280
|
+
const output = await runVaultCommand(provisional, ["search", query, "--json", "--full", "--limit", String(MAX_CREDENTIAL_MATCHES + 1)], env, {}, {
|
|
6209
6281
|
captureBytes: 256 * 1024,
|
|
6210
6282
|
oversizeCode: "vault_metadata_oversized",
|
|
6211
6283
|
oversizeMessage: "Secrets returned too much credential metadata; narrow the vault naming or bind an exact key explicitly.",
|
|
@@ -6219,12 +6291,14 @@ async function discoverVaultReferences(provider, env = process.env, vaultExecuta
|
|
|
6219
6291
|
} catch {
|
|
6220
6292
|
throw new Fault(422, "vault_metadata_invalid", "Hasna Secrets returned invalid credential metadata JSON.");
|
|
6221
6293
|
}
|
|
6222
|
-
|
|
6294
|
+
if (Array.isArray(parsed) && parsed.length > MAX_CREDENTIAL_MATCHES)
|
|
6295
|
+
throw new Fault(422, "credential_matches_too_many", "More than 256 credential metadata rows matched. Bind an exact vault key explicitly.");
|
|
6296
|
+
const result = secretMetadataSchema.array().max(MAX_CREDENTIAL_MATCHES).safeParse(parsed);
|
|
6223
6297
|
if (!result.success)
|
|
6224
6298
|
throw new Fault(422, "vault_metadata_invalid", "Hasna Secrets returned an unsupported credential metadata shape.");
|
|
6225
6299
|
for (const entry of result.data)
|
|
6226
6300
|
entries.set(entry.key, entry);
|
|
6227
|
-
if (entries.size >
|
|
6301
|
+
if (entries.size > MAX_CREDENTIAL_MATCHES)
|
|
6228
6302
|
throw new Fault(422, "credential_matches_too_many", "More than 256 credential references matched. Bind an exact vault key explicitly.");
|
|
6229
6303
|
}
|
|
6230
6304
|
return [...entries.values()].sort((a, b) => a.key.localeCompare(b.key)).map((entry) => ({ account: operator2.source, key: entry.key, url: operator2.url, executable: vaultExecutable, operator: { kind: "contracts", expectedSource: operator2.source, expectedTier: operator2.tier } }));
|
|
@@ -6271,6 +6345,9 @@ function authenticationProbe(provider) {
|
|
|
6271
6345
|
return { url, method: provider.credentialCheck.method ?? "GET", authStyle: provider.authStyle ?? "bearer" };
|
|
6272
6346
|
}
|
|
6273
6347
|
const base = new URL(provider.baseUrl);
|
|
6348
|
+
const bedrockOrigin = bedrockMantleOrigin(provider.baseUrl);
|
|
6349
|
+
if (provider.protocol === "anthropic-messages" && bedrockOrigin)
|
|
6350
|
+
return { url: new URL("/v1/models", bedrockOrigin), method: "GET", authStyle: "bearer" };
|
|
6274
6351
|
if (provider.credentialEnv === "SWITCHER_PROVIDER_OPENROUTER" && base.origin === "https://openrouter.ai" && base.pathname.replace(/\/+$/, "") === "/api/v1")
|
|
6275
6352
|
return { url: new URL("https://openrouter.ai/api/v1/key"), method: "GET", authStyle: provider.authStyle ?? "bearer" };
|
|
6276
6353
|
return;
|
|
@@ -5,6 +5,7 @@ export declare const modelPolicyRoleSchema: z.ZodEnum<["subagent", "fast", "plan
|
|
|
5
5
|
export type ModelPolicyRole = z.infer<typeof modelPolicyRoleSchema>;
|
|
6
6
|
export declare const modelPolicySchema: z.ZodObject<{
|
|
7
7
|
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
8
|
+
selection: z.ZodOptional<z.ZodEnum<["restricted", "catalog"]>>;
|
|
8
9
|
roles: z.ZodOptional<z.ZodObject<{
|
|
9
10
|
subagent: z.ZodOptional<z.ZodString>;
|
|
10
11
|
fast: z.ZodOptional<z.ZodString>;
|
|
@@ -38,6 +39,7 @@ export declare const modelPolicySchema: z.ZodObject<{
|
|
|
38
39
|
fallbacks: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>, Record<string, string[]>, Record<string, string[]>>>;
|
|
39
40
|
}, "strict", z.ZodTypeAny, {
|
|
40
41
|
version: 1;
|
|
42
|
+
selection?: "restricted" | "catalog" | undefined;
|
|
41
43
|
roles?: {
|
|
42
44
|
subagent?: string | undefined;
|
|
43
45
|
fast?: string | undefined;
|
|
@@ -53,6 +55,7 @@ export declare const modelPolicySchema: z.ZodObject<{
|
|
|
53
55
|
fallbacks?: Record<string, string[]> | undefined;
|
|
54
56
|
}, {
|
|
55
57
|
version?: 1 | undefined;
|
|
58
|
+
selection?: "restricted" | "catalog" | undefined;
|
|
56
59
|
roles?: {
|
|
57
60
|
subagent?: string | undefined;
|
|
58
61
|
fast?: string | undefined;
|
package/dist/model-policy.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare const MODEL_POLICY_VERSION: 1;
|
|
|
3
3
|
export type ModelRole = "subagent" | "fast" | "planning" | "review" | "summary" | "compaction" | "weak" | "editor";
|
|
4
4
|
export type ModelPolicy = {
|
|
5
5
|
version?: 1;
|
|
6
|
+
selection?: "restricted" | "catalog";
|
|
6
7
|
roles?: Partial<Record<ModelRole, string>>;
|
|
7
8
|
allowedModels?: string[];
|
|
8
9
|
aliases?: Record<string, string>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function nativeHome(env: NodeJS.ProcessEnv): string;
|
|
2
|
+
export declare function readNativeSettings(path: string): Promise<Record<string, any>>;
|
|
3
|
+
export declare function rejectNativeRouting(value: unknown, keys: ReadonlySet<string>): void;
|
|
4
|
+
export declare function writeNativeSettings(path: string, value: unknown): Promise<string>;
|
|
5
|
+
export declare function durableNativeDirectory(root: string, target: string, name: string): Promise<void>;
|
|
6
|
+
export declare function readNativeText(path: string): Promise<string | undefined>;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const nativeRoles: readonly ["main", "subagent", "fast", "planning", "review", "summary", "compaction", "weak", "editor"];
|
|
8
8
|
export type NativeRole = typeof nativeRoles[number];
|
|
9
|
-
export type NativePolicyHarness = "claude" | "codex" | "grok" | "opencode" | "opencode2" | "omp" | "hermes" | "aider" | "kilo" | "gemini" | "cline" | "dsh" | "pi" | "prime-agent";
|
|
9
|
+
export type NativePolicyHarness = "claude" | "codex" | "grok" | "opencode" | "opencode2" | "omp" | "hermes" | "aider" | "kilo" | "gemini" | "cline" | "dsh" | "pi" | "prime-agent" | "antigravity" | "junie";
|
|
10
10
|
export type NativeModelPolicyInput = {
|
|
11
11
|
harness: NativePolicyHarness;
|
|
12
12
|
mainModel: string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type NativeState } from "./native-state";
|
|
2
|
+
type Identity = {
|
|
3
|
+
dev: number;
|
|
4
|
+
ino: number;
|
|
5
|
+
size: number;
|
|
6
|
+
mtimeMs: number;
|
|
7
|
+
ctimeMs: number;
|
|
8
|
+
};
|
|
9
|
+
type File = {
|
|
10
|
+
path: string;
|
|
11
|
+
bytes: number;
|
|
12
|
+
sha256: string;
|
|
13
|
+
source: Identity;
|
|
14
|
+
existing: boolean;
|
|
15
|
+
sessionId?: string;
|
|
16
|
+
};
|
|
17
|
+
export type NativeStateImport = {
|
|
18
|
+
state: NativeState;
|
|
19
|
+
source: string;
|
|
20
|
+
entries: string[];
|
|
21
|
+
directories: string[];
|
|
22
|
+
files: File[];
|
|
23
|
+
bytes: number;
|
|
24
|
+
};
|
|
25
|
+
/** Entire import is checked before writes. Account/auth/config/SQLite files
|
|
26
|
+
* cannot be selected, including through links. This is a snapshot, not cutover. */
|
|
27
|
+
export declare function planNativeStateImport(state: NativeState, source: string, selection?: string[]): Promise<NativeStateImport>;
|
|
28
|
+
export declare function nativeStateImportDigest(plan: NativeStateImport): string;
|
|
29
|
+
export declare function nativeStateImportSummary(plan: NativeStateImport, applied: boolean): {
|
|
30
|
+
mode: string;
|
|
31
|
+
tool: import("./native-state").SharedNativeTool;
|
|
32
|
+
entries: string[];
|
|
33
|
+
planDigest: string;
|
|
34
|
+
files: number;
|
|
35
|
+
newFiles: number;
|
|
36
|
+
publishedFiles: number;
|
|
37
|
+
bytes: number;
|
|
38
|
+
originalsPreserved: boolean;
|
|
39
|
+
cutoverComplete: boolean;
|
|
40
|
+
sqliteCopied: boolean;
|
|
41
|
+
notice: string;
|
|
42
|
+
};
|
|
43
|
+
export declare function applyNativeStateImport(plan: NativeStateImport): Promise<void>;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type SharedNativeTool = "codex" | "claude";
|
|
2
|
+
export type NativeState = {
|
|
3
|
+
tool: SharedNativeTool;
|
|
4
|
+
home: string;
|
|
5
|
+
sqliteHome?: string;
|
|
6
|
+
marker: string;
|
|
7
|
+
instructions?: Record<string, unknown>;
|
|
8
|
+
};
|
|
9
|
+
export declare function nativeStateRequested(tool: SharedNativeTool, environment?: NodeJS.ProcessEnv, explicit?: boolean): boolean;
|
|
10
|
+
export declare function validateNativeStateVersion(tool: SharedNativeTool, version: string | undefined): void;
|
|
11
|
+
export declare const CODEX_INSTRUCTION_KEYS: readonly ["instructions", "developer_instructions", "model_instructions_file", "compact_prompt", "experimental_compact_prompt_file", "include_permissions_instructions", "include_apps_instructions", "include_collaboration_mode_instructions", "include_environment_context", "project_doc_max_bytes", "project_doc_fallback_filenames"];
|
|
12
|
+
type Entry = {
|
|
13
|
+
name: string;
|
|
14
|
+
kind: "directory" | "file";
|
|
15
|
+
};
|
|
16
|
+
export declare const NATIVE_STATE_ENTRIES: Record<SharedNativeTool, readonly Entry[]>;
|
|
17
|
+
export declare function assertNativeStateDirectory(path: string): Promise<void>;
|
|
18
|
+
export declare function ensureNativeStateDirectory(path: string, create?: boolean): Promise<void>;
|
|
19
|
+
export declare function withNativeStateLock<T>(state: NativeState, operation: () => Promise<T>): Promise<T>;
|
|
20
|
+
/** A nested CLI keeps its authentication home. Refuse conflicting instruction
|
|
21
|
+
* overlays rather than rewriting account config or exposing instructions in argv. */
|
|
22
|
+
export declare function assertNativeInstructionOverlay(state: NativeState, overlayHome: string): Promise<void>;
|
|
23
|
+
/** This marker identifies the corpus, never the selected authentication home. */
|
|
24
|
+
export declare function resolveNativeState(tool: SharedNativeTool, environment?: NodeJS.ProcessEnv, options?: {
|
|
25
|
+
create?: boolean;
|
|
26
|
+
}): Promise<NativeState>;
|
|
27
|
+
export declare function nativeStateEnvironment(state: NativeState): Record<string, string>;
|
|
28
|
+
/** Metadata only. Old data remains visible as pending migration; normal launch
|
|
29
|
+
* never treats starting a fresh shared overlay as completed legacy migration. */
|
|
30
|
+
export declare function legacyNativeStateWarnings(root: string, state: NativeState): Promise<string[]>;
|
|
31
|
+
export declare function projectNativeState(state: NativeState, overlayHome: string): Promise<void>;
|
|
32
|
+
export {};
|
package/dist/sdk.d.ts
CHANGED
|
@@ -495,10 +495,11 @@ export declare class SwitcherClient {
|
|
|
495
495
|
id: string;
|
|
496
496
|
name: string;
|
|
497
497
|
providerId: string;
|
|
498
|
-
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
|
|
498
|
+
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "antigravity" | "junie" | "aider" | "kilo";
|
|
499
499
|
model: string;
|
|
500
500
|
modelPolicy?: {
|
|
501
501
|
version: 1;
|
|
502
|
+
selection?: "restricted" | "catalog";
|
|
502
503
|
roles?: {
|
|
503
504
|
subagent?: string;
|
|
504
505
|
fast?: string;
|
|
@@ -524,10 +525,11 @@ export declare class SwitcherClient {
|
|
|
524
525
|
id: string;
|
|
525
526
|
name: string;
|
|
526
527
|
providerId: string;
|
|
527
|
-
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
|
|
528
|
+
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "antigravity" | "junie" | "aider" | "kilo";
|
|
528
529
|
model: string;
|
|
529
530
|
modelPolicy?: {
|
|
530
531
|
version: 1;
|
|
532
|
+
selection?: "restricted" | "catalog";
|
|
531
533
|
roles?: {
|
|
532
534
|
subagent?: string;
|
|
533
535
|
fast?: string;
|
|
@@ -553,10 +555,11 @@ export declare class SwitcherClient {
|
|
|
553
555
|
id: string;
|
|
554
556
|
name: string;
|
|
555
557
|
providerId: string;
|
|
556
|
-
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
|
|
558
|
+
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "antigravity" | "junie" | "aider" | "kilo";
|
|
557
559
|
model: string;
|
|
558
560
|
modelPolicy?: {
|
|
559
561
|
version: 1;
|
|
562
|
+
selection?: "restricted" | "catalog";
|
|
560
563
|
roles?: {
|
|
561
564
|
subagent?: string;
|
|
562
565
|
fast?: string;
|
|
@@ -582,10 +585,11 @@ export declare class SwitcherClient {
|
|
|
582
585
|
id: string;
|
|
583
586
|
name: string;
|
|
584
587
|
providerId: string;
|
|
585
|
-
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
|
|
588
|
+
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "antigravity" | "junie" | "aider" | "kilo";
|
|
586
589
|
model: string;
|
|
587
590
|
modelPolicy?: {
|
|
588
591
|
version: 1;
|
|
592
|
+
selection?: "restricted" | "catalog";
|
|
589
593
|
roles?: {
|
|
590
594
|
subagent?: string;
|
|
591
595
|
fast?: string;
|
|
@@ -663,10 +667,11 @@ export declare class SwitcherClient {
|
|
|
663
667
|
id: string;
|
|
664
668
|
name: string;
|
|
665
669
|
providerId: string;
|
|
666
|
-
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
|
|
670
|
+
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "antigravity" | "junie" | "aider" | "kilo";
|
|
667
671
|
model: string;
|
|
668
672
|
modelPolicy?: {
|
|
669
673
|
version: 1;
|
|
674
|
+
selection?: "restricted" | "catalog";
|
|
670
675
|
roles?: {
|
|
671
676
|
subagent?: string;
|
|
672
677
|
fast?: string;
|
|
@@ -712,10 +717,11 @@ export declare class SwitcherClient {
|
|
|
712
717
|
listRuns(options?: {}): Promise<Page<{
|
|
713
718
|
modelPolicyVersion?: 1;
|
|
714
719
|
profileId: string;
|
|
715
|
-
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
|
|
720
|
+
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "antigravity" | "junie" | "aider" | "kilo";
|
|
716
721
|
model: string;
|
|
717
722
|
modelPolicy?: {
|
|
718
723
|
version: 1;
|
|
724
|
+
selection?: "restricted" | "catalog";
|
|
719
725
|
roles?: {
|
|
720
726
|
subagent?: string;
|
|
721
727
|
fast?: string;
|
|
@@ -762,10 +768,11 @@ export declare class SwitcherClient {
|
|
|
762
768
|
getRun(id: string): Promise<{
|
|
763
769
|
modelPolicyVersion?: 1;
|
|
764
770
|
profileId: string;
|
|
765
|
-
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
|
|
771
|
+
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "antigravity" | "junie" | "aider" | "kilo";
|
|
766
772
|
model: string;
|
|
767
773
|
modelPolicy?: {
|
|
768
774
|
version: 1;
|
|
775
|
+
selection?: "restricted" | "catalog";
|
|
769
776
|
roles?: {
|
|
770
777
|
subagent?: string;
|
|
771
778
|
fast?: string;
|
|
@@ -814,10 +821,11 @@ export declare class SwitcherClient {
|
|
|
814
821
|
}, idempotencyKey?: string): Promise<{
|
|
815
822
|
modelPolicyVersion?: 1;
|
|
816
823
|
profileId: string;
|
|
817
|
-
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
|
|
824
|
+
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "antigravity" | "junie" | "aider" | "kilo";
|
|
818
825
|
model: string;
|
|
819
826
|
modelPolicy?: {
|
|
820
827
|
version: 1;
|
|
828
|
+
selection?: "restricted" | "catalog";
|
|
821
829
|
roles?: {
|
|
822
830
|
subagent?: string;
|
|
823
831
|
fast?: string;
|
|
@@ -864,10 +872,11 @@ export declare class SwitcherClient {
|
|
|
864
872
|
finishRun(id: string, version: number, input: components["schemas"]["RunUpdate"], idempotencyKey?: string): Promise<{
|
|
865
873
|
modelPolicyVersion?: 1;
|
|
866
874
|
profileId: string;
|
|
867
|
-
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
|
|
875
|
+
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "antigravity" | "junie" | "aider" | "kilo";
|
|
868
876
|
model: string;
|
|
869
877
|
modelPolicy?: {
|
|
870
878
|
version: 1;
|
|
879
|
+
selection?: "restricted" | "catalog";
|
|
871
880
|
roles?: {
|
|
872
881
|
subagent?: string;
|
|
873
882
|
fast?: string;
|
package/dist/sdk.js
CHANGED
|
@@ -21,6 +21,7 @@ var fallbacksSchema = z2.record(policyModelIdSchema, z2.array(policyModelIdSchem
|
|
|
21
21
|
});
|
|
22
22
|
var modelPolicySchema = z2.object({
|
|
23
23
|
version: z2.literal(1).default(1),
|
|
24
|
+
selection: z2.enum(["restricted", "catalog"]).optional(),
|
|
24
25
|
roles: z2.object({
|
|
25
26
|
subagent: policyModelIdSchema.optional(),
|
|
26
27
|
fast: policyModelIdSchema.optional(),
|
|
@@ -51,7 +52,7 @@ var routingEventSchema = z2.object({
|
|
|
51
52
|
}).strict();
|
|
52
53
|
var routingEventsSchema = z2.array(routingEventSchema).max(1000);
|
|
53
54
|
// src/domain.ts
|
|
54
|
-
var harnessSchema = z3.enum(["claude", "codex", "grok", "opencode", "opencode2", "pi", "omp", "dsh", "cline", "hermes", "prime-agent", "gemini", "aider", "kilo"]);
|
|
55
|
+
var harnessSchema = z3.enum(["claude", "codex", "grok", "opencode", "opencode2", "pi", "omp", "dsh", "cline", "hermes", "prime-agent", "gemini", "antigravity", "junie", "aider", "kilo"]);
|
|
55
56
|
var protocolSchema = z3.enum(["anthropic-messages", "openai-responses", "openai-chat", "gemini-generate-content"]);
|
|
56
57
|
var idSchema = z3.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$/);
|
|
57
58
|
var label = z3.string().min(1).max(200);
|
|
@@ -175,7 +176,7 @@ function compatible(harness, protocol) {
|
|
|
175
176
|
return protocol === "anthropic-messages";
|
|
176
177
|
if (harness === "codex")
|
|
177
178
|
return protocol === "openai-responses";
|
|
178
|
-
if (harness === "gemini")
|
|
179
|
+
if (harness === "gemini" || harness === "antigravity")
|
|
179
180
|
return protocol === "gemini-generate-content";
|
|
180
181
|
if (protocol === "gemini-generate-content")
|
|
181
182
|
return false;
|
|
@@ -219,6 +220,19 @@ async function boundedJson(response, maxBytes = MAX_BYTES) {
|
|
|
219
220
|
// src/sdk.ts
|
|
220
221
|
import { createClientTransport } from "@hasna/contracts/client";
|
|
221
222
|
|
|
223
|
+
// src/bedrock.ts
|
|
224
|
+
function bedrockMantleOrigin(value) {
|
|
225
|
+
let url;
|
|
226
|
+
try {
|
|
227
|
+
url = new URL(value);
|
|
228
|
+
} catch {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
if (url.protocol !== "https:" || url.port || url.username || url.password || url.search || url.hash || url.pathname.replace(/\/+$/, "") !== "/anthropic/v1")
|
|
232
|
+
return;
|
|
233
|
+
return /^bedrock-mantle\.[a-z]{2}(?:-[a-z]+)+-\d+\.api\.aws$/.test(url.hostname) ? url.origin : undefined;
|
|
234
|
+
}
|
|
235
|
+
|
|
222
236
|
// src/presets.ts
|
|
223
237
|
var route = (protocol, baseUrl, options = {}) => ({
|
|
224
238
|
protocol,
|
|
@@ -251,8 +265,10 @@ var providerPresets = [
|
|
|
251
265
|
], ["https://api-docs.deepseek.com/guides/anthropic_api", "https://api-docs.deepseek.com/api/list-models", "https://api-docs.deepseek.com/updates/", "https://api-docs.deepseek.com/guides/responses_api/"], "DEEPSEEK_API_KEY"),
|
|
252
266
|
preset("openrouter", "OpenRouter", ["openai-chat", "openai-responses", "anthropic-messages"].map((protocol) => route(protocol, "https://openrouter.ai/api/v1", { catalogAuthStyle: "none", credentialCheck: { method: "GET", path: "key" } })), ["https://openrouter.ai/docs/api/api-reference/models/list-all-models-and-their-properties", "https://openrouter.ai/docs/guides/overview"], "OPENROUTER_API_KEY"),
|
|
253
267
|
preset("anthropic", "Anthropic", [route("anthropic-messages", "https://api.anthropic.com/v1", { authStyle: "x-api-key" })], ["https://platform.claude.com/docs/en/api/overview", "https://platform.claude.com/docs/en/api/models/list"], "ANTHROPIC_API_KEY"),
|
|
268
|
+
preset("bedrock", "Amazon Bedrock (Mantle)", [route("anthropic-messages", undefined, { authStyle: "x-api-key", catalogAuthStyle: "bearer", notes: ["Pass the regional https://bedrock-mantle.<region>.api.aws/anthropic/v1 endpoint and a Bedrock API key. The authenticated catalog is /v1/models on that same origin. Model access and regional availability remain controlled by the AWS account; this route does not distribute or inherit AWS administrative credentials."] })], ["https://docs.aws.amazon.com/bedrock/latest/userguide/inference-messages-api.html", "https://docs.aws.amazon.com/bedrock/latest/userguide/api-keys.html"], "AWS_BEARER_TOKEN_BEDROCK"),
|
|
254
269
|
preset("gemini", "Google Gemini", [route("gemini-generate-content", "https://generativelanguage.googleapis.com/v1beta", {
|
|
255
270
|
authStyle: "x-api-key",
|
|
271
|
+
credentialCheck: { method: "GET", path: "models" },
|
|
256
272
|
catalogBaseUrl: "https://generativelanguage.googleapis.com/v1beta",
|
|
257
273
|
catalogFormat: "gemini",
|
|
258
274
|
catalogAuthStyle: "x-api-key",
|
|
@@ -323,16 +339,19 @@ function providerFromPreset(presetId, options = {}) {
|
|
|
323
339
|
const baseUrl = options.baseUrl ?? selected.baseUrl;
|
|
324
340
|
if (!baseUrl)
|
|
325
341
|
throw new Fault(400, "endpoint_required", "This preset requires an explicit --url for its inference endpoint.");
|
|
342
|
+
const bedrockOrigin = presetId === "bedrock" ? bedrockMantleOrigin(endpoint(baseUrl)) : undefined;
|
|
343
|
+
if (presetId === "bedrock" && !bedrockOrigin)
|
|
344
|
+
throw new Fault(400, "invalid_url", "Bedrock requires a regional HTTPS Mantle endpoint ending in /anthropic/v1.");
|
|
326
345
|
if (presetId === "azure-openai" && !/\/openai\/v1$/.test(endpoint(baseUrl)))
|
|
327
346
|
throw new Fault(400, "invalid_url", "Azure OpenAI v1 requires an explicit endpoint ending in /openai/v1; deployment and api-version URLs are unsupported.");
|
|
328
347
|
if (options.baseUrl && selected.baseUrl && new URL(endpoint(options.baseUrl)).origin !== new URL(selected.baseUrl).origin && preset2.credentialEnv && !options.credentialEnv)
|
|
329
348
|
throw new Fault(422, "credential_authority", "An endpoint on another origin requires an explicit --credential-env reference.");
|
|
330
|
-
const suffix = selected.protocol === "anthropic-messages" ? "messages" : selected.protocol === "openai-responses" ? "responses" : "chat";
|
|
349
|
+
const suffix = selected.protocol === "anthropic-messages" ? "messages" : selected.protocol === "openai-responses" ? "responses" : selected.protocol === "gemini-generate-content" ? "generate-content" : "chat";
|
|
331
350
|
if (presetId === "fireworks" && !options.catalogBaseUrl && !options.catalogAccountId)
|
|
332
351
|
throw new Fault(400, "catalog_account_required", "Fireworks model discovery requires --catalog-account-id or an explicit --catalog-url.");
|
|
333
352
|
if (selected.catalogFormat === "none" && options.catalogFormat && options.catalogFormat !== "none" && !options.catalogBaseUrl)
|
|
334
353
|
throw new Fault(400, "catalog_url_required", "This preset requires an explicit --catalog-url when enabling a catalog parser.");
|
|
335
|
-
const catalogBaseUrl = options.catalogBaseUrl ?? (presetId === "fireworks" && options.catalogAccountId ? `https://api.fireworks.ai/v1/accounts/${encodeURIComponent(options.catalogAccountId)}` : options.baseUrl ? undefined : selected.catalogBaseUrl);
|
|
354
|
+
const catalogBaseUrl = options.catalogBaseUrl ?? (bedrockOrigin ? `${bedrockOrigin}/v1` : presetId === "fireworks" && options.catalogAccountId ? `https://api.fireworks.ai/v1/accounts/${encodeURIComponent(options.catalogAccountId)}` : options.baseUrl ? undefined : selected.catalogBaseUrl);
|
|
336
355
|
return parse(providerInputSchema, {
|
|
337
356
|
id: options.id ?? `${preset2.id}-${suffix}`,
|
|
338
357
|
name: preset2.name,
|