@aliou/pi-neuralwatt 0.5.3 → 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.3",
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": {
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);
@@ -4,7 +4,7 @@
4
4
 
5
5
  import type { ProviderModelConfig } from "@earendil-works/pi-coding-agent";
6
6
 
7
- const CANONICAL_NEURALWATT_MODELS: ProviderModelConfig[] = [
7
+ export const NEURALWATT_MODELS: ProviderModelConfig[] = [
8
8
  // GLM-5 Fast - ZhipuAI
9
9
  {
10
10
  id: "glm-5-fast",
@@ -235,6 +235,33 @@ const CANONICAL_NEURALWATT_MODELS: ProviderModelConfig[] = [
235
235
  requiresReasoningContentOnAssistantMessages: true,
236
236
  },
237
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,
252
+ thinkingLevelMap: {
253
+ minimal: null,
254
+ low: null,
255
+ medium: "medium",
256
+ high: null,
257
+ xhigh: null,
258
+ },
259
+ compat: {
260
+ supportsDeveloperRole: false,
261
+ maxTokensField: "max_tokens",
262
+ requiresReasoningContentOnAssistantMessages: true,
263
+ },
264
+ },
238
265
  // Qwen3.6 35B Fast - Qwen
239
266
  {
240
267
  id: "qwen3.6-35b-fast",
@@ -270,9 +297,7 @@ export const LEGACY_NEURALWATT_MODEL_IDS = new Set<string>(
270
297
  const LEGACY_NEURALWATT_MODELS: ProviderModelConfig[] = Object.entries(
271
298
  LEGACY_MODEL_ALIAS_MAP,
272
299
  ).map(([legacyId, canonicalId]) => {
273
- const canonical = CANONICAL_NEURALWATT_MODELS.find(
274
- (model) => model.id === canonicalId,
275
- );
300
+ const canonical = NEURALWATT_MODELS.find((model) => model.id === canonicalId);
276
301
 
277
302
  if (!canonical) {
278
303
  throw new Error(`Missing canonical model for legacy alias ${legacyId}`);
@@ -285,7 +310,11 @@ const LEGACY_NEURALWATT_MODELS: ProviderModelConfig[] = Object.entries(
285
310
  };
286
311
  });
287
312
 
288
- export const NEURALWATT_MODELS: ProviderModelConfig[] = [
289
- ...CANONICAL_NEURALWATT_MODELS,
290
- ...LEGACY_NEURALWATT_MODELS,
291
- ];
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
+ }