@fgv/ts-extras 5.1.0-25 → 5.1.0-27

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 (139) hide show
  1. package/dist/index.browser.js +2 -2
  2. package/dist/index.browser.js.map +1 -1
  3. package/dist/packlets/ai-assist/apiClient.js +300 -213
  4. package/dist/packlets/ai-assist/apiClient.js.map +1 -1
  5. package/dist/packlets/ai-assist/chatRequestBuilders.js +6 -0
  6. package/dist/packlets/ai-assist/chatRequestBuilders.js.map +1 -1
  7. package/dist/packlets/ai-assist/imageOptionsResolver.js +212 -0
  8. package/dist/packlets/ai-assist/imageOptionsResolver.js.map +1 -0
  9. package/dist/packlets/ai-assist/index.js +1 -0
  10. package/dist/packlets/ai-assist/index.js.map +1 -1
  11. package/dist/packlets/ai-assist/model.js +1 -1
  12. package/dist/packlets/ai-assist/model.js.map +1 -1
  13. package/dist/packlets/ai-assist/registry.js +120 -22
  14. package/dist/packlets/ai-assist/registry.js.map +1 -1
  15. package/dist/packlets/ai-assist/sseParser.js +1 -0
  16. package/dist/packlets/ai-assist/sseParser.js.map +1 -1
  17. package/dist/packlets/ai-assist/streamingAdapters/anthropic.js +17 -12
  18. package/dist/packlets/ai-assist/streamingAdapters/anthropic.js.map +1 -1
  19. package/dist/packlets/ai-assist/streamingAdapters/common.js +2 -0
  20. package/dist/packlets/ai-assist/streamingAdapters/common.js.map +1 -1
  21. package/dist/packlets/ai-assist/streamingAdapters/gemini.js +17 -5
  22. package/dist/packlets/ai-assist/streamingAdapters/gemini.js.map +1 -1
  23. package/dist/packlets/ai-assist/streamingAdapters/openaiChat.js +19 -4
  24. package/dist/packlets/ai-assist/streamingAdapters/openaiChat.js.map +1 -1
  25. package/dist/packlets/ai-assist/streamingAdapters/openaiResponses.js +20 -5
  26. package/dist/packlets/ai-assist/streamingAdapters/openaiResponses.js.map +1 -1
  27. package/dist/packlets/ai-assist/streamingAdapters/proxy.js +9 -3
  28. package/dist/packlets/ai-assist/streamingAdapters/proxy.js.map +1 -1
  29. package/dist/packlets/ai-assist/streamingClient.js +28 -6
  30. package/dist/packlets/ai-assist/streamingClient.js.map +1 -1
  31. package/dist/packlets/ai-assist/thinkingOptionsResolver.js +265 -0
  32. package/dist/packlets/ai-assist/thinkingOptionsResolver.js.map +1 -0
  33. package/dist/packlets/conversion/converters.js +1 -0
  34. package/dist/packlets/conversion/converters.js.map +1 -1
  35. package/dist/packlets/crypto-utils/index.browser.js +2 -0
  36. package/dist/packlets/crypto-utils/index.browser.js.map +1 -1
  37. package/dist/packlets/crypto-utils/index.js +2 -0
  38. package/dist/packlets/crypto-utils/index.js.map +1 -1
  39. package/dist/packlets/crypto-utils/keyPairAlgorithmParams.js +8 -0
  40. package/dist/packlets/crypto-utils/keyPairAlgorithmParams.js.map +1 -1
  41. package/dist/packlets/crypto-utils/keystore/keyStore.js +2 -1
  42. package/dist/packlets/crypto-utils/keystore/keyStore.js.map +1 -1
  43. package/dist/packlets/crypto-utils/model.js +2 -1
  44. package/dist/packlets/crypto-utils/model.js.map +1 -1
  45. package/dist/packlets/crypto-utils/nodeCryptoProvider.js +25 -0
  46. package/dist/packlets/crypto-utils/nodeCryptoProvider.js.map +1 -1
  47. package/dist/packlets/crypto-utils/spkiHelpers.js +130 -0
  48. package/dist/packlets/crypto-utils/spkiHelpers.js.map +1 -0
  49. package/dist/ts-extras.d.ts +695 -126
  50. package/lib/index.browser.d.ts +2 -2
  51. package/lib/index.browser.d.ts.map +1 -1
  52. package/lib/index.browser.js +4 -3
  53. package/lib/index.browser.js.map +1 -1
  54. package/lib/packlets/ai-assist/apiClient.d.ts +29 -85
  55. package/lib/packlets/ai-assist/apiClient.d.ts.map +1 -1
  56. package/lib/packlets/ai-assist/apiClient.js +300 -213
  57. package/lib/packlets/ai-assist/apiClient.js.map +1 -1
  58. package/lib/packlets/ai-assist/chatRequestBuilders.d.ts.map +1 -1
  59. package/lib/packlets/ai-assist/chatRequestBuilders.js +6 -0
  60. package/lib/packlets/ai-assist/chatRequestBuilders.js.map +1 -1
  61. package/lib/packlets/ai-assist/imageOptionsResolver.d.ts +74 -0
  62. package/lib/packlets/ai-assist/imageOptionsResolver.d.ts.map +1 -0
  63. package/lib/packlets/ai-assist/imageOptionsResolver.js +216 -0
  64. package/lib/packlets/ai-assist/imageOptionsResolver.js.map +1 -0
  65. package/lib/packlets/ai-assist/index.d.ts +2 -1
  66. package/lib/packlets/ai-assist/index.d.ts.map +1 -1
  67. package/lib/packlets/ai-assist/index.js +4 -1
  68. package/lib/packlets/ai-assist/index.js.map +1 -1
  69. package/lib/packlets/ai-assist/model.d.ts +410 -35
  70. package/lib/packlets/ai-assist/model.d.ts.map +1 -1
  71. package/lib/packlets/ai-assist/model.js +1 -1
  72. package/lib/packlets/ai-assist/model.js.map +1 -1
  73. package/lib/packlets/ai-assist/registry.d.ts.map +1 -1
  74. package/lib/packlets/ai-assist/registry.js +120 -22
  75. package/lib/packlets/ai-assist/registry.js.map +1 -1
  76. package/lib/packlets/ai-assist/sseParser.d.ts.map +1 -1
  77. package/lib/packlets/ai-assist/sseParser.js +1 -0
  78. package/lib/packlets/ai-assist/sseParser.js.map +1 -1
  79. package/lib/packlets/ai-assist/streamingAdapters/anthropic.d.ts +2 -1
  80. package/lib/packlets/ai-assist/streamingAdapters/anthropic.d.ts.map +1 -1
  81. package/lib/packlets/ai-assist/streamingAdapters/anthropic.js +17 -12
  82. package/lib/packlets/ai-assist/streamingAdapters/anthropic.js.map +1 -1
  83. package/lib/packlets/ai-assist/streamingAdapters/common.d.ts +5 -1
  84. package/lib/packlets/ai-assist/streamingAdapters/common.d.ts.map +1 -1
  85. package/lib/packlets/ai-assist/streamingAdapters/common.js +2 -0
  86. package/lib/packlets/ai-assist/streamingAdapters/common.js.map +1 -1
  87. package/lib/packlets/ai-assist/streamingAdapters/gemini.d.ts +2 -1
  88. package/lib/packlets/ai-assist/streamingAdapters/gemini.d.ts.map +1 -1
  89. package/lib/packlets/ai-assist/streamingAdapters/gemini.js +17 -5
  90. package/lib/packlets/ai-assist/streamingAdapters/gemini.js.map +1 -1
  91. package/lib/packlets/ai-assist/streamingAdapters/openaiChat.d.ts +2 -1
  92. package/lib/packlets/ai-assist/streamingAdapters/openaiChat.d.ts.map +1 -1
  93. package/lib/packlets/ai-assist/streamingAdapters/openaiChat.js +19 -4
  94. package/lib/packlets/ai-assist/streamingAdapters/openaiChat.js.map +1 -1
  95. package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.d.ts +2 -1
  96. package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.d.ts.map +1 -1
  97. package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.js +20 -5
  98. package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.js.map +1 -1
  99. package/lib/packlets/ai-assist/streamingAdapters/proxy.d.ts.map +1 -1
  100. package/lib/packlets/ai-assist/streamingAdapters/proxy.js +9 -3
  101. package/lib/packlets/ai-assist/streamingAdapters/proxy.js.map +1 -1
  102. package/lib/packlets/ai-assist/streamingClient.d.ts.map +1 -1
  103. package/lib/packlets/ai-assist/streamingClient.js +28 -6
  104. package/lib/packlets/ai-assist/streamingClient.js.map +1 -1
  105. package/lib/packlets/ai-assist/thinkingOptionsResolver.d.ts +71 -0
  106. package/lib/packlets/ai-assist/thinkingOptionsResolver.d.ts.map +1 -0
  107. package/lib/packlets/ai-assist/thinkingOptionsResolver.js +270 -0
  108. package/lib/packlets/ai-assist/thinkingOptionsResolver.js.map +1 -0
  109. package/lib/packlets/conversion/converters.d.ts.map +1 -1
  110. package/lib/packlets/conversion/converters.js +1 -0
  111. package/lib/packlets/conversion/converters.js.map +1 -1
  112. package/lib/packlets/crypto-utils/index.browser.d.ts +1 -0
  113. package/lib/packlets/crypto-utils/index.browser.d.ts.map +1 -1
  114. package/lib/packlets/crypto-utils/index.browser.js +7 -1
  115. package/lib/packlets/crypto-utils/index.browser.js.map +1 -1
  116. package/lib/packlets/crypto-utils/index.d.ts +1 -0
  117. package/lib/packlets/crypto-utils/index.d.ts.map +1 -1
  118. package/lib/packlets/crypto-utils/index.js +7 -1
  119. package/lib/packlets/crypto-utils/index.js.map +1 -1
  120. package/lib/packlets/crypto-utils/keyPairAlgorithmParams.d.ts +10 -6
  121. package/lib/packlets/crypto-utils/keyPairAlgorithmParams.d.ts.map +1 -1
  122. package/lib/packlets/crypto-utils/keyPairAlgorithmParams.js +8 -0
  123. package/lib/packlets/crypto-utils/keyPairAlgorithmParams.js.map +1 -1
  124. package/lib/packlets/crypto-utils/keystore/keyStore.d.ts.map +1 -1
  125. package/lib/packlets/crypto-utils/keystore/keyStore.js +2 -1
  126. package/lib/packlets/crypto-utils/keystore/keyStore.js.map +1 -1
  127. package/lib/packlets/crypto-utils/model.d.ts +19 -1
  128. package/lib/packlets/crypto-utils/model.d.ts.map +1 -1
  129. package/lib/packlets/crypto-utils/model.js +2 -1
  130. package/lib/packlets/crypto-utils/model.js.map +1 -1
  131. package/lib/packlets/crypto-utils/nodeCryptoProvider.d.ts +13 -0
  132. package/lib/packlets/crypto-utils/nodeCryptoProvider.d.ts.map +1 -1
  133. package/lib/packlets/crypto-utils/nodeCryptoProvider.js +25 -0
  134. package/lib/packlets/crypto-utils/nodeCryptoProvider.js.map +1 -1
  135. package/lib/packlets/crypto-utils/spkiHelpers.d.ts +53 -0
  136. package/lib/packlets/crypto-utils/spkiHelpers.d.ts.map +1 -0
  137. package/lib/packlets/crypto-utils/spkiHelpers.js +136 -0
  138. package/lib/packlets/crypto-utils/spkiHelpers.js.map +1 -0
  139. package/package.json +13 -13
