@crossworks/client-types 0.232.133 → 0.232.140
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 +1 -1
- package/src/dto/agent-graph.ts +229 -0
- package/src/dto/agents.ts +190 -0
- package/src/dto/comms.ts +114 -0
- package/src/dto/heartbeats.ts +60 -0
- package/src/dto/recall.ts +21 -0
- package/src/dto/rows.ts +882 -0
- package/src/dto/turns.ts +192 -0
- package/src/dto/views.ts +936 -0
- package/src/index.ts +15 -2534
- package/src/model-pools-data.json +2194 -0
- package/src/model-pools-data.ts +10 -2194
- package/src/model-pools-template.test.ts +77 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The curated-pool TEMPLATE is data, and its two ends have to agree.
|
|
3
|
+
*
|
|
4
|
+
* `GET /api/model-pools/export` writes the file; `model-pools-seed.ts` reads it
|
|
5
|
+
* back through `CURATED_MODEL_POOLS`. Until tier 3 of the 2026-09-02 audit the
|
|
6
|
+
* route emitted pools NESTED as `[{ pool, label, models: [...] }]` with
|
|
7
|
+
* `position` dropped, so an exported file could never be seeded — and nothing
|
|
8
|
+
* failed, because no test had ever fed one end to the other.
|
|
9
|
+
*
|
|
10
|
+
* These pin the template's own shape. The route builds a
|
|
11
|
+
* `CuratedTemplateEntry[]` and is type-checked against it, so a route change
|
|
12
|
+
* that broke the contract now fails the build; a DATA change that breaks it
|
|
13
|
+
* fails here.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { describe, expect, it } from 'vitest';
|
|
17
|
+
|
|
18
|
+
import { CURATED_MODEL_POOLS, type CuratedTemplateEntry } from './model-pools-data';
|
|
19
|
+
|
|
20
|
+
describe('curated model pool template', () => {
|
|
21
|
+
it('is a flat array of entries, not pools-with-models', () => {
|
|
22
|
+
expect(Array.isArray(CURATED_MODEL_POOLS)).toBe(true);
|
|
23
|
+
expect(CURATED_MODEL_POOLS.length).toBeGreaterThan(0);
|
|
24
|
+
for (const e of CURATED_MODEL_POOLS) {
|
|
25
|
+
expect(e).not.toHaveProperty('models');
|
|
26
|
+
expect(typeof e.pool).toBe('string');
|
|
27
|
+
expect(typeof e.name).toBe('string');
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('carries the position the seeder orders by', () => {
|
|
32
|
+
// The nested export shape dropped this field entirely; a template without
|
|
33
|
+
// it seeds every pool in insertion order, silently losing the curation.
|
|
34
|
+
for (const e of CURATED_MODEL_POOLS) {
|
|
35
|
+
expect(Number.isInteger(e.position), `${e.pool}/${e.name} has no position`).toBe(true);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('positions are unique within a pool', () => {
|
|
40
|
+
const seen = new Map<string, Set<number>>();
|
|
41
|
+
const clashes: string[] = [];
|
|
42
|
+
for (const e of CURATED_MODEL_POOLS) {
|
|
43
|
+
const set = seen.get(e.pool) ?? new Set<number>();
|
|
44
|
+
if (set.has(e.position)) clashes.push(`${e.pool}: two entries at ${e.position}`);
|
|
45
|
+
set.add(e.position);
|
|
46
|
+
seen.set(e.pool, set);
|
|
47
|
+
}
|
|
48
|
+
expect(clashes).toEqual([]);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('every entry has at least one route to call', () => {
|
|
52
|
+
const routeless = CURATED_MODEL_POOLS.filter((e) => e.routes.length === 0).map(
|
|
53
|
+
(e) => `${e.pool}/${e.name}`,
|
|
54
|
+
);
|
|
55
|
+
expect(routeless).toEqual([]);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('pricing, when present, is a captured USD snapshot', () => {
|
|
59
|
+
const bad: string[] = [];
|
|
60
|
+
for (const e of CURATED_MODEL_POOLS) {
|
|
61
|
+
if (!e.pricing) continue;
|
|
62
|
+
if (e.pricing.currency !== 'USD') bad.push(`${e.name}: ${e.pricing.currency}`);
|
|
63
|
+
if (Number.isNaN(Date.parse(e.pricing.capturedAt))) bad.push(`${e.name}: capturedAt`);
|
|
64
|
+
}
|
|
65
|
+
expect(bad).toEqual([]);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('the JSON parses back into the declared entry type', () => {
|
|
69
|
+
// The .json file is the source; this asserts the cast in model-pools-data.ts
|
|
70
|
+
// is not hiding a shape drift a re-export could introduce.
|
|
71
|
+
const sample: CuratedTemplateEntry | undefined = CURATED_MODEL_POOLS[0];
|
|
72
|
+
expect(sample).toBeDefined();
|
|
73
|
+
expect(Object.keys(sample!).sort()).toEqual(
|
|
74
|
+
['name', 'note', 'pool', 'position', 'pricing', 'rating', 'routes', 'vendor'].sort(),
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
});
|