@agentproto/catalog-sync 0.5.0 → 0.5.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 +15 -0
- package/dist/bin.mjs +145 -17
- package/dist/bin.mjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +134 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/snapshots/llm-huggingface.json +5489 -0
- package/snapshots/llm-moonshot.json +61 -61
- package/snapshots/llm-openrouter.json +29319 -35
package/dist/index.mjs
CHANGED
|
@@ -344,6 +344,133 @@ var llmRequestyGenerator = defineGenerator({
|
|
|
344
344
|
sources: sources2,
|
|
345
345
|
generate: generate2
|
|
346
346
|
});
|
|
347
|
+
var HUGGINGFACE_MODELS_URL = "https://router.huggingface.co/v1/models";
|
|
348
|
+
var OUTPUT_PATH3 = "packages/model-catalog/src/llm/huggingface-routes.generated.ts";
|
|
349
|
+
var HFProviderSchema = z.object({
|
|
350
|
+
provider: z.string(),
|
|
351
|
+
status: z.string(),
|
|
352
|
+
context_length: z.number().optional(),
|
|
353
|
+
pricing: z.object({
|
|
354
|
+
input: z.number().optional(),
|
|
355
|
+
output: z.number().optional()
|
|
356
|
+
}).optional(),
|
|
357
|
+
supports_tools: z.boolean().optional(),
|
|
358
|
+
supports_structured_output: z.boolean().optional()
|
|
359
|
+
}).passthrough();
|
|
360
|
+
var HFModelSchema = z.object({
|
|
361
|
+
id: z.string(),
|
|
362
|
+
providers: z.array(HFProviderSchema).optional()
|
|
363
|
+
}).passthrough();
|
|
364
|
+
var SnapshotSchema3 = z.object({
|
|
365
|
+
data: z.array(HFModelSchema)
|
|
366
|
+
});
|
|
367
|
+
function round4(n) {
|
|
368
|
+
return Math.round(n * 1e4) / 1e4;
|
|
369
|
+
}
|
|
370
|
+
function serializeProvider(p) {
|
|
371
|
+
const fields = [
|
|
372
|
+
`provider: ${JSON.stringify(p.provider)}`,
|
|
373
|
+
`status: ${JSON.stringify(p.status)}`
|
|
374
|
+
];
|
|
375
|
+
if (p.contextLength !== void 0) fields.push(`contextLength: ${p.contextLength}`);
|
|
376
|
+
if (p.inputPer1M !== void 0) fields.push(`inputPer1M: ${p.inputPer1M}`);
|
|
377
|
+
if (p.outputPer1M !== void 0) fields.push(`outputPer1M: ${p.outputPer1M}`);
|
|
378
|
+
if (p.supportsTools !== void 0) fields.push(`supportsTools: ${p.supportsTools}`);
|
|
379
|
+
if (p.supportsStructuredOutput !== void 0) {
|
|
380
|
+
fields.push(`supportsStructuredOutput: ${p.supportsStructuredOutput}`);
|
|
381
|
+
}
|
|
382
|
+
return ` {
|
|
383
|
+
${fields.join(",\n ")},
|
|
384
|
+
}`;
|
|
385
|
+
}
|
|
386
|
+
function serializeEntry3(id, e) {
|
|
387
|
+
const providerLines = e.providers.map(serializeProvider).join(",\n");
|
|
388
|
+
return [
|
|
389
|
+
` ${JSON.stringify(id)}: {`,
|
|
390
|
+
` wireId: ${JSON.stringify(e.wireId)},`,
|
|
391
|
+
` providers: [`,
|
|
392
|
+
providerLines,
|
|
393
|
+
` ],`,
|
|
394
|
+
` },`
|
|
395
|
+
].join("\n");
|
|
396
|
+
}
|
|
397
|
+
function serializeFile3(entries) {
|
|
398
|
+
const ids = Object.keys(entries).sort();
|
|
399
|
+
const lines = [
|
|
400
|
+
"// AUTO-GENERATED by @agentproto/catalog-sync (llm:huggingface).",
|
|
401
|
+
"// Do not edit by hand \u2014 re-run `pnpm --filter @agentproto/catalog-sync generate`.",
|
|
402
|
+
`// Source: ${HUGGINGFACE_MODELS_URL}`,
|
|
403
|
+
"// Per-model LIVE inference providers from the HuggingFace router. HF wire",
|
|
404
|
+
"// ids are case-sensitive and preserved verbatim. Provider entries are",
|
|
405
|
+
"// SPARSE on some models \u2014 every field below except provider/status is",
|
|
406
|
+
"// optional and emitted only when the upstream response carries it. Only",
|
|
407
|
+
'// providers with status === "live" are kept; models with zero live',
|
|
408
|
+
"// providers are skipped. inputPer1M/outputPer1M are USD per 1M tokens",
|
|
409
|
+
"// (HuggingFace router convention \u2014 already at that scale, unlike",
|
|
410
|
+
"// OpenRouter's per-token strings).",
|
|
411
|
+
"",
|
|
412
|
+
"export interface HuggingFaceRouteProvider {",
|
|
413
|
+
" provider: string",
|
|
414
|
+
" status: string",
|
|
415
|
+
" contextLength?: number",
|
|
416
|
+
" inputPer1M?: number",
|
|
417
|
+
" outputPer1M?: number",
|
|
418
|
+
" supportsTools?: boolean",
|
|
419
|
+
" supportsStructuredOutput?: boolean",
|
|
420
|
+
"}",
|
|
421
|
+
"",
|
|
422
|
+
"export interface HuggingFaceRoute {",
|
|
423
|
+
" wireId: string",
|
|
424
|
+
" providers: HuggingFaceRouteProvider[]",
|
|
425
|
+
"}",
|
|
426
|
+
"",
|
|
427
|
+
"export const HUGGINGFACE_ROUTES: Record<string, HuggingFaceRoute> = {"
|
|
428
|
+
];
|
|
429
|
+
for (const id of ids) {
|
|
430
|
+
lines.push(serializeEntry3(id, entries[id]));
|
|
431
|
+
}
|
|
432
|
+
lines.push("}");
|
|
433
|
+
lines.push("");
|
|
434
|
+
return lines.join("\n");
|
|
435
|
+
}
|
|
436
|
+
async function generate3(ctx) {
|
|
437
|
+
const src = sources3[0];
|
|
438
|
+
if (!src) throw new Error("llm:huggingface: no source configured");
|
|
439
|
+
const parsed = SnapshotSchema3.parse(await ctx.fetchSource(src));
|
|
440
|
+
const entries = {};
|
|
441
|
+
for (const model of parsed.data) {
|
|
442
|
+
const liveProviders = (model.providers ?? []).filter((p) => p.status === "live");
|
|
443
|
+
if (liveProviders.length === 0) continue;
|
|
444
|
+
const providers = liveProviders.map((p) => {
|
|
445
|
+
const entry = {
|
|
446
|
+
provider: p.provider,
|
|
447
|
+
status: p.status
|
|
448
|
+
};
|
|
449
|
+
if (p.context_length !== void 0) entry.contextLength = p.context_length;
|
|
450
|
+
if (p.pricing?.input !== void 0) entry.inputPer1M = round4(p.pricing.input);
|
|
451
|
+
if (p.pricing?.output !== void 0) entry.outputPer1M = round4(p.pricing.output);
|
|
452
|
+
if (p.supports_tools !== void 0) entry.supportsTools = p.supports_tools;
|
|
453
|
+
if (p.supports_structured_output !== void 0) {
|
|
454
|
+
entry.supportsStructuredOutput = p.supports_structured_output;
|
|
455
|
+
}
|
|
456
|
+
return entry;
|
|
457
|
+
}).sort((a, b) => a.provider.localeCompare(b.provider));
|
|
458
|
+
entries[model.id] = { wireId: model.id, providers };
|
|
459
|
+
}
|
|
460
|
+
return { [OUTPUT_PATH3]: serializeFile3(entries) };
|
|
461
|
+
}
|
|
462
|
+
var sources3 = [
|
|
463
|
+
{
|
|
464
|
+
id: "llm-huggingface",
|
|
465
|
+
url: HUGGINGFACE_MODELS_URL
|
|
466
|
+
}
|
|
467
|
+
];
|
|
468
|
+
var llmHuggingfaceGenerator = defineGenerator({
|
|
469
|
+
name: "llm:huggingface",
|
|
470
|
+
modality: "llm",
|
|
471
|
+
sources: sources3,
|
|
472
|
+
generate: generate3
|
|
473
|
+
});
|
|
347
474
|
|
|
348
475
|
// src/generators/serialize-voices.ts
|
|
349
476
|
function serializeVoice(v) {
|
|
@@ -387,7 +514,7 @@ var ELEVENLABS_SOURCE = {
|
|
|
387
514
|
// Live refresh needs the account key; offline reads ignore this.
|
|
388
515
|
headers: { "xi-api-key": "env:ELEVENLABS_API_KEY" }
|
|
389
516
|
};
|
|
390
|
-
var
|
|
517
|
+
var OUTPUT_PATH4 = "packages/catalog-sync/generated/voice-elevenlabs.generated.ts";
|
|
391
518
|
var voiceElevenlabs = defineGenerator({
|
|
392
519
|
name: "voice:elevenlabs",
|
|
393
520
|
modality: "voice",
|
|
@@ -398,7 +525,7 @@ var voiceElevenlabs = defineGenerator({
|
|
|
398
525
|
);
|
|
399
526
|
const voices = mapElevenLabsVoices(snapshot);
|
|
400
527
|
return {
|
|
401
|
-
[
|
|
528
|
+
[OUTPUT_PATH4]: serializeVoiceModule(
|
|
402
529
|
"voice:elevenlabs",
|
|
403
530
|
"ELEVENLABS_VOICES",
|
|
404
531
|
voices
|
|
@@ -418,7 +545,7 @@ var MINIMAX_SOURCE = {
|
|
|
418
545
|
},
|
|
419
546
|
body: { voice_type: "system" }
|
|
420
547
|
};
|
|
421
|
-
var
|
|
548
|
+
var OUTPUT_PATH5 = "packages/catalog-sync/generated/voice-minimax.generated.ts";
|
|
422
549
|
var voiceMinimax = defineGenerator({
|
|
423
550
|
name: "voice:minimax",
|
|
424
551
|
modality: "voice",
|
|
@@ -429,7 +556,7 @@ var voiceMinimax = defineGenerator({
|
|
|
429
556
|
);
|
|
430
557
|
const voices = mapMinimaxVoices(snapshot);
|
|
431
558
|
return {
|
|
432
|
-
[
|
|
559
|
+
[OUTPUT_PATH5]: serializeVoiceModule(
|
|
433
560
|
"voice:minimax",
|
|
434
561
|
"MINIMAX_VOICES",
|
|
435
562
|
voices
|
|
@@ -753,10 +880,10 @@ function resolveHeaders2(headers) {
|
|
|
753
880
|
}
|
|
754
881
|
return { headers: out, missing };
|
|
755
882
|
}
|
|
756
|
-
async function refreshSources(
|
|
883
|
+
async function refreshSources(sources4, opts) {
|
|
757
884
|
const results = [];
|
|
758
885
|
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
759
|
-
for (const { source, refreshable, notes } of
|
|
886
|
+
for (const { source, refreshable, notes } of sources4) {
|
|
760
887
|
if (!opts.refresh) {
|
|
761
888
|
results.push({
|
|
762
889
|
id: source.id,
|
|
@@ -875,6 +1002,6 @@ var OPENAI_LLM_SOURCE = {
|
|
|
875
1002
|
};
|
|
876
1003
|
var OPENAI_SOURCES = [OPENAI_LLM_SOURCE];
|
|
877
1004
|
|
|
878
|
-
export { OPENAI_LLM_SOURCE, OPENAI_SOURCES, defineGenerator, imageReplicate, llmOpenRouterGenerator, llmRequestyGenerator, refreshSources, reviewedRefresh, runGenerators, voiceElevenlabs, voiceMinimax };
|
|
1005
|
+
export { OPENAI_LLM_SOURCE, OPENAI_SOURCES, defineGenerator, imageReplicate, llmHuggingfaceGenerator, llmOpenRouterGenerator, llmRequestyGenerator, refreshSources, reviewedRefresh, runGenerators, voiceElevenlabs, voiceMinimax };
|
|
879
1006
|
//# sourceMappingURL=index.mjs.map
|
|
880
1007
|
//# sourceMappingURL=index.mjs.map
|