@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/mcp/index.js
CHANGED
|
@@ -4,28 +4,32 @@
|
|
|
4
4
|
// src/mcp.ts
|
|
5
5
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
6
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
|
-
import { z as
|
|
7
|
+
import { z as z4 } from "zod";
|
|
8
8
|
|
|
9
9
|
// src/domain.ts
|
|
10
|
-
import { z as
|
|
10
|
+
import { z as z3 } from "zod";
|
|
11
11
|
|
|
12
|
-
// src/
|
|
12
|
+
// src/reasoning.ts
|
|
13
13
|
import { z } from "zod";
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var
|
|
14
|
+
var reasoningEffortSchema = z.enum(["none", "minimal", "low", "medium", "high", "xhigh", "max", "ultra"]);
|
|
15
|
+
|
|
16
|
+
// src/model-policy-schema.ts
|
|
17
|
+
import { z as z2 } from "zod";
|
|
18
|
+
var policyModelIdSchema = z2.string().min(1).max(300).regex(/^[^\u0000-\u001f\u007f]+$/);
|
|
19
|
+
var modelPolicyRoleSchema = z2.enum(["subagent", "fast", "planning", "review", "summary", "compaction", "weak", "editor"]);
|
|
20
|
+
var boundedModelList = z2.array(policyModelIdSchema).max(500);
|
|
21
|
+
var aliasSchema = z2.string().regex(/^[A-Za-z0-9._/-]{1,120}$/).refine((v) => !["__proto__", "prototype", "constructor"].includes(v));
|
|
22
|
+
var boundedModelMap = z2.record(aliasSchema, policyModelIdSchema).superRefine((value, ctx) => {
|
|
19
23
|
if (Object.keys(value).length > 200)
|
|
20
24
|
ctx.addIssue({ code: "custom", message: "Model policy maps may contain at most 200 entries." });
|
|
21
25
|
});
|
|
22
|
-
var fallbacksSchema =
|
|
26
|
+
var fallbacksSchema = z2.record(policyModelIdSchema, z2.array(policyModelIdSchema).max(20)).superRefine((value, ctx) => {
|
|
23
27
|
if (Object.keys(value).length > 200)
|
|
24
28
|
ctx.addIssue({ code: "custom", message: "Model policy fallback maps may contain at most 200 entries." });
|
|
25
29
|
});
|
|
26
|
-
var modelPolicySchema =
|
|
27
|
-
version:
|
|
28
|
-
roles:
|
|
30
|
+
var modelPolicySchema = z2.object({
|
|
31
|
+
version: z2.literal(1).default(1),
|
|
32
|
+
roles: z2.object({
|
|
29
33
|
subagent: policyModelIdSchema.optional(),
|
|
30
34
|
fast: policyModelIdSchema.optional(),
|
|
31
35
|
planning: policyModelIdSchema.optional(),
|
|
@@ -39,28 +43,29 @@ var modelPolicySchema = z.object({
|
|
|
39
43
|
aliases: boundedModelMap.optional(),
|
|
40
44
|
fallbacks: fallbacksSchema.optional()
|
|
41
45
|
}).strict();
|
|
42
|
-
var routingDecisionSchema =
|
|
43
|
-
var routingEventRoleSchema =
|
|
44
|
-
var routingEventSchema =
|
|
45
|
-
at:
|
|
46
|
-
requestId:
|
|
46
|
+
var routingDecisionSchema = z2.enum(["allow", "alias", "reject", "fallback"]);
|
|
47
|
+
var routingEventRoleSchema = z2.enum(["main", ...modelPolicyRoleSchema.options]);
|
|
48
|
+
var routingEventSchema = z2.object({
|
|
49
|
+
at: z2.string().datetime({ offset: true }),
|
|
50
|
+
requestId: z2.string().regex(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/),
|
|
47
51
|
requestedModel: policyModelIdSchema,
|
|
48
52
|
resolvedModel: policyModelIdSchema.optional(),
|
|
49
53
|
reportedModel: policyModelIdSchema.optional(),
|
|
54
|
+
reasoningEffort: reasoningEffortSchema.optional(),
|
|
50
55
|
decision: routingDecisionSchema,
|
|
51
56
|
role: routingEventRoleSchema.optional(),
|
|
52
|
-
reason:
|
|
53
|
-
upstreamStatus:
|
|
57
|
+
reason: z2.string().regex(/^[a-z][a-z0-9_]{0,63}$/).optional(),
|
|
58
|
+
upstreamStatus: z2.number().int().min(100).max(599).optional()
|
|
54
59
|
}).strict();
|
|
55
|
-
var routingEventsSchema =
|
|
60
|
+
var routingEventsSchema = z2.array(routingEventSchema).max(1000);
|
|
56
61
|
|
|
57
62
|
// src/domain.ts
|
|
58
|
-
var VERSION = "0.1.
|
|
59
|
-
var harnessSchema =
|
|
60
|
-
var protocolSchema =
|
|
61
|
-
var idSchema =
|
|
62
|
-
var label =
|
|
63
|
-
var envRef =
|
|
63
|
+
var VERSION = "0.1.9";
|
|
64
|
+
var harnessSchema = z3.enum(["claude", "codex", "grok", "opencode", "opencode2", "pi", "omp", "dsh", "cline", "hermes", "prime-agent", "gemini", "aider", "kilo"]);
|
|
65
|
+
var protocolSchema = z3.enum(["anthropic-messages", "openai-responses", "openai-chat", "gemini-generate-content"]);
|
|
66
|
+
var idSchema = z3.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$/);
|
|
67
|
+
var label = z3.string().min(1).max(200);
|
|
68
|
+
var envRef = z3.string().regex(/^SWITCHER_PROVIDER_[A-Z0-9_]+$/);
|
|
64
69
|
function endpoint(value) {
|
|
65
70
|
let url;
|
|
66
71
|
try {
|
|
@@ -73,85 +78,86 @@ function endpoint(value) {
|
|
|
73
78
|
throw new Fault(400, "invalid_url", "URL must use HTTPS, contain no credentials/query/fragment, or use HTTP on loopback.");
|
|
74
79
|
return url.href.replace(/\/+$/, "");
|
|
75
80
|
}
|
|
76
|
-
var urlSchema =
|
|
81
|
+
var urlSchema = z3.string().max(2000).superRefine((v, ctx) => {
|
|
77
82
|
try {
|
|
78
83
|
endpoint(v);
|
|
79
84
|
} catch {
|
|
80
85
|
ctx.addIssue({ code: "custom", message: "Invalid endpoint URL" });
|
|
81
86
|
}
|
|
82
87
|
}).transform(endpoint);
|
|
83
|
-
var expiresOnSchema =
|
|
88
|
+
var expiresOnSchema = z3.string().regex(/^\d{4}-\d{2}-\d{2}$/).refine((value) => {
|
|
84
89
|
const day = new Date(`${value}T00:00:00.000Z`);
|
|
85
90
|
return Number.isFinite(day.getTime()) && day.toISOString().slice(0, 10) === value;
|
|
86
91
|
}, "Use a real calendar date in YYYY-MM-DD format.");
|
|
87
|
-
var modelSchema =
|
|
88
|
-
id:
|
|
92
|
+
var modelSchema = z3.object({
|
|
93
|
+
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."),
|
|
89
94
|
name: label,
|
|
90
|
-
description:
|
|
91
|
-
available:
|
|
95
|
+
description: z3.string().max(8000).optional(),
|
|
96
|
+
available: z3.boolean().optional(),
|
|
92
97
|
expiresOn: expiresOnSchema.optional(),
|
|
93
|
-
contextWindow:
|
|
94
|
-
maxOutputTokens:
|
|
95
|
-
inputModalities:
|
|
96
|
-
outputModalities:
|
|
97
|
-
supportedParameters:
|
|
98
|
-
|
|
98
|
+
contextWindow: z3.number().int().positive().optional(),
|
|
99
|
+
maxOutputTokens: z3.number().int().positive().optional(),
|
|
100
|
+
inputModalities: z3.array(z3.string().max(50)).max(20).optional(),
|
|
101
|
+
outputModalities: z3.array(z3.string().max(50)).max(20).optional(),
|
|
102
|
+
supportedParameters: z3.array(z3.string().max(100)).max(100).optional(),
|
|
103
|
+
reasoningEfforts: z3.array(reasoningEffortSchema).max(8).optional(),
|
|
104
|
+
supportedGenerationMethods: z3.array(z3.string().min(1).max(100)).max(100).optional()
|
|
99
105
|
}).strict();
|
|
100
|
-
var providerInputSchema =
|
|
106
|
+
var providerInputSchema = z3.object({
|
|
101
107
|
id: idSchema,
|
|
102
108
|
name: label,
|
|
103
109
|
baseUrl: urlSchema,
|
|
104
110
|
protocol: protocolSchema,
|
|
105
111
|
credentialEnv: envRef.optional(),
|
|
106
|
-
authStyle:
|
|
112
|
+
authStyle: z3.enum(["bearer", "x-api-key", "api-key"]).default("bearer"),
|
|
107
113
|
catalogBaseUrl: urlSchema.optional(),
|
|
108
|
-
catalogFormat:
|
|
109
|
-
catalogAuthStyle:
|
|
114
|
+
catalogFormat: z3.enum(["openai", "ollama", "mistral", "together", "fireworks", "dashscope", "gemini", "none"]).optional(),
|
|
115
|
+
catalogAuthStyle: z3.enum(["bearer", "x-api-key", "api-key", "none"]).optional(),
|
|
110
116
|
catalogCredentialEnv: envRef.optional(),
|
|
111
|
-
catalogAccountId:
|
|
112
|
-
modelsPath:
|
|
113
|
-
manualModels:
|
|
114
|
-
additionalModels:
|
|
117
|
+
catalogAccountId: z3.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/).optional(),
|
|
118
|
+
modelsPath: z3.string().regex(/^[a-zA-Z0-9_/-]+$/).max(200).default("models"),
|
|
119
|
+
manualModels: z3.array(modelSchema).max(1e4).default([]),
|
|
120
|
+
additionalModels: z3.array(modelSchema).max(1e4).optional()
|
|
115
121
|
}).strict().refine((p) => !p.modelsPath.split("/").includes("..") && !p.modelsPath.startsWith("/"), "modelsPath must be relative");
|
|
116
|
-
var providerPresetSchema =
|
|
122
|
+
var providerPresetSchema = z3.object({
|
|
117
123
|
id: idSchema,
|
|
118
124
|
name: label,
|
|
119
125
|
credentialEnv: envRef.optional(),
|
|
120
|
-
credentialAliases:
|
|
121
|
-
protocols:
|
|
126
|
+
credentialAliases: z3.array(z3.string().regex(/^[A-Z][A-Z0-9_]+$/)),
|
|
127
|
+
protocols: z3.array(z3.object({
|
|
122
128
|
protocol: protocolSchema,
|
|
123
129
|
baseUrl: urlSchema.optional(),
|
|
124
|
-
authStyle:
|
|
130
|
+
authStyle: z3.enum(["bearer", "x-api-key", "api-key"]),
|
|
125
131
|
catalogBaseUrl: urlSchema.optional(),
|
|
126
|
-
catalogFormat:
|
|
127
|
-
catalogAuthStyle:
|
|
128
|
-
modelsPath:
|
|
129
|
-
notes:
|
|
132
|
+
catalogFormat: z3.enum(["openai", "ollama", "mistral", "together", "fireworks", "dashscope", "gemini", "none"]),
|
|
133
|
+
catalogAuthStyle: z3.enum(["bearer", "x-api-key", "api-key", "none"]).optional(),
|
|
134
|
+
modelsPath: z3.string(),
|
|
135
|
+
notes: z3.array(z3.string())
|
|
130
136
|
}).strict()).min(1),
|
|
131
|
-
sources:
|
|
132
|
-
verification:
|
|
137
|
+
sources: z3.array(z3.string().url()),
|
|
138
|
+
verification: z3.literal("documented")
|
|
133
139
|
}).strict();
|
|
134
|
-
var profileInputSchema =
|
|
140
|
+
var profileInputSchema = z3.object({
|
|
135
141
|
id: idSchema,
|
|
136
142
|
name: label,
|
|
137
143
|
providerId: idSchema,
|
|
138
144
|
harness: harnessSchema,
|
|
139
|
-
model:
|
|
145
|
+
model: z3.string().min(1).max(300),
|
|
140
146
|
modelPolicy: modelPolicySchema.optional()
|
|
141
147
|
}).strict();
|
|
142
|
-
var runInputSchema =
|
|
143
|
-
modelPolicyVersion:
|
|
148
|
+
var runInputSchema = z3.object({
|
|
149
|
+
modelPolicyVersion: z3.literal(1),
|
|
144
150
|
profileId: idSchema,
|
|
145
151
|
harness: harnessSchema,
|
|
146
|
-
model:
|
|
152
|
+
model: z3.string().min(1).max(300),
|
|
147
153
|
modelPolicy: modelPolicySchema.optional(),
|
|
148
|
-
planToken:
|
|
154
|
+
planToken: z3.string().regex(/^[a-f0-9]{64}$/)
|
|
149
155
|
}).strict();
|
|
150
|
-
var runUpdateSchema =
|
|
151
|
-
status:
|
|
152
|
-
exitCode:
|
|
156
|
+
var runUpdateSchema = z3.object({
|
|
157
|
+
status: z3.enum(["exited", "failed", "interrupted"]),
|
|
158
|
+
exitCode: z3.number().int().min(0).max(255),
|
|
153
159
|
routingEvents: routingEventsSchema.optional(),
|
|
154
|
-
routingEventsDropped:
|
|
160
|
+
routingEventsDropped: z3.number().int().min(0).max(1e6).optional()
|
|
155
161
|
}).strict();
|
|
156
162
|
|
|
157
163
|
class Fault extends Error {
|
|
@@ -229,8 +235,9 @@ var preset = (id, name, protocols, sources, alias) => parse(providerPresetSchema
|
|
|
229
235
|
var providerPresets = [
|
|
230
236
|
preset("deepseek", "DeepSeek", [
|
|
231
237
|
route("openai-chat", "https://api.deepseek.com", { catalogBaseUrl: "https://api.deepseek.com" }),
|
|
238
|
+
route("openai-responses", "https://api.deepseek.com", { catalogBaseUrl: "https://api.deepseek.com" }),
|
|
232
239
|
route("anthropic-messages", "https://api.deepseek.com/anthropic/v1", { catalogBaseUrl: "https://api.deepseek.com" })
|
|
233
|
-
], ["https://api-docs.deepseek.com/guides/anthropic_api", "https://api-docs.deepseek.com/api/list-models"], "DEEPSEEK_API_KEY"),
|
|
240
|
+
], ["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"),
|
|
234
241
|
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"),
|
|
235
242
|
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"),
|
|
236
243
|
preset("gemini", "Google Gemini", [route("gemini-generate-content", "https://generativelanguage.googleapis.com/v1beta", {
|
|
@@ -291,6 +298,36 @@ var providerPresets = [
|
|
|
291
298
|
preset("siliconflow", "SiliconFlow", [route("openai-chat", "https://api.siliconflow.cn/v1", { catalogBaseUrl: "https://api.siliconflow.cn/v1", catalogFormat: "openai", notes: ["The official SiliconCloud OpenAPI contract defines GET /models with Bearer auth and data[] model rows; optional type and sub_type filters are available at the upstream endpoint."] })], ["https://github.com/siliconflow/siliconcloud/blob/main/openapi.yaml", "https://docs.siliconflow.cn/docs/userguide/quickstart", "https://docs.siliconflow.cn/docs/api/chat-completions-post"], "SILICONFLOW_API_KEY"),
|
|
292
299
|
...["anthropic-messages", "openai-responses", "openai-chat"].map((protocol) => preset(`generic-${protocol}`, `Custom ${protocol}`, [route(protocol)], []))
|
|
293
300
|
];
|
|
301
|
+
// src/desktop-apps.ts
|
|
302
|
+
import { execFile } from "child_process";
|
|
303
|
+
import { access, stat } from "fs/promises";
|
|
304
|
+
import { constants } from "fs";
|
|
305
|
+
import { homedir } from "os";
|
|
306
|
+
import { promisify } from "util";
|
|
307
|
+
var execute = promisify(execFile);
|
|
308
|
+
var host = {
|
|
309
|
+
platform: process.platform,
|
|
310
|
+
home: homedir(),
|
|
311
|
+
async run(command, args) {
|
|
312
|
+
const { stdout } = await execute(command, args, { encoding: "utf8", timeout: 8000, maxBuffer: 64 * 1024, env: { PATH: "/usr/bin:/bin", HOME: homedir() } });
|
|
313
|
+
return stdout.trim();
|
|
314
|
+
},
|
|
315
|
+
async executable(path) {
|
|
316
|
+
try {
|
|
317
|
+
await access(path, constants.X_OK);
|
|
318
|
+
return (await stat(path)).isFile();
|
|
319
|
+
} catch {
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
async isDirectory(path) {
|
|
324
|
+
try {
|
|
325
|
+
return (await stat(path)).isDirectory();
|
|
326
|
+
} catch {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
};
|
|
294
331
|
|
|
295
332
|
// src/sdk.ts
|
|
296
333
|
class SwitcherError extends Error {
|
|
@@ -438,6 +475,33 @@ class SwitcherClient {
|
|
|
438
475
|
deleteProvider(id, version, idempotencyKey) {
|
|
439
476
|
return this.request("DELETE", `/v1/providers/${encodeURIComponent(id)}`, undefined, { version, idempotencyKey });
|
|
440
477
|
}
|
|
478
|
+
async editModel(providerId, operation, value) {
|
|
479
|
+
const model = typeof value === "string" ? undefined : parse(modelSchema, value);
|
|
480
|
+
const id = model?.id ?? parse(modelSchema.shape.id, value);
|
|
481
|
+
const provider = await this.getProvider(providerId);
|
|
482
|
+
const { version, updatedAt, ...input } = provider;
|
|
483
|
+
const manual = provider.manualModels.some((item) => item.id === id);
|
|
484
|
+
const additional = (provider.additionalModels ?? []).some((item) => item.id === id);
|
|
485
|
+
if (operation === "add" && (manual || additional))
|
|
486
|
+
throw new SwitcherError(409, "model_exists", "This model is already configured. Use models update to replace its metadata.");
|
|
487
|
+
if (operation !== "add" && !manual && !additional)
|
|
488
|
+
throw new SwitcherError(404, "model_not_configured", "This model has no saved metadata. Use models add to configure a catalog model; remote catalog entries cannot be deleted locally.");
|
|
489
|
+
const useManual = manual || !additional && (provider.manualModels.length > 0 || provider.catalogFormat === "none");
|
|
490
|
+
const manualModels = provider.manualModels.filter((item) => item.id !== id);
|
|
491
|
+
const additionalModels = (provider.additionalModels ?? []).filter((item) => item.id !== id);
|
|
492
|
+
if (operation !== "remove")
|
|
493
|
+
(useManual ? manualModels : additionalModels).push(model);
|
|
494
|
+
return this.updateProvider({ ...input, manualModels, additionalModels }, version);
|
|
495
|
+
}
|
|
496
|
+
addModel(providerId, model) {
|
|
497
|
+
return this.editModel(providerId, "add", model);
|
|
498
|
+
}
|
|
499
|
+
updateModel(providerId, model) {
|
|
500
|
+
return this.editModel(providerId, "update", model);
|
|
501
|
+
}
|
|
502
|
+
removeModel(providerId, modelId) {
|
|
503
|
+
return this.editModel(providerId, "remove", modelId);
|
|
504
|
+
}
|
|
441
505
|
refreshModels(id, idempotencyKey) {
|
|
442
506
|
return this.request("POST", `/v1/providers/${encodeURIComponent(id)}/refresh`, {}, { idempotencyKey });
|
|
443
507
|
}
|
|
@@ -481,7 +545,7 @@ function clientFromEnv(env = process.env, options = {}) {
|
|
|
481
545
|
|
|
482
546
|
// src/mcp.ts
|
|
483
547
|
var server = new McpServer({ name: "switcher", version: VERSION });
|
|
484
|
-
var page = { limit:
|
|
548
|
+
var page = { limit: z4.number().int().min(1).max(1000).optional(), offset: z4.number().int().nonnegative().optional(), search: z4.string().optional() };
|
|
485
549
|
function tool(name, description, schema, run) {
|
|
486
550
|
server.tool(name, description, schema, async (input) => {
|
|
487
551
|
try {
|
|
@@ -492,23 +556,26 @@ function tool(name, description, schema, run) {
|
|
|
492
556
|
});
|
|
493
557
|
}
|
|
494
558
|
tool("providers_list", "List provider profiles.", page, (p) => clientFromEnv().listProviders(p));
|
|
495
|
-
tool("providers_get", "Get a provider.", { id:
|
|
559
|
+
tool("providers_get", "Get a provider.", { id: z4.string() }, (p) => clientFromEnv().getProvider(p.id));
|
|
496
560
|
tool("providers_create", "Create a provider using credential environment references only.", providerInputSchema.innerType().shape, (p) => clientFromEnv().createProvider(p));
|
|
497
|
-
tool("providers_update", "Replace a provider at its current version.", { provider: providerInputSchema, version:
|
|
498
|
-
tool("providers_delete", "Delete an unreferenced provider.", { id:
|
|
499
|
-
tool("models_list", "List catalog with capability information.", { id:
|
|
561
|
+
tool("providers_update", "Replace a provider at its current version.", { provider: providerInputSchema, version: z4.number().int() }, (p) => clientFromEnv().updateProvider(p.provider, p.version));
|
|
562
|
+
tool("providers_delete", "Delete an unreferenced provider.", { id: z4.string(), version: z4.number().int() }, (p) => clientFromEnv().deleteProvider(p.id, p.version));
|
|
563
|
+
tool("models_list", "List catalog with capability information.", { id: z4.string(), ...page }, (p) => {
|
|
500
564
|
const { id, ...rest } = p;
|
|
501
565
|
return clientFromEnv().listModels(id, rest);
|
|
502
566
|
});
|
|
503
|
-
tool("
|
|
567
|
+
tool("models_add", "Add saved model metadata; discovery stays active unless the provider uses a manual catalog.", { providerId: z4.string(), model: modelSchema }, (p) => clientFromEnv().addModel(p.providerId, p.model));
|
|
568
|
+
tool("models_update", "Replace all saved metadata for a configured model.", { providerId: z4.string(), model: modelSchema }, (p) => clientFromEnv().updateModel(p.providerId, p.model));
|
|
569
|
+
tool("models_remove", "Remove saved model metadata; upstream catalog entries remain.", { providerId: z4.string(), modelId: modelSchema.shape.id }, (p) => clientFromEnv().removeModel(p.providerId, p.modelId));
|
|
570
|
+
tool("models_refresh", "Discover provider models.", { id: z4.string() }, (p) => clientFromEnv().refreshModels(p.id));
|
|
504
571
|
tool("profiles_list", "List harness launch profiles.", page, (p) => clientFromEnv().listProfiles(p));
|
|
505
|
-
tool("profiles_get", "Get a harness profile.", { id:
|
|
572
|
+
tool("profiles_get", "Get a harness profile.", { id: z4.string() }, (p) => clientFromEnv().getProfile(p.id));
|
|
506
573
|
tool("profiles_create", "Create a harness launch profile.", profileInputSchema.shape, (p) => clientFromEnv().createProfile(p));
|
|
507
|
-
tool("profiles_update", "Replace a harness profile at its version.", { profile: profileInputSchema, version:
|
|
508
|
-
tool("profiles_delete", "Delete a profile without run history.", { id:
|
|
509
|
-
tool("launch_plan", "Validate a local launch plan; does not execute a remote process.", { profileId:
|
|
574
|
+
tool("profiles_update", "Replace a harness profile at its version.", { profile: profileInputSchema, version: z4.number().int() }, (p) => clientFromEnv().updateProfile(p.profile, p.version));
|
|
575
|
+
tool("profiles_delete", "Delete a profile without run history.", { id: z4.string(), version: z4.number().int() }, (p) => clientFromEnv().deleteProfile(p.id, p.version));
|
|
576
|
+
tool("launch_plan", "Validate a local launch plan; does not execute a remote process.", { profileId: z4.string() }, (p) => clientFromEnv().launchPlan(p.profileId));
|
|
510
577
|
tool("runs_list", "List launch metadata.", page, (p) => clientFromEnv().listRuns(p));
|
|
511
|
-
tool("runs_get", "Get launch metadata.", { id:
|
|
578
|
+
tool("runs_get", "Get launch metadata.", { id: z4.string() }, (p) => clientFromEnv().getRun(p.id));
|
|
512
579
|
if (process.argv.includes("--version"))
|
|
513
580
|
console.log(VERSION);
|
|
514
581
|
else if (process.argv.includes("--help"))
|
|
@@ -76,6 +76,7 @@ export declare const routingEventSchema: z.ZodObject<{
|
|
|
76
76
|
requestedModel: z.ZodString;
|
|
77
77
|
resolvedModel: z.ZodOptional<z.ZodString>;
|
|
78
78
|
reportedModel: z.ZodOptional<z.ZodString>;
|
|
79
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<["none", "minimal", "low", "medium", "high", "xhigh", "max", "ultra"]>>;
|
|
79
80
|
decision: z.ZodEnum<["allow", "alias", "reject", "fallback"]>;
|
|
80
81
|
role: z.ZodOptional<z.ZodEnum<["main", "subagent", "fast", "planning", "review", "summary", "compaction", "weak", "editor"]>>;
|
|
81
82
|
reason: z.ZodOptional<z.ZodString>;
|
|
@@ -87,6 +88,7 @@ export declare const routingEventSchema: z.ZodObject<{
|
|
|
87
88
|
decision: "allow" | "alias" | "reject" | "fallback";
|
|
88
89
|
resolvedModel?: string | undefined;
|
|
89
90
|
reportedModel?: string | undefined;
|
|
91
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra" | undefined;
|
|
90
92
|
role?: "main" | "subagent" | "fast" | "planning" | "review" | "summary" | "compaction" | "weak" | "editor" | undefined;
|
|
91
93
|
reason?: string | undefined;
|
|
92
94
|
upstreamStatus?: number | undefined;
|
|
@@ -97,6 +99,7 @@ export declare const routingEventSchema: z.ZodObject<{
|
|
|
97
99
|
decision: "allow" | "alias" | "reject" | "fallback";
|
|
98
100
|
resolvedModel?: string | undefined;
|
|
99
101
|
reportedModel?: string | undefined;
|
|
102
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra" | undefined;
|
|
100
103
|
role?: "main" | "subagent" | "fast" | "planning" | "review" | "summary" | "compaction" | "weak" | "editor" | undefined;
|
|
101
104
|
reason?: string | undefined;
|
|
102
105
|
upstreamStatus?: number | undefined;
|
|
@@ -108,6 +111,7 @@ export declare const routingEventsSchema: z.ZodArray<z.ZodObject<{
|
|
|
108
111
|
requestedModel: z.ZodString;
|
|
109
112
|
resolvedModel: z.ZodOptional<z.ZodString>;
|
|
110
113
|
reportedModel: z.ZodOptional<z.ZodString>;
|
|
114
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<["none", "minimal", "low", "medium", "high", "xhigh", "max", "ultra"]>>;
|
|
111
115
|
decision: z.ZodEnum<["allow", "alias", "reject", "fallback"]>;
|
|
112
116
|
role: z.ZodOptional<z.ZodEnum<["main", "subagent", "fast", "planning", "review", "summary", "compaction", "weak", "editor"]>>;
|
|
113
117
|
reason: z.ZodOptional<z.ZodString>;
|
|
@@ -119,6 +123,7 @@ export declare const routingEventsSchema: z.ZodArray<z.ZodObject<{
|
|
|
119
123
|
decision: "allow" | "alias" | "reject" | "fallback";
|
|
120
124
|
resolvedModel?: string | undefined;
|
|
121
125
|
reportedModel?: string | undefined;
|
|
126
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra" | undefined;
|
|
122
127
|
role?: "main" | "subagent" | "fast" | "planning" | "review" | "summary" | "compaction" | "weak" | "editor" | undefined;
|
|
123
128
|
reason?: string | undefined;
|
|
124
129
|
upstreamStatus?: number | undefined;
|
|
@@ -129,6 +134,7 @@ export declare const routingEventsSchema: z.ZodArray<z.ZodObject<{
|
|
|
129
134
|
decision: "allow" | "alias" | "reject" | "fallback";
|
|
130
135
|
resolvedModel?: string | undefined;
|
|
131
136
|
reportedModel?: string | undefined;
|
|
137
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra" | undefined;
|
|
132
138
|
role?: "main" | "subagent" | "fast" | "planning" | "review" | "summary" | "compaction" | "weak" | "editor" | undefined;
|
|
133
139
|
reason?: string | undefined;
|
|
134
140
|
upstreamStatus?: number | undefined;
|
package/dist/presets.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export declare function providerFromPreset(presetId: string, options?: PresetOpt
|
|
|
51
51
|
inputModalities?: string[] | undefined;
|
|
52
52
|
outputModalities?: string[] | undefined;
|
|
53
53
|
supportedParameters?: string[] | undefined;
|
|
54
|
+
reasoningEfforts?: ("none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra")[] | undefined;
|
|
54
55
|
supportedGenerationMethods?: string[] | undefined;
|
|
55
56
|
}[];
|
|
56
57
|
credentialEnv?: string | undefined;
|
|
@@ -70,6 +71,7 @@ export declare function providerFromPreset(presetId: string, options?: PresetOpt
|
|
|
70
71
|
inputModalities?: string[] | undefined;
|
|
71
72
|
outputModalities?: string[] | undefined;
|
|
72
73
|
supportedParameters?: string[] | undefined;
|
|
74
|
+
reasoningEfforts?: ("none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra")[] | undefined;
|
|
73
75
|
supportedGenerationMethods?: string[] | undefined;
|
|
74
76
|
}[] | undefined;
|
|
75
77
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { Model } from "./domain";
|
|
3
|
+
export declare const reasoningEffortSchema: z.ZodEnum<["none", "minimal", "low", "medium", "high", "xhigh", "max", "ultra"]>;
|
|
4
|
+
export type ReasoningEffort = z.infer<typeof reasoningEffortSchema>;
|
|
5
|
+
/** Advertise declared capabilities, documented DeepSeek levels, or an explicit
|
|
6
|
+
* operator selection. Do not invent a complete effort menu for arbitrary models. */
|
|
7
|
+
export declare function codexReasoning(model: Model, baseUrl: string, selected?: ReasoningEffort): {
|
|
8
|
+
levels: ("none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra")[];
|
|
9
|
+
defaultEffort: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra";
|
|
10
|
+
};
|