@mcowger/oh-my-pi-plexus 1.4.11 → 1.5.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 +7 -138
  2. package/dist/extension.js +389337 -68153
  3. package/package.json +8 -8
package/README.md CHANGED
@@ -7,7 +7,6 @@ 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
@@ -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.
@@ -161,69 +128,6 @@ Run inside Oh My Pi using the native login flow:
161
128
 
162
129
  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
130
 
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
- ---
226
-
227
131
  ## Configuration files
228
132
 
229
133
  ### pi
@@ -250,16 +154,6 @@ The API key is stored through pi's own auth storage. `PLEXUS_API_URL` or `PLEXUS
250
154
 
251
155
  Same layout as pi, rooted under `~/.omp/agent` instead of `~/.pi/agent` since Oh My Pi resolves its own agent directory.
252
156
 
253
- ### OpenCode
254
-
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)
259
- ```
260
-
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.
262
-
263
157
  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.
264
158
 
265
159
  ---
@@ -290,19 +184,6 @@ All plugin packages support suppressing models by name or pattern so undesired m
290
184
  }
291
185
  ```
292
186
 
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
187
  ---
307
188
 
308
189
  ## Package layout
@@ -331,17 +212,6 @@ packages/
331
212
  cache.ts # model cache I/O
332
213
  log.ts # append-only log
333
214
  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
215
  ```
346
216
 
347
217
  `plexus-models` has zero imports from any agent framework. Each host adapter imports it via a relative path.
@@ -355,9 +225,8 @@ The `/v1/models` endpoint returns an OpenRouter-style list. These fields drive h
355
225
  | `preferred_api` | String or array. First recognized value selects the host API dialect. |
356
226
  | `supported_parameters` | `reasoning`, `include_reasoning`, or `reasoning_effort` enables reasoning support. |
357
227
  | `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
228
  | `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. |
229
+ | `pricing.tiers` | Alternate rates above `input_tokens_above`; mapped to native pi context pricing tiers. |
361
230
  | `top_provider` | Supplies context and output token limits when present. |
362
231
  | `pi_provider` / `pi_model` | Lets the pi adapter reuse built-in pi compat, headers, and thinking-level metadata. |
363
232
  | `pi_options` | pi compat overrides. These win over heuristic and built-in metadata. |
@@ -367,11 +236,7 @@ Models with a falsy `id` are skipped. Missing metadata falls back to safe defaul
367
236
  ## Adapter behavior
368
237
 
369
238
  - **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.
239
+ - The active adapters convert Plexus's per-token base and tier rates to the per-million-token units expected by their host.
375
240
 
376
241
  ## Development
377
242
 
@@ -381,6 +246,10 @@ After cloning, install dependencies to set up the pre-commit hook:
381
246
  bun install
382
247
  ```
383
248
 
384
- The pre-commit hook (via lefthook) rebuilds both dist artifacts automatically whenever source files change. After committing, reload/restart your agent.
249
+ The pre-commit hook (via lefthook) rebuilds the active dist artifacts automatically whenever source files change. After committing, reload/restart your agent.
250
+
251
+ ## Archived adapters
252
+
253
+ `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
254
 
386
255
  To add support for a new host agent, see [AGENTS.md](AGENTS.md).