@leitwerk-dev/models 0.1.9 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,15 +18,25 @@ extensions:
18
18
  azure-openai-responses:
19
19
  api_key: env:AZURE_OPENAI_API_KEY
20
20
  base_url: https://my-resource.openai.azure.com
21
+ models: # Optional deployments absent from Pi's built-in catalog.
22
+ - id: private-reasoner
23
+ reasoning: true
24
+ thinking_level_map: {low: low, medium: medium, xhigh: xhigh}
21
25
  custom_gateways:
22
26
  internal-gateway:
23
27
  base_url: https://llm-gateway.example.com/v1
24
28
  api_key: false
25
29
  api: openai-completions
30
+ compat:
31
+ supportsStore: false
32
+ thinkingFormat: deepseek
26
33
  models:
27
34
  - id: gemma-4-31b-it
28
35
  name: Gemma 4 31B IT
29
36
  reasoning: true
37
+ thinking_level_map: {off: null, xhigh: high}
38
+ input: [text]
39
+ cost: {input: 0, output: 0, cacheRead: 0, cacheWrite: 0}
30
40
  context_window: 262144
31
41
  max_tokens: 32768
32
42
 
@@ -41,4 +51,16 @@ pi:
41
51
 
42
52
  The extension uses a code-defined standard-provider list with explicit environment-variable mappings. Pi upgrades do not implicitly enable new providers. Providers with ambient or OAuth-only authentication, including Bedrock and OpenAI Codex, require dedicated extensions.
43
53
 
54
+ Standard providers accept an optional `models` list to add deployments or replace catalog definitions by ID. These definitions use the provider's canonical API and configured endpoint for both worker and server calls. Credential availability still controls whether a model can be selected. Missing metadata uses Pi's explicit-model defaults: text input, no reasoning, zero estimated cost, 128,000 context tokens and 16,384 output tokens. Specify the actual limits and costs when known.
55
+
56
+ Both kinds of model definition accept `thinking_level_map`, `input`, `cost`, and `compat`. Thinking-map keys are `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`; `null` marks a level unsupported. `context_window`, `max_tokens`, and `thinking_level_map` are converted to Pi's field names. `cost` and `compat` use Pi's camelCase keys directly. Gateway-level compatibility settings apply to all models; model-level settings override them. Supported compatibility keys are `supportsStore`, `supportsDeveloperRole`, `supportsReasoningEffort`, `supportsUsageInStreaming`, `maxTokensField`, `supportsStrictMode`, `thinkingFormat`, and `requiresReasoningContentOnAssistantMessages`. Model IDs must be unique within each list, and unknown metadata fields are rejected.
57
+
44
58
  Custom gateways support `openai-completions`, `openai-responses`, `anthropic-messages`, and `google-generative-ai`. They support worker LLM turns. Because they do not declare a server adapter, they cannot be selected for process-title generation.
