@bastani/atomic 0.9.41-alpha.1 → 0.9.41-alpha.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/builtin/intercom/package.json +2 -2
  3. package/dist/builtin/mcp/package.json +1 -1
  4. package/dist/builtin/subagents/package.json +3 -3
  5. package/dist/builtin/web-access/package.json +2 -2
  6. package/dist/builtin/workflows/CHANGELOG.md +8 -0
  7. package/dist/builtin/workflows/builtin/adversarial-verification.js +2 -2
  8. package/dist/builtin/workflows/builtin/{chunk-qjqn389g.js → chunk-2jfst7e4.js} +72 -10
  9. package/dist/builtin/workflows/builtin/{chunk-4bwtzyjq.js → chunk-49kkbdpr.js} +1 -1
  10. package/dist/builtin/workflows/builtin/{chunk-qdd897wm.js → chunk-apagcs4r.js} +1 -1
  11. package/dist/builtin/workflows/builtin/{chunk-454hz1qt.js → chunk-dcxscfnb.js} +1 -1
  12. package/dist/builtin/workflows/builtin/{chunk-bjva9j5k.js → chunk-hx8v4p97.js} +1 -1
  13. package/dist/builtin/workflows/builtin/{chunk-85mx6wcf.js → chunk-k5q3t7je.js} +1 -1
  14. package/dist/builtin/workflows/builtin/{chunk-8kkv04hz.js → chunk-n2gkzkty.js} +1 -1
  15. package/dist/builtin/workflows/builtin/{chunk-y45tkftg.js → chunk-txbc93t6.js} +1 -1
  16. package/dist/builtin/workflows/builtin/{chunk-x0vvjyzg.js → chunk-w4xp1w1f.js} +1 -1
  17. package/dist/builtin/workflows/builtin/{chunk-5eh0brtd.js → chunk-z3pajrfs.js} +1 -1
  18. package/dist/builtin/workflows/builtin/classify-and-act.js +2 -2
  19. package/dist/builtin/workflows/builtin/fan-out-and-synthesize.js +2 -2
  20. package/dist/builtin/workflows/builtin/generate-and-filter.js +2 -2
  21. package/dist/builtin/workflows/builtin/goal.js +2 -2
  22. package/dist/builtin/workflows/builtin/index.js +10 -10
  23. package/dist/builtin/workflows/builtin/loop-until-done.js +2 -2
  24. package/dist/builtin/workflows/builtin/open-claude-design.js +2 -2
  25. package/dist/builtin/workflows/builtin/ralph.js +2 -2
  26. package/dist/builtin/workflows/builtin/tournament.js +2 -2
  27. package/dist/builtin/workflows/package.json +2 -2
  28. package/dist/builtin/workflows/src/extension/index.bundle.mjs +511 -28
  29. package/dist/builtin/workflows/src/index.js +582 -99
  30. package/dist/core/model-config.d.ts +28 -0
  31. package/dist/core/model-config.d.ts.map +1 -1
  32. package/dist/core/provider-composer-internal.d.ts +2 -1
  33. package/dist/core/provider-composer-internal.d.ts.map +1 -1
  34. package/dist/core/provider-composer-internal.js +8 -6
  35. package/dist/core/provider-composer-internal.js.map +1 -1
  36. package/dist/core/tools/grep.js +1 -1
  37. package/dist/core/tools/grep.js.map +1 -1
  38. package/docs/models-configuration.md +9 -0
  39. package/docs/models.md +3 -1
  40. package/docs/providers.md +1 -1
  41. package/docs/workflows/authoring.md +1 -1
  42. package/npm-shrinkwrap.json +67 -54
  43. package/package.json +6 -6
  44. package/schemas/models.schema.json +21 -0
@@ -93,6 +93,8 @@ export declare const ModelsJsonCompatSchema: Type.TObject<{
93
93
  }>>>;
94
94
  enforcesPreservedThinkingBinding: Type.TOptional<Type.TBoolean>;
95
95
  delegatesThinkingModelBinding: Type.TOptional<Type.TBoolean>;
96
+ imageInput: Type.TOptional<Type.TUnion<[Type.TLiteral<"assets">, Type.TLiteral<"images">, Type.TLiteral<"state-image-urls">]>>;
97
+ sendImageOptInHeader: Type.TOptional<Type.TBoolean>;
96
98
  supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
97
99
  supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
98
100
  sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
@@ -256,6 +258,8 @@ declare const ModelDefinitionSchema: Type.TObject<{
256
258
  }>>>;
257
259
  enforcesPreservedThinkingBinding: Type.TOptional<Type.TBoolean>;
258
260
  delegatesThinkingModelBinding: Type.TOptional<Type.TBoolean>;
261
+ imageInput: Type.TOptional<Type.TUnion<[Type.TLiteral<"assets">, Type.TLiteral<"images">, Type.TLiteral<"state-image-urls">]>>;
262
+ sendImageOptInHeader: Type.TOptional<Type.TBoolean>;
259
263
  supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
260
264
  supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
261
265
  sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
@@ -417,6 +421,8 @@ declare const ModelOverrideSchema: Type.TObject<{
417
421
  }>>>;
418
422
  enforcesPreservedThinkingBinding: Type.TOptional<Type.TBoolean>;
419
423
  delegatesThinkingModelBinding: Type.TOptional<Type.TBoolean>;
424
+ imageInput: Type.TOptional<Type.TUnion<[Type.TLiteral<"assets">, Type.TLiteral<"images">, Type.TLiteral<"state-image-urls">]>>;
425
+ sendImageOptInHeader: Type.TOptional<Type.TBoolean>;
420
426
  supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
421
427
  supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
422
428
  sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
@@ -529,6 +535,8 @@ declare const ProviderConfigSchema: Type.TObject<{
529
535
  }>>>;
530
536
  enforcesPreservedThinkingBinding: Type.TOptional<Type.TBoolean>;
531
537
  delegatesThinkingModelBinding: Type.TOptional<Type.TBoolean>;
538
+ imageInput: Type.TOptional<Type.TUnion<[Type.TLiteral<"assets">, Type.TLiteral<"images">, Type.TLiteral<"state-image-urls">]>>;
539
+ sendImageOptInHeader: Type.TOptional<Type.TBoolean>;
532
540
  supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
533
541
  supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
534
542
  sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
@@ -693,6 +701,8 @@ declare const ProviderConfigSchema: Type.TObject<{
693
701
  }>>>;
694
702
  enforcesPreservedThinkingBinding: Type.TOptional<Type.TBoolean>;
695
703
  delegatesThinkingModelBinding: Type.TOptional<Type.TBoolean>;
704
+ imageInput: Type.TOptional<Type.TUnion<[Type.TLiteral<"assets">, Type.TLiteral<"images">, Type.TLiteral<"state-image-urls">]>>;
705
+ sendImageOptInHeader: Type.TOptional<Type.TBoolean>;
696
706
  supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
697
707
  supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
698
708
  sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
@@ -854,6 +864,8 @@ declare const ProviderConfigSchema: Type.TObject<{
854
864
  }>>>;
855
865
  enforcesPreservedThinkingBinding: Type.TOptional<Type.TBoolean>;
856
866
  delegatesThinkingModelBinding: Type.TOptional<Type.TBoolean>;
867
+ imageInput: Type.TOptional<Type.TUnion<[Type.TLiteral<"assets">, Type.TLiteral<"images">, Type.TLiteral<"state-image-urls">]>>;
868
+ sendImageOptInHeader: Type.TOptional<Type.TBoolean>;
857
869
  supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
858
870
  supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
859
871
  sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
@@ -969,6 +981,8 @@ export declare const ModelsConfigSchema: Type.TObject<{
969
981
  }>>>;
970
982
  enforcesPreservedThinkingBinding: Type.TOptional<Type.TBoolean>;
971
983
  delegatesThinkingModelBinding: Type.TOptional<Type.TBoolean>;
984
+ imageInput: Type.TOptional<Type.TUnion<[Type.TLiteral<"assets">, Type.TLiteral<"images">, Type.TLiteral<"state-image-urls">]>>;
985
+ sendImageOptInHeader: Type.TOptional<Type.TBoolean>;
972
986
  supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
973
987
  supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
974
988
  sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
@@ -1133,6 +1147,8 @@ export declare const ModelsConfigSchema: Type.TObject<{
1133
1147
  }>>>;
1134
1148
  enforcesPreservedThinkingBinding: Type.TOptional<Type.TBoolean>;
1135
1149
  delegatesThinkingModelBinding: Type.TOptional<Type.TBoolean>;
1150
+ imageInput: Type.TOptional<Type.TUnion<[Type.TLiteral<"assets">, Type.TLiteral<"images">, Type.TLiteral<"state-image-urls">]>>;
1151
+ sendImageOptInHeader: Type.TOptional<Type.TBoolean>;
1136
1152
  supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
1137
1153
  supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
1138
1154
  sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
@@ -1294,6 +1310,8 @@ export declare const ModelsConfigSchema: Type.TObject<{
1294
1310
  }>>>;
1295
1311
  enforcesPreservedThinkingBinding: Type.TOptional<Type.TBoolean>;
1296
1312
  delegatesThinkingModelBinding: Type.TOptional<Type.TBoolean>;
1313
+ imageInput: Type.TOptional<Type.TUnion<[Type.TLiteral<"assets">, Type.TLiteral<"images">, Type.TLiteral<"state-image-urls">]>>;
1314
+ sendImageOptInHeader: Type.TOptional<Type.TBoolean>;
1297
1315
  supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
