@commonlyai/cli 0.1.106 → 0.1.108
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/package.json
CHANGED
package/src/commands/agent.js
CHANGED
|
@@ -155,16 +155,19 @@ export const BOOTSTRAP_ADAPTER_DETECT_ORDER = ['claude', 'codex', 'pi'];
|
|
|
155
155
|
export const NO_AGENT_CLI_CODE = 'no_agent_cli';
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
|
-
* A saved
|
|
159
|
-
* an
|
|
160
|
-
*
|
|
161
|
-
*
|
|
158
|
+
* A saved seat with no enforced sandbox: an adapter that takes one, no
|
|
159
|
+
* workspace, and an environment that is absent or enforces nothing (a record
|
|
160
|
+
* from before bootstrap applied the default, or one attached without an
|
|
161
|
+
* environment file). Such a record is told how to pick the default up; it is
|
|
162
|
+
* not rewritten here (Cofounder, 2026-10-16: none were found outside our own
|
|
163
|
+
* tests).
|
|
162
164
|
*/
|
|
163
165
|
export const savedSeatLacksDefaultSandbox = (record) => Boolean(record)
|
|
164
166
|
&& ADAPTERS_WITH_DEFAULT_SANDBOX.has(record.adapter)
|
|
165
167
|
&& !record.workspacePath
|
|
166
|
-
&& record.environment
|
|
167
|
-
|
|
168
|
+
&& (record.environment === null || record.environment === undefined
|
|
169
|
+
|| (typeof record.environment === 'object' && !Array.isArray(record.environment)
|
|
170
|
+
&& withDefaultSandbox(record.environment) !== record.environment));
|
|
168
171
|
|
|
169
172
|
/** Return the adapter binding resolved for this exact installation by the server. */
|
|
170
173
|
export const runtimeAdapterForInstallation = ({ installations, podId, instanceId } = {}) => {
|
|
@@ -3117,8 +3120,9 @@ Docs:
|
|
|
3117
3120
|
console.log(`${stamp()} [${name}] bootstrapped ${tokenFile(record.agentName)} from COMMONLY_AGENT_TOKEN (adapter: ${record.adapter})`);
|
|
3118
3121
|
} else if (savedSeatLacksDefaultSandbox(record)) {
|
|
3119
3122
|
console.warn(
|
|
3120
|
-
`${stamp()} [${name}] this agent's saved settings
|
|
3121
|
-
+ `commonly agent detach ${name} --force, then run a fresh command
|
|
3123
|
+
`${stamp()} [${name}] this agent's saved settings declare no sandbox, so it runs without one. `
|
|
3124
|
+
+ `To give it the default: commonly agent detach ${name} --force, then either run a fresh command `
|
|
3125
|
+
+ 'from the Connect page, or attach it again with an environment file that sets sandbox.trust: public.',
|
|
3122
3126
|
);
|
|
3123
3127
|
}
|
|
3124
3128
|
|
|
@@ -208,6 +208,9 @@ const buildClaudeEnv = (input, state, expansionEnv = {}, credentialFile = null)
|
|
|
208
208
|
}
|
|
209
209
|
output.HOME = state.statePath;
|
|
210
210
|
output.TMPDIR = state.tmpPath;
|
|
211
|
+
// Claude keeps its temp root at /private/tmp/claude-<uid> unless told
|
|
212
|
+
// otherwise; the seat's Seatbelt profile admits only its own tmp.
|
|
213
|
+
output.CLAUDE_CODE_TMPDIR = state.tmpPath;
|
|
211
214
|
output.XDG_CACHE_HOME = join(state.statePath, '.cache');
|
|
212
215
|
output.XDG_CONFIG_HOME = join(state.statePath, '.config');
|
|
213
216
|
output.XDG_DATA_HOME = join(state.statePath, '.local', 'share');
|
package/src/lib/sandbox/bwrap.js
CHANGED
|
@@ -47,12 +47,18 @@ const DEFAULT_RO_BINDS = [
|
|
|
47
47
|
'/lib64',
|
|
48
48
|
];
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
// `bwrap --version` only proves the binary is there. On Ubuntu 24.04 and later
|
|
51
|
+
// AppArmor restricts unprivileged user namespaces, so bwrap is installed and
|
|
52
|
+
// every sandbox it starts fails (`setting up uid map: Permission denied`,
|
|
53
|
+
// ubuntu run 38982219348). Starting one empty namespace is the real check.
|
|
54
|
+
const NAMESPACE_PROBE = ['--unshare-all', '--ro-bind', '/', '/', 'true'];
|
|
55
|
+
|
|
56
|
+
export const detectBwrap = ({ spawn = spawnSync, platform = process.platform } = {}) => {
|
|
57
|
+
if (platform !== 'linux') {
|
|
52
58
|
return { available: false, error: MACOS_MESSAGE };
|
|
53
59
|
}
|
|
54
60
|
try {
|
|
55
|
-
const res =
|
|
61
|
+
const res = spawn('bwrap', ['--version'], { encoding: 'utf8' });
|
|
56
62
|
if (res.error || res.status !== 0) {
|
|
57
63
|
return {
|
|
58
64
|
available: false,
|
|
@@ -60,6 +66,15 @@ export const detectBwrap = () => {
|
|
|
60
66
|
+ '`sudo dnf install bubblewrap` (Fedora) or `sudo pacman -S bubblewrap` (Arch).',
|
|
61
67
|
};
|
|
62
68
|
}
|
|
69
|
+
const probe = spawn('bwrap', NAMESPACE_PROBE, { encoding: 'utf8', timeout: 10_000 });
|
|
70
|
+
if (probe.error || probe.status !== 0) {
|
|
71
|
+
const reason = (probe.stderr || probe.error?.message || `exit ${probe.status}`).trim().split('\n').pop();
|
|
72
|
+
return {
|
|
73
|
+
available: false,
|
|
74
|
+
error: `bubblewrap is installed but cannot start a sandbox on this machine (${reason}). `
|
|
75
|
+
+ 'On Ubuntu 24.04 and later, AppArmor restricts the unprivileged user namespaces it needs.',
|
|
76
|
+
};
|
|
77
|
+
}
|
|
63
78
|
return { available: true, path: 'bwrap' };
|
|
64
79
|
} catch (err) {
|
|
65
80
|
return { available: false, error: `bwrap detection failed: ${err.message}` };
|
|
@@ -9,16 +9,21 @@
|
|
|
9
9
|
* the pod saw nothing.
|
|
10
10
|
*
|
|
11
11
|
* Only the adapters that run inside these mechanisms are checked. Codex
|
|
12
|
-
* confines with its own permission profiles (mode.js)
|
|
13
|
-
* declared sandbox itself
|
|
12
|
+
* confines with its own permission profiles (mode.js). pi is a scope boundary,
|
|
13
|
+
* not a gap in this check: it refuses a declared sandbox itself, so a
|
|
14
|
+
* Connect-page pi seat is saved without one and runs unconfined
|
|
15
|
+
* (default-environment.js, ADAPTERS_WITH_DEFAULT_SANDBOX); confining pi
|
|
16
|
+
* belongs to pi's own sandbox work.
|
|
14
17
|
*/
|
|
15
18
|
|
|
16
19
|
import { normalizeSandboxTrust } from '../environment.js';
|
|
17
|
-
import { resolvePublicSandboxMode } from './mode.js';
|
|
20
|
+
import { PUBLIC_SANDBOX_MODES, resolvePublicSandboxMode } from './mode.js';
|
|
18
21
|
import { detectBwrap as defaultDetectBwrap } from './bwrap.js';
|
|
19
22
|
import { detectSeatbelt as defaultDetectSeatbelt } from './seatbelt.js';
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
// The Seatbelt modes come from mode.js, as grant-broker-guard's do, so a mode
|
|
25
|
+
// added there is not silently missing here.
|
|
26
|
+
const SEATBELT_MODES = PUBLIC_SANDBOX_MODES;
|
|
22
27
|
|
|
23
28
|
const ADAPTER_LABELS = { claude: 'Claude Code', opencode: 'OpenCode', qwen: 'Qwen Code' };
|
|
24
29
|
|
|
@@ -415,18 +415,17 @@ export const buildSeatbeltProfile = ({
|
|
|
415
415
|
`(allow network-outbound (remote tcp "localhost:${port}"))`
|
|
416
416
|
)).join('\n');
|
|
417
417
|
const claudeRuntimeRules = allowClaudeRuntimeAccess ? (() => {
|
|
418
|
-
|
|
419
|
-
|
|
418
|
+
// Claude's temp root is the seat's own: the adapter sets CLAUDE_CODE_TMPDIR
|
|
419
|
+
// under statePath, which the state rule above already admits. The
|
|
420
|
+
// uid-wide /private/tmp/claude-<uid> holds every other Claude session's
|
|
421
|
+
// temp files on the machine, so it is not admitted.
|
|
422
|
+
// Claude's security helper needs the encrypted login-keychain database and
|
|
423
|
+
// this non-secret locale file: that one file, not the Keychains folder.
|
|
424
|
+
const loginKeychain = join(homedir(), 'Library', 'Keychains', 'login.keychain-db');
|
|
420
425
|
const textEncoding = join(homedir(), '.CFUserTextEncoding');
|
|
421
426
|
return [
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
`(allow file-read-metadata file-test-existence (path-ancestors "${escapeSbplString(claudeTmp)}"))`,
|
|
425
|
-
`(allow file-read* file-test-existence file-write* ${literal(claudeTmp)} ${subpath(claudeTmp)})`,
|
|
426
|
-
// Claude's security helper needs the encrypted login-keychain database
|
|
427
|
-
// and this non-secret locale file. Other wrappers do not get this access.
|
|
428
|
-
`(allow file-read* file-test-existence ${subpath(userKeychains)} ${literal(textEncoding)})`,
|
|
429
|
-
`(allow file-read-metadata file-test-existence (path-ancestors "${escapeSbplString(userKeychains)}"))`,
|
|
427
|
+
`(allow file-read* file-test-existence ${literal(loginKeychain)} ${literal(textEncoding)})`,
|
|
428
|
+
`(allow file-read-metadata file-test-existence (path-ancestors "${escapeSbplString(loginKeychain)}"))`,
|
|
430
429
|
];
|
|
431
430
|
})() : [];
|
|
432
431
|
|