@aliou/pi-neuralwatt 0.11.4 → 0.12.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.
@@ -199,6 +199,13 @@ export default async function (pi: ExtensionAPI) {
199
199
  return { message: overflowMessage };
200
200
  });
201
201
 
202
+ // Inject the active Pi session id as a conversation id on every Neuralwatt
203
+ // request so the gateway can correlate requests within a session.
204
+ pi.on("before_provider_headers", (event, ctx) => {
205
+ if (ctx.model?.provider !== "neuralwatt") return;
206
+ event.headers["X-NW-Conversation-ID"] = ctx.sessionManager.getSessionId();
207
+ });
208
+
202
209
  pi.on("after_provider_response", (event, ctx) => {
203
210
  if (ctx.model?.provider !== "neuralwatt") return;
204
211
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aliou/pi-neuralwatt",
3
- "version": "0.11.4",
3
+ "version": "0.12.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "private": false,
@@ -34,7 +34,7 @@
34
34
  "!extensions/**/*.test.ts"
35
35
  ],
36
36
  "dependencies": {
37
- "@aliou/pi-utils-settings": "^0.18.0",
37
+ "@aliou/pi-utils-settings": "^0.19.1",
38
38
  "@aliou/pi-utils-ui": "^0.5.0"
39
39
  },
40
40
  "peerDependencies": {
@@ -67,8 +67,8 @@
67
67
  "format": "biome check --write",
68
68
  "test": "vitest run",
69
69
  "test:watch": "vitest",
70
- "gen:schema": "ts-json-schema-generator --path src/config/types.ts --type NeuralwattConfig --no-type-check -o schema.json",
71
- "check:schema": "ts-json-schema-generator --path src/config/types.ts --type NeuralwattConfig --no-type-check -o /tmp/schema-check.json && diff -q schema.json /tmp/schema-check.json",
70
+ "gen:schema": "pi-settings-schema -p src/config/types.ts -t NeuralwattConfig -o schema.json --version 0.12.0",
71
+ "check:schema": "pi-settings-schema -p src/config/types.ts -t NeuralwattConfig -o schema.json --version 0.12.0 --check",
72
72
  "check:lockfile": "pnpm install --frozen-lockfile --ignore-scripts",
73
73
  "prepare": "[ -d .git ] && husky || true",
74
74
  "changeset": "changeset",
package/schema.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
- "$ref": "#/definitions/NeuralwattConfig",
3
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$ref": "#/definitions/NeuralwattConfig",
4
4
  "definitions": {
5
5
  "NeuralwattConfig": {
6
- "additionalProperties": false,
6
+ "type": "object",
7
7
  "properties": {
8
8
  "$schema": {
9
- "description": "$schema URL for editor autocomplete.",
10
9
  "type": "string"
11
10
  },
12
11
  "provider": {
@@ -24,57 +23,70 @@
24
23
  "subBarIntegration": {
25
24
  "$ref": "#/definitions/NeuralwattSubBarIntegrationConfig",
26
25
  "description": "Sub-bar/status-bar integration feature."
26
+ },
27
+ "version": {
28
+ "anyOf": [
29
+ {
30
+ "type": "integer",
31
+ "minimum": 0
32
+ },
33
+ {
34
+ "type": "string",
35
+ "pattern": "^\\d{1,15}(\\.\\d{1,15})?(\\.\\d{1,15})?$"
36
+ }
37
+ ],
38
+ "description": "Config schema version, stamped by migrations. Current version: 0.12.0."
27
39
  }
28
40
  },
29
- "type": "object"
41
+ "additionalProperties": false
30
42
  },
31
43
  "NeuralwattProviderConfig": {
32
- "additionalProperties": false,
44
+ "type": "object",
33
45
  "properties": {
46
+ "includeLegacyModelIds": {
47
+ "type": "boolean",
48
+ "description": "Include legacy Neuralwatt model IDs in the model picker."
49
+ },
34
50
  "includeAliasedModelIds": {
35
- "description": "Include alternate creator-scoped Neuralwatt model IDs in the model picker.",
36
- "type": "boolean"
51
+ "type": "boolean",
52
+ "description": "Include alternate creator-scoped Neuralwatt model IDs in the model picker."
37
53
  },
38
54
  "includeEarlyAccessModels": {
39
- "description": "Include early-access Neuralwatt models discovered via the authenticated API.",
40
- "type": "boolean"
41
- },
42
- "includeLegacyModelIds": {
43
- "description": "Include legacy Neuralwatt model IDs in the model picker.",
44
- "type": "boolean"
55
+ "type": "boolean",
56
+ "description": "Include early-access Neuralwatt models discovered via the authenticated API."
45
57
  }
46
58
  },
47
- "type": "object"
59
+ "additionalProperties": false
48
60
  },
49
61
  "NeuralwattQuotaCommandConfig": {
50
- "additionalProperties": false,
62
+ "type": "object",
51
63
  "properties": {
52
64
  "enabled": {
53
- "description": "Show the quota command (/neuralwatt:quota).",
54
- "type": "boolean"
65
+ "type": "boolean",
66
+ "description": "Show the quota command (/neuralwatt:quota)."
55
67
  }
56
68
  },
57
- "type": "object"
69
+ "additionalProperties": false
58
70
  },
59
71
  "NeuralwattQuotaWarningsConfig": {
60
- "additionalProperties": false,
72
+ "type": "object",
61
73
  "properties": {
62
74
  "enabled": {
63
- "description": "Show quota warnings when credits or energy are low.",
64
- "type": "boolean"
75
+ "type": "boolean",
76
+ "description": "Show quota warnings when credits or energy are low."
65
77
  }
66
78
  },
67
- "type": "object"
79
+ "additionalProperties": false
68
80
  },
69
81
  "NeuralwattSubBarIntegrationConfig": {
70
- "additionalProperties": false,
82
+ "type": "object",
71
83
  "properties": {
72
84
  "enabled": {
73
- "description": "Show usage in the sub-bar / status bar.",
74
- "type": "boolean"
85
+ "type": "boolean",
86
+ "description": "Show usage in the sub-bar / status bar."
75
87
  }
76
88
  },
77
- "type": "object"
89
+ "additionalProperties": false
78
90
  }
79
91
  }
80
- }
92
+ }
@@ -29,6 +29,7 @@ function isPreviousConfigWithoutLegacyDefault(
29
29
  export const disableLegacyModelIdsByDefaultMigration: Migration<NeuralwattConfig> =
30
30
  {
31
31
  name: "disable-legacy-model-ids-by-default",
32
+ version: "0.8.0",
32
33
  shouldRun: isPreviousConfigWithoutLegacyDefault,
33
34
  message:
34
35
  "[neuralwatt] legacy model IDs (ids including the provider and the quantization) are disabled by default. You can enable them with /neuralwatt:settings.",
@@ -80,6 +80,7 @@ export async function backupConfig(filePath: string): Promise<void> {
80
80
 
81
81
  export const flatToNestedConfigMigration: Migration<NeuralwattConfig> = {
82
82
  name: "flat-to-nested-config",
83
+ version: "0.8.1",
83
84
  shouldRun: isPreviousConfig,
84
85
  message: FLAT_CONFIG_MIGRATION_MESSAGE,
85
86
  run: async (config, filePath) => {
@@ -25,6 +25,7 @@ function previousProvider(
25
25
  */
26
26
  export const renameHiddenToEarlyAccessMigration: Migration<NeuralwattConfig> = {
27
27
  name: "rename-hidden-models-to-early-access",
28
+ version: "0.10.6",
28
29
  shouldRun: (config) =>
29
30
  previousProvider(config)?.includeHiddenModels !== undefined,
30
31
  message:
@@ -25,6 +25,7 @@ function previousProvider(
25
25
  export const enableAliasesForLegacyUsersMigration: Migration<NeuralwattConfig> =
26
26
  {
27
27
  name: "enable-alias-model-ids-for-legacy-users",
28
+ version: "0.11.0",
28
29
  shouldRun: (config) => {
29
30
  const provider = previousProvider(config);
30
31
  return (