@trazum/cli 1.52.0 → 1.53.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trazum/cli",
3
- "version": "1.52.0",
3
+ "version": "1.53.0",
4
4
  "description": "Trazum CLI: find where your LLM bill goes, price every finding per month, and enforce token budgets in CI.",
5
5
  "license": "MIT",
6
6
  "author": "David Mu\u00f1oz Rey",
@@ -37,7 +37,7 @@
37
37
  "prepublishOnly": "npm run build && npm test"
38
38
  },
39
39
  "dependencies": {
40
- "@trazum/core": "1.52.0"
40
+ "@trazum/core": "1.53.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "^26.2.0",
@@ -59,17 +59,106 @@ export const MAX_GATEWAY_BODY_BYTES = 8 * 1024 * 1024;
59
59
  * proxy for somebody's API key, and the budget decision only has meaning for
60
60
  * the endpoint that spends tokens.
61
61
  */
62
- export const UPSTREAMS: Readonly<Record<string, { origin: string; path: string }>> = {
62
+ export interface Upstream {
63
+ origin: string;
64
+ /**
65
+ * The one path, or the one *shape* of path when the model is part of it.
66
+ *
67
+ * A pattern is not a widening. It exists because Google puts the model in
68
+ * the URL rather than the body, so "one path" cannot be written down as a
69
+ * literal for that provider — and every pattern here is anchored at both
70
+ * ends with the model segment restricted to characters a model id is made
71
+ * of, which is a narrower grammar than a literal comparison against a string
72
+ * somebody could have put a `?` or a `..` in.
73
+ */
74
+ path: string | RegExp;
75
+ /**
76
+ * Where the model name is, when the request body does not carry one.
77
+ *
78
+ * Gemini's body has `contents` and no `model` field. Reading it out of the
79
+ * validated path is the only honest source: the alternative is a gateway
80
+ * that forwards a call it could not price, which is the one thing standing
81
+ * in the path was for.
82
+ */
83
+ modelIn?: 'path';
84
+ }
85
+
86
+ export const UPSTREAMS: Readonly<Record<string, Upstream>> = {
63
87
  anthropic: { origin: 'https://api.anthropic.com', path: '/v1/messages' },
64
88
  openai: { origin: 'https://api.openai.com', path: '/v1/chat/completions' },
89
+ /**
90
+ * DeepSeek's host is not a new fact: `scripts/measure-token-band.mjs` has
91
+ * sent a real API key to `https://api.deepseek.com/chat/completions` since
92
+ * the band harness learned a second provider. Reusing the endpoint this
93
+ * repository already trusts with a credential is the difference between
94
+ * adding an upstream and inventing one — and the path has no `/v1`, which is
95
+ * the kind of detail recall gets wrong.
96
+ */
97
+ deepseek: { origin: 'https://api.deepseek.com', path: '/chat/completions' },
98
+ /**
99
+ * Google, on the same rule and from a fuller record than DeepSeek's.
100
+ *
101
+ * `packages/core/src/llm.ts` has sent a real key to
102
+ * `https://generativelanguage.googleapis.com` at
103
+ * `/v1beta/models/{model}:generateContent`, with the key in an
104
+ * `x-goog-api-key` header rather than the query string, since the Gemini
105
+ * provider landed. `packages/core/src/usage.ts` has read the counts that
106
+ * come back. Host, path, credential header and response shape are all
107
+ * facts this repository already holds — nothing here was recalled.
108
+ *
109
+ * Only `:generateContent`. `:streamGenerateContent` and `:countTokens` are
110
+ * different operations whose shapes nobody here has established, and a
111
+ * gateway that forwards an operation it cannot read is a general proxy for
112
+ * somebody's key with extra steps.
113
+ */
114
+ google: {
115
+ origin: 'https://generativelanguage.googleapis.com',
116
+ path: /^\/v1beta\/models\/([A-Za-z0-9._-]+):generateContent$/,
117
+ modelIn: 'path',
118
+ },
65
119
  };
66
120
 
121
+ /**
122
+ * The path this gateway forwards for a provider, as a person reads it.
123
+ *
124
+ * One phrasing, used by the refusal, the documentation guard and the security
125
+ * allowlist — because three renderings of the same fact is how the page, the
126
+ * refusal and the test come to disagree about what is actually forwarded.
127
+ */
128
+ export function forwards(upstream: Upstream): string {
129
+ return typeof upstream.path === 'string' ? upstream.path : '/v1beta/models/{model}:generateContent';
130
+ }
131
+
132
+ /**
133
+ * Whether this request is the one call this gateway speaks for, and the model
134
+ * the path named if it named one.
135
+ *
136
+ * The returned path is **built here**, never the caller's string echoed back.
137
+ * A pattern that matched is evidence the request was well formed; it is not a
138
+ * licence to forward whatever matched it. Nothing reaches the upstream URL
139
+ * except the compiled-in origin and a path assembled from a model id that has
140
+ * already been restricted to `[A-Za-z0-9._-]`.
141
+ */
142
+ export function route(upstream: Upstream, url: string | undefined): { path: string; model: string | null } | null {
143
+ if (url === undefined) return null;
144
+ if (typeof upstream.path === 'string') {
145
+ return url === upstream.path ? { path: upstream.path, model: null } : null;
146
+ }
147
+ const matched = upstream.path.exec(url);
148
+ const model = matched?.[1];
149
+ // A pattern that matched but captured nothing would otherwise build a path
150
+ // containing the word `undefined` and forward it. Refusing is the only
151
+ // answer: there is no model, so there is nothing to price the call against.
152
+ if (model === undefined) return null;
153
+ return { path: `/v1beta/models/${model}:generateContent`, model };
154
+ }
155
+
67
156
  /**
68
157
  * Headers Trazum adds or removes. Everything else the caller sent is forwarded
69
158
  * verbatim, including their credential, which this never reads.
70
159
  */
71
160
  /** Why a forwarded call's cost could not be measured. */
72
- export type UnmeasuredCause = 'stream-broke' | 'no-usage-event';
161
+ export type UnmeasuredCause = 'stream-broke' | 'no-usage-event' | 'no-usage-in-body';
73
162
 
74
163
  const HOP_BY_HOP = new Set([
75
164
  'connection',
@@ -156,7 +245,7 @@ async function readBody(request: IncomingMessage): Promise<string | null> {
156
245
  * of here, including the decision and the record, is structurally incapable of
157
246
  * carrying a prompt.
158
247
  */
159
- function describe(body: string, provider: string): {
248
+ function describe(body: string, provider: string, modelFromPath: string | null): {
160
249
  model: string;
161
250
  inputTokens: number | null;
162
251
  maxOutputTokens: number | null;
@@ -170,7 +259,15 @@ function describe(body: string, provider: string): {
170
259
  }
171
260
  if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) return null;
172
261
  const request = parsed as Record<string, unknown>;
173
- if (typeof request.model !== 'string') return null;
262
+ /**
263
+ * The body's model, or the one the validated path named.
264
+ *
265
+ * Never both, and the path never overrides a body that carried one: a
266
+ * gateway that preferred the URL could price a call as one model and forward
267
+ * it as another, which is the substitution this product exists to refuse.
268
+ */
269
+ const model = typeof request.model === 'string' ? request.model : modelFromPath;
270
+ if (model === null) return null;
174
271
 
175
272
  // Every text field the wire format puts in front of the model, counted and
176
273
  // then dropped. `JSON.stringify` of the messages over-counts by the
@@ -181,12 +278,25 @@ function describe(body: string, provider: string): {
181
278
  if (typeof request.system === 'string') parts.push(request.system);
182
279
  if (Array.isArray(request.messages)) parts.push(JSON.stringify(request.messages));
183
280
  if (Array.isArray(request.input)) parts.push(JSON.stringify(request.input));
281
+ // Gemini names the same two things differently: the system prompt is a
282
+ // `systemInstruction` document rather than a string, and the turns are
283
+ // `contents` rather than `messages`. Counted the same way and dropped the
284
+ // same way.
285
+ if (typeof request.systemInstruction === 'object' && request.systemInstruction !== null) {
286
+ parts.push(JSON.stringify(request.systemInstruction));
287
+ }
288
+ if (Array.isArray(request.contents)) parts.push(JSON.stringify(request.contents));
184
289
 
185
290
  const text = parts.join('\n');
186
- const max = provider === 'anthropic' ? request.max_tokens : request.max_completion_tokens ?? request.max_tokens;
291
+ const generation = typeof request.generationConfig === 'object' && request.generationConfig !== null
292
+ ? (request.generationConfig as Record<string, unknown>).maxOutputTokens
293
+ : undefined;
294
+ const max = provider === 'anthropic'
295
+ ? request.max_tokens
296
+ : request.max_completion_tokens ?? request.max_tokens ?? generation;
187
297
 
188
298
  return {
189
- model: request.model,
299
+ model,
190
300
  inputTokens: text === '' ? null : estimateTokens(text),
191
301
  maxOutputTokens: typeof max === 'number' && Number.isFinite(max) ? max : null,
192
302
  /**
@@ -236,11 +346,19 @@ export function buildGateway(context: GatewayContext): Server {
236
346
  response.end(`${JSON.stringify({ error: 'no upstream configured for this provider' })}\n`);
237
347
  return;
238
348
  }
239
- if (request.method !== 'POST' || request.url !== upstream.path) {
349
+ const routed = request.method === 'POST' ? route(upstream, request.url) : null;
350
+ if (routed === null) {
240
351
  // Only the one path that spends tokens. A gateway forwarding anything
241
352
  // else is a general proxy for somebody's API key.
242
353
  response.writeHead(404, { 'content-type': 'application/json' });
243
- response.end(`${JSON.stringify({ error: 'not a path this gateway forwards' })}\n`);
354
+ response.end(
355
+ // A refusal never arrives bare: the one thing it does forward, said
356
+ // from the upstream table rather than written out again here.
357
+ `${JSON.stringify({
358
+ error: 'not a path this gateway forwards',
359
+ forwards: `POST ${forwards(upstream)}`,
360
+ })}\n`,
361
+ );
244
362
  return;
245
363
  }
246
364
 
@@ -251,7 +369,7 @@ export function buildGateway(context: GatewayContext): Server {
251
369
  return;
252
370
  }
253
371
 
254
- const described = describe(body, context.provider);
372
+ const described = describe(body, context.provider, routed.model);
255
373
  if (described === null) {
256
374
  response.writeHead(400, { 'content-type': 'application/json' });
257
375
  response.end(`${JSON.stringify({ error: 'could not read a model out of this request' })}\n`);
@@ -303,7 +421,7 @@ export function buildGateway(context: GatewayContext): Server {
303
421
 
304
422
  let upstreamResponse: Response;
305
423
  try {
306
- upstreamResponse = await doFetch(`${upstream.origin}${upstream.path}`, {
424
+ upstreamResponse = await doFetch(`${upstream.origin}${routed.path}`, {
307
425
  method: 'POST',
308
426
  headers: outgoing,
309
427
  body: forwarded,
@@ -366,7 +484,30 @@ export function buildGateway(context: GatewayContext): Server {
366
484
  } catch {
367
485
  measured = null;
368
486
  }
369
- recordUsage(usageFromResponse(context.provider, measured));
487
+ const buffered = usageFromResponse(context.provider, measured);
488
+ /**
489
+ * The buffered path was the silent one.
490
+ *
491
+ * 1.52 taught the streaming path to say *this call is unmeasured*
492
+ * when no usage event arrived, and left this branch recording nothing
493
+ * and saying nothing — the same silence, on the other side of one
494
+ * `if`. A guard that covers one branch of a fork reads as coverage of
495
+ * the fork.
496
+ *
497
+ * Only on a response the provider called **ok**. An upstream error
498
+ * carries no counts because it produced none, and its own status
499
+ * already says so; announcing those as unmeasured calls would bury the
500
+ * ones that actually spent money.
501
+ */
502
+ if (buffered === null && upstreamResponse.ok) {
503
+ // The word "body" is deliberately not in this sentence. A security
504
+ // test refuses any `note(...)` mentioning it, prose or variable,
505
+ // because the cost of that rule being blunt is one word of wording
506
+ // and the cost of it being clever is somebody's prompt in a log.
507
+ context.note(`${described.model} answered with no usage counts — this call is unmeasured`);
508
+ context.unmeasured?.('no-usage-in-body');
509
+ }
510
+ recordUsage(buffered);
370
511
  response.writeHead(upstreamResponse.status, back);
371
512
  response.end(text);
372
513
  return;
package/src/i18n/en.ts CHANGED
@@ -1262,13 +1262,29 @@ ${bold('EXAMPLES')}
1262
1262
  given === ''
1263
1263
  ? `Name the provider to stand in front of. Known: ${known}.`
1264
1264
  : `"${given}" is not a provider this gateway speaks for. Known: ${known}.`,
1265
+ pricedNotFronted: (given, known) =>
1266
+ `Trazum prices ${given} but this gateway does not stand in front of it yet — it fronts ${known}. That is a real gap and it is on the roadmap, not a typo on your part. Until then: "trazum profile" prices a ${given} log you export, and its --max-usd gate fails a build on the bill after the fact. What you do not get is a refusal before the money is spent, which is the whole point of the gateway and the reason this is worth saying rather than listing ${given} as unknown.`,
1265
1267
  needsPolicy: (policies) =>
1266
1268
  `--on-cannot-tell is required, and there is no default: ${policies}. When the gateway cannot judge a call — no budget, nothing measured, an unpriced model — one of these happens, and only you know which failure your product can survive. fail-open keeps it working and lets the bill run; fail-closed stops the bill and takes it down with it. Picking one for you would be the most consequential decision in your architecture, made silently at install time.`,
1267
1269
  listening: (where, provider) => `Gateway on ${where}, in front of ${provider}`,
1268
- unmeasured: (cause, sofar) =>
1269
- cause === 'stream-broke'
1270
- ? `unmeasured: the stream broke before its usage event — the provider billed this call and this session cannot see it (${sofar} unmeasured so far)`
1271
- : `unmeasured: the stream carried no usage event — on OpenAI that is every streaming call without stream_options.include_usage, so the total below is short by these (${sofar} unmeasured so far)`,
1270
+ /**
1271
+ * One sentence per cause, and no `else`.
1272
+ *
1273
+ * This was a two-branch ternary whose second arm explained OpenAI's
1274
+ * `stream_options`. A third cause added later would have inherited that
1275
+ * sentence and told a Gemini user about a setting that does not exist in
1276
+ * their SDK — a message bounded by its neighbour rather than by its
1277
+ * subject, which is this project's most repeated mistake.
1278
+ */
1279
+ unmeasured: (cause, sofar) => {
1280
+ if (cause === 'stream-broke') {
1281
+ return `unmeasured: the stream broke before its usage event — the provider billed this call and this session cannot see it (${sofar} unmeasured so far)`;
1282
+ }
1283
+ if (cause === 'no-usage-event') {
1284
+ return `unmeasured: the stream carried no usage event — on OpenAI that is every streaming call without stream_options.include_usage, so the total below is short by these (${sofar} unmeasured so far)`;
1285
+ }
1286
+ return `unmeasured: the provider answered without any usage in the body — the call was made and its cost is not knowable from the response, so the total below is short by these (${sofar} unmeasured so far)`;
1287
+ },
1272
1288
  pointYourSdk: (where) =>
1273
1289
  `Point your SDK's base URL at ${where} and change nothing else. It speaks the provider's own wire format, so no code changes and no new client.`,
1274
1290
  credential: () =>
@@ -2246,6 +2262,8 @@ ${bold('EXAMPLES')}
2246
2262
  `Name a provider to read your bill from: trazum connect anthropic. Available: ${providers}. The credential comes from the environment and is never stored — add --dry-run to see exactly what would be called and which variable it would be read from.`,
2247
2263
  unknownProvider: (id, providers) =>
2248
2264
  `There is no connector for "${id}". The ones that exist are: ${providers}.`,
2265
+ pricedNoConnector: (id, providers) =>
2266
+ `Trazum prices ${id} but has no connector for it yet — it connects to ${providers}. Either that provider publishes no usage API, or one has not been written; both are gaps rather than mistakes of yours. Until then, export a log and run "trazum profile" on it: every figure works except the ones a usage API would supply on its own.`,
2249
2267
  dryRun: (provider, from, to, envVars, keyKind) =>
2250
2268
  `Would read ${provider} usage from ${from} to ${to}, using ${keyKind} taken from ${envVars}. Nothing was sent and no credential was needed to print this.`,
2251
2269
  heading: (provider, from, to, usd, calls) =>
package/src/i18n/es.ts CHANGED
@@ -1299,13 +1299,20 @@ ${bold('EJEMPLOS')}
1299
1299
  given === ''
1300
1300
  ? `Nombra el proveedor delante del que ponerse. Conocidos: ${known}.`
1301
1301
  : `"${given}" no es un proveedor por el que hable esta pasarela. Conocidos: ${known}.`,
1302
+ pricedNotFronted: (given, known) =>
1303
+ `Trazum tarifa ${given} pero esta pasarela todavía no se pone delante de él — cubre ${known}. Es un hueco real y está en la hoja de ruta, no una errata tuya. Mientras tanto: "trazum profile" tarifa un registro de ${given} que exportes, y su gate --max-usd tumba una build por la factura ya gastada. Lo que no tienes es un rechazo antes de gastar el dinero, que es justo el sentido de la pasarela y la razón de decir esto en vez de listar ${given} como desconocido.`,
1302
1304
  needsPolicy: (policies) =>
1303
1305
  `--on-cannot-tell es obligatorio, y no hay valor por defecto: ${policies}. Cuando la pasarela no puede juzgar una llamada — sin presupuesto, sin nada medido, un modelo sin precio — pasa una de las dos, y solo tú sabes qué fallo puede sobrevivir tu producto. fail-open lo mantiene funcionando y deja correr la factura; fail-closed para la factura y se lo lleva por delante. Elegir por ti sería tomar la decisión más consecuente de tu arquitectura, en silencio, al instalar.`,
1304
1306
  listening: (where, provider) => `Pasarela en ${where}, delante de ${provider}`,
1305
- unmeasured: (cause, sofar) =>
1306
- cause === 'stream-broke'
1307
- ? `sin medir: el stream se rompió antes de su evento de uso — el proveedor facturó esta llamada y esta sesión no puede verla (${sofar} sin medir hasta ahora)`
1308
- : `sin medir: el stream no llevó evento de uso — en OpenAI eso es toda llamada en streaming sin stream_options.include_usage, así que el total de abajo se queda corto (${sofar} sin medir hasta ahora)`,
1307
+ unmeasured: (cause, sofar) => {
1308
+ if (cause === 'stream-broke') {
1309
+ return `sin medir: el stream se rompió antes de su evento de uso — el proveedor facturó esta llamada y esta sesión no puede verla (${sofar} sin medir hasta ahora)`;
1310
+ }
1311
+ if (cause === 'no-usage-event') {
1312
+ return `sin medir: el stream no llevó evento de uso — en OpenAI eso es toda llamada en streaming sin stream_options.include_usage, así que el total de abajo se queda corto (${sofar} sin medir hasta ahora)`;
1313
+ }
1314
+ return `sin medir: el proveedor respondió sin uso alguno en el cuerpo — la llamada se hizo y su coste no es deducible de la respuesta, así que el total de abajo se queda corto (${sofar} sin medir hasta ahora)`;
1315
+ },
1309
1316
  pointYourSdk: (where) =>
1310
1317
  `Apunta la URL base de tu SDK a ${where} y no cambies nada más. Habla el formato del propio proveedor, así que no hay cambios de código ni cliente nuevo.`,
1311
1318
  credential: () =>
@@ -2265,6 +2272,8 @@ ${bold('EJEMPLOS')}
2265
2272
  `Nombra un proveedor del que leer tu factura: trazum connect anthropic. Disponibles: ${providers}. La credencial sale del entorno y nunca se guarda — añade --dry-run para ver exactamente qué se llamaría y de qué variable saldría.`,
2266
2273
  unknownProvider: (id, providers) =>
2267
2274
  `No hay conector para "${id}". Los que existen son: ${providers}.`,
2275
+ pricedNoConnector: (id, providers) =>
2276
+ `Trazum tarifa ${id} pero todavía no tiene conector para él — conecta con ${providers}. O ese proveedor no publica una API de uso, o nadie ha escrito el conector; ambos son huecos, no errores tuyos. Mientras tanto, exporta un registro y pásale "trazum profile": funciona todo salvo lo que solo una API de uso podría aportar.`,
2268
2277
  dryRun: (provider, from, to, envVars, keyKind) =>
2269
2278
  `Leería el uso de ${provider} del ${from} al ${to}, usando ${keyKind} tomada de ${envVars}. No se envió nada y no hizo falta ninguna credencial para imprimir esto.`,
2270
2279
  heading: (provider, from, to, usd, calls) =>
package/src/i18n/types.ts CHANGED
@@ -377,9 +377,10 @@ export interface CliMessages {
377
377
 
378
378
  gateway: {
379
379
  badProvider(given: string, known: string): string;
380
+ pricedNotFronted(given: string, known: string): string;
380
381
  needsPolicy(policies: string): string;
381
382
  listening(where: string, provider: string): string;
382
- unmeasured(cause: 'stream-broke' | 'no-usage-event', sofar: number): string;
383
+ unmeasured(cause: 'stream-broke' | 'no-usage-event' | 'no-usage-in-body', sofar: number): string;
383
384
  pointYourSdk(where: string): string;
384
385
  credential(): string;
385
386
  neverSubstitutes(): string;
@@ -1421,6 +1422,7 @@ export interface CliMessages {
1421
1422
  connect: {
1422
1423
  noTarget(providers: string): string;
1423
1424
  unknownProvider(id: string, providers: string): string;
1425
+ pricedNoConnector(id: string, providers: string): string;
1424
1426
  /** What would be called, with no key needed and nothing sent. */
1425
1427
  dryRun(provider: string, from: string, to: string, envVars: string, keyKind: string): string;
1426
1428
  /** `calls` is null on a source that serves no request count. */
package/src/index.ts CHANGED
@@ -2131,6 +2131,18 @@ function commandFeedback(t: CliMessages): void {
2131
2131
  * config, with the operator's own reason, and every substituted call is marked
2132
2132
  * so no later report treats it as the call the caller made.
2133
2133
  */
2134
+ /**
2135
+ * Every provider the catalogue prices.
2136
+ *
2137
+ * `provider` is optional on a model — an overlay may add one without it — so a
2138
+ * missing provider is skipped rather than coerced. A model with no provider
2139
+ * cannot make its provider "supported" by accident.
2140
+ */
2141
+ function pricedProviders(catalogue: PricingCatalogue): Set<string> {
2142
+ const models = catalogue.models ?? [];
2143
+ return new Set(models.map((m) => m.provider).filter((p): p is string => typeof p === 'string'));
2144
+ }
2145
+
2134
2146
  async function commandGateway(
2135
2147
  args: Args,
2136
2148
  config: TrazumConfig,
@@ -2140,6 +2152,22 @@ async function commandGateway(
2140
2152
  ): Promise<void> {
2141
2153
  const provider = args.positional[0];
2142
2154
  if (provider === undefined || UPSTREAMS[provider] === undefined) {
2155
+ /**
2156
+ * Three answers, not two.
2157
+ *
2158
+ * A provider Trazum **prices** but does not front is a different situation
2159
+ * from a name it has never heard, and until 1.53 both got the same
2160
+ * sentence. One is a gap in this tool with a workaround; the other is a
2161
+ * typo. Telling them apart is the difference between a user reaching for
2162
+ * `profile` and a user checking their spelling.
2163
+ *
2164
+ * Derived from the catalogue, so a provider added to pricing starts
2165
+ * getting the better answer without anyone remembering to update a list.
2166
+ */
2167
+ const priced = pricedProviders(pricing);
2168
+ if (provider !== undefined && priced.has(provider)) {
2169
+ throw new Error(t.gateway.pricedNotFronted(provider, Object.keys(UPSTREAMS).join(', ')));
2170
+ }
2143
2171
  throw new Error(t.gateway.badProvider(provider ?? '', Object.keys(UPSTREAMS).join(', ')));
2144
2172
  }
2145
2173
 
@@ -4609,7 +4637,12 @@ async function commandConnect(
4609
4637
  }
4610
4638
  const descriptor = connectorFor(id);
4611
4639
  if (descriptor === null) {
4612
- throw new Error(t.connect.unknownProvider(id, CONNECTORS.map((c) => c.id).join(', ')));
4640
+ // The same three-way split as the gateway, for the same reason.
4641
+ const priced = pricedProviders(pricing);
4642
+ const known = CONNECTORS.map((c) => c.id).join(', ');
4643
+ throw new Error(
4644
+ priced.has(id) ? t.connect.pricedNoConnector(id, known) : t.connect.unknownProvider(id, known),
4645
+ );
4613
4646
  }
4614
4647
 
4615
4648
  const now = Date.now();