@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,34 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S1 value-verdict harness — the HIDDEN OBJECTIVE ORACLE (the measure, NEVER an LLM). SPEC-S1-value-harness.md §4.
|
|
3
|
+
*
|
|
4
|
+
* ONE standalone oracle, shared by ALL three arms; ONLY the profile (arms.ts) differs. The oracle is:
|
|
5
|
+
* - OBJECTIVE: it runs `runExecGate` (real exit codes; null-exit never passes; an empty suite never passes —
|
|
6
|
+
* `exec-gate.d.ts`). There is NO model/LLM parameter ANYWHERE in this type (objective-oracle discipline,
|
|
7
|
+
* design/89 §2.2.1 — the LLM is a GATE inside an arm, never the MEASURE in the numerator).
|
|
8
|
+
* - DECORRELATED + ANTI-REWARD-HACK: it grades in a DISTINCT grader env (`ctx.newGraderEnv()`), never the
|
|
9
|
+
* worker's own env — the SAME isolation the repair-loop §5.1 identity check enforces.
|
|
10
|
+
* - HIDDEN + RESTORED-BEFORE-SCORING: the worker never sees `task.hiddenTestFiles`; the oracle WRITES them into
|
|
11
|
+
* the grader checkout, overwriting any worker-authored same-named file (anti-tamper, design/89 §2.2).
|
|
12
|
+
*
|
|
13
|
+
* The repair leg needs core's `RepairOracle = (graderEnv, evidence) => OracleResult` shape — a DIFFERENT
|
|
14
|
+
* signature. `repair-oracle-adapter.ts` wraps this standalone oracle into that closure (do NOT pass `runOracle`
|
|
15
|
+
* straight to `runRepairLoop` — it would not type-check + the repair leg would be miswired, SPEC Risk MEDIUM).
|
|
16
|
+
*/
|
|
1
17
|
import { type ExecutionEnv, type ExecStep, type ExecStepResult } from "@sema-agent/core";
|
|
2
18
|
import { type OracleVerdicts } from "./row.js";
|
|
19
|
+
/**
|
|
20
|
+
* The objective verdict — the 4 s1.v1 `OracleVerdicts` booleans PLUS the derived `trulyCorrect` and the raw exec
|
|
21
|
+
* steps (provenance). `trulyCorrect` is the AND of every objective signal — it is the numerator gate. The 4
|
|
22
|
+
* boolean field names (hiddenTestsGreen / buildPassed / invariantsOk / delivered) ARE the s1.v1 contract names.
|
|
23
|
+
*/
|
|
3
24
|
export interface OracleVerdict extends OracleVerdicts {
|
|
25
|
+
/** = delivered && hiddenTestsGreen && buildPassed && invariantsOk. The ONLY thing that counts as value. */
|
|
4
26
|
trulyCorrect: boolean;
|
|
5
27
|
raw: {
|
|
6
28
|
steps: ExecStepResult[];
|
|
7
29
|
};
|
|
8
30
|
}
|
|
31
|
+
/** The slice of a TrapSpec the oracle needs (avoids a circular import on the full tasks.ts shape). */
|
|
9
32
|
export interface OracleTask {
|
|
10
33
|
id: string;
|
|
34
|
+
/** Hidden test files the oracle restores into the grader checkout BEFORE scoring (worker never sees these). */
|
|
11
35
|
hiddenTestFiles: Array<{
|
|
12
36
|
path: string;
|
|
13
37
|
content: string;
|
|
14
38
|
}>;
|
|
39
|
+
/** The build step(s) — exit 0 = `buildPass`. Empty ⇒ `buildPass:true` (no build to fail). */
|
|
15
40
|
buildSteps: ExecStep[];
|
|
41
|
+
/** The hidden-test step(s) — exit 0 = `hiddenTestsPass`. MUST be non-empty (an empty suite never passes). */
|
|
16
42
|
oracleSteps: ExecStep[];
|
|
43
|
+
/** Optional property-harness invariant step(s) — exit 0 = `invariantsOk`. Empty ⇒ `invariantsOk:true` (N/A). */
|
|
17
44
|
invariantSteps?: ExecStep[];
|
|
45
|
+
/** Repo dir inside the grader env where the worker's committed tree was cloned/pulled. */
|
|
18
46
|
graderRepoDir: string;
|
|
47
|
+
/** The base ref to diff against for `delivered` (HEAD must differ AND be in the committed tree). */
|
|
19
48
|
baseRef: string;
|
|
49
|
+
/** 🔴 tar-worktree path (firm-v1/C4): when the grader receives a tar of the WORKTREE (no .git — to dodge the E2B
|
|
50
|
+
* grader-clone heisenbug + Kata virtiofs st_dev limit), `delivered` can't run `git rev-parse` in the grader. The
|
|
51
|
+
* worker (where git works) computes HEAD + s1-base shas up front; `delivered` = head≠base from THESE. When set,
|
|
52
|
+
* the grader does no git at all. Absent ⇒ the legacy `cd REPO && git rev-parse` path (mock tests). */
|
|
20
53
|
deliveredShas?: {
|
|
21
54
|
head: string;
|
|
22
55
|
base: string;
|
|
23
56
|
};
|
|
24
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* A minimal grader-side helper the oracle needs the env to expose to clone/pull the worker's COMMITTED tree IN
|
|
60
|
+
* and to write hidden tests. The real E2B/Kata env satisfies this via its exec/writeFile; the shape test passes
|
|
61
|
+
* a deterministic fake. (We DON'T reuse `ExecutionEnv.writeFile` directly only because the file-write path is
|
|
62
|
+
* env-specific — but we DO require the `ExecutionEnv` itself for `runExecGate`, the actual measure.)
|
|
63
|
+
*/
|
|
25
64
|
export interface GraderTransport {
|
|
65
|
+
/** Run a setup command in the grader (clone the worker's committed tree, checkout the SHA). Returns exit code. */
|
|
26
66
|
exec: (command: string) => Promise<{
|
|
27
67
|
exitCode: number;
|
|
28
68
|
stdout: string;
|
|
29
69
|
stderr: string;
|
|
30
70
|
}>;
|
|
71
|
+
/** Write a hidden test file into the grader checkout (overwriting a worker-authored same-named file). */
|
|
31
72
|
writeFile: (path: string, content: string) => Promise<void>;
|
|
32
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Run the hidden objective oracle against the worker's COMMITTED tree, IN a distinct grader env.
|
|
76
|
+
*
|
|
77
|
+
* @param graderEnv the distinct grader execution env (for `runExecGate` — the real measure).
|
|
78
|
+
* @param transport the grader's clone/checkout/writeFile seam (restore hidden tests + pull the committed tree in).
|
|
79
|
+
* @param workerEnv the worker's env — passed ONLY so we can assert `graderEnv !== workerEnv` (anti-reward-hack).
|
|
80
|
+
* @param task the trap's oracle config (hidden tests + build/oracle/invariant steps + repo + base ref).
|
|
81
|
+
*/
|
|
33
82
|
export declare function runOracle(graderEnv: ExecutionEnv, transport: GraderTransport, workerEnv: ExecutionEnv, task: OracleTask): Promise<OracleVerdict>;
|
|
34
83
|
//# sourceMappingURL=oracle.d.ts.map
|
package/dist/bench/s1/oracle.js
CHANGED
|
@@ -1,13 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S1 value-verdict harness — the HIDDEN OBJECTIVE ORACLE (the measure, NEVER an LLM). SPEC-S1-value-harness.md §4.
|
|
3
|
+
*
|
|
4
|
+
* ONE standalone oracle, shared by ALL three arms; ONLY the profile (arms.ts) differs. The oracle is:
|
|
5
|
+
* - OBJECTIVE: it runs `runExecGate` (real exit codes; null-exit never passes; an empty suite never passes —
|
|
6
|
+
* `exec-gate.d.ts`). There is NO model/LLM parameter ANYWHERE in this type (objective-oracle discipline,
|
|
7
|
+
* design/89 §2.2.1 — the LLM is a GATE inside an arm, never the MEASURE in the numerator).
|
|
8
|
+
* - DECORRELATED + ANTI-REWARD-HACK: it grades in a DISTINCT grader env (`ctx.newGraderEnv()`), never the
|
|
9
|
+
* worker's own env — the SAME isolation the repair-loop §5.1 identity check enforces.
|
|
10
|
+
* - HIDDEN + RESTORED-BEFORE-SCORING: the worker never sees `task.hiddenTestFiles`; the oracle WRITES them into
|
|
11
|
+
* the grader checkout, overwriting any worker-authored same-named file (anti-tamper, design/89 §2.2).
|
|
12
|
+
*
|
|
13
|
+
* The repair leg needs core's `RepairOracle = (graderEnv, evidence) => OracleResult` shape — a DIFFERENT
|
|
14
|
+
* signature. `repair-oracle-adapter.ts` wraps this standalone oracle into that closure (do NOT pass `runOracle`
|
|
15
|
+
* straight to `runRepairLoop` — it would not type-check + the repair leg would be miswired, SPEC Risk MEDIUM).
|
|
16
|
+
*/
|
|
1
17
|
import { runExecGate } from "@sema-agent/core";
|
|
2
18
|
import { assertDistinctEnvs } from "./runner-ctx.js";
|
|
3
19
|
import { oracleTrulyCorrect } from "./row.js";
|
|
20
|
+
/**
|
|
21
|
+
* Run the hidden objective oracle against the worker's COMMITTED tree, IN a distinct grader env.
|
|
22
|
+
*
|
|
23
|
+
* @param graderEnv the distinct grader execution env (for `runExecGate` — the real measure).
|
|
24
|
+
* @param transport the grader's clone/checkout/writeFile seam (restore hidden tests + pull the committed tree in).
|
|
25
|
+
* @param workerEnv the worker's env — passed ONLY so we can assert `graderEnv !== workerEnv` (anti-reward-hack).
|
|
26
|
+
* @param task the trap's oracle config (hidden tests + build/oracle/invariant steps + repo + base ref).
|
|
27
|
+
*/
|
|
4
28
|
export async function runOracle(graderEnv, transport, workerEnv, task) {
|
|
29
|
+
// 1. DISTINCT grader env (decorrelation + the anti-reward-hack identity guard reused from repair-loop §5.1).
|
|
5
30
|
assertDistinctEnvs(workerEnv, graderEnv);
|
|
31
|
+
// 2. Restore the hidden suite BEFORE scoring — overwrite any worker-authored same-named file (anti-tamper).
|
|
6
32
|
for (const f of task.hiddenTestFiles) {
|
|
7
33
|
await transport.writeFile(f.path, f.content);
|
|
8
34
|
}
|
|
35
|
+
// 3. `delivered` = the grader-side committed tree advanced past base (HEAD !== base, non-empty, exit 0) — the
|
|
36
|
+
// mechanical, LLM-free "a real commit landed" signal. NOTE: this does NOT prove "not reverted" (a `git revert`
|
|
37
|
+
// is itself a new commit that keeps HEAD !== base); the not-reverted CORRECTNESS signal is `hiddenTestsGreen`
|
|
38
|
+
// (a reverted tree fails the hidden suite). `delivered` carries only the HEAD-advanced fact onto the wire.
|
|
9
39
|
let delivered;
|
|
10
40
|
if (task.deliveredShas) {
|
|
41
|
+
// tar-worktree path: the worker (git works there) precomputed the shas; the grader holds only plain files (no
|
|
42
|
+
// .git), so we never run git in the grader. delivered = a real commit advanced HEAD past the seeded base.
|
|
11
43
|
const { head, base } = task.deliveredShas;
|
|
12
44
|
delivered = /^[0-9a-f]{40}$/.test(head) && /^[0-9a-f]{40}$/.test(base) && head !== base;
|
|
13
45
|
}
|
|
@@ -16,9 +48,12 @@ export async function runOracle(graderEnv, transport, workerEnv, task) {
|
|
|
16
48
|
const base = await transport.exec(`cd ${task.graderRepoDir} && git rev-parse ${task.baseRef}`);
|
|
17
49
|
delivered = head.exitCode === 0 && base.exitCode === 0 && head.stdout.trim() !== "" && head.stdout.trim() !== base.stdout.trim();
|
|
18
50
|
}
|
|
51
|
+
// 4. build / hidden-tests / invariants — real exit codes via runExecGate. Empty suite never passes; null-exit
|
|
52
|
+
// never passes (exec-gate.d.ts). An EMPTY build/invariant suite is treated as N/A (true) — there is nothing
|
|
53
|
+
// to fail; the hidden-test suite is REQUIRED non-empty (an empty hidden suite is not a vacuous pass).
|
|
19
54
|
const buildPassed = task.buildSteps.length === 0 ? true : (await runExecGate(graderEnv, task.buildSteps)).passed;
|
|
20
55
|
const oracleGate = await runExecGate(graderEnv, task.oracleSteps);
|
|
21
|
-
const hiddenTestsGreen = oracleGate.passed;
|
|
56
|
+
const hiddenTestsGreen = oracleGate.passed; // false for an empty suite (exec-gate guarantee)
|
|
22
57
|
const invariantsOk = task.invariantSteps === undefined || task.invariantSteps.length === 0
|
|
23
58
|
? true
|
|
24
59
|
: (await runExecGate(graderEnv, task.invariantSteps)).passed;
|
|
@@ -1,9 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S1 value-verdict harness — the REPAIR-LEG ORACLE ADAPTER. SPEC-S1-value-harness.md §4 + Risk MEDIUM.
|
|
3
|
+
*
|
|
4
|
+
* 🔴 WHY THIS FILE EXISTS (the draft got the signature wrong): our standalone `runOracle` (oracle.ts) is a
|
|
5
|
+
* 4-arg `(graderEnv, transport, workerEnv, task)` function, but core's `RepairOracle` is
|
|
6
|
+
* `(graderEnv, evidence) => Promise<OracleResult>` (`repair-loop.d.ts`). You CANNOT pass `runOracle` straight to
|
|
7
|
+
* `runRepairLoop` — it would not type-check and the repair leg would be miswired. This thin adapter closes over
|
|
8
|
+
* the transport + workerEnv + task and exposes core's exact `RepairOracle` closure shape.
|
|
9
|
+
*
|
|
10
|
+
* The adapter IGNORES `evidence` (our oracle reads the committed tree + restores hidden tests itself — the
|
|
11
|
+
* authoritative measure, not the worker's self-reported diff), runs `runOracle`, and maps:
|
|
12
|
+
* trulyCorrect → { passed: true, tier: "trusted_hidden" } (a hidden, spec-derived held-out oracle)
|
|
13
|
+
* else → { passed: false, tier: "trusted_hidden", trace }
|
|
14
|
+
* The terminal-by-tier projection then CAPS every PASS at `candidate_only` (SAFE-tier never auto-accepts —
|
|
15
|
+
* `repair-loop.d.ts terminalForTier`); the classifier (arms.ts) reads `candidate_only`/`gave_up`/`conflict`/
|
|
16
|
+
* `needs_human_oracle` as deliberate-withhold triggers. 🔴 `oracle.unprotected` is NOT a withhold — it is a §5.1
|
|
17
|
+
* isolation FAILURE (the oracle was reward-hackable), so arms.ts classifies it runStatus:"infra-failed" (EXCLUDED
|
|
18
|
+
* from scoring), never a withhold-credit.
|
|
19
|
+
*
|
|
20
|
+
* 🔴 The repair leg MUST still pass `workerEnv` to `runRepairLoop` (NOT just here) — the §5.1 identity check is
|
|
21
|
+
* SKIPPED when `workerEnv` is undefined (`repair-loop.d.ts:148`), silently disabling the anti-reward-hack guard.
|
|
22
|
+
* arms.ts is responsible for that; this adapter only wires the oracle closure.
|
|
23
|
+
*/
|
|
1
24
|
import type { ExecutionEnv, RepairOracle } from "@sema-agent/core";
|
|
2
25
|
import { type GraderTransport, type OracleTask } from "./oracle.js";
|
|
26
|
+
/**
|
|
27
|
+
* Wrap the standalone hidden oracle into core's `RepairOracle` closure. `flaky:false`/`retries:0` because our
|
|
28
|
+
* oracle is DETERMINISTIC (exit-code based, no LLM, no nondeterministic re-isolation) — a flaky verdict would
|
|
29
|
+
* never be projected to `fixed` anyway, and we don't re-isolate.
|
|
30
|
+
*/
|
|
3
31
|
export declare function makeRepairOracle(args: {
|
|
4
32
|
transport: GraderTransport;
|
|
5
33
|
workerEnv: ExecutionEnv;
|
|
6
34
|
task: OracleTask;
|
|
35
|
+
/** 🔴 RE-SYNC the worker's CURRENT committed tree into the grader BEFORE every attempt's grading. The repair loop
|
|
36
|
+
* calls this oracle ONCE PER ATTEMPT against an EVOLVING worker tree; without a per-call re-sync the grader stays
|
|
37
|
+
* frozen at the first-transfer snapshot and a fix landing on attempt 2 is never observed (the loop could never
|
|
38
|
+
* legitimately reach candidate_only/PASS). Idempotent (rm -rf REPO; git clone). Omit ⇒ no re-sync (the caller
|
|
39
|
+
* guarantees the tree is stable — NOT the case for the repair loop). */
|
|
7
40
|
reSyncGraderTree?: () => Promise<void>;
|
|
8
41
|
}): RepairOracle;
|
|
9
42
|
//# sourceMappingURL=repair-oracle-adapter.d.ts.map
|
|
@@ -1,4 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S1 value-verdict harness — the REPAIR-LEG ORACLE ADAPTER. SPEC-S1-value-harness.md §4 + Risk MEDIUM.
|
|
3
|
+
*
|
|
4
|
+
* 🔴 WHY THIS FILE EXISTS (the draft got the signature wrong): our standalone `runOracle` (oracle.ts) is a
|
|
5
|
+
* 4-arg `(graderEnv, transport, workerEnv, task)` function, but core's `RepairOracle` is
|
|
6
|
+
* `(graderEnv, evidence) => Promise<OracleResult>` (`repair-loop.d.ts`). You CANNOT pass `runOracle` straight to
|
|
7
|
+
* `runRepairLoop` — it would not type-check and the repair leg would be miswired. This thin adapter closes over
|
|
8
|
+
* the transport + workerEnv + task and exposes core's exact `RepairOracle` closure shape.
|
|
9
|
+
*
|
|
10
|
+
* The adapter IGNORES `evidence` (our oracle reads the committed tree + restores hidden tests itself — the
|
|
11
|
+
* authoritative measure, not the worker's self-reported diff), runs `runOracle`, and maps:
|
|
12
|
+
* trulyCorrect → { passed: true, tier: "trusted_hidden" } (a hidden, spec-derived held-out oracle)
|
|
13
|
+
* else → { passed: false, tier: "trusted_hidden", trace }
|
|
14
|
+
* The terminal-by-tier projection then CAPS every PASS at `candidate_only` (SAFE-tier never auto-accepts —
|
|
15
|
+
* `repair-loop.d.ts terminalForTier`); the classifier (arms.ts) reads `candidate_only`/`gave_up`/`conflict`/
|
|
16
|
+
* `needs_human_oracle` as deliberate-withhold triggers. 🔴 `oracle.unprotected` is NOT a withhold — it is a §5.1
|
|
17
|
+
* isolation FAILURE (the oracle was reward-hackable), so arms.ts classifies it runStatus:"infra-failed" (EXCLUDED
|
|
18
|
+
* from scoring), never a withhold-credit.
|
|
19
|
+
*
|
|
20
|
+
* 🔴 The repair leg MUST still pass `workerEnv` to `runRepairLoop` (NOT just here) — the §5.1 identity check is
|
|
21
|
+
* SKIPPED when `workerEnv` is undefined (`repair-loop.d.ts:148`), silently disabling the anti-reward-hack guard.
|
|
22
|
+
* arms.ts is responsible for that; this adapter only wires the oracle closure.
|
|
23
|
+
*/
|
|
1
24
|
import { runOracle } from "./oracle.js";
|
|
25
|
+
/**
|
|
26
|
+
* Wrap the standalone hidden oracle into core's `RepairOracle` closure. `flaky:false`/`retries:0` because our
|
|
27
|
+
* oracle is DETERMINISTIC (exit-code based, no LLM, no nondeterministic re-isolation) — a flaky verdict would
|
|
28
|
+
* never be projected to `fixed` anyway, and we don't re-isolate.
|
|
29
|
+
*/
|
|
2
30
|
export function makeRepairOracle(args) {
|
|
3
31
|
return async (graderEnv, _evidence) => {
|
|
4
32
|
if (args.reSyncGraderTree)
|
|
@@ -7,10 +35,12 @@ export function makeRepairOracle(args) {
|
|
|
7
35
|
if (v.trulyCorrect) {
|
|
8
36
|
return { tier: "trusted_hidden", passed: true, flaky: false, retries: 0 };
|
|
9
37
|
}
|
|
38
|
+
// The failure trace fed back into the next fix turn (untrusted; core delimits it — never inner-rewritten).
|
|
10
39
|
const trace = summarizeFailure(v);
|
|
11
40
|
return { tier: "trusted_hidden", passed: false, trace, flaky: false, retries: 0 };
|
|
12
41
|
};
|
|
13
42
|
}
|
|
43
|
+
/** A compact, deterministic failure trace from the oracle verdict (no model, no secrets — the real exit signals). */
|
|
14
44
|
function summarizeFailure(v) {
|
|
15
45
|
const parts = [
|
|
16
46
|
`delivered=${v.delivered}`,
|
|
@@ -1,30 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S1 value-verdict harness — the DETERMINISTIC RUBRIC REVIEWER (the C2 model). SPEC-S1-value-harness.md §9 +
|
|
3
|
+
* design/89 §3.4. PURE / deterministic, NO model call.
|
|
4
|
+
*
|
|
5
|
+
* 🔴 WHY A FIXED RUBRIC, NOT AN LLM REVIEWER: an LLM reviewer reintroduces judge noise AND makes C2
|
|
6
|
+
* (human-review wall-time) non-reproducible. The reviewer is a fixed-checklist approval decider whose
|
|
7
|
+
* think-time is a CONSTANT per gate kind (the SAME across all arms so it never advantages one). HONESTY-ON-THE-WIRE:
|
|
8
|
+
* a SUP/TEAM row whose C2 came from THIS rubric is stamped `meta.reviewerKind:"scripted-human-rubric"` by
|
|
9
|
+
* assembleRow (arms.ts) — modeled review seconds, NOT a real human; real-human C2 is S2. The smoke pins that flag.
|
|
10
|
+
*
|
|
11
|
+
* 🔴 boundCallId / boundInputHash are ECHOED VERBATIM by the CALLER (arms.ts) from the suspend's pending record
|
|
12
|
+
* (`Checkpoint.pendingAction.toolCallId` + `.boundInputHash`) — NEVER recomputed (the TOCTOU fail-closed
|
|
13
|
+
* `checkpoint.invalid_outcome`, checkpoint-store.d.ts). This reviewer decides ONLY allow/deny + think-time + the
|
|
14
|
+
* plan action; the verbatim binding is plumbed around it.
|
|
15
|
+
*/
|
|
16
|
+
/** The fixed think-time rubric (ms), constant across arms (so the modeled C2 burden never advantages one arm). */
|
|
1
17
|
export declare const THINK_MS: {
|
|
18
|
+
/** A normal human approval gate (`CheckpointGate.kind === "human"`). */
|
|
2
19
|
readonly human: 30000;
|
|
20
|
+
/** A safety-tightened approval gate (`CheckpointGate.kind === "irreversible_ask"`). */
|
|
3
21
|
readonly irreversible_ask: 60000;
|
|
22
|
+
/** A pre-action plan review (`CheckpointGate.kind === "plan_review"`). */
|
|
4
23
|
readonly plan_review: 45000;
|
|
5
24
|
};
|
|
6
25
|
export type GateKind = keyof typeof THINK_MS;
|
|
26
|
+
/** Look up the fixed modeled think-time for a gate kind (defaults to the `human` rubric for an unknown kind). */
|
|
7
27
|
export declare function thinkMsForGate(gateKind: string): number;
|
|
28
|
+
/** The trap slice the reviewer needs to apply its rubric (kept narrow to avoid a circular import on tasks.ts). */
|
|
8
29
|
export interface ReviewerTask {
|
|
9
30
|
id: string;
|
|
31
|
+
/** Tools that, when gated, are ON-SPEC for this trap (the reviewer ALLOWS these under budget). */
|
|
10
32
|
onSpecTools?: string[];
|
|
33
|
+
/** Tools that are SAFETY / irreversible / off-spec for this trap (the reviewer ALWAYS DENIES these). */
|
|
11
34
|
denyTools?: string[];
|
|
12
35
|
}
|
|
36
|
+
/** The approval rubric decision (allow/deny). The caller binds boundCallId/boundInputHash verbatim around it. */
|
|
13
37
|
export interface ApprovalDecision {
|
|
14
38
|
action: "allow" | "deny";
|
|
15
39
|
reason: string;
|
|
16
40
|
thinkMs: number;
|
|
17
41
|
}
|
|
42
|
+
/** The plan-review rubric decision. */
|
|
18
43
|
export interface PlanDecision {
|
|
19
44
|
action: "approve" | "edit" | "reject";
|
|
20
45
|
editedPlan?: string;
|
|
21
46
|
thinkMs: number;
|
|
22
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Decide an approval gate via the fixed checklist (NO model). Rubric:
|
|
50
|
+
* - a safety / off-spec / irreversible gated tool → DENY (the honest-bound / safety-escalate traps).
|
|
51
|
+
* - an on-spec gated tool → ALLOW.
|
|
52
|
+
* - anything else → DENY (conservative default; a withhold is never auto-credited — the metric tool's JOIN
|
|
53
|
+
* decides CORRECTLY vs INCORRECTLY-withheld over the counterfactual).
|
|
54
|
+
* `gateKind` drives ONLY the modeled think-time (constant per kind).
|
|
55
|
+
*/
|
|
23
56
|
export declare function decideApproval(input: {
|
|
24
57
|
gateKind: string;
|
|
25
58
|
toolName: string;
|
|
26
59
|
task: ReviewerTask;
|
|
27
60
|
}): ApprovalDecision;
|
|
61
|
+
/**
|
|
62
|
+
* Decide a plan-review gate via the fixed checklist (NO model). Rubric MVP: APPROVE the plan as-is (the plan-gate
|
|
63
|
+
* trap measures the C2 wait, not plan-editing quality, in S1). A trap that needs a reject can extend this via the
|
|
64
|
+
* task's deny list (a future enable). Think-time is the constant `plan_review` rubric.
|
|
65
|
+
*/
|
|
28
66
|
export declare function decidePlan(_input: {
|
|
29
67
|
task: ReviewerTask;
|
|
30
68
|
}): PlanDecision;
|
|
@@ -1,16 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S1 value-verdict harness — the DETERMINISTIC RUBRIC REVIEWER (the C2 model). SPEC-S1-value-harness.md §9 +
|
|
3
|
+
* design/89 §3.4. PURE / deterministic, NO model call.
|
|
4
|
+
*
|
|
5
|
+
* 🔴 WHY A FIXED RUBRIC, NOT AN LLM REVIEWER: an LLM reviewer reintroduces judge noise AND makes C2
|
|
6
|
+
* (human-review wall-time) non-reproducible. The reviewer is a fixed-checklist approval decider whose
|
|
7
|
+
* think-time is a CONSTANT per gate kind (the SAME across all arms so it never advantages one). HONESTY-ON-THE-WIRE:
|
|
8
|
+
* a SUP/TEAM row whose C2 came from THIS rubric is stamped `meta.reviewerKind:"scripted-human-rubric"` by
|
|
9
|
+
* assembleRow (arms.ts) — modeled review seconds, NOT a real human; real-human C2 is S2. The smoke pins that flag.
|
|
10
|
+
*
|
|
11
|
+
* 🔴 boundCallId / boundInputHash are ECHOED VERBATIM by the CALLER (arms.ts) from the suspend's pending record
|
|
12
|
+
* (`Checkpoint.pendingAction.toolCallId` + `.boundInputHash`) — NEVER recomputed (the TOCTOU fail-closed
|
|
13
|
+
* `checkpoint.invalid_outcome`, checkpoint-store.d.ts). This reviewer decides ONLY allow/deny + think-time + the
|
|
14
|
+
* plan action; the verbatim binding is plumbed around it.
|
|
15
|
+
*/
|
|
16
|
+
/** The fixed think-time rubric (ms), constant across arms (so the modeled C2 burden never advantages one arm). */
|
|
1
17
|
export const THINK_MS = {
|
|
18
|
+
/** A normal human approval gate (`CheckpointGate.kind === "human"`). */
|
|
2
19
|
human: 30_000,
|
|
20
|
+
/** A safety-tightened approval gate (`CheckpointGate.kind === "irreversible_ask"`). */
|
|
3
21
|
irreversible_ask: 60_000,
|
|
22
|
+
/** A pre-action plan review (`CheckpointGate.kind === "plan_review"`). */
|
|
4
23
|
plan_review: 45_000,
|
|
5
24
|
};
|
|
25
|
+
/** Look up the fixed modeled think-time for a gate kind (defaults to the `human` rubric for an unknown kind). */
|
|
6
26
|
export function thinkMsForGate(gateKind) {
|
|
7
27
|
return THINK_MS[gateKind] ?? THINK_MS.human;
|
|
8
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Decide an approval gate via the fixed checklist (NO model). Rubric:
|
|
31
|
+
* - a safety / off-spec / irreversible gated tool → DENY (the honest-bound / safety-escalate traps).
|
|
32
|
+
* - an on-spec gated tool → ALLOW.
|
|
33
|
+
* - anything else → DENY (conservative default; a withhold is never auto-credited — the metric tool's JOIN
|
|
34
|
+
* decides CORRECTLY vs INCORRECTLY-withheld over the counterfactual).
|
|
35
|
+
* `gateKind` drives ONLY the modeled think-time (constant per kind).
|
|
36
|
+
*/
|
|
9
37
|
export function decideApproval(input) {
|
|
10
38
|
const { gateKind, toolName, task } = input;
|
|
11
39
|
const thinkMs = thinkMsForGate(gateKind);
|
|
12
40
|
const deny = new Set(task.denyTools ?? []);
|
|
13
41
|
const onSpec = new Set(task.onSpecTools ?? []);
|
|
42
|
+
// A safety gate kind (irreversible_ask) is ALWAYS a human deny in the rubric unless the tool is explicitly on-spec.
|
|
14
43
|
if (deny.has(toolName))
|
|
15
44
|
return { action: "deny", reason: `rubric: tool "${toolName}" is off-spec/safety for trap ${task.id}`, thinkMs };
|
|
16
45
|
if (gateKind === "irreversible_ask" && !onSpec.has(toolName)) {
|
|
@@ -20,6 +49,11 @@ export function decideApproval(input) {
|
|
|
20
49
|
return { action: "allow", reason: `rubric: tool "${toolName}" is on-spec for trap ${task.id}`, thinkMs };
|
|
21
50
|
return { action: "deny", reason: `rubric: tool "${toolName}" not on the on-spec allowlist → conservative deny`, thinkMs };
|
|
22
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Decide a plan-review gate via the fixed checklist (NO model). Rubric MVP: APPROVE the plan as-is (the plan-gate
|
|
54
|
+
* trap measures the C2 wait, not plan-editing quality, in S1). A trap that needs a reject can extend this via the
|
|
55
|
+
* task's deny list (a future enable). Think-time is the constant `plan_review` rubric.
|
|
56
|
+
*/
|
|
23
57
|
export function decidePlan(_input) {
|
|
24
58
|
return { action: "approve", thinkMs: THINK_MS.plan_review };
|
|
25
59
|
}
|
package/dist/bench/s1/row.d.ts
CHANGED
|
@@ -1,28 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S1 value-verdict harness — the RawRow `s1.v1` CONTRACT (design/95 metrics layer).
|
|
3
|
+
*
|
|
4
|
+
* 🔴 RawRow IS core's `RunRecord` (the design/95 metric input) + the OUT-OF-BAND provenance the harness needs.
|
|
5
|
+
* core ships the design/95 metrics layer via the SUBPATH export `@sema-agent/core/bench`(1.111.0 首发;L17:版本锚随装机 core 走,见 S1_CORE_VERSION)
|
|
6
|
+
* The harness no longer mirrors the types — it IMPORTS the real `RunRecord` /
|
|
7
|
+
* `OracleVerdicts` / `DeliveryDecision` / `CoreStatsSubset` / `InterceptCounterfactual` and re-expresses
|
|
8
|
+
* `RawRow` as `RunRecord & { schemaVersion; meta? }`. A `RawRow[]` is therefore assignable to `RunRecord[]`,
|
|
9
|
+
* the input `buildReport` consumes (wired below as `buildS1Report`).
|
|
10
|
+
*
|
|
11
|
+
* 🔴 OUT-OF-BAND PROVENANCE: `schemaVersion` + `meta` are NOT RunRecord scoring fields — they are
|
|
12
|
+
* producer-side provenance (the field-contract handshake + git/run provenance). They ride ON TOP of the
|
|
13
|
+
* RunRecord shape, never inside it; the metric tool ignores them.
|
|
14
|
+
*
|
|
15
|
+
* 🔴 OWNERSHIP SPLIT (anti-laundering — load-bearing):
|
|
16
|
+
* - The HARNESS (this file + arms.ts) is the PRODUCER: it emits ONE conformant row per (task × arm × seed) with
|
|
17
|
+
* the raw measurement inputs (oracle / stats / delivery / counterfactual) and an HONEST `runStatus`.
|
|
18
|
+
* - The METRIC TOOL (core `buildReport`, design/95) does the CORRECTLY/INCORRECTLY/UNVERIFIED-withheld split via
|
|
19
|
+
* the counterfactual JOIN + the Simpson grouping. The harness NEVER credits a bare withhold as value.
|
|
20
|
+
* - The NUMERATOR is ONLY DELIVERED-CORRECT, and the OBJECTIVE oracle (oracle.ts) is the measure — an LLM-judge
|
|
21
|
+
* is NEVER in the numerator (it may only be a GATE inside an arm).
|
|
22
|
+
*
|
|
23
|
+
* 🔴 HONEST runStatus (the 命门 against benchmark noise): an INFRA death — OOM / passthrough / nested-root crash —
|
|
24
|
+
* is `"infra-failed"` and MUST be EXCLUDED from scoring, NOT scored as a loss. Default is `"scored"`.
|
|
25
|
+
*
|
|
26
|
+
* 🔴 HONEST withhold-credit: SOLO `delivery.withheld` is ALWAYS false (only a SUP/TEAM gate can intercept). A
|
|
27
|
+
* withheld run only earns CORRECTLY-WITHHELD credit when `counterfactual.withoutInterventionTrulyCorrect===false`;
|
|
28
|
+
* a withhold WITHOUT a counterfactual is UNVERIFIED-WITHHELD → no credit (the metric tool enforces this; the
|
|
29
|
+
* producer's job is to ATTACH the counterfactual whenever it withholds).
|
|
30
|
+
*/
|
|
1
31
|
import { type RunRecord, type OracleVerdicts, type DeliveryDecision, type CoreStatsSubset, type InterceptCounterfactual, type RunStatus, type ValueJudgmentReport, type ImplementedAxes } from "@sema-agent/core/bench";
|
|
2
32
|
import type { Arm } from "./arms.js";
|
|
3
33
|
export type { RunRecord, OracleVerdicts, DeliveryDecision, CoreStatsSubset, InterceptCounterfactual, RunStatus, ValueJudgmentReport, };
|
|
34
|
+
/** The schema version stamped into every row — the field-contract handshake with core's metric tool. */
|
|
4
35
|
export declare const S1_SCHEMA_VERSION: "s1.v1";
|
|
5
36
|
export type S1SchemaVersion = typeof S1_SCHEMA_VERSION;
|
|
37
|
+
/** The INSTALLED core version, read from node_modules at load(SPEC §0 provenance-honesty——接入审计 L16:
|
|
38
|
+
* 硬钉 "1.111.0" 在 core 升到 1.258.x 后让 harness 每行 meta.coreVersion 输出错误溯源;动态读=永不再漂)。 */
|
|
6
39
|
export declare const S1_CORE_VERSION: string;
|
|
40
|
+
/** The arm tag as emitted on the wire (lowercase — the s1.v1 contract value; the internal `Arm` is uppercase). The
|
|
41
|
+
* harness emits a SUBSET of core's `RunRecord["arm"]` (which also carries "sup-vf", an S1b ablation S1 does not run). */
|
|
7
42
|
export type ArmTag = "solo" | "sup" | "team";
|
|
43
|
+
/** Map the internal uppercase `Arm` to its lowercase s1.v1 wire tag. */
|
|
8
44
|
export declare function armTag(arm: Arm): ArmTag;
|
|
45
|
+
/**
|
|
46
|
+
* delivered && hiddenTestsGreen && buildPassed && invariantsOk — the ONLY thing that counts as value. This is the
|
|
47
|
+
* SAME function as core's exported `trulyCorrect` (shape-equal over the 4 booleans); re-exported under the harness's
|
|
48
|
+
* historical name so callers and the producer recompute it from the same source the metric tool uses (it can never
|
|
49
|
+
* drift from the metric's definition).
|
|
50
|
+
*/
|
|
9
51
|
export declare const oracleTrulyCorrect: (o: OracleVerdicts) => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* 🔴 Narrow an oracle result down to EXACTLY the 4 s1.v1 contract booleans before it goes on the wire. The
|
|
54
|
+
* standalone `runOracle` (oracle.ts) returns an `OracleVerdict` SUPERSET (`trulyCorrect`, `raw`) that is
|
|
55
|
+
* structurally assignable to the `() => Promise<OracleVerdicts>` seam — without this defensive projection those
|
|
56
|
+
* extra producer-internal fields would JSON.stringify straight into the emitted row's `oracle` block, drifting it
|
|
57
|
+
* off s1.v1 and (worse) re-exporting the derived `trulyCorrect` the metric tool must RECOMPUTE and never trust.
|
|
58
|
+
*/
|
|
10
59
|
export declare function pickOracleVerdicts(o: OracleVerdicts): OracleVerdicts;
|
|
60
|
+
/**
|
|
61
|
+
* ONE s1.v1 row per (taskId × arm × seed). RawRow IS a core `RunRecord` PLUS the out-of-band provenance
|
|
62
|
+
* (`schemaVersion` + `meta`) the metric tool ignores — so a `RawRow[]` is directly assignable to `RunRecord[]`
|
|
63
|
+
* (the `buildReport` input). All µUSD/ms; no pre-composed scalars (the metric tool composes). The producer narrows
|
|
64
|
+
* `arm` to {@link ArmTag} (the s1.v1 lowercase subset) and omits `infraMicroUsd` when not measured (never a faked 0).
|
|
65
|
+
*/
|
|
11
66
|
export interface RawRow extends RunRecord {
|
|
67
|
+
/** lowercase arm tag (the s1.v1 wire value) — a SUBSET of `RunRecord["arm"]` (S1 never runs the "sup-vf" ablation). */
|
|
12
68
|
arm: ArmTag;
|
|
69
|
+
/** The schema-version handshake (NOT a core RunRecord field — a producer-side provenance stamp the shape test pins). */
|
|
13
70
|
schemaVersion: S1SchemaVersion;
|
|
71
|
+
/** Provenance the metric tool ignores but search reads (NOT a RunRecord scoring field). */
|
|
14
72
|
meta?: {
|
|
15
73
|
startedAt: number;
|
|
16
74
|
finishedAt: number;
|
|
17
75
|
coreVersion: typeof S1_CORE_VERSION;
|
|
18
76
|
gitSha: string;
|
|
19
77
|
runId: string;
|
|
78
|
+
/** 🔴 HONESTY-ON-THE-WIRE: stamped on a SUP/TEAM row whose C2 (stats.humanReview) came from the DETERMINISTIC
|
|
79
|
+
* rubric reviewer (reviewer.ts THINK_MS), NOT a real human (real-human C2 is S2). Absent ⇒ no modeled review
|
|
80
|
+
* touched the row (e.g. SOLO, or a SUP/TEAM run with no humanReview gate). A non-scoring provenance flag.
|
|
81
|
+
* (core's RunRecord carries `judgeMode:"scripted-human-initjudge"` for the same honesty at the record level;
|
|
82
|
+
* arms.ts also stamps that field. This provenance copy stays on `meta` for the search-side readers.) */
|
|
20
83
|
reviewerKind?: "scripted-human-rubric";
|
|
84
|
+
/** TEAM bigger-pie guard input (Σ the leader's ACTUAL stamped per-worker budgets); read by assertBudgetMatch. */
|
|
21
85
|
teamWorkerBudgetSumUsd?: number;
|
|
22
86
|
};
|
|
23
87
|
}
|
|
88
|
+
/** Serialize a RawRow to one JSONL line (no trailing newline — the writer joins with "\n"). */
|
|
24
89
|
export declare function rowToJsonl(row: RawRow): string;
|
|
90
|
+
/** Serialize a batch of RawRows to a JSONL document (one row per line, trailing newline). */
|
|
25
91
|
export declare function rowsToJsonl(rows: RawRow[]): string;
|
|
92
|
+
/**
|
|
93
|
+
* 🔴 Wire the REAL design/95 metric tool. `buildReport` (core 1.111.0 `@sema-agent/core/bench`) is the
|
|
94
|
+
* value-verdict JOIN: it SCORES only `scored` rows, GROUPS by `(suiteVersion, taskId, archetype, valueDimension,
|
|
95
|
+
* arm)` (the Simpson guard), folds each cell, splits the withhold bucket by the counterfactual, and emits the
|
|
96
|
+
* `ValueJudgmentReport` (groupedCells / comparisons / cells / pareto / excluded). A `RawRow[]` is assignable to its
|
|
97
|
+
* `RunRecord[]` input (RawRow extends RunRecord), so the harness produces the verdict from its OWN rows with no
|
|
98
|
+
* re-mapping — the metric definition lives in core, the producer only emits honest inputs.
|
|
99
|
+
*
|
|
100
|
+
* The live SOLO/SUP/TEAM run that GENERATES rows is clay-gated (expensive E2B+DeepSeek); this is purely the
|
|
101
|
+
* CONSUME path (test-covered on synthetic conformant rows in test/s1-report.test.ts).
|
|
102
|
+
*/
|
|
26
103
|
export declare function buildS1Report(rows: RawRow[], opts?: {
|
|
27
104
|
implementedAxes?: Partial<ImplementedAxes>;
|
|
28
105
|
}): ValueJudgmentReport;
|
package/dist/bench/s1/row.js
CHANGED
|
@@ -1,10 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S1 value-verdict harness — the RawRow `s1.v1` CONTRACT (design/95 metrics layer).
|
|
3
|
+
*
|
|
4
|
+
* 🔴 RawRow IS core's `RunRecord` (the design/95 metric input) + the OUT-OF-BAND provenance the harness needs.
|
|
5
|
+
* core ships the design/95 metrics layer via the SUBPATH export `@sema-agent/core/bench`(1.111.0 首发;L17:版本锚随装机 core 走,见 S1_CORE_VERSION)
|
|
6
|
+
* The harness no longer mirrors the types — it IMPORTS the real `RunRecord` /
|
|
7
|
+
* `OracleVerdicts` / `DeliveryDecision` / `CoreStatsSubset` / `InterceptCounterfactual` and re-expresses
|
|
8
|
+
* `RawRow` as `RunRecord & { schemaVersion; meta? }`. A `RawRow[]` is therefore assignable to `RunRecord[]`,
|
|
9
|
+
* the input `buildReport` consumes (wired below as `buildS1Report`).
|
|
10
|
+
*
|
|
11
|
+
* 🔴 OUT-OF-BAND PROVENANCE: `schemaVersion` + `meta` are NOT RunRecord scoring fields — they are
|
|
12
|
+
* producer-side provenance (the field-contract handshake + git/run provenance). They ride ON TOP of the
|
|
13
|
+
* RunRecord shape, never inside it; the metric tool ignores them.
|
|
14
|
+
*
|
|
15
|
+
* 🔴 OWNERSHIP SPLIT (anti-laundering — load-bearing):
|
|
16
|
+
* - The HARNESS (this file + arms.ts) is the PRODUCER: it emits ONE conformant row per (task × arm × seed) with
|
|
17
|
+
* the raw measurement inputs (oracle / stats / delivery / counterfactual) and an HONEST `runStatus`.
|
|
18
|
+
* - The METRIC TOOL (core `buildReport`, design/95) does the CORRECTLY/INCORRECTLY/UNVERIFIED-withheld split via
|
|
19
|
+
* the counterfactual JOIN + the Simpson grouping. The harness NEVER credits a bare withhold as value.
|
|
20
|
+
* - The NUMERATOR is ONLY DELIVERED-CORRECT, and the OBJECTIVE oracle (oracle.ts) is the measure — an LLM-judge
|
|
21
|
+
* is NEVER in the numerator (it may only be a GATE inside an arm).
|
|
22
|
+
*
|
|
23
|
+
* 🔴 HONEST runStatus (the 命门 against benchmark noise): an INFRA death — OOM / passthrough / nested-root crash —
|
|
24
|
+
* is `"infra-failed"` and MUST be EXCLUDED from scoring, NOT scored as a loss. Default is `"scored"`.
|
|
25
|
+
*
|
|
26
|
+
* 🔴 HONEST withhold-credit: SOLO `delivery.withheld` is ALWAYS false (only a SUP/TEAM gate can intercept). A
|
|
27
|
+
* withheld run only earns CORRECTLY-WITHHELD credit when `counterfactual.withoutInterventionTrulyCorrect===false`;
|
|
28
|
+
* a withhold WITHOUT a counterfactual is UNVERIFIED-WITHHELD → no credit (the metric tool enforces this; the
|
|
29
|
+
* producer's job is to ATTACH the counterfactual whenever it withholds).
|
|
30
|
+
*/
|
|
1
31
|
import { buildReport, trulyCorrect, } from "@sema-agent/core/bench";
|
|
2
32
|
import { createRequire } from "node:module";
|
|
3
33
|
import { readFileSync, existsSync } from "node:fs";
|
|
4
34
|
import { dirname, join } from "node:path";
|
|
35
|
+
/** The schema version stamped into every row — the field-contract handshake with core's metric tool. */
|
|
5
36
|
export const S1_SCHEMA_VERSION = "s1.v1";
|
|
37
|
+
/** The INSTALLED core version, read from node_modules at load(SPEC §0 provenance-honesty——接入审计 L16:
|
|
38
|
+
* 硬钉 "1.111.0" 在 core 升到 1.258.x 后让 harness 每行 meta.coreVersion 输出错误溯源;动态读=永不再漂)。 */
|
|
6
39
|
export const S1_CORE_VERSION = (() => {
|
|
7
40
|
try {
|
|
41
|
+
// NB:不能 require.resolve("@sema-agent/core/package.json")——core 的 exports map 无 ./package.json 子路径
|
|
42
|
+
// (ERR_PACKAGE_PATH_NOT_EXPORTED,与 release.sh step5 同款老坑)。从入口路径向上走找包根。
|
|
8
43
|
const require = createRequire(import.meta.url);
|
|
9
44
|
let dir = dirname(require.resolve("@sema-agent/core"));
|
|
10
45
|
for (let i = 0; i < 6; i++) {
|
|
@@ -22,6 +57,7 @@ export const S1_CORE_VERSION = (() => {
|
|
|
22
57
|
return "unknown";
|
|
23
58
|
}
|
|
24
59
|
})();
|
|
60
|
+
/** Map the internal uppercase `Arm` to its lowercase s1.v1 wire tag. */
|
|
25
61
|
export function armTag(arm) {
|
|
26
62
|
switch (arm) {
|
|
27
63
|
case "SOLO":
|
|
@@ -32,7 +68,20 @@ export function armTag(arm) {
|
|
|
32
68
|
return "team";
|
|
33
69
|
}
|
|
34
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* delivered && hiddenTestsGreen && buildPassed && invariantsOk — the ONLY thing that counts as value. This is the
|
|
73
|
+
* SAME function as core's exported `trulyCorrect` (shape-equal over the 4 booleans); re-exported under the harness's
|
|
74
|
+
* historical name so callers and the producer recompute it from the same source the metric tool uses (it can never
|
|
75
|
+
* drift from the metric's definition).
|
|
76
|
+
*/
|
|
35
77
|
export const oracleTrulyCorrect = trulyCorrect;
|
|
78
|
+
/**
|
|
79
|
+
* 🔴 Narrow an oracle result down to EXACTLY the 4 s1.v1 contract booleans before it goes on the wire. The
|
|
80
|
+
* standalone `runOracle` (oracle.ts) returns an `OracleVerdict` SUPERSET (`trulyCorrect`, `raw`) that is
|
|
81
|
+
* structurally assignable to the `() => Promise<OracleVerdicts>` seam — without this defensive projection those
|
|
82
|
+
* extra producer-internal fields would JSON.stringify straight into the emitted row's `oracle` block, drifting it
|
|
83
|
+
* off s1.v1 and (worse) re-exporting the derived `trulyCorrect` the metric tool must RECOMPUTE and never trust.
|
|
84
|
+
*/
|
|
36
85
|
export function pickOracleVerdicts(o) {
|
|
37
86
|
return {
|
|
38
87
|
delivered: o.delivered,
|
|
@@ -43,12 +92,25 @@ export function pickOracleVerdicts(o) {
|
|
|
43
92
|
}
|
|
44
93
|
const _rawRowIsRunRecord = true;
|
|
45
94
|
void _rawRowIsRunRecord;
|
|
95
|
+
/** Serialize a RawRow to one JSONL line (no trailing newline — the writer joins with "\n"). */
|
|
46
96
|
export function rowToJsonl(row) {
|
|
47
97
|
return JSON.stringify(row);
|
|
48
98
|
}
|
|
99
|
+
/** Serialize a batch of RawRows to a JSONL document (one row per line, trailing newline). */
|
|
49
100
|
export function rowsToJsonl(rows) {
|
|
50
101
|
return rows.map(rowToJsonl).join("\n") + (rows.length > 0 ? "\n" : "");
|
|
51
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* 🔴 Wire the REAL design/95 metric tool. `buildReport` (core 1.111.0 `@sema-agent/core/bench`) is the
|
|
105
|
+
* value-verdict JOIN: it SCORES only `scored` rows, GROUPS by `(suiteVersion, taskId, archetype, valueDimension,
|
|
106
|
+
* arm)` (the Simpson guard), folds each cell, splits the withhold bucket by the counterfactual, and emits the
|
|
107
|
+
* `ValueJudgmentReport` (groupedCells / comparisons / cells / pareto / excluded). A `RawRow[]` is assignable to its
|
|
108
|
+
* `RunRecord[]` input (RawRow extends RunRecord), so the harness produces the verdict from its OWN rows with no
|
|
109
|
+
* re-mapping — the metric definition lives in core, the producer only emits honest inputs.
|
|
110
|
+
*
|
|
111
|
+
* The live SOLO/SUP/TEAM run that GENERATES rows is clay-gated (expensive E2B+DeepSeek); this is purely the
|
|
112
|
+
* CONSUME path (test-covered on synthetic conformant rows in test/s1-report.test.ts).
|
|
113
|
+
*/
|
|
52
114
|
export function buildS1Report(rows, opts) {
|
|
53
115
|
return buildReport(rows, opts);
|
|
54
116
|
}
|