bugxhunter 0.9.5 → 0.9.6
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/.env.example +26 -1
- package/docker-compose.yml +30 -11
- package/package.json +1 -1
- package/server/dist/opencode.js +11 -1
- package/server/dist/recon-driver.js +190 -0
- package/server/dist/recon.js +538 -0
- package/web/dist/assets/{index-C6uzCxFC.js → index-BSYyJO9q.js} +1 -1
- package/web/dist/index.html +1 -1
package/.env.example
CHANGED
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
# Comma list of Claude model ids the AGENT's picker shows (default below). The
|
|
21
21
|
# Playground lists every model the key can use. In Docker the agent's Claude
|
|
22
22
|
# models are set in docker/opencode.json.
|
|
23
|
-
#
|
|
23
|
+
# claude-mythos-5-2 is verified-organisations-only: include it only if your key
|
|
24
|
+
# has access (it may not appear in the Playground's live list even when it does).
|
|
25
|
+
# ANTHROPIC_MODELS=claude-opus-5-5,claude-sonnet-5-5,claude-haiku-5-5,claude-mythos-5-2
|
|
24
26
|
|
|
25
27
|
# GitHub needs nothing here: "Connect GitHub" in the sidebar signs in to the
|
|
26
28
|
# public BugXHunter GitHub App (read-only). A fork that registers its own app
|
|
@@ -44,6 +46,29 @@ SCX_PROXY_TOKEN=
|
|
|
44
46
|
# Optional: host port for the UI (default 8790).
|
|
45
47
|
# OPEN_RUNNER_PORT=8790
|
|
46
48
|
|
|
49
|
+
# Egress control for the agent sandbox (the egress-logger sidecar).
|
|
50
|
+
# monitor (default): log every outbound destination, block nothing.
|
|
51
|
+
# enforce: deny-by-default to an allowlist (EGRESS_ALLOW + the model proxy).
|
|
52
|
+
# Needs a rebuild (the agent image now ships iptables). The runner can
|
|
53
|
+
# also flip the mode per engagement at runtime via the policy file
|
|
54
|
+
# /logs/egress-policy.json ({"mode","allow"}); env EGRESS_MODE=enforce
|
|
55
|
+
# is a floor that file cannot lower.
|
|
56
|
+
# EGRESS_MODE=monitor
|
|
57
|
+
# Comma list of allowed destinations under enforce — hosts, IPs or CIDRs. List
|
|
58
|
+
# the in-scope target(s) here (runner auto-injection is a follow-up), plus your
|
|
59
|
+
# out-of-band collaborator host so blind-vuln confirmation keeps working.
|
|
60
|
+
# e.g. EGRESS_ALLOW=target.example,oob.mycollab.net,203.0.113.0/24
|
|
61
|
+
# EGRESS_ALLOW=
|
|
62
|
+
# Upstream resolver IP(s) allowed on port 53 under enforce. On a compose network
|
|
63
|
+
# resolv.conf lists only Docker's embedded 127.0.0.11, which forwards upstream
|
|
64
|
+
# from the agent's namespace, so without this external DNS can fail under enforce.
|
|
65
|
+
# Set the real resolver, or give the agent an explicit `dns:`. e.g. EGRESS_DNS=1.1.1.1
|
|
66
|
+
# EGRESS_DNS=
|
|
67
|
+
# NOTE: enforce mode is defense-in-depth egress control, NOT a hard containment
|
|
68
|
+
# boundary — a NET_RAW agent can bypass it (AF_PACKET), and an agent restart
|
|
69
|
+
# reopens its namespace until re-sync. See docs/recon-security.md. Treat it as
|
|
70
|
+
# experimental and verify DNS/egress behaviour in your environment before relying on it.
|
|
71
|
+
|
|
47
72
|
# Optional: which published images `docker compose pull` fetches — a signed
|
|
48
73
|
# release tag like v1.2.3 (see SECURITY.md), or latest (default).
|
|
49
74
|
# BXH_VERSION=latest
|
package/docker-compose.yml
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
#
|
|
7
7
|
# Isolation model:
|
|
8
8
|
# - `agent` has direct internet so scan tools run at full speed (nmap, ping
|
|
9
|
-
# and raw DNS work too via NET_RAW). Outbound traffic is logged
|
|
9
|
+
# and raw DNS work too via NET_RAW). Outbound traffic is logged by default;
|
|
10
|
+
# set EGRESS_MODE=enforce to also deny-by-default to an allowlist (the
|
|
11
|
+
# in-scope target + EGRESS_ALLOW), enforced by the egress-logger sidecar.
|
|
10
12
|
# - `agent` holds NO SCX key: model calls go to runner's /scx/v1 proxy, which
|
|
11
13
|
# injects the key, so the key never enters the sandbox. Same for the GitHub
|
|
12
14
|
# sign-in: `runner` clones into /workspace, the agent gets a credential-free copy.
|
|
@@ -14,8 +16,8 @@
|
|
|
14
16
|
# - Both run as non-root with no-new-privileges; the agent drops all caps
|
|
15
17
|
# except NET_RAW, and bash/edit actions are approved in the UI.
|
|
16
18
|
#
|
|
17
|
-
# ⚠
|
|
18
|
-
# authorised to test, and run this on a trusted machine/VM.
|
|
19
|
+
# ⚠ In the default monitor mode the agent has unrestricted outbound. Only point
|
|
20
|
+
# it at targets you are authorised to test, and run this on a trusted machine/VM.
|
|
19
21
|
|
|
20
22
|
name: bugxhunter
|
|
21
23
|
|
|
@@ -114,23 +116,40 @@ services:
|
|
|
114
116
|
cpus: 1
|
|
115
117
|
restart: unless-stopped
|
|
116
118
|
|
|
117
|
-
#
|
|
118
|
-
# outbound traffic (tcpdump)
|
|
119
|
-
# /logs/egress-<date>.jsonl.
|
|
120
|
-
#
|
|
119
|
+
# Egress sidecar: shares the agent's network namespace. Always sniffs the
|
|
120
|
+
# agent's outbound traffic (tcpdump) and records distinct destinations + DNS
|
|
121
|
+
# lookups to /logs/egress-<date>.jsonl. In EGRESS_MODE=enforce it also installs
|
|
122
|
+
# a deny-by-default iptables chain (allow the in-scope target + EGRESS_ALLOW
|
|
123
|
+
# hosts + infra; REJECT the rest). Default EGRESS_MODE=monitor is log-only, in
|
|
124
|
+
# the data path for nothing, so scans keep full speed. The runner can flip the
|
|
125
|
+
# mode per engagement at runtime by writing /logs/egress-policy.json.
|
|
126
|
+
# Only this sidecar holds NET_ADMIN, so the agent can't touch the rules.
|
|
121
127
|
egress-logger:
|
|
122
128
|
image: ghcr.io/cintelis/bugxhunter-agent:${BXH_VERSION:-latest}${BXH_AGENT_FLAVOR:-}
|
|
123
129
|
command: ["node", "/usr/local/lib/egress-logger.mjs"]
|
|
124
|
-
network_mode: "service:agent" # see the agent's connections
|
|
125
|
-
user: root # needs CAP_NET_RAW effective (agent image defaults to non-root)
|
|
130
|
+
network_mode: "service:agent" # see (and, in enforce mode, filter) the agent's connections
|
|
131
|
+
user: root # needs CAP_NET_RAW/NET_ADMIN effective (agent image defaults to non-root)
|
|
126
132
|
environment:
|
|
127
133
|
OPEN_RUNNER_LOG_DIR: /logs
|
|
134
|
+
# monitor (default, log-only) or enforce (deny-by-default allowlist).
|
|
135
|
+
EGRESS_MODE: ${EGRESS_MODE:-monitor}
|
|
136
|
+
# Comma list of allowed destinations under enforce (hosts / IPs / CIDRs):
|
|
137
|
+
# put the in-scope target(s) here, plus any out-of-band collaborator host.
|
|
138
|
+
# The model proxy (runner) is always allowed. NB: automatic per-engagement
|
|
139
|
+
# injection of the target by the runner is a follow-up — for now list it here.
|
|
140
|
+
EGRESS_ALLOW: ${EGRESS_ALLOW:-}
|
|
141
|
+
# Upstream resolver IP(s) to allow on port 53 under enforce. On a compose
|
|
142
|
+
# network resolv.conf lists only Docker's embedded 127.0.0.11, which forwards
|
|
143
|
+
# upstream from inside the agent's namespace — set this to the real resolver
|
|
144
|
+
# (e.g. 1.1.1.1) so DNS keeps working, or give the agent an explicit `dns:`.
|
|
145
|
+
EGRESS_DNS: ${EGRESS_DNS:-}
|
|
128
146
|
volumes:
|
|
129
147
|
- logs:/logs
|
|
130
148
|
cap_drop: [ALL]
|
|
131
149
|
# NET_RAW: capture; SETUID/SETGID: tcpdump drops to its own user;
|
|
132
|
-
# DAC_OVERRIDE: write into /logs (owned by the runner's user)
|
|
133
|
-
|
|
150
|
+
# DAC_OVERRIDE: write into /logs (owned by the runner's user);
|
|
151
|
+
# NET_ADMIN: manage the BXH_EGRESS chain (used only in enforce mode).
|
|
152
|
+
cap_add: [NET_RAW, SETUID, SETGID, DAC_OVERRIDE, NET_ADMIN]
|
|
134
153
|
security_opt: ["no-new-privileges:true"]
|
|
135
154
|
depends_on: [agent]
|
|
136
155
|
restart: unless-stopped
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bugxhunter",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"description": "BugXHunter: an AI security-testing agent with a sandboxed runner, a passkey-sealed key vault and read-only GitHub access. `npx bugxhunter` runs it on your machine.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://bugxhunter.com",
|
package/server/dist/opencode.js
CHANGED
|
@@ -21,6 +21,7 @@ import { fileURLToPath } from "node:url";
|
|
|
21
21
|
import { createOpencodeServer, createOpencodeClient } from "@opencode-ai/sdk";
|
|
22
22
|
import { httpError } from "./errors.js";
|
|
23
23
|
import { anthropicOpencodeProvider, openrouterOpencodeProvider, nvidiaOpencodeProvider, ANTHROPIC_MODELS, OPENROUTER_MODELS, PORT } from "./providers.js";
|
|
24
|
+
import { RECON_AGENTS, withScrubbedEnv } from "./recon.js";
|
|
24
25
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
25
26
|
/** BugXHunter's own folder: the default project when none is chosen. */
|
|
26
27
|
export const REPO_ROOT = path.resolve(__dirname, "../..");
|
|
@@ -64,6 +65,9 @@ async function inlineConfig() {
|
|
|
64
65
|
build: { model: DEFAULT_MODEL },
|
|
65
66
|
plan: { model: DEFAULT_MODEL },
|
|
66
67
|
vision: VISION_AGENT,
|
|
68
|
+
// Supervised recon/autopwn: executor (GLM) + triage (Haiku) + verify
|
|
69
|
+
// (Sonnet) + escalate (Mythos), each on the job it is good at. See recon.ts.
|
|
70
|
+
...RECON_AGENTS,
|
|
67
71
|
},
|
|
68
72
|
permission: { edit: "ask", bash: "ask" },
|
|
69
73
|
...(Object.keys(provider).length ? { provider } : {}),
|
|
@@ -150,7 +154,13 @@ function getServer() {
|
|
|
150
154
|
if (!server) {
|
|
151
155
|
server = stopStaleServer()
|
|
152
156
|
.then(inlineConfig)
|
|
153
|
-
|
|
157
|
+
// Spawn with the operator's secrets stripped from the agent's env: the SDK
|
|
158
|
+
// snapshots process.env synchronously, so withScrubbedEnv hides them across
|
|
159
|
+
// exactly that spawn, then restores them for the runner. A prompt-injected
|
|
160
|
+
// executor (fed adversarial target output) then has nothing to exfiltrate.
|
|
161
|
+
// Local mode only; in Docker the agent is a separate container whose env is
|
|
162
|
+
// scrubbed at the compose/container layer (see docs/recon-security.md).
|
|
163
|
+
.then((config) => withScrubbedEnv(() => createOpencodeServer({ hostname: "127.0.0.1", port: AGENT_PORT, timeout: 15000, config: config })))
|
|
154
164
|
.then((s) => {
|
|
155
165
|
closeServer = () => {
|
|
156
166
|
try {
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supervised recon — the driver loop.
|
|
3
|
+
* -----------------------------------------------------------------------------
|
|
4
|
+
* Walks the recon roles from recon.ts into an actual run: seed the executor,
|
|
5
|
+
* let it probe under the risk-tier gate, track budget/rounds, escalate on
|
|
6
|
+
* evidence, and collect env-tagged findings — then stop cleanly.
|
|
7
|
+
*
|
|
8
|
+
* The loop's CONTROL LOGIC lives here and is pure + unit-tested against a fake
|
|
9
|
+
* session runner. The one piece that must talk to OpenCode — actually running
|
|
10
|
+
* an executor turn, streaming its events, auto-replying permissions the gate
|
|
11
|
+
* clears, and parsing the verifier's findings — is the `ReconSessionRunner`
|
|
12
|
+
* interface. The server implements it against the OpenCode SDK (the next
|
|
13
|
+
* integration step); the loop never imports OpenCode, so it stays testable.
|
|
14
|
+
*
|
|
15
|
+
* Why the gate is wired through the runner rather than called between turns:
|
|
16
|
+
* OpenCode streams `permission.asked` MID-turn and blocks until replied, so the
|
|
17
|
+
* decision has to ride the event stream. The runner is handed `gate` and calls
|
|
18
|
+
* it on each permission as it arrives.
|
|
19
|
+
*/
|
|
20
|
+
import { routeModel, harnessFor, classifyCommand, commandHazard, allCapped, originOf, escalateAfter, } from "./recon.js";
|
|
21
|
+
const SEVERITY_RANK = { low: 0, medium: 1, high: 2, critical: 3 };
|
|
22
|
+
const worstSeverity = (fs) => {
|
|
23
|
+
let best;
|
|
24
|
+
for (const f of fs)
|
|
25
|
+
if (f.verdict !== "rejected" && (!best || SEVERITY_RANK[f.severity] > SEVERITY_RANK[best]))
|
|
26
|
+
best = f.severity;
|
|
27
|
+
return best;
|
|
28
|
+
};
|
|
29
|
+
/** Hard default caps so a run is NEVER unbounded, even with an empty harness. */
|
|
30
|
+
const DEFAULT_RECON_HARNESS = {
|
|
31
|
+
maxRounds: 80,
|
|
32
|
+
budgetTokens: 3_000_000,
|
|
33
|
+
};
|
|
34
|
+
/** A positive integer, or the fallback (defends against undefined/NaN/Infinity overrides). */
|
|
35
|
+
const posInt = (v, d) => (typeof v === "number" && Number.isInteger(v) && v >= 1 ? v : d);
|
|
36
|
+
/** Merge harness overrides over the profile and hard defaults WITHOUT letting an
|
|
37
|
+
* undefined/NaN/Infinity override erase a cap — the loop is never unbounded. */
|
|
38
|
+
function resolveHarness(override) {
|
|
39
|
+
const merged = { ...DEFAULT_RECON_HARNESS, ...harnessFor("executor"), ...override };
|
|
40
|
+
return {
|
|
41
|
+
...merged,
|
|
42
|
+
maxRounds: posInt(merged.maxRounds, DEFAULT_RECON_HARNESS.maxRounds),
|
|
43
|
+
budgetTokens: posInt(merged.budgetTokens, DEFAULT_RECON_HARNESS.budgetTokens),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export function reconGateDecision(p, ctx = {}) {
|
|
47
|
+
const tool = (p.tool ?? "").toLowerCase();
|
|
48
|
+
if (!tool)
|
|
49
|
+
return "ask"; // guard: a permission with no tool fails closed
|
|
50
|
+
if (tool === "bash" || tool === "shell") {
|
|
51
|
+
if (!p.command)
|
|
52
|
+
return "ask";
|
|
53
|
+
// Deny the handful of shapes that wreck the agent host or turn it into a
|
|
54
|
+
// zombie (reverse shell, download->shell, exfil) — even a human shouldn't
|
|
55
|
+
// one-click-approve those. These are NOT in-scope attacks on the target.
|
|
56
|
+
if (commandHazard(p.command))
|
|
57
|
+
return "deny";
|
|
58
|
+
return classifyCommand(p.command, ctx); // allow (tiny safe set) | ask (everything else)
|
|
59
|
+
}
|
|
60
|
+
if (tool === "read" || tool === "grep" || tool === "glob" || tool === "list" || tool === "ls")
|
|
61
|
+
return "allow";
|
|
62
|
+
// edit/write/patch/multiedit (mutate files), webfetch/fetch (reach out): always ask.
|
|
63
|
+
return "ask";
|
|
64
|
+
}
|
|
65
|
+
const str = (v) => (typeof v === "string" && v.trim() ? v : undefined);
|
|
66
|
+
const get = (o, k) => (o && typeof o === "object" ? o[k] : undefined);
|
|
67
|
+
/**
|
|
68
|
+
* Defensively pull a shell command out of a raw OpenCode permission object —
|
|
69
|
+
* its shape varies by server version, so check the known spots and fail to
|
|
70
|
+
* `undefined` (which the gate treats as "ask").
|
|
71
|
+
*/
|
|
72
|
+
export function extractReconCommand(raw) {
|
|
73
|
+
const toolInput = get(get(raw, "tool"), "input");
|
|
74
|
+
// Only fields known to be the EXACT executed command. The `pattern` (a glob)
|
|
75
|
+
// and a bare `input` string are deliberately NOT used: feeding the gate a
|
|
76
|
+
// string other than what runs is a bypass (H1). Unknown shape -> undefined -> ask.
|
|
77
|
+
return (str(get(raw, "command")) ??
|
|
78
|
+
str(get(get(raw, "metadata"), "command")) ??
|
|
79
|
+
str(get(get(raw, "input"), "command")) ??
|
|
80
|
+
str(get(get(raw, "args"), "command")) ??
|
|
81
|
+
str(get(toolInput, "command")));
|
|
82
|
+
}
|
|
83
|
+
/** Mutable state of one recon run: spend, rounds, stuck-streak, findings. */
|
|
84
|
+
export class ReconRun {
|
|
85
|
+
harness;
|
|
86
|
+
spentTokens = 0;
|
|
87
|
+
rounds = 0;
|
|
88
|
+
/** Consecutive turns the executor reported stuck — the escalation signal. */
|
|
89
|
+
attempts = 0;
|
|
90
|
+
findings = [];
|
|
91
|
+
constructor(harness = {}) {
|
|
92
|
+
this.harness = harness;
|
|
93
|
+
}
|
|
94
|
+
recordUsage(tokens) { if (tokens > 0)
|
|
95
|
+
this.spentTokens += tokens; }
|
|
96
|
+
recordRound() { this.rounds += 1; }
|
|
97
|
+
recordStuck() { this.attempts += 1; }
|
|
98
|
+
resetAttempts() { this.attempts = 0; }
|
|
99
|
+
/** Keep every finding the verifier didn't reject. */
|
|
100
|
+
addFindings(fs) {
|
|
101
|
+
for (const f of fs)
|
|
102
|
+
if (f.verdict !== "rejected")
|
|
103
|
+
this.findings.push(f);
|
|
104
|
+
}
|
|
105
|
+
/** Uncached input tokens left, or undefined when the harness sets no budget. */
|
|
106
|
+
budgetRemaining() {
|
|
107
|
+
return this.harness.budgetTokens === undefined ? undefined : Math.max(0, this.harness.budgetTokens - this.spentTokens);
|
|
108
|
+
}
|
|
109
|
+
outOfBudget() { const r = this.budgetRemaining(); return r !== undefined && r <= 0; }
|
|
110
|
+
outOfRounds() { return this.harness.maxRounds !== undefined && this.rounds >= this.harness.maxRounds; }
|
|
111
|
+
/** The worst severity seen so far, for the escalation signal. */
|
|
112
|
+
highestSeverity() {
|
|
113
|
+
let best;
|
|
114
|
+
for (const f of this.findings)
|
|
115
|
+
if (!best || SEVERITY_RANK[f.severity] > SEVERITY_RANK[best])
|
|
116
|
+
best = f.severity;
|
|
117
|
+
return best;
|
|
118
|
+
}
|
|
119
|
+
/** Signals for the router this round. severityHint is passed in per-turn by the
|
|
120
|
+
* driver (the CURRENT candidate's severity) — NOT accumulated, so one High
|
|
121
|
+
* finding does not pin every later turn to the frontier model (H2). */
|
|
122
|
+
signals(extra = {}) {
|
|
123
|
+
return { attempts: this.attempts, budgetRemaining: this.budgetRemaining(), ...extra };
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/** Build the executor's seed prompt: scope fence + env-fidelity gate + objective. */
|
|
127
|
+
export function buildReconKickoff(opts) {
|
|
128
|
+
const { objective, scope, env } = opts;
|
|
129
|
+
const nonProd = env.nonProdSettings?.length ? ` Known non-production settings: ${env.nonProdSettings.join(", ")}.` : "";
|
|
130
|
+
return [
|
|
131
|
+
`SCOPE (authorisation fence): test only ${scope}. Anything outside it is out of bounds — do not touch it.`,
|
|
132
|
+
`ENVIRONMENT FIDELITY: this is a ${env.kind} instance. ${env.divergences}${nonProd} Tag every finding with this environment; if a finding depends on a setting that differs from production, mark it config-dependent and say what to re-test against production — never report it as a clean production bug.`,
|
|
133
|
+
`OBJECTIVE: ${objective}`,
|
|
134
|
+
`Work one hypothesis at a time with the smallest low-impact probe. Read-only probes run freely; anything that changes state pauses for human approval. When you have a candidate, hand it to the recon-verify subagent — do not promote it yourself.`,
|
|
135
|
+
].join("\n\n");
|
|
136
|
+
}
|
|
137
|
+
/** Prompt that nudges the executor forward after a turn goes idle with work left. */
|
|
138
|
+
export const RECON_CONTINUE = "Continue: take the next untested hypothesis within scope. If the in-scope surface is genuinely exhausted, stop and say so rather than widening scope. Hand any new candidate to recon-verify.";
|
|
139
|
+
/**
|
|
140
|
+
* Drive one supervised recon run to completion. Pure control flow over the
|
|
141
|
+
* injected runner: route (and escalate) the executor model each round, run a
|
|
142
|
+
* turn under the gate, fold in usage and findings, and stop on done / idle /
|
|
143
|
+
* budget / rounds. The harness for the executor role supplies the caps.
|
|
144
|
+
*/
|
|
145
|
+
export async function driveRecon(opts) {
|
|
146
|
+
const run = new ReconRun(resolveHarness(opts.harness));
|
|
147
|
+
const { host: scopeHost, port: scopePort } = originOf(opts.scope);
|
|
148
|
+
const gate = (p) => reconGateDecision(p, { scopeHost, scopePort });
|
|
149
|
+
const maxStuck = escalateAfter() + 2; // give escalation a chance before giving up
|
|
150
|
+
let prompt = buildReconKickoff(opts);
|
|
151
|
+
// One-shot: the worst severity found LAST turn informs THIS turn's routing, then clears.
|
|
152
|
+
let severityHint;
|
|
153
|
+
for (;;) {
|
|
154
|
+
const signals = run.signals({ rateLimited: opts.rateLimited?.(), severityHint });
|
|
155
|
+
// Every model is rate-limited — back off rather than thrash (H4).
|
|
156
|
+
if (allCapped(signals))
|
|
157
|
+
return finish(run, "rate-limited");
|
|
158
|
+
const model = routeModel("executor", signals);
|
|
159
|
+
let res;
|
|
160
|
+
try {
|
|
161
|
+
res = await opts.runner.runTurn({ prompt, model, gate });
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
return finish(run, "error"); // keep the findings gathered so far (M2)
|
|
165
|
+
}
|
|
166
|
+
run.recordRound();
|
|
167
|
+
run.recordUsage(res.tokensUsed);
|
|
168
|
+
run.addFindings(res.findings);
|
|
169
|
+
severityHint = worstSeverity(res.findings);
|
|
170
|
+
if (res.stuck)
|
|
171
|
+
run.recordStuck();
|
|
172
|
+
else
|
|
173
|
+
run.resetAttempts();
|
|
174
|
+
if (res.done)
|
|
175
|
+
return finish(run, "done"); // a clean finish wins over the caps
|
|
176
|
+
if (run.outOfBudget())
|
|
177
|
+
return finish(run, "budget");
|
|
178
|
+
if (run.outOfRounds())
|
|
179
|
+
return finish(run, "rounds");
|
|
180
|
+
if (run.attempts >= maxStuck)
|
|
181
|
+
return finish(run, "stuck"); // persistently stuck, even escalated (H3)
|
|
182
|
+
if (!res.madeProgress && !res.stuck)
|
|
183
|
+
return finish(run, "idle"); // surface spent
|
|
184
|
+
prompt = RECON_CONTINUE;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function finish(run, stopped) {
|
|
188
|
+
return { findings: run.findings, rounds: run.rounds, tokens: run.spentTokens, stopped };
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=recon-driver.js.map
|