pi-neuralwatt-provider 1.3.1 → 1.3.3
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/index.ts +3 -4
- package/package.json +1 -1
- package/tests/__mocks__/pi-coding-agent.ts +8 -0
- package/tests/config.test.ts +2 -3
- package/npm-shrinkwrap.json +0 -2240
package/index.ts
CHANGED
|
@@ -61,13 +61,12 @@ import type { SimpleStreamOptions } from "@earendil-works/pi-ai";
|
|
|
61
61
|
import { clampThinkingLevel } from "@earendil-works/pi-ai";
|
|
62
62
|
import { streamOpenAICompletions } from "@earendil-works/pi-ai/compat";
|
|
63
63
|
import type { AssistantMessageEventStream } from "@earendil-works/pi-ai";
|
|
64
|
-
import type
|
|
64
|
+
import { getAgentDir, type ExtensionAPI, type ModelRegistry } from "@earendil-works/pi-coding-agent";
|
|
65
65
|
import modelsData from "./models.json" with { type: "json" };
|
|
66
66
|
import customModelsData from "./custom-models.json" with { type: "json" };
|
|
67
67
|
import patchesData from "./patch.json" with { type: "json" };
|
|
68
68
|
import { transformContextForImageLimit } from "./transform";
|
|
69
69
|
import fs from "fs";
|
|
70
|
-
import os from "os";
|
|
71
70
|
import path from "path";
|
|
72
71
|
|
|
73
72
|
// ─── Display Configuration ────────────────────────────────────────────────────
|
|
@@ -94,7 +93,7 @@ interface ModelOverride {
|
|
|
94
93
|
vision?: { maxImagesPerRequest?: number };
|
|
95
94
|
}
|
|
96
95
|
|
|
97
|
-
const CONFIG_PATH = path.join(
|
|
96
|
+
const CONFIG_PATH = path.join(getAgentDir(), "extensions", "neuralwatt.json");
|
|
98
97
|
|
|
99
98
|
const VALID_DISPLAY_MODES = new Set<string>(["widget", "statusbar", "off"]);
|
|
100
99
|
|
|
@@ -319,7 +318,7 @@ function buildModels(
|
|
|
319
318
|
const PROVIDER_ID = "neuralwatt";
|
|
320
319
|
export const BASE_URL = "https://api.neuralwatt.com/v1";
|
|
321
320
|
const MODELS_URL = `${BASE_URL}/models`;
|
|
322
|
-
const CACHE_DIR = path.join(
|
|
321
|
+
const CACHE_DIR = path.join(getAgentDir(), "cache");
|
|
323
322
|
const CACHE_PATH = path.join(CACHE_DIR, `${PROVIDER_ID}-models.json`);
|
|
324
323
|
const LIVE_FETCH_TIMEOUT_MS = 8000;
|
|
325
324
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-neuralwatt-provider",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Neuralwatt provider extension for pi - Access Kimi, GLM, Qwen, GPT-OSS, Devstral, and MiniMax models through the Neuralwatt API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
// Stub for @earendil-works/pi-coding-agent peer dependency
|
|
2
2
|
|
|
3
|
+
import os from "os";
|
|
4
|
+
import path from "path";
|
|
5
|
+
|
|
6
|
+
/** Mirrors the real getAgentDir(): respects PI_CODING_AGENT_DIR, defaults to ~/.pi/agent */
|
|
7
|
+
export function getAgentDir(): string {
|
|
8
|
+
return process.env.PI_CODING_AGENT_DIR || path.join(os.homedir(), ".pi", "agent");
|
|
9
|
+
}
|
|
10
|
+
|
|
3
11
|
export interface ExtensionAPI {
|
|
4
12
|
registerProvider(_name: string, _provider: any): void;
|
|
5
13
|
on(_event: string, _handler: any): void;
|
package/tests/config.test.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
|
|
2
2
|
import fs from "fs";
|
|
3
|
-
import
|
|
3
|
+
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
4
4
|
import path from "path";
|
|
5
5
|
|
|
6
6
|
// We test the config parsing by importing the module's loadConfig indirectly.
|
|
7
7
|
// Since loadConfig reads from the filesystem at import time and on session_start,
|
|
8
8
|
// we test the parseDisplayMode logic and the config file loading path directly.
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
const CONFIG_PATH = path.join(CONFIG_DIR, "neuralwatt.json");
|
|
10
|
+
const CONFIG_PATH = path.join(getAgentDir(), "extensions", "neuralwatt.json");
|
|
12
11
|
|
|
13
12
|
// Replicate the parsing logic inline to test it without module-level side effects.
|
|
14
13
|
// The real code under test is in index.ts — these unit tests validate the
|