@commonlyai/cli 0.1.250 → 0.1.252
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
|
@@ -262,7 +262,9 @@ const claudeAuthMetadata = async () => {
|
|
|
262
262
|
// it. Never bind or copy the operator's full file: it contains project paths,
|
|
263
263
|
// MCP configuration, usage history, and other host-private metadata. Public
|
|
264
264
|
// wrappers get a per-identity 0700 HOME carrying only this whitelist.
|
|
265
|
-
|
|
265
|
+
// A seat that reaches the model through the provider proxy (F151) needs no
|
|
266
|
+
// keychain, so its HOME gets no link to one.
|
|
267
|
+
const preparePublicClaudeState = async (ctx, { keychain = true } = {}) => {
|
|
266
268
|
const identity = ctx.agentName || ctx.cwd || 'anonymous';
|
|
267
269
|
const identityHash = createHash('sha256').update(identity).digest('hex').slice(0, 20);
|
|
268
270
|
const statePath = ctx._publicClaudeState
|
|
@@ -283,17 +285,20 @@ const preparePublicClaudeState = async (ctx) => {
|
|
|
283
285
|
// Keep HOME isolated while pointing that one standard location at the
|
|
284
286
|
// operator's encrypted keychain database. Seatbelt admits the keychain
|
|
285
287
|
// directory read-only; no bearer credential is copied into agent state.
|
|
288
|
+
// A key seat creates no link. One a keyless turn of the same agent left is
|
|
289
|
+
// kept for that turn: the key seat's profile admits no keychain file, so the
|
|
290
|
+
// link leads nowhere it can read.
|
|
286
291
|
const keychainLink = await statOrNull(stateKeychains);
|
|
287
292
|
if (keychainLink && !keychainLink.isSymbolicLink()) {
|
|
288
293
|
throw new Error(`refusing to replace non-symlink Claude keychain path: ${stateKeychains}`);
|
|
289
294
|
}
|
|
290
|
-
if (keychainLink) {
|
|
295
|
+
if (keychain && keychainLink) {
|
|
291
296
|
const target = await readlink(stateKeychains);
|
|
292
297
|
if (target !== operatorKeychains) {
|
|
293
298
|
await unlink(stateKeychains);
|
|
294
299
|
await symlink(operatorKeychains, stateKeychains);
|
|
295
300
|
}
|
|
296
|
-
} else {
|
|
301
|
+
} else if (keychain) {
|
|
297
302
|
await symlink(operatorKeychains, stateKeychains);
|
|
298
303
|
}
|
|
299
304
|
|
|
@@ -1201,6 +1206,14 @@ const policyOnlyHost = (ctx) => ctx.hostUnconfined === true
|
|
|
1201
1206
|
&& (ctx._platform || process.platform) === 'win32'
|
|
1202
1207
|
&& isConfinedTrust(ctx.environment?.sandbox?.trust);
|
|
1203
1208
|
|
|
1209
|
+
// The loopback port a provider proxy listens on, for the Seatbelt rule that
|
|
1210
|
+
// admits it. Taken from its base URL when the proxy does not report one.
|
|
1211
|
+
const proxyPort = (proxy) => {
|
|
1212
|
+
if (!proxy) return null;
|
|
1213
|
+
const port = Number(proxy.port ?? new URL(proxy.baseURL).port);
|
|
1214
|
+
return Number.isInteger(port) && port > 0 ? port : null;
|
|
1215
|
+
};
|
|
1216
|
+
|
|
1204
1217
|
const prepareArgv = async (innerArgv, ctx) => {
|
|
1205
1218
|
const env = ctx.environment;
|
|
1206
1219
|
const claudeEnv = withClaudePath(ctx.claudeEnv);
|
|
@@ -1332,7 +1345,11 @@ const prepareArgv = async (innerArgv, ctx) => {
|
|
|
1332
1345
|
...commitHookExecutables,
|
|
1333
1346
|
...originalHookExecutables,
|
|
1334
1347
|
],
|
|
1335
|
-
|
|
1348
|
+
// F151: a key seat reaches the model only through the host's loopback
|
|
1349
|
+
// proxy, so its profile admits that port and no keychain; a login seat
|
|
1350
|
+
// keeps the keychain rules and needs no port.
|
|
1351
|
+
allowClaudeRuntimeAccess: !ctx.providerProxyPort,
|
|
1352
|
+
loopbackNetworkPorts: ctx.providerProxyPort ? [ctx.providerProxyPort] : [],
|
|
1336
1353
|
readOnlyDirectories: [
|
|
1337
1354
|
...(ctx.mcpReadDirectories || []),
|
|
1338
1355
|
...(ctx.workspaceGit?.readDirectories || []),
|
|
@@ -1590,7 +1607,23 @@ export default {
|
|
|
1590
1607
|
// bwrap seat needs a host-prepared build exactly as a Seatbelt one does
|
|
1591
1608
|
// (#2247).
|
|
1592
1609
|
if (publicNativeSandbox) {
|
|
1593
|
-
|
|
1610
|
+
// F151: Seatbelt strips the environment to the safe list, so a seat
|
|
1611
|
+
// configured with an API key used to start with neither key nor login
|
|
1612
|
+
// ("Not logged in"). The key stays on the host behind a per-turn
|
|
1613
|
+
// loopback proxy, as on bwrap; the jail gets the proxy's address and
|
|
1614
|
+
// token, and no keychain. Without a key, the keychain login as before.
|
|
1615
|
+
const source = ctx.env || process.env;
|
|
1616
|
+
if (source.ANTHROPIC_API_KEY) {
|
|
1617
|
+
publicClaudeState = await preparePublicClaudeState(ctx, { keychain: false });
|
|
1618
|
+
providerProxy = await (ctx._startProviderProxy || startProviderProxy)({
|
|
1619
|
+
provider: { baseURL: source.ANTHROPIC_BASE_URL || 'https://api.anthropic.com' },
|
|
1620
|
+
keyMaterial: source.ANTHROPIC_API_KEY,
|
|
1621
|
+
wire: 'anthropic-messages',
|
|
1622
|
+
adapterLabel: 'Claude',
|
|
1623
|
+
});
|
|
1624
|
+
} else {
|
|
1625
|
+
publicClaudeState = await preparePublicClaudeState(ctx);
|
|
1626
|
+
}
|
|
1594
1627
|
} else if (workspaceBwrapSandbox) {
|
|
1595
1628
|
// Checked before the state is prepared, so a host that cannot run the
|
|
1596
1629
|
// jail never gets a copy of the login.
|
|
@@ -1684,6 +1717,7 @@ export default {
|
|
|
1684
1717
|
mcpReadDirectories: mcpConfig?.mcpReadDirectories || [],
|
|
1685
1718
|
publicClaudeState,
|
|
1686
1719
|
publicSkillArgs,
|
|
1720
|
+
providerProxyPort: proxyPort(providerProxy),
|
|
1687
1721
|
claudeEnv,
|
|
1688
1722
|
};
|
|
1689
1723
|
const { cmd, args, env, childHome } = await prepareArgv(baseArgs, spawnCtx);
|
|
@@ -1751,6 +1785,7 @@ export default {
|
|
|
1751
1785
|
mcpReadDirectories: mcpConfig?.mcpReadDirectories || [],
|
|
1752
1786
|
publicClaudeState,
|
|
1753
1787
|
publicSkillArgs,
|
|
1788
|
+
providerProxyPort: proxyPort(providerProxy),
|
|
1754
1789
|
claudeEnv: withProvider(buildClaudeEnv(
|
|
1755
1790
|
ctx.env,
|
|
1756
1791
|
publicClaudeState,
|
|
@@ -43,8 +43,9 @@ const templateLiteral = (value) => {
|
|
|
43
43
|
// attach_file reads this process's filesystem, including its credential file.
|
|
44
44
|
// catch_up is left out too: it moves the read cursor past history unread, so a
|
|
45
45
|
// public seat past 50 unseen falls back to continueAnyway, which it keeps.
|
|
46
|
-
// Self-install
|
|
47
|
-
// public seat (F118, PUBLIC_ONLY_WITHHELD_TOOLS);
|
|
46
|
+
// Self-install, the memory writes (log_cycle included) and delete_message are
|
|
47
|
+
// left out on every public seat (F118, F141, PUBLIC_ONLY_WITHHELD_TOOLS);
|
|
48
|
+
// reading memory stays.
|
|
48
49
|
export const PUBLIC_GOOSE_TOOLS = Object.freeze([
|
|
49
50
|
'commonly_get_started', 'commonly_post_message', 'commonly_claim_message',
|
|
50
51
|
'commonly_release_claim', 'commonly_get_messages', 'commonly_get_context',
|
|
@@ -15,11 +15,15 @@ export const PUBLIC_WITHHELD_TOOLS = Object.freeze(['commonly_attach_file', 'com
|
|
|
15
15
|
// `cycles[]` through POST /api/agents/runtime/memory/sync. Reading memory
|
|
16
16
|
// (commonly_read_agent_memory, and the long_term the wrapper puts in the
|
|
17
17
|
// prompt) stays offered.
|
|
18
|
+
// commonly_delete_message (F141): a stranger-steered seat could delete its own
|
|
19
|
+
// replies to an injection, which are the evidence of what the attack achieved.
|
|
20
|
+
// A workspace seat keeps it.
|
|
18
21
|
export const PUBLIC_ONLY_WITHHELD_TOOLS = Object.freeze([
|
|
19
22
|
'commonly_self_install_into_pod',
|
|
20
23
|
'commonly_write_agent_memory',
|
|
21
24
|
'commonly_save_my_memory',
|
|
22
25
|
'commonly_log_cycle',
|
|
26
|
+
'commonly_delete_message',
|
|
23
27
|
]);
|
|
24
28
|
|
|
25
29
|
// Everything a public seat is not offered. Codex, OpenCode, Qwen and Goose
|