pi-lilac-provider 1.7.0 → 1.7.2
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 +7 -1
- package/scripts/test-flex.ts +4 -4
- package/scripts/test-model-overrides.ts +4 -3
package/index.ts
CHANGED
|
@@ -84,12 +84,11 @@
|
|
|
84
84
|
* Then use /model to select from available models
|
|
85
85
|
*/
|
|
86
86
|
|
|
87
|
-
import type
|
|
87
|
+
import { getAgentDir, type ExtensionAPI, type ModelRegistry } from "@earendil-works/pi-coding-agent";
|
|
88
88
|
import modelsData from "./models.json" with { type: "json" };
|
|
89
89
|
import customModelsData from "./custom-models.json" with { type: "json" };
|
|
90
90
|
import patchData from "./patch.json" with { type: "json" };
|
|
91
91
|
import fs from "fs";
|
|
92
|
-
import os from "os";
|
|
93
92
|
import path from "path";
|
|
94
93
|
|
|
95
94
|
// ─── Types ────────────────────────────────────────────────────────────────────
|
|
@@ -198,7 +197,7 @@ interface LilacConfig {
|
|
|
198
197
|
flexThreshold?: number | null;
|
|
199
198
|
}
|
|
200
199
|
|
|
201
|
-
const CONFIG_PATH = path.join(
|
|
200
|
+
const CONFIG_PATH = path.join(getAgentDir(), "extensions", "lilac.json");
|
|
202
201
|
const DEFAULT_CONFIG: LilacConfig = { modelOverrides: {}, flexThreshold: null };
|
|
203
202
|
|
|
204
203
|
// Validate user-supplied modelOverrides from the config file. Non-object ids and
|
|
@@ -433,7 +432,7 @@ const PROVIDER_ID = "lilac";
|
|
|
433
432
|
const BASE_URL = "https://api.getlilac.com/v1";
|
|
434
433
|
const STATUS_URL = "https://api.getlilac.com/status";
|
|
435
434
|
const MODELS_URL = `${BASE_URL}/models`;
|
|
436
|
-
const CACHE_DIR = path.join(
|
|
435
|
+
const CACHE_DIR = path.join(getAgentDir(), "cache");
|
|
437
436
|
const CACHE_PATH = path.join(CACHE_DIR, `${PROVIDER_ID}-models.json`);
|
|
438
437
|
const DISCOUNT_CACHE_PATH = path.join(CACHE_DIR, `${PROVIDER_ID}-discounts.json`);
|
|
439
438
|
const LIVE_FETCH_TIMEOUT_MS = 8000;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-lilac-provider",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "Lilac provider extension for pi - Access Kimi K2.6, GLM 5.1, and Gemma 4 models through Lilac's OpenAI-compatible API on idle GPUs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -25,6 +25,12 @@
|
|
|
25
25
|
],
|
|
26
26
|
"author": "",
|
|
27
27
|
"license": "MIT",
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@earendil-works/pi-coding-agent": ">=0.74.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@earendil-works/pi-coding-agent": "0.80.3"
|
|
33
|
+
},
|
|
28
34
|
"pi": {
|
|
29
35
|
"extensions": [
|
|
30
36
|
"./index.ts"
|
package/scripts/test-flex.ts
CHANGED
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import fs from "fs";
|
|
26
|
-
import os from "os";
|
|
27
26
|
import path from "path";
|
|
28
|
-
import type
|
|
27
|
+
import { getAgentDir, type ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
29
28
|
|
|
30
|
-
// Isolate config + cache to a temp
|
|
29
|
+
// Isolate config + cache to a temp agent dir so loadConfig/cacheDiscounts never touch
|
|
31
30
|
// the real ~/.pi. Must be set before importing index.ts, which computes
|
|
32
31
|
// CONFIG_PATH / CACHE_PATH at module scope.
|
|
33
32
|
const tmpHome = `/tmp/pi-lilac-flex-test-${Date.now()}`;
|
|
34
33
|
fs.mkdirSync(tmpHome, { recursive: true });
|
|
35
34
|
process.env.HOME = tmpHome;
|
|
35
|
+
process.env.PI_CODING_AGENT_DIR = path.join(tmpHome, ".pi", "agent");
|
|
36
36
|
|
|
37
37
|
const {
|
|
38
38
|
default: registerLilac,
|
|
@@ -65,7 +65,7 @@ function eq<T>(actual: T, expected: T, message: string) {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
const cfgPath = path.join(
|
|
68
|
+
const cfgPath = path.join(getAgentDir(), "extensions", "lilac.json");
|
|
69
69
|
const KIMI = "moonshotai/kimi-k2.6";
|
|
70
70
|
|
|
71
71
|
// ─── parseFlexThreshold ───────────────────────────────────────────────────────
|
|
@@ -20,19 +20,20 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import fs from "fs";
|
|
23
|
-
import os from "os";
|
|
24
23
|
import path from "path";
|
|
24
|
+
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
25
25
|
|
|
26
26
|
const root = path.resolve(import.meta.dirname, "..");
|
|
27
27
|
const modelsData = JSON.parse(fs.readFileSync(path.join(root, "models.json"), "utf8"));
|
|
28
28
|
const customModelsData = JSON.parse(fs.readFileSync(path.join(root, "custom-models.json"), "utf8"));
|
|
29
29
|
const patchData = JSON.parse(fs.readFileSync(path.join(root, "patch.json"), "utf8"));
|
|
30
30
|
|
|
31
|
-
// Isolate config + cache to a temp
|
|
31
|
+
// Isolate config + cache to a temp agent dir so loadConfig never touches the real ~/.pi.
|
|
32
32
|
// Must be set before importing index.ts, which computes CONFIG_PATH at module scope.
|
|
33
33
|
const tmpHome = `/tmp/pi-lilac-override-test-${Date.now()}`;
|
|
34
34
|
fs.mkdirSync(tmpHome, { recursive: true });
|
|
35
35
|
process.env.HOME = tmpHome;
|
|
36
|
+
process.env.PI_CODING_AGENT_DIR = path.join(tmpHome, ".pi", "agent");
|
|
36
37
|
|
|
37
38
|
const {
|
|
38
39
|
buildModels,
|
|
@@ -160,7 +161,7 @@ eq(parseModelOverrides({ id: 123 } as any), undefined, "non-object override (num
|
|
|
160
161
|
|
|
161
162
|
console.log("\n--- loadConfig ---");
|
|
162
163
|
|
|
163
|
-
const cfgPath = path.join(
|
|
164
|
+
const cfgPath = path.join(getAgentDir(), "extensions", "lilac.json");
|
|
164
165
|
|
|
165
166
|
{
|
|
166
167
|
// Fresh tmpHome: no config file -> loadConfig auto-populates the scaffold and returns defaults
|