magpie-cursor-relay 0.0.0-stage → 0.3.11
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.
- package/CHANGELOG.md +286 -0
- package/LICENSE +21 -0
- package/README.md +115 -2
- package/THIRD_PARTY_NOTICES.md +7 -0
- package/agent.js +257 -0
- package/bin/cursor-magpie-bridge +4 -0
- package/bridge.js +343 -0
- package/icon.png +0 -0
- package/icon.svg +1 -0
- package/install.js +105 -0
- package/integrity.json +5 -0
- package/lib/config.js +23 -0
- package/lib/install.js +225 -0
- package/lib/lock.js +90 -0
- package/lib/magpie.js +68 -0
- package/lib/relay.js +79 -0
- package/lib/settings.js +110 -0
- package/lib/watch.js +15 -0
- package/node_modules/jsonc-parser/CHANGELOG.md +76 -0
- package/node_modules/jsonc-parser/LICENSE.md +21 -0
- package/node_modules/jsonc-parser/README.md +364 -0
- package/node_modules/jsonc-parser/SECURITY.md +41 -0
- package/node_modules/jsonc-parser/lib/esm/impl/edit.js +185 -0
- package/node_modules/jsonc-parser/lib/esm/impl/format.js +261 -0
- package/node_modules/jsonc-parser/lib/esm/impl/parser.js +659 -0
- package/node_modules/jsonc-parser/lib/esm/impl/scanner.js +443 -0
- package/node_modules/jsonc-parser/lib/esm/impl/string-intern.js +29 -0
- package/node_modules/jsonc-parser/lib/esm/main.d.ts +351 -0
- package/node_modules/jsonc-parser/lib/esm/main.js +178 -0
- package/node_modules/jsonc-parser/lib/umd/impl/edit.js +201 -0
- package/node_modules/jsonc-parser/lib/umd/impl/format.js +275 -0
- package/node_modules/jsonc-parser/lib/umd/impl/parser.js +682 -0
- package/node_modules/jsonc-parser/lib/umd/impl/scanner.js +456 -0
- package/node_modules/jsonc-parser/lib/umd/impl/string-intern.js +42 -0
- package/node_modules/jsonc-parser/lib/umd/main.d.ts +351 -0
- package/node_modules/jsonc-parser/lib/umd/main.js +194 -0
- package/node_modules/jsonc-parser/package.json +37 -0
- package/npm-shrinkwrap.json +34 -0
- package/package.json +63 -4
- package/scripts/build-native.sh +30 -0
- package/setup.cmd +4 -0
- package/setup.command +29 -0
- package/setup.ps1 +37 -0
- package/source.patch +1228 -0
- package/test/agent.test.js +242 -0
- package/test/config.test.js +33 -0
- package/test/install.test.js +188 -0
- package/test/lock.test.js +87 -0
- package/test/magpie.test.js +74 -0
- package/test/manual-lifecycle.mjs +22 -0
- package/test/relay.test.js +121 -0
- package/test/settings-change.test.js +50 -0
- package/test/settings.test.js +49 -0
- package/test/watch.test.js +68 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.3.11
|
|
4
|
+
|
|
5
|
+
修复 `magpie cursor-bridge <模型>` 命令行连接报 `ReferenceError: process is not defined`:Magpie 命令行在没有 `process` 的沙箱里执行插件的 `connect()`,自动启动检查现在先判断 `process` 是否存在,连接配置照常写出,由已在运行的后台桥接自行接管。
|
|
6
|
+
|
|
7
|
+
- 验证:插件测试 72 项通过,新增无 `process` 沙箱的连接回归测试(修复前失败)。
|
|
8
|
+
|
|
9
|
+
## 0.3.10
|
|
10
|
+
|
|
11
|
+
改名 **Magpie-Cursor-Relay**(npm 包 `magpie-cursor-relay`),准备上架 Magpie 插件市场,与同名上游 `magpie-agent-cursor-bridge` 区分。Agent ID 仍是 `cursor-bridge`,已有连接与设置不受影响。
|
|
12
|
+
|
|
13
|
+
- `package.json` 的 `os`/`cpu` 改为实际随包提供的 `darwin`/`arm64`,不再声明 Windows 与 Intel。
|
|
14
|
+
- 功能代码与 0.3.9 相同。
|
|
15
|
+
|
|
16
|
+
## 0.3.9
|
|
17
|
+
|
|
18
|
+
修复 Connect 之后在 Magpie 新增的模型在 Cursor 里显示成 `provider/model` 完整 ID 的问题。
|
|
19
|
+
|
|
20
|
+
- 每次刷新模型列表都读取 Magpie `settings.json` 里的 `modelNames`,新模型和改名立即生效,无需重新 Connect。
|
|
21
|
+
- 名字优先级:Magpie 当前名字 → Connect 时的快照名 → 网关返回名 → 去掉 provider 前缀的模型 ID。
|
|
22
|
+
- 验证:插件全量测试 71 项通过,新增名字优先级回归测试(修复前失败)。
|
|
23
|
+
|
|
24
|
+
## 0.3.8
|
|
25
|
+
|
|
26
|
+
适配 Cursor checkpoint 消息中 `{"__type":"Uint8Array","hex":"..."}` 格式的图片载荷,修复含图会话续聊报 `Cursor message is missing image` 的问题。
|
|
27
|
+
|
|
28
|
+
## 0.3.7
|
|
29
|
+
|
|
30
|
+
适配 Cursor 3.29.9 协议变更,修复更新后对话报错或挂起的问题。
|
|
31
|
+
|
|
32
|
+
- `BidiAppend` 解码同时兼容 `data_binary`(tag 4 二进制字节)与旧版 `data`(tag 1 hex)。
|
|
33
|
+
- `BootstrapStatsig` 强制关闭 `nal_websocket_client` 与 `run_inference_websocket_client`,并将 `/agent/v1/run` 加入本地代理路由,防止 WebSocket 直连绕过本地桥。
|
|
34
|
+
- 验证:服务端 166 项单测、插件 70 项单测及 `data_binary` 端到端冒烟均通过。
|
|
35
|
+
|
|
36
|
+
## 0.3.6
|
|
37
|
+
|
|
38
|
+
修复安装器未把 Node 运行时依赖的 `libnode.127.dylib` 一起放入发布目录,导致 launchd 启动桥接时出现 `OS_REASON_DYLD` 并反复崩溃。
|
|
39
|
+
|
|
40
|
+
- 发布目录现在根据 `otool -L` 自动复制 `@rpath` 动态库,launchd 不再依赖开发机的 Homebrew 路径。
|
|
41
|
+
- 验证:插件全量测试 70 项通过,并覆盖运行时动态库随 release staging 复制。
|
|
42
|
+
|
|
43
|
+
## 0.3.5
|
|
44
|
+
|
|
45
|
+
修复上游 413 请求体超限被桥错误编码成 `unavailable` 的问题:这类确定性拒绝现在标为不可重试并立即显示,避免 Cursor 对同一 52.9 MB 请求重复重试;502/超时仍保留可重试。
|
|
46
|
+
|
|
47
|
+
- 发布包包含新的原生引擎,保留 0.3.4 的续聊历史修复。
|
|
48
|
+
- 验证:发布模式错误生命周期 7 项、Lodestar 回归 3 项、413 分类与 Cursor 错误详情回归、插件测试 70 项全部通过。
|
|
49
|
+
|
|
50
|
+
## 0.3.4
|
|
51
|
+
|
|
52
|
+
修复 Cursor 续聊反复从旧进度开始,以及随后报
|
|
53
|
+
`Cursor stable history shrank` 的问题。
|
|
54
|
+
|
|
55
|
+
- Cursor 复用用户消息编号、同时携带更新后的完整历史时,以本次历史为准;
|
|
56
|
+
旧 `input_anchor` 仅用于未携带根历史的请求。保留原去重机制和历史完整性检查,
|
|
57
|
+
不清空数据库,不删除消息,不修改模型或输出预算。
|
|
58
|
+
- 加入离线回归测试:同编号但内容变化、同内容带最新历史续聊、无历史重试。
|
|
59
|
+
修复前前两项失败;修复后全部通过,模拟工具执行一次并成功入账。
|
|
60
|
+
- 构建脚本固定到本次实际测试的源码提交,保留独立的 engine_version,
|
|
61
|
+
加入回归测试并在计算校验值前完成 macOS 临时签名。
|
|
62
|
+
- 修复插件测试的自动启动隔离:在安排异步任务前读取禁止启动开关,
|
|
63
|
+
测试恢复原环境变量,防止测试结束后意外安装插件。
|
|
64
|
+
- 验证:完整服务端测试 268 项、插件测试 70 项全部通过;真实历史离线回放和
|
|
65
|
+
实际 Cursor 续聊均已越过原故障点,历史继续增长、工具结果正常入账。
|
|
66
|
+
- 升级只在没有活动任务时切换后台进程,保留旧发布目录;无需清空会话数据库。
|
|
67
|
+
- 修复上游 413 请求体超限被桥错误编码成 `unavailable` 的问题:这类确定性拒绝现在标为不可重试并立即显示,避免 Cursor 对同一 52.9 MB 请求重复重试;502/超时仍保留可重试。
|
|
68
|
+
- 验证:发布模式错误生命周期 7 项、Lodestar 回归 3 项、413 分类与 Cursor 错误详情回归均通过。
|
|
69
|
+
|
|
70
|
+
## 0.3.3
|
|
71
|
+
|
|
72
|
+
Stop long opus replies from being truncated. Responses were cut mid-stream with
|
|
73
|
+
`finish_reason=length`, failing the run with "model stopped before completing the
|
|
74
|
+
response", because the request never carried an output cap and the gateway's low
|
|
75
|
+
default applied.
|
|
76
|
+
|
|
77
|
+
### Fixed
|
|
78
|
+
|
|
79
|
+
- `configure()` now propagates a model's configured output cap to the request
|
|
80
|
+
(`model.max_output_tokens`); it previously set display name / context / reasoning
|
|
81
|
+
but dropped the token cap, so `openai_chat` sent no `max_completion_tokens` and
|
|
82
|
+
the gateway truncated. This was an upstream gap — no DB or config value could
|
|
83
|
+
reach the request without it.
|
|
84
|
+
- The bridge catalogues each model's real `max_output_tokens` from the gateway
|
|
85
|
+
`/models` response (captured in `gatewayModels`), clamped to 64000 to stay well
|
|
86
|
+
inside the context window. So opus gets a generous cap and smaller models keep
|
|
87
|
+
their own limit, instead of every model inheriting the gateway's low default.
|
|
88
|
+
|
|
89
|
+
## 0.3.2
|
|
90
|
+
|
|
91
|
+
Harden message hydration against a non-UTF8 `payload_json`. An older engine once
|
|
92
|
+
wrote raw bytes where a user `message_id` belonged, leaving one row whose JSON is
|
|
93
|
+
not valid UTF-8; `messages.rs` read it with `row.get::<&str>` which **panics** on
|
|
94
|
+
bad bytes, taking down the worker thread (the stray `messages.rs:101` panic seen
|
|
95
|
+
in long conversations).
|
|
96
|
+
|
|
97
|
+
### Fixed
|
|
98
|
+
|
|
99
|
+
- Hydrate reads `payload_json` with `try_get`, so a non-UTF8 row fails that one
|
|
100
|
+
request with a decode error instead of panicking the worker. The affected
|
|
101
|
+
conversation's live lineage keeps working; only a turn that actually touches the
|
|
102
|
+
bad row errors, recoverably. No data is deleted — the clean engine never writes
|
|
103
|
+
such rows, this just stops the old scars from crashing anything.
|
|
104
|
+
|
|
105
|
+
## 0.3.1
|
|
106
|
+
|
|
107
|
+
Front subagents work. When the agent spawns a subagent with `run_in_background`
|
|
108
|
+
false or absent, Cursor sends the turn without a `message_id`, and upstream
|
|
109
|
+
`compile::run::action` rejected it with `Cursor user message action has no
|
|
110
|
+
message_id` — so only background subagents (`run_in_background: true`) ran.
|
|
111
|
+
|
|
112
|
+
### Fixed
|
|
113
|
+
|
|
114
|
+
- A subagent turn with an empty `message_id` now gets a deterministic synthetic
|
|
115
|
+
id (`synthetic-subagent:<digest of kind + text>`) and compiles through the
|
|
116
|
+
**normal** path — unlike the old binary patch, which skipped the compile path
|
|
117
|
+
and corrupted checkpoints. The id is derived from the subagent kind and text,
|
|
118
|
+
so retries stay idempotent; the subagent runs in its own `conversation_id` and
|
|
119
|
+
never pollutes the parent. A non-subagent empty `message_id` is still rejected.
|
|
120
|
+
Covered by unit tests in `server/src/cursor/compile/run.rs`.
|
|
121
|
+
|
|
122
|
+
## 0.3.0
|
|
123
|
+
|
|
124
|
+
The engine is now built from source instead of shipped as a prebuilt binary. The
|
|
125
|
+
bin is `cursor-magpie-bridge` compiled from leookun/cursor-byok (MIT) plus
|
|
126
|
+
`source.patch`, which adds the headless bridge entry (`server/src/bin/
|
|
127
|
+
cursor-magpie-bridge.rs`): it reads `effective.json`, catalogues the Magpie models
|
|
128
|
+
against a loopback-only gateway, runs the proxy over the already-trusted CA, and
|
|
129
|
+
emits the same `ready` event the supervisor consumes. The JS layer, config
|
|
130
|
+
contract, CA path, and data dir are unchanged, so this is a drop-in swap that
|
|
131
|
+
reuses the existing trusted CA with no re-trust.
|
|
132
|
+
|
|
133
|
+
### Fixed
|
|
134
|
+
|
|
135
|
+
- Dropped the front-subagent binary patch that earlier builds carried. That patch
|
|
136
|
+
rerouted every user message past the engine's normal compile path, which
|
|
137
|
+
produced the 1–2 message checkpoints and the `FOREIGN KEY constraint failed`
|
|
138
|
+
(787) / "stable history shrank" errors seen in long conversations. The source
|
|
139
|
+
build ships upstream `compile::run::action` unchanged: conversations compile
|
|
140
|
+
correctly. A **front** subagent (`run_in_background` false/absent) still returns
|
|
141
|
+
the upstream `Cursor user message action has no message_id`; use a background
|
|
142
|
+
subagent (`run_in_background: true`). Re-adding front-subagent support at source
|
|
143
|
+
level is a tracked follow-up, see `PATCH-subagent.md`.
|
|
144
|
+
|
|
145
|
+
## 0.2.7
|
|
146
|
+
|
|
147
|
+
A toggle restarted Cursor to make it re-read `http.proxy`, which cost every open
|
|
148
|
+
editor and put the gateway's 499s in the log while the model list still took its
|
|
149
|
+
time. The upgrade path also left two things behind: the real Startup entry still
|
|
150
|
+
named the previous release, and the previous release's watchdog kept running.
|
|
151
|
+
|
|
152
|
+
### Changed
|
|
153
|
+
|
|
154
|
+
- A connect or disconnect no longer restarts Cursor. The relay already keeps the
|
|
155
|
+
published address constant, so a toggle does not change the value Cursor holds;
|
|
156
|
+
`CURSOR_BRIDGE_RESTART_CURSOR=1` restores the old kill for anyone who wants it.
|
|
157
|
+
`CURSOR_BRIDGE_NO_RESTART` is gone, since not restarting is now the default.
|
|
158
|
+
|
|
159
|
+
### Fixed
|
|
160
|
+
|
|
161
|
+
- An automatic install no longer redirects the Startup entry. `connect()` passed
|
|
162
|
+
`CURSOR_BRIDGE_ROOT`, and `pathed()` treats that as an isolated install, so the
|
|
163
|
+
entry was written into a private folder while the real one kept pointing at the
|
|
164
|
+
release it was meant to replace: the next login started the old build. The
|
|
165
|
+
variable is now forwarded only when the caller set it themselves.
|
|
166
|
+
- Upgrading stops the previous watchdog. It holds its own lock and outlives the
|
|
167
|
+
supervisor it guards, so stopping only `supervisor.lock` left the old release's
|
|
168
|
+
watchdog watching a directory that had already been replaced.
|
|
169
|
+
- `activate` reads the Startup entry back and fails when it does not name the
|
|
170
|
+
release being installed, instead of reporting success.
|
|
171
|
+
|
|
172
|
+
## 0.2.6
|
|
173
|
+
|
|
174
|
+
Magpie replaces this plugin's files from GitHub but never rewrites the record of
|
|
175
|
+
the installed release, so after an update the supervisor on disk was still the
|
|
176
|
+
previous plugin's. `start()` asked whether a supervisor was alive and, when the
|
|
177
|
+
old one still held its lock, returned before anything compared versions: an
|
|
178
|
+
upgrade from the Magpie plugin page silently kept running the old build, and the
|
|
179
|
+
toggle still read connected.
|
|
180
|
+
|
|
181
|
+
### Fixed
|
|
182
|
+
|
|
183
|
+
- A live supervisor is reused only when it runs the plugin's own version. The
|
|
184
|
+
version it publishes in `status.json` is compared with `package.json`, and a
|
|
185
|
+
mismatch falls through to `setup()`, which stops the old supervisor and stages
|
|
186
|
+
a release matching the files that are actually installed. Upgrading in Magpie
|
|
187
|
+
now takes effect on the next toggle instead of requiring a manual install.
|
|
188
|
+
- A `status.json` without a version is not treated as a mismatch. An older
|
|
189
|
+
supervisor cannot be attributed that way, and rebuilding on it would fight a
|
|
190
|
+
healthy bridge on every connect.
|
|
191
|
+
|
|
192
|
+
## 0.2.5
|
|
193
|
+
|
|
194
|
+
Cursor reads `http.proxy` once and keeps using that address, so writing the
|
|
195
|
+
setting was never enough: Cursor only noticed when its own retry backoff
|
|
196
|
+
expired. Leaving the address stable helped, but the switch still felt slow.
|
|
197
|
+
|
|
198
|
+
### Fixed
|
|
199
|
+
|
|
200
|
+
- Cursor is restarted when, and only when, the published proxy address actually
|
|
201
|
+
changes. This is what upstream cursor-byok does: it ends Cursor before writing
|
|
202
|
+
the settings, and Cursor reads the new proxy as it reopens. The switch is now
|
|
203
|
+
immediate in both directions instead of waiting for Cursor to come around.
|
|
204
|
+
A rewrite with the same address still does nothing, so a healthy bridge never
|
|
205
|
+
kills Cursor in a loop.
|
|
206
|
+
- `applyProxy` now reports whether the settings text changed, which is what
|
|
207
|
+
separates a real switch from the per-pass rewrite. Disconnecting relies on the
|
|
208
|
+
same signal, so Cursor drops the Magpie models as soon as the keys are removed
|
|
209
|
+
instead of continuing to use a proxy that is gone.
|
|
210
|
+
|
|
211
|
+
### Added
|
|
212
|
+
|
|
213
|
+
- `CURSOR_BRIDGE_NO_RESTART=1` keeps Cursor running, trading the immediate
|
|
214
|
+
switch for Cursor's own refresh delay. Useful while something unsaved is open.
|
|
215
|
+
|
|
216
|
+
## 0.2.4
|
|
217
|
+
|
|
218
|
+
Cursor caches the proxy address it read from `settings.json`, so anything that moved that address cost a visible stall. Both changes below keep the published address and the map behind it still.
|
|
219
|
+
|
|
220
|
+
### Fixed
|
|
221
|
+
|
|
222
|
+
- Cursor is given a stable proxy address. The engine takes an ephemeral port on every start, so a watchdog restart moved the address while Cursor kept dialing the previous one; its `agent-store-sync` then failed with "Failed to establish a socket connection to proxies" and retried on a backoff, which is what made the model list appear late after a reconnect. The supervisor now listens on a fixed port (`CURSOR_BRIDGE_RELAY_PORT`, default 52407) and forwards to whatever port the engine holds, so a restart is invisible to Cursor. Verified: the engine moved from pid 21340 to 31640 with the published address unchanged, and both the proxy CONNECT and the catalogue still answered.
|
|
223
|
+
- The fixed port is bound, not probed. Asking "is this port free?" first was a race with the previous supervisor's closing socket, which answered "busy" and published a different address -- exactly the churn the fixed port prevents. Binding is retried briefly, and a fallback port is announced in `status.json` instead of being adopted silently.
|
|
224
|
+
- A toggle is noticed in under a second. The serving loop waited two seconds and the catalogue was refreshed every fifteen, although the gateway answers in tens of milliseconds. Disconnect and reconnect now measure about 0.8s each, down from 1.5s and 1.9s.
|
|
225
|
+
|
|
226
|
+
## 0.2.3
|
|
227
|
+
|
|
228
|
+
Everything below was found on a machine where Magpie showed the agent as connected while Cursor listed only its own models. The bridge had been dead for seventeen hours and nothing said so.
|
|
229
|
+
|
|
230
|
+
### Fixed
|
|
231
|
+
|
|
232
|
+
- A release staged by an earlier plugin is no longer launched. Magpie replaces this plugin's files from GitHub but never rewrites `installation.json`, so the recorded release could belong to the previous plugin; the older `bridge.js` has no watchdog, and one exit left the bridge down for good. A version mismatch now falls back to `setup()` and stages a release that matches the installed files.
|
|
233
|
+
- The supervisor starts with its own watchdog enabled. `launch()` passed `CURSOR_BRIDGE_NO_WATCHDOG=1`, which disabled the only watchdog that exists: `connect()` runs once per toggle, so nothing else could ever restart a supervisor that died. A killed supervisor was revived within a second in testing, and Cursor's proxy followed the new port.
|
|
234
|
+
- A failed launch is recorded in `autostart.log`. `spawn` reports an unrunnable runtime through its `error` event instead of throwing, and the handler was empty, so a launch that never produced a supervisor left no evidence anywhere.
|
|
235
|
+
- An engine that exits before `ready` no longer reports "check certificate trust". Exit code 107 was printed with that hint on a machine whose CA was trusted all along, sending every reader down the wrong path; the message now says the engine exited before ready and leaves the cause to the engine's own stderr.
|
|
236
|
+
- A scratch `home` no longer writes the Startup entry of the real profile. `paths()` read `APPDATA` unconditionally, so running the tests overwrote the real Startup script with a path into `%TEMP%`; that tree was deleted when the test finished and every later login silently started nothing.
|
|
237
|
+
- `install.js` honours `CURSOR_BRIDGE_ROOT`. It ignored the variable `agent.js` passes when falling back to `setup()`, so a run that asked for an isolated root rewrote the real `installation.json`, staged into the real release directory and started a second supervisor.
|
|
238
|
+
- `npm-shrinkwrap.json` no longer pins the package to macOS/arm64. Installing on Windows was refused by npm's platform check while `package.json` already allowed both platforms.
|
|
239
|
+
|
|
240
|
+
### Changed
|
|
241
|
+
|
|
242
|
+
- Starting the bridge is reported as `starting` until the engine is up, so a reader never sees the previous run's `connected` during the gap.
|
|
243
|
+
- The agent notice no longer tells users to restart Cursor. The catalogue is served per request, so opening a panel or the model picker is enough; the old wording sent users to a restart that merely masked the startup delay.
|
|
244
|
+
|
|
245
|
+
### Added
|
|
246
|
+
|
|
247
|
+
- A release bump no longer breaks the tests: they read the version from `package.json` instead of repeating the string.
|
|
248
|
+
|
|
249
|
+
## 0.2.2
|
|
250
|
+
|
|
251
|
+
- Turning the agent on starts the bridge: a staged release is launched as the supervisor, and a first run falls back to the packaged setup.
|
|
252
|
+
- Node built-ins load lazily inside `connect()`, so the agent module still imports when the sandbox offers none.
|
|
253
|
+
- Windows certificate trust follows the engine's own CA verdict. The bridge reads the local machine root store, so a per-user import no longer reports success while the bridge refuses to start.
|
|
254
|
+
- The packaged native engine stays at 0.2.1: its version is compiled into the binary, so `integrity.json` now pins `engine_version` separately and a JavaScript release no longer has to match it.
|
|
255
|
+
|
|
256
|
+
### Fixed
|
|
257
|
+
|
|
258
|
+
- A stale `supervisor.lock` no longer disables model sync. The lock records the owner's pid *and* start time, so a dead supervisor whose pid was reused by an unrelated process is reclaimed instead of answering "already running". This was the reported cause of Cursor showing no Magpie models while Magpie still showed the agent as connected.
|
|
259
|
+
- `status.json` now carries a heartbeat, so a supervisor that dies without a clean shutdown no longer leaves a frozen `connected` state that reads as healthy.
|
|
260
|
+
- A failed autostart is recorded in `autostart.log` instead of being swallowed, so a bridge that never started is diagnosable.
|
|
261
|
+
- The install tests run even where the OS temp directory refuses the native engine's certificate store.
|
|
262
|
+
|
|
263
|
+
## 0.2.1
|
|
264
|
+
|
|
265
|
+
- Hide Cursor Auto in the bridge model picker using Cursor's display configuration, including clearing cached Auto controls. Magpie models and route groups remain selectable.
|
|
266
|
+
|
|
267
|
+
## 0.2.0
|
|
268
|
+
|
|
269
|
+
- Standard Magpie Agent package with an explicit file allowlist and bundled JavaScript dependency.
|
|
270
|
+
- Independent, per-machine certificate initialization; no original Cursor BYOK installation needed.
|
|
271
|
+
- Windows trust checks the generated CA thumbprint, so an older Cursor BYOK root with the same name is not treated as trusted.
|
|
272
|
+
- The agent module imports only relative files, so Magpie's plugin sandbox can load it.
|
|
273
|
+
- Explicit macOS certificate trust step with SSL trust verification; existing certificates preserved.
|
|
274
|
+
- Setup reuses Magpie's Bun and keeps a local runtime copy, removing the dependency on user-installed Node.
|
|
275
|
+
- Plugin/native version pairing and native SHA-256 verification.
|
|
276
|
+
- Complete version directories and rollback of launch configuration after failed service registration.
|
|
277
|
+
- Status reports the actual running version. Updating the plugin requires rerunning setup to activate the matching service.
|
|
278
|
+
- Apple Silicon macOS only; no installation lifecycle scripts and no credentials in the package.
|
|
279
|
+
|
|
280
|
+
## 0.1.1
|
|
281
|
+
|
|
282
|
+
- Return only Magpie's model catalogue, without appending Cursor subscription models.
|
|
283
|
+
|
|
284
|
+
## 0.1.0
|
|
285
|
+
|
|
286
|
+
- Cursor protocol bridge through Magpie, background lifecycle, and recoverable proxy settings.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 leookun
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,116 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Magpie-Cursor-Relay
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
让 Cursor 编辑器直接使用 Magpie 中配置的全部模型与路由组。模型菜单返回 Magpie 模型目录,隐藏 Cursor 默认 Auto 入口,保留 Cursor 原有登录。
|
|
4
|
+
|
|
5
|
+
当前发布 **0.3.11,仅随包提供 Apple Silicon macOS 引擎**;Windows / Intel macOS 暂无对应发布产物。
|
|
6
|
+
|
|
7
|
+
**和市场里其他 Cursor 插件的区别**
|
|
8
|
+
|
|
9
|
+
- `@magpie-community/opencode-cursor-auth`(Cursor)方向相反:它登录你的 Cursor 订阅,让 Magpie 和其他 Agent 用 Cursor 的模型;本插件让 Cursor 用 Magpie 的模型。
|
|
10
|
+
- `nodlles/magpie-agent-cursor-bridge` 与 `932633145/magpie-agent-cursor-bridge` 是本插件的上游。本插件在其基础上加了:续聊历史回退修复(0.3.4)、413 不再重试(0.3.5)、发布目录自带运行时动态库(0.3.6)、适配 Cursor 3.29.9 协议(0.3.7)、含图会话续聊(0.3.8)、模型名实时跟随 Magpie 且不显示 provider 前缀(0.3.9)。
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 特性
|
|
15
|
+
|
|
16
|
+
- **可追溯的源码构建**:原生引擎基于 cursor-byok,源码补丁、构建脚本和校验值随包提供。
|
|
17
|
+
- **动态模型同步**:在 Magpie 中添加、切换或分组的模型,每 15 秒自动热同步至 Cursor 模型列表。
|
|
18
|
+
- **无感代理接管**:连接时自动配置 Cursor 代理,断开连接或卸载时完整自动还原 Cursor 原有配置。
|
|
19
|
+
- **安全与隐私**:所有 TLS 证书与回环代理均在本机生成,网络流量仅流经本机回环地址(`127.0.0.1`)至 Magpie 网关,不接触任何外部中转服务。
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
### 安装方式
|
|
24
|
+
|
|
25
|
+
在 Magpie → **Plugins** 搜索 **Magpie-Cursor-Relay** 安装,或在终端执行:
|
|
26
|
+
```text
|
|
27
|
+
magpie plugin add magpie-cursor-relay
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
也可以直接从仓库安装:`github:adminwdsj/magpie-agent-cursor-bridge`。不要和上游的 `magpie-agent-cursor-bridge` 同时安装,两者使用同一个 Agent ID。
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 安装与快速上手
|
|
35
|
+
|
|
36
|
+
### 前置条件
|
|
37
|
+
- 已在本机安装 **Cursor** 与 **Magpie**。
|
|
38
|
+
- 已在 Magpie 中添加并配置好至少一个可用模型或路由组。
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
### Windows 系统使用步骤(上游历史说明,本分支当前不提供 Windows 引擎)
|
|
43
|
+
|
|
44
|
+
1. **运行初始化**:
|
|
45
|
+
在插件目录下打开 PowerShell 执行初始化脚本(或直接双击运行 `setup.cmd`):
|
|
46
|
+
```powershell
|
|
47
|
+
powershell -ExecutionPolicy Bypass -File .\setup.ps1
|
|
48
|
+
```
|
|
49
|
+
*注:首次初始化时会检查并提示信任本机生成的本地根证书(系统标准确认窗口选择“是”即可)。*
|
|
50
|
+
|
|
51
|
+
2. **在 Magpie 中选择模型**:
|
|
52
|
+
- 打开 Magpie,在 **Agents** 页面找到 **Magpie-Cursor-Relay**。
|
|
53
|
+
- 打开开关,并从下拉列表中挑选您希望在 Cursor 中使用的模型或路由组。
|
|
54
|
+
|
|
55
|
+
3. **在 Cursor 中刷新模型列表**:
|
|
56
|
+
- 首次开启后,后台桥接需要几十秒启动;等状态变为已连接即可。
|
|
57
|
+
- 打开对话面板,或点一下底部的模型下拉框——Cursor 会重新拉取模型表,Magpie 提供的模型随即出现,点击即可畅快对话。
|
|
58
|
+
|
|
59
|
+
> 无需重启 Cursor。模型目录是按请求下发的,只要 Cursor 重新发起一次拉取就会更新;
|
|
60
|
+
> 若列表没变,再点一次模型下拉框即可。重启也只是强制刷新的一种方式。
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
### macOS 系统使用步骤
|
|
65
|
+
|
|
66
|
+
1. **运行初始化**:
|
|
67
|
+
在终端中运行:
|
|
68
|
+
```bash
|
|
69
|
+
bash setup.command
|
|
70
|
+
```
|
|
71
|
+
*根据系统提示完成本地钥匙串证书信任授权。*
|
|
72
|
+
|
|
73
|
+
2. **在 Magpie 中选择模型**:
|
|
74
|
+
- 在 Magpie → **Agents** 中开启 **Magpie-Cursor-Relay** 并选择模型。
|
|
75
|
+
- 等后台桥接启动完成(几十秒),在 Cursor 中打开对话面板或点一下模型下拉框即可看到 Magpie 的模型;无需重启 Cursor。
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 常用管理命令
|
|
80
|
+
|
|
81
|
+
| 操作 | Windows (PowerShell) | macOS / Linux (Bash) |
|
|
82
|
+
| :--- | :--- | :--- |
|
|
83
|
+
| **启动/更新服务** | `powershell -ExecutionPolicy Bypass -File setup.ps1` | `bash setup.command` |
|
|
84
|
+
| **查看后台运行状态** | `powershell -ExecutionPolicy Bypass -File setup.ps1 status` | `bash setup.command status` |
|
|
85
|
+
| **停用并卸载后台服务** | `powershell -ExecutionPolicy Bypass -File setup.ps1 uninstall` | `bash setup.command uninstall` |
|
|
86
|
+
|
|
87
|
+
- **断开连接**:在 Magpie 的 Agents 页面选择 Disconnect,或在终端执行 `magpie cursor-bridge default`。
|
|
88
|
+
- **代理自愈与还原**:当桥接服务退出或在 Magpie 中断开连接时,Cursor 的代理配置会自动恢复为初始状态。
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 架构与工作流程
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
Magpie Agent 插件 → 写入私有连接配置 (connection.json)
|
|
96
|
+
↓
|
|
97
|
+
后台监视器 (Supervisor)
|
|
98
|
+
├─ 启停原生桥接引擎 (cursor-magpie-bridge)
|
|
99
|
+
└─ 自动维护/还原 Cursor 代理设置 (settings.json)
|
|
100
|
+
↓
|
|
101
|
+
Cursor 编辑器 ──[本地 TLS 回环代理]──> 原生桥接服务 ──[OpenAI 协议兼容]──> 本地 Magpie 网关 ──> 大模型提供商
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
- **配置与数据隔离目录**:
|
|
105
|
+
- Windows: `%USERPROFILE%\.config\magpie-cursor-bridge\`
|
|
106
|
+
- macOS: `~/.config/magpie-cursor-bridge/`
|
|
107
|
+
- **运行产物与自启**:
|
|
108
|
+
- Windows: 自启通过当前用户 Startup 目录无窗口后台执行。
|
|
109
|
+
- macOS: 通过 `launchd` 用户 LaunchAgent 守护。
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 开源协议
|
|
114
|
+
|
|
115
|
+
本项目核心遵循 [MIT License](LICENSE)。
|
|
116
|
+
部分原生协议核心来源于开源项目 cursor-byok(MIT License)。
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
The native bridge derives from [leookun/cursor-byok](https://github.com/leookun/cursor-byok), MIT, copyright 2026 leookun, commit 31e9f5cbc98a7d28cffcb5efbb9323cd3e143354(0.3.4 实际验证的源码基线). Its license is included as LICENSE. The exact source changes are in source.patch. Dependency versions are pinned by upstream Cargo.lock.
|
|
4
|
+
|
|
5
|
+
The supervisor uses jsonc-parser 3.3.1, MIT, copyright Microsoft Corporation; its license is included in node_modules/jsonc-parser/LICENSE.md. Dependencies of the native executable retain their respective licenses in their source packages.
|
|
6
|
+
|
|
7
|
+
Magpie is a separate installed application; this package uses its public Agent Plugin interface. Compatibility was developed against v0.1.1220. This package does not bundle Magpie or Cursor.
|