neurastream 0.2.13 → 0.2.14
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/README.md +14 -0
- package/package.json +1 -1
- package/src/adapters/omp/index.ts +122 -4
- package/src/adapters/omp/install.ts +14 -7
- package/src/adapters/omp/traces.ts +27 -0
- package/src/cli/dispatch.ts +5 -0
- package/src/cli/traces.ts +64 -22
- package/src/core/agent-score.ts +7 -0
- package/src/core/config.ts +36 -0
- package/src/core/guards.ts +6 -5
- package/src/core/incident-detectors.ts +59 -5
- package/src/core/incidents.ts +2 -2
- package/src/core/rate-limit.ts +63 -0
- package/src/core/trace-actions.ts +487 -0
- package/src/core/trace-claims.ts +35 -8
- package/templates/config.yml +29 -0
package/src/core/trace-claims.ts
CHANGED
|
@@ -126,6 +126,18 @@ export interface ClaimVerdict {
|
|
|
126
126
|
how: string;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
/**
|
|
130
|
+
* One related run's trace, passed by the caller (INCIDENT I-20261025-23): a Main run's report
|
|
131
|
+
* cites the results it received from its subagents, and that evidence sits in the subagents' own
|
|
132
|
+
* sessions, not Main's. The adapter owns file discovery — depth-2 session files under Main's
|
|
133
|
+
* session dir — core only checks the texts.
|
|
134
|
+
*/
|
|
135
|
+
export interface RelatedRun {
|
|
136
|
+
/** The subagent run's trace run id — the agent name. */
|
|
137
|
+
name: string;
|
|
138
|
+
events: TraceEvent[];
|
|
139
|
+
}
|
|
140
|
+
|
|
129
141
|
/** Every string an args object carries (commands, paths, labels), joined for substring checks. */
|
|
130
142
|
function argsText(args: Record<string, unknown> | undefined): string {
|
|
131
143
|
const parts: string[] = [];
|
|
@@ -159,8 +171,14 @@ export function claimsFromEvents(events: TraceEvent[]): Claim[] {
|
|
|
159
171
|
* heavy-label — the label, quoted, in a heavy-run call the run actually made;
|
|
160
172
|
* changed-path — carried by an edit/write tool call's arguments, or written by a shell
|
|
161
173
|
* command (a write operator before the path in one command segment).
|
|
174
|
+
*
|
|
175
|
+
* `related` (a Main run's subagent traces) gives the result-line family a second chance: a
|
|
176
|
+
* count or exit claim nothing in the run's own output shows is still backed when a subagent's
|
|
177
|
+
* toolResult shows it (`how: "subagent:<name>"`) — Main's report cites the result it received.
|
|
178
|
+
* The other kinds keep their own-run shape checks (a sha needs its git pairing, a label the
|
|
179
|
+
* heavy-run call, a path the write), so only the pure result-line kinds cross runs.
|
|
162
180
|
*/
|
|
163
|
-
export function verifyClaims(claims: Claim[], events: TraceEvent[]): ClaimVerdict[] {
|
|
181
|
+
export function verifyClaims(claims: Claim[], events: TraceEvent[], related: RelatedRun[] = []): ClaimVerdict[] {
|
|
164
182
|
const results = events.filter((e) => e.kind === "toolResult").map((e) => e.text ?? "");
|
|
165
183
|
const calls = events
|
|
166
184
|
.filter((e) => e.kind === "toolCall")
|
|
@@ -168,20 +186,29 @@ export function verifyClaims(claims: Claim[], events: TraceEvent[]): ClaimVerdic
|
|
|
168
186
|
// The harness writes exactly one toolResult per toolCall, in order, so the i-th result
|
|
169
187
|
// pairs with the i-th call.
|
|
170
188
|
const paired = results.map((text, i) => ({ text, call: calls[i] }));
|
|
189
|
+
// Related-run backing: the same result-line test against every subagent's toolResults.
|
|
190
|
+
const subBacked = (c: Claim, test: (text: string) => boolean): ClaimVerdict | null => {
|
|
191
|
+
for (const r of related) {
|
|
192
|
+
if (r.events.some((e) => e.kind === "toolResult" && typeof e.text === "string" && test(e.text)))
|
|
193
|
+
return { claim: c, backed: true, how: `subagent:${r.name}` };
|
|
194
|
+
}
|
|
195
|
+
return null;
|
|
196
|
+
};
|
|
171
197
|
const verdict = (c: Claim): ClaimVerdict => {
|
|
172
198
|
const unbacked: ClaimVerdict = { claim: c, backed: false, how: "" };
|
|
173
199
|
switch (c.kind) {
|
|
174
200
|
case "tests-passed":
|
|
175
201
|
case "tests-failed": {
|
|
176
202
|
const word = c.kind === "tests-passed" ? "pass" : "fail";
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
return unbacked;
|
|
203
|
+
const re = new RegExp(`\\b${c.count}\\s+${word}(?:ed)?\\b`, "i");
|
|
204
|
+
if (results.some((t) => re.test(t))) return { claim: c, backed: true, how: "count in a toolResult" };
|
|
205
|
+
return subBacked(c, (t) => re.test(t)) ?? unbacked;
|
|
206
|
+
}
|
|
207
|
+
case "exit": {
|
|
208
|
+
const re = new RegExp(`\\bexit(?:\\s+code)?\\s*[:=]?\\s*${c.count}\\b`, "i");
|
|
209
|
+
if (results.some((t) => re.test(t))) return { claim: c, backed: true, how: "exit line in a toolResult" };
|
|
210
|
+
return subBacked(c, (t) => re.test(t)) ?? unbacked;
|
|
180
211
|
}
|
|
181
|
-
case "exit":
|
|
182
|
-
if (results.some((t) => new RegExp(`\\bexit(?:\\s+code)?\\s*[:=]?\\s*${c.count}\\b`, "i").test(t)))
|
|
183
|
-
return { claim: c, backed: true, how: "exit line in a toolResult" };
|
|
184
|
-
return unbacked;
|
|
185
212
|
case "sha":
|
|
186
213
|
if (paired.some((p) => p.call !== undefined && /\bgit\b/.test(p.call.args) && p.text.includes(c.value ?? "\u0000")))
|
|
187
214
|
return { claim: c, backed: true, how: "in a git command's output" };
|
package/templates/config.yml
CHANGED
|
@@ -28,6 +28,7 @@ score:
|
|
|
28
28
|
false-claim: 5
|
|
29
29
|
rule-break: 2
|
|
30
30
|
escaped-defect: 8
|
|
31
|
+
unreported-finding: 5
|
|
31
32
|
diagnose_weight: 4
|
|
32
33
|
gate_days: 7
|
|
33
34
|
board_days: 7
|
|
@@ -107,6 +108,11 @@ guards:
|
|
|
107
108
|
chat_unlock: false # the owner's whole chat message "unlock"/"unlock N"/"lock" moves the guard unlock file
|
|
108
109
|
plan_read_max_hours: 24
|
|
109
110
|
idle_stops: 3
|
|
111
|
+
rate_limit:
|
|
112
|
+
patterns: ["429", "rate_limit", "rate limit", "overloaded", "529"] # error-text substrings (case-insensitive) that mark a provider rate limit
|
|
113
|
+
default_wait_s: 300 # wait when the error text names no retry-after
|
|
114
|
+
max_wait_s: 3600 # cap for the parsed (or doubled) wait, before slack
|
|
115
|
+
slack_s: 15 # added on top of every wait
|
|
110
116
|
blocker_timeout_ms: 10000
|
|
111
117
|
skip_tools: [todo, wait, ask, web_search, job, cancel_job]
|
|
112
118
|
read_tools: [read, grep, glob, find]
|
|
@@ -190,3 +196,26 @@ snapshot:
|
|
|
190
196
|
- ".font-unix"
|
|
191
197
|
- "snap-private-tmp"
|
|
192
198
|
- "*.sock"
|
|
199
|
+
|
|
200
|
+
traces:
|
|
201
|
+
allowed_hosts: # hosts a network command may touch without a finding
|
|
202
|
+
- localhost
|
|
203
|
+
- 127.0.0.1
|
|
204
|
+
- "::1"
|
|
205
|
+
owned_repos: [] # product names another product's run may not read quietly; the intended list lives in docs/config.md
|
|
206
|
+
actions:
|
|
207
|
+
secret_globs: # a read matching any glob is a high finding; evidence is masked either way
|
|
208
|
+
- "~/.ssh/**"
|
|
209
|
+
- "**/*.env*"
|
|
210
|
+
- "**/*keys*.txt"
|
|
211
|
+
- "**/mcp.json"
|
|
212
|
+
- "**/keyring*/**"
|
|
213
|
+
- "**/.gnupg/**"
|
|
214
|
+
- "**/.password-store/**"
|
|
215
|
+
net_tools: [curl, wget, nc, ssh, scp] # commands that reach a host (word match inside shell tools)
|
|
216
|
+
shell_patterns: ['| sh', '| bash', 'eval "$('] # a command containing one feeds a shell from a pipe
|
|
217
|
+
write_roots: [] # prefixes a run may write (plan Worktree: roots); empty falls back to paths.work_roots; both empty = the scope check is off
|
|
218
|
+
deny_globs: # writes matching any glob are flagged wherever they land
|
|
219
|
+
- "~/.omp/**"
|
|
220
|
+
- "~/.local/bin/**"
|
|
221
|
+
- "~/.local/state/**"
|