@sema-agent/server 1.322.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 +59 -3
- 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,6 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* center prompts 消费投影腿([1043]④/[1050]③ 分工:web 承存储+covering 解析+下发,server 承本模块;
|
|
3
|
+
* [1057] 下发形定稿 / [1061] registry-core 0.10.16 schema / [1062]⑤「server 零新义务=逐字透传」)。
|
|
4
|
+
*
|
|
5
|
+
* 链路:center(sema-web)把 covering 走完的**基线终形**经 `GET /api/config/effective` 的 additive
|
|
6
|
+
* `prompts` key 下发 → 本模块按任务 scenario 选包(`scenarioOverrides[s] ?? sections`,整包替换非增量,
|
|
7
|
+
* [1057]①c)→ 声明数组**逐字**(含 opt-in `contentHash`,core 1.315 校验+manifest 透传)喂 core 既有
|
|
8
|
+
* typed `stableBlocks` 钩子。守卫全在 core(id 规范/slot 闭集/core/ 命名空间拒绝/identity 三锚
|
|
9
|
+
* pass-through/锁定槽不可写)——server 不做语义复检([1057]①f:identity 完整角色层由 center 编辑面把关)。
|
|
10
|
+
*
|
|
11
|
+
* 仅有的一层「形校验」不是语义复检,是**防炸底线**(详见其现居所 `src/prompts-domain-validate.ts`——
|
|
12
|
+
* 判形半场已下沉到该中立叶子,本文件 re-export 保兼容;design/158 S6,lens2 §G):core 对坏形声明的
|
|
13
|
+
* 守卫是 THROW(assemble 期),server 在采用前做结构判形,坏形=拒绝采用该候选的 prompts 面。
|
|
14
|
+
*
|
|
15
|
+
* 生效语义(两段史):1.222 时 core 1.315 的 epoch 是 bundled-only(声明不进 descriptor),热换=resume
|
|
16
|
+
* 三失真,故临时 restart-to-apply;core 1.316([1068] 裁 a/[1070]d)把声明以 (id,slot,chars,contentHash?)
|
|
17
|
+
* 纳入 artifactDigest——声明变=digest 变=**下任务边界自动重 pin**(既有 legacy_migration 机制接手),
|
|
18
|
+
* 进行中会话 epoch pin 保稳。自此恢复**热采用**(main.ts boot+refresh 双点 adopt),与 center
|
|
19
|
+
* 「发布=新任务生效」产品语义对齐([1051]②b)。字节级检测只认 opt-in contentHash(文本不进 digest,
|
|
20
|
+
* 防会话可导出面字典预映)——center 链路恒逐 section 铸([1065]),本投影逐字透传即全强度。
|
|
21
|
+
*/
|
|
1
22
|
import { type PromptProvider, type PublishedPromptArtifactEnvelope } from "@sema-agent/core";
|
|
2
23
|
import { type EffectiveCenterPrompts, type PromptsDomainFaces } from "../prompts-domain-validate.js";
|
|
24
|
+
/** 判形半场(validateCenterPrompts/validatePromptsDomain/CORE_ENGINE_VERSION 及两 interface)已下沉到
|
|
25
|
+
* 中立叶子 `src/prompts-domain-validate.ts`(design/158 S6,lens2 §G:消 config-lkg → capabilities 的
|
|
26
|
+
* 唯一分层反向边)。此处 re-export 保兼容——既有消费者(main/run-local/测试)零改动。 */
|
|
3
27
|
export { validateCenterPrompts, validatePromptsDomain, CORE_ENGINE_VERSION, type EffectiveCenterPrompts, type PromptsDomainFaces } from "../prompts-domain-validate.js";
|
|
28
|
+
/** [985]b / [1285] — §9.4 by-digest 补拉组合店:local miss ⇒ fetchRaw(digest) 从 center 拉 envelope ⇒
|
|
29
|
+
* core verifyPromptArtifact 全管线 + **回验「拿到的=要的」digest 逐位**(center 答非所问=丢弃)⇒
|
|
30
|
+
* best-effort 回写 inner(下次直命中)。任何失败=undefined(诚实缺席,fail-loud 归 core 的
|
|
31
|
+
* prompt_snapshot_unavailable——绝不拼杂交)。 */
|
|
4
32
|
export declare function withPromptArtifactBackfill(inner: {
|
|
5
33
|
get(d: string, o: {
|
|
6
34
|
engineVersion: string;
|
|
@@ -10,6 +38,11 @@ export declare function withPromptArtifactBackfill(inner: {
|
|
|
10
38
|
info: (msg: string, meta?: Record<string, unknown>) => void;
|
|
11
39
|
warn: (msg: string, meta?: Record<string, unknown>) => void;
|
|
12
40
|
}): typeof inner;
|
|
41
|
+
/** e/b 接线([1236]① seam/[985]e):catalog 轴的两态过渡推进 core 的 CenterPromptSource——
|
|
42
|
+
* present(且身份变)⇒ applySnapshot(core 重验+落盘+原子换 candidate;validate 已过 core verify,
|
|
43
|
+
* 此处失败=磁盘/状态写问题,warn 不挡 declaration 轴);absent-after-present / prompts 键整体消失
|
|
44
|
+
* ⇒ applyDisabled(闸关=显式撤下语义的 catalog 轴半场,离线重启不复活)。幂等安全:同 envelope
|
|
45
|
+
* 重放=同 digest 覆盖写。 */
|
|
13
46
|
export declare function applyCatalogToSource(source: {
|
|
14
47
|
applySnapshot(raw: unknown): Promise<{
|
|
15
48
|
ok: true;
|
|
@@ -20,11 +53,24 @@ export declare function applyCatalogToSource(source: {
|
|
|
20
53
|
reason: string;
|
|
21
54
|
}>;
|
|
22
55
|
applyDisabled(sourceRevision: string): Promise<void>;
|
|
56
|
+
/** codex-2 F2(restart-owed disable):撤下写盘失败后重启,内存 prev 丢了但持久态还 active——
|
|
57
|
+
* 以 source 自身的 live candidate 为准判「欠 disable」,不是只看内存 prev。 */
|
|
23
58
|
current?(): unknown;
|
|
24
59
|
}, next: PromptsDomainFaces | undefined, prev: PromptsDomainFaces | undefined, log: {
|
|
25
60
|
info: (msg: string, meta?: Record<string, unknown>) => void;
|
|
26
61
|
warn: (msg: string, meta?: Record<string, unknown>) => void;
|
|
27
62
|
}, phase: string): Promise<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* 选包+投影:该 scenario 的终形声明数组(`scenarioOverrides[s] ?? sections`)→ typed `stableBlocks`
|
|
65
|
+
* 钩子(声明**逐字**透传,含 contentHash——core 1.315 校验后进 manifest)。空数组在 validate 已拒
|
|
66
|
+
* (F4:空替换集非 v1 语义),所以这里恒有非空声明——恒返回 provider(center-wins 无死分支)。
|
|
67
|
+
*/
|
|
28
68
|
export declare function centerPromptProvider(prompts: EffectiveCenterPrompts, scenarioName: string): PromptProvider;
|
|
69
|
+
/** codex R3(appendSystemPrompt 案):该 scenario 的终形 center 声明里是否有「已组装 identity」——core 的
|
|
70
|
+
* M9 迁移卫在 provider.stableBlocks 的 identity 声明上探同三锚,命中即走 pass-through 臂(其保留集无
|
|
71
|
+
* `core/role.append`,任何 append rider/outputStyle 会被静默丢)。选包与 {@link centerPromptProvider}
|
|
72
|
+
* 同式(`overrides[s] ?? sections`);锚谓词由调用方注入(task-settings `hasConstitutionAnchors` 单真源)。
|
|
73
|
+
* [1057]①f 的「server 不做语义复检」不动:这不是复检语义,是为 capabilities.appendSystemPrompt 的诚实面
|
|
74
|
+
* 探 core 会走哪条臂。 */
|
|
29
75
|
export declare function centerIdentityAssembled(prompts: EffectiveCenterPrompts, scenarioName: string, isAssembled: (text: unknown) => boolean): boolean;
|
|
30
76
|
//# sourceMappingURL=center-prompts.d.ts.map
|
|
@@ -1,14 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* center prompts 消费投影腿([1043]④/[1050]③ 分工:web 承存储+covering 解析+下发,server 承本模块;
|
|
3
|
+
* [1057] 下发形定稿 / [1061] registry-core 0.10.16 schema / [1062]⑤「server 零新义务=逐字透传」)。
|
|
4
|
+
*
|
|
5
|
+
* 链路:center(sema-web)把 covering 走完的**基线终形**经 `GET /api/config/effective` 的 additive
|
|
6
|
+
* `prompts` key 下发 → 本模块按任务 scenario 选包(`scenarioOverrides[s] ?? sections`,整包替换非增量,
|
|
7
|
+
* [1057]①c)→ 声明数组**逐字**(含 opt-in `contentHash`,core 1.315 校验+manifest 透传)喂 core 既有
|
|
8
|
+
* typed `stableBlocks` 钩子。守卫全在 core(id 规范/slot 闭集/core/ 命名空间拒绝/identity 三锚
|
|
9
|
+
* pass-through/锁定槽不可写)——server 不做语义复检([1057]①f:identity 完整角色层由 center 编辑面把关)。
|
|
10
|
+
*
|
|
11
|
+
* 仅有的一层「形校验」不是语义复检,是**防炸底线**(详见其现居所 `src/prompts-domain-validate.ts`——
|
|
12
|
+
* 判形半场已下沉到该中立叶子,本文件 re-export 保兼容;design/158 S6,lens2 §G):core 对坏形声明的
|
|
13
|
+
* 守卫是 THROW(assemble 期),server 在采用前做结构判形,坏形=拒绝采用该候选的 prompts 面。
|
|
14
|
+
*
|
|
15
|
+
* 生效语义(两段史):1.222 时 core 1.315 的 epoch 是 bundled-only(声明不进 descriptor),热换=resume
|
|
16
|
+
* 三失真,故临时 restart-to-apply;core 1.316([1068] 裁 a/[1070]d)把声明以 (id,slot,chars,contentHash?)
|
|
17
|
+
* 纳入 artifactDigest——声明变=digest 变=**下任务边界自动重 pin**(既有 legacy_migration 机制接手),
|
|
18
|
+
* 进行中会话 epoch pin 保稳。自此恢复**热采用**(main.ts boot+refresh 双点 adopt),与 center
|
|
19
|
+
* 「发布=新任务生效」产品语义对齐([1051]②b)。字节级检测只认 opt-in contentHash(文本不进 digest,
|
|
20
|
+
* 防会话可导出面字典预映)——center 链路恒逐 section 铸([1065]),本投影逐字透传即全强度。
|
|
21
|
+
*/
|
|
1
22
|
import { verifyPromptArtifact } from "@sema-agent/core";
|
|
2
23
|
import { CORE_ENGINE_VERSION } from "../prompts-domain-validate.js";
|
|
24
|
+
/** 判形半场(validateCenterPrompts/validatePromptsDomain/CORE_ENGINE_VERSION 及两 interface)已下沉到
|
|
25
|
+
* 中立叶子 `src/prompts-domain-validate.ts`(design/158 S6,lens2 §G:消 config-lkg → capabilities 的
|
|
26
|
+
* 唯一分层反向边)。此处 re-export 保兼容——既有消费者(main/run-local/测试)零改动。 */
|
|
3
27
|
export { validateCenterPrompts, validatePromptsDomain, CORE_ENGINE_VERSION } from "../prompts-domain-validate.js";
|
|
28
|
+
/** [985]b / [1285] — §9.4 by-digest 补拉组合店:local miss ⇒ fetchRaw(digest) 从 center 拉 envelope ⇒
|
|
29
|
+
* core verifyPromptArtifact 全管线 + **回验「拿到的=要的」digest 逐位**(center 答非所问=丢弃)⇒
|
|
30
|
+
* best-effort 回写 inner(下次直命中)。任何失败=undefined(诚实缺席,fail-loud 归 core 的
|
|
31
|
+
* prompt_snapshot_unavailable——绝不拼杂交)。 */
|
|
4
32
|
export function withPromptArtifactBackfill(inner, fetchRaw, log) {
|
|
33
|
+
// codex F1(补拉批):per-canonical-digest 单飞——冷副本上 N 个 pinned resume 同时 miss 同一 artifact
|
|
34
|
+
// 只发一次远拉(finally 清账);裸/大写形入口即正则化(FilePromptArtifactStore 只认 canonical 键,
|
|
35
|
+
// 不正则化=非 canonical 请求缓存永 miss 重拉)。坏形 digest 直拒(不上网)。负缓存有意不设:每次
|
|
36
|
+
// miss 都是用户驱动的 resume 尝试,量有界;404 重复由单飞在并发窗内已并。
|
|
5
37
|
const inFlight = new Map();
|
|
6
38
|
return {
|
|
7
39
|
put: (e) => inner.put(e),
|
|
8
40
|
get: async (digest, opts) => {
|
|
9
41
|
const hex = digest.replace(/^sha256:/i, "").toLowerCase();
|
|
10
42
|
if (!/^[0-9a-f]{64}$/.test(hex))
|
|
11
|
-
return undefined;
|
|
43
|
+
return undefined; // malformed request — never a network trip
|
|
12
44
|
const canonical = `sha256:${hex}`;
|
|
13
45
|
const local = await inner.get(canonical, opts);
|
|
14
46
|
if (local)
|
|
@@ -24,7 +56,7 @@ export function withPromptArtifactBackfill(inner, fetchRaw, log) {
|
|
|
24
56
|
log.warn("center_prompts_backfill_rejected", { digest: canonical, ...(v.ok ? { got: v.artifact.artifactDigest, code: "digest_mismatch" } : { code: v.code, reason: v.reason }) });
|
|
25
57
|
return undefined;
|
|
26
58
|
}
|
|
27
|
-
await inner.put(raw).catch(() => undefined);
|
|
59
|
+
await inner.put(raw).catch(() => undefined); // cache best-effort
|
|
28
60
|
log.info("center_prompts_backfilled", { digest: canonical });
|
|
29
61
|
return raw;
|
|
30
62
|
}
|
|
@@ -41,11 +73,18 @@ export function withPromptArtifactBackfill(inner, fetchRaw, log) {
|
|
|
41
73
|
},
|
|
42
74
|
};
|
|
43
75
|
}
|
|
76
|
+
/** e/b 接线([1236]① seam/[985]e):catalog 轴的两态过渡推进 core 的 CenterPromptSource——
|
|
77
|
+
* present(且身份变)⇒ applySnapshot(core 重验+落盘+原子换 candidate;validate 已过 core verify,
|
|
78
|
+
* 此处失败=磁盘/状态写问题,warn 不挡 declaration 轴);absent-after-present / prompts 键整体消失
|
|
79
|
+
* ⇒ applyDisabled(闸关=显式撤下语义的 catalog 轴半场,离线重启不复活)。幂等安全:同 envelope
|
|
80
|
+
* 重放=同 digest 覆盖写。 */
|
|
44
81
|
export async function applyCatalogToSource(source, next, prev, log, phase) {
|
|
82
|
+
// codex-2 F2:返回「过渡是否成功」——false 时 caller **不推进** centerPrompts(身份留在 prev),
|
|
83
|
+
// 下一拍 refresh 身份仍不等=同一过渡自动重试;吞错推进曾让失败的 apply/withdraw 永久静默。
|
|
45
84
|
try {
|
|
46
85
|
if (next?.catalog) {
|
|
47
86
|
if (prev?.identity === next.identity)
|
|
48
|
-
return true;
|
|
87
|
+
return true; // unchanged face — no state churn
|
|
49
88
|
const r = await source.applySnapshot(next.catalog);
|
|
50
89
|
if (r.ok) {
|
|
51
90
|
log.info("center_prompts_catalog_applied", { phase, artifactDigest: r.artifactDigest });
|
|
@@ -55,6 +94,8 @@ export async function applyCatalogToSource(source, next, prev, log, phase) {
|
|
|
55
94
|
return false;
|
|
56
95
|
}
|
|
57
96
|
if (prev?.catalog || source.current?.() !== undefined) {
|
|
97
|
+
// the axis was live (in-memory marker OR a persisted candidate surviving a restart whose disable was
|
|
98
|
+
// owed) and the face now has no catalog: fail-closed mirror of the cleared semantics — disable durably.
|
|
58
99
|
await source.applyDisabled(`${phase}:catalog-absent`);
|
|
59
100
|
log.info("center_prompts_catalog_disabled", { phase, note: "catalog axis withdrawn — core candidate cleared (does not revive offline)" });
|
|
60
101
|
}
|
|
@@ -65,10 +106,23 @@ export async function applyCatalogToSource(source, next, prev, log, phase) {
|
|
|
65
106
|
return false;
|
|
66
107
|
}
|
|
67
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* 选包+投影:该 scenario 的终形声明数组(`scenarioOverrides[s] ?? sections`)→ typed `stableBlocks`
|
|
111
|
+
* 钩子(声明**逐字**透传,含 contentHash——core 1.315 校验后进 manifest)。空数组在 validate 已拒
|
|
112
|
+
* (F4:空替换集非 v1 语义),所以这里恒有非空声明——恒返回 provider(center-wins 无死分支)。
|
|
113
|
+
*/
|
|
68
114
|
export function centerPromptProvider(prompts, scenarioName) {
|
|
69
115
|
const decls = prompts.scenarioOverrides?.[scenarioName] ?? prompts.sections;
|
|
116
|
+
// 声明数组在候选采用时已判形+冻结(main.ts ref 整体替换,数组不原位变异)——闭包直接引用,core 侧
|
|
117
|
+
// 1.315 还有声明边界快照(getter 无法让「验过的」≠「发出的」)。
|
|
70
118
|
return { stableBlocks: () => decls };
|
|
71
119
|
}
|
|
120
|
+
/** codex R3(appendSystemPrompt 案):该 scenario 的终形 center 声明里是否有「已组装 identity」——core 的
|
|
121
|
+
* M9 迁移卫在 provider.stableBlocks 的 identity 声明上探同三锚,命中即走 pass-through 臂(其保留集无
|
|
122
|
+
* `core/role.append`,任何 append rider/outputStyle 会被静默丢)。选包与 {@link centerPromptProvider}
|
|
123
|
+
* 同式(`overrides[s] ?? sections`);锚谓词由调用方注入(task-settings `hasConstitutionAnchors` 单真源)。
|
|
124
|
+
* [1057]①f 的「server 不做语义复检」不动:这不是复检语义,是为 capabilities.appendSystemPrompt 的诚实面
|
|
125
|
+
* 探 core 会走哪条臂。 */
|
|
72
126
|
export function centerIdentityAssembled(prompts, scenarioName, isAssembled) {
|
|
73
127
|
const decls = prompts.scenarioOverrides?.[scenarioName] ?? prompts.sections;
|
|
74
128
|
return decls.some((d) => d.slot === "identity" && isAssembled(d.text));
|
|
@@ -2,20 +2,48 @@ import { runTeamDiscussion, type Runner, type ToolSpec } from "@sema-agent/core"
|
|
|
2
2
|
import type { Metrics } from "../observability/metrics.js";
|
|
3
3
|
import type { Logger } from "../observability/logger.js";
|
|
4
4
|
type TeamFn = typeof runTeamDiscussion;
|
|
5
|
+
/**
|
|
6
|
+
* Code-review council (Option C+, layers L1 + L3) packaged as ONE tool, so the run model is unchanged
|
|
7
|
+
* and the orchestration is **code-driven** (deterministic — we don't rely on the model to follow a
|
|
8
|
+
* multi-step orchestration prompt, which live runs showed it doesn't do reliably).
|
|
9
|
+
*
|
|
10
|
+
* - L1 (gather): one isolated, read-only-repo-tooled subagent PER differential lens, run in PARALLEL.
|
|
11
|
+
* - L3 (arbitrate): a neutral arbiter grounds/dedups/buckets/ranks. It does not add findings.
|
|
12
|
+
* - L2 (peer debate over findings + dispute verification with member tools) is the next layer.
|
|
13
|
+
*
|
|
14
|
+
* Research basis (core's design): tooled differential exploration is the main source of real bugs;
|
|
15
|
+
* grounding + bucketing kill "imagined requirements" and stop a design preference being filed as a bug.
|
|
16
|
+
*/
|
|
5
17
|
interface Lens {
|
|
6
18
|
name: string;
|
|
7
19
|
brief: string;
|
|
8
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Caller-tunable lens COUNT (OA request) — a structured cost/coverage dial, sibling of `@model` / `council` /
|
|
23
|
+
* `debate`. The deployment owns WHICH lenses (the `LENSES` order = the priority: security/correctness first =
|
|
24
|
+
* the bug-finders); the caller only picks HOW MANY. Clamp to [1, LENSES.length]; absent / non-numeric = ALL
|
|
25
|
+
* (the current default → zero regression). A named subset is deliberately NOT supported (it would force a
|
|
26
|
+
* published, maintained lens vocabulary contract; the count is the verifiable knob a "light/standard" UI needs).
|
|
27
|
+
*/
|
|
9
28
|
export declare function pickLenses(count?: number): readonly Lens[];
|
|
29
|
+
/** Caller-settable debate rounds: a FINITE integer clamped to [1,3]; non-number / NaN / ±Infinity = undefined
|
|
30
|
+
* (→ the council's default of 1). Mirrors `pickLenses`'s `Number.isFinite` guard — the previous inline clamp let
|
|
31
|
+
* `NaN` through (`typeof NaN === "number"`, `Math.min(3, NaN) === NaN`), corrupting the cost metric (council). */
|
|
10
32
|
export declare function clampRounds(rounds: unknown): number | undefined;
|
|
11
33
|
export interface CouncilToolOptions {
|
|
34
|
+
/** Aggregate the council's (otherwise invisible) sub-task cost into metrics. */
|
|
12
35
|
metrics?: Metrics;
|
|
13
36
|
logger?: Logger;
|
|
37
|
+
/** L1+L2+L3: add a peer-team debate (tool-grounded) before arbitration. Default L1+L3 only. */
|
|
14
38
|
debate?: boolean;
|
|
39
|
+
/** Debate rounds (when `debate`). Default 1. */
|
|
15
40
|
rounds?: number;
|
|
41
|
+
/** Caller-chosen lens COUNT (cost/coverage dial). Clamped to [1, LENSES.length]; absent = all lenses. */
|
|
16
42
|
lensCount?: number;
|
|
43
|
+
/** Injectable for tests; defaults to core's runTeamDiscussion. */
|
|
17
44
|
teamFn?: TeamFn;
|
|
18
45
|
}
|
|
46
|
+
/** Build the `run_council` tool. The lead calls it once; it returns the final arbitrated review. */
|
|
19
47
|
export declare function createCouncilTool(subRunner: Runner, repoTools: ToolSpec[], objective: string, opts?: CouncilToolOptions): ToolSpec;
|
|
20
48
|
export {};
|
|
21
49
|
//# sourceMappingURL=code-review-council.d.ts.map
|
|
@@ -1,30 +1,45 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import { runTeamDiscussion } from "@sema-agent/core";
|
|
3
|
-
import { REVIEW_LENSES, GROUNDING, LENS_SYSTEM_TPL, DEBATE_MEMBER_TPL, DEBATE_TOPIC_TPL, ARBITER_SYSTEM, ARBITER_FALLBACK_HEADER } from "./prompts/code-review.js";
|
|
4
|
-
const LENSES = REVIEW_LENSES;
|
|
3
|
+
import { REVIEW_LENSES, GROUNDING, LENS_SYSTEM_TPL, DEBATE_MEMBER_TPL, DEBATE_TOPIC_TPL, ARBITER_SYSTEM, ARBITER_FALLBACK_HEADER } from "./prompts/code-review.js"; // bundle-data layer
|
|
4
|
+
const LENSES = REVIEW_LENSES; // roster copy lives in prompts/code-review.ts
|
|
5
|
+
/**
|
|
6
|
+
* Caller-tunable lens COUNT (OA request) — a structured cost/coverage dial, sibling of `@model` / `council` /
|
|
7
|
+
* `debate`. The deployment owns WHICH lenses (the `LENSES` order = the priority: security/correctness first =
|
|
8
|
+
* the bug-finders); the caller only picks HOW MANY. Clamp to [1, LENSES.length]; absent / non-numeric = ALL
|
|
9
|
+
* (the current default → zero regression). A named subset is deliberately NOT supported (it would force a
|
|
10
|
+
* published, maintained lens vocabulary contract; the count is the verifiable knob a "light/standard" UI needs).
|
|
11
|
+
*/
|
|
5
12
|
export function pickLenses(count) {
|
|
6
13
|
if (count == null || !Number.isFinite(count))
|
|
7
14
|
return LENSES;
|
|
8
15
|
const n = Math.min(LENSES.length, Math.max(1, Math.floor(count)));
|
|
9
16
|
return LENSES.slice(0, n);
|
|
10
17
|
}
|
|
18
|
+
/** Caller-settable debate rounds: a FINITE integer clamped to [1,3]; non-number / NaN / ±Infinity = undefined
|
|
19
|
+
* (→ the council's default of 1). Mirrors `pickLenses`'s `Number.isFinite` guard — the previous inline clamp let
|
|
20
|
+
* `NaN` through (`typeof NaN === "number"`, `Math.min(3, NaN) === NaN`), corrupting the cost metric (council). */
|
|
11
21
|
export function clampRounds(rounds) {
|
|
12
22
|
if (typeof rounds !== "number" || !Number.isFinite(rounds))
|
|
13
23
|
return undefined;
|
|
14
24
|
return Math.min(3, Math.max(1, Math.floor(rounds)));
|
|
15
25
|
}
|
|
26
|
+
// Guardrail COPY (GROUNDING/templates/arbiter) lives in prompts/code-review.ts — this file keeps
|
|
27
|
+
// only the fill logic. `fillPrompt` is a plain `{key}` substitution (no escaping: values are our own lens
|
|
28
|
+
// names/briefs and the objective/findings the model already sees verbatim elsewhere).
|
|
16
29
|
function fillPrompt(tpl, vars) {
|
|
17
30
|
return tpl.replace(/\{(\w+)\}/g, (m, k) => (k in vars ? vars[k] : m));
|
|
18
31
|
}
|
|
19
32
|
function lensSystem(lens) {
|
|
20
33
|
return fillPrompt(LENS_SYSTEM_TPL, { name: lens.name, brief: lens.brief, grounding: GROUNDING });
|
|
21
34
|
}
|
|
35
|
+
// L2 — peer debate persona (guardrails 5,6): cross-examine, adjust confidence, verify disputes with tools.
|
|
22
36
|
function debateMemberSystem(lens) {
|
|
23
37
|
return fillPrompt(DEBATE_MEMBER_TPL, { name: lens.name, brief: lens.brief });
|
|
24
38
|
}
|
|
25
39
|
function debateTopic(objective, findings) {
|
|
26
40
|
return fillPrompt(DEBATE_TOPIC_TPL, { objective, grounding: GROUNDING, findings });
|
|
27
41
|
}
|
|
42
|
+
/** Build the `run_council` tool. The lead calls it once; it returns the final arbitrated review. */
|
|
28
43
|
export function createCouncilTool(subRunner, repoTools, objective, opts = {}) {
|
|
29
44
|
return {
|
|
30
45
|
name: "run_council",
|
|
@@ -33,17 +48,23 @@ export function createCouncilTool(subRunner, repoTools, objective, opts = {}) {
|
|
|
33
48
|
effect: "read",
|
|
34
49
|
parameters: Type.Object({}),
|
|
35
50
|
execute: async (_args, ctx) => {
|
|
51
|
+
// Caller-chosen lens subset (OA cost/coverage dial); default = all lenses.
|
|
36
52
|
const active = pickLenses(opts.lensCount);
|
|
37
|
-
|
|
53
|
+
// Forward the parent task's AbortSignal (core ≥1.18) so the lenses/arbiter stop the instant the
|
|
54
|
+
// parent is cancelled, instead of each burning to its own timeoutSec (design/16 feature request).
|
|
55
|
+
const lenses = await runLensReviews(subRunner, repoTools, objective, ctx.signal, active); // L1
|
|
38
56
|
const findings = lenses.map((l) => `### ${l.lens} reviewer\n${l.text}`).join("\n\n");
|
|
39
|
-
const converge = await runConvergence(subRunner, repoTools, objective, findings, opts, ctx.signal, active);
|
|
57
|
+
const converge = await runConvergence(subRunner, repoTools, objective, findings, opts, ctx.signal, active); // L2?+L3
|
|
58
|
+
// Cost is otherwise invisible — the sub-tasks run on a separate runner, so the parent run's
|
|
59
|
+
// stats only count the lead. Surface the real (~Nx) cost three ways:
|
|
40
60
|
const totalTokens = lenses.reduce((s, l) => s + l.tokens, 0) + converge.tokens;
|
|
41
61
|
const totalTurns = lenses.reduce((s, l) => s + l.turns, 0) + converge.turns;
|
|
42
62
|
const tasks = active.length + (opts.debate ? active.length * (opts.rounds ?? 1) + 1 : 1);
|
|
63
|
+
// ① into the PARENT run's TaskResult.stats.nested (core 1.11 reportUsage):
|
|
43
64
|
ctx.reportUsage?.({ tokens: totalTokens, turns: totalTurns, tasks });
|
|
44
65
|
const mode = opts.debate ? "L1+L2+L3" : "L1+L3";
|
|
45
66
|
opts.metrics?.inc("council_runs_total", { mode });
|
|
46
|
-
opts.metrics?.inc("task_tokens_total", {}, totalTokens);
|
|
67
|
+
opts.metrics?.inc("task_tokens_total", {}, totalTokens); // global counter, no labels — keep it honest
|
|
47
68
|
opts.metrics?.observe("council_tokens", totalTokens);
|
|
48
69
|
opts.logger?.info("council_done", { mode, lenses: lenses.length, totalTokens, totalTurns });
|
|
49
70
|
return {
|
|
@@ -53,10 +74,15 @@ export function createCouncilTool(subRunner, repoTools, objective, opts = {}) {
|
|
|
53
74
|
},
|
|
54
75
|
};
|
|
55
76
|
}
|
|
77
|
+
/** L1 — one isolated, repo-tooled subagent per lens, run in parallel. A single lens that throws
|
|
78
|
+
* (gateway 5xx / timeout) must NOT collapse the whole council, so failures degrade to a noted
|
|
79
|
+
* empty lens and arbitration proceeds on the survivors. */
|
|
56
80
|
async function runLensReviews(subRunner, repoTools, objective, signal, lenses) {
|
|
57
81
|
const settled = await Promise.allSettled(lenses.map(async (lens) => {
|
|
58
82
|
const r = await subRunner.runTask({
|
|
59
83
|
objective: `${objective}\n\nReview ONLY through the ${lens.name} lens.`,
|
|
84
|
+
// Cost tiering (1.24): lenses run on the `subagent` role — cheap when MODEL_CHEAP_ID is set,
|
|
85
|
+
// else the main model. Scanning for leads doesn't need the strong model; the arbiter does.
|
|
60
86
|
modelRole: "subagent",
|
|
61
87
|
tools: repoTools,
|
|
62
88
|
systemPrompt: lensSystem(lens),
|
|
@@ -75,6 +101,7 @@ async function runLensReviews(subRunner, repoTools, objective, signal, lenses) {
|
|
|
75
101
|
turns: 0,
|
|
76
102
|
});
|
|
77
103
|
}
|
|
104
|
+
/** L2 (peer debate, tool-grounded) + L3 synthesis, or — when `debate` is off — L3 arbiter alone. */
|
|
78
105
|
async function runConvergence(subRunner, repoTools, objective, findings, opts, signal, lenses) {
|
|
79
106
|
if (opts.debate) {
|
|
80
107
|
const team = await (opts.teamFn ?? runTeamDiscussion)({
|
|
@@ -83,12 +110,14 @@ async function runConvergence(subRunner, repoTools, objective, findings, opts, s
|
|
|
83
110
|
members: lenses.map((l) => ({ role: l.name, systemPrompt: debateMemberSystem(l) })),
|
|
84
111
|
topic: debateTopic(objective, findings),
|
|
85
112
|
rounds: opts.rounds ?? 1,
|
|
86
|
-
tools: repoTools,
|
|
113
|
+
tools: repoTools, // members may verify a disputed claim against the real code (Tool-MAD)
|
|
87
114
|
maxTranscriptTokens: 8000,
|
|
88
115
|
synthesizer: { role: "arbiter", systemPrompt: ARBITER_SYSTEM },
|
|
89
116
|
limits: { timeoutSec: 400 },
|
|
90
|
-
signal,
|
|
117
|
+
signal, // 1.28: a parent abort now cascades into the debate members
|
|
91
118
|
});
|
|
119
|
+
// 1.32: synthesizer 两次都失败时 `conclusion` 是 `[unavailable…]` 垃圾串,与真结论无法区分。别当结论
|
|
120
|
+
// 返回——退回未经仲裁的各 lens 原始发现(findings 在手),用户至少看到真实发现,而不是把垃圾当评审。
|
|
92
121
|
if (!team.conclusionValid) {
|
|
93
122
|
opts.logger?.warn("council_arbiter_failed", { failures: team.failures });
|
|
94
123
|
return {
|
|
@@ -99,14 +128,18 @@ async function runConvergence(subRunner, repoTools, objective, findings, opts, s
|
|
|
99
128
|
}
|
|
100
129
|
return { review: team.conclusion, tokens: team.stats.tokens, turns: team.stats.turns };
|
|
101
130
|
}
|
|
131
|
+
// L3 only — a single neutral arbiter (ground / dedup / bucket / rank). No new findings.
|
|
102
132
|
const arb = await subRunner.runTask({
|
|
103
133
|
objective: `Arbitrate these specialist findings into ONE final review:\n\n${findings}`,
|
|
134
|
+
// The arbiter grounds/dedups/ranks — keep it on the strong `synthesize` role (= main model).
|
|
104
135
|
modelRole: "synthesize",
|
|
105
136
|
systemPrompt: ARBITER_SYSTEM,
|
|
106
137
|
limits: { timeoutSec: 240 },
|
|
107
138
|
enableBlockedReport: false,
|
|
108
139
|
signal,
|
|
109
140
|
});
|
|
141
|
+
// Mirror the debate path's fallback: an empty/failed arbiter result must not surface as an empty review —
|
|
142
|
+
// hand back the raw lens findings so the caller still sees real findings, not nothing.
|
|
110
143
|
const review = arb.result?.trim() || `${ARBITER_FALLBACK_HEADER}${findings}`;
|
|
111
144
|
return { review, tokens: arb.stats.tokens, turns: arb.stats.turns };
|
|
112
145
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { CollabTemplateWire } from "./collab-wire.js";
|
|
2
|
+
/** core WorkflowScriptStore.list() 行(name+description+whenToUse)——LLM 工具卡/roster 投影面。 */
|
|
2
3
|
export interface CollabWorkflowListing {
|
|
3
4
|
name: string;
|
|
4
5
|
description?: string;
|
|
5
6
|
whenToUse?: string;
|
|
6
7
|
}
|
|
8
|
+
/** 一条已注册的 collab 命名 workflow:执行体恒为 core 内置 team-discussion 脚本,个性全在 defaultArgs。 */
|
|
7
9
|
export interface CollabWorkflowEntry {
|
|
8
10
|
defaultArgs: {
|
|
9
11
|
members: Array<{
|
|
@@ -32,9 +34,14 @@ export interface CollabWorkflowProjection {
|
|
|
32
34
|
}
|
|
33
35
|
export declare function projectCollabToWorkflows(templates: readonly CollabTemplateWire[] | undefined): CollabWorkflowProjection;
|
|
34
36
|
export declare function registerCollabWorkflows(workflows: Record<string, CollabWorkflowEntry>): void;
|
|
37
|
+
/** composite WorkflowScriptStore 的 resolveName 前段:collab 命中 ⇒ 内置 team-discussion 脚本+本模板
|
|
38
|
+
* defaultArgs(同名 SHADOW core 内置,design/140 §6 1c)。🔴 Object.hasOwn — `name` 是模型供给的
|
|
39
|
+
* (run-workflow-tool 原样传 rawName):裸索引会让 Object.prototype 成员名("constructor"/"toString"/
|
|
40
|
+
* "__proto__"…)假命中 ⇒ 零模板注册也能烧真讨论、且同名文件 store 条目被遮蔽(对抗评审 2026-07-11 MED)。 */
|
|
35
41
|
export declare function resolveCollabWorkflow(name: string): {
|
|
36
42
|
script: string;
|
|
37
43
|
defaultArgs: unknown;
|
|
38
44
|
} | undefined;
|
|
45
|
+
/** composite store 的 list() 段(同步——workflow 工具卡只吃同步 list,core 契约注释)。 */
|
|
39
46
|
export declare function listCollabWorkflows(): CollabWorkflowListing[];
|
|
40
47
|
//# sourceMappingURL=collab-workflows.d.ts.map
|
|
@@ -1,9 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* collab → named-workflow projection — 翻译层**切片 1.5**(design/140 统一解:
|
|
3
|
+
* 「模式=内置命名 workflow profile,一期零新引擎机制」;core 1.263.0 三件落地后的靶点切换)。
|
|
4
|
+
*
|
|
5
|
+
* 切片① 的 runTeamDiscussion 投影(collab-project.ts)已随本切片**整体替换**(同款纪律:别留双路径
|
|
6
|
+
* 降级)。新形态:每个可投影的 CollabTemplate 翻译成一条**命名 workflow 注册条目**——
|
|
7
|
+
*
|
|
8
|
+
* `Workflow({name: <collab id>})` ⇒ 执行体 = core 内置 `TEAM_DISCUSSION_SCRIPT`(pure script content,
|
|
9
|
+
* 零新机制)+ `defaultArgs` = 本模板的 slots/rounds/finalizer 翻译(args 合并链第二级:调用时 args >
|
|
10
|
+
* 本注册 defaults > 脚本内置兜底,core `mergeWorkflowArgs` 在 tool-resolve 时点快照)。center「只配模式
|
|
11
|
+
* 各 slot 的模型」的拍板意图恰好=defaultArgs 这一级;调用者仍可用 args.topic/members 覆盖。
|
|
12
|
+
*
|
|
13
|
+
* 可投影子集(团队讨论 profile 能忠实执行的语义;其余整条跳过+结构化上报,绝不静默降级):
|
|
14
|
+
* topology ∈ {ring, pair}(round-based 顺序发言=脚本真实形态;star/layered 等 core 后续 profile)∧
|
|
15
|
+
* finalizer.type = "summarize"(→脚本 finalizer;judge/vote/fuse/verify 裁决族=后续 profile)∧
|
|
16
|
+
* sharedContext = {transcript, session} ∧ 全 slot 无 tools(工具绑定=执行面后续)。
|
|
17
|
+
*
|
|
18
|
+
* 语义注记(投影成功但记录):脚本对 members cap 6 / rounds cap 5(确定性截断)——超界模板照投+note;
|
|
19
|
+
* CollabTemplate.budget=模板级预算无 per-name workflow 通道(WorkflowLimits 是部署级、per-child 强制轴
|
|
20
|
+
* 已有)→ 记 note,引擎 budget 硬顶+部署 maxTask* 闸兜底(与切片① 结论一致)。
|
|
21
|
+
*
|
|
22
|
+
* 纯函数投影 + 模块级可变注册表(registerTeams 同款单例姿势,applyEffective boot+refresh 热更);
|
|
23
|
+
* 消费点 = main.ts 的 composite WorkflowScriptStore(resolveName 先查这里——**同名 SHADOW core 内置**,
|
|
24
|
+
* design/140 §6 1c 契约)。
|
|
25
|
+
*/
|
|
1
26
|
import { TEAM_DISCUSSION_SCRIPT } from "@sema-agent/core";
|
|
2
27
|
export function projectCollabToWorkflows(templates) {
|
|
3
28
|
const out = { workflows: {}, skipped: [], notes: [] };
|
|
4
29
|
for (const t of templates ?? []) {
|
|
5
30
|
if (t.enabled === false)
|
|
6
|
-
continue;
|
|
31
|
+
continue; // 运营态关闭(不进 skipped)
|
|
7
32
|
if (t.topology !== "ring" && t.topology !== "pair") {
|
|
8
33
|
out.skipped.push({ id: t.id, reason: `topology "${t.topology}" awaits a dedicated profile (design/140 follow-on)` });
|
|
9
34
|
continue;
|
|
@@ -22,11 +47,17 @@ export function projectCollabToWorkflows(templates) {
|
|
|
22
47
|
out.skipped.push({ id: t.id, reason: "slot tools binding awaits the execution slice" });
|
|
23
48
|
continue;
|
|
24
49
|
}
|
|
50
|
+
// finalizer.slot → 脚本 finalizer(该席位退出讨论席)。slot **未配** ⇒ 脚本内置综合官兜底(合法形态);
|
|
51
|
+
// slot 配了但**悬空**(指向不存在的席位——拼错/编辑漂移)⇒ 整条跳过(静默回退默认综合官
|
|
52
|
+
// = 模板意图被悄悄改写,违「绝不静默降级」纪律;center zod 不做跨字段存在性校验,这里是唯一防线)。
|
|
25
53
|
const finSlot = t.finalizer.slot !== undefined ? t.slots.find((s) => s.id === t.finalizer.slot) : undefined;
|
|
26
54
|
if (t.finalizer.slot !== undefined && finSlot === undefined) {
|
|
27
55
|
out.skipped.push({ id: t.id, reason: `finalizer.slot "${t.finalizer.slot}" does not match any slot id (dangling reference)` });
|
|
28
56
|
continue;
|
|
29
57
|
}
|
|
58
|
+
// 对抗评审 2026-07-11(MED):finalizer slot 合法可为 cardinality-N 多成员(registry-core 只约束
|
|
59
|
+
// cardinality=1 ≤1 人),但 team-discussion 的 finalizer 是单席——members[1..] 无席可坐。不静默丢人:
|
|
60
|
+
// 首成员任综合官,其余 note 上报(与 cap 截断同款有损注记纪律)。
|
|
30
61
|
if ((finSlot?.members?.length ?? 0) > 1) {
|
|
31
62
|
out.notes.push({ id: t.id, note: `finalizer slot "${finSlot.id}" carries ${finSlot.members.length} members — only the first seats as the synthesizer (single-seat finalizer profile)` });
|
|
32
63
|
}
|
|
@@ -35,6 +66,10 @@ export function projectCollabToWorkflows(templates) {
|
|
|
35
66
|
const finalizer = finPrompt !== undefined || finModel !== undefined
|
|
36
67
|
? { ...(finPrompt !== undefined ? { prompt: finPrompt } : {}), ...(finModel !== undefined ? { model: finModel } : {}) }
|
|
37
68
|
: undefined;
|
|
69
|
+
// 讨论席展开(cardinality "N" 逐成员出席,role 序号唯一;member 镜头 > slot 镜头;T1 modelRef 缺省=
|
|
70
|
+
// 不设 model ⇒ 脚本/引擎跟随调用者当前模型,零特判)。members 为空的席位=slot 镜头即人设,一人出席。
|
|
71
|
+
// cardinality 声明与 members 实况分叉(=1 却配了多成员)不静默 flatten——全员照展开
|
|
72
|
+
// (丢成员=更糟的静默降级)但 note 上报,center 编辑面可据此标注修正。
|
|
38
73
|
const members = [];
|
|
39
74
|
for (const s of t.slots) {
|
|
40
75
|
if (s === finSlot)
|
|
@@ -59,6 +94,8 @@ export function projectCollabToWorkflows(templates) {
|
|
|
59
94
|
defaultArgs: { members, rounds: t.rounds.max, ...(finalizer ? { finalizer } : {}) },
|
|
60
95
|
listing: {
|
|
61
96
|
name: t.id,
|
|
97
|
+
// description=center 起的显示名+描述(工具卡人话);whenToUse 留给 center 未来字段——缺席时
|
|
98
|
+
// 工具卡回落 description(core workflowWhenToUseText 链)。
|
|
62
99
|
description: [t.name, t.description].filter(Boolean).join(" — ") || t.id,
|
|
63
100
|
},
|
|
64
101
|
};
|
|
@@ -75,15 +112,21 @@ export function projectCollabToWorkflows(templates) {
|
|
|
75
112
|
}
|
|
76
113
|
return out;
|
|
77
114
|
}
|
|
115
|
+
// ── 模块级注册表(registerTeams 同款可变单例;applyEffective boot+refresh 热更,非粘:整表替换)────────
|
|
78
116
|
let REGISTRY = {};
|
|
79
117
|
export function registerCollabWorkflows(workflows) {
|
|
80
118
|
REGISTRY = { ...workflows };
|
|
81
119
|
}
|
|
120
|
+
/** composite WorkflowScriptStore 的 resolveName 前段:collab 命中 ⇒ 内置 team-discussion 脚本+本模板
|
|
121
|
+
* defaultArgs(同名 SHADOW core 内置,design/140 §6 1c)。🔴 Object.hasOwn — `name` 是模型供给的
|
|
122
|
+
* (run-workflow-tool 原样传 rawName):裸索引会让 Object.prototype 成员名("constructor"/"toString"/
|
|
123
|
+
* "__proto__"…)假命中 ⇒ 零模板注册也能烧真讨论、且同名文件 store 条目被遮蔽(对抗评审 2026-07-11 MED)。 */
|
|
82
124
|
export function resolveCollabWorkflow(name) {
|
|
83
125
|
if (!Object.hasOwn(REGISTRY, name))
|
|
84
126
|
return undefined;
|
|
85
127
|
return { script: TEAM_DISCUSSION_SCRIPT, defaultArgs: REGISTRY[name].defaultArgs };
|
|
86
128
|
}
|
|
129
|
+
/** composite store 的 list() 段(同步——workflow 工具卡只吃同步 list,core 契约注释)。 */
|
|
87
130
|
export function listCollabWorkflows() {
|
|
88
131
|
return Object.values(REGISTRY).map((e) => e.listing);
|
|
89
132
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { ToolSpec } from "@sema-agent/core";
|
|
2
|
+
/**
|
|
3
|
+
* OA scenario — tools are thin HTTP clients to the OA backend's existing APIs (read = /api/v1/*,
|
|
4
|
+
* write = /api/assets/*). The shared service token + the request's principal are forwarded so OA
|
|
5
|
+
* enforces THAT end-user's RBAC + audit (the service never holds per-user creds). Decoupled: the
|
|
6
|
+
* service knows no OA schema/DB — OA stays the source of truth (its /api/v1/meta is self-describing).
|
|
7
|
+
*/
|
|
2
8
|
export interface OaCtx {
|
|
3
9
|
baseUrl: string;
|
|
4
10
|
token: string;
|
|
@@ -39,6 +39,16 @@ export function oaTools(ctx) {
|
|
|
39
39
|
return e; const x = a; return oaFetch(ctx, `/api/assets/${encodeURIComponent(x.type)}/${encodeURIComponent(x.id)}/transition`, { method: "POST", body: { to: x.to, note: x.note ?? null } }); } },
|
|
40
40
|
];
|
|
41
41
|
}
|
|
42
|
+
// OA business prompt MOVED OUT — migration complete (design/29, 2026-06-05). Persona / 工作准则 / UI
|
|
43
|
+
// markers (::FORM:: / ::GOTO:: / ::SUGGEST:: / ::ISSUE_FORM::) / 分级确认 / 报bug流程 are OA's business,
|
|
44
|
+
// and OA now injects the WHOLE thing per request via `request.systemPrompt` (it holds the service token,
|
|
45
|
+
// content is stable per OA version → cacheable prefix; page context still rides `objective`). Keeping
|
|
46
|
+
// any of it here would just DUPLICATE OA's prompt, so the base is EMPTY — single source of truth = OA.
|
|
47
|
+
// The service stays business-agnostic: it provides the oa_* tools (referenced by NAME from OA's prompt;
|
|
48
|
+
// they carry their own descriptions) and nothing else. `stablePrompt` keeps STABLE→VARIABLE order —
|
|
49
|
+
// OA's systemPrompt is appended after this (empty) base, before core's <user_memory>.
|
|
50
|
+
// (::ISSUE_FORM:: is parsed/rendered + submitted entirely by OA's frontend via OA /api/ai/issue — the
|
|
51
|
+
// service never touches it; `open_gitea_issue` remains only as the unattended/automated fallback.)
|
|
42
52
|
const OA_SYSTEM = "";
|
|
43
53
|
export const oaPrompt = stablePrompt(OA_SYSTEM);
|
|
44
54
|
//# sourceMappingURL=oa-tools.js.map
|
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
import type { PromptProvider } from "@sema-agent/core";
|
|
2
|
+
/**
|
|
3
|
+
* Build a scenario's prompt provider from just its ROLE base, on core 1.243's 提示词主权 contract:
|
|
4
|
+
* `stableSystem` returns ONLY the role layer (base + the task's own systemPrompt) and **core appends
|
|
5
|
+
* the constitution structurally** — harness/safety blocks (Truth/CYBER_RISK/URL_SAFETY), mode blocks,
|
|
6
|
+
* AND the memory safety/hygiene guidance (`constitutionBlocks`), plus the volatile `<user_memory>`
|
|
7
|
+
* tail LAST (design/12 prefix-cache discipline; guarded in CI by `assertPromptCacheFriendly`).
|
|
8
|
+
*
|
|
9
|
+
* History: the pre-1.243 seam made this helper's whole-prompt replacement silently DROP
|
|
10
|
+
* core's constitution — oa/code-review/team ran with zero safety blocks. Same batch also moved
|
|
11
|
+
* MEMORY_SAFETY/MEMORY_HYGIENE into the constitution layer, so the hand-composition this helper used
|
|
12
|
+
* to do (core 1.62, design/41) would now DOUBLE-inject them — both removed; core owns the discipline
|
|
13
|
+
* (consolidation mutual-exclusion included). This stays a thin role-layer join so scenarios don't
|
|
14
|
+
* re-implement the same two-line body five times.
|
|
15
|
+
*/
|
|
2
16
|
export declare function stablePrompt(base: string): PromptProvider;
|
|
3
17
|
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build a scenario's prompt provider from just its ROLE base, on core 1.243's 提示词主权 contract:
|
|
3
|
+
* `stableSystem` returns ONLY the role layer (base + the task's own systemPrompt) and **core appends
|
|
4
|
+
* the constitution structurally** — harness/safety blocks (Truth/CYBER_RISK/URL_SAFETY), mode blocks,
|
|
5
|
+
* AND the memory safety/hygiene guidance (`constitutionBlocks`), plus the volatile `<user_memory>`
|
|
6
|
+
* tail LAST (design/12 prefix-cache discipline; guarded in CI by `assertPromptCacheFriendly`).
|
|
7
|
+
*
|
|
8
|
+
* History: the pre-1.243 seam made this helper's whole-prompt replacement silently DROP
|
|
9
|
+
* core's constitution — oa/code-review/team ran with zero safety blocks. Same batch also moved
|
|
10
|
+
* MEMORY_SAFETY/MEMORY_HYGIENE into the constitution layer, so the hand-composition this helper used
|
|
11
|
+
* to do (core 1.62, design/41) would now DOUBLE-inject them — both removed; core owns the discipline
|
|
12
|
+
* (consolidation mutual-exclusion included). This stays a thin role-layer join so scenarios don't
|
|
13
|
+
* re-implement the same two-line body five times.
|
|
14
|
+
*/
|
|
1
15
|
export function stablePrompt(base) {
|
|
2
16
|
return {
|
|
3
17
|
stableSystem: ({ userSystemPrompt }) => [base, userSystemPrompt].filter(Boolean).join("\n\n"),
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code-review council copy (bundle-data layer). Pure data — placeholders are `{name}`-style,
|
|
3
|
+
* filled by the consumer (code-review-council.ts fillPrompt). Guardrail rationale lives with the
|
|
4
|
+
* consumer's comments; this file is ONLY the words.
|
|
5
|
+
*/
|
|
6
|
+
/** The deployment-owned lens roster. Order = priority (security/correctness first = the bug-finders);
|
|
7
|
+
* the caller dials COUNT only (pickLenses), never a named subset. */
|
|
1
8
|
export declare const REVIEW_LENSES: ReadonlyArray<{
|
|
2
9
|
name: string;
|
|
3
10
|
brief: string;
|
|
4
11
|
}>;
|
|
12
|
+
/** Guardrails 2-5: evidence grounding (a CONFIDENCE signal, not a delete), requirement anchoring,
|
|
13
|
+
* bucketing, severity×confidence. */
|
|
5
14
|
export declare const GROUNDING: string;
|
|
15
|
+
/** L1 lens reviewer system prompt. Placeholders: {name} {brief} {grounding}. */
|
|
6
16
|
export declare const LENS_SYSTEM_TPL: string;
|
|
17
|
+
/** L2 peer-debate persona (guardrails 5,6). Placeholders: {name} {brief}. */
|
|
7
18
|
export declare const DEBATE_MEMBER_TPL: string;
|
|
19
|
+
/** L2 debate topic body. Placeholders: {objective} {grounding} {findings}. */
|
|
8
20
|
export declare const DEBATE_TOPIC_TPL: string;
|
|
21
|
+
/** Guardrails 4,7: arbitration is not summary — no new findings, ground/dedup/bucket/rank only. */
|
|
9
22
|
export declare const ARBITER_SYSTEM: string;
|
|
23
|
+
/** No-arbiter fallback header ({findings} appended by the consumer). */
|
|
10
24
|
export declare const ARBITER_FALLBACK_HEADER = "[council \u4EF2\u88C1\u65E0\u8F93\u51FA\u2014\u2014\u4EE5\u4E0B\u662F\u672A\u7ECF\u4EF2\u88C1\u7684\u5404 lens \u539F\u59CB\u53D1\u73B0]\n\n";
|
|
11
25
|
//# sourceMappingURL=code-review.d.ts.map
|