59
+
60
+ ## API support
61
+
62
+ The following exported declarations are `@public`:
63
+
64
+ - `@leitwerk-dev/models`: `default`.
65
+
66
+ See the [SDK compatibility policy](../../docs/process-sdk.md#api-compatibility) for member classifications and support guarantees.
package/dist/index.d.ts CHANGED
@@ -1,15 +1,5 @@
1
- export declare const manifest: {
2
- readonly id: "models";
3
- readonly version: "0.1.0";
4
- };
5
- declare const modelsExtension: {
6
- manifest: {
7
- readonly id: "models";
8
- readonly version: "0.1.0";
9
- };
10
- modelProviders: import("@leitwerk-dev/process-sdk").ModelProviderSet;
11
- };
1
+ import { type LeitwerkExtensionModule } from "@leitwerk-dev/process-sdk";
2
+ /** @public */
3
+ declare const modelsExtension: LeitwerkExtensionModule;
12
4
  export default modelsExtension;
13
- export * from "./models-provider.js";
14
- export * from "./provider-auth.js";
15
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ;;;CAGX,CAAC;AAEX,QAAA,MAAM,eAAe;;;;;;CAGc,CAAC;AAEpC,eAAe,eAAe,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAW/F,cAAc;AACd,QAAA,MAAM,eAAe,EAAE,uBAKtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -1,14 +1,430 @@
1
+ // src/index.ts
1
2
  import { defineModelProviders } from "@leitwerk-dev/process-sdk";
2
- import { resolveModelProviders } from "./models-provider.js";
3
- export const manifest = {
4
- id: "models",
5
- version: "0.1.0",
6
- };
7
- const modelsExtension = {
8
- manifest,
9
- modelProviders: defineModelProviders(resolveModelProviders),
10
- };
11
- export default modelsExtension;
12
- export * from "./models-provider.js";
13
- export * from "./provider-auth.js";
3
+
4
+ // src/models-provider.ts
5
+ import { getBuiltinModels } from "@earendil-works/pi-ai/providers/all";
6
+
7
+ // ../../packages/domain/dist/index.js
8
+ import * as v from "valibot";
9
+ import * as v2 from "valibot";
10
+ var SYSTEM_ACTOR = { id: "system", kind: "system", provider: null };
11
+ function serializeActor(actor) {
12
+ return JSON.stringify({
13
+ id: actor.id,
14
+ kind: actor.kind,
15
+ provider: actor.provider,
16
+ ...actor.displayName !== void 0 ? { displayName: actor.displayName } : {}
17
+ });
18
+ }
19
+ var SERIALIZED_SYSTEM_ACTOR = serializeActor(SYSTEM_ACTOR);
20
+ var jsonObjectSchema = v.custom(
21
+ (value) => typeof value === "object" && value !== null && !Array.isArray(value),
22
+ "Expected object"
23
+ );
24
+ var instanceTurnConfigSchema = v.pipe(
25
+ jsonObjectSchema,
26
+ v.object({
27
+ modelProfileId: v.optional(v.unknown())
28
+ })
29
+ );
30
+ var strictInstanceTurnConfigsJsonSchema = v.pipe(
31
+ v.string(),
32
+ v.parseJson(),
33
+ jsonObjectSchema,
34
+ v.record(v.string(), instanceTurnConfigSchema)
35
+ );
36
+ var copiedUnknownRecordSchema = v2.pipe(
37
+ v2.unknown(),
38
+ v2.check(isUnknownRecord, "Expected object"),
39
+ v2.record(v2.string(), v2.unknown())
40
+ );
41
+ function isUnknownRecord(value) {
42
+ return typeof value === "object" && value !== null && !Array.isArray(value);
43
+ }
44
+
45
+ // src/models-provider.ts
46
+ import {
47
+ builtinPiProvider,
48
+ configuredPiProvider,
49
+ defineModelProvider
50
+ } from "@leitwerk-dev/process-sdk";
51
+ import * as v3 from "valibot";
52
+
53
+ // src/provider-auth.ts
54
+ var STANDARD_PROVIDER_ENV_KEYS = {
55
+ "ant-ling": ["ANT_LING_API_KEY"],
56
+ anthropic: ["ANTHROPIC_OAUTH_TOKEN", "ANTHROPIC_API_KEY"],
57
+ "azure-openai-responses": ["AZURE_OPENAI_API_KEY"],
58
+ cerebras: ["CEREBRAS_API_KEY"],
59
+ "cloudflare-ai-gateway": ["CLOUDFLARE_API_KEY"],
60
+ "cloudflare-workers-ai": ["CLOUDFLARE_API_KEY"],
61
+ deepseek: ["DEEPSEEK_API_KEY"],
62
+ fireworks: ["FIREWORKS_API_KEY"],
63
+ "github-copilot": ["COPILOT_GITHUB_TOKEN"],
64
+ google: ["GEMINI_API_KEY"],
65
+ "google-vertex": ["GOOGLE_CLOUD_API_KEY"],
66
+ groq: ["GROQ_API_KEY"],
67
+ huggingface: ["HF_TOKEN"],
68
+ "kimi-coding": ["KIMI_API_KEY"],
69
+ minimax: ["MINIMAX_API_KEY"],
70
+ "minimax-cn": ["MINIMAX_CN_API_KEY"],
71
+ mistral: ["MISTRAL_API_KEY"],
72
+ moonshotai: ["MOONSHOT_API_KEY"],
73
+ "moonshotai-cn": ["MOONSHOT_API_KEY"],
74
+ nvidia: ["NVIDIA_API_KEY"],
75
+ openai: ["OPENAI_API_KEY"],
76
+ opencode: ["OPENCODE_API_KEY"],
77
+ "opencode-go": ["OPENCODE_API_KEY"],
78
+ openrouter: ["OPENROUTER_API_KEY"],
79
+ "qwen-token-plan": ["QWEN_TOKEN_PLAN_API_KEY"],
80
+ "qwen-token-plan-cn": ["QWEN_TOKEN_PLAN_CN_API_KEY"],
81
+ together: ["TOGETHER_API_KEY"],
82
+ "vercel-ai-gateway": ["AI_GATEWAY_API_KEY"],
83
+ xai: ["XAI_API_KEY"],
84
+ xiaomi: ["XIAOMI_API_KEY"],
85
+ "xiaomi-token-plan-ams": ["XIAOMI_TOKEN_PLAN_AMS_API_KEY"],
86
+ "xiaomi-token-plan-cn": ["XIAOMI_TOKEN_PLAN_CN_API_KEY"],
87
+ "xiaomi-token-plan-sgp": ["XIAOMI_TOKEN_PLAN_SGP_API_KEY"],
88
+ zai: ["ZAI_API_KEY"],
89
+ "zai-coding-cn": ["ZAI_CODING_CN_API_KEY"]
90
+ };
91
+ function getKnownEnvKeys(providerId) {
92
+ return STANDARD_PROVIDER_ENV_KEYS[providerId] ?? [];
93
+ }
94
+ function getStandardEnvApiKey(providerId) {
95
+ for (const key of getKnownEnvKeys(providerId)) {
96
+ const value = process.env[key]?.trim();
97
+ if (value) return value;
98
+ }
99
+ return void 0;
100
+ }
101
+ function getSupportedStandardProviders() {
102
+ return Object.keys(STANDARD_PROVIDER_ENV_KEYS);
103
+ }
104
+
105
+ // src/models-provider.ts
106
+ var nonEmptyStringSchema = v3.pipe(
107
+ v3.string(),
108
+ v3.transform((value) => value.trim()),
109
+ v3.minLength(1)
110
+ );
111
+ var positiveIntegerSchema = v3.pipe(v3.number(), v3.integer(), v3.minValue(1));
112
+ var nonNegativeNumberSchema = v3.pipe(v3.number(), v3.finite(), v3.minValue(0));
113
+ var thinkingLevelValueSchema = v3.optional(v3.nullable(nonEmptyStringSchema));
114
+ var thinkingLevelMapSchema = v3.strictObject({
115
+ /** @internal */
116
+ off: thinkingLevelValueSchema,
117
+ /** @internal */
118
+ minimal: thinkingLevelValueSchema,
119
+ /** @internal */
120
+ low: thinkingLevelValueSchema,
121
+ /** @internal */
122
+ medium: thinkingLevelValueSchema,
123
+ /** @internal */
124
+ high: thinkingLevelValueSchema,
125
+ /** @internal */
126
+ xhigh: thinkingLevelValueSchema,
127
+ /** @internal */
128
+ max: thinkingLevelValueSchema
129
+ });
130
+ var compatibilitySchema = v3.strictObject({
131
+ /** @internal */
132
+ supportsStore: v3.optional(v3.boolean()),
133
+ /** @internal */
134
+ supportsDeveloperRole: v3.optional(v3.boolean()),
135
+ /** @internal */
136
+ supportsReasoningEffort: v3.optional(v3.boolean()),
137
+ /** @internal */
138
+ supportsUsageInStreaming: v3.optional(v3.boolean()),
139
+ /** @internal */
140
+ maxTokensField: v3.optional(v3.picklist(["max_tokens", "max_completion_tokens"])),
141
+ /** @internal */
142
+ supportsStrictMode: v3.optional(v3.boolean()),
143
+ /** @internal */
144
+ requiresReasoningContentOnAssistantMessages: v3.optional(v3.boolean()),
145
+ /** @internal */
146
+ thinkingFormat: v3.optional(
147
+ v3.picklist([
148
+ "openai",
149
+ "openrouter",
150
+ "deepseek",
151
+ "together",
152
+ "zai",
153
+ "qwen",
154
+ "chat-template",
155
+ "qwen-chat-template",
156
+ "string-thinking",
157
+ "ant-ling"
158
+ ])
159
+ )
160
+ });
161
+ var modelCostSchema = v3.strictObject({
162
+ /** @internal */
163
+ input: nonNegativeNumberSchema,
164
+ /** @internal */
165
+ output: nonNegativeNumberSchema,
166
+ /** @internal */
167
+ cacheRead: nonNegativeNumberSchema,
168
+ /** @internal */
169
+ cacheWrite: nonNegativeNumberSchema
170
+ });
171
+ var baseUrlSchema = v3.pipe(
172
+ nonEmptyStringSchema,
173
+ v3.url(),
174
+ v3.check((value) => ["http:", "https:"].includes(new URL(value).protocol)),
175
+ v3.transform((value) => {
176
+ const url2 = new URL(value);
177
+ url2.pathname = url2.pathname.replace(/\/+$/u, "");
178
+ return url2.toString().replace(/\/$/u, "");
179
+ })
180
+ );
181
+ var customModelSchema = v3.pipe(
182
+ v3.strictObject({
183
+ /** @internal */
184
+ id: nonEmptyStringSchema,
185
+ /** @internal */
186
+ name: v3.optional(nonEmptyStringSchema),
187
+ /** @internal */
188
+ reasoning: v3.optional(v3.boolean()),
189
+ /** @internal */
190
+ thinking_level_map: v3.optional(thinkingLevelMapSchema),
191
+ /** @internal */
192
+ input: v3.optional(v3.pipe(v3.array(v3.picklist(["text", "image"])), v3.minLength(1))),
193
+ /** @internal */
194
+ cost: v3.optional(modelCostSchema),
195
+ /** @internal */
196
+ compat: v3.optional(compatibilitySchema),
197
+ /** @internal */
198
+ context_window: v3.optional(positiveIntegerSchema),
199
+ /** @internal */
200
+ max_tokens: v3.optional(positiveIntegerSchema)
201
+ }),
202
+ v3.transform(({ context_window, max_tokens, thinking_level_map, ...model }) => ({
203
+ ...model,
204
+ ...thinking_level_map === void 0 ? {} : {
205
+ /** @internal */
206
+ thinkingLevelMap: thinking_level_map
207
+ },
208
+ ...context_window === void 0 ? {} : {
209
+ /** @internal */
210
+ contextWindow: context_window
211
+ },
212
+ ...max_tokens === void 0 ? {} : {
213
+ /** @internal */
214
+ maxTokens: max_tokens
215
+ }
216
+ }))
217
+ );
218
+ var modelDefinitionsSchema = v3.pipe(
219
+ v3.array(customModelSchema),
220
+ v3.minLength(1),
221
+ v3.check(
222
+ (models) => new Set(models.map(({ id }) => id)).size === models.length,
223
+ "Duplicate model id"
224
+ )
225
+ );
226
+ var customGatewaySchema = v3.strictObject({
227
+ base_url: baseUrlSchema,
228
+ api_key: v3.optional(v3.nullable(v3.union([v3.literal(false), nonEmptyStringSchema]))),
229
+ api: v3.optional(
230
+ v3.picklist([
231
+ "openai-completions",
232
+ "openai-responses",
233
+ "anthropic-messages",
234
+ "google-generative-ai"
235
+ ]),
236
+ "openai-completions"
237
+ ),
238
+ compat: v3.optional(compatibilitySchema),
239
+ models: modelDefinitionsSchema
240
+ });
241
+ function normalizeStandardModels(providerId, models, baseUrl) {
242
+ const catalog = getBuiltinModels(providerId);
243
+ return models.map((model) => {
244
+ const reference = catalog.find(({ id }) => id === model.id) ?? catalog[0];
245
+ if (!reference) throw new Error(`Provider '${providerId}' has no canonical API definition`);
246
+ return {
247
+ ...model,
248
+ /** @internal */
249
+ provider: providerId,
250
+ /** @internal */
251
+ api: reference.api,
252
+ /** @internal */
253
+ baseUrl: baseUrl ?? reference.baseUrl,
254
+ /** @internal */
255
+ name: model.name ?? model.id,
256
+ /** @internal */
257
+ reasoning: model.reasoning ?? false,
258
+ /** @internal */
259
+ input: model.input ?? ["text"],
260
+ /** @internal */
261
+ cost: model.cost ?? { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
262
+ // Match Pi's defaults for explicitly configured models.
263
+ /** @internal */
264
+ contextWindow: model.contextWindow ?? 128e3,
265
+ /** @internal */
266
+ maxTokens: model.maxTokens ?? 16384
267
+ };
268
+ });
269
+ }
270
+ function assertKnownFields(value, allowed, location = "configuration") {
271
+ const known = new Set(allowed);
272
+ const unknown3 = Object.keys(value).find((key) => !known.has(key));
273
+ if (unknown3) throw new Error(`${location} contains unknown field '${unknown3}'`);
274
+ }
275
+ function nonEmptyString(value, location) {
276
+ if (typeof value !== "string") throw new Error(`${location} must be a string`);
277
+ const normalized = value.trim();
278
+ if (!normalized) throw new Error(`${location} must not be empty`);
279
+ return normalized;
280
+ }
281
+ function resolveSecret(value, location) {
282
+ const configured = nonEmptyString(value, location);
283
+ if (!configured.startsWith("env:")) return configured;
284
+ const variable = nonEmptyString(configured.slice(4), `${location} environment variable`);
285
+ const resolved = process.env[variable]?.trim();
286
+ if (!resolved) throw new Error(`${location} references unset environment variable '${variable}'`);
287
+ return resolved;
288
+ }
289
+ function parseApiKeyCredential(value, providerId) {
290
+ if (!isUnknownRecord(value)) throw new Error(`${providerId} credential must be an object`);
291
+ assertKnownFields(value, ["apiKey"], `${providerId} credential`);
292
+ return { apiKey: nonEmptyString(value.apiKey, `${providerId} credential apiKey`) };
293
+ }
294
+ function apiKeySecrets(credential) {
295
+ return credential ? { apiKey: credential.apiKey } : {};
296
+ }
297
+ function parseStandardProviderConfig(raw, providerId) {
298
+ if (raw !== void 0 && raw !== null && !isUnknownRecord(raw)) {
299
+ throw new Error("configuration must be an object");
300
+ }
301
+ const rawConfig = raw ?? {};
302
+ assertKnownFields(rawConfig, ["api_key", "base_url", "models"]);
303
+ const apiKey = rawConfig.api_key === void 0 || rawConfig.api_key === null ? getStandardEnvApiKey(providerId) : resolveSecret(rawConfig.api_key, "api_key");
304
+ const baseUrl = rawConfig.base_url === void 0 || rawConfig.base_url === null ? void 0 : v3.parse(baseUrlSchema, resolveSecret(rawConfig.base_url, "base_url"));
305
+ const models = rawConfig.models === void 0 ? void 0 : normalizeStandardModels(
306
+ providerId,
307
+ v3.parse(modelDefinitionsSchema, rawConfig.models),
308
+ baseUrl
309
+ );
310
+ return {
311
+ config: { ...baseUrl ? { baseUrl } : {}, ...models ? { models } : {} },
312
+ ...apiKey ? { credential: { apiKey } } : {}
313
+ };
314
+ }
315
+ function catalogModelStatuses(ctx, knownModelIds, credentialsAvailable, missingReason, credentialReason) {
316
+ return [...new Set(ctx.configuredModels.map(({ modelId }) => modelId))].map(
317
+ (modelId) => !knownModelIds.has(modelId) ? { modelId, availability: "unavailable", safeReason: missingReason(modelId) } : credentialsAvailable ? { modelId, availability: "available" } : { modelId, availability: "unavailable", safeReason: credentialReason }
318
+ );
319
+ }
320
+ function evaluateStandardModelStatuses(providerId, ctx) {
321
+ return catalogModelStatuses(
322
+ ctx,
323
+ /* @__PURE__ */ new Set([
324
+ ...getBuiltinModels(providerId).map(({ id }) => id),
325
+ ...(ctx.config.models ?? []).map(({ id }) => id)
326
+ ]),
327
+ ctx.credentialStatus.available,
328
+ (modelId) => `Canonical Pi model '${providerId}/${modelId}' is not found in catalog`,
329
+ `${providerId} credentials are unavailable (set ${getKnownEnvKeys(providerId).join(" or ")})`
330
+ );
331
+ }
332
+ function createStandardModelProvider(providerId) {
333
+ const reference = builtinPiProvider(providerId);
334
+ return defineModelProvider({
335
+ id: providerId,
336
+ parseConfig: (raw) => parseStandardProviderConfig(raw, providerId),
337
+ worker: configuredPiProvider(providerId, ({ config }) => ({
338
+ providers: config.baseUrl || config.models ? { [providerId]: { ...config } } : {}
339
+ })),
340
+ server: reference,
341
+ models: (ctx) => evaluateStandardModelStatuses(providerId, ctx),
342
+ credential: { parse: (value) => parseApiKeyCredential(value, providerId) },
343
+ secrets: ({ credential }) => apiKeySecrets(credential)
344
+ });
345
+ }
346
+ function parseCustomGatewayConfig(providerId, raw) {
347
+ const parsed = v3.parse(customGatewaySchema, raw);
348
+ const keyless = parsed.api_key === false;
349
+ const apiKey = keyless || parsed.api_key === void 0 || parsed.api_key === null ? void 0 : resolveSecret(parsed.api_key, "api_key");
350
+ return {
351
+ config: {
352
+ providerId,
353
+ baseUrl: parsed.base_url,
354
+ api: parsed.api,
355
+ keyless,
356
+ ...parsed.compat === void 0 ? {} : { compat: parsed.compat },
357
+ models: parsed.models
358
+ },
359
+ ...apiKey ? { credential: { apiKey } } : {}
360
+ };
361
+ }
362
+ function createCustomGatewayProvider(providerId, keyless) {
363
+ return defineModelProvider({
364
+ id: providerId,
365
+ parseConfig: (raw) => parseCustomGatewayConfig(providerId, raw),
366
+ worker: configuredPiProvider(providerId, ({ config }) => ({
367
+ providers: {
368
+ [config.providerId]: {
369
+ baseUrl: config.baseUrl,
370
+ api: config.api,
371
+ ...config.compat === void 0 ? {} : { compat: config.compat },
372
+ models: config.models
373
+ }
374
+ }
375
+ })),
376
+ models: (ctx) => catalogModelStatuses(
377
+ ctx,
378
+ new Set(ctx.config.models.map(({ id }) => id)),
379
+ ctx.config.keyless || ctx.credentialStatus.available,
380
+ (modelId) => `Canonical model '${ctx.config.providerId}/${modelId}' is not found in custom gateway definition`,
381
+ `Gateway provider '${ctx.config.providerId}' credentials are unavailable`
382
+ ),
383
+ ...keyless ? {} : { credential: { parse: (value) => parseApiKeyCredential(value, providerId) } },
384
+ secrets: ({ credential }) => apiKeySecrets(credential ?? (keyless ? { apiKey: "leitwerk-keyless" } : null))
385
+ });
386
+ }
387
+ function resolveModelProviders(raw) {
388
+ if (raw !== void 0 && raw !== null && !isUnknownRecord(raw)) {
389
+ throw new Error("configuration must be an object");
390
+ }
391
+ const owner = raw ?? {};
392
+ const standardIds = getSupportedStandardProviders();
393
+ assertKnownFields(owner, [...standardIds, "custom_gateways"]);
394
+ const entries = standardIds.map((providerId) => ({
395
+ definition: createStandardModelProvider(providerId),
396
+ rawConfig: owner[providerId]
397
+ }));
398
+ if (owner.custom_gateways === void 0) return entries;
399
+ if (!isUnknownRecord(owner.custom_gateways)) throw new Error("custom_gateways must be an object");
400
+ for (const [providerId, gateway] of Object.entries(owner.custom_gateways)) {
401
+ if (!providerId.trim()) throw new Error("custom gateway provider id must not be empty");
402
+ entries.push({
403
+ definition: createCustomGatewayProvider(
404
+ providerId,
405
+ isUnknownRecord(gateway) && gateway.api_key === false
406
+ ),
407
+ rawConfig: gateway
408
+ });
409
+ }
410
+ return entries;
411
+ }
412
+
413
+ // src/index.ts
414
+ var manifest = {
415
+ /** @internal */
416
+ id: "models",
417
+ /** @internal */
418
+ version: "0.1.0"
419
+ };
420
+ var modelsExtension = {
421
+ /** @internal */
422
+ manifest,
423
+ /** @internal */
424
+ modelProviders: defineModelProviders(resolveModelProviders)
425
+ };
426
+ var index_default = modelsExtension;
427
+ export {
428
+ index_default as default
429
+ };
14
430
  //# sourceMappingURL=index.js.map