@commonlyai/cli 0.1.283 → 0.1.284
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
|
@@ -105,7 +105,7 @@ import { detectBwrap } from '../lib/sandbox/bwrap.js';
|
|
|
105
105
|
import { resolvePublicSandboxMode } from '../lib/sandbox/mode.js';
|
|
106
106
|
import { UNSANDBOXED_FLAG, hostSandboxRefusal, windowsSandboxMessage } from '../lib/sandbox/host-check.js';
|
|
107
107
|
import {
|
|
108
|
-
CODEX_UNSANDBOXED_NOTICE, UNSANDBOXED_NOTICE, codexUnconfinedForRun, hostUnconfinedForRun, runOptedInUnsandboxed,
|
|
108
|
+
CODEX_UNSANDBOXED_NOTICE, UNSANDBOXED_NOTICE, codexUnconfinedForRun, hostReportFailureMessage, hostUnconfinedForRun, runOptedInUnsandboxed,
|
|
109
109
|
unsandboxedFlagRefusal,
|
|
110
110
|
} from '../lib/sandbox/windows-unsandboxed.js';
|
|
111
111
|
import { prepareMcpBeforeFirstPoll } from '../lib/mcp-first-run.js';
|
|
@@ -1093,6 +1093,17 @@ export const setWakeOnMessage = async ({ client, record, enabled }) => {
|
|
|
1093
1093
|
return { agentName: record.agentName, podId: record.podId, instanceId, enabled: Boolean(enabled) };
|
|
1094
1094
|
};
|
|
1095
1095
|
|
|
1096
|
+
/** Lift the mark an unsandboxed run left on the seat. Only its owner's login can. */
|
|
1097
|
+
export const clearUnsandboxedMark = async ({ client, record }) => {
|
|
1098
|
+
if (!record?.podId || !record?.agentName) {
|
|
1099
|
+
throw new Error('token record is missing podId/agentName — re-attach the agent');
|
|
1100
|
+
}
|
|
1101
|
+
const instanceId = record.instanceId || 'default';
|
|
1102
|
+
const path = `/api/registry/pods/${encodeURIComponent(record.podId)}/agents/${encodeURIComponent(record.agentName)}/host-unconfined`;
|
|
1103
|
+
const result = await client.del(`${path}?instanceId=${encodeURIComponent(instanceId)}`);
|
|
1104
|
+
return { agentName: record.agentName, machineUnconfined: result?.machineUnconfined === true };
|
|
1105
|
+
};
|
|
1106
|
+
|
|
1096
1107
|
/**
|
|
1097
1108
|
* Update the server-side configuration for an existing local agent. The
|
|
1098
1109
|
* registry PATCH route already fans this change out to accessible pod peers;
|
|
@@ -5252,7 +5263,7 @@ Docs:
|
|
|
5252
5263
|
try {
|
|
5253
5264
|
await seatClient.post('/api/agents/runtime/host-unconfined', {});
|
|
5254
5265
|
} catch (err) {
|
|
5255
|
-
console.error(`${stamp()} [${name}]
|
|
5266
|
+
console.error(`${stamp()} [${name}] ${hostReportFailureMessage(err)}`);
|
|
5256
5267
|
process.exit(1);
|
|
5257
5268
|
}
|
|
5258
5269
|
}
|
|
@@ -5706,6 +5717,31 @@ Use --local to find the name you'd pass to 'agent run' or 'agent detach'.
|
|
|
5706
5717
|
}
|
|
5707
5718
|
});
|
|
5708
5719
|
|
|
5720
|
+
// ── clear-unsandboxed ─────────────────────────────────────────────────────
|
|
5721
|
+
agent
|
|
5722
|
+
.command('clear-unsandboxed <name>')
|
|
5723
|
+
.description('After moving an agent to a sandboxed host, let it use grants again (needs your login, not its token)')
|
|
5724
|
+
.option('--instance <url>', 'Target Commonly instance')
|
|
5725
|
+
.action(async (name, opts) => {
|
|
5726
|
+
const record = loadAgentToken(name);
|
|
5727
|
+
if (!record) {
|
|
5728
|
+
console.error(`No token file for '${name}' — is it attached on this machine? (commonly agent list --local)`);
|
|
5729
|
+
process.exit(1);
|
|
5730
|
+
}
|
|
5731
|
+
const instanceUrl = resolveInstanceUrl(opts.instance || record.instanceUrl);
|
|
5732
|
+
const token = getToken(opts.instance || record.instanceUrl);
|
|
5733
|
+
if (!token) { console.error('Not logged in. Run: commonly login'); process.exit(1); }
|
|
5734
|
+
const client = createClient({ instance: instanceUrl, token });
|
|
5735
|
+
try {
|
|
5736
|
+
const result = await clearUnsandboxedMark({ client, record });
|
|
5737
|
+
console.log(`✓ Cleared for ${result.agentName}. Running it with --unsandboxed marks it again.`);
|
|
5738
|
+
if (result.machineUnconfined) console.log(' Its machine reports no sandbox, so grants stay refused while it runs there.');
|
|
5739
|
+
} catch (err) {
|
|
5740
|
+
console.error(`Failed: ${err.message}`);
|
|
5741
|
+
process.exit(1);
|
|
5742
|
+
}
|
|
5743
|
+
});
|
|
5744
|
+
|
|
5709
5745
|
// ── heartbeat ─────────────────────────────────────────────────────────────
|
|
5710
5746
|
agent
|
|
5711
5747
|
.command('heartbeat <name>')
|
|
@@ -142,6 +142,14 @@ export const UNSANDBOXED_NOTICE = 'unsandboxed (opted in): Windows has no sandbo
|
|
|
142
142
|
/** Codex has no restricted tool settings to keep, so its line says what it costs instead. */
|
|
143
143
|
export const CODEX_UNSANDBOXED_NOTICE = 'unsandboxed (opted in): Windows has no sandbox Codex can use here, so nothing confines this agent. It runs with your own access to files and commands, and anyone in its pods, people invited later included, can direct it. It gets no connector grants, and a turn is refused if a pod stops being invite-only.';
|
|
144
144
|
|
|
145
|
+
// A 404 here is a server from before this route, which reads like a missing agent.
|
|
146
|
+
export const hostReportFailureMessage = (err) => {
|
|
147
|
+
const hint = err?.status === 404
|
|
148
|
+
? '. This server is older than this CLI: update the server, or run the agent in a sandbox.'
|
|
149
|
+
: '';
|
|
150
|
+
return `could not tell the server this agent has no sandbox, so it did not start: ${err?.message}${hint}`;
|
|
151
|
+
};
|
|
152
|
+
|
|
145
153
|
export default {
|
|
146
154
|
CODEX_UNSANDBOXED_NOTICE,
|
|
147
155
|
UNSANDBOXED_FLAG,
|