@xynogen/pix-models 0.1.11 → 0.1.14

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": "@xynogen/pix-models",
3
- "version": "0.1.11",
3
+ "version": "0.1.14",
4
4
  "description": "Pi extension — enhanced /models picker with BenchLM ranks",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@xynogen/pix-data": "*",
42
- "@xynogen/pix-pretty": "*"
42
+ "@xynogen/pix-pretty": "^1.7.9"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@earendil-works/pi-coding-agent": "*",
@@ -69,10 +69,11 @@ describe("sortModels", () => {
69
69
  { provider: "a", id: "m3", name: "Middle", score: null },
70
70
  { provider: "a", id: "m4", name: "Beta", score: 80 },
71
71
  ];
72
+ type ModelEntry = (typeof models)[number];
72
73
 
73
74
  it("sorts by score descending", () => {
74
75
  const sorted = sortModels(models);
75
- expect(sorted[0].name).toBe("Alpha"); // score 95
76
+ expect((sorted[0] as ModelEntry).name).toBe("Alpha"); // score 95
76
77
  });
77
78
 
78
79
  it("breaks score ties alphabetically by name", () => {
@@ -84,7 +85,7 @@ describe("sortModels", () => {
84
85
 
85
86
  it("puts null score models last", () => {
86
87
  const sorted = sortModels(models);
87
- expect(sorted[sorted.length - 1].name).toBe("Middle");
88
+ expect((sorted[sorted.length - 1] as ModelEntry).name).toBe("Middle");
88
89
  });
89
90
 
90
91
  it("does not mutate the original array", () => {
package/src/once.ts CHANGED
@@ -14,7 +14,8 @@
14
14
  */
15
15
  export function once(pi: object, key: string, fn: () => void): void {
16
16
  const g = globalThis as { __pixOnce?: WeakMap<object, Set<string>> };
17
- const registry = (g.__pixOnce ??= new WeakMap<object, Set<string>>());
17
+ if (!g.__pixOnce) g.__pixOnce = new WeakMap<object, Set<string>>();
18
+ const registry = g.__pixOnce;
18
19
  let loaded = registry.get(pi);
19
20
  if (!loaded) {
20
21
  loaded = new Set<string>();