@sagentlab/navarch-runtime 0.1.138 → 0.1.140

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.
@@ -22,18 +22,20 @@ const node_path_1 = __importDefault(require("node:path"));
22
22
  const BROWSER_USE_RUNTIMES = ["codex", "claude-code", "antigravity", "opencode", "acp", "muse"];
23
23
  /**
24
24
  * Which navarch_browser tools a host session gets. `browserUse` adds capture
25
- * and local_browser_* for browser-use tasks. `playwrightSuites` adds
26
- * start_playwright_browser to every macOS Codex build/verify/qa session,
27
- * because Codex's seatbelt cannot launch the project's own Playwright suite's
28
- * Chromium whether or not the task asked for browser-use.
25
+ * and local_browser_* for browser-use build/verify/qa tasks. `playwrightSuites`
26
+ * adds start_playwright_browser to every macOS Codex build/verify/qa/ops
27
+ * session, because Codex's seatbelt cannot launch the project's own Playwright
28
+ * suite's Chromium whether or not the task asked for browser-use. Ops tasks
29
+ * diagnose suite failures too (ShiftSwap issue #154).
29
30
  */
30
31
  function navarchBrowserTools(input) {
31
- if (input.mcpConfigPath || input.sandboxMode !== "host" || !["build", "verify", "qa"].includes(input.taskType)) {
32
+ if (input.mcpConfigPath || input.sandboxMode !== "host")
32
33
  return { browserUse: false, playwrightSuites: false };
33
- }
34
34
  return {
35
- browserUse: input.requiredCapabilities?.includes("browser-use") === true && BROWSER_USE_RUNTIMES.includes(input.runtime),
36
- playwrightSuites: input.runtime === "codex" && input.platform === "darwin",
35
+ browserUse: ["build", "verify", "qa"].includes(input.taskType)
36
+ && input.requiredCapabilities?.includes("browser-use") === true && BROWSER_USE_RUNTIMES.includes(input.runtime),
37
+ playwrightSuites: ["build", "verify", "qa", "ops"].includes(input.taskType)
38
+ && input.runtime === "codex" && input.platform === "darwin",
37
39
  };
38
40
  }