@@ -1,5 +1,5 @@
1
1
  import * as AiAssist from './packlets/ai-assist';
2
- import * as Crypto from './packlets/crypto-utils/index.browser';
2
+ import * as CryptoUtils from './packlets/crypto-utils/index.browser';
3
3
  import * as Csv from './packlets/csv/index.browser';
4
4
  import * as Experimental from './packlets/experimental';
5
5
  import * as Hash from './packlets/hash/index.browser';
@@ -7,5 +7,5 @@ import * as Mustache from './packlets/mustache';
7
7
  import * as RecordJar from './packlets/record-jar/index.browser';
8
8
  import * as ZipFileTree from './packlets/zip-file-tree';
9
9
  import { Converters } from './packlets/conversion';
10
- export { AiAssist, Converters, Crypto, Csv, Experimental, Hash, Mustache, RecordJar, ZipFileTree };
10
+ export { AiAssist, Converters, CryptoUtils, CryptoUtils as Crypto, Csv, Experimental, Hash, Mustache, RecordJar, ZipFileTree };
11
11
  //# sourceMappingURL=index.browser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AAEjD,OAAO,KAAK,MAAM,MAAM,uCAAuC,CAAC;AAEhE,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,OAAO,KAAK,YAAY,MAAM,yBAAyB,CAAC;AAExD,OAAO,KAAK,IAAI,MAAM,+BAA+B,CAAC;AACtD,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAEhD,OAAO,KAAK,SAAS,MAAM,qCAAqC,CAAC;AACjE,OAAO,KAAK,WAAW,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AAEjD,OAAO,KAAK,WAAW,MAAM,uCAAuC,CAAC;AAErE,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,OAAO,KAAK,YAAY,MAAM,yBAAyB,CAAC;AAExD,OAAO,KAAK,IAAI,MAAM,+BAA+B,CAAC;AACtD,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAEhD,OAAO,KAAK,SAAS,MAAM,qCAAqC,CAAC;AACjE,OAAO,KAAK,WAAW,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,OAAO,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,WAAW,IAAI,MAAM,EACrB,GAAG,EACH,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,WAAW,EACZ,CAAC"}
