regent-code 3.0.2 → 3.0.4

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.
@@ -36,3 +36,6 @@ jobs:
36
36
  - name: Test
37
37
  working-directory: .opencode
38
38
  run: node --test tests/regent.test.js tests/regent.v2.test.js tests/regent.live-test.js tests/regent.hybrid.v2.6.1.test.js tests/regent.runtime.v2.6.1.test.js
39
+
40
+ - name: Test MCP suites (bin contract + installer + server)
41
+ run: node --test mcp/tests/bin.test.js mcp/tests/install.test.js mcp/tests/mcp.test.js
@@ -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.4 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.4"],
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.4` 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/AGENTS.md CHANGED
@@ -28,6 +28,12 @@ All 108 tests across the five suites must pass before committing.
28
28
  - Error paths produce structured JSON, never throw
29
29
  - `context.directory` → `process.cwd()` fallback
30
30
 
31
+ ## Bin targets
32
+
33
+ - Every `package.json` `bin` file MUST start with `#!/usr/bin/env node`. Without it, npm generates a passthrough `.cmd` shim on Windows that ShellExecutes the file through its extension association (opens an editor) instead of running it under node. Enforced by `mcp/tests/bin.test.js`.
34
+ - The MCP launch contract is the single command `npx -y regent-code` - no absolute paths, no global installs, no hand-written `.cmd`/`.ps1` shims. Enforced by the same test.
35
+ - `npm run prepublishOnly` (wired to `npm run verify`) gates every `npm publish`; CI runs the MCP suites too.
36
+
31
37
  ## Verdict gates
32
38
 
33
39
  Before committing:
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.4"],
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.4` 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,13 +79,13 @@ 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.4 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 `["npx", "-y", "regent-code"]`. That single command spawns the server through the package's `bin` — no absolute paths, no global install, no per-machine shims.
88
+ - **Plugin**: `plugins` → `regent-code@3.0.4`
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
 
@@ -95,7 +95,7 @@ It is **idempotent and non-destructive** — it only adds or updates regent entr
95
95
 
96
96
  Since v3.0.0, regent-code ships a second distribution alongside the plugin: a Model Context Protocol (MCP) server that exposes the same six tools (`delegate`, `delegate_many`, `research`, `explore`, `changed-files`, `verify`) plus the Regent command and skill corpus as MCP prompts. It is out-of-process and works from any MCP client (Claude Desktop, Cursor, or OpenCode).
97
97
 
98
- Configure it in OpenCode by adding a local MCP server:
98
+ Configure it in OpenCode by adding a local MCP server — the exact entry the installer writes:
99
99
 
100
100
  ```jsonc
101
101
  {
@@ -104,7 +104,7 @@ Configure it in OpenCode by adding a local MCP server:
104
104
  "servers": {
105
105
  "regent": {
106
106
  "type": "local",
107
- "command": ["node", "<REPO>/regent-code/mcp/index.js"],
107
+ "command": ["npx", "-y", "regent-code"],
108
108
  "cwd": "."
109
109
  }
110
110
  }
@@ -112,25 +112,9 @@ Configure it in OpenCode by adding a local MCP server:
112
112
  }
113
113
  ```
114
114
 
115
- `<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.
115
+ `npx -y regent-code` is the single, canonical launch command — it runs on any machine with Node/npm installed, from the npm registry or the npx cache. No cloning, no global install, no absolute path, no shims. `cwd: "."` makes the server operate on the workspace directory, which is what the `explore` tool and subagent dispatch use as the working directory.
116
116
 
117
- **Other machines / people — no local clone needed.** The package is published to npm, so anyone can add it to their `opencode.jsonc` directly:
118
-
119
- ```jsonc
120
- {
121
- "$schema": "https://opencode.ai/config.json",
122
- "mcp": {
123
- "servers": {
124
- "regent": {
125
- "type": "local",
126
- "command": ["npx", "-y", "regent-code@3.0.2"]
127
- }
128
- }
129
- }
130
- }
131
- ```
132
-
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.
117
+ **Other machines / people — no local clone needed.** The package is published to npm. On any machine, either hand-write the entry above or run the one-command installer (see "One-command install" above).
134
118
 
135
119
  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
120
 
package/mcp/cli.js CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  // Regent CLI entry (package `bin`).
2
3
  // no arguments -> run the MCP server over stdio (that is what a local
3
4
  // `mcp.servers` entry in OpenCode invokes)
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,17 +8,19 @@
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';
12
11
  import { parseTree, findNodeAtLocation, getNodeValue, modify, applyEdits } from 'jsonc-parser';
13
-
14
- const require = createRequire(import.meta.url);
15
- const { version } = require('../package.json');
12
+ import { version } from './version.js';
16
13
 
17
14
  export const PLUGIN_SPEC = `regent-code@${version}`;
18
15
  export const SERVER_NAME = 'regent';
16
+
17
+ // The MCP server launches with a single portable command. `npx -y regent-code`
18
+ // runs the package's `bin` (mcp/cli.js) from the npm registry or npx cache —
19
+ // no absolute paths, no global install, no per-machine shims. This is the only
20
+ // supported launch path; the installer writes exactly this entry.
19
21
  export const SERVER_CONFIG = Object.freeze({
20
22
  type: 'local',
21
- command: ['npx', '-y', `regent-code@${version}`],
23
+ command: ['npx', '-y', 'regent-code'],
22
24
  cwd: '.',
23
25
  });
24
26
 
@@ -198,6 +200,7 @@ export function install(options = {}) {
198
200
  const existingText = existsSync(target.path) ? readFileSync(target.path, 'utf8') : null;
199
201
  const base = existingText ?? `{\n}\n`;
200
202
  const { text, report } = patchText(base);
203
+ const warnings = [...report.warnings];
201
204
 
202
205
  if (text !== existingText) {
203
206
  mkdirSync(dirname(target.path), { recursive: true });
@@ -206,6 +209,7 @@ export function install(options = {}) {
206
209
 
207
210
  return {
208
211
  ...report,
212
+ ...(warnings.length ? { warnings } : {}),
209
213
  path: target.path,
210
214
  scope: target.scope,
211
215
  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.4",
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": {
@@ -30,8 +30,9 @@
30
30
  "format": "prettier --write .opencode/plugins/ skills/ mcp/ --no-error-on-unmatched-pattern",
31
31
  "format:check": "prettier --check .opencode/plugins/ skills/ mcp/ --no-error-on-unmatched-pattern",
32
32
  "typecheck": "tsc --noEmit",
33
- "test": "node --test .opencode/tests/regent.test.js .opencode/tests/regent.live-test.js .opencode/tests/regent.v2.test.js .opencode/tests/regent.hybrid.v2.6.1.test.js .opencode/tests/regent.runtime.v2.6.1.test.js mcp/tests/mcp.test.js mcp/tests/install.test.js",
34
- "verify": "npm run format:check && npm run lint && npm run typecheck && npm test"
33
+ "test": "node --test .opencode/tests/regent.test.js .opencode/tests/regent.live-test.js .opencode/tests/regent.v2.test.js .opencode/tests/regent.hybrid.v2.6.1.test.js .opencode/tests/regent.runtime.v2.6.1.test.js mcp/tests/mcp.test.js mcp/tests/install.test.js mcp/tests/bin.test.js",
34
+ "verify": "npm run format:check && npm run lint && npm run typecheck && npm test",
35
+ "prepublishOnly": "npm run verify"
35
36
  },
36
37
  "devDependencies": {
37
38
  "@eslint/js": "^10.0.1",
Binary file
Binary file