@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.
- package/dist/browser-evidence.cjs +29 -25
- package/dist/playwright-server.cjs +5 -1
- package/dist/session.cjs +1 -1
- package/package.json +1 -1
|
@@ -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`
|
|
26
|
-
* start_playwright_browser to every macOS Codex build/verify/qa
|
|
27
|
-
* because Codex's seatbelt cannot launch the project's own Playwright
|
|
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"
|
|
32
|
+
if (input.mcpConfigPath || input.sandboxMode !== "host")
|
|
32
33
|
return { browserUse: false, playwrightSuites: false };
|
|
33
|
-
}
|
|
34
34
|
return {
|
|
35
|
-
browserUse:
|
|
36
|
-
|
|
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
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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
|
-
|
|
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