linco-connect 1.0.0 → 1.0.2
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 +22 -22
- package/bin/{linco.js → linco-connect.js} +7 -7
- package/package.json +2 -2
- package/public/index.html +4 -4
- package/server.js +1 -1
- package/src/httpStatic.js +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Codex: wss://chat.ddjf.info/socket/ai/codex
|
|
|
20
20
|
|
|
21
21
|
## 功能特性
|
|
22
22
|
|
|
23
|
-
- npm CLI 安装和启动:支持 `linco init/start/stop/doctor`,可用 `start --daemon` 后台运行。
|
|
23
|
+
- npm CLI 安装和启动:支持 `linco-connect init/start/stop/doctor`,可用 `start --daemon` 后台运行。
|
|
24
24
|
- 远端 IM 默认按配置连接,用户只需配置 `appId/appSecret`。
|
|
25
25
|
- 本地测试页的模拟前端 IM 默认不连接:需要本地页面联调时需显式添加 `--local-im` 或 `--mock-im`。
|
|
26
26
|
- 内置 Linco IM WebSocket 地址:用户只需配置 `appId/appSecret`,插件会在连接时拼成 `token=appId:appSecret`。
|
|
@@ -59,22 +59,22 @@ npm start
|
|
|
59
59
|
作为 npm CLI 使用时:
|
|
60
60
|
|
|
61
61
|
```bash
|
|
62
|
-
npm install -g linco
|
|
63
|
-
linco init --token "appId:appSecret" --agent claude
|
|
64
|
-
linco doctor
|
|
65
|
-
linco start
|
|
62
|
+
npm install -g linco-connect
|
|
63
|
+
linco-connect init --token "appId:appSecret" --agent claude
|
|
64
|
+
linco-connect doctor
|
|
65
|
+
linco-connect start
|
|
66
66
|
# 后台运行
|
|
67
|
-
linco start --daemon
|
|
67
|
+
linco-connect start --daemon
|
|
68
68
|
# 停止后台服务
|
|
69
|
-
linco stop
|
|
69
|
+
linco-connect stop
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
本地开发也可以用:
|
|
73
73
|
|
|
74
74
|
```bash
|
|
75
|
-
node bin/linco.js init --token "appId:appSecret" --agent claude
|
|
76
|
-
node bin/linco.js doctor
|
|
77
|
-
node bin/linco.js start
|
|
75
|
+
node bin/linco-connect.js init --token "appId:appSecret" --agent claude
|
|
76
|
+
node bin/linco-connect.js doctor
|
|
77
|
+
node bin/linco-connect.js start
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
## 初始化配置
|
|
@@ -82,13 +82,13 @@ node bin/linco.js start
|
|
|
82
82
|
推荐方式:
|
|
83
83
|
|
|
84
84
|
```bash
|
|
85
|
-
linco init --token "appId:appSecret" --agent claude
|
|
85
|
+
linco-connect init --token "appId:appSecret" --agent claude
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
可选参数:
|
|
89
89
|
|
|
90
90
|
```bash
|
|
91
|
-
linco init \
|
|
91
|
+
linco-connect init \
|
|
92
92
|
--token "appId:appSecret" \
|
|
93
93
|
--agent claude \
|
|
94
94
|
--account default \
|
|
@@ -179,39 +179,39 @@ C:\Users\<用户名>\.linco\config.json
|
|
|
179
179
|
默认启动本地服务,并按配置连接远端 IM;本地测试页不会自动连接模拟前端 IM:
|
|
180
180
|
|
|
181
181
|
```bash
|
|
182
|
-
linco start
|
|
182
|
+
linco-connect start
|
|
183
183
|
```
|
|
184
184
|
|
|
185
185
|
需要使用本地测试页模拟前端 IM 时,显式启用:
|
|
186
186
|
|
|
187
187
|
```bash
|
|
188
|
-
linco start --local-im
|
|
188
|
+
linco-connect start --local-im
|
|
189
189
|
# 等价写法
|
|
190
|
-
linco start --mock-im
|
|
190
|
+
linco-connect start --mock-im
|
|
191
191
|
```
|
|
192
192
|
|
|
193
193
|
后台启动:
|
|
194
194
|
|
|
195
195
|
```bash
|
|
196
|
-
linco start --daemon
|
|
196
|
+
linco-connect start --daemon
|
|
197
197
|
```
|
|
198
198
|
|
|
199
199
|
后台启动并启用本地模拟前端 IM:
|
|
200
200
|
|
|
201
201
|
```bash
|
|
202
|
-
linco start --daemon --local-im
|
|
202
|
+
linco-connect start --daemon --local-im
|
|
203
203
|
```
|
|
204
204
|
|
|
205
205
|
停止后台服务:
|
|
206
206
|
|
|
207
207
|
```bash
|
|
208
|
-
linco stop
|
|
208
|
+
linco-connect stop
|
|
209
209
|
```
|
|
210
210
|
|
|
211
211
|
后台模式会把 PID 和日志写入:
|
|
212
212
|
|
|
213
213
|
```text
|
|
214
|
-
~/.linco/linco.pid
|
|
214
|
+
~/.linco/linco-connect.pid
|
|
215
215
|
~/.linco/logs/daemon.out.log
|
|
216
216
|
~/.linco/logs/daemon.err.log
|
|
217
217
|
```
|
|
@@ -239,7 +239,7 @@ npm start -- --daemon
|
|
|
239
239
|
## 环境检查
|
|
240
240
|
|
|
241
241
|
```bash
|
|
242
|
-
linco doctor
|
|
242
|
+
linco-connect doctor
|
|
243
243
|
```
|
|
244
244
|
|
|
245
245
|
会检查:
|
|
@@ -419,8 +419,8 @@ outbox 目录: .../outbox
|
|
|
419
419
|
```bash
|
|
420
420
|
npm install
|
|
421
421
|
npm start
|
|
422
|
-
node bin/linco.js --help
|
|
423
|
-
node bin/linco.js doctor
|
|
422
|
+
node bin/linco-connect.js --help
|
|
423
|
+
node bin/linco-connect.js doctor
|
|
424
424
|
```
|
|
425
425
|
|
|
426
426
|
当前项目没有配置测试、lint 或构建脚本。
|
|
@@ -53,7 +53,7 @@ async function main() {
|
|
|
53
53
|
doctorCommand();
|
|
54
54
|
break;
|
|
55
55
|
default:
|
|
56
|
-
throw new Error(`未知命令: ${command}\n运行 linco --help 查看用法。`);
|
|
56
|
+
throw new Error(`未知命令: ${command}\n运行 linco-connect --help 查看用法。`);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -123,7 +123,7 @@ function initCommand(options) {
|
|
|
123
123
|
if (agentType) {
|
|
124
124
|
console.log(` Agent 类型: ${agentType}`);
|
|
125
125
|
}
|
|
126
|
-
console.log(' 下一步: linco doctor && linco start');
|
|
126
|
+
console.log(' 下一步: linco-connect doctor && linco-connect start');
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
function commandExists(command) {
|
|
@@ -299,7 +299,7 @@ async function stopCommand() {
|
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
function daemonPidFile(config) {
|
|
302
|
-
return path.join(config.lincoHome, 'linco.pid');
|
|
302
|
+
return path.join(config.lincoHome, 'linco-connect.pid');
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
function daemonLogFiles(config) {
|
|
@@ -448,10 +448,10 @@ function printHelp() {
|
|
|
448
448
|
console.log(`Linco Connect ${pkg.version}
|
|
449
449
|
|
|
450
450
|
用法:
|
|
451
|
-
linco init --token "appId:appSecret" --agent claude [--account default] [--force]
|
|
452
|
-
linco start [--daemon] [--local-im|--mock-im]
|
|
453
|
-
linco stop
|
|
454
|
-
linco doctor
|
|
451
|
+
linco-connect init --token "appId:appSecret" --agent claude [--account default] [--force]
|
|
452
|
+
linco-connect start [--daemon] [--local-im|--mock-im]
|
|
453
|
+
linco-connect stop
|
|
454
|
+
linco-connect doctor
|
|
455
455
|
|
|
456
456
|
说明:
|
|
457
457
|
init 初始化本地配置,不需要填写 wsUrl
|
package/package.json
CHANGED
package/public/index.html
CHANGED
|
@@ -1094,7 +1094,7 @@
|
|
|
1094
1094
|
const text = inputEl.value.trim();
|
|
1095
1095
|
if (!text && pendingAttachments.length === 0) return;
|
|
1096
1096
|
if (!connected) {
|
|
1097
|
-
addMessage('error', '本地模拟 IM 未连接,请使用 linco start --local-im 启动后再打开测试页。');
|
|
1097
|
+
addMessage('error', '本地模拟 IM 未连接,请使用 linco-connect start --local-im 启动后再打开测试页。');
|
|
1098
1098
|
return;
|
|
1099
1099
|
}
|
|
1100
1100
|
|
|
@@ -1128,7 +1128,7 @@
|
|
|
1128
1128
|
|
|
1129
1129
|
function safeSend(payload) {
|
|
1130
1130
|
if (!ws || ws.readyState !== WebSocket.OPEN) {
|
|
1131
|
-
addMessage('error', '本地模拟 IM 未连接,请使用 linco start --local-im 启动后再打开测试页。');
|
|
1131
|
+
addMessage('error', '本地模拟 IM 未连接,请使用 linco-connect start --local-im 启动后再打开测试页。');
|
|
1132
1132
|
return;
|
|
1133
1133
|
}
|
|
1134
1134
|
ws.send(JSON.stringify(payload));
|
|
@@ -1240,7 +1240,7 @@
|
|
|
1240
1240
|
|
|
1241
1241
|
function ensureLocalTokenForUi() {
|
|
1242
1242
|
if (localToken) return true;
|
|
1243
|
-
addMessage('error', '❌ 缺少本地访问 token,请使用 linco start 输出的本地测试页地址打开。');
|
|
1243
|
+
addMessage('error', '❌ 缺少本地访问 token,请使用 linco-connect start 输出的本地测试页地址打开。');
|
|
1244
1244
|
return false;
|
|
1245
1245
|
}
|
|
1246
1246
|
|
|
@@ -1291,7 +1291,7 @@
|
|
|
1291
1291
|
initializeAgentSelector(config);
|
|
1292
1292
|
if (!config.localImEnabled) {
|
|
1293
1293
|
setConnected(false);
|
|
1294
|
-
addMessage('system', '本地模拟 IM 默认关闭。需要测试本地前端 IM 时,请使用 linco start --local-im 启动。');
|
|
1294
|
+
addMessage('system', '本地模拟 IM 默认关闭。需要测试本地前端 IM 时,请使用 linco-connect start --local-im 启动。');
|
|
1295
1295
|
return;
|
|
1296
1296
|
}
|
|
1297
1297
|
connectWebSocket(config);
|
package/server.js
CHANGED
|
@@ -4,7 +4,7 @@ const { startServer } = require('./src/serverApp');
|
|
|
4
4
|
|
|
5
5
|
const cliFlags = process.argv.slice(2);
|
|
6
6
|
if (cliFlags.includes('--daemon') || cliFlags.includes('--local-im') || cliFlags.includes('--mock-im')) {
|
|
7
|
-
const cli = path.join(__dirname, 'bin', 'linco.js');
|
|
7
|
+
const cli = path.join(__dirname, 'bin', 'linco-connect.js');
|
|
8
8
|
const result = spawnSync(process.execPath, [cli, 'start', ...cliFlags], {
|
|
9
9
|
cwd: __dirname,
|
|
10
10
|
env: process.env,
|
package/src/httpStatic.js
CHANGED
|
@@ -63,7 +63,7 @@ function rejectUnauthorized(res) {
|
|
|
63
63
|
'Content-Type': 'text/plain; charset=utf-8',
|
|
64
64
|
'Cache-Control': 'no-store',
|
|
65
65
|
});
|
|
66
|
-
res.end('未授权访问本地测试页,请使用 linco start 输出的本地测试地址打开。');
|
|
66
|
+
res.end('未授权访问本地测试页,请使用 linco-connect start 输出的本地测试地址打开。');
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
function handleClientConfigRequest(req, res, config) {
|