magpie-cursor-relay 0.3.10 → 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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.11
4
+
5
+ 修复 `magpie cursor-bridge <模型>` 命令行连接报 `ReferenceError: process is not defined`:Magpie 命令行在没有 `process` 的沙箱里执行插件的 `connect()`,自动启动检查现在先判断 `process` 是否存在,连接配置照常写出,由已在运行的后台桥接自行接管。
6
+
7
+ - 验证:插件测试 72 项通过,新增无 `process` 沙箱的连接回归测试(修复前失败)。
8
+
3
9
  ## 0.3.10
4
10
 
5
11
  改名 **Magpie-Cursor-Relay**(npm 包 `magpie-cursor-relay`),准备上架 Magpie 插件市场,与同名上游 `magpie-agent-cursor-bridge` 区分。Agent ID 仍是 `cursor-bridge`,已有连接与设置不受影响。
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  让 Cursor 编辑器直接使用 Magpie 中配置的全部模型与路由组。模型菜单返回 Magpie 模型目录,隐藏 Cursor 默认 Auto 入口,保留 Cursor 原有登录。
4
4
 
5
- 当前发布 **0.3.10,仅随包提供 Apple Silicon macOS 引擎**;Windows / Intel macOS 暂无对应发布产物。
5
+ 当前发布 **0.3.11,仅随包提供 Apple Silicon macOS 引擎**;Windows / Intel macOS 暂无对应发布产物。
6
6
 
7
7
  **和市场里其他 Cursor 插件的区别**
8
8
 
package/agent.js CHANGED
@@ -27,7 +27,9 @@ export function connect({ gateway, model, models }) {
27
27
  function start() {
28
28
  // Capture the opt-out before returning to the caller; tests may restore env
29
29
  // before the asynchronous startup callback runs.
30
- if (process.env.MAGPIE_CURSOR_BRIDGE_NO_AUTOSTART) return;
30
+ // Magpie's CLI runs connect() in a sandbox with no `process`; the running
31
+ // supervisor picks the new connection.json up on its own there.
32
+ if (typeof process === 'undefined' || process.env.MAGPIE_CURSOR_BRIDGE_NO_AUTOSTART) return;
31
33
  Promise.resolve().then(async () => {
32
34
  const fs = await import('node:fs');
33
35
  const os = await import('node:os');
package/integrity.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.3.10",
2
+ "version": "0.3.11",
3
3
  "engine_version": "0.2.1",
4
4
  "engine": "2ed05bbb3f9e42f2874f3417324655d1f7f2c0c30fa00430bf965e98c4def327"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "magpie-cursor-relay",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "type": "module",
5
5
  "description": "Magpie-Cursor-Relay:让 Cursor 用 Magpie 的全部模型与路由组(Apple Silicon macOS)",
6
6
  "license": "MIT",
@@ -24,3 +24,10 @@ test('model names follow live Magpie names, then snapshot, then bare model id',a
24
24
  test('disconnected configuration is inactive',()=>{assert.equal(validate({}),null);assert.equal(validate({...c,enabled:false}),null);});
25
25
  test('refuses remote gateway and credential-bearing URL',()=>{for(const gateway of ['https://evil.example/v1','http://127.0.0.1.evil.example','http://key@127.0.0.1','file:///tmp/test'])assert.throws(()=>validate({...c,gateway}));});
26
26
  test('selected model must exist and IDs must be unique',()=>{assert.throws(()=>validate({...c,model:'missing'}));assert.throws(()=>validate({...c,models:[...c.models,...c.models]}));});
27
+ test('connect answers in a sandbox without process',()=>{
28
+ const real=globalThis.process;
29
+ let out;
30
+ try { globalThis.process=undefined; out=connect({gateway:{v1:c.gateway,key:c.key},models:c.models}); }
31
+ finally { globalThis.process=real; }
32
+ assert.equal(out.enabled,true);assert.equal(out.models[0].id,c.model);
33
+ });