regent-code 3.0.2 → 3.0.3

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.
@@ -6,7 +6,7 @@ If the package is published to npm, both the plugin and the MCP server install
6
6
  with a single command against any existing `opencode.json` / `opencode.jsonc`:
7
7
 
8
8
  ```bash
9
- npx -y regent-code@3.0.1 install
9
+ npx -y regent-code@3.0.3 install
10
10
  ```
11
11
 
12
12
  Patches the project config (or the global `~/.config/opencode/` config) to add
@@ -19,7 +19,7 @@ Patches the project config (or the global `~/.config/opencode/` config) to add
19
19
  ```jsonc
20
20
  {
21
21
  "$schema": "https://opencode.ai/config.json",
22
- "plugins": ["regent-code@git+https://github.com/nathwn12/regent-code.git#v3.0.1"],
22
+ "plugins": ["regent-code@git+https://github.com/nathwn12/regent-code.git#v3.0.3"],
23
23
  }
24
24
  ```
25
25
 
@@ -32,7 +32,7 @@ Patches the project config (or the global `~/.config/opencode/` config) to add
32
32
  }
33
33
  ```
34
34
 
35
- The pinned version is recommended. Use the unpinned branch only when you intentionally want the latest changes. The `v3.0.1` git tag must be pushed to GitHub before the pinned spec resolves.
35
+ The pinned version is recommended. Use the unpinned branch only when you intentionally want the latest changes. The `v3.0.3` git tag must be pushed to GitHub before the pinned spec resolves.
36
36
 
37
37
  ## Single-source rule (duplicate plugin ID)
38
38
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "type": "module",
3
3
  "dependencies": {
4
- "@opencode-ai/plugin": "^0.0.0-beta-18414"
4
+ "@opencode-ai/plugin": "beta"
5
5
  }
6
6
  }
package/README.md CHANGED
@@ -51,26 +51,26 @@ Add Regent to your OpenCode configuration:
51
51
  ```jsonc
52
52
  {
53
53
  "$schema": "https://opencode.ai/config.json",
54
- "plugins": ["regent-code@git+https://github.com/nathwn12/regent-code.git#v3.0.2"],
54
+ "plugins": ["regent-code@git+https://github.com/nathwn12/regent-code.git#v3.0.3"],
55
55
  }
56
56
  ```
57
57
 
58
58
  ### Version compatibility (dynamic, not pinned)
59
59
 
60
- Since v3.0.2 regent-code does **not** pin a specific OpenCode beta. Both the
61
- plugin and the MCP server depend on `@opencode-ai/client` and
62
- `@opencode-ai/plugin` through a floating beta range
63
- (`>=0.0.0-beta-18314 <0.0.0-beta-99999`) that resolves the newest beta on every
64
- install matching whatever service version that machine runs, no manual pin
65
- updates. The dispatch code is *runtime-adaptive* on top: generation results
60
+ Since v3.0.3 regent-code resolves `@opencode-ai/client` and
61
+ `@opencode-ai/plugin` through the OpenCode **`beta` dist-tag** (`"beta"` in
62
+ `package.json`), which always points at the current beta build — the same
63
+ channel the CLI ships on. Every install resolves automatically to the newest
64
+ beta; no version chasing, no manual pin updates. (Avoid `npm install
65
+ pkg@<version>` in this repo: npm silently rewrites dependency ranges in the
66
+ manifest when given explicit versions — use plain `npm install` or `npm
67
+ update`.) The dispatch code is *runtime-adaptive* on top: generation results
66
68
  are read from the persisted transcript when the service stores turns, otherwise
67
69
  from the synchronous `session.generate` text; agent catalogs are queried with
68
70
  and without an explicit location scope; and the caller-authorization guardrail
69
71
  degrades OPEN when the runtime agent API is unresolvable (only recursion from
70
- known worker sessions stays hard-blocked). If the beta track ever renumbers
71
- (e.g. `0.1.0`), raise the range's upper bound in `package.json` and
72
- `.opencode/package.json`.
73
- The `v3.0.2` git tag must be pushed to GitHub before this pinned spec resolves.
72
+ known worker sessions stays hard-blocked). The `v3.0.3` git tag must be pushed
73
+ to GitHub before this pinned spec resolves.
74
74
 
75
75
  > **Windows dev-machine warning (single-source rule):** when this repository is open as an OpenCode project, its own `.opencode/plugins/regent.js` is auto-loaded as a project plugin. Do NOT also pin regent in `opencode.jsonc` on the same machine — two active sources make host plugin reloads fail with `Duplicate plugin ID: regent`, leaving sessions with a torn tool surface and blocking live skill/plugin edits. Either develop unpinned (project plugin only) or pin the repo file directly: `"plugins": ["file:///Q:/PROJECTS/PERSONAL/regent-code/.opencode/plugins/regent.js"]`. One source of truth, always.
76
76
 
@@ -79,16 +79,18 @@ The `v3.0.2` git tag must be pushed to GitHub before this pinned spec resolves.
79
79
  The fastest way to get **both** the plugin and the MCP server on any machine — no cloning, no manual config edits, no local files:
80
80
 
81
81
  ```bash
