@mcowger/pi-plexus 1.2.5 → 1.3.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/README.md +69 -3
- package/dist/extension.js +5 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ Exposes models from a self-hosted [Plexus](https://github.com/mcowger/plexus) AI
|
|
|
8
8
|
|---|---|---|
|
|
9
9
|
| `plexus-pi` | [pi](https://github.com/earendil-works/pi) | `@mcowger/pi-plexus` |
|
|
10
10
|
| `plexus-opencode` | [OpenCode](https://opencode.ai) | `@mcowger/opencode-plexus` |
|
|
11
|
+
| `plexus-oh-my-pi` | [Oh My Pi](https://github.com/can1357/oh-my-pi) | `@mcowger/oh-my-pi-plexus` |
|
|
11
12
|
|
|
12
13
|
## Prerequisites
|
|
13
14
|
|
|
@@ -84,6 +85,41 @@ Then reference the built artifact in `opencode.json`:
|
|
|
84
85
|
|
|
85
86
|
---
|
|
86
87
|
|
|
88
|
+
### Oh My Pi
|
|
89
|
+
|
|
90
|
+
Oh My Pi is a fork of pi and is **not** wire-compatible with `plexus-pi` in every respect (different runtime packages, extension manifest field, and built-in model registry — see [AGENTS.md](AGENTS.md)), so it has its own adapter package.
|
|
91
|
+
|
|
92
|
+
#### Option 1 — npm (recommended)
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
cd ~/.omp/agent/extensions
|
|
96
|
+
npm install @mcowger/oh-my-pi-plexus
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
#### Option 2 — git clone into the extensions directory
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
git clone https://github.com/mcowger/plexus-agent-plugins ~/.omp/agent/extensions/plexus-agent-plugins
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
#### Option 3 — git clone anywhere + settings.json
|
|
106
|
+
|
|
107
|
+
```sh
|
|
108
|
+
git clone https://github.com/mcowger/plexus-agent-plugins ~/code/plexus-agent-plugins
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Then register the path in `~/.omp/agent/settings.json`:
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"extensions": [
|
|
116
|
+
"~/code/plexus-agent-plugins/packages/plexus-oh-my-pi"
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
87
123
|
## First-time setup
|
|
88
124
|
|
|
89
125
|
### pi
|
|
@@ -105,7 +141,7 @@ To force a model refresh:
|
|
|
105
141
|
/plexus refresh
|
|
106
142
|
```
|
|
107
143
|
|
|
108
|
-
|
|
144
|
+
Select a Plexus model explicitly for the current session. With no model ID, Pi opens a selector; you can also pass the exact Plexus model ID directly. This explicit choice is not applied automatically when starting a new session:
|
|
109
145
|
|
|
110
146
|
```
|
|
111
147
|
/plexus set-default-model
|
|
@@ -114,6 +150,16 @@ Set the model Pi should use by default. With no model ID, Pi opens a selector; y
|
|
|
114
150
|
|
|
115
151
|
Use `/login plexus` for setup and `/logout plexus` to remove stored credentials.
|
|
116
152
|
|
|
153
|
+
### Oh My Pi
|
|
154
|
+
|
|
155
|
+
Run inside Oh My Pi using the native login flow:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
/login plexus
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Same prompts and `/plexus refresh` / `/plexus set-default-model` commands as pi (see above) — `plexus-oh-my-pi` mirrors the pi adapter's behavior, adjusted for Oh My Pi's own runtime packages and built-in model registry.
|
|
162
|
+
|
|
117
163
|
### OpenCode
|
|
118
164
|
|
|
119
165
|
Run inside OpenCode:
|
|
@@ -163,7 +209,7 @@ export PLEXUS_API_KEY=your-api-key
|
|
|
163
209
|
|
|
164
210
|
```
|
|
165
211
|
~/.pi/agent/extensions/plexus/
|
|
166
|
-
config.json # base URL and
|
|
212
|
+
config.json # base URL and model preference metadata
|
|
167
213
|
plexus-models-cache.json # last-fetched model list (startup cache)
|
|
168
214
|
plexus-models-response.json # raw API response (diagnostics)
|
|
169
215
|
plexus.log # extension activity log
|
|
@@ -171,6 +217,18 @@ export PLEXUS_API_KEY=your-api-key
|
|
|
171
217
|
|
|
172
218
|
The API key is stored through pi's own auth storage. `PLEXUS_API_URL` or `PLEXUS_BASE_URL` can be used as an environment override.
|
|
173
219
|
|
|
220
|
+
### Oh My Pi
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
~/.omp/agent/extensions/plexus/
|
|
224
|
+
config.json # base URL and model preference metadata
|
|
225
|
+
plexus-models-cache.json # last-fetched model list (startup cache)
|
|
226
|
+
plexus-models-response.json # raw API response (diagnostics)
|
|
227
|
+
plexus.log # extension activity log
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Same layout as pi, rooted under `~/.omp/agent` instead of `~/.pi/agent` since Oh My Pi resolves its own agent directory.
|
|
231
|
+
|
|
174
232
|
### OpenCode
|
|
175
233
|
|
|
176
234
|
```
|
|
@@ -202,6 +260,14 @@ packages/
|
|
|
202
260
|
cache.ts # model cache I/O
|
|
203
261
|
log.ts # append-only log
|
|
204
262
|
package.json # declares pi.extensions entry point
|
|
263
|
+
plexus-oh-my-pi/ # Oh My Pi host adapter (fork of pi; own runtime packages + catalog)
|
|
264
|
+
src/
|
|
265
|
+
extension.ts # entry point: commands, session refresh, auth flow
|
|
266
|
+
mapper.ts # PlexusModelDescriptor → Oh My Pi ProviderModelConfig
|
|
267
|
+
config.ts # base URL / default model config I/O
|
|
268
|
+
cache.ts # model cache I/O
|
|
269
|
+
log.ts # append-only log
|
|
270
|
+
package.json # declares omp.extensions entry point
|
|
205
271
|
plexus-opencode/ # OpenCode plugin adapter
|
|
206
272
|
src/
|
|
207
273
|
plugin.ts # Plugin export: config hook, provider hook, auth handler
|
|
@@ -237,7 +303,7 @@ Models with a falsy `id` are skipped. Missing metadata falls back to safe defaul
|
|
|
237
303
|
|
|
238
304
|
## Adapter behavior
|
|
239
305
|
|
|
240
|
-
- **pi** refreshes on session start and through `/plexus refresh
|
|
306
|
+
- **pi** refreshes on session start and through `/plexus refresh`, without changing the model selected for the session. It accepts either root URLs or URLs ending in `/v1` and normalizes them before calling Plexus.
|
|
241
307
|
- **OpenCode** seeds the provider from the on-disk cache (or a placeholder model) once, during config loading — OpenCode's `provider.models` hook never fires for custom providers, so there is no live discovery at startup. Run `/plexus-refresh` to force a live fetch and rewrite the cache; because OpenCode has no way to hot-reload a custom provider's model list mid-session, a restart is required afterward to see the refreshed models in the picker.
|
|
242
308
|
- OpenCode models retain their upstream model ID, SDK dialect, release date, and reasoning metadata so OpenCode can generate its native GPT, Claude, Gemini, and OpenAI-compatible variants and apply its current request transforms. DeepSeek models also preserve `reasoning_content` across tool-call turns.
|
|
243
309
|
- OpenCode uses a 250K-token context window when Plexus supplies no context metadata; its output fallback remains 20% of that window.
|
package/dist/extension.js
CHANGED
|
@@ -350,9 +350,6 @@ function getBaseUrl() {
|
|
|
350
350
|
const raw = getRawBaseUrl();
|
|
351
351
|
return raw ? normalizeApiBase(raw) : null;
|
|
352
352
|
}
|
|
353
|
-
function getDefaultModel() {
|
|
354
|
-
return getConfigSync().defaultModel ?? null;
|
|
355
|
-
}
|
|
356
353
|
|
|
357
354
|
// src/cache.ts
|
|
358
355
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
@@ -506,10 +503,9 @@ function plexusExtension(pi) {
|
|
|
506
503
|
log("session_start", { hasApiKey: !!apiKey, baseUrl });
|
|
507
504
|
if (!apiKey || !baseUrl) {
|
|
508
505
|
log("session_start: no auth configured, skipping refresh");
|
|
509
|
-
await trySetDefaultModel(pi, startupModels, ctx);
|
|
510
506
|
return;
|
|
511
507
|
}
|
|
512
|
-
await doRefresh(pi, apiKey, ctx
|
|
508
|
+
await doRefresh(pi, apiKey, ctx);
|
|
513
509
|
});
|
|
514
510
|
pi.registerCommand("plexus", {
|
|
515
511
|
description: "Plexus provider commands: refresh, set-default-model (setup: /login plexus)",
|
|
@@ -562,7 +558,7 @@ function createPlexusLoginProvider(pi) {
|
|
|
562
558
|
throw new Error("Plexus API key is required.");
|
|
563
559
|
await saveBaseUrl(baseUrl);
|
|
564
560
|
callbacks.onProgress?.("Refreshing Plexus models...");
|
|
565
|
-
await doRefresh(pi, apiKey, null
|
|
561
|
+
await doRefresh(pi, apiKey, null);
|
|
566
562
|
return {
|
|
567
563
|
access: apiKey,
|
|
568
564
|
refresh: apiKey,
|
|
@@ -592,7 +588,7 @@ async function handleRefresh(pi, ctx) {
|
|
|
592
588
|
return;
|
|
593
589
|
}
|
|
594
590
|
ctx.ui.notify("Refreshing Plexus models\u2026", "info");
|
|
595
|
-
await doRefresh(pi, apiKey, ctx
|
|
591
|
+
await doRefresh(pi, apiKey, ctx);
|
|
596
592
|
}
|
|
597
593
|
async function handleSetDefaultModel(pi, ctx, requestedModelId) {
|
|
598
594
|
let modelId = requestedModelId;
|
|
@@ -616,9 +612,9 @@ async function handleSetDefaultModel(pi, ctx, requestedModelId) {
|
|
|
616
612
|
await saveDefaultModel(model.id);
|
|
617
613
|
const registryModel = ctx.modelRegistry.find(PROVIDER_NAME, model.id) ?? model;
|
|
618
614
|
const active = await pi.setModel(registryModel);
|
|
619
|
-
ctx.ui.notify(active ? `
|
|
615
|
+
ctx.ui.notify(active ? `Plexus model selected: ${model.id}.` : `Plexus model ${model.id} was saved but could not be selected in this session.`, active ? "info" : "warning");
|
|
620
616
|
}
|
|
621
|
-
async function doRefresh(pi, apiKey, ctx
|
|
617
|
+
async function doRefresh(pi, apiKey, ctx) {
|
|
622
618
|
const modelsUrl = getModelsUrl();
|
|
623
619
|
const baseUrl = getBaseUrl();
|
|
624
620
|
if (!modelsUrl || !baseUrl) {
|
|
@@ -644,8 +640,6 @@ async function doRefresh(pi, apiKey, ctx, setDefault) {
|
|
|
644
640
|
log("doRefresh: registered", { count: piModels.length });
|
|
645
641
|
if (ctx)
|
|
646
642
|
ctx.ui.notify(`Refreshed ${piModels.length} Plexus models`, "info");
|
|
647
|
-
if (setDefault)
|
|
648
|
-
await trySetDefaultModel(pi, piModels, ctx);
|
|
649
643
|
} catch (error) {
|
|
650
644
|
log("doRefresh: failed", { error: String(error) });
|
|
651
645
|
if (ctx) {
|
|
@@ -653,19 +647,6 @@ async function doRefresh(pi, apiKey, ctx, setDefault) {
|
|
|
653
647
|
}
|
|
654
648
|
}
|
|
655
649
|
}
|
|
656
|
-
async function trySetDefaultModel(pi, models, ctx) {
|
|
657
|
-
const defaultModelId = getDefaultModel();
|
|
658
|
-
if (!defaultModelId)
|
|
659
|
-
return;
|
|
660
|
-
const model = models.find((m) => m.id === defaultModelId);
|
|
661
|
-
if (!model) {
|
|
662
|
-
log("trySetDefaultModel: model not found", { defaultModelId });
|
|
663
|
-
return;
|
|
664
|
-
}
|
|
665
|
-
const registryModel = ctx?.modelRegistry.find(PROVIDER_NAME, defaultModelId) ?? model;
|
|
666
|
-
const ok = await pi.setModel(registryModel);
|
|
667
|
-
log("trySetDefaultModel", { defaultModelId, ok });
|
|
668
|
-
}
|
|
669
650
|
export {
|
|
670
651
|
plexusExtension as default
|
|
671
652
|
};
|