@sagentlab/navarch-runtime 0.1.186 → 0.1.187

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/README.md CHANGED
@@ -658,13 +658,13 @@ unchanged across the deployment.
658
658
  | `NAVARCH_CODEX_BIN` | `codex` | Path/name of the Codex CLI binary. |
659
659
  | `NAVARCH_CODEX_EXTRA_ARGS` | — | Comma list of extra CLI args appended after the generated MCP `-c` overrides and `--json` (Codex). |
660
660
  | `NAVARCH_ANTIGRAVITY_BIN` | `agy` | Path/name of the Antigravity CLI binary, version 1.3.1+. |
661
- | `NAVARCH_ANTIGRAVITY_EXTRA_ARGS` | — | Comma list: only `--agent`, `--model`, `--effort`, `--sandbox`, `--dangerously-skip-permissions`; protocol, deadline and resume flags are owned by Navarch. |
661
+ | `NAVARCH_ANTIGRAVITY_EXTRA_ARGS` | — | Comma list: only `--agent`, `--model`, `--effort` (`low` to `max`), `--sandbox`, `--dangerously-skip-permissions`; protocol, deadline and resume flags are owned by Navarch. A `--model` here must match the model the project or task selects, or the session fails. |
662
662
  | `NAVARCH_OPENCODE_BIN` | `opencode` | Path/name of the OpenCode CLI binary. |
663
663
  | `NAVARCH_OPENCODE_EXTRA_ARGS` | — | Comma list of extra CLI args appended after `run`, the prompt, and the generated `--format json` argument. Explicit `--format`, `--model`, or `--variant` values replace the corresponding per-session default. |
664
664
  | `NAVARCH_ACP_BIN` | `dsh` | Path/name of an Agent Client Protocol v1 stdio server. DeepSeek Harness is the default implementation. |
665
665
  | `NAVARCH_ACP_EXTRA_ARGS` | `--profile,acp` | Comma list of arguments used to start the ACP server. Override this together with `NAVARCH_ACP_BIN` for another ACP-compatible coding agent. |
666
666
  | `NAVARCH_QODER_BIN` | `qoder` | Path/name of the Qoder CLI binary. |
667
- | `NAVARCH_QODER_EXTRA_ARGS` | — | Comma list of extra CLI args appended after the unattended defaults (`--setting-sources`, `--permission-mode auto`, `--output-format json`). An explicit `--output-format`, `--permission-mode`, `--settings`, `--model`, or `--reasoning-effort` here replaces the per-session default. Qoder selects its own account models; pin one via `--model` here or `connect --model` to override. |
667
+ | `NAVARCH_QODER_EXTRA_ARGS` | — | Comma list of extra CLI args appended after the unattended defaults (`--setting-sources`, `--permission-mode auto`, `--output-format json`). An explicit `--output-format`, `--permission-mode`, `--settings`, `--model`, or `--reasoning-effort` here replaces the per-session default. Qoder selects its own account models unless the project or a task names one; `--model` here or `connect --model` pins one for this machine. |
668
668
  | `NAVARCH_MUSE_BIN` | `muse` | Path/name of the native Muse Code CLI. Requires authenticated experimental `muse serve` SDK access; the npm SDK does not install the CLI. See [Muse Code setup](../docs/navarch/muse-code.md). |
669
669
  | `NAVARCH_MUSE_EXTRA_ARGS` | — | Comma list of arguments passed to `muse serve`. Permission/sandbox bypass flags are rejected. Configure narrow native approval rules rather than enabling blanket approval. |
670
670
  | `NAVARCH_MCP_CONFIG_PATH` | — | Path to the platform MCP config passed as `--mcp-config`. |
@@ -887,8 +887,8 @@ export NAVARCH_AGENT=opencode
887
887
  export NAVARCH_AGENT=acp
888
888
 
889
889
  # Qoder — requires an authenticated `qoder` CLI (or NAVARCH_QODER_BIN pointing
890
- # at it). Model selection is account-owned; NAVARCH_QODER_EXTRA_ARGS or
891
- # `connect --model` can pin one explicitly.
890
+ # at it). The model comes from the project setting (default: the account's own
891
+ # selection); NAVARCH_QODER_EXTRA_ARGS or `connect --model` pins one here.
892
892
  export NAVARCH_AGENT=qoder
