linco-connect 1.0.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/server.js ADDED
@@ -0,0 +1,17 @@
1
+ const { spawnSync } = require('child_process');
2
+ const path = require('path');
3
+ const { startServer } = require('./src/serverApp');
4
+
5
+ const cliFlags = process.argv.slice(2);
6
+ if (cliFlags.includes('--daemon') || cliFlags.includes('--local-im') || cliFlags.includes('--mock-im')) {
7
+ const cli = path.join(__dirname, 'bin', 'linco.js');
8
+ const result = spawnSync(process.execPath, [cli, 'start', ...cliFlags], {
9
+ cwd: __dirname,
10
+ env: process.env,
11
+ stdio: 'inherit',
12
+ windowsHide: true,
13
+ });
14
+ process.exit(result.status || 0);
15
+ }
16
+
17
+ startServer(__dirname);
@@ -0,0 +1,37 @@
1
+ const claude = require('./agents/claude');
2
+ const codex = require('./agents/codex');
3
+
4
+ const providers = {
5
+ claude,
6
+ codex,
7
+ };
8
+
9
+ function providerFor(session) {
10
+ const agentType = session.agentType || 'claude';
11
+ const provider = providers[agentType];
12
+ if (!provider) throw new Error(`不支持的 Agent: ${agentType}`);
13
+ return provider;
14
+ }
15
+
16
+ function executeAgentQuery(input, ws, session, config) {
17
+ return providerFor(session).execute(input, ws, session, config);
18
+ }
19
+
20
+ function resolvePendingDanger(confirmed, ws, session, config) {
21
+ return providerFor(session).resolvePendingDanger?.(confirmed, ws, session, config) || false;
22
+ }
23
+
24
+ function resolvePendingPermission(allowed, ws, session, config) {
25
+ return providerFor(session).resolvePendingPermission?.(allowed, ws, session, config) || false;
26
+ }
27
+
28
+ function stopAgentProcess(session, options = {}) {
29
+ return providerFor(session).stop?.(session, options);
30
+ }
31
+
32
+ module.exports = {
33
+ executeAgentQuery,
34
+ resolvePendingDanger,
35
+ resolvePendingPermission,
36
+ stopAgentProcess,
37
+ };
@@ -0,0 +1 @@
1
+ module.exports = require('../claudeRunner');