@namzu/sdk 69.3.0 → 69.4.0
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/CHANGELOG.md +11 -0
- package/dist/authorization/readonly-commands.d.ts.map +1 -1
- package/dist/authorization/readonly-commands.js +30 -2
- package/dist/authorization/readonly-commands.js.map +1 -1
- package/dist/prompt/coding-agent-doctrine.d.ts +1 -1
- package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
- package/dist/prompt/coding-agent-doctrine.js +1 -1
- package/dist/provider/side-request-reasoning.d.ts.map +1 -1
- package/dist/provider/side-request-reasoning.js +5 -1
- package/dist/provider/side-request-reasoning.js.map +1 -1
- package/dist/runtime/query/auto-review/classifier.d.ts.map +1 -1
- package/dist/runtime/query/auto-review/classifier.js +13 -2
- package/dist/runtime/query/auto-review/classifier.js.map +1 -1
- package/dist/runtime/query/auto-review/failure.d.ts +12 -5
- package/dist/runtime/query/auto-review/failure.d.ts.map +1 -1
- package/dist/runtime/query/auto-review/failure.js +42 -7
- package/dist/runtime/query/auto-review/failure.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +22 -6
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/runtime/query/turn/check-scope.d.ts +18 -0
- package/dist/runtime/query/turn/check-scope.d.ts.map +1 -0
- package/dist/runtime/query/turn/check-scope.js +90 -0
- package/dist/runtime/query/turn/check-scope.js.map +1 -0
- package/dist/runtime/query/turn/outcome-ledger.d.ts.map +1 -1
- package/dist/runtime/query/turn/outcome-ledger.js +13 -0
- package/dist/runtime/query/turn/outcome-ledger.js.map +1 -1
- package/dist/tools/builtins/job.d.ts.map +1 -1
- package/dist/tools/builtins/job.js +4 -1
- package/dist/tools/builtins/job.js.map +1 -1
- package/dist/tools/builtins/wait-for-job.d.ts.map +1 -1
- package/dist/tools/builtins/wait-for-job.js +2 -1
- package/dist/tools/builtins/wait-for-job.js.map +1 -1
- package/package.json +1 -1
- package/src/authorization/readonly-commands.ts +30 -2
- package/src/prompt/coding-agent-doctrine.ts +1 -1
- package/src/provider/side-request-reasoning.ts +5 -1
- package/src/runtime/query/auto-review/classifier.ts +14 -2
- package/src/runtime/query/auto-review/failure.ts +52 -7
- package/src/runtime/query/review-policy.ts +30 -6
- package/src/runtime/query/turn/check-scope.ts +90 -0
- package/src/runtime/query/turn/outcome-ledger.ts +11 -0
- package/src/tools/builtins/job.ts +4 -1
- package/src/tools/builtins/wait-for-job.ts +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wait-for-job.js","sourceRoot":"","sources":["../../../src/tools/builtins/wait-for-job.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAA;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAEvF;;;;;;;;;;;;GAYG;AAEH,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,2BAA2B,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;AACzF,MAAM,uBAAuB,GAAG,kBAAkB,CAAC,wBAAwB,EAAE,mBAAmB,CAAC,CAAA;AAEjG;;;;;;;;;GASG;AACH,MAAM,WAAW,GAAG,kBAAkB,CAAC,uBAAuB,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;AAE/E,MAAM,WAAW,GAAG,CAAC;KACnB,MAAM,CAAC;IACP,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yDAAyD,CAAC;IAClF,eAAe,EAAE,CA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AC9C,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACzE,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;aAChE;YACD,wEAAwE;YACxE,qEAAqE;YACrE,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;gBAChE,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,SAAkB,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACxF,CAAA;IACF,CAAC;CACD,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@namzu/sdk",
|
|
3
|
-
"version": "69.
|
|
3
|
+
"version": "69.4.0",
|
|
4
4
|
"description": "Open-source AI kernel for TypeScript: runs an agent the way an operating system runs a process, with an identity and a budget, scheduled tool calls and checkpointed turns.",
|
|
5
5
|
"license": "FSL-1.1-MIT",
|
|
6
6
|
"engines": {
|
|
@@ -299,7 +299,9 @@ function looksLikeNetworkPath(value: string): boolean {
|
|
|
299
299
|
function isDynamic(word: ShellWord): boolean {
|
|
300
300
|
// `expands` is false for a single-quoted `$`, which is only text.
|
|
301
301
|
if (word.substitutes || (word.expands && /[$`]/.test(word.value))) return true
|
|
302
|
-
|
|
302
|
+
// A brace list inside quotes is text: `echo '{a,b}'`.
|
|
303
|
+
if (/\{[^{}]*(?:,|\.\.)[^{}]*\}/.test(word.text.replace(/'[^']*'|"(?:\\.|[^"\\])*"/g, '')))
|
|
304
|
+
return true
|
|
303
305
|
// `~user` expands to another account's home; `~` and `~/x` are this one's.
|
|
304
306
|
return /^~(?!\/|$)/.test(word.text)
|
|
305
307
|
}
|
|
@@ -319,6 +321,18 @@ function valueFits(value: string, kind: 'none' | 'string' | 'number'): boolean {
|
|
|
319
321
|
return kind === 'string'
|
|
320
322
|
}
|
|
321
323
|
|
|
324
|
+
/**
|
|
325
|
+
* A path that reads a process's environment (`/proc/<pid>/environ`, or a
|
|
326
|
+
* glob under `/proc` that can reach it). `env` and `printenv` are not
|
|
327
|
+
* read-only here, so neither is reading the same bytes through a file.
|
|
328
|
+
*/
|
|
329
|
+
function namesProcessEnvironment(word: ShellWord | string): boolean {
|
|
330
|
+
const value = typeof word === 'string' ? word : word.value
|
|
331
|
+
if (/(?:^|\/)environ$/.test(value)) return true
|
|
332
|
+
const text = typeof word === 'string' ? word : word.text
|
|
333
|
+
return /(?:^|\/)proc\//.test(value) && hasUnquotedGlob(text)
|
|
334
|
+
}
|
|
335
|
+
|
|
322
336
|
/** A flag's value that is dynamic or names a network path. */
|
|
323
337
|
function dangerousValue(value: string): boolean {
|
|
324
338
|
return /[$`]/.test(value) || looksLikeNetworkPath(value)
|
|
@@ -651,7 +665,19 @@ function dockerIsReadOnly(args: readonly string[]): boolean {
|
|
|
651
665
|
}
|
|
652
666
|
|
|
653
667
|
/** Whether one simple command, as its argument vector, is on the list. */
|
|
654
|
-
|
|
668
|
+
/** Options that go before a git subcommand and change nothing about what it reads. */
|
|
669
|
+
const GIT_NEUTRAL_GLOBALS: ReadonlySet<string> = new Set(['--no-optional-locks', '--no-pager'])
|
|
670
|
+
|
|
671
|
+
function commandIsReadOnly(vector: readonly string[], text: string): boolean {
|
|
672
|
+
// `git --no-optional-locks status`: the option keeps git from taking the
|
|
673
|
+
// index lock for an opportunistic refresh, so it only makes a read gentler.
|
|
674
|
+
let argv = vector
|
|
675
|
+
if (argv[0] === 'git' && argv[1] !== undefined && GIT_NEUTRAL_GLOBALS.has(argv[1])) {
|
|
676
|
+
argv = ['git', ...argv.slice(2)]
|
|
677
|
+
while (argv[1] !== undefined && GIT_NEUTRAL_GLOBALS.has(argv[1])) {
|
|
678
|
+
argv = ['git', ...argv.slice(2)]
|
|
679
|
+
}
|
|
680
|
+
}
|
|
655
681
|
const [head, ...rest] = argv
|
|
656
682
|
if (head === undefined) return false
|
|
657
683
|
if (ANY_ARGUMENTS.has(head)) return true
|
|
@@ -741,6 +767,7 @@ function redirectionsAreHarmless(
|
|
|
741
767
|
}
|
|
742
768
|
if (operator === '<') {
|
|
743
769
|
if (looksLikeNetworkPath(value)) return false
|
|
770
|
+
if (namesProcessEnvironment(target)) return false
|
|
744
771
|
if (/^~(?!\/|$)/.test(target.text)) return false
|
|
745
772
|
continue
|
|
746
773
|
}
|
|
@@ -794,6 +821,7 @@ export function isReadOnlyCommandLine(line: string, dialect: ShellDialect = 'bas
|
|
|
794
821
|
const glob = words.some((word) => word.expands && hasUnquotedGlob(word.text))
|
|
795
822
|
if (glob && !GLOB_OK.has(head.value)) return false
|
|
796
823
|
if (words.some((word) => looksLikeNetworkPath(word.value))) return false
|
|
824
|
+
if (words.some(namesProcessEnvironment)) return false
|
|
797
825
|
|
|
798
826
|
const argv = words.map((word) => word.value)
|
|
799
827
|
if (!commandIsReadOnly(argv, command.text)) return false
|
|
@@ -69,7 +69,7 @@ export const CODING_AGENT_WORKING_DOCTRINE = `## How you work
|
|
|
69
69
|
This section applies only when you were asked to change something.
|
|
70
70
|
- Begin editing once you know the first change; the requested scope is the deliverable, at the size asked. Match the surrounding idiom.
|
|
71
71
|
- Prefer the dedicated tools over shell equivalents (\`read\` over \`cat\`, \`grep\` over a shell grep, \`glob\` over \`find\`, \`edit\` over \`sed -i\`, \`write\` over a redirect); use \`bash\` for the rest.
|
|
72
|
-
- For a defect, reproduce it first with a small script or a failing test; a script stays in the scratch folder unless it becomes a test. After the change, rerun it. Run the project's tests and lint or format check, and add tests for behaviour you introduced. Claim only the checks you ran.
|
|
72
|
+
- For a defect, reproduce it first with a small script or a failing test; a script stays in the scratch folder unless it becomes a test. After the change, rerun it. Run the project's tests and lint or format check, and add tests for behaviour you introduced. Claim only the checks you ran; name what you skipped, and call a partial count partial.
|
|
73
73
|
- Say where any throwaway file you made is, and which files outside the request you touched.
|
|
74
74
|
|
|
75
75
|
### Working with git
|
|
@@ -71,9 +71,13 @@ function refusesReasoningControls(error: unknown): boolean {
|
|
|
71
71
|
// request nor switch the controls off for the model.
|
|
72
72
|
if (/rate.?limit|too many requests|overloaded|timed? ?out|\b(429|5\d\d)\b/i.test(text))
|
|
73
73
|
return false
|
|
74
|
+
// A driver that checks the request itself before sending it (the Codex
|
|
75
|
+
// subscription driver refuses `thinking: disabled` beside any effort but
|
|
76
|
+
// `none`) refuses with a plain error that says "requires" or "would not
|
|
77
|
+
// prove"; it is a refusal of the controls all the same.
|
|
74
78
|
const names = /\b(thinking|reasoning|effort)\b/i.test(text)
|
|
75
79
|
const rejects =
|
|
76
|
-
/unsupported|not supported|unsupport|invalid|unknown|unrecogni[sz]ed|unexpected|not allowed|not permitted|does not (?:accept|support|allow)|not accept|extra inputs|bad request|\b400\b|\b422\b/i.test(
|
|
80
|
+
/unsupported|not supported|unsupport|invalid|unknown|unrecogni[sz]ed|unexpected|not allowed|not permitted|does not (?:accept|support|allow)|not accept|extra inputs|bad request|\b400\b|\b422\b|\brequires\b|would not prove/i.test(
|
|
77
81
|
text,
|
|
78
82
|
)
|
|
79
83
|
return names && rejects
|
|
@@ -198,6 +198,12 @@ export {
|
|
|
198
198
|
autoReviewUnavailableFeedback,
|
|
199
199
|
} from './feedback.js'
|
|
200
200
|
|
|
201
|
+
/** The HTTP status the failure carried, as the one log attribute it is kept under. */
|
|
202
|
+
function statusOf(error: unknown): { 'namzu.auto_review.error_status'?: number } {
|
|
203
|
+
const status = classifyProviderError(error).status
|
|
204
|
+
return status !== undefined ? { 'namzu.auto_review.error_status': status } : {}
|
|
205
|
+
}
|
|
206
|
+
|
|
201
207
|
class DeadlineError extends Error {
|
|
202
208
|
readonly retryable = true
|
|
203
209
|
constructor() {
|
|
@@ -430,11 +436,14 @@ export function createAutoReviewClassifier(
|
|
|
430
436
|
if (request.signal?.aborted) {
|
|
431
437
|
return blocked(started, 0, 'aborted', 'the review was cancelled before it finished')
|
|
432
438
|
}
|
|
433
|
-
const why = describeCheckFailure(error, options.quickDeadlineMs ?? 60_000)
|
|
439
|
+
const why = describeCheckFailure(error, options.quickDeadlineMs ?? 60_000, options.model)
|
|
434
440
|
log.warn('auto review could not complete', {
|
|
435
441
|
'namzu.auto_review.stage': 1,
|
|
436
442
|
'namzu.auto_review.failure': why,
|
|
443
|
+
'namzu.auto_review.model': options.model,
|
|
437
444
|
'namzu.auto_review.error': error instanceof Error ? error.message : String(error),
|
|
445
|
+
'namzu.auto_review.error_code': classifyProviderError(error).code,
|
|
446
|
+
...statusOf(error),
|
|
438
447
|
})
|
|
439
448
|
return blocked(
|
|
440
449
|
started,
|
|
@@ -457,11 +466,14 @@ export function createAutoReviewClassifier(
|
|
|
457
466
|
if (request.signal?.aborted) {
|
|
458
467
|
return blocked(started, 1, 'aborted', 'the review was cancelled before it finished')
|
|
459
468
|
}
|
|
460
|
-
const why = describeCheckFailure(error, options.reasonedDeadlineMs ?? 120_000)
|
|
469
|
+
const why = describeCheckFailure(error, options.reasonedDeadlineMs ?? 120_000, options.model)
|
|
461
470
|
log.warn('auto review could not complete', {
|
|
462
471
|
'namzu.auto_review.stage': 2,
|
|
463
472
|
'namzu.auto_review.failure': why,
|
|
473
|
+
'namzu.auto_review.model': options.model,
|
|
464
474
|
'namzu.auto_review.error': error instanceof Error ? error.message : String(error),
|
|
475
|
+
'namzu.auto_review.error_code': classifyProviderError(error).code,
|
|
476
|
+
...statusOf(error),
|
|
465
477
|
})
|
|
466
478
|
return blocked(
|
|
467
479
|
started,
|
|
@@ -1,16 +1,57 @@
|
|
|
1
|
+
import { LOG_SECRET_PATTERNS } from '../../../constants/secret-patterns.js'
|
|
1
2
|
import { classifyProviderError } from '../../../types/provider/errors.js'
|
|
2
3
|
|
|
4
|
+
/** The most characters of the provider's own wording that are shown. */
|
|
5
|
+
const DETAIL_CHARS = 140
|
|
6
|
+
|
|
7
|
+
/** A query-parameter or field name that says its value is a credential. */
|
|
8
|
+
const SENSITIVE_NAME = String.raw`[A-Za-z0-9_.-]*(?:key|token|secret|passw(?:or)?d|pwd|sig|signature|auth|credential|cookie|session)[A-Za-z0-9_.-]*`
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Credential shapes that carry no vendor prefix: URL userinfo, a query
|
|
12
|
+
* parameter or `name: value` / `name=value` pair whose name says secret, and
|
|
13
|
+
* an `x-api-key` style header.
|
|
14
|
+
*/
|
|
15
|
+
function scrubCredentialShapes(input: string): string {
|
|
16
|
+
return input
|
|
17
|
+
.replace(/(\/\/)[^/@\s]+@/g, '$1[REDACTED:userinfo]@')
|
|
18
|
+
.replace(
|
|
19
|
+
new RegExp(
|
|
20
|
+
String.raw`(\b${SENSITIVE_NAME}\b)(\s*[:=]\s*)(?:"[^"]*"|'[^']*'|[^\s&;,"']+)`,
|
|
21
|
+
'gi',
|
|
22
|
+
),
|
|
23
|
+
'$1$2[REDACTED:secret]',
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The provider's own wording, fit to show: one line, anything shaped like a
|
|
29
|
+
* credential replaced, and cut short. A refusal that says only "provider
|
|
30
|
+
* error" hides the one fact that tells a person what to change.
|
|
31
|
+
*/
|
|
32
|
+
export function checkFailureDetail(error: unknown): string {
|
|
33
|
+
let text = error instanceof Error ? error.message : String(error)
|
|
34
|
+
for (const [label, pattern] of LOG_SECRET_PATTERNS) {
|
|
35
|
+
pattern.lastIndex = 0
|
|
36
|
+
text = text.replace(pattern, `[REDACTED:${label}]`)
|
|
37
|
+
}
|
|
38
|
+
text = scrubCredentialShapes(text)
|
|
39
|
+
text = text.replace(/\s+/g, ' ').trim()
|
|
40
|
+
return text.length > DETAIL_CHARS ? `${text.slice(0, DETAIL_CHARS - 1)}…` : text
|
|
41
|
+
}
|
|
42
|
+
|
|
3
43
|
/**
|
|
4
44
|
* The class of a failure to complete the safety check, in a few plain words:
|
|
5
|
-
* `no credential for the check model`, `
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* to
|
|
45
|
+
* `no credential for the check model`, `timed out after 60 s`, or, when the
|
|
46
|
+
* class alone says nothing, the status, the model and a short, scrubbed piece
|
|
47
|
+
* of the provider's own wording: `provider returned 400 (gpt-6.2-sol): ...`.
|
|
48
|
+
* The text is cut to one short line with anything shaped like a credential
|
|
49
|
+
* replaced; the whole of it goes to the log.
|
|
9
50
|
*
|
|
10
51
|
* `deadlineMs` is the deadline the pass ran under, when the failure was the
|
|
11
52
|
* deadline expiring.
|
|
12
53
|
*/
|
|
13
|
-
export function describeCheckFailure(error: unknown, deadlineMs?: number): string {
|
|
54
|
+
export function describeCheckFailure(error: unknown, deadlineMs?: number, model?: string): string {
|
|
14
55
|
if (error instanceof Error && error.name === 'DeadlineError') {
|
|
15
56
|
return deadlineMs !== undefined
|
|
16
57
|
? `timed out after ${Math.round(deadlineMs / 1000)} s`
|
|
@@ -44,7 +85,11 @@ export function describeCheckFailure(error: unknown, deadlineMs?: number): strin
|
|
|
44
85
|
return 'could not reach the provider'
|
|
45
86
|
case 'not_found':
|
|
46
87
|
return 'the check model was not found'
|
|
47
|
-
default:
|
|
48
|
-
|
|
88
|
+
default: {
|
|
89
|
+
const head = status !== undefined ? `provider returned ${status}` : 'provider error'
|
|
90
|
+
const where = model !== undefined && model !== '' ? ` (${model})` : ''
|
|
91
|
+
const detail = checkFailureDetail(error)
|
|
92
|
+
return detail === '' ? `${head}${where}` : `${head}${where}: ${detail}`
|
|
93
|
+
}
|
|
49
94
|
}
|
|
50
95
|
}
|
|
@@ -1219,12 +1219,15 @@ export function createReviewHandler(options: ReviewPolicyOptions = {}): ResumeHa
|
|
|
1219
1219
|
// below shows the whole batch, so its yes also answers any question
|
|
1220
1220
|
// the rest of this function would ask; nobody is asked twice.
|
|
1221
1221
|
let answered: ToolReviewAnswer | undefined
|
|
1222
|
-
const ask = async (
|
|
1222
|
+
const ask = async (
|
|
1223
|
+
screenConsent?: true,
|
|
1224
|
+
shown?: readonly ToolCallSummary[],
|
|
1225
|
+
): Promise<ToolReviewAnswer> =>
|
|
1223
1226
|
answered ??
|
|
1224
1227
|
(prompt as ToolReviewPrompt)({
|
|
1225
1228
|
sessionId: request.sessionId,
|
|
1226
1229
|
turnId: request.turnId,
|
|
1227
|
-
toolCalls: request.toolCalls,
|
|
1230
|
+
toolCalls: shown ?? request.toolCalls,
|
|
1228
1231
|
...(screenConsent ? { screenConsent } : {}),
|
|
1229
1232
|
...(request.perCall ? { perCall: true as const } : {}),
|
|
1230
1233
|
...(request.perCall && context?.signal ? { signal: context.signal } : {}),
|
|
@@ -1330,8 +1333,11 @@ export function createReviewHandler(options: ReviewPolicyOptions = {}): ResumeHa
|
|
|
1330
1333
|
if (isPermissive(mode)) {
|
|
1331
1334
|
// A person's answer on the whole batch, as a decision. An escape is
|
|
1332
1335
|
// confirmed by id only here, only for a person's yes.
|
|
1333
|
-
const askPerson = async (
|
|
1334
|
-
|
|
1336
|
+
const askPerson = async (
|
|
1337
|
+
escapes: readonly string[],
|
|
1338
|
+
shown?: readonly ToolCallSummary[],
|
|
1339
|
+
): Promise<HITLResumeDecision> => {
|
|
1340
|
+
const answer = await ask(undefined, shown)
|
|
1335
1341
|
if (answer.kind === 'reject') {
|
|
1336
1342
|
return {
|
|
1337
1343
|
action: 'reject_tools',
|
|
@@ -1351,6 +1357,24 @@ export function createReviewHandler(options: ReviewPolicyOptions = {}): ResumeHa
|
|
|
1351
1357
|
if (mode === 'classify' && !classified) {
|
|
1352
1358
|
const classifier = options.classifier as AutoReviewClassifier
|
|
1353
1359
|
const transcript = context?.transcript() ?? []
|
|
1360
|
+
// When the check cannot give a verdict and a person is asked, the
|
|
1361
|
+
// question is about the calls nothing else settled. A read the static
|
|
1362
|
+
// rules already allow runs without a prompt; it is not put to the
|
|
1363
|
+
// person beside the call that is, so one outage does not turn every
|
|
1364
|
+
// glob and grep of a batch into something to approve.
|
|
1365
|
+
const unsettled = async (): Promise<readonly ToolCallSummary[]> => {
|
|
1366
|
+
const kept: ToolCallSummary[] = []
|
|
1367
|
+
for (const call of request.toolCalls) {
|
|
1368
|
+
if (
|
|
1369
|
+
call.authorization?.decision === 'deny' ||
|
|
1370
|
+
isBypassImmune(call) ||
|
|
1371
|
+
!(await neverSent(call, request.sessionId))
|
|
1372
|
+
) {
|
|
1373
|
+
kept.push(call)
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
return kept
|
|
1377
|
+
}
|
|
1354
1378
|
for (const tc of live) {
|
|
1355
1379
|
// The questions a person must answer are asked of a person, never of a model.
|
|
1356
1380
|
if (isBypassImmune(tc) || (await neverSent(tc, request.sessionId))) continue
|
|
@@ -1382,7 +1406,7 @@ export function createReviewHandler(options: ReviewPolicyOptions = {}): ResumeHa
|
|
|
1382
1406
|
reason: 'auto mode stopped: the conversation is too long for the safety check',
|
|
1383
1407
|
}
|
|
1384
1408
|
}
|
|
1385
|
-
return askPerson(escapes)
|
|
1409
|
+
return askPerson(escapes, await unsettled())
|
|
1386
1410
|
}
|
|
1387
1411
|
transcriptTooLong = false
|
|
1388
1412
|
// A check that could not be completed says nothing about the call,
|
|
@@ -1393,7 +1417,7 @@ export function createReviewHandler(options: ReviewPolicyOptions = {}): ResumeHa
|
|
|
1393
1417
|
if (decision.cause === 'unavailable' || decision.cause === 'unreadable') {
|
|
1394
1418
|
if (prompt) {
|
|
1395
1419
|
options.onClassifierFellBack?.({ reason: decision.reason })
|
|
1396
|
-
return askPerson(escapes)
|
|
1420
|
+
return askPerson(escapes, await unsettled())
|
|
1397
1421
|
}
|
|
1398
1422
|
}
|
|
1399
1423
|
// With nobody to ask, a check that keeps giving no verdict ends the
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a later run of a check says what an earlier failed run of it would
|
|
3
|
+
* have said, had it passed.
|
|
4
|
+
*
|
|
5
|
+
* The outcome record keys a check by its command line, so the same suite run
|
|
6
|
+
* once for a single file and later for its whole folder, or once with a
|
|
7
|
+
* reporter flag and once with an environment variable, reads as two commands
|
|
8
|
+
* and the first failure would stand for the rest of the turn beside a final
|
|
9
|
+
* state that passes. A pass of a run that includes everything the failed run
|
|
10
|
+
* ran, with nothing narrowing it, settles the failure. Anything the reading
|
|
11
|
+
* cannot place (a different program, a different option, a path outside the
|
|
12
|
+
* later run's paths, a filter the later run adds) leaves the failure standing. A
|
|
13
|
+
* run under a different program prefix (a root-level `pnpm exec biome check` against an
|
|
14
|
+
* in-package `biome check`) is not matched and also leaves it standing.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** Words of a command line; a quoted run is one word. */
|
|
18
|
+
function words(line: string): string[] {
|
|
19
|
+
const out: string[] = []
|
|
20
|
+
for (const match of line.matchAll(/'[^']*'|"[^"]*"|\S+/gu)) out.push(match[0])
|
|
21
|
+
return out
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Flags that narrow what a test run runs, with a value in the next word. */
|
|
25
|
+
const FILTER_WITH_VALUE = new Set(['-t', '--testNamePattern', '-k', '--grep', '-g'])
|
|
26
|
+
|
|
27
|
+
/** A file or folder; `@scope/package` names a workspace package, not a path. */
|
|
28
|
+
const looksLikePath = (word: string): boolean =>
|
|
29
|
+
!word.startsWith('-') &&
|
|
30
|
+
!word.startsWith('@') &&
|
|
31
|
+
(word.includes('/') || /\.[cm]?[jt]sx?$/u.test(word))
|
|
32
|
+
|
|
33
|
+
interface Scope {
|
|
34
|
+
readonly program: string
|
|
35
|
+
readonly options: readonly string[]
|
|
36
|
+
readonly paths: readonly string[]
|
|
37
|
+
readonly filtered: boolean
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function scopeOf(command: string): Scope | undefined {
|
|
41
|
+
const all = words(command)
|
|
42
|
+
while (all.length > 0 && /^[A-Za-z_]\w*=/u.test(all[0] as string)) all.shift()
|
|
43
|
+
const program: string[] = []
|
|
44
|
+
const options: string[] = []
|
|
45
|
+
const paths: string[] = []
|
|
46
|
+
let filtered = false
|
|
47
|
+
let seenPath = false
|
|
48
|
+
for (let at = 0; at < all.length; at++) {
|
|
49
|
+
const word = all[at] as string
|
|
50
|
+
if (word === '--') continue
|
|
51
|
+
if (FILTER_WITH_VALUE.has(word)) {
|
|
52
|
+
filtered = true
|
|
53
|
+
at++
|
|
54
|
+
continue
|
|
55
|
+
}
|
|
56
|
+
if (/^--(?:testNamePattern|grep)=/u.test(word)) {
|
|
57
|
+
filtered = true
|
|
58
|
+
continue
|
|
59
|
+
}
|
|
60
|
+
if (word.startsWith('--reporter')) {
|
|
61
|
+
// `--reporter=dot` and `--reporter dot` change how the answer is drawn, not what runs.
|
|
62
|
+
if (!word.includes('=')) at++
|
|
63
|
+
continue
|
|
64
|
+
}
|
|
65
|
+
if (looksLikePath(word)) {
|
|
66
|
+
seenPath = true
|
|
67
|
+
paths.push(word.replace(/\/+$/u, ''))
|
|
68
|
+
} else if (word.startsWith('-') && program.length > 0) options.push(word)
|
|
69
|
+
else if (!seenPath) program.push(word)
|
|
70
|
+
else return undefined
|
|
71
|
+
}
|
|
72
|
+
if (program.length === 0) return undefined
|
|
73
|
+
return { program: program.join(' '), options: options.sort(), paths, filtered }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** True when a passing `later` run covers everything a failed `earlier` run ran. */
|
|
77
|
+
export function laterRunCovers(later: string, earlier: string): boolean {
|
|
78
|
+
const after = scopeOf(later)
|
|
79
|
+
const before = scopeOf(earlier)
|
|
80
|
+
if (after === undefined || before === undefined) return false
|
|
81
|
+
if (after.filtered || after.program !== before.program) return false
|
|
82
|
+
if (before.options.some((option) => !after.options.includes(option))) return false
|
|
83
|
+
// A run with no path names the whole of what its program checks, so it covers any
|
|
84
|
+
// earlier run of that program; an earlier path-less run is covered only by another.
|
|
85
|
+
if (after.paths.length === 0) return true
|
|
86
|
+
if (before.paths.length === 0) return false
|
|
87
|
+
return before.paths.every((path) =>
|
|
88
|
+
after.paths.some((held) => path === held || path.startsWith(`${held}/`)),
|
|
89
|
+
)
|
|
90
|
+
}
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
type TurnOutcomeVerdict,
|
|
27
27
|
} from '../../../types/session/outcome.js'
|
|
28
28
|
import type { ToolFacts } from '../../../types/tool/index.js'
|
|
29
|
+
import { laterRunCovers } from './check-scope.js'
|
|
29
30
|
import { WRITING_TOOLS, isVerificationCommand } from './completion-audit.js'
|
|
30
31
|
|
|
31
32
|
/** A finished tool call as the ledger sees it. */
|
|
@@ -611,6 +612,13 @@ export class OutcomeLedger {
|
|
|
611
612
|
// Latest run of each distinct command, ordered by when it last ran.
|
|
612
613
|
this.checks.delete(key)
|
|
613
614
|
this.checks.set(key, state)
|
|
615
|
+
// A pass of a run that includes what an earlier failed run ran settles that
|
|
616
|
+
// failure: the line must not name it beside a final state that passes.
|
|
617
|
+
if (state.result === 'passed') {
|
|
618
|
+
for (const [held, check] of this.checks) {
|
|
619
|
+
if (check.result === 'failed' && laterRunCovers(key, held)) this.checks.delete(held)
|
|
620
|
+
}
|
|
621
|
+
}
|
|
614
622
|
if (this.checks.size > MAX_REMEMBERED_CHECKS) {
|
|
615
623
|
// A failing check is never the one forgotten.
|
|
616
624
|
for (const [candidate, held] of this.checks) {
|
|
@@ -639,6 +647,9 @@ export class OutcomeLedger {
|
|
|
639
647
|
if (facts.background === true || facts.continued === true || facts.timedOut === true) {
|
|
640
648
|
return { result: 'unsettled', ...withCode }
|
|
641
649
|
}
|
|
650
|
+
// Stopped by a signal (a job the operator or the model killed): it was cut
|
|
651
|
+
// short, not found wanting, so it neither passes nor fails.
|
|
652
|
+
if (facts.signal !== undefined && exitCode === undefined) return { result: 'unsettled' }
|
|
642
653
|
if (exitCode === undefined) {
|
|
643
654
|
return { result: call.isError === true ? 'failed' : 'unsettled' }
|
|
644
655
|
}
|
|
@@ -63,7 +63,10 @@ export const JobTool = defineTool({
|
|
|
63
63
|
const label =
|
|
64
64
|
input.action === 'list'
|
|
65
65
|
? 'List background jobs'
|
|
66
|
-
:
|
|
66
|
+
: // No id in the row: it is the model's handle on the job, not something the person reads.
|
|
67
|
+
input.action === 'kill'
|
|
68
|
+
? 'Stop background job'
|
|
69
|
+
: 'Read background output'
|
|
67
70
|
return { kind: 'generic', presentation: 'activity', label }
|
|
68
71
|
},
|
|
69
72
|
|
|
@@ -119,7 +119,9 @@ export const WaitForJobTool = defineTool({
|
|
|
119
119
|
return {
|
|
120
120
|
kind: 'generic',
|
|
121
121
|
presentation: 'activity',
|
|
122
|
-
|
|
122
|
+
// No id in the row: it is the model's handle on the job, not something the person reads.
|
|
123
|
+
label:
|
|
124
|
+
input.output_contains === undefined ? 'Wait for background job' : 'Wait for job output',
|
|
123
125
|
}
|
|
124
126
|
},
|
|
125
127
|
|