@commonlyai/cli 0.1.328 → 0.1.330
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 +1 -1
- package/src/commands/agent.js +47 -46
- package/src/commands/daemon.js +24 -23
- package/src/commands/dev.js +10 -9
- package/src/commands/doctor.js +3 -2
- package/src/commands/inbox.js +16 -15
- package/src/commands/login.js +7 -6
- package/src/commands/mcp.js +3 -2
- package/src/commands/pod.js +8 -7
- package/src/commands/task.js +9 -8
- package/src/index.js +14 -13
- package/src/lib/adapters/claude.js +2 -1
- package/src/lib/adapters/opencode.js +50 -3
- package/src/lib/api.js +2 -1
- package/src/lib/cli-hint.js +33 -0
- package/src/lib/daemon-hint.js +15 -3
- package/src/lib/daemon-service.js +5 -4
- package/src/lib/doctor.js +10 -9
- package/src/lib/mcp-home.js +24 -0
- package/src/lib/model-unavailable.js +2 -1
- package/src/lib/poller.js +2 -1
- package/src/lib/sandbox/host-check.js +3 -2
- package/src/lib/stable-install.js +2 -1
- package/src/lib/task.js +3 -2
- package/src/lib/turn-failure-notice.js +11 -1
- package/src/lib/update-check.js +2 -1
package/package.json
CHANGED
package/src/commands/agent.js
CHANGED
|
@@ -164,6 +164,7 @@ import {
|
|
|
164
164
|
} from '../lib/enforcement.js';
|
|
165
165
|
import { buildReplyReceipt } from '../lib/reply-receipt.js';
|
|
166
166
|
import { savedRuntimeControls, withSavedRuntimeControls, effortRefusedByDevice } from '../lib/seat-runtime-controls.js';
|
|
167
|
+
import { CLI } from '../lib/cli-hint.js';
|
|
167
168
|
|
|
168
169
|
const isPodFocusDiagnostic = (error) => (
|
|
169
170
|
typeof error?.code === 'string'
|
|
@@ -190,7 +191,7 @@ export const saveAgentToken = (name, record) => {
|
|
|
190
191
|
try {
|
|
191
192
|
refreshMcpTokenCopy(name, record?.runtimeToken);
|
|
192
193
|
} catch (err) {
|
|
193
|
-
console.warn(`Could not refresh the MCP token copy for '${name}': ${err.message}. Run:
|
|
194
|
+
console.warn(`Could not refresh the MCP token copy for '${name}': ${err.message}. Run: ${CLI} mcp config --agent ${name}`);
|
|
194
195
|
}
|
|
195
196
|
};
|
|
196
197
|
|
|
@@ -216,7 +217,7 @@ export const seatKey = (agentName, instanceId) => (
|
|
|
216
217
|
);
|
|
217
218
|
|
|
218
219
|
const runCommandFor = (agentName, instanceId) => (
|
|
219
|
-
|
|
220
|
+
`${CLI} agent run ${agentName}${isDefaultInstanceId(instanceId) ? '' : ` --instance-id ${instanceId}`}`
|
|
220
221
|
);
|
|
221
222
|
|
|
222
223
|
/**
|
|
@@ -402,7 +403,7 @@ export const serverAdapterBindingRefusal = ({
|
|
|
402
403
|
if (runtimeAdapterForInstallation({ installations, podId, instanceId }) === adapter) return null;
|
|
403
404
|
const refusal = `Adapter '${adapter}' is not declared for this Commonly installation.`;
|
|
404
405
|
if (!includeAttachGuidance) return refusal;
|
|
405
|
-
return `${refusal} A pod owner must sign in with
|
|
406
|
+
return `${refusal} A pod owner must sign in with ${CLI} login, then run ${CLI} agent attach ${adapter}`
|
|
406
407
|
+ ` --pod ${podId || '<pod-id>'} --name ${agentName || '<agent-name>'}`
|
|
407
408
|
+ ` [--env <environment.yaml>] before this seat can use adapter '${adapter}'.`;
|
|
408
409
|
};
|
|
@@ -449,7 +450,7 @@ export const printAttachRunGuidance = ({
|
|
|
449
450
|
warn = console.warn,
|
|
450
451
|
} = {}) => {
|
|
451
452
|
if (binding?.canRun) {
|
|
452
|
-
log(`\n Run with:
|
|
453
|
+
log(`\n Run with: ${CLI} agent run ${agentName}`);
|
|
453
454
|
} else {
|
|
454
455
|
warn(`\n WARNING: ${binding?.warning || 'The server did not confirm this adapter binding.'}`);
|
|
455
456
|
}
|
|
@@ -490,7 +491,7 @@ export const checkRunAllowRequest = ({ record, requested = [] }) => {
|
|
|
490
491
|
message: [
|
|
491
492
|
`'${name}' was set up with ${saved.length ? `--allow ${saved.join(',')}` : 'no --allow'}; `
|
|
492
493
|
+ `--allow ${requested.join(',')} was not applied.`,
|
|
493
|
-
`To change it:
|
|
494
|
+
`To change it: ${CLI} agent detach ${name} --force, then re-run with the Connect-page `
|
|
494
495
|
+ `env exports and --allow ${requested.join(',')}.`,
|
|
495
496
|
].join('\n'),
|
|
496
497
|
};
|
|
@@ -522,8 +523,8 @@ export const checkRunAdapterRequest = ({ record, requestedAdapter, tokenPath })
|
|
|
522
523
|
ok: false,
|
|
523
524
|
message: [
|
|
524
525
|
`'${name}' is bound to the ${bound} adapter by its token file (${tokenPath}); --adapter ${requested} was not applied.`,
|
|
525
|
-
`To run it with ${requested} here:
|
|
526
|
-
`A daemon-managed seat switches with:
|
|
526
|
+
`To run it with ${requested} here: ${CLI} agent detach ${name} --force, then re-run with the Connect-page env exports and --adapter ${requested}.`,
|
|
527
|
+
`A daemon-managed seat switches with: ${CLI} agent config ${name} --adapter ${requested}`,
|
|
527
528
|
].join('\n'),
|
|
528
529
|
};
|
|
529
530
|
};
|
|
@@ -683,7 +684,7 @@ const listAgents = async (opts, deps) => {
|
|
|
683
684
|
if (opts.local) {
|
|
684
685
|
const agents = listLocalAgents();
|
|
685
686
|
if (agents.length === 0) {
|
|
686
|
-
log(
|
|
687
|
+
log(`No agents attached locally. Run: ${CLI} agent attach <adapter> --pod <podId> --name <n>`);
|
|
687
688
|
return 0;
|
|
688
689
|
}
|
|
689
690
|
log(`${col('NAME', 20)} ${col('ADAPTER', 10)} ${col('POD', 26)} LAST TURN`);
|
|
@@ -696,7 +697,7 @@ const listAgents = async (opts, deps) => {
|
|
|
696
697
|
}
|
|
697
698
|
|
|
698
699
|
const token = tokenFor(opts.instance);
|
|
699
|
-
if (!token) { error(
|
|
700
|
+
if (!token) { error(`Not logged in. Run: ${CLI} login`); return 1; }
|
|
700
701
|
|
|
701
702
|
const client = clientFactory({ instance: instanceUrlFor(opts.instance), token });
|
|
702
703
|
|
|
@@ -778,7 +779,7 @@ export const resolveLogsSeat = async (client, podId, typed, instanceId) => {
|
|
|
778
779
|
if (hits.length > 1) {
|
|
779
780
|
const pairs = hits.map((h) => `${h.name || h.agentName}/${h.instanceId}`).join(', ');
|
|
780
781
|
throw new Error(`${hits.length} seats are named '${typed}' here: ${pairs}. `
|
|
781
|
-
+ `Run:
|
|
782
|
+
+ `Run: ${CLI} agent logs <agentName> --pod ${podId} --instance-id <instance>`);
|
|
782
783
|
}
|
|
783
784
|
if (hits.length === 0) {
|
|
784
785
|
// A typo must not read like an idle seat, so say what was read instead.
|
|
@@ -1256,7 +1257,7 @@ export const updateAgentConfiguration = async ({
|
|
|
1256
1257
|
throw new Error('token record is missing agentName — re-attach the agent');
|
|
1257
1258
|
}
|
|
1258
1259
|
if (runtimeKey) {
|
|
1259
|
-
if (adapter || envPath) throw new Error(
|
|
1260
|
+
if (adapter || envPath) throw new Error(`--adapter and --env require an owner login; run ${CLI} login`);
|
|
1260
1261
|
const controls = Object.fromEntries(Object.entries({ model, effort })
|
|
1261
1262
|
.filter(([, value]) => value !== null && value !== undefined));
|
|
1262
1263
|
if (!Object.keys(controls).length) throw new Error('provide --model or --effort');
|
|
@@ -1528,13 +1529,13 @@ export const performAttach = async ({
|
|
|
1528
1529
|
'Instead:',
|
|
1529
1530
|
' - Run it without an OS sandbox, which is your choice: use the commands on the Connect page.'
|
|
1530
1531
|
+ ' They set COMMONLY_API_URL and COMMONLY_AGENT_TOKEN, then run'
|
|
1531
|
-
+ `
|
|
1532
|
+
+ ` ${CLI} agent run <name> --adapter claude ${UNSANDBOXED_FLAG}.`
|
|
1532
1533
|
+ " It keeps Commonly's restricted tool settings and gets no shell, but nothing at the OS level"
|
|
1533
1534
|
+ ' confines it, and it gets no connector grants.'
|
|
1534
1535
|
// agent run prefers a saved record over the page's env vars, so an
|
|
1535
1536
|
// older record of that name would run with its own settings (#3407).
|
|
1536
1537
|
+ ' If this computer already has an agent saved under that name, the run uses that one and its'
|
|
1537
|
-
+
|
|
1538
|
+
+ ` settings instead: remove it first with ${CLI} agent detach <name> --force.`,
|
|
1538
1539
|
' - Use Commonly from your own Claude Code sessions: the Connect page shows a PowerShell `claude mcp add` command.',
|
|
1539
1540
|
' - A hosted agent: choose "Run it here" on the Connect page. Nothing runs on this machine.',
|
|
1540
1541
|
].join('\n') : windowsSandboxMessage(adapterName)));
|
|
@@ -2360,7 +2361,7 @@ export const performRun = ({
|
|
|
2360
2361
|
const flag = (name, value) => (value && /^[A-Za-z0-9._:/-]+$/.test(value) ? ` --${name} ${value}` : '');
|
|
2361
2362
|
const flags = `${flag('model', lastSavedControls.model)}${flag('effort', lastSavedControls.effort)}` || ' --model <model>';
|
|
2362
2363
|
log(`${agentName} has no saved environment on this computer, so the model and effort saved in Commonly `
|
|
2363
|
-
+ `don't apply to it yet. Run once:
|
|
2364
|
+
+ `don't apply to it yet. Run once: ${CLI} agent config ${agentName}${flags}`);
|
|
2364
2365
|
}
|
|
2365
2366
|
}
|
|
2366
2367
|
// Dropped only when the device listed its levels and this one is not
|
|
@@ -4807,7 +4808,7 @@ export const performRun = ({
|
|
|
4807
4808
|
onError?.(new Error(
|
|
4808
4809
|
`Runtime token rejected ${consecutiveAuthErrors} times in a row — stopping. `
|
|
4809
4810
|
+ `If this agent's key was reissued, run it again with the new key in COMMONLY_AGENT_TOKEN. `
|
|
4810
|
-
+ `To remove the agent from its pod:
|
|
4811
|
+
+ `To remove the agent from its pod: ${CLI} agent detach ${agentName}`,
|
|
4811
4812
|
));
|
|
4812
4813
|
running = false;
|
|
4813
4814
|
return;
|
|
@@ -5105,17 +5106,17 @@ export const registerAgent = (program) => {
|
|
|
5105
5106
|
agent.addHelpText('after', `
|
|
5106
5107
|
Examples:
|
|
5107
5108
|
# Wrap your local claude binary as a pod agent (ADR-005)
|
|
5108
|
-
$
|
|
5109
|
-
$
|
|
5110
|
-
$
|
|
5109
|
+
$ ${CLI} agent attach claude --pod <podId> --name my-claude
|
|
5110
|
+
$ ${CLI} agent run my-claude
|
|
5111
|
+
$ ${CLI} agent detach my-claude
|
|
5111
5112
|
|
|
5112
5113
|
# Scaffold a custom Python agent (ADR-006)
|
|
5113
|
-
$
|
|
5114
|
+
$ ${CLI} agent init --language python --name research-bot --pod <podId>
|
|
5114
5115
|
|
|
5115
5116
|
# List installed agents
|
|
5116
|
-
$
|
|
5117
|
-
$
|
|
5118
|
-
$
|
|
5117
|
+
$ ${CLI} agent list
|
|
5118
|
+
$ ${CLI} agent config my-claude --adapter claude --model gpt-5.4 --effort high
|
|
5119
|
+
$ ${CLI} agent config my-claude --model gpt-5.4 --effort high
|
|
5119
5120
|
|
|
5120
5121
|
Docs:
|
|
5121
5122
|
https://github.com/Team-Commonly/commonly/blob/main/docs/agents/LOCAL_CLI_WRAPPER.md
|
|
@@ -5135,7 +5136,7 @@ Docs:
|
|
|
5135
5136
|
.action(async (opts) => {
|
|
5136
5137
|
const instanceUrl = resolveInstanceUrl(opts.instance);
|
|
5137
5138
|
const token = getToken(opts.instance);
|
|
5138
|
-
if (!token) { console.error(
|
|
5139
|
+
if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
|
|
5139
5140
|
|
|
5140
5141
|
const client = createClient({ instance: instanceUrl, token });
|
|
5141
5142
|
|
|
@@ -5190,7 +5191,7 @@ Docs:
|
|
|
5190
5191
|
}
|
|
5191
5192
|
if (runtimeToken) {
|
|
5192
5193
|
console.log(`\nRuntime token: ${runtimeToken}`);
|
|
5193
|
-
console.log(
|
|
5194
|
+
console.log(`Use this with: ${CLI} agent connect --name <name> --token <token>`);
|
|
5194
5195
|
}
|
|
5195
5196
|
} catch (err) {
|
|
5196
5197
|
console.error(`Registration failed: ${err.message}`);
|
|
@@ -5213,7 +5214,7 @@ Docs:
|
|
|
5213
5214
|
.action(async (opts) => {
|
|
5214
5215
|
const instanceUrl = resolveInstanceUrl(opts.instance);
|
|
5215
5216
|
const token = opts.token || getToken(opts.instance);
|
|
5216
|
-
if (!token) { console.error(
|
|
5217
|
+
if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
|
|
5217
5218
|
|
|
5218
5219
|
const port = parseInt(opts.port, 10);
|
|
5219
5220
|
const localUrl = `http://localhost:${port}${opts.path}`;
|
|
@@ -5280,12 +5281,12 @@ Docs:
|
|
|
5280
5281
|
.option('--env <path>', 'Path to environment.json (ADR-008 — sandbox/skills/MCP)')
|
|
5281
5282
|
.option('--import-memory [path]', 'Import local memory (CLAUDE.md / MEMORY.md / ~/.claude project memory, or a given file/dir) into the agent after attach')
|
|
5282
5283
|
.option('--yes', 'Skip the import confirmation prompt')
|
|
5283
|
-
.option('--wake-on-message',
|
|
5284
|
+
.option('--wake-on-message', `Wake this agent on every message in the pod, not only @mentions (ADR-018 ambient wake; default off). Change later with: ${CLI} agent wake <name> on|off`)
|
|
5284
5285
|
.option('--instance <url>', 'Target Commonly instance')
|
|
5285
5286
|
.action(async (adapterName, opts) => {
|
|
5286
5287
|
const instanceUrl = resolveInstanceUrl(opts.instance);
|
|
5287
5288
|
const token = getToken(opts.instance);
|
|
5288
|
-
if (!token) { console.error(
|
|
5289
|
+
if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
|
|
5289
5290
|
|
|
5290
5291
|
const client = createClient({ instance: instanceUrl, token });
|
|
5291
5292
|
|
|
@@ -5344,7 +5345,7 @@ Docs:
|
|
|
5344
5345
|
});
|
|
5345
5346
|
} catch (err) {
|
|
5346
5347
|
console.warn(`Memory import failed (agent is still attached): ${err.message}`);
|
|
5347
|
-
console.warn(`Retry with:
|
|
5348
|
+
console.warn(`Retry with: ${CLI} agent import-memory ${opts.name}`);
|
|
5348
5349
|
}
|
|
5349
5350
|
}
|
|
5350
5351
|
|
|
@@ -5376,7 +5377,7 @@ Docs:
|
|
|
5376
5377
|
.action(async (name, opts) => {
|
|
5377
5378
|
const record = loadAgentToken(name);
|
|
5378
5379
|
if (!record) {
|
|
5379
|
-
console.error(`No token for '${name}'. Attach it first:
|
|
5380
|
+
console.error(`No token for '${name}'. Attach it first: ${CLI} agent attach <adapter> --pod <podId> --name ${name}`);
|
|
5380
5381
|
process.exit(1);
|
|
5381
5382
|
}
|
|
5382
5383
|
try {
|
|
@@ -5403,13 +5404,13 @@ Docs:
|
|
|
5403
5404
|
.action(async (name, opts) => {
|
|
5404
5405
|
const record = loadAgentToken(name);
|
|
5405
5406
|
if (!record) {
|
|
5406
|
-
console.error(`No token for '${name}'. Attach it first:
|
|
5407
|
+
console.error(`No token for '${name}'. Attach it first: ${CLI} agent attach <adapter> --pod <podId> --name ${name}`);
|
|
5407
5408
|
process.exit(1);
|
|
5408
5409
|
}
|
|
5409
5410
|
// Skill registration is a USER action (pod-membership-checked route),
|
|
5410
5411
|
// unlike memory import which authenticates as the agent.
|
|
5411
5412
|
const userToken = getToken(opts.instance);
|
|
5412
|
-
if (!userToken) { console.error(
|
|
5413
|
+
if (!userToken) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
|
|
5413
5414
|
|
|
5414
5415
|
try {
|
|
5415
5416
|
const skills = detectSkills({ explicitDir: opts.dir ? pathResolve(opts.dir) : null });
|
|
@@ -5538,7 +5539,7 @@ Docs:
|
|
|
5538
5539
|
console.error(
|
|
5539
5540
|
`No token for '${name}'. Either export COMMONLY_API_URL + COMMONLY_AGENT_TOKEN`
|
|
5540
5541
|
+ ` (shown on the Connect your own agent page) and re-run, or:`
|
|
5541
|
-
+ `
|
|
5542
|
+
+ ` ${CLI} agent attach <adapter> --pod <podId> --name ${agentArg}`,
|
|
5542
5543
|
);
|
|
5543
5544
|
process.exit(1);
|
|
5544
5545
|
}
|
|
@@ -5626,7 +5627,7 @@ Docs:
|
|
|
5626
5627
|
} else if (savedSeatLacksDefaultSandbox(record)) {
|
|
5627
5628
|
console.warn(
|
|
5628
5629
|
`${stamp()} [${name}] this agent's saved settings declare no sandbox, so it runs without one. `
|
|
5629
|
-
+ `To give it the default:
|
|
5630
|
+
+ `To give it the default: ${CLI} agent detach ${name} --force, then either run a fresh command `
|
|
5630
5631
|
+ 'from the Connect page, or attach it again with an environment file that sets sandbox.trust: public.',
|
|
5631
5632
|
);
|
|
5632
5633
|
}
|
|
@@ -5792,8 +5793,8 @@ Docs:
|
|
|
5792
5793
|
if (!userToken) {
|
|
5793
5794
|
console.error(
|
|
5794
5795
|
`No user login found for ${record.instanceUrl}. Either run `
|
|
5795
|
-
+ `'
|
|
5796
|
-
+ `'
|
|
5796
|
+
+ `'${CLI} login --instance ${record.instanceUrl}' first, or `
|
|
5797
|
+
+ `'${CLI} agent detach ${name} --force' to clean up local files only.`,
|
|
5797
5798
|
);
|
|
5798
5799
|
process.exit(1);
|
|
5799
5800
|
}
|
|
@@ -5837,7 +5838,7 @@ Docs:
|
|
|
5837
5838
|
.action(async (opts) => {
|
|
5838
5839
|
const instanceUrl = resolveInstanceUrl(opts.instance);
|
|
5839
5840
|
const token = getToken(opts.instance);
|
|
5840
|
-
if (!token) { console.error(
|
|
5841
|
+
if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
|
|
5841
5842
|
|
|
5842
5843
|
const client = createClient({ instance: instanceUrl, token });
|
|
5843
5844
|
|
|
@@ -5942,7 +5943,7 @@ Use --local to find the name you'd pass to 'agent run' or 'agent detach'.
|
|
|
5942
5943
|
}
|
|
5943
5944
|
|
|
5944
5945
|
const token = getToken(opts.instance);
|
|
5945
|
-
if (!token) { console.error(
|
|
5946
|
+
if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
|
|
5946
5947
|
const client = createClient({ instance: resolveInstanceUrl(opts.instance), token });
|
|
5947
5948
|
const printActivity = async () => {
|
|
5948
5949
|
const seat = await resolveLogsSeat(client, opts.pod, name, opts.instanceId);
|
|
@@ -5982,19 +5983,19 @@ Use --local to find the name you'd pass to 'agent run' or 'agent detach'.
|
|
|
5982
5983
|
.action(async (name, opts) => {
|
|
5983
5984
|
const record = loadAgentToken(name);
|
|
5984
5985
|
if (!record) {
|
|
5985
|
-
console.error(`No token file for '${name}' — is it attached on this machine? (
|
|
5986
|
+
console.error(`No token file for '${name}' — is it attached on this machine? (${CLI} agent list --local)`);
|
|
5986
5987
|
process.exit(1);
|
|
5987
5988
|
}
|
|
5988
5989
|
const instance = opts.instance || record.instanceUrl;
|
|
5989
5990
|
const ownerToken = getToken(instance);
|
|
5990
5991
|
const runtimeKey = !opts.adapter && !opts.env && !ownerToken && Boolean(record.runtimeToken);
|
|
5991
5992
|
const token = runtimeKey ? record.runtimeToken : ownerToken;
|
|
5992
|
-
if (!token) { console.error(
|
|
5993
|
+
if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
|
|
5993
5994
|
try {
|
|
5994
5995
|
const instanceUrl = resolveInstanceUrl(instance);
|
|
5995
5996
|
if (runtimeKey && (!record.instanceUrl
|
|
5996
5997
|
|| new URL(instanceUrl).href.replace(/\/$/, '') !== new URL(record.instanceUrl).href.replace(/\/$/, ''))) {
|
|
5997
|
-
throw new Error(
|
|
5998
|
+
throw new Error(`Changing --instance requires an owner login for that instance; run ${CLI} login`);
|
|
5998
5999
|
}
|
|
5999
6000
|
const client = createClient({ instance: instanceUrl, token });
|
|
6000
6001
|
const result = await updateAgentConfiguration({
|
|
@@ -6034,12 +6035,12 @@ Use --local to find the name you'd pass to 'agent run' or 'agent detach'.
|
|
|
6034
6035
|
}
|
|
6035
6036
|
const record = loadAgentToken(name);
|
|
6036
6037
|
if (!record) {
|
|
6037
|
-
console.error(`No token file for '${name}' — is it attached on this machine? (
|
|
6038
|
+
console.error(`No token file for '${name}' — is it attached on this machine? (${CLI} agent list --local)`);
|
|
6038
6039
|
process.exit(1);
|
|
6039
6040
|
}
|
|
6040
6041
|
const instanceUrl = resolveInstanceUrl(opts.instance || record.instanceUrl);
|
|
6041
6042
|
const token = getToken(opts.instance || record.instanceUrl);
|
|
6042
|
-
if (!token) { console.error(
|
|
6043
|
+
if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
|
|
6043
6044
|
const client = createClient({ instance: instanceUrl, token });
|
|
6044
6045
|
try {
|
|
6045
6046
|
const result = await setWakeOnMessage({ client, record, enabled });
|
|
@@ -6061,12 +6062,12 @@ Use --local to find the name you'd pass to 'agent run' or 'agent detach'.
|
|
|
6061
6062
|
.action(async (name, opts) => {
|
|
6062
6063
|
const record = loadAgentToken(name);
|
|
6063
6064
|
if (!record) {
|
|
6064
|
-
console.error(`No token file for '${name}' — is it attached on this machine? (
|
|
6065
|
+
console.error(`No token file for '${name}' — is it attached on this machine? (${CLI} agent list --local)`);
|
|
6065
6066
|
process.exit(1);
|
|
6066
6067
|
}
|
|
6067
6068
|
const instanceUrl = resolveInstanceUrl(opts.instance || record.instanceUrl);
|
|
6068
6069
|
const token = getToken(opts.instance || record.instanceUrl);
|
|
6069
|
-
if (!token) { console.error(
|
|
6070
|
+
if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
|
|
6070
6071
|
const client = createClient({ instance: instanceUrl, token });
|
|
6071
6072
|
try {
|
|
6072
6073
|
const result = await clearUnsandboxedMark({ client, record });
|
|
@@ -6085,7 +6086,7 @@ Use --local to find the name you'd pass to 'agent run' or 'agent detach'.
|
|
|
6085
6086
|
.option('--instance <url>', 'Target Commonly instance')
|
|
6086
6087
|
.action(async (name, opts) => {
|
|
6087
6088
|
const token = getToken(opts.instance);
|
|
6088
|
-
if (!token) { console.error(
|
|
6089
|
+
if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
|
|
6089
6090
|
|
|
6090
6091
|
const client = createClient({ instance: resolveInstanceUrl(opts.instance), token });
|
|
6091
6092
|
|
|
@@ -6109,7 +6110,7 @@ Use --local to find the name you'd pass to 'agent run' or 'agent detach'.
|
|
|
6109
6110
|
.action((name, opts) => {
|
|
6110
6111
|
const record = loadAgentToken(name);
|
|
6111
6112
|
if (!record?.runtimeToken) {
|
|
6112
|
-
console.error(`No runtime token found for '${name}'. Run
|
|
6113
|
+
console.error(`No runtime token found for '${name}'. Run ${CLI} agent attach first.`);
|
|
6113
6114
|
process.exit(1);
|
|
6114
6115
|
}
|
|
6115
6116
|
const podId = opts.pod || record.podId;
|
package/src/commands/daemon.js
CHANGED
|
@@ -57,6 +57,7 @@ import {
|
|
|
57
57
|
import { installedCliVersion, startUpdateNotice, UPDATE_CHECK_OPT_OUT_ENV } from '../lib/update-check.js';
|
|
58
58
|
import { machineHostReport } from '../lib/machine-host.js';
|
|
59
59
|
import { orchestrateDaemonSetup } from '../lib/stable-install.js';
|
|
60
|
+
import { CLI } from '../lib/cli-hint.js';
|
|
60
61
|
|
|
61
62
|
// launchd, systemd and Task Scheduler hold one Commonly daemon per computer
|
|
62
63
|
// account. Install refuses to stop another HOME's; this flag takes it over.
|
|
@@ -127,7 +128,7 @@ const watchDaemonStatus = async () => {
|
|
|
127
128
|
let states = null;
|
|
128
129
|
let stateNote = '';
|
|
129
130
|
if (!getToken(record.instanceUrl)) {
|
|
130
|
-
stateNote = `Not logged in: showing local process state only. Run:
|
|
131
|
+
stateNote = `Not logged in: showing local process state only. Run: ${CLI} login --instance ${record.instanceUrl}`;
|
|
131
132
|
} else {
|
|
132
133
|
const podIds = [...new Set(seats.map((seat) => loadAgentToken(seat.recordKey || seat.agentName)?.podId).filter(Boolean))];
|
|
133
134
|
try {
|
|
@@ -171,14 +172,14 @@ const watchDaemonStatus = async () => {
|
|
|
171
172
|
const requireDaemonRecord = () => {
|
|
172
173
|
const record = loadDaemonRecord();
|
|
173
174
|
if (!record) {
|
|
174
|
-
throw new Error(
|
|
175
|
+
throw new Error(`No local daemon is registered. Run: ${CLI} daemon register`);
|
|
175
176
|
}
|
|
176
177
|
return record;
|
|
177
178
|
};
|
|
178
179
|
|
|
179
180
|
const requireUserToken = (instance) => {
|
|
180
181
|
const token = getToken(instance);
|
|
181
|
-
if (!token) throw new Error(`Not logged in to ${instance}. Run:
|
|
182
|
+
if (!token) throw new Error(`Not logged in to ${instance}. Run: ${CLI} login --instance ${instance}`);
|
|
182
183
|
return token;
|
|
183
184
|
};
|
|
184
185
|
|
|
@@ -274,9 +275,9 @@ const storedDaemonState = async (client, record) => {
|
|
|
274
275
|
};
|
|
275
276
|
|
|
276
277
|
export const daemonStatusErrorMessage = (error) => (isRevokedDaemonKey(error)
|
|
277
|
-
?
|
|
278
|
+
? `This computer's old key was revoked. Run: ${CLI} daemon register`
|
|
278
279
|
: isMissingDaemonMachine(error)
|
|
279
|
-
?
|
|
280
|
+
? `This computer is no longer registered. Run: ${CLI} daemon register`
|
|
280
281
|
: `Daemon status failed: ${error.message}`);
|
|
281
282
|
|
|
282
283
|
// `daemon setup` on a computer that is already registered for this instance
|
|
@@ -299,7 +300,7 @@ export const allowRevokedDaemonReplacement = async ({ existing, client }) => {
|
|
|
299
300
|
if (!existing) return null;
|
|
300
301
|
const state = await storedDaemonState(client, existing);
|
|
301
302
|
if (state === 'active') {
|
|
302
|
-
throw new Error(`A local daemon is already registered for ${existing.machineName}. Run:
|
|
303
|
+
throw new Error(`A local daemon is already registered for ${existing.machineName}. Run: ${CLI} daemon status`);
|
|
303
304
|
}
|
|
304
305
|
return state;
|
|
305
306
|
};
|
|
@@ -376,20 +377,20 @@ The daemon token is scoped to this machine and stored in a 0600 file under
|
|
|
376
377
|
~/.commonly/daemon/. It is never shown again after registration.
|
|
377
378
|
|
|
378
379
|
Examples:
|
|
379
|
-
$
|
|
380
|
-
$
|
|
381
|
-
$
|
|
382
|
-
$
|
|
383
|
-
$
|
|
384
|
-
$
|
|
385
|
-
$
|
|
380
|
+
$ ${CLI} daemon setup # install, log in, register, and start — one step
|
|
381
|
+
$ ${CLI} daemon register --name "Sam's MacBook"
|
|
382
|
+
$ ${CLI} daemon heartbeat
|
|
383
|
+
$ ${CLI} daemon status --verbose
|
|
384
|
+
$ ${CLI} daemon logs --seat my-agent -f
|
|
385
|
+
$ ${CLI} daemon start|stop|restart
|
|
386
|
+
$ ${CLI} daemon unregister
|
|
386
387
|
`);
|
|
387
388
|
|
|
388
389
|
daemon
|
|
389
390
|
.command('setup')
|
|
390
391
|
.description('From a fresh computer in one step: install the CLI under your home (no sudo, no global install), log in, register this computer, and start the daemon')
|
|
391
392
|
.option('--instance <url-or-key>', 'Target Commonly instance')
|
|
392
|
-
.option(UNSANDBOXED_FLAG,
|
|
393
|
+
.option(UNSANDBOXED_FLAG, `Native Windows only: the agents this daemon runs have no sandbox (see \`${CLI} daemon install\`). Forwarded to the install step.`)
|
|
393
394
|
.option(REPLACE_FLAG, REPLACE_HELP)
|
|
394
395
|
.action(async (opts) => {
|
|
395
396
|
try {
|
|
@@ -465,11 +466,11 @@ Examples:
|
|
|
465
466
|
console.log('Initial heartbeat accepted.');
|
|
466
467
|
} catch (error) {
|
|
467
468
|
console.error(`Machine is registered, but its initial heartbeat failed: ${error.message}`);
|
|
468
|
-
console.error(
|
|
469
|
+
console.error(`Retry with: ${CLI} daemon heartbeat`);
|
|
469
470
|
process.exitCode = 1;
|
|
470
471
|
}
|
|
471
472
|
if (existing && existsSync(servicePaths(process.platform, homedir()).file)) {
|
|
472
|
-
console.log(
|
|
473
|
+
console.log(`Restart the installed daemon to use the new key: ${CLI} daemon restart`);
|
|
473
474
|
}
|
|
474
475
|
} catch (error) {
|
|
475
476
|
console.error(`Daemon registration failed: ${error.message}`);
|
|
@@ -555,7 +556,7 @@ Examples:
|
|
|
555
556
|
const deps = serviceDeps();
|
|
556
557
|
const target = servicePaths(process.platform, homedir());
|
|
557
558
|
if (!deps.existsFile(target.file)) {
|
|
558
|
-
throw new Error(`No installed daemon service found. Run:
|
|
559
|
+
throw new Error(`No installed daemon service found. Run: ${CLI} daemon install`);
|
|
559
560
|
}
|
|
560
561
|
await actionFn({ platform: process.platform, home: homedir(), execCmd: deps.execCmd });
|
|
561
562
|
console.log(`Daemon ${action} requested (${target.kind}).`);
|
|
@@ -582,7 +583,7 @@ Examples:
|
|
|
582
583
|
const optedInBefore = loadUnsandboxedOptIn();
|
|
583
584
|
if (opts.unsandboxed) {
|
|
584
585
|
saveUnsandboxedOptIn();
|
|
585
|
-
console.log(
|
|
586
|
+
console.log(`Agents this daemon runs will have no sandbox: they act with your own access to files and commands, and get no connector grants. Codex can run commands in invite-only pods, where anyone in the pod, people you invite later included, can direct it. To turn this off, run: ${CLI} daemon install`);
|
|
586
587
|
} else if (clearUnsandboxedOptIn()) {
|
|
587
588
|
console.log('Turned off running without a sandbox: on Windows, agents this daemon runs are refused again until you choose otherwise.');
|
|
588
589
|
}
|
|
@@ -674,14 +675,14 @@ Examples:
|
|
|
674
675
|
try {
|
|
675
676
|
const terminal = loadDaemonStop();
|
|
676
677
|
if (terminal) {
|
|
677
|
-
console.error(
|
|
678
|
+
console.error(`Daemon stopped: no valid local registration. Run: ${CLI} daemon register`);
|
|
678
679
|
process.exitCode = process.platform === 'darwin' ? 0 : terminal.exitCode;
|
|
679
680
|
return;
|
|
680
681
|
}
|
|
681
682
|
record = requireDaemonRecord();
|
|
682
683
|
const stopped = loadDaemonStop(record);
|
|
683
684
|
if (stopped) {
|
|
684
|
-
console.error(
|
|
685
|
+
console.error(`Daemon stopped: this computer's key was revoked. Run: ${CLI} daemon register`);
|
|
685
686
|
// launchd restarts the first nonzero terminal exit once; a saved
|
|
686
687
|
// verdict makes that second invocation successful and ends the loop.
|
|
687
688
|
process.exitCode = process.platform === 'darwin' ? 0 : stopped.exitCode;
|
|
@@ -710,7 +711,7 @@ Examples:
|
|
|
710
711
|
const name = seatProviderKeyEnv({ adapter: saved?.adapter, environment: saved?.environment });
|
|
711
712
|
if (!name || process.env[name] || warnedKeys.has(`${agentName}:${name}`)) return;
|
|
712
713
|
warnedKeys.add(`${agentName}:${name}`);
|
|
713
|
-
stampLog(`WARNING: [${agentName}] needs ${name}, which is not set in this environment, so it will fail to start (a provider.keyFile avoids this); export it and re-run:
|
|
714
|
+
stampLog(`WARNING: [${agentName}] needs ${name}, which is not set in this environment, so it will fail to start (a provider.keyFile avoids this); export it and re-run: ${CLI} daemon install (docs/agents/daemon-service-environment.md)`);
|
|
714
715
|
};
|
|
715
716
|
// TASK-660: the daemon outlives many publishes, so say once at start-up
|
|
716
717
|
// when it is stale. Not awaited: supervision never waits on the registry.
|
|
@@ -731,7 +732,7 @@ Examples:
|
|
|
731
732
|
} catch (error) {
|
|
732
733
|
stampLog(`could not save revoked-machine stop marker: ${error.message}`);
|
|
733
734
|
}
|
|
734
|
-
stampLog(
|
|
735
|
+
stampLog(`machine key revoked; stopping supervised agents. Run: ${CLI} daemon register`);
|
|
735
736
|
clearInterval(pollTimer);
|
|
736
737
|
clearInterval(heartbeatTimer);
|
|
737
738
|
supervisor.stop();
|
|
@@ -856,7 +857,7 @@ Examples:
|
|
|
856
857
|
});
|
|
857
858
|
const lastSeen = machine.lastSeenAt ? new Date(machine.lastSeenAt).toLocaleString() : 'never';
|
|
858
859
|
console.log(`${machine.name}: ${machine.status} (last heartbeat: ${lastSeen})`);
|
|
859
|
-
if (loadUnsandboxedOptIn()) console.log(
|
|
860
|
+
if (loadUnsandboxedOptIn()) console.log(`Sandbox: unsandboxed (opted in). Agents run with your own access and get no connector grants, and anyone in an invite-only pod can direct a Codex agent there. Turn off: ${CLI} daemon install`);
|
|
860
861
|
if (opts.verbose) {
|
|
861
862
|
const local = loadDaemonState();
|
|
862
863
|
if (!local) {
|
package/src/commands/dev.js
CHANGED
|
@@ -15,6 +15,7 @@ import { existsSync } from 'fs';
|
|
|
15
15
|
import { join } from 'path';
|
|
16
16
|
import { saveInstance, getToken, LOCAL_URL } from '../lib/config.js';
|
|
17
17
|
import { createClient } from '../lib/api.js';
|
|
18
|
+
import { CLI } from '../lib/cli-hint.js';
|
|
18
19
|
|
|
19
20
|
const findDevSh = (startDir = process.cwd()) => {
|
|
20
21
|
let dir = startDir;
|
|
@@ -62,13 +63,13 @@ export const registerDev = (program) => {
|
|
|
62
63
|
|
|
63
64
|
dev.addHelpText('after', `
|
|
64
65
|
Examples:
|
|
65
|
-
$
|
|
66
|
-
$
|
|
67
|
-
$
|
|
68
|
-
$
|
|
66
|
+
$ ${CLI} dev up # Start a local docker-compose stack
|
|
67
|
+
$ ${CLI} dev status # Check health
|
|
68
|
+
$ ${CLI} dev logs backend # Tail backend logs
|
|
69
|
+
$ ${CLI} dev down # Stop everything
|
|
69
70
|
|
|
70
71
|
Login against the local instance with:
|
|
71
|
-
$
|
|
72
|
+
$ ${CLI} login --instance http://localhost:5000
|
|
72
73
|
`);
|
|
73
74
|
|
|
74
75
|
dev
|
|
@@ -83,7 +84,7 @@ Login against the local instance with:
|
|
|
83
84
|
console.log(' Frontend: http://localhost:3000');
|
|
84
85
|
console.log(' Backend: http://localhost:5000');
|
|
85
86
|
console.log('\nLogin to local instance:');
|
|
86
|
-
console.log(
|
|
87
|
+
console.log(` ${CLI} login --instance http://localhost:5000 --key local`);
|
|
87
88
|
});
|
|
88
89
|
|
|
89
90
|
dev
|
|
@@ -92,8 +93,8 @@ Login against the local instance with:
|
|
|
92
93
|
.allowUnknownOption()
|
|
93
94
|
.allowExcessArguments()
|
|
94
95
|
.action(() => {
|
|
95
|
-
console.error(
|
|
96
|
-
console.error(
|
|
96
|
+
console.error(`The local OpenClaw gateway was retired (ADR-021 Part B), so \`${CLI} dev clawdbot\` no longer does anything.`);
|
|
97
|
+
console.error(`Use native agents, or attach a local CLI with: ${CLI} agent attach <cli>`);
|
|
97
98
|
process.exit(1);
|
|
98
99
|
});
|
|
99
100
|
|
|
@@ -146,7 +147,7 @@ Login against the local instance with:
|
|
|
146
147
|
console.log('Local instance: healthy');
|
|
147
148
|
console.log(JSON.stringify(data, null, 2));
|
|
148
149
|
} catch {
|
|
149
|
-
console.log(
|
|
150
|
+
console.log(`Local instance: not running (start with: ${CLI} dev up)`);
|
|
150
151
|
}
|
|
151
152
|
});
|
|
152
153
|
};
|
package/src/commands/doctor.js
CHANGED
|
@@ -16,6 +16,7 @@ import { detectSeatbelt } from '../lib/sandbox/seatbelt.js';
|
|
|
16
16
|
import { daemonStatusErrorMessage, getDaemonMachineStatus } from './daemon.js';
|
|
17
17
|
import { listLocalAgents, listUnreadableAgentTokens } from './agent.js';
|
|
18
18
|
import { doctorExitCode, formatDoctorLine, runDoctor } from '../lib/doctor.js';
|
|
19
|
+
import { CLI } from '../lib/cli-hint.js';
|
|
19
20
|
|
|
20
21
|
const REQUEST_TIMEOUT_MS = 5000;
|
|
21
22
|
|
|
@@ -79,7 +80,7 @@ export const loginTarget = ({
|
|
|
79
80
|
key: saved?.key || null,
|
|
80
81
|
url: resolveUrl(instanceArg),
|
|
81
82
|
tokenSource: !token ? null : (env.COMMONLY_TOKEN ? 'env' : 'saved'),
|
|
82
|
-
loginHint: instanceArg ?
|
|
83
|
+
loginHint: instanceArg ? `${CLI} login --instance ${instanceArg}` : `${CLI} login`,
|
|
83
84
|
};
|
|
84
85
|
};
|
|
85
86
|
|
|
@@ -133,7 +134,7 @@ export const registerDoctor = (program) => {
|
|
|
133
134
|
for (const line of results.map(formatDoctorLine)) console.log(line);
|
|
134
135
|
process.exitCode = doctorExitCode(results);
|
|
135
136
|
} catch (error) {
|
|
136
|
-
console.error(
|
|
137
|
+
console.error(`${CLI} doctor could not finish: ${error.message}`);
|
|
137
138
|
process.exitCode = 1;
|
|
138
139
|
}
|
|
139
140
|
});
|