@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
|
@@ -3,6 +3,12 @@ import type { Metrics } from "../observability/metrics.js";
|
|
|
3
3
|
import type { Logger } from "../observability/logger.js";
|
|
4
4
|
import { GiteaClient } from "./repo-tools.js";
|
|
5
5
|
import { type LoadedSkill } from "./skills.js";
|
|
6
|
+
/**
|
|
7
|
+
* Scenario routing — a deployment serves many scenarios from one image. Each request's `scenario`
|
|
8
|
+
* selects a pre-wired capability bundle: tools (incl. subagent roster) + a whole-harness prompt +
|
|
9
|
+
* skills. Heavy bits (HTTP clients, skill files) are startup singletons; per task we only bind
|
|
10
|
+
* coordinates and build cheap closures, so there is no per-request "assembly" cost.
|
|
11
|
+
*/
|
|
6
12
|
export interface ScenarioRequest {
|
|
7
13
|
scenario?: string;
|
|
8
14
|
repo?: string;
|
|
@@ -12,22 +18,37 @@ export interface ScenarioBundle {
|
|
|
12
18
|
tools: ToolSpec[];
|
|
13
19
|
skills: SkillSpec[];
|
|
14
20
|
promptProvider?: PromptProvider;
|
|
21
|
+
/** [849] 场景解释层定死的终验开关(core TaskSpec.finalVerification):bench 实测产品默认请求与
|
|
22
|
+
* bench 态差距三件之一。只有 `autonomous` 置 true;spec 组装处与 caller 显式声明取 OR(场景只会
|
|
23
|
+
* 多加一轮收官验证,绝不收窄 caller 意图),壳/caller 不感知。 */
|
|
15
24
|
finalVerification?: true;
|
|
16
25
|
}
|
|
17
26
|
export type Scenario = (req: ScenarioRequest, principal?: string) => ScenarioBundle;
|
|
18
27
|
export interface ScenarioDeps {
|
|
19
28
|
runner: Runner;
|
|
29
|
+
/** In-memory runner for ephemeral sub-tasks (council lenses/arbiter) — keeps them out of TiDB. */
|
|
20
30
|
subRunner: Runner;
|
|
21
31
|
model: string;
|
|
22
32
|
skills: LoadedSkill[];
|
|
23
33
|
repoClient?: GiteaClient;
|
|
34
|
+
/** Multi-tenant deployment (REQUIRE_PRINCIPAL). Gates the full-body `WebFetch` tool out of the
|
|
35
|
+
* default roster — core says a multi-tenant deployment MUST allowlist hosts (an injected/malicious tenant model
|
|
36
|
+
* could exfil via an arbitrary public URL; the SSRF floor only blocks internal). Single-user TOC keeps WebFetch. */
|
|
24
37
|
requirePrincipal?: boolean;
|
|
38
|
+
/** Deployment-injected WebSearch backend (Brave/Tavily/SearXNG via `WEB_SEARCH_PROVIDER`). When set,
|
|
39
|
+
* `assembleCodeTools` mounts the WebSearch tool; absent ⇒ not assembled (core ships no search backend). */
|
|
25
40
|
webSearch?: WebSearchConfig;
|
|
41
|
+
/** [1900]/[1904] WebFetch 摘要器(core `makeWebFetchSummarizer(brain, summarize 角色模型)` 的产物,
|
|
42
|
+
* main.ts 构造一次注入)。在场 ⇒ 装配实参携 `webFetch.summarize`——带 prompt 的 WebFetch 走 cheap
|
|
43
|
+
* 模型摘要而非整页灌上下文([1870] L1 的 ~660× 放大就是这缝);缺席 ⇒ `webFetch` 键不铸(修前
|
|
44
|
+
* 字节形,core 落「summarization unavailable」诚实兜底)。 */
|
|
26
45
|
webFetchSummarize?: (content: string, prompt: string, signal?: AbortSignal) => Promise<string>;
|
|
27
46
|
metrics?: Metrics;
|
|
28
47
|
logger?: Logger;
|
|
48
|
+
/** OA backend coordinates for the `oa` scenario (read /api/v1, write /api/assets). */
|
|
29
49
|
oaApiBaseUrl?: string;
|
|
30
50
|
oaServiceToken?: string;
|
|
51
|
+
/** 可选:`oa` 场景注入"开 Gitea issue"工具(OA AI 请求#5);repo/token/labels 固定,模型只填 title/body。 */
|
|
31
52
|
oaIssue?: {
|
|
32
53
|
baseUrl: string;
|
|
33
54
|
owner: string;
|
|
@@ -35,29 +56,113 @@ export interface ScenarioDeps {
|
|
|
35
56
|
token: string;
|
|
36
57
|
defaultLabels?: number[];
|
|
37
58
|
};
|
|
59
|
+
/**
|
|
60
|
+
* When true, the `default` scenario carries the Sema product identity (see {@link semaIdentityProvider}).
|
|
61
|
+
* Set by the local/TOC deployment (CONFIG_PROVIDER=local / run-local) so the local engine answers "who
|
|
62
|
+
* are you" as Sema instead of the model's hallucinated identity. Business scenarios (oa/team/code-review)
|
|
63
|
+
* keep their own prompts; cloud (CONFIG_PROVIDER≠local) leaves the default scenario neutral unless turned
|
|
64
|
+
* on, so integrators that inject their own persona are unaffected.
|
|
65
|
+
*/
|
|
38
66
|
brandIdentity?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* core 1.287 `SubagentToolOptions.extraTools` seam wire-through — per-SPAWN dynamic tool injection into the
|
|
69
|
+
* delegated (Agent-tool) child roster. Deployment-injected per-task tools (today: SendUserFile — its instance is
|
|
70
|
+
* execute-time late-bound via ctx.taskId → TaskEnvRegistry, so ONE spec serves every spawn) cannot ride the
|
|
71
|
+
* ASSEMBLY-time static `subagent.tools` pool; this factory is evaluated by core at each spawn and its product is
|
|
72
|
+
* merged into the pool, then goes through core's `resolveToolSubset` whitelist like any other tool (agent-def
|
|
73
|
+
* allowTools/denyTools still govern — no extra gate needed on our side). Absent ⇒ no dynamic injection (children
|
|
74
|
+
* see exactly the static full-body roster, the pre-1.287 behavior).
|
|
75
|
+
*/
|
|
39
76
|
subagentExtraTools?: (ctx: SubagentSpawnContext) => ToolSpec[];
|
|
77
|
+
/**
|
|
78
|
+
* core 1.364 durable background agents(design/151 S1,[1503] 提货单②写半场):后台子代 `a*` 行的
|
|
79
|
+
* durable 执行记录 store。**必须与 `RunnerDeps.backgroundAgentStore` 同实例**(读写双点配对,engine
|
|
80
|
+
* 无法核对——半接=静默死特性,RB-37①)。绝不在这里另起实例。absent ⇒ pre-151 行为(settle 后
|
|
81
|
+
* eager release,读面纯 live)。
|
|
82
|
+
*/
|
|
40
83
|
backgroundAgentStore?: BackgroundAgentStore;
|
|
84
|
+
/**
|
|
85
|
+
* core 1.382(design/153 二拍B 件1+件2,parked 状态机)[1561] 提货单①②:「同车必接」的一对——core
|
|
86
|
+
* `parkEligible` 门要求 checkpointStore 与 ensureChildSessionDurable **全在场**才成立,任一缺席 = 净是
|
|
87
|
+
* pre-153 行为(子代 SAFETY ask 照旧 deny+continue,零回归)。
|
|
88
|
+
* - `checkpointStore` 必须与 `RunnerDeps.checkpointStore`(主 runner 的 per-task spec 面)**同实例**
|
|
89
|
+
* ——子代 suspend 在那里铸 token,异实例 = park 全静默失效(core JSDoc 钉过症状,组装区注释同步)。
|
|
90
|
+
* - `ensureChildSessionDurable` = park 提交前的 capability 挂点(core 签名 `(sessionId) => Promise<void>`)
|
|
91
|
+
* ——resolve = 该子代 session 已从任意进程可读,reject/缺席 = veto(子代按 pre-153 settle failed,
|
|
92
|
+
* checkpoint 被 expire)。**本车保守实现**:只在子代 session 已经真正路由到宿主 durable 会话店
|
|
93
|
+
* **且真有内容**(`getLeafId() !== null`——排除 F-7 同族的空壳 claim-create 行,那种行 acquire
|
|
94
|
+
* 命中但零内容,是`register()`对任意自报 sessionId 的副作用,不是真正 durable 的会话)时 resolve
|
|
95
|
+
* (=fork 续聊的常见形),其余一律 reject——不做「主动迁移私店会话进 durable 店」这一步
|
|
96
|
+
* (ForkRoutingSessionStore 的路由表是私有状态,无迁移 API;主动迁移是更大的活,candidate 留给
|
|
97
|
+
* 后续按需再做)。
|
|
98
|
+
*/
|
|
41
99
|
checkpointStore?: CheckpointStore;
|
|
42
100
|
ensureChildSessionDurable?: (sessionId: string) => Promise<void>;
|
|
43
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Sema product identity, prepended to the core default base for the `default` scenario when
|
|
104
|
+
* {@link ScenarioDeps.brandIdentity} is on. Honest about the substrate (the engine runs whichever model
|
|
105
|
+
* the operator configured — not Claude/Anthropic), so the agent never inherits the model's training-time
|
|
106
|
+
* "I am Claude" hallucination.
|
|
107
|
+
*
|
|
108
|
+
* Live-caught incident (a Qwen3.5 deployment self-described as "running on a DeepSeek model"):
|
|
109
|
+
* NOTHING substrate-specific may be hardcoded here — onboard is multi-provider (Qwen/GLM/Kimi/self-hosted
|
|
110
|
+
* vLLM…), so a baked maker name makes every non-DeepSeek deployment misstate its own substrate. Same for
|
|
111
|
+
* the gateway protocol (the brain stack serves Anthropic-compatible routes too — routing brain +
|
|
112
|
+
* createAnthropicBrain — so "OpenAI-compatible gateway" would be the same class of lie). Neutral wording
|
|
113
|
+
* (zero core-seam need; interpolating the model id would need a `StablePromptContext.model`
|
|
114
|
+
* seam and reads poorly for ugly preset ids). The anti-"I am Claude" design is kept — only the baked
|
|
115
|
+
* substrate facts are removed.
|
|
116
|
+
*/
|
|
44
117
|
export { SEMA_IDENTITY } from "./prompts/identity.js";
|
|
118
|
+
/**
|
|
119
|
+
* Prompt provider for the branded `default` scenario: SEMA_IDENTITY on top of the ROLE base — the
|
|
120
|
+
* task's own `body.systemPrompt`, or core's {@link DEFAULT_SYSTEM_PROMPT} when none. Core 1.243
|
|
121
|
+
* (提示词主权批) appends the constitution structurally AFTER this role layer (harness
|
|
122
|
+
* safety blocks + modes + memory guidance + the prefix-cache-safe `<user_memory>` tail), so identity
|
|
123
|
+
* cannot displace the safety blocks. The pre-1.243 form (identity + `defaultPromptProvider.stableSystem`,
|
|
124
|
+
* i.e. an ALREADY-assembled prompt) would now trip the migration guard (anchor-detect → pass-through +
|
|
125
|
+
* `onError(phase:"prompt-constitution")`) — this role-only form is the guard-free contract.
|
|
126
|
+
*/
|
|
45
127
|
export declare function semaIdentityProvider(): PromptProvider;
|
|
128
|
+
/**
|
|
129
|
+
* `code` 场景的提示词提供者([849] 造,[891] clay 裁定改名 autonomous→code):role 基底 = core
|
|
130
|
+
* {@link CODE_SYSTEM_PROMPT}(core 1.298 [891] 改名批正名,旧名 FULL_BODY_SYSTEM_PROMPT=恒等
|
|
131
|
+
* 别名过渡窗;CODE_AGENT persona + AUTONOMY_SELF_AUDIT + ANTI_VERBOSITY +
|
|
132
|
+
* TOOL_PARAM_JSON;[891] 血缘定论 = CC 生产编码提示词的蒸馏去牌版,底本随 CC 版本对表 cc-anchors,
|
|
133
|
+
* 非自研)——与 bench 的请求组装完全同源,引用 core 常量随版本走,绝不复制字符串(tb bench 实测:
|
|
134
|
+
* 产品默认请求与同引擎 bench 态的差距根因就在这三件 persona/自检/终验)。品牌层与
|
|
135
|
+
* {@link semaIdentityProvider} 同构:brandIdentity 开时 SEMA_IDENTITY 叠在 role 基底之上;任务自带
|
|
136
|
+
* systemPrompt 按同一优先序赢过基底(role 合成规则与 default 场景一致)。宪法由 core 1.243 在 role
|
|
137
|
+
* 层之后结构化追加——此处只产 role-only 形态(guard-free 契约,同 semaIdentityProvider 注释)。
|
|
138
|
+
* 无 systemPrompt 且无品牌时原样返回 core 常量(测试以引用比对锁 bench 同源,不做字符串快照)。
|
|
139
|
+
*/
|
|
46
140
|
export declare function codePromptProvider(brand: boolean): PromptProvider;
|
|
141
|
+
/** @deprecated [891] 改名 code——一版过渡期保留旧符号(与场景名 alias 同窗退役)。 */
|
|
47
142
|
export declare const autonomousPromptProvider: typeof codePromptProvider;
|
|
48
143
|
export declare function buildScenarios(deps: ScenarioDeps): Record<string, Scenario>;
|
|
144
|
+
/** Resolve the scenario for a request (falls back to `default`). */
|
|
49
145
|
export declare function selectScenario(scenarios: Record<string, Scenario>, name: string | undefined): Scenario;
|
|
146
|
+
/** web 渲染契约(定稿形状;knobs 现在没有=整字段省略)。 */
|
|
50
147
|
export interface ScenarioDetail {
|
|
51
148
|
name: string;
|
|
149
|
+
/** selectScenario 实际用哪份定义(center 同名 shadow 时="center")——与 centerScenarios overlay 同判定源。 */
|
|
52
150
|
source: "builtin" | "center";
|
|
151
|
+
/** 是否存在同名内建定义(被 shadow 时仍 true,web 画锁徽章+shadow 标注)。 */
|
|
53
152
|
builtin: boolean;
|
|
54
153
|
summary: string;
|
|
55
154
|
toolset: string;
|
|
56
155
|
tools: string[];
|
|
156
|
+
/** 内建=概览(不外泄提示词资产全文);center 条目=prompt 原文(本就 ≤4KB 明文在配置域)。 */
|
|
57
157
|
promptSummary: string;
|
|
58
158
|
enabled: boolean;
|
|
59
159
|
}
|
|
160
|
+
/** 内建六场景详情。default/autonomous/team 工厂对良性请求无副作用可真调(拿真实工具名单);code-review/scan/oa 是
|
|
161
|
+
* fail-loud 语义(缺 GIT_API/OA 配置/principal 即 throw)→ 探针失败落静态表兜底(表↔工厂一致性由测试锁:
|
|
162
|
+
* 测试喂 fake deps 真调工厂对账工具名)。enabled 对内建恒 true(约定②)。 */
|
|
60
163
|
export declare function builtinScenarioDetails(scenarios: Record<string, Scenario>, deps: Pick<ScenarioDeps, "brandIdentity">): Record<string, ScenarioDetail>;
|
|
164
|
+
/** center 条目详情(有效性判定与 centerScenarios 完全同款:无效条目既不进 overlay 也不进详情——
|
|
165
|
+
* 保证约定①「详情显示的来源=运行实际用的定义」永不错位)。 */
|
|
61
166
|
export declare function centerScenarioDetails(specs: CenterScenarioSpec[] | undefined, builtinNames: string[]): Record<string, ScenarioDetail>;
|
|
62
167
|
export interface CenterScenarioSpec {
|
|
63
168
|
name: string;
|
|
@@ -66,14 +171,39 @@ export interface CenterScenarioSpec {
|
|
|
66
171
|
enabled?: boolean;
|
|
67
172
|
}
|
|
68
173
|
export declare const SCENARIO_NAME_RE: RegExp;
|
|
174
|
+
/**
|
|
175
|
+
* Build the center-declared scenario overlay. Invalid specs are SKIPPED with a warning (never fail
|
|
176
|
+
* boot — same posture as skills/teams); valid ones become scenarios keyed by name, ready to be merged
|
|
177
|
+
* OVER the built-ins (center wins). Returns the overlay plus which built-in names it shadows.
|
|
178
|
+
*/
|
|
69
179
|
export declare function centerScenarios(deps: ScenarioDeps, specs: CenterScenarioSpec[] | undefined, builtinNames: string[], logger?: Logger): {
|
|
70
180
|
overlay: Record<string, Scenario>;
|
|
71
181
|
shadows: string[];
|
|
72
182
|
};
|
|
183
|
+
/**
|
|
184
|
+
* Personalization seam: merge the caller's own skills AFTER the scenario's, with
|
|
185
|
+
* SCENARIO-WINS on a name clash — the security baseline (scenario/center skills) can never be shadowed
|
|
186
|
+
* by user content. Duplicate names within the user list keep the first. Clashes are logged for audit
|
|
187
|
+
* (silent drops would make "my skill didn't fire" undebuggable). Input is already shape/size-validated
|
|
188
|
+
* by the HTTP layer (validateUserSkills); this stays pure merge policy.
|
|
189
|
+
*/
|
|
73
190
|
export declare function mergeUserSkills(scenarioSkills: SkillSpec[] | undefined, userSkills: SkillSpec[] | undefined, logger?: Logger): SkillSpec[] | undefined;
|
|
191
|
+
/** center caps view 的解析结果两键(形状钉死)。`scenario` null = 三层皆未配。 */
|
|
74
192
|
export interface ScenarioRuling {
|
|
75
193
|
scenario: string | null;
|
|
194
|
+
/** 纯场景名集合(principal/组名不上 wire);空 = 该 principal 无任何指派 = 无治理。 */
|
|
76
195
|
allowlist: string[];
|
|
77
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* resolveSpec 的执法入口(指派为默认、body.scenario 可换但限 allowlist)。返回本请求的
|
|
199
|
+
* 生效场景名(未做 unknown→default 回退——那是 resolveSpec 既有职责,保持单点)。
|
|
200
|
+
*
|
|
201
|
+
* - body.scenario 显式给出:allowlist 非空且集外 ⇒ typed 拒绝(400 `scenario_not_allowed`,附 allowlist
|
|
202
|
+
* ——机器码归 wire、人话归壳/web);集内 ⇒ 用户主动切换赢。allowlist 为空(无 ruling / 该 principal
|
|
203
|
+
* 三层皆无指派 / caps 面故障)⇒ 无治理约束,现状放行(与「null 落兜底链」同一语义:分配面未覆盖 =
|
|
204
|
+
* 不收紧,恒不比没有治理时更宽;caps 故障不把用户锁死在 default——场景切换不是权限放大面,fail-open
|
|
205
|
+
* 到现状,与 workflows 面的 fail-closed 是刻意的 posture 差异,见 runtime-caps-resolver)。
|
|
206
|
+
* - body.scenario 未给:ruling 胜者 ⇒ 指派为默认;无胜者 ⇒ defaultScenario 现状链。
|
|
207
|
+
*/
|
|
78
208
|
export declare function gateScenarioRequest(ruling: ScenarioRuling | undefined, bodyScenario: unknown, defaultScenario: string): string;
|
|
79
209
|
//# sourceMappingURL=scenarios.d.ts.map
|
|
@@ -8,29 +8,101 @@ import { createTeamTool, teamCoordinatorPrompt, getTeam, teamNames } from "./tea
|
|
|
8
8
|
import { oaTools, oaPrompt } from "./oa-tools.js";
|
|
9
9
|
import { createWebSearchBackend, webSearchConfigFromSettings } from "../plugins/web-search.js";
|
|
10
10
|
import { skillsForScenario } from "./skills.js";
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Sema product identity, prepended to the core default base for the `default` scenario when
|
|
13
|
+
* {@link ScenarioDeps.brandIdentity} is on. Honest about the substrate (the engine runs whichever model
|
|
14
|
+
* the operator configured — not Claude/Anthropic), so the agent never inherits the model's training-time
|
|
15
|
+
* "I am Claude" hallucination.
|
|
16
|
+
*
|
|
17
|
+
* Live-caught incident (a Qwen3.5 deployment self-described as "running on a DeepSeek model"):
|
|
18
|
+
* NOTHING substrate-specific may be hardcoded here — onboard is multi-provider (Qwen/GLM/Kimi/self-hosted
|
|
19
|
+
* vLLM…), so a baked maker name makes every non-DeepSeek deployment misstate its own substrate. Same for
|
|
20
|
+
* the gateway protocol (the brain stack serves Anthropic-compatible routes too — routing brain +
|
|
21
|
+
* createAnthropicBrain — so "OpenAI-compatible gateway" would be the same class of lie). Neutral wording
|
|
22
|
+
* (zero core-seam need; interpolating the model id would need a `StablePromptContext.model`
|
|
23
|
+
* seam and reads poorly for ugly preset ids). The anti-"I am Claude" design is kept — only the baked
|
|
24
|
+
* substrate facts are removed.
|
|
25
|
+
*/
|
|
26
|
+
export { SEMA_IDENTITY } from "./prompts/identity.js"; // copy moved to the bundle-data layer
|
|
12
27
|
import { SEMA_IDENTITY } from "./prompts/identity.js";
|
|
28
|
+
/**
|
|
29
|
+
* Prompt provider for the branded `default` scenario: SEMA_IDENTITY on top of the ROLE base — the
|
|
30
|
+
* task's own `body.systemPrompt`, or core's {@link DEFAULT_SYSTEM_PROMPT} when none. Core 1.243
|
|
31
|
+
* (提示词主权批) appends the constitution structurally AFTER this role layer (harness
|
|
32
|
+
* safety blocks + modes + memory guidance + the prefix-cache-safe `<user_memory>` tail), so identity
|
|
33
|
+
* cannot displace the safety blocks. The pre-1.243 form (identity + `defaultPromptProvider.stableSystem`,
|
|
34
|
+
* i.e. an ALREADY-assembled prompt) would now trip the migration guard (anchor-detect → pass-through +
|
|
35
|
+
* `onError(phase:"prompt-constitution")`) — this role-only form is the guard-free contract.
|
|
36
|
+
*/
|
|
13
37
|
export function semaIdentityProvider() {
|
|
38
|
+
// Lens-4 endgame (core 1.310, [1006]②/[1012]): the typed stableBlocks branch now carries core's OWN
|
|
39
|
+
// pass-through guard (M9-family anchor detection on identity declarations → provider-assembled,
|
|
40
|
+
// un-doubled) — the 0c3352f server-side fallback routing for the already-assembled input face is
|
|
41
|
+
// retired; the real-composer parity matrix keeps that face pinned byte-equal against the pre-M14 form.
|
|
14
42
|
return {
|
|
43
|
+
// M14 (core 1.303, 板 [968]): the branded head is a TYPED block — the stable id "sema/identity" gives
|
|
44
|
+
// it a manifest section identity + digest (the G-1 observability gap; IDENTITY-DIGEST-MIGRATION.md
|
|
45
|
+
// route B, this hook is its carrier). identity-slot semantics: the block REPLACES core/role.base at
|
|
46
|
+
// the head position, so it must carry the FULL role layer (identity + role base) — byte-identical to
|
|
47
|
+
// the previous stableSystem string. Finer identity/role digest separation is the catalog-section
|
|
48
|
+
// endgame, not this hook's job.
|
|
15
49
|
stableBlocks: (ctx) => [
|
|
16
50
|
{ id: "sema/identity", slot: "identity", text: `${SEMA_IDENTITY}\n\n${ctx.userSystemPrompt ?? DEFAULT_SYSTEM_PROMPT}` },
|
|
17
51
|
],
|
|
18
52
|
};
|
|
19
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* `code` 场景的提示词提供者([849] 造,[891] clay 裁定改名 autonomous→code):role 基底 = core
|
|
56
|
+
* {@link CODE_SYSTEM_PROMPT}(core 1.298 [891] 改名批正名,旧名 FULL_BODY_SYSTEM_PROMPT=恒等
|
|
57
|
+
* 别名过渡窗;CODE_AGENT persona + AUTONOMY_SELF_AUDIT + ANTI_VERBOSITY +
|
|
58
|
+
* TOOL_PARAM_JSON;[891] 血缘定论 = CC 生产编码提示词的蒸馏去牌版,底本随 CC 版本对表 cc-anchors,
|
|
59
|
+
* 非自研)——与 bench 的请求组装完全同源,引用 core 常量随版本走,绝不复制字符串(tb bench 实测:
|
|
60
|
+
* 产品默认请求与同引擎 bench 态的差距根因就在这三件 persona/自检/终验)。品牌层与
|
|
61
|
+
* {@link semaIdentityProvider} 同构:brandIdentity 开时 SEMA_IDENTITY 叠在 role 基底之上;任务自带
|
|
62
|
+
* systemPrompt 按同一优先序赢过基底(role 合成规则与 default 场景一致)。宪法由 core 1.243 在 role
|
|
63
|
+
* 层之后结构化追加——此处只产 role-only 形态(guard-free 契约,同 semaIdentityProvider 注释)。
|
|
64
|
+
* 无 systemPrompt 且无品牌时原样返回 core 常量(测试以引用比对锁 bench 同源,不做字符串快照)。
|
|
65
|
+
*/
|
|
20
66
|
export function codePromptProvider(brand) {
|
|
67
|
+
// [1158]/[1161]/[1162] b 案(clay 拍):provider 供给的字节 core 永不改写(provenance 卫,1.329),
|
|
68
|
+
// 所以 known-constant narrowing 够不着 provider 手里的 CODE_SYSTEM_PROMPT——simple 形的「裸底」
|
|
69
|
+
// 由 server 自己按 ctx.promptProfile 选 core 常量(CODE_AGENT_PROMPT=core 1.329 narrowing 的同一
|
|
70
|
+
// 目标常量,引用不复制,[891] 同源铁律)。classic 全链字节等价旧形;行为九段随 pack 走(平形
|
|
71
|
+
// stableSystem/stableBlocks 都不排段;server 从未用 replaceAll)。
|
|
21
72
|
const roleBase = (ctx) => ctx.userSystemPrompt ?? (ctx.promptProfile === "classic" ? CODE_SYSTEM_PROMPT : CODE_AGENT_PROMPT);
|
|
73
|
+
// Unbranded: plain role layer via the string hook — core keeps its own core/role.base section identity,
|
|
74
|
+
// and the reference-equality bench-parity tests keep comparing the exact core constant.
|
|
22
75
|
if (!brand) {
|
|
23
76
|
return { stableSystem: (ctx) => roleBase(ctx) };
|
|
24
77
|
}
|
|
78
|
+
// Branded: same M14 typed form as semaIdentityProvider (identity slot = role-layer replacement with the
|
|
79
|
+
// brand line on top; the base under the brand follows the SAME profile fork — the brand overlay is the
|
|
80
|
+
// legal divergence ([1134] 宪法二类), the base stays core-owned bytes).
|
|
25
81
|
return {
|
|
26
82
|
stableBlocks: (ctx) => [
|
|
27
83
|
{ id: "sema/identity", slot: "identity", text: `${SEMA_IDENTITY}\n\n${roleBase(ctx)}` },
|
|
28
84
|
],
|
|
29
85
|
};
|
|
30
86
|
}
|
|
87
|
+
/** @deprecated [891] 改名 code——一版过渡期保留旧符号(与场景名 alias 同窗退役)。 */
|
|
31
88
|
export const autonomousPromptProvider = codePromptProvider;
|
|
32
89
|
export function buildScenarios(deps) {
|
|
90
|
+
// The default scenario filters skills by "default" — NOT by req.scenario (which may be an unknown name
|
|
91
|
+
// that fell back here): the bundle must be a coherent "default" set, matching how main.ts resolves an
|
|
92
|
+
// unknown scenario to "default" for tools/prompt/mcp too (council finding — else default-tagged drop).
|
|
93
|
+
// 抽成具名工厂:`autonomous` 直接复用它取 bundle(工具/技能面与 default 恒等由构造保证,不靠两处
|
|
94
|
+
// 各写一份 assembleCodeTools 参数再祈祷不漂移)。
|
|
33
95
|
const defaultScenario = (req) => {
|
|
96
|
+
// gap-audit rank-1 BLOCKER: the default agent is the CC agent loop — it MUST have the
|
|
97
|
+
// full-body roster, not just nowTool. core's `assembleCodeTools` (1.161) ships TodoWrite (planning) +
|
|
98
|
+
// the subagent/Task delegation tool (runs on the sub-runner, child ⊆ parent — no escalation) + WebFetch.
|
|
99
|
+
// 🔒 WebFetch is GATED OUT on a multi-tenant deployment (REQUIRE_PRINCIPAL): allowHosts is unset = all PUBLIC,
|
|
100
|
+
// and core says a multi-tenant deployment MUST allowlist (an injected tenant model could exfil via an
|
|
101
|
+
// arbitrary public URL — the SSRF floor only blocks INTERNAL). Single-user TOC keeps it (the user's own box).
|
|
102
|
+
// WebSearch backend resolution: a per-request `body.settings.webSearch` (the user's shell settings) WINS, but
|
|
103
|
+
// ONLY on the single-user host lane (a per-request endpoint/key is a capability config — on multi-tenant a tenant
|
|
104
|
+
// could SSRF via a `searxng` URL pointed at an internal host, so multi-tenant uses ONLY the deployment-env
|
|
105
|
+
// `deps.webSearch`; design/107 axis, mirrors settings.env). Absent both ⇒ WebSearch not assembled (core ships none).
|
|
34
106
|
const reqWebSearch = deps.requirePrincipal !== true
|
|
35
107
|
? webSearchConfigFromSettings(req?.settings?.webSearch)
|
|
36
108
|
: undefined;
|
|
@@ -39,9 +111,29 @@ export function buildScenarios(deps) {
|
|
|
39
111
|
tools: [
|
|
40
112
|
nowTool(),
|
|
41
113
|
...assembleCodeTools({
|
|
114
|
+
// [1900]/[1904]:WebFetch 摘要缝——键在场才铸(负控=修前字节形)。
|
|
42
115
|
...(deps.webFetchSummarize ? { webFetch: { summarize: deps.webFetchSummarize } } : {}),
|
|
116
|
+
// CC 201 parity: CC 201 makes the two planning families MUTUALLY
|
|
117
|
+
// EXCLUSIVE — with TodoV2 (the Task trio) enabled, TodoWriteTool.isEnabled returns false and the
|
|
118
|
+
// interactive model sees ONE family (TodoWrite survives only as an SDK/non-interactive compat slot).
|
|
119
|
+
// Both-on was the CC 198 posture (live-caught cost: the model wastes a turn comparing the two tools
|
|
120
|
+
// and juggles duplicate state). taskList:true below ⇒ TodoWrite OFF.
|
|
43
121
|
todoWrite: false,
|
|
122
|
+
// core 1.215 (design/119): the structured task-list family (TaskCreate/TaskGet/TaskUpdate/TaskList —
|
|
123
|
+
// stable ids, status transitions, dependencies); core defaults it OFF, the full-body deployment opts
|
|
124
|
+
// in. Under CC 201 this family is the ONLY planning leg (see todoWrite above).
|
|
44
125
|
taskList: true,
|
|
126
|
+
// core 1.206 (design/115 P3): `background` exposes CC's `run_in_background` on the Agent tool — the
|
|
127
|
+
// child runs async under an `a*` task id (TaskOutput/TaskStop; ONE "later" completion notification;
|
|
128
|
+
// parent teardown aborts orphans). Same trust envelope as the sync path (child ⊆ parent roster, same
|
|
129
|
+
// rights) — only the scheduling is async, so no posture gate. owner/scope: core 1.365 BREAKING 升必填,
|
|
130
|
+
// 但 core 仍 ctx-first(subagent.js `ctx.taskId ?? bg.owner` / `ctx.principal ?? bg.scope`)——引擎链
|
|
131
|
+
// 每 spawn 恒带 ctx.taskId,这里的值是类型要求的兜底:scope="default" 与引擎链 `principal ?? "default"`
|
|
132
|
+
// 同词([1509] 单租户拼法);owner 哨兵在 ctx.taskId 缺席的病态窗把行锚到无人可匹配的键(fail-closed
|
|
133
|
+
// 方向,default-deny 谓词下不可读,绝不放大)。
|
|
134
|
+
// core 1.364 agentStore = durable 写半场,与 RunnerDeps.backgroundAgentStore 同实例(deps 注入)。
|
|
135
|
+
// core 1.382 checkpointStore/ensureChildSessionDurable = design/153 parked 状态机的「同车必接」
|
|
136
|
+
// 一对([1561] 提货单①②,ScenarioDeps 字段注释详述);两者任一缺席 = 净是 pre-153 行为。
|
|
45
137
|
subagent: {
|
|
46
138
|
runner: deps.subRunner,
|
|
47
139
|
background: {
|
|
@@ -52,7 +144,11 @@ export function buildScenarios(deps) {
|
|
|
52
144
|
...(deps.checkpointStore ? { checkpointStore: deps.checkpointStore } : {}),
|
|
53
145
|
...(deps.ensureChildSessionDurable ? { ensureChildSessionDurable: deps.ensureChildSessionDurable } : {}),
|
|
54
146
|
},
|
|
147
|
+
// core 1.287 extraTools seam ([795]/[802]③): per-spawn dynamic tool injection (SendUserFile
|
|
148
|
+
// reaches the delegated-child roster; product still goes through resolveToolSubset).
|
|
55
149
|
...(deps.subagentExtraTools ? { extraTools: deps.subagentExtraTools } : {}),
|
|
150
|
+
// 历史复审轴B #3(1.254):extraTools 工厂 throw 的错误 sink——core 契约「absent ⇒ dropped after
|
|
151
|
+
// the generic disclosure」= 部署日志零痕迹,只剩模型面固定 note。接 warn 让故障可观测。
|
|
56
152
|
...(deps.subagentExtraTools && deps.logger
|
|
57
153
|
? { onExtraToolsError: (err, info) => deps.logger?.warn?.("subagent_extra_tools_error", { ...info, err: err instanceof Error ? err.message : String(err) }) }
|
|
58
154
|
: {}),
|
|
@@ -61,21 +157,41 @@ export function buildScenarios(deps) {
|
|
|
61
157
|
}).filter((t) => t.name !== "WebFetch" || deps.requirePrincipal !== true),
|
|
62
158
|
],
|
|
63
159
|
skills: skillsForScenario(deps.skills, "default"),
|
|
160
|
+
// Local/TOC deployment brands the neutral default scenario as Sema (so the local engine answers "who
|
|
161
|
+
// are you" as Sema, not the model's hallucinated identity). Cloud leaves it neutral unless opted in.
|
|
64
162
|
...(deps.brandIdentity ? { promptProvider: semaIdentityProvider() } : {}),
|
|
65
163
|
};
|
|
66
164
|
};
|
|
67
165
|
return {
|
|
68
166
|
default: defaultScenario,
|
|
167
|
+
// [849]→[891] code(原名 autonomous,clay 裁定改名+persona×终验解耦):与 default 完全同 roster
|
|
168
|
+
// (full-body 工具面 + default 技能面原样复用,连 WebFetch 多租户闸/WebSearch 装配都跟着 default
|
|
169
|
+
// 工厂走),只换一轴——role 基底 = core CODE_SYSTEM_PROMPT(CC 编码 persona 蒸馏版,见
|
|
170
|
+
// codePromptProvider)。**不再定死 finalVerification**([891] 解耦:终验是无人值守运行模式旋钮,
|
|
171
|
+
// caller 显式声明,交互态不多烧终验轮)。这是 [891] 起的出厂缺省场景(config DEFAULT_SCENARIO
|
|
172
|
+
// 缺省 "code")——编码产品出厂态对标 CC 出厂态;通用域中性 persona 的 default 保留为显式可选。
|
|
173
|
+
// 刻意走内建、不走 center overlay:overlay 已无 prompt 通道([1053] ScenarioEntry.prompt 直删,场景级提示词=center prompts binding)。
|
|
69
174
|
code: (req, principal) => ({
|
|
70
175
|
...defaultScenario(req, principal),
|
|
71
176
|
promptProvider: codePromptProvider(deps.brandIdentity === true),
|
|
72
177
|
}),
|
|
178
|
+
// [891] 兼容 alias(一版过渡,deprecation warn 在 main.ts 解析处):旧语义逐字保留 —— code persona
|
|
179
|
+
// + finalVerification 场景层定死 true(存量 TB harness/部署传 "autonomous" 的行为一根毛不变;
|
|
180
|
+
// 新调用方要终验请显式传 body.finalVerification)。
|
|
73
181
|
autonomous: (req, principal) => ({
|
|
74
182
|
...defaultScenario(req, principal),
|
|
75
183
|
promptProvider: codePromptProvider(deps.brandIdentity === true),
|
|
76
184
|
finalVerification: true,
|
|
77
185
|
}),
|
|
78
186
|
"code-review": (req) => codeReview(deps, req),
|
|
187
|
+
// Neutral repo-readonly scenario (OA ask): the SAME clone-free read-only repo tools as code-review
|
|
188
|
+
// (repo_tree / repo_read_file / repo_pull_diff over GIT_API_TOKEN) with NO promptProvider — the
|
|
189
|
+
// objective and the center-distributed skills own the output contract. The reviewer framing was
|
|
190
|
+
// never a security control (the boundary is the token's scope + the read-only tool set); it only
|
|
191
|
+
// fought skill-driven outputs (live: oa-repo-scan loaded but the lead still wrote a review).
|
|
192
|
+
// Deliberately NOT the alternative "let a scenario-targeted skill override promptProvider": that
|
|
193
|
+
// would let runtime-distributed content rewrite the deployment-pinned system prompt and break the
|
|
194
|
+
// stablePrompt STABLE→VARIABLE prefix-cache discipline (design/12/17).
|
|
79
195
|
scan: (req) => {
|
|
80
196
|
if (!deps.repoClient)
|
|
81
197
|
throw new HttpError(501, "scan scenario needs GIT_API_BASEURL configured");
|
|
@@ -90,8 +206,11 @@ export function buildScenarios(deps) {
|
|
|
90
206
|
oa: (req, principal) => {
|
|
91
207
|
if (!deps.oaApiBaseUrl || !deps.oaServiceToken)
|
|
92
208
|
throw new HttpError(501, "oa scenario needs OA_API_BASEURL + OA_SERVICE_TOKEN configured");
|
|
209
|
+
// OA enforces the END USER's RBAC from the forwarded principal — without one, every OA call would
|
|
210
|
+
// run unattributed. Refuse rather than silently send a null principal.
|
|
93
211
|
if (!principal)
|
|
94
212
|
throw new HttpError(401, "oa scenario requires an authenticated principal (set REQUIRE_PRINCIPAL + x-agent-principal)");
|
|
213
|
+
// 写权限的"开 issue"工具仅当配置了 OA_ISSUE_* 时注入;token/repo 固定,模型只填 title/body。
|
|
95
214
|
const issueTool = deps.oaIssue
|
|
96
215
|
? [createGiteaIssueTool({ ...deps.oaIssue, name: "open_gitea_issue", description: "把用户的 bug/需求开成 Gitea issue 报给老板。只填 title(简洁)/body(现象、影响、复现/建议)。仓库与标签由部署固定。" })]
|
|
97
216
|
: [];
|
|
@@ -101,9 +220,13 @@ export function buildScenarios(deps) {
|
|
|
101
220
|
promptProvider: oaPrompt,
|
|
102
221
|
};
|
|
103
222
|
},
|
|
223
|
+
// Multi-agent team: pick a template, the consumer (OA) injects business context, we run it.
|
|
224
|
+
// Templates resolve from the live registry (`getTeam`) = BUILTIN_TEAMS overridden/extended by the
|
|
225
|
+
// sema registry at runtime (applyEffective → registerTeams), so a team is config-driven; built-ins
|
|
226
|
+
// are the fallback when the center supplies none.
|
|
104
227
|
team: (req) => {
|
|
105
228
|
const name = typeof req.team === "string" ? req.team : "default";
|
|
106
|
-
const template = getTeam(name);
|
|
229
|
+
const template = getTeam(name); // built-ins, overridden/extended by the sema registry at runtime
|
|
107
230
|
if (!template) {
|
|
108
231
|
throw new HttpError(404, `unknown team "${name}" (available: ${teamNames().join(", ")})`);
|
|
109
232
|
}
|
|
@@ -117,16 +240,20 @@ export function buildScenarios(deps) {
|
|
|
117
240
|
},
|
|
118
241
|
};
|
|
119
242
|
}
|
|
243
|
+
/** Resolve the scenario for a request (falls back to `default`). */
|
|
120
244
|
export function selectScenario(scenarios, name) {
|
|
121
245
|
return (name && scenarios[name]) || scenarios.default;
|
|
122
246
|
}
|
|
247
|
+
/** 内建六场景详情。default/autonomous/team 工厂对良性请求无副作用可真调(拿真实工具名单);code-review/scan/oa 是
|
|
248
|
+
* fail-loud 语义(缺 GIT_API/OA 配置/principal 即 throw)→ 探针失败落静态表兜底(表↔工厂一致性由测试锁:
|
|
249
|
+
* 测试喂 fake deps 真调工厂对账工具名)。enabled 对内建恒 true(约定②)。 */
|
|
123
250
|
export function builtinScenarioDetails(scenarios, deps) {
|
|
124
251
|
const probe = (name, req, principal, fallback) => {
|
|
125
252
|
try {
|
|
126
253
|
return (scenarios[name]?.(req, principal)?.tools ?? []).map((t) => t.name);
|
|
127
254
|
}
|
|
128
255
|
catch {
|
|
129
|
-
return fallback;
|
|
256
|
+
return fallback; // 工厂 fail-loud(部署未配该场景的后端)→ 静态名单(web 仍能展示工具面选项)
|
|
130
257
|
}
|
|
131
258
|
};
|
|
132
259
|
const REPO_TOOLS = ["repo_tree", "repo_read_file", "repo_pull_diff", "Now"];
|
|
@@ -145,6 +272,8 @@ export function builtinScenarioDetails(scenarios, deps) {
|
|
|
145
272
|
team: mk("team", "多智能体团队圆桌(模板成员+synthesizer,模板可由 registry 配置)", "team", probe("team", {}, undefined, ["run_team"]), "团队协调者提示词(圆桌纪律+合成流程)"),
|
|
146
273
|
};
|
|
147
274
|
}
|
|
275
|
+
/** center 条目详情(有效性判定与 centerScenarios 完全同款:无效条目既不进 overlay 也不进详情——
|
|
276
|
+
* 保证约定①「详情显示的来源=运行实际用的定义」永不错位)。 */
|
|
148
277
|
export function centerScenarioDetails(specs, builtinNames) {
|
|
149
278
|
const out = {};
|
|
150
279
|
for (const spec of specs ?? []) {
|
|
@@ -158,9 +287,11 @@ export function centerScenarioDetails(specs, builtinNames) {
|
|
|
158
287
|
name: spec.name,
|
|
159
288
|
source: "center",
|
|
160
289
|
builtin: builtinNames.includes(spec.name),
|
|
161
|
-
summary: "",
|
|
290
|
+
summary: "", // center spec 无 notes 字段(回落空串;registry 侧加 notes 后在此透传)
|
|
162
291
|
toolset: spec.toolset,
|
|
163
292
|
tools: spec.toolset === "repo-readonly" ? ["repo_tree", "repo_read_file", "repo_pull_diff", "Now"] : ["Now"],
|
|
293
|
+
// [1053] ScenarioEntry.prompt 已删(scenario 级提示词=center prompts binding 单入口)——center 条目
|
|
294
|
+
// 恒空串;字段本身保留(builtin 条目仍有真值,wire 形不变)。
|
|
164
295
|
promptSummary: "",
|
|
165
296
|
enabled: true,
|
|
166
297
|
};
|
|
@@ -182,6 +313,12 @@ const TOOLSETS = {
|
|
|
182
313
|
},
|
|
183
314
|
};
|
|
184
315
|
export const SCENARIO_NAME_RE = /^[a-z][a-z0-9-]{1,31}$/;
|
|
316
|
+
// ([1053] registry-core 0.10.15:SCENARIO_PROMPT_MAX 随 ScenarioEntry.prompt 一并退役)
|
|
317
|
+
/**
|
|
318
|
+
* Build the center-declared scenario overlay. Invalid specs are SKIPPED with a warning (never fail
|
|
319
|
+
* boot — same posture as skills/teams); valid ones become scenarios keyed by name, ready to be merged
|
|
320
|
+
* OVER the built-ins (center wins). Returns the overlay plus which built-in names it shadows.
|
|
321
|
+
*/
|
|
185
322
|
export function centerScenarios(deps, specs, builtinNames, logger) {
|
|
186
323
|
const overlay = {};
|
|
187
324
|
const shadows = [];
|
|
@@ -197,6 +334,9 @@ export function centerScenarios(deps, specs, builtinNames, logger) {
|
|
|
197
334
|
logger?.warn("sema_registry_scenario_invalid", { name: spec.name, reason: `unknown toolset "${String(spec.toolset)}" (have: ${Object.keys(TOOLSETS).join(", ")})` });
|
|
198
335
|
continue;
|
|
199
336
|
}
|
|
337
|
+
// [1053] registry-core 0.10.15:ScenarioEntry.prompt 直删(clay 亲裁)——center 场景的提示词通道收敛为
|
|
338
|
+
// center prompts binding(scenario 维,[1050]①a/[1051]③a);overlay 只组装工具面+技能面,提示词由投影腿
|
|
339
|
+
// (effective 声明数组→core stableBlocks,[1054]③ 已认领)在 binding 落地后统一承载。
|
|
200
340
|
const name = spec.name;
|
|
201
341
|
overlay[name] = (req) => ({
|
|
202
342
|
tools: toolset.build(deps, req),
|
|
@@ -217,15 +357,25 @@ function codeReview(deps, req) {
|
|
|
217
357
|
const repoTools = repoToolsFor(deps.repoClient, coords);
|
|
218
358
|
const skills = skillsForScenario(deps.skills, "code-review");
|
|
219
359
|
const objective = typeof req.objective === "string" ? req.objective : "Review this repository.";
|
|
360
|
+
// Tiering: `council: true` runs the multi-lens council (L1 parallel lenses + L3 arbiter) — for
|
|
361
|
+
// high-value/whole-repo review (~15× tokens). Default = the lead reviews the in-scope files DIRECTLY
|
|
362
|
+
// (cheap, reliable, finishes fast). A live run showed the model self-orchestrates unreliably, so for
|
|
363
|
+
// review (a KNOWN decomposition) the subagent fan-out is CODE-driven here, not left to the model
|
|
364
|
+
// (deterministic + cheaper + cacheable; see design/35). For OPEN-ENDED tasks where the decomposition
|
|
365
|
+
// isn't known, core's `createSubagentTool` (model-driven self-delegation, with maxDepth / isolated
|
|
366
|
+
// context / compressed-report guardrails) is the right tool — wire it in a dedicated scenario then.
|
|
220
367
|
if (req.council === true) {
|
|
221
|
-
const rounds = clampRounds(req.rounds);
|
|
368
|
+
const rounds = clampRounds(req.rounds); // finite-guarded (NaN/±Inf → undefined → council default 1)
|
|
222
369
|
return {
|
|
223
370
|
tools: [
|
|
224
371
|
createCouncilTool(deps.subRunner, repoTools, objective, {
|
|
225
372
|
metrics: deps.metrics,
|
|
226
373
|
logger: deps.logger,
|
|
227
|
-
debate: req.debate === true,
|
|
374
|
+
debate: req.debate === true, // L1+L2+L3 (peer debate) vs L1+L3
|
|
375
|
+
// OA cost/coverage dial: an optional structured lens COUNT (clamped to [1,6] + NaN-guarded in pickLenses;
|
|
376
|
+
// absent = all 6 → zero regression). Per-request, no restart — orthogonal to the lens MODEL (startup env).
|
|
228
377
|
...(typeof req.lenses === "number" ? { lensCount: req.lenses } : {}),
|
|
378
|
+
// Caller-settable debate rounds (finite, clamped [1,3]; absent/NaN = default 1). Only when debate=true.
|
|
229
379
|
...(rounds !== undefined ? { rounds } : {}),
|
|
230
380
|
}),
|
|
231
381
|
],
|
|
@@ -237,12 +387,24 @@ function codeReview(deps, req) {
|
|
|
237
387
|
}
|
|
238
388
|
const reviewBody = "Produce ONE prioritized review: a short summary, then findings grouped by severity " +
|
|
239
389
|
"(blocker / major / minor), each with `path:line`, the problem, and a concrete fix. Cite real code — never invent files or symbols.";
|
|
390
|
+
// Each provider supplies ONLY its stable base; `stablePrompt` enforces STABLE→VARIABLE ordering
|
|
391
|
+
// (base, then userSystemPrompt, then per-user memoryBlock) so the prefix-cache discipline can't be
|
|
392
|
+
// got wrong by hand (design/12, design/17).
|
|
393
|
+
/** Default: the lead reads the in-scope files and reviews them directly. */
|
|
240
394
|
const directReviewerPrompt = stablePrompt("You are a senior code reviewer. Call repo_tree to map the repository, then repo_read_file to read " +
|
|
241
395
|
"the files in scope, then review them yourself. " +
|
|
242
396
|
reviewBody);
|
|
397
|
+
/** Council mode: the lead just runs the (code-driven) council tool and returns its result verbatim. */
|
|
243
398
|
const coordinatorPrompt = stablePrompt("You coordinate a code-review council. Call `run_council` exactly once (no arguments). When it " +
|
|
244
399
|
"returns the arbitrated review, output that review as your final answer VERBATIM — do not " +
|
|
245
400
|
"summarize, shorten, or rewrite it.");
|
|
401
|
+
/**
|
|
402
|
+
* Personalization seam: merge the caller's own skills AFTER the scenario's, with
|
|
403
|
+
* SCENARIO-WINS on a name clash — the security baseline (scenario/center skills) can never be shadowed
|
|
404
|
+
* by user content. Duplicate names within the user list keep the first. Clashes are logged for audit
|
|
405
|
+
* (silent drops would make "my skill didn't fire" undebuggable). Input is already shape/size-validated
|
|
406
|
+
* by the HTTP layer (validateUserSkills); this stays pure merge policy.
|
|
407
|
+
*/
|
|
246
408
|
export function mergeUserSkills(scenarioSkills, userSkills, logger) {
|
|
247
409
|
if (!userSkills || userSkills.length === 0)
|
|
248
410
|
return scenarioSkills;
|
|
@@ -254,13 +416,24 @@ export function mergeUserSkills(scenarioSkills, userSkills, logger) {
|
|
|
254
416
|
dropped.push(s.name);
|
|
255
417
|
continue;
|
|
256
418
|
}
|
|
257
|
-
reserved.add(s.name);
|
|
419
|
+
reserved.add(s.name); // also dedupes within the user list itself (first wins)
|
|
258
420
|
out.push(s);
|
|
259
421
|
}
|
|
260
422
|
if (dropped.length > 0)
|
|
261
423
|
logger?.warn("user_skills_dropped", { reason: "name reserved by scenario (or duplicate)", names: dropped });
|
|
262
424
|
return out;
|
|
263
425
|
}
|
|
426
|
+
/**
|
|
427
|
+
* resolveSpec 的执法入口(指派为默认、body.scenario 可换但限 allowlist)。返回本请求的
|
|
428
|
+
* 生效场景名(未做 unknown→default 回退——那是 resolveSpec 既有职责,保持单点)。
|
|
429
|
+
*
|
|
430
|
+
* - body.scenario 显式给出:allowlist 非空且集外 ⇒ typed 拒绝(400 `scenario_not_allowed`,附 allowlist
|
|
431
|
+
* ——机器码归 wire、人话归壳/web);集内 ⇒ 用户主动切换赢。allowlist 为空(无 ruling / 该 principal
|
|
432
|
+
* 三层皆无指派 / caps 面故障)⇒ 无治理约束,现状放行(与「null 落兜底链」同一语义:分配面未覆盖 =
|
|
433
|
+
* 不收紧,恒不比没有治理时更宽;caps 故障不把用户锁死在 default——场景切换不是权限放大面,fail-open
|
|
434
|
+
* 到现状,与 workflows 面的 fail-closed 是刻意的 posture 差异,见 runtime-caps-resolver)。
|
|
435
|
+
* - body.scenario 未给:ruling 胜者 ⇒ 指派为默认;无胜者 ⇒ defaultScenario 现状链。
|
|
436
|
+
*/
|
|
264
437
|
export function gateScenarioRequest(ruling, bodyScenario, defaultScenario) {
|
|
265
438
|
if (typeof bodyScenario === "string") {
|
|
266
439
|
const allowed = ruling?.allowlist ?? [];
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import type { ToolSpec } from "@sema-agent/core";
|
|
2
2
|
import { type SandboxImageResolver } from "../per-task-image.js";
|
|
3
3
|
import type { ImageViewer, ImageIndexEntry, ImageListFilter } from "../plugins/store-contracts.js";
|
|
4
|
+
/** The catalog slice the tool needs: fail-closed resolution + the viewer-scoped published listing. */
|
|
4
5
|
export interface EnvironmentCatalog extends SandboxImageResolver {
|
|
5
6
|
list(filter: ImageListFilter): Promise<{
|
|
6
7
|
entries: ImageIndexEntry[];
|
|
7
8
|
nextCursor: string | null;
|
|
8
9
|
}>;
|
|
9
10
|
}
|
|
11
|
+
/** Session-keyed selected PROFILE (intent). Mirrors PerTaskImageRegistry's bounded-eviction shape, but holds
|
|
12
|
+
* the profile string so every subsequent task re-resolves fail-closed (re-admit discipline). In-memory —
|
|
13
|
+
* honest v1 boundary: a worker restart drops the selection (the model can re-select; nothing fails closed
|
|
14
|
+
* the wrong way, the session just falls back to the worker default image). */
|
|
10
15
|
export declare class SessionEnvironmentSelection {
|
|
11
16
|
private readonly maxEntries;
|
|
12
17
|
private readonly map;
|
|
@@ -17,6 +22,8 @@ export declare class SessionEnvironmentSelection {
|
|
|
17
22
|
export declare function selectEnvironmentTool(deps: {
|
|
18
23
|
catalog: EnvironmentCatalog;
|
|
19
24
|
selection: SessionEnvironmentSelection;
|
|
25
|
+
/** Trusted viewer scope derived from the AUTH channel at spec-prep (never from tool args/ctx besides the
|
|
26
|
+
* read-only ctx.principal the Runner threads) — built per-execute so operator/tenant scoping stays live. */
|
|
20
27
|
viewerFor: (principal: string | undefined) => ImageViewer;
|
|
21
28
|
}): ToolSpec;
|
|
22
29
|
//# sourceMappingURL=select-environment-tool.d.ts.map
|