@piagent/platform 1.48.4 → 1.49.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.
Files changed (81) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/docs/command-reference-vietnamese.md +2 -2
  3. package/docs/distribution-standard.md +6 -6
  4. package/docs/operator-manual-vietnamese.md +7 -7
  5. package/docs/publishing-for-teams.md +2 -0
  6. package/docs/release-install-policy.md +2 -2
  7. package/docs/team-onboarding.md +2 -2
  8. package/docs-site/architecture.html +1 -1
  9. package/docs-site/assets/search-en.json +1 -1
  10. package/docs-site/assets/search-vi.json +1 -1
  11. package/docs-site/benchmark.html +1 -1
  12. package/docs-site/commands.html +1 -1
  13. package/docs-site/context-engine.html +1 -1
  14. package/docs-site/ecosystem.html +1 -1
  15. package/docs-site/en/architecture.html +1 -1
  16. package/docs-site/en/benchmark.html +1 -1
  17. package/docs-site/en/commands.html +1 -1
  18. package/docs-site/en/context-engine.html +1 -1
  19. package/docs-site/en/ecosystem.html +1 -1
  20. package/docs-site/en/index.html +15 -15
  21. package/docs-site/en/mcp-approval.html +1 -1
  22. package/docs-site/en/mcp-auth.html +1 -1
  23. package/docs-site/en/mcp-servers.html +1 -1
  24. package/docs-site/en/mcp.html +1 -1
  25. package/docs-site/en/permissions.html +1 -1
  26. package/docs-site/en/profiles.html +1 -1
  27. package/docs-site/en/quickstart.html +1 -1
  28. package/docs-site/en/runtime.html +1 -1
  29. package/docs-site/en/scope.html +1 -1
  30. package/docs-site/en/security.html +1 -1
  31. package/docs-site/en/team.html +1 -1
  32. package/docs-site/en/update.html +3 -3
  33. package/docs-site/en/whats-new.html +50 -29
  34. package/docs-site/en/windows.html +1 -1
  35. package/docs-site/en/workflows.html +1 -1
  36. package/docs-site/index.html +15 -15
  37. package/docs-site/mcp-approval.html +1 -1
  38. package/docs-site/mcp-auth.html +1 -1
  39. package/docs-site/mcp-servers.html +1 -1
  40. package/docs-site/mcp.html +1 -1
  41. package/docs-site/permissions.html +1 -1
  42. package/docs-site/profiles.html +1 -1
  43. package/docs-site/quickstart.html +1 -1
  44. package/docs-site/releases.json +57 -0
  45. package/docs-site/runtime.html +1 -1
  46. package/docs-site/scope.html +1 -1
  47. package/docs-site/security.html +1 -1
  48. package/docs-site/team.html +1 -1
  49. package/docs-site/update.html +3 -3
  50. package/docs-site/whats-new.html +50 -29
  51. package/docs-site/windows.html +1 -1
  52. package/docs-site/workflows.html +1 -1
  53. package/evals/private-holdout-v1/public-exposure.v2.json +2 -2
  54. package/package.json +1 -1
  55. package/packages/piagent-core/managed/check-questions.mjs +133 -0
  56. package/packages/piagent-core/managed/command-tools.mjs +2 -0
  57. package/packages/piagent-core/managed/helper-run.mjs +1 -1
  58. package/packages/piagent-core/managed/repository-checks.mjs +80 -0
  59. package/packages/piagent-core/managed/review-snapshot-request.mjs +3 -1
  60. package/packages/piagent-core/managed/runtime-snapshot.mjs +63 -0
  61. package/packages/piagent-core/managed/terminal-boundary.mjs +4 -2
  62. package/packages/piagent-core/managed/tool-boundary.mjs +7 -7
  63. package/packages/piagent-core/managed/ts-diagnostics.mjs +1 -1
  64. package/packages/piagent-core/managed/workflow.mjs +40 -89
  65. package/packages/piagent-core/package.json +1 -1
  66. package/packages/piagent-webui/dist/client/assets/{App-DqN7B1JR.js → App-CU-wndsb.js} +1 -1
  67. package/packages/piagent-webui/dist/client/assets/{GatewayApp-B3--WjSd.js → GatewayApp-MIvgr7kn.js} +6 -6
  68. package/packages/piagent-webui/dist/client/assets/{InspectionApp-BKQiA0Ce.js → InspectionApp-Bfvr2S8S.js} +1 -1
  69. package/packages/piagent-webui/dist/client/assets/{SessionAgentWorkspace-ZAdRbxVA.js → SessionAgentWorkspace-0Xowe-sG.js} +1 -1
  70. package/packages/piagent-webui/dist/client/assets/{SessionInspectorDrawer-B2e4-1FG.js → SessionInspectorDrawer-72Z5908P.js} +2 -2
  71. package/packages/piagent-webui/dist/client/assets/{SettingsNavigation-C3MC0X4P.js → SettingsNavigation-Bu1A7x4F.js} +1 -1
  72. package/packages/piagent-webui/dist/client/assets/{SettingsPage-D4os5vHj.js → SettingsPage-DxGxE0AF.js} +1 -1
  73. package/packages/piagent-webui/dist/client/assets/{TerminalPanel-CVYUiDkn.js → TerminalPanel-BKgx9SjR.js} +1 -1
  74. package/packages/piagent-webui/dist/client/assets/{WorkspaceCodeEditor-E0Zopcke.js → WorkspaceCodeEditor-DFrh3qs2.js} +1 -1
  75. package/packages/piagent-webui/dist/client/assets/{WorkspaceExplorer-DldLoJyf.js → WorkspaceExplorer-D6ufO-eP.js} +3 -3
  76. package/packages/piagent-webui/dist/client/assets/{index-DcrpSyBK.js → index-C3CJv1wM.js} +2 -2
  77. package/packages/piagent-webui/dist/client/index.html +1 -1
  78. package/packages/piagent-webui/server/transcript-projection.ts +2 -1
  79. package/packages/piagent-webui/shared/process-copy.ts +3 -2
  80. package/schemas/piagent-webui/transcript-v1.schema.json +1 -0
  81. package/scripts/runtime-advisory-exceptions.json +8 -0
