@sagentlab/navarch-runtime 0.1.138 → 0.1.139

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(); });
@@ -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/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.139",
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",