@hasna/switcher 0.1.1 → 0.1.3
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 +146 -7
- package/dist/aider-args.d.ts +7 -0
- package/dist/aider-config.d.ts +6 -0
- package/dist/auth.d.ts +3 -0
- package/dist/cli/index.js +7548 -2558
- package/dist/cli.d.ts +2 -0
- package/dist/cline-backend.d.ts +7 -0
- package/dist/codex-model-policy.d.ts +65 -0
- package/dist/credentials.d.ts +5 -5
- package/dist/direct-launch.d.ts +3 -3
- package/dist/domain.d.ts +320 -50
- package/dist/dsh-args.d.ts +5 -0
- package/dist/gemini-bridge.d.ts +6 -0
- package/dist/gemini-config.d.ts +12 -0
- package/dist/gemini-model-policy.d.ts +56 -0
- package/dist/generated/api.d.ts +220 -21
- package/dist/harness-arguments.d.ts +1 -0
- package/dist/harness-installation.d.ts +19 -0
- package/dist/harness-types.d.ts +10 -0
- package/dist/harnesses.d.ts +5 -2
- package/dist/hermes-backend.d.ts +19 -0
- package/dist/hermes-model-policy.d.ts +30 -0
- package/dist/index.js +136 -43
- package/dist/inference-gateway.d.ts +24 -0
- package/dist/kilo-config.d.ts +13 -0
- package/dist/kilo.d.ts +5 -0
- package/dist/launcher.d.ts +12 -6
- package/dist/mcp/index.js +139 -55
- package/dist/model-policy-schema.d.ts +137 -0
- package/dist/model-policy.d.ts +31 -0
- package/dist/native-model-policy.d.ts +23 -0
- package/dist/omp-backend.d.ts +7 -0
- package/dist/opencode-model-policy.d.ts +33 -0
- package/dist/opencode2-config.d.ts +3 -3
- package/dist/ori-backend.d.ts +2 -2
- package/dist/ori-model-policy.d.ts +8 -0
- package/dist/presets.d.ts +11 -10
- package/dist/sdk.d.ts +279 -38
- package/dist/sdk.js +136 -43
- package/dist/serve/index.js +1306 -125
- package/docs/MODEL-POLICY.md +82 -0
- package/openapi.json +973 -14
- package/package.json +14 -3
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type Model } from "./domain";
|
|
2
|
+
import type { CompiledModelPolicy } from "./model-policy";
|
|
3
|
+
/** The settings fragment understood by Gemini CLI 0.58.0. */
|
|
4
|
+
export type GeminiModelPolicyFragment = {
|
|
5
|
+
modelConfigs: {
|
|
6
|
+
customOverrides: Array<{
|
|
7
|
+
match: {
|
|
8
|
+
model: string;
|
|
9
|
+
};
|
|
10
|
+
modelConfig: {
|
|
11
|
+
model: string;
|
|
12
|
+
};
|
|
13
|
+
}>;
|
|
14
|
+
modelChains: Record<string, Array<{
|
|
15
|
+
model: string;
|
|
16
|
+
isLastResort: true;
|
|
17
|
+
}>>;
|
|
18
|
+
modelDefinitions: Record<string, {
|
|
19
|
+
displayName: string;
|
|
20
|
+
tier: "custom";
|
|
21
|
+
family: "switcher";
|
|
22
|
+
isPreview: false;
|
|
23
|
+
isVisible: true;
|
|
24
|
+
features: {
|
|
25
|
+
thinking: false;
|
|
26
|
+
multimodalToolUse: boolean;
|
|
27
|
+
};
|
|
28
|
+
}>;
|
|
29
|
+
modelIdResolutions: Record<string, {
|
|
30
|
+
default: string;
|
|
31
|
+
contexts: [];
|
|
32
|
+
}>;
|
|
33
|
+
classifierIdResolutions: Record<string, {
|
|
34
|
+
default: string;
|
|
35
|
+
contexts: [];
|
|
36
|
+
}>;
|
|
37
|
+
};
|
|
38
|
+
agents?: {
|
|
39
|
+
overrides: {
|
|
40
|
+
codebase_investigator: {
|
|
41
|
+
modelConfig: {
|
|
42
|
+
model: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Compile the portable Switcher policy into native Gemini 0.58.0 settings.
|
|
50
|
+
*
|
|
51
|
+
* Gemini's stable native route controls are modelConfigs.modelIdResolutions
|
|
52
|
+
* and agents.overrides.<agent>.modelConfig.model. Its modelConfigs.modelChains
|
|
53
|
+
* field receives terminal selected-model chains; the gateway owns explicit
|
|
54
|
+
* ordered fallback and retry semantics.
|
|
55
|
+
*/
|
|
56
|
+
export declare function compileGeminiModelPolicy(selectedModel: string, models: readonly Model[], compiled: CompiledModelPolicy): GeminiModelPolicyFragment;
|
package/dist/generated/api.d.ts
CHANGED
|
@@ -250,15 +250,15 @@ export interface components {
|
|
|
250
250
|
credentialAliases: string[];
|
|
251
251
|
protocols: {
|
|
252
252
|
/** @enum {string} */
|
|
253
|
-
protocol: "anthropic-messages" | "openai-responses" | "openai-chat";
|
|
253
|
+
protocol: "anthropic-messages" | "openai-responses" | "openai-chat" | "gemini-generate-content";
|
|
254
254
|
baseUrl?: string;
|
|
255
255
|
/** @enum {string} */
|
|
256
|
-
authStyle: "bearer" | "x-api-key";
|
|
256
|
+
authStyle: "bearer" | "x-api-key" | "api-key";
|
|
257
257
|
catalogBaseUrl?: string;
|
|
258
258
|
/** @enum {string} */
|
|
259
|
-
catalogFormat: "openai" | "ollama" | "mistral" | "together" | "fireworks" | "dashscope" | "none";
|
|
259
|
+
catalogFormat: "openai" | "ollama" | "mistral" | "together" | "fireworks" | "dashscope" | "gemini" | "none";
|
|
260
260
|
/** @enum {string} */
|
|
261
|
-
catalogAuthStyle?: "bearer" | "x-api-key" | "none";
|
|
261
|
+
catalogAuthStyle?: "bearer" | "x-api-key" | "api-key" | "none";
|
|
262
262
|
modelsPath: string;
|
|
263
263
|
notes: string[];
|
|
264
264
|
}[];
|
|
@@ -271,18 +271,18 @@ export interface components {
|
|
|
271
271
|
name: string;
|
|
272
272
|
baseUrl: string;
|
|
273
273
|
/** @enum {string} */
|
|
274
|
-
protocol: "anthropic-messages" | "openai-responses" | "openai-chat";
|
|
274
|
+
protocol: "anthropic-messages" | "openai-responses" | "openai-chat" | "gemini-generate-content";
|
|
275
275
|
credentialEnv?: string;
|
|
276
276
|
/**
|
|
277
277
|
* @default bearer
|
|
278
278
|
* @enum {string}
|
|
279
279
|
*/
|
|
280
|
-
authStyle: "bearer" | "x-api-key";
|
|
280
|
+
authStyle: "bearer" | "x-api-key" | "api-key";
|
|
281
281
|
catalogBaseUrl?: string;
|
|
282
282
|
/** @enum {string} */
|
|
283
|
-
catalogFormat?: "openai" | "ollama" | "mistral" | "together" | "fireworks" | "dashscope" | "none";
|
|
283
|
+
catalogFormat?: "openai" | "ollama" | "mistral" | "together" | "fireworks" | "dashscope" | "gemini" | "none";
|
|
284
284
|
/** @enum {string} */
|
|
285
|
-
catalogAuthStyle?: "bearer" | "x-api-key" | "none";
|
|
285
|
+
catalogAuthStyle?: "bearer" | "x-api-key" | "api-key" | "none";
|
|
286
286
|
catalogCredentialEnv?: string;
|
|
287
287
|
catalogAccountId?: string;
|
|
288
288
|
/** @default models */
|
|
@@ -298,6 +298,7 @@ export interface components {
|
|
|
298
298
|
inputModalities?: string[];
|
|
299
299
|
outputModalities?: string[];
|
|
300
300
|
supportedParameters?: string[];
|
|
301
|
+
supportedGenerationMethods?: string[];
|
|
301
302
|
}[];
|
|
302
303
|
};
|
|
303
304
|
Provider: {
|
|
@@ -305,18 +306,18 @@ export interface components {
|
|
|
305
306
|
name: string;
|
|
306
307
|
baseUrl: string;
|
|
307
308
|
/** @enum {string} */
|
|
308
|
-
protocol: "anthropic-messages" | "openai-responses" | "openai-chat";
|
|
309
|
+
protocol: "anthropic-messages" | "openai-responses" | "openai-chat" | "gemini-generate-content";
|
|
309
310
|
credentialEnv?: string;
|
|
310
311
|
/**
|
|
311
312
|
* @default bearer
|
|
312
313
|
* @enum {string}
|
|
313
314
|
*/
|
|
314
|
-
authStyle: "bearer" | "x-api-key";
|
|
315
|
+
authStyle: "bearer" | "x-api-key" | "api-key";
|
|
315
316
|
catalogBaseUrl?: string;
|
|
316
317
|
/** @enum {string} */
|
|
317
|
-
catalogFormat?: "openai" | "ollama" | "mistral" | "together" | "fireworks" | "dashscope" | "none";
|
|
318
|
+
catalogFormat?: "openai" | "ollama" | "mistral" | "together" | "fireworks" | "dashscope" | "gemini" | "none";
|
|
318
319
|
/** @enum {string} */
|
|
319
|
-
catalogAuthStyle?: "bearer" | "x-api-key" | "none";
|
|
320
|
+
catalogAuthStyle?: "bearer" | "x-api-key" | "api-key" | "none";
|
|
320
321
|
catalogCredentialEnv?: string;
|
|
321
322
|
catalogAccountId?: string;
|
|
322
323
|
/** @default models */
|
|
@@ -332,6 +333,7 @@ export interface components {
|
|
|
332
333
|
inputModalities?: string[];
|
|
333
334
|
outputModalities?: string[];
|
|
334
335
|
supportedParameters?: string[];
|
|
336
|
+
supportedGenerationMethods?: string[];
|
|
335
337
|
}[];
|
|
336
338
|
version: number;
|
|
337
339
|
updatedAt: string;
|
|
@@ -341,16 +343,64 @@ export interface components {
|
|
|
341
343
|
name: string;
|
|
342
344
|
providerId: string;
|
|
343
345
|
/** @enum {string} */
|
|
344
|
-
harness: "claude" | "codex" | "grok" | "opencode2" | "pi";
|
|
346
|
+
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
|
|
345
347
|
model: string;
|
|
348
|
+
modelPolicy?: {
|
|
349
|
+
/**
|
|
350
|
+
* @default 1
|
|
351
|
+
* @enum {number}
|
|
352
|
+
*/
|
|
353
|
+
version: 1;
|
|
354
|
+
roles?: {
|
|
355
|
+
subagent?: string;
|
|
356
|
+
fast?: string;
|
|
357
|
+
planning?: string;
|
|
358
|
+
review?: string;
|
|
359
|
+
summary?: string;
|
|
360
|
+
compaction?: string;
|
|
361
|
+
weak?: string;
|
|
362
|
+
editor?: string;
|
|
363
|
+
};
|
|
364
|
+
allowedModels?: string[];
|
|
365
|
+
aliases?: {
|
|
366
|
+
[key: string]: string;
|
|
367
|
+
};
|
|
368
|
+
fallbacks?: {
|
|
369
|
+
[key: string]: string[];
|
|
370
|
+
};
|
|
371
|
+
};
|
|
346
372
|
};
|
|
347
373
|
Profile: {
|
|
348
374
|
id: string;
|
|
349
375
|
name: string;
|
|
350
376
|
providerId: string;
|
|
351
377
|
/** @enum {string} */
|
|
352
|
-
harness: "claude" | "codex" | "grok" | "opencode2" | "pi";
|
|
378
|
+
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
|
|
353
379
|
model: string;
|
|
380
|
+
modelPolicy?: {
|
|
381
|
+
/**
|
|
382
|
+
* @default 1
|
|
383
|
+
* @enum {number}
|
|
384
|
+
*/
|
|
385
|
+
version: 1;
|
|
386
|
+
roles?: {
|
|
387
|
+
subagent?: string;
|
|
388
|
+
fast?: string;
|
|
389
|
+
planning?: string;
|
|
390
|
+
review?: string;
|
|
391
|
+
summary?: string;
|
|
392
|
+
compaction?: string;
|
|
393
|
+
weak?: string;
|
|
394
|
+
editor?: string;
|
|
395
|
+
};
|
|
396
|
+
allowedModels?: string[];
|
|
397
|
+
aliases?: {
|
|
398
|
+
[key: string]: string;
|
|
399
|
+
};
|
|
400
|
+
fallbacks?: {
|
|
401
|
+
[key: string]: string[];
|
|
402
|
+
};
|
|
403
|
+
};
|
|
354
404
|
version: number;
|
|
355
405
|
updatedAt: string;
|
|
356
406
|
};
|
|
@@ -364,6 +414,45 @@ export interface components {
|
|
|
364
414
|
inputModalities?: string[];
|
|
365
415
|
outputModalities?: string[];
|
|
366
416
|
supportedParameters?: string[];
|
|
417
|
+
supportedGenerationMethods?: string[];
|
|
418
|
+
};
|
|
419
|
+
ModelPolicy: {
|
|
420
|
+
/**
|
|
421
|
+
* @default 1
|
|
422
|
+
* @enum {number}
|
|
423
|
+
*/
|
|
424
|
+
version: 1;
|
|
425
|
+
roles?: {
|
|
426
|
+
subagent?: string;
|
|
427
|
+
fast?: string;
|
|
428
|
+
planning?: string;
|
|
429
|
+
review?: string;
|
|
430
|
+
summary?: string;
|
|
431
|
+
compaction?: string;
|
|
432
|
+
weak?: string;
|
|
433
|
+
editor?: string;
|
|
434
|
+
};
|
|
435
|
+
allowedModels?: string[];
|
|
436
|
+
aliases?: {
|
|
437
|
+
[key: string]: string;
|
|
438
|
+
};
|
|
439
|
+
fallbacks?: {
|
|
440
|
+
[key: string]: string[];
|
|
441
|
+
};
|
|
442
|
+
};
|
|
443
|
+
RoutingEvent: {
|
|
444
|
+
/** Format: date-time */
|
|
445
|
+
at: string;
|
|
446
|
+
requestId: string;
|
|
447
|
+
requestedModel: string;
|
|
448
|
+
resolvedModel?: string;
|
|
449
|
+
reportedModel?: string;
|
|
450
|
+
/** @enum {string} */
|
|
451
|
+
decision: "allow" | "alias" | "reject" | "fallback";
|
|
452
|
+
/** @enum {string} */
|
|
453
|
+
role?: "main" | "subagent" | "fast" | "planning" | "review" | "summary" | "compaction" | "weak" | "editor";
|
|
454
|
+
reason?: string;
|
|
455
|
+
upstreamStatus?: number;
|
|
367
456
|
};
|
|
368
457
|
ModelPage: {
|
|
369
458
|
data: {
|
|
@@ -376,6 +465,7 @@ export interface components {
|
|
|
376
465
|
inputModalities?: string[];
|
|
377
466
|
outputModalities?: string[];
|
|
378
467
|
supportedParameters?: string[];
|
|
468
|
+
supportedGenerationMethods?: string[];
|
|
379
469
|
codingEligible: boolean;
|
|
380
470
|
}[];
|
|
381
471
|
total: number;
|
|
@@ -396,6 +486,7 @@ export interface components {
|
|
|
396
486
|
inputModalities?: string[];
|
|
397
487
|
outputModalities?: string[];
|
|
398
488
|
supportedParameters?: string[];
|
|
489
|
+
supportedGenerationMethods?: string[];
|
|
399
490
|
}[];
|
|
400
491
|
refreshedAt: string;
|
|
401
492
|
/** @enum {string} */
|
|
@@ -407,18 +498,18 @@ export interface components {
|
|
|
407
498
|
name: string;
|
|
408
499
|
baseUrl: string;
|
|
409
500
|
/** @enum {string} */
|
|
410
|
-
protocol: "anthropic-messages" | "openai-responses" | "openai-chat";
|
|
501
|
+
protocol: "anthropic-messages" | "openai-responses" | "openai-chat" | "gemini-generate-content";
|
|
411
502
|
credentialEnv?: string;
|
|
412
503
|
/**
|
|
413
504
|
* @default bearer
|
|
414
505
|
* @enum {string}
|
|
415
506
|
*/
|
|
416
|
-
authStyle: "bearer" | "x-api-key";
|
|
507
|
+
authStyle: "bearer" | "x-api-key" | "api-key";
|
|
417
508
|
catalogBaseUrl?: string;
|
|
418
509
|
/** @enum {string} */
|
|
419
|
-
catalogFormat?: "openai" | "ollama" | "mistral" | "together" | "fireworks" | "dashscope" | "none";
|
|
510
|
+
catalogFormat?: "openai" | "ollama" | "mistral" | "together" | "fireworks" | "dashscope" | "gemini" | "none";
|
|
420
511
|
/** @enum {string} */
|
|
421
|
-
catalogAuthStyle?: "bearer" | "x-api-key" | "none";
|
|
512
|
+
catalogAuthStyle?: "bearer" | "x-api-key" | "api-key" | "none";
|
|
422
513
|
catalogCredentialEnv?: string;
|
|
423
514
|
catalogAccountId?: string;
|
|
424
515
|
/** @default models */
|
|
@@ -434,6 +525,7 @@ export interface components {
|
|
|
434
525
|
inputModalities?: string[];
|
|
435
526
|
outputModalities?: string[];
|
|
436
527
|
supportedParameters?: string[];
|
|
528
|
+
supportedGenerationMethods?: string[];
|
|
437
529
|
}[];
|
|
438
530
|
version: number;
|
|
439
531
|
updatedAt: string;
|
|
@@ -443,8 +535,32 @@ export interface components {
|
|
|
443
535
|
name: string;
|
|
444
536
|
providerId: string;
|
|
445
537
|
/** @enum {string} */
|
|
446
|
-
harness: "claude" | "codex" | "grok" | "opencode2" | "pi";
|
|
538
|
+
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
|
|
447
539
|
model: string;
|
|
540
|
+
modelPolicy?: {
|
|
541
|
+
/**
|
|
542
|
+
* @default 1
|
|
543
|
+
* @enum {number}
|
|
544
|
+
*/
|
|
545
|
+
version: 1;
|
|
546
|
+
roles?: {
|
|
547
|
+
subagent?: string;
|
|
548
|
+
fast?: string;
|
|
549
|
+
planning?: string;
|
|
550
|
+
review?: string;
|
|
551
|
+
summary?: string;
|
|
552
|
+
compaction?: string;
|
|
553
|
+
weak?: string;
|
|
554
|
+
editor?: string;
|
|
555
|
+
};
|
|
556
|
+
allowedModels?: string[];
|
|
557
|
+
aliases?: {
|
|
558
|
+
[key: string]: string;
|
|
559
|
+
};
|
|
560
|
+
fallbacks?: {
|
|
561
|
+
[key: string]: string[];
|
|
562
|
+
};
|
|
563
|
+
};
|
|
448
564
|
version: number;
|
|
449
565
|
updatedAt: string;
|
|
450
566
|
};
|
|
@@ -459,6 +575,7 @@ export interface components {
|
|
|
459
575
|
inputModalities?: string[];
|
|
460
576
|
outputModalities?: string[];
|
|
461
577
|
supportedParameters?: string[];
|
|
578
|
+
supportedGenerationMethods?: string[];
|
|
462
579
|
}[];
|
|
463
580
|
refreshedAt: string;
|
|
464
581
|
/** @enum {string} */
|
|
@@ -468,22 +585,89 @@ export interface components {
|
|
|
468
585
|
warnings: string[];
|
|
469
586
|
};
|
|
470
587
|
RunInput: {
|
|
588
|
+
/** @enum {number} */
|
|
589
|
+
modelPolicyVersion: 1;
|
|
471
590
|
profileId: string;
|
|
472
591
|
/** @enum {string} */
|
|
473
|
-
harness: "claude" | "codex" | "grok" | "opencode2" | "pi";
|
|
592
|
+
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
|
|
474
593
|
model: string;
|
|
594
|
+
modelPolicy?: {
|
|
595
|
+
/**
|
|
596
|
+
* @default 1
|
|
597
|
+
* @enum {number}
|
|
598
|
+
*/
|
|
599
|
+
version: 1;
|
|
600
|
+
roles?: {
|
|
601
|
+
subagent?: string;
|
|
602
|
+
fast?: string;
|
|
603
|
+
planning?: string;
|
|
604
|
+
review?: string;
|
|
605
|
+
summary?: string;
|
|
606
|
+
compaction?: string;
|
|
607
|
+
weak?: string;
|
|
608
|
+
editor?: string;
|
|
609
|
+
};
|
|
610
|
+
allowedModels?: string[];
|
|
611
|
+
aliases?: {
|
|
612
|
+
[key: string]: string;
|
|
613
|
+
};
|
|
614
|
+
fallbacks?: {
|
|
615
|
+
[key: string]: string[];
|
|
616
|
+
};
|
|
617
|
+
};
|
|
475
618
|
planToken: string;
|
|
476
619
|
};
|
|
477
620
|
RunUpdate: {
|
|
478
621
|
/** @enum {string} */
|
|
479
622
|
status: "exited" | "failed" | "interrupted";
|
|
480
623
|
exitCode: number;
|
|
624
|
+
routingEvents?: {
|
|
625
|
+
/** Format: date-time */
|
|
626
|
+
at: string;
|
|
627
|
+
requestId: string;
|
|
628
|
+
requestedModel: string;
|
|
629
|
+
resolvedModel?: string;
|
|
630
|
+
reportedModel?: string;
|
|
631
|
+
/** @enum {string} */
|
|
632
|
+
decision: "allow" | "alias" | "reject" | "fallback";
|
|
633
|
+
/** @enum {string} */
|
|
634
|
+
role?: "main" | "subagent" | "fast" | "planning" | "review" | "summary" | "compaction" | "weak" | "editor";
|
|
635
|
+
reason?: string;
|
|
636
|
+
upstreamStatus?: number;
|
|
637
|
+
}[];
|
|
638
|
+
routingEventsDropped?: number;
|
|
481
639
|
};
|
|
482
640
|
Run: {
|
|
641
|
+
/** @enum {number} */
|
|
642
|
+
modelPolicyVersion?: 1;
|
|
483
643
|
profileId: string;
|
|
484
644
|
/** @enum {string} */
|
|
485
|
-
harness: "claude" | "codex" | "grok" | "opencode2" | "pi";
|
|
645
|
+
harness: "claude" | "codex" | "grok" | "opencode" | "opencode2" | "pi" | "omp" | "dsh" | "cline" | "hermes" | "prime-agent" | "gemini" | "aider" | "kilo";
|
|
486
646
|
model: string;
|
|
647
|
+
modelPolicy?: {
|
|
648
|
+
/**
|
|
649
|
+
* @default 1
|
|
650
|
+
* @enum {number}
|
|
651
|
+
*/
|
|
652
|
+
version: 1;
|
|
653
|
+
roles?: {
|
|
654
|
+
subagent?: string;
|
|
655
|
+
fast?: string;
|
|
656
|
+
planning?: string;
|
|
657
|
+
review?: string;
|
|
658
|
+
summary?: string;
|
|
659
|
+
compaction?: string;
|
|
660
|
+
weak?: string;
|
|
661
|
+
editor?: string;
|
|
662
|
+
};
|
|
663
|
+
allowedModels?: string[];
|
|
664
|
+
aliases?: {
|
|
665
|
+
[key: string]: string;
|
|
666
|
+
};
|
|
667
|
+
fallbacks?: {
|
|
668
|
+
[key: string]: string[];
|
|
669
|
+
};
|
|
670
|
+
};
|
|
487
671
|
planToken: string;
|
|
488
672
|
version: number;
|
|
489
673
|
updatedAt: string;
|
|
@@ -496,6 +680,21 @@ export interface components {
|
|
|
496
680
|
startedAt: string;
|
|
497
681
|
endedAt?: string;
|
|
498
682
|
exitCode?: number;
|
|
683
|
+
routingEvents?: {
|
|
684
|
+
/** Format: date-time */
|
|
685
|
+
at: string;
|
|
686
|
+
requestId: string;
|
|
687
|
+
requestedModel: string;
|
|
688
|
+
resolvedModel?: string;
|
|
689
|
+
reportedModel?: string;
|
|
690
|
+
/** @enum {string} */
|
|
691
|
+
decision: "allow" | "alias" | "reject" | "fallback";
|
|
692
|
+
/** @enum {string} */
|
|
693
|
+
role?: "main" | "subagent" | "fast" | "planning" | "review" | "summary" | "compaction" | "weak" | "editor";
|
|
694
|
+
reason?: string;
|
|
695
|
+
upstreamStatus?: number;
|
|
696
|
+
}[];
|
|
697
|
+
routingEventsDropped?: number;
|
|
499
698
|
};
|
|
500
699
|
Health: {
|
|
501
700
|
/** @enum {string} */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { HarnessId } from "./harness-types";
|
|
2
|
+
export declare function geminiPolicyArguments(input: readonly string[], originalHome: string): string[];
|
|
2
3
|
export declare function assertHarnessArguments(harness: HarnessId, args: readonly string[], options?: {
|
|
3
4
|
additionalReserved?: readonly string[];
|
|
4
5
|
reserveCodexConfig?: boolean;
|
|
@@ -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;
|
package/dist/harness-types.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { Model, Provider, Profile } from "./domain";
|
|
2
|
+
import type { CompiledModelPolicy, ModelPolicy } from "./model-policy";
|
|
3
|
+
import type { NativeModelPolicy } from "./native-model-policy";
|
|
4
|
+
import type { RoutingEvent } from "./inference-gateway";
|
|
2
5
|
export type HarnessId = Profile["harness"];
|
|
3
6
|
export type HarnessLaunchInput = {
|
|
4
7
|
harness: HarnessId;
|
|
@@ -14,6 +17,12 @@ export type HarnessLaunchInput = {
|
|
|
14
17
|
cwd: string;
|
|
15
18
|
version?: string;
|
|
16
19
|
sessionDir?: string;
|
|
20
|
+
providerId?: string;
|
|
21
|
+
providerBaseUrl?: string;
|
|
22
|
+
modelPolicy?: ModelPolicy;
|
|
23
|
+
compiledPolicy?: CompiledModelPolicy;
|
|
24
|
+
nativePolicy?: NativeModelPolicy;
|
|
25
|
+
onRoutingEvent?: (event: RoutingEvent) => void;
|
|
17
26
|
};
|
|
18
27
|
export type PreparedLaunch = {
|
|
19
28
|
executable: string;
|
|
@@ -21,5 +30,6 @@ export type PreparedLaunch = {
|
|
|
21
30
|
env: Record<string, string>;
|
|
22
31
|
configPaths: string[];
|
|
23
32
|
warnings: string[];
|
|
33
|
+
beforeLaunch?: () => Promise<void>;
|
|
24
34
|
cleanup?: () => Promise<void>;
|
|
25
35
|
};
|
package/dist/harnesses.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
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" | "pi";
|
|
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" | "pi";
|
|
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>;
|
|
13
16
|
export declare function validateHarnessVersion(harness: HarnessId, version: string | undefined): void;
|
|
14
17
|
export declare function codexModel(model: HarnessLaunchInput["models"][number], priority: number): {
|
|
15
18
|
slug: string;
|
|
@@ -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>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type HermesModelRoles = {
|
|
2
|
+
subagent?: string;
|
|
3
|
+
fast?: string;
|
|
4
|
+
planning?: string;
|
|
5
|
+
review?: string;
|
|
6
|
+
summary?: string;
|
|
7
|
+
compaction?: string;
|
|
8
|
+
weak?: string;
|
|
9
|
+
editor?: string;
|
|
10
|
+
};
|
|
11
|
+
export type HermesModelPolicyFragment = {
|
|
12
|
+
auxiliary: Record<string, {
|
|
13
|
+
api_mode: string;
|
|
14
|
+
provider: "custom";
|
|
15
|
+
model: string;
|
|
16
|
+
base_url: string;
|
|
17
|
+
api_key_env: "SWITCHER_HERMES_AUX_API_KEY";
|
|
18
|
+
fallback_chain: [];
|
|
19
|
+
}>;
|
|
20
|
+
delegation: {
|
|
21
|
+
model: string;
|
|
22
|
+
provider: "custom";
|
|
23
|
+
base_url: string;
|
|
24
|
+
};
|
|
25
|
+
env: {
|
|
26
|
+
apiKeyEnv: "SWITCHER_HERMES_AUX_API_KEY";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/** Compile verified Hermes auxiliary config fields without serializing credentials. */
|
|
30
|
+
export declare function compileHermesModelPolicy(currentModel: string, roles: HermesModelRoles, baseUrl: string, apiMode?: string): HermesModelPolicyFragment;
|