@@ -54,13 +54,14 @@ var __importStar = (this && this.__importStar) || (function () {
54
54
  };
55
55
  })();
56
56
  Object.defineProperty(exports, "__esModule", { value: true });
57
- exports.ZipFileTree = exports.RecordJar = exports.Mustache = exports.Hash = exports.Experimental = exports.Csv = exports.Crypto = exports.Converters = exports.AiAssist = void 0;
57
+ exports.ZipFileTree = exports.RecordJar = exports.Mustache = exports.Hash = exports.Experimental = exports.Csv = exports.Crypto = exports.CryptoUtils = exports.Converters = exports.AiAssist = void 0;
58
58
  /* c8 ignore start - Browser-specific export used conditionally in package.json */
59
59
  const AiAssist = __importStar(require("./packlets/ai-assist"));
60
60
  exports.AiAssist = AiAssist;
61
61
  // eslint-disable-next-line @rushstack/packlets/mechanics
62
- const Crypto = __importStar(require("./packlets/crypto-utils/index.browser"));
63
- exports.Crypto = Crypto;
62
+ const CryptoUtils = __importStar(require("./packlets/crypto-utils/index.browser"));
63
+ exports.CryptoUtils = CryptoUtils;
64
+ exports.Crypto = CryptoUtils;
64
65
  // eslint-disable-next-line @rushstack/packlets/mechanics
