@aliou/pi-neuralwatt 0.5.2 → 0.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aliou/pi-neuralwatt",
3
- "version": "0.5.2",
3
+ "version": "0.6.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "private": false,
@@ -32,7 +32,7 @@
32
32
  "!src/**/*.test.ts"
33
33
  ],
34
34
  "dependencies": {
35
- "@aliou/pi-utils-settings": "^0.15.0",
35
+ "@aliou/pi-utils-settings": "^0.17.0",
36
36
  "@aliou/pi-utils-ui": "^0.4.0"
37
37
  },
38
38
  "peerDependencies": {
@@ -51,12 +51,10 @@
51
51
  "typescript": "^5.9.3",
52
52
  "vitest": "^4.0.18"
53
53
  },
54
- "peerDependenciesMeta": {
55
- "@earendil-works/pi-coding-agent": {
56
- "optional": true
57
- },
58
- "@earendil-works/pi-tui": {
59
- "optional": true
54
+ "pnpm": {
55
+ "overrides": {
56
+ "@earendil-works/pi-ai": "$@earendil-works/pi-coding-agent",
57
+ "@earendil-works/pi-tui": "$@earendil-works/pi-coding-agent"
60
58
  }
61
59
  },
62
60
  "scripts": {
@@ -68,8 +66,18 @@
68
66
  "gen:schema": "ts-json-schema-generator --path src/config.ts --type NeuralwattConfig --no-type-check -o schema.json",
69
67
  "check:schema": "ts-json-schema-generator --path src/config.ts --type NeuralwattConfig --no-type-check -o /tmp/schema-check.json && diff -q schema.json /tmp/schema-check.json",
70
68
  "check:lockfile": "pnpm install --frozen-lockfile --ignore-scripts",
69
+ "prepare": "[ -d .git ] && husky || true",
71
70
  "changeset": "changeset",
72
71
  "version": "changeset version",
73
72
  "release": "pnpm changeset publish"
73
+ },
74
+ "packageManager": "pnpm@10.26.1",
75
+ "peerDependenciesMeta": {
76
+ "@earendil-works/pi-coding-agent": {
77
+ "optional": true
78
+ },
79
+ "@earendil-works/pi-tui": {
80
+ "optional": true
81
+ }
74
82
  }
75
- }
83
+ }
package/schema.json CHANGED
@@ -5,6 +5,10 @@
5
5
  "NeuralwattConfig": {
6
6
  "additionalProperties": false,
7
7
  "properties": {
8
+ "includeLegacyModelIds": {
9
+ "description": "Include legacy Neuralwatt model IDs in the model picker.",
10
+ "type": "boolean"
11
+ },
8
12
  "quotaCommand": {
9
13
  "description": "Show the quota command (/neuralwatt:quota).",
10
14
  "type": "boolean"
package/src/config.ts CHANGED
@@ -28,24 +28,38 @@ export interface NeuralwattConfig {
28
28
  quotaWarnings?: boolean;
29
29
  /** Show usage in the sub-bar / status bar. */
30
30
  subBarIntegration?: boolean;
31
+ /** Include legacy Neuralwatt model IDs in the model picker. */
32
+ includeLegacyModelIds?: boolean;
31
33
  }
32
34
 
33
35
  export interface ResolvedNeuralwattConfig {
34
36
  quotaCommand: boolean;
35
37
  quotaWarnings: boolean;
36
38
  subBarIntegration: boolean;
39
+ includeLegacyModelIds: boolean;
37
40
  }
38
41
 
39
42
  const DEFAULTS: ResolvedNeuralwattConfig = {
40
43
  quotaCommand: true,
41
44
  quotaWarnings: true,
42
45
  subBarIntegration: true,
46
+ includeLegacyModelIds: false,
43
47
  };
44
48
 
45
49
  export const configLoader = new ConfigLoader<
46
50
  NeuralwattConfig,
47
51
  ResolvedNeuralwattConfig
48
- >("neuralwatt", DEFAULTS);
52
+ >("neuralwatt", DEFAULTS, {
53
+ migrations: [
54
+ {
55
+ name: "disable-legacy-model-ids-by-default",
56
+ shouldRun: (config) => config.includeLegacyModelIds === undefined,
57
+ message:
58
+ "[neuralwatt] legacy model IDs (ids including the provider and the quantization) are disabled by default. You can enable them with /neuralwatt:settings.",
59
+ run: (config) => ({ ...config, includeLegacyModelIds: false }),
60
+ },
61
+ ],
62
+ });
49
63
 
50
64
  export const NEURALWATT_CONFIG_UPDATED_EVENT =
51
65
  "neuralwatt:config:updated" as const;
@@ -128,6 +142,23 @@ export function registerNeuralwattSettings(
128
142
  ),
129
143
  ],
130
144
  },
145
+ {
146
+ label: "Other settings",
147
+ items: [
148
+ {
149
+ id: "includeLegacyModelIds",
150
+ label: "Legacy model IDs",
151
+ description:
152
+ "Include deprecated Neuralwatt model IDs as aliases in the model picker",
153
+ currentValue:
154
+ (tabConfig?.includeLegacyModelIds ??
155
+ resolved.includeLegacyModelIds)
156
+ ? "include"
157
+ : "ignore",
158
+ values: ["include", "ignore"],
159
+ },
160
+ ],
161
+ },
131
162
  ];
