@mcowger/pi-plexus 0.2.3 → 0.2.5
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 +22 -6
- package/src/pi-compat.ts +34 -0
- package/src/plexus-cache.ts +1 -1
- package/src/plexus-config.ts +2 -2
- package/src/plexus-log.ts +1 -1
- package/src/plexus-models.ts +3 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcowger/pi-plexus",
|
|
3
3
|
"author": "Matt Cowger",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.5",
|
|
5
5
|
"description": "Plexus AI provider extension package for pi",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"LICENSE"
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
|
-
"postinstall": "lefthook install",
|
|
25
|
+
"postinstall": "command -v lefthook >/dev/null 2>&1 && lefthook install || true",
|
|
26
26
|
"check": "bunx tsc --noEmit",
|
|
27
27
|
"test": "bun test",
|
|
28
28
|
"format": "biome format --write .",
|
|
@@ -31,12 +31,28 @@
|
|
|
31
31
|
"pack:dry-run": "bun pack --dry-run"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@biomejs/biome": "2.4.
|
|
35
|
-
"lefthook": "2.1.
|
|
34
|
+
"@biomejs/biome": "2.4.15",
|
|
35
|
+
"lefthook": "2.1.8"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@earendil-works/pi-ai": "0.
|
|
39
|
-
"@earendil-works/pi-coding-agent": "0.
|
|
38
|
+
"@earendil-works/pi-ai": "0.75.4",
|
|
39
|
+
"@earendil-works/pi-coding-agent": "0.75.4",
|
|
40
|
+
"@oh-my-pi/pi-ai": ">=15.0.0",
|
|
41
|
+
"@oh-my-pi/pi-coding-agent": ">=15.0.0"
|
|
42
|
+
},
|
|
43
|
+
"peerDependenciesMeta": {
|
|
44
|
+
"@oh-my-pi/pi-ai": {
|
|
45
|
+
"optional": true
|
|
46
|
+
},
|
|
47
|
+
"@oh-my-pi/pi-coding-agent": {
|
|
48
|
+
"optional": true
|
|
49
|
+
},
|
|
50
|
+
"@earendil-works/pi-ai": {
|
|
51
|
+
"optional": true
|
|
52
|
+
},
|
|
53
|
+
"@earendil-works/pi-coding-agent": {
|
|
54
|
+
"optional": true
|
|
55
|
+
}
|
|
40
56
|
},
|
|
41
57
|
"pi": {
|
|
42
58
|
"extensions": [
|
package/src/pi-compat.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dual-compat layer: works with both oh-my-pi and upstream pi.
|
|
3
|
+
*
|
|
4
|
+
* oh-my-pi uses @oh-my-pi/* packages and getAgentDir() returns ~/.omp/agent.
|
|
5
|
+
* Upstream pi uses @earendil-works/* packages and getAgentDir() returns ~/.pi/agent.
|
|
6
|
+
*
|
|
7
|
+
* All path differences are handled automatically by getAgentDir() —
|
|
8
|
+
* no hardcoded ~/.pi or ~/.omp paths needed.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// Runtime resolution — try oh-my-pi first, fall back to upstream pi.
|
|
12
|
+
// Bun's resolver will only find one of these installed since they conflict.
|
|
13
|
+
let _getAgentDir: (() => string) | undefined;
|
|
14
|
+
// biome-ignore lint/suspicious/noExplicitAny: getModel/getBundledModel use branded generic types
|
|
15
|
+
let _lookupModel: ((...args: any[]) => any) | undefined;
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
// @ts-expect-error — optional peer, only present under oh-my-pi
|
|
19
|
+
const codingAgent = await import("@oh-my-pi/pi-coding-agent");
|
|
20
|
+
_getAgentDir = codingAgent.getAgentDir;
|
|
21
|
+
// @ts-expect-error — optional peer, only present under oh-my-pi
|
|
22
|
+
const ai = await import("@oh-my-pi/pi-ai");
|
|
23
|
+
_lookupModel = ai.getBundledModel; // oh-my-pi name
|
|
24
|
+
} catch {
|
|
25
|
+
const codingAgent = await import("@earendil-works/pi-coding-agent");
|
|
26
|
+
_getAgentDir = codingAgent.getAgentDir;
|
|
27
|
+
const ai = await import("@earendil-works/pi-ai");
|
|
28
|
+
_lookupModel = ai.getModel; // upstream pi name
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// biome-ignore lint/style/noNonNullAssertion: one of the two import paths is guaranteed to succeed
|
|
32
|
+
export const getAgentDir = _getAgentDir!;
|
|
33
|
+
// biome-ignore lint/style/noNonNullAssertion: one of the two import paths is guaranteed to succeed
|
|
34
|
+
export const lookupModel = _lookupModel!;
|
package/src/plexus-cache.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
import { getAgentDir } from "
|
|
4
|
+
import { getAgentDir } from "./pi-compat.js";
|
|
5
5
|
import type { PlexusApiResponse } from "./plexus-models.js";
|
|
6
6
|
import type { PiModel } from "./plexus-models.js";
|
|
7
7
|
|
package/src/plexus-config.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
import { getAgentDir } from "
|
|
4
|
+
import { getAgentDir } from "./pi-compat.js";
|
|
5
5
|
|
|
6
6
|
const getConfigDir = (): string => join(getAgentDir(), "extensions", "plexus");
|
|
7
7
|
const getConfigPath = (): string => join(getConfigDir(), "config.json");
|
|
@@ -55,4 +55,4 @@ export const getBaseUrl = getBaseUrlSync;
|
|
|
55
55
|
export const getDefaultModel = (): string | null => {
|
|
56
56
|
const config = getConfigSync();
|
|
57
57
|
return config.defaultModel ?? null;
|
|
58
|
-
};
|
|
58
|
+
};
|
package/src/plexus-log.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { appendFileSync, mkdirSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { getAgentDir } from "
|
|
3
|
+
import { getAgentDir } from "./pi-compat.js";
|
|
4
4
|
|
|
5
5
|
const getLogPath = (): string => join(getAgentDir(), "extensions", "plexus", "plexus.log");
|
|
6
6
|
|
package/src/plexus-models.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { lookupModel } from "./pi-compat.js";
|
|
2
2
|
import type {
|
|
3
3
|
Api,
|
|
4
4
|
Model,
|
|
@@ -105,10 +105,9 @@ const inferReasoning = (supported_parameters: string[] | undefined): boolean =>
|
|
|
105
105
|
const lookupPiModel = (piProvider?: string, piModel?: string): Model<Api> | null => {
|
|
106
106
|
if (!piProvider || !piModel) return null;
|
|
107
107
|
|
|
108
|
-
//
|
|
109
|
-
// so we cast to bypass the branded type constraints on getModel.
|
|
108
|
+
// lookupModel is shimmed to call getModel (upstream) or getBundledModel (oh-my-pi).
|
|
110
109
|
// biome-ignore lint/suspicious/noExplicitAny: dynamic string args don't satisfy generic constraints
|
|
111
|
-
return
|
|
110
|
+
return (lookupModel as any)(piProvider, piModel) ?? null;
|
|
112
111
|
};
|
|
113
112
|
|
|
114
113
|
/**
|