@ravefox/space 0.0.0-stage → 0.2.1
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/LICENSE +205 -0
- package/NOTICE +55 -0
- package/README.md +63 -2
- package/assets/webhook-sdk/python/bot.py +63 -0
- package/assets/webhook-sdk/python/commonly.py +232 -0
- package/node_modules/@commonlyai/seats/README.md +25 -0
- package/node_modules/@commonlyai/seats/package.json +22 -0
- package/node_modules/@commonlyai/seats/src/adapters/hermes.js +264 -0
- package/node_modules/@commonlyai/seats/src/adapters/stub.js +24 -0
- package/node_modules/@commonlyai/seats/src/contract.js +48 -0
- package/node_modules/@commonlyai/seats/src/failures.js +44 -0
- package/node_modules/@commonlyai/seats/src/harness-plan.js +329 -0
- package/node_modules/@commonlyai/seats/src/index.js +22 -0
- package/node_modules/@commonlyai/seats/src/process-group.js +269 -0
- package/node_modules/@commonlyai/seats/src/record/format.js +737 -0
- package/node_modules/@commonlyai/seats/src/record/otel.js +238 -0
- package/node_modules/@commonlyai/seats/src/runtime-observation.js +29 -0
- package/node_modules/@commonlyai/seats/src/seat-model.js +17 -0
- package/node_modules/@commonlyai/seats/src/supervisor.js +308 -0
- package/node_modules/@commonlyai/seats/src/trace/events.js +46 -0
- package/node_modules/@commonlyai/seats/src/trace/store.js +276 -0
- package/node_modules/@commonlyai/seats/src/turn-processes.js +226 -0
- package/node_modules/@commonlyai/seats/src/upstream-refusal.js +418 -0
- package/node_modules/@commonlyai/seats/src/valet/env.js +201 -0
- package/node_modules/@commonlyai/seats/src/valet/grant.js +123 -0
- package/node_modules/@commonlyai/seats/src/valet/permissions.js +213 -0
- package/node_modules/@commonlyai/seats/src/wire/provider-proxy.js +529 -0
- package/package.json +63 -4
- package/skills/commonly/SKILL.md +233 -0
- package/src/commands/agent.js +6334 -0
- package/src/commands/daemon.js +933 -0
- package/src/commands/dev.js +153 -0
- package/src/commands/doctor.js +141 -0
- package/src/commands/inbox.js +330 -0
- package/src/commands/login.js +194 -0
- package/src/commands/mcp.js +56 -0
- package/src/commands/pod.js +120 -0
- package/src/commands/task.js +279 -0
- package/src/commands/verify.js +48 -0
- package/src/index.js +99 -0
- package/src/lib/adapter-login.js +76 -0
- package/src/lib/adapters/broker-bridge-entry.js +76 -0
- package/src/lib/adapters/claude.js +2207 -0
- package/src/lib/adapters/codex-broker-bridge.mjs +298 -0
- package/src/lib/adapters/codex.js +1898 -0
- package/src/lib/adapters/dsh.js +513 -0
- package/src/lib/adapters/goose.js +510 -0
- package/src/lib/adapters/hermes.js +18 -0
- package/src/lib/adapters/index.js +68 -0
- package/src/lib/adapters/opencode.js +1681 -0
- package/src/lib/adapters/pi-commonly-mcp.mjs +71 -0
- package/src/lib/adapters/pi-mcp-client.mjs +617 -0
- package/src/lib/adapters/pi-shell-env.mjs +41 -0
- package/src/lib/adapters/pi.js +1025 -0
- package/src/lib/adapters/qwen.js +523 -0
- package/src/lib/adapters/seat-model.js +8 -0
- package/src/lib/adapters/stub.js +1 -0
- package/src/lib/adapters/tested-version.js +106 -0
- package/src/lib/api.js +205 -0
- package/src/lib/claim-outcome.js +128 -0
- package/src/lib/claimed-work-gate.js +73 -0
- package/src/lib/cli-hint.js +33 -0
- package/src/lib/commit-attribution.js +391 -0
- package/src/lib/config.js +155 -0
- package/src/lib/content-refusal.js +94 -0
- package/src/lib/credential-file.js +208 -0
- package/src/lib/daemon-agent-states.js +95 -0
- package/src/lib/daemon-hint.js +18 -0
- package/src/lib/daemon-logs.js +43 -0
- package/src/lib/daemon-service-windows.js +263 -0
- package/src/lib/daemon-service.js +486 -0
- package/src/lib/daemon-state.js +84 -0
- package/src/lib/daemon-store.js +119 -0
- package/src/lib/daemon-supervisor.js +629 -0
- package/src/lib/daemon-watch.js +115 -0
- package/src/lib/declared-mcp-guard.js +284 -0
- package/src/lib/default-environment.js +207 -0
- package/src/lib/device-login.js +126 -0
- package/src/lib/digest-frame.js +151 -0
- package/src/lib/doctor.js +291 -0
- package/src/lib/egress-proxy.js +160 -0
- package/src/lib/enforcement.js +946 -0
- package/src/lib/environment.js +681 -0
- package/src/lib/first-output-watchdog.js +191 -0
- package/src/lib/git-readonly-server.js +138 -0
- package/src/lib/git-readonly.js +463 -0
- package/src/lib/git-remote-commonly.mjs +100 -0
- package/src/lib/grant-broker-guard.js +345 -0
- package/src/lib/hooks-config.js +238 -0
- package/src/lib/host-gh-broker.js +152 -0
- package/src/lib/host-gh-shim.mjs +98 -0
- package/src/lib/inbox.js +483 -0
- package/src/lib/instance-proxy.js +76 -0
- package/src/lib/machine-host.js +29 -0
- package/src/lib/mcp-credential-delivery.js +121 -0
- package/src/lib/mcp-first-run.js +50 -0
- package/src/lib/mcp-home.js +644 -0
- package/src/lib/mcp-ready.js +68 -0
- package/src/lib/mcp-server-version.js +123 -0
- package/src/lib/mcp-token.js +36 -0
- package/src/lib/mcp-warm-child.mjs +412 -0
- package/src/lib/memory-bridge.js +191 -0
- package/src/lib/memory-import.js +156 -0
- package/src/lib/missing-harness.js +31 -0
- package/src/lib/model-unavailable.js +154 -0
- package/src/lib/native-runtime-inventory.js +40 -0
- package/src/lib/outsider-grant-mcp.js +82 -0
- package/src/lib/own-key-launch.js +42 -0
- package/src/lib/pod-catch-up.js +55 -0
- package/src/lib/pod-focus.js +224 -0
- package/src/lib/pod-tail.js +68 -0
- package/src/lib/poll-liveness.js +103 -0
- package/src/lib/poll-retry.js +81 -0
- package/src/lib/poller.js +200 -0
- package/src/lib/provider-proxy.js +42 -0
- package/src/lib/public-seat-mcp-flag.js +36 -0
- package/src/lib/public-tool-error.js +60 -0
- package/src/lib/public-withheld-tools.js +48 -0
- package/src/lib/reply-receipt.js +55 -0
- package/src/lib/resolve-on-path.js +22 -0
- package/src/lib/runtime-inventory.js +56 -0
- package/src/lib/runtime-observation.js +37 -0
- package/src/lib/sandbox/bwrap.js +275 -0
- package/src/lib/sandbox/codex-perimeter.js +16 -0
- package/src/lib/sandbox/host-check.js +268 -0
- package/src/lib/sandbox/mode.js +49 -0
- package/src/lib/sandbox/opencode-loopback.mjs +68 -0
- package/src/lib/sandbox/seatbelt.js +684 -0
- package/src/lib/sandbox/turn-dir.js +56 -0
- package/src/lib/sandbox/windows-unsandboxed.js +183 -0
- package/src/lib/sandbox/workspace-git-config.js +243 -0
- package/src/lib/sandbox/workspace-pin.js +158 -0
- package/src/lib/seat-runtime-controls.js +61 -0
- package/src/lib/seat-stop.js +97 -0
- package/src/lib/server-skills.js +32 -0
- package/src/lib/session-recycle.js +219 -0
- package/src/lib/session-store.js +215 -0
- package/src/lib/skill-prompt.js +74 -0
- package/src/lib/skills-import.js +113 -0
- package/src/lib/spawn-credential.js +402 -0
- package/src/lib/spawn-retry.js +311 -0
- package/src/lib/stable-install.js +176 -0
- package/src/lib/supervised-turn.js +352 -0
- package/src/lib/task.js +235 -0
- package/src/lib/turn-failure-notice.js +177 -0
- package/src/lib/unconfined-seat-guard.js +94 -0
- package/src/lib/update-check.js +192 -0
- package/src/lib/upstream-refusal.js +1 -0
- package/src/lib/webhook-server.js +109 -0
- package/src/lib/windows-command.js +393 -0
- package/src/lib/workspace-git.js +87 -0
- package/src/lib/workspace-trust.js +162 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs inside OpenCode's private bwrap network namespace. The only route to
|
|
3
|
+
* the host is through the two fixed-origin Unix sockets bound for this spawn.
|
|
4
|
+
*/
|
|
5
|
+
import { spawn, spawnSync } from 'child_process';
|
|
6
|
+
import { existsSync } from 'fs';
|
|
7
|
+
import { createServer, connect } from 'net';
|
|
8
|
+
|
|
9
|
+
const [socketPath, portText, instanceSocketPath, instancePortText, binary, ...args] = process.argv.slice(2);
|
|
10
|
+
const port = Number(portText);
|
|
11
|
+
const instancePort = Number(instancePortText);
|
|
12
|
+
if (!socketPath || !instanceSocketPath || !binary
|
|
13
|
+
|| !Number.isInteger(port) || port < 1 || port > 65535
|
|
14
|
+
|| !Number.isInteger(instancePort) || instancePort < 1 || instancePort > 65535
|
|
15
|
+
|| port === instancePort) {
|
|
16
|
+
throw new Error('OpenCode loopback bridge requires distinct provider and instance ports');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const ip = ['/usr/sbin/ip', '/sbin/ip', '/usr/bin/ip', '/bin/ip'].find(existsSync);
|
|
20
|
+
if (!ip) throw new Error('OpenCode isolated loopback requires iproute2');
|
|
21
|
+
const up = spawnSync(ip, ['link', 'set', 'lo', 'up'], { encoding: 'utf8' });
|
|
22
|
+
if (up.error || up.status !== 0) {
|
|
23
|
+
throw new Error(`OpenCode isolated loopback could not start: ${up.error?.message || up.stderr?.trim() || up.status}`);
|
|
24
|
+
}
|
|
25
|
+
const setpriv = ['/usr/bin/setpriv', '/bin/setpriv'].find(existsSync);
|
|
26
|
+
if (!setpriv) throw new Error('OpenCode isolated loopback requires setpriv');
|
|
27
|
+
|
|
28
|
+
const sockets = new Set();
|
|
29
|
+
const makeBridge = (path) => createServer((local) => {
|
|
30
|
+
const proxy = connect(path);
|
|
31
|
+
sockets.add(local);
|
|
32
|
+
sockets.add(proxy);
|
|
33
|
+
local.on('close', () => sockets.delete(local));
|
|
34
|
+
proxy.on('close', () => sockets.delete(proxy));
|
|
35
|
+
local.on('error', () => proxy.destroy());
|
|
36
|
+
proxy.on('error', () => local.destroy());
|
|
37
|
+
local.pipe(proxy).pipe(local);
|
|
38
|
+
});
|
|
39
|
+
const providerBridge = makeBridge(socketPath);
|
|
40
|
+
const instanceBridge = instanceSocketPath === '-' ? null : makeBridge(instanceSocketPath);
|
|
41
|
+
providerBridge.on('error', (err) => { throw err; });
|
|
42
|
+
instanceBridge?.on('error', (err) => { throw err; });
|
|
43
|
+
providerBridge.listen(port, '127.0.0.1', () => {
|
|
44
|
+
const startChild = () => {
|
|
45
|
+
// Only this bridge needs CAP_NET_ADMIN to raise lo and CAP_SETPCAP to drop
|
|
46
|
+
// both capabilities before starting the model process.
|
|
47
|
+
const child = spawn(setpriv, [
|
|
48
|
+
'--bounding-set=-net_admin,-setpcap',
|
|
49
|
+
'--inh-caps=-net_admin,-setpcap',
|
|
50
|
+
'--ambient-caps=-net_admin,-setpcap',
|
|
51
|
+
binary, ...args,
|
|
52
|
+
], { stdio: 'inherit', env: process.env });
|
|
53
|
+
const forward = (signal) => { if (!child.killed) child.kill(signal); };
|
|
54
|
+
process.on('SIGTERM', () => forward('SIGTERM'));
|
|
55
|
+
process.on('SIGINT', () => forward('SIGINT'));
|
|
56
|
+
child.on('error', (err) => {
|
|
57
|
+
process.stderr.write(`${err.message}\n`);
|
|
58
|
+
});
|
|
59
|
+
child.on('close', (code, signal) => {
|
|
60
|
+
for (const socket of sockets) socket.destroy();
|
|
61
|
+
providerBridge.close();
|
|
62
|
+
if (instanceBridge) instanceBridge.close(() => { process.exitCode = code ?? (signal === 'SIGTERM' ? 143 : 1); });
|
|
63
|
+
else process.exitCode = code ?? (signal === 'SIGTERM' ? 143 : 1);
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
if (instanceBridge) instanceBridge.listen(instancePort, '127.0.0.1', startChild);
|
|
67
|
+
else startChild();
|
|
68
|
+
});
|