65
66
  const Csv = __importStar(require("./packlets/csv/index.browser"));
66
67
  exports.Csv = Csv;
@@ -1 +1 @@
1
- {"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kFAAkF;AAClF,+DAAiD;AAiBxC,4BAAQ;AAhBjB,yDAAyD;AACzD,8EAAgE;AAejC,wBAAM;AAdrC,yDAAyD;AACzD,kEAAoD;AAab,kBAAG;AAZ1C,sEAAwD;AAYZ,oCAAY;AAXxD,yDAAyD;AACzD,oEAAsD;AAUI,oBAAI;AAT9D,8DAAgD;AASgB,4BAAQ;AARxE,yDAAyD;AACzD,+EAAiE;AAOS,8BAAS;AANnF,sEAAwD;AAM6B,kCAAW;AAJhG,sDAAmD;AAIhC,2FAJV,uBAAU,OAIU;AAC7B,oBAAoB","sourcesContent":["/*\n * Copyright (c) 2020 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/* c8 ignore start - Browser-specific export used conditionally in package.json */\nimport * as AiAssist from './packlets/ai-assist';\n// eslint-disable-next-line @rushstack/packlets/mechanics\nimport * as Crypto from './packlets/crypto-utils/index.browser';\n// eslint-disable-next-line @rushstack/packlets/mechanics\nimport * as Csv from './packlets/csv/index.browser';\nimport * as Experimental from './packlets/experimental';\n// eslint-disable-next-line @rushstack/packlets/mechanics\nimport * as Hash from './packlets/hash/index.browser';\nimport * as Mustache from './packlets/mustache';\n// eslint-disable-next-line @rushstack/packlets/mechanics\nimport * as RecordJar from './packlets/record-jar/index.browser';\nimport * as ZipFileTree from './packlets/zip-file-tree';\n\nimport { Converters } from './packlets/conversion';\n\n// Browser-safe exports - Node.js crypto-based providers excluded\n// Use BrowserCryptoProvider from @fgv/ts-web-extras for browser crypto\nexport { AiAssist, Converters, Crypto, Csv, Experimental, Hash, Mustache, RecordJar, ZipFileTree };\n/* c8 ignore stop */\n"]}
1
+ {"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kFAAkF;AAClF,+DAAiD;AAkB/C,4BAAQ;AAjBV,yDAAyD;AACzD,mFAAqE;AAkBnE,kCAAW;AACI,6BAAM;AAlBvB,yDAAyD;AACzD,kEAAoD;AAkBlD,kBAAG;AAjBL,sEAAwD;AAkBtD,oCAAY;AAjBd,yDAAyD;AACzD,oEAAsD;AAiBpD,oBAAI;AAhBN,8DAAgD;AAiB9C,4BAAQ;AAhBV,yDAAyD;AACzD,+EAAiE;AAgB/D,8BAAS;AAfX,sEAAwD;AAgBtD,kCAAW;AAdb,sDAAmD;AAMjD,2FANO,uBAAU,OAMP;AAUZ,oBAAoB","sourcesContent":["/*\n * Copyright (c) 2020 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/* c8 ignore start - Browser-specific export used conditionally in package.json */\nimport * as AiAssist from './packlets/ai-assist';\n// eslint-disable-next-line @rushstack/packlets/mechanics\nimport * as CryptoUtils from './packlets/crypto-utils/index.browser';\n// eslint-disable-next-line @rushstack/packlets/mechanics\nimport * as Csv from './packlets/csv/index.browser';\nimport * as Experimental from './packlets/experimental';\n// eslint-disable-next-line @rushstack/packlets/mechanics\nimport * as Hash from './packlets/hash/index.browser';\nimport * as Mustache from './packlets/mustache';\n// eslint-disable-next-line @rushstack/packlets/mechanics\nimport * as RecordJar from './packlets/record-jar/index.browser';\nimport * as ZipFileTree from './packlets/zip-file-tree';\n\nimport { Converters } from './packlets/conversion';\n\n// Browser-safe exports - Node.js crypto-based providers excluded\n// Use BrowserCryptoProvider from @fgv/ts-web-extras for browser crypto\nexport {\n AiAssist,\n Converters,\n CryptoUtils,\n CryptoUtils as Crypto,\n Csv,\n Experimental,\n Hash,\n Mustache,\n RecordJar,\n ZipFileTree\n};\n/* c8 ignore stop */\n"]}
@@ -1,5 +1,5 @@
1
1
  import { type Logging, Result } from '@fgv/ts-utils';
