@mcowger/pi-plexus 0.6.0 → 0.7.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 (2) hide show
  1. package/README.md +98 -17
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,32 +2,39 @@
2
2
 
3
3
  Exposes models from a self-hosted [Plexus](https://github.com/mcowger/plexus) AI proxy as a first-class provider inside AI coding agents. Models appear in the agent's model picker with correct wire-protocol behavior, as if they were natively supported providers.
4
4
 
5
+ ## Supported agents
6
+
7
+ | Package | Agent | npm |
8
+ |---|---|---|
9
+ | `plexus-pi` | [pi](https://github.com/earendil-works/pi) | `@mcowger/pi-plexus` |
10
+ | `plexus-opencode` | [OpenCode](https://opencode.ai) | `@mcowger/opencode-plexus` |
11
+
5
12
  ## Prerequisites
6
13
 
7
14
  - A running Plexus instance
8
15
 
9
16
  ## Installation
10
17
 
11
- The built `dist/extension.js` is committed to the repo, so no build step is needed for any install method.
18
+ The built dist artifact is committed to the repo, so no build step is needed for any install method.
19
+
20
+ ---
21
+
22
+ ### pi
12
23
 
13
- ### Option 1 — npm (recommended)
24
+ #### Option 1 — npm (recommended)
14
25
 
15
26
  ```sh
16
27
  cd ~/.pi/agent/extensions
17
28
  npm install @mcowger/pi-plexus
18
29
  ```
19
30
 
20
- pi auto-discovers packages under `~/.pi/agent/extensions/` that have a `pi.extensions` field in their `package.json`.
21
-
22
- ### Option 2 — git clone into the extensions directory
31
+ #### Option 2 — git clone into the extensions directory
23
32
 
24
33
  ```sh
25
34
  git clone https://github.com/mcowger/plexus-agent-plugins ~/.pi/agent/extensions/plexus-agent-plugins
26
35
  ```
27
36
 
28
- pi will find `packages/plexus-pi/` inside that directory and load `dist/extension.js`.
29
-
30
- ### Option 3 — git clone anywhere + settings.json
37
+ #### Option 3 — git clone anywhere + settings.json
31
38
 
32
39
  ```sh
33
40
  git clone https://github.com/mcowger/plexus-agent-plugins ~/code/plexus-agent-plugins
@@ -43,9 +50,45 @@ Then register the path in `~/.pi/agent/settings.json`:
43
50
  }
44
51
  ```
45
52
 
53
+ ---
54
+
55
+ ### OpenCode
56
+
57
+ #### Option 1 — npm (recommended)
58
+
59
+ ```sh
60
+ npm install -g @mcowger/opencode-plexus
61
+ ```
62
+
63
+ Then add the plugin to your `opencode.json`:
64
+
65
+ ```json
66
+ {
67
+ "plugins": ["@mcowger/opencode-plexus"]
68
+ }
69
+ ```
70
+
71
+ #### Option 2 — path reference
72
+
73
+ ```sh
74
+ git clone https://github.com/mcowger/plexus-agent-plugins ~/code/plexus-agent-plugins
75
+ ```
76
+
77
+ Then reference the built artifact in `opencode.json`:
78
+
79
+ ```json
80
+ {
81
+ "plugins": ["~/code/plexus-agent-plugins/packages/plexus-opencode/dist/index.js"]
82
+ }
83
+ ```
84
+
85
+ ---
86
+
46
87
  ## First-time setup
47
88
 
48
- On first use, run the login command inside pi:
89
+ ### pi
90
+
91
+ Run inside pi:
49
92
 
50
93
  ```
51
94
  /plexus login
@@ -57,19 +100,34 @@ You will be prompted for:
57
100
  - **Plexus API key**
58
101
  - **Default model** (optional)
59
102
 
60
- Credentials are stored in pi's standard `auth.json` (API key) and a small `config.json` (base URL). Models are fetched immediately and cached for fast startup.
103
+ To force a model refresh:
61
104
 
62
- After login, models appear in the model picker and refresh automatically on every new session.
105
+ ```
106
+ /plexus refresh
107
+ ```
108
+
109
+ ### OpenCode
63
110
 
64
- To force a refresh at any time:
111
+ Run inside OpenCode:
65
112
 
66
113
  ```
67
- /plexus refresh
114
+ /connect
68
115
  ```
69
116
 
117
+ Select **Plexus** and enter your base URL and API key. Models are loaded immediately and cached for fast startup on subsequent sessions.
118
+
119
+ You can also pre-configure via environment variables:
120
+
121
+ ```sh
122
+ export PLEXUS_BASE_URL=https://plexus.example.com
123
+ export PLEXUS_API_KEY=your-api-key
124
+ ```
125
+
126
+ ---
127
+
70
128
  ## Configuration files
71
129
 
72
- All files live under the agent's data directory:
130
+ ### pi
73
131
 
74
132
  ```
75
133
  ~/.pi/agent/extensions/plexus/
@@ -79,7 +137,19 @@ All files live under the agent's data directory:
79
137
  plexus.log # extension activity log
80
138
  ```
81
139
 
82
- The API key is stored in pi's own `~/.pi/agent/auth.json` alongside all other provider credentials — it is never written to a separate file.
140
+ The API key is stored in pi's own credential store (`auth.json`) — never in a separate file.
141
+
142
+ ### OpenCode
143
+
144
+ ```
145
+ ~/.local/share/opencode/plugins/plexus/
146
+ models-cache.json # last-fetched model list (startup cache)
147
+ models-raw.json # raw API response (diagnostics)
148
+ ```
149
+
150
+ The API key is stored in OpenCode's own credential store — never in a separate file.
151
+
152
+ ---
83
153
 
84
154
  ## Package layout
85
155
 
@@ -98,9 +168,20 @@ packages/
98
168
  cache.ts # model cache I/O
99
169
  log.ts # append-only log
100
170
  package.json # declares pi.extensions entry point
171
+ plexus-opencode/ # OpenCode plugin adapter
172
+ src/
173
+ plugin.ts # Plugin export: config hook, auth handler
174
+ mapper.ts # PlexusApiModel → OpenCode ConfigModel
175
+ cache.ts # model cache I/O
176
+ config-store.ts # resolveConfig, persistToGlobalConfig
177
+ log.ts # logger via OpenCode SDK
178
+ constants.ts # provider ID, env var names, timeouts
179
+ url.ts # URL helpers (trimURL, apiBase, modelsUrl)
180
+ index.ts # barrel export
181
+ package.json # npm package manifest
101
182
  ```
102
183
 
103
- `plexus-models` has zero imports from any agent framework. `plexus-pi` imports it via a relative path.
184
+ `plexus-models` has zero imports from any agent framework. Each host adapter imports it via a relative path.
104
185
 
105
186
  ## Development
106
187
 
@@ -110,6 +191,6 @@ After cloning, install dependencies to set up the pre-commit hook:
110
191
  bun install
111
192
  ```
112
193
 
113
- The pre-commit hook (via lefthook) rebuilds `dist/extension.js` automatically whenever source files change, so the committed artifact stays in sync. After committing, reload the extension in pi with `/reload` or restart the agent.
194
+ The pre-commit hook (via lefthook) rebuilds both dist artifacts automatically whenever source files change. After committing, reload/restart your agent.
114
195
 
115
196
  To add support for a new host agent, see [AGENTS.md](AGENTS.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcowger/pi-plexus",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Plexus AI proxy plugin for the pi coding agent",
5
5
  "type": "module",
6
6
  "files": [