39
41
  async function installEvidenceBrowser() {
@@ -214,23 +216,25 @@ async function startBrowserEvidence(options) {
214
216
  }
215
217
  const server = new mcp_js_1.McpServer({ name: "navarch-browser", version: "1.0.0" });
216
218
  const transport = new streamableHttp_js_1.StreamableHTTPServerTransport({ sessionIdGenerator: undefined, enableJsonResponse: true });
217
- server.registerTool("capture_visual_evidence", {
218
- description: "Capture and upload desktop and mobile screenshots using Navarch's managed local browser. Works outside the coding-agent sandbox. Returns durable artifact URLs. Capture does not certify acceptance or that the URL serves the supplied commit. Evidence is automatically attached to the delivery PR at session completion.",
219
- inputSchema: captureShape,
220
- }, async (args) => {
221
- try {
222
- if (busy)
223
- throw new Error("A capture is already running. Wait for it to finish.");
224
- const pending = capture(args);
225
- activeCapture = pending;
226
- const { captured, images } = await pending;
227
- return { content: [{ type: "text", text: JSON.stringify(captured) }, ...images] };
228
- }
229
- catch (error) {
230
- return { isError: true, content: [{ type: "text", text: String(error) }] };
231
- }
232
- });
233
- (0, local_browser_cjs_1.registerLocalBrowserTools)(server, localBrowser);
219
+ if (options.browserUse !== false) {
220
+ server.registerTool("capture_visual_evidence", {
221
+ description: "Capture and upload desktop and mobile screenshots using Navarch's managed local browser. Works outside the coding-agent sandbox. Returns durable artifact URLs. Capture does not certify acceptance or that the URL serves the supplied commit. Evidence is automatically attached to the delivery PR at session completion.",
222
+ inputSchema: captureShape,
223
+ }, async (args) => {
224
+ try {
225
+ if (busy)
226
+ throw new Error("A capture is already running. Wait for it to finish.");
227
+ const pending = capture(args);
228
+ activeCapture = pending;
229
+ const { captured, images } = await pending;
230
+ return { content: [{ type: "text", text: JSON.stringify(captured) }, ...images] };
231
+ }
232
+ catch (error) {
233
+ return { isError: true, content: [{ type: "text", text: String(error) }] };
234
+ }
235
+ });
236
+ (0, local_browser_cjs_1.registerLocalBrowserTools)(server, localBrowser);
237
+ }
234
238
  if (options.playwrightServer)
235
239
  (0, playwright_server_cjs_1.registerPlaywrightServerTool)(server, options.playwrightServer);
236
240
  res.on("close", () => { void transport.close(); void server.close(); });
package/dist/delivery.cjs CHANGED
@@ -176,10 +176,11 @@ function deliveryIncompleteSection(args) {
176
176
  "so your earlier edits, commits, and branch are all still here — start with `git status` and",
177
177
  "`git log --oneline` and continue from there rather than redoing the work.",
178
178
  "",
179
- "Inspect tracked and untracked changes before deciding what is undelivered work. Preserve required",
180
- "evidence in task artifacts, remove only temporary files you created (such as `.review-*/` scratch",
181
- "directories), and restore only tracked edits you made solely for local checks. Do not delete",
182
- "unfamiliar or pre-existing changes, hide leftovers with ignore rules, or commit scratch files.",
179
+ "Inspect tracked and untracked changes before deciding what is undelivered work. Required evidence",
180
+ "belongs in your final report or in task or issue comments; files in the worktree are not evidence.",
181
+ "Remove only temporary files you created (such as `.review-*/` scratch directories or evidence files",
182
+ "whose content you already reported), and restore only tracked edits you made solely for local checks.",
183
+ "Do not delete unfamiliar or pre-existing changes, hide leftovers with ignore rules, or commit scratch files.",
183
184
  ...(args.taskType === "review"
184
185
  ? [
185
186
  "This is a read-only review task. The generic delivery failure does not authorize commits,",
@@ -259,7 +259,11 @@ function createPlaywrightServer(options) {
259
259
  canonicalCore,
260
260
  token,
261
261
  ];
262
- const childEnv = { TMPDIR: params.PRIVATE };
262
+ // Chromium's macOS temp dir ignores TMPDIR and falls back to the user's
263
+ // /var/folders/.../T, which the profile does not let it write. Every
264
+ // download creates a temp file there first, so without this each one
265
+ // ended `canceled` (ShiftSwap issue #154).
266
+ const childEnv = { TMPDIR: params.PRIVATE, MAC_CHROMIUM_TMPDIR: params.PRIVATE };
263
267
  for (const name of ["HOME", "PATH", "LANG", "PLAYWRIGHT_BROWSERS_PATH"]) {
264
268
  if (env[name] !== undefined)
265
269
  childEnv[name] = env[name];
package/dist/prompt.cjs CHANGED
@@ -12,7 +12,7 @@ exports.renderCompletionRemediationPrompt = renderCompletionRemediationPrompt;
12
12
  exports.renderResumedCompletionRemediationPrompt = renderResumedCompletionRemediationPrompt;
13
13
  exports.renderHostedCheckpointNote = renderHostedCheckpointNote;
14
14
  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.";
15
- 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. Before your final report, inspect `git status --short`, including untracked files. Preserve required evidence in task artifacts, then remove only temporary files you created and restore only tracked edits you made solely for local checks. Do not delete unfamiliar or pre-existing changes, hide leftovers with ignore rules, or commit scratch files merely to make the worktree clean. Review tasks deliver a native review and attestation, never commits, pushes, or a new PR.";
15
+ 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. Before your final report, inspect `git status --short`, including untracked files. Put required evidence in your final report or in task or issue comments, not in files: a file left in the worktree is not delivered evidence, and an untracked one fails delivery as uncommitted work. Then remove only temporary files you created, including evidence files whose content you already reported, and restore only tracked edits you made solely for local checks. Do not delete unfamiliar or pre-existing changes, hide leftovers with ignore rules, or commit scratch files merely to make the worktree clean. Review tasks deliver a native review and attestation, never commits, pushes, or a new PR.";
16
16
  /** Overrides the playbooks' "default branch" PR base when the project sets a working branch. */
17
17
  function workingBranchNote(workingBranch) {
18
18
  if (!workingBranch)
package/dist/session.cjs CHANGED
@@ -731,7 +731,7 @@ async function runClaimedSession(deps, claimed, sessionId, lifecycle) {
731
731
  registry.register(playwrightServer.token);
732
732
  browserEvidence = await (0, browser_evidence_cjs_1.startBrowserEvidence)({
733
733
  apiBase: api.getBaseUrl(), machineToken: api.getToken() ?? "", leaseId,
734
- isActive, playwrightServer,
734
+ isActive, playwrightServer, browserUse,
735
735
  });
736
736
  registry.register(browserEvidence.token);
737
737
  const mcp = JSON.parse(await node_fs_1.promises.readFile(mcpConfigPath, "utf8"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sagentlab/navarch-runtime",
3
- "version": "0.1.138",
3
+ "version": "0.1.140",
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",