2
- import { AiPrompt, type AiModelCapability, type AiServerToolConfig, type IAiCompletionResponse, type IAiImageGenerationParams, type IAiImageGenerationResponse, type IAiModelCapabilityConfig, type IAiModelInfo, type IAiProviderDescriptor, type IChatMessage, type ModelSpec } from './model';
2
+ import { AiPrompt, type AiModelCapability, type AiServerToolConfig, type IAiCompletionResponse, type IAiImageGenerationParams, type IAiImageGenerationResponse, type IAiModelCapabilityConfig, type IAiModelInfo, type IAiProviderDescriptor, type IChatMessage, type IThinkingConfig, type ModelSpec } from './model';
3
3
  /**
4
4
  * Parameters for a provider completion request.
5
5
  * @public
@@ -11,10 +11,7 @@ export interface IProviderCompletionParams {
11
11
  readonly apiKey: string;
12
12
  /** The structured prompt to send */
13
13
  readonly prompt: AiPrompt;
14
- /**
15
- * Additional messages to append after system+user (e.g. for correction retries).
16
- * These are appended in order after the initial system and user messages.
17
- */
14
+ /** Additional messages to append after system+user in order (e.g. for correction retries). */
18
15
  readonly additionalMessages?: ReadonlyArray<IChatMessage>;
19
16
  /** Sampling temperature (default: 0.7) */
20
17
  readonly temperature?: number;
