@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
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
* turn's own provider, so it never counts (public-tool-error.js).
|
|
27
27
|
*/
|
|
28
28
|
import { PUBLIC_MCP_NOT_READY_CODE, PUBLIC_TOOL_FAILED_CODE } from './public-tool-error.js';
|
|
29
|
+
import { CLI } from './cli-hint.js';
|
|
29
30
|
|
|
30
31
|
/** How long one model's hint stays posted before the seat may post it again. */
|
|
31
32
|
export const MODEL_UNAVAILABLE_HINT_WINDOW_MS = 60 * 60 * 1000;
|
|
@@ -149,5 +150,5 @@ export const modelUnavailableHint = (model, { cliAgentName = null } = {}) => {
|
|
|
149
150
|
return `${what} To change it, open the agent's Settings, then How it runs, then Model.`;
|
|
150
151
|
}
|
|
151
152
|
const name = CLI_AGENT_NAME_RE.test(cliAgentName) ? cliAgentName : '<name>';
|
|
152
|
-
return `${what} To change it, run
|
|
153
|
+
return `${what} To change it, run ${CLI} agent config ${name} --model <model> on the computer it runs on, then restart ${CLI} agent run ${name}.`;
|
|
153
154
|
};
|
package/src/lib/poller.js
CHANGED
|
@@ -10,6 +10,7 @@ import { createClient } from './api.js';
|
|
|
10
10
|
import { formatDigestFrame } from './digest-frame.js';
|
|
11
11
|
import { EMPTY_OUTPUT } from './claim-outcome.js';
|
|
12
12
|
import { createPollLiveness, formatStall, resolvePollLivenessMs } from './poll-liveness.js';
|
|
13
|
+
import { CLI } from './cli-hint.js';
|
|
13
14
|
|
|
14
15
|
// Delivery failures that must stop a consumer rather than fall through to the
|
|
15
16
|
// normal at-least-once retry path. A stale delivery belongs to a replacement
|
|
@@ -168,7 +169,7 @@ export const startPoller = ({
|
|
|
168
169
|
`Runtime token rejected ${consecutiveAuthErrors} times in a row — stopping poller. `
|
|
169
170
|
+ `This connection takes its key from --token, then COMMONLY_TOKEN, then your saved login. `
|
|
170
171
|
+ `If the key was rotated or revoked, re-run with the new key in --token or COMMONLY_TOKEN; `
|
|
171
|
-
+ `with neither set, run
|
|
172
|
+
+ `with neither set, run ${CLI} login${loginInstance ? ` --instance ${loginInstance}` : ''}.`,
|
|
172
173
|
));
|
|
173
174
|
running = false;
|
|
174
175
|
return;
|
|
@@ -21,6 +21,7 @@ import { normalizeSandboxTrust } from '../environment.js';
|
|
|
21
21
|
import { PUBLIC_SANDBOX_MODES, resolvePublicSandboxMode } from './mode.js';
|
|
22
22
|
import { detectBwrap as defaultDetectBwrap } from './bwrap.js';
|
|
23
23
|
import { detectSeatbelt as defaultDetectSeatbelt } from './seatbelt.js';
|
|
24
|
+
import { CLI } from '../cli-hint.js';
|
|
24
25
|
|
|
25
26
|
// D245: the Windows opt-in (windows-unsandboxed.js re-exports it; defined here to avoid an import cycle).
|
|
26
27
|
export const UNSANDBOXED_FLAG = '--unsandboxed';
|
|
@@ -50,7 +51,7 @@ const CODEX_WINDOWS_MESSAGE = [
|
|
|
50
51
|
"Codex can't enforce a sandbox on Windows without its elevated setup,",
|
|
51
52
|
'so by default this agent cannot listen for @mentions from native Windows. You can:',
|
|
52
53
|
` - In invite-only pods, run it without a sandbox: add ${UNSANDBOXED_FLAG}`
|
|
53
|
-
+ ` (
|
|
54
|
+
+ ` (${CLI} agent run <name> ${UNSANDBOXED_FLAG}, or ${CLI} daemon install ${UNSANDBOXED_FLAG}).`
|
|
54
55
|
+ ' Nothing confines it: it runs with your own access to files and commands, anyone in the pod,'
|
|
55
56
|
+ ' people you invite later included, can direct it, and it gets no connector grants.',
|
|
56
57
|
CODEX_WSL_LINE,
|
|
@@ -134,7 +135,7 @@ export const windowsSandboxMessage = (adapterName) => {
|
|
|
134
135
|
// D245: the user's own choice, never a default (sandbox/windows-unsandboxed.js).
|
|
135
136
|
...(adapterName === 'claude'
|
|
136
137
|
? [` - Run it without an OS sandbox: add ${UNSANDBOXED_FLAG}`
|
|
137
|
-
+ ` (
|
|
138
|
+
+ ` (${CLI} agent run <name> ${UNSANDBOXED_FLAG}, or ${CLI} daemon install ${UNSANDBOXED_FLAG}).`
|
|
138
139
|
+ " It keeps Commonly's restricted tool settings and gets no shell, but nothing at the OS level confines it, and it gets no connector grants."]
|
|
139
140
|
: []),
|
|
140
141
|
...(adapterName === 'claude'
|
|
@@ -24,6 +24,7 @@ import { existsSync, mkdirSync, readFileSync } from 'fs';
|
|
|
24
24
|
import { homedir } from 'os';
|
|
25
25
|
import { join, sep } from 'path';
|
|
26
26
|
import { resolveLaunch } from './windows-command.js';
|
|
27
|
+
import { NPX } from './cli-hint.js';
|
|
27
28
|
|
|
28
29
|
export const CLI_PACKAGE = '@commonlyai/cli';
|
|
29
30
|
|
|
@@ -35,7 +36,7 @@ export const MIN_NODE_MAJOR = 22;
|
|
|
35
36
|
// version that invoked it, so what runs resident is what the user installed.
|
|
36
37
|
export const stableCliDir = (home = homedir()) => join(home, '.commonly', 'cli');
|
|
37
38
|
/** The one line that sets up or updates a computer, for advice the CLI prints. */
|
|
38
|
-
export const DAEMON_SETUP_LINE =
|
|
39
|
+
export const DAEMON_SETUP_LINE = `${NPX} -y ${CLI_PACKAGE}@latest daemon setup`;
|
|
39
40
|
|
|
40
41
|
/** True when this process runs the copy `daemon setup` installed under $HOME. */
|
|
41
42
|
export const runsFromStableInstall = (entry = process.argv[1], home = homedir()) => (
|
package/src/lib/task.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import { readFileSync } from 'fs';
|
|
14
14
|
import { DEFAULT_URL, resolveInstance } from './config.js';
|
|
15
15
|
import { extractToken, resolveTokenFilePath, TOKEN_FILE_ENV } from './inbox.js';
|
|
16
|
+
import { CLI } from './cli-hint.js';
|
|
16
17
|
|
|
17
18
|
export const API_URL_ENV = 'COMMONLY_API_URL';
|
|
18
19
|
export const TASK_TOKEN_ENV = 'COMMONLY_AGENT_TOKEN';
|
|
@@ -62,10 +63,10 @@ export const checkStatusFilter = (value) => {
|
|
|
62
63
|
export const checkUpdateStatus = (value) => {
|
|
63
64
|
const status = String(value).trim().toLowerCase();
|
|
64
65
|
if (status === 'claimed') {
|
|
65
|
-
throw new TaskRefusal(
|
|
66
|
+
throw new TaskRefusal(`--status claimed is refused: \`${CLI} task claim\` writes the lease, and a bare status does not.`);
|
|
66
67
|
}
|
|
67
68
|
if (status === 'done') {
|
|
68
|
-
throw new TaskRefusal(
|
|
69
|
+
throw new TaskRefusal(`--status done is refused: \`${CLI} task close\` stamps completedAt and the PR, and PATCH does not.`);
|
|
69
70
|
}
|
|
70
71
|
if (!UPDATE_STATUSES.includes(status)) {
|
|
71
72
|
throw new TaskRefusal(`--status must be ${UPDATE_STATUSES.join(' or ')} (got '${value}').`);
|
|
@@ -88,6 +88,12 @@ export const OUT_OF_ALLOWANCE_NOTICE = 'I can’t answer right now: the AI accou
|
|
|
88
88
|
// (CUT_OFF_LINE in agentMessageService.ts, pinned by a test).
|
|
89
89
|
export const CUT_OFF_NOTICE = 'I got cut off before I could finish that, so please ask me again if anything is missing.';
|
|
90
90
|
|
|
91
|
+
// F421: a public seat whose Commonly tools never came up. Its model would have
|
|
92
|
+
// answered without reading the pod, so the wrapper withholds that answer and
|
|
93
|
+
// says this instead; the event stays unacked and is answered once the tools work.
|
|
94
|
+
export const TOOLS_UNAVAILABLE_NOTICE = 'I can’t answer right now: the tools I use to read and post here '
|
|
95
|
+
+ `aren’t working on my computer. Whoever runs me needs to fix that. ${AGAIN}`;
|
|
96
|
+
|
|
91
97
|
export const codexVersionNotice = (required) => 'I can’t answer right now: the computer I run on needs '
|
|
92
98
|
+ `Codex ${required} or newer. Whoever runs me needs to upgrade it and start me again. ${AGAIN}`;
|
|
93
99
|
|
|
@@ -96,7 +102,11 @@ const matches = (wordings, text) => wordings.some((wording) => wording.test(text
|
|
|
96
102
|
/** The cause a pod should hear about, and its line, or null when it should hear nothing. */
|
|
97
103
|
export const cantAnswerNotice = (error) => {
|
|
98
104
|
// A public seat's withheld turn quotes a TOOL's error, not its own provider's.
|
|
99
|
-
|
|
105
|
+
// A tool that failed mid-turn usually means Commonly itself was unreachable,
|
|
106
|
+
// so a line could not reach the pod either; it stays silent and retries.
|
|
107
|
+
if (error?.code === PUBLIC_TOOL_FAILED_CODE) return null;
|
|
108
|
+
// Tools that never started leave the API reachable, and a stranger waiting.
|
|
109
|
+
if (error?.code === PUBLIC_MCP_NOT_READY_CODE) return { cause: 'tools-unavailable', text: TOOLS_UNAVAILABLE_NOTICE };
|
|
100
110
|
if (error?.code === PUBLIC_CODEX_VERSION_CODE) {
|
|
101
111
|
return { cause: 'codex-version', text: codexVersionNotice(error.requiredVersion) };
|
|
102
112
|
}
|
package/src/lib/update-check.js
CHANGED
|
@@ -18,6 +18,7 @@ import { homedir } from 'node:os';
|
|
|
18
18
|
import { dirname, join } from 'node:path';
|
|
19
19
|
import { exactVersion, parseVersion } from './mcp-server-version.js';
|
|
20
20
|
import { DAEMON_SETUP_LINE, runsFromStableInstall } from './stable-install.js';
|
|
21
|
+
import { NPM } from './cli-hint.js';
|
|
21
22
|
|
|
22
23
|
export const CLI_PACKAGE = '@commonlyai/cli';
|
|
23
24
|
export const REGISTRY_LATEST_URL = 'https://registry.npmjs.org/@commonlyai%2fcli/latest';
|
|
@@ -58,7 +59,7 @@ export const updateNoticeLine = ({
|
|
|
58
59
|
const gap = Number.isFinite(behind) ? `${behind} versions behind` : 'behind a newer release line';
|
|
59
60
|
// A `daemon setup` copy lives under $HOME and has no global install to update;
|
|
60
61
|
// running setup again updates it and restarts the daemon.
|
|
61
|
-
const update = fromSetup ? DAEMON_SETUP_LINE :
|
|
62
|
+
const update = fromSetup ? DAEMON_SETUP_LINE : `${NPM} install -g ${CLI_PACKAGE}@latest`;
|
|
62
63
|
return `your CLI is ${gap} (installed ${from}, latest ${to}). Update: ${update}`
|
|
63
64
|
+ ` (silence with ${UPDATE_CHECK_OPT_OUT_ENV}=1)`;
|
|
64
65
|
};
|