@piagent/platform 1.44.1 → 1.44.3
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 +23 -0
- package/docs/command-reference-vietnamese.md +2 -2
- package/docs/distribution-standard.md +6 -6
- package/docs/harness-conformance.md +14 -0
- package/docs/operator-manual-vietnamese.md +7 -7
- package/docs/publishing-for-teams.md +2 -0
- package/docs/release-install-policy.md +2 -2
- package/docs/team-onboarding.md +2 -2
- package/docs-site/architecture.html +1 -1
- package/docs-site/assets/search-en.json +1 -1
- package/docs-site/assets/search-vi.json +1 -1
- package/docs-site/benchmark.html +1 -1
- package/docs-site/commands.html +1 -1
- package/docs-site/context-engine.html +1 -1
- package/docs-site/ecosystem.html +1 -1
- package/docs-site/en/architecture.html +1 -1
- package/docs-site/en/benchmark.html +1 -1
- package/docs-site/en/commands.html +1 -1
- package/docs-site/en/context-engine.html +1 -1
- package/docs-site/en/ecosystem.html +1 -1
- package/docs-site/en/index.html +15 -15
- package/docs-site/en/mcp-approval.html +1 -1
- package/docs-site/en/mcp-auth.html +1 -1
- package/docs-site/en/mcp-servers.html +1 -1
- package/docs-site/en/mcp.html +1 -1
- package/docs-site/en/permissions.html +1 -1
- package/docs-site/en/profiles.html +1 -1
- package/docs-site/en/quickstart.html +1 -1
- package/docs-site/en/runtime.html +1 -1
- package/docs-site/en/scope.html +1 -1
- package/docs-site/en/security.html +1 -1
- package/docs-site/en/team.html +1 -1
- package/docs-site/en/update.html +3 -3
- package/docs-site/en/whats-new.html +50 -29
- package/docs-site/en/windows.html +1 -1
- package/docs-site/en/workflows.html +1 -1
- package/docs-site/index.html +15 -15
- package/docs-site/mcp-approval.html +1 -1
- package/docs-site/mcp-auth.html +1 -1
- package/docs-site/mcp-servers.html +1 -1
- package/docs-site/mcp.html +1 -1
- package/docs-site/permissions.html +1 -1
- package/docs-site/profiles.html +1 -1
- package/docs-site/quickstart.html +1 -1
- package/docs-site/releases.json +62 -0
- package/docs-site/runtime.html +1 -1
- package/docs-site/scope.html +1 -1
- package/docs-site/security.html +1 -1
- package/docs-site/team.html +1 -1
- package/docs-site/update.html +3 -3
- package/docs-site/whats-new.html +50 -29
- package/docs-site/windows.html +1 -1
- package/docs-site/workflows.html +1 -1
- package/evals/private-holdout-v1/public-exposure.v2.json +2 -2
- package/package.json +1 -1
- package/packages/piagent-core/managed/command-tools.mjs +7 -5
- package/packages/piagent-core/managed/fetch-guard.mjs +38 -0
- package/packages/piagent-core/managed/helper-roles.mjs +24 -6
- package/packages/piagent-core/managed/helper-run.mjs +4 -2
- package/packages/piagent-core/managed/host-command.mjs +9 -0
- package/packages/piagent-core/managed/memory-tools.mjs +4 -3
- package/packages/piagent-core/managed/risk-lanes.mjs +38 -0
- package/packages/piagent-core/managed/session.mjs +8 -8
- package/packages/piagent-core/managed/untrusted.mjs +17 -0
- package/packages/piagent-core/managed/workflow.mjs +24 -4
- package/packages/piagent-core/package.json +1 -1
|
@@ -5,6 +5,7 @@ import { failureCode } from '../runtime/managed-failure.mjs';
|
|
|
5
5
|
import { TsDiagnostics } from './ts-diagnostics.mjs';
|
|
6
6
|
import { checkpointsOf } from './checkpoints.mjs';
|
|
7
7
|
import { discoverDeliveryContext } from './delivery-context.mjs';
|
|
8
|
+
import { LANE_LIMITS, patchStats, changeLane, lanePolicy } from './risk-lanes.mjs';
|
|
8
9
|
|
|
9
10
|
// The process layer of the company harness: a plan for multi-step work, the
|
|
10
11
|
// repository's checks after a code change, an independent review of the patch.
|
|
@@ -17,7 +18,7 @@ export function workflowPolicy(manifest) {
|
|
|
17
18
|
const mode = value => MODES.includes(value) ? value : 'suggest';
|
|
18
19
|
const loops = Number.isInteger(w.max_fix_loops) && w.max_fix_loops >= 0 && w.max_fix_loops <= 3 ? w.max_fix_loops : 2;
|
|
19
20
|
// A review needs a review helper; without one in the Harness it is off.
|
|
20
|
-
return { plan: mode(w.plan), verify: mode(w.verify), review: config.review ? mode(w.review) : 'off', maxFixLoops: loops };
|
|
21
|
+
return { plan: mode(w.plan), verify: mode(w.verify), review: config.review ? mode(w.review) : 'off', maxFixLoops: loops, lanes: w.lanes !== false };
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
// Checks come from the repository: a "## Checks" section in AGENTS.md (code
|
|
@@ -150,6 +151,10 @@ export function workflowPrompt(policy, checks) {
|
|
|
150
151
|
}
|
|
151
152
|
if (policy.review !== 'off') lines.push(policy.review === 'require' ? '- Review: the harness reviews the final patch with an independent reviewer; blocking findings come back to you to fix, or to answer when a finding is wrong: the reviewer then judges your answer, and a disagreement that remains goes to the member.'
|
|
152
153
|
: '- Review: before you finish a code change, ask the review helper (delegate role "review") to review the patch, then fix blocking findings.');
|
|
154
|
+
if (policy.lanes && (policy.verify !== 'off' || policy.review !== 'off')) {
|
|
155
|
+
const L = LANE_LIMITS;
|
|
156
|
+
lines.push(`- Size: the process follows the size of your change. A small change (at most ${L.tinyFiles} files and ${L.tinyLines} changed lines, no migration, auth, security, CI, dependency or AGENTS.md file) ends after its checks, without a review: do not ask for one. A risky change (a complex request, one of those files, more than ${L.riskyFiles} files or ${L.riskyLines} lines) must pass the checks${policy.review !== 'off' ? ' and the harness review' : ''} even where they are only suggested.`);
|
|
157
|
+
}
|
|
153
158
|
return lines.length ? `\n\nProcess for code changes (company Harness):\n${lines.join('\n')}\n${process.platform === 'darwin' ? 'End-to-end and UI checks run in bash with the project\'s Playwright (@playwright/test; add it with npm when the project lacks it) and the browsers installed on this Mac, against a server the test or start_process starts; while a local proxy listens they need run_with_network. When Playwright\'s browsers are missing, ask with run_on_host to run `npx playwright install chromium`.' : 'End-to-end tests that start a local server and a browser run through run_with_network, which the user approves.'} If a check cannot run because the machine lacks something (a runtime such as a JDK, Docker, a database or another service, the network), do not stop there: request the approval that makes it run (run_with_network, run_with_docker, start_docker, or run_on_host to install what is missing) or ask the member with ask_user; never install or start anything without that approval.\nA command stops after 10 minutes and anything left running in the background stops when the turn ends: run the checks that cover your change first and a long suite in parts, not in the background.${process.platform === 'darwin' ? ' A dev server, watcher or local service you need across turns runs with start_process (read it with process_output, stop it with stop_process).' : ''}` : '';
|
|
154
159
|
}
|
|
155
160
|
|
|
@@ -241,7 +246,9 @@ export class RunProcess {
|
|
|
241
246
|
// claims verify marked failed, and where the harness last sent the
|
|
242
247
|
// agent back (to read its answer and see whether the code moved).
|
|
243
248
|
objections: [], disputes: [], verifyFails: [], claimsAsked: false, claimsAt: null, claimsRechecked: false, claimsDone: false,
|
|
244
|
-
sentAt: null, sentDigest: null, rejudged: false, reviewSettled: false, objectionsAsked: false
|
|
249
|
+
sentAt: null, sentDigest: null, rejudged: false, reviewSettled: false, objectionsAsked: false,
|
|
250
|
+
// The patch's risk lane (workflow.lanes) and the main agent's own web lookups.
|
|
251
|
+
lane: null, laneStats: null, laneDigest: null, webLookups: 0 });
|
|
245
252
|
}
|
|
246
253
|
// Plan "require" on a complex task that has no plan yet.
|
|
247
254
|
planMissing(plan) {
|
|
@@ -299,7 +306,18 @@ export class RunProcess {
|
|
|
299
306
|
// A finding, a failed claim or an objection to a brief is the agent's to fix
|
|
300
307
|
// or answer; the same disagreement a second time goes to the member.
|
|
301
308
|
export async function completionGate(managed, run, signal) {
|
|
302
|
-
const session = managed.session,
|
|
309
|
+
const session = managed.session, configured = run.policy;
|
|
310
|
+
let policy = configured;
|
|
311
|
+
// The lane of the patch as it is now, read again only when it changed.
|
|
312
|
+
const laneOf = async digest => {
|
|
313
|
+
if (!configured.lanes) return configured;
|
|
314
|
+
if (run.laneDigest === null || run.laneDigest !== digest) {
|
|
315
|
+
let stats = null;
|
|
316
|
+
try { stats = patchStats(await managed.patchSnapshot?.()); } catch { /* unreadable: standard */ }
|
|
317
|
+
run.lane = changeLane(stats, run); run.laneStats = stats ? { files: stats.files, lines: stats.lines } : null; run.laneDigest = digest;
|
|
318
|
+
}
|
|
319
|
+
return lanePolicy(configured, run.lane);
|
|
320
|
+
};
|
|
303
321
|
const digestOf = async () => { try { return await (managed.changeDigest ?? managed.patchDigest).call(managed); } catch { return null; } };
|
|
304
322
|
const reviewDigestOf = async () => { try { return await managed.patchDigest(); } catch { return null; } };
|
|
305
323
|
const stopped = () => signal?.aborted || ['aborted', 'error'].includes(session.messages.findLast(m => m.role === 'assistant')?.stopReason);
|
|
@@ -316,6 +334,7 @@ export async function completionGate(managed, run, signal) {
|
|
|
316
334
|
// A check that passed still counts when the turn was cut off after it.
|
|
317
335
|
if (run.changed) run.verified = run.verifiedOn(digest);
|
|
318
336
|
run.docsOnly = run.changed && onlyNonCode(managed.ownPaths);
|
|
337
|
+
policy = run.changed ? await laneOf(digest) : configured;
|
|
319
338
|
if (stopped()) { interrupted = run.changed; break; }
|
|
320
339
|
if (run.changed) {
|
|
321
340
|
const reviewDigest = managed.review ? await reviewDigestOf() : null;
|
|
@@ -424,7 +443,8 @@ export async function completionGate(managed, run, signal) {
|
|
|
424
443
|
run.planSkipped ? 'code was changed before the required plan existed' : null, planOpen ? `plan: ${planOpen} step(s) not completed` : null] : []),
|
|
425
444
|
run.disputes.length ? `${run.disputes.length} disagreement(s) between the main agent and a subagent go to the member` : null].filter(Boolean);
|
|
426
445
|
await session.sendCustomMessage({ customType: 'agent-watch-process', content: `Process status for this turn: ${run.changed ? 'code changed' : 'no code changed'}; ${words.join('; ') || 'no process step configured'}.`, display: true,
|
|
427
|
-
details: { phase: 'final', outcome: run.outcome, ...status, ...(run.reviewUnavailable ? { reviewUnavailable: run.reviewUnavailableReason } : {}), policy: { verify: policy.verify, review: policy.review }
|
|
446
|
+
details: { phase: 'final', outcome: run.outcome, ...status, ...(run.reviewUnavailable ? { reviewUnavailable: run.reviewUnavailableReason } : {}), policy: { verify: policy.verify, review: policy.review },
|
|
447
|
+
...(configured.lanes && run.lane ? { lane: run.lane, ...(run.laneStats ? { size: run.laneStats } : {}) } : {}) } }, { triggerTurn: false });
|
|
428
448
|
}
|
|
429
449
|
|
|
430
450
|
// The run's process sees each edit and command: plan guard before, check
|