@proagentstore/cli 0.4.79 → 0.4.80
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.
|
@@ -115,6 +115,8 @@ export class BrowserBridge {
|
|
|
115
115
|
findings = [];
|
|
116
116
|
sourceFailures = [];
|
|
117
117
|
summary = null;
|
|
118
|
+
/** Tool calls that reached the bridge. Zero at exit means the CLI never used the browser (#944). */
|
|
119
|
+
calls = 0;
|
|
118
120
|
constructor(browser, host) {
|
|
119
121
|
this.browser = browser;
|
|
120
122
|
this.host = host;
|
|
@@ -128,6 +130,7 @@ export class BrowserBridge {
|
|
|
128
130
|
];
|
|
129
131
|
}
|
|
130
132
|
async callTool(name, args = {}) {
|
|
133
|
+
this.calls++;
|
|
131
134
|
if (name === "record_finding")
|
|
132
135
|
return this.recordFinding(args);
|
|
133
136
|
if (name === "report_source_failure")
|
|
@@ -143,6 +143,17 @@ export function signInHelp(engine) {
|
|
|
143
143
|
? "The Claude Code CLI on this machine is not signed in. Run `claude`, then /login, on that machine and start the run again."
|
|
144
144
|
: "The Codex CLI on this machine is not signed in. Run `codex login` on that machine and start the run again.";
|
|
145
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Why a run that never touched the browser bridge failed, and the step that fixes it (#944). The usual
|
|
148
|
+
* cause is the CLI refusing the bridge's tools (an approval policy, #952) or not loading the server.
|
|
149
|
+
*/
|
|
150
|
+
export function bridgeUnused(engine, said) {
|
|
151
|
+
const blocked = /approval|not (allowed|permitted)|permission|denied/i.test(said);
|
|
152
|
+
const cause = blocked
|
|
153
|
+
? `The ${engine === "claude" ? "Claude Code" : "Codex"} CLI was refused the PAGS browser tools.`
|
|
154
|
+
: `The ${engine === "claude" ? "Claude Code" : "Codex"} CLI finished without using the PAGS browser tools.`;
|
|
155
|
+
return `${cause} No page was opened, so this run found nothing. Update the CLI on that machine (npm i -g @proagentstore/cli), restart \`pags up\`, and start the run again.`;
|
|
156
|
+
}
|
|
146
157
|
/** The CLI's own closing text, from its structured output — the summary when it never called finish_research. */
|
|
147
158
|
export function finalText(engine, lines) {
|
|
148
159
|
for (let i = lines.length - 1; i >= 0; i--) {
|
|
@@ -27,7 +27,7 @@ import { RunnerInputError } from "../errors.js";
|
|
|
27
27
|
import { BrowserBridge, domainWithin } from "./bridge.js";
|
|
28
28
|
import { BRIDGE_ENV } from "./bridge-stdio.js";
|
|
29
29
|
import { LOCAL_BROWSER_AUTH_MODES, LOCAL_BROWSER_ENGINES, LOCAL_BROWSER_TASK_TYPE, redactDetail, redactText, secretEnvValues, } from "./contract.js";
|
|
30
|
-
import { buildEngineSpec, finalText, missingLogin, observedEngineAuth, researchPrompt, signInHelp } from "./engine.js";
|
|
30
|
+
import { bridgeUnused, buildEngineSpec, finalText, missingLogin, observedEngineAuth, researchPrompt, signInHelp } from "./engine.js";
|
|
31
31
|
const MAX_EVENTS = 2000;
|
|
32
32
|
const OUTPUT_LINES = 400;
|
|
33
33
|
const SAFE_ID = /^[A-Za-z0-9_.:-]{1,100}$/;
|
|
@@ -387,6 +387,11 @@ export class LocalBrowserRuntime {
|
|
|
387
387
|
const tail = run.output.slice(-5).join("\n").slice(-800);
|
|
388
388
|
return { outcome: "failed", summary, error: `The ${e.engine} CLI exited with code ${code}${tail ? `: ${tail}` : ""}` };
|
|
389
389
|
}
|
|
390
|
+
// A CLI that exits cleanly having never called the bridge did no research, whatever its prose
|
|
391
|
+
// says. Live run aac758dc (#952) ended `completed` with "the browser bridge required approval":
|
|
392
|
+
// no page opened, and the run looked like a success with nothing found.
|
|
393
|
+
if (!bridge?.calls)
|
|
394
|
+
return { outcome: "failed", summary, error: bridgeUnused(e.engine, summary) };
|
|
390
395
|
return { outcome: "completed", summary };
|
|
391
396
|
}
|
|
392
397
|
end(run, r) {
|