82
- npx -y regent-code@3.0.2 install
82
+ npx -y regent-code@3.0.3 install
83
83
  ```
84
84
 
85
85
  The installer finds an existing `opencode.json` / `opencode.jsonc` (project config in the current directory first, then the global `~/.config/opencode/` config) and adds both entries:
86
86
 
87
- - **MCP server**: `mcp.servers.regent` → runs `["npx", "-y", "regent-code@3.0.2"]`
88
- - **Plugin**: `plugins` → `regent-code@3.0.2`
87
+ - **MCP server**: `mcp.servers.regent` → runs `node <absolute path to this package's mcp/cli.js>` directly. No per-connection npx bootstrap: `npx -y regent-code` re-resolves against the npm registry on every OpenCode session start and can re-provision the npx cache, which makes MCP connects flaky (handshake timeouts / connection-closed). Launching the installed file with `node` is deterministic and offline.
88
+ - **Plugin**: `plugins` → `regent-code@3.0.3`
89
89
 
90
90
  It is **idempotent and non-destructive** — it only adds or updates regent entries, preserving comments, trailing commas, and every unrelated setting in the file. Re-run it to upgrade the pinned version. Flags: `--global` forces the user config, `--file <path>` targets an exact file, `--help` explains all options. Restart the OpenCode session afterwards — plugin load and MCP connection happen on config load.
91
91
 
92
+ > When the installer is invoked from npm's ephemeral npx cache, it prints a warning: the absolute path it wrote can be pruned by npm. Run `npm install -g regent-code@3.0.3` once and re-run the installer so the entry points at the persistent global install.
93
+
92
94
  > On the machine that develops regent-code itself, respect the single-source rule above: do not add a second pin when the repo is open as a project.
93
95
 
94
96
  ## MCP Server
@@ -114,7 +116,14 @@ Configure it in OpenCode by adding a local MCP server:
114
116
 
115
117
  `<REPO>` is the path to where the repo is cloned; `cwd: "."` makes the server operate on the workspace directory, which is what the `explore` tool and subagent dispatch use as the working directory.
116
118
 
117
- **Other machines / people — no local clone needed.** The package is published to npm, so anyone can add it to their `opencode.jsonc` directly:
119
+ **Other machines / people — no local clone needed.** The package is published to npm. Recommended: install globally once, then let the installer write the entry (see "One-command install" above):
120
+
121
+ ```bash
122
+ npm install -g regent-code@3.0.3
123
+ npx -y regent-code@3.0.3 install --global
124
+ ```
125
+
126
+ Or add the server to `opencode.jsonc` manually with a direct node launch:
118
127
 
119
128
  ```jsonc
120
129
  {
@@ -123,14 +132,14 @@ Configure it in OpenCode by adding a local MCP server:
123
132
  "servers": {
124
133
  "regent": {
125
134
  "type": "local",
126
- "command": ["npx", "-y", "regent-code@3.0.2"]
135
+ "command": ["node", "<NPM_GLOBAL>/regent-code/mcp/cli.js"]
127
136
  }
128
137
  }
129
138
  }
130
139
  }
131
140
  ```
132
141
 
133
- `npx` downloads the package on first run and starts the server; nothing is pinned to a local path. Dispatch tools still require a local OpenCode service to be running (see below), so the server behaves identically to a local install.
142
+ `<NPM_GLOBAL>` is the npm global install directory (`npm root -g`). Launching the installed file with `node` means every OpenCode session start spawns the server directly — no per-connection npx registry resolution, so connection is deterministic and works offline. Dispatch tools still require a local OpenCode service to be running (see below), so the server behaves identically to a local install.
134
143
 
135
144
  Tool names surface in OpenCode as `<server>_<tool>`, so `regent_delegate`, `regent_delegate_many`, `regent_research`, `regent_explore`, `regent_changed-files`, `regent_verify`. Prompts surface as commands named `<server>:<prompt>`; the prompts are namespaced `command.<name>` (e.g. `/regent:command.orchestrate`, `/regent:command.tdd`) and `skill.<id>` (e.g. `/regent:skill.using-regent`).
136
145
 
package/mcp/index.js CHANGED
@@ -42,8 +42,7 @@ import {
42
42
  } from './shared.js';
43
43
 
