@sagentlab/navarch-runtime 0.1.65 → 0.1.66

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.
@@ -36,11 +36,30 @@ async function runOpenCodeAdapter(options) {
36
36
  };
37
37
  }
38
38
  const env = { ...options.env };
39
+ // V2 resolves its workspace from PWD. spawn({ cwd }) alone leaves the
40
+ // supervisor's PWD in the inherited environment (often the home directory).
41
+ if (!options.dockerExec && options.cwd)
42
+ env.PWD = node_path_1.default.resolve(options.cwd);
39
43
  await prepareOpenCodeConfig(options.mcpConfigPath, env, Boolean(options.dockerExec));
44
+ // V2's default background service owns its own cwd, environment and MCP
45
+ // configuration. A client process's isolated config does not isolate that
46
+ // service. Probe help without starting a turn, so older in-process CLIs
47
+ // remain supported and upgrades are detected on the next session.
48
+ const runOptions = { ...options, env };
49
+ const probeOptions = { ...runOptions, timeoutMs: 10_000, onProcessStarted: undefined };
50
+ const help = options.dockerExec
51
+ ? await runViaDocker(probeOptions, ["run", "--help"])
52
+ : await runOnHost(probeOptions, ["run", "--help"]);
53
+ if (help.exitCode !== 0 || help.timedOut || help.killedByLeaseLoss) {
54
+ return { ...help, stderr: `OpenCode CLI capability check failed. ${help.stderr}` };
55
+ }
40
56
  const binaryKey = `${options.dockerExec ? "docker:" : ""}${options.bin ?? "opencode"}`;
41
57
  const defaultLogLevel = !hasArg(options.extraArgs, "--log-level");
42
58
  const logLevel = defaultLogLevel ? (openCodeLogLevels.get(binaryKey) ?? "ERROR") : null;
43
59
  const args = ["run", options.prompt];
60
+ if (/^\s*--standalone\b/m.test(help.stdout) && !hasArg(options.extraArgs, "--standalone")) {
61
+ args.push("--standalone");
62
+ }
44
63
  // Provider failures may only appear in logs, absent from assistant events.
45
64
  if (!hasArg(options.extraArgs, "--print-logs"))
46
65
  args.push("--print-logs");
@@ -57,7 +76,6 @@ async function runOpenCodeAdapter(options) {
57
76
  // use the model's own default.
58
77
  args.push("--model", options.reasoningEffort ? `${options.model}#${options.reasoningEffort}` : options.model);
59
78
  }
60
- const runOptions = { ...options, env };
61
79
  const run = (runArgs) => runOptions.dockerExec ? runViaDocker(runOptions, runArgs) : runOnHost(runOptions, runArgs);
62
80
  let raw = await run(args);
63
81
  if (logLevel && raw.exitCode !== 0 && isLogLevelRejection(raw.stderr)) {
package/dist/prompt.cjs CHANGED
@@ -4,6 +4,7 @@ exports.renderPrompt = renderPrompt;
4
4
  exports.renderGuidanceCorrectionPrompt = renderGuidanceCorrectionPrompt;
5
5
  exports.renderHostedCheckpointNote = renderHostedCheckpointNote;
6
6
  const CODE_GRAPH_GUIDANCE = "For JS/TS dependency inspection, the runtime provides `navarch-runtime code-graph --query <symbol-or-file> --mode search|callers|callees|impact --commit HEAD`. If the runtime is not on PATH, use its installed entry point; do not install another copy mid-task. Results describe committed source and include commit/freshness warnings; inspect current files for uncommitted changes and unresolved dependencies.";
7
+ const PROCESS_GUIDANCE = "Process management: this host may run other agent sessions. Keep the PID or tool handle of each preview server you start and stop only that owned process. Never use broad process-name or command-line matching (pkill, killall) to clean up servers: the agent launcher carries the task prompt in its arguments and can match those patterns, terminating your own session. Use a different port when a port is occupied by a process you do not own. Keep scratch files in the current worktree; paths in previous transcripts belong to earlier sessions.";
7
8
  /**
8
9
  * Renders the four-layer context bundle (project-plan.md §3.8: steering docs,
9
10
  * task itself, task-type playbook, depends_on reports) into the single prompt
@@ -16,13 +17,14 @@ function renderPrompt(task, bundle) {
16
17
  const repositoryContext = bundle.repository
17
18
  ? `Repository: ${bundle.repository.full_name} (${bundle.repository.url})\nLocal checkout: this session's isolated git worktree (current working directory).`
18
19
  : null;
19
- return [repositoryContext, bundle.task_context.trim(), CODE_GRAPH_GUIDANCE, bundle.retry_context?.trim()]
20
+ return [repositoryContext, PROCESS_GUIDANCE, bundle.task_context.trim(), CODE_GRAPH_GUIDANCE, bundle.retry_context?.trim()]
20
21
  .filter((section) => Boolean(section))
21
22
  .join("\n\n") + "\n";
22
23
  }
23
24
  const sections = [];
24
25
  sections.push(`# Task: ${task.summary}`);
25
26
  sections.push(`Type: ${task.task_type} | Repo: ${task.repo} | Environment: ${task.environment_scope}`);
27
+ sections.push(PROCESS_GUIDANCE);
26
28
  if (bundle.repository) {
27
29
  sections.push(`Repository URL: ${bundle.repository.url}\nLocal checkout: this session's isolated git worktree (current working directory).`);
28
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sagentlab/navarch-runtime",
3
- "version": "0.1.65",
3
+ "version": "0.1.66",
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",