linco-connect 1.0.9 → 1.1.0
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/bin/linco-connect.js +23 -4
- package/package.json +1 -1
- package/public/index.html +3 -2
- package/src/agentRunner.js +2 -0
- package/src/agents/openclaw.js +609 -0
- package/src/attachmentHandler.js +34 -5
- package/src/config.js +20 -4
- package/src/httpStatic.js +2 -2
- package/src/imConnector.js +78 -3
- package/src/lincoProtocol.js +24 -1
- package/src/openclawGateway.js +442 -0
- package/src/slashCommands.js +4 -0
- package/src/wsServer.js +5 -1
package/bin/linco-connect.js
CHANGED
|
@@ -16,6 +16,10 @@ const {
|
|
|
16
16
|
} = require('../src/config');
|
|
17
17
|
const { ensureLocalToken, localUrlWithToken } = require('../src/localAuth');
|
|
18
18
|
const { checkGatewayHealth, resolveHermesGatewayOptions } = require('../src/hermesGateway');
|
|
19
|
+
const {
|
|
20
|
+
checkGatewayHealth: checkOpenClawGatewayHealth,
|
|
21
|
+
resolveOpenClawGatewayOptions,
|
|
22
|
+
} = require('../src/openclawGateway');
|
|
19
23
|
const pkg = require('../package.json');
|
|
20
24
|
|
|
21
25
|
const rootDir = path.resolve(__dirname, '..');
|
|
@@ -147,6 +151,8 @@ function mergeInitConfig(current, values) {
|
|
|
147
151
|
appSecret: values.appSecret,
|
|
148
152
|
enabled: true,
|
|
149
153
|
};
|
|
154
|
+
if (values.agentType === 'openclaw') accountEntry.openclawAgentId = 'main';
|
|
155
|
+
const agentType = values.agentType || 'claude';
|
|
150
156
|
|
|
151
157
|
return {
|
|
152
158
|
...current,
|
|
@@ -157,13 +163,13 @@ function mergeInitConfig(current, values) {
|
|
|
157
163
|
...(current.channels?.linco || {}),
|
|
158
164
|
agents: {
|
|
159
165
|
...(current.channels?.linco?.agents || {}),
|
|
160
|
-
[
|
|
161
|
-
...(current.channels?.linco?.agents?.[
|
|
166
|
+
[agentType]: {
|
|
167
|
+
...(current.channels?.linco?.agents?.[agentType] || {}),
|
|
162
168
|
defaultAccount: values.account,
|
|
163
169
|
accounts: {
|
|
164
|
-
...(current.channels?.linco?.agents?.[
|
|
170
|
+
...(current.channels?.linco?.agents?.[agentType]?.accounts || {}),
|
|
165
171
|
[values.account]: {
|
|
166
|
-
...(current.channels?.linco?.agents?.[
|
|
172
|
+
...(current.channels?.linco?.agents?.[agentType]?.accounts?.[values.account] || {}),
|
|
167
173
|
...accountEntry,
|
|
168
174
|
},
|
|
169
175
|
},
|
|
@@ -425,6 +431,19 @@ async function doctorCommand() {
|
|
|
425
431
|
} else {
|
|
426
432
|
checks.push([`${agentType} Gateway`, false, `未运行,且 autoStartGateway=false ${options.gatewayUrl}`]);
|
|
427
433
|
}
|
|
434
|
+
} else if (agentType === 'openclaw') {
|
|
435
|
+
const options = resolveOpenClawGatewayOptions(agent);
|
|
436
|
+
const health = await checkOpenClawGatewayHealth(options.gatewayUrl, agent, { timeoutMs: 3000 });
|
|
437
|
+
if (health.ok) {
|
|
438
|
+
checks.push([`${agentType} Gateway`, true, options.gatewayUrl]);
|
|
439
|
+
} else if (agent.autoStartGateway !== false) {
|
|
440
|
+
const hasCli = !agent.enabled || (path.isAbsolute(options.openclawBin) ? fs.existsSync(options.openclawBin) : commandExists(options.openclawBin));
|
|
441
|
+
checks.push([`${agentType} Gateway`, true, `not running; OpenClaw messages will auto-start ${options.gatewayUrl}`]);
|
|
442
|
+
checks.push([`${agentType} CLI`, hasCli, options.openclawBin]);
|
|
443
|
+
} else {
|
|
444
|
+
checks.push([`${agentType} Gateway`, false, `not running and autoStartGateway=false ${options.gatewayUrl}`]);
|
|
445
|
+
}
|
|
446
|
+
checks.push([`${agentType} Agent ID`, true, agent.openclawAgentId || 'main']);
|
|
428
447
|
} else {
|
|
429
448
|
checks.push([`${agentType} CLI`, !agent.enabled || (path.isAbsolute(agent.bin) ? fs.existsSync(agent.bin) : commandExists(agent.bin)), agent.bin]);
|
|
430
449
|
}
|
package/package.json
CHANGED
package/public/index.html
CHANGED
|
@@ -577,6 +577,7 @@
|
|
|
577
577
|
<option value="claude">Claude Code</option>
|
|
578
578
|
<option value="codex">Codex</option>
|
|
579
579
|
<option value="hermes">Hermes</option>
|
|
580
|
+
<option value="openclaw">OpenClaw</option>
|
|
580
581
|
</select>
|
|
581
582
|
</div>
|
|
582
583
|
<div id="messages"></div>
|
|
@@ -1180,11 +1181,11 @@
|
|
|
1180
1181
|
|
|
1181
1182
|
function normalizeAgentType(value) {
|
|
1182
1183
|
const type = String(value || 'claude').trim().toLowerCase();
|
|
1183
|
-
return ['claude', 'codex', 'hermes'].includes(type) ? type : 'claude';
|
|
1184
|
+
return ['claude', 'codex', 'hermes', 'openclaw'].includes(type) ? type : 'claude';
|
|
1184
1185
|
}
|
|
1185
1186
|
|
|
1186
1187
|
function agentLabel(type) {
|
|
1187
|
-
return type === 'codex' ? 'Codex' : type === 'hermes' ? 'Hermes' : 'Claude Code';
|
|
1188
|
+
return type === 'codex' ? 'Codex' : type === 'hermes' ? 'Hermes' : type === 'openclaw' ? 'OpenClaw' : 'Claude Code';
|
|
1188
1189
|
}
|
|
1189
1190
|
|
|
1190
1191
|
function setAgentSelection(agentType, options = {}) {
|
package/src/agentRunner.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
const claude = require('./agents/claude');
|
|
2
2
|
const codex = require('./agents/codex');
|
|
3
3
|
const hermes = require('./agents/hermes');
|
|
4
|
+
const openclaw = require('./agents/openclaw');
|
|
4
5
|
|
|
5
6
|
const providers = {
|
|
6
7
|
claude,
|
|
7
8
|
codex,
|
|
8
9
|
hermes,
|
|
10
|
+
openclaw,
|
|
9
11
|
};
|
|
10
12
|
|
|
11
13
|
function providerFor(session) {
|