pi-dual-engine 0.2.0 → 0.2.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/dist/index.js CHANGED
@@ -305,14 +305,7 @@ function planProviderConfig(plan, group, proxyUrl, extras = new Map) {
305
305
  const family = familyOf(model.api);
306
306
  const carried = family !== undefined && plan.families.includes(family);
307
307
  return {
308
- id: model.id,
309
- name: model.name,
310
- api: model.api,
311
- reasoning: model.reasoning,
312
- input: model.input,
313
- cost: model.cost,
314
- contextWindow: model.contextWindow,
315
- maxTokens: model.maxTokens,
308
+ ...model,
316
309
  baseUrl: carried ? proxyUrl : model.baseUrl
317
310
  };
318
311
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-dual-engine",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "One-owner-per-byte coordination between the Caveman harness engine and the Headroom wire engine (dual-engine).",
5
5
  "type": "module",
6
6
  "pi": {
package/src/assignment.ts CHANGED
@@ -15,6 +15,9 @@ export type ProviderModel = {
15
15
  };
16
16
  readonly contextWindow: number;
17
17
  readonly maxTokens: number;
18
+ readonly thinkingLevelMap?: Record<string, string | null>;
19
+ readonly compat?: unknown;
20
+ readonly inputLimits?: unknown;
18
21
  };
19
22
  export type ProviderGroup = { readonly provider: string; readonly models: readonly ProviderModel[] };
20
23
 
package/src/providers.ts CHANGED
@@ -22,14 +22,7 @@ export function planProviderConfig(
22
22
  const family = familyOf(model.api);
23
23
  const carried = family !== undefined && plan.families.includes(family);
24
24
  return {
25
- id: model.id,
26
- name: model.name,
27
- api: model.api,
28
- reasoning: model.reasoning,
29
- input: model.input,
30
- cost: model.cost,
31
- contextWindow: model.contextWindow,
32
- maxTokens: model.maxTokens,
25
+ ...model,
33
26
  baseUrl: carried ? proxyUrl : model.baseUrl,
34
27
  };
35
28
  });
@@ -46,6 +46,81 @@ describe("provider registration", () => {
46
46
  expect(models.find((model) => model.id === "gemini")?.baseUrl).toBe("https://b.example.com/v1");
47
47
  });
48
48
 
49
+ test("thinkingLevelMap with xhigh/max survives re-registration", () => {
50
+ const mapped: ProviderGroup = {
51
+ provider: "aaa",
52
+ models: [
53
+ {
54
+ id: "spark",
55
+ name: "spark",
56
+ api: "openai-completions",
57
+ baseUrl: "https://a.example.com/v1",
58
+ reasoning: false,
59
+ input: ["text"],
60
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
61
+ contextWindow: 1000,
62
+ maxTokens: 100,
63
+ thinkingLevelMap: { minimal: "minimal", low: "low", medium: "medium", high: "high", xhigh: "xhigh" },
64
+ },
65
+ ],
66
+ };
67
+ const config = planProviderConfig(plan, mapped, "http://127.0.0.1:8801");
68
+ const models = config.models as { id: string; thinkingLevelMap?: Record<string, string | null> }[];
69
+ expect(models.find((model) => model.id === "spark")?.thinkingLevelMap?.["xhigh"]).toBe("xhigh");
70
+ });
71
+
72
+ test("null-disabled thinking levels stay disabled", () => {
73
+ const mapped: ProviderGroup = {
74
+ provider: "aaa",
75
+ models: [
76
+ {
77
+ id: "spark",
78
+ name: "spark",
79
+ api: "openai-completions",
80
+ baseUrl: "https://a.example.com/v1",
81
+ reasoning: false,
82
+ input: ["text"],
83
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
84
+ contextWindow: 1000,
85
+ maxTokens: 100,
86
+ thinkingLevelMap: { off: null, minimal: null, low: "low", medium: "medium", high: "high" },
87
+ },
88
+ ],
89
+ };
90
+ const config = planProviderConfig(plan, mapped, "http://127.0.0.1:8801");
91
+ const models = config.models as { id: string; thinkingLevelMap?: Record<string, string | null> }[];
92
+ const found = models.find((model) => model.id === "spark")?.thinkingLevelMap;
93
+ expect(found && "off" in found && found["off"]).toBeNull();
94
+ expect(found?.["low"]).toBe("low");
95
+ });
96
+
97
+ test("optional compat/inputLimits survive with scoped baseUrl override", () => {
98
+ const mapped: ProviderGroup = {
99
+ provider: "aaa",
100
+ models: [
101
+ {
102
+ id: "chat",
103
+ name: "chat",
104
+ api: "openai-completions",
105
+ baseUrl: "https://a.example.com/v1",
106
+ reasoning: false,
107
+ input: ["text"],
108
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
109
+ contextWindow: 1000,
110
+ maxTokens: 100,
111
+ compat: { strict: true },
112
+ inputLimits: { maxImages: 4 },
113
+ },
114
+ ],
115
+ };
116
+ const config = planProviderConfig(plan, mapped, "http://127.0.0.1:8801");
117
+ const models = config.models as { id: string; baseUrl: string; compat?: unknown; inputLimits?: unknown }[];
118
+ const found = models.find((model) => model.id === "chat");
119
+ expect(found?.baseUrl).toBe("http://127.0.0.1:8801");
120
+ expect(found?.compat).toEqual({ strict: true });
121
+ expect(found?.inputLimits).toEqual({ maxImages: 4 });
122
+ });
123
+
49
124
  test("non-chat models are carried through a registration untouched", () => {
50
125
  const extras = new Map([["aaa", [{ id: "image-model", api: "openai-images" }]]]);
51
126
  const config = planProviderConfig(plan, group, "http://127.0.0.1:8801", extras);