@sema-agent/server 1.323.0 → 2.0.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/dist/approval-hmac.d.ts +40 -0
- package/dist/approval-hmac.js +67 -0
- package/dist/approval.d.ts +31 -0
- package/dist/approval.js +72 -4
- package/dist/audit.d.ts +26 -0
- package/dist/audit.js +40 -1
- package/dist/auth-bridge.d.ts +10 -0
- package/dist/auth-bridge.js +47 -4
- package/dist/auth-keys.d.ts +19 -0
- package/dist/auth-keys.js +13 -0
- package/dist/bake-runner/main.d.ts +5 -0
- package/dist/bake-runner/main.js +43 -4
- package/dist/bake-runner/protocol.d.ts +57 -0
- package/dist/bake-runner/protocol.js +58 -3
- package/dist/bake-runner/runner.d.ts +54 -0
- package/dist/bake-runner/runner.js +87 -5
- package/dist/bench/l8/artifact.d.ts +63 -0
- package/dist/bench/l8/artifact.js +61 -2
- package/dist/bench/l8/escape.d.ts +36 -0
- package/dist/bench/l8/escape.js +25 -0
- package/dist/bench/l8/index.d.ts +14 -0
- package/dist/bench/l8/index.js +14 -0
- package/dist/bench/l8/probes.d.ts +74 -0
- package/dist/bench/l8/probes.js +60 -0
- package/dist/bench/l8/run-probes.d.ts +43 -0
- package/dist/bench/l8/run-probes.js +45 -2
- package/dist/bench/s1/arms.d.ts +126 -0
- package/dist/bench/s1/arms.js +188 -13
- package/dist/bench/s1/live-deps.d.ts +66 -0
- package/dist/bench/s1/live-deps.js +249 -11
- package/dist/bench/s1/oracle.d.ts +49 -0
- package/dist/bench/s1/oracle.js +36 -1
- package/dist/bench/s1/repair-oracle-adapter.d.ts +33 -0
- package/dist/bench/s1/repair-oracle-adapter.js +30 -0
- package/dist/bench/s1/reviewer.d.ts +38 -0
- package/dist/bench/s1/reviewer.js +34 -0
- package/dist/bench/s1/row.d.ts +77 -0
- package/dist/bench/s1/row.js +62 -0
- package/dist/bench/s1/run-firm.d.ts +47 -0
- package/dist/bench/s1/run-firm.js +70 -4
- package/dist/bench/s1/runner-ctx.d.ts +71 -0
- package/dist/bench/s1/runner-ctx.js +36 -0
- package/dist/bench/s1/tasks.d.ts +108 -0
- package/dist/bench/s1/tasks.js +115 -0
- package/dist/boot-reclaim.d.ts +19 -0
- package/dist/boot-reclaim.js +20 -0
- package/dist/brain.d.ts +25 -0
- package/dist/brain.js +61 -1
- package/dist/budget.d.ts +66 -0
- package/dist/budget.js +128 -4
- package/dist/capabilities/builtin-tools.d.ts +3 -0
- package/dist/capabilities/builtin-tools.js +3 -0
- package/dist/capabilities/center-plugins.d.ts +17 -1
- package/dist/capabilities/center-plugins.js +45 -4
- package/dist/capabilities/center-prompts.d.ts +46 -0
- package/dist/capabilities/center-prompts.js +57 -3
- package/dist/capabilities/code-review-council.d.ts +28 -0
- package/dist/capabilities/code-review-council.js +40 -7
- package/dist/capabilities/collab-wire.d.ts +2 -0
- package/dist/capabilities/collab-workflows.d.ts +7 -0
- package/dist/capabilities/collab-workflows.js +44 -1
- package/dist/capabilities/oa-tools.d.ts +6 -0
- package/dist/capabilities/oa-tools.js +10 -0
- package/dist/capabilities/prompt.d.ts +14 -0
- package/dist/capabilities/prompt.js +14 -0
- package/dist/capabilities/prompts/code-review.d.ts +14 -0
- package/dist/capabilities/prompts/code-review.js +14 -0
- package/dist/capabilities/prompts/identity.d.ts +6 -0
- package/dist/capabilities/prompts/identity.js +6 -0
- package/dist/capabilities/prompts/team.d.ts +4 -0
- package/dist/capabilities/prompts/team.js +4 -0
- package/dist/capabilities/repo-tools.d.ts +11 -0
- package/dist/capabilities/repo-tools.js +8 -0
- package/dist/capabilities/sandbox-file-send.d.ts +95 -0
- package/dist/capabilities/sandbox-file-send.js +91 -3
- package/dist/capabilities/scenarios.d.ts +130 -0
- package/dist/capabilities/scenarios.js +180 -7
- package/dist/capabilities/select-environment-tool.d.ts +7 -0
- package/dist/capabilities/select-environment-tool.js +30 -0
- package/dist/capabilities/send-user-file-tool.d.ts +33 -0
- package/dist/capabilities/send-user-file-tool.js +65 -1
- package/dist/capabilities/skills.d.ts +29 -0
- package/dist/capabilities/skills.js +13 -2
- package/dist/capabilities/team.d.ts +22 -0
- package/dist/capabilities/team.js +22 -2
- package/dist/capabilities/tool-defer.d.ts +26 -0
- package/dist/capabilities/tool-defer.js +3 -0
- package/dist/config-center/apply-effective.d.ts +65 -0
- package/dist/config-center/apply-effective.js +204 -12
- package/dist/config-center/http-client.d.ts +34 -0
- package/dist/config-center/http-client.js +68 -0
- package/dist/config-center/restart-signal.d.ts +22 -0
- package/dist/config-center/restart-signal.js +39 -0
- package/dist/config-center/skills-mcp.d.ts +20 -1
- package/dist/config-center/skills-mcp.js +42 -7
- package/dist/config-center/types.d.ts +92 -1
- package/dist/config-lkg.d.ts +12 -0
- package/dist/config-lkg.js +41 -0
- package/dist/config-provider.d.ts +78 -0
- package/dist/config-provider.js +165 -2
- package/dist/config-types.d.ts +546 -0
- package/dist/config.d.ts +64 -0
- package/dist/config.js +455 -60
- package/dist/degenerate-instrument.d.ts +38 -0
- package/dist/degenerate-instrument.js +55 -3
- package/dist/elicitation.d.ts +39 -0
- package/dist/elicitation.js +87 -3
- package/dist/env-facts.d.ts +61 -0
- package/dist/env-facts.js +73 -7
- package/dist/fleet/fleet-bus.d.ts +185 -0
- package/dist/fleet/fleet-bus.js +333 -27
- package/dist/fleet/subagent-tail-bus.d.ts +11 -0
- package/dist/fleet/subagent-tail-bus.js +33 -2
- package/dist/fleet-client.d.ts +38 -0
- package/dist/fleet-client.js +44 -9
- package/dist/fleet-lease.d.ts +46 -0
- package/dist/fleet-lease.js +73 -5
- package/dist/hooks/branch-transcript.d.ts +8 -0
- package/dist/hooks/branch-transcript.js +33 -0
- package/dist/hooks/cc-stop-prompt.d.ts +42 -0
- package/dist/hooks/cc-stop-prompt.js +43 -1
- package/dist/hooks/hook-llm.d.ts +15 -0
- package/dist/hooks/hook-llm.js +47 -0
- package/dist/hooks/hook-runner.d.ts +89 -0
- package/dist/hooks/hook-runner.js +327 -18
- package/dist/http/idempotency.d.ts +31 -0
- package/dist/http/idempotency.js +34 -0
- package/dist/http/principal-gate.d.ts +17 -0
- package/dist/http/principal-gate.js +35 -3
- package/dist/http/route-ctx.d.ts +36 -0
- package/dist/http/routes/approvals-assistant.d.ts +25 -0
- package/dist/http/routes/approvals-assistant.js +253 -23
- package/dist/http/routes/attachments.js +22 -4
- package/dist/http/routes/capabilities.d.ts +7 -0
- package/dist/http/routes/capabilities.js +202 -1
- package/dist/http/routes/fleet.d.ts +6 -0
- package/dist/http/routes/fleet.js +94 -5
- package/dist/http/routes/images.d.ts +17 -0
- package/dist/http/routes/images.js +222 -14
- package/dist/http/routes/leader.d.ts +7 -0
- package/dist/http/routes/leader.js +10 -0
- package/dist/http/routes/memory-policy.d.ts +6 -0
- package/dist/http/routes/memory-policy.js +38 -6
- package/dist/http/routes/notify-wake.d.ts +10 -0
- package/dist/http/routes/notify-wake.js +19 -3
- package/dist/http/routes/observability.d.ts +6 -0
- package/dist/http/routes/observability.js +19 -2
- package/dist/http/routes/runs.d.ts +15 -0
- package/dist/http/routes/runs.js +464 -41
- package/dist/http/routes/session-sync.d.ts +15 -0
- package/dist/http/routes/session-sync.js +229 -19
- package/dist/http/routes/sessions-list.d.ts +6 -0
- package/dist/http/routes/sessions-list.js +35 -4
- package/dist/http/routes/sessions.d.ts +14 -0
- package/dist/http/routes/sessions.js +176 -31
- package/dist/http/routes/side-query.d.ts +8 -0
- package/dist/http/routes/side-query.js +26 -1
- package/dist/http/routes/tasks.d.ts +18 -0
- package/dist/http/routes/tasks.js +501 -38
- package/dist/http/routes/trace-usage.d.ts +10 -0
- package/dist/http/routes/trace-usage.js +66 -14
- package/dist/http/routes/workflows.d.ts +12 -0
- package/dist/http/routes/workflows.js +180 -19
- package/dist/http/run-meta.d.ts +11 -0
- package/dist/http/run-meta.js +6 -0
- package/dist/http/send.d.ts +19 -0
- package/dist/http/send.js +11 -0
- package/dist/http/server.d.ts +255 -0
- package/dist/http/server.js +921 -75
- package/dist/http/sse-log.d.ts +15 -0
- package/dist/http/sse-log.js +16 -0
- package/dist/http/tar.d.ts +9 -0
- package/dist/http/tar.js +21 -5
- package/dist/http/wire-gate.d.ts +9 -0
- package/dist/http/wire-gate.js +9 -0
- package/dist/http/wire-types.d.ts +187 -0
- package/dist/http/workspace-content.d.ts +8 -0
- package/dist/http/workspace-content.js +10 -0
- package/dist/images/bake-validate.d.ts +63 -0
- package/dist/images/bake-validate.js +71 -1
- package/dist/images/manifest.d.ts +19 -0
- package/dist/images/manifest.js +6 -1
- package/dist/index.d.ts +1 -5
- package/dist/index.js +10 -5
- package/dist/key-resolver.d.ts +23 -0
- package/dist/key-resolver.js +27 -2
- package/dist/leader/diffout.d.ts +23 -0
- package/dist/leader/diffout.js +8 -1
- package/dist/leader/diffup.d.ts +32 -0
- package/dist/leader/diffup.js +43 -0
- package/dist/leader/endpoint.d.ts +20 -0
- package/dist/leader/endpoint.js +25 -2
- package/dist/leader/fanout.d.ts +60 -0
- package/dist/leader/fanout.js +29 -3
- package/dist/leader/grader-env-factory.d.ts +74 -0
- package/dist/leader/grader-env-factory.js +62 -3
- package/dist/leader/leader.d.ts +97 -0
- package/dist/leader/leader.js +151 -4
- package/dist/leader/merge.d.ts +94 -0
- package/dist/leader/merge.js +112 -9
- package/dist/leader/planner.d.ts +52 -0
- package/dist/leader/planner.js +47 -3
- package/dist/leader/repair-oracle.d.ts +61 -0
- package/dist/leader/repair-oracle.js +59 -1
- package/dist/leader/repair-wire.d.ts +78 -0
- package/dist/leader/repair-wire.js +79 -2
- package/dist/leader/wire.d.ts +79 -0
- package/dist/leader/wire.js +255 -8
- package/dist/lsp/e2b-bridge.d.ts +16 -0
- package/dist/lsp/e2b-bridge.js +32 -4
- package/dist/lsp/e2b-manager.d.ts +10 -0
- package/dist/lsp/e2b-manager.js +18 -2
- package/dist/lsp/lsp-frames.d.ts +12 -0
- package/dist/lsp/lsp-frames.js +12 -0
- package/dist/lsp/manager.d.ts +12 -0
- package/dist/lsp/manager.js +35 -2
- package/dist/lsp/types.d.ts +10 -0
- package/dist/lsp/ws-transport.d.ts +12 -0
- package/dist/lsp/ws-transport.js +53 -5
- package/dist/lsp-evict.d.ts +14 -0
- package/dist/lsp-evict.js +15 -1
- package/dist/main.js +2132 -96
- package/dist/memory-export.d.ts +1 -0
- package/dist/memory-export.js +4 -0
- package/dist/memory-scope.d.ts +49 -0
- package/dist/memory-scope.js +87 -4
- package/dist/memory-sync-client.d.ts +24 -0
- package/dist/memory-sync-client.js +41 -2
- package/dist/memory-sync.d.ts +23 -0
- package/dist/memory-sync.js +70 -1
- package/dist/model-select.d.ts +39 -0
- package/dist/model-select.js +42 -1
- package/dist/observability/cost-quota.d.ts +20 -0
- package/dist/observability/cost-quota.js +4 -0
- package/dist/observability/cost-taxonomy.d.ts +45 -0
- package/dist/observability/cost-taxonomy.js +34 -0
- package/dist/observability/logger.d.ts +1 -0
- package/dist/observability/logger.js +6 -0
- package/dist/observability/metrics.d.ts +13 -0
- package/dist/observability/metrics.js +63 -0
- package/dist/observability/otel-exporter.d.ts +9 -0
- package/dist/observability/otel-exporter.js +11 -3
- package/dist/observability/principal-context.d.ts +9 -0
- package/dist/observability/principal-context.js +9 -0
- package/dist/observability/prompt-manifest.d.ts +37 -0
- package/dist/observability/prompt-manifest.js +35 -1
- package/dist/observability/rate-limit.d.ts +10 -0
- package/dist/observability/rate-limit.js +1 -0
- package/dist/observability/tool-trace.d.ts +24 -0
- package/dist/observability/tool-trace.js +41 -1
- package/dist/orchestration/hardened-vm-runner.d.ts +107 -0
- package/dist/orchestration/hardened-vm-runner.js +119 -4
- package/dist/orchestration/hardened-vm-worker-runner.d.ts +14 -0
- package/dist/orchestration/hardened-vm-worker-runner.js +26 -1
- package/dist/orchestration/hardened-vm-worker.js +27 -0
- package/dist/orchestration/subagent-steer.d.ts +44 -0
- package/dist/orchestration/subagent-steer.js +45 -1
- package/dist/orchestration/workflow-agent-steer.d.ts +54 -0
- package/dist/orchestration/workflow-agent-steer.js +80 -1
- package/dist/orchestration/workflow-completion-inbox.d.ts +189 -2
- package/dist/orchestration/workflow-completion-inbox.js +283 -32
- package/dist/orchestration/workflow-notify-journal.d.ts +132 -1
- package/dist/orchestration/workflow-notify-journal.js +187 -13
- package/dist/parked-decide.d.ts +61 -0
- package/dist/parked-decide.js +58 -1
- package/dist/per-task-image.d.ts +54 -0
- package/dist/per-task-image.js +41 -0
- package/dist/plan-cache-probe.d.ts +35 -0
- package/dist/plan-cache-probe.js +18 -3
- package/dist/plugins/approval-exemption-store.d.ts +7 -0
- package/dist/plugins/approval-exemption-store.js +28 -2
- package/dist/plugins/approval-store-sql.d.ts +64 -0
- package/dist/plugins/approval-store-sql.js +32 -0
- package/dist/plugins/background-agent-store-sql.d.ts +55 -0
- package/dist/plugins/background-agent-store-sql.js +91 -4
- package/dist/plugins/background-shell-support.d.ts +98 -0
- package/dist/plugins/background-shell-support.js +117 -13
- package/dist/plugins/blob-backend.d.ts +104 -0
- package/dist/plugins/blob-backend.js +163 -6
- package/dist/plugins/breaker-state-sql.d.ts +65 -1
- package/dist/plugins/breaker-state-sql.js +46 -8
- package/dist/plugins/caching-session-store.d.ts +42 -0
- package/dist/plugins/caching-session-store.js +63 -3
- package/dist/plugins/checkpoint-store-sql.d.ts +179 -0
- package/dist/plugins/checkpoint-store-sql.js +239 -11
- package/dist/plugins/file-outcome-sink.d.ts +4 -0
- package/dist/plugins/file-outcome-sink.js +9 -0
- package/dist/plugins/file-resume-anchor-store.d.ts +20 -0
- package/dist/plugins/file-resume-anchor-store.js +43 -4
- package/dist/plugins/file-run-store.d.ts +90 -0
- package/dist/plugins/file-run-store.js +145 -13
- package/dist/plugins/file-snapshot-store-sql.d.ts +133 -1
- package/dist/plugins/file-snapshot-store-sql.js +178 -10
- package/dist/plugins/file-workflow-journal-store.d.ts +10 -0
- package/dist/plugins/file-workflow-journal-store.js +10 -0
- package/dist/plugins/fork-routing-session-store.d.ts +47 -0
- package/dist/plugins/fork-routing-session-store.js +51 -3
- package/dist/plugins/host-platform.d.ts +69 -0
- package/dist/plugins/host-platform.js +81 -2
- package/dist/plugins/image-bake-store-sql.d.ts +136 -1
- package/dist/plugins/image-bake-store-sql.js +241 -7
- package/dist/plugins/image-index-sql.d.ts +46 -0
- package/dist/plugins/image-index-sql.js +113 -4
- package/dist/plugins/k8s-bg-scripts.d.ts +34 -0
- package/dist/plugins/k8s-bg-scripts.js +88 -4
- package/dist/plugins/k8s-exec-protocol.d.ts +33 -0
- package/dist/plugins/k8s-exec-protocol.js +41 -0
- package/dist/plugins/local-checkpoint-store.d.ts +40 -0
- package/dist/plugins/local-checkpoint-store.js +86 -7
- package/dist/plugins/local-session-store.d.ts +157 -0
- package/dist/plugins/local-session-store.js +289 -34
- package/dist/plugins/local-task-attachment-store.js +14 -2
- package/dist/plugins/mailbox-store-sql.d.ts +38 -0
- package/dist/plugins/mailbox-store-sql.js +39 -6
- package/dist/plugins/memory-engine-pg.d.ts +30 -0
- package/dist/plugins/memory-engine-pg.js +122 -4
- package/dist/plugins/memory-engine-tidb.d.ts +26 -0
- package/dist/plugins/memory-engine-tidb.js +115 -5
- package/dist/plugins/memory-engine-vector-util.d.ts +5 -0
- package/dist/plugins/memory-engine-vector-util.js +5 -0
- package/dist/plugins/memory-resume-anchor-store.d.ts +8 -0
- package/dist/plugins/memory-resume-anchor-store.js +17 -0
- package/dist/plugins/memory-run-store.d.ts +63 -0
- package/dist/plugins/memory-run-store.js +73 -8
- package/dist/plugins/memory-session-policy-store.d.ts +17 -0
- package/dist/plugins/memory-session-policy-store.js +17 -0
- package/dist/plugins/memory-sync-store-pg.d.ts +42 -0
- package/dist/plugins/memory-sync-store-pg.js +45 -2
- package/dist/plugins/memory-sync-store-tidb.d.ts +9 -0
- package/dist/plugins/memory-sync-store-tidb.js +31 -1
- package/dist/plugins/outcome-ledger-sql.d.ts +63 -0
- package/dist/plugins/outcome-ledger-sql.js +97 -3
- package/dist/plugins/pg-approval-store.d.ts +7 -0
- package/dist/plugins/pg-approval-store.js +7 -0
- package/dist/plugins/pg-breaker-state.d.ts +6 -0
- package/dist/plugins/pg-breaker-state.js +6 -0
- package/dist/plugins/pg-checkpoint-store.d.ts +8 -0
- package/dist/plugins/pg-checkpoint-store.js +8 -0
- package/dist/plugins/pg-cost-quota.d.ts +17 -0
- package/dist/plugins/pg-cost-quota.js +6 -0
- package/dist/plugins/pg-file-snapshot-store.d.ts +6 -0
- package/dist/plugins/pg-file-snapshot-store.js +6 -0
- package/dist/plugins/pg-image-bake.d.ts +9 -0
- package/dist/plugins/pg-image-bake.js +9 -0
- package/dist/plugins/pg-image-index.d.ts +9 -0
- package/dist/plugins/pg-image-index.js +9 -0
- package/dist/plugins/pg-outcome-ledger.d.ts +9 -0
- package/dist/plugins/pg-outcome-ledger.js +9 -0
- package/dist/plugins/pg-pool.d.ts +50 -0
- package/dist/plugins/pg-pool.js +78 -0
- package/dist/plugins/pg-query.d.ts +11 -0
- package/dist/plugins/pg-rate-limiter.d.ts +23 -0
- package/dist/plugins/pg-rate-limiter.js +12 -2
- package/dist/plugins/pg-resume-anchor-store.d.ts +5 -0
- package/dist/plugins/pg-resume-anchor-store.js +5 -0
- package/dist/plugins/pg-run-store.d.ts +7 -0
- package/dist/plugins/pg-run-store.js +7 -0
- package/dist/plugins/pg-safe-json.d.ts +13 -0
- package/dist/plugins/pg-safe-json.js +40 -4
- package/dist/plugins/pg-session-policy-store.d.ts +5 -0
- package/dist/plugins/pg-session-policy-store.js +5 -0
- package/dist/plugins/pg-session-storage.d.ts +72 -0
- package/dist/plugins/pg-session-storage.js +152 -20
- package/dist/plugins/pg-session-store.d.ts +10 -0
- package/dist/plugins/pg-session-store.js +10 -0
- package/dist/plugins/pg-tool-result-store.d.ts +7 -0
- package/dist/plugins/pg-tool-result-store.js +7 -0
- package/dist/plugins/pg-workflow-journal-store.d.ts +7 -0
- package/dist/plugins/pg-workflow-journal-store.js +7 -0
- package/dist/plugins/pg-workflow-run-store.d.ts +7 -0
- package/dist/plugins/pg-workflow-run-store.js +7 -0
- package/dist/plugins/posix-shell-fs.d.ts +3 -0
- package/dist/plugins/posix-shell-fs.js +31 -1
- package/dist/plugins/remote-env-adb.d.ts +25 -0
- package/dist/plugins/remote-env-adb.js +95 -12
- package/dist/plugins/remote-env-e2b.d.ts +146 -0
- package/dist/plugins/remote-env-e2b.js +371 -40
- package/dist/plugins/remote-env-file-error.d.ts +34 -0
- package/dist/plugins/remote-env-file-error.js +37 -0
- package/dist/plugins/remote-env-host.d.ts +151 -0
- package/dist/plugins/remote-env-host.js +468 -70
- package/dist/plugins/remote-env-k8s.d.ts +135 -0
- package/dist/plugins/remote-env-k8s.js +318 -32
- package/dist/plugins/remote-env-local-docker.d.ts +65 -0
- package/dist/plugins/remote-env-local-docker.js +149 -24
- package/dist/plugins/remote-env-ssh.d.ts +35 -0
- package/dist/plugins/remote-env-ssh.js +117 -20
- package/dist/plugins/remote-scratchpad.d.ts +38 -0
- package/dist/plugins/remote-scratchpad.js +32 -2
- package/dist/plugins/remote-shell.d.ts +22 -0
- package/dist/plugins/remote-shell.js +27 -1
- package/dist/plugins/resume-anchor-store-sql.d.ts +28 -0
- package/dist/plugins/resume-anchor-store-sql.js +11 -0
- package/dist/plugins/roster-store-sql.d.ts +27 -0
- package/dist/plugins/roster-store-sql.js +54 -0
- package/dist/plugins/run-store-sql.d.ts +194 -0
- package/dist/plugins/run-store-sql.js +210 -9
- package/dist/plugins/s3-presign.d.ts +20 -0
- package/dist/plugins/s3-presign.js +49 -2
- package/dist/plugins/scheduler-support.d.ts +12 -0
- package/dist/plugins/scheduler-support.js +75 -3
- package/dist/plugins/send-file-ledger.d.ts +15 -0
- package/dist/plugins/send-file-ledger.js +53 -4
- package/dist/plugins/send-user-file.d.ts +77 -0
- package/dist/plugins/send-user-file.js +92 -4
- package/dist/plugins/session-policy-store-sql.d.ts +15 -0
- package/dist/plugins/session-policy-store-sql.js +75 -3
- package/dist/plugins/session-store.d.ts +45 -0
- package/dist/plugins/session-store.js +51 -0
- package/dist/plugins/sql-driver.d.ts +77 -0
- package/dist/plugins/sql-driver.js +4 -0
- package/dist/plugins/sql-escape.d.ts +8 -0
- package/dist/plugins/sql-escape.js +8 -0
- package/dist/plugins/sql-row-helpers.d.ts +25 -0
- package/dist/plugins/sql-row-helpers.js +25 -0
- package/dist/plugins/store-backend.d.ts +103 -0
- package/dist/plugins/store-backend.js +120 -27
- package/dist/plugins/store-contracts.d.ts +62 -0
- package/dist/plugins/store-contracts.js +3 -0
- package/dist/plugins/task-attachment-store.d.ts +60 -0
- package/dist/plugins/task-attachment-store.js +49 -3
- package/dist/plugins/task-list-store-sql.d.ts +25 -0
- package/dist/plugins/task-list-store-sql.js +21 -0
- package/dist/plugins/tidb-approval-store.d.ts +6 -0
- package/dist/plugins/tidb-approval-store.js +6 -0
- package/dist/plugins/tidb-breaker-state.d.ts +5 -0
- package/dist/plugins/tidb-breaker-state.js +5 -0
- package/dist/plugins/tidb-checkpoint-store.d.ts +7 -0
- package/dist/plugins/tidb-checkpoint-store.js +7 -0
- package/dist/plugins/tidb-cost-quota.d.ts +6 -0
- package/dist/plugins/tidb-cost-quota.js +1 -0
- package/dist/plugins/tidb-file-snapshot-store.d.ts +6 -0
- package/dist/plugins/tidb-file-snapshot-store.js +6 -0
- package/dist/plugins/tidb-image-bake.d.ts +8 -0
- package/dist/plugins/tidb-image-bake.js +8 -0
- package/dist/plugins/tidb-image-index.d.ts +8 -0
- package/dist/plugins/tidb-image-index.js +8 -0
- package/dist/plugins/tidb-outcome-ledger.d.ts +10 -0
- package/dist/plugins/tidb-outcome-ledger.js +10 -0
- package/dist/plugins/tidb-pool.d.ts +56 -0
- package/dist/plugins/tidb-pool.js +181 -1
- package/dist/plugins/tidb-rate-limiter.d.ts +11 -0
- package/dist/plugins/tidb-rate-limiter.js +5 -2
- package/dist/plugins/tidb-resume-anchor-store.d.ts +5 -0
- package/dist/plugins/tidb-resume-anchor-store.js +5 -0
- package/dist/plugins/tidb-run-store.d.ts +7 -0
- package/dist/plugins/tidb-run-store.js +7 -0
- package/dist/plugins/tidb-session-policy-store.d.ts +5 -0
- package/dist/plugins/tidb-session-policy-store.js +5 -0
- package/dist/plugins/tidb-session-storage.d.ts +43 -0
- package/dist/plugins/tidb-session-storage.js +62 -3
- package/dist/plugins/tidb-session-store.d.ts +142 -0
- package/dist/plugins/tidb-session-store.js +264 -16
- package/dist/plugins/tidb-tool-result-store.d.ts +5 -0
- package/dist/plugins/tidb-tool-result-store.js +7 -0
- package/dist/plugins/tidb-workflow-journal-store.d.ts +7 -0
- package/dist/plugins/tidb-workflow-journal-store.js +7 -0
- package/dist/plugins/tidb-workflow-run-store.d.ts +8 -0
- package/dist/plugins/tidb-workflow-run-store.js +8 -0
- package/dist/plugins/tool-result-store-sql.d.ts +58 -0
- package/dist/plugins/tool-result-store-sql.js +38 -2
- package/dist/plugins/web-search.d.ts +35 -0
- package/dist/plugins/web-search.js +45 -9
- package/dist/plugins/workflow-journal-limits.d.ts +10 -0
- package/dist/plugins/workflow-journal-limits.js +10 -0
- package/dist/plugins/workflow-journal-store-sql.d.ts +78 -0
- package/dist/plugins/workflow-journal-store-sql.js +58 -2
- package/dist/plugins/workflow-run-store-sql.d.ts +84 -0
- package/dist/plugins/workflow-run-store-sql.js +84 -6
- package/dist/plugins/worktree-isolation.d.ts +45 -0
- package/dist/plugins/worktree-isolation.js +105 -6
- package/dist/plugins/write-behind-counter.d.ts +56 -1
- package/dist/plugins/write-behind-counter.js +53 -14
- package/dist/principal-jwt.d.ts +24 -0
- package/dist/principal-jwt.js +60 -5
- package/dist/project-memory.d.ts +22 -0
- package/dist/project-memory.js +144 -15
- package/dist/prompts-domain-validate.d.ts +28 -0
- package/dist/prompts-domain-validate.js +42 -1
- package/dist/question.d.ts +33 -0
- package/dist/question.js +69 -2
- package/dist/resource-suspend.d.ts +21 -0
- package/dist/resource-suspend.js +16 -0
- package/dist/router/route-orchestration.d.ts +78 -0
- package/dist/router/route-orchestration.js +77 -0
- package/dist/run-local.d.ts +32 -0
- package/dist/run-local.js +172 -8
- package/dist/runs.d.ts +189 -4
- package/dist/runs.js +465 -24
- package/dist/runtime-caps-resolver.d.ts +106 -0
- package/dist/runtime-caps-resolver.js +89 -4
- package/dist/runtime-governance.d.ts +84 -0
- package/dist/runtime-governance.js +127 -1
- package/dist/sandbox-pkg-source.d.ts +23 -0
- package/dist/sandbox-pkg-source.js +37 -0
- package/dist/sealed-key.d.ts +54 -0
- package/dist/sealed-key.js +68 -3
- package/dist/security.d.ts +108 -0
- package/dist/security.js +145 -6
- package/dist/sema-registry.d.ts +21 -0
- package/dist/sema-registry.js +21 -0
- package/dist/session-leaf-bus.d.ts +31 -0
- package/dist/session-leaf-bus.js +32 -0
- package/dist/session-sync-content.d.ts +46 -0
- package/dist/session-sync-content.js +47 -1
- package/dist/session-sync-kernel.d.ts +89 -0
- package/dist/session-sync-kernel.js +48 -3
- package/dist/session-sync.d.ts +125 -0
- package/dist/session-sync.js +181 -8
- package/dist/session-titler.d.ts +26 -0
- package/dist/session-titler.js +41 -7
- package/dist/session-watch.d.ts +53 -1
- package/dist/session-watch.js +73 -9
- package/dist/sighup-idle.d.ts +30 -0
- package/dist/sighup-idle.js +12 -1
- package/dist/spec-fields.d.ts +91 -3
- package/dist/spec-fields.js +116 -4
- package/dist/task-cwd.d.ts +50 -0
- package/dist/task-cwd.js +68 -1
- package/dist/task-mcp.d.ts +47 -0
- package/dist/task-mcp.js +29 -0
- package/dist/task-settings.d.ts +175 -0
- package/dist/task-settings.js +226 -11
- package/dist/task-workflow.d.ts +67 -0
- package/dist/task-workflow.js +75 -8
- package/dist/tool-approval.d.ts +91 -0
- package/dist/tool-approval.js +215 -0
- package/dist/trace/artifacts.d.ts +9 -0
- package/dist/trace/artifacts.js +30 -5
- package/dist/trace/core-keyset-guard.d.ts +18 -0
- package/dist/trace/ledger-sink.d.ts +43 -0
- package/dist/trace/ledger-sink.js +64 -5
- package/dist/trace/project.d.ts +133 -0
- package/dist/trace/project.js +189 -2
- package/dist/trace/redact.d.ts +19 -0
- package/dist/trace/redact.js +66 -9
- package/dist/usage-analytics.d.ts +26 -0
- package/dist/usage-analytics.js +26 -3
- package/package.json +1 -1
|
@@ -1,48 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S1 value-verdict harness — the RESUMABLE FIRM-RUN DRIVER. SPEC-S1-value-harness.md §11 ("the human's post-step
|
|
3
|
+
* that wires this scaffold into a runnable batch CLI"). Enumerates the firm cells {C1,C2,C4} × the arms each trap
|
|
4
|
+
* declares × N seeds, runs each MISSING cell via `runArm` against a REAL `ProfileDeps` (live-deps.ts), records an
|
|
5
|
+
* append-only JSONL LEDGER keyed by (taskId, arm, seed), and at the end builds the `ValueJudgmentReport` via
|
|
6
|
+
* `buildS1Report`. The report IS the output — this driver never asserts which arm wins.
|
|
7
|
+
*
|
|
8
|
+
* 🔴 RESUMABLE (clay's hard requirement): on start the driver READS the ledger, builds the done-set, and runs ONLY
|
|
9
|
+
* missing cells. A completed SCORED cell is NEVER re-run. A cell that throws / times out is recorded
|
|
10
|
+
* `runStatus:"infra-failed"` (EXCLUDED from scoring, NOT a fake loss) AND left re-runnable on the next pass — so
|
|
11
|
+
* a hang/crash mid-run resumes cleanly. Per-cell wall-clock timeout → kill the cell, mark infra-failed, move on.
|
|
12
|
+
*
|
|
13
|
+
* 🔴 --dry-run: a MOCK ProfileDeps (no E2B/DeepSeek) proves the driver loop + ledger + resume + buildReport work
|
|
14
|
+
* DETERMINISTICALLY (this is what the test + CI exercise; the REAL run is the owner's gated step).
|
|
15
|
+
*
|
|
16
|
+
* 🔴 ENV GATING: the live path requires E2B_API_KEY + DEEPSEEK_API_KEY; absent → the driver refuses the live path
|
|
17
|
+
* with a clear message (never a silent fake run). The deterministic --dry-run never needs keys.
|
|
18
|
+
*/
|
|
1
19
|
import { Runner } from "@sema-agent/core";
|
|
2
20
|
import { type Arm } from "./arms.js";
|
|
3
21
|
import { type TrapSpec } from "./tasks.js";
|
|
4
22
|
import { type BenchBudget } from "./runner-ctx.js";
|
|
5
23
|
import { type RawRow, type ValueJudgmentReport } from "./row.js";
|
|
6
24
|
import { type LiveRuntimeConfig, type LiveCell } from "./live-deps.js";
|
|
25
|
+
/** A ledger key uniquely identifies one cell (the resume primary key). */
|
|
7
26
|
export interface CellKey {
|
|
8
27
|
taskId: string;
|
|
9
28
|
arm: Arm;
|
|
10
29
|
seed: number | string;
|
|
11
30
|
}
|
|
31
|
+
/** One ledger record on disk: the emitted RawRow (a completed cell) — re-aggregated on the final pass. */
|
|
12
32
|
export type LedgerRecord = RawRow;
|
|
33
|
+
/** The driver options. */
|
|
13
34
|
export interface RunFirmOptions {
|
|
35
|
+
/** Seeds per (trap, arm). Default 5 (clay: comprehensive → CLI `--seeds N`). */
|
|
14
36
|
seeds?: number;
|
|
37
|
+
/** Optional cell filters for a controlled live run (single-cell smoke / re-run one trap-arm). `only` = a trapId
|
|
38
|
+
* (e.g. "C1"), `arm` = a lowercase arm tag ("solo"|"sup"|"team"). The ledger keys are unchanged → a filtered run
|
|
39
|
+
* still resumes/merges into the same run. */
|
|
15
40
|
only?: string;
|
|
16
41
|
arm?: string;
|
|
42
|
+
/** Per-cell wall-clock timeout ms. A cell that exceeds it is killed → infra-failed → re-runnable. Default 15min. */
|
|
17
43
|
cellTimeoutMs?: number;
|
|
44
|
+
/** The append-only JSONL ledger path. */
|
|
18
45
|
ledgerPath: string;
|
|
46
|
+
/** The output report JSON path. */
|
|
19
47
|
reportPath: string;
|
|
48
|
+
/** The shared budget every arm runs on (the §3.2 fairness root). */
|
|
20
49
|
budget: BenchBudget;
|
|
50
|
+
/** Provenance. */
|
|
21
51
|
runId: string;
|
|
22
52
|
gitSha: string;
|
|
53
|
+
/** DRY-RUN: inject a MOCK deps factory (no E2B/DeepSeek). The live path uses buildLiveDeps when this is absent. */
|
|
23
54
|
mockDepsFactory?: (trap: TrapSpec, seed: number | string, cellId: string) => LiveCell;
|
|
55
|
+
/** The live runtime config (required for the live path; ignored in dry-run). */
|
|
24
56
|
liveRuntime?: LiveRuntimeConfig;
|
|
57
|
+
/** Observability sink. */
|
|
25
58
|
log?: (msg: string, meta?: Record<string, unknown>) => void;
|
|
26
59
|
}
|
|
60
|
+
/** The cell + the seam through which it runs (the SUP arm needs a per-cell CheckpointStore). */
|
|
27
61
|
interface PlannedCell extends CellKey {
|
|
28
62
|
trap: TrapSpec;
|
|
29
63
|
}
|
|
64
|
+
/** Enumerate the firm cells = FIRM_TRAPS × trap.arms × seeds. Optional `only` (trapId) / `arm` filters slice the
|
|
65
|
+
* set for a controlled live run — a single-cell smoke (`--only C1 --arm solo --seeds 1`) before the full sweep, or
|
|
66
|
+
* re-running one trap/arm. The ledger keys are unchanged, so a filtered run still resumes/merges into the same run. */
|
|
30
67
|
export declare function enumerateCells(seeds: number, filter?: {
|
|
31
68
|
only?: string;
|
|
32
69
|
arm?: string;
|
|
33
70
|
}): PlannedCell[];
|
|
71
|
+
/** A stable string key for a cell (the ledger dedupe key). */
|
|
34
72
|
export declare function cellKeyStr(k: CellKey): string;
|
|
73
|
+
/** Read the ledger, returning ALL records + the done-set of SCORED-or-otherwise-completed cell keys. A record with
|
|
74
|
+
* `runStatus:"infra-failed"` is NOT in the done-set (it is re-runnable — the resume contract). */
|
|
35
75
|
export declare function readLedger(ledgerPath: string): Promise<{
|
|
36
76
|
records: LedgerRecord[];
|
|
37
77
|
done: Set<string>;
|
|
38
78
|
}>;
|
|
79
|
+
/**
|
|
80
|
+
* Run the firm batch. Returns the final `ValueJudgmentReport` (also written to `reportPath`). Resumable: re-running
|
|
81
|
+
* continues where it stopped, never re-running a completed scored cell.
|
|
82
|
+
*/
|
|
39
83
|
export declare function runFirm(opts: RunFirmOptions): Promise<{
|
|
40
84
|
report: ValueJudgmentReport;
|
|
41
85
|
scored: number;
|
|
42
86
|
excluded: number;
|
|
43
87
|
ranThisPass: number;
|
|
44
88
|
}>;
|
|
89
|
+
/** Parse a CLI flag as a positive integer; default when the flag is absent; exit(2) on a present-but-invalid value
|
|
90
|
+
* (0, negative, NaN, fractional) rather than silently coercing it. */
|
|
45
91
|
export declare function positiveIntArg(raw: string | undefined, def: number, flag: string): number;
|
|
92
|
+
/** CLI entry. */
|
|
46
93
|
export declare function main(argv?: string[]): Promise<void>;
|
|
47
94
|
export { buildLiveDeps, liveRuntimeConfigFromEnv } from "./live-deps.js";
|
|
48
95
|
export { Runner };
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S1 value-verdict harness — the RESUMABLE FIRM-RUN DRIVER. SPEC-S1-value-harness.md §11 ("the human's post-step
|
|
3
|
+
* that wires this scaffold into a runnable batch CLI"). Enumerates the firm cells {C1,C2,C4} × the arms each trap
|
|
4
|
+
* declares × N seeds, runs each MISSING cell via `runArm` against a REAL `ProfileDeps` (live-deps.ts), records an
|
|
5
|
+
* append-only JSONL LEDGER keyed by (taskId, arm, seed), and at the end builds the `ValueJudgmentReport` via
|
|
6
|
+
* `buildS1Report`. The report IS the output — this driver never asserts which arm wins.
|
|
7
|
+
*
|
|
8
|
+
* 🔴 RESUMABLE (clay's hard requirement): on start the driver READS the ledger, builds the done-set, and runs ONLY
|
|
9
|
+
* missing cells. A completed SCORED cell is NEVER re-run. A cell that throws / times out is recorded
|
|
10
|
+
* `runStatus:"infra-failed"` (EXCLUDED from scoring, NOT a fake loss) AND left re-runnable on the next pass — so
|
|
11
|
+
* a hang/crash mid-run resumes cleanly. Per-cell wall-clock timeout → kill the cell, mark infra-failed, move on.
|
|
12
|
+
*
|
|
13
|
+
* 🔴 --dry-run: a MOCK ProfileDeps (no E2B/DeepSeek) proves the driver loop + ledger + resume + buildReport work
|
|
14
|
+
* DETERMINISTICALLY (this is what the test + CI exercise; the REAL run is the owner's gated step).
|
|
15
|
+
*
|
|
16
|
+
* 🔴 ENV GATING: the live path requires E2B_API_KEY + DEEPSEEK_API_KEY; absent → the driver refuses the live path
|
|
17
|
+
* with a clear message (never a silent fake run). The deterministic --dry-run never needs keys.
|
|
18
|
+
*/
|
|
1
19
|
import { promises as fs } from "node:fs";
|
|
2
20
|
import path from "node:path";
|
|
3
21
|
import { Runner, InMemoryCheckpointStore } from "@sema-agent/core";
|
|
@@ -7,8 +25,14 @@ import { makeBenchClock } from "./runner-ctx.js";
|
|
|
7
25
|
import { buildS1Report, S1_SCHEMA_VERSION, S1_CORE_VERSION } from "./row.js";
|
|
8
26
|
import { armTag } from "./row.js";
|
|
9
27
|
import { buildLiveDeps, liveRuntimeConfigFromEnv } from "./live-deps.js";
|
|
28
|
+
/** Enumerate the firm cells = FIRM_TRAPS × trap.arms × seeds. Optional `only` (trapId) / `arm` filters slice the
|
|
29
|
+
* set for a controlled live run — a single-cell smoke (`--only C1 --arm solo --seeds 1`) before the full sweep, or
|
|
30
|
+
* re-running one trap/arm. The ledger keys are unchanged, so a filtered run still resumes/merges into the same run. */
|
|
10
31
|
export function enumerateCells(seeds, filter = {}) {
|
|
11
32
|
const cells = [];
|
|
33
|
+
// 🔴 default sweep = FIRM_TRAPS only (directional traps must NEVER enter a firm verdict). An explicit --only MAY
|
|
34
|
+
// target a directional trap (e.g. C6 hazard) for a controlled make-real probe — its rows carry liveProof:directional
|
|
35
|
+
// so buildReport still excludes them from the verdict; running it just produces the data to CONFIRM the hazard fires.
|
|
12
36
|
const source = filter.only ? ALL_TRAPS : FIRM_TRAPS;
|
|
13
37
|
for (const trap of source) {
|
|
14
38
|
if (filter.only && trap.id !== filter.only)
|
|
@@ -23,9 +47,12 @@ export function enumerateCells(seeds, filter = {}) {
|
|
|
23
47
|
}
|
|
24
48
|
return cells;
|
|
25
49
|
}
|
|
50
|
+
/** A stable string key for a cell (the ledger dedupe key). */
|
|
26
51
|
export function cellKeyStr(k) {
|
|
27
52
|
return `${k.taskId}::${armTag(k.arm)}::${String(k.seed)}`;
|
|
28
53
|
}
|
|
54
|
+
/** Read the ledger, returning ALL records + the done-set of SCORED-or-otherwise-completed cell keys. A record with
|
|
55
|
+
* `runStatus:"infra-failed"` is NOT in the done-set (it is re-runnable — the resume contract). */
|
|
29
56
|
export async function readLedger(ledgerPath) {
|
|
30
57
|
let raw;
|
|
31
58
|
try {
|
|
@@ -45,12 +72,14 @@ export async function readLedger(ledgerPath) {
|
|
|
45
72
|
rec = JSON.parse(t);
|
|
46
73
|
}
|
|
47
74
|
catch {
|
|
48
|
-
continue;
|
|
75
|
+
continue; // a torn final line from a crash mid-write — skip it (the cell stays re-runnable)
|
|
49
76
|
}
|
|
50
77
|
records.push(rec);
|
|
78
|
+
// A cell is "done" (never re-run) ONLY when it is a completed scored/excluded-but-final row. An infra-failed
|
|
79
|
+
// row is re-runnable, so it does NOT enter the done-set. (The LAST record for a key wins on re-aggregation.)
|
|
51
80
|
const key = cellKeyStr({ taskId: rec.taskId, arm: armUpper(rec.arm), seed: rec.seed ?? 0 });
|
|
52
81
|
if (rec.runStatus === "infra-failed") {
|
|
53
|
-
done.delete(key);
|
|
82
|
+
done.delete(key); // a later successful re-run supersedes; an infra-failed alone keeps it runnable
|
|
54
83
|
}
|
|
55
84
|
else {
|
|
56
85
|
done.add(key);
|
|
@@ -58,6 +87,7 @@ export async function readLedger(ledgerPath) {
|
|
|
58
87
|
}
|
|
59
88
|
return { records, done };
|
|
60
89
|
}
|
|
90
|
+
/** Map the lowercase wire tag back to the internal uppercase Arm. */
|
|
61
91
|
function armUpper(tag) {
|
|
62
92
|
switch (tag) {
|
|
63
93
|
case "solo":
|
|
@@ -67,13 +97,18 @@ function armUpper(tag) {
|
|
|
67
97
|
case "team":
|
|
68
98
|
return "TEAM";
|
|
69
99
|
default:
|
|
100
|
+
// 🔴 fail-loud (review council DESIGN#1): `tag` comes from a parsed JSONL ledger line, so a corrupt/unknown arm
|
|
101
|
+
// would otherwise produce an `undefined` cellKeyStr → silent dedup poisoning. A bad ledger row must throw, not
|
|
102
|
+
// collapse two cells onto one undefined key.
|
|
70
103
|
throw new Error(`s1 run-firm: unknown arm tag ${JSON.stringify(tag)} in ledger row (expected solo|sup|team)`);
|
|
71
104
|
}
|
|
72
105
|
}
|
|
106
|
+
/** Append one record to the ledger (atomic-ish: one write of one line + newline). */
|
|
73
107
|
async function appendLedger(ledgerPath, rec) {
|
|
74
108
|
await fs.mkdir(path.dirname(ledgerPath), { recursive: true });
|
|
75
109
|
await fs.appendFile(ledgerPath, JSON.stringify(rec) + "\n", "utf8");
|
|
76
110
|
}
|
|
111
|
+
/** Run a promise with a wall-clock timeout. Rejects with a timeout error on expiry (the caller marks infra-failed). */
|
|
77
112
|
function withTimeout(p, ms, label) {
|
|
78
113
|
return new Promise((resolve, reject) => {
|
|
79
114
|
const timer = setTimeout(() => reject(new Error(`cell timeout after ${ms}ms (${label})`)), ms);
|
|
@@ -87,6 +122,7 @@ function withTimeout(p, ms, label) {
|
|
|
87
122
|
});
|
|
88
123
|
});
|
|
89
124
|
}
|
|
125
|
+
/** Build an infra-failed RawRow for a cell that threw/timed out (EXCLUDED, NOT a fake loss; re-runnable). */
|
|
90
126
|
function infraFailedRow(cell, ctx) {
|
|
91
127
|
const now = ctx.clock.now();
|
|
92
128
|
return {
|
|
@@ -105,9 +141,13 @@ function infraFailedRow(cell, ctx) {
|
|
|
105
141
|
humanReview: { count: 0, totalWaitMs: 0, gates: [] },
|
|
106
142
|
},
|
|
107
143
|
wallTimeSec: 0,
|
|
108
|
-
meta: { startedAt: now, finishedAt: now, coreVersion: S1_CORE_VERSION, gitSha: ctx.gitSha, runId: ctx.runId },
|
|
144
|
+
meta: { startedAt: now, finishedAt: now, coreVersion: S1_CORE_VERSION, gitSha: ctx.gitSha, runId: ctx.runId }, // L16:动态读装机 core 版本(硬钉曾漂到 1.111.0)
|
|
109
145
|
};
|
|
110
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Run the firm batch. Returns the final `ValueJudgmentReport` (also written to `reportPath`). Resumable: re-running
|
|
149
|
+
* continues where it stopped, never re-running a completed scored cell.
|
|
150
|
+
*/
|
|
111
151
|
export async function runFirm(opts) {
|
|
112
152
|
const seeds = opts.seeds ?? 5;
|
|
113
153
|
if (!Number.isInteger(seeds) || seeds < 1)
|
|
@@ -146,16 +186,23 @@ export async function runFirm(opts) {
|
|
|
146
186
|
}
|
|
147
187
|
await appendLedger(opts.ledgerPath, row);
|
|
148
188
|
ranThisPass++;
|
|
189
|
+
// Only a non-infra-failed row enters the done-set (an infra-failed cell stays re-runnable on the next pass).
|
|
149
190
|
if (row.runStatus !== "infra-failed")
|
|
150
191
|
done.add(key);
|
|
151
192
|
log("cell_done", { key, runStatus: row.runStatus });
|
|
152
193
|
}
|
|
194
|
+
// Final pass: load ALL ledger rows, de-dupe to the LAST record per key (a re-run supersedes an earlier
|
|
195
|
+
// infra-failed), build the report.
|
|
153
196
|
const { records } = await readLedger(opts.ledgerPath);
|
|
154
197
|
const lastByKey = new Map();
|
|
155
198
|
for (const rec of records) {
|
|
156
199
|
lastByKey.set(cellKeyStr({ taskId: rec.taskId, arm: armUpper(rec.arm), seed: rec.seed ?? 0 }), rec);
|
|
157
200
|
}
|
|
158
201
|
const allRows = [...lastByKey.values()];
|
|
202
|
+
// 🔴 (review HIGH finding) the firm report is FIRM_TRAPS rows ONLY. A directional probe (C6/C7) can share a ledger
|
|
203
|
+
// via --only, and buildReport does NOT filter by liveProof — an unfiltered call would let directional rows
|
|
204
|
+
// pollute the firm comparisons/pareto. Filter to firm taskIds here (directional rows stay in the ledger for
|
|
205
|
+
// separate analysis); a directional probe should also use its own --run-id to keep ledgers cleanly separate.
|
|
159
206
|
const firmIds = new Set(FIRM_TRAPS.map((t) => t.id));
|
|
160
207
|
const rows = allRows.filter((r) => firmIds.has(r.taskId));
|
|
161
208
|
const report = buildS1Report(rows);
|
|
@@ -165,13 +212,21 @@ export async function runFirm(opts) {
|
|
|
165
212
|
const excluded = rows.length - scored;
|
|
166
213
|
return { report, scored, excluded, ranThisPass };
|
|
167
214
|
}
|
|
215
|
+
/** Build a live cell or throw a clear message if the live runtime is missing (env gating). */
|
|
168
216
|
function buildLiveCellOrThrow(opts, trap, seed, cellId) {
|
|
169
217
|
if (!opts.liveRuntime) {
|
|
170
218
|
throw new Error("S1 run-firm: live path requires E2B_API_KEY + DEEPSEEK_API_KEY (the brain gateway). None resolved — refusing a silent fake run. Use --dry-run for the deterministic loop, or set the keys for the owner's gated live run.");
|
|
171
219
|
}
|
|
172
220
|
return buildLiveDeps(opts.liveRuntime, trap, seed, cellId);
|
|
173
221
|
}
|
|
222
|
+
// ─────────────────────────────── CLI ───────────────────────────────
|
|
223
|
+
/** The default shared budget (the §3.2 fairness root). Overridable via CLI flags. */
|
|
174
224
|
function defaultBudget(modelId) {
|
|
225
|
+
// 🔴 maxTokens is a GENEROUS safety net, NOT the binding gate (clay: budget unlimited). The 1-cell live smoke caught
|
|
226
|
+
// that maxTokens:8000 capped EVERY run "failed" → infra-failed → nothing ever scored: the token counter includes
|
|
227
|
+
// CACHED tokens (97% cache hit), so a single verify round over repo context blew 8000 while real cost was ~$0. The
|
|
228
|
+
// real, FAIR economic gate is maxCostUsd + maxTurns (uniform across all arms); maxTokens just must not bind before
|
|
229
|
+
// them. 200k comfortably fits ~12 turns of verify→fix with repo context; cost stays the measured economic axis.
|
|
175
230
|
return { modelId, maxTokens: 200_000, maxCostUsd: 1.0, maxTurns: 12, maxRounds: 2, supAutoBudget: 1 };
|
|
176
231
|
}
|
|
177
232
|
function parseArgs(argv) {
|
|
@@ -180,6 +235,9 @@ function parseArgs(argv) {
|
|
|
180
235
|
return i >= 0 && i + 1 < argv.length ? argv[i + 1] : undefined;
|
|
181
236
|
};
|
|
182
237
|
const runId = get("run-id") ?? `s1-firm-${Date.now()}`;
|
|
238
|
+
// --seeds / --cell-timeout-ms: explicit positive-integer validation (NOT a `|| default` truthy coercion, which
|
|
239
|
+
// silently turns `--seeds 0` into 5 and lets `--seeds -1` enumerate ZERO cells = a silent empty run). Absent flag
|
|
240
|
+
// → default; present-but-invalid → a clear error + non-zero exit (never a silently-coerced batch).
|
|
183
241
|
const seeds = positiveIntArg(get("seeds"), 5, "--seeds");
|
|
184
242
|
const cellTimeoutMs = positiveIntArg(get("cell-timeout-ms"), 15 * 60_000, "--cell-timeout-ms");
|
|
185
243
|
return {
|
|
@@ -193,6 +251,8 @@ function parseArgs(argv) {
|
|
|
193
251
|
...(get("arm") ? { arm: get("arm") } : {}),
|
|
194
252
|
};
|
|
195
253
|
}
|
|
254
|
+
/** Parse a CLI flag as a positive integer; default when the flag is absent; exit(2) on a present-but-invalid value
|
|
255
|
+
* (0, negative, NaN, fractional) rather than silently coercing it. */
|
|
196
256
|
export function positiveIntArg(raw, def, flag) {
|
|
197
257
|
if (raw === undefined)
|
|
198
258
|
return def;
|
|
@@ -203,13 +263,15 @@ export function positiveIntArg(raw, def, flag) {
|
|
|
203
263
|
}
|
|
204
264
|
return n;
|
|
205
265
|
}
|
|
266
|
+
/** The mock deps factory for --dry-run: a deterministic LiveCell (no E2B/DeepSeek). Per-cell deterministic by seed. */
|
|
206
267
|
function dryRunMockFactory() {
|
|
207
268
|
return (trap, seed) => {
|
|
269
|
+
// A deterministic stats fixture + a deterministic oracle keyed on the trap (C2 = impossible-spec → not green).
|
|
208
270
|
const stats = {
|
|
209
271
|
costBreakdown: { llmRootMicroUsd: 50_000, nestedSubagentMicroUsd: 0, memoryConsolidationMicroUsd: 0, compactionMicroUsd: 0 },
|
|
210
272
|
humanReview: { count: 0, totalWaitMs: 0, gates: [] },
|
|
211
273
|
};
|
|
212
|
-
const green = trap.id !== "C2-honest-bound";
|
|
274
|
+
const green = trap.id !== "C2-honest-bound"; // C2's contradiction can never be objectively correct
|
|
213
275
|
const oracle = { delivered: true, hiddenTestsGreen: green, buildPassed: true, invariantsOk: true };
|
|
214
276
|
const vr = {
|
|
215
277
|
taskId: trap.id,
|
|
@@ -232,6 +294,7 @@ function dryRunMockFactory() {
|
|
|
232
294
|
return { deps, dispose: async () => { } };
|
|
233
295
|
};
|
|
234
296
|
}
|
|
297
|
+
/** CLI entry. */
|
|
235
298
|
export async function main(argv = process.argv.slice(2)) {
|
|
236
299
|
const args = parseArgs(argv);
|
|
237
300
|
const liveRuntime = liveRuntimeConfigFromEnv();
|
|
@@ -272,6 +335,8 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
272
335
|
directionalOnly: result.report.directionalOnly,
|
|
273
336
|
}, null, 2));
|
|
274
337
|
}
|
|
338
|
+
// Run as a CLI when invoked directly (not when imported by the test). `import.meta.url` guard keeps the module
|
|
339
|
+
// import-safe for the deterministic test.
|
|
275
340
|
const isMain = (() => {
|
|
276
341
|
try {
|
|
277
342
|
return typeof process !== "undefined" && Array.isArray(process.argv) && /run-firm(\.[jt]s)?$/.test(process.argv[1] ?? "");
|
|
@@ -286,6 +351,7 @@ if (isMain) {
|
|
|
286
351
|
process.exit(1);
|
|
287
352
|
});
|
|
288
353
|
}
|
|
354
|
+
// Re-export the live wiring for the owner's gated run + the test.
|
|
289
355
|
export { buildLiveDeps, liveRuntimeConfigFromEnv } from "./live-deps.js";
|
|
290
356
|
export { Runner };
|
|
291
357
|
//# sourceMappingURL=run-firm.js.map
|
|
@@ -1,4 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S1 value-verdict harness — the FAIRNESS ROOT (SPEC-S1-value-harness.md §2). ONE place constructs the shared
|
|
3
|
+
* Runner ingredients (config / brain / pricing), the SAME budget for every arm, and the injected deterministic
|
|
4
|
+
* clock that makes C2 (human-review wall-time) reproducible.
|
|
5
|
+
*
|
|
6
|
+
* 🔴 THE §3.2 RED LINE (design/89's #1 confound): every leaf TaskSpec across all 3 arms carries the SAME
|
|
7
|
+
* `{ maxTokens, maxCostUsd, limits.maxTurns }`, and TEAM's per-worker budgets sum to ≤ the solo budget — so no
|
|
8
|
+
* arm can win on a bigger pie. `assertBudgetMatch` (below) is the build-time guard the shape test runs.
|
|
9
|
+
*
|
|
10
|
+
* 🔴 BUDGET-MATCH for TEAM is NEW WIRING the live conflict test does NOT do: `leader-conflict-resolver-live.test.ts`
|
|
11
|
+
* sets NO budget on `SubtaskSpec.spec` and NO `now` on any Runner. The harness STAMPS both (arms.ts) — copying the
|
|
12
|
+
* live test verbatim would yield an unbounded TEAM (the confound) and an empty `humanReview` (C2 = undefined).
|
|
13
|
+
*
|
|
14
|
+
* The real-infra construction (E2B worker/grader envs + a live brain) is deferred to the live make-real proof
|
|
15
|
+
* (`test/s1-value-live.test.ts`, gated on E2B+DEEPSEEK). This module only fixes the SHAPE + the budget invariant
|
|
16
|
+
* + the clock; a deterministic shape test exercises it with a MOCK runner (no real agents, no keys).
|
|
17
|
+
*/
|
|
1
18
|
import type { ExecutionEnv } from "@sema-agent/core";
|
|
19
|
+
/**
|
|
20
|
+
* The budget block the budget-match guard compares. NOT a s1.v1 RawRow field (the contract carries no budget) —
|
|
21
|
+
* it is a PRODUCER-side fairness descriptor (one per emitted cell). `teamWorkerBudgetSumUsd` is the bigger-pie
|
|
22
|
+
* guard input (TEAM only): Σ per-worker maxCostUsd, asserted ≤ maxCostUsd.
|
|
23
|
+
*/
|
|
2
24
|
export interface RowBudget {
|
|
3
25
|
modelId: string;
|
|
4
26
|
maxTokens: number;
|
|
@@ -6,28 +28,68 @@ export interface RowBudget {
|
|
|
6
28
|
maxTurns: number;
|
|
7
29
|
maxRounds: number;
|
|
8
30
|
supAutoBudget?: number;
|
|
31
|
+
/** TEAM only: Σ per-worker maxCostUsd — asserted ≤ maxCostUsd (anti-bigger-pie confound). */
|
|
9
32
|
teamWorkerBudgetSumUsd?: number;
|
|
10
33
|
}
|
|
34
|
+
/** Project the producer's shared budget (+ an optional TEAM worker-sum) into a `RowBudget` for the fairness guard. */
|
|
11
35
|
export declare function budgetDescriptor(budget: BenchBudget, arm: string, teamWorkerBudgetSumUsd?: number): RowBudget;
|
|
36
|
+
/** The single budget every arm shares (the §3.2 red line). All scalars are the SAME across SOLO/SUP/TEAM. */
|
|
12
37
|
export interface BenchBudget {
|
|
38
|
+
/** SAME base model all arms (design/89 §3.2 — decorrelation is a separate axis, not the value axis). */
|
|
13
39
|
modelId: string;
|
|
40
|
+
/** `TaskSpec.maxTokens` — SAME all arms. */
|
|
14
41
|
maxTokens: number;
|
|
42
|
+
/** `TaskSpec.maxCostUsd` — SAME all arms (also the per-run spend cap). For TEAM, Σworker ≤ this. */
|
|
15
43
|
maxCostUsd: number;
|
|
44
|
+
/** `TaskSpec.limits.maxTurns` — SAME all arms. */
|
|
16
45
|
maxTurns: number;
|
|
46
|
+
/** `VerifyConfig.maxRounds` (verify-fix rounds) — SAME for SOLO & SUP. */
|
|
17
47
|
maxRounds: number;
|
|
48
|
+
/** `createDurableAskPolicy.autoBudget` — the SUP per-leg auto-approve circuit-breaker count, constant across SUP cells. */
|
|
18
49
|
supAutoBudget: number;
|
|
19
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* An injectable deterministic clock (SPEC §2). EVERY Runner in EVERY arm is built with `now: ctx.now`, and the
|
|
53
|
+
* reviewer's modeled think-time advances `advanceClock(ms)` — so `stats.humanReview.totalWaitMs` is reproducible
|
|
54
|
+
* and NEVER consumes real wall-time (`RunnerDeps.now`, core types.d.ts:1002 / design/91 §4.3 flaky-guard).
|
|
55
|
+
*
|
|
56
|
+
* 🔴 CLOCK-ADVANCE OWNERSHIP (review #10 — HARNESS-OWNS-CLOCK, the single fold point per arm): the modeled review
|
|
57
|
+
* wait is folded into ctx.clock by the HARNESS exactly once per arm — SUP in driveSupSuspendResume (per leg), TEAM
|
|
58
|
+
* in runArm after captureTeamStats. The live TEAM leader's workers therefore MUST NOT advance ctx.clock themselves
|
|
59
|
+
* (give them a child/frozen clock); if a worker shared ctx.now and hit a modeled review gate it would advance the
|
|
60
|
+
* clock, and runArm's `advanceClock(stats.humanReview.totalWaitMs)` would DOUBLE-COUNT the same wait into C3
|
|
61
|
+
* (wallTimeSec), making TEAM look slower than it is — a value-verdict confound in a fair-comparison harness.
|
|
62
|
+
*/
|
|
20
63
|
export interface BenchClock {
|
|
21
64
|
now: () => number;
|
|
22
65
|
advanceClock: (ms: number) => void;
|
|
23
66
|
}
|
|
67
|
+
/** Construct the deterministic clock used to model C2 review seconds (no real wall-time advance). */
|
|
24
68
|
export declare function makeBenchClock(startEpochMs?: number): BenchClock;
|
|
69
|
+
/**
|
|
70
|
+
* The shared context every arm runs in. Construction of `config/brain/pricing/newWorkerEnv/newGraderEnv` is the
|
|
71
|
+
* live make-real proof's job (it needs real keys + a real adapter). The SHAPE is fixed here so the arm runner +
|
|
72
|
+
* the shape test type-check against it.
|
|
73
|
+
*
|
|
74
|
+
* 🔴 `newGraderEnv` MUST return a DISTINCT env object from `newWorkerEnv` (decorrelation + the repair-loop §5.1
|
|
75
|
+
* anti-reward-hack identity check — `repair-loop.d.ts`: `graderEnv === workerEnv → oracle.unprotected`). The
|
|
76
|
+
* oracle (oracle.ts) ALWAYS grades in a grader env; the repair leg ALWAYS passes `workerEnv` so the identity
|
|
77
|
+
* check is LIVE (it is SKIPPED when `workerEnv` is undefined → a silently reward-hackable oracle).
|
|
78
|
+
*/
|
|
25
79
|
export interface RunnerCtx {
|
|
26
80
|
budget: BenchBudget;
|
|
27
81
|
clock: BenchClock;
|
|
82
|
+
/** A stable id for the whole batch (rows carry it for resume-by-(taskId,repeatIdx,arm) + orphan reap). */
|
|
28
83
|
runId: string;
|
|
84
|
+
/** The git SHA the harness ran at (provenance for search). */
|
|
29
85
|
gitSha: string;
|
|
30
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Apply the shared budget to a leaf TaskSpec-like object (SOLO impl, SUP impl, each TEAM `SubtaskSpec.spec`).
|
|
89
|
+
* Returns the budget fields to spread onto the spec — kept as a helper so EVERY leaf is stamped identically
|
|
90
|
+
* (the live tests forget this for TEAM workers — the confound). `maxCostUsd` is overridable for the TEAM
|
|
91
|
+
* per-worker split (Σ ≤ solo, enforced by `assertBudgetMatch`).
|
|
92
|
+
*/
|
|
31
93
|
export declare function leafBudgetFields(budget: BenchBudget, overrideMaxCostUsd?: number): {
|
|
32
94
|
maxTokens: number;
|
|
33
95
|
maxCostUsd: number;
|
|
@@ -35,10 +97,19 @@ export declare function leafBudgetFields(budget: BenchBudget, overrideMaxCostUsd
|
|
|
35
97
|
maxTurns: number;
|
|
36
98
|
};
|
|
37
99
|
};
|
|
100
|
+
/**
|
|
101
|
+
* BUDGET-MATCH build-time guard (the §3.2 red line — run by the shape test). FAILS if, within a task class:
|
|
102
|
+
* (a) any arm's `{ modelId, maxTokens, maxCostUsd, maxTurns, maxRounds }` differs, OR
|
|
103
|
+
* (b) a TEAM row's `teamWorkerBudgetSumUsd` exceeds `maxCostUsd` (the bigger-pie confound).
|
|
104
|
+
*
|
|
105
|
+
* Pure over the rows' `budget` blocks (so it works on emitted RawRows AND on a pre-flight check). Returns the
|
|
106
|
+
* list of violations (empty = OK) so the caller can assert it.
|
|
107
|
+
*/
|
|
38
108
|
export declare function assertBudgetMatch(rows: Array<{
|
|
39
109
|
arm: string;
|
|
40
110
|
taskId: string;
|
|
41
111
|
budget: RowBudget;
|
|
42
112
|
}>): string[];
|
|
113
|
+
/** Assert two execution envs are DISTINCT objects (the §5.1 anti-reward-hack precondition). Throws if same. */
|
|
43
114
|
export declare function assertDistinctEnvs(workerEnv: ExecutionEnv, graderEnv: ExecutionEnv): void;
|
|
44
115
|
//# sourceMappingURL=runner-ctx.d.ts.map
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S1 value-verdict harness — the FAIRNESS ROOT (SPEC-S1-value-harness.md §2). ONE place constructs the shared
|
|
3
|
+
* Runner ingredients (config / brain / pricing), the SAME budget for every arm, and the injected deterministic
|
|
4
|
+
* clock that makes C2 (human-review wall-time) reproducible.
|
|
5
|
+
*
|
|
6
|
+
* 🔴 THE §3.2 RED LINE (design/89's #1 confound): every leaf TaskSpec across all 3 arms carries the SAME
|
|
7
|
+
* `{ maxTokens, maxCostUsd, limits.maxTurns }`, and TEAM's per-worker budgets sum to ≤ the solo budget — so no
|
|
8
|
+
* arm can win on a bigger pie. `assertBudgetMatch` (below) is the build-time guard the shape test runs.
|
|
9
|
+
*
|
|
10
|
+
* 🔴 BUDGET-MATCH for TEAM is NEW WIRING the live conflict test does NOT do: `leader-conflict-resolver-live.test.ts`
|
|
11
|
+
* sets NO budget on `SubtaskSpec.spec` and NO `now` on any Runner. The harness STAMPS both (arms.ts) — copying the
|
|
12
|
+
* live test verbatim would yield an unbounded TEAM (the confound) and an empty `humanReview` (C2 = undefined).
|
|
13
|
+
*
|
|
14
|
+
* The real-infra construction (E2B worker/grader envs + a live brain) is deferred to the live make-real proof
|
|
15
|
+
* (`test/s1-value-live.test.ts`, gated on E2B+DEEPSEEK). This module only fixes the SHAPE + the budget invariant
|
|
16
|
+
* + the clock; a deterministic shape test exercises it with a MOCK runner (no real agents, no keys).
|
|
17
|
+
*/
|
|
18
|
+
/** Project the producer's shared budget (+ an optional TEAM worker-sum) into a `RowBudget` for the fairness guard. */
|
|
1
19
|
export function budgetDescriptor(budget, arm, teamWorkerBudgetSumUsd) {
|
|
2
20
|
return {
|
|
3
21
|
modelId: budget.modelId,
|
|
@@ -9,6 +27,7 @@ export function budgetDescriptor(budget, arm, teamWorkerBudgetSumUsd) {
|
|
|
9
27
|
...(arm === "TEAM" && teamWorkerBudgetSumUsd !== undefined ? { teamWorkerBudgetSumUsd } : {}),
|
|
10
28
|
};
|
|
11
29
|
}
|
|
30
|
+
/** Construct the deterministic clock used to model C2 review seconds (no real wall-time advance). */
|
|
12
31
|
export function makeBenchClock(startEpochMs = Date.now()) {
|
|
13
32
|
let t = startEpochMs;
|
|
14
33
|
return {
|
|
@@ -20,6 +39,12 @@ export function makeBenchClock(startEpochMs = Date.now()) {
|
|
|
20
39
|
},
|
|
21
40
|
};
|
|
22
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Apply the shared budget to a leaf TaskSpec-like object (SOLO impl, SUP impl, each TEAM `SubtaskSpec.spec`).
|
|
44
|
+
* Returns the budget fields to spread onto the spec — kept as a helper so EVERY leaf is stamped identically
|
|
45
|
+
* (the live tests forget this for TEAM workers — the confound). `maxCostUsd` is overridable for the TEAM
|
|
46
|
+
* per-worker split (Σ ≤ solo, enforced by `assertBudgetMatch`).
|
|
47
|
+
*/
|
|
23
48
|
export function leafBudgetFields(budget, overrideMaxCostUsd) {
|
|
24
49
|
return {
|
|
25
50
|
maxTokens: budget.maxTokens,
|
|
@@ -27,8 +52,17 @@ export function leafBudgetFields(budget, overrideMaxCostUsd) {
|
|
|
27
52
|
limits: { maxTurns: budget.maxTurns },
|
|
28
53
|
};
|
|
29
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* BUDGET-MATCH build-time guard (the §3.2 red line — run by the shape test). FAILS if, within a task class:
|
|
57
|
+
* (a) any arm's `{ modelId, maxTokens, maxCostUsd, maxTurns, maxRounds }` differs, OR
|
|
58
|
+
* (b) a TEAM row's `teamWorkerBudgetSumUsd` exceeds `maxCostUsd` (the bigger-pie confound).
|
|
59
|
+
*
|
|
60
|
+
* Pure over the rows' `budget` blocks (so it works on emitted RawRows AND on a pre-flight check). Returns the
|
|
61
|
+
* list of violations (empty = OK) so the caller can assert it.
|
|
62
|
+
*/
|
|
30
63
|
export function assertBudgetMatch(rows) {
|
|
31
64
|
const violations = [];
|
|
65
|
+
// Group by task class (here: taskId — each trap is its own class for the budget invariant).
|
|
32
66
|
const byTask = new Map();
|
|
33
67
|
for (const r of rows) {
|
|
34
68
|
const g = byTask.get(r.taskId) ?? [];
|
|
@@ -44,6 +78,7 @@ export function assertBudgetMatch(rows) {
|
|
|
44
78
|
violations.push(`budget-match: task ${taskId} arm ${r.arm} ${k}=${String(b[k])} != ${r.arm === group[0].arm ? "" : `${group[0].arm} `}${String(ref[k])}`);
|
|
45
79
|
}
|
|
46
80
|
}
|
|
81
|
+
// (b) TEAM bigger-pie guard: Σ per-worker budget must not exceed the shared per-arm maxCostUsd.
|
|
47
82
|
if (b.teamWorkerBudgetSumUsd !== undefined && b.teamWorkerBudgetSumUsd > b.maxCostUsd + 1e-9) {
|
|
48
83
|
violations.push(`budget-match: task ${taskId} arm ${r.arm} teamWorkerBudgetSumUsd=${b.teamWorkerBudgetSumUsd} > maxCostUsd=${b.maxCostUsd} (bigger-pie confound)`);
|
|
49
84
|
}
|
|
@@ -51,6 +86,7 @@ export function assertBudgetMatch(rows) {
|
|
|
51
86
|
}
|
|
52
87
|
return violations;
|
|
53
88
|
}
|
|
89
|
+
/** Assert two execution envs are DISTINCT objects (the §5.1 anti-reward-hack precondition). Throws if same. */
|
|
54
90
|
export function assertDistinctEnvs(workerEnv, graderEnv) {
|
|
55
91
|
if (workerEnv === graderEnv) {
|
|
56
92
|
throw new Error("S1 oracle: graderEnv === workerEnv — the anti-reward-hack identity check would fail closed (oracle.unprotected). The grader MUST be a distinct env (decorrelation + the repair-loop §5.1 boundary).");
|