1298
1316
  supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
1299
1317
  sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
@@ -1409,6 +1427,8 @@ export declare const ModelsJsonSchemas: {
1409
1427
  }>>>;
1410
1428
  enforcesPreservedThinkingBinding: Type.TOptional<Type.TBoolean>;
1411
1429
  delegatesThinkingModelBinding: Type.TOptional<Type.TBoolean>;
1430
+ imageInput: Type.TOptional<Type.TUnion<[Type.TLiteral<"assets">, Type.TLiteral<"images">, Type.TLiteral<"state-image-urls">]>>;
1431
+ sendImageOptInHeader: Type.TOptional<Type.TBoolean>;
1412
1432
  supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
1413
1433
  supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
1414
1434
  sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
@@ -1573,6 +1593,8 @@ export declare const ModelsJsonSchemas: {
1573
1593
  }>>>;
1574
1594
  enforcesPreservedThinkingBinding: Type.TOptional<Type.TBoolean>;
1575
1595
  delegatesThinkingModelBinding: Type.TOptional<Type.TBoolean>;
1596
+ imageInput: Type.TOptional<Type.TUnion<[Type.TLiteral<"assets">, Type.TLiteral<"images">, Type.TLiteral<"state-image-urls">]>>;
1597
+ sendImageOptInHeader: Type.TOptional<Type.TBoolean>;
1576
1598
  supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
1577
1599
  supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
1578
1600
  sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
@@ -1734,6 +1756,8 @@ export declare const ModelsJsonSchemas: {
1734
1756
  }>>>;
1735
1757
  enforcesPreservedThinkingBinding: Type.TOptional<Type.TBoolean>;
1736
1758
  delegatesThinkingModelBinding: Type.TOptional<Type.TBoolean>;
1759
+ imageInput: Type.TOptional<Type.TUnion<[Type.TLiteral<"assets">, Type.TLiteral<"images">, Type.TLiteral<"state-image-urls">]>>;
1760
+ sendImageOptInHeader: Type.TOptional<Type.TBoolean>;
1737
1761
  supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
1738
1762
  supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
1739
1763
  sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
@@ -1899,6 +1923,8 @@ export declare const ModelsJsonSchemas: {
1899
1923
  }>>>;
1900
1924
  enforcesPreservedThinkingBinding: Type.TOptional<Type.TBoolean>;
1901
1925
  delegatesThinkingModelBinding: Type.TOptional<Type.TBoolean>;
1926
+ imageInput: Type.TOptional<Type.TUnion<[Type.TLiteral<"assets">, Type.TLiteral<"images">, Type.TLiteral<"state-image-urls">]>>;
1927
+ sendImageOptInHeader: Type.TOptional<Type.TBoolean>;
1902
1928
  supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
1903
1929
  supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
1904
1930
  sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
@@ -2060,6 +2086,8 @@ export declare const ModelsJsonSchemas: {
2060
2086
  }>>>;
2061
2087
  enforcesPreservedThinkingBinding: Type.TOptional<Type.TBoolean>;
2062
2088
  delegatesThinkingModelBinding: Type.TOptional<Type.TBoolean>;
2089
+ imageInput: Type.TOptional<Type.TUnion<[Type.TLiteral<"assets">, Type.TLiteral<"images">, Type.TLiteral<"state-image-urls">]>>;
2090
+ sendImageOptInHeader: Type.TOptional<Type.TBoolean>;
2063
2091
  supportsDeveloperRole: Type.TOptional<Type.TBoolean>;
2064
2092
  supportsMidConvoSystemMessages: Type.TOptional<Type.TBoolean>;
2065
2093
  sessionAffinityFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openai-nosession">, Type.TLiteral<"openrouter">]>>;
@@ -1 +1 @@
1
- {"version":3,"file":"model-config.d.ts","sourceRoot":"","sources":["../../src/core/model-config.ts"],"names":[],"mappings":"AAAA,wDAAwD;AAWxD,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAoC5C,uGAAuG;AACvG,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUlC,CAAC;AAEF,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBzB,CAAC;AAEH,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBvB,CAAC;AAEH,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IACL,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACb,CAAC;AAIF,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACnE,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACzE,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAqBrE,yCAAyC;AACzC,qBAAa,WAAW;IACvB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA0C;IACpE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;IAE3C,OAAO,eAGN;IAED,OAAa,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAsC1E;IAED,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAE9D;IAED,cAAc,IAAI,SAAS,MAAM,EAAE,CAElC;IAED,QAAQ,IAAI,MAAM,GAAG,SAAS,CAE7B;CACD"}
@@ -1,4 +1,4 @@
1
- import type { AnyModel, Api, ApiKeyAuth, AssistantMessageEventStream, ClassifierApi, ImageApi, Model, OAuthAuth, OAuthCredentials, OAuthLoginCallbacks, Provider, ProviderClassifier, ProviderImages, RefreshModelsContext, SimpleStreamOptions, TranscriptContext } from "@bastani/pi-ai";
1
+ import type { AnyModel, Api, ApiKeyAuth, AssistantMessageEventStream, ClassifierApi, ClassifierModel, ImageApi, Model, OAuthAuth, OAuthCredentials, OAuthLoginCallbacks, Provider, ProviderClassifier, ProviderImages, RefreshModelsContext, SimpleStreamOptions, TranscriptContext } from "@bastani/pi-ai";
2
2
  import type { ModelsJsonModelOverride, ModelsJsonProvider } from "./model-config.ts";
3
3
  import { clearConfigValueCache } from "./resolve-config-value.ts";
4
4
  export interface ExtensionOAuthConfig {
@@ -49,6 +49,7 @@ export interface ProviderClassifierModelConfig extends ProviderModelConfigBase {
49
49
  type: "classifier";
50
50
  api?: ClassifierApi;
51
51
  contextWindow: number;
52
+ compat?: ClassifierModel<ClassifierApi>["compat"];
52
53
  }
53
54
  export type ProviderModelConfig = ProviderChatModelConfig | ProviderImageModelConfig | ProviderClassifierModelConfig;
54
55
  /** Input type for the extension registerProvider API. */
@@ -1 +1 @@
1
- {"version":3,"file":"provider-composer-internal.d.ts","sourceRoot":"","sources":["../../src/core/provider-composer-internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,QAAQ,EACR,GAAG,EACH,UAAU,EACV,2BAA2B,EAG3B,aAAa,EACb,QAAQ,EACR,KAAK,EAEL,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,QAAQ,EAER,kBAAkB,EAElB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,KAAK,EAAmB,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACtG,OAAO,EACN,qBAAqB,EAMrB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,oBAAoB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,KAAK,CAAC,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,C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;AAED,wBAAgB,gBAAgB,CAC/B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,QAAQ,GAAG,SAAS,EAC1B,MAAM,EAAE,kBAAkB,GAAG,SAAS,EACtC,SAAS,EAAE,mBAAmB,GAAG,SAAS,GACxC,SAAS,GAAG,SAAS,CAkBvB;AAED,wBAAgB,eAAe,CAC9B,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,kBAAkB,GAAG,SAAS,EACtC,SAAS,EAAE,mBAAmB,GAAG,SAAS,GACxC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAWpC"}
1
+ {"version":3,"file":"provider-composer-internal.d.ts","sourceRoot":"","sources":["../../src/core/provider-composer-internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,QAAQ,EACR,GAAG,EACH,UAAU,EACV,2BAA2B,EAG3B,aAAa,EACb,eAAe,EACf,QAAQ,EACR,KAAK,EAEL,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,QAAQ,EAER,kBAAkB,EAElB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,KAAK,EAAmB,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACtG,OAAO,EACN,qBAAqB,EAMrB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,oBAAoB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,KAAK,CAAC,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACtF;;;;;;;OAOG;IACH,YAAY,CAAC,WAAW,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC5F,SAAS,CAAC,WAAW,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AG,SAAS,EAC1B,MAAM,EAAE,kBAAkB,GAAG,SAAS,EACtC,SAAS,EAAE,mBAAmB,GAAG,SAAS,GACxC,SAAS,GAAG,SAAS,CAkBvB;AAED,wBAAgB,eAAe,CAC9B,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,kBAAkB,GAAG,SAAS,EACtC,SAAS,EAAE,mBAAmB,GAAG,SAAS,GACxC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAWpC"}
@@ -133,13 +133,15 @@ export function applyModelsJson(providerId, baseModels, config) {
133
133
  config.authHeader === undefined) {
134
134
  throw new Error(`Provider ${providerId}: must specify "baseUrl", "headers", "compat", "modelOverrides", or "models".`);
135
135
  }
136
- const models = baseModels.map((model) => isModelType(model, "chat")
137
- ? {
138
- ...model,
139
- baseUrl: config.oauth === "radius" ? model.baseUrl : (config.baseUrl ?? model.baseUrl),
140
- compat: mergeCompat(model.compat, config.compat),
136
+ const models = baseModels.map((model) => {
137
+ const baseUrl = config.oauth === "radius" ? model.baseUrl : (config.baseUrl ?? model.baseUrl);
138
+ if (isModelType(model, "chat"))
139
+ return { ...model, baseUrl, compat: mergeCompat(model.compat, config.compat) };
140
+ if (isModelType(model, "classifier") && config.compat) {
141
+ return { ...model, baseUrl, compat: { ...model.compat, ...config.compat } };
141
142
  }
142
- : { ...model, baseUrl: config.oauth === "radius" ? model.baseUrl : (config.baseUrl ?? model.baseUrl) });
143
+ return { ...model, baseUrl };
144
+ });
143
145
  for (const definition of config.models ?? []) {
144
146
  const existingIndex = models.findIndex((model) => isModelType(model, "chat") && model.id === definition.id);
145
147
  const defaults = findModelDefaults(models.filter((model) => isModelType(model, "chat")), definition.id, definition.api ?? config.api ?? (providerId === "azure" ? "azure-openai-responses" : undefined));
@@ -1 +1 @@
1
- {"version":3,"file":"provider-composer-internal.js","sourceRoot":"","sources":["../../src/core/provider-composer-internal.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,WAAW,EAAE,MAAM,gB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E,OAAO,EAAE,UAAU,CAAC,CAAC;QACtD,CAAC;KACD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe,CAC9B,KAAe,EACf,MAAsC,EACtC,SAA0C;IAE1C,MAAM,UAAU,GAAG,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACnH,MAAM,cAAc,GAAG,SAAS,EAAE,MAAM,EAAE,IAAI,CAC7C,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,CACrF,CAAC;IACF,MAAM,OAAO,GAAG;QACf,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;QACzF,GAAG,UAAU,EAAE,OAAO;QACtB,GAAG,cAAc,EAAE,OAAO;KAC1B,CAAC;IACF,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9D,CAAC","sourcesContent":["import type {\n\tAnyModel,\n\tApi,\n\tApiKeyAuth,\n\tAssistantMessageEventStream,\n\tAuthContext,\n\tAuthResult,\n\tClassifierApi,\n\tImageApi,\n\tModel,\n\tModelAuth,\n\tOAuthAuth,\n\tOAuthCredentials,\n\tOAuthLoginCallbacks,\n\tProvider,\n\tProviderAuthInteraction,\n\tProviderClassifier,\n\tProviderHeaders,\n\tProviderImages,\n\tRefreshModelsContext,\n\tSimpleStreamOptions,\n\tTranscriptContext,\n} from \"@bastani/pi-ai\";\nimport { isModelType } from \"@bastani/pi-ai\";\nimport { extensionRefreshRejection } from \"./extension-oauth-refresh-rejection.ts\";\nimport type { ModelsJsonModel, ModelsJsonModelOverride, ModelsJsonProvider } from \"./model-config.ts\";\nimport {\n\tclearConfigValueCache,\n\tgetConfigValueEnvVarNames,\n\tisCommandConfigValue,\n\tisConfigValueConfigured,\n\tresolveConfigValueOrThrow,\n\tresolveHeadersOrThrow,\n} from \"./resolve-config-value.ts\";\n\nexport interface ExtensionOAuthConfig {\n\tname: string;\n\tloginLabel?: string;\n\tusesCallbackServer?: boolean;\n\tlogin(callbacks: OAuthLoginCallbacks, signal: AbortSignal): Promise<OAuthCredentials>;\n\t/**\n\t * Refresh expired credentials. Pass `signal` to the network call, but add no timeout or abort of your own: Atomic\n\t * never aborts it on a timeout, because once the request is sent the provider may already have rotated the\n\t * refresh token. The caller stops waiting after 60 seconds; a later result is still saved, and a graceful exit\n\t * waits briefly for it. It is a required parameter so the contract is stated in the type.\n\t * Throw `OAuthRefreshRejectedError` when the provider rejected the stored login; common error shapes are mapped\n\t * onto it (see `extensionRefreshRejection`).\n\t */\n\trefreshToken(credentials: OAuthCredentials, signal: AbortSignal): Promise<OAuthCredentials>;\n\tgetApiKey(credentials: OAuthCredentials): string;\n\tmodifyModels?(models: Model<Api>[], credentials: OAuthCredentials): Model<Api>[];\n}\n\ninterface ProviderModelConfigBase {\n\tid: string;\n\tname: string;\n\tapi?: string;\n\tbaseUrl?: string;\n\tinput: AnyModel[\"input\"];\n\tinputLimits?: AnyModel[\"inputLimits\"];\n\tcost: AnyModel[\"cost\"];\n\theaders?: Record<string, string>;\n}\n\nexport interface ProviderChatModelConfig extends ProviderModelConfigBase {\n\ttype?: \"chat\";\n\tapi?: Api;\n\treasoning: boolean;\n\tthinkingLevelMap?: Model<Api>[\"thinkingLevelMap\"];\n\tpromptCache?: Model<Api>[\"promptCache\"];\n\tcontextWindow: number;\n\tmaxTokens: number;\n\tsamplingParams?: Model<Api>[\"samplingParams\"];\n\tsamplingParamsByThinkingLevel?: Model<Api>[\"samplingParamsByThinkingLevel\"];\n\tcompat?: Model<Api>[\"compat\"];\n}\n\nexport interface ProviderImageModelConfig extends ProviderModelConfigBase {\n\ttype: \"image\";\n\tapi?: ImageApi;\n\toutput: (\"text\" | \"image\")[];\n}\n\nexport interface ProviderClassifierModelConfig extends ProviderModelConfigBase {\n\ttype: \"classifier\";\n\tapi?: ClassifierApi;\n\tcontextWindow: number;\n}\n\nexport type ProviderModelConfig = ProviderChatModelConfig | ProviderImageModelConfig | ProviderClassifierModelConfig;\n\n/** Input type for the extension registerProvider API. */\nexport interface ProviderConfigInput {\n\tname?: string;\n\taliasOf?: string;\n\tbaseUrl?: string;\n\tapiKey?: string;\n\tapi?: Api;\n\tstreamSimple?: (\n\t\tmodel: Model<Api>,\n\t\tcontext: TranscriptContext,\n\t\toptions?: SimpleStreamOptions,\n\t) => AssistantMessageEventStream;\n\timages?: Partial<Record<ImageApi, ProviderImages>>;\n\tclassifiers?: Partial<Record<ClassifierApi, ProviderClassifier>>;\n\theaders?: Record<string, string>;\n\tauthHeader?: boolean;\n\toauth?: ExtensionOAuthConfig;\n\tmodels?: ProviderModelConfig[];\n\trefreshModels?(context: RefreshModelsContext): Promise<NonNullable<ProviderConfigInput[\"models\"]>>;\n}\n\nexport type AuthStatus = {\n\tconfigured: boolean;\n\tsource?: \"stored\" | \"runtime\" | \"environment\" | \"fallback\" | \"models_json_key\" | \"models_json_command\";\n\tlabel?: string;\n};\n\nexport const clearApiKeyCache = clearConfigValueCache;\n\nfunction mergeCompat(\n\tbase: Model<Api>[\"compat\"],\n\toverride: Model<Api>[\"compat\"] | ModelsJsonModelOverride[\"compat\"],\n): Model<Api>[\"compat\"] {\n\tif (!override) return base;\n\tconst merged = { ...base, ...override } as NonNullable<Model<Api>[\"compat\"]>;\n\tconst baseNested = base as Record<string, unknown> | undefined;\n\tconst overrideNested = override as Record<string, unknown>;\n\tconst mergedNested = merged as Record<string, unknown>;\n\tfor (const key of [\"openRouterRouting\", \"vercelGatewayRouting\", \"chatTemplateKwargs\", \"chatTemplateArgs\"] as const) {\n\t\tconst baseValue = baseNested?.[key];\n\t\tconst overrideValue = overrideNested[key];\n\t\tif (\n\t\t\t(typeof baseValue === \"object\" && baseValue !== null) ||\n\t\t\t(typeof overrideValue === \"object\" && overrideValue !== null)\n\t\t) {\n\t\t\tmergedNested[key] = { ...(baseValue as object | undefined), ...(overrideValue as object | undefined) };\n\t\t}\n\t}\n\treturn merged;\n}\n\nfunction mergeInputLimits(\n\tbase: Model<Api>[\"inputLimits\"],\n\toverride: ModelsJsonModelOverride[\"inputLimits\"],\n): Model<Api>[\"inputLimits\"] {\n\tif (!override) return base;\n\treturn {\n\t\t...base,\n\t\t...override,\n\t\timages: override.images\n\t\t\t? {\n\t\t\t\t\t...base?.images,\n\t\t\t\t\t...override.images,\n\t\t\t\t\tresize: override.images.resize\n\t\t\t\t\t\t? { ...base?.images?.resize, ...override.images.resize }\n\t\t\t\t\t\t: base?.images?.resize,\n\t\t\t\t}\n\t\t\t: base?.images,\n\t};\n}\n\nfunction mergeSamplingParamsByThinkingLevel(\n\tbase: Model<Api>[\"samplingParamsByThinkingLevel\"],\n\toverride: Model<Api>[\"samplingParamsByThinkingLevel\"],\n): Model<Api>[\"samplingParamsByThinkingLevel\"] {\n\tif (!override) return base;\n\tconst merged = { ...base };\n\tfor (const level of [\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"] as const) {\n\t\tconst params = override[level];\n\t\tif (params) merged[level] = { ...base?.[level], ...params };\n\t}\n\treturn merged;\n}\n\nexport function applyModelOverride(model: Model<Api>, override: ModelsJsonModelOverride): Model<Api> {\n\treturn {\n\t\t...model,\n\t\tpromptCache: override.promptCache ? { ...model.promptCache, ...override.promptCache } : model.promptCache,\n\t\tname: override.name ?? model.name,\n\t\treasoning: override.reasoning ?? model.reasoning,\n\t\tthinkingLevelMap: override.thinkingLevelMap\n\t\t\t? { ...model.thinkingLevelMap, ...override.thinkingLevelMap }\n\t\t\t: model.thinkingLevelMap,\n\t\tinput: (override.input as Model<Api>[\"input\"] | undefined) ?? model.input,\n\t\tinputLimits: mergeInputLimits(model.inputLimits, override.inputLimits),\n\t\tcost: override.cost\n\t\t\t? {\n\t\t\t\t\tinput: override.cost.input ?? model.cost.input,\n\t\t\t\t\toutput: override.cost.output ?? model.cost.output,\n\t\t\t\t\tcacheRead: override.cost.cacheRead ?? model.cost.cacheRead,\n\t\t\t\t\tcacheWrite: override.cost.cacheWrite ?? model.cost.cacheWrite,\n\t\t\t\t\ttiers: override.cost.tiers ?? model.cost.tiers,\n\t\t\t\t}\n\t\t\t: model.cost,\n\t\tcontextWindow: override.contextWindow ?? model.contextWindow,\n\t\tmaxTokens: override.maxTokens ?? model.maxTokens,\n\t\tsamplingParams: override.samplingParams\n\t\t\t? { ...model.samplingParams, ...override.samplingParams }\n\t\t\t: model.samplingParams,\n\t\tsamplingParamsByThinkingLevel: mergeSamplingParamsByThinkingLevel(\n\t\t\tmodel.samplingParamsByThinkingLevel,\n\t\t\toverride.samplingParamsByThinkingLevel,\n\t\t),\n\t\tcompat: mergeCompat(model.compat, override.compat),\n\t};\n}\n\nfunction modelFromJson(\n\tproviderId: string,\n\tdefinition: ModelsJsonModel,\n\tproviderConfig: ModelsJsonProvider,\n\tdefaults: Model<Api> | undefined,\n): Model<Api> {\n\tconst api = definition.api ?? providerConfig.api ?? defaults?.api;\n\tif (!api) {\n\t\tthrow new Error(\n\t\t\t`Provider ${providerId}, model ${definition.id}: no \"api\" specified. Set at provider or model level.`,\n\t\t);\n\t}\n\tconst baseUrl = definition.baseUrl ?? providerConfig.baseUrl ?? defaults?.baseUrl;\n\tif (!baseUrl) throw new Error(`Provider ${providerId}: \"baseUrl\" is required when defining custom models.`);\n\tif (definition.contextWindow !== undefined && definition.contextWindow <= 0) {\n\t\tthrow new Error(`Provider ${providerId}, model ${definition.id}: invalid contextWindow`);\n\t}\n\tif (definition.maxTokens !== undefined && definition.maxTokens <= 0) {\n\t\tthrow new Error(`Provider ${providerId}, model ${definition.id}: invalid maxTokens`);\n\t}\n\treturn {\n\t\tid: definition.id,\n\t\tname: definition.name ?? definition.id,\n\t\tapi: api as Api,\n\t\tprovider: providerId,\n\t\tbaseUrl,\n\t\treasoning: definition.reasoning ?? false,\n\t\tthinkingLevelMap: definition.thinkingLevelMap,\n\t\tinput: (definition.input ?? [\"text\"]) as Model<Api>[\"input\"],\n\t\tinputLimits: definition.inputLimits,\n\t\tcost: definition.cost ?? { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n\t\tpromptCache: definition.promptCache,\n\t\tcontextWindow: definition.contextWindow ?? 128000,\n\t\tmaxTokens: definition.maxTokens ?? 16384,\n\t\tsamplingParams: definition.samplingParams,\n\t\tsamplingParamsByThinkingLevel: definition.samplingParamsByThinkingLevel,\n\t\theaders: undefined,\n\t\tcompat: mergeCompat(providerConfig.compat, definition.compat),\n\t};\n}\n\nfunction findModelDefaults(models: readonly Model<Api>[], modelId: string, api?: Api): Model<Api> | undefined {\n\treturn (\n\t\tmodels.find((model) => model.id === modelId) ??\n\t\t(api ? models.find((model) => model.api === api) : undefined) ??\n\t\tmodels.find((model) => model.api === \"openai-completions\") ??\n\t\tmodels[0]\n\t);\n}\n\nexport function applyModelsJson(\n\tproviderId: string,\n\tbaseModels: readonly AnyModel[],\n\tconfig: ModelsJsonProvider | undefined,\n): AnyModel[] {\n\tif (!config) return [...baseModels];\n\tif (config.oauth && !config.baseUrl) {\n\t\tthrow new Error(`Provider ${providerId}: \"baseUrl\" is required when \"oauth\" is set.`);\n\t}\n\tconst hasOverrides = config.modelOverrides && Object.keys(config.modelOverrides).length > 0;\n\tif (\n\t\t!config.models?.length &&\n\t\t!config.baseUrl &&\n\t\t!config.headers &&\n\t\t!config.compat &&\n\t\t!hasOverrides &&\n\t\t!config.apiKey &&\n\t\t!config.oauth &&\n\t\tconfig.authHeader === undefined\n\t) {\n\t\tthrow new Error(\n\t\t\t`Provider ${providerId}: must specify \"baseUrl\", \"headers\", \"compat\", \"modelOverrides\", or \"models\".`,\n\t\t);\n\t}\n\n\tconst models: AnyModel[] = baseModels.map((model) =>\n\t\tisModelType(model, \"chat\")\n\t\t\t? {\n\t\t\t\t\t...model,\n\t\t\t\t\tbaseUrl: config.oauth === \"radius\" ? model.baseUrl : (config.baseUrl ?? model.baseUrl),\n\t\t\t\t\tcompat: mergeCompat(model.compat, config.compat),\n\t\t\t\t}\n\t\t\t: { ...model, baseUrl: config.oauth === \"radius\" ? model.baseUrl : (config.baseUrl ?? model.baseUrl) },\n\t);\n\tfor (const definition of config.models ?? []) {\n\t\tconst existingIndex = models.findIndex((model) => isModelType(model, \"chat\") && model.id === definition.id);\n\t\tconst defaults = findModelDefaults(\n\t\t\tmodels.filter((model) => isModelType(model, \"chat\")),\n\t\t\tdefinition.id,\n\t\t\tdefinition.api ?? config.api ?? (providerId === \"azure\" ? \"azure-openai-responses\" : undefined),\n\t\t);\n\t\tconst model = modelFromJson(providerId, definition, config, defaults);\n\t\tif (existingIndex >= 0) models[existingIndex] = model;\n\t\telse models.push(model);\n\t}\n\treturn models;\n}\n\nexport function applyExtension(\n\tproviderId: string,\n\tmodels: readonly AnyModel[],\n\tconfig: ProviderConfigInput | undefined,\n): AnyModel[] {\n\tif (!config) return [...models];\n\tif (!config.models) {\n\t\treturn config.baseUrl ? models.map((model) => ({ ...model, baseUrl: config.baseUrl! })) : [...models];\n\t}\n\treturn config.models.map((definition) => {\n\t\tconst type = definition.type ?? \"chat\";\n\t\tconst candidates = models.filter((model) => isModelType(model, type));\n\t\tconst defaults =\n\t\t\tcandidates.find((model) => model.id === definition.id) ??\n\t\t\t(definition.api ? candidates.find((model) => model.api === definition.api) : undefined) ??\n\t\t\t(type === \"chat\" && providerId === \"azure\"\n\t\t\t\t? candidates.find((model) => model.api === \"azure-openai-responses\")\n\t\t\t\t: undefined) ??\n\t\t\t(type === \"chat\" ? candidates.find((model) => model.api === \"openai-completions\") : undefined) ??\n\t\t\tcandidates[0];\n\t\tconst api = definition.api ?? (type === \"chat\" ? config.api : undefined) ?? defaults?.api;\n\t\tif (!api) {\n\t\t\tthrow new Error(\n\t\t\t\t`Provider ${providerId}, model ${definition.id}: no \"api\" specified. Set it at model level${type === \"chat\" ? \" or provider level\" : \"\"}.`,\n\t\t\t);\n\t\t}\n\t\tconst baseUrl = definition.baseUrl ?? config.baseUrl ?? defaults?.baseUrl;\n\t\tif (!baseUrl) throw new Error(`Provider ${providerId}: \"baseUrl\" is required when defining custom models.`);\n\t\treturn { ...definition, api, provider: providerId, baseUrl, headers: undefined } as AnyModel;\n\t});\n}\n\nfunction adaptOAuth(config: ExtensionOAuthConfig): OAuthAuth {\n\treturn {\n\t\tname: config.name,\n\t\tlogin: async (callbacks) => {\n\t\t\tconst legacyCallbacks: OAuthLoginCallbacks & {\n\t\t\t\tonInfo(message: string, links: readonly { label?: string; url: string }[]): void;\n\t\t\t} = {\n\t\t\t\tonAuth: (info) => callbacks.notify({ type: \"auth_url\", ...info }),\n\t\t\t\tonDeviceCode: (info) => callbacks.notify({ type: \"device_code\", ...info }),\n\t\t\t\tonPrompt: (prompt) => callbacks.prompt({ type: \"text\", ...prompt }),\n\t\t\t\tonProgress: (message) => callbacks.notify({ type: \"progress\", message }),\n\t\t\t\tonInfo: (message, links) => callbacks.notify({ type: \"info\", message, links }),\n\t\t\t\tonManualCodeInput: () => callbacks.prompt({ type: \"manual_code\", message: \"Paste the authorization code\" }),\n\t\t\t\tonSelect: (prompt) => callbacks.prompt({ type: \"select\", ...prompt }),\n\t\t\t\tsignal: callbacks.signal,\n\t\t\t};\n\t\t\tconst credential = await config.login(legacyCallbacks, callbacks.signal);\n\t\t\treturn { ...credential, type: \"oauth\" };\n\t\t},\n\t\trefresh: async (credential, signal) => {\n\t\t\ttry {\n\t\t\t\treturn { ...(await config.refreshToken(credential, signal)), type: \"oauth\" };\n\t\t\t} catch (error) {\n\t\t\t\tthrow extensionRefreshRejection(error, credential, config.name) ?? error;\n\t\t\t}\n\t\t},\n\t\ttoAuth: async (credential) => ({ apiKey: config.getApiKey(credential) }),\n\t};\n}\n\nfunction withConfiguredAuth(\n\tauth: ModelAuth,\n\theaders: Record<string, string> | undefined,\n\tauthHeader: boolean,\n): ModelAuth {\n\tlet mergedHeaders: ProviderHeaders | undefined =\n\t\tauth.headers || headers ? { ...auth.headers, ...headers } : undefined;\n\tif (authHeader) {\n\t\tif (!auth.apiKey) throw new Error(\"authHeader requires a resolved API key\");\n\t\tmergedHeaders = { ...mergedHeaders, Authorization: `Bearer ${auth.apiKey}` };\n\t}\n\treturn { ...auth, headers: mergedHeaders };\n}\n\nexport function configuredApiKey(\n\tconfig: ModelsJsonProvider | undefined,\n\textension: ProviderConfigInput | undefined,\n): string | undefined {\n\treturn extension?.apiKey ?? config?.apiKey;\n}\n\nexport function configuredHeaders(\n\tconfig: ModelsJsonProvider | undefined,\n\textension: ProviderConfigInput | undefined,\n): Record<string, string> | undefined {\n\tif (!config?.headers && !extension?.headers) return undefined;\n\treturn { ...config?.headers, ...extension?.headers };\n}\n\nasync function configContextEnv(\n\tvalues: readonly string[],\n\tctx: AuthContext,\n\texplicit?: Record<string, string>,\n): Promise<Record<string, string> | undefined> {\n\tconst env = { ...explicit };\n\tfor (const name of new Set(values.flatMap(getConfigValueEnvVarNames))) {\n\t\tif (env[name] !== undefined) continue;\n\t\tconst value = await ctx.env(name);\n\t\tif (value !== undefined) env[name] = value;\n\t}\n\treturn Object.keys(env).length > 0 ? env : undefined;\n}\n\nexport function composeApiKeyAuth(\n\tproviderId: string,\n\tbase: Provider | undefined,\n\tconfig: ModelsJsonProvider | undefined,\n\textension: ProviderConfigInput | undefined,\n): ApiKeyAuth | undefined {\n\tconst inherited = base?.auth.apiKey;\n\tconst rawKey = configuredApiKey(config, extension);\n\tconst oauth = extension?.oauth ?? base?.auth.oauth;\n\t// OAuth-only providers get no fabricated API-key login method.\n\tif (!inherited && rawKey === undefined && oauth) return undefined;\n\tconst rawHeaders = configuredHeaders(config, extension);\n\tconst authHeader = extension?.authHeader ?? config?.authHeader ?? false;\n\treturn {\n\t\tname: inherited?.name ?? \"API key\",\n\t\t// A configured key replaces borrowed credentials; a base without a login gains none.\n\t\tborrowCredentialsFrom: rawKey === undefined ? inherited?.borrowCredentialsFrom : undefined,\n\t\tlogin: inherited\n\t\t\t? inherited.login\n\t\t\t: async (interaction: ProviderAuthInteraction) => ({\n\t\t\t\t\ttype: \"api_key\",\n\t\t\t\t\tkey: await interaction.prompt({ type: \"secret\", message: \"Enter API key\" }),\n\t\t\t\t}),\n\t\tcheck: async (input) => {\n\t\t\tif (input.credential) {\n\t\t\t\tif (inherited?.check) return inherited.check(input);\n\t\t\t\tif (input.credential.key) return { type: \"api_key\", source: \"stored credential\" };\n\t\t\t\tconst resolved = await inherited?.resolve(input);\n\t\t\t\treturn resolved ? { type: \"api_key\", source: resolved.source } : undefined;\n\t\t\t}\n\t\t\tif (rawKey !== undefined) {\n\t\t\t\tif (isCommandConfigValue(rawKey)) return { type: \"api_key\", source: \"configured API key\" };\n\t\t\t\tconst envNames = getConfigValueEnvVarNames(rawKey);\n\t\t\t\tfor (const name of envNames) {\n\t\t\t\t\tif ((await input.ctx.env(name)) === undefined) return undefined;\n\t\t\t\t}\n\t\t\t\treturn { type: \"api_key\", source: \"configured API key\" };\n\t\t\t}\n\t\t\tif (inherited?.check) return inherited.check(input);\n\t\t\tconst resolved = await inherited?.resolve(input);\n\t\t\treturn resolved ? { type: \"api_key\", source: resolved.source } : undefined;\n\t\t},\n\t\tresolve: async (input) => {\n\t\t\tlet result: AuthResult | undefined;\n\t\t\tif (input.credential) {\n\t\t\t\tresult = inherited\n\t\t\t\t\t? await inherited.resolve(input)\n\t\t\t\t\t: input.credential.key\n\t\t\t\t\t\t? { auth: { apiKey: input.credential.key }, env: input.credential.env, source: \"stored credential\" }\n\t\t\t\t\t\t: undefined;\n\t\t\t} else if (rawKey !== undefined) {\n\t\t\t\tconst env = await configContextEnv([rawKey], input.ctx);\n\t\t\t\t// Like a built-in whose key variable is unset, an unset `$VAR` key means no credential, not an error.\n\t\t\t\tif (!isCommandConfigValue(rawKey) && !isConfigValueConfigured(rawKey, env)) return undefined;\n\t\t\t\tconst key = resolveConfigValueOrThrow(rawKey, `API key for provider \"${providerId}\"`, env);\n\t\t\t\tresult = inherited\n\t\t\t\t\t? await inherited.resolve({ ...input, credential: { type: \"api_key\", key } })\n\t\t\t\t\t: { auth: { apiKey: key }, source: \"configured API key\" };\n\t\t\t} else {\n\t\t\t\tresult = await inherited?.resolve(input);\n\t\t\t}\n\t\t\tif (!result) return undefined;\n\t\t\tconst explicitEnv = { ...(input.credential?.env ?? {}), ...(result.env ?? {}) };\n\t\t\tconst headerEnv = await configContextEnv(Object.values(rawHeaders ?? {}), input.ctx, explicitEnv);\n\t\t\tconst headers = resolveHeadersOrThrow(rawHeaders, `provider \"${providerId}\"`, headerEnv);\n\t\t\treturn { ...result, auth: withConfiguredAuth(result.auth, headers, authHeader) };\n\t\t},\n\t};\n}\n\nexport function composeOAuthAuth(\n\tproviderId: string,\n\tbase: Provider | undefined,\n\tconfig: ModelsJsonProvider | undefined,\n\textension: ProviderConfigInput | undefined,\n): OAuthAuth | undefined {\n\tconst oauth = extension?.oauth ? adaptOAuth(extension.oauth) : base?.auth.oauth;\n\tif (!oauth) return undefined;\n\tconst rawHeaders = configuredHeaders(config, extension);\n\tconst authHeader = extension?.authHeader ?? config?.authHeader ?? false;\n\treturn {\n\t\t...oauth,\n\t\ttoAuth: async (credential) => {\n\t\t\tconst auth = await oauth.toAuth(credential);\n\t\t\tconst env = credential.env;\n\t\t\tconst headers = resolveHeadersOrThrow(\n\t\t\t\trawHeaders,\n\t\t\t\t`provider \"${providerId}\"`,\n\t\t\t\ttypeof env === \"object\" && env !== null ? (env as Record<string, string>) : undefined,\n\t\t\t);\n\t\t\treturn withConfiguredAuth(auth, headers, authHeader);\n\t\t},\n\t};\n}\n\nexport function rawModelHeaders(\n\tmodel: AnyModel,\n\tconfig: ModelsJsonProvider | undefined,\n\textension: ProviderConfigInput | undefined,\n): Record<string, string> | undefined {\n\tconst definition = isModelType(model, \"chat\") ? config?.models?.find((entry) => entry.id === model.id) : undefined;\n\tconst extensionModel = extension?.models?.find(\n\t\t(entry) => (entry.type ?? \"chat\") === (model.type ?? \"chat\") && entry.id === model.id,\n\t);\n\tconst headers = {\n\t\t...(isModelType(model, \"chat\") ? config?.modelOverrides?.[model.id]?.headers : undefined),\n\t\t...definition?.headers,\n\t\t...extensionModel?.headers,\n\t};\n\treturn Object.keys(headers).length > 0 ? headers : undefined;\n}\n"]}
1
+ {"version":3,"file":"provider-composer-internal.js","sourceRoot":"","sources":["../../src/core/provider-composer-internal.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AAEnF,OAAO,EACN,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,GACrB,MAAM,2BAA2B,CAAC;AAsFnC,MAAM,CAAC,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAEtD,SAAS,WAAW,CACnB,IAA0B,EAC1B,QAAkE;IAElE,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,MAAM,MAAM,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,EAAuC,CAAC;IAC7E,MAAM,UAAU,GAAG,IAA2C,CAAC;IAC/D,MAAM,cAAc,GAAG,QAAmC,CAAC;IAC3D,MAAM,YAAY,GAAG,MAAiC,CAAC;IACvD,KAAK,MAAM,GAAG,IAAI,CAAC,mBAAmB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,kBAAkB,CAAU,EAAE,CAAC;QAC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AAC,IAAI,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,CACrF,CAAC;IACF,MAAM,OAAO,GAAG;QACf,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;QACzF,GAAG,UAAU,EAAE,OAAO;QACtB,GAAG,cAAc,EAAE,OAAO;KAC1B,CAAC;IACF,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9D,CAAC","sourcesContent":["import type {\n\tAnyModel,\n\tApi,\n\tApiKeyAuth,\n\tAssistantMessageEventStream,\n\tAuthContext,\n\tAuthResult,\n\tClassifierApi,\n\tClassifierModel,\n\tImageApi,\n\tModel,\n\tModelAuth,\n\tOAuthAuth,\n\tOAuthCredentials,\n\tOAuthLoginCallbacks,\n\tProvider,\n\tProviderAuthInteraction,\n\tProviderClassifier,\n\tProviderHeaders,\n\tProviderImages,\n\tRefreshModelsContext,\n\tSimpleStreamOptions,\n\tTranscriptContext,\n} from \"@bastani/pi-ai\";\nimport { isModelType } from \"@bastani/pi-ai\";\nimport { extensionRefreshRejection } from \"./extension-oauth-refresh-rejection.ts\";\nimport type { ModelsJsonModel, ModelsJsonModelOverride, ModelsJsonProvider } from \"./model-config.ts\";\nimport {\n\tclearConfigValueCache,\n\tgetConfigValueEnvVarNames,\n\tisCommandConfigValue,\n\tisConfigValueConfigured,\n\tresolveConfigValueOrThrow,\n\tresolveHeadersOrThrow,\n} from \"./resolve-config-value.ts\";\n\nexport interface ExtensionOAuthConfig {\n\tname: string;\n\tloginLabel?: string;\n\tusesCallbackServer?: boolean;\n\tlogin(callbacks: OAuthLoginCallbacks, signal: AbortSignal): Promise<OAuthCredentials>;\n\t/**\n\t * Refresh expired credentials. Pass `signal` to the network call, but add no timeout or abort of your own: Atomic\n\t * never aborts it on a timeout, because once the request is sent the provider may already have rotated the\n\t * refresh token. The caller stops waiting after 60 seconds; a later result is still saved, and a graceful exit\n\t * waits briefly for it. It is a required parameter so the contract is stated in the type.\n\t * Throw `OAuthRefreshRejectedError` when the provider rejected the stored login; common error shapes are mapped\n\t * onto it (see `extensionRefreshRejection`).\n\t */\n\trefreshToken(credentials: OAuthCredentials, signal: AbortSignal): Promise<OAuthCredentials>;\n\tgetApiKey(credentials: OAuthCredentials): string;\n\tmodifyModels?(models: Model<Api>[], credentials: OAuthCredentials): Model<Api>[];\n}\n\ninterface ProviderModelConfigBase {\n\tid: string;\n\tname: string;\n\tapi?: string;\n\tbaseUrl?: string;\n\tinput: AnyModel[\"input\"];\n\tinputLimits?: AnyModel[\"inputLimits\"];\n\tcost: AnyModel[\"cost\"];\n\theaders?: Record<string, string>;\n}\n\nexport interface ProviderChatModelConfig extends ProviderModelConfigBase {\n\ttype?: \"chat\";\n\tapi?: Api;\n\treasoning: boolean;\n\tthinkingLevelMap?: Model<Api>[\"thinkingLevelMap\"];\n\tpromptCache?: Model<Api>[\"promptCache\"];\n\tcontextWindow: number;\n\tmaxTokens: number;\n\tsamplingParams?: Model<Api>[\"samplingParams\"];\n\tsamplingParamsByThinkingLevel?: Model<Api>[\"samplingParamsByThinkingLevel\"];\n\tcompat?: Model<Api>[\"compat\"];\n}\n\nexport interface ProviderImageModelConfig extends ProviderModelConfigBase {\n\ttype: \"image\";\n\tapi?: ImageApi;\n\toutput: (\"text\" | \"image\")[];\n}\n\nexport interface ProviderClassifierModelConfig extends ProviderModelConfigBase {\n\ttype: \"classifier\";\n\tapi?: ClassifierApi;\n\tcontextWindow: number;\n\tcompat?: ClassifierModel<ClassifierApi>[\"compat\"];\n}\n\nexport type ProviderModelConfig = ProviderChatModelConfig | ProviderImageModelConfig | ProviderClassifierModelConfig;\n\n/** Input type for the extension registerProvider API. */\nexport interface ProviderConfigInput {\n\tname?: string;\n\taliasOf?: string;\n\tbaseUrl?: string;\n\tapiKey?: string;\n\tapi?: Api;\n\tstreamSimple?: (\n\t\tmodel: Model<Api>,\n\t\tcontext: TranscriptContext,\n\t\toptions?: SimpleStreamOptions,\n\t) => AssistantMessageEventStream;\n\timages?: Partial<Record<ImageApi, ProviderImages>>;\n\tclassifiers?: Partial<Record<ClassifierApi, ProviderClassifier>>;\n\theaders?: Record<string, string>;\n\tauthHeader?: boolean;\n\toauth?: ExtensionOAuthConfig;\n\tmodels?: ProviderModelConfig[];\n\trefreshModels?(context: RefreshModelsContext): Promise<NonNullable<ProviderConfigInput[\"models\"]>>;\n}\n\nexport type AuthStatus = {\n\tconfigured: boolean;\n\tsource?: \"stored\" | \"runtime\" | \"environment\" | \"fallback\" | \"models_json_key\" | \"models_json_command\";\n\tlabel?: string;\n};\n\nexport const clearApiKeyCache = clearConfigValueCache;\n\nfunction mergeCompat(\n\tbase: Model<Api>[\"compat\"],\n\toverride: Model<Api>[\"compat\"] | ModelsJsonModelOverride[\"compat\"],\n): Model<Api>[\"compat\"] {\n\tif (!override) return base;\n\tconst merged = { ...base, ...override } as NonNullable<Model<Api>[\"compat\"]>;\n\tconst baseNested = base as Record<string, unknown> | undefined;\n\tconst overrideNested = override as Record<string, unknown>;\n\tconst mergedNested = merged as Record<string, unknown>;\n\tfor (const key of [\"openRouterRouting\", \"vercelGatewayRouting\", \"chatTemplateKwargs\", \"chatTemplateArgs\"] as const) {\n\t\tconst baseValue = baseNested?.[key];\n\t\tconst overrideValue = overrideNested[key];\n\t\tif (\n\t\t\t(typeof baseValue === \"object\" && baseValue !== null) ||\n\t\t\t(typeof overrideValue === \"object\" && overrideValue !== null)\n\t\t) {\n\t\t\tmergedNested[key] = { ...(baseValue as object | undefined), ...(overrideValue as object | undefined) };\n\t\t}\n\t}\n\treturn merged;\n}\n\nfunction mergeInputLimits(\n\tbase: Model<Api>[\"inputLimits\"],\n\toverride: ModelsJsonModelOverride[\"inputLimits\"],\n): Model<Api>[\"inputLimits\"] {\n\tif (!override) return base;\n\treturn {\n\t\t...base,\n\t\t...override,\n\t\timages: override.images\n\t\t\t? {\n\t\t\t\t\t...base?.images,\n\t\t\t\t\t...override.images,\n\t\t\t\t\tresize: override.images.resize\n\t\t\t\t\t\t? { ...base?.images?.resize, ...override.images.resize }\n\t\t\t\t\t\t: base?.images?.resize,\n\t\t\t\t}\n\t\t\t: base?.images,\n\t};\n}\n\nfunction mergeSamplingParamsByThinkingLevel(\n\tbase: Model<Api>[\"samplingParamsByThinkingLevel\"],\n\toverride: Model<Api>[\"samplingParamsByThinkingLevel\"],\n): Model<Api>[\"samplingParamsByThinkingLevel\"] {\n\tif (!override) return base;\n\tconst merged = { ...base };\n\tfor (const level of [\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"] as const) {\n\t\tconst params = override[level];\n\t\tif (params) merged[level] = { ...base?.[level], ...params };\n\t}\n\treturn merged;\n}\n\nexport function applyModelOverride(model: Model<Api>, override: ModelsJsonModelOverride): Model<Api> {\n\treturn {\n\t\t...model,\n\t\tpromptCache: override.promptCache ? { ...model.promptCache, ...override.promptCache } : model.promptCache,\n\t\tname: override.name ?? model.name,\n\t\treasoning: override.reasoning ?? model.reasoning,\n\t\tthinkingLevelMap: override.thinkingLevelMap\n\t\t\t? { ...model.thinkingLevelMap, ...override.thinkingLevelMap }\n\t\t\t: model.thinkingLevelMap,\n\t\tinput: (override.input as Model<Api>[\"input\"] | undefined) ?? model.input,\n\t\tinputLimits: mergeInputLimits(model.inputLimits, override.inputLimits),\n\t\tcost: override.cost\n\t\t\t? {\n\t\t\t\t\tinput: override.cost.input ?? model.cost.input,\n\t\t\t\t\toutput: override.cost.output ?? model.cost.output,\n\t\t\t\t\tcacheRead: override.cost.cacheRead ?? model.cost.cacheRead,\n\t\t\t\t\tcacheWrite: override.cost.cacheWrite ?? model.cost.cacheWrite,\n\t\t\t\t\ttiers: override.cost.tiers ?? model.cost.tiers,\n\t\t\t\t}\n\t\t\t: model.cost,\n\t\tcontextWindow: override.contextWindow ?? model.contextWindow,\n\t\tmaxTokens: override.maxTokens ?? model.maxTokens,\n\t\tsamplingParams: override.samplingParams\n\t\t\t? { ...model.samplingParams, ...override.samplingParams }\n\t\t\t: model.samplingParams,\n\t\tsamplingParamsByThinkingLevel: mergeSamplingParamsByThinkingLevel(\n\t\t\tmodel.samplingParamsByThinkingLevel,\n\t\t\toverride.samplingParamsByThinkingLevel,\n\t\t),\n\t\tcompat: mergeCompat(model.compat, override.compat),\n\t};\n}\n\nfunction modelFromJson(\n\tproviderId: string,\n\tdefinition: ModelsJsonModel,\n\tproviderConfig: ModelsJsonProvider,\n\tdefaults: Model<Api> | undefined,\n): Model<Api> {\n\tconst api = definition.api ?? providerConfig.api ?? defaults?.api;\n\tif (!api) {\n\t\tthrow new Error(\n\t\t\t`Provider ${providerId}, model ${definition.id}: no \"api\" specified. Set at provider or model level.`,\n\t\t);\n\t}\n\tconst baseUrl = definition.baseUrl ?? providerConfig.baseUrl ?? defaults?.baseUrl;\n\tif (!baseUrl) throw new Error(`Provider ${providerId}: \"baseUrl\" is required when defining custom models.`);\n\tif (definition.contextWindow !== undefined && definition.contextWindow <= 0) {\n\t\tthrow new Error(`Provider ${providerId}, model ${definition.id}: invalid contextWindow`);\n\t}\n\tif (definition.maxTokens !== undefined && definition.maxTokens <= 0) {\n\t\tthrow new Error(`Provider ${providerId}, model ${definition.id}: invalid maxTokens`);\n\t}\n\treturn {\n\t\tid: definition.id,\n\t\tname: definition.name ?? definition.id,\n\t\tapi: api as Api,\n\t\tprovider: providerId,\n\t\tbaseUrl,\n\t\treasoning: definition.reasoning ?? false,\n\t\tthinkingLevelMap: definition.thinkingLevelMap,\n\t\tinput: (definition.input ?? [\"text\"]) as Model<Api>[\"input\"],\n\t\tinputLimits: definition.inputLimits,\n\t\tcost: definition.cost ?? { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n\t\tpromptCache: definition.promptCache,\n\t\tcontextWindow: definition.contextWindow ?? 128000,\n\t\tmaxTokens: definition.maxTokens ?? 16384,\n\t\tsamplingParams: definition.samplingParams,\n\t\tsamplingParamsByThinkingLevel: definition.samplingParamsByThinkingLevel,\n\t\theaders: undefined,\n\t\tcompat: mergeCompat(providerConfig.compat, definition.compat),\n\t};\n}\n\nfunction findModelDefaults(models: readonly Model<Api>[], modelId: string, api?: Api): Model<Api> | undefined {\n\treturn (\n\t\tmodels.find((model) => model.id === modelId) ??\n\t\t(api ? models.find((model) => model.api === api) : undefined) ??\n\t\tmodels.find((model) => model.api === \"openai-completions\") ??\n\t\tmodels[0]\n\t);\n}\n\nexport function applyModelsJson(\n\tproviderId: string,\n\tbaseModels: readonly AnyModel[],\n\tconfig: ModelsJsonProvider | undefined,\n): AnyModel[] {\n\tif (!config) return [...baseModels];\n\tif (config.oauth && !config.baseUrl) {\n\t\tthrow new Error(`Provider ${providerId}: \"baseUrl\" is required when \"oauth\" is set.`);\n\t}\n\tconst hasOverrides = config.modelOverrides && Object.keys(config.modelOverrides).length > 0;\n\tif (\n\t\t!config.models?.length &&\n\t\t!config.baseUrl &&\n\t\t!config.headers &&\n\t\t!config.compat &&\n\t\t!hasOverrides &&\n\t\t!config.apiKey &&\n\t\t!config.oauth &&\n\t\tconfig.authHeader === undefined\n\t) {\n\t\tthrow new Error(\n\t\t\t`Provider ${providerId}: must specify \"baseUrl\", \"headers\", \"compat\", \"modelOverrides\", or \"models\".`,\n\t\t);\n\t}\n\n\tconst models: AnyModel[] = baseModels.map((model) => {\n\t\tconst baseUrl = config.oauth === \"radius\" ? model.baseUrl : (config.baseUrl ?? model.baseUrl);\n\t\tif (isModelType(model, \"chat\")) return { ...model, baseUrl, compat: mergeCompat(model.compat, config.compat) };\n\t\tif (isModelType(model, \"classifier\") && config.compat) {\n\t\t\treturn { ...model, baseUrl, compat: { ...model.compat, ...config.compat } };\n\t\t}\n\t\treturn { ...model, baseUrl };\n\t});\n\tfor (const definition of config.models ?? []) {\n\t\tconst existingIndex = models.findIndex((model) => isModelType(model, \"chat\") && model.id === definition.id);\n\t\tconst defaults = findModelDefaults(\n\t\t\tmodels.filter((model) => isModelType(model, \"chat\")),\n\t\t\tdefinition.id,\n\t\t\tdefinition.api ?? config.api ?? (providerId === \"azure\" ? \"azure-openai-responses\" : undefined),\n\t\t);\n\t\tconst model = modelFromJson(providerId, definition, config, defaults);\n\t\tif (existingIndex >= 0) models[existingIndex] = model;\n\t\telse models.push(model);\n\t}\n\treturn models;\n}\n\nexport function applyExtension(\n\tproviderId: string,\n\tmodels: readonly AnyModel[],\n\tconfig: ProviderConfigInput | undefined,\n): AnyModel[] {\n\tif (!config) return [...models];\n\tif (!config.models) {\n\t\treturn config.baseUrl ? models.map((model) => ({ ...model, baseUrl: config.baseUrl! })) : [...models];\n\t}\n\treturn config.models.map((definition) => {\n\t\tconst type = definition.type ?? \"chat\";\n\t\tconst candidates = models.filter((model) => isModelType(model, type));\n\t\tconst defaults =\n\t\t\tcandidates.find((model) => model.id === definition.id) ??\n\t\t\t(definition.api ? candidates.find((model) => model.api === definition.api) : undefined) ??\n\t\t\t(type === \"chat\" && providerId === \"azure\"\n\t\t\t\t? candidates.find((model) => model.api === \"azure-openai-responses\")\n\t\t\t\t: undefined) ??\n\t\t\t(type === \"chat\" ? candidates.find((model) => model.api === \"openai-completions\") : undefined) ??\n\t\t\tcandidates[0];\n\t\tconst api = definition.api ?? (type === \"chat\" ? config.api : undefined) ?? defaults?.api;\n\t\tif (!api) {\n\t\t\tthrow new Error(\n\t\t\t\t`Provider ${providerId}, model ${definition.id}: no \"api\" specified. Set it at model level${type === \"chat\" ? \" or provider level\" : \"\"}.`,\n\t\t\t);\n\t\t}\n\t\tconst baseUrl = definition.baseUrl ?? config.baseUrl ?? defaults?.baseUrl;\n\t\tif (!baseUrl) throw new Error(`Provider ${providerId}: \"baseUrl\" is required when defining custom models.`);\n\t\treturn { ...definition, api, provider: providerId, baseUrl, headers: undefined } as AnyModel;\n\t});\n}\n\nfunction adaptOAuth(config: ExtensionOAuthConfig): OAuthAuth {\n\treturn {\n\t\tname: config.name,\n\t\tlogin: async (callbacks) => {\n\t\t\tconst legacyCallbacks: OAuthLoginCallbacks & {\n\t\t\t\tonInfo(message: string, links: readonly { label?: string; url: string }[]): void;\n\t\t\t} = {\n\t\t\t\tonAuth: (info) => callbacks.notify({ type: \"auth_url\", ...info }),\n\t\t\t\tonDeviceCode: (info) => callbacks.notify({ type: \"device_code\", ...info }),\n\t\t\t\tonPrompt: (prompt) => callbacks.prompt({ type: \"text\", ...prompt }),\n\t\t\t\tonProgress: (message) => callbacks.notify({ type: \"progress\", message }),\n\t\t\t\tonInfo: (message, links) => callbacks.notify({ type: \"info\", message, links }),\n\t\t\t\tonManualCodeInput: () => callbacks.prompt({ type: \"manual_code\", message: \"Paste the authorization code\" }),\n\t\t\t\tonSelect: (prompt) => callbacks.prompt({ type: \"select\", ...prompt }),\n\t\t\t\tsignal: callbacks.signal,\n\t\t\t};\n\t\t\tconst credential = await config.login(legacyCallbacks, callbacks.signal);\n\t\t\treturn { ...credential, type: \"oauth\" };\n\t\t},\n\t\trefresh: async (credential, signal) => {\n\t\t\ttry {\n\t\t\t\treturn { ...(await config.refreshToken(credential, signal)), type: \"oauth\" };\n\t\t\t} catch (error) {\n\t\t\t\tthrow extensionRefreshRejection(error, credential, config.name) ?? error;\n\t\t\t}\n\t\t},\n\t\ttoAuth: async (credential) => ({ apiKey: config.getApiKey(credential) }),\n\t};\n}\n\nfunction withConfiguredAuth(\n\tauth: ModelAuth,\n\theaders: Record<string, string> | undefined,\n\tauthHeader: boolean,\n): ModelAuth {\n\tlet mergedHeaders: ProviderHeaders | undefined =\n\t\tauth.headers || headers ? { ...auth.headers, ...headers } : undefined;\n\tif (authHeader) {\n\t\tif (!auth.apiKey) throw new Error(\"authHeader requires a resolved API key\");\n\t\tmergedHeaders = { ...mergedHeaders, Authorization: `Bearer ${auth.apiKey}` };\n\t}\n\treturn { ...auth, headers: mergedHeaders };\n}\n\nexport function configuredApiKey(\n\tconfig: ModelsJsonProvider | undefined,\n\textension: ProviderConfigInput | undefined,\n): string | undefined {\n\treturn extension?.apiKey ?? config?.apiKey;\n}\n\nexport function configuredHeaders(\n\tconfig: ModelsJsonProvider | undefined,\n\textension: ProviderConfigInput | undefined,\n): Record<string, string> | undefined {\n\tif (!config?.headers && !extension?.headers) return undefined;\n\treturn { ...config?.headers, ...extension?.headers };\n}\n\nasync function configContextEnv(\n\tvalues: readonly string[],\n\tctx: AuthContext,\n\texplicit?: Record<string, string>,\n): Promise<Record<string, string> | undefined> {\n\tconst env = { ...explicit };\n\tfor (const name of new Set(values.flatMap(getConfigValueEnvVarNames))) {\n\t\tif (env[name] !== undefined) continue;\n\t\tconst value = await ctx.env(name);\n\t\tif (value !== undefined) env[name] = value;\n\t}\n\treturn Object.keys(env).length > 0 ? env : undefined;\n}\n\nexport function composeApiKeyAuth(\n\tproviderId: string,\n\tbase: Provider | undefined,\n\tconfig: ModelsJsonProvider | undefined,\n\textension: ProviderConfigInput | undefined,\n): ApiKeyAuth | undefined {\n\tconst inherited = base?.auth.apiKey;\n\tconst rawKey = configuredApiKey(config, extension);\n\tconst oauth = extension?.oauth ?? base?.auth.oauth;\n\t// OAuth-only providers get no fabricated API-key login method.\n\tif (!inherited && rawKey === undefined && oauth) return undefined;\n\tconst rawHeaders = configuredHeaders(config, extension);\n\tconst authHeader = extension?.authHeader ?? config?.authHeader ?? false;\n\treturn {\n\t\tname: inherited?.name ?? \"API key\",\n\t\t// A configured key replaces borrowed credentials; a base without a login gains none.\n\t\tborrowCredentialsFrom: rawKey === undefined ? inherited?.borrowCredentialsFrom : undefined,\n\t\tlogin: inherited\n\t\t\t? inherited.login\n\t\t\t: async (interaction: ProviderAuthInteraction) => ({\n\t\t\t\t\ttype: \"api_key\",\n\t\t\t\t\tkey: await interaction.prompt({ type: \"secret\", message: \"Enter API key\" }),\n\t\t\t\t}),\n\t\tcheck: async (input) => {\n\t\t\tif (input.credential) {\n\t\t\t\tif (inherited?.check) return inherited.check(input);\n\t\t\t\tif (input.credential.key) return { type: \"api_key\", source: \"stored credential\" };\n\t\t\t\tconst resolved = await inherited?.resolve(input);\n\t\t\t\treturn resolved ? { type: \"api_key\", source: resolved.source } : undefined;\n\t\t\t}\n\t\t\tif (rawKey !== undefined) {\n\t\t\t\tif (isCommandConfigValue(rawKey)) return { type: \"api_key\", source: \"configured API key\" };\n\t\t\t\tconst envNames = getConfigValueEnvVarNames(rawKey);\n\t\t\t\tfor (const name of envNames) {\n\t\t\t\t\tif ((await input.ctx.env(name)) === undefined) return undefined;\n\t\t\t\t}\n\t\t\t\treturn { type: \"api_key\", source: \"configured API key\" };\n\t\t\t}\n\t\t\tif (inherited?.check) return inherited.check(input);\n\t\t\tconst resolved = await inherited?.resolve(input);\n\t\t\treturn resolved ? { type: \"api_key\", source: resolved.source } : undefined;\n\t\t},\n\t\tresolve: async (input) => {\n\t\t\tlet result: AuthResult | undefined;\n\t\t\tif (input.credential) {\n\t\t\t\tresult = inherited\n\t\t\t\t\t? await inherited.resolve(input)\n\t\t\t\t\t: input.credential.key\n\t\t\t\t\t\t? { auth: { apiKey: input.credential.key }, env: input.credential.env, source: \"stored credential\" }\n\t\t\t\t\t\t: undefined;\n\t\t\t} else if (rawKey !== undefined) {\n\t\t\t\tconst env = await configContextEnv([rawKey], input.ctx);\n\t\t\t\t// Like a built-in whose key variable is unset, an unset `$VAR` key means no credential, not an error.\n\t\t\t\tif (!isCommandConfigValue(rawKey) && !isConfigValueConfigured(rawKey, env)) return undefined;\n\t\t\t\tconst key = resolveConfigValueOrThrow(rawKey, `API key for provider \"${providerId}\"`, env);\n\t\t\t\tresult = inherited\n\t\t\t\t\t? await inherited.resolve({ ...input, credential: { type: \"api_key\", key } })\n\t\t\t\t\t: { auth: { apiKey: key }, source: \"configured API key\" };\n\t\t\t} else {\n\t\t\t\tresult = await inherited?.resolve(input);\n\t\t\t}\n\t\t\tif (!result) return undefined;\n\t\t\tconst explicitEnv = { ...(input.credential?.env ?? {}), ...(result.env ?? {}) };\n\t\t\tconst headerEnv = await configContextEnv(Object.values(rawHeaders ?? {}), input.ctx, explicitEnv);\n\t\t\tconst headers = resolveHeadersOrThrow(rawHeaders, `provider \"${providerId}\"`, headerEnv);\n\t\t\treturn { ...result, auth: withConfiguredAuth(result.auth, headers, authHeader) };\n\t\t},\n\t};\n}\n\nexport function composeOAuthAuth(\n\tproviderId: string,\n\tbase: Provider | undefined,\n\tconfig: ModelsJsonProvider | undefined,\n\textension: ProviderConfigInput | undefined,\n): OAuthAuth | undefined {\n\tconst oauth = extension?.oauth ? adaptOAuth(extension.oauth) : base?.auth.oauth;\n\tif (!oauth) return undefined;\n\tconst rawHeaders = configuredHeaders(config, extension);\n\tconst authHeader = extension?.authHeader ?? config?.authHeader ?? false;\n\treturn {\n\t\t...oauth,\n\t\ttoAuth: async (credential) => {\n\t\t\tconst auth = await oauth.toAuth(credential);\n\t\t\tconst env = credential.env;\n\t\t\tconst headers = resolveHeadersOrThrow(\n\t\t\t\trawHeaders,\n\t\t\t\t`provider \"${providerId}\"`,\n\t\t\t\ttypeof env === \"object\" && env !== null ? (env as Record<string, string>) : undefined,\n\t\t\t);\n\t\t\treturn withConfiguredAuth(auth, headers, authHeader);\n\t\t},\n\t};\n}\n\nexport function rawModelHeaders(\n\tmodel: AnyModel,\n\tconfig: ModelsJsonProvider | undefined,\n\textension: ProviderConfigInput | undefined,\n): Record<string, string> | undefined {\n\tconst definition = isModelType(model, \"chat\") ? config?.models?.find((entry) => entry.id === model.id) : undefined;\n\tconst extensionModel = extension?.models?.find(\n\t\t(entry) => (entry.type ?? \"chat\") === (model.type ?? \"chat\") && entry.id === model.id,\n\t);\n\tconst headers = {\n\t\t...(isModelType(model, \"chat\") ? config?.modelOverrides?.[model.id]?.headers : undefined),\n\t\t...definition?.headers,\n\t\t...extensionModel?.headers,\n\t};\n\treturn Object.keys(headers).length > 0 ? headers : undefined;\n}\n"]}
@@ -236,7 +236,7 @@ export function createGrepToolDefinition(cwd, options) {
236
236
  settle(() => reject(new Error("ripgrep (rg) is not available and could not be downloaded")));
237
237
  return;
238
238
  }
239
- const args = ["--json", "--line-number", "--color=never"];
239
+ const args = ["--no-config", "--json", "--line-number", "--color=never"];
240
240
  if (hidden !== false)
241
241
  args.push("--hidden");
242
242
  if (gitignore === false)