@@ -1,10 +1,10 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
1
  import { reviewUnavailableReason } from './patch-snapshot.mjs';
4
2
  import { failureCode, unnamedFailureText } from '../runtime/managed-failure.mjs';
5
3
  import { TsDiagnostics } from './ts-diagnostics.mjs';
6
4
  import { checkpointsOf } from './checkpoints.mjs';
7
- import { discoverDeliveryContext } from './delivery-context.mjs';
5
+ import { declaredChecks, detectedChecks, repositoryChecks, isCheckCommand, isReadOnlyCommand, nonCodePath, onlyNonCode } from './repository-checks.mjs';
6
+ export { declaredChecks, detectedChecks, repositoryChecks, isCheckCommand, isReadOnlyCommand, nonCodePath, onlyNonCode };
7
+ import { askCheckScope, asksFullChecks, beforeCheckOrPush, checkScope } from './check-questions.mjs';
8
8
  import { LANE_LIMITS, patchStats, changeLane, lanePolicy } from './risk-lanes.mjs';
9
9
  import { briefCounts, decisionsText, ledgerGuard, ledgerOf, ledgerWords, reviewFocus, saveLedger, setStatus, settleLedger } from './ledger.mjs';
10
10
 
@@ -22,83 +22,6 @@ export function workflowPolicy(manifest) {
22
22
  return { plan: mode(w.plan), verify: mode(w.verify), review: config.review ? mode(w.review) : 'off', maxFixLoops: loops, lanes: w.lanes !== false };
23
23
  }
24
24
 
