routstrd 0.4.3 → 0.4.4

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.
@@ -151311,17 +151311,12 @@ Installing routstr models in pi models.json...`);
151311
151311
  const existingModels = new Map((piConfig.providers["routstr"]?.models ?? []).map((m) => [m.id, m]));
151312
151312
  const providerModels = models.map((model5) => {
151313
151313
  const previous = existingModels.get(model5.id);
151314
- const entry = previous ? { ...previous } : { id: model5.id };
151315
- entry.id = model5.id;
151314
+ const entry = { id: model5.id };
151316
151315
  if (model5.context_length !== undefined && model5.context_length > 0) {
151317
151316
  entry.contextWindow = model5.context_length;
151318
- } else {
151319
- delete entry.contextWindow;
151320
151317
  }
151321
151318
  if (model5.name) {
151322
151319
  entry.name = model5.name;
151323
- } else {
151324
- delete entry.name;
151325
151320
  }
151326
151321
  const mods = model5.architecture?.input_modalities ?? [];
151327
151322
  const input = [];
@@ -151330,10 +151325,15 @@ Installing routstr models in pi models.json...`);
151330
151325
  if (mods.includes("image"))
151331
151326
  input.push("image");
151332
151327
  entry.input = input;
151328
+ if (previous?.reasoning !== undefined)
151329
+ entry.reasoning = previous.reasoning;
151330
+ if (previous?.thinkingLevelMap !== undefined)
151331
+ entry.thinkingLevelMap = previous.thinkingLevelMap;
151332
+ if (previous?.compat !== undefined)
151333
+ entry.compat = previous.compat;
151333
151334
  return entry;
151334
151335
  });
151335
151336
  piConfig.providers["routstr"] = {
151336
- ...piConfig.providers["routstr"] ?? {},
151337
151337
  baseUrl,
151338
151338
  api: "openai-completions",
151339
151339
  apiKey,
package/dist/index.js CHANGED
@@ -22434,17 +22434,12 @@ Installing routstr models in pi models.json...`);
22434
22434
  const existingModels = new Map((piConfig.providers["routstr"]?.models ?? []).map((m) => [m.id, m]));
22435
22435
  const providerModels = models.map((model) => {
22436
22436
  const previous = existingModels.get(model.id);
22437
- const entry = previous ? { ...previous } : { id: model.id };
22438
- entry.id = model.id;
22437
+ const entry = { id: model.id };
22439
22438
  if (model.context_length !== undefined && model.context_length > 0) {
22440
22439
  entry.contextWindow = model.context_length;
22441
- } else {
22442
- delete entry.contextWindow;
22443
22440
  }
22444
22441
  if (model.name) {
22445
22442
  entry.name = model.name;
22446
- } else {
22447
- delete entry.name;
22448
22443
  }
22449
22444
  const mods = model.architecture?.input_modalities ?? [];
22450
22445
  const input = [];
@@ -22453,10 +22448,15 @@ Installing routstr models in pi models.json...`);
22453
22448
  if (mods.includes("image"))
22454
22449
  input.push("image");
22455
22450
  entry.input = input;
22451
+ if (previous?.reasoning !== undefined)
22452
+ entry.reasoning = previous.reasoning;
22453
+ if (previous?.thinkingLevelMap !== undefined)
22454
+ entry.thinkingLevelMap = previous.thinkingLevelMap;
22455
+ if (previous?.compat !== undefined)
22456
+ entry.compat = previous.compat;
22456
22457
  return entry;
22457
22458
  });
22458
22459
  piConfig.providers["routstr"] = {
22459
- ...piConfig.providers["routstr"] ?? {},
22460
22460
  baseUrl,
22461
22461
  api: "openai-completions",
22462
22462
  apiKey,
@@ -27170,7 +27170,7 @@ zoo`.split(`
27170
27170
  // package.json
27171
27171
  var package_default = {
27172
27172
  name: "routstrd",
27173
- version: "0.4.3",
27173
+ version: "0.4.4",
27174
27174
  module: "src/index.ts",
27175
27175
  type: "module",
27176
27176
  private: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "routstrd",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "private": false,
@@ -10,8 +10,10 @@ type PiModelEntry = {
10
10
  contextWindow?: number;
11
11
  name?: string;
12
12
  input?: string[];
13
- // Preserve arbitrary manual fields (reasoning, thinkingLevelMap, compat, cost, etc.)
14
- [key: string]: unknown;
13
+ // Thinking/reasoning config is user-curated and preserved across refreshes.
14
+ reasoning?: boolean;
15
+ thinkingLevelMap?: Record<string, string | null>;
16
+ compat?: Record<string, unknown>;
15
17
  };
16
18
 
17
19
  type PiProviderConfig = {
@@ -65,29 +67,24 @@ export async function installPiIntegration(
65
67
  return;
66
68
  }
67
69
 
68
- // Preserve any manually-added per-model fields (reasoning, thinkingLevelMap,
69
- // compat, cost, maxTokens, etc.) across refreshes. Only `id` and `contextWindow`
70
- // are managed by routstrd.
70
+ // Rebuild every model entry from scratch from the daemon, so the generated
71
+ // models.json is always a faithful projection of the daemon's state. The only
72
+ // exception is thinking/reasoning config (reasoning, thinkingLevelMap, compat),
73
+ // which the daemon does not provide and the user curates by hand — preserve it.
71
74
  const existingModels = new Map<string, PiModelEntry>(
72
75
  (piConfig.providers["routstr"]?.models ?? []).map((m) => [m.id, m]),
73
76
  );
74
77
 
75
78
  const providerModels: PiModelEntry[] = models.map((model) => {
76
79
  const previous = existingModels.get(model.id);
77
- const entry: PiModelEntry = previous ? { ...previous } : { id: model.id };
78
-
79
- entry.id = model.id;
80
+ const entry: PiModelEntry = { id: model.id };
80
81
 
81
82
  if (model.context_length !== undefined && model.context_length > 0) {
82
83
  entry.contextWindow = model.context_length;
83
- } else {
84
- delete entry.contextWindow;
85
84
  }
86
85
 
87
86
  if (model.name) {
88
87
  entry.name = model.name;
89
- } else {
90
- delete entry.name;
91
88
  }
92
89
 
93
90
  // Map the daemon's input modalities to Pi's ["text", "image"] vocabulary.
@@ -97,13 +94,16 @@ export async function installPiIntegration(
97
94
  if (mods.includes("image")) input.push("image");
98
95
  entry.input = input;
99
96
 
97
+ // Preserve user-curated thinking fields from the previous entry.
98
+ if (previous?.reasoning !== undefined) entry.reasoning = previous.reasoning;
99
+ if (previous?.thinkingLevelMap !== undefined) entry.thinkingLevelMap = previous.thinkingLevelMap;
100
+ if (previous?.compat !== undefined) entry.compat = previous.compat;
101
+
100
102
  return entry;
101
103
  });
102
104
 
103
- // Preserve provider-level manual fields (compat, headers, name, etc.); only update
104
- // the routstrd-managed fields below.
105
+ // Rebuild provider from scratch too; only write routstrd-managed fields.
105
106
  piConfig.providers["routstr"] = {
106
- ...(piConfig.providers["routstr"] ?? {}),
107
107
  baseUrl,
108
108
  api: "openai-completions",
109
109
  apiKey,