893
893
 
894
894
  # Muse Code (experimental, runtime 0.1.117+) — see the dedicated setup
@@ -927,14 +927,17 @@ profile on every claim. The runtime passes those values as per-session CLI
927
927
  overrides (`codex exec --model ... -c model_reasoning_effort=...`,
928
928
  `claude -p --model ... --effort ...`, `agy --model ...`, or `opencode run
929
929
  --model ... --variant ...`) and records the effective model, profile, and
930
- effort on completion. Antigravity uses the `default` sentinel to preserve the CLI account model;
931
- explicit low/medium/high effort is supported without inventing higher levels. OpenCode accepts any `provider/model`
930
+ effort on completion. Antigravity, Qoder, Muse Code and ACP use the `default` sentinel to keep the
931
+ agent's own model until the project or a task names one; an Antigravity slug carries its effort
932
+ level, so no separate effort is sent, and an ACP model the agent does not advertise fails the
933
+ session before the first prompt. OpenCode accepts any `provider/model`
932
934
  reference (the platform default is `opencode/x-preview-f-free`, Ox Alpha Free
933
935
  (Unlimited) on OpenCode Zen), or `default` to preserve the authenticated
934
- account's selection. ACP sessions use the agent's advertised default model and
935
- set the standard `reasoning_effort` configuration option when it is available.
936
- Muse uses the account-owned `default` model; Navarch adds no Muse project-model
937
- column or public model catalog. Its SDK integration is experimental and has no
936
+ account's selection. ACP sessions select a named model through the agent's
937
+ advertised model option and set the standard `reasoning_effort` configuration
938
+ option when it is available.
939
+ Muse uses the account-owned `default` model unless the project names a
940
+ `modelId`; there is no public model catalog. Its SDK integration is experimental and has no
938
941
  Navi conversation capability. Read [Muse Code setup and limitations](../docs/navarch/muse-code.md)
939
942
  before using private repositories, especially Muse Contributor data settings.
940
943
  Machine-wide extra arguments still configure other CLI behavior; dispatched
@@ -1325,7 +1328,8 @@ repositories without changing the query format.
1325
1328
  machine identity. `start` and `supervise` reuse that model, including after worker
1326
1329
  restarts. Their optional `--model` flag overrides the saved choice. The pin wins
1327
1330
  over the project's session model for the selected adapter only; switching agent
1328
- types does not reuse another adapter's pin. Reconnect without `--model` to return
1331
+ types does not reuse another adapter's pin. A model pinned on the task itself
1332
+ wins over the machine pin (runtime 0.1.187+). Reconnect without `--model` to return
1329
1333
  to project-controlled model selection. Older identities without a model keep
1330
1334
  using the control-plane execution policy.
1331
1335
 
@@ -158,7 +158,10 @@ async function runAcpAdapter(options) {
158
158
  });
159
159
  sessionId = created.sessionId;
160
160
  let configOptions = created.configOptions ?? [];
161
- configOptions = await setConfigOption(context, acp.methods.agent.session.setConfigOption, sessionId, configOptions, "model", options.model === "default" ? undefined : options.model);
161
+ configOptions = await setConfigOption(context, acp.methods.agent.session.setConfigOption, sessionId, configOptions, "model", options.model === "default" ? undefined : options.model,
162
+ // A named model is an explicit selection: running the agent's own
163
+ // default instead would be a silent substitution.
164
+ true);
162
165
  await setConfigOption(context, acp.methods.agent.session.setConfigOption, sessionId, configOptions, "reasoning_effort", options.reasoningEffort);
163
166
  // The probe saw protocol v1; an agent that now answers another version
164
167
  // takes no interrupt, which then waits for the turn boundary.
@@ -266,19 +269,34 @@ function collectUpdate(notification, messages, thoughts, setCostUsd) {
266
269
  setCostUsd(update.cost.amount);
267
270
  }
268
271
  }
