@sema-agent/core 5.19.0 → 5.21.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/CHANGELOG.md +102 -4
- package/dist/agents/agent-definition.d.ts +7 -0
- package/dist/agents/agent-transcript-tool.d.ts +30 -0
- package/dist/agents/builtin-agents.d.ts +60 -0
- package/dist/agents/cascade.d.ts +107 -0
- package/dist/agents/cumulative-stats.d.ts +56 -0
- package/dist/agents/observer.d.ts +162 -0
- package/dist/agents/peer-admission.d.ts +95 -0
- package/dist/agents/repair-loop.d.ts +226 -0
- package/dist/agents/retain-ledger.d.ts +141 -0
- package/dist/agents/roster-store.d.ts +105 -0
- package/dist/agents/roster-store.js +3 -0
- package/dist/agents/send-message-tool.d.ts +92 -0
- package/dist/agents/session-util.d.ts +5 -0
- package/dist/agents/subagent-steps.d.ts +66 -0
- package/dist/agents/subagent.d.ts +600 -0
- package/dist/agents/suspend-guard.d.ts +29 -0
- package/dist/agents/teacher.d.ts +75 -0
- package/dist/agents/team.d.ts +120 -1
- package/dist/agents/tool-filter.d.ts +34 -0
- package/dist/agents/verify.d.ts +198 -0
- package/dist/bench/metrics.d.ts +455 -0
- package/dist/brain/anthropic.d.ts +30 -0
- package/dist/brain/circuit-breaker.d.ts +33 -0
- package/dist/brain/circuit-breaker.js +14 -3
- package/dist/brain/context-overflow.d.ts +60 -3
- package/dist/brain/degrading.d.ts +67 -0
- package/dist/brain/errors.d.ts +42 -0
- package/dist/brain/failover.d.ts +15 -0
- package/dist/brain/media-degrade.d.ts +39 -0
- package/dist/brain/model-presets.d.ts +31 -0
- package/dist/brain/open-responses.d.ts +19 -0
- package/dist/brain/openai.d.ts +46 -0
- package/dist/brain/reasoning.d.ts +106 -1
- package/dist/brain/repetition.d.ts +83 -0
- package/dist/brain/request-params.d.ts +56 -0
- package/dist/brain/retry.d.ts +46 -0
- package/dist/brain/routing.d.ts +12 -0
- package/dist/brain/status-sink.d.ts +30 -1
- package/dist/brain/stream-engine.d.ts +147 -0
- package/dist/brain/stream-shared.d.ts +34 -0
- package/dist/brain/terminal-cause.d.ts +31 -0
- package/dist/brain/timeout.d.ts +108 -0
- package/dist/brain/timeout.js +11 -0
- package/dist/brain/tool-call-id.d.ts +20 -0
- package/dist/brain/tool-call-repair.d.ts +13 -0
- package/dist/config/catalog.d.ts +47 -0
- package/dist/config/defaults.d.ts +33 -0
- package/dist/core/a2a-task-state.d.ts +53 -0
- package/dist/core/a2a.d.ts +51 -0
- package/dist/core/arg-summary.d.ts +62 -0
- package/dist/core/ask-question.d.ts +272 -2
- package/dist/core/auto-compaction.d.ts +467 -0
- package/dist/core/auto-compaction.js +20 -6
- package/dist/core/auto-mode-prompt-assets.d.ts +8 -0
- package/dist/core/auto-mode-prompt.d.ts +27 -0
- package/dist/core/auto-mode.d.ts +54 -3
- package/dist/core/auto-promote.d.ts +100 -0
- package/dist/core/background-agent-store.d.ts +293 -0
- package/dist/core/background-agent-store.js +5 -0
- package/dist/core/background-shell.d.ts +110 -0
- package/dist/core/cache-break-detector.d.ts +34 -0
- package/dist/core/canonical-json.d.ts +57 -0
- package/dist/core/checkpoint-store.d.ts +1574 -16
- package/dist/core/compliance.d.ts +30 -0
- package/dist/core/consolidate-scope.d.ts +75 -0
- package/dist/core/context-edit.d.ts +99 -0
- package/dist/core/context-guard.d.ts +46 -0
- package/dist/core/exec-gate.d.ts +44 -0
- package/dist/core/exec-output-tail.d.ts +61 -0
- package/dist/core/file-snapshot-store.d.ts +104 -0
- package/dist/core/fs-write-gate-policy.d.ts +36 -0
- package/dist/core/git-worktree-env.d.ts +31 -0
- package/dist/core/governance-codes.d.ts +19 -0
- package/dist/core/hooks.d.ts +609 -1
- package/dist/core/human-input-projection.d.ts +37 -0
- package/dist/core/human-input-projection.js +13 -0
- package/dist/core/image-downsample.d.ts +74 -0
- package/dist/core/locked-config.d.ts +37 -0
- package/dist/core/lsp-diagnostics.d.ts +77 -0
- package/dist/core/lsp-protocol.d.ts +29 -0
- package/dist/core/lsp-session.d.ts +60 -1
- package/dist/core/lsp.d.ts +150 -1
- package/dist/core/mailbox-store.d.ts +57 -0
- package/dist/core/mailbox-store.js +2 -0
- package/dist/core/mcp.d.ts +385 -0
- package/dist/core/mcp.js +58 -11
- package/dist/core/media-byte-cap.d.ts +21 -0
- package/dist/core/memory-admission.d.ts +71 -0
- package/dist/core/memory-engine/content-origin.d.ts +64 -0
- package/dist/core/memory-engine/data-plane.d.ts +43 -0
- package/dist/core/memory-engine/dual-root.d.ts +24 -0
- package/dist/core/memory-engine/engine.d.ts +230 -0
- package/dist/core/memory-engine/engine.js +103 -35
- package/dist/core/memory-engine/file-backend.d.ts +155 -0
- package/dist/core/memory-engine/frontmatter.d.ts +16 -0
- package/dist/core/memory-engine/layout.d.ts +217 -0
- package/dist/core/memory-engine/memory-backend-contract.d.ts +12 -0
- package/dist/core/memory-engine/migrate.d.ts +9 -0
- package/dist/core/memory-engine/scan.d.ts +12 -0
- package/dist/core/memory-engine/scope-contract.d.ts +61 -1
- package/dist/core/memory-engine/sync-client.d.ts +87 -0
- package/dist/core/memory-engine/sync.d.ts +60 -0
- package/dist/core/memory-engine/tools.d.ts +41 -0
- package/dist/core/memory-engine/types.d.ts +188 -0
- package/dist/core/memory-recall.d.ts +141 -0
- package/dist/core/memory-vector.d.ts +20 -0
- package/dist/core/memory.d.ts +458 -0
- package/dist/core/message-utils.d.ts +6 -0
- package/dist/core/oracle-isolation.d.ts +69 -0
- package/dist/core/permission-rule-consent.d.ts +138 -0
- package/dist/core/permission-rule-model.d.ts +122 -0
- package/dist/core/permission-rule-store.d.ts +119 -3
- package/dist/core/permission-rules.d.ts +87 -1
- package/dist/core/present-plan-tool.d.ts +20 -0
- package/dist/core/pricing.d.ts +26 -0
- package/dist/core/property-harness.d.ts +86 -0
- package/dist/core/protocol-naming.d.ts +38 -0
- package/dist/core/protocol-table.d.ts +61 -0
- package/dist/core/push-queue.d.ts +1 -0
- package/dist/core/remote-env.d.ts +383 -1
- package/dist/core/retention-policy.d.ts +40 -0
- package/dist/core/retention-policy.js +21 -0
- package/dist/core/retention.d.ts +51 -0
- package/dist/core/roles.d.ts +59 -0
- package/dist/core/runner/active-skill-scope.d.ts +34 -0
- package/dist/core/runner/assemble-result.d.ts +134 -0
- package/dist/core/runner/compaction-call-options.d.ts +97 -1
- package/dist/core/runner/grounding-signal.d.ts +10 -0
- package/dist/core/runner/image.d.ts +17 -0
- package/dist/core/runner/image.js +29 -15
- package/dist/core/runner/memory-consolidation.d.ts +60 -0
- package/dist/core/runner/prepare-memory.d.ts +59 -0
- package/dist/core/runner/prepare-task.d.ts +1011 -2
- package/dist/core/runner/prepare-task.js +51 -14
- package/dist/core/runner/prompt-suggestions.d.ts +7 -0
- package/dist/core/runner/runtask.d.ts +304 -3
- package/dist/core/runner/runtask.js +17 -2
- package/dist/core/runner/session-file-state-replay.d.ts +49 -0
- package/dist/core/runner/session-rule-policy.d.ts +58 -0
- package/dist/core/runner/strict-output-schema.d.ts +18 -3
- package/dist/core/runner/synthetic-tools.d.ts +113 -0
- package/dist/core/runner/teardown-bounded.d.ts +34 -0
- package/dist/core/runner/tool-disclosure.d.ts +227 -0
- package/dist/core/runner/tool-output-projection.d.ts +6 -0
- package/dist/core/runner/turn-attachments.d.ts +634 -0
- package/dist/core/runner/usage-accounting.d.ts +32 -0
- package/dist/core/runtime.d.ts +9 -0
- package/dist/core/safe-notify.d.ts +64 -0
- package/dist/core/safety-axis-vocab.d.ts +23 -0
- package/dist/core/safety-merge-corpus.d.ts +37 -0
- package/dist/core/scheduler.d.ts +121 -0
- package/dist/core/secret-env.d.ts +32 -0
- package/dist/core/select-model.d.ts +15 -0
- package/dist/core/sensitive-path-policy.d.ts +42 -0
- package/dist/core/session-policy-store.d.ts +94 -0
- package/dist/core/session-reconcile.d.ts +80 -0
- package/dist/core/session-store.d.ts +85 -0
- package/dist/core/session.d.ts +153 -0
- package/dist/core/shared-memory/contract.d.ts +22 -0
- package/dist/core/shared-memory/normalize.d.ts +123 -2
- package/dist/core/shared-memory/tools.d.ts +14 -0
- package/dist/core/shared-memory/types.d.ts +105 -0
- package/dist/core/shutdown-debug.d.ts +6 -0
- package/dist/core/side-query.d.ts +38 -0
- package/dist/core/side-query.js +6 -1
- package/dist/core/skill-tool-specifier.d.ts +72 -0
- package/dist/core/skills-directory.d.ts +100 -1
- package/dist/core/spec-contract.d.ts +89 -0
- package/dist/core/store-contracts/background-agent-store-contract.d.ts +31 -0
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +26 -0
- package/dist/core/store-contracts/contract-harness.d.ts +20 -0
- package/dist/core/store-contracts/contract-kit-version.d.ts +27 -0
- package/dist/core/store-contracts/file-snapshot-store-contract.d.ts +8 -0
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +42 -0
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +13 -0
- package/dist/core/strategy-store.d.ts +37 -0
- package/dist/core/stub-env.d.ts +7 -0
- package/dist/core/surrogate-safe-slice.d.ts +35 -0
- package/dist/core/task-notification.d.ts +202 -0
- package/dist/core/task-outcome.d.ts +53 -0
- package/dist/core/task-registry-agent.d.ts +337 -1
- package/dist/core/task-registry-agent.js +2 -0
- package/dist/core/task-registry-monitor.d.ts +12 -0
- package/dist/core/task-registry-shared.d.ts +540 -0
- package/dist/core/task-registry.d.ts +343 -0
- package/dist/core/task-registry.js +13 -2
- package/dist/core/task-tool-shape.d.ts +44 -0
- package/dist/core/tighten-task-spec.d.ts +21 -0
- package/dist/core/tool-detach.d.ts +21 -0
- package/dist/core/tool-errors.d.ts +131 -0
- package/dist/core/tool-errors.js +4 -0
- package/dist/core/tool-name-aliases.d.ts +27 -0
- package/dist/core/tool-policy.d.ts +555 -0
- package/dist/core/tool-policy.js +3 -0
- package/dist/core/tool-result-budget.d.ts +32 -0
- package/dist/core/tool-result-store.d.ts +174 -1
- package/dist/core/tools.d.ts +45 -0
- package/dist/core/trace.d.ts +323 -0
- package/dist/core/types.d.ts +3859 -2
- package/dist/core/untrusted-egress.d.ts +8 -0
- package/dist/core/untrusted-text.d.ts +156 -0
- package/dist/core/usage-window-store.d.ts +95 -0
- package/dist/core/version.d.ts +1 -0
- package/dist/core/warm-resume.d.ts +17 -0
- package/dist/core/wiring-manifest.d.ts +169 -0
- package/dist/core/with-retry.d.ts +24 -0
- package/dist/core/workflow-journal-store.d.ts +160 -0
- package/dist/core/workflow-run-store-contract.d.ts +25 -0
- package/dist/core/workflow-run-store.d.ts +119 -0
- package/dist/core/workflow-run-store.js +2 -0
- package/dist/engine/compaction/compaction.d.ts +256 -1
- package/dist/engine/compaction/utils.d.ts +94 -0
- package/dist/engine/execution-env/kill-tree.d.ts +29 -0
- package/dist/engine/execution-env/node-execution-env.d.ts +94 -0
- package/dist/engine/harness/agent-harness.d.ts +116 -0
- package/dist/engine/harness/agent-harness.js +3 -14
- package/dist/engine/harness/messages.d.ts +15 -0
- package/dist/engine/harness/types.d.ts +464 -2
- package/dist/engine/llm/diagnostics.d.ts +4 -0
- package/dist/engine/llm/event-stream.d.ts +3 -0
- package/dist/engine/llm/index.d.ts +7 -0
- package/dist/engine/llm/types.d.ts +500 -3
- package/dist/engine/llm/validation.d.ts +3 -0
- package/dist/engine/loop/agent-loop.d.ts +87 -2
- package/dist/engine/loop/runtime-deps.d.ts +7 -0
- package/dist/engine/loop/types.d.ts +424 -0
- package/dist/engine/lsp/frame-decoder.d.ts +13 -0
- package/dist/engine/lsp/node-lsp-manager.d.ts +107 -0
- package/dist/engine/lsp/stdio-lsp-transport.d.ts +7 -0
- package/dist/engine/session/import-validate.d.ts +27 -0
- package/dist/engine/session/log-digest.d.ts +93 -0
- package/dist/engine/session/memory-repo.d.ts +6 -0
- package/dist/engine/session/memory-storage.d.ts +2 -0
- package/dist/engine/session/session.d.ts +75 -0
- package/dist/engine/session/storage-base.d.ts +8 -0
- package/dist/fixtures/index.d.ts +36 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.js +1 -2
- package/dist/internal/harness-types.d.ts +6 -0
- package/dist/internal/harness.d.ts +11 -0
- package/dist/internal/llm.d.ts +6 -0
- package/dist/orchestration/builtin-workflows.d.ts +53 -0
- package/dist/orchestration/dev-vm-script-runner.d.ts +19 -0
- package/dist/orchestration/goal.d.ts +57 -0
- package/dist/orchestration/goal.js +3 -0
- package/dist/orchestration/run-spec.d.ts +42 -0
- package/dist/orchestration/run-spec.js +4 -0
- package/dist/orchestration/run-workflow-tool.d.ts +169 -0
- package/dist/orchestration/workflow-governance.d.ts +61 -0
- package/dist/orchestration/workflow-meta.d.ts +28 -0
- package/dist/orchestration/workflow-observe.d.ts +60 -0
- package/dist/orchestration/workflow-primitives.d.ts +23 -1
- package/dist/orchestration/workflow-sandbox-conformance.d.ts +38 -0
- package/dist/orchestration/workflow-script-runner.d.ts +88 -0
- package/dist/orchestration/workflow-script-store.d.ts +98 -0
- package/dist/orchestration/workflow-size-guideline.d.ts +67 -0
- package/dist/orchestration/workflow-types.d.ts +169 -2
- package/dist/orchestration/workflow.d.ts +358 -0
- package/dist/orchestration/workflow.js +13 -2
- package/dist/prompt-assembly/artifact-store.d.ts +33 -0
- package/dist/prompt-assembly/artifact.d.ts +25 -0
- package/dist/prompt-assembly/assemble.d.ts +20 -0
- package/dist/prompt-assembly/composer.d.ts +29 -0
- package/dist/prompt-assembly/epoch.d.ts +55 -1
- package/dist/prompt-assembly/event-registry.d.ts +35 -0
- package/dist/prompt-assembly/explain.d.ts +12 -0
- package/dist/prompt-assembly/tool-catalog.d.ts +38 -0
- package/dist/prompt-assembly/turn-snapshot.d.ts +40 -0
- package/dist/prompt-assembly/types.d.ts +115 -0
- package/dist/prompts/coordinator.d.ts +27 -0
- package/dist/prompts/default.d.ts +539 -0
- package/dist/prompts/simple-sections.d.ts +45 -0
- package/dist/prompts/supervisor.d.ts +66 -0
- package/dist/scenarios/env.d.ts +28 -0
- package/dist/scenarios/full-body.d.ts +50 -0
- package/dist/scenarios/scenario-registry.d.ts +60 -0
- package/dist/scenarios/teacher-quickstart.d.ts +27 -0
- package/dist/server/http.d.ts +17 -0
- package/dist/stores/cc/lockfile.d.ts +6 -0
- package/dist/stores/cc/mailbox-store.d.ts +8 -0
- package/dist/stores/cc/roster-adapter.d.ts +4 -0
- package/dist/stores/cc/sidecar-transcript.d.ts +66 -0
- package/dist/stores/file/background-agent-store.d.ts +24 -0
- package/dist/stores/file/background-agent-store.js +2 -1
- package/dist/stores/file/checkpoint-store.d.ts +38 -0
- package/dist/stores/file/file-snapshot-store.d.ts +25 -0
- package/dist/stores/file/fs-atomic.d.ts +155 -0
- package/dist/stores/file/index.d.ts +89 -0
- package/dist/stores/file/mailbox-store.d.ts +36 -0
- package/dist/stores/file/mailbox-store.js +2 -0
- package/dist/stores/file/memory-store.d.ts +82 -0
- package/dist/stores/file/permission-rule-store.d.ts +79 -0
- package/dist/stores/file/session-policy-store.d.ts +28 -0
- package/dist/stores/file/session-store.d.ts +40 -0
- package/dist/stores/file/shared-ledger.d.ts +83 -0
- package/dist/stores/file/tool-result-store.d.ts +11 -0
- package/dist/stores/file/usage-window-store.d.ts +18 -0
- package/dist/stores/file/workflow-journal-store.d.ts +100 -0
- package/dist/stores/file/workflow-run-store.d.ts +11 -0
- package/dist/stores/file/workflow-run-store.js +2 -0
- package/dist/tools/fs/bash-readonly-classifier.d.ts +282 -0
- package/dist/tools/fs/encoding.d.ts +60 -0
- package/dist/tools/fs/fs-bash.d.ts +133 -0
- package/dist/tools/fs/fs-pdf.d.ts +28 -0
- package/dist/tools/fs/fs-search-tools.d.ts +5 -0
- package/dist/tools/fs/fs-shared.d.ts +360 -0
- package/dist/tools/fs/fs-write.d.ts +16 -0
- package/dist/tools/fs/gh-rate-limit.d.ts +22 -0
- package/dist/tools/fs/index.d.ts +79 -0
- package/dist/tools/fs/notebook.d.ts +56 -0
- package/dist/tools/fs/pdf.d.ts +70 -0
- package/dist/tools/fs/pdf.js +8 -2
- package/dist/tools/fs/repo-map.d.ts +10 -0
- package/dist/tools/fs/safety.d.ts +376 -0
- package/dist/tools/fs/search.d.ts +131 -0
- package/dist/tools/loop-tick.d.ts +24 -0
- package/dist/tools/monitor.d.ts +55 -0
- package/dist/tools/scheduler-tools.d.ts +51 -0
- package/dist/tools/sql-adapters.d.ts +18 -0
- package/dist/tools/sql.d.ts +25 -0
- package/dist/tools/task-list.d.ts +77 -0
- package/dist/tools/todo.d.ts +8 -0
- package/dist/tools/web.d.ts +184 -0
- package/dist/tools/web.js +32 -5
- package/dist/tools/worktree.d.ts +81 -0
- package/package.json +2 -2
- package/dist/tools/gitea-issue.d.ts +0 -13
- package/dist/tools/gitea-issue.js +0 -75
package/dist/agents/verify.d.ts
CHANGED
|
@@ -2,8 +2,49 @@ import { Type, type Static } from "typebox";
|
|
|
2
2
|
import type { Runner, ResumeTaskConfig } from "../core/runner/runtask.js";
|
|
3
3
|
import type { CheckpointGate, CheckpointToken, ResumeOutcome } from "../core/checkpoint-store.js";
|
|
4
4
|
import type { ModelRef, TaskResult, TaskSpec, ToolSpec } from "../core/types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Verification gate (developer mode, design/28 §4). An **independent adversarial verifier** runs after
|
|
7
|
+
* an implementation task and tries to BREAK it — read-only, evidence-required, returning a structured
|
|
8
|
+
* verdict — then the gate loops fix→re-verify until PASS or a round cap.
|
|
9
|
+
*
|
|
10
|
+
* PROVENANCE (2026-07-14; RB-306 ④ — re-verified and CORRECTED against CC 2.1.220): distilled and
|
|
11
|
+
* de-branded from the MIT-era upstream source's dedicated `verification` agent — which was an
|
|
12
|
+
* Anthropic-internal A/B experiment (third-party default OFF) and has since been RETIRED upstream:
|
|
13
|
+
* 2.1.207 through 2.1.220 ship NO verification agent. The current upstream completion-gate shape is
|
|
14
|
+
* (a) the Stop hook (`decision:"block"` + reason fed back — sema's Stop hook is at full parity) and
|
|
15
|
+
* (b) — corrected — NOT a bundled skill. There is no built-in `verify` skill in the 220 corpus. What
|
|
16
|
+
* 220 ships is an INSTRUCTION TO CREATE ONE PER PROJECT: its memory prompt (@190146) forbids creating
|
|
17
|
+
* project skills ("never create one — a new project skill silently shadows a same-named built-in
|
|
18
|
+
* skill") and makes exactly one exception — "The single exception is verify, because how a project
|
|
19
|
+
* verifies changes is project-specific: put a verify correction in the `.claude/skills/verify/
|
|
20
|
+
* SKILL.md` closest to the code it covers … and if that file does not exist, create it." So upstream's
|
|
21
|
+
* position is "verification is project-specific; teach the user's repo to describe its own", not "here
|
|
22
|
+
* is a verifier". This primitive is therefore a SUPERSET of what upstream ships in a different
|
|
23
|
+
* direction than the old note implied: a spawned adversarial verifier with a fix loop, bundled. It is
|
|
24
|
+
* orthogonal to and composable with the Stop hook (wire the verdict into a stop() hook to make it a
|
|
25
|
+
* hard completion gate).
|
|
26
|
+
*
|
|
27
|
+
* DEPLOYMENT POSTURE (clay 裁定 2026-07-14): opt-in library primitive ONLY — never a scenario default,
|
|
28
|
+
* never deployed implicitly. It is a **thin composition** over existing core seams — a verifier subtask
|
|
29
|
+
* (own model role), a read-only tool set (via tool `effect`), {@link TaskSpec.outputSchema} for the
|
|
30
|
+
* verdict, and the teacher-style fix loop — so it adds no Runner-core surface. Off by default; opt in
|
|
31
|
+
* per task via {@link runWithVerification} (or {@link runDeveloperTask}).
|
|
32
|
+
*
|
|
33
|
+
* Boundary vs teacher mode: teacher's Tier-1 is a *lenient* rubric verifier that triggers escalation to
|
|
34
|
+
* an advisor (stuck/wrong recovery); this is a *strict adversarial* completion gate with a fix loop.
|
|
35
|
+
* Orthogonal, composable, not merged.
|
|
36
|
+
*/
|
|
5
37
|
export declare const VERIFICATION_PROMPT = "You are a verification specialist. Your job is NOT to confirm the implementation works \u2014 it is to try to BREAK it.\n\nYou have two documented failure patterns. First, verification avoidance: faced with a check, you find reasons not to run it \u2014 you read code, narrate what you would test, declare \"PASS,\" and move on. Second, being seduced by the first 80%: a polished result or a passing test suite makes you inclined to pass it, not noticing the edge that crashes, the state that vanishes, the bad input that is unhandled. The first 80% is the easy part. Your entire value is in finding the last 20%.\n\n## Hard boundary \u2014 do not modify the project\nYou are STRICTLY a verifier. Do NOT create, modify, or delete project files; do NOT install packages; do NOT run version-control write operations. Use only the read/probe/execute tools available to you. (If you need a scratch file, use a temp directory, and clean up.)\n\n## Evidence is mandatory\nReading code is NOT verification. Every check must actually run something \u2014 execute the code, hit the endpoint, run the build/tests \u2014 and record the command and its real output. A \"PASS\" with no command output is a skip, not a pass.\n\n## Strategy (adapt to what changed)\n- Build/lib changes: build it, run the full test suite, exercise the public API as a consumer would.\n- Backend/API: start it, call endpoints, check response *shapes* (not just status codes), test error paths.\n- CLI/script: run with representative AND edge inputs (empty, malformed, boundary); check stdout/stderr/exit codes.\n- Bug fix: reproduce the original bug first, verify the fix, then check for regressions and side effects.\n- Refactor (no behavior change): the existing suite must pass unchanged; diff the public surface; same inputs \u2192 same outputs.\nRun the project's own build/tests/linters as a baseline, then apply the type-specific checks. Test results are context, not proof \u2014 the implementer is an LLM too; its tests may be happy-path or circular.\n\n## Adversarial probes (pick the ones that fit)\nBoundary values (0, -1, empty, very long, unicode, max), idempotency (same mutating call twice), orphan operations (ids that don't exist), concurrency (parallel create-if-not-exists). Your verdict must include at least one adversarial probe you actually ran and its result \u2014 even if it was handled correctly.\n\n## Before you FAIL\nCheck you haven't missed why it's actually fine: defensive code elsewhere, intentional behavior documented in comments/specs, or an unfixable external-contract limitation (note that as an observation, not a FAIL). Don't wave away real issues, but don't FAIL on intentional behavior.\n\n## Verdict\nSubmit exactly one verdict via the provided output tool:\n- PASS \u2014 you ran real checks (including \u22651 adversarial probe) and it holds up. Put the commands + observed output in `evidence`.\n- FAIL \u2014 something is broken. Put each concrete problem (with how to reproduce) in `findings`.\n- PARTIAL \u2014 environmental limitation only (no test framework, a tool/server unavailable). Not for \"I'm unsure\": if you can run the check, decide PASS or FAIL. Note what you couldn't verify and why in `findings`.";
|
|
38
|
+
/**
|
|
39
|
+
* The L3 **static-judge** prompt for the L2+L3 composition (design/54 §4): the mechanical L2 gate already
|
|
40
|
+
* ran the build/tests, so here the verifier is a **read-only judge** that scrutinizes the supplied diff +
|
|
41
|
+
* test results — it must NOT try to execute code (the verifier's tools are read-only by design, design/44
|
|
42
|
+
* §6; telling it to "run tests" makes it judge PARTIAL on every module when the sandbox blocks the runtime —
|
|
43
|
+
* service[36]/search[48] dogfood). {@link verifyCompleted} selects this automatically when `evidence` is set
|
|
44
|
+
* and no `verifierPrompt` override is given.
|
|
45
|
+
*/
|
|
6
46
|
export declare const STATIC_VERIFICATION_PROMPT = "You are a verification judge. Your job is NOT to confirm the change works \u2014 it is to find where it BREAKS.\n\nYou are READ-ONLY by design: the build and tests have ALREADY been run by a separate mechanical gate. Their results and the code change (a diff) are usually supplied to you as evidence; but if little or no diff/results are supplied this round (e.g. a re-verification AFTER a fix), judge the CURRENT working tree directly \u2014 do NOT return PARTIAL merely because a diff is absent. Do NOT try to execute code, run tests, or invoke a runtime \u2014 the environment will refuse it, and that is expected, not a limitation. Judge from any supplied diff/results plus read-only inspection of the working tree (read files, search, list).\n\nYou have two documented failure patterns. First, being seduced by the first 80%: a clean diff or a green test run makes you inclined to pass it, not noticing the edge that crashes, the state that vanishes, the bad input that is unhandled, the cross-module assumption that breaks. Second, hiding behind PARTIAL because you couldn't run something \u2014 that is NOT what PARTIAL is for here; execution was the mechanical gate's job. Your entire value is finding the last 20% by READING.\n\n## What to scrutinize (adapt to the diff)\n- Boundary/edge cases the tests likely miss: 0, -1, empty, very long, unicode, max, malformed input, idempotency, orphan ids, off-by-one, negative numbers, EOF/empty fields.\n- Semantic correctness vs the task spec: does the change actually do what was asked, including cases the tests don't cover (the title()/CSV/base62 class of defect)?\n- Cross-module/integration hazards in the diff: a changed signature/export/contract/default a caller elsewhere still assumes; a deleted helper something depends on.\n- If the provided test results show failures, that is a concrete FAIL with the failing output as evidence.\n\n## Verdict\nSubmit exactly one verdict via the provided output tool:\n- PASS \u2014 you read the diff + results, looked for the edges above, and it holds. Cite the specific things you checked in `evidence`.\n- FAIL \u2014 you found a concrete defect. Put each problem (with the diff location / input that breaks it) in `findings`.\n- PARTIAL \u2014 ONLY when the evidence itself is genuinely insufficient to judge (e.g. the diff is empty or unrelated to the task, no results supplied). NOT for \"I couldn't execute it.\" Say what's missing in `findings`.";
|
|
47
|
+
/** The verifier's structured verdict (delivered via {@link TaskSpec.outputSchema}). */
|
|
7
48
|
export declare const VerdictSchema: Type.TObject<{
|
|
8
49
|
verdict: Type.TUnion<[Type.TLiteral<"PASS">, Type.TLiteral<"FAIL">, Type.TLiteral<"PARTIAL">]>;
|
|
9
50
|
findings: Type.TArray<Type.TString>;
|
|
@@ -11,20 +52,82 @@ export declare const VerdictSchema: Type.TObject<{
|
|
|
11
52
|
}>;
|
|
12
53
|
export type Verdict = Static<typeof VerdictSchema>;
|
|
13
54
|
export interface VerifyConfig {
|
|
55
|
+
/** RB-473 — disclosure channel for CONTAINED host-callback failures in this scope (the RB-463
|
|
56
|
+
* isolation primitive's bounded first-failure per site). Absent ⇒ failures are counted only. */
|
|
14
57
|
onNotifyError?: (failure: import("../core/safe-notify.js").SafeNotifyFailure) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Verifier model (wins over the role). Default: resolve the `verifier` role (→ `default` fallback).
|
|
60
|
+
*
|
|
61
|
+
* 🔴 DECORRELATION (design/54 §3.1, [44]): the verifier MUST be a **different model than the implementer**
|
|
62
|
+
* — an LLM grading its own work confirms its own blind spots (service[33]: a strong heterogeneous judge
|
|
63
|
+
* reading the diff caught the title()/csv/base62 defects the implementer's own tests missed). The default
|
|
64
|
+
* `verifier` role falling back to `default` (= the implementer) DEFEATS this — pass an explicit
|
|
65
|
+
* heterogeneous `verifierModel`, or map a distinct `verifier` role. Decorrelation is a deployment contract,
|
|
66
|
+
* not something this layer can assert (role→model resolution lives in the Runner).
|
|
67
|
+
*/
|
|
15
68
|
verifierModel?: ModelRef;
|
|
69
|
+
/**
|
|
70
|
+
* Tools the verifier may use — should be read/probe tools that DON'T mutate the project.
|
|
71
|
+
* **Default**: the impl task's tools filtered to `effect: "read"` only (a true read-only boundary).
|
|
72
|
+
* A generic core can't know which of YOUR tools mutate "the project", so if the verifier needs to run a
|
|
73
|
+
* build/test runner, mark that tool `effect: "read"` (it doesn't persist project changes) or pass it here
|
|
74
|
+
* explicitly. Anything `idempotent`/`write` is dropped by default — pass `verifierTools` to widen.
|
|
75
|
+
*/
|
|
16
76
|
verifierTools?: ToolSpec[];
|
|
77
|
+
/** Verify→fix→re-verify rounds (each round = one verification; FAIL between rounds triggers a fix turn). Default 2. */
|
|
78
|
+
/** CLS-A-6: a non-finite value falls back to the default (2) — the gate always runs at least one round. */
|
|
17
79
|
maxRounds?: number;
|
|
80
|
+
/**
|
|
81
|
+
* The concrete **change to scrutinize** (design/54 §3.1) — typically the integration `git diff` the
|
|
82
|
+
* orchestrator computes via {@link runExecGate}. Fed to the verifier as **untrusted, opaque-delimited
|
|
83
|
+
* data** so the judge reads the actual code change, not the implementer's prose self-report (which a
|
|
84
|
+
* compromised worker controls — threat BUG1). On a durable-HITL resume, the caller MUST recompute this
|
|
85
|
+
* from the **post-resume** working tree (don't reuse a pre-suspend diff — threat BUG5, design/53 §2.B).
|
|
86
|
+
*/
|
|
18
87
|
evidence?: string;
|
|
88
|
+
/** Stop the verify→fix loop once cumulative cost (verifier runs + impl fix turns) reaches this; return the
|
|
89
|
+
* current result. Matches `cascade`'s "all costs" sense. Optional (design/54 §3.4). HRD-AGO-8: checked both
|
|
90
|
+
* before issuing a fix round AND before the verifier of every round after the first (round 1 always runs —
|
|
91
|
+
* the ceilings bound the loop, they are not a way to skip verifying). */
|
|
19
92
|
costCeilingMicroUsd?: number;
|
|
93
|
+
/** Overall wall-clock ceiling for the whole verify→fix loop. Optional (design/54 §3.4). Checked at the same
|
|
94
|
+
* two points as {@link costCeilingMicroUsd} (HRD-AGO-8). */
|
|
20
95
|
totalTimeoutMs?: number;
|
|
96
|
+
/** Override the verifier system prompt ({@link VERIFICATION_PROMPT}). */
|
|
21
97
|
verifierPrompt?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Whether the verifier's execution-env hand band (design/44: `edit_file`/`write_file`/`bash` mounted by
|
|
100
|
+
* the Runner from `executionEnv`, BYPASSING the `verifierTools` effect filter) is forced READ-ONLY.
|
|
101
|
+
*
|
|
102
|
+
* **Default `true` — the independence argument:** the verifier's value rests on it judging work it
|
|
103
|
+
* cannot touch. A verifier that can mutate the project mid-judgment can "fix" what it is grading and
|
|
104
|
+
* then pass its own patch (self-confirmation — the exact blind-spot loop decorrelation exists to
|
|
105
|
+
* break), and a compromised implementer report (untrusted input, threat BUG1) could steer a write-
|
|
106
|
+
* capable judge into destructive edits instead of a wrong verdict. Read-only bounds the blast radius
|
|
107
|
+
* of a fooled verifier to a bad verdict.
|
|
108
|
+
*
|
|
109
|
+
* Set `false` ONLY when verification genuinely requires mutating commands — e.g. a verifier that must
|
|
110
|
+
* really run a build/test cycle that writes artifacts (node_modules, dist, coverage) where marking a
|
|
111
|
+
* runner tool `effect:"read"` / passing `verifierTools` doesn't apply because the commands go through
|
|
112
|
+
* the hand band's `bash`. You are then accepting that the verifier can write to the working tree:
|
|
113
|
+
* prefer a throwaway checkout/sandbox, and keep the implementer/verifier models decorrelated.
|
|
114
|
+
*/
|
|
22
115
|
verifierHandsReadOnly?: boolean;
|
|
116
|
+
/** Per-round callback (observability). */
|
|
23
117
|
onRound?: (info: {
|
|
24
118
|
round: number;
|
|
25
119
|
verdict: VerificationOutcome["verdict"];
|
|
26
120
|
findings: string[];
|
|
27
121
|
}) => void;
|
|
122
|
+
/**
|
|
123
|
+
* HRD-AGO-3 — fired when the VERIFIER's own run durably paused (`suspended`/`needs_review`), carrying the
|
|
124
|
+
* resume capability for the checkpoint it minted. The pause is ALWAYS reported on
|
|
125
|
+
* {@link VerificationOutcome.verifierPause} as well; this callback exists so a deployment that owns the
|
|
126
|
+
* checkpoint lifecycle can act at once (decide it, or cancel + release the pinned verifier session) instead
|
|
127
|
+
* of waiting for the reaper. A throwing handler cannot strand the gate (it is swallowed, like `onRound`).
|
|
128
|
+
*
|
|
129
|
+
* ⚠️ `checkpointToken` is the resume CAPABILITY — never log it or put it in a URL (types.ts §6).
|
|
130
|
+
*/
|
|
28
131
|
onVerifierPause?: (info: {
|
|
29
132
|
round: number;
|
|
30
133
|
status: TaskResult["status"];
|
|
@@ -33,28 +136,123 @@ export interface VerifyConfig {
|
|
|
33
136
|
checkpointGate?: CheckpointGate;
|
|
34
137
|
}) => void;
|
|
35
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Why a {@link VerificationOutcome} is `"unverified"` (search [46] BUG7: `"unverified"` was overloaded across
|
|
141
|
+
* three distinct situations a consumer must tell apart to gate correctly):
|
|
142
|
+
* - `"suspended"` — the impl (or resumed impl) suspended on a durable HITL gate, so it isn't done yet; the
|
|
143
|
+
* result is failed-with-token and the caller should resume (NOT treat as a verification failure).
|
|
144
|
+
* - `"no_verdict"` — the verifier ran but never produced a structured verdict (a broken/flaky verifier); the
|
|
145
|
+
* work IS done but could not be gated — treat as a gate failure, not a pass.
|
|
146
|
+
* - `"could_not_verify"` — the verifier returned PARTIAL: it ran but could NOT verify due to an environmental
|
|
147
|
+
* limit (e.g. no test framework). The work IS done but was NOT gated — a careless `verdict !== "FAIL"`
|
|
148
|
+
* consumer must treat this as a non-verification, not a pass; `findings` carry what couldn't be checked.
|
|
149
|
+
* - `"needs_review"` — the impl/verifier paused on a non-durable human review and isn't gated yet.
|
|
150
|
+
* - `"impl_incomplete"` — the implementation itself didn't complete (failed/blocked/timeout) before verification.
|
|
151
|
+
* - `"opted_out"` — verification was explicitly disabled (`runDeveloperTask({ verify: false })`); not gated by design.
|
|
152
|
+
* - `"verifier_paused"` (HRD-AGO-3) — the VERIFIER's own run durably paused (suspended/needs_review) and minted
|
|
153
|
+
* a checkpoint of its own. DISJOINT from `"suspended"` (which is about the IMPLEMENTATION): the work IS done,
|
|
154
|
+
* it simply was not gated, and there is an outstanding verifier checkpoint the caller must decide or cancel —
|
|
155
|
+
* see {@link VerificationOutcome.verifierPause} for the token. Previously reported as `"no_verdict"`, which
|
|
156
|
+
* reads like a broken verifier and hid the fact that a live checkpoint was left pinned.
|
|
157
|
+
*/
|
|
36
158
|
export type UnverifiedReason = "suspended" | "needs_review" | "no_verdict" | "opted_out" | "impl_incomplete" | "could_not_verify" | "verifier_paused";
|
|
37
159
|
export interface VerificationOutcome {
|
|
160
|
+
/** Final verdict. `"unverified"` = the work was not gated; see {@link unverifiedReason} for WHY (they differ). */
|
|
38
161
|
verdict: "PASS" | "FAIL" | "PARTIAL" | "unverified";
|
|
162
|
+
/** Set iff `verdict === "unverified"` — disambiguates the three unverified situations (search [46] BUG7). */
|
|
39
163
|
unverifiedReason?: UnverifiedReason;
|
|
164
|
+
/** How many verification rounds ran. */
|
|
40
165
|
rounds: number;
|
|
166
|
+
/** Findings from the FINAL verification (problems on FAIL, caveats on PARTIAL). */
|
|
41
167
|
findings: string[];
|
|
168
|
+
/** Evidence (commands + output) from the final verification, if the verifier supplied it. */
|
|
42
169
|
evidence?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Total cost (micro-USD) of the VERIFIER run(s) across all rounds — the verification OVERHEAD, separate from
|
|
172
|
+
* the implementation's own cost (which is the returned `TaskResult.stats`, as the verifier runs in its own
|
|
173
|
+
* session). Mirrors `runWithTeacher`'s `teacherStats` work-vs-overhead split. Σ of each verifier run's
|
|
174
|
+
* cost+nested. `result.stats.costMicroUsd + verification.verifierCost` is the EXACT operation total for the
|
|
175
|
+
* common single-pass case; in the rarer multi-round fix case `result.stats` is the FINAL impl attempt's cost
|
|
176
|
+
* (the returned `...current`) so an earlier failed attempt's impl cost is not separately surfaced. Omitted
|
|
177
|
+
* (undefined) when no verifier ran (e.g. an impl that suspended/was opted out before verification).
|
|
178
|
+
*/
|
|
43
179
|
verifierCost?: number;
|
|
180
|
+
/**
|
|
181
|
+
* HRD-AGO-3 — set iff `unverifiedReason === "verifier_paused"`: the VERIFIER's own durable pause. The
|
|
182
|
+
* verifier's session stays PINNED by its checkpoint (releasing it here would orphan the checkpoint), so the
|
|
183
|
+
* pause is handed back instead of being swallowed: resume/cancel the checkpoint with this token, and the
|
|
184
|
+
* session is reclaimed on that terminal. Without it the token died inside the gate and the checkpoint +
|
|
185
|
+
* pinned session survived only until the deadline reaper collected them, with nothing in the result saying so.
|
|
186
|
+
*
|
|
187
|
+
* ⚠️ `checkpointToken` is the resume CAPABILITY — never log it or put it in a URL (types.ts §6).
|
|
188
|
+
*/
|
|
44
189
|
verifierPause?: {
|
|
190
|
+
/** The verifier run's terminal pause status (`"suspended"` or `"needs_review"`). */
|
|
45
191
|
status: TaskResult["status"];
|
|
192
|
+
/** The paused verifier's own session id (independent of the implementation's). */
|
|
46
193
|
sessionId: string;
|
|
194
|
+
/** The resume capability for the verifier's checkpoint. Undefined only if the pause carried none. */
|
|
47
195
|
checkpointToken?: CheckpointToken;
|
|
196
|
+
/** What the verifier's checkpoint is waiting on (which resume outcome it takes). */
|
|
48
197
|
checkpointGate?: CheckpointGate;
|
|
49
198
|
};
|
|
50
199
|
}
|
|
51
200
|
export interface VerificationResult extends TaskResult {
|
|
201
|
+
/** The verification outcome. The task `result`/`status` is the implementation's; consult `verdict` for quality. */
|
|
52
202
|
verification: VerificationOutcome;
|
|
53
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Verify an already-**completed** implementation `result` behind the independent adversarial verifier,
|
|
206
|
+
* looping fix→re-verify until PASS (or a round cap) — **without re-running the implementation**. This is the
|
|
207
|
+
* L3 entry for the L2+L3 composition (design/54 §4): in a fan-out, a worker's module has already been
|
|
208
|
+
* produced, so the orchestrator runs the mechanical L2 gate ({@link runExecGate}), computes the diff, then
|
|
209
|
+
* calls this with `config.evidence = diff (+ L2 results)` to judge the finished work. The sibling of
|
|
210
|
+
* {@link runWithVerification} (fresh run + verify) and {@link resumeWithVerification} (resume + verify) for
|
|
211
|
+
* the "I already have the result, just verify it" case — all three share this gate so a task is judged
|
|
212
|
+
* identically however it reached completion (design/45 §11 Q6 + design/51 P1-b).
|
|
213
|
+
*
|
|
214
|
+
* `specBase` carries the impl's tools/roles/model/limits/signal/keys (everything but `objective`/`sessionId`)
|
|
215
|
+
* so the verifier inherits the right role map + read-only tool boundary; `objective` is the original task
|
|
216
|
+
* objective the verifier needs as context. When `config.evidence` is set and no `config.verifierPrompt`
|
|
217
|
+
* override is given, the verifier uses {@link STATIC_VERIFICATION_PROMPT} (read the diff/results; don't try
|
|
218
|
+
* to execute — that was L2's job), avoiding the "PARTIAL on everything" failure in a read-only sandbox.
|
|
219
|
+
*/
|
|
54
220
|
export declare function verifyCompleted(runner: Runner, result: TaskResult, specBase: ResumeTaskConfig, objective: string, config: VerifyConfig): Promise<VerificationResult>;
|
|
221
|
+
/**
|
|
222
|
+
* Run an implementation task, then gate it behind an independent adversarial verifier, looping
|
|
223
|
+
* fix→re-verify until PASS (or a round cap). Returns the implementation result plus the
|
|
224
|
+
* {@link VerificationOutcome}. The caller decides WHEN to use this (explicit opt-in) — it always
|
|
225
|
+
* verifies once invoked. If the impl **suspends on a durable HITL gate**, it is surfaced as
|
|
226
|
+
* failed-with-token (verdict `unverified`); the caller approves and calls {@link resumeWithVerification}
|
|
227
|
+
* to resume AND verify (design/51 P1-b: the durable + HITL + verify integration).
|
|
228
|
+
*/
|
|
55
229
|
export declare function runWithVerification(runner: Runner, implSpec: TaskSpec, config?: VerifyConfig): Promise<VerificationResult>;
|
|
230
|
+
/**
|
|
231
|
+
* Resume a durable-suspended implementation task (design/45 F4) **and** verify it on completion — the
|
|
232
|
+
* durable + HITL + verify integration (design/51 P1-b). The mirror of {@link runWithVerification} for the
|
|
233
|
+
* resume path: `runWithVerification` surfaces a HITL suspend as failed-with-token; once the human
|
|
234
|
+
* adjudicates, the caller calls this with the `token` + `outcome`, and it resumes the implementation and —
|
|
235
|
+
* **if it COMPLETES** — runs the identical adversarial verifier + fix loop. If the resumed run suspends
|
|
236
|
+
* AGAIN (a later durable gate), it is surfaced as failed-with-token (`unverified`) for the caller to resume
|
|
237
|
+
* once more. `objective` is the ORIGINAL task objective (the resume carries none of its own) — the verifier
|
|
238
|
+
* needs it as context; pass the same objective the original `runWithVerification` ran with.
|
|
239
|
+
*
|
|
240
|
+
* 🔴 Freshness (threat BUG5, design/53 §2.B): if you pass `config.evidence` (a diff), recompute it from the
|
|
241
|
+
* **post-resume** working tree — a worker can clean-report → suspend at a gated tool → plant a backdoor
|
|
242
|
+
* after approval, so a pre-suspend diff would grade stale code. The verifier already verifies the current working
|
|
243
|
+
* tree (verifierObjective), so dropping the stale diff closes the timing window.
|
|
244
|
+
*/
|
|
56
245
|
export declare function resumeWithVerification(runner: Runner, token: CheckpointToken, outcome: ResumeOutcome, taskConfig: ResumeTaskConfig, objective: string, config?: VerifyConfig): Promise<VerificationResult>;
|
|
57
246
|
export interface DeveloperTaskConfig extends VerifyConfig {
|
|
247
|
+
/** Run the verification gate. Default `true` (that's the point of developer mode). Set `false` for prompt-only. */
|
|
58
248
|
verify?: boolean;
|
|
59
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* One-stop developer-mode convenience: applies {@link CODE_AGENT_PROMPT} (unless the task supplies its
|
|
252
|
+
* own `systemPrompt`) and, by default, runs the {@link runWithVerification} gate. Equivalent to wiring
|
|
253
|
+
* the building blocks by hand — use the building blocks directly when you want full control.
|
|
254
|
+
*
|
|
255
|
+
* Pair with a role map that gives a strong implementation model and cheaper helper/verifier models for
|
|
256
|
+
* "auto model selection" (design/28 §3.2): `roles: { default: strong, subagent: cheap, verifier: strong }`.
|
|
257
|
+
*/
|
|
60
258
|
export declare function runDeveloperTask(runner: Runner, spec: TaskSpec, config?: DeveloperTaskConfig): Promise<VerificationResult>;
|