@sema-agent/server 1.323.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/approval-hmac.d.ts +40 -0
- package/dist/approval-hmac.js +67 -0
- package/dist/approval.d.ts +31 -0
- package/dist/approval.js +72 -4
- package/dist/audit.d.ts +26 -0
- package/dist/audit.js +40 -1
- package/dist/auth-bridge.d.ts +10 -0
- package/dist/auth-bridge.js +47 -4
- package/dist/auth-keys.d.ts +19 -0
- package/dist/auth-keys.js +13 -0
- package/dist/bake-runner/main.d.ts +5 -0
- package/dist/bake-runner/main.js +43 -4
- package/dist/bake-runner/protocol.d.ts +57 -0
- package/dist/bake-runner/protocol.js +58 -3
- package/dist/bake-runner/runner.d.ts +54 -0
- package/dist/bake-runner/runner.js +87 -5
- package/dist/bench/l8/artifact.d.ts +63 -0
- package/dist/bench/l8/artifact.js +61 -2
- package/dist/bench/l8/escape.d.ts +36 -0
- package/dist/bench/l8/escape.js +25 -0
- package/dist/bench/l8/index.d.ts +14 -0
- package/dist/bench/l8/index.js +14 -0
- package/dist/bench/l8/probes.d.ts +74 -0
- package/dist/bench/l8/probes.js +60 -0
- package/dist/bench/l8/run-probes.d.ts +43 -0
- package/dist/bench/l8/run-probes.js +45 -2
- package/dist/bench/s1/arms.d.ts +126 -0
- package/dist/bench/s1/arms.js +188 -13
- package/dist/bench/s1/live-deps.d.ts +66 -0
- package/dist/bench/s1/live-deps.js +249 -11
- package/dist/bench/s1/oracle.d.ts +49 -0
- package/dist/bench/s1/oracle.js +36 -1
- package/dist/bench/s1/repair-oracle-adapter.d.ts +33 -0
- package/dist/bench/s1/repair-oracle-adapter.js +30 -0
- package/dist/bench/s1/reviewer.d.ts +38 -0
- package/dist/bench/s1/reviewer.js +34 -0
- package/dist/bench/s1/row.d.ts +77 -0
- package/dist/bench/s1/row.js +62 -0
- package/dist/bench/s1/run-firm.d.ts +47 -0
- package/dist/bench/s1/run-firm.js +70 -4
- package/dist/bench/s1/runner-ctx.d.ts +71 -0
- package/dist/bench/s1/runner-ctx.js +36 -0
- package/dist/bench/s1/tasks.d.ts +108 -0
- package/dist/bench/s1/tasks.js +115 -0
- package/dist/boot-reclaim.d.ts +19 -0
- package/dist/boot-reclaim.js +20 -0
- package/dist/brain.d.ts +25 -0
- package/dist/brain.js +61 -1
- package/dist/budget.d.ts +66 -0
- package/dist/budget.js +128 -4
- package/dist/capabilities/builtin-tools.d.ts +3 -0
- package/dist/capabilities/builtin-tools.js +3 -0
- package/dist/capabilities/center-plugins.d.ts +17 -1
- package/dist/capabilities/center-plugins.js +45 -4
- package/dist/capabilities/center-prompts.d.ts +46 -0
- package/dist/capabilities/center-prompts.js +57 -3
- package/dist/capabilities/code-review-council.d.ts +28 -0
- package/dist/capabilities/code-review-council.js +40 -7
- package/dist/capabilities/collab-wire.d.ts +2 -0
- package/dist/capabilities/collab-workflows.d.ts +7 -0
- package/dist/capabilities/collab-workflows.js +44 -1
- package/dist/capabilities/oa-tools.d.ts +6 -0
- package/dist/capabilities/oa-tools.js +10 -0
- package/dist/capabilities/prompt.d.ts +14 -0
- package/dist/capabilities/prompt.js +14 -0
- package/dist/capabilities/prompts/code-review.d.ts +14 -0
- package/dist/capabilities/prompts/code-review.js +14 -0
- package/dist/capabilities/prompts/identity.d.ts +6 -0
- package/dist/capabilities/prompts/identity.js +6 -0
- package/dist/capabilities/prompts/team.d.ts +4 -0
- package/dist/capabilities/prompts/team.js +4 -0
- package/dist/capabilities/repo-tools.d.ts +11 -0
- package/dist/capabilities/repo-tools.js +8 -0
- package/dist/capabilities/sandbox-file-send.d.ts +95 -0
- package/dist/capabilities/sandbox-file-send.js +91 -3
- package/dist/capabilities/scenarios.d.ts +130 -0
- package/dist/capabilities/scenarios.js +180 -7
- package/dist/capabilities/select-environment-tool.d.ts +7 -0
- package/dist/capabilities/select-environment-tool.js +30 -0
- package/dist/capabilities/send-user-file-tool.d.ts +33 -0
- package/dist/capabilities/send-user-file-tool.js +65 -1
- package/dist/capabilities/skills.d.ts +29 -0
- package/dist/capabilities/skills.js +13 -2
- package/dist/capabilities/team.d.ts +22 -0
- package/dist/capabilities/team.js +22 -2
- package/dist/capabilities/tool-defer.d.ts +26 -0
- package/dist/capabilities/tool-defer.js +3 -0
- package/dist/config-center/apply-effective.d.ts +65 -0
- package/dist/config-center/apply-effective.js +204 -12
- package/dist/config-center/http-client.d.ts +34 -0
- package/dist/config-center/http-client.js +68 -0
- package/dist/config-center/restart-signal.d.ts +22 -0
- package/dist/config-center/restart-signal.js +39 -0
- package/dist/config-center/skills-mcp.d.ts +20 -1
- package/dist/config-center/skills-mcp.js +42 -7
- package/dist/config-center/types.d.ts +92 -1
- package/dist/config-lkg.d.ts +12 -0
- package/dist/config-lkg.js +41 -0
- package/dist/config-provider.d.ts +78 -0
- package/dist/config-provider.js +165 -2
- package/dist/config-types.d.ts +546 -0
- package/dist/config.d.ts +64 -0
- package/dist/config.js +455 -60
- package/dist/degenerate-instrument.d.ts +38 -0
- package/dist/degenerate-instrument.js +55 -3
- package/dist/elicitation.d.ts +39 -0
- package/dist/elicitation.js +87 -3
- package/dist/env-facts.d.ts +61 -0
- package/dist/env-facts.js +73 -7
- package/dist/fleet/fleet-bus.d.ts +185 -0
- package/dist/fleet/fleet-bus.js +333 -27
- package/dist/fleet/subagent-tail-bus.d.ts +11 -0
- package/dist/fleet/subagent-tail-bus.js +33 -2
- package/dist/fleet-client.d.ts +38 -0
- package/dist/fleet-client.js +44 -9
- package/dist/fleet-lease.d.ts +46 -0
- package/dist/fleet-lease.js +73 -5
- package/dist/hooks/branch-transcript.d.ts +8 -0
- package/dist/hooks/branch-transcript.js +33 -0
- package/dist/hooks/cc-stop-prompt.d.ts +42 -0
- package/dist/hooks/cc-stop-prompt.js +43 -1
- package/dist/hooks/hook-llm.d.ts +15 -0
- package/dist/hooks/hook-llm.js +47 -0
- package/dist/hooks/hook-runner.d.ts +89 -0
- package/dist/hooks/hook-runner.js +327 -18
- package/dist/http/idempotency.d.ts +31 -0
- package/dist/http/idempotency.js +34 -0
- package/dist/http/principal-gate.d.ts +17 -0
- package/dist/http/principal-gate.js +35 -3
- package/dist/http/route-ctx.d.ts +36 -0
- package/dist/http/routes/approvals-assistant.d.ts +25 -0
- package/dist/http/routes/approvals-assistant.js +253 -23
- package/dist/http/routes/attachments.js +22 -4
- package/dist/http/routes/capabilities.d.ts +7 -0
- package/dist/http/routes/capabilities.js +202 -1
- package/dist/http/routes/fleet.d.ts +6 -0
- package/dist/http/routes/fleet.js +94 -5
- package/dist/http/routes/images.d.ts +17 -0
- package/dist/http/routes/images.js +222 -14
- package/dist/http/routes/leader.d.ts +7 -0
- package/dist/http/routes/leader.js +10 -0
- package/dist/http/routes/memory-policy.d.ts +6 -0
- package/dist/http/routes/memory-policy.js +38 -6
- package/dist/http/routes/notify-wake.d.ts +10 -0
- package/dist/http/routes/notify-wake.js +19 -3
- package/dist/http/routes/observability.d.ts +6 -0
- package/dist/http/routes/observability.js +19 -2
- package/dist/http/routes/runs.d.ts +15 -0
- package/dist/http/routes/runs.js +464 -41
- package/dist/http/routes/session-sync.d.ts +15 -0
- package/dist/http/routes/session-sync.js +229 -19
- package/dist/http/routes/sessions-list.d.ts +6 -0
- package/dist/http/routes/sessions-list.js +35 -4
- package/dist/http/routes/sessions.d.ts +14 -0
- package/dist/http/routes/sessions.js +176 -31
- package/dist/http/routes/side-query.d.ts +8 -0
- package/dist/http/routes/side-query.js +26 -1
- package/dist/http/routes/tasks.d.ts +18 -0
- package/dist/http/routes/tasks.js +501 -38
- package/dist/http/routes/trace-usage.d.ts +10 -0
- package/dist/http/routes/trace-usage.js +66 -14
- package/dist/http/routes/workflows.d.ts +12 -0
- package/dist/http/routes/workflows.js +180 -19
- package/dist/http/run-meta.d.ts +11 -0
- package/dist/http/run-meta.js +6 -0
- package/dist/http/send.d.ts +19 -0
- package/dist/http/send.js +11 -0
- package/dist/http/server.d.ts +255 -0
- package/dist/http/server.js +921 -75
- package/dist/http/sse-log.d.ts +15 -0
- package/dist/http/sse-log.js +16 -0
- package/dist/http/tar.d.ts +9 -0
- package/dist/http/tar.js +21 -5
- package/dist/http/wire-gate.d.ts +9 -0
- package/dist/http/wire-gate.js +9 -0
- package/dist/http/wire-types.d.ts +187 -0
- package/dist/http/workspace-content.d.ts +8 -0
- package/dist/http/workspace-content.js +10 -0
- package/dist/images/bake-validate.d.ts +63 -0
- package/dist/images/bake-validate.js +71 -1
- package/dist/images/manifest.d.ts +19 -0
- package/dist/images/manifest.js +6 -1
- package/dist/index.d.ts +1 -5
- package/dist/index.js +10 -5
- package/dist/key-resolver.d.ts +23 -0
- package/dist/key-resolver.js +27 -2
- package/dist/leader/diffout.d.ts +23 -0
- package/dist/leader/diffout.js +8 -1
- package/dist/leader/diffup.d.ts +32 -0
- package/dist/leader/diffup.js +43 -0
- package/dist/leader/endpoint.d.ts +20 -0
- package/dist/leader/endpoint.js +25 -2
- package/dist/leader/fanout.d.ts +60 -0
- package/dist/leader/fanout.js +29 -3
- package/dist/leader/grader-env-factory.d.ts +74 -0
- package/dist/leader/grader-env-factory.js +62 -3
- package/dist/leader/leader.d.ts +97 -0
- package/dist/leader/leader.js +151 -4
- package/dist/leader/merge.d.ts +94 -0
- package/dist/leader/merge.js +112 -9
- package/dist/leader/planner.d.ts +52 -0
- package/dist/leader/planner.js +47 -3
- package/dist/leader/repair-oracle.d.ts +61 -0
- package/dist/leader/repair-oracle.js +59 -1
- package/dist/leader/repair-wire.d.ts +78 -0
- package/dist/leader/repair-wire.js +79 -2
- package/dist/leader/wire.d.ts +79 -0
- package/dist/leader/wire.js +255 -8
- package/dist/lsp/e2b-bridge.d.ts +16 -0
- package/dist/lsp/e2b-bridge.js +32 -4
- package/dist/lsp/e2b-manager.d.ts +10 -0
- package/dist/lsp/e2b-manager.js +18 -2
- package/dist/lsp/lsp-frames.d.ts +12 -0
- package/dist/lsp/lsp-frames.js +12 -0
- package/dist/lsp/manager.d.ts +12 -0
- package/dist/lsp/manager.js +35 -2
- package/dist/lsp/types.d.ts +10 -0
- package/dist/lsp/ws-transport.d.ts +12 -0
- package/dist/lsp/ws-transport.js +53 -5
- package/dist/lsp-evict.d.ts +14 -0
- package/dist/lsp-evict.js +15 -1
- package/dist/main.js +2132 -96
- package/dist/memory-export.d.ts +1 -0
- package/dist/memory-export.js +4 -0
- package/dist/memory-scope.d.ts +49 -0
- package/dist/memory-scope.js +87 -4
- package/dist/memory-sync-client.d.ts +24 -0
- package/dist/memory-sync-client.js +41 -2
- package/dist/memory-sync.d.ts +23 -0
- package/dist/memory-sync.js +70 -1
- package/dist/model-select.d.ts +39 -0
- package/dist/model-select.js +42 -1
- package/dist/observability/cost-quota.d.ts +20 -0
- package/dist/observability/cost-quota.js +4 -0
- package/dist/observability/cost-taxonomy.d.ts +45 -0
- package/dist/observability/cost-taxonomy.js +34 -0
- package/dist/observability/logger.d.ts +1 -0
- package/dist/observability/logger.js +6 -0
- package/dist/observability/metrics.d.ts +13 -0
- package/dist/observability/metrics.js +63 -0
- package/dist/observability/otel-exporter.d.ts +9 -0
- package/dist/observability/otel-exporter.js +11 -3
- package/dist/observability/principal-context.d.ts +9 -0
- package/dist/observability/principal-context.js +9 -0
- package/dist/observability/prompt-manifest.d.ts +37 -0
- package/dist/observability/prompt-manifest.js +35 -1
- package/dist/observability/rate-limit.d.ts +10 -0
- package/dist/observability/rate-limit.js +1 -0
- package/dist/observability/tool-trace.d.ts +24 -0
- package/dist/observability/tool-trace.js +41 -1
- package/dist/orchestration/hardened-vm-runner.d.ts +107 -0
- package/dist/orchestration/hardened-vm-runner.js +119 -4
- package/dist/orchestration/hardened-vm-worker-runner.d.ts +14 -0
- package/dist/orchestration/hardened-vm-worker-runner.js +26 -1
- package/dist/orchestration/hardened-vm-worker.js +27 -0
- package/dist/orchestration/subagent-steer.d.ts +44 -0
- package/dist/orchestration/subagent-steer.js +45 -1
- package/dist/orchestration/workflow-agent-steer.d.ts +54 -0
- package/dist/orchestration/workflow-agent-steer.js +80 -1
- package/dist/orchestration/workflow-completion-inbox.d.ts +189 -2
- package/dist/orchestration/workflow-completion-inbox.js +283 -32
- package/dist/orchestration/workflow-notify-journal.d.ts +132 -1
- package/dist/orchestration/workflow-notify-journal.js +187 -13
- package/dist/parked-decide.d.ts +61 -0
- package/dist/parked-decide.js +58 -1
- package/dist/per-task-image.d.ts +54 -0
- package/dist/per-task-image.js +41 -0
- package/dist/plan-cache-probe.d.ts +35 -0
- package/dist/plan-cache-probe.js +18 -3
- package/dist/plugins/approval-exemption-store.d.ts +7 -0
- package/dist/plugins/approval-exemption-store.js +28 -2
- package/dist/plugins/approval-store-sql.d.ts +64 -0
- package/dist/plugins/approval-store-sql.js +32 -0
- package/dist/plugins/background-agent-store-sql.d.ts +55 -0
- package/dist/plugins/background-agent-store-sql.js +91 -4
- package/dist/plugins/background-shell-support.d.ts +98 -0
- package/dist/plugins/background-shell-support.js +117 -13
- package/dist/plugins/blob-backend.d.ts +104 -0
- package/dist/plugins/blob-backend.js +163 -6
- package/dist/plugins/breaker-state-sql.d.ts +65 -1
- package/dist/plugins/breaker-state-sql.js +46 -8
- package/dist/plugins/caching-session-store.d.ts +42 -0
- package/dist/plugins/caching-session-store.js +63 -3
- package/dist/plugins/checkpoint-store-sql.d.ts +179 -0
- package/dist/plugins/checkpoint-store-sql.js +239 -11
- package/dist/plugins/file-outcome-sink.d.ts +4 -0
- package/dist/plugins/file-outcome-sink.js +9 -0
- package/dist/plugins/file-resume-anchor-store.d.ts +20 -0
- package/dist/plugins/file-resume-anchor-store.js +43 -4
- package/dist/plugins/file-run-store.d.ts +90 -0
- package/dist/plugins/file-run-store.js +145 -13
- package/dist/plugins/file-snapshot-store-sql.d.ts +133 -1
- package/dist/plugins/file-snapshot-store-sql.js +178 -10
- package/dist/plugins/file-workflow-journal-store.d.ts +10 -0
- package/dist/plugins/file-workflow-journal-store.js +10 -0
- package/dist/plugins/fork-routing-session-store.d.ts +47 -0
- package/dist/plugins/fork-routing-session-store.js +51 -3
- package/dist/plugins/host-platform.d.ts +69 -0
- package/dist/plugins/host-platform.js +81 -2
- package/dist/plugins/image-bake-store-sql.d.ts +136 -1
- package/dist/plugins/image-bake-store-sql.js +241 -7
- package/dist/plugins/image-index-sql.d.ts +46 -0
- package/dist/plugins/image-index-sql.js +113 -4
- package/dist/plugins/k8s-bg-scripts.d.ts +34 -0
- package/dist/plugins/k8s-bg-scripts.js +88 -4
- package/dist/plugins/k8s-exec-protocol.d.ts +33 -0
- package/dist/plugins/k8s-exec-protocol.js +41 -0
- package/dist/plugins/local-checkpoint-store.d.ts +40 -0
- package/dist/plugins/local-checkpoint-store.js +86 -7
- package/dist/plugins/local-session-store.d.ts +157 -0
- package/dist/plugins/local-session-store.js +289 -34
- package/dist/plugins/local-task-attachment-store.js +14 -2
- package/dist/plugins/mailbox-store-sql.d.ts +38 -0
- package/dist/plugins/mailbox-store-sql.js +39 -6
- package/dist/plugins/memory-engine-pg.d.ts +30 -0
- package/dist/plugins/memory-engine-pg.js +122 -4
- package/dist/plugins/memory-engine-tidb.d.ts +26 -0
- package/dist/plugins/memory-engine-tidb.js +115 -5
- package/dist/plugins/memory-engine-vector-util.d.ts +5 -0
- package/dist/plugins/memory-engine-vector-util.js +5 -0
- package/dist/plugins/memory-resume-anchor-store.d.ts +8 -0
- package/dist/plugins/memory-resume-anchor-store.js +17 -0
- package/dist/plugins/memory-run-store.d.ts +63 -0
- package/dist/plugins/memory-run-store.js +73 -8
- package/dist/plugins/memory-session-policy-store.d.ts +17 -0
- package/dist/plugins/memory-session-policy-store.js +17 -0
- package/dist/plugins/memory-sync-store-pg.d.ts +42 -0
- package/dist/plugins/memory-sync-store-pg.js +45 -2
- package/dist/plugins/memory-sync-store-tidb.d.ts +9 -0
- package/dist/plugins/memory-sync-store-tidb.js +31 -1
- package/dist/plugins/outcome-ledger-sql.d.ts +63 -0
- package/dist/plugins/outcome-ledger-sql.js +97 -3
- package/dist/plugins/pg-approval-store.d.ts +7 -0
- package/dist/plugins/pg-approval-store.js +7 -0
- package/dist/plugins/pg-breaker-state.d.ts +6 -0
- package/dist/plugins/pg-breaker-state.js +6 -0
- package/dist/plugins/pg-checkpoint-store.d.ts +8 -0
- package/dist/plugins/pg-checkpoint-store.js +8 -0
- package/dist/plugins/pg-cost-quota.d.ts +17 -0
- package/dist/plugins/pg-cost-quota.js +6 -0
- package/dist/plugins/pg-file-snapshot-store.d.ts +6 -0
- package/dist/plugins/pg-file-snapshot-store.js +6 -0
- package/dist/plugins/pg-image-bake.d.ts +9 -0
- package/dist/plugins/pg-image-bake.js +9 -0
- package/dist/plugins/pg-image-index.d.ts +9 -0
- package/dist/plugins/pg-image-index.js +9 -0
- package/dist/plugins/pg-outcome-ledger.d.ts +9 -0
- package/dist/plugins/pg-outcome-ledger.js +9 -0
- package/dist/plugins/pg-pool.d.ts +50 -0
- package/dist/plugins/pg-pool.js +78 -0
- package/dist/plugins/pg-query.d.ts +11 -0
- package/dist/plugins/pg-rate-limiter.d.ts +23 -0
- package/dist/plugins/pg-rate-limiter.js +12 -2
- package/dist/plugins/pg-resume-anchor-store.d.ts +5 -0
- package/dist/plugins/pg-resume-anchor-store.js +5 -0
- package/dist/plugins/pg-run-store.d.ts +7 -0
- package/dist/plugins/pg-run-store.js +7 -0
- package/dist/plugins/pg-safe-json.d.ts +13 -0
- package/dist/plugins/pg-safe-json.js +40 -4
- package/dist/plugins/pg-session-policy-store.d.ts +5 -0
- package/dist/plugins/pg-session-policy-store.js +5 -0
- package/dist/plugins/pg-session-storage.d.ts +72 -0
- package/dist/plugins/pg-session-storage.js +152 -20
- package/dist/plugins/pg-session-store.d.ts +10 -0
- package/dist/plugins/pg-session-store.js +10 -0
- package/dist/plugins/pg-tool-result-store.d.ts +7 -0
- package/dist/plugins/pg-tool-result-store.js +7 -0
- package/dist/plugins/pg-workflow-journal-store.d.ts +7 -0
- package/dist/plugins/pg-workflow-journal-store.js +7 -0
- package/dist/plugins/pg-workflow-run-store.d.ts +7 -0
- package/dist/plugins/pg-workflow-run-store.js +7 -0
- package/dist/plugins/posix-shell-fs.d.ts +3 -0
- package/dist/plugins/posix-shell-fs.js +31 -1
- package/dist/plugins/remote-env-adb.d.ts +25 -0
- package/dist/plugins/remote-env-adb.js +95 -12
- package/dist/plugins/remote-env-e2b.d.ts +146 -0
- package/dist/plugins/remote-env-e2b.js +371 -40
- package/dist/plugins/remote-env-file-error.d.ts +34 -0
- package/dist/plugins/remote-env-file-error.js +37 -0
- package/dist/plugins/remote-env-host.d.ts +151 -0
- package/dist/plugins/remote-env-host.js +468 -70
- package/dist/plugins/remote-env-k8s.d.ts +135 -0
- package/dist/plugins/remote-env-k8s.js +318 -32
- package/dist/plugins/remote-env-local-docker.d.ts +65 -0
- package/dist/plugins/remote-env-local-docker.js +149 -24
- package/dist/plugins/remote-env-ssh.d.ts +35 -0
- package/dist/plugins/remote-env-ssh.js +117 -20
- package/dist/plugins/remote-scratchpad.d.ts +38 -0
- package/dist/plugins/remote-scratchpad.js +32 -2
- package/dist/plugins/remote-shell.d.ts +22 -0
- package/dist/plugins/remote-shell.js +27 -1
- package/dist/plugins/resume-anchor-store-sql.d.ts +28 -0
- package/dist/plugins/resume-anchor-store-sql.js +11 -0
- package/dist/plugins/roster-store-sql.d.ts +27 -0
- package/dist/plugins/roster-store-sql.js +54 -0
- package/dist/plugins/run-store-sql.d.ts +194 -0
- package/dist/plugins/run-store-sql.js +210 -9
- package/dist/plugins/s3-presign.d.ts +20 -0
- package/dist/plugins/s3-presign.js +49 -2
- package/dist/plugins/scheduler-support.d.ts +12 -0
- package/dist/plugins/scheduler-support.js +75 -3
- package/dist/plugins/send-file-ledger.d.ts +15 -0
- package/dist/plugins/send-file-ledger.js +53 -4
- package/dist/plugins/send-user-file.d.ts +77 -0
- package/dist/plugins/send-user-file.js +92 -4
- package/dist/plugins/session-policy-store-sql.d.ts +15 -0
- package/dist/plugins/session-policy-store-sql.js +75 -3
- package/dist/plugins/session-store.d.ts +45 -0
- package/dist/plugins/session-store.js +51 -0
- package/dist/plugins/sql-driver.d.ts +77 -0
- package/dist/plugins/sql-driver.js +4 -0
- package/dist/plugins/sql-escape.d.ts +8 -0
- package/dist/plugins/sql-escape.js +8 -0
- package/dist/plugins/sql-row-helpers.d.ts +25 -0
- package/dist/plugins/sql-row-helpers.js +25 -0
- package/dist/plugins/store-backend.d.ts +103 -0
- package/dist/plugins/store-backend.js +120 -27
- package/dist/plugins/store-contracts.d.ts +62 -0
- package/dist/plugins/store-contracts.js +3 -0
- package/dist/plugins/task-attachment-store.d.ts +60 -0
- package/dist/plugins/task-attachment-store.js +49 -3
- package/dist/plugins/task-list-store-sql.d.ts +25 -0
- package/dist/plugins/task-list-store-sql.js +21 -0
- package/dist/plugins/tidb-approval-store.d.ts +6 -0
- package/dist/plugins/tidb-approval-store.js +6 -0
- package/dist/plugins/tidb-breaker-state.d.ts +5 -0
- package/dist/plugins/tidb-breaker-state.js +5 -0
- package/dist/plugins/tidb-checkpoint-store.d.ts +7 -0
- package/dist/plugins/tidb-checkpoint-store.js +7 -0
- package/dist/plugins/tidb-cost-quota.d.ts +6 -0
- package/dist/plugins/tidb-cost-quota.js +1 -0
- package/dist/plugins/tidb-file-snapshot-store.d.ts +6 -0
- package/dist/plugins/tidb-file-snapshot-store.js +6 -0
- package/dist/plugins/tidb-image-bake.d.ts +8 -0
- package/dist/plugins/tidb-image-bake.js +8 -0
- package/dist/plugins/tidb-image-index.d.ts +8 -0
- package/dist/plugins/tidb-image-index.js +8 -0
- package/dist/plugins/tidb-outcome-ledger.d.ts +10 -0
- package/dist/plugins/tidb-outcome-ledger.js +10 -0
- package/dist/plugins/tidb-pool.d.ts +56 -0
- package/dist/plugins/tidb-pool.js +181 -1
- package/dist/plugins/tidb-rate-limiter.d.ts +11 -0
- package/dist/plugins/tidb-rate-limiter.js +5 -2
- package/dist/plugins/tidb-resume-anchor-store.d.ts +5 -0
- package/dist/plugins/tidb-resume-anchor-store.js +5 -0
- package/dist/plugins/tidb-run-store.d.ts +7 -0
- package/dist/plugins/tidb-run-store.js +7 -0
- package/dist/plugins/tidb-session-policy-store.d.ts +5 -0
- package/dist/plugins/tidb-session-policy-store.js +5 -0
- package/dist/plugins/tidb-session-storage.d.ts +43 -0
- package/dist/plugins/tidb-session-storage.js +62 -3
- package/dist/plugins/tidb-session-store.d.ts +142 -0
- package/dist/plugins/tidb-session-store.js +264 -16
- package/dist/plugins/tidb-tool-result-store.d.ts +5 -0
- package/dist/plugins/tidb-tool-result-store.js +7 -0
- package/dist/plugins/tidb-workflow-journal-store.d.ts +7 -0
- package/dist/plugins/tidb-workflow-journal-store.js +7 -0
- package/dist/plugins/tidb-workflow-run-store.d.ts +8 -0
- package/dist/plugins/tidb-workflow-run-store.js +8 -0
- package/dist/plugins/tool-result-store-sql.d.ts +58 -0
- package/dist/plugins/tool-result-store-sql.js +38 -2
- package/dist/plugins/web-search.d.ts +35 -0
- package/dist/plugins/web-search.js +45 -9
- package/dist/plugins/workflow-journal-limits.d.ts +10 -0
- package/dist/plugins/workflow-journal-limits.js +10 -0
- package/dist/plugins/workflow-journal-store-sql.d.ts +78 -0
- package/dist/plugins/workflow-journal-store-sql.js +58 -2
- package/dist/plugins/workflow-run-store-sql.d.ts +84 -0
- package/dist/plugins/workflow-run-store-sql.js +84 -6
- package/dist/plugins/worktree-isolation.d.ts +45 -0
- package/dist/plugins/worktree-isolation.js +105 -6
- package/dist/plugins/write-behind-counter.d.ts +56 -1
- package/dist/plugins/write-behind-counter.js +53 -14
- package/dist/principal-jwt.d.ts +24 -0
- package/dist/principal-jwt.js +60 -5
- package/dist/project-memory.d.ts +22 -0
- package/dist/project-memory.js +144 -15
- package/dist/prompts-domain-validate.d.ts +28 -0
- package/dist/prompts-domain-validate.js +42 -1
- package/dist/question.d.ts +33 -0
- package/dist/question.js +69 -2
- package/dist/resource-suspend.d.ts +21 -0
- package/dist/resource-suspend.js +16 -0
- package/dist/router/route-orchestration.d.ts +78 -0
- package/dist/router/route-orchestration.js +77 -0
- package/dist/run-local.d.ts +32 -0
- package/dist/run-local.js +172 -8
- package/dist/runs.d.ts +189 -4
- package/dist/runs.js +465 -24
- package/dist/runtime-caps-resolver.d.ts +106 -0
- package/dist/runtime-caps-resolver.js +89 -4
- package/dist/runtime-governance.d.ts +84 -0
- package/dist/runtime-governance.js +127 -1
- package/dist/sandbox-pkg-source.d.ts +23 -0
- package/dist/sandbox-pkg-source.js +37 -0
- package/dist/sealed-key.d.ts +54 -0
- package/dist/sealed-key.js +68 -3
- package/dist/security.d.ts +108 -0
- package/dist/security.js +145 -6
- package/dist/sema-registry.d.ts +21 -0
- package/dist/sema-registry.js +21 -0
- package/dist/session-leaf-bus.d.ts +31 -0
- package/dist/session-leaf-bus.js +32 -0
- package/dist/session-sync-content.d.ts +46 -0
- package/dist/session-sync-content.js +47 -1
- package/dist/session-sync-kernel.d.ts +89 -0
- package/dist/session-sync-kernel.js +48 -3
- package/dist/session-sync.d.ts +125 -0
- package/dist/session-sync.js +181 -8
- package/dist/session-titler.d.ts +26 -0
- package/dist/session-titler.js +41 -7
- package/dist/session-watch.d.ts +53 -1
- package/dist/session-watch.js +73 -9
- package/dist/sighup-idle.d.ts +30 -0
- package/dist/sighup-idle.js +12 -1
- package/dist/spec-fields.d.ts +91 -3
- package/dist/spec-fields.js +116 -4
- package/dist/task-cwd.d.ts +50 -0
- package/dist/task-cwd.js +68 -1
- package/dist/task-mcp.d.ts +47 -0
- package/dist/task-mcp.js +29 -0
- package/dist/task-settings.d.ts +175 -0
- package/dist/task-settings.js +226 -11
- package/dist/task-workflow.d.ts +67 -0
- package/dist/task-workflow.js +75 -8
- package/dist/tool-approval.d.ts +91 -0
- package/dist/tool-approval.js +215 -0
- package/dist/trace/artifacts.d.ts +9 -0
- package/dist/trace/artifacts.js +30 -5
- package/dist/trace/core-keyset-guard.d.ts +18 -0
- package/dist/trace/ledger-sink.d.ts +43 -0
- package/dist/trace/ledger-sink.js +64 -5
- package/dist/trace/project.d.ts +133 -0
- package/dist/trace/project.js +189 -2
- package/dist/trace/redact.d.ts +19 -0
- package/dist/trace/redact.js +66 -9
- package/dist/usage-analytics.d.ts +26 -0
- package/dist/usage-analytics.js +26 -3
- package/package.json +1 -1
package/dist/http/sse-log.d.ts
CHANGED
|
@@ -1,23 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* design/158 A9 seam —— 通用可恢复 SSE 泵(P2.8),从 `http/server.ts` 整段搬出的原文。
|
|
3
|
+
*
|
|
4
|
+
* task_run 与 image_bake 两条日志共用同一套 liveness/heartbeat/416/终态复取/15 分钟帽逻辑;域模块
|
|
5
|
+
* (routes/images.ts)与 server.ts 都要用它,所以它必须住在 http/ 叶子里(routes/* 值 import server.ts
|
|
6
|
+
* 会闭合运行时装载环)。
|
|
7
|
+
*/
|
|
1
8
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
9
|
export interface SseLogProvider<E extends {
|
|
3
10
|
seq: number;
|
|
4
11
|
}> {
|
|
12
|
+
/** The coarse terminality status + the freshness clock (`updatedAt`). Undefined/null ⇒ unknown id (the
|
|
13
|
+
* caller already 404'd existence before opening the stream, so this is the in-flight terminal poll). */
|
|
5
14
|
statusOf(id: string): Promise<{
|
|
6
15
|
status: string;
|
|
7
16
|
updatedAt: string;
|
|
8
17
|
} | null | undefined>;
|
|
18
|
+
/** Events with seq strictly greater than `after`, ascending. */
|
|
9
19
|
getEvents(id: string, after: number): Promise<E[]>;
|
|
20
|
+
/** Earliest retained seq → the 416 resume boundary. */
|
|
10
21
|
retainedFrom(id: string): Promise<number>;
|
|
22
|
+
/** Map ONE event to its SSE frame (the `id:`/`event:`/`data:` lines differ per log). */
|
|
11
23
|
formatEvent(ev: E): {
|
|
12
24
|
id: number;
|
|
13
25
|
event: string;
|
|
14
26
|
data: unknown;
|
|
15
27
|
};
|
|
28
|
+
/** The synthetic frame written when the log is stale (no events + `updatedAt` older than `staleMs`). */
|
|
16
29
|
staleFrame(): {
|
|
17
30
|
event: string;
|
|
18
31
|
data: unknown;
|
|
19
32
|
};
|
|
20
33
|
}
|
|
34
|
+
/** The shared resumable SSE pump (P2.8) — provider supplies the log-specific differences; the liveness/
|
|
35
|
+
* heartbeat/416/terminal-re-fetch/15-min-cap logic is identical for task_run + image_bake. */
|
|
21
36
|
export declare function streamSseLog<E extends {
|
|
22
37
|
seq: number;
|
|
23
38
|
}>(req: IncomingMessage, res: ServerResponse, provider: SseLogProvider<E>, id: string, staleMs: number): Promise<void>;
|
package/dist/http/sse-log.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { sendJson, sendError, sseHeaders } from "./send.js";
|
|
2
|
+
/** The shared resumable SSE pump (P2.8) — provider supplies the log-specific differences; the liveness/
|
|
3
|
+
* heartbeat/416/terminal-re-fetch/15-min-cap logic is identical for task_run + image_bake. */
|
|
2
4
|
export async function streamSseLog(req, res, provider, id, staleMs) {
|
|
3
5
|
const lastId = Number(req.headers["last-event-id"] ?? new URL(req.url ?? "", "http://x").searchParams.get("from") ?? 0);
|
|
4
6
|
let from = Number.isFinite(lastId) ? lastId : 0;
|
|
5
7
|
if (from > 0) {
|
|
8
|
+
// Resume point evicted past retention → 416 so the client re-syncs, instead of a silent incomplete stream
|
|
9
|
+
// (parity with streamTaskTrace; council). Inert until retention evicts (retainedFrom stays 1 with no TTL).
|
|
6
10
|
const retainedFrom = await provider.retainedFrom(id);
|
|
7
11
|
if (retainedFrom > from + 1) {
|
|
8
12
|
sendError(res, 416, "limit.retention_evicted", "resume point evicted past retention", { retainedFrom });
|
|
@@ -25,11 +29,20 @@ export async function streamSseLog(req, res, provider, id, staleMs) {
|
|
|
25
29
|
}
|
|
26
30
|
};
|
|
27
31
|
while (!closed) {
|
|
32
|
+
// Independent reads — issue concurrently to shave the SSE poll latency. The terminal-event gap is
|
|
33
|
+
// still covered by the extra getEvents below (a `done` landing between these two is re-fetched).
|
|
28
34
|
const [events, row] = await Promise.all([provider.getEvents(id, from), provider.statusOf(id)]);
|
|
29
35
|
write(events);
|
|
30
36
|
if (!row)
|
|
31
37
|
break;
|
|
32
38
|
if (row.status !== "running") {
|
|
39
|
+
// Terminal. The `done`/`failed` event is appended BEFORE the coarse status flips terminal (runs.ts +
|
|
40
|
+
// the bake terminal-write), so it can land in the gap between the getEvents and statusOf above — fetch
|
|
41
|
+
// ONCE MORE so the stream never ends before delivering the terminal event. (The ONE exception is E12's
|
|
42
|
+
// post-completion `suggestions` event, appended AFTER setTerminal once the fire-and-forget pass settles —
|
|
43
|
+
// it is intentionally NOT delivered on this live tail; a poller reads it from GET /v1/runs/:id, which is the
|
|
44
|
+
// `await result() THEN await suggestions()` contract. Releasing the session lock at `done` beats blocking it
|
|
45
|
+
// on the suggestion LLM pass just to stream a UI nicety.)
|
|
33
46
|
write(await provider.getEvents(id, from));
|
|
34
47
|
break;
|
|
35
48
|
}
|
|
@@ -40,10 +53,13 @@ export async function streamSseLog(req, res, provider, id, staleMs) {
|
|
|
40
53
|
break;
|
|
41
54
|
}
|
|
42
55
|
if (Date.now() - start > MAX_MS) {
|
|
56
|
+
// BL-16: cap reached but the run continues — emit a terminal reconnect signal (not a silent close, which
|
|
57
|
+
// a client couldn't distinguish from a completed run). Distinct from the `failed`/`done` run events.
|
|
43
58
|
res.write(`event: error\ndata: ${JSON.stringify({ type: "error", code: "STREAM_MAX_DURATION", message: "stream reached its 15-minute cap — reconnect with Last-Event-ID to continue (the run is still active)" })}\n\n`);
|
|
44
59
|
break;
|
|
45
60
|
}
|
|
46
61
|
if (events.length === 0) {
|
|
62
|
+
// Heartbeat during a long idle tail (e.g. a debate phase) so the relay's idle timeout doesn't fire.
|
|
47
63
|
if (Date.now() - lastBeat > 15_000) {
|
|
48
64
|
res.write(`event: heartbeat\ndata: {}\n\n`);
|
|
49
65
|
lastBeat = Date.now();
|
package/dist/http/tar.d.ts
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 极小 ustar 写器(workspace 浏览面 #3 的 archive 端点用,[1882]/[1894])。零依赖(仓内 no-SDK 姿势,
|
|
3
|
+
* 同 s3-presign/OTLP 先例)。只写 regular file 条目:512B ustar 头(prefix 155/name 100 拆分)+
|
|
4
|
+
* 内容 512 对齐 + 两块零尾。**不做** PAX/GNU 长名扩展——快照 relPath 超过 prefix+name 可承载
|
|
5
|
+
* (>255 或不可在 "/" 处拆)属病态路径,调用方按 fail-loud 处理(archive 面 422 点名)。
|
|
6
|
+
*/
|
|
7
|
+
/** 把 relPath 拆成 ustar 的 (prefix ≤155, name ≤100);不可拆 ⇒ null(调用方 fail-loud)。 */
|
|
1
8
|
export declare function splitTarPath(relPath: string): {
|
|
2
9
|
prefix: string;
|
|
3
10
|
name: string;
|
|
4
11
|
} | null;
|
|
5
12
|
export declare function tarHeader(relPath: string, sizeBytes: number, mtimeSec: number): Buffer;
|
|
13
|
+
/** 内容块的 512 对齐尾垫(0 长内容=0 垫)。 */
|
|
6
14
|
export declare function tarPadding(sizeBytes: number): Buffer;
|
|
15
|
+
/** 归档终止:两块 512 零。 */
|
|
7
16
|
export declare const TAR_END: Buffer<ArrayBuffer>;
|
|
8
17
|
//# sourceMappingURL=tar.d.ts.map
|
package/dist/http/tar.js
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 极小 ustar 写器(workspace 浏览面 #3 的 archive 端点用,[1882]/[1894])。零依赖(仓内 no-SDK 姿势,
|
|
3
|
+
* 同 s3-presign/OTLP 先例)。只写 regular file 条目:512B ustar 头(prefix 155/name 100 拆分)+
|
|
4
|
+
* 内容 512 对齐 + 两块零尾。**不做** PAX/GNU 长名扩展——快照 relPath 超过 prefix+name 可承载
|
|
5
|
+
* (>255 或不可在 "/" 处拆)属病态路径,调用方按 fail-loud 处理(archive 面 422 点名)。
|
|
6
|
+
*/
|
|
1
7
|
const BLOCK = 512;
|
|
8
|
+
/** 八进制右对齐 NUL 结尾字段(ustar 数字字段形)。 */
|
|
2
9
|
function octal(n, width) {
|
|
3
10
|
const s = n.toString(8).padStart(width - 1, "0");
|
|
4
11
|
return Buffer.from(s + "\0", "ascii");
|
|
5
12
|
}
|
|
13
|
+
/** 把 relPath 拆成 ustar 的 (prefix ≤155, name ≤100);不可拆 ⇒ null(调用方 fail-loud)。 */
|
|
6
14
|
export function splitTarPath(relPath) {
|
|
7
15
|
const bytes = Buffer.byteLength(relPath, "utf8");
|
|
8
16
|
if (bytes <= 100)
|
|
9
17
|
return { prefix: "", name: relPath };
|
|
10
18
|
if (bytes > 255)
|
|
11
19
|
return null;
|
|
20
|
+
// 从右往左找一个 "/",使 name ≤100 且 prefix ≤155(按字节算——多字节字符路径保守处理)。
|
|
12
21
|
for (let i = relPath.length - 1; i > 0; i--) {
|
|
13
22
|
if (relPath[i] !== "/")
|
|
14
23
|
continue;
|
|
@@ -19,6 +28,11 @@ export function splitTarPath(relPath) {
|
|
|
19
28
|
}
|
|
20
29
|
return null;
|
|
21
30
|
}
|
|
31
|
+
/** 一个 regular-file 条目的 512B ustar 头。`mtimeSec` 由调用方给(快照无 per-file mtime ⇒ 统一用
|
|
32
|
+
* 快照时刻/0——确定性输出,同輸入同字节)。 */
|
|
33
|
+
/** ustar 的 size 字段是 12 字节八进制(11 位数字 + NUL)⇒ 上限 8 GiB−1。超了写进去会溢出到相邻
|
|
34
|
+
* 字段/丢末位并**静默**产出坏头(复审 F8/A-LOW 实测:2^36 解析回来是值/8)。fail-loud,与
|
|
35
|
+
* splitTarPath 的病态路径同姿势。当前配置下不可达(快照总字节帽 256MiB),属防御纵深。 */
|
|
22
36
|
const USTAR_MAX_SIZE = 8 * 1024 * 1024 * 1024 - 1;
|
|
23
37
|
export function tarHeader(relPath, sizeBytes, mtimeSec) {
|
|
24
38
|
if (!Number.isFinite(sizeBytes) || sizeBytes < 0 || sizeBytes > USTAR_MAX_SIZE) {
|
|
@@ -29,13 +43,13 @@ export function tarHeader(relPath, sizeBytes, mtimeSec) {
|
|
|
29
43
|
throw new Error(`tar: path not representable in ustar (must be ≤255 bytes and splittable at "/"): ${relPath}`);
|
|
30
44
|
const h = Buffer.alloc(BLOCK, 0);
|
|
31
45
|
h.write(split.name, 0, 100, "utf8");
|
|
32
|
-
octal(0o644, 8).copy(h, 100);
|
|
33
|
-
octal(0, 8).copy(h, 108);
|
|
34
|
-
octal(0, 8).copy(h, 116);
|
|
46
|
+
octal(0o644, 8).copy(h, 100); // mode
|
|
47
|
+
octal(0, 8).copy(h, 108); // uid
|
|
48
|
+
octal(0, 8).copy(h, 116); // gid
|
|
35
49
|
octal(sizeBytes, 12).copy(h, 124);
|
|
36
50
|
octal(Math.max(0, Math.floor(mtimeSec)), 12).copy(h, 136);
|
|
37
|
-
h.fill(0x20, 148, 156);
|
|
38
|
-
h.write("0", 156, 1, "ascii");
|
|
51
|
+
h.fill(0x20, 148, 156); // chksum = spaces while summing
|
|
52
|
+
h.write("0", 156, 1, "ascii"); // typeflag: regular file
|
|
39
53
|
h.write("ustar\0", 257, 6, "ascii");
|
|
40
54
|
h.write("00", 263, 2, "ascii");
|
|
41
55
|
h.write(split.prefix, 345, 155, "utf8");
|
|
@@ -45,9 +59,11 @@ export function tarHeader(relPath, sizeBytes, mtimeSec) {
|
|
|
45
59
|
Buffer.from(sum.toString(8).padStart(6, "0") + "\0 ", "ascii").copy(h, 148);
|
|
46
60
|
return h;
|
|
47
61
|
}
|
|
62
|
+
/** 内容块的 512 对齐尾垫(0 长内容=0 垫)。 */
|
|
48
63
|
export function tarPadding(sizeBytes) {
|
|
49
64
|
const rem = sizeBytes % BLOCK;
|
|
50
65
|
return Buffer.alloc(rem === 0 ? 0 : BLOCK - rem, 0);
|
|
51
66
|
}
|
|
67
|
+
/** 归档终止:两块 512 零。 */
|
|
52
68
|
export const TAR_END = Buffer.alloc(BLOCK * 2, 0);
|
|
53
69
|
//# sourceMappingURL=tar.js.map
|
package/dist/http/wire-gate.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* D-0 (design/80 §1): the single source of truth for the `CheckpointGate.kind` values the service emits on the
|
|
3
|
+
* wire. The suspend path surfaces the gate VERBATIM (`append("suspended", { gate })`, server.ts), and the
|
|
4
|
+
* agent-client SDK renders these as typed arms (an unknown kind falls through the SDK's open `(string & {})`
|
|
5
|
+
* arm and renders generically). This explicit mirror exists so the compile-time guards below + the contract
|
|
6
|
+
* test (`test/wire-gate-contract.test.ts`) keep the wire/SDK in lockstep with core — the guarantee the SDK's
|
|
7
|
+
* own `spec.test.ts` cannot give (it hardcodes the kinds without importing core, so it would stay GREEN the
|
|
8
|
+
* moment core adds a 6th kind; design/80 §3 #10 was therefore unenforced until this).
|
|
9
|
+
*/
|
|
1
10
|
export declare const WIRE_GATE_KINDS: readonly ["human", "irreversible_ask", "resource_limit", "needs_review", "task_done", "plan_review"];
|
|
2
11
|
export type WireGateKind = (typeof WIRE_GATE_KINDS)[number];
|
|
3
12
|
//# sourceMappingURL=wire-gate.d.ts.map
|
package/dist/http/wire-gate.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* D-0 (design/80 §1): the single source of truth for the `CheckpointGate.kind` values the service emits on the
|
|
3
|
+
* wire. The suspend path surfaces the gate VERBATIM (`append("suspended", { gate })`, server.ts), and the
|
|
4
|
+
* agent-client SDK renders these as typed arms (an unknown kind falls through the SDK's open `(string & {})`
|
|
5
|
+
* arm and renders generically). This explicit mirror exists so the compile-time guards below + the contract
|
|
6
|
+
* test (`test/wire-gate-contract.test.ts`) keep the wire/SDK in lockstep with core — the guarantee the SDK's
|
|
7
|
+
* own `spec.test.ts` cannot give (it hardcodes the kinds without importing core, so it would stay GREEN the
|
|
8
|
+
* moment core adds a 6th kind; design/80 §3 #10 was therefore unenforced until this).
|
|
9
|
+
*/
|
|
1
10
|
export const WIRE_GATE_KINDS = ["human", "irreversible_ask", "resource_limit", "needs_review", "task_done", "plan_review"];
|
|
2
11
|
const _wireCoversCore = true;
|
|
3
12
|
const _noStaleWireKind = true;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP wire REQUEST types (design/158 A4) — pure type shapes of the task-submit surface, moved VERBATIM out of
|
|
3
|
+
* http/server.ts so a caller that needs only the request SHAPE (security.ts's authorizer signature; embedders via
|
|
4
|
+
* index.ts) depends on a type-only LEAF instead of the whole 10k-line route module. server.ts re-exports
|
|
5
|
+
* {@link TaskRequestBody}, so every existing import site keeps working unchanged. Conservative scope for the first
|
|
6
|
+
* cut: ONLY TaskRequestBody (its field types are inline or core imports — no other server.ts-local satellites);
|
|
7
|
+
* sibling request/response shapes can migrate here later on the same pattern.
|
|
8
|
+
*/
|
|
1
9
|
import type { AgentDefinition, McpServerSpec } from "@sema-agent/core";
|
|
2
10
|
export interface TaskRequestBody {
|
|
3
11
|
objective: string;
|
|
@@ -8,50 +16,152 @@ export interface TaskRequestBody {
|
|
|
8
16
|
} | {
|
|
9
17
|
url: string;
|
|
10
18
|
}>;
|
|
19
|
+
/** D-1 通用文件上传:预上传附件的句柄数组(POST /v1/attachments 的 `id`)。提交时绑定到会话并在
|
|
20
|
+
* 执行环境工作目录 `attachments/` 下物化;objective 尾部追加告知(名字/mime/尺寸,内容不进流)。
|
|
21
|
+
* 上限 16/task;未知或他人 id → 400(fresh 腿)。⚠️ 名为 `attachmentIds` 而非 `attachments`——
|
|
22
|
+
* 后者已被系统提醒配置键占用(本接口 :464,core spec.attachments 镜像)。 */
|
|
11
23
|
attachmentIds?: string[];
|
|
24
|
+
/** design/112 C1 (core 1.181): the CLIENT/gateway's view of the user — used by core to localize the env block's
|
|
25
|
+
* date to the user's zone + surface who the agent acts for. The shell/gateway fills it from a verified user
|
|
26
|
+
* identity (NOT the model). core validates timeZone (invalid → UTC, never mislabeled). Pass-through to
|
|
27
|
+
* `spec.clientContext`; `locale` was removed in core 1.186 (dead field) so only timeZone+userEmail are accepted. */
|
|
12
28
|
clientContext?: {
|
|
13
29
|
timeZone?: string;
|
|
14
30
|
userEmail?: string;
|
|
15
31
|
};
|
|
32
|
+
/** Business/UX system prompt the CLIENT injects (decoupling seam): appended after the scenario's
|
|
33
|
+
* stable base (before <user_memory>), so an integrator (e.g. OA) owns its own persona / UI markers /
|
|
34
|
+
* workflow rules and evolves them WITHOUT a service change. Trusted: only a caller holding
|
|
35
|
+
* SERVICE_AUTH_TOKEN reaches here (same boundary as `businessContext`). Keep it STABLE per
|
|
36
|
+
* integrator-version (it's part of the cacheable prefix); put per-request context in `objective`. */
|
|
16
37
|
systemPrompt?: string;
|
|
38
|
+
/** Append-only system prompt rider ([1476] R1 / [1478] R2 ruling): passes through to core's
|
|
39
|
+
* `TaskSpec.appendSystemPrompt` (≈ CC `--append-system-prompt`) — a STABLE block composed after the scenario
|
|
40
|
+
* base + `systemPrompt`, before the volatile tail (prefix-cache friendly). First-class lane for the shell's
|
|
41
|
+
* product-knowledge block, so `settings.outputStyle` stays a real output style (a future center-issued style
|
|
42
|
+
* block composes AFTER this field — byte-stable order, pinned by test). Same trust boundary + cap as
|
|
43
|
+
* `systemPrompt` (token-holder only, MAX_SYSTEM_PROMPT_CHARS) — but NOT the same prompt position (codex F1,
|
|
44
|
+
* honesty note): this lands in `core/role.append`, AFTER core's locked safety blocks, exactly where
|
|
45
|
+
* `settings.outputStyle` has landed since 1.26 — the same principal class held this slot before this field
|
|
46
|
+
* existed, so no new grant; whether caller riders should compose BEFORE the safety tail is core's slot-order
|
|
47
|
+
* question (raised on the board). Rejected fail-loud when `systemPrompt` is an already-assembled prompt
|
|
48
|
+
* (anchors detected) — that assembler arm cannot mount the rider (silent drop would belie the capability bit). */
|
|
17
49
|
appendSystemPrompt?: string;
|
|
50
|
+
/** Explicit model selection (CLI `/model` picker + `run --model <ref>`). An INTENT by catalog
|
|
51
|
+
* name (e.g. "deepseek-pro") — resolveSpec gates it against the SAME allow-list as an inline `@name` mention
|
|
52
|
+
* (config.models keys), so it picks WHICH configured model but can never inject one. Wins over an inline
|
|
53
|
+
* @mention; an unknown name falls through to mention/default (lenient). Never a baseUrl/apiKey. */
|
|
18
54
|
model?: string;
|
|
55
|
+
/** [1479]① Cheap-model gear for within-task compaction/summarize (core design/145 `TaskSpec.compactionModel`):
|
|
56
|
+
* a catalog INTENT like `model` (name/tier word/id), gated against the SAME expanded allow-list — picks WHICH
|
|
57
|
+
* configured model compacts, never injects one. core clamps window-unsafe picks back to the main model with
|
|
58
|
+
* `modelFallback` attribution on the `compacted` event. Absent ⇒ the `summarize` role / main model (status quo).
|
|
59
|
+
* Unknown fresh-submit value → 400 (body.model posture); a RESUME replay whose ref left the catalog is dropped
|
|
60
|
+
* + warned in resolveSpec (core's resolveModel would otherwise throw and brick the resume). */
|
|
19
61
|
compactionModel?: string;
|
|
62
|
+
/** Per-task budget the caller requests (1.37). Capped server-side to the operator ceiling
|
|
63
|
+
* (MAX_TASK_COST_USD / MAX_TASK_TOKENS) — a caller may ask for less, never more. */
|
|
20
64
|
maxCostUsd?: number;
|
|
21
65
|
maxTokens?: number;
|
|
66
|
+
/** Developer mode (1.44): run the task behind the adversarial verification gate (impl → independent
|
|
67
|
+
* read-only verify → fix loop). Default off. `verifyRounds` is clamped to [1,5] (default 2). Not
|
|
68
|
+
* supported on /v1/tasks/stream (the gate is multi-round, not a single stream). */
|
|
22
69
|
verify?: boolean;
|
|
23
70
|
verifyRounds?: number;
|
|
71
|
+
/** Quality-gate cascade (1.45): run cheapest→strongest (config `MODEL_CASCADE_LADDER`), escalating when
|
|
72
|
+
* a rung fails the gate (default = it didn't complete). Default off; mutually exclusive with `verify`;
|
|
73
|
+
* not on /v1/tasks/stream. ⚠️ each rung is a cold re-run — use for read-only / idempotent tasks. */
|
|
24
74
|
cascade?: boolean;
|
|
75
|
+
/** Work-view correlation id (optional): groups the runs of one logical task across both client doors
|
|
76
|
+
* (MCP façade / portal) so a fragmented set of runs reads as one task. Opaque to the engine — only
|
|
77
|
+
* persisted on the run row + filterable via `GET /v1/tasks?jobId=`. ≤64 chars (matches the column). */
|
|
25
78
|
jobId?: string;
|
|
79
|
+
/** Personalization seam: the caller's OWN skills for this task, threaded into core's
|
|
80
|
+
* `TaskSpec.skills`. Merged AFTER the scenario's skills with SCENARIO-WINS on a name clash (the security
|
|
81
|
+
* baseline can never be shadowed by user content — see mergeUserSkills). Caps: ≤10 skills, content ≤32KB
|
|
82
|
+
* each. User skills are user-authored content in the user's OWN principal-isolated task (self-harm
|
|
83
|
+
* surface, not privilege escalation); scenario/center skills remain the only trusted layer. */
|
|
26
84
|
skills?: Array<{
|
|
27
85
|
name: string;
|
|
28
86
|
description: string;
|
|
29
87
|
content: string;
|
|
30
88
|
}>;
|
|
89
|
+
/** §7 P0.5 (用户按需选像): the sandbox image PROFILE this task wants (e.g.
|
|
90
|
+
* "code-full" / "code-python"). An INTENT, never a digest — the service resolves it to a published digest with
|
|
91
|
+
* the caller's principal (fail-closed visibility re-admit) and applies it per-pod. Only supported on the k8s
|
|
92
|
+
* backend; absent ⇒ the worker-global default image. `capabilitiesNeeded` optionally requires the resolved
|
|
93
|
+
* image to provide boolean capabilities (browser/db/nestedBuild) or the request is rejected. */
|
|
31
94
|
sandboxImageProfile?: string;
|
|
32
95
|
capabilitiesNeeded?: string[];
|
|
96
|
+
/** Structured-output constraint (CC `--json-schema`): a JSON Schema the model's FINAL answer
|
|
97
|
+
* must match — threaded into core's `TaskSpec.outputSchema`, which injects a built-in `submit_output` tool and
|
|
98
|
+
* surfaces the validated object as `TaskResult.structuredOutput` (an invalid submit retries, then fails with
|
|
99
|
+
* `output.invalid`). A plain JSON-schema OBJECT (shape + size validated here; deep validity is core's). */
|
|
33
100
|
outputSchema?: Record<string, unknown>;
|
|
101
|
+
/** Reasoning-effort selection (CC `/effort` picker, shell-host contract E7): a neutral effort tier mapped to
|
|
102
|
+
* core's `TaskSpec.thinking` (`ThinkingLevel`). Accepted set = core's tiers (off/minimal/low/medium/high/xhigh/max);
|
|
103
|
+
* the picker's advertised default set is `/v1/models` `supportedEffortLevels`. A provided-but-unknown value is a
|
|
104
|
+
* 400 (fail-loud, never silently dropped — the body.model silent-drop bug class). Absent ⇒ core uses the resolved
|
|
105
|
+
* role's default thinking. NEVER `budgetTokens`/`fast_mode` (provider-neutral by omission). */
|
|
34
106
|
reasoningEffort?: string;
|
|
107
|
+
/** Resume-at (shell-host contract E18): the E2 message `eventId` to rewind the conversation to — core branches the
|
|
108
|
+
* session at that prior message before running the new objective ("rewind to this message, ask differently").
|
|
109
|
+
* The service resolves eventId→the persisted SessionTreeEntry.id (the anchor map) in resolveSpec; an unknown
|
|
110
|
+
* eventId is a 4xx (never silently dropped). Requires a session. Absent ⇒ continue from the current leaf. */
|
|
35
111
|
resumeAt?: string;
|
|
112
|
+
/** [833] rewind exclusive mode (core 1.292 `TaskSpec.resumeAtMode`): qualifies the `resumeAt` target. `"at"`
|
|
113
|
+
* (default when absent — zero regression) keeps the target message in the branched context; `"before"` branches at
|
|
114
|
+
* the target's PARENT, EXCLUDING the target itself (the exclusive-rewind shape: "remove this prompt and everything
|
|
115
|
+
* after it"). core enforces the "before" edges and the service passes its rejection codes through UNCHANGED for the
|
|
116
|
+
* shell to render: `resume_at.before_target_not_user` (only plain user-message targets),
|
|
117
|
+
* `resume_at.before_root_unsupported` (can't rewind past the session root — start a new session),
|
|
118
|
+
* `rewind_snapshot.unresolvable` (rewindFiles: no snapshot at/above the "before" branch point). Only meaningful
|
|
119
|
+
* WITH `resumeAt` — sent alone it's a 400 (fail-loud, not a silent no-op). */
|
|
36
120
|
resumeAtMode?: string;
|
|
121
|
+
/** design/114 Phase3 (reuse-path warm-resume): require the `sessionId` to ALREADY exist. When `true` and the session
|
|
122
|
+
* is genuinely missing (expired / purged / never created), the run FAILS LOUD (`resume.session_not_found`) instead
|
|
123
|
+
* of silently starting a fresh empty session ("looks warm, actually fresh"). Absent/`false` ⇒ the historical
|
|
124
|
+
* create-on-miss. Fails loud with NO sessionId too (nothing to resume). Rides the persisted body onto resume legs. */
|
|
37
125
|
requireExistingSession?: boolean;
|
|
126
|
+
/** Prompt suggestions (shell-host contract E12): opt-in — after the task COMPLETES, core runs ONE extra LLM pass to
|
|
127
|
+
* propose follow-up prompts the user might send. `true` = default (count 3, cheap role); an object tunes count/role.
|
|
128
|
+
* OFF/absent ⇒ zero extra LLM. The strings are UNTRUSTED model text for the shell UI ONLY (never re-fed to a model);
|
|
129
|
+
* the service persists them (redacted) as a `suggestions` event on the run's events tail. */
|
|
38
130
|
suggestNextPrompts?: boolean | {
|
|
39
131
|
count?: number;
|
|
40
132
|
role?: string;
|
|
41
133
|
};
|
|
134
|
+
/** Rewind-files (shell-host contract E19): opt-in — snapshot the working tree each completed turn + RESTORE it when a
|
|
135
|
+
* `resumeAt` branch is taken ("rewind to this message" also rewinds the files). Requires a FileSnapshotStore; works for
|
|
136
|
+
* ANY execution env since core's gate-split (1.134.0). OFF/absent ⇒ no snapshot/restore work. */
|
|
42
137
|
rewindFiles?: boolean;
|
|
138
|
+
/** R8 code-only rewind (CC "Restore code" mode, core 1.166 `rewindFilesTo`): restore the working tree to the snapshot
|
|
139
|
+
* at a prior USER message WITHOUT forking the conversation (the session leaf is untouched — only the files move). The
|
|
140
|
+
* value is the same handle as `resumeAt` (the prompt's taskId); the service resolves it → the entry id. Honored ONLY
|
|
141
|
+
* when `resumeAt` is ABSENT (the two modes are mutually exclusive). Requires the anchor map + a FileSnapshotStore. */
|
|
43
142
|
rewindFilesTo?: string;
|
|
143
|
+
/** design/131 (core 1.246): per-task resilience INTENT flags. allowDegrade/allowFailover are caller-facing;
|
|
144
|
+
* bypassBreaker is operator-only (resolveSpec drops it for non-operators — a permission downgrade, not a 400). */
|
|
44
145
|
resilience?: {
|
|
45
146
|
allowDegrade?: boolean;
|
|
46
147
|
allowFailover?: boolean;
|
|
47
148
|
bypassBreaker?: boolean;
|
|
48
149
|
};
|
|
150
|
+
/** design/132 (core 1.249): one-shot end-game verification nudge — opt-in by the AUTONOMY caller. */
|
|
49
151
|
finalVerification?: boolean;
|
|
152
|
+
/** [854]④ per-request 配速(core spec.limits 全链:timeoutSec 墙钟 + deadlineNudge/callCapByDeadline/
|
|
153
|
+
* gracefulFinalize;maxOutputTokens = 每次模型调用的输出上限;maxTurns = 上游 parity 的回合上限)。
|
|
154
|
+
* 三键均为正整数(0 拒绝:core 侧 timeoutSec>0 才生效,放行 0 会绕过运营方封顶)。与 `maxTokens`
|
|
155
|
+
* (per-task 总 token 预算,cappedCeiling 车道)不同物 —— maxOutputTokens 是单次调用配速。
|
|
156
|
+
* 每键各自被可选 env 上限封顶(TASK_TIMEOUT_MAX_SEC / TASK_MAX_OUTPUT_TOKENS_MAX / TASK_MAX_TURNS_MAX,
|
|
157
|
+
* 缺省不设=不封顶);timeoutSec 缺席时保持既有 tenancy 墙钟姿势(resolveTaskLimits,spec-fields.ts)。 */
|
|
50
158
|
limits?: {
|
|
51
159
|
timeoutSec?: number;
|
|
52
160
|
maxOutputTokens?: number;
|
|
53
161
|
maxTurns?: number;
|
|
54
162
|
};
|
|
163
|
+
/** design/133 (core 1.251) + G1 (core 1.253): turn-boundary attachment reminders (todo / changed-files /
|
|
164
|
+
* plan-mode) + one-shot boundary notices (post-compaction background-task recap / deferred-tools delta). */
|
|
55
165
|
attachments?: {
|
|
56
166
|
todoReminder?: boolean;
|
|
57
167
|
changedFiles?: boolean | {
|
|
@@ -61,30 +171,107 @@ export interface TaskRequestBody {
|
|
|
61
171
|
backgroundTasks?: boolean;
|
|
62
172
|
toolsDelta?: boolean;
|
|
63
173
|
};
|
|
174
|
+
/** C1 (core 1.219, subagent viewing pane): opt-in — forward a delegated child's live CONTENT events
|
|
175
|
+
* (text_delta/reasoning_delta/tool_start/tool_end, each stamped `parentToolCallId`) onto this run's stream/durable
|
|
176
|
+
* log, so a shell can render the child's transcript live ("enter 看详情"). Default OFF = progress-only (prior
|
|
177
|
+
* behavior). Purely a render channel — core never merges the child stream into the parent's model context. */
|
|
64
178
|
forwardSubagentEvents?: boolean;
|
|
179
|
+
/** G3([816] 壳侧承诺③/[820]③):壳供 per-session scratchpad 路径(壳 vendored getScratchpadDir 的
|
|
180
|
+
* 约定路径)。接受后优先于 server 自算,同源喂 envFacts.scratchpadDir 事实 + fs-write gate exemptDirs +
|
|
181
|
+
* additionalDirectories 根围栏——壳提示词与 server 写门指同一个目录。验收 fail-closed(单用户 +
|
|
182
|
+
* host-semantics lane + 绝对路径/深度/长度门,规则在 env-facts.acceptShellScratchpadDir),拒收形
|
|
183
|
+
* warn 后回落自算——「没到货引擎忽略 = 无害 additive」的对偶:异形键忽略,任务照跑。 */
|
|
65
184
|
scratchpadDir?: string;
|
|
185
|
+
/** design/122 (core 1.225): opt-in — RETAIN settled sub-agent sessions so the shell can revive one
|
|
186
|
+
* (`POST /v1/runs/:id/subagents/:target/resume`, CC dfe parity). `true` = core defaults (30min ttl / 16 max);
|
|
187
|
+
* an object tunes them (service-clamped: ttlMs ≤24h, max ≤64 — retention pins sessions in memory within the
|
|
188
|
+
* run). Default OFF = throwaway children (a resume then 409s `resume.retain_off`). Run-scoped: everything is
|
|
189
|
+
* released when the parent run ends regardless. */
|
|
66
190
|
retainSubagentSessions?: boolean | {
|
|
67
191
|
ttlMs?: number;
|
|
68
192
|
max?: number;
|
|
69
193
|
};
|
|
194
|
+
/** [876] per-task custom subagents (core 1.295 `TaskSpec.agents` — CC `.claude/agents/` parity): the shell sends
|
|
195
|
+
* its resolved agent definitions per request. Whitelist-validated FAIL-LOUD at submit (unknown keys 400 — an
|
|
196
|
+
* agent definition silently losing a `denyTools`/`isolation` field is a silent widening, the opposite failure
|
|
197
|
+
* mode of the resilience "tolerate unknown keys" posture; `permissionMode` deliberately NOT accepted — core call,
|
|
198
|
+
* separate batch). `model` must be an ALREADY-RESOLVED name or Model object (the server does no alias translation).
|
|
199
|
+
* 🔒 Honored on SINGLE-USER deployments only (multi-tenant warns + ignores until a per-tenant caps face exists —
|
|
200
|
+
* fail-closed; advertised via capabilities.taskAgents). ≤32 per request. Rides the persisted body onto resume
|
|
201
|
+
* legs (defensive per-item DROP there, never a brick). */
|
|
70
202
|
agents?: AgentDefinition[];
|
|
203
|
+
/** [854]② (core 1.295 `TaskSpec.retainBackgroundProcesses`): opt-out of the task-end reaping of session
|
|
204
|
+
* background processes ("keep my dev server running"). On the host lane this is a RESOURCE-RESIDENCY grant, so
|
|
205
|
+
* it takes the same single-user gate as backgroundShell/hooks (multi-tenant warns + ignores; advertised via
|
|
206
|
+
* capabilities.retainBackgroundProcesses). Boolean fail-loud at submit; only `true` rides the spec. */
|
|
71
207
|
retainBackgroundProcesses?: boolean;
|
|
208
|
+
/** [1052]② (core 1.314 工具面控制批): roster 真卸载清单(schema 不上 wire,manifest 收窄)。wire 工具名;
|
|
209
|
+
* tighten-only(core 继承不变量 union 进子 spawn)。数组-of-string fail-loud at submit。 */
|
|
72
210
|
excludeTools?: string[];
|
|
211
|
+
/** [1052]② (core 1.314): design/36 延迟披露清单(占位上 wire,ToolSearch 激活)——cli「Workflow 默认开
|
|
212
|
+
* 不暴露」的承载位。同 excludeTools 的校验/继承姿势。 */
|
|
73
213
|
deferTools?: string[];
|
|
214
|
+
/** [1144]/[1146] (core 1.328 R2): 提示词双形轴——simple(CC 212 短形,引擎缺省)| classic(长形,可按
|
|
215
|
+
* 任务/模型试分)。纯呈现轴无租户门;枚举 fail-loud at submit;缺省不挂键。 */
|
|
74
216
|
promptProfile?: "simple" | "classic";
|
|
217
|
+
/** R4 (CC parity): the LIGHT top-level per-turn permission-mode intent (CC `permissionMode`). The shell sends
|
|
218
|
+
* the RAW mode (axis-agnostic, no client-side interpretation); the SERVICE interprets it tighten-only: `plan` ⇒
|
|
219
|
+
* read-only hands + `present_plan` (EnterPlanMode parity); `acceptEdits`/`bypassPermissions` LOOSEN → coerced to
|
|
220
|
+
* `default` (never honored remotely; the client enforces them on its own machine). Folds onto the SAME tighten-only
|
|
221
|
+
* governance as `settings.permissions.defaultMode` (the heavier bundle), so it's a lighter alias, not a second path. */
|
|
75
222
|
permissionMode?: string;
|
|
223
|
+
/** MF-30 memory PAUSE (shell-host contract, option B per-request — clay 2026-06-27): `false` makes THIS run
|
|
224
|
+
* read-only over long-term memory (`TaskSpec.memory.writeScope:null` — the design/138 memory ENGINE materializes/
|
|
225
|
+
* reads but its harvest commits nothing). Absent/`true` ⇒ normal read+write. The shell's `/memory` pause carries
|
|
226
|
+
* this per request (no stored per-session flag). Re-applies on resume (rides in the persisted body). */
|
|
76
227
|
memoryWrite?: boolean;
|
|
228
|
+
/** 142-S4 projectId 线程化(design/142 §2):这个 run 归属的项目(center 登记簿键,generic lowercase
|
|
229
|
+
* UUID — core S1 `resolveProjectId` marker 或 S3 无仓 mint 的产物;客户端只透传,零铸造权威)。是「哪个
|
|
230
|
+
* 项目」的选择器,不是身份/capability — scope 的 tenant 段永远来自 verified principal。SHAPE 门在
|
|
231
|
+
* authorizer(PROJECT_ID_REGEX,不合形状=422 typed `invalid_project_id`)。多租户 DB 记忆面下它把派生
|
|
232
|
+
* scope 从 user 盘切到项目盘(`proj:<tenant>/<projectId>`)并以 config.projects[projectId].defaultScopes
|
|
233
|
+
* 作 memory.scopes 种子;单用户部署忽略派生(memoryScopeFor 不变),仅 defaultScopes 种子生效。
|
|
234
|
+
* Rides the persisted body onto resume legs(与 memoryWrite 同姿势)。 */
|
|
77
235
|
projectId?: string;
|
|
236
|
+
/** [#40 / TOC cwd seam, SDK 0.0.36] The TOC client's launch directory — the agent's HOST execution-env workspace
|
|
237
|
+
* runs HERE (CC-parity: `sema` in a project dir operates on THAT project). An ABSOLUTE host path. 🔒 honored ONLY
|
|
238
|
+
* on the single-user `host` lane (see task-cwd.ts `cwdHonored`); IGNORED on cloud/container lanes + multi-tenant
|
|
239
|
+
* (a caller can't point a shared/cloud worker at an arbitrary host path). Validated absolute (prepareSpec 400s a
|
|
240
|
+
* relative cwd — it would silently resolve against the SERVICE process cwd). */
|
|
78
241
|
cwd?: string;
|
|
242
|
+
/** [R3] Caller-supplied per-request MCP servers (the TOC client's local `.mcp.json`), aligned to core
|
|
243
|
+
* `McpServerSpec`. 🔒 honored on any SINGLE-USER deployment (task-mcp.ts `mcpInjectionHonored` = `requirePrincipal!==true`)
|
|
244
|
+
* — the requester is the super-admin of their OWN worker (CC-parity), on ANY execution lane (the stdio MCP runs on the
|
|
245
|
+
* worker, not the exec env); IGNORED on multi-tenant deployments (can't make the shared worker run an arbitrary
|
|
246
|
+
* command). Validated + gated downstream; the center/config baseline wins on a name clash. */
|
|
79
247
|
mcpServers?: McpServerSpec[];
|
|
248
|
+
/** CC parity (Workflow super-set): per-task activation of the LLM-authored workflow engine (core `run_workflow`).
|
|
249
|
+
* `true` → `spec.selfOrchestration` (the engine mounts run_workflow), gated on the deployment's `selfOrchestrationEnabled`
|
|
250
|
+
* (else a harmless no-op) + core's `allowWorkflows` per-principal entitlement on multi-tenant (single-user honors
|
|
251
|
+
* directly). Absent/false ⇒ no workflow tool this run. */
|
|
80
252
|
selfOrchestration?: boolean;
|
|
253
|
+
/** §4 (CC parity, mirrors `selfOrchestration`): per-task opt-in for CC `/fork` — mount core's `Fork` tool so the
|
|
254
|
+
* model can fork the session (a child inherits the parent's full context + shares the prompt-cache prefix). `true` →
|
|
255
|
+
* `spec.enableFork`; core additionally requires a durable fork-capable session store (`hasSessionFork` — the TOC file
|
|
256
|
+
* backend satisfies it), else it stays inert. Absent/false ⇒ no Fork tool this run (default). Forks the CALLER's OWN
|
|
257
|
+
* session (owner-checked authorizer), so no cross-tenant surface. */
|
|
81
258
|
enableFork?: boolean;
|
|
82
259
|
[k: string]: unknown;
|
|
83
260
|
}
|
|
261
|
+
/** design/80 D-1: the operator-echoed decision-action binding carried on POST /v1/approvals/:id[/decide].
|
|
262
|
+
* All optional for back-compat — a legacy BFF caller omitting them resumes on the current-pending values
|
|
263
|
+
* exactly as before (the pre-D-1 path), tracked by a deprecation counter.
|
|
264
|
+
* design/158 A9: hoisted VERBATIM out of `createHttpServer`'s closure so the approvals/assistant route domain
|
|
265
|
+
* and the resume leg can name the SAME shape without a routes/* → server.ts value edge. */
|
|
84
266
|
export type DecideBinding = {
|
|
267
|
+
/** The capability token the operator actually SAW (from listPending). A mismatch with the current pending
|
|
268
|
+
* ⇒ approval_stale (they decided a superseded/resolved view). */
|
|
85
269
|
checkpointToken?: string;
|
|
270
|
+
/** The pendingAction.toolCallId the operator saw — echoed into ResumeOutcome.boundCallId. */
|
|
86
271
|
boundCallId?: string;
|
|
272
|
+
/** The server-minted opaque boundInputHash the operator saw — echoed VERBATIM (never recomputed here). */
|
|
87
273
|
boundInputHash?: string;
|
|
274
|
+
/** design/37 edit: operator-corrected tool args, applied by core AFTER the binding check, on approve only. */
|
|
88
275
|
updatedInput?: unknown;
|
|
89
276
|
};
|
|
90
277
|
//# sourceMappingURL=wire-types.d.ts.map
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* design/158 A9 seam —— workspace 文件面的内容类型/二进制判别,从 `http/server.ts` 整段搬出的原文。
|
|
3
|
+
* routes/sessions.ts 的 workspace 腿要用它,所以住在 http/ 叶子里(routes/* 不可值 import server.ts)。
|
|
4
|
+
*/
|
|
5
|
+
/** workspace file 面的 content-type(#3,[1894]③):保守扩展名表——只收「浏览器渲染无歧义且
|
|
6
|
+
* 无主动内容」的类型,其余一律 octet-stream(nosniff 恒带;html/svg 等可执行内容**故意**不进表,
|
|
7
|
+
* agent 产物=不可信,按下载处理)。 */
|
|
1
8
|
export declare function workspaceContentType(relPath: string): string;
|
|
9
|
+
/** 二进制判别([1894]③):首 8KiB 含 NUL 即二进制(git 同判据——快、稳、无误伤 UTF-8)。 */
|
|
2
10
|
export declare function looksBinary(bytes: Uint8Array): boolean;
|
|
3
11
|
//# sourceMappingURL=workspace-content.d.ts.map
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* design/158 A9 seam —— workspace 文件面的内容类型/二进制判别,从 `http/server.ts` 整段搬出的原文。
|
|
3
|
+
* routes/sessions.ts 的 workspace 腿要用它,所以住在 http/ 叶子里(routes/* 不可值 import server.ts)。
|
|
4
|
+
*/
|
|
5
|
+
/** workspace file 面的 content-type(#3,[1894]③):保守扩展名表——只收「浏览器渲染无歧义且
|
|
6
|
+
* 无主动内容」的类型,其余一律 octet-stream(nosniff 恒带;html/svg 等可执行内容**故意**不进表,
|
|
7
|
+
* agent 产物=不可信,按下载处理)。 */
|
|
1
8
|
export function workspaceContentType(relPath) {
|
|
9
|
+
// 🔴 复审 A-LOW:先确认**真有** `.` 再取扩展名——`lastIndexOf` 返回 -1 时 `slice(0)` 会把整个
|
|
10
|
+
// basename 当扩展名,于是一个名为 `png`/`pdf` 的任意内容文件会命中保守表按 image/png 发出。
|
|
2
11
|
const base = relPath.slice(relPath.lastIndexOf("/") + 1);
|
|
3
12
|
const dot = base.lastIndexOf(".");
|
|
4
13
|
const ext = dot > 0 ? base.slice(dot + 1).toLowerCase() : "";
|
|
@@ -10,6 +19,7 @@ export function workspaceContentType(relPath) {
|
|
|
10
19
|
};
|
|
11
20
|
return TABLE[ext] ?? "application/octet-stream";
|
|
12
21
|
}
|
|
22
|
+
/** 二进制判别([1894]③):首 8KiB 含 NUL 即二进制(git 同判据——快、稳、无误伤 UTF-8)。 */
|
|
13
23
|
export function looksBinary(bytes) {
|
|
14
24
|
const n = Math.min(bytes.byteLength, 8192);
|
|
15
25
|
for (let i = 0; i < n; i++)
|
|
@@ -1,9 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bake input WHITELIST + vetted-argv builder (IMAGE-API-DESIGN.md §P2.4 — the anti-RCE core).
|
|
3
|
+
*
|
|
4
|
+
* bands/profile/baseRef/bump compose a Dockerfile + a `FROM` + a `docker build` = arbitrary code on the build
|
|
5
|
+
* host. So EVERY field is validated SERVER-SIDE against a CLOSED SET *before* an argv is built; off-list → an
|
|
6
|
+
* error, never coerced. The runner only ever sees the VETTED argv this module emits (never operator free-text)
|
|
7
|
+
* and only runs `build.sh`, which composes Dockerfiles from the in-repo `bands/` via `gen-dockerfile.sh` — there
|
|
8
|
+
* is no path here to inject a raw Dockerfile or a shell command.
|
|
9
|
+
*
|
|
10
|
+
* Set membership is the gate (NOT regex): `^[a-z0-9-]+$` is belt-only — `python; rm -rf /` ∉ the frozen set →
|
|
11
|
+
* rejected, and the argv is a RAW vetted VECTOR the runner array-spawns (each element in its own argv slot, no
|
|
12
|
+
* shell), never concatenated into a command string.
|
|
13
|
+
*
|
|
14
|
+
* The frozen catalogs below MIRROR the recipe source of truth (`gen-dockerfile.sh` `profile_bands()` + the
|
|
15
|
+
* `bands/` dir). A DRIFT test (test/image-bake-validate.test.ts) asserts they still match — a silently-drifted
|
|
16
|
+
* list would either reject a valid profile or admit a removed band. Keep them in lockstep with the recipes.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* FROZEN profile catalog — mirrored from `e2b-template/dev-sandbox/gen-dockerfile.sh` `profile_bands()`.
|
|
20
|
+
* (db / browser-nodriver are opt-in overlays, NOT in `code-full` — `code-full-db` adds db; per design §4.)
|
|
21
|
+
*/
|
|
1
22
|
export declare const FROZEN_PROFILES: readonly string[];
|
|
23
|
+
/** FROZEN band set — mirrored from the `e2b-template/dev-sandbox/bands/` directory (one dir per band). */
|
|
2
24
|
export declare const FROZEN_BANDS: readonly string[];
|
|
25
|
+
/**
|
|
26
|
+
* FROZEN bump-tool set — the toolchain identifiers a `--bump <tool>=<ver>` may target. Conservative union of the
|
|
27
|
+
* version-overridable toolchains the bands accept (`<TOOL>_VERSION` env, build.sh forwards `--bump tool=ver`).
|
|
28
|
+
* Set-membership is the gate; the value is range-checked by VER_RE. Off-list tool → 400 (never coerced).
|
|
29
|
+
*/
|
|
3
30
|
export declare const FROZEN_BUMP_TOOLS: readonly string[];
|
|
31
|
+
/** Bump value range (P2.4d): printable version-ish tokens only, ≤40 chars — folds into the lockhash. */
|
|
4
32
|
export declare const VER_RE: RegExp;
|
|
33
|
+
/** Belt-only band shape (set-membership is the real gate); a defense-in-depth reject of structurally weird ids. */
|
|
5
34
|
export declare const BAND_SHAPE_RE: RegExp;
|
|
35
|
+
/** A digest must be an immutable sha256 ref (the allow-list check against the index is the real gate, P2.4c). */
|
|
6
36
|
export declare const DIGEST_RE: RegExp;
|
|
37
|
+
/** The raw, untrusted submit body fields this module validates (operator free-text). */
|
|
7
38
|
export interface BakeSubmit {
|
|
8
39
|
profile?: unknown;
|
|
9
40
|
bands?: unknown;
|
|
@@ -12,14 +43,18 @@ export interface BakeSubmit {
|
|
|
12
43
|
push?: unknown;
|
|
13
44
|
dryRun?: unknown;
|
|
14
45
|
logs?: unknown;
|
|
46
|
+
/** RFC B4: bake-time package-source profile — "cn" (default) | "global". Closed set, never coerced. */
|
|
15
47
|
pkgSource?: unknown;
|
|
16
48
|
}
|
|
49
|
+
/** A validation rejection: the HTTP status + a stable error envelope (matches the live images-block shape). */
|
|
17
50
|
export interface BakeReject {
|
|
18
51
|
ok: false;
|
|
19
52
|
status: number;
|
|
20
53
|
error: string;
|
|
54
|
+
/** P2.14 #2 — structured band-conflict for the composer UI; null otherwise. */
|
|
21
55
|
conflictBands?: string[];
|
|
22
56
|
}
|
|
57
|
+
/** A vetted bake: the normalized inputs + the RAW argv vector the runner array-spawns (and only this). */
|
|
23
58
|
export interface BakeAccept {
|
|
24
59
|
ok: true;
|
|
25
60
|
profile: string;
|
|
@@ -29,11 +64,39 @@ export interface BakeAccept {
|
|
|
29
64
|
push: boolean;
|
|
30
65
|
dryRun: boolean;
|
|
31
66
|
logs: boolean;
|
|
67
|
+
/** RFC B4: vetted bake-time package-source profile; null = build.sh default (cn). */
|
|
32
68
|
pkgSource: "cn" | "global" | null;
|
|
69
|
+
/** The VETTED build.sh argv (NOT including `build.sh` itself) — raw vetted vector, array-spawned (no shell). */
|
|
33
70
|
argv: string[];
|
|
34
71
|
}
|
|
35
72
|
export type BakeValidation = BakeAccept | BakeReject;
|
|
73
|
+
/**
|
|
74
|
+
* Validate + normalize a `POST /v1/images/bakes` body into a vetted argv, or a typed rejection.
|
|
75
|
+
*
|
|
76
|
+
* Order is deliberate: profile XOR bands → bands set-membership (dupes/empties/shape) → bump set+range →
|
|
77
|
+
* baseRef shape (the index allow-list check is done by the caller via `baseRefAllowed`, async) → build the
|
|
78
|
+
* raw vetted argv. The output repo is server-fixed (`sema-images/<profile>`); the caller CANNOT set
|
|
79
|
+
* `--tag` (build.sh auto-computes the immutable tag — kills namespace-squat) nor an arbitrary `FROM`.
|
|
80
|
+
*
|
|
81
|
+
* `baseRefAllowed` is checked HERE for shape only; the digest-in-index allow-list is the caller's async step
|
|
82
|
+
* (it owns the TiDB index). A present-but-malformed `baseRef` is rejected before any DB hit.
|
|
83
|
+
*/
|
|
36
84
|
export declare function validateBake(body: BakeSubmit): BakeValidation;
|
|
85
|
+
/**
|
|
86
|
+
* Build the VETTED, NORMALIZED build.sh argv from an accepted validation + the caller-resolved effective fields
|
|
87
|
+
* (the index-checked baseRef and the build-host CACHE_BASE — both runner-environment facts image-api injects,
|
|
88
|
+
* never operator free-text). The elements are RAW (no shell-quoting): the runner array-spawns build.sh so each
|
|
89
|
+
* element lands in its own argv slot (no shell can re-interpret a frozen-set value). The runner runs
|
|
90
|
+
* `build.sh <argv...>` and ONLY this.
|
|
91
|
+
*
|
|
92
|
+
* Server-fixed invariants enforced here (NOT caller-settable, P2.4d):
|
|
93
|
+
* - `--json` always (machine output the runner parses).
|
|
94
|
+
* - selection is `--profile <p>` XOR `--bands a,b,c` (already vetted).
|
|
95
|
+
* - NO `--tag` (build.sh auto-computes the immutable tag — kills namespace-squat / overwrite-by-naming).
|
|
96
|
+
* - the output repo is server-fixed `sema-images/<profile>` (build.sh's IMAGE_PREFIX default; not forwarded).
|
|
97
|
+
* - `--base-ref` is the index-checked effective base (caller resolves the default when absent).
|
|
98
|
+
* - `--cache-base` is the build-host promoted cache (runner env).
|
|
99
|
+
*/
|
|
37
100
|
export declare function buildBakeArgv(v: BakeAccept, effective: {
|
|
38
101
|
baseRef: string | null;
|
|
39
102
|
cacheBase: string | null;
|