@rama_nigg/open-cursor 2.2.1 → 2.3.1

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 (58) hide show
  1. package/README.md +85 -27
  2. package/dist/index.js +70 -70
  3. package/dist/plugin-entry.js +70 -70
  4. package/package.json +9 -3
  5. package/src/acp/metrics.ts +83 -0
  6. package/src/acp/sessions.ts +107 -0
  7. package/src/acp/tools.ts +209 -0
  8. package/src/auth.ts +269 -0
  9. package/src/cli/discover.ts +53 -0
  10. package/src/cli/model-discovery.ts +50 -0
  11. package/src/cli/opencode-cursor.ts +620 -0
  12. package/src/client/simple.ts +277 -0
  13. package/src/commands/status.ts +39 -0
  14. package/src/index.ts +40 -0
  15. package/src/models/config.ts +64 -0
  16. package/src/models/discovery.ts +132 -0
  17. package/src/models/index.ts +3 -0
  18. package/src/models/types.ts +11 -0
  19. package/src/plugin-entry.ts +28 -0
  20. package/src/plugin-toggle.ts +67 -0
  21. package/src/plugin.ts +1918 -0
  22. package/src/provider/boundary.ts +161 -0
  23. package/src/provider/runtime-interception.ts +721 -0
  24. package/src/provider/tool-loop-guard.ts +644 -0
  25. package/src/provider/tool-schema-compat.ts +516 -0
  26. package/src/provider.ts +268 -0
  27. package/src/proxy/formatter.ts +42 -0
  28. package/src/proxy/handler.ts +29 -0
  29. package/src/proxy/prompt-builder.ts +171 -0
  30. package/src/proxy/server.ts +207 -0
  31. package/src/proxy/tool-loop.ts +317 -0
  32. package/src/proxy/types.ts +13 -0
  33. package/src/streaming/ai-sdk-parts.ts +105 -0
  34. package/src/streaming/delta-tracker.ts +33 -0
  35. package/src/streaming/line-buffer.ts +44 -0
  36. package/src/streaming/openai-sse.ts +114 -0
  37. package/src/streaming/parser.ts +22 -0
  38. package/src/streaming/types.ts +152 -0
  39. package/src/tools/core/executor.ts +25 -0
  40. package/src/tools/core/registry.ts +27 -0
  41. package/src/tools/core/types.ts +31 -0
  42. package/src/tools/defaults.ts +673 -0
  43. package/src/tools/discovery.ts +140 -0
  44. package/src/tools/executors/cli.ts +58 -0
  45. package/src/tools/executors/local.ts +25 -0
  46. package/src/tools/executors/mcp.ts +39 -0
  47. package/src/tools/executors/sdk.ts +39 -0
  48. package/src/tools/index.ts +8 -0
  49. package/src/tools/registry.ts +34 -0
  50. package/src/tools/router.ts +123 -0
  51. package/src/tools/schema.ts +58 -0
  52. package/src/tools/skills/loader.ts +61 -0
  53. package/src/tools/skills/resolver.ts +21 -0
  54. package/src/tools/types.ts +29 -0
  55. package/src/types.ts +8 -0
  56. package/src/utils/errors.ts +131 -0
  57. package/src/utils/logger.ts +146 -0
  58. package/src/utils/perf.ts +44 -0
package/README.md CHANGED
@@ -9,13 +9,41 @@ No prompt limits. No broken streams. Full thinking + tool support in Opencode. Y
9
9
 
10
10
  ## Installation
11
11
 
12
- **Option A: One-Line Install**
12
+ **Option A Add to opencode.json (Recommended)**
13
+
14
+ The simplest approach—just add the npm package to your OpenCode config:
15
+
16
+ ```json
17
+ {
18
+ "plugin": ["@rama_nigg/open-cursor@latest"],
19
+ "provider": {
20
+ "cursor-acp": {
21
+ "name": "Cursor ACP",
22
+ "npm": "@ai-sdk/openai-compatible",
23
+ "models": {
24
+ "cursor-acp/claude-sonnet": { "name": "Claude Sonnet" },
25
+ "cursor-acp/gpt-4o": { "name": "GPT-4o" },
26
+ "cursor-acp/gemini-2.5-pro": { "name": "Gemini 2.5 Pro" },
27
+ "cursor-acp/cursor-small": { "name": "Cursor Small" }
28
+ }
29
+ }
30
+ }
31
+ }
32
+ ```
33
+
34
+ After authenticating with `cursor-agent login`, run `cursor-agent models` to see the full model list, or use one of the automated installers below to auto-discover models.
35
+
36
+ **Prerequisites:** Only OpenCode required. OpenCode's Bun runtime resolves the npm package automatically.
37
+
38
+ **Option B — One-line installer (curl)**
13
39
 
14
40
  ```bash
15
41
  curl -fsSL https://raw.githubusercontent.com/Nomadcxx/opencode-cursor/main/install.sh | bash
16
42
  ```
17
43
 
18
- **Option B: npm Package (Recommended)**
44
+ This automated installer detects your environment and chooses the best installation method.
45
+
46
+ **Option C — npm global install + CLI**
19
47
 
20
48
  ```bash
21
49
  npm install -g @rama_nigg/open-cursor
@@ -29,7 +57,9 @@ npm update -g @rama_nigg/open-cursor
29
57
  open-cursor install
30
58
  ```
31
59
 
32
- **Option C: TUI Installer**
60
+ **Option D — Go TUI installer**
61
+
62
+ Interactive visual installer with dual-mode support (quick install or build from source):
33
63
 
