@hasna/switcher 0.1.7 → 0.1.9
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 +166 -4
- package/dist/chatgpt-launch.d.ts +5 -0
- package/dist/claude-desktop-launch.d.ts +11 -0
- package/dist/cli/index.js +1122 -368
- package/dist/codex-delegation.d.ts +7 -0
- package/dist/credentials.d.ts +7 -7
- package/dist/desktop-apps.d.ts +25 -0
- package/dist/desktop-state.d.ts +3 -0
- package/dist/domain.d.ts +26 -4
- package/dist/generated/api.d.ts +16 -0
- package/dist/harness-process.d.ts +1 -0
- package/dist/harness-types.d.ts +3 -0
- package/dist/harnesses.d.ts +7 -3
- package/dist/index.js +199 -69
- package/dist/inference-gateway.d.ts +2 -0
- package/dist/launcher.d.ts +6 -0
- package/dist/mcp/index.js +145 -78
- package/dist/model-policy-schema.d.ts +6 -0
- package/dist/presets.d.ts +2 -0
- package/dist/reasoning.d.ts +10 -0
- package/dist/sdk.d.ts +156 -0
- package/dist/sdk.js +199 -69
- package/dist/serve/index.js +290 -74
- package/openapi.json +210 -1
- package/package.json +3 -2
package/dist/serve/index.js
CHANGED
|
@@ -11,25 +11,29 @@ import { chmod, mkdir } from "fs/promises";
|
|
|
11
11
|
import { dirname, resolve } from "path";
|
|
12
12
|
|
|
13
13
|
// src/domain.ts
|
|
14
|
-
import { z as
|
|
14
|
+
import { z as z3 } from "zod";
|
|
15
15
|
|
|
16
|
-
// src/
|
|
16
|
+
// src/reasoning.ts
|
|
17
17
|
import { z } from "zod";
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var
|
|
18
|
+
var reasoningEffortSchema = z.enum(["none", "minimal", "low", "medium", "high", "xhigh", "max", "ultra"]);
|
|
19
|
+
|
|
20
|
+
// src/model-policy-schema.ts
|
|
21
|
+
import { z as z2 } from "zod";
|
|
22
|
+
var policyModelIdSchema = z2.string().min(1).max(300).regex(/^[^\u0000-\u001f\u007f]+$/);
|
|
23
|
+
var modelPolicyRoleSchema = z2.enum(["subagent", "fast", "planning", "review", "summary", "compaction", "weak", "editor"]);
|
|
24
|
+
var boundedModelList = z2.array(policyModelIdSchema).max(500);
|
|
25
|
+
var aliasSchema = z2.string().regex(/^[A-Za-z0-9._/-]{1,120}$/).refine((v) => !["__proto__", "prototype", "constructor"].includes(v));
|
|
26
|
+
var boundedModelMap = z2.record(aliasSchema, policyModelIdSchema).superRefine((value, ctx) => {
|
|
23
27
|
if (Object.keys(value).length > 200)
|
|
24
28
|
ctx.addIssue({ code: "custom", message: "Model policy maps may contain at most 200 entries." });
|
|
25
29
|
});
|
|
26
|
-
var fallbacksSchema =
|
|
30
|
+
var fallbacksSchema = z2.record(policyModelIdSchema, z2.array(policyModelIdSchema).max(20)).superRefine((value, ctx) => {
|
|
27
31
|
if (Object.keys(value).length > 200)
|
|
28
32
|
ctx.addIssue({ code: "custom", message: "Model policy fallback maps may contain at most 200 entries." });
|
|
29
33
|
});
|
|
30
|
-
var modelPolicySchema =
|
|
31
|
-
version:
|
|
32
|
-
roles:
|
|
34
|
+
var modelPolicySchema = z2.object({
|
|
35
|
+
version: z2.literal(1).default(1),
|
|
36
|
+
roles: z2.object({
|
|
33
37
|
subagent: policyModelIdSchema.optional(),
|
|
34
38
|
fast: policyModelIdSchema.optional(),
|
|
35
39
|
planning: policyModelIdSchema.optional(),
|
|
@@ -43,31 +47,32 @@ var modelPolicySchema = z.object({
|
|
|
43
47
|
aliases: boundedModelMap.optional(),
|
|
44
48
|
fallbacks: fallbacksSchema.optional()
|
|
45
49
|
}).strict();
|
|
46
|
-
var routingDecisionSchema =
|
|
47
|
-
var routingEventRoleSchema =
|
|
48
|
-
var routingEventSchema =
|
|
49
|
-
at:
|
|
50
|
-
requestId:
|
|
50
|
+
var routingDecisionSchema = z2.enum(["allow", "alias", "reject", "fallback"]);
|
|
51
|
+
var routingEventRoleSchema = z2.enum(["main", ...modelPolicyRoleSchema.options]);
|
|
52
|
+
var routingEventSchema = z2.object({
|
|
53
|
+
at: z2.string().datetime({ offset: true }),
|
|
54
|
+
requestId: z2.string().regex(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/),
|
|
51
55
|
requestedModel: policyModelIdSchema,
|
|
52
56
|
resolvedModel: policyModelIdSchema.optional(),
|
|
53
57
|
reportedModel: policyModelIdSchema.optional(),
|
|
58
|
+
reasoningEffort: reasoningEffortSchema.optional(),
|
|
54
59
|
decision: routingDecisionSchema,
|
|
55
60
|
role: routingEventRoleSchema.optional(),
|
|
56
|
-
reason:
|
|
57
|
-
upstreamStatus:
|
|
61
|
+
reason: z2.string().regex(/^[a-z][a-z0-9_]{0,63}$/).optional(),
|
|
62
|
+
upstreamStatus: z2.number().int().min(100).max(599).optional()
|
|
58
63
|
}).strict();
|
|
59
|
-
var routingEventsSchema =
|
|
64
|
+
var routingEventsSchema = z2.array(routingEventSchema).max(1000);
|
|
60
65
|
function canonicalPolicyJSON(value) {
|
|
61
66
|
return JSON.stringify(value, (_key, item) => item && typeof item === "object" && !Array.isArray(item) ? Object.fromEntries(Object.entries(item).sort(([a], [b]) => a.localeCompare(b))) : item);
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
// src/domain.ts
|
|
65
|
-
var VERSION = "0.1.
|
|
66
|
-
var harnessSchema =
|
|
67
|
-
var protocolSchema =
|
|
68
|
-
var idSchema =
|
|
69
|
-
var label =
|
|
70
|
-
var envRef =
|
|
70
|
+
var VERSION = "0.1.9";
|
|
71
|
+
var harnessSchema = z3.enum(["claude", "codex", "grok", "opencode", "opencode2", "pi", "omp", "dsh", "cline", "hermes", "prime-agent", "gemini", "aider", "kilo"]);
|
|
72
|
+
var protocolSchema = z3.enum(["anthropic-messages", "openai-responses", "openai-chat", "gemini-generate-content"]);
|
|
73
|
+
var idSchema = z3.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$/);
|
|
74
|
+
var label = z3.string().min(1).max(200);
|
|
75
|
+
var envRef = z3.string().regex(/^SWITCHER_PROVIDER_[A-Z0-9_]+$/);
|
|
71
76
|
function endpoint(value) {
|
|
72
77
|
let url;
|
|
73
78
|
try {
|
|
@@ -80,85 +85,86 @@ function endpoint(value) {
|
|
|
80
85
|
throw new Fault(400, "invalid_url", "URL must use HTTPS, contain no credentials/query/fragment, or use HTTP on loopback.");
|
|
81
86
|
return url.href.replace(/\/+$/, "");
|
|
82
87
|
}
|
|
83
|
-
var urlSchema =
|
|
88
|
+
var urlSchema = z3.string().max(2000).superRefine((v, ctx) => {
|
|
84
89
|
try {
|
|
85
90
|
endpoint(v);
|
|
86
91
|
} catch {
|
|
87
92
|
ctx.addIssue({ code: "custom", message: "Invalid endpoint URL" });
|
|
88
93
|
}
|
|
89
94
|
}).transform(endpoint);
|
|
90
|
-
var expiresOnSchema =
|
|
95
|
+
var expiresOnSchema = z3.string().regex(/^\d{4}-\d{2}-\d{2}$/).refine((value) => {
|
|
91
96
|
const day = new Date(`${value}T00:00:00.000Z`);
|
|
92
97
|
return Number.isFinite(day.getTime()) && day.toISOString().slice(0, 10) === value;
|
|
93
98
|
}, "Use a real calendar date in YYYY-MM-DD format.");
|
|
94
|
-
var modelSchema =
|
|
95
|
-
id:
|
|
99
|
+
var modelSchema = z3.object({
|
|
100
|
+
id: z3.string().min(1).max(300).refine((value) => value === value.trim() && !/[\x00-\x1f\x7f-\x9f]/.test(value), "Use a nonblank model ID without surrounding whitespace or control characters."),
|
|
96
101
|
name: label,
|
|
97
|
-
description:
|
|
98
|
-
available:
|
|
102
|
+
description: z3.string().max(8000).optional(),
|
|
103
|
+
available: z3.boolean().optional(),
|
|
99
104
|
expiresOn: expiresOnSchema.optional(),
|
|
100
|
-
contextWindow:
|
|
101
|
-
maxOutputTokens:
|
|
102
|
-
inputModalities:
|
|
103
|
-
outputModalities:
|
|
104
|
-
supportedParameters:
|
|
105
|
-
|
|
105
|
+
contextWindow: z3.number().int().positive().optional(),
|
|
106
|
+
maxOutputTokens: z3.number().int().positive().optional(),
|
|
107
|
+
inputModalities: z3.array(z3.string().max(50)).max(20).optional(),
|
|
108
|
+
outputModalities: z3.array(z3.string().max(50)).max(20).optional(),
|
|
109
|
+
supportedParameters: z3.array(z3.string().max(100)).max(100).optional(),
|
|
110
|
+
reasoningEfforts: z3.array(reasoningEffortSchema).max(8).optional(),
|
|
111
|
+
supportedGenerationMethods: z3.array(z3.string().min(1).max(100)).max(100).optional()
|
|
106
112
|
}).strict();
|
|
107
|
-
var providerInputSchema =
|
|
113
|
+
var providerInputSchema = z3.object({
|
|
108
114
|
id: idSchema,
|
|
109
115
|
name: label,
|
|
110
116
|
baseUrl: urlSchema,
|
|
111
117
|
protocol: protocolSchema,
|
|
112
118
|
credentialEnv: envRef.optional(),
|
|
113
|
-
authStyle:
|
|
119
|
+
authStyle: z3.enum(["bearer", "x-api-key", "api-key"]).default("bearer"),
|
|
114
120
|
catalogBaseUrl: urlSchema.optional(),
|
|
115
|
-
catalogFormat:
|
|
116
|
-
catalogAuthStyle:
|
|
121
|
+
catalogFormat: z3.enum(["openai", "ollama", "mistral", "together", "fireworks", "dashscope", "gemini", "none"]).optional(),
|
|
122
|
+
catalogAuthStyle: z3.enum(["bearer", "x-api-key", "api-key", "none"]).optional(),
|
|
117
123
|
catalogCredentialEnv: envRef.optional(),
|
|
118
|
-
catalogAccountId:
|
|
119
|
-
modelsPath:
|
|
120
|
-
manualModels:
|
|
121
|
-
additionalModels:
|
|
124
|
+
catalogAccountId: z3.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/).optional(),
|
|
125
|
+
modelsPath: z3.string().regex(/^[a-zA-Z0-9_/-]+$/).max(200).default("models"),
|
|
126
|
+
manualModels: z3.array(modelSchema).max(1e4).default([]),
|
|
127
|
+
additionalModels: z3.array(modelSchema).max(1e4).optional()
|
|
122
128
|
}).strict().refine((p) => !p.modelsPath.split("/").includes("..") && !p.modelsPath.startsWith("/"), "modelsPath must be relative");
|
|
123
|
-
var providerPresetSchema =
|
|
129
|
+
var providerPresetSchema = z3.object({
|
|
124
130
|
id: idSchema,
|
|
125
131
|
name: label,
|
|
126
132
|
credentialEnv: envRef.optional(),
|
|
127
|
-
credentialAliases:
|
|
128
|
-
protocols:
|
|
133
|
+
credentialAliases: z3.array(z3.string().regex(/^[A-Z][A-Z0-9_]+$/)),
|
|
134
|
+
protocols: z3.array(z3.object({
|
|
129
135
|
protocol: protocolSchema,
|
|
130
136
|
baseUrl: urlSchema.optional(),
|
|
131
|
-
authStyle:
|
|
137
|
+
authStyle: z3.enum(["bearer", "x-api-key", "api-key"]),
|
|
132
138
|
catalogBaseUrl: urlSchema.optional(),
|
|
133
|
-
catalogFormat:
|
|
134
|
-
catalogAuthStyle:
|
|
135
|
-
modelsPath:
|
|
136
|
-
notes:
|
|
139
|
+
catalogFormat: z3.enum(["openai", "ollama", "mistral", "together", "fireworks", "dashscope", "gemini", "none"]),
|
|
140
|
+
catalogAuthStyle: z3.enum(["bearer", "x-api-key", "api-key", "none"]).optional(),
|
|
141
|
+
modelsPath: z3.string(),
|
|
142
|
+
notes: z3.array(z3.string())
|
|
137
143
|
}).strict()).min(1),
|
|
138
|
-
sources:
|
|
139
|
-
verification:
|
|
144
|
+
sources: z3.array(z3.string().url()),
|
|
145
|
+
verification: z3.literal("documented")
|
|
140
146
|
}).strict();
|
|
141
|
-
var profileInputSchema =
|
|
147
|
+
var profileInputSchema = z3.object({
|
|
142
148
|
id: idSchema,
|
|
143
149
|
name: label,
|
|
144
150
|
providerId: idSchema,
|
|
145
151
|
harness: harnessSchema,
|
|
146
|
-
model:
|
|
152
|
+
model: z3.string().min(1).max(300),
|
|
147
153
|
modelPolicy: modelPolicySchema.optional()
|
|
148
154
|
}).strict();
|
|
149
|
-
var runInputSchema =
|
|
150
|
-
modelPolicyVersion:
|
|
155
|
+
var runInputSchema = z3.object({
|
|
156
|
+
modelPolicyVersion: z3.literal(1),
|
|
151
157
|
profileId: idSchema,
|
|
152
158
|
harness: harnessSchema,
|
|
153
|
-
model:
|
|
159
|
+
model: z3.string().min(1).max(300),
|
|
154
160
|
modelPolicy: modelPolicySchema.optional(),
|
|
155
|
-
planToken:
|
|
161
|
+
planToken: z3.string().regex(/^[a-f0-9]{64}$/)
|
|
156
162
|
}).strict();
|
|
157
|
-
var runUpdateSchema =
|
|
158
|
-
status:
|
|
159
|
-
exitCode:
|
|
163
|
+
var runUpdateSchema = z3.object({
|
|
164
|
+
status: z3.enum(["exited", "failed", "interrupted"]),
|
|
165
|
+
exitCode: z3.number().int().min(0).max(255),
|
|
160
166
|
routingEvents: routingEventsSchema.optional(),
|
|
161
|
-
routingEventsDropped:
|
|
167
|
+
routingEventsDropped: z3.number().int().min(0).max(1e6).optional()
|
|
162
168
|
}).strict();
|
|
163
169
|
|
|
164
170
|
class Fault extends Error {
|
|
@@ -363,7 +369,7 @@ class Store {
|
|
|
363
369
|
|
|
364
370
|
// src/service.ts
|
|
365
371
|
import { createHash as createHash2, timingSafeEqual } from "crypto";
|
|
366
|
-
import { z as
|
|
372
|
+
import { z as z4 } from "zod";
|
|
367
373
|
|
|
368
374
|
// src/http.ts
|
|
369
375
|
var MAX_BYTES = 16 * 1024 * 1024;
|
|
@@ -757,8 +763,9 @@ var preset = (id2, name, protocols, sources, alias) => parse(providerPresetSchem
|
|
|
757
763
|
var providerPresets = [
|
|
758
764
|
preset("deepseek", "DeepSeek", [
|
|
759
765
|
route("openai-chat", "https://api.deepseek.com", { catalogBaseUrl: "https://api.deepseek.com" }),
|
|
766
|
+
route("openai-responses", "https://api.deepseek.com", { catalogBaseUrl: "https://api.deepseek.com" }),
|
|
760
767
|
route("anthropic-messages", "https://api.deepseek.com/anthropic/v1", { catalogBaseUrl: "https://api.deepseek.com" })
|
|
761
|
-
], ["https://api-docs.deepseek.com/guides/anthropic_api", "https://api-docs.deepseek.com/api/list-models"], "DEEPSEEK_API_KEY"),
|
|
768
|
+
], ["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"),
|
|
762
769
|
preset("openrouter", "OpenRouter", ["openai-chat", "openai-responses", "anthropic-messages"].map((protocol) => route(protocol, "https://openrouter.ai/api/v1", { catalogAuthStyle: "none" })), ["https://openrouter.ai/docs/api/api-reference/models/list-all-models-and-their-properties", "https://openrouter.ai/docs/guides/overview"], "OPENROUTER_API_KEY"),
|
|
763
770
|
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"),
|
|
764
771
|
preset("gemini", "Google Gemini", [route("gemini-generate-content", "https://generativelanguage.googleapis.com/v1beta", {
|
|
@@ -830,7 +837,7 @@ var openapi_default = {
|
|
|
830
837
|
openapi: "3.0.3",
|
|
831
838
|
info: {
|
|
832
839
|
title: "Switcher API",
|
|
833
|
-
version: "0.1.
|
|
840
|
+
version: "0.1.9",
|
|
834
841
|
description: "Authenticated provider/profile/catalog control plane. Launches run locally; the API never returns provider credentials."
|
|
835
842
|
},
|
|
836
843
|
security: [
|
|
@@ -2269,6 +2276,23 @@ var openapi_default = {
|
|
|
2269
2276
|
},
|
|
2270
2277
|
maxItems: 100
|
|
2271
2278
|
},
|
|
2279
|
+
reasoningEfforts: {
|
|
2280
|
+
type: "array",
|
|
2281
|
+
items: {
|
|
2282
|
+
type: "string",
|
|
2283
|
+
enum: [
|
|
2284
|
+
"none",
|
|
2285
|
+
"minimal",
|
|
2286
|
+
"low",
|
|
2287
|
+
"medium",
|
|
2288
|
+
"high",
|
|
2289
|
+
"xhigh",
|
|
2290
|
+
"max",
|
|
2291
|
+
"ultra"
|
|
2292
|
+
]
|
|
2293
|
+
},
|
|
2294
|
+
maxItems: 8
|
|
2295
|
+
},
|
|
2272
2296
|
supportedGenerationMethods: {
|
|
2273
2297
|
type: "array",
|
|
2274
2298
|
items: {
|
|
@@ -2348,6 +2372,23 @@ var openapi_default = {
|
|
|
2348
2372
|
},
|
|
2349
2373
|
maxItems: 100
|
|
2350
2374
|
},
|
|
2375
|
+
reasoningEfforts: {
|
|
2376
|
+
type: "array",
|
|
2377
|
+
items: {
|
|
2378
|
+
type: "string",
|
|
2379
|
+
enum: [
|
|
2380
|
+
"none",
|
|
2381
|
+
"minimal",
|
|
2382
|
+
"low",
|
|
2383
|
+
"medium",
|
|
2384
|
+
"high",
|
|
2385
|
+
"xhigh",
|
|
2386
|
+
"max",
|
|
2387
|
+
"ultra"
|
|
2388
|
+
]
|
|
2389
|
+
},
|
|
2390
|
+
maxItems: 8
|
|
2391
|
+
},
|
|
2351
2392
|
supportedGenerationMethods: {
|
|
2352
2393
|
type: "array",
|
|
2353
2394
|
items: {
|
|
@@ -2513,6 +2554,23 @@ var openapi_default = {
|
|
|
2513
2554
|
},
|
|
2514
2555
|
maxItems: 100
|
|
2515
2556
|
},
|
|
2557
|
+
reasoningEfforts: {
|
|
2558
|
+
type: "array",
|
|
2559
|
+
items: {
|
|
2560
|
+
type: "string",
|
|
2561
|
+
enum: [
|
|
2562
|
+
"none",
|
|
2563
|
+
"minimal",
|
|
2564
|
+
"low",
|
|
2565
|
+
"medium",
|
|
2566
|
+
"high",
|
|
2567
|
+
"xhigh",
|
|
2568
|
+
"max",
|
|
2569
|
+
"ultra"
|
|
2570
|
+
]
|
|
2571
|
+
},
|
|
2572
|
+
maxItems: 8
|
|
2573
|
+
},
|
|
2516
2574
|
supportedGenerationMethods: {
|
|
2517
2575
|
type: "array",
|
|
2518
2576
|
items: {
|
|
@@ -2592,6 +2650,23 @@ var openapi_default = {
|
|
|
2592
2650
|
},
|
|
2593
2651
|
maxItems: 100
|
|
2594
2652
|
},
|
|
2653
|
+
reasoningEfforts: {
|
|
2654
|
+
type: "array",
|
|
2655
|
+
items: {
|
|
2656
|
+
type: "string",
|
|
2657
|
+
enum: [
|
|
2658
|
+
"none",
|
|
2659
|
+
"minimal",
|
|
2660
|
+
"low",
|
|
2661
|
+
"medium",
|
|
2662
|
+
"high",
|
|
2663
|
+
"xhigh",
|
|
2664
|
+
"max",
|
|
2665
|
+
"ultra"
|
|
2666
|
+
]
|
|
2667
|
+
},
|
|
2668
|
+
maxItems: 8
|
|
2669
|
+
},
|
|
2595
2670
|
supportedGenerationMethods: {
|
|
2596
2671
|
type: "array",
|
|
2597
2672
|
items: {
|
|
@@ -2995,6 +3070,23 @@ var openapi_default = {
|
|
|
2995
3070
|
},
|
|
2996
3071
|
maxItems: 100
|
|
2997
3072
|
},
|
|
3073
|
+
reasoningEfforts: {
|
|
3074
|
+
type: "array",
|
|
3075
|
+
items: {
|
|
3076
|
+
type: "string",
|
|
3077
|
+
enum: [
|
|
3078
|
+
"none",
|
|
3079
|
+
"minimal",
|
|
3080
|
+
"low",
|
|
3081
|
+
"medium",
|
|
3082
|
+
"high",
|
|
3083
|
+
"xhigh",
|
|
3084
|
+
"max",
|
|
3085
|
+
"ultra"
|
|
3086
|
+
]
|
|
3087
|
+
},
|
|
3088
|
+
maxItems: 8
|
|
3089
|
+
},
|
|
2998
3090
|
supportedGenerationMethods: {
|
|
2999
3091
|
type: "array",
|
|
3000
3092
|
items: {
|
|
@@ -3139,6 +3231,19 @@ var openapi_default = {
|
|
|
3139
3231
|
maxLength: 300,
|
|
3140
3232
|
pattern: "^[^\\u0000-\\u001f\\u007f]+$"
|
|
3141
3233
|
},
|
|
3234
|
+
reasoningEffort: {
|
|
3235
|
+
type: "string",
|
|
3236
|
+
enum: [
|
|
3237
|
+
"none",
|
|
3238
|
+
"minimal",
|
|
3239
|
+
"low",
|
|
3240
|
+
"medium",
|
|
3241
|
+
"high",
|
|
3242
|
+
"xhigh",
|
|
3243
|
+
"max",
|
|
3244
|
+
"ultra"
|
|
3245
|
+
]
|
|
3246
|
+
},
|
|
3142
3247
|
decision: {
|
|
3143
3248
|
type: "string",
|
|
3144
3249
|
enum: [
|
|
@@ -3243,6 +3348,23 @@ var openapi_default = {
|
|
|
3243
3348
|
},
|
|
3244
3349
|
maxItems: 100
|
|
3245
3350
|
},
|
|
3351
|
+
reasoningEfforts: {
|
|
3352
|
+
type: "array",
|
|
3353
|
+
items: {
|
|
3354
|
+
type: "string",
|
|
3355
|
+
enum: [
|
|
3356
|
+
"none",
|
|
3357
|
+
"minimal",
|
|
3358
|
+
"low",
|
|
3359
|
+
"medium",
|
|
3360
|
+
"high",
|
|
3361
|
+
"xhigh",
|
|
3362
|
+
"max",
|
|
3363
|
+
"ultra"
|
|
3364
|
+
]
|
|
3365
|
+
},
|
|
3366
|
+
maxItems: 8
|
|
3367
|
+
},
|
|
3246
3368
|
supportedGenerationMethods: {
|
|
3247
3369
|
type: "array",
|
|
3248
3370
|
items: {
|
|
@@ -3361,6 +3483,23 @@ var openapi_default = {
|
|
|
3361
3483
|
},
|
|
3362
3484
|
maxItems: 100
|
|
3363
3485
|
},
|
|
3486
|
+
reasoningEfforts: {
|
|
3487
|
+
type: "array",
|
|
3488
|
+
items: {
|
|
3489
|
+
type: "string",
|
|
3490
|
+
enum: [
|
|
3491
|
+
"none",
|
|
3492
|
+
"minimal",
|
|
3493
|
+
"low",
|
|
3494
|
+
"medium",
|
|
3495
|
+
"high",
|
|
3496
|
+
"xhigh",
|
|
3497
|
+
"max",
|
|
3498
|
+
"ultra"
|
|
3499
|
+
]
|
|
3500
|
+
},
|
|
3501
|
+
maxItems: 8
|
|
3502
|
+
},
|
|
3364
3503
|
supportedGenerationMethods: {
|
|
3365
3504
|
type: "array",
|
|
3366
3505
|
items: {
|
|
@@ -3537,6 +3676,23 @@ var openapi_default = {
|
|
|
3537
3676
|
},
|
|
3538
3677
|
maxItems: 100
|
|
3539
3678
|
},
|
|
3679
|
+
reasoningEfforts: {
|
|
3680
|
+
type: "array",
|
|
3681
|
+
items: {
|
|
3682
|
+
type: "string",
|
|
3683
|
+
enum: [
|
|
3684
|
+
"none",
|
|
3685
|
+
"minimal",
|
|
3686
|
+
"low",
|
|
3687
|
+
"medium",
|
|
3688
|
+
"high",
|
|
3689
|
+
"xhigh",
|
|
3690
|
+
"max",
|
|
3691
|
+
"ultra"
|
|
3692
|
+
]
|
|
3693
|
+
},
|
|
3694
|
+
maxItems: 8
|
|
3695
|
+
},
|
|
3540
3696
|
supportedGenerationMethods: {
|
|
3541
3697
|
type: "array",
|
|
3542
3698
|
items: {
|
|
@@ -3616,6 +3772,23 @@ var openapi_default = {
|
|
|
3616
3772
|
},
|
|
3617
3773
|
maxItems: 100
|
|
3618
3774
|
},
|
|
3775
|
+
reasoningEfforts: {
|
|
3776
|
+
type: "array",
|
|
3777
|
+
items: {
|
|
3778
|
+
type: "string",
|
|
3779
|
+
enum: [
|
|
3780
|
+
"none",
|
|
3781
|
+
"minimal",
|
|
3782
|
+
"low",
|
|
3783
|
+
"medium",
|
|
3784
|
+
"high",
|
|
3785
|
+
"xhigh",
|
|
3786
|
+
"max",
|
|
3787
|
+
"ultra"
|
|
3788
|
+
]
|
|
3789
|
+
},
|
|
3790
|
+
maxItems: 8
|
|
3791
|
+
},
|
|
3619
3792
|
supportedGenerationMethods: {
|
|
3620
3793
|
type: "array",
|
|
3621
3794
|
items: {
|
|
@@ -3875,6 +4048,23 @@ var openapi_default = {
|
|
|
3875
4048
|
},
|
|
3876
4049
|
maxItems: 100
|
|
3877
4050
|
},
|
|
4051
|
+
reasoningEfforts: {
|
|
4052
|
+
type: "array",
|
|
4053
|
+
items: {
|
|
4054
|
+
type: "string",
|
|
4055
|
+
enum: [
|
|
4056
|
+
"none",
|
|
4057
|
+
"minimal",
|
|
4058
|
+
"low",
|
|
4059
|
+
"medium",
|
|
4060
|
+
"high",
|
|
4061
|
+
"xhigh",
|
|
4062
|
+
"max",
|
|
4063
|
+
"ultra"
|
|
4064
|
+
]
|
|
4065
|
+
},
|
|
4066
|
+
maxItems: 8
|
|
4067
|
+
},
|
|
3878
4068
|
supportedGenerationMethods: {
|
|
3879
4069
|
type: "array",
|
|
3880
4070
|
items: {
|
|
@@ -4126,6 +4316,19 @@ var openapi_default = {
|
|
|
4126
4316
|
maxLength: 300,
|
|
4127
4317
|
pattern: "^[^\\u0000-\\u001f\\u007f]+$"
|
|
4128
4318
|
},
|
|
4319
|
+
reasoningEffort: {
|
|
4320
|
+
type: "string",
|
|
4321
|
+
enum: [
|
|
4322
|
+
"none",
|
|
4323
|
+
"minimal",
|
|
4324
|
+
"low",
|
|
4325
|
+
"medium",
|
|
4326
|
+
"high",
|
|
4327
|
+
"xhigh",
|
|
4328
|
+
"max",
|
|
4329
|
+
"ultra"
|
|
4330
|
+
]
|
|
4331
|
+
},
|
|
4129
4332
|
decision: {
|
|
4130
4333
|
type: "string",
|
|
4131
4334
|
enum: [
|
|
@@ -4396,6 +4599,19 @@ var openapi_default = {
|
|
|
4396
4599
|
maxLength: 300,
|
|
4397
4600
|
pattern: "^[^\\u0000-\\u001f\\u007f]+$"
|
|
4398
4601
|
},
|
|
4602
|
+
reasoningEffort: {
|
|
4603
|
+
type: "string",
|
|
4604
|
+
enum: [
|
|
4605
|
+
"none",
|
|
4606
|
+
"minimal",
|
|
4607
|
+
"low",
|
|
4608
|
+
"medium",
|
|
4609
|
+
"high",
|
|
4610
|
+
"xhigh",
|
|
4611
|
+
"max",
|
|
4612
|
+
"ultra"
|
|
4613
|
+
]
|
|
4614
|
+
},
|
|
4399
4615
|
decision: {
|
|
4400
4616
|
type: "string",
|
|
4401
4617
|
enum: [
|
|
@@ -4604,10 +4820,10 @@ function createHandler(store, apiKey, providerEnv = process.env, resolveCredenti
|
|
|
4604
4820
|
const id2 = parts[2];
|
|
4605
4821
|
if (id2)
|
|
4606
4822
|
parse(idSchema, id2);
|
|
4607
|
-
const page = () => parse(
|
|
4608
|
-
limit:
|
|
4609
|
-
offset:
|
|
4610
|
-
search:
|
|
4823
|
+
const page = () => parse(z4.object({
|
|
4824
|
+
limit: z4.coerce.number().int().min(1).max(1000).default(100),
|
|
4825
|
+
offset: z4.coerce.number().int().min(0).max(1e6).default(0),
|
|
4826
|
+
search: z4.string().max(200).default("")
|
|
4611
4827
|
}).strict(), Object.fromEntries(url.searchParams));
|
|
4612
4828
|
if (request.method === "GET") {
|
|
4613
4829
|
if (resource === "provider-presets" && parts.length <= 3)
|
|
@@ -4651,7 +4867,7 @@ function createHandler(store, apiKey, providerEnv = process.env, resolveCredenti
|
|
|
4651
4867
|
return json(replay.value, request.method === "POST" && ["providers", "profiles", "runs"].includes(resource) && !id2 ? 201 : 200);
|
|
4652
4868
|
let refreshed;
|
|
4653
4869
|
if (resource === "providers" && id2 && parts[3] === "refresh" && parts.length === 4 && request.method === "POST") {
|
|
4654
|
-
parse(
|
|
4870
|
+
parse(z4.object({}).strict(), body);
|
|
4655
4871
|
const provider = await store.get("providers", id2);
|
|
4656
4872
|
refreshed = { provider, catalog: await discover(provider, providerEnv, resolveCredential) };
|
|
4657
4873
|
}
|
|
@@ -4691,7 +4907,7 @@ function createHandler(store, apiKey, providerEnv = process.env, resolveCredenti
|
|
|
4691
4907
|
return store.put("catalogs", { id: id2, ...catalog }, old?.version, db);
|
|
4692
4908
|
}
|
|
4693
4909
|
if (resource === "launch-plans" && !id2 && request.method === "POST") {
|
|
4694
|
-
const { profileId } = parse(
|
|
4910
|
+
const { profileId } = parse(z4.object({ profileId: idSchema }).strict(), body);
|
|
4695
4911
|
const profile = await store.get("profiles", profileId, db);
|
|
4696
4912
|
const provider = await store.get("providers", profile.providerId, db);
|
|
4697
4913
|
validateHarnessProvider(profile.harness, provider);
|