25
- // Checks come from the repository: a "## Checks" section in AGENTS.md (code
26
- // block lines or `command` bullets), else what its manifests imply.
27
- const HEADING = /^#{1,6}\s+(checks?|verification|kiểm tra)\s*$/i;
28
- export function declaredChecks(agentsFiles = []) {
29
- const out = [];
30
- for (const file of agentsFiles) {
31
- let inside = false, fence = false;
32
- for (const line of String(file.content ?? '').split('\n')) {
33
- if (!fence && /^#{1,6}\s/.test(line)) { inside = HEADING.test(line.trim()); continue; }
34
- if (!inside) continue;
35
- if (/^\s*(```|~~~)/.test(line)) { fence = !fence; continue; }
36
- const command = (fence ? line : line.match(/^\s*[-*]\s+`([^`]+)`/)?.[1] ?? '').trim();
37
- if (command && !command.startsWith('#') && command.length <= 200 && !out.includes(command) && out.length < 10) out.push(command);
38
- }
39
- }
40
- return out;
41
- }
42
- export function detectedChecks(dir) {
43
- const has = name => { try { const s = fs.lstatSync(path.join(dir, name)); return s.isFile() && s.size <= 1024 * 1024; } catch { return false; } };
44
- const out = [];
45
- if (has('package.json')) {
46
- try {
47
- const scripts = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8')).scripts ?? {};
48
- const runner = has('pnpm-lock.yaml') ? 'pnpm' : has('yarn.lock') ? 'yarn' : has('bun.lock') || has('bun.lockb') ? 'bun' : 'npm';
49
- for (const name of ['typecheck', 'type-check', 'lint', 'test', 'test:unit', 'test:integration', 'test:api', 'test:contract', 'test:e2e']) if (typeof scripts[name] === 'string') out.push(name === 'test' && runner === 'npm' ? 'npm test' : `${runner} run ${name}`);
50
- } catch { /* not JSON: nothing implied */ }
51
- }
52
- if (has('go.mod')) out.push('go vet ./...', 'go test ./...');
53
- if (has('Package.swift')) out.push('swift build', 'swift test');
54
- if (has('Cargo.toml')) out.push('cargo check', 'cargo test');
55
- if (has('pyproject.toml') || has('pytest.ini')) out.push(has('uv.lock') ? 'uv run pytest' : 'pytest');
56
- if (has('pom.xml')) out.push(has('mvnw') ? './mvnw verify' : 'mvn verify');
57
- if (has('build.gradle') || has('build.gradle.kts')) out.push(has('gradlew') ? './gradlew test' : 'gradle test');
58
- return out.slice(0, 16);
59
- }
60
- export function repositoryChecks(agentsFiles, cwd, top = cwd) {
61
- const declared = declaredChecks(agentsFiles);
62
- if (declared.length) return { source: 'agents', commands: declared };
63
- const detected = detectedChecks(cwd);
64
- // Include package/repository-local checks even when the workspace root has a
65
- // lint command. These are candidates, not a request to test unrelated repos.
66
- const quote = value => "'" + value.replaceAll("'", "'\\''") + "'";
67
- const nested = discoverDeliveryContext(cwd).units.filter(unit => unit.path !== '.').flatMap(unit =>
68
- detectedChecks(path.join(cwd, unit.path)).map(command => `cd ${quote(unit.path)} && ${command}`));
69
- const commands = [...new Set([...detected, ...nested])].slice(0, 64);
70
- return { source: 'detected', commands: commands.length || cwd === top ? commands : detectedChecks(top) };
71
- }
72
- // A command that verifies code: a declared check, or a known test, type,
73
- // lint or build runner. Text tools that merely mention one do not count.
74
- const RUNNER = /\b(npm|pnpm|yarn|bun)\s+(run\s+)?(test|lint|typecheck|type-check|check|build|verify)\b|\bnode\s+--test\b|\b(tsc|vitest|jest|eslint|biome|ruff|mypy|pyright|pytest|rspec|phpunit)\b|\bplaywright\s+test\b|\bpython3?\s+-m\s+(pytest|unittest|mypy)\b|\bgo\s+(test|vet|build)\b|\bcargo\s+(test|check|clippy|build)\b|\bswift\s+(test|build)\b|\bxcodebuild\b.*\b(test|build)\b|\bmake\s+(test|check|lint)\b|\b(gradle|gradlew|mvn|mvnw)\b.*\b(test|check|verify|compile|package|build)\b|\bdotnet\s+(test|build)\b|\bdeno\s+(test|check|lint)\b/;
75
- // Files no check covers: documentation, pictures and documents,
76
- // and Spec Kit's .specify/ state. A turn that changed only these changed no
77
- // code: no check is required of it (one is still reported if it ran).
78
- const NON_CODE = /\.(md|mdx|markdown|rst|adoc|asciidoc|org|png|jpe?g|gif|webp|bmp|ico|pdf|docx?|xlsx?|pptx?|odt|ods|odp|rtf)$/i;
79
- export function nonCodePath(file) {
80
- const name = String(file ?? '').replaceAll('\\', '/');
81
- return !!name && (NON_CODE.test(name) || /(^|\/)\.specify\//.test(name) || /(^|\/)(LICENSE|NOTICE|AUTHORS|CODEOWNERS)$/.test(name));
82
- }
83
- export const onlyNonCode = paths => { const list = [...(paths ?? [])]; return list.length > 0 && list.every(nonCodePath); };
84
-
85
- // A command that only reads: each part starts with a reading tool and nothing
86
- // is written to a file. Anything else may change files. Git may name the
87
- // repository first (git -C <folder>): a workspace folder holding several
88
- // repositories is read that way.
89
- const GIT_READ = String.raw`git(\s+(-C\s+('[^']*'|"[^"]*"|\S+)|-c\s+\S+|--no-pager))*\s+(status|diff|log|show|branch|ls-files|rev-parse|rev-list|blame|describe|shortlog|cat-file|for-each-ref|reflog(?!\s+(expire|delete))|remote(\s+(-v|--verbose|show|get-url)\b|$))`;
90
- const READER = new RegExp(String.raw`^(ls|cat|head|tail|wc|grep|egrep|rg|find|fd|sed|awk|cut|sort|uniq|tr|echo|printf|pwd|which|stat|file|du|df|tree|jq|diff|cmp|basename|dirname|realpath|date|true|cd|${GIT_READ})(\b|$)`);
91
- export function isReadOnlyCommand(command) {
92
- const text = String(command ?? '').trim();
93
- if (!text || />(?!>|\s*&\d|\s*\/dev\/null)|\btee\b|\bsed\s+(-[a-zA-Z]*i|--in-place)|\s-(delete|exec|execdir|fprint|ok)\b|\bxargs\b|\$\(|`/.test(text)) return false;
94
- return text.split(/&&|\|\||;|\||\n/).every(part => !part.trim() || READER.test(part.trim()));
95
- }
96
- export function isCheckCommand(command, declared = []) {
97
- const text = String(command ?? '').replace(/\s+/g, ' ').trim();
98
- if (!text || /^(echo|printf|grep|rg|cat|sed|awk|head|tail|less|git|ls|find)\b/.test(text)) return false;
99
- return declared.some(d => text.includes(d)) || RUNNER.test(text);
100
- }
101
-
102
25
  // update_plan: the agent's checklist, kept as a session entry so it survives
103
26
  // compaction and "continue", and shown to the member beside the conversation.
104
27
  export const PLAN_ENTRY = 'agent-watch-plan';
@@ -148,7 +71,7 @@ export function workflowPrompt(policy, checks) {
148
71
  if (policy.plan !== 'off') lines.push(`- Plan: for work with several steps keep a checklist with update_plan and update it as you go. When the member asks for several items (plans, files, tickets), put every item in the checklist and work through all of them; do not end your turn to report between items.${policy.plan === 'require' ? ' For a complex task, file edits are refused until a plan exists. A checklist left with pending steps sends you back to the next one until every step is completed or deferred: if you cannot go on without the member, ask with ask_user. Mark a step deferred only when the member asked to leave it for later or it is no longer needed; never mark completed a step you did not do.' : ''}`);
149
72
  if (policy.verify !== 'off') {
150
73
  const list = checks.commands.length ? `${checks.commands.map(c => '`' + c + '`').join(', ')}${checks.source === 'detected' ? ' (detected; the repository declares none in AGENTS.md "## Checks")' : ''}` : 'none declared: choose the tests, type check or build that cover the change';
151
- lines.push(`- Verify: after changing code, run the repository checks that cover the change and fix failures before you finish. Repository checks: ${list}.${policy.verify === 'require' ? ' The turn does not end until a check has passed on the final code.' : ''} Only the member may skip the checks: when they ask to, call waive_checks with their words; never skip them on your own.`);
74
+ lines.push(`- Verify: after changing code, run the tests that cover the change (one file, a filter, one package) and fix failures before you finish; after a failure rerun the part that failed. Do not choose the whole test suite yourself: it can take long, so the harness asks the member before a full run and before a push. Repository checks: ${list}.${policy.verify === 'require' ? ' The turn does not end until a check has passed on the final code.' : ''} Only the member may skip the checks: when they ask to, call waive_checks with their words; never skip them on your own.`);
152
75
  }
153
76
  // What each severity asks: blocking is fixed or argued, major decided, minor only listed.
154
77
  const severities = ' Blocking findings: fix them, or reject one with resolve_objection and the reviewer judges your reason; a disagreement that remains goes to the member. Major findings: fix them or reject them with resolve_objection; no new review follows. Minor findings are listed for the member and need nothing.';
@@ -251,6 +174,8 @@ export class RunProcess {
251
174
  // its answer and see whether the code moved).
252
175
  ledger: [], disputes: [], verifyFails: [], claimsAsked: false, claimsAt: null, claimsRechecked: false, claimsDone: false, mainReviews: 0, minorFindings: 0,
253
176
  sentAt: null, sentDigest: null, rejudged: false, reviewSettled: false, decideAsked: false,
177
+ // How much of the suite the member wants run (check-questions.mjs).
178
+ scopeChoice: null, scopeWords: null, fullAsked: asksFullChecks(request), pushAllowedOn: undefined,
254
179
  // The patch's risk lane (workflow.lanes) and the main agent's own web lookups.
255
180
  lane: null, laneStats: null, laneDigest: null, webLookups: 0 });
256
181
  }
@@ -273,18 +198,27 @@ export class RunProcess {
273
198
  this.unplannedChange = true; this.planSkipped = true;
274
199
  }
275
200
  async afterTool(name, args, ok, digestOf) {
201
+ if (['write', 'edit'].includes(name) && ok) this.edited = true;
276
202
  if (name === 'bash' && isCheckCommand(args?.command, this.checks.commands)) {
203
+ const scope = checkScope(args.command, this.checks.commands), digest = await digestOf(), last = this.lastCheck;
277
204
  this.checksRun += 1; if (!ok) this.checksFailed += 1;
278
- this.lastCheck = { ok, digest: await digestOf(), mutations: this.mutations };
205
+ // A lint after a partial test run does not make it the whole suite.
206
+ this.lastCheck = { ok, digest, mutations: this.mutations, scope: scope ?? (last?.scope === 'partial' && last.digest === digest ? 'partial' : 'other') };
207
+ // The member's "run it all" covers one run; after a fix they are asked again.
208
+ if (scope === 'suite' && this.scopeChoice === 'full') this.scopeChoice = null;
279
209
  // A command may change files, so it counts. Without a git repository to
280
210
  // compare the code against, one that only reads does not: counting every
281
211
  // command reported code changes in turns that only read and checked.
282
212
  } else if (['write', 'edit'].includes(name) && ok || name === 'bash' && (this.startDigest !== null || !isReadOnlyCommand(args?.command))) this.mutations += 1;
283
213
  }
284
- verifiedOn(digest) {
214
+ passedOn(digest) {
285
215
  const c = this.lastCheck;
286
216
  return !!c?.ok && (digest !== null && c.digest !== null ? c.digest === digest : c.mutations === this.mutations);
287
217
  }
218
+ partOnlyOn(digest) { return this.passedOn(digest) && this.lastCheck.scope === 'partial'; }
219
+ suitePassedOn(digest) { return this.passedOn(digest) && this.lastCheck.scope === 'suite'; }
220
+ // A partial run counts unless the member wants the whole suite.
221
+ verifiedOn(digest) { return this.passedOn(digest) && !(this.partOnlyOn(digest) && (this.fullAsked || this.scopeChoice === 'full')); }
288
222
  // Version 2 (a broker advertising "process-v2") adds whether code was
289
223
  // changed without the required plan and how many calls named no tool.
290
224
  // Version 3 adds helper objections, those the agent answered and the
@@ -334,7 +268,7 @@ export async function completionGate(managed, run, signal) {
334
268
  let digest = null, interrupted = false, verifyGaveUp = false;
335
269
  for (let step = 0; step < 16; step += 1) {
336
270
  digest = await digestOf();
337
- run.changed = run.startDigest !== null && digest !== null ? digest !== run.startDigest : run.mutations > 0;
271
+ run.changed = run.startDigest !== null && digest !== null ? digest !== run.startDigest : run.startDigest !== null ? run.edited === true : run.mutations > 0; // code that cannot be read now: only a real edit says it changed
338
272
  // A check that passed still counts when the turn was cut off after it.
339
273
  if (run.changed) run.verified = run.verifiedOn(digest);
340
274
  run.docsOnly = run.changed && onlyNonCode(managed.ownPaths);
@@ -350,10 +284,26 @@ export async function completionGate(managed, run, signal) {
350
284
  // The member declined the approval a check needed (a JDK, Docker, the
351
285
  // network): asking again would only repeat the same answer.
352
286
  if (policy.verify === 'require' && !run.verified && run.approvalDeclined && run.fixLoops > 0) verifyGaveUp = true;
353
- if (policy.verify === 'require' && !run.verified && !run.docsOnly && !verifyGaveUp && run.waivedDigest !== digest) {
287
+ // "Do not run" covered the code it was given for; new code is asked about again.
288
+ if (run.scopeChoice === 'skip' && run.waivedDigest !== digest) run.scopeChoice = null;
289
+ // How much to test is the member's call; asked once, not while a check is failing.
290
+ if (policy.verify === 'require' && !run.docsOnly && !verifyGaveUp && run.waivedDigest !== digest && !run.scopeChoice && !run.fullAsked && run.lastCheck?.ok !== false && (!run.verified || run.partOnlyOn(digest))) {
291
+ const answer = await askCheckScope(managed, { partPassed: run.partOnlyOn(digest), signal });
292
+ if (stopped()) { interrupted = true; break; }
293
+ if (answer) {
294
+ run.scopeChoice = answer.choice; run.scopeWords = answer.words ?? null;
295
+ if (answer.choice === 'skip') run.waivedDigest = digest; // the same record as waive_checks: this exact code, reported unverified
296
+ run.verified = run.verifiedOn(digest);
297
+ }
298
+ }
299
+ if (policy.verify === 'require' && (!run.verified || run.scopeWords) && !run.docsOnly && !verifyGaveUp && run.waivedDigest !== digest) {
354
300
  run.fixLoops += 1;
355
301
  const list = run.checks.commands.length ? run.checks.commands.map(c => '`' + c + '`').join(', ') : 'the tests, type check or build that cover the change';
356
- await send(`Harness process check: code changed in this turn, but no check has passed on the current code. Run the checks that cover your change (${list}) and fix what fails. If a check cannot run because the machine lacks something (a runtime such as a JDK, Docker, a database or another service, the network), request the approval that makes it run (run_with_network, run_with_docker, start_docker, run_on_host) or ask the member with ask_user, then run it; install or start nothing without that approval. If it fails for a reason unrelated to your change, say so plainly.`,
302
+ const words = run.scopeWords; run.scopeWords = null;
303
+ const ask = words ? `The member answered about testing: "${String(words).slice(0, 500)}". Follow that and fix what fails.`
304
+ : run.scopeChoice === 'partial' ? 'Run only the tests that cover your change (one file, a filter, one package), not the whole suite, and fix what fails.'
305
+ : `Run the checks that cover your change (${list}) and fix what fails.${run.fullAsked || run.scopeChoice === 'full' ? ' The member wants the whole suite: a partial run does not count.' : ''}`;
306
+ await send(`Harness process check: code changed in this turn, but no check has passed on the current code. ${ask} If a check cannot run because the machine lacks something (a runtime such as a JDK, Docker, a database or another service, the network), request the approval that makes it run (run_with_network, run_with_docker, start_docker, run_on_host) or ask the member with ask_user, then run it; install or start nothing without that approval. If it fails for a reason unrelated to your change, say so plainly.`,
357
307
  { phase: 'verify', loop: run.fixLoops, maxLoops: policy.maxFixLoops, lastCheckFailed: run.lastCheck?.ok === false });
358
308
  continue;
359
309
  }
@@ -362,7 +312,7 @@ export async function completionGate(managed, run, signal) {
362
312
  const answer = run.sentAt !== null ? answerSince(run.sentAt) + decisionsText(run, 'review') : '';
363
313
  // After a fix the reviewer checks its blocking findings and the files changed since.
364
314
  const focus = run.sentAt !== null ? await reviewFocus(managed) : null, previous = (review?.findings ?? []).filter(f => f.severity === 'blocking').map((f, i) => `${i + 1}. ${findingText(f)}`).join('\n');
365
- const brief = `Review the current patch against the member's request.\n\nChecks: ${run.verified ? 'a repository check passed on this code' : 'no check has passed on this code'}.${answer ? `\n\nThe main agent's answer to your previous blocking findings (the code changed after it):\n${answer}` : ''}${focus ? `\n\nSince your last review only these files changed: ${focus.files.join(', ')}. Judge whether each previous blocking finding is fixed (repeat it when it is not) and review the changes in these files; the rest of the patch was reviewed and has not changed.${previous ? `\nYour previous blocking findings:\n${previous}` : ''}` : ''}`;
315
+ const brief = `Review the current patch against the member's request.\n\nChecks: ${run.partOnlyOn(digest) ? 'only part of the test suite passed on this code' : run.verified ? 'a repository check passed on this code' : 'no check has passed on this code'}.${answer ? `\n\nThe main agent's answer to your previous blocking findings (the code changed after it):\n${answer}` : ''}${focus ? `\n\nSince your last review only these files changed: ${focus.files.join(', ')}. Judge whether each previous blocking finding is fixed (repeat it when it is not) and review the changes in these files; the rest of the patch was reviewed and has not changed.${previous ? `\nYour previous blocking findings:\n${previous}` : ''}` : ''}`;
366
316
  managed.reviewFocus = focus;
367
317
  try { await managed.delegate({ role: 'review', task: brief }, signal, { harness: true }); }
368
318
  catch (error) {
@@ -442,8 +392,8 @@ export async function completionGate(managed, run, signal) {
442
392
  if (!run.changed && !run.disputes.length && !ledgerOf(run).length) return;
443
393
  const finalPlan = currentPlan(session.sessionManager), planOpen = run.planUpdated ? finalPlan?.plan?.filter(p => p.status === 'pending' || p.status === 'in_progress').length ?? 0 : 0;
444
394
  const status = { verified: run.verified, reviewed: run.reviewed, blockingOpen: run.blockingOpen, checks: run.checksRun, fixLoops: run.fixLoops,
445
- ...(planOpen ? { planOpen } : {}), ...(run.planSkipped ? { planSkipped: true } : {}), ...(!run.verified && run.waivedDigest === digest ? { checksWaived: true } : {}), ...(run.disputes.length ? { disputes: run.disputes.length } : {}), ...(run.changed ? {} : { unchanged: true }) };
446
- const words = [...(run.changed ? [run.verified ? 'a check passed on the final code' : policy.verify === 'off' ? null : run.docsOnly ? 'only documentation changed: no check needed' : run.waivedDigest === digest ? 'no check passed on the final code: the member waived the checks' : 'no check passed on the final code',
395
+ ...(planOpen ? { planOpen } : {}), ...(run.planSkipped ? { planSkipped: true } : {}), ...(!run.verified && run.waivedDigest === digest ? { checksWaived: true } : {}), ...(run.verified && run.partOnlyOn(digest) ? { partOnly: true } : {}), ...(run.disputes.length ? { disputes: run.disputes.length } : {}), ...(run.changed ? {} : { unchanged: true }) };
396
+ const words = [...(run.changed ? [run.partOnlyOn(digest) && run.verified ? 'only part of the test suite passed on the final code' : run.verified ? 'a check passed on the final code' : policy.verify === 'off' ? null : run.docsOnly ? 'only documentation changed: no check needed' : run.waivedDigest === digest ? 'no check passed on the final code: the member waived the checks' : 'no check passed on the final code',
447
397
  run.reviewed ? (run.blockingOpen ? `review: ${run.blockingOpen} blocking issue(s) still open` : 'review: no blocking issue') : policy.review === 'off' ? null : run.reviewUnavailable ? `review could not run (${run.reviewUnavailableReason})` : 'not reviewed',
448
398
  run.planSkipped ? 'code was changed before the required plan existed' : null, planOpen ? `plan: ${planOpen} step(s) not completed` : null] : []),
449
399
  run.disputes.length ? `${run.disputes.length} disagreement(s) between the main agent and a subagent go to the member` : null, ledgerWords(run)].filter(Boolean);
@@ -464,6 +414,7 @@ export function processEditTools(session, tools) {
464
414
  session.run?.beforeEdit(tool.name, plan, session.mainAnswers);
465
415
  // An open premise objection is resolved before files change (ledger.mjs).
466
416
  if (tool.name !== 'bash' || !isReadOnlyCommand(args[1]?.command)) ledgerGuard(session.run, session.mainAnswers);
417
+ if (tool.name === 'bash') await beforeCheckOrPush(session, args[1]?.command, args[4], args[2]);
467
418
  // While a required plan is missing, a command that changes files
468
419
  // counts as an edit: the code is compared after each command.
469
420
  const watch = tool.name === 'bash' && !!session.run?.planMissing(plan) && !session.run.unplannedChange && session.run.startDigest !== null;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piagent/core",
3
- "version": "1.48.4",
3
+ "version": "1.49.0",
4
4
  "type": "module",
5
5
  "private": true,
6
6
  "license": "MIT",