@hasna/switcher 0.2.18 → 0.2.19
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/Dockerfile +6 -1
- package/README.md +1 -1
- package/dist/claude-desktop.js +19180 -3734
- package/dist/cli/index.js +613 -319
- package/dist/codex-state-bridge.js +4 -4
- package/dist/credentials.d.ts +36 -184
- package/dist/domain.d.ts +271 -737
- package/dist/gateway-service.d.ts +3 -1
- package/dist/index.js +19122 -3676
- package/dist/inference-gateway.d.ts +2 -0
- package/dist/mcp/index.js +19611 -4119
- package/dist/model-policy-schema.d.ts +93 -112
- package/dist/opencode2-config.d.ts +8 -12
- package/dist/presets.d.ts +2 -2
- package/dist/process-table.d.ts +7 -0
- package/dist/reasoning.d.ts +11 -2
- package/dist/sdk.js +19122 -3676
- package/dist/serve/index.js +269 -223
- package/docs/GATEWAY-SERVICE.md +66 -30
- package/openapi.json +264 -218
- package/package.json +8 -5
|
@@ -1,11 +1,23 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
1
|
+
import { z } from "zod-v4";
|
|
2
2
|
/** Model references are opaque provider IDs, never prompts or credentials. */
|
|
3
3
|
export declare const policyModelIdSchema: z.ZodString;
|
|
4
|
-
export declare const modelPolicyRoleSchema: z.ZodEnum<
|
|
4
|
+
export declare const modelPolicyRoleSchema: z.ZodEnum<{
|
|
5
|
+
subagent: "subagent";
|
|
6
|
+
fast: "fast";
|
|
7
|
+
planning: "planning";
|
|
8
|
+
review: "review";
|
|
9
|
+
summary: "summary";
|
|
10
|
+
compaction: "compaction";
|
|
11
|
+
weak: "weak";
|
|
12
|
+
editor: "editor";
|
|
13
|
+
}>;
|
|
5
14
|
export type ModelPolicyRole = z.infer<typeof modelPolicyRoleSchema>;
|
|
6
15
|
export declare const modelPolicySchema: z.ZodObject<{
|
|
7
16
|
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
8
|
-
selection: z.ZodOptional<z.ZodEnum<
|
|
17
|
+
selection: z.ZodOptional<z.ZodEnum<{
|
|
18
|
+
restricted: "restricted";
|
|
19
|
+
catalog: "catalog";
|
|
20
|
+
}>>;
|
|
9
21
|
roles: z.ZodOptional<z.ZodObject<{
|
|
10
22
|
subagent: z.ZodOptional<z.ZodString>;
|
|
11
23
|
fast: z.ZodOptional<z.ZodString>;
|
|
@@ -15,98 +27,65 @@ export declare const modelPolicySchema: z.ZodObject<{
|
|
|
15
27
|
compaction: z.ZodOptional<z.ZodString>;
|
|
16
28
|
weak: z.ZodOptional<z.ZodString>;
|
|
17
29
|
editor: z.ZodOptional<z.ZodString>;
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
summary?: string | undefined;
|
|
24
|
-
compaction?: string | undefined;
|
|
25
|
-
weak?: string | undefined;
|
|
26
|
-
editor?: string | undefined;
|
|
27
|
-
}, {
|
|
28
|
-
subagent?: string | undefined;
|
|
29
|
-
fast?: string | undefined;
|
|
30
|
-
planning?: string | undefined;
|
|
31
|
-
review?: string | undefined;
|
|
32
|
-
summary?: string | undefined;
|
|
33
|
-
compaction?: string | undefined;
|
|
34
|
-
weak?: string | undefined;
|
|
35
|
-
editor?: string | undefined;
|
|
36
|
-
}>>;
|
|
37
|
-
allowedModels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
38
|
-
aliases: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodEffects<z.ZodString, string, string>, z.ZodString>, Record<string, string>, Record<string, string>>>;
|
|
39
|
-
fallbacks: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>, Record<string, string[]>, Record<string, string[]>>>;
|
|
40
|
-
}, "strict", z.ZodTypeAny, {
|
|
41
|
-
version: 1;
|
|
42
|
-
selection?: "restricted" | "catalog" | undefined;
|
|
43
|
-
roles?: {
|
|
44
|
-
subagent?: string | undefined;
|
|
45
|
-
fast?: string | undefined;
|
|
46
|
-
planning?: string | undefined;
|
|
47
|
-
review?: string | undefined;
|
|
48
|
-
summary?: string | undefined;
|
|
49
|
-
compaction?: string | undefined;
|
|
50
|
-
weak?: string | undefined;
|
|
51
|
-
editor?: string | undefined;
|
|
52
|
-
} | undefined;
|
|
53
|
-
allowedModels?: string[] | undefined;
|
|
54
|
-
aliases?: Record<string, string> | undefined;
|
|
55
|
-
fallbacks?: Record<string, string[]> | undefined;
|
|
56
|
-
}, {
|
|
57
|
-
version?: 1 | undefined;
|
|
58
|
-
selection?: "restricted" | "catalog" | undefined;
|
|
59
|
-
roles?: {
|
|
60
|
-
subagent?: string | undefined;
|
|
61
|
-
fast?: string | undefined;
|
|
62
|
-
planning?: string | undefined;
|
|
63
|
-
review?: string | undefined;
|
|
64
|
-
summary?: string | undefined;
|
|
65
|
-
compaction?: string | undefined;
|
|
66
|
-
weak?: string | undefined;
|
|
67
|
-
editor?: string | undefined;
|
|
68
|
-
} | undefined;
|
|
69
|
-
allowedModels?: string[] | undefined;
|
|
70
|
-
aliases?: Record<string, string> | undefined;
|
|
71
|
-
fallbacks?: Record<string, string[]> | undefined;
|
|
72
|
-
}>;
|
|
30
|
+
}, z.core.$strict>>;
|
|
31
|
+
allowedModels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
32
|
+
aliases: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
33
|
+
fallbacks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
34
|
+
}, z.core.$strict>;
|
|
73
35
|
export type ModelPolicy = z.infer<typeof modelPolicySchema>;
|
|
74
|
-
export declare const routingDecisionSchema: z.ZodEnum<
|
|
75
|
-
|
|
36
|
+
export declare const routingDecisionSchema: z.ZodEnum<{
|
|
37
|
+
allow: "allow";
|
|
38
|
+
alias: "alias";
|
|
39
|
+
reject: "reject";
|
|
40
|
+
fallback: "fallback";
|
|
41
|
+
}>;
|
|
42
|
+
export declare const routingEventRoleSchema: z.ZodEnum<{
|
|
43
|
+
main: "main";
|
|
44
|
+
subagent: "subagent";
|
|
45
|
+
fast: "fast";
|
|
46
|
+
planning: "planning";
|
|
47
|
+
review: "review";
|
|
48
|
+
summary: "summary";
|
|
49
|
+
compaction: "compaction";
|
|
50
|
+
weak: "weak";
|
|
51
|
+
editor: "editor";
|
|
52
|
+
}>;
|
|
76
53
|
export declare const routingEventSchema: z.ZodObject<{
|
|
77
54
|
at: z.ZodString;
|
|
78
55
|
requestId: z.ZodString;
|
|
79
56
|
requestedModel: z.ZodString;
|
|
80
57
|
resolvedModel: z.ZodOptional<z.ZodString>;
|
|
81
58
|
reportedModel: z.ZodOptional<z.ZodString>;
|
|
82
|
-
reasoningEffort: z.ZodOptional<z.ZodEnum<
|
|
83
|
-
|
|
84
|
-
|
|
59
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
60
|
+
none: "none";
|
|
61
|
+
minimal: "minimal";
|
|
62
|
+
low: "low";
|
|
63
|
+
medium: "medium";
|
|
64
|
+
high: "high";
|
|
65
|
+
xhigh: "xhigh";
|
|
66
|
+
max: "max";
|
|
67
|
+
ultra: "ultra";
|
|
68
|
+
}>>;
|
|
69
|
+
decision: z.ZodEnum<{
|
|
70
|
+
allow: "allow";
|
|
71
|
+
alias: "alias";
|
|
72
|
+
reject: "reject";
|
|
73
|
+
fallback: "fallback";
|
|
74
|
+
}>;
|
|
75
|
+
role: z.ZodOptional<z.ZodEnum<{
|
|
76
|
+
main: "main";
|
|
77
|
+
subagent: "subagent";
|
|
78
|
+
fast: "fast";
|
|
79
|
+
planning: "planning";
|
|
80
|
+
review: "review";
|
|
81
|
+
summary: "summary";
|
|
82
|
+
compaction: "compaction";
|
|
83
|
+
weak: "weak";
|
|
84
|
+
editor: "editor";
|
|
85
|
+
}>>;
|
|
85
86
|
reason: z.ZodOptional<z.ZodString>;
|
|
86
87
|
upstreamStatus: z.ZodOptional<z.ZodNumber>;
|
|
87
|
-
},
|
|
88
|
-
at: string;
|
|
89
|
-
requestId: string;
|
|
90
|
-
requestedModel: string;
|
|
91
|
-
decision: "allow" | "alias" | "reject" | "fallback";
|
|
92
|
-
resolvedModel?: string | undefined;
|
|
93
|
-
reportedModel?: string | undefined;
|
|
94
|
-
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra" | undefined;
|
|
95
|
-
role?: "main" | "subagent" | "fast" | "planning" | "review" | "summary" | "compaction" | "weak" | "editor" | undefined;
|
|
96
|
-
reason?: string | undefined;
|
|
97
|
-
upstreamStatus?: number | undefined;
|
|
98
|
-
}, {
|
|
99
|
-
at: string;
|
|
100
|
-
requestId: string;
|
|
101
|
-
requestedModel: string;
|
|
102
|
-
decision: "allow" | "alias" | "reject" | "fallback";
|
|
103
|
-
resolvedModel?: string | undefined;
|
|
104
|
-
reportedModel?: string | undefined;
|
|
105
|
-
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra" | undefined;
|
|
106
|
-
role?: "main" | "subagent" | "fast" | "planning" | "review" | "summary" | "compaction" | "weak" | "editor" | undefined;
|
|
107
|
-
reason?: string | undefined;
|
|
108
|
-
upstreamStatus?: number | undefined;
|
|
109
|
-
}>;
|
|
88
|
+
}, z.core.$strict>;
|
|
110
89
|
export type RoutingEvent = z.infer<typeof routingEventSchema>;
|
|
111
90
|
export declare const routingEventsSchema: z.ZodArray<z.ZodObject<{
|
|
112
91
|
at: z.ZodString;
|
|
@@ -114,33 +93,35 @@ export declare const routingEventsSchema: z.ZodArray<z.ZodObject<{
|
|
|
114
93
|
requestedModel: z.ZodString;
|
|
115
94
|
resolvedModel: z.ZodOptional<z.ZodString>;
|
|
116
95
|
reportedModel: z.ZodOptional<z.ZodString>;
|
|
117
|
-
reasoningEffort: z.ZodOptional<z.ZodEnum<
|
|
118
|
-
|
|
119
|
-
|
|
96
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
97
|
+
none: "none";
|
|
98
|
+
minimal: "minimal";
|
|
99
|
+
low: "low";
|
|
100
|
+
medium: "medium";
|
|
101
|
+
high: "high";
|
|
102
|
+
xhigh: "xhigh";
|
|
103
|
+
max: "max";
|
|
104
|
+
ultra: "ultra";
|
|
105
|
+
}>>;
|
|
106
|
+
decision: z.ZodEnum<{
|
|
107
|
+
allow: "allow";
|
|
108
|
+
alias: "alias";
|
|
109
|
+
reject: "reject";
|
|
110
|
+
fallback: "fallback";
|
|
111
|
+
}>;
|
|
112
|
+
role: z.ZodOptional<z.ZodEnum<{
|
|
113
|
+
main: "main";
|
|
114
|
+
subagent: "subagent";
|
|
115
|
+
fast: "fast";
|
|
116
|
+
planning: "planning";
|
|
117
|
+
review: "review";
|
|
118
|
+
summary: "summary";
|
|
119
|
+
compaction: "compaction";
|
|
120
|
+
weak: "weak";
|
|
121
|
+
editor: "editor";
|
|
122
|
+
}>>;
|
|
120
123
|
reason: z.ZodOptional<z.ZodString>;
|
|
121
124
|
upstreamStatus: z.ZodOptional<z.ZodNumber>;
|
|
122
|
-
},
|
|
123
|
-
at: string;
|
|
124
|
-
requestId: string;
|
|
125
|
-
requestedModel: string;
|
|
126
|
-
decision: "allow" | "alias" | "reject" | "fallback";
|
|
127
|
-
resolvedModel?: string | undefined;
|
|
128
|
-
reportedModel?: string | undefined;
|
|
129
|
-
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra" | undefined;
|
|
130
|
-
role?: "main" | "subagent" | "fast" | "planning" | "review" | "summary" | "compaction" | "weak" | "editor" | undefined;
|
|
131
|
-
reason?: string | undefined;
|
|
132
|
-
upstreamStatus?: number | undefined;
|
|
133
|
-
}, {
|
|
134
|
-
at: string;
|
|
135
|
-
requestId: string;
|
|
136
|
-
requestedModel: string;
|
|
137
|
-
decision: "allow" | "alias" | "reject" | "fallback";
|
|
138
|
-
resolvedModel?: string | undefined;
|
|
139
|
-
reportedModel?: string | undefined;
|
|
140
|
-
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra" | undefined;
|
|
141
|
-
role?: "main" | "subagent" | "fast" | "planning" | "review" | "summary" | "compaction" | "weak" | "editor" | undefined;
|
|
142
|
-
reason?: string | undefined;
|
|
143
|
-
upstreamStatus?: number | undefined;
|
|
144
|
-
}>, "many">;
|
|
125
|
+
}, z.core.$strict>>;
|
|
145
126
|
/** Stable object-key order; ordered fallback arrays retain their precedence. */
|
|
146
127
|
export declare function canonicalPolicyJSON(value: unknown): string;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
1
|
+
import { z } from "zod-v4";
|
|
2
2
|
declare const rule: z.ZodObject<{
|
|
3
3
|
action: z.ZodString;
|
|
4
4
|
resource: z.ZodString;
|
|
5
|
-
effect: z.ZodEnum<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
effect: "allow" | "deny" | "ask";
|
|
12
|
-
action: string;
|
|
13
|
-
resource: string;
|
|
14
|
-
}>;
|
|
5
|
+
effect: z.ZodEnum<{
|
|
6
|
+
allow: "allow";
|
|
7
|
+
deny: "deny";
|
|
8
|
+
ask: "ask";
|
|
9
|
+
}>;
|
|
10
|
+
}, z.core.$strict>;
|
|
15
11
|
type Rule = z.infer<typeof rule>;
|
|
16
12
|
type Agent = {
|
|
17
13
|
system?: string;
|
|
@@ -35,9 +31,9 @@ export declare function isolateOpenCode2(cwd: string, stateDir: string, provider
|
|
|
35
31
|
};
|
|
36
32
|
default_agent?: string | undefined;
|
|
37
33
|
permissions: {
|
|
38
|
-
effect: "allow" | "deny" | "ask";
|
|
39
34
|
action: string;
|
|
40
35
|
resource: string;
|
|
36
|
+
effect: "allow" | "deny" | "ask";
|
|
41
37
|
}[];
|
|
42
38
|
agents: Record<string, Agent>;
|
|
43
39
|
};
|
package/dist/presets.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ export declare function getProviderPreset(id: string): {
|
|
|
13
13
|
notes: string[];
|
|
14
14
|
baseUrl?: string | undefined;
|
|
15
15
|
credentialCheck?: {
|
|
16
|
-
path: string;
|
|
17
16
|
method: "GET" | "HEAD";
|
|
17
|
+
path: string;
|
|
18
18
|
} | undefined;
|
|
19
19
|
catalogBaseUrl?: string | undefined;
|
|
20
20
|
catalogAuthStyle?: "bearer" | "x-api-key" | "api-key" | "none" | undefined;
|
|
@@ -60,8 +60,8 @@ export declare function providerFromPreset(presetId: string, options?: PresetOpt
|
|
|
60
60
|
}[];
|
|
61
61
|
credentialEnv?: string | undefined;
|
|
62
62
|
credentialCheck?: {
|
|
63
|
-
path: string;
|
|
64
63
|
method: "GET" | "HEAD";
|
|
64
|
+
path: string;
|
|
65
65
|
} | undefined;
|
|
66
66
|
catalogBaseUrl?: string | undefined;
|
|
67
67
|
catalogFormat?: "openai" | "ollama" | "mistral" | "together" | "fireworks" | "dashscope" | "gemini" | "none" | undefined;
|
package/dist/process-table.d.ts
CHANGED
|
@@ -26,3 +26,10 @@ export type EnvironmentDigestProbe = (pids: number[], digest: string) => Promise
|
|
|
26
26
|
* Only the user's own processes are readable. Unsupported platforms find nothing.
|
|
27
27
|
*/
|
|
28
28
|
export declare function processesHoldingTokenDigest(pids: number[], digest: string): Promise<number[]>;
|
|
29
|
+
/**
|
|
30
|
+
* The PIDs of this user's processes at the client end of an established loopback TCP
|
|
31
|
+
* connection from `clientPort` to `serverPort`. Other users' processes are never
|
|
32
|
+
* returned. Unsupported platforms, and any read that fails, find nothing.
|
|
33
|
+
*/
|
|
34
|
+
export type ConnectionPeerLookup = (clientPort: number, serverPort: number) => Promise<number[]>;
|
|
35
|
+
export declare const loopbackPeers: ConnectionPeerLookup;
|
package/dist/reasoning.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
1
|
+
import { z } from "zod-v4";
|
|
2
2
|
import type { Model } from "./domain";
|
|
3
|
-
export declare const reasoningEffortSchema: z.ZodEnum<
|
|
3
|
+
export declare const reasoningEffortSchema: z.ZodEnum<{
|
|
4
|
+
none: "none";
|
|
5
|
+
minimal: "minimal";
|
|
6
|
+
low: "low";
|
|
7
|
+
medium: "medium";
|
|
8
|
+
high: "high";
|
|
9
|
+
xhigh: "xhigh";
|
|
10
|
+
max: "max";
|
|
11
|
+
ultra: "ultra";
|
|
12
|
+
}>;
|
|
4
13
|
export type ReasoningEffort = z.infer<typeof reasoningEffortSchema>;
|
|
5
14
|
/** Advertise declared capabilities, documented DeepSeek levels, or an explicit
|
|
6
15
|
* operator selection. Do not invent a complete effort menu for arbitrary models. */
|