@agentproto/catalog-sync 0.2.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/LICENSE +21 -0
- package/README.md +68 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.mjs +671 -0
- package/dist/bin.mjs.map +1 -0
- package/dist/generators/llm-openrouter.d.ts +5 -0
- package/dist/generators/llm-openrouter.mjs +134 -0
- package/dist/generators/llm-openrouter.mjs.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.mjs +609 -0
- package/dist/index.mjs.map +1 -0
- package/dist/runner.d.ts +22 -0
- package/dist/runner.mjs +116 -0
- package/dist/runner.mjs.map +1 -0
- package/dist/types.d.ts +52 -0
- package/dist/types.mjs +14 -0
- package/dist/types.mjs.map +1 -0
- package/package.json +82 -0
- package/snapshots/image-replicate.json +217 -0
- package/snapshots/llm-openrouter.json +68 -0
- package/snapshots/voice-elevenlabs.json +13339 -0
- package/snapshots/voice-minimax.json +2664 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jeremy André and agentproto contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# @agentproto/catalog-sync
|
|
2
|
+
|
|
3
|
+
Build-time generator framework for [`@agentproto/model-catalog`](../model-catalog).
|
|
4
|
+
Catalog data (prices, model lists) is **generated** from pinned provider
|
|
5
|
+
sources, not hand-committed — every `*.generated.ts` is reproducible from a
|
|
6
|
+
committed snapshot, and CI catches drift via `--check`.
|
|
7
|
+
|
|
8
|
+
## Contract
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
// src/types.ts — FROZEN
|
|
12
|
+
interface CatalogSource { id: string; url: string }
|
|
13
|
+
interface GeneratorContext {
|
|
14
|
+
fetchSource(src: CatalogSource): Promise<unknown> // snapshot-first; refresh fetches + writes
|
|
15
|
+
refresh: boolean
|
|
16
|
+
}
|
|
17
|
+
type GeneratedFiles = Record<string, string> // repo-relative path → TS source text
|
|
18
|
+
interface CatalogGenerator {
|
|
19
|
+
name: string // "llm:openrouter"
|
|
20
|
+
modality: "llm" | "image" | "video" | "audio" | "voice"
|
|
21
|
+
sources: CatalogSource[]
|
|
22
|
+
generate(ctx: GeneratorContext): Promise<GeneratedFiles>
|
|
23
|
+
}
|
|
24
|
+
function defineGenerator(g: CatalogGenerator): CatalogGenerator
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
A sibling agent builds provider generators against this surface. Adding new
|
|
28
|
+
generators is the extension path; editing `types.ts` is not.
|
|
29
|
+
|
|
30
|
+
## Flow
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
provider API ──(generate --refresh)──▶ snapshots/<id>.json ← committed, deterministic
|
|
34
|
+
│
|
|
35
|
+
generate (offline) ▼
|
|
36
|
+
*.generated.ts ← drop-in for model-catalog
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- **Offline by default.** `generate` reads `snapshots/<id>.json`. Tests and CI
|
|
40
|
+
never hit the network.
|
|
41
|
+
- **Network only behind `--refresh`**, which fetches each source's pinned URL
|
|
42
|
+
and writes the snapshot for the next offline run.
|
|
43
|
+
|
|
44
|
+
## CLI
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
pnpm --filter @agentproto/catalog-sync generate # write changed files
|
|
48
|
+
pnpm --filter @agentproto/catalog-sync generate --check # diff vs committed; exit 1 on drift (CI)
|
|
49
|
+
pnpm --filter @agentproto/catalog-sync generate --refresh # re-fetch pinned sources
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Generators
|
|
53
|
+
|
|
54
|
+
### `llm:openrouter`
|
|
55
|
+
|
|
56
|
+
Source: `https://openrouter.ai/api/v1/models` (pinned snapshot:
|
|
57
|
+
`snapshots/llm-openrouter.json`). Emits
|
|
58
|
+
`packages/model-catalog/src/llm/openrouter-routes.generated.ts` — a drop-in
|
|
59
|
+
`OPENROUTER_ROUTES: Record<string, LLMPricing>` plus the derived
|
|
60
|
+
`OPENROUTER_PROVIDERS` list.
|
|
61
|
+
|
|
62
|
+
- Per-token USD prices → `inputPer1M` / `outputPer1M` (USD per 1M tokens).
|
|
63
|
+
- `cache_read` / `cache_write` (when present) → `cacheReadMultiplier` /
|
|
64
|
+
`cacheWriteMultiplier` (ratio vs base input). The committed model-catalog
|
|
65
|
+
file omits these; this generator emits them when the source carries them
|
|
66
|
+
(P3 spec: "plus cache fields if the source has them") — additive and
|
|
67
|
+
`LLMPricing`-compatible.
|
|
68
|
+
- Unpriced routes (`openrouter/auto`) are skipped.
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|