@hasna/switcher 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export declare function main(args?: string[]): Promise<void>;
@@ -0,0 +1,231 @@
1
+ import { z } from "zod";
2
+ export declare const VERSION = "0.1.0";
3
+ export declare const harnessSchema: z.ZodEnum<["claude", "codex", "grok", "opencode2"]>;
4
+ export declare const protocolSchema: z.ZodEnum<["anthropic-messages", "openai-responses", "openai-chat"]>;
5
+ export declare const idSchema: z.ZodString;
6
+ export declare function endpoint(value: string): string;
7
+ export declare const modelSchema: z.ZodObject<{
8
+ id: z.ZodString;
9
+ name: z.ZodString;
10
+ description: z.ZodOptional<z.ZodString>;
11
+ contextWindow: z.ZodOptional<z.ZodNumber>;
12
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
13
+ inputModalities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
14
+ outputModalities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
15
+ supportedParameters: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
16
+ }, "strict", z.ZodTypeAny, {
17
+ id: string;
18
+ name: string;
19
+ description?: string | undefined;
20
+ contextWindow?: number | undefined;
21
+ maxOutputTokens?: number | undefined;
22
+ inputModalities?: string[] | undefined;
23
+ outputModalities?: string[] | undefined;
24
+ supportedParameters?: string[] | undefined;
25
+ }, {
26
+ id: string;
27
+ name: string;
28
+ description?: string | undefined;
29
+ contextWindow?: number | undefined;
30
+ maxOutputTokens?: number | undefined;
31
+ inputModalities?: string[] | undefined;
32
+ outputModalities?: string[] | undefined;
33
+ supportedParameters?: string[] | undefined;
34
+ }>;
35
+ export declare const providerInputSchema: z.ZodEffects<z.ZodObject<{
36
+ id: z.ZodString;
37
+ name: z.ZodString;
38
+ baseUrl: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
39
+ protocol: z.ZodEnum<["anthropic-messages", "openai-responses", "openai-chat"]>;
40
+ credentialEnv: z.ZodOptional<z.ZodString>;
41
+ authStyle: z.ZodDefault<z.ZodEnum<["bearer", "x-api-key"]>>;
42
+ modelsPath: z.ZodDefault<z.ZodString>;
43
+ manualModels: z.ZodDefault<z.ZodArray<z.ZodObject<{
44
+ id: z.ZodString;
45
+ name: z.ZodString;
46
+ description: z.ZodOptional<z.ZodString>;
47
+ contextWindow: z.ZodOptional<z.ZodNumber>;
48
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
49
+ inputModalities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
50
+ outputModalities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
51
+ supportedParameters: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
52
+ }, "strict", z.ZodTypeAny, {
53
+ id: string;
54
+ name: string;
55
+ description?: string | undefined;
56
+ contextWindow?: number | undefined;
57
+ maxOutputTokens?: number | undefined;
58
+ inputModalities?: string[] | undefined;
59
+ outputModalities?: string[] | undefined;
60
+ supportedParameters?: string[] | undefined;
61
+ }, {
62
+ id: string;
63
+ name: string;
64
+ description?: string | undefined;
65
+ contextWindow?: number | undefined;
66
+ maxOutputTokens?: number | undefined;
67
+ inputModalities?: string[] | undefined;
68
+ outputModalities?: string[] | undefined;
69
+ supportedParameters?: string[] | undefined;
70
+ }>, "many">>;
71
+ }, "strict", z.ZodTypeAny, {
72
+ id: string;
73
+ name: string;
74
+ baseUrl: string;
75
+ protocol: "anthropic-messages" | "openai-responses" | "openai-chat";
76
+ authStyle: "bearer" | "x-api-key";
77
+ modelsPath: string;
78
+ manualModels: {
79
+ id: string;
80
+ name: string;
81
+ description?: string | undefined;
82
+ contextWindow?: number | undefined;
83
+ maxOutputTokens?: number | undefined;
84
+ inputModalities?: string[] | undefined;
85
+ outputModalities?: string[] | undefined;
86
+ supportedParameters?: string[] | undefined;
87
+ }[];
88
+ credentialEnv?: string | undefined;
89
+ }, {
90
+ id: string;
91
+ name: string;
92
+ baseUrl: string;
93
+ protocol: "anthropic-messages" | "openai-responses" | "openai-chat";
94
+ credentialEnv?: string | undefined;
95
+ authStyle?: "bearer" | "x-api-key" | undefined;
96
+ modelsPath?: string | undefined;
97
+ manualModels?: {
98
+ id: string;
99
+ name: string;
100
+ description?: string | undefined;
101
+ contextWindow?: number | undefined;
102
+ maxOutputTokens?: number | undefined;
103
+ inputModalities?: string[] | undefined;
104
+ outputModalities?: string[] | undefined;
105
+ supportedParameters?: string[] | undefined;
106
+ }[] | undefined;
107
+ }>, {
108
+ id: string;
109
+ name: string;
110
+ baseUrl: string;
111
+ protocol: "anthropic-messages" | "openai-responses" | "openai-chat";
112
+ authStyle: "bearer" | "x-api-key";
113
+ modelsPath: string;
114
+ manualModels: {
115
+ id: string;
116
+ name: string;
117
+ description?: string | undefined;
118
+ contextWindow?: number | undefined;
119
+ maxOutputTokens?: number | undefined;
120
+ inputModalities?: string[] | undefined;
121
+ outputModalities?: string[] | undefined;
122
+ supportedParameters?: string[] | undefined;
123
+ }[];
124
+ credentialEnv?: string | undefined;
125
+ }, {
126
+ id: string;
127
+ name: string;
128
+ baseUrl: string;
129
+ protocol: "anthropic-messages" | "openai-responses" | "openai-chat";
130
+ credentialEnv?: string | undefined;
131
+ authStyle?: "bearer" | "x-api-key" | undefined;
132
+ modelsPath?: string | undefined;
133
+ manualModels?: {
134
+ id: string;
135
+ name: string;
136
+ description?: string | undefined;
137
+ contextWindow?: number | undefined;
138
+ maxOutputTokens?: number | undefined;
139
+ inputModalities?: string[] | undefined;
140
+ outputModalities?: string[] | undefined;
141
+ supportedParameters?: string[] | undefined;
142
+ }[] | undefined;
143
+ }>;
144
+ export declare const profileInputSchema: z.ZodObject<{
145
+ id: z.ZodString;
146
+ name: z.ZodString;
147
+ providerId: z.ZodString;
148
+ harness: z.ZodEnum<["claude", "codex", "grok", "opencode2"]>;
149
+ model: z.ZodString;
150
+ }, "strict", z.ZodTypeAny, {
151
+ id: string;
152
+ name: string;
153
+ providerId: string;
154
+ harness: "claude" | "codex" | "grok" | "opencode2";
155
+ model: string;
156
+ }, {
157
+ id: string;
158
+ name: string;
159
+ providerId: string;
160
+ harness: "claude" | "codex" | "grok" | "opencode2";
161
+ model: string;
162
+ }>;
163
+ export declare const runInputSchema: z.ZodObject<{
164
+ profileId: z.ZodString;
165
+ harness: z.ZodEnum<["claude", "codex", "grok", "opencode2"]>;
166
+ model: z.ZodString;
167
+ planToken: z.ZodString;
168
+ }, "strict", z.ZodTypeAny, {
169
+ harness: "claude" | "codex" | "grok" | "opencode2";
170
+ model: string;
171
+ profileId: string;
172
+ planToken: string;
173
+ }, {
174
+ harness: "claude" | "codex" | "grok" | "opencode2";
175
+ model: string;
176
+ profileId: string;
177
+ planToken: string;
178
+ }>;
179
+ export declare const runUpdateSchema: z.ZodObject<{
180
+ status: z.ZodEnum<["exited", "failed", "interrupted"]>;
181
+ exitCode: z.ZodNumber;
182
+ }, "strict", z.ZodTypeAny, {
183
+ status: "exited" | "failed" | "interrupted";
184
+ exitCode: number;
185
+ }, {
186
+ status: "exited" | "failed" | "interrupted";
187
+ exitCode: number;
188
+ }>;
189
+ export type ProviderInput = z.input<typeof providerInputSchema>;
190
+ export type Provider = z.output<typeof providerInputSchema> & {
191
+ version: number;
192
+ updatedAt: string;
193
+ };
194
+ export type ProfileInput = z.infer<typeof profileInputSchema>;
195
+ export type Profile = ProfileInput & {
196
+ version: number;
197
+ updatedAt: string;
198
+ };
199
+ export type Model = z.infer<typeof modelSchema>;
200
+ export type Run = z.infer<typeof runInputSchema> & {
201
+ providerId: string;
202
+ providerVersion: number;
203
+ profileVersion: number;
204
+ id: string;
205
+ status: "running" | "exited" | "failed" | "interrupted";
206
+ startedAt: string;
207
+ endedAt?: string;
208
+ exitCode?: number;
209
+ version: number;
210
+ updatedAt: string;
211
+ };
212
+ export type Catalog = {
213
+ models: Model[];
214
+ refreshedAt: string;
215
+ source: "remote" | "manual";
216
+ };
217
+ export type LaunchPlan = {
218
+ planToken: string;
219
+ profile: Profile;
220
+ provider: Provider;
221
+ catalog: Catalog;
222
+ warnings: string[];
223
+ };
224
+ export declare class Fault extends Error {
225
+ status: number;
226
+ code: string;
227
+ constructor(status: number, code: string, message: string);
228
+ }
229
+ export declare function parse<T>(schema: z.ZodType<T, any, any>, value: unknown): T;
230
+ export declare function compatible(harness: Profile["harness"], protocol: Provider["protocol"]): boolean;
231
+ export declare function codingEligible(model: Model): boolean;