@piagent/platform 1.6.0 → 1.6.1
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 +49 -0
- package/README.md +17 -14
- package/README.vi.md +26 -1
- package/benchmarks/production-v1/spend-control.v1.json +27 -3
- package/benchmarks/production-v1/suite.json +5 -1
- package/catalog/capabilities.json +16 -16
- package/docs/authority-manifest.md +1 -1
- package/docs/auto-delegation-policy.md +38 -73
- package/docs/command-reference-vietnamese.md +23 -31
- package/docs/context-engine.md +5 -3
- package/docs/context-window-policy.md +37 -1
- package/docs/distribution-standard.md +7 -7
- package/docs/en/architecture.md +26 -13
- package/docs/languages.json +4 -4
- package/docs/operator-manual-vietnamese.md +21 -41
- package/docs/publishing-for-teams.md +5 -0
- package/docs/quality-benchmark.md +179 -23
- package/docs/release-install-policy.md +6 -6
- package/docs/runtime-harness-standard.md +3 -3
- package/docs/security-threat-model.md +1 -1
- package/docs/subagent-orchestration-capabilities.md +19 -51
- package/docs/subagents-and-multiagent.md +21 -47
- package/docs/task-implementation-contract.md +3 -3
- package/docs/task-lifecycle-vietnamese.md +1 -1
- package/docs/team-onboarding.md +2 -2
- package/docs/vi/architecture.md +26 -13
- package/docs-site/architecture.html +1 -1
- package/docs-site/benchmark.html +89 -95
- package/docs-site/commands.html +1 -1
- package/docs-site/content/benchmark.html +88 -94
- package/docs-site/content/en/benchmark.html +134 -90
- package/docs-site/content/en/index.html +19 -19
- package/docs-site/content/en/runtime.html +4 -4
- package/docs-site/content/en/whats-new.html +12 -1
- package/docs-site/content/en/workflows.html +2 -2
- package/docs-site/content/index.html +19 -19
- package/docs-site/content/runtime.html +4 -4
- package/docs-site/content/whats-new.html +12 -1
- package/docs-site/content/workflows.html +2 -2
- package/docs-site/context-engine.html +1 -1
- package/docs-site/en/architecture.html +1 -1
- package/docs-site/en/benchmark.html +135 -91
- package/docs-site/en/commands.html +1 -1
- package/docs-site/en/context-engine.html +1 -1
- package/docs-site/en/index.html +20 -20
- 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 +5 -5
- 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/whats-new.html +13 -2
- package/docs-site/en/workflows.html +3 -3
- package/docs-site/index.html +20 -20
- 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/runtime.html +5 -5
- package/docs-site/scope.html +1 -1
- package/docs-site/security.html +1 -1
- package/docs-site/team.html +1 -1
- package/docs-site/whats-new.html +13 -2
- package/docs-site/workflows.html +3 -3
- package/evals/fixtures/benchmark-assurance-evidence.invalid.json +1 -1
- package/evals/fixtures/benchmark-assurance-evidence.valid.json +1 -1
- package/evals/fixtures/codex-relative-efficiency-v1.invalid.json +4 -0
- package/evals/fixtures/codex-relative-efficiency-v1.valid.json +94 -0
- package/evals/fixtures/helper-request.invalid.json +1 -1
- package/evals/fixtures/helper-request.valid.json +1 -1
- package/evals/fixtures/piagent-webui/subagent-tree-v1.valid.json +7 -0
- package/evals/fixtures/task-authority-snapshot.valid.json +4 -4
- package/evals/fs4-readiness-matrix.v1.json +2 -2
- package/evals/fs5-causal-arm.v1.json +2 -2
- package/evals/fs5-pilot-protocol.v1.json +3 -3
- package/evals/fs5-pilot-protocol.v2.json +8 -8
- package/evals/fs5-pilot-protocol.v3.json +8 -8
- package/evals/fs5-pilot-protocol.v4.json +6 -6
- package/evals/fs5-pilot-protocol.v5.json +7 -6
- package/evals/private-holdout-v1/public-exposure.v1.json +1 -1
- package/evals/runtime-conformance-v1/README.md +43 -0
- package/evals/runtime-conformance-v1/evaluate-paid-canary.mjs +198 -0
- package/evals/runtime-conformance-v1/lane.json +57 -0
- package/evals/runtime-conformance-v1/paid-canary.json +31 -0
- package/evals/runtime-conformance-v1/runner.mjs +456 -0
- package/package.json +1 -1
- package/packages/piagent-core/README.md +13 -4
- package/packages/piagent-core/benchmark/benchmark-codex-relative-efficiency.js +698 -0
- package/packages/piagent-core/benchmark/benchmark-core.js +4 -3
- package/packages/piagent-core/benchmark/benchmark-forensics.js +4 -2
- package/packages/piagent-core/benchmark/benchmark-preflight.js +3 -1
- package/packages/piagent-core/benchmark/benchmark-provider-free-evidence.js +345 -0
- package/packages/piagent-core/benchmark/benchmark-record-validation.js +74 -5
- package/packages/piagent-core/benchmark/benchmark-report.js +15 -1
- package/packages/piagent-core/benchmark/benchmark-runtime-causal.js +244 -0
- package/packages/piagent-core/benchmark/benchmark-stage-diagnostic.js +201 -4
- package/packages/piagent-core/benchmark/benchmark-suite.js +22 -1
- package/packages/piagent-core/benchmark/benchmark-summary-support.js +4 -0
- package/packages/piagent-core/benchmark/benchmark-usage.js +15 -4
- package/packages/piagent-core/capabilities/runtime-integrity.js +3 -0
- package/packages/piagent-core/extensions/acceptance-behavior-proof.js +806 -0
- package/packages/piagent-core/extensions/acceptance-receipt.js +89 -48
- package/packages/piagent-core/extensions/context-engine.js +1 -11
- package/packages/piagent-core/extensions/context-index-policy.js +4 -0
- package/packages/piagent-core/extensions/context-query-paths.js +57 -0
- package/packages/piagent-core/extensions/criterion-context-pack.js +16 -3
- package/packages/piagent-core/extensions/criterion-graph.js +4 -1
- package/packages/piagent-core/extensions/fallback-base-policy.ts +101 -0
- package/packages/piagent-core/extensions/guard-types.ts +4 -0
- package/packages/piagent-core/extensions/piagent-guard.ts +194 -226
- package/packages/piagent-core/extensions/task-lifecycle.js +32 -0
- package/packages/piagent-core/extensions/task-state.js +69 -8
- package/packages/piagent-core/extensions/verification-intelligence.js +49 -12
- package/packages/piagent-core/extensions/workspace-evidence-roots.js +52 -16
- package/packages/piagent-core/package.json +1 -1
- package/packages/piagent-core/policies/base-policy.json +42 -2
- package/packages/piagent-core/policy/authority-manifest.v1.json +3 -3
- package/packages/piagent-core/prompts/be-to-fe.md +2 -8
- package/packages/piagent-core/prompts/plan.md +1 -1
- package/packages/piagent-core/prompts/platform-improve.md +2 -6
- package/packages/piagent-core/prompts/review.md +2 -7
- package/packages/piagent-core/prompts/scout.md +1 -1
- package/packages/piagent-core/prompts/task.md +4 -3
- package/packages/piagent-core/runtime/hooks/completion-hook.ts +7 -6
- package/packages/piagent-core/runtime/hooks/input-hook.ts +6 -0
- package/packages/piagent-core/runtime/hooks/session-start-hook.ts +100 -1
- package/packages/piagent-core/runtime/hooks/tool-result-hook.ts +58 -72
- package/packages/piagent-core/runtime/hooks/tool-result-value-helpers.ts +66 -0
- package/packages/piagent-core/runtime/inspection/bounded-emission-guard.ts +286 -0
- package/packages/piagent-core/runtime/inspection/runtime-event-store.ts +37 -7
- package/packages/piagent-core/runtime/inspection/task-subagent-tree.ts +27 -4
- package/packages/piagent-core/runtime/inspection/tool-failure-classification.ts +20 -3
- package/packages/piagent-core/runtime/inspection/webui-snapshot.ts +47 -11
- package/packages/piagent-core/runtime/orchestration/helper-lifecycle.ts +16 -12
- package/packages/piagent-core/runtime/orchestration/minimal-delegation-policy.ts +71 -0
- package/packages/piagent-core/runtime/orchestration/owned-work-budget.ts +28 -20
- package/packages/piagent-core/runtime/orchestration/role-policy.ts +27 -9
- package/packages/piagent-core/runtime/orchestration/subagent-tool-policy.ts +329 -0
- package/packages/piagent-core/runtime/policy/block-remedy.ts +0 -4
- package/packages/piagent-core/runtime/product/efficiency-metrics.ts +3 -0
- package/packages/piagent-core/runtime/quality/edit-freshness-guard.ts +102 -0
- package/packages/piagent-core/runtime/quality/exact-output-contract.ts +20 -10
- package/packages/piagent-core/runtime/quality/performance-assurance.ts +3 -3
- package/packages/piagent-core/runtime/recovery/continuation-budget.ts +1 -1
- package/packages/piagent-core/runtime/recovery/handoff-projection.ts +4 -1
- package/packages/piagent-core/runtime/recovery/pristine-task-policy-refresh.ts +91 -0
- package/packages/piagent-core/runtime/recovery/recovery-policy.ts +7 -4
- package/packages/piagent-core/runtime/recovery/resume-state.ts +112 -14
- package/packages/piagent-core/runtime/recovery/semantic-repair-handshake.ts +7 -13
- package/packages/piagent-core/runtime/recovery/task-evidence-coverage-refresh.ts +217 -0
- package/packages/piagent-core/runtime/registration/context-commands.ts +16 -2
- package/packages/piagent-core/runtime/registration/knowledge-tools.ts +9 -5
- package/packages/piagent-core/runtime/registration/operator-request-intake.ts +49 -0
- package/packages/piagent-core/runtime/registration/policy-tools.ts +4 -4
- package/packages/piagent-core/runtime/registration/session-commands.ts +1 -1
- package/packages/piagent-core/runtime/registration/task-completion-tools.ts +12 -9
- package/packages/piagent-core/runtime/registration/task-evidence-tools.ts +21 -12
- package/packages/piagent-core/runtime/registration/task-start-guidance.ts +19 -13
- package/packages/piagent-core/runtime/registration/task-start-manifest.ts +54 -0
- package/packages/piagent-core/runtime/registration/task-start-tool.ts +57 -57
- package/packages/piagent-core/runtime/runtime-limits.ts +16 -2
- package/packages/piagent-core/runtime/session/adaptive-context-analysis.ts +461 -0
- package/packages/piagent-core/runtime/session/adaptive-context-governor.ts +464 -0
- package/packages/piagent-core/runtime/session/adaptive-context-ledger.ts +265 -0
- package/packages/piagent-core/runtime/session/message-signals.ts +7 -3
- package/packages/piagent-core/runtime/session/operator-request-carry.ts +44 -0
- package/packages/piagent-core/runtime/session/runtime-state.ts +11 -7
- package/packages/piagent-core/runtime/session/source-checkout-read-grants.ts +35 -0
- package/packages/piagent-core/runtime/session/system-prompt.ts +76 -14
- package/packages/piagent-core/runtime/session/task-contract-presentation.ts +39 -0
- package/packages/piagent-core/runtime/tools/phase-tools.ts +8 -8
- package/packages/piagent-core/runtime/tools/tool-groups.ts +12 -2
- package/packages/piagent-core/runtime/verification/exact-verifier-reuse.ts +101 -0
- package/packages/piagent-core/runtime/workflows/runtime-intake-compaction.ts +164 -0
- package/packages/piagent-core/runtime/workflows/task-intake.ts +167 -39
- package/packages/piagent-core/subagents/piagent-oracle.md +5 -3
- package/packages/piagent-core/subagents/piagent-planner.md +6 -4
- package/packages/piagent-core/subagents/piagent-reviewer.md +5 -3
- package/packages/piagent-core/subagents/piagent-scout.md +4 -2
- package/packages/piagent-core/subagents/piagent-worker.md +6 -4
- package/packages/piagent-webui/dist/client/assets/{MarkdownMessage-CxeZqTte.js → MarkdownMessage-B4XehTCU.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/{index-DynIMe8I.js → index-CgOEyRPG.js} +4 -4
- package/packages/piagent-webui/dist/client/index.html +1 -1
- package/packages/piagent-webui/extension/piagent-webui.ts +3 -1
- package/packages/piagent-webui/extension/same-session-bridge.ts +1 -1
- package/packages/piagent-webui/extension/session-stream-adapter.ts +33 -10
- package/packages/piagent-webui/gateway/gateway-session-stream.ts +37 -21
- package/packages/piagent-webui/gateway/session-operation-lifecycle.ts +237 -0
- package/packages/piagent-webui/gateway/session-operation-retry-control.ts +38 -0
- package/packages/piagent-webui/gateway/session-operation-watchdog.ts +9 -2
- package/packages/piagent-webui/gateway/session-runtime-supervisor.ts +8 -7
- package/packages/piagent-webui/ownership/session-lease-store.ts +5 -2
- package/packages/piagent-webui/server/core-inspection-provider.ts +2 -1
- package/packages/piagent-webui/server/transcript-projection.ts +91 -5
- package/schemas/codex-relative-efficiency-v1.schema.json +155 -0
- package/schemas/piagent-webui/runtime-event-v2.schema.json +15 -5
- package/schemas/piagent-webui/subagent-tree-v1.schema.json +11 -1
- package/schemas/project-profile.schema.json +1 -1
- package/schemas/task-contract.schema.json +15 -0
- package/scripts/benchmark-runner-core.mjs +14 -6
- package/scripts/benchmark-runner-finalization.mjs +4 -0
- package/scripts/configure-subagents.sh +42 -34
- package/scripts/helper-evaluation.mjs +1 -1
- package/scripts/team-doctor.sh +1 -1
- package/scripts/verify-local.sh +5 -0
|
@@ -236,6 +236,7 @@ export class CoreInspectionProvider implements WebUiReadModelProvider {
|
|
|
236
236
|
}
|
|
237
237
|
async transcript(beforeCursor: string | null, limit: number): Promise<unknown> {
|
|
238
238
|
const snapshot = await this.snapshot() as any;
|
|
239
|
+
const activeTask = this.#input.task?.() as any;
|
|
239
240
|
return projectTranscript({ identity: { projectRef: snapshot.identity.projectRef, runtimeInstanceId: snapshot.identity.runtimeInstanceId,
|
|
240
241
|
sessionRef: snapshot.identity.sessionRef, taskId: snapshot.identity.taskId, taskRunId: snapshot.identity.taskRunId, agentOperationId: null, toolCallId: null },
|
|
241
242
|
revision: { runtimeRevision: snapshot.revision.runtimeRevision, taskRevision: snapshot.revision.taskRevision,
|
|
@@ -243,7 +244,7 @@ export class CoreInspectionProvider implements WebUiReadModelProvider {
|
|
|
243
244
|
indexRevision: snapshot.revision.indexRevision, approvalRevision: snapshot.revision.approvalRevision,
|
|
244
245
|
sessionOptionRevision: snapshot.revision.sessionOptionRevision, queueRevision: snapshot.revision.queueRevision },
|
|
245
246
|
eventCursor: snapshot.revision.eventCursor, entries: this.#input.sessionEntries?.() ?? [], beforeCursor, limit,
|
|
246
|
-
generatedAt: snapshot.generatedAt });
|
|
247
|
+
generatedAt: snapshot.generatedAt, taskOutcome: typeof activeTask?.trace?.outcome === "string" ? activeTask.trace.outcome : null });
|
|
247
248
|
}
|
|
248
249
|
async queue(): Promise<unknown> {
|
|
249
250
|
if (!this.#input.queueProjection) throw new ReadModelNotFound();
|
|
@@ -32,6 +32,7 @@ export type TranscriptProjectionInput = {
|
|
|
32
32
|
beforeCursor?: string | null;
|
|
33
33
|
limit?: number;
|
|
34
34
|
generatedAt?: string;
|
|
35
|
+
taskOutcome?: string | null;
|
|
35
36
|
};
|
|
36
37
|
|
|
37
38
|
function hash(value: string): string { return createHash("sha256").update(value).digest("hex"); }
|
|
@@ -159,6 +160,89 @@ function item(entry: any, identity: TranscriptIdentity): TranscriptItem | null {
|
|
|
159
160
|
agentOperationId: null, turnIndex: null, content, ...(userProjection.attachments.length ? { attachments: userProjection.attachments } : {}),
|
|
160
161
|
toolCalls: projectedToolCalls };
|
|
161
162
|
}
|
|
163
|
+
|
|
164
|
+
type ProjectedTranscriptItem = { entry: any; item: TranscriptItem; cursor: string };
|
|
165
|
+
|
|
166
|
+
function linkTranscriptTurns(values: ProjectedTranscriptItem[]): ProjectedTranscriptItem[] {
|
|
167
|
+
let userMessageRef: string | null = null;
|
|
168
|
+
const toolCallOwners = new Map<string, string>();
|
|
169
|
+
return values.map((value) => {
|
|
170
|
+
let parentMessageRef: string | null = null;
|
|
171
|
+
if (value.item.role === "user") userMessageRef = value.item.messageRef;
|
|
172
|
+
else if (value.item.role === "tool-result") {
|
|
173
|
+
parentMessageRef = toolCallOwners.get(value.item.toolCalls[0]?.toolCallRef ?? "") ?? userMessageRef;
|
|
174
|
+
} else parentMessageRef = userMessageRef;
|
|
175
|
+
const linked = { ...value, item: { ...value.item, parentMessageRef } };
|
|
176
|
+
if (linked.item.role === "assistant") {
|
|
177
|
+
for (const toolCall of linked.item.toolCalls) toolCallOwners.set(toolCall.toolCallRef, linked.item.messageRef);
|
|
178
|
+
}
|
|
179
|
+
return linked;
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function suppressOpenTaskHandoff(values: ProjectedTranscriptItem[], taskOutcome: string | null | undefined): ProjectedTranscriptItem[] {
|
|
184
|
+
if (taskOutcome !== "pending") return values;
|
|
185
|
+
let latestUser = -1;
|
|
186
|
+
for (let index = values.length - 1; index >= 0; index -= 1) {
|
|
187
|
+
if (values[index]?.item.role === "user") { latestUser = index; break; }
|
|
188
|
+
}
|
|
189
|
+
if (latestUser < 0) return values;
|
|
190
|
+
return values.map((value, index) => {
|
|
191
|
+
if (index <= latestUser || value.item.role !== "assistant" || value.item.toolCalls.length > 0
|
|
192
|
+
|| !["available", "redacted"].includes(value.item.content.state)) return value;
|
|
193
|
+
return { ...value, item: { ...value.item, content: unavailableContent("assistant-task-pending") } };
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function durableAssistant(item: TranscriptItem): boolean {
|
|
198
|
+
return item.role === "assistant" && item.toolCalls.length === 0
|
|
199
|
+
&& (item.content.state === "available" || item.content.state === "redacted")
|
|
200
|
+
&& hasVisibleText(item.content.text ?? "");
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function compactOversizedTurn(
|
|
204
|
+
values: ProjectedTranscriptItem[], start: number, end: number, limit: number
|
|
205
|
+
): ProjectedTranscriptItem[] {
|
|
206
|
+
if (limit === 1) return [values[start]!];
|
|
207
|
+
const selected = new Set<number>([start]);
|
|
208
|
+
for (let index = end - 1; index > start; index -= 1) {
|
|
209
|
+
if (durableAssistant(values[index]!.item)) { selected.add(index); break; }
|
|
210
|
+
}
|
|
211
|
+
for (let index = end - 1; index > start && selected.size < limit; index -= 1) selected.add(index);
|
|
212
|
+
return [...selected].sort((left, right) => left - right).map((index) => values[index]!);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function boundedTurnPage(
|
|
216
|
+
values: ProjectedTranscriptItem[], end: number, limit: number
|
|
217
|
+
): { selected: ProjectedTranscriptItem[]; start: number; compacted: boolean } {
|
|
218
|
+
if (end <= 0) return { selected: [], start: 0, compacted: false };
|
|
219
|
+
const users: number[] = [];
|
|
220
|
+
for (let index = 0; index < end; index += 1) if (values[index]?.item.role === "user") users.push(index);
|
|
221
|
+
if (users.length === 0) {
|
|
222
|
+
const start = Math.max(0, end - limit);
|
|
223
|
+
return { selected: values.slice(start, end), start, compacted: false };
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const selected: ProjectedTranscriptItem[] = [];
|
|
227
|
+
let remaining = limit, turnEnd = end, start = end;
|
|
228
|
+
for (let userIndex = users.length - 1; userIndex >= 0 && remaining > 0; userIndex -= 1) {
|
|
229
|
+
const turnStart = users[userIndex]!;
|
|
230
|
+
const turnSize = turnEnd - turnStart;
|
|
231
|
+
if (turnSize > remaining) {
|
|
232
|
+
if (selected.length === 0) {
|
|
233
|
+
const compacted = compactOversizedTurn(values, turnStart, turnEnd, remaining);
|
|
234
|
+
return { selected: compacted, start: turnStart, compacted: true };
|
|
235
|
+
}
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
selected.unshift(...values.slice(turnStart, turnEnd));
|
|
239
|
+
start = turnStart;
|
|
240
|
+
remaining -= turnSize;
|
|
241
|
+
turnEnd = turnStart;
|
|
242
|
+
}
|
|
243
|
+
return { selected, start, compacted: false };
|
|
244
|
+
}
|
|
245
|
+
|
|
162
246
|
function unavailable(input: TranscriptProjectionInput, reasonCode: string, limit: number): TranscriptDocument {
|
|
163
247
|
return { schemaVersion: 1, version: "piagent-webui-transcript-v1", generatedAt: input.generatedAt ?? new Date().toISOString(),
|
|
164
248
|
identity: structuredClone(input.identity), revision: structuredClone(input.revision), eventCursor: input.eventCursor,
|
|
@@ -168,17 +252,19 @@ function unavailable(input: TranscriptProjectionInput, reasonCode: string, limit
|
|
|
168
252
|
export function projectTranscript(input: TranscriptProjectionInput): TranscriptDocument {
|
|
169
253
|
const limit = Math.max(1, Math.min(MAX_ITEMS, Number.isInteger(input.limit) ? Number(input.limit) : 50));
|
|
170
254
|
if (!Array.isArray(input.entries) || input.entries.length > MAX_ENTRIES) return unavailable(input, "transcript-history-unavailable", limit);
|
|
171
|
-
const projected = input.entries.map((entry) => ({ entry, item: item(entry, input.identity)
|
|
172
|
-
|
|
255
|
+
const projected = suppressOpenTaskHandoff(linkTranscriptTurns(input.entries.map((entry) => ({ entry, item: item(entry, input.identity),
|
|
256
|
+
cursor: opaque("transcript", [input.identity.sessionRef, (entry as any)?.id]) }))
|
|
257
|
+
.filter((value): value is ProjectedTranscriptItem => Boolean(value.item))), input.taskOutcome);
|
|
258
|
+
const cursors = projected.map((value) => value.cursor);
|
|
173
259
|
let end = projected.length;
|
|
174
260
|
if (input.beforeCursor) {
|
|
175
261
|
const cursorIndex = cursors.indexOf(input.beforeCursor);
|
|
176
262
|
if (cursorIndex < 0) return unavailable(input, "transcript-cursor-gap", limit);
|
|
177
263
|
end = cursorIndex;
|
|
178
264
|
}
|
|
179
|
-
const
|
|
265
|
+
const page = boundedTurnPage(projected, end, limit), selected = page.selected.map((value) => value.item), hasOlder = page.start > 0;
|
|
180
266
|
return { schemaVersion: 1, version: "piagent-webui-transcript-v1", generatedAt: input.generatedAt ?? new Date().toISOString(),
|
|
181
267
|
identity: structuredClone(input.identity), revision: structuredClone(input.revision), eventCursor: input.eventCursor,
|
|
182
|
-
state: "ready", items: selected, page: { beforeCursor: input.beforeCursor ?? null, nextBeforeCursor: hasOlder ? cursors[start] : null,
|
|
183
|
-
hasOlder, limit, truncated: projected.length !== input.entries.filter((entry: any) => entry?.type === "message").length }, reasonCode: null };
|
|
268
|
+
state: "ready", items: selected, page: { beforeCursor: input.beforeCursor ?? null, nextBeforeCursor: hasOlder ? cursors[page.start] : null,
|
|
269
|
+
hasOlder, limit, truncated: page.compacted || projected.length !== input.entries.filter((entry: any) => entry?.type === "message").length }, reasonCode: null };
|
|
184
270
|
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/Vt-mmm/piagent/schemas/codex-relative-efficiency-v1.schema.json",
|
|
4
|
+
"title": "Piagent Codex-relative efficiency evidence v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schemaVersion", "policy", "required", "claim", "billedOrSubscriptionCost", "costBoundary", "checks", "failures", "passed", "families", "totalTokenTraffic", "apiEquivalentCost", "subagents"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schemaVersion": { "const": 1 },
|
|
10
|
+
"policy": { "$ref": "#/$defs/policy" },
|
|
11
|
+
"required": { "type": "boolean" },
|
|
12
|
+
"claim": { "type": "string", "minLength": 1 },
|
|
13
|
+
"billedOrSubscriptionCost": { "const": false },
|
|
14
|
+
"costBoundary": { "type": "string", "minLength": 1 },
|
|
15
|
+
"checks": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"minProperties": 1,
|
|
18
|
+
"additionalProperties": { "type": "boolean" }
|
|
19
|
+
},
|
|
20
|
+
"failures": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
|
|
21
|
+
"passed": { "type": "boolean" },
|
|
22
|
+
"families": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/family" } },
|
|
23
|
+
"totalTokenTraffic": { "$ref": "#/$defs/aggregateTokens" },
|
|
24
|
+
"apiEquivalentCost": { "$ref": "#/$defs/aggregateCost" },
|
|
25
|
+
"subagents": { "$ref": "#/$defs/subagents" }
|
|
26
|
+
},
|
|
27
|
+
"$defs": {
|
|
28
|
+
"nullableNonNegativeNumber": { "type": ["number", "null"], "minimum": 0 },
|
|
29
|
+
"nullablePositiveNumber": { "type": ["number", "null"], "exclusiveMinimum": 0 },
|
|
30
|
+
"confidence": {
|
|
31
|
+
"type": ["object", "null"],
|
|
32
|
+
"additionalProperties": false,
|
|
33
|
+
"required": ["lower", "upper", "sampleUnit", "scenarioCount"],
|
|
34
|
+
"properties": {
|
|
35
|
+
"lower": { "type": "number", "exclusiveMinimum": 0 },
|
|
36
|
+
"upper": { "type": "number", "exclusiveMinimum": 0 },
|
|
37
|
+
"sampleUnit": { "const": "scenario-family" },
|
|
38
|
+
"scenarioCount": { "type": "integer", "minimum": 2 }
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"policy": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"additionalProperties": false,
|
|
44
|
+
"required": ["schemaVersion", "id", "baselineSurface", "candidateSurface", "estimand", "outcomeConditioning", "attemptPolicy", "maximumTotalTokenTrafficRatio", "maximumTotalTokenTrafficRatioUpper95", "maximumApiEquivalentCostRatio", "maximumApiEquivalentCostRatioUpper95", "maximumSubagentSessionsPerAttempt", "maximumSubagentTrafficShare"],
|
|
45
|
+
"properties": {
|
|
46
|
+
"schemaVersion": { "const": 1 },
|
|
47
|
+
"id": { "const": "codex-relative-efficiency-v1" },
|
|
48
|
+
"baselineSurface": { "const": "codex-cli" },
|
|
49
|
+
"candidateSurface": { "const": "piagent" },
|
|
50
|
+
"estimand": { "const": "fixed-workload-family-geometric-mean" },
|
|
51
|
+
"outcomeConditioning": { "const": "none" },
|
|
52
|
+
"attemptPolicy": { "const": "accepted-plus-exact-provider-started-failed-attempts" },
|
|
53
|
+
"maximumTotalTokenTrafficRatio": { "type": "number", "exclusiveMinimum": 0, "maximum": 0.7 },
|
|
54
|
+
"maximumTotalTokenTrafficRatioUpper95": { "type": "number", "exclusiveMinimum": 0, "maximum": 0.7 },
|
|
55
|
+
"maximumApiEquivalentCostRatio": { "type": "number", "exclusiveMinimum": 0, "maximum": 0.7 },
|
|
56
|
+
"maximumApiEquivalentCostRatioUpper95": { "type": "number", "exclusiveMinimum": 0, "maximum": 0.7 },
|
|
57
|
+
"maximumSubagentSessionsPerAttempt": { "type": "integer", "minimum": 0, "maximum": 1 },
|
|
58
|
+
"maximumSubagentTrafficShare": { "type": "number", "minimum": 0, "maximum": 0.05 }
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"family": {
|
|
62
|
+
"type": "object",
|
|
63
|
+
"additionalProperties": false,
|
|
64
|
+
"required": ["scenarioId", "expectedAttempts", "pairedAttempts", "exact", "issues", "baselineTokenTraffic", "candidateTokenTraffic", "totalTokenTrafficRatio", "baselineApiEquivalentCostUsd", "candidateApiEquivalentCostUsd", "apiEquivalentCostRatio", "candidateSubagentSessions", "candidateSubagentTraffic", "maximumSubagentSessionsPerAttempt", "candidateAttempts", "subagentEvidenceComplete"],
|
|
65
|
+
"properties": {
|
|
66
|
+
"scenarioId": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" },
|
|
67
|
+
"expectedAttempts": { "type": ["integer", "null"], "minimum": 1 },
|
|
68
|
+
"pairedAttempts": { "type": "integer", "minimum": 0 },
|
|
69
|
+
"exact": { "type": "boolean" },
|
|
70
|
+
"issues": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
|
|
71
|
+
"baselineTokenTraffic": { "type": "number", "minimum": 0 },
|
|
72
|
+
"candidateTokenTraffic": { "type": "number", "minimum": 0 },
|
|
73
|
+
"totalTokenTrafficRatio": { "$ref": "#/$defs/nullablePositiveNumber" },
|
|
74
|
+
"baselineApiEquivalentCostUsd": { "type": "number", "minimum": 0 },
|
|
75
|
+
"candidateApiEquivalentCostUsd": { "type": "number", "minimum": 0 },
|
|
76
|
+
"apiEquivalentCostRatio": { "$ref": "#/$defs/nullablePositiveNumber" },
|
|
77
|
+
"candidateSubagentSessions": { "type": "integer", "minimum": 0 },
|
|
78
|
+
"candidateSubagentTraffic": { "type": "integer", "minimum": 0 },
|
|
79
|
+
"maximumSubagentSessionsPerAttempt": { "type": "integer", "minimum": 0 },
|
|
80
|
+
"candidateAttempts": { "type": "integer", "minimum": 0 },
|
|
81
|
+
"subagentEvidenceComplete": { "type": "boolean" }
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"aggregateBase": {
|
|
85
|
+
"type": "object",
|
|
86
|
+
"required": ["complete", "expectedScenarioFamilies", "completeScenarioFamilies", "ratio", "ratioConfidence95", "ratioConfidence95Raw", "aggregateRatio", "deltaPercent"],
|
|
87
|
+
"properties": {
|
|
88
|
+
"complete": { "type": "boolean" },
|
|
89
|
+
"expectedScenarioFamilies": { "type": "integer", "minimum": 1 },
|
|
90
|
+
"completeScenarioFamilies": { "type": "integer", "minimum": 0 },
|
|
91
|
+
"ratio": { "$ref": "#/$defs/nullablePositiveNumber" },
|
|
92
|
+
"ratioConfidence95": { "$ref": "#/$defs/confidence" },
|
|
93
|
+
"ratioConfidence95Raw": { "$ref": "#/$defs/confidence" },
|
|
94
|
+
"aggregateRatio": { "$ref": "#/$defs/nullableNonNegativeNumber" },
|
|
95
|
+
"deltaPercent": { "type": ["number", "null"] }
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"aggregateTokens": {
|
|
99
|
+
"allOf": [
|
|
100
|
+
{ "$ref": "#/$defs/aggregateBase" },
|
|
101
|
+
{
|
|
102
|
+
"type": "object",
|
|
103
|
+
"additionalProperties": false,
|
|
104
|
+
"required": ["complete", "expectedScenarioFamilies", "completeScenarioFamilies", "ratio", "ratioConfidence95", "ratioConfidence95Raw", "aggregateBaselineTokens", "aggregateCandidateTokens", "aggregateRatio", "deltaPercent"],
|
|
105
|
+
"properties": {
|
|
106
|
+
"complete": true,
|
|
107
|
+
"expectedScenarioFamilies": true,
|
|
108
|
+
"completeScenarioFamilies": true,
|
|
109
|
+
"ratio": true,
|
|
110
|
+
"ratioConfidence95": true,
|
|
111
|
+
"ratioConfidence95Raw": true,
|
|
112
|
+
"aggregateRatio": true,
|
|
113
|
+
"deltaPercent": true,
|
|
114
|
+
"aggregateBaselineTokens": { "type": "number", "minimum": 0 },
|
|
115
|
+
"aggregateCandidateTokens": { "type": "number", "minimum": 0 }
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
"aggregateCost": {
|
|
121
|
+
"allOf": [
|
|
122
|
+
{ "$ref": "#/$defs/aggregateBase" },
|
|
123
|
+
{
|
|
124
|
+
"type": "object",
|
|
125
|
+
"additionalProperties": false,
|
|
126
|
+
"required": ["complete", "expectedScenarioFamilies", "completeScenarioFamilies", "ratio", "ratioConfidence95", "ratioConfidence95Raw", "aggregateBaselineUsd", "aggregateCandidateUsd", "aggregateRatio", "deltaPercent"],
|
|
127
|
+
"properties": {
|
|
128
|
+
"complete": true,
|
|
129
|
+
"expectedScenarioFamilies": true,
|
|
130
|
+
"completeScenarioFamilies": true,
|
|
131
|
+
"ratio": true,
|
|
132
|
+
"ratioConfidence95": true,
|
|
133
|
+
"ratioConfidence95Raw": true,
|
|
134
|
+
"aggregateRatio": true,
|
|
135
|
+
"deltaPercent": true,
|
|
136
|
+
"aggregateBaselineUsd": { "type": "number", "minimum": 0 },
|
|
137
|
+
"aggregateCandidateUsd": { "type": "number", "minimum": 0 }
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
"subagents": {
|
|
143
|
+
"type": "object",
|
|
144
|
+
"additionalProperties": false,
|
|
145
|
+
"required": ["candidateAttempts", "sessions", "tokenTraffic", "trafficShare", "maximumObservedSessionsPerAttempt"],
|
|
146
|
+
"properties": {
|
|
147
|
+
"candidateAttempts": { "type": "integer", "minimum": 0 },
|
|
148
|
+
"sessions": { "type": "integer", "minimum": 0 },
|
|
149
|
+
"tokenTraffic": { "type": "integer", "minimum": 0 },
|
|
150
|
+
"trafficShare": { "$ref": "#/$defs/nullableNonNegativeNumber" },
|
|
151
|
+
"maximumObservedSessionsPerAttempt": { "type": "integer", "minimum": 0 }
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -2962,11 +2962,21 @@
|
|
|
2962
2962
|
},
|
|
2963
2963
|
"then": {
|
|
2964
2964
|
"type": "object",
|
|
2965
|
-
"
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2965
|
+
"oneOf": [
|
|
2966
|
+
{
|
|
2967
|
+
"properties": {
|
|
2968
|
+
"isError": { "const": false },
|
|
2969
|
+
"exitCode": { "anyOf": [{ "const": 0 }, { "type": "null" }] },
|
|
2970
|
+
"reasonCode": { "type": "null" }
|
|
2971
|
+
}
|
|
2972
|
+
},
|
|
2973
|
+
{
|
|
2974
|
+
"properties": {
|
|
2975
|
+
"isError": { "const": false },
|
|
2976
|
+
"reasonCode": { "const": "search-target-missing" }
|
|
2977
|
+
}
|
|
2978
|
+
}
|
|
2979
|
+
]
|
|
2970
2980
|
}
|
|
2971
2981
|
},
|
|
2972
2982
|
{
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"title": "Piagent WebUI bounded subagent ownership tree v1",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"additionalProperties": false,
|
|
7
|
-
"required": ["schemaVersion", "version", "generatedAt", "identity", "runRef", "state", "treeRevision", "evidenceState", "orchestration", "parent", "children", "writer", "nestedLineage", "summary", "warnings", "health"],
|
|
7
|
+
"required": ["schemaVersion", "version", "generatedAt", "identity", "runRef", "state", "treeRevision", "evidenceState", "orchestration", "delegation", "parent", "children", "writer", "nestedLineage", "summary", "warnings", "health"],
|
|
8
8
|
"properties": {
|
|
9
9
|
"schemaVersion": { "const": 1 },
|
|
10
10
|
"version": { "const": "piagent-webui-subagent-tree-v1" },
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"treeRevision": { "$ref": "common-v1.schema.json#/$defs/nullableRevisionToken" },
|
|
16
16
|
"evidenceState": { "enum": ["complete", "partial", "aggregate-only", "missing", "unknown"] },
|
|
17
17
|
"orchestration": { "$ref": "#/$defs/orchestration" },
|
|
18
|
+
"delegation": { "$ref": "#/$defs/delegation" },
|
|
18
19
|
"parent": { "anyOf": [{ "$ref": "#/$defs/parent" }, { "type": "null" }] },
|
|
19
20
|
"children": { "type": "array", "maxItems": 64, "items": { "$ref": "#/$defs/child" } },
|
|
20
21
|
"writer": { "$ref": "#/$defs/writer" },
|
|
@@ -51,6 +52,15 @@
|
|
|
51
52
|
"mode": { "enum": ["solo-first", "bounded-subagents", "parallel-readonly", "unknown"] },
|
|
52
53
|
"subagents": { "enum": ["not-used", "optional", "used", "unknown"] }
|
|
53
54
|
} },
|
|
55
|
+
"delegation": { "type": "object", "additionalProperties": false, "required": ["action", "reasonCodes", "projectedNetSavingsRatio", "minimumRequiredNetSavingsRatio", "budget"], "properties": {
|
|
56
|
+
"action": { "enum": ["dispatch", "skip", "unknown"] },
|
|
57
|
+
"reasonCodes": { "type": "array", "maxItems": 16, "uniqueItems": true, "items": { "type": "string", "pattern": "^[a-z0-9_.:-]+$" } },
|
|
58
|
+
"projectedNetSavingsRatio": { "type": ["number", "null"], "minimum": -10, "maximum": 1 },
|
|
59
|
+
"minimumRequiredNetSavingsRatio": { "const": 0.3 },
|
|
60
|
+
"budget": { "type": "object", "additionalProperties": false, "required": ["maxConcurrent", "maxTotal", "maxRetries", "maxWriters"], "properties": {
|
|
61
|
+
"maxConcurrent": { "const": 1 }, "maxTotal": { "const": 1 }, "maxRetries": { "const": 0 }, "maxWriters": { "const": 0 }
|
|
62
|
+
} }
|
|
63
|
+
} },
|
|
54
64
|
"parent": { "type": "object", "additionalProperties": false, "required": ["nodeRef", "lifecycleState", "budgetTerminal", "mergeOwner"], "properties": {
|
|
55
65
|
"nodeRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" }, "lifecycleState": { "enum": ["active", "terminal", "unknown"] },
|
|
56
66
|
"budgetTerminal": { "type": ["boolean", "null"] }, "mergeOwner": { "const": "parent" }
|
|
@@ -410,6 +410,8 @@
|
|
|
410
410
|
"properties": {
|
|
411
411
|
"mode": { "enum": ["off", "recommend", "on"] },
|
|
412
412
|
"used": { "type": "boolean" },
|
|
413
|
+
"decision": { "enum": ["dispatch", "skip"] },
|
|
414
|
+
"projectedSavingsRatio": { "type": ["number", "null"], "minimum": -10, "maximum": 1 },
|
|
413
415
|
"reasonCodes": { "type": "array", "maxItems": 16, "uniqueItems": true, "items": { "type": "string", "pattern": "^[a-z0-9_.:-]+$" } },
|
|
414
416
|
"helpers": {
|
|
415
417
|
"type": "array", "maxItems": 3,
|
|
@@ -540,6 +542,15 @@
|
|
|
540
542
|
"type": "string",
|
|
541
543
|
"minLength": 10
|
|
542
544
|
},
|
|
545
|
+
"operatorRequest": {
|
|
546
|
+
"type": "string",
|
|
547
|
+
"minLength": 1,
|
|
548
|
+
"maxLength": 8000
|
|
549
|
+
},
|
|
550
|
+
"operatorRequestDigest": {
|
|
551
|
+
"type": "string",
|
|
552
|
+
"pattern": "^operator-request-v1:[a-f0-9]{64}$"
|
|
553
|
+
},
|
|
543
554
|
"riskLane": {
|
|
544
555
|
"enum": [
|
|
545
556
|
"tiny",
|
|
@@ -869,6 +880,10 @@
|
|
|
869
880
|
"format": "date-time"
|
|
870
881
|
}
|
|
871
882
|
},
|
|
883
|
+
"dependentRequired": {
|
|
884
|
+
"operatorRequest": ["operatorRequestDigest"],
|
|
885
|
+
"operatorRequestDigest": ["operatorRequest"]
|
|
886
|
+
},
|
|
872
887
|
"allOf": [
|
|
873
888
|
{
|
|
874
889
|
"if": { "properties": { "changeMode": { "const": "read-only" } }, "required": ["changeMode"] },
|
|
@@ -10,6 +10,7 @@ import { codexModelName, codexThinkingEffort } from "../packages/piagent-core/be
|
|
|
10
10
|
import { benchmarkEnvironment, benchmarkEnvironmentPolicy, comparisonSurfaces, createCodexRuntime, piagentTreatment } from "../packages/piagent-core/benchmark/benchmark-runtime.js";
|
|
11
11
|
import { assertBenchmarkPiCredentialReady, assertBenchmarkPiCredentialWritebackPolicy, cleanupBenchmarkPiRuntimeHome, createBenchmarkPiRuntimeHome, resetBenchmarkPiRuntimeEphemeralState, withBenchmarkPiCredentialWriteback } from "../packages/piagent-core/benchmark/benchmark-pi-home.js";
|
|
12
12
|
import { benchmarkPreflight, benchmarkPreflightReceipt } from "../packages/piagent-core/benchmark/benchmark-preflight.js";
|
|
13
|
+
import { prepareProductionProviderFreeEvidence, productionProviderFreeEvidenceError } from "../packages/piagent-core/benchmark/benchmark-provider-free-evidence.js";
|
|
13
14
|
import { applyBenchmarkExecutionDefaults } from "../packages/piagent-core/benchmark/benchmark-runner-policy.js";
|
|
14
15
|
import {
|
|
15
16
|
appendPrivateJsonl,
|
|
@@ -32,7 +33,7 @@ import {
|
|
|
32
33
|
buildBenchmarkStageDiagnostic,
|
|
33
34
|
createProductionStageControl,
|
|
34
35
|
durablePairedOutcomeFloorStop,
|
|
35
|
-
productionSpendControlValidationErrors,
|
|
36
|
+
productionGuardBindingMatches, productionSpendControlValidationErrors,
|
|
36
37
|
productionStageResumeDisposition
|
|
37
38
|
} from "../packages/piagent-core/benchmark/benchmark-stage-diagnostic.js";
|
|
38
39
|
import { loadBenchmarkAssuranceEvidence, loadBenchmarkSuite, resolveBenchmarkSuiteEntry, validateBenchmarkSuiteFiles } from "../packages/piagent-core/benchmark/benchmark-suite-runtime.js";
|
|
@@ -103,7 +104,6 @@ async function runLegacy(argv) {
|
|
|
103
104
|
const result = await runCommand("bash", [path.join(packageRoot, "scripts", "quality-benchmark.sh"), ...argv], { cwd: process.cwd(), inherit: true });
|
|
104
105
|
process.exitCode = result.code;
|
|
105
106
|
}
|
|
106
|
-
|
|
107
107
|
async function main() {
|
|
108
108
|
const argv = process.argv.slice(2);
|
|
109
109
|
if (isLegacyInvocation(argv)) return runLegacy(argv);
|
|
@@ -268,6 +268,7 @@ async function main() {
|
|
|
268
268
|
if (resumeState) {
|
|
269
269
|
const manifest = resumeState.manifest;
|
|
270
270
|
if (manifest.suiteDigest !== suiteDigest) fail("Cannot resume benchmark: suite files changed since the original run", 1);
|
|
271
|
+
if (productionSpendControlled && !productionGuardBindingMatches(manifest, productionSpendControl)) fail("Cannot resume production benchmark: frozen production guard binding is missing or changed", 1);
|
|
271
272
|
if (manifest.rootSeed !== rootSeed) fail("Cannot resume benchmark: root seed mismatch", 1);
|
|
272
273
|
if (manifest.repeats !== options.repeats) fail("Cannot resume benchmark: repeat count mismatch", 1);
|
|
273
274
|
if (!sameStringList(manifest.surfaces, options.surfaces)) fail("Cannot resume benchmark: surface list mismatch", 1);
|
|
@@ -528,6 +529,10 @@ async function main() {
|
|
|
528
529
|
order: fullOrder.map((item) => ({ scenarioId: item.scenario.id, surface: item.surface, repeat: item.repeat }))
|
|
529
530
|
};
|
|
530
531
|
const configurationDigest = crypto.createHash("sha256").update(JSON.stringify(configuration)).digest("hex");
|
|
532
|
+
const source = bootstrapMetadata?.sourceIdentity;
|
|
533
|
+
if (!source) fail("Modern benchmark is missing its frozen Git source identity", 1);
|
|
534
|
+
const { receipt: providerFreeEvidence, binding: providerFreeEvidenceBinding } = await prepareProductionProviderFreeEvidence({
|
|
535
|
+
required: productionSpendControl?.productionGuards?.providerFreeEvidence?.requiredBeforeFirstPaidSession === true, packageRoot, bootstrapMetadata, candidateProvenance: candidateGuard.provenance, configurationDigest, runCommand, resumedReceipt: resumeState ? resumeState.manifest.providerFreeEvidence ?? null : undefined });
|
|
531
536
|
piCommand = runtimeCommands.pi.resolvedPath;
|
|
532
537
|
if (runtimeCommands.codex) codexCommand = runtimeCommands.codex.resolvedPath;
|
|
533
538
|
if (resumeState && JSON.stringify(resumeState.manifest.runtimeCommands ?? null) !== JSON.stringify(runtimeCommands)) {
|
|
@@ -610,10 +615,8 @@ async function main() {
|
|
|
610
615
|
}
|
|
611
616
|
}
|
|
612
617
|
assertHostReadinessStartReady();
|
|
613
|
-
const source = bootstrapMetadata?.sourceIdentity;
|
|
614
|
-
if (!source) fail("Modern benchmark is missing its frozen Git source identity", 1);
|
|
615
618
|
if (options.preflightOnly) {
|
|
616
|
-
const receipt = benchmarkPreflightReceipt({ packageVersion: packageManifest.version, source, candidateProvenance: candidateGuard.report(), suite, suiteDigest, runtimeDependencies: bootstrapMetadata.runtimeDependencies, runtimeCommands, environmentPolicy, configurationDigest, rootSeedDigest, options, runtime, hostReadinessPolicyDigest: productionHostReadinessPolicyDigest, hostReadiness: hostReadinessReceipt });
|
|
619
|
+
const receipt = benchmarkPreflightReceipt({ packageVersion: packageManifest.version, source, candidateProvenance: candidateGuard.report(), suite, suiteDigest, runtimeDependencies: bootstrapMetadata.runtimeDependencies, runtimeCommands, environmentPolicy, configurationDigest, rootSeedDigest, options, runtime, hostReadinessPolicyDigest: productionHostReadinessPolicyDigest, hostReadiness: hostReadinessReceipt, providerFreeEvidence });
|
|
617
620
|
process.stdout.write(options.json ? `${JSON.stringify(receipt, null, 2)}\n` : `${plan}${codexPlan}\nPREFLIGHT READY: no model session started.\n${JSON.stringify(receipt, null, 2)}\n`);
|
|
618
621
|
return;
|
|
619
622
|
}
|
|
@@ -676,6 +679,8 @@ async function main() {
|
|
|
676
679
|
stopAfterFailedPair: options.stopAfterFailedPair,
|
|
677
680
|
scenarioIds: options.scenarioIds ?? null,
|
|
678
681
|
...(productionSpendControlled ? {
|
|
682
|
+
productionGuards: productionSpendControl.productionGuards,
|
|
683
|
+
providerFreeEvidence,
|
|
679
684
|
stageControl: createProductionStageControl({
|
|
680
685
|
authorizedThroughRuns: productionStageBoundaries[0],
|
|
681
686
|
generatedAt: startedAt
|
|
@@ -912,8 +917,11 @@ async function main() {
|
|
|
912
917
|
}
|
|
913
918
|
let finalizationReceipt;
|
|
914
919
|
if (!interruptedSignal && !fatalRunError) {
|
|
920
|
+
if (productionSpendControl?.productionGuards?.providerFreeEvidence?.requiredBeforeFirstPaidSession === true) {
|
|
921
|
+
fatalRunError ??= productionProviderFreeEvidenceError(manifest.providerFreeEvidence, providerFreeEvidenceBinding, "final production provider-free evidence");
|
|
922
|
+
}
|
|
915
923
|
finalizationReceipt = executionGuard.receipt("finalization", [piRuntimeHome]);
|
|
916
|
-
fatalRunError
|
|
924
|
+
fatalRunError ??= finalizationReceipt.error;
|
|
917
925
|
}
|
|
918
926
|
finalizeBenchmarkRun({
|
|
919
927
|
assuranceEvidence, bootstrapMetadata, candidateGuard, canonicalProductionSuite,
|
|
@@ -248,6 +248,9 @@ export function finalizeBenchmarkRun(context) {
|
|
|
248
248
|
? options.codexMode === "controlled" ? "excluded" : "operator-home"
|
|
249
249
|
: null,
|
|
250
250
|
piGlobalInstructions: "excluded",
|
|
251
|
+
comparisonAccessContract: options.surfaces.includes("codex-cli") && options.codexMode === "controlled"
|
|
252
|
+
? "paired-workspace-write-offline-surface-system"
|
|
253
|
+
: null,
|
|
251
254
|
piAgentHome: manifest.piAgentHome,
|
|
252
255
|
usageIntegrity: manifest.tokenClaimsUnavailableReason ?? "measured",
|
|
253
256
|
codexDisabledFeatures: runtime.codexDisabledFeatures,
|
|
@@ -268,6 +271,7 @@ export function finalizeBenchmarkRun(context) {
|
|
|
268
271
|
hostReadinessHistory,
|
|
269
272
|
environmentPolicy,
|
|
270
273
|
runtimeDependencies: bootstrapMetadata?.runtimeDependencies ?? null,
|
|
274
|
+
providerFreeEvidence: manifest.providerFreeEvidence ?? null,
|
|
271
275
|
assuranceEvidence
|
|
272
276
|
},
|
|
273
277
|
runs: completedRuns,
|