34
64
  ```bash
35
65
  git clone https://github.com/Nomadcxx/opencode-cursor.git
@@ -37,46 +67,55 @@ cd opencode-cursor
37
67
  go build -o ./installer ./cmd/installer && ./installer
38
68
  ```
39
69
 
40
- **Option D: Let an LLM do it**
70
+ **Option E LLM instructions**
41
71
 
42
72
  Paste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):
43
73
 
44
74
  ```
45
- Install the cursor-acp plugin for OpenCode:
46
-
47
- 1. Preferred install (npm):
48
- npm install -g @rama_nigg/open-cursor
49
- open-cursor install
50
-
51
- 2. Fallback (build from source):
52
- git clone https://github.com/Nomadcxx/opencode-cursor.git
53
- cd opencode-cursor
54
- bun install && bun run build
55
- mkdir -p ~/.config/opencode/plugin
56
- ln -sf $(pwd)/dist/plugin-entry.js ~/.config/opencode/plugin/cursor-acp.js
57
- ./scripts/sync-models.sh
58
-
59
- 3. Verify:
60
- opencode models | grep cursor-acp
75
+ Install the cursor-acp plugin for OpenCode using the npm package approach:
76
+
77
+ 1. Edit your opencode.json config file (usually at ~/.config/opencode/opencode.json)
78
+ 2. Add "@rama_nigg/open-cursor@latest" to the plugin array
79
+ 3. Add the cursor-acp provider configuration with models
80
+ 4. Restart OpenCode
81
+
82
+ Example configuration:
83
+ {
84
+ "plugin": ["@rama_nigg/open-cursor@latest"],
85
+ "provider": {
86
+ "cursor-acp": {
87
+ "name": "Cursor ACP",
88
+ "npm": "@ai-sdk/openai-compatible",
89
+ "models": {
90
+ "cursor-acp/claude-sonnet": { "name": "Claude Sonnet" }
91
+ }
92
+ }
93
+ }
94
+ }
95
+
96
+ 5. Authenticate: cursor-agent login
97
+ 6. Verify: opencode models | grep cursor-acp
61
98
  ```
62
99
 
63
- **Option E: Manual Install**
100
+ **Option F Manual (from source)**
101
+
102
+ For developers and contributors who want full control:
64
103
 
65
104
  ```bash
105
+ git clone https://github.com/Nomadcxx/opencode-cursor.git
106
+ cd opencode-cursor
66
107
  bun install && bun run build
67
108
  mkdir -p ~/.config/opencode/plugin
68
109
  ln -sf $(pwd)/dist/plugin-entry.js ~/.config/opencode/plugin/cursor-acp.js
69
110
  ```
70
111
 
71
- The installers handle the rest automatically. If you're doing a manual install, you'll need to do the following steps yourself.
72
-
73
- Easiest way is to run the sync script, which populates everything for you:
112
+ The automated installers handle configuration automatically. For manual installs, run the sync script to populate models:
74
113
 
75
114
  ```bash
76
115
  ./scripts/sync-models.sh
77
116
  ```
78
117
 
79
- Or if you'd rather do it by hand, add this to `~/.config/opencode/opencode.json` (then run `./scripts/sync-models.sh` to populate models):
118
+ Or configure manually by adding this to `~/.config/opencode/opencode.json` (then run `./scripts/sync-models.sh` to populate models):
80
119
 
81
120
  ```json
82
121
  {
@@ -126,6 +165,22 @@ Or if you'd rather do it by hand, add this to `~/.config/opencode/opencode.json`
126
165
  }
127
166
  ```
128
167
 
168
+ ### Plugin Configuration Reference
169
+
170
+ Depending on your installation method, use the appropriate plugin identifier:
171
+
172
+ **npm package (recommended for production):**
173
+ ```json
174
+ "plugin": ["@rama_nigg/open-cursor@latest"]
175
+ ```
176
+
177
+ **Local build (for development):**
178
+ ```json
179
+ "plugin": ["cursor-acp"]
180
+ ```
181
+
182
+ Both approaches work—the npm package is resolved automatically by OpenCode's Bun runtime, while the local build requires the symlink setup shown in Option F above.
183
+
129
184
  ## Authentication
130
185
 
131
186
  ### Option 1: Via OpenCode (Recommended)
@@ -206,12 +261,15 @@ Detailed architecture: [docs/architecture/runtime-tool-loop.md](docs/architectur
206
261
 
207
262
  ## Prerequisites
208
263
 
264
+ **For Option A (npm-direct):** Only [OpenCode](https://opencode.ai/) required.
265
+
266
+ **For Options B-F:**
209
267
  - [Bun](https://bun.sh/)
210
268
  - [cursor-agent](https://cursor.com/) - `curl -fsSL https://cursor.com/install | bash`
211
269
 
212
- **Option A (one-line install):** If Go is installed, the script runs the TUI installer; otherwise it performs a shell-only install (Bun + cursor-agent required). For syncing models without the TUI, install [jq](https://jq.org/) or run `./scripts/sync-models.sh` after install.
270
+ **Option B (one-line install):** If Go is installed, the script runs the TUI installer; otherwise it performs a shell-only install (OpenCode + cursor-agent required). For syncing models without the TUI, install [jq](https://jq.org/) or run `./scripts/sync-models.sh` after install.
213
271
 
214
- **Option B (TUI installer):** Go 1.21+ required to build the installer.
272
+ **Option D (TUI installer):** Go 1.21+ required to build the installer.
215
273
 
216
274
  ## Features
217
275