@fxz26284407/yuanma-gateway 0.1.9 → 0.1.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/README.md +3 -3
- package/bin/yuanma-gateway.mjs +2 -2
- package/dist/deepseek.js +1 -1
- package/dist/platform/macos.js +1 -1
- package/dist/platform/windows.js +2 -2
- package/dist/server.js +1 -1
- package/package.json +3 -3
- package/scripts/restart-local-gateway.mjs +2 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## 平台支持
|
|
6
6
|
|
|
7
|
-
从 0.1.8 起,macOS 与 Windows 11 x64 使用同一个 npm 包和版本,通过系统适配器连接 Codex、DeepSeek Harness 与 Antigravity。要求 Node.js 22,安装和升级命令相同。Windows 项目目录兼容反斜杠与正斜杠。
|
|
7
|
+
从 0.1.8 起,macOS 与 Windows 11 x64 使用同一个 npm 包和版本,通过系统适配器连接 Codex、DeepSeek Harness 与 Antigravity。要求 Node.js 22 或 26,安装和升级命令相同。Windows 项目目录兼容反斜杠与正斜杠。
|
|
8
8
|
|
|
9
9
|
Windows 本地管理接口使用仅监听回环地址的鉴权入口,文件权限按当前用户 SID 设置;macOS 继续使用 Unix socket。二维码已缩小,配对准备阶段显示等待提示。
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ Windows 本地管理接口使用仅监听回环地址的鉴权入口,文件权
|
|
|
12
12
|
|
|
13
13
|
已发布的网关支持手机与电脑在同一局域网直连,无需部署 Relay。当前 App 最低要求网关 0.1.7,请同时更新手机与网关。
|
|
14
14
|
|
|
15
|
-
在电脑安装 Node.js 22,并准备好与桌面共用的 Codex app-server 入口后执行:
|
|
15
|
+
在电脑安装 Node.js 22 或 26,并准备好与桌面共用的 Codex app-server 入口后执行:
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
18
|
npm install -g @fxz26284407/yuanma-gateway@latest --registry=https://registry.npmmirror.com
|
|
@@ -92,7 +92,7 @@ yuanma-gateway pair --relay-url wss://relay.example.com
|
|
|
92
92
|
|
|
93
93
|
## Mac 网关安装(npm)
|
|
94
94
|
|
|
95
|
-
需要 **macOS、Node.js 22**,以及已登录、与桌面共用的 Codex app-server。当前适配固定为 app-server **0.166.0**;其他版本需要先适配协议。DeepSeek 功能另外依赖本机已有的 DeepSeek Harness 和登录。
|
|
95
|
+
需要 **macOS、Node.js 22 或 26**,以及已登录、与桌面共用的 Codex app-server。当前适配固定为 app-server **0.166.0**;其他版本需要先适配协议。DeepSeek 功能另外依赖本机已有的 DeepSeek Harness 和登录。
|
|
96
96
|
|
|
97
97
|
### 安装
|
|
98
98
|
|
package/bin/yuanma-gateway.mjs
CHANGED
|
@@ -18,7 +18,7 @@ const root=fileURLToPath(new URL('../',import.meta.url));
|
|
|
18
18
|
const home=platform.gatewayHome;
|
|
19
19
|
const settingsPath=join(home,'installation.json');
|
|
20
20
|
const cli=join(root,'dist/cli.js');
|
|
21
|
-
const help=`远码网关(需要 Node.js 22 和已登录的桌面智能体)
|
|
21
|
+
const help=`远码网关(需要 Node.js 22 或 26 和已登录的桌面智能体)
|
|
22
22
|
yuanma-gateway init [--backend codex|deepseek|antigravity] [--codex-endpoint 本机共享入口] [--relay-url wss://域名] [--projects 项目ID,项目ID] [--allow-development-keys] [--accept-project-access]
|
|
23
23
|
yuanma-gateway init --config 原配置绝对路径 --state-dir 原状态目录绝对路径
|
|
24
24
|
yuanma-gateway start [--relay-url wss://域名]
|
|
@@ -180,7 +180,7 @@ async function run(path,args){
|
|
|
180
180
|
|
|
181
181
|
try{
|
|
182
182
|
platform.supportedHost();
|
|
183
|
-
if(
|
|
183
|
+
if(!/^(22|26)\./.test(process.versions.node))throw Error('请使用 Node.js 22 或 26');
|
|
184
184
|
const [action='help',...args]=process.argv.slice(2);
|
|
185
185
|
if(['help','--help','-h'].includes(action)||args.includes('--help'))console.log(help);
|
|
186
186
|
else if(['--version','version'].includes(action))console.log(JSON.parse(await readFile(join(root,'package.json'),'utf8')).version);
|
package/dist/deepseek.js
CHANGED
|
@@ -538,7 +538,7 @@ export class DeepSeekBackend {
|
|
|
538
538
|
await this.inspect(projectId, id);
|
|
539
539
|
requireValue(serviceTier === undefined, 'INVALID_MODEL', 'Harness 没有 Fast 档位', 400);
|
|
540
540
|
const entry = (await this.listModels()).find(m => m.model === model);
|
|
541
|
-
requireValue(entry && (entry.efforts.
|
|
541
|
+
requireValue(entry && (entry.efforts.includes(effort) || (effort === '' && entry.defaultEffort === '')), 'INVALID_MODEL', '模型或思考深度不可用', 400);
|
|
542
542
|
const [provider, nativeModel] = JSON.parse(entry.model);
|
|
543
543
|
const result = await this.call('session/selectModel', { request: { sessionId: id, provider, model: nativeModel, ...(effort ? { reasoningEffort: effort } : {}) } });
|
|
544
544
|
const applied = this.selectionView(result.selected);
|
package/dist/platform/macos.js
CHANGED
|
@@ -192,7 +192,7 @@ export class MacOsAdapter extends HostAdapter {
|
|
|
192
192
|
}
|
|
193
193
|
})
|
|
194
194
|
};
|
|
195
|
-
pairingRuntime() { return process.versions.node
|
|
195
|
+
pairingRuntime() { return /^(22|26)\./.test(process.versions.node) ? process.execPath : execFileSync('/bin/zsh', ['-c', 'source "$1"; nvm which 22', 'codex-mobile-runtime', join(homedir(), '.nvm/nvm.sh')], { encoding: 'utf8' }).trim(); }
|
|
196
196
|
async browserInstalled(metadata) {
|
|
197
197
|
const names = (metadata.macos?.applicationNames ?? []).filter((name) => typeof name === 'string' && name === basename(name) && name.endsWith('.app'));
|
|
198
198
|
for (const name of names.slice(0, 8))
|
package/dist/platform/windows.js
CHANGED
|
@@ -184,8 +184,8 @@ export class WindowsAdapter extends HostAdapter {
|
|
|
184
184
|
checkProjectName(name) { requireValue(!(/[<>:"|?*]|[. ]$/.test(name) || /^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(name)), 'INVALID_REQUEST', '项目名称不符合 Windows 文件命名规则', 400); }
|
|
185
185
|
documentNameAllowed(name) { return !/[<>:"|?*]/.test(name); }
|
|
186
186
|
homeRelative(path) { return super.homeRelative(path) || path.startsWith('~\\'); }
|
|
187
|
-
pairingRuntime() { if (
|
|
188
|
-
throw Error('请使用 Node.js 22 运行配对命令'); return process.execPath; }
|
|
187
|
+
pairingRuntime() { if (!/^(22|26)\./.test(process.versions.node))
|
|
188
|
+
throw Error('请使用 Node.js 22 或 26 运行配对命令'); return process.execPath; }
|
|
189
189
|
codexConnection(endpoint) {
|
|
190
190
|
if (/^wss?:\/\//.test(endpoint)) {
|
|
191
191
|
const port = Number(localWebsocketUrl(endpoint).port);
|
package/dist/server.js
CHANGED
|
@@ -647,7 +647,7 @@ export async function startGateway(options) {
|
|
|
647
647
|
const projectId = text(data.projectId, 'projectId');
|
|
648
648
|
allowed(projectId, actor, true);
|
|
649
649
|
requireValue(current().backend.setModel, 'UNSUPPORTED_COMMAND', 'Model settings unavailable', 503);
|
|
650
|
-
return current().backend.setModel(projectId, text(data.threadId, 'threadId'), text(data.model, 'model'), text(data.effort, 'effort'), data.serviceTier);
|
|
650
|
+
return current().backend.setModel(projectId, text(data.threadId, 'threadId'), text(data.model, 'model'), data.effort === '' ? '' : text(data.effort, 'effort'), data.serviceTier);
|
|
651
651
|
}
|
|
652
652
|
if (req.method === 'POST' && path === '/v1/questions/reply') {
|
|
653
653
|
const projectId = text(data.projectId, 'projectId');
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fxz26284407/yuanma-gateway",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
|
-
"node": "22.x"
|
|
6
|
+
"node": "22.x || 26.x"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "tsc",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"prepack": "npm run build"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"better-sqlite3": "12.
|
|
17
|
+
"better-sqlite3": "12.10.0",
|
|
18
18
|
"noise-handshake": "4.2.0",
|
|
19
19
|
"qrcode-terminal": "^0.12.0",
|
|
20
20
|
"ws": "8.20.0"
|
|
@@ -27,7 +27,7 @@ export async function gatewayLaunch(stateDir){
|
|
|
27
27
|
if(!startup){
|
|
28
28
|
// ponytail: only the verified legacy default launch can migrate without startup metadata.
|
|
29
29
|
const config=resolve(root,'.local/gateway-config.json');
|
|
30
|
-
if(!command.includes(cli)||!command.includes(config)||!command.includes(dir)
|
|
30
|
+
if(!command.includes(cli)||!command.includes(config)||!command.includes(dir)||!/^(22|26)\./.test(process.versions.node))throw Error('Cannot verify legacy launch; restart this instance manually once');
|
|
31
31
|
startup={argv:[cli,'start','--config',config,'--state-dir',dir],cwd:root,execPath:process.execPath};
|
|
32
32
|
if(/(?:^|\s)--relay-url(?:=|\s)/.test(command)&&previous.relayUrl)startup.argv.push('--relay-url',relayEndpoint(previous.relayUrl));
|
|
33
33
|
}
|
|
@@ -59,7 +59,7 @@ export function connectionArgs(connection){
|
|
|
59
59
|
throw Error('Unknown connection mode');
|
|
60
60
|
}
|
|
61
61
|
export async function restartGateway(stateDir,requested){
|
|
62
|
-
if(
|
|
62
|
+
if(!/^(22|26)\./.test(process.versions.node))throw Error('Restart requires Node.js 22 or 26');
|
|
63
63
|
const {dir,owner,startup,values,config,previous}=await gatewayLaunch(stateDir);
|
|
64
64
|
const connection=typeof requested==='string'?{connectionMode:'relay',relayUrl:requested}:requested??{
|
|
65
65
|
connectionMode:previous.connectionMode??(previous.relayUrl?'relay':'local'),
|