@commonlyai/cli 0.1.302 → 0.1.303
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 +12 -2
- package/src/lib/model-unavailable.js +20 -4
package/package.json
CHANGED
package/src/commands/agent.js
CHANGED
|
@@ -2067,6 +2067,9 @@ export const performRun = ({
|
|
|
2067
2067
|
// saved on the server before each turn. Off for daemon seats, whose daemon
|
|
2068
2068
|
// projects the same values into `environment`.
|
|
2069
2069
|
readSavedControls = false,
|
|
2070
|
+
// A machine-bound record started by hand, without its daemon: nothing
|
|
2071
|
+
// projects Settings into it, so only `agent config` changes its model.
|
|
2072
|
+
standaloneMachineRun = false,
|
|
2070
2073
|
// F150: a seat with no daemon reads its live grant brokers before each turn.
|
|
2071
2074
|
// Off for daemon seats, whose daemon merges /assigned's into the record.
|
|
2072
2075
|
readGrantBrokers = false,
|
|
@@ -2649,13 +2652,19 @@ export const performRun = ({
|
|
|
2649
2652
|
const postModelUnavailableHint = async (error, hintPodId, configuredModel) => {
|
|
2650
2653
|
const failure = modelUnavailableFailure(error, { fallbackModel: configuredModel });
|
|
2651
2654
|
if (!failure || !hintPodId) return;
|
|
2652
|
-
|
|
2655
|
+
// A listener seat with no saved environment ignores Settings (see the
|
|
2656
|
+
// "has no saved environment" notice above), and so does a machine-bound
|
|
2657
|
+
// run with no daemon, so both get the command. Each instruction keeps its
|
|
2658
|
+
// own hour: a seat restarted with an environment hears the Settings line
|
|
2659
|
+
// even if the command line went out just before.
|
|
2660
|
+
const cliAgentName = (readSavedControls && !environment) || standaloneMachineRun ? agentName : null;
|
|
2661
|
+
const key = `model-unavailable:${failure.model || 'unknown'}${cliAgentName ? ':agent-config' : ''}`;
|
|
2653
2662
|
try {
|
|
2654
2663
|
if (!noticeDue(agentName, key, MODEL_UNAVAILABLE_HINT_WINDOW_MS)) return;
|
|
2655
2664
|
const delivery = await deliverTurnNotice({
|
|
2656
2665
|
client,
|
|
2657
2666
|
podId: hintPodId,
|
|
2658
|
-
text: modelUnavailableHint(failure.model),
|
|
2667
|
+
text: modelUnavailableHint(failure.model, { cliAgentName }),
|
|
2659
2668
|
limit: chatCharLimit,
|
|
2660
2669
|
maxChunks: maxChatChunks,
|
|
2661
2670
|
log,
|
|
@@ -5570,6 +5579,7 @@ Docs:
|
|
|
5570
5579
|
machineId: record.machineId, agentName: record.agentName, instanceId: record.instanceId }),
|
|
5571
5580
|
reportRuntime: Boolean(record.machineId || process.env.COMMONLY_MANAGED_RUNNER === '1'),
|
|
5572
5581
|
readSavedControls: !record.machineId && process.env.COMMONLY_MANAGED_RUNNER !== '1',
|
|
5582
|
+
standaloneMachineRun: Boolean(record.machineId) && process.env.COMMONLY_MANAGED_RUNNER !== '1',
|
|
5573
5583
|
readGrantBrokers: !record.machineId && process.env.COMMONLY_MANAGED_RUNNER !== '1',
|
|
5574
5584
|
spawnCredentialTtlSeconds: resolveSpawnTtlSeconds(process.env),
|
|
5575
5585
|
refusalHandoff: opts.refusalHandoff || null,
|
|
@@ -131,7 +131,23 @@ export const modelUnavailableFailure = (error, { fallbackModel = null } = {}) =>
|
|
|
131
131
|
return { model: safeModelName(fallbackModel) };
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
const CLI_AGENT_NAME_RE = /^[a-z0-9][a-z0-9._-]{0,63}$/i;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The one line posted in the pod. The model is set in the agent's Settings,
|
|
138
|
+
* under the "How it runs" section, which starts collapsed (F354: a walk missed
|
|
139
|
+
* it). `cliAgentName` is for a `commonly agent run` seat whose record has no
|
|
140
|
+
* saved environment: Settings doesn't reach that seat until `agent config`
|
|
141
|
+
* writes one, so the line names that command instead. A name that can't be
|
|
142
|
+
* printed safely becomes `<name>`: Settings still wouldn't reach that seat.
|
|
143
|
+
*/
|
|
144
|
+
export const modelUnavailableHint = (model, { cliAgentName = null } = {}) => {
|
|
145
|
+
const what = model
|
|
146
|
+
? `The model provider says ${model} isn't available for this agent.`
|
|
147
|
+
: "The model provider says this agent's model isn't available.";
|
|
148
|
+
if (typeof cliAgentName !== 'string' || !cliAgentName) {
|
|
149
|
+
return `${what} To change it, open the agent's Settings, then How it runs, then Model.`;
|
|
150
|
+
}
|
|
151
|
+
const name = CLI_AGENT_NAME_RE.test(cliAgentName) ? cliAgentName : '<name>';
|
|
152
|
+
return `${what} To change it, run commonly agent config ${name} --model <model> on the computer it runs on, then restart commonly agent run ${name}.`;
|
|
153
|
+
};
|