132
163
  },
133
164
  onSettingChange: (id, newValue, config) => {
@@ -135,6 +166,10 @@ export function registerNeuralwattSettings(
135
166
  return null;
136
167
  }
137
168
 
169
+ if (id === "includeLegacyModelIds") {
170
+ return { ...config, includeLegacyModelIds: newValue === "include" };
171
+ }
172
+
138
173
  const enabled = newValue === "enabled";
139
174
  switch (id) {
140
175
  case "quotaCommand":
@@ -2,6 +2,7 @@ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
2
  import {
3
3
  configLoader,
4
4
  emitConfigUpdated,
5
+ NEURALWATT_CONFIG_UPDATED_EVENT,
5
6
  NEURALWATT_EXTENSIONS_REGISTER_EVENT,
6
7
  NEURALWATT_EXTENSIONS_REQUEST_EVENT,
7
8
  type NeuralwattFeatureId,
@@ -16,12 +17,14 @@ import {
16
17
  } from "../../types/quota-events";
17
18
  import { fetchQuotas } from "../../utils/quotas";
18
19
  import { normalizeNeuralwattContextOverflowError } from "./context-overflow";
19
- import { NEURALWATT_MODELS } from "./models";
20
+ import { getNeuralwattModels } from "./models";
20
21
  import { buildQuotasFromHeaders, fetchRequestedQuotas } from "./quota-store";
21
22
 
22
23
  const HEADER_EMIT_THROTTLE_MS = 5_000;
23
24
 
24
25
  function registerNeuralwattProvider(pi: ExtensionAPI): void {
26
+ const { includeLegacyModelIds } = configLoader.getConfig();
27
+
25
28
  pi.registerProvider("neuralwatt", {
26
29
  baseUrl: "https://api.neuralwatt.com/v1",
27
30
  apiKey: "$NEURALWATT_API_KEY",
@@ -31,7 +34,9 @@ function registerNeuralwattProvider(pi: ExtensionAPI): void {
31
34
  Referer: "https://pi.dev",
32
35
  "X-Title": "npm:@aliou/pi-neuralwatt",
33
36
  },
34
- models: NEURALWATT_MODELS,
37
+ models: getNeuralwattModels({
38
+ includeLegacyModelIds,
39
+ }),
35
40
  });
36
41
  }
37
42
 
@@ -47,6 +52,10 @@ export default async function (pi: ExtensionAPI) {
47
52
  getLoadedFeatures: () => loadedFeatures,
48
53
  });
49
54
 
55
+ pi.events.on(NEURALWATT_CONFIG_UPDATED_EVENT, () => {
56
+ registerNeuralwattProvider(pi);
57
+ });
58
+
50
59
  let lastHeaderEmitAt = 0;
51
60
  let quotaRequestInFlight = false;
52
61
 
@@ -98,6 +107,10 @@ export default async function (pi: ExtensionAPI) {
98
107
  });
99
108
 
100
109
  pi.on("session_start", async (_event, ctx) => {
110
+ for (const message of configLoader.drainMessages()) {
111
+ ctx.ui.notify(message, "warning");
112
+ }
113
+
101
114
  loadedFeatures.clear();
102
115
  pi.events.emit(NEURALWATT_EXTENSIONS_REQUEST_EVENT, undefined);
103
116
  emitConfigUpdated(pi);
@@ -5,26 +5,6 @@
5
5
  import type { ProviderModelConfig } from "@earendil-works/pi-coding-agent";
6
6
 
7
7
  export const NEURALWATT_MODELS: ProviderModelConfig[] = [
8
- // Devstral Small 2 - Mistral
9
- {
10
- id: "mistralai/Devstral-Small-2-24B-Instruct-2512",
11
- name: "Devstral Small 2",
12
- reasoning: false,
13
- input: ["text", "image"],
14
- cost: {
15
- input: 0.12,
16
- output: 0.35,
17
- cacheRead: 0,
18
- cacheWrite: 0,
19
- },
20
- contextWindow: 262128,
21
- maxTokens: 32768,
22
- compat: {
23
- supportsDeveloperRole: false,
24
- maxTokensField: "max_tokens",
25
- requiresAssistantAfterToolResult: true,
26
- },
27
- },
28
8
  // GLM-5 Fast - ZhipuAI
29
9
  {
30
10
  id: "glm-5-fast",
@@ -38,7 +18,7 @@ export const NEURALWATT_MODELS: ProviderModelConfig[] = [
38
18
  cacheWrite: 0,
39
19
  },
40
20
  contextWindow: 202736,
41
- maxTokens: 32768,
21
+ maxTokens: 65536,
42
22
  compat: {
43
23
  supportsDeveloperRole: false,
44
24
  maxTokensField: "max_tokens",
@@ -46,7 +26,7 @@ export const NEURALWATT_MODELS: ProviderModelConfig[] = [
46
26
  },
47
27
  // GLM-5.1 - ZhipuAI
48
28
  {
49
- id: "zai-org/GLM-5.1-FP8",
29
+ id: "glm-5.1",
50
30
  name: "GLM-5.1",
51
31
  reasoning: true,
52
32
  input: ["text"],
@@ -57,7 +37,7 @@ export const NEURALWATT_MODELS: ProviderModelConfig[] = [
57
37
  cacheWrite: 0,
58
38
  },
59
39
  contextWindow: 202736,
60
- maxTokens: 32768,
40
+ maxTokens: 65536,
61
41
  thinkingLevelMap: {
62
42
  minimal: null,
63
43
  low: null,
@@ -84,37 +64,10 @@ export const NEURALWATT_MODELS: ProviderModelConfig[] = [
84
64
  cacheWrite: 0,
85
65
  },
86
66
  contextWindow: 202736,
87
- maxTokens: 32768,
88
- compat: {
89
- supportsDeveloperRole: false,
90
- maxTokensField: "max_tokens",
91
- },
92
- },
93
- // GPT-OSS 20B - OpenAI
94
- {
95
- id: "openai/gpt-oss-20b",
96
- name: "GPT-OSS 20B",
97
- reasoning: true,
98
- input: ["text"],
99
- cost: {
100
- input: 0.03,
101
- output: 0.16,
102
- cacheRead: 0,
103
- cacheWrite: 0,
104
- },
105
- contextWindow: 16368,
106
- maxTokens: 4096,
107
- thinkingLevelMap: {
108
- minimal: "low",
109
- low: "low",
110
- medium: "medium",
111
- high: "high",
112
- xhigh: null,
113
- },
67
+ maxTokens: 65536,
114
68
  compat: {
115
69
  supportsDeveloperRole: false,
116
70
  maxTokensField: "max_tokens",
117
- requiresReasoningContentOnAssistantMessages: true,
118
71
  },
119
72
  },
120
73
  // Kimi K2.5 - MoonshotAI
@@ -165,7 +118,7 @@ export const NEURALWATT_MODELS: ProviderModelConfig[] = [
165
118
  },
166
119
  // Kimi K2.6 - MoonshotAI
167
120
  {
168
- id: "moonshotai/Kimi-K2.6",
121
+ id: "kimi-k2.6",
169
122
  name: "Kimi K2.6",
170
123
  reasoning: true,
171
124
  input: ["text", "image"],
@@ -209,36 +162,9 @@ export const NEURALWATT_MODELS: ProviderModelConfig[] = [
209
162
  maxTokensField: "max_tokens",
210
163
  },
211
164
  },
212
- // MiniMax M2.5 - MiniMax
213
- {
214
- id: "MiniMaxAI/MiniMax-M2.5",
215
- name: "MiniMax M2.5",
216
- reasoning: true,
217
- input: ["text"],
218
- cost: {
219
- input: 0.35,
220
- output: 1.38,
221
- cacheRead: 0,
222
- cacheWrite: 0,
223
- },
224
- contextWindow: 196592,
225
- maxTokens: 65536,
226
- thinkingLevelMap: {
227
- minimal: null,
228
- low: null,
229
- medium: "medium",
230
- high: null,
231
- xhigh: null,
232
- },
233
- compat: {
234
- supportsDeveloperRole: false,
235
- maxTokensField: "max_tokens",
236
- requiresReasoningContentOnAssistantMessages: true,
237
- },
238
- },
239
165
  // Qwen3.5 397B - Qwen
240
166
  {
241
- id: "Qwen/Qwen3.5-397B-A17B-FP8",
167
+ id: "qwen3.5-397b",
242
168
  name: "Qwen3.5 397B",
243
169
  reasoning: true,
244
170
  input: ["text"],
@@ -284,7 +210,7 @@ export const NEURALWATT_MODELS: ProviderModelConfig[] = [
284
210
  },
285
211
  // Qwen3.6 35B - Qwen
286
212
  {
287
- id: "Qwen/Qwen3.6-35B-A3B",
213
+ id: "qwen3.6-35b",
288
214
  name: "Qwen3.6 35B",
289
215
  reasoning: true,
290
216
  input: ["text", "image"],
@@ -295,7 +221,34 @@ export const NEURALWATT_MODELS: ProviderModelConfig[] = [
295
221
  cacheWrite: 0,
296
222
  },
297
223
  contextWindow: 131056,
298
- maxTokens: 32768,
224
+ maxTokens: 65536,
225
+ thinkingLevelMap: {
226
+ minimal: null,
227
+ low: null,
228
+ medium: "medium",
229
+ high: null,
230
+ xhigh: null,
231
+ },
232
+ compat: {
233
+ supportsDeveloperRole: false,
234
+ maxTokensField: "max_tokens",
235
+ requiresReasoningContentOnAssistantMessages: true,
236
+ },
237
+ },
238
+ // Kimi K2.7 Code - MoonshotAI
239
+ {
240
+ id: "moonshotai/Kimi-K2.7-Code",
241
+ name: "Kimi K2.7 Code",
242
+ reasoning: true,
243
+ input: ["text", "image"],
244
+ cost: {
245
+ input: 0.95,
246
+ output: 4.0,
247
+ cacheRead: 0,
248
+ cacheWrite: 0,
249
+ },
250
+ contextWindow: 262128,
251
+ maxTokens: 65536,
299
252
  thinkingLevelMap: {
300
253
  minimal: null,
301
254
  low: null,
@@ -322,10 +275,46 @@ export const NEURALWATT_MODELS: ProviderModelConfig[] = [
322
275
  cacheWrite: 0,
323
276
  },
324
277
  contextWindow: 131056,
325
- maxTokens: 32768,
278
+ maxTokens: 65536,
326
279
  compat: {
327
280
  supportsDeveloperRole: false,
328
281
  maxTokensField: "max_tokens",
329
282
  },
330
283
  },
331
284
  ];
285
+
286
+ const LEGACY_MODEL_ALIAS_MAP = {
287
+ "zai-org/GLM-5.1-FP8": "glm-5.1",
288
+ "moonshotai/Kimi-K2.6": "kimi-k2.6",
289
+ "Qwen/Qwen3.5-397B-A17B-FP8": "qwen3.5-397b",
290
+ "Qwen/Qwen3.6-35B-A3B": "qwen3.6-35b",
291
+ } as const;
292
+
293
+ export const LEGACY_NEURALWATT_MODEL_IDS = new Set<string>(
294
+ Object.keys(LEGACY_MODEL_ALIAS_MAP),
295
+ );
296
+
297
+ const LEGACY_NEURALWATT_MODELS: ProviderModelConfig[] = Object.entries(
298
+ LEGACY_MODEL_ALIAS_MAP,
299
+ ).map(([legacyId, canonicalId]) => {
300
+ const canonical = NEURALWATT_MODELS.find((model) => model.id === canonicalId);
301
+
302
+ if (!canonical) {
303
+ throw new Error(`Missing canonical model for legacy alias ${legacyId}`);
304
+ }
305
+
306
+ return {
307
+ ...canonical,
308
+ id: legacyId,
309
+ name: `${canonical.name} (legacy ID)`,
310
+ };
311
+ });
312
+
313
+ export function getNeuralwattModels(options?: {
314
+ includeLegacyModelIds?: boolean;
315
+ }): ProviderModelConfig[] {
316
+ if (options?.includeLegacyModelIds)
317
+ return [...NEURALWATT_MODELS, ...LEGACY_NEURALWATT_MODELS];
318
+
319
+ return NEURALWATT_MODELS;
320
+ }