@mcowger/oh-my-pi-plexus 1.4.12 → 1.6.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.
Files changed (3) hide show
  1. package/README.md +29 -163
  2. package/dist/extension.js +389361 -68305
  3. package/package.json +8 -8
package/README.md CHANGED
@@ -7,13 +7,12 @@ Exposes models from a self-hosted [Plexus](https://github.com/mcowger/plexus) AI
7
7
  | Package | Agent | npm |
8
8
  |---|---|---|
9
9
  | `plexus-pi` | [pi](https://github.com/earendil-works/pi) | `@mcowger/pi-plexus` |
10
- | `plexus-opencode` | [OpenCode](https://opencode.ai) | `@mcowger/opencode-plexus` |
11
10
  | `plexus-oh-my-pi` | [Oh My Pi](https://github.com/can1357/oh-my-pi) | `@mcowger/oh-my-pi-plexus` |
12
11
 
13
12
  ## Prerequisites
14
13
 
15
14
  - A running Plexus instance
16
- - pi 0.81.0 or later (for `plexus-pi`)
15
+ - pi 0.85.1 or later (for `plexus-pi`)
17
16
 
18
17
  ## Installation
19
18
 
@@ -54,38 +53,6 @@ Then register the path in `~/.pi/agent/settings.json`:
54
53
 
55
54
  ---
56
55
 
57
- ### OpenCode
58
-
59
- #### Option 1 — npm (recommended)
60
-
61
- ```sh
62
- npm install -g @mcowger/opencode-plexus
63
- ```
64
-
65
- Then add the plugin to your `opencode.json`:
66
-
67
- ```json
68
- {
69
- "plugins": ["@mcowger/opencode-plexus"]
70
- }
71
- ```
72
-
73
- #### Option 2 — path reference
74
-
75
- ```sh
76
- git clone https://github.com/mcowger/plexus-agent-plugins ~/code/plexus-agent-plugins
77
- ```
78
-
79
- Then reference the built artifact in `opencode.json`:
80
-
81
- ```json
82
- {
83
- "plugins": ["~/code/plexus-agent-plugins/packages/plexus-opencode/dist/index.js"]
84
- }
85
- ```
86
-
87
- ---
88
-
89
56
  ### Oh My Pi
90
57
 
91
58
  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.
@@ -142,13 +109,14 @@ To force a model refresh:
142
109
  /plexus refresh
143
110
  ```
144
111
 
145
- 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:
112
+ Inspect the effective URL, authentication availability, and catalog source without exposing a credential:
146
113
 
147
114
  ```
148
- /plexus set-default-model
149
- /plexus set-default-model claude-sonnet-4-5
115
+ /plexus status
150
116
  ```
151
117
 
118
+ Select a Plexus model in `/model`. Save its startup default with the host's normal model-picker action; Plexus does not maintain a separate default-model setting.
119
+
152
120
  Use `/login plexus` for setup and `/logout plexus` to remove stored credentials.
153
121
 
154
122
  ### Oh My Pi
@@ -159,108 +127,32 @@ Run inside Oh My Pi using the native login flow:
159
127
  /login plexus
160
128
  ```
161
129
 
162
- 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.
163
-
164
- ### OpenCode
165
-
166
- Run inside OpenCode:
167
-
168
- ```
169
- /connect
170
- ```
171
-
172
- Select **Plexus** and enter your base URL and API key. OpenCode has no live model-discovery hook for custom providers, so the model list is seeded from the on-disk cache at startup. Run `/plexus-refresh` to force a live fetch from Plexus and rewrite the cache, then restart OpenCode to pick up the refreshed list:
173
-
174
- ```
175
- /plexus-refresh
176
- ```
177
-
178
- You may enter either the Plexus root URL or the `/v1` API base URL:
179
-
180
- ```text
181
- https://plexus.example.com
182
- https://plexus.example.com/v1
183
- ```
184
-
185
- The plugins normalize either form to the Plexus root URL for storage and derive `/v1` paths when calling the API.
186
-
187
- OpenCode stores the API key in its native auth store and stores the Plexus base URL as auth metadata on that connection. Existing `provider.plexus.options.plexusBaseURL` config is still honored as a fallback.
188
-
189
- `provider.plexus.options.baseURL` is also accepted as input-only compatibility config. Some external clients read OpenCode config files directly and only recognize `options.baseURL`. The plugin normalizes that value for Plexus discovery and then removes it from OpenCode's in-memory provider options, so individual models keep their own `/v1` or `/v1beta` endpoints instead of being overridden by a provider-wide URL.
190
-
191
- For an OpenChamber-compatible OpenCode config, omit `options.apiKey` and authenticate through `/connect`:
192
-
193
- ```json
194
- {
195
- "provider": {
196
- "plexus": {
197
- "options": {
198
- "baseURL": "https://plexus.example.com/v1"
199
- }
200
- }
201
- }
202
- }
203
- ```
204
-
205
- Then run `/connect`, select **Plexus**, and authenticate against the same Plexus server. A raw unresolved `options.apiKey` value in this file can override the resolved runtime credential used by OpenChamber, including OpenCode `{env:NAME}` templates that OpenChamber does not expand when extra characters follow the template.
206
-
207
- The plugin publishes models with `/v1` endpoints before `/v1beta` models. This ordering helps OpenChamber versions that derive a provider-wide endpoint from the first runtime model; it does not change model endpoints or OpenCode routing. Gemini models still use `/v1beta` through `@ai-sdk/google`.
208
-
209
- The OpenCode plugin respects each model's `preferred_api` value and routes models through the matching SDK/API shape:
210
-
211
- - `chat_completions` / `openai-completions` → OpenAI-compatible chat completions
212
- - `responses` / `openai-responses` → OpenAI Responses API
213
- - `messages` / `anthropic-messages` → Anthropic Messages API
214
- - `gemini` / `google-generative-ai` → Google Gemini API
215
-
216
- You can also pre-configure via environment variables:
217
-
218
- ```sh
219
- export PLEXUS_API_URL=https://plexus.example.com
220
- export PLEXUS_API_KEY=your-api-key
221
- ```
222
-
223
- `PLEXUS_BASE_URL` is also accepted for compatibility; `PLEXUS_API_URL` wins when both are set.
224
-
225
- ---
130
+ Same prompts and `/plexus refresh` / `/plexus status` commands as pi (see above). Save the selected startup model through OMP's normal `/model` or `/models` flow.
226
131
 
227
132
  ## Configuration files
228
133
 
229
- ### pi
230
-
231
- ```
232
- ~/.pi/agent/extensions/plexus/
233
- config.json # base URL and model preference metadata
234
- plexus-models-cache.json # last-fetched model list (startup cache)
235
- plexus-models-response.json # raw API response (diagnostics)
236
- plexus.log # extension activity log
237
- ```
238
-
239
- 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.
134
+ ### Connection state
240
135
 
241
- ### Oh My Pi
136
+ Each adapter stores only non-secret Plexus settings in its own `config.json`:
242
137
 
243
- ```
244
- ~/.omp/agent/extensions/plexus/
245
- config.json # base URL and model preference metadata
246
- plexus-models-cache.json # last-fetched model list (startup cache)
247
- plexus-models-response.json # raw API response (diagnostics)
248
- plexus.log # extension activity log
138
+ ```text
139
+ <agent-dir>/extensions/plexus/config.json # base URL and optional model suppression
249
140
  ```
250
141
 
251
- Same layout as pi, rooted under `~/.omp/agent` instead of `~/.pi/agent` since Oh My Pi resolves its own agent directory.
142
+ Credentials stay in the host credential store (`auth.json` for Pi, `agent.db` for OMP). Model catalogs stay in the host model registry/store. The extension no longer writes a second model cache, ETag file, raw API response, or default-model preference.
252
143
 
253
- ### OpenCode
144
+ At runtime, configuration resolves as follows:
254
145
 
255
- ```
256
- ~/.local/share/opencode/plugins/plexus/
257
- models-cache.json # last-fetched model list (startup cache)
258
- models-raw.json # raw API response (diagnostics)
146
+ ```text
147
+ base URL: PLEXUS_API_URL → PLEXUS_BASE_URL → saved Plexus base URL
148
+ API key: host credential store → PLEXUS_API_KEY process fallback
149
+ catalog: host model store → live Plexus refresh
150
+ startup model: host model-picker preference
259
151
  ```
260
152
 
261
- The API key is stored through OpenCode's auth flow, and the Plexus base URL is stored as auth metadata. `PLEXUS_API_URL`, `PLEXUS_BASE_URL`, and `PLEXUS_API_KEY` can be used as environment overrides.
153
+ `PLEXUS_API_URL` and `PLEXUS_BASE_URL` are process-only URL overrides; `PLEXUS_API_KEY` is a process-only credential fallback. None are persisted. `/plexus status` reports the effective URL source, whether auth is available, and catalog state without exposing credentials.
262
154
 
263
- Both adapters also accept pi-style environment interpolation in configured strings, such as `${PLEXUS_API_URL}` or `$PLEXUS_API_KEY`. This is useful when checking non-secret config into an agent config file while keeping the actual values in the environment.
155
+ Plexus accepts a root URL or a `/v1` API URL. The adapter normalizes that only for the Plexus discovery request. Each model then receives its own API-specific base URL: OpenAI stays on `/v1`, Anthropic uses the root, and Google uses `/v1beta`.
264
156
 
265
157
  ---
266
158
 
@@ -290,19 +182,6 @@ All plugin packages support suppressing models by name or pattern so undesired m
290
182
  }
291
183
  ```
292
184
 
293
- - **OpenCode config**: Add `suppressModels` (or `suppress`) under `provider.plexus.options` in `opencode.json`:
294
- ```json
295
- {
296
- "provider": {
297
- "plexus": {
298
- "options": {
299
- "suppressModels": ["gpt-3.5*", "claude-2*"]
300
- }
301
- }
302
- }
303
- }
304
- ```
305
-
306
185
  ---
307
186
 
308
187
  ## Package layout
@@ -319,29 +198,17 @@ packages/
319
198
  src/
320
199
  extension.ts # entry point: commands, session refresh, auth flow
321
200
  mapper.ts # PlexusModelDescriptor → pi ProviderModelConfig
322
- config.ts # base URL / default model config I/O
323
- cache.ts # model cache I/O
201
+ config.ts # base URL / suppression config I/O
202
+ cache.ts # Pi native model-store restore
324
203
  log.ts # append-only log
325
204
  package.json # declares pi.extensions entry point
326
205
  plexus-oh-my-pi/ # Oh My Pi host adapter (fork of pi; own runtime packages + catalog)
327
206
  src/
328
207
  extension.ts # entry point: commands, session refresh, auth flow
329
208
  mapper.ts # PlexusModelDescriptor → Oh My Pi ProviderModelConfig
330
- config.ts # base URL / default model config I/O
331
- cache.ts # model cache I/O
209
+ config.ts # base URL / suppression config I/O
332
210
  log.ts # append-only log
333
211
  package.json # declares omp.extensions entry point
334
- plexus-opencode/ # OpenCode plugin adapter
335
- src/
336
- plugin.ts # Plugin export: config hook, provider hook, auth handler
337
- mapper.ts # PlexusApiModel → OpenCode ConfigModel
338
- cache.ts # model cache I/O
339
- config-store.ts # resolveConfig, readStoredAuth
340
- log.ts # logger via OpenCode SDK
341
- constants.ts # provider ID, env var names, timeouts
342
- url.ts # URL helpers (trimURL, apiBase, modelsUrl)
343
- index.ts # barrel export
344
- package.json # npm package manifest
345
212
  ```
346
213
 
347
214
  `plexus-models` has zero imports from any agent framework. Each host adapter imports it via a relative path.
@@ -355,9 +222,8 @@ The `/v1/models` endpoint returns an OpenRouter-style list. These fields drive h
355
222
  | `preferred_api` | String or array. First recognized value selects the host API dialect. |
356
223
  | `supported_parameters` | `reasoning`, `include_reasoning`, or `reasoning_effort` enables reasoning support. |
357
224
  | `architecture.input_modalities` | Enables text/image/audio/video/pdf support where the host supports it. |
358
- | `architecture.output_modalities` | Non-text-only output models are filtered from OpenCode chat providers. |
359
225
  | `pricing` | Converted into host per-million-token cost metadata. Plexus returns per-token prices. |
360
- | `pricing.tiers` | Alternate rates above `input_tokens_above`; mapped to native pi and OpenCode context pricing tiers. |
226
+ | `pricing.tiers` | Alternate rates above `input_tokens_above`; mapped to native pi context pricing tiers. |
361
227
  | `top_provider` | Supplies context and output token limits when present. |
362
228
  | `pi_provider` / `pi_model` | Lets the pi adapter reuse built-in pi compat, headers, and thinking-level metadata. |
363
229
  | `pi_options` | pi compat overrides. These win over heuristic and built-in metadata. |
@@ -367,11 +233,7 @@ Models with a falsy `id` are skipped. Missing metadata falls back to safe defaul
367
233
  ## Adapter behavior
368
234
 
369
235
  - **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.
370
- - **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.
371
- - 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.
372
- - OpenCode uses a 250K-token context window when Plexus supplies no context metadata; its output fallback remains 20% of that window.
373
- - OpenCode moves `/v1beta` models after `/v1` models in published model order. Model endpoints and per-model SDK selection are unchanged.
374
- - Both adapters convert Plexus's per-token base and tier rates to the per-million-token units expected by their host.
236
+ - The active adapters convert Plexus's per-token base and tier rates to the per-million-token units expected by their host.
375
237
 
376
238
  ## Development
377
239
 
@@ -381,6 +243,10 @@ After cloning, install dependencies to set up the pre-commit hook:
381
243
  bun install
382
244
  ```
383
245
 
384
- The pre-commit hook (via lefthook) rebuilds both dist artifacts automatically whenever source files change. After committing, reload/restart your agent.
246
+ The pre-commit hook (via lefthook) rebuilds the active dist artifacts automatically whenever source files change. After committing, reload/restart your agent.
247
+
248
+ ## Archived adapters
249
+
250
+ `packages/deprecated/plexus-opencode` is preserved for reference but is archived. It is private and excluded from builds, tests, hooks, version sync, and publishing. In my testing, OpenCode was notably slower and less token-efficient than pi and Oh My Pi.
385
251
 
386
252
  To add support for a new host agent, see [AGENTS.md](AGENTS.md).