@@ -27,34 +24,22 @@ export interface IProviderCompletionParams {
27
24
  /** Optional abort signal for cancelling the in-flight request. */
28
25
  readonly signal?: AbortSignal;
29
26
  /**
30
- * Optional override of the descriptor's default base URL. When set, the
31
- * dispatcher uses this URL (scheme + host + optional port + optional path
32
- * prefix) and appends the descriptor's per-route suffix (e.g.
33
- * `/chat/completions`) the same way it composes against the default.
34
- *
35
- * Must be a well-formed `http`/`https` URL string. Used to dispatch the same
36
- * provider descriptor against a self-hosted or local endpoint (e.g.
37
- * `http://localhost:11434/v1` for Ollama, or LAN-hosted OpenAI-compatible
38
- * servers).
39
- *
40
- * Setting `endpoint` does not change the auth shape: providers with
41
- * `needsSecret === true` still require an API key.
27
+ * Optional override of the descriptor's default base URL (scheme + host +
28
+ * optional port + path prefix). The per-route suffix (e.g. `/chat/completions`)
29
+ * is appended unchanged. Must be a well-formed `http`/`https` URL. Auth shape
30
+ * is unchanged: `needsSecret` providers still require an API key.
42
31
  */
43
32
  readonly endpoint?: string;
33
+ /**
34
+ * Optional thinking/reasoning config. Anthropic, OpenAI, and xAI reject `temperature` when
35
+ * the effective merged effort is non-`'none'`; Gemini always accepts both.
36
+ */
37
+ readonly thinking?: IThinkingConfig;
44
38
  }
45
39
  /**
46
40
  * Calls the appropriate chat completion API for a given provider.
47
- *
48
- * Routes based on the provider descriptor's `apiFormat` field:
49
- * - `'openai'` for xAI, OpenAI, Groq, Mistral
50
- * - `'anthropic'` for Anthropic Claude
51
- * - `'gemini'` for Google Gemini
52
- *
53
- * When tools are provided and the provider supports them:
54
- * - OpenAI-format providers switch to the Responses API
55
- * - Anthropic includes tools in the Messages API request
56
- * - Gemini includes Google Search grounding
57
- *
41
+ * Routes by `apiFormat`: `'openai'` (xAI/OpenAI/Groq/Mistral — switches to Responses API when
42
+ * tools are set), `'anthropic'`, or `'gemini'`.
58
43
  * @param params - Request parameters including descriptor, API key, prompt, and optional tools
59
44
  * @returns The completion response with content and truncation status, or a failure
60
45
  * @public
@@ -77,30 +62,15 @@ export interface IProviderImageGenerationParams {
77
62
  readonly logger?: Logging.ILogger;
78
63
  /** Optional abort signal for cancelling the in-flight request. */
79
64
  readonly signal?: AbortSignal;
80
- /**
81
- * Optional override of the descriptor's default base URL. Same semantics as
82
- * the non-streaming completion path's endpoint: a well-formed `http`/`https`
83
- * URL substituted for `descriptor.baseUrl` when composing the request, with
84
- * the per-route suffix (e.g. `/images/generations`, `:predict`) appended
85
- * unchanged.
86
- */
65
+ /** Optional override of the descriptor's base URL; per-route suffix is appended unchanged. */
87
66
  readonly endpoint?: string;
88
67
  }
89
68
  /**
90
69
  * Calls the appropriate image-generation API for a given provider.
91
- *
92
- * Resolves a {@link IAiImageModelCapability} from
93
- * {@link IAiProviderDescriptor.imageGeneration} for the requested model and
94
- * routes by its `format`:
95
- * - `'openai-images'` for OpenAI (DALL-E, gpt-image-1)
96
- * - `'xai-images'` for xAI Grok image models
97
- * - `'gemini-imagen'` for Google Imagen `:predict`
98
- * - `'gemini-image-out'` for Gemini chat-style image output (Nano Banana)
99
- *
100
- * Image-model selection reuses the existing `'image'` {@link ModelSpecKey}.
101
- * When `request.referenceImages` is non-empty, the call is rejected up front
102
- * unless the resolved capability declares `acceptsImageReferenceInput`.
103
- *
70
+ * Routes by the `format` field of the resolved {@link IAiImageModelCapability}:
71
+ * `'openai-images'`, `'xai-images'`, `'xai-images-edits'`, `'gemini-imagen'`,
72
+ * or `'gemini-image-out'`. Rejects up front if `referenceImages` is set but the
73
+ * capability does not declare `acceptsImageReferenceInput`.
104
74
  * @param params - Request parameters including descriptor, API key, and prompt
105
75
  * @returns The generated images, or a failure
106
76
  * @public
@@ -123,20 +93,12 @@ export interface IProviderListModelsParams {
123
93
  readonly logger?: Logging.ILogger;
124
94
  /** Optional abort signal for cancelling the in-flight request. */
125
95
  readonly signal?: AbortSignal;