269
- async function setConfigOption(context, method, sessionId, options, configId, desired) {
272
+ async function setConfigOption(context, method, sessionId, options, configId, desired,
273
+ /** Fail the session when the agent cannot apply `desired`, instead of keeping its own value. */
274
+ required = false) {
270
275
  if (!desired)
271
276
  return options;
272
277
  const expectedCategory = configId === "model" ? "model" : "thought_level";
273
278
  const option = options.find((candidate) => ((candidate.id === configId || candidate.category === expectedCategory)
274
279
  && candidate.type === "select"));
275
- if (!option || option.type !== "select")
280
+ if (!option || option.type !== "select") {
281
+ if (required) {
282
+ throw new Error(`The ACP agent offers no selectable ${configId}, so the selected ${configId} "${desired}" cannot be applied. `
283
+ + `Set the project's ACP agent model to default, or connect an agent that advertises it.`);
284
+ }
276
285
  return options;
286
+ }
277
287
  const choices = option.options.flatMap((candidate) => "group" in candidate ? candidate.options : [candidate]);
278
288
  const selected = choices.find((candidate) => candidate.value === desired || candidate.name === desired);
279
- if (!selected || selected.value === option.currentValue)
289
+ if (!selected) {
290
+ if (required) {
291
+ const offered = choices.slice(0, 20).map((candidate) => candidate.value).join(", ");
292
+ throw new Error(`The ACP agent does not offer ${configId} "${desired}". It offers: ${offered || "none"}${choices.length > 20 ? ", …" : ""}. `
293
+ + `Select one of these, or set the project's ACP agent model to default.`);
294
+ }
295
+ return options;
296
+ }
297
+ if (selected.value === option.currentValue)
280
298
  return options;
281
- const response = await context.request(method, { sessionId, configId, value: selected.value });
299
+ const response = await context.request(method, { sessionId, configId: option.id, value: selected.value });
282
300
  return response.configOptions ?? options;
283
301
  }
284
302
  async function readMcpServers(configPath, env) {
@@ -16,7 +16,10 @@ const antigravity_mcp_cjs_1 = require("./antigravity-mcp.cjs");
16
16
  const types_cjs_1 = require("./types.cjs");
17
17
  /** Documented agy 1.3.1 contract, not Gemini CLI's similarly named format.
18
18
  * https://antigravity.google/docs/cli/headless/
19
- * https://antigravity.google/docs/changelog (1.1.27, 1.1.28, 1.2.6, 1.2.10)
19
+ * https://antigravity.google/docs/changelog (1.1.27, 1.1.28, 1.2.6, 1.2.10, 1.2.11)
20
+ * `--model` takes a slug from `agy models`; headless mode exits non-zero on an
21
+ * unknown one instead of falling back. `--effort` is low to max "depending on
22
+ * the model", so the CLI, not this adapter, decides which levels a model takes.
20
23
  * One stdin user event + EOF per process; later lease-local turns may resume
21
24
  * only the exact validated AG conversation. No interactive approval protocol.
22
25
  */
@@ -118,13 +121,13 @@ function antigravityArgs(options) {
118
121
  }
119
122
  const model = options.model && options.model !== "default" ? options.model : values.get("--model");
120
123
  if (values.has("--model") && options.model && options.model !== "default" && values.get("--model") !== options.model)
121
- return "Antigravity model arguments conflict with the selected execution model.";
124
+ return `Antigravity model arguments conflict: NAVARCH_ANTIGRAVITY_EXTRA_ARGS names ${values.get("--model")} but the selected execution model is ${options.model}. Remove --model from the extra arguments or select the same model.`;
122
125
  if (model)
123
126
  values.set("--model", model);
124
127
  const effort = options.reasoningEffort ?? values.get("--effort");
125
128
  if (effort) {
126
- if (!["low", "medium", "high"].includes(effort))
127
- return "Antigravity supports low, medium or high reasoning effort only.";
129
+ if (!["low", "medium", "high", "xhigh", "max"].includes(effort))
130
+ return "Antigravity reasoning effort must be low, medium, high, xhigh or max.";
128
131
  if (values.has("--effort") && values.get("--effort") !== effort)
129
132
  return "Antigravity reasoning effort arguments conflict.";
130
133
  values.set("--effort", effort);
@@ -20,10 +20,10 @@ function hasFlag(args, flag) {
20
20
  * parseClaudeJsonResult and its result text lands in the ordinary
21
21
  * exit-conditions path.
22
22
  *
23
- * Model selection is account-owned (`qoder --list-models`), so the claim-time
23
+ * The catalog is account-owned (`qoder --list-models`), so the claim-time
24
24
  * `"default"` sentinel (execution-policy.ts / session.cts) is passed through
25
- * as no `--model` flag; an explicit pin from `--model` at enroll or
26
- * NAVARCH_QODER_EXTRA_ARGS still reaches the CLI.
25
+ * as no `--model` flag; a model named by the project, a task pin, `--model` at
26
+ * enroll or NAVARCH_QODER_EXTRA_ARGS reaches the CLI.
27
27
  */
28
28
  async function runQoderAdapter(options) {
29
29
  if (options.signal?.aborted) {
@@ -52,8 +52,21 @@ async function runQoderAdapter(options) {
52
52
  args.push("--output-format", "json");
53
53
  }
54
54
  args.push(...options.extraArgs);
55
- if (options.model && options.model !== "default" && !hasFlag(options.extraArgs, "--model")) {
56
- args.push("--model", options.model);
55
+ if (options.model && options.model !== "default") {
56
+ const model = options.model;
57
+ const modelArgs = options.extraArgs.flatMap((arg, index) => arg === "--model" ? [options.extraArgs[index + 1]]
58
+ : arg.startsWith("--model=") ? [arg.slice("--model=".length)] : []);
59
+ if (modelArgs.some((value) => value !== model)) {
60
+ return {
61
+ exitCode: 1,
62
+ timedOut: false,
63
+ killedByLeaseLoss: false,
64
+ stdout: "",
65
+ stderr: `Qoder model arguments conflict with the selected model ${model}. Remove --model from NAVARCH_QODER_EXTRA_ARGS or select the same model.`,
66
+ };
67
+ }
68
+ if (modelArgs.length === 0)
69
+ args.push("--model", model);
57
70
  }
58
71
  if (options.reasoningEffort && !hasFlag(options.extraArgs, "--reasoning-effort")) {
59
72
  args.push("--reasoning-effort", options.reasoningEffort);
package/dist/session.cjs CHANGED
@@ -88,10 +88,12 @@ function resolveSessionExecution(config, claimed) {
88
88
  : "claude-opus-5-5",
89
89
  reasoning_effort: "medium",
90
90
  };
91
- return {
92
- ...execution,
93
- ...(runtime === config.agentType && config.model ? { model: config.model } : {}),
94
- };
91
+ // The machine pin stands in for project policy on its own adapter. A model
92
+ // the task itself pinned wins: running the machine's model there would be a
93
+ // silent substitution.
94
+ const machinePin = runtime === config.agentType && config.model && !execution.model_pinned
95
+ ? config.model : undefined;
96
+ return { ...execution, ...(machinePin ? { model: machinePin } : {}) };
95
97
  }
96
98
  /**
97
99
  * Runs one claimed task end to end (implementation-plan.md WP-07):
@@ -162,6 +164,9 @@ async function runClaimedSession(deps, claimed, sessionId, lifecycle) {
162
164
  const { lease_id: leaseId, task, context_bundle: bundle } = claimed;
163
165
  const runtime = claimed.runtime ?? config.agentType;
164
166
  const execution = resolveSessionExecution(config, claimed);
167
+ if (execution.model_pinned && runtime === config.agentType && config.model && config.model !== execution.model) {
168
+ log.info(`session ${leaseId}: the task pins model ${execution.model}; this machine's --model pin (${config.model}) is not applied`);
169
+ }
165
170
  // Isolation posture reported on every completion so `sessions` records what
166
171
  // a run actually executed under (#660). Derived from config alone, so the
167
172
  // pre-start failure paths below can stamp it too. Host mode records
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sagentlab/navarch-runtime",
3
- "version": "0.1.186",
3
+ "version": "0.1.187",
4
4
  "description": "Navarch machine-side session manager: claims delivery tasks and runs them through local coding agents.",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",