44
44
  import { readPackagePrompts, renderPrompt } from './prompts.js';
45
-
46
- const version = '3.0.1';
45
+ import { version } from './version.js';
47
46
 
48
47
  // ── OpenCode client (lazy singleton) ─────────────────────────
49
48
  let clientPromise = null;
package/mcp/install.js CHANGED
@@ -8,20 +8,30 @@
8
8
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
9
9
  import { join, dirname, resolve } from 'node:path';
10
10
  import { homedir } from 'node:os';
11
- import { createRequire } from 'node:module';
11
+ import { fileURLToPath } from 'node:url';
12
12
  import { parseTree, findNodeAtLocation, getNodeValue, modify, applyEdits } from 'jsonc-parser';
13
-
14
- const require = createRequire(import.meta.url);
15
- const { version } = require('../package.json');
13
+ import { version } from './version.js';
16
14
 
17
15
  export const PLUGIN_SPEC = `regent-code@${version}`;
18
16
  export const SERVER_NAME = 'regent';
17
+
18
+ // Launch the MCP server straight from the installed package. A per-connection
19
+ // `npx -y regent-code` bootstraps npm resolution against the registry and can
20
+ // re-provision the npx cache on every OpenCode session start, which makes MCP
21
+ // connects flaky (handshake timeouts / connection-closed). `node <path>` is
22
+ // deterministic and offline.
23
+ const CLI_PATH = fileURLToPath(new URL('./cli.js', import.meta.url));
24
+
19
25
  export const SERVER_CONFIG = Object.freeze({
20
26
  type: 'local',
21
- command: ['npx', '-y', `regent-code@${version}`],
27
+ command: ['node', CLI_PATH],
22
28
  cwd: '.',
23
29
  });
24
30
 
31
+ // npm's ephemeral npx cache (`_npx/<hash>/...`) can be pruned by npm; warn the
32
+ // user to install globally so the config's absolute path keeps resolving.
33
+ const EPHEMERAL_NPX_CACHE = '_npx';
34
+
25
35
  const CONFIG_NAMES = ['opencode.jsonc', 'opencode.json'];
26
36
 
27
37
  export class InstallError extends Error {}
@@ -198,7 +208,15 @@ export function install(options = {}) {
198
208
  const existingText = existsSync(target.path) ? readFileSync(target.path, 'utf8') : null;
199
209
  const base = existingText ?? `{\n}\n`;
200
210
  const { text, report } = patchText(base);
201
-
211
+ const warnings = [...report.warnings];
212
+
213
+ if (CLI_PATH.includes(EPHEMERAL_NPX_CACHE)) {
214
+ warnings.push(
215
+ `MCP entry points into npm's ephemeral npx cache (${CLI_PATH}); npm can prune it. ` +
216
+ `Run "npm install -g ${PLUGIN_SPEC}" once, then re-run "npx -y ${PLUGIN_SPEC} install" ` +
217
+ `so the config points at the persistent global install.`,
218
+ );
219
+ }
202
220
  if (text !== existingText) {
203
221
  mkdirSync(dirname(target.path), { recursive: true });
204
222
  writeFileSync(target.path, text);
@@ -206,6 +224,7 @@ export function install(options = {}) {
206
224
 
207
225
  return {
208
226
  ...report,
227
+ ...(warnings.length ? { warnings } : {}),
209
228
  path: target.path,
210
229
  scope: target.scope,
211
230
  created: existingText === null,
package/mcp/version.js ADDED
@@ -0,0 +1,9 @@
1
+ // Single dynamic source for the package version: read from the installed
2
+ // package.json at runtime, never hardcoded. Both the installer (plugin/MCP
3
+ // spec pins) and the MCP server (serverInfo) import from here, so a version
4
+ // bump in package.json propagates everywhere without touching code.
5
+ import { createRequire } from 'node:module';
6
+
7
+ const require = createRequire(import.meta.url);
8
+
9
+ export const version = require('../package.json').version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "regent-code",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "Agent orchestration for OpenCode. From idea to shipped — zero ceremony. Plugin + MCP server.",
5
5
  "type": "module",
6
6
  "main": ".opencode/plugins/regent.js",
@@ -15,8 +15,8 @@
15
15
  "author": "nathwn12",
16
16
  "dependencies": {
17
17
  "@modelcontextprotocol/sdk": "^1.30.0",
18
- "@opencode-ai/client": "^0.0.0-beta-18414",
19
- "@opencode-ai/plugin": "^0.0.0-beta-18414",
18
+ "@opencode-ai/client": "beta",
19
+ "@opencode-ai/plugin": "beta",
20
20
  "jsonc-parser": "3.3.1"
21
21
  },
22
22
  "repository": {
Binary file
Binary file