@hasna/switcher 0.1.0 → 0.1.2

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.
@@ -63,6 +63,38 @@ export interface paths {
63
63
  patch?: never;
64
64
  trace?: never;
65
65
  };
66
+ "/v1/provider-presets": {
67
+ parameters: {
68
+ query?: never;
69
+ header?: never;
70
+ path?: never;
71
+ cookie?: never;
72
+ };
73
+ get: operations["listProviderPresets"];
74
+ put?: never;
75
+ post?: never;
76
+ delete?: never;
77
+ options?: never;
78
+ head?: never;
79
+ patch?: never;
80
+ trace?: never;
81
+ };
82
+ "/v1/provider-presets/{id}": {
83
+ parameters: {
84
+ query?: never;
85
+ header?: never;
86
+ path?: never;
87
+ cookie?: never;
88
+ };
89
+ get: operations["getProviderPreset"];
90
+ put?: never;
91
+ post?: never;
92
+ delete?: never;
93
+ options?: never;
94
+ head?: never;
95
+ patch?: never;
96
+ trace?: never;
97
+ };
66
98
  "/v1/providers/{id}/models": {
67
99
  parameters: {
68
100
  query?: never;
@@ -211,18 +243,48 @@ export interface paths {
211
243
  export type webhooks = Record<string, never>;
212
244
  export interface components {
213
245
  schemas: {
246
+ ProviderPreset: {
247
+ id: string;
248
+ name: string;
249
+ credentialEnv?: string;
250
+ credentialAliases: string[];
251
+ protocols: {
252
+ /** @enum {string} */
253
+ protocol: "anthropic-messages" | "openai-responses" | "openai-chat" | "gemini-generate-content";
254
+ baseUrl?: string;
255
+ /** @enum {string} */
256
+ authStyle: "bearer" | "x-api-key" | "api-key";
257
+ catalogBaseUrl?: string;
258
+ /** @enum {string} */
259
+ catalogFormat: "openai" | "ollama" | "mistral" | "together" | "fireworks" | "dashscope" | "gemini" | "none";
260
+ /** @enum {string} */
261
+ catalogAuthStyle?: "bearer" | "x-api-key" | "api-key" | "none";
262
+ modelsPath: string;
263
+ notes: string[];
264
+ }[];
265
+ sources: string[];
266
+ /** @enum {string} */
267
+ verification: "documented";
268
+ };
214
269
  ProviderInput: {
215
270
  id: string;
216
271
  name: string;
217
272
  baseUrl: string;
218
273
  /** @enum {string} */
219
- protocol: "anthropic-messages" | "openai-responses" | "openai-chat";
274
+ protocol: "anthropic-messages" | "openai-responses" | "openai-chat" | "gemini-generate-content";
220
275
  credentialEnv?: string;
221
276
  /**
222
277
  * @default bearer
223
278
  * @enum {string}
224
279
  */
225
- authStyle: "bearer" | "x-api-key";
280
+ authStyle: "bearer" | "x-api-key" | "api-key";
281
+ catalogBaseUrl?: string;
282
+ /** @enum {string} */
283
+ catalogFormat?: "openai" | "ollama" | "mistral" | "together" | "fireworks" | "dashscope" | "gemini" | "none";
284
+ /** @enum {string} */
285
+ catalogAuthStyle?: "bearer" | "x-api-key" | "api-key" | "none";
286
+ catalogCredentialEnv?: string;
287
+ catalogAccountId?: string;
226
288
  /** @default models */
227
289
  modelsPath: string;
228
290
  /** @default [] */
@@ -230,11 +292,13 @@ export interface components {
230
292
  id: string;
231
293
  name: string;
232
294
  description?: string;
295
+ available?: boolean;
233
296
  contextWindow?: number;
234
297
  maxOutputTokens?: number;
235
298
  inputModalities?: string[];
236
299
  outputModalities?: string[];
237
300
  supportedParameters?: string[];
301
+ supportedGenerationMethods?: string[];
238
302
  }[];
239
303
  };
240
304
  Provider: {
@@ -242,13 +306,20 @@ export interface components {
242
306
  name: string;
243
307
  baseUrl: string;
244
308
  /** @enum {string} */
245
- protocol: "anthropic-messages" | "openai-responses" | "openai-chat";
309
+ protocol: "anthropic-messages" | "openai-responses" | "openai-chat" | "gemini-generate-content";
246
310
  credentialEnv?: string;
247
311
  /**
248
312
  * @default bearer
249
313
  * @enum {string}
250
314
  */
251
- authStyle: "bearer" | "x-api-key";
315
+ authStyle: "bearer" | "x-api-key" | "api-key";
316
+ catalogBaseUrl?: string;
317
+ /** @enum {string} */
318
+ catalogFormat?: "openai" | "ollama" | "mistral" | "together" | "fireworks" | "dashscope" | "gemini" | "none";
319
+ /** @enum {string} */
320
+ catalogAuthStyle?: "bearer" | "x-api-key" | "api-key" | "none";
321
+ catalogCredentialEnv?: string;
322
+ catalogAccountId?: string;
252
323
  /** @default models */
253
324
  modelsPath: string;
254
325
  /** @default [] */
@@ -256,11 +327,13 @@ export interface components {
256
327
  id: string;
257
328
  name: string;
258
329
  description?: string;
330
+ available?: boolean;
259
331
  contextWindow?: number;
260
332
  maxOutputTokens?: number;
261
333
  inputModalities?: string[];
262
334
  outputModalities?: string[];
263
335
  supportedParameters?: string[];
336
+ supportedGenerationMethods?: string[];
264
337
  }[];
265
338
  version: number;
266
339
  updatedAt: string;
@@ -270,7 +343,7 @@ export interface components {
270
343
  name: string;
271
344
  providerId: string;
272
345
  /** @enum {string} */
273
- harness: "claude" | "codex" | "grok" | "opencode2";
346
+ harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
274
347
  model: string;
275
348
  };
276
349
  Profile: {
@@ -278,7 +351,7 @@ export interface components {
278
351
  name: string;
279
352
  providerId: string;
280
353
  /** @enum {string} */
281
- harness: "claude" | "codex" | "grok" | "opencode2";
354
+ harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
282
355
  model: string;
283
356
  version: number;
284
357
  updatedAt: string;
@@ -287,22 +360,26 @@ export interface components {
287
360
  id: string;
288
361
  name: string;
289
362
  description?: string;
363
+ available?: boolean;
290
364
  contextWindow?: number;
291
365
  maxOutputTokens?: number;
292
366
  inputModalities?: string[];
293
367
  outputModalities?: string[];
294
368
  supportedParameters?: string[];
369
+ supportedGenerationMethods?: string[];
295
370
  };
296
371
  ModelPage: {
297
372
  data: {
298
373
  id: string;
299
374
  name: string;
300
375
  description?: string;
376
+ available?: boolean;
301
377
  contextWindow?: number;
302
378
  maxOutputTokens?: number;
303
379
  inputModalities?: string[];
304
380
  outputModalities?: string[];
305
381
  supportedParameters?: string[];
382
+ supportedGenerationMethods?: string[];
306
383
  codingEligible: boolean;
307
384
  }[];
308
385
  total: number;
@@ -317,11 +394,13 @@ export interface components {
317
394
  id: string;
318
395
  name: string;
319
396
  description?: string;
397
+ available?: boolean;
320
398
  contextWindow?: number;
321
399
  maxOutputTokens?: number;
322
400
  inputModalities?: string[];
323
401
  outputModalities?: string[];
324
402
  supportedParameters?: string[];
403
+ supportedGenerationMethods?: string[];
325
404
  }[];
326
405
  refreshedAt: string;
327
406
  /** @enum {string} */
@@ -333,13 +412,20 @@ export interface components {
333
412
  name: string;
334
413
  baseUrl: string;
335
414
  /** @enum {string} */
336
- protocol: "anthropic-messages" | "openai-responses" | "openai-chat";
415
+ protocol: "anthropic-messages" | "openai-responses" | "openai-chat" | "gemini-generate-content";
337
416
  credentialEnv?: string;
338
417
  /**
339
418
  * @default bearer
340
419
  * @enum {string}
341
420
  */
342
- authStyle: "bearer" | "x-api-key";
421
+ authStyle: "bearer" | "x-api-key" | "api-key";
422
+ catalogBaseUrl?: string;
423
+ /** @enum {string} */
424
+ catalogFormat?: "openai" | "ollama" | "mistral" | "together" | "fireworks" | "dashscope" | "gemini" | "none";
425
+ /** @enum {string} */
426
+ catalogAuthStyle?: "bearer" | "x-api-key" | "api-key" | "none";
427
+ catalogCredentialEnv?: string;
428
+ catalogAccountId?: string;
343
429
  /** @default models */
344
430
  modelsPath: string;
345
431
  /** @default [] */
@@ -347,11 +433,13 @@ export interface components {
347
433
  id: string;
348
434
  name: string;
349
435
  description?: string;
436
+ available?: boolean;
350
437
  contextWindow?: number;
351
438
  maxOutputTokens?: number;
352
439
  inputModalities?: string[];
353
440
  outputModalities?: string[];
354
441
  supportedParameters?: string[];
442
+ supportedGenerationMethods?: string[];
355
443
  }[];
356
444
  version: number;
357
445
  updatedAt: string;
@@ -361,7 +449,7 @@ export interface components {
361
449
  name: string;
362
450
  providerId: string;
363
451
  /** @enum {string} */
364
- harness: "claude" | "codex" | "grok" | "opencode2";
452
+ harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
365
453
  model: string;
366
454
  version: number;
367
455
  updatedAt: string;
@@ -371,11 +459,13 @@ export interface components {
371
459
  id: string;
372
460
  name: string;
373
461
  description?: string;
462
+ available?: boolean;
374
463
  contextWindow?: number;
375
464
  maxOutputTokens?: number;
376
465
  inputModalities?: string[];
377
466
  outputModalities?: string[];
378
467
  supportedParameters?: string[];
468
+ supportedGenerationMethods?: string[];
379
469
  }[];
380
470
  refreshedAt: string;
381
471
  /** @enum {string} */
@@ -387,7 +477,7 @@ export interface components {
387
477
  RunInput: {
388
478
  profileId: string;
389
479
  /** @enum {string} */
390
- harness: "claude" | "codex" | "grok" | "opencode2";
480
+ harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
391
481
  model: string;
392
482
  planToken: string;
393
483
  };
@@ -399,7 +489,7 @@ export interface components {
399
489
  Run: {
400
490
  profileId: string;
401
491
  /** @enum {string} */
402
- harness: "claude" | "codex" | "grok" | "opencode2";
492
+ harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
403
493
  model: string;
404
494
  planToken: string;
405
495
  version: number;
@@ -804,6 +894,68 @@ export interface operations {
804
894
  };
805
895
  };
806
896
  };
897
+ listProviderPresets: {
898
+ parameters: {
899
+ query?: never;
900
+ header?: never;
901
+ path?: never;
902
+ cookie?: never;
903
+ };
904
+ requestBody?: never;
905
+ responses: {
906
+ /** @description Success */
907
+ 200: {
908
+ headers: {
909
+ [name: string]: unknown;
910
+ };
911
+ content: {
912
+ "application/json": {
913
+ data: components["schemas"]["ProviderPreset"][];
914
+ };
915
+ };
916
+ };
917
+ /** @description Structured error */
918
+ default: {
919
+ headers: {
920
+ [name: string]: unknown;
921
+ };
922
+ content: {
923
+ "application/json": components["schemas"]["Error"];
924
+ };
925
+ };
926
+ };
927
+ };
928
+ getProviderPreset: {
929
+ parameters: {
930
+ query?: never;
931
+ header?: never;
932
+ path: {
933
+ id: string;
934
+ };
935
+ cookie?: never;
936
+ };
937
+ requestBody?: never;
938
+ responses: {
939
+ /** @description Success */
940
+ 200: {
941
+ headers: {
942
+ [name: string]: unknown;
943
+ };
944
+ content: {
945
+ "application/json": components["schemas"]["ProviderPreset"];
946
+ };
947
+ };
948
+ /** @description Structured error */
949
+ default: {
950
+ headers: {
951
+ [name: string]: unknown;
952
+ };
953
+ content: {
954
+ "application/json": components["schemas"]["Error"];
955
+ };
956
+ };
957
+ };
958
+ };
807
959
  listModels: {
808
960
  parameters: {
809
961
  query?: {
@@ -0,0 +1 @@
1
+ export declare function validateGrokResume(args: string[]): void;
@@ -0,0 +1,6 @@
1
+ import type { HarnessId } from "./harness-types";
2
+ export declare function geminiPolicyArguments(input: readonly string[], originalHome: string): string[];
3
+ export declare function assertHarnessArguments(harness: HarnessId, args: readonly string[], options?: {
4
+ additionalReserved?: readonly string[];
5
+ reserveCodexConfig?: boolean;
6
+ }): void;
@@ -0,0 +1 @@
1
+ export declare function childEnvironment(env?: NodeJS.ProcessEnv): Record<string, string>;
@@ -0,0 +1,19 @@
1
+ import type { HarnessId } from "./harness-types";
2
+ /**
3
+ * Native installation facts used by doctor and missing-executable errors.
4
+ *
5
+ * These records deliberately distinguish a verified package from a project
6
+ * distribution. A project entry has no guessed npm command: the operator is
7
+ * sent to the upstream installation instructions and can pass the resulting
8
+ * executable with --executable.
9
+ */
10
+ export type HarnessInstallation = {
11
+ displayName: string;
12
+ executable: string;
13
+ versionRequirement: string;
14
+ packageOrProject: string;
15
+ documentationUrl: string;
16
+ installationGuidance: string;
17
+ };
18
+ export declare function harnessInstallation(harness: HarnessId): HarnessInstallation;
19
+ export declare function harnessInstallationMessage(harness: HarnessId, executable: string, explicitOverride: boolean): string;
@@ -0,0 +1,11 @@
1
+ /** Own a POSIX process group; interactive children get a controlling terminal. */
2
+ export declare function runHarnessProcess(options: {
3
+ executable: string;
4
+ args: string[];
5
+ cwd: string;
6
+ env: NodeJS.ProcessEnv;
7
+ timeoutMs?: number;
8
+ }): Promise<{
9
+ code: number;
10
+ interrupted: boolean;
11
+ }>;
@@ -13,6 +13,7 @@ export type HarnessLaunchInput = {
13
13
  stateDir: string;
14
14
  cwd: string;
15
15
  version?: string;
16
+ sessionDir?: string;
16
17
  };
17
18
  export type PreparedLaunch = {
18
19
  executable: string;
@@ -20,5 +21,6 @@ export type PreparedLaunch = {
20
21
  env: Record<string, string>;
21
22
  configPaths: string[];
22
23
  warnings: string[];
24
+ beforeLaunch?: () => Promise<void>;
23
25
  cleanup?: () => Promise<void>;
24
26
  };
@@ -1,13 +1,47 @@
1
1
  import type { HarnessId, HarnessLaunchInput, PreparedLaunch } from "./harness-types";
2
2
  export declare function detectHarness(harness: HarnessId, override?: string): Promise<{
3
- harness: "claude" | "codex" | "grok" | "opencode2";
3
+ harness: "gemini" | "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "aider" | "kilo";
4
4
  executable: string;
5
5
  available: boolean;
6
6
  version: string;
7
+ installation: import("./harness-installation").HarnessInstallation;
7
8
  } | {
8
- harness: "claude" | "codex" | "grok" | "opencode2";
9
+ harness: "gemini" | "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "aider" | "kilo";
9
10
  executable: string;
10
11
  available: boolean;
11
12
  version: undefined;
13
+ installation: import("./harness-installation").HarnessInstallation;
12
14
  }>;
15
+ export declare function validateHarnessConfiguration(harness: HarnessId, cwd: string, args?: readonly string[]): Promise<void>;
16
+ export declare function validateHarnessVersion(harness: HarnessId, version: string | undefined): void;
17
+ export declare function codexModel(model: HarnessLaunchInput["models"][number], priority: number): {
18
+ slug: string;
19
+ display_name: string;
20
+ description: string;
21
+ shell_type: string;
22
+ visibility: string;
23
+ supported_in_api: boolean;
24
+ priority: number;
25
+ supported_reasoning_levels: never[];
26
+ default_reasoning_level: null;
27
+ support_verbosity: boolean;
28
+ supports_reasoning_summary_parameter: boolean;
29
+ default_verbosity: null;
30
+ supports_parallel_tool_calls: boolean;
31
+ apply_patch_tool_type: null;
32
+ truncation_policy: {
33
+ mode: string;
34
+ limit: number;
35
+ };
36
+ experimental_supported_tools: never[];
37
+ context_window: number | null;
38
+ max_context_window: number | null;
39
+ input_modalities: ("text" | "image")[];
40
+ prefer_websockets: boolean;
41
+ use_responses_lite: boolean;
42
+ model_messages: {
43
+ instructions_template: string;
44
+ instructions_variables: null;
45
+ };
46
+ };
13
47
  export declare function prepareHarnessLaunch(input: HarnessLaunchInput): Promise<PreparedLaunch>;
@@ -0,0 +1,19 @@
1
+ import type { HarnessLaunchInput, PreparedLaunch } from "./harness-types";
2
+ /** Hermes' native runtime names for the three Switcher wire contracts. */
3
+ export declare const hermesApiMode: {
4
+ readonly "anthropic-messages": "anthropic_messages";
5
+ readonly "openai-responses": "codex_responses";
6
+ readonly "openai-chat": "chat_completions";
7
+ };
8
+ /**
9
+ * Keep Hermes' picker and inference route on the exact Switcher catalog.
10
+ * Hermes' custom provider client uses Bearer locally; this bridge translates
11
+ * that local credential into the provider's declared upstream header style.
12
+ */
13
+ export declare function createHermesBridge(input: Pick<HarnessLaunchInput, "baseUrl" | "protocol" | "authStyle" | "model" | "models" | "credential">): {
14
+ baseUrl: string;
15
+ token: string;
16
+ cleanup: () => Promise<void>;
17
+ };
18
+ /** Prepare a Hermes run with isolated config, catalog and durable session state. */
19
+ export declare function prepareHermesLaunch(input: HarnessLaunchInput): Promise<PreparedLaunch>;