126
- /**
127
- * Optional override of the descriptor's default base URL — a well-formed
128
- * `http`/`https` URL substituted for `descriptor.baseUrl`, with the
129
- * per-format `/models` route appended unchanged.
130
- */
96
+ /** Optional override of the descriptor's base URL; per-format `/models` route is appended unchanged. */
131
97
  readonly endpoint?: string;
132
98
  }
133
99
  /**
134
- * Lists models available from a provider, with capabilities resolved from
135
- * native provider info (where supplied) and a configurable rule set.
136
- *
137
- * Routes based on `descriptor.apiFormat` — listing reuses the existing
138
- * format dispatch and does not require a separate descriptor field.
139
- *
100
+ * Lists models available from a provider, routing by `descriptor.apiFormat`.
101
+ * Capabilities are resolved from native provider info and a configurable rule set.
140
102
  * @param params - Request parameters including descriptor, API key, and optional capability filter
141
103
  * @returns The resolved model list, or a failure
142
104
  * @public
@@ -144,18 +106,9 @@ export interface IProviderListModelsParams {
144
106
  export declare function callProviderListModels(params: IProviderListModelsParams): Promise<Result<ReadonlyArray<IAiModelInfo>>>;
145
107
  /**
146
108
  * Calls the model-listing endpoint on a proxy server.
147
- *
148
- * @remarks
149
- * Proxy contract:
150
- * - Endpoint: `POST ${proxyUrl}/api/ai/list-models`
151
- * - Request body: `{providerId, apiKey, capability?}`. Capability config is
152
- * not forwarded — the proxy applies its own (typically the same default
153
- * the library ships).
154
- * - Success response body: an `IAiModelInfo[]` (under key `models`) where
155
- * `capabilities` is serialized as a string array (not Set, which doesn't
156
- * round-trip through JSON).
157
- * - Error response body: `{error: string}`, surfaced as `proxy: ${error}`.
158
- *
109
+ * Endpoint: `POST ${proxyUrl}/api/ai/list-models`. Capability config is not
110
+ * forwarded. `capabilities` is serialized as a string array. Error body
111
+ * `{error: string}` is surfaced as `proxy: ${error}`.
159
112
  * @public
160
113
  */
161
114
  export declare function callProxiedListModels(proxyUrl: string, params: IProviderListModelsParams): Promise<Result<ReadonlyArray<IAiModelInfo>>>;
@@ -176,20 +129,11 @@ export declare function callProxiedCompletion(proxyUrl: string, params: IProvide
176
129
  /**
177
130
  * Calls the image-generation endpoint on a proxy server instead of calling
178
131
  * the provider API directly from the browser.
179
- *
180
- * @remarks
181
- * The proxy contract:
182
- * - Endpoint: `POST ${proxyUrl}/api/ai/image-generation`
183
- * - Request body: `{providerId, apiKey, params, modelOverride?}`
184
- * - Success response body: an {@link IAiImageGenerationResponse}
185
- * - Error response body: `{error: string}` (surfaced as `proxy: ${error}`)
186
- *
187
- * The proxy server is responsible for descriptor lookup, model resolution,
188
- * provider dispatch, and response normalization. When `params.referenceImages`
189
- * is present, the proxy is also responsible for repackaging it into the
190
- * upstream wire format (e.g. multipart/form-data for OpenAI `/images/edits`,
191
- * `inlineData` parts for Gemini `:generateContent`).
192
- *
132
+ * Endpoint: `POST ${proxyUrl}/api/ai/image-generation`. Request body:
133
+ * `{providerId, apiKey, params, modelOverride?}`. The proxy handles descriptor
134
+ * lookup, model resolution, provider dispatch, and response normalization
135
+ * (including repackaging `referenceImages` for the upstream wire format).
136
+ * Error body `{error: string}` is surfaced as `proxy: ${error}`.
193
137
  * @param proxyUrl - Base URL of the proxy server (e.g. `http://localhost:3001`)
194
138
  * @param params - Same parameters as {@link callProviderImageGeneration}
195
139
  * @returns The generated images, or a failure
@@ -1 +1 @@
1
- {"version":3,"file":"apiClient.d.ts","sourceRoot":"","sources":["../../../src/packlets/ai-assist/apiClient.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAQ,KAAK,OAAO,EAAc,MAAM,EAAuC,MAAM,eAAe,CAAC;AAE5G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