@ours.network/claude-code 1.2.0-nightly.4 → 1.2.0-nightly.5
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/.claude-plugin/plugin.json +1 -1
- package/bin/proxy.mjs +4 -41
- package/dist/hooks/runner.js +7 -47
- package/package.json +4 -3
- package/bin/container-file-transfer.mjs +0 -147
- package/bin/container-launch.d.mts +0 -2
- package/bin/container-launch.mjs +0 -40
- package/dist/network-client.mjs +0 -16924
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "ours.network",
|
|
4
4
|
"displayName": "ours.network",
|
|
5
5
|
"description": "Secure agent-to-agent communication channel over ADAPT: self-sovereign pubkey identity, end-to-end encryption.",
|
|
6
|
-
"version": "1.2.0-nightly.
|
|
6
|
+
"version": "1.2.0-nightly.5",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Adapt Toolkit"
|
|
9
9
|
},
|
package/bin/proxy.mjs
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
|
-
import { existsSync
|
|
5
|
-
import { homedir } from 'node:os';
|
|
4
|
+
import { existsSync } from 'node:fs';
|
|
6
5
|
import { dirname, join } from 'node:path';
|
|
7
6
|
import { fileURLToPath } from 'node:url';
|
|
8
7
|
|
|
9
|
-
import { containerInvocation } from './container-launch.mjs';
|
|
10
|
-
import { runContainerProxy } from './container-file-transfer.mjs';
|
|
11
8
|
|
|
12
9
|
const sessionEnd = process.argv[2] === 'session-end';
|
|
13
10
|
const watch = process.argv[2] === 'watch';
|
|
14
|
-
const command = sessionEnd ? 'session-end' : 'proxy';
|
|
15
|
-
const forwarded = process.argv.slice(sessionEnd ? 3 : 2);
|
|
11
|
+
const command = sessionEnd ? 'session-end' : watch ? 'watch' : 'proxy';
|
|
12
|
+
const forwarded = process.argv.slice(sessionEnd || watch ? 3 : 2);
|
|
16
13
|
const env = { ...process.env };
|
|
17
14
|
const require = createRequire(import.meta.url);
|
|
18
15
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
@@ -48,43 +45,9 @@ function relayChild(child, label) {
|
|
|
48
45
|
}
|
|
49
46
|
|
|
50
47
|
async function main() {
|
|
51
|
-
const network = await import('../dist/network-client.mjs');
|
|
52
|
-
const profile = network.hostProfileFromEnv(env);
|
|
53
|
-
if (profile) {
|
|
54
|
-
const configPath = env.OURS_MCP_CONFIG || join(env.HOME || homedir(), '.ours-mcp', 'config.json');
|
|
55
|
-
const hostRecordRoot = dirname(configPath);
|
|
56
|
-
if (sessionEnd) {
|
|
57
|
-
const payload = JSON.parse(readFileSync(0, 'utf8') || '{}');
|
|
58
|
-
if (typeof payload.session_id !== 'string' || !payload.session_id) throw new Error('SessionEnd requires session_id.');
|
|
59
|
-
await network.endNetworkNativeSession({ profile, nativeSessionId: payload.session_id, hostRecordRoot });
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const nativeSessionId = env.CLAUDE_CODE_SESSION_ID;
|
|
63
|
-
if (watch) {
|
|
64
|
-
await network.runNetworkWatch({ identity: process.argv[3], nativeSessionId, profile, hostRecordRoot, env });
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
await network.runNetworkProxy({ nativeSessionId, profile, hostRecordRoot, env });
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const container = containerInvocation(watch ? 'watch' : command, watch ? process.argv.slice(3) : forwarded, env);
|
|
72
|
-
if (container) {
|
|
73
|
-
const child = watch || sessionEnd
|
|
74
|
-
? spawn(container.command, container.args, { stdio: watch ? ['pipe', 'inherit', 'inherit'] : 'inherit', env: container.env })
|
|
75
|
-
: runContainerProxy(container);
|
|
76
|
-
if (watch) {
|
|
77
|
-
const stop = () => { child.stdin?.end(); if (!child.killed) child.kill('SIGTERM'); };
|
|
78
|
-
process.on('SIGINT', stop);
|
|
79
|
-
process.on('SIGTERM', stop);
|
|
80
|
-
}
|
|
81
|
-
if (watch || sessionEnd) relayChild(child, 'container MCP');
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
48
|
const cliPath = resolveLocalServer();
|
|
86
49
|
if (!cliPath) {
|
|
87
|
-
throw new Error('cannot resolve @ours.network/mcp.
|
|
50
|
+
throw new Error('cannot resolve @ours.network/mcp. Reinstall the plugin with its declared MCP dependency.');
|
|
88
51
|
}
|
|
89
52
|
if (!env.OURS_CLIENT_PID && process.ppid > 1) env.OURS_CLIENT_PID = String(process.ppid);
|
|
90
53
|
const child = spawn(process.execPath, [cliPath, command, ...forwarded], { stdio: 'inherit', env });
|