@sema-agent/server 7.133.0 → 7.135.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/MIGRATION.md +221 -0
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/USAGE.md +222 -36
- package/deploy/sema-up/README.md +16 -0
- package/deploy/sema-up/chart/Chart.yaml +1 -1
- package/deploy/sema-up/chart/templates/NOTES.txt +15 -0
- package/deploy/sema-up/chart/templates/_helpers.tpl +129 -0
- package/deploy/sema-up/chart/templates/sealed-key.yaml +24 -0
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +14 -0
- package/deploy/sema-up/chart/templates/server.yaml +14 -0
- package/deploy/sema-up/chart/values-full-single.yaml +5 -1
- package/deploy/sema-up/chart/values.yaml +34 -0
- package/dist/adoption/plan.d.ts +1 -1
- package/dist/approval-ask-audit-store.d.ts +25 -25
- package/dist/approval-ask-machine.d.ts +2 -2
- package/dist/approval-card.d.ts +66 -154
- package/dist/approval-card.js +33 -52
- package/dist/approval-content-kind.d.ts +26 -6
- package/dist/approval-content-kind.js +23 -3
- package/dist/approval-deny-reasons.d.ts +1 -1
- package/dist/approval-gate-currency.d.ts +91 -0
- package/dist/approval-gate-currency.js +120 -0
- package/dist/approval-hmac.d.ts +7 -7
- package/dist/approval-policy-settlement.d.ts +2 -2
- package/dist/approval-reconciler.d.ts +3 -3
- package/dist/approval.d.ts +14 -8
- package/dist/approval.js +35 -16
- package/dist/auth-bridge.d.ts +1 -1
- package/dist/auto-mode-face.d.ts +4 -4
- package/dist/background-session-reap.d.ts +2 -2
- package/dist/bake-runner/main.d.ts +2 -2
- package/dist/bake-runner/runner.d.ts +4 -4
- package/dist/bench/s1/live-deps.d.ts +1 -1
- package/dist/bench/s1/run-firm.d.ts +1 -1
- package/dist/boot/coordinators.d.ts +7 -2
- package/dist/boot/coordinators.js +8 -5
- package/dist/boot/deferred-sandbox-path-env.d.ts +0 -6
- package/dist/boot/deferred-sandbox-path-env.js +0 -5
- package/dist/boot/engine-lease.d.ts +5 -5
- package/dist/boot/execution-env.d.ts +16 -15
- package/dist/boot/execution-env.js +19 -21
- package/dist/boot/fatal-exit.d.ts +2 -2
- package/dist/boot/late-binds.d.ts +1 -1
- package/dist/boot/leader.d.ts +2 -0
- package/dist/boot/leader.js +2 -1
- package/dist/boot/memory-boundary.d.ts +2 -2
- package/dist/boot/memory-consolidation.d.ts +15 -15
- package/dist/boot/parked-revive-gate.d.ts +3 -3
- package/dist/boot/parked-revive-gate.js +3 -2
- package/dist/boot/read-deny-anchor-audit.js +2 -2
- package/dist/boot/reapers.d.ts +4 -4
- package/dist/boot/resolve-spec.d.ts +1 -1
- package/dist/boot/resolve-spec.js +28 -24
- package/dist/boot/runner-deps.d.ts +29 -16
- package/dist/boot/runner-deps.js +12 -2
- package/dist/boot/session-faces.d.ts +3 -3
- package/dist/boot/session-faces.js +11 -30
- package/dist/boot/shutdown.d.ts +5 -5
- package/dist/boot/side-query-lane.d.ts +2 -2
- package/dist/boot/stage-05-execution-env.js +4 -4
- package/dist/boot/stage-06-runners.d.ts +4 -3
- package/dist/boot/stage-06-runners.js +15 -4
- package/dist/boot/stage-07-capability-layer.d.ts +2 -1
- package/dist/boot/stage-08-reapers.d.ts +2 -1
- package/dist/boot/stage-09-leader.d.ts +2 -1
- package/dist/boot/stage-09-leader.js +2 -2
- package/dist/boot/stage-10-http-server.d.ts +2 -1
- package/dist/boot/stage-10-http-server.js +2 -1
- package/dist/boot/stores.d.ts +8 -0
- package/dist/boot/stores.js +10 -13
- package/dist/boot/web-admin.d.ts +21 -15
- package/dist/boot/web-admin.js +16 -12
- package/dist/boot/workflow-orchestration.js +2 -9
- package/dist/brain.d.ts +11 -11
- package/dist/budget.d.ts +4 -4
- package/dist/budget.js +5 -1
- package/dist/caller-text-echo.d.ts +2 -0
- package/dist/caller-text-echo.js +2 -1
- package/dist/canonical-json.d.ts +2 -41
- package/dist/canonical-json.js +2 -13
- package/dist/capabilities/approvals-push.d.ts +4 -4
- package/dist/capabilities/builtin-tools.d.ts +5 -5
- package/dist/capabilities/center-plugins.d.ts +5 -5
- package/dist/capabilities/center-plugins.js +1 -1
- package/dist/capabilities/center-prompts.d.ts +1 -1
- package/dist/capabilities/center-wiring.d.ts +1 -1
- package/dist/capabilities/composite-members.d.ts +2 -2
- package/dist/capabilities/composite-members.js +1 -1
- package/dist/capabilities/execution-lane.d.ts +5 -5
- package/dist/capabilities/execution-lane.js +2 -2
- package/dist/capabilities/hands-lane.d.ts +5 -5
- package/dist/capabilities/mcp-probe.d.ts +10 -7
- package/dist/capabilities/mcp-probe.js +2 -2
- package/dist/capabilities/sandbox-file-send.d.ts +1 -18
- package/dist/capabilities/sandbox-file-send.js +0 -7
- package/dist/capabilities/scenarios.d.ts +28 -10
- package/dist/capabilities/scenarios.js +15 -5
- package/dist/capabilities/send-user-file-tool.d.ts +1 -1
- package/dist/capabilities/skills.d.ts +31 -12
- package/dist/capabilities/skills.js +23 -17
- package/dist/capabilities/tool-defer.d.ts +1 -1
- package/dist/capability-facts.d.ts +27 -24
- package/dist/capability-facts.js +18 -20
- package/dist/center-config-tier.d.ts +1 -1
- package/dist/center-credential.d.ts +4 -4
- package/dist/checkpoint-ctx-seal-m28.d.ts +42 -0
- package/dist/checkpoint-ctx-seal-m28.js +19 -0
- package/dist/checkpoint-identity.d.ts +5 -0
- package/dist/checkpoint-identity.js +14 -0
- package/dist/config-catalog.d.ts +12 -12
- package/dist/config-invariants.d.ts +4 -4
- package/dist/config-invariants.js +3 -2
- package/dist/config-lkg.d.ts +1 -1
- package/dist/config-provider.d.ts +13 -13
- package/dist/config-provider.js +2 -1
- package/dist/config-types.d.ts +83 -83
- package/dist/config.d.ts +26 -24
- package/dist/config.js +12 -10
- package/dist/cross-session-settings.d.ts +1 -1
- package/dist/delegated-session-owner.d.ts +16 -13
- package/dist/delegated-session-owner.js +9 -10
- package/dist/deployment-governance.d.ts +16 -16
- package/dist/deployment-shape.d.ts +127 -0
- package/dist/deployment-shape.js +72 -0
- package/dist/device-store.d.ts +1 -1
- package/dist/device-ws-hub.d.ts +1 -1
- package/dist/egress-redirect.d.ts +1 -1
- package/dist/entry-mode-clamp-notice.d.ts +2 -2
- package/dist/env-facts.d.ts +10 -9
- package/dist/env-facts.js +1 -1
- package/dist/env-name-allowlist-knobs.d.ts +5 -5
- package/dist/exec-bounds.d.ts +2 -2
- package/dist/execution-lane-caps.d.ts +31 -43
- package/dist/execution-lane-caps.js +0 -13
- package/dist/field-conflict.d.ts +2 -1
- package/dist/field-conflict.js +1 -0
- package/dist/file-history-capture.d.ts +9 -9
- package/dist/file-history-disclosure.d.ts +50 -9
- package/dist/file-history-disclosure.js +8 -13
- package/dist/fleet/drain-entry.d.ts +2 -2
- package/dist/fleet/fleet-bus.d.ts +26 -14
- package/dist/fleet/fleet-bus.js +6 -5
- package/dist/fleet/fleet-reconciler.d.ts +9 -9
- package/dist/fleet/subagent-tail-bus.d.ts +4 -4
- package/dist/fleet-client.d.ts +13 -13
- package/dist/fleet-lease.d.ts +16 -16
- package/dist/governance-http-status.d.ts +2 -2
- package/dist/hooks/hook-llm.d.ts +7 -7
- package/dist/hooks/hook-runner.d.ts +57 -30
- package/dist/hooks/hook-runner.js +38 -20
- package/dist/host-decision.d.ts +5 -5
- package/dist/host-lsp-manager.d.ts +5 -5
- package/dist/hosted-posture.d.ts +23 -13
- package/dist/hosted-posture.js +4 -9
- package/dist/http/admission.d.ts +2 -2
- package/dist/http/admission.js +28 -5
- package/dist/http/approval-sweeps.d.ts +1 -1
- package/dist/http/approval-sweeps.js +5 -2
- package/dist/http/checkpoint-ctx.d.ts +183 -2
- package/dist/http/checkpoint-ctx.js +197 -2
- package/dist/http/dispatch.d.ts +3 -3
- package/dist/http/dispatch.js +3 -3
- package/dist/http/durable-run-leg.js +7 -5
- package/dist/http/idempotency.d.ts +4 -4
- package/dist/http/idempotency.js +2 -2
- package/dist/http/mcp-dial-deadline.d.ts +7 -5
- package/dist/http/memory-compliance-failure-reply.d.ts +4 -4
- package/dist/http/owner-access.d.ts +4 -6
- package/dist/http/owner-access.js +1 -1
- package/dist/http/principal-gate.d.ts +39 -13
- package/dist/http/principal-gate.js +30 -6
- package/dist/http/readiness.d.ts +1 -1
- package/dist/http/refusal-body.d.ts +12 -0
- package/dist/http/refusal-body.js +11 -0
- package/dist/http/request-guards.d.ts +4 -13
- package/dist/http/request-guards.js +4 -17
- package/dist/http/resume-ctx-read.d.ts +53 -6
- package/dist/http/resume-ctx-read.js +26 -3
- package/dist/http/resume-legs.d.ts +5 -4
- package/dist/http/resume-legs.js +47 -29
- package/dist/http/route-ctx.d.ts +29 -38
- package/dist/http/route-table.d.ts +9 -9
- package/dist/http/routes/agents-roster.d.ts +1 -1
- package/dist/http/routes/agents-roster.js +2 -3
- package/dist/http/routes/approvals-assistant.d.ts +5 -5
- package/dist/http/routes/approvals-assistant.js +91 -17
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/background.js +2 -2
- package/dist/http/routes/capabilities.d.ts +1 -1
- package/dist/http/routes/capabilities.js +16 -8
- package/dist/http/routes/config-catalog.d.ts +1 -1
- package/dist/http/routes/devices.d.ts +1 -1
- package/dist/http/routes/diagnostics.d.ts +6 -6
- package/dist/http/routes/diagnostics.js +1 -1
- package/dist/http/routes/fleet.d.ts +1 -1
- package/dist/http/routes/fleet.js +5 -4
- package/dist/http/routes/mcp-reconnect.d.ts +4 -4
- package/dist/http/routes/mcp-reconnect.js +3 -3
- package/dist/http/routes/memory-consolidation.d.ts +1 -1
- package/dist/http/routes/memory-origin.d.ts +1 -1
- package/dist/http/routes/notify-wake.d.ts +1 -1
- package/dist/http/routes/notify-wake.js +2 -2
- package/dist/http/routes/rules.d.ts +1 -1
- package/dist/http/routes/rules.js +4 -4
- package/dist/http/routes/runs.js +44 -11
- package/dist/http/routes/session-sync.d.ts +3 -2
- package/dist/http/routes/session-sync.js +109 -62
- package/dist/http/routes/sessions-list.d.ts +1 -1
- package/dist/http/routes/sessions-list.js +4 -5
- package/dist/http/routes/sessions.js +34 -48
- package/dist/http/routes/tasks.d.ts +1 -1
- package/dist/http/routes/tasks.js +21 -16
- package/dist/http/routes/trace-usage.d.ts +1 -1
- package/dist/http/routes/trace-usage.js +7 -9
- package/dist/http/routes/workflows.d.ts +3 -0
- package/dist/http/routes/workflows.js +31 -28
- package/dist/http/send.d.ts +5 -5
- package/dist/http/server.d.ts +39 -33
- package/dist/http/server.js +5 -2
- package/dist/http/session-inherit-env.d.ts +3 -3
- package/dist/http/sse-lifecycle.d.ts +1 -1
- package/dist/http/sse-log.d.ts +2 -2
- package/dist/http/submit-ctx.d.ts +4 -3
- package/dist/http/submit-ctx.js +19 -3
- package/dist/http/sync-submit-body.d.ts +1 -1
- package/dist/http/verify-rounds.d.ts +1 -1
- package/dist/http/wire-types.d.ts +35 -24
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/instruction-source-notice.d.ts +2 -2
- package/dist/key-resolver.d.ts +3 -3
- package/dist/lane-home-probe.d.ts +1 -1
- package/dist/leader/diffout.d.ts +1 -1
- package/dist/leader/diffup.d.ts +2 -2
- package/dist/leader/endpoint.d.ts +1 -1
- package/dist/leader/fanout.d.ts +1 -1
- package/dist/leader/leader.d.ts +4 -4
- package/dist/leader/merge.d.ts +3 -3
- package/dist/leader/repair-wire.d.ts +1 -1
- package/dist/leader/wire.d.ts +9 -5
- package/dist/leader/wire.js +8 -7
- package/dist/list-entry-display.d.ts +1 -1
- package/dist/lsp-evict.d.ts +1 -1
- package/dist/main.js +1 -1
- package/dist/mcp-assertion-header.d.ts +1 -1
- package/dist/memory-layer-legacy-lock.d.ts +1 -1
- package/dist/memory-operator-faces.d.ts +1 -1
- package/dist/memory-origin-fence.js +2 -2
- package/dist/memory-posture.js +4 -2
- package/dist/memory-project-layer.d.ts +1 -1
- package/dist/memory-scope.d.ts +19 -19
- package/dist/memory-store-refusal.d.ts +4 -4
- package/dist/model-compat.d.ts +1 -1
- package/dist/model-entry-headers.d.ts +2 -2
- package/dist/model-entry-refusal.d.ts +17 -17
- package/dist/model-provider.d.ts +10 -10
- package/dist/model-reach-scope.d.ts +1 -1
- package/dist/model-route-endpoint.d.ts +6 -6
- package/dist/model-route-url.d.ts +5 -5
- package/dist/model-select.d.ts +15 -6
- package/dist/model-select.js +5 -0
- package/dist/model-unreachable-notice.d.ts +3 -3
- package/dist/namespaced-rule-name.d.ts +15 -5
- package/dist/namespaced-rule-name.js +3 -2
- package/dist/observability/corrupt-read-seat.d.ts +9 -9
- package/dist/observability/cost-taxonomy.d.ts +1 -1
- package/dist/observability/err-text.d.ts +1 -1
- package/dist/observability/fail-open.d.ts +12 -8
- package/dist/observability/fail-open.js +12 -8
- package/dist/observability/metrics.d.ts +3 -3
- package/dist/observability/prompt-manifest.d.ts +19 -8
- package/dist/observability/prompt-manifest.js +9 -8
- package/dist/observability/run-terminal.d.ts +36 -36
- package/dist/observability/secret-env-scrub.d.ts +3 -3
- package/dist/observability/tool-trace.d.ts +1 -1
- package/dist/observability/tool-trace.js +8 -9
- package/dist/operator-ask.d.ts +4 -4
- package/dist/orchestration/workflow-agent-session-index.d.ts +3 -3
- package/dist/orchestration/workflow-completion-inbox.d.ts +20 -5
- package/dist/orchestration/workflow-completion-inbox.js +29 -7
- package/dist/orchestration/workflow-notify-journal.d.ts +43 -19
- package/dist/orchestration/workflow-notify-journal.js +17 -0
- package/dist/orchestration/workflow-park-decision.d.ts +1 -1
- package/dist/orchestration/workflow-park-decision.js +1 -0
- package/dist/outbound-dispatcher.d.ts +4 -4
- package/dist/parent-watch.d.ts +4 -4
- package/dist/parked-decide.d.ts +20 -20
- package/dist/parked-decide.js +8 -5
- package/dist/parked-revive-surface.d.ts +7 -7
- package/dist/parked-revive-surface.js +2 -3
- package/dist/peer-directory.d.ts +3 -3
- package/dist/peer-directory.js +1 -1
- package/dist/permission-rule-list.d.ts +10 -1
- package/dist/permission-rule-list.js +7 -5
- package/dist/permission-rule-vocab.d.ts +3 -25
- package/dist/permission-rule-vocab.js +0 -13
- package/dist/plugins/adoption-log-sql.d.ts +1 -1
- package/dist/plugins/approval-ask-store-file.d.ts +8 -1
- package/dist/plugins/approval-ask-store-file.js +6 -3
- package/dist/plugins/approval-ask-store-memory.d.ts +11 -7
- package/dist/plugins/approval-ask-store-memory.js +11 -7
- package/dist/plugins/approval-ask-store-sql.d.ts +34 -15
- package/dist/plugins/approval-ask-store-sql.js +18 -5
- package/dist/plugins/approval-exemption-store.d.ts +3 -3
- package/dist/plugins/approval-nonce-store.d.ts +3 -3
- package/dist/plugins/approval-payload-fingerprint.d.ts +14 -6
- package/dist/plugins/approval-payload-fingerprint.js +1 -1
- package/dist/plugins/background-agent-store-sql.d.ts +1 -1
- package/dist/plugins/background-shell-support.d.ts +2 -2
- package/dist/plugins/blob-backend.d.ts +1 -1
- package/dist/plugins/caching-session-store.d.ts +24 -33
- package/dist/plugins/caching-session-store.js +8 -19
- package/dist/plugins/checkpoint-index-columns.d.ts +81 -0
- package/dist/plugins/checkpoint-index-columns.js +62 -0
- package/dist/plugins/checkpoint-store-sql.d.ts +66 -67
- package/dist/plugins/checkpoint-store-sql.js +100 -103
- package/dist/plugins/device-store-sql.d.ts +7 -6
- package/dist/plugins/e2b-orphan-reclaim.d.ts +1 -1
- package/dist/plugins/ensure-schema-lock-policy.d.ts +1 -1
- package/dist/plugins/file-history-store-sql.d.ts +9 -7
- package/dist/plugins/file-history-store-sql.js +27 -15
- package/dist/plugins/file-run-store.d.ts +8 -8
- package/dist/plugins/fork-routing-session-store.d.ts +2 -2
- package/dist/plugins/fork-routing-session-store.js +1 -1
- package/dist/plugins/host-platform.d.ts +10 -10
- package/dist/plugins/image-bake-store-sql.d.ts +1 -1
- package/dist/plugins/image-index-sql.d.ts +1 -1
- package/dist/plugins/leader-run-store-sql.d.ts +1 -1
- package/dist/plugins/local-checkpoint-store.d.ts +23 -12
- package/dist/plugins/local-checkpoint-store.js +29 -4
- package/dist/plugins/local-session-store.d.ts +44 -45
- package/dist/plugins/local-session-store.js +42 -52
- package/dist/plugins/local-session-window.d.ts +12 -6
- package/dist/plugins/local-session-window.js +1 -17
- package/dist/plugins/mailbox-store-sql.d.ts +2 -2
- package/dist/plugins/memory-engine-pg.d.ts +1 -1
- package/dist/plugins/memory-run-store.d.ts +4 -4
- package/dist/plugins/memory-sync-store-pg.d.ts +3 -3
- package/dist/plugins/one-time-migrations.d.ts +76 -39
- package/dist/plugins/one-time-migrations.js +127 -34
- package/dist/plugins/outcome-ledger-sql.d.ts +1 -1
- package/dist/plugins/park-commit-watch.d.ts +3 -3
- package/dist/plugins/permission-rule-store-file.d.ts +5 -5
- package/dist/plugins/permission-rule-store-file.js +16 -19
- package/dist/plugins/permission-rule-store-sql.d.ts +38 -4
- package/dist/plugins/permission-rule-store-sql.js +74 -31
- package/dist/plugins/pg-cost-quota.d.ts +1 -1
- package/dist/plugins/pg-pool.d.ts +2 -2
- package/dist/plugins/pg-pool.js +5 -2
- package/dist/plugins/pg-rate-limiter.d.ts +1 -1
- package/dist/plugins/pg-session-storage.d.ts +9 -21
- package/dist/plugins/pg-session-storage.js +51 -42
- package/dist/plugins/remote-env-adb.d.ts +10 -10
- package/dist/plugins/remote-env-device.d.ts +22 -14
- package/dist/plugins/remote-env-device.js +28 -16
- package/dist/plugins/remote-env-e2b.d.ts +3 -3
- package/dist/plugins/remote-env-host.d.ts +16 -16
- package/dist/plugins/remote-env-k8s.d.ts +8 -8
- package/dist/plugins/remote-env-local-docker.d.ts +2 -2
- package/dist/plugins/remote-env-ssh.d.ts +4 -4
- package/dist/plugins/remote-scratchpad.d.ts +2 -3
- package/dist/plugins/remote-scratchpad.js +0 -4
- package/dist/plugins/remote-shell.d.ts +6 -6
- package/dist/plugins/retention-lane-store-sql.d.ts +4 -4
- package/dist/plugins/retention-store-sql.d.ts +4 -4
- package/dist/plugins/roster-store-sql.d.ts +1 -1
- package/dist/plugins/run-store-sql.d.ts +8 -8
- package/dist/plugins/schema-consistency.d.ts +2 -2
- package/dist/plugins/schema-ensure-legs.d.ts +3 -3
- package/dist/plugins/schema-indexes.d.ts +1 -1
- package/dist/plugins/schema-live-columns.d.ts +1 -1
- package/dist/plugins/session-event-payload.d.ts +4 -4
- package/dist/plugins/session-fork.d.ts +34 -0
- package/dist/plugins/session-fork.js +29 -0
- package/dist/plugins/session-ownership.d.ts +11 -0
- package/dist/plugins/session-ownership.js +11 -0
- package/dist/plugins/session-placement.d.ts +12 -14
- package/dist/plugins/session-placement.js +2 -15
- package/dist/plugins/session-policy-store-sql.d.ts +12 -12
- package/dist/plugins/session-store.d.ts +2 -2
- package/dist/plugins/session-store.js +2 -2
- package/dist/plugins/shared-memory-store-sql.d.ts +2 -2
- package/dist/plugins/sql-driver.d.ts +8 -8
- package/dist/plugins/sql-errors.d.ts +1 -1
- package/dist/plugins/sql-json-column.d.ts +21 -21
- package/dist/plugins/sql-row-helpers.d.ts +2 -2
- package/dist/plugins/store-backend.d.ts +17 -16
- package/dist/plugins/store-backend.js +3 -3
- package/dist/plugins/store-contracts.d.ts +21 -21
- package/dist/plugins/task-attachment-store.d.ts +2 -2
- package/dist/plugins/task-list-store-sql.d.ts +1 -1
- package/dist/plugins/tidb-pool.d.ts +2 -2
- package/dist/plugins/tidb-pool.js +9 -2
- package/dist/plugins/tidb-session-store.d.ts +17 -27
- package/dist/plugins/tidb-session-store.js +52 -42
- package/dist/plugins/tool-result-store-sql.d.ts +1 -1
- package/dist/plugins/usage-window-store-sql.d.ts +3 -3
- package/dist/plugins/user-input-ledger-file.d.ts +1 -1
- package/dist/plugins/user-input-ledger-sql.d.ts +3 -3
- package/dist/plugins/web-search.d.ts +19 -5
- package/dist/plugins/web-search.js +19 -4
- package/dist/{orchestration/workflow-journal-entry.d.ts → plugins/workflow-journal-payload.d.ts} +23 -32
- package/dist/plugins/workflow-journal-payload.js +32 -0
- package/dist/plugins/workflow-journal-store-sql.d.ts +28 -14
- package/dist/plugins/workflow-journal-store-sql.js +34 -15
- package/dist/plugins/workflow-run-store-sql.d.ts +4 -4
- package/dist/posture-source.d.ts +11 -11
- package/dist/principal-jwt.d.ts +6 -6
- package/dist/project-identity.d.ts +3 -3
- package/dist/project-memory.d.ts +4 -4
- package/dist/read-face-posture.d.ts +7 -7
- package/dist/request-key-closure.d.ts +1 -1
- package/dist/request-key-closure.js +1 -1
- package/dist/request-tool-axes.d.ts +12 -0
- package/dist/request-tool-axes.js +20 -0
- package/dist/request-value-closure.d.ts +15 -8
- package/dist/request-value-closure.js +2 -0
- package/dist/router/route-orchestration.d.ts +11 -16
- package/dist/router/route-orchestration.js +2 -12
- package/dist/rule-entry-list.d.ts +8 -7
- package/dist/rule-entry-list.js +2 -9
- package/dist/rules-consent.d.ts +6 -6
- package/dist/rules-consent.js +2 -0
- package/dist/run-cancel-context.d.ts +5 -5
- package/dist/run-local.d.ts +10 -10
- package/dist/run-local.js +1 -0
- package/dist/runs.d.ts +15 -12
- package/dist/runs.js +19 -4
- package/dist/runtime-caps-resolver.d.ts +6 -6
- package/dist/runtime-governance.d.ts +9 -9
- package/dist/sandbox-pkg-source.d.ts +9 -31
- package/dist/sandbox-pkg-source.js +14 -8
- package/dist/sealed-key.d.ts +34 -2
- package/dist/sealed-key.js +55 -1
- package/dist/security.d.ts +31 -32
- package/dist/security.js +12 -9
- package/dist/server-secret-env.d.ts +10 -10
- package/dist/session-children-retire.d.ts +1 -1
- package/dist/session-error-wire.d.ts +19 -12
- package/dist/session-error-wire.js +4 -1
- package/dist/session-incarnation.d.ts +52 -35
- package/dist/session-incarnation.js +23 -8
- package/dist/session-policy-wire.d.ts +27 -5
- package/dist/session-policy-wire.js +15 -1
- package/dist/session-records-skipped-notice.d.ts +1 -1
- package/dist/session-sync-kernel.d.ts +38 -11
- package/dist/session-sync-kernel.js +10 -0
- package/dist/session-sync.d.ts +49 -6
- package/dist/session-sync.js +52 -10
- package/dist/session-titler.d.ts +7 -6
- package/dist/session-titler.js +8 -13
- package/dist/session-watch.d.ts +3 -3
- package/dist/session-watch.js +4 -4
- package/dist/sighup-idle.d.ts +2 -2
- package/dist/spec-fields.d.ts +4 -4
- package/dist/sql-engine-posture.d.ts +3 -3
- package/dist/store-posture.d.ts +2 -2
- package/dist/stored-request-tool-axes-m19.d.ts +1 -1
- package/dist/task-a2a.d.ts +3 -1
- package/dist/task-a2a.js +38 -5
- package/dist/task-cwd.d.ts +7 -88
- package/dist/task-cwd.js +2 -15
- package/dist/task-mcp.d.ts +14 -10
- package/dist/task-mcp.js +39 -12
- package/dist/task-settings.d.ts +34 -18
- package/dist/task-settings.js +34 -4
- package/dist/task-workflow.d.ts +0 -24
- package/dist/task-workflow.js +2 -1
- package/dist/terminal.d.ts +5 -5
- package/dist/tighten-only-seats.d.ts +7 -6
- package/dist/tighten-only-seats.js +1 -1
- package/dist/tool-approval.d.ts +273 -228
- package/dist/tool-approval.js +125 -47
- package/dist/tool-rule-names.d.ts +7 -1
- package/dist/trace/core-keyset-guard.d.ts +15 -9
- package/dist/trace/engine-notice-wire.d.ts +5 -5
- package/dist/trace/engine-notice-wire.js +1 -0
- package/dist/trace/exit-seat.d.ts +40 -1
- package/dist/trace/exit-seat.js +46 -14
- package/dist/trace/ledger-events.d.ts +6 -4
- package/dist/trace/ledger-sink.d.ts +1 -1
- package/dist/trace/model-segment.d.ts +3 -3
- package/dist/trace/project.d.ts +65 -46
- package/dist/trace/project.js +49 -5
- package/dist/trace/redact.d.ts +44 -27
- package/dist/trace/redact.js +343 -73
- package/dist/trace/self-minted-wire.d.ts +39 -14
- package/dist/trace/self-minted-wire.js +9 -0
- package/dist/trace/sema-provenance.d.ts +1 -1
- package/dist/trace/task-notification-facets.d.ts +4 -4
- package/dist/trace/wire-projection-faces.d.ts +9 -3
- package/dist/trace/wire-projection-faces.js +7 -1
- package/dist/unattended-permission-mode.d.ts +5 -5
- package/dist/url-credential.d.ts +52 -0
- package/dist/url-credential.js +49 -0
- package/dist/url-refusal.d.ts +6 -2
- package/dist/url-refusal.js +8 -1
- package/dist/usage-analytics.d.ts +2 -2
- package/dist/user-input-ledger.d.ts +23 -23
- package/dist/web-admin-client/apply-effective.d.ts +5 -5
- package/dist/web-admin-client/apply-effective.js +2 -1
- package/dist/web-admin-client/apply-ledger.d.ts +2 -2
- package/dist/web-admin-client/center-request.d.ts +2 -2
- package/dist/web-admin-client/facade.d.ts +5 -5
- package/dist/web-admin-client/facade.js +1 -1
- package/dist/web-admin-client/hot-keys-registry.d.ts +2 -2
- package/dist/web-admin-client/http-client.d.ts +4 -4
- package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
- package/dist/web-admin-client/pull-state.d.ts +1 -1
- package/dist/web-admin-client/read-face.d.ts +2 -2
- package/dist/web-admin-client/read-warnings.d.ts +5 -5
- package/dist/web-admin-client/restart-signal.d.ts +6 -6
- package/dist/web-admin-client/skills-mcp.d.ts +29 -4
- package/dist/web-admin-client/skills-mcp.js +31 -4
- package/dist/web-admin-client/types.d.ts +17 -10
- package/dist/workspace-space.d.ts +5 -3
- package/dist/write-protection.d.ts +2 -2
- package/package.json +4 -3
- package/scripts/drain-check-local.mjs +35 -2
- package/scripts/drain-check.mysql.sql +22 -2
- package/scripts/drain-check.pg.sql +22 -2
- package/skills/loop.md +1 -1
- package/dist/mcp-tool-faces.d.ts +0 -69
- package/dist/mcp-tool-faces.js +0 -104
- package/dist/orchestration/workflow-journal-entry.js +0 -27
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
import { readMcpSourceLabel } from "../mcp-source-label.js";
|
|
2
|
-
import { readMcpToolFaces } from "../mcp-tool-faces.js";
|
|
3
2
|
import { skillContentHash } from "@sema-agent/settings-schema";
|
|
4
|
-
import { readMcpToolAxes } from "@sema-agent/core";
|
|
3
|
+
import { readMcpToolAxes, readToolFaces } from "@sema-agent/core";
|
|
5
4
|
import { MCP_CONTENT_ORIGINS, describeBadContentOrigin, describeBadWireName, isContentOriginWord, isUsableWireName } from "@sema-agent/settings-schema";
|
|
6
5
|
import { noteMcpAssertionHeaderNotSent, sentMcpAssertionHeaderMember, withholdsMcpAssertionHeader } from "../mcp-assertion-header.js";
|
|
7
6
|
import { SHA256_HEX_RE } from "../digest-form.js";
|
|
7
|
+
export function skillToolListsOf(source) {
|
|
8
|
+
return {
|
|
9
|
+
...(source.allowedTools !== undefined ? { allowedTools: [...source.allowedTools] } : {}),
|
|
10
|
+
...(source.disallowedTools !== undefined ? { disallowedTools: [...source.disallowedTools] } : {}),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function sameToolList(a, b) {
|
|
14
|
+
if (a === undefined || b === undefined)
|
|
15
|
+
return a === b;
|
|
16
|
+
return a.length === b.length && a.every((entry, i) => entry === b[i]);
|
|
17
|
+
}
|
|
18
|
+
export function installedSkillMatchesManifest(installed, m) {
|
|
19
|
+
const canonScenarios = (a) => [...(a ?? [])].sort().join("\u0000");
|
|
20
|
+
const lists = skillToolListsOf(m);
|
|
21
|
+
return (installed.spec.name === m.name &&
|
|
22
|
+
skillContentHash(installed.spec.content) === m.contentHash &&
|
|
23
|
+
installed.spec.description === m.description &&
|
|
24
|
+
canonScenarios(installed.scenarios) === canonScenarios(m.scenarios) &&
|
|
25
|
+
sameToolList(installed.spec.allowedTools, lists.allowedTools) &&
|
|
26
|
+
sameToolList(installed.spec.disallowedTools, lists.disallowedTools));
|
|
27
|
+
}
|
|
28
|
+
export function skillManifestEntriesNotInstalled(installed, entries) {
|
|
29
|
+
const winners = new Map();
|
|
30
|
+
for (const m of entries)
|
|
31
|
+
if (m.enabled !== false)
|
|
32
|
+
winners.set(m.name, m);
|
|
33
|
+
return [...winners.values()].filter((m) => !installed.some((sk) => installedSkillMatchesManifest(sk, m)));
|
|
34
|
+
}
|
|
8
35
|
function skillBodyPresent(body) {
|
|
9
36
|
return body !== undefined && body !== "";
|
|
10
37
|
}
|
|
@@ -64,7 +91,7 @@ export async function applySkillsManifest(baseline, manifest, bodies, logger) {
|
|
|
64
91
|
}
|
|
65
92
|
contentCache.set(m.contentHash, content);
|
|
66
93
|
const overrodeBuiltin = byName.has(m.name);
|
|
67
|
-
byName.set(m.name, { spec: { name: m.name, description: m.description, content }, scenarios: m.scenarios ?? [] });
|
|
94
|
+
byName.set(m.name, { spec: { name: m.name, description: m.description, content, ...skillToolListsOf(m) }, scenarios: m.scenarios ?? [], source: "center" });
|
|
68
95
|
logger?.info("web_admin_skill", { name: m.name, hash: m.contentHash, scenarios: m.scenarios, overrodeBuiltin });
|
|
69
96
|
}
|
|
70
97
|
catch (err) {
|
|
@@ -116,7 +143,7 @@ export function resolveMcpServers(mcp, logger) {
|
|
|
116
143
|
});
|
|
117
144
|
}
|
|
118
145
|
const source = readMcpSourceLabel(s.name, s.source);
|
|
119
|
-
const facesRead =
|
|
146
|
+
const facesRead = readToolFaces(s.toolFaces);
|
|
120
147
|
if (!facesRead.ok) {
|
|
121
148
|
logger?.warn("web_admin_mcp_tool_faces_invalid", {
|
|
122
149
|
server: s.name,
|
|
@@ -48,7 +48,7 @@ export interface CenterModel {
|
|
|
48
48
|
* 此后记账,不回算窗口内历史(registry types.d.ts 同句契约)。 */
|
|
49
49
|
quotaWeight?: number;
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* [ref](settings-schema 1.10.0 `ModelEntry.compat`)—— 这条目录条目对 **openai-completions 线路**的
|
|
52
52
|
* 兼容声明,上 core `Model.compat`(`OpenAICompletionsCompat` 五键)。真需求 = vLLM / Qwen 类**缺省开
|
|
53
53
|
* 思考**的网关:关思考只能靠 `thinkingFormat: "qwen-chat-template"`(`chat_template_kwargs.
|
|
54
54
|
* enable_thinking=false`),而 `extraBody` 穿不过引擎的 OpenAI 保留键表。
|
|
@@ -82,9 +82,9 @@ export interface CenterModel {
|
|
|
82
82
|
* the missing leg made every promptGuidance pilot a false control). */
|
|
83
83
|
promptGuidance?: string[];
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
85
|
+
* [ref](7.108.0)—— 这条条目发给供应商的**附加请求头**(部署 ↔ 供应商的契约;今天只有 `anthropic-beta`),上 core 的 per-model
|
|
86
86
|
* 头座 `Model.headers`。类型是 `unknown` 而不是那个结构,理由与 {@link CenterModel.compat} 逐字同:本类型是承载形,判据(闭集白名单 +
|
|
87
|
-
* 线路 + 值形)与坏形处置的单一属主是 `model-entry-headers.ts`(执法点 =
|
|
87
|
+
* 线路 + 值形)与坏形处置的单一属主是 `model-entry-headers.ts`(执法点 = [ref] 逐条判据,判不过 ⇒ 条目不可用)。
|
|
88
88
|
* ⚠️ 两条读腿今天**剥掉**它(settings-schema 6.3.0 `ModelEntry` 无此键;候裁加字段):今天到得了这里的只有绕过读腿的输入。
|
|
89
89
|
*/
|
|
90
90
|
headers?: unknown;
|
|
@@ -102,6 +102,13 @@ export interface CenterSkillManifest {
|
|
|
102
102
|
scenarios: string[];
|
|
103
103
|
contentHash: string;
|
|
104
104
|
enabled?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* 技能自带的两只工具名单(settings-schema 14.4.0 `SkillSpec.allowedTools?` / `disallowedTools?`,与引擎 `SkillSpec` 同名同形)。**缺席 ⇒ 键不出现;在场 ⇒ 整只数组原样
|
|
107
|
+
* 交给引擎**(逐条按作者所写:不去重 / 不排序 / 不判拼写;`[]` 与缺席是两种承运形,读成什么由引擎定)。本仓只承载,不判 —— 判官是引擎(拒侧读成空的条目 fail-closed)。
|
|
108
|
+
* 承运单点 = {@link skillToolListsOf}(`skills-mcp.ts`):本地腿投影与 manifest → 引擎规格的铸点读同一只。
|
|
109
|
+
*/
|
|
110
|
+
allowedTools?: string[];
|
|
111
|
+
disallowedTools?: string[];
|
|
105
112
|
}
|
|
106
113
|
/** MCP server registry entry. `envRefs`/`headerRefs` are env-NAME refs (target-key → ENV_NAME), NOT secrets. */
|
|
107
114
|
export interface CenterMcpServer {
|
|
@@ -137,7 +144,7 @@ export interface CenterMcpServer {
|
|
|
137
144
|
* 自动翻红逼销账。
|
|
138
145
|
*/
|
|
139
146
|
contentOrigin?: ToolContentOrigin;
|
|
140
|
-
/**
|
|
147
|
+
/** [ref] / [ref]:声明方自述的分组标签(开集,非空 ≤80;settings-schema 1.7.0 `McpServerSpec.source`)——上 core
|
|
141
148
|
* `McpServerSpec.source`,由 `wiring_manifest.mcp[].source` 逐字回显。显示用,不进信任轴。 */
|
|
142
149
|
source?: string;
|
|
143
150
|
/**
|
|
@@ -147,18 +154,18 @@ export interface CenterMcpServer {
|
|
|
147
154
|
*
|
|
148
155
|
* 🔴 类型是 `unknown` 而不是那个结构,**刻意的**:本类型是两条 center 腿的**承载形**(本地 config.d 经
|
|
149
156
|
* settings-schema 的 `z.unknown()` 解析透明地过来、远端 /effective 是直读 JSON),判据与坏形处置的单一
|
|
150
|
-
*
|
|
157
|
+
* 属主是引擎根导出的 `readToolFaces`(`resolveMcpServers` 在铸 spec 那一刻调它)。在承载
|
|
151
158
|
* 形上先写一个结构,等于把同一张判据表抄成两份(而其中一份没有执行力)。
|
|
152
159
|
*/
|
|
153
160
|
toolFaces?: unknown;
|
|
154
161
|
/**
|
|
155
|
-
*
|
|
162
|
+
* [ref](settings-schema 12.2.x `McpServerSpec.toolAxes`,解析透明 `z.unknown()`)—— 部署侧为这台 server 的**每只工具**声明的
|
|
156
163
|
* 风险轴(`effect` / `egress` / `irreversibility`),键 = server 的**原始(未加命名空间)**工具名,上 core
|
|
157
164
|
* `McpServerSpec.toolAxes`。
|
|
158
165
|
*
|
|
159
166
|
* 🔴 类型是 `unknown` 而不是那个结构,**刻意的**(与 {@link CenterMcpServer.toolFaces} 逐字同姿):本类型是两条部署腿的**承载形**
|
|
160
167
|
* (本地 config.d 经 `z.unknown()` 解析透明地过来、远端 /effective 是直读 JSON),形判与投影的单一属主是**引擎**根导出的
|
|
161
|
-
* `readMcpToolAxes`(core 7.51.2
|
|
168
|
+
* `readMcpToolAxes`(core 7.51.2 [ref];`resolveMcpServers` 在铸 spec 那一刻调它;产出的型是引擎的 `McpServerSpec["toolAxes"]`;本仓自铸的那一只
|
|
162
169
|
* 7.129.0 退役)。坏形 ⇒ 整条 server 不进 + 一行 `web_admin_mcp_tool_axes_invalid`。
|
|
163
170
|
* (同批解析透明键 `authForm` / `entryKind` 的语义归连接器,本层仍只承载。)
|
|
164
171
|
*/
|
|
@@ -290,7 +297,7 @@ export interface EffectiveConfig {
|
|
|
290
297
|
atMention?: unknown;
|
|
291
298
|
tierGroups?: unknown;
|
|
292
299
|
activeTierGroup?: string;
|
|
293
|
-
/** 🔴
|
|
300
|
+
/** 🔴 [ref] / [ref] —— **本仓读腿铸的**载体(不是 wire 键:中心在模型域里写同名键会被 schema 当未知键剥掉并进候选门):这次读
|
|
294
301
|
* 被 schema 逐条丢掉的**每一条**目录条目一行(下标 + settings-schema 闭集词 `reasonCode` + 告警自带的 `identity` + 字段诊断;形与律见
|
|
295
302
|
* `read-warnings.ts` {@link DroppedCatalogEntry})。读者各取所需:模型面 stage 把有名且启用的行铸成 `config.model_entry_invalid` 墓碑
|
|
296
303
|
* (不变量 `refused-names-not-minted` 据此判增广),每一行与 `models` 同 commit 进 `config.droppedCatalogEntries`(`GET /v1/models.droppedEntries` 的源)。
|
|
@@ -353,7 +360,7 @@ export interface EffectiveConfig {
|
|
|
353
360
|
/** settings-schema 0.6 起治理三件(autonomy/commandPolicy/approvalRequire)的**唯一**承运域(0.7.1 撤
|
|
354
361
|
* runtime 位双写镜像;顺序契约当年已走完:消费端先切、center 再撤)。键集与 schema `GovernanceConfig.shape`
|
|
355
362
|
* 逐字相等([ref] 件3 对账门钉)。消费:autonomy/commandPolicy 逐请求热(`stageRuntimeHot`,boot+refresh);
|
|
356
|
-
* approvalRequire 自
|
|
363
|
+
* approvalRequire 自 [ref] 波 2 起同样热(`stageApprovalGate`,boot+refresh 双腿,有自己的拒绝臂)。
|
|
357
364
|
* 同一 presence 规则(undefined = 不管 → 回 env 基线,非粘)。 */
|
|
358
365
|
governance?: {
|
|
359
366
|
autonomy?: Autonomy;
|
|
@@ -379,7 +386,7 @@ export interface EffectiveConfig {
|
|
|
379
386
|
* ruling riding the caps view. `required=false` / ruling absent = no enforcement (legacy). `allowedLanes` is
|
|
380
387
|
* an OPEN value domain (adding one is never BREAKING; consumers tolerate unknown names). Known lane names:
|
|
381
388
|
* `host`/`e2b`/`k8s`/`ssh`/`adb`/`local-docker`/`device` (the REMOTE_EXEC providers) **plus `in-process`**
|
|
382
|
-
* — the REMOTE_EXEC-unset fleet posture (
|
|
389
|
+
* — the REMOTE_EXEC-unset fleet posture ([ref]: previously "OA/review-style workers", a scenario family retired in 5.0.0; named distinctly from the explicit
|
|
383
390
|
* `host` lane on purpose). ⚠️ Admins writing `required=true` policies must include `in-process` when such
|
|
384
391
|
* workers should stay admittable — center UI/doc 词表待补齐。
|
|
385
392
|
*
|
|
@@ -90,9 +90,11 @@ export interface EndedSpace {
|
|
|
90
90
|
readonly sessionId: string;
|
|
91
91
|
readonly spaceKey: string;
|
|
92
92
|
}
|
|
93
|
-
/** The closed word set of `workspace_cache_reclaim_failed.reason` —
|
|
94
|
-
*
|
|
95
|
-
|
|
93
|
+
/** The closed word set of `workspace_cache_reclaim_failed.reason` — said by the ONE reclaim seat (`plugins/remote-env-k8s.ts`). The
|
|
94
|
+
* session-delete coordinator's third word (`occupant_unreadable`, a second read of the deleted session's occupant that could fail on its own)
|
|
95
|
+
* is retired: the coordinator takes the space key from the same head read its owner fence judges (`boot/session-faces.ts`), so there is
|
|
96
|
+
* no second read to fail — a head read that throws fails the delete itself (retried to convergence). */
|
|
97
|
+
export type CacheReclaimReason = "delete_failed" | "budget";
|
|
96
98
|
/**
|
|
97
99
|
* The ONE reclaim seat for an ended space — called where a space ENDS: the session-delete coordinator (`boot/session-faces.ts` `purgeSession`)
|
|
98
100
|
* and the managed-retention sweep after it deletes session trees (`boot/retention-lane.ts`); neither writes a reclaim of its own. It reclaims
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref] —— **写保护表**(core `RunnerDeps.writeProtectedPaths` 座)的姿态推导点(形制照
|
|
3
3
|
* `memory-posture.ts` / `sql-engine-posture.ts`:一次推导,两个读面)。
|
|
4
4
|
*
|
|
5
|
-
* ## 病(
|
|
5
|
+
* ## 病([ref] F2 的根)
|
|
6
6
|
*
|
|
7
7
|
* core 的写保护表是**字面名表**(CC `DANGEROUS_FILES` / `DANGEROUS_DIRECTORIES` /
|
|
8
8
|
* `DANGEROUS_DIRECTORY_PATHS` 三形对位):一次落在表行上的可定路径写(Write/Edit/NotebookEdit)会把
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/server",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.135.0",
|
|
4
4
|
"description": "Sema Server — the server/API implementation layer for Sema, wiring core, registry, model providers, and cloud agent execution. Built on @sema-agent/core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"build:binary:run-local:darwin-arm64": "bun build --compile --target=bun-darwin-arm64 src/run-local.ts --outfile dist/run-local-darwin-arm64"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@sema-agent/core": "7.
|
|
72
|
-
"@sema-agent/settings-schema": "14.
|
|
71
|
+
"@sema-agent/core": "7.55.0",
|
|
72
|
+
"@sema-agent/settings-schema": "14.4.0",
|
|
73
73
|
"e2b": "^2.28.0",
|
|
74
74
|
"libsodium-wrappers": "^0.8.4",
|
|
75
75
|
"mysql2": "^3.22.4",
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"@types/ws": "^8.18.1",
|
|
93
93
|
"ajv": "^8.20.0",
|
|
94
94
|
"ajv-formats": "^3.0.1",
|
|
95
|
+
"core-mixed-version-reader": "npm:@sema-agent/core@7.54.1",
|
|
95
96
|
"tsx": "4.19.2",
|
|
96
97
|
"typescript": "5.7.2",
|
|
97
98
|
"vitest": "^4.1.8",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* 换钉前的**排空检查 —— `DB_BACKEND=local`(File 店)车道**,只读。随 npm 包出(`scripts/drain-check-local.mjs`)。
|
|
4
|
-
*
|
|
4
|
+
* 一次跑**九条判据**(判据表 {@link DRAIN_CRITERIA},每条一行末行、各自的命中行;SQL 车道的同一判据是同目录随包的 `drain-check.mysql.sql` / `drain-check.pg.sql`,
|
|
5
5
|
* 每条判据一段、段首标记 `-- drain-check:<判据名>:<后端>`,判据名与本表的 `name` 同一个词):
|
|
6
6
|
* · `skill-grants-rollback`(**回滚**到 7.115.x 前,即引擎从 7.41 退回 7.40):四样任一 ——
|
|
7
7
|
* ① pending 行带 `state.skillGrants`(本次 run 冻结在行上的技能授予行:模型激活 / 子代捕获写下的放行与禁止);
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
* `dist/orchestration/workflow-agent-session-index.js` 取 —— 本脚本只按 runId 折叠;读不出的行计入 `corrupt`(rc 2:读不出的那一行可能正是点名某张待批卡的那一份);
|
|
32
32
|
* 窗与删码:本判据是一次性迁移 M9 的读侧半场 —— 窗口与删码清单见引擎启动期一次性迁移登记表(one-time-migrations)M9 一行,随 M9 一起删;这里不写第二份窗。
|
|
33
33
|
* · `parked-tool-lists`(升级到 7.132.0 前)/ `own-tool-lists-rollback`(从 7.132.0 回滚前):停驻行记下的工具名清单 / 7.52 写下的 `ownToolLists`(判据与出路见判据表那两条的注);
|
|
34
|
+
* · `sealed-credentials-rollback`(从 7.134.0 回滚前):续跑上下文的凭据位上带封签的 pending 行(7.133.x 读不懂封签,续跑时把这些位当没有;判据与出路见判据表那一条的注);
|
|
34
35
|
* · `retired-mode-seed`(换钉 7.113.0 前,core 7.39.0 删掉退役 mode-seed 的一次性迁移):pending 行的 `state.inheritedGate` 仍带退役成员;
|
|
35
36
|
* · `permissions-allow-list`(换钉 7.117.0 前,本服务把 `settings.permissions.allow` 整份交给引擎的 allow 层):pending 行所在会话的续跑上下文
|
|
36
37
|
* (`checkpoint-ctx/*.json` 的信封 `{ sessionId, updatedAt, ctx }`)里,`ctx.body.settings.permissions.allow` 是非空数组,且 `ctx.permissionsAllowReading` 不是 `"allow_layer"`
|
|
@@ -74,6 +75,7 @@
|
|
|
74
75
|
* `SKILL-DENY-INERT-ROW token=<token> sessionId=<id> createdAt=<ms> member=<skills|agents.skills>` /
|
|
75
76
|
* `WORKFLOW-PARK-ROW token=<token> sessionId=<id> createdAt=<ms> runId=<点名它的 run,逗号连接>` /
|
|
76
77
|
* `PARKED-TOOL-LISTS-ROW token=<token> sessionId=<id> createdAt=<ms> member=<toolCeiling|constraintChain|boundGrantDigest>` / `OWN-TOOL-LISTS-ROW token=<token> sessionId=<id> createdAt=<ms>` /
|
|
78
|
+
* `SEALED-CREDENTIALS-ROW token=<token> sessionId=<id> createdAt=<ms> field=<第一处带封签的凭据位>|runId=<workflow 子代卡:点它的 run>` /
|
|
77
79
|
* `ALLOW-LIST-ROW token=<token> sessionId=<id> createdAt=<ms>` / `RETIRED-ROW token=<token> sessionId=<id> createdAt=<ms> member=<成员>`;
|
|
78
80
|
* · 每条判据一行末行(表序;`RETIRED-MODE-SEED` 那一行恒在最后,7.113.0 起读「最后一行」的下游不受影响;`PERMISSIONS-ALLOW-LIST` 仍是倒数第二行):
|
|
79
81
|
* `SKILL-GRANTS rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
@@ -82,6 +84,7 @@
|
|
|
82
84
|
* `WORKFLOW-PARK-HOLDER rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
83
85
|
* `PARKED-TOOL-LISTS rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
84
86
|
* `OWN-TOOL-LISTS-ROLLBACK rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
87
|
+
* `SEALED-CREDENTIALS-ROLLBACK rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
85
88
|
* `PERMISSIONS-ALLOW-LIST rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
86
89
|
* `RETIRED-MODE-SEED rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`;
|
|
87
90
|
* `corrupt` = 共用扫描的坏记录 + 这条判据自己读不懂的旁路输入(`permissions-allow-list`:读不懂的 ctx 档,文件名进 stderr —— 一份读不懂的 ctx 可能正是某条 pending 行带 `allow` 的那一份;
|
|
@@ -97,7 +100,7 @@ import { join } from "node:path";
|
|
|
97
100
|
import { fileURLToPath } from "node:url";
|
|
98
101
|
|
|
99
102
|
/** 从脚本隔壁的编译产物取来的服务判据(脚本不持第二份实现)。
|
|
100
|
-
* @typedef {{ allowListReadingUnstated: (ctx: Record<string, unknown>) => boolean, retiredSkillManifestLayerOf: (body: unknown) => "skills" | "agents.skills" | undefined, skillDenyInertEntryOf: (body: unknown) => { layer: "skills" | "agents.skills", message: string } | undefined, readAgentSessionLedgerLine: (v: unknown) => { runId: string, rows: Array<{ sessionId: string }> } | undefined }} ServiceCriteria */
|
|
103
|
+
* @typedef {{ allowListReadingUnstated: (ctx: Record<string, unknown>) => boolean, sealedCredentialFieldOf: (ctx: unknown) => string | undefined, retiredSkillManifestLayerOf: (body: unknown) => "skills" | "agents.skills" | undefined, skillDenyInertEntryOf: (body: unknown) => { layer: "skills" | "agents.skills", message: string } | undefined, readAgentSessionLedgerLine: (v: unknown) => { runId: string, rows: Array<{ sessionId: string }> } | undefined }} ServiceCriteria */
|
|
101
104
|
|
|
102
105
|
/** 读期间文件在变时的有界重读次数(含第一次)。 */
|
|
103
106
|
const STABLE_READ_ATTEMPTS = 3;
|
|
@@ -460,6 +463,35 @@ export const DRAIN_CRITERIA = [
|
|
|
460
463
|
load: () => ({ input: undefined, corrupt: 0, unreadable: [] }),
|
|
461
464
|
judge: (row) => (isObject(row.state) && Object.hasOwn(/** @type {Record<string, unknown>} */ (row.state), "ownToolLists") ? "" : undefined),
|
|
462
465
|
},
|
|
466
|
+
{
|
|
467
|
+
// 从 7.134.0 回滚到 7.133.x 之前:pending 行所在会话的续跑上下文里,提交体的凭据位(MCP / A2A 请求头与 env、settings.env、settings.webSearch.apiKey、http hook 请求头;7.135.0 起另有 command hook 的插件选项)
|
|
468
|
+
// (从 7.135.0 回滚到 7.134.x 之前同用本判据:7.134.x 不认插件选项上的封签,续跑时那份 hooks 整只不采纳;本判据数任何凭据位上的封签,这一类在候选里)
|
|
469
|
+
// 上带封签 —— 7.134.0 封好才落盘,7.133.x 读不懂封签、续跑时把这些位当作没有(无凭据照跑、不报错)。出路:回滚前把它们决掉或取消(随包 `MIGRATION.md` 7.134.0 节)。
|
|
470
|
+
// 判据函数是服务里那一只(`sealedCredentialFieldOf`,经编译产物 `dist/http/checkpoint-ctx.js` 取;走法与封口 / 开口 / 一次性迁移同一只),本脚本不写第二份;
|
|
471
|
+
// 命中行点名第一处凭据位(`field=`,键名;值从不出来);读不懂的 ctx 档 / 索引账本行计入 `corrupt`(rc 2)。
|
|
472
|
+
// 读哪一份续跑上下文与续跑腿同:workflow 子代卡(子会话被 park 索引点名)续跑读**发起会话**那一份,而发起会话记在引擎的 run 账里(引擎自己的账本格式,本脚本不重抄)
|
|
473
|
+
// ⇒ 子代卡数的是真超集:自己那一份带封签,或数据根里任一份 ctx 带封签,即记为候选并点名点它的 run(`runId=`)—— 与随包 SQL 孪生同为超集,不漏。
|
|
474
|
+
// 表序在 `permissions-allow-list` 之前 —— 那一条仍倒数第二、`RETIRED-MODE-SEED` 仍最后。
|
|
475
|
+
name: "sealed-credentials-rollback",
|
|
476
|
+
tail: "SEALED-CREDENTIALS-ROLLBACK",
|
|
477
|
+
hit: "SEALED-CREDENTIALS-ROW",
|
|
478
|
+
load: (root, service) => {
|
|
479
|
+
const idx = readCtxIndex(root);
|
|
480
|
+
const parks = readParkIndex(root, service.readAgentSessionLedgerLine);
|
|
481
|
+
const fieldOf = service.sealedCredentialFieldOf;
|
|
482
|
+
const anySealed = [...idx.bySession.values()].some((ctx) => fieldOf(ctx) !== undefined);
|
|
483
|
+
return { input: { bySession: idx.bySession, fieldOf, parkedBy: parks.bySession, anySealed }, corrupt: idx.corrupt + parks.corrupt, unreadable: [...idx.unreadable, ...parks.unreadable] };
|
|
484
|
+
},
|
|
485
|
+
judge: (row, input) => {
|
|
486
|
+
const { bySession, fieldOf, parkedBy, anySealed } = /** @type {{ bySession: Map<string, Record<string, unknown>>, fieldOf: ServiceCriteria["sealedCredentialFieldOf"], parkedBy: Map<string, string[]>, anySealed: boolean }} */ (input);
|
|
487
|
+
if (typeof row.sessionId !== "string") return undefined;
|
|
488
|
+
const ctx = bySession.get(row.sessionId);
|
|
489
|
+
const field = ctx === undefined ? undefined : fieldOf(ctx);
|
|
490
|
+
if (field !== undefined) return ` field=${field}`;
|
|
491
|
+
const runs = parkedBy.get(row.sessionId);
|
|
492
|
+
return runs !== undefined && anySealed ? ` runId=${runs.join(",")}` : undefined;
|
|
493
|
+
},
|
|
494
|
+
},
|
|
463
495
|
{
|
|
464
496
|
name: "permissions-allow-list",
|
|
465
497
|
tail: "PERMISSIONS-ALLOW-LIST",
|
|
@@ -503,6 +535,7 @@ async function loadServiceCriteria(rootEcho) {
|
|
|
503
535
|
/** @type {Array<[string, () => Promise<Record<string, unknown>>, string]>} 〔产物相对路径(报告用), 取模块, 导出名〕 */
|
|
504
536
|
const wanted = [
|
|
505
537
|
["dist/http/checkpoint-ctx.js", () => import("../dist/http/checkpoint-ctx.js"), "allowListReadingUnstated"],
|
|
538
|
+
["dist/http/checkpoint-ctx.js", () => import("../dist/http/checkpoint-ctx.js"), "sealedCredentialFieldOf"],
|
|
506
539
|
["dist/http/retired-skill-manifest.js", () => import("../dist/http/retired-skill-manifest.js"), "retiredSkillManifestLayerOf"],
|
|
507
540
|
["dist/rule-entry-list.js", () => import("../dist/rule-entry-list.js"), "skillDenyInertEntryOf"],
|
|
508
541
|
["dist/orchestration/workflow-agent-session-index.js", () => import("../dist/orchestration/workflow-agent-session-index.js"), "readAgentSessionLedgerLine"],
|
|
@@ -8,15 +8,16 @@
|
|
|
8
8
|
-- sessions 命中行所在的会话 id,逗号连接,新的在前。以 hit_rows 为准:这一列被会话变量 group_concat_max_len(缺省 1024 字节)截断时,列出的会话数会少于 hit_rows ——
|
|
9
9
|
-- 先处理列出的再跑一次,或先在同一个会话里 SET SESSION group_concat_max_len = 1048576; 再跑本文件(本文件自己只含 SELECT)。
|
|
10
10
|
-- 每段只数 pending 行(已决 / 已过期的行不数);判据只看**键在不在 / 值形**,不读行的其余内容。
|
|
11
|
-
-- DB_BACKEND=local(File 店)没有 SQL:用同目录的 drain-check-local.mjs
|
|
11
|
+
-- DB_BACKEND=local(File 店)没有 SQL:用同目录的 drain-check-local.mjs,九条判据同名。
|
|
12
12
|
--
|
|
13
|
-
--
|
|
13
|
+
-- 九条判据(顺序同 drain-check-local.mjs 的判据表):
|
|
14
14
|
-- skill-grants-rollback 回滚到 7.115.x(引擎 7.40)之前:7.116.0 停驻的行带 7.40 不读的技能授予节 / 卡绑定 / 会话上下文里的人点名技能 / 还没被激活的技能声明的禁止清单。
|
|
15
15
|
-- retired-skill-manifest 升级到 7.116.0 之前:停驻、持久化提交体里技能(顶层 skills[] 或子代 agents[].skills[])还带已退役的 manifest 键。
|
|
16
16
|
-- skill-deny-inert 换钉 7.117.0 之前:停驻、提交体里技能(顶层 skills[] 或子代 agents[].skills[])的 disallowedTools 有引擎会读成空的条目的**候选**(见该段注)。
|
|
17
17
|
-- workflow-park-holder 换钉 7.118.0 之前 / 从 7.118.0 回滚到 7.117.x 之前:此刻待批、且子会话被 workflow park 索引点名的卡(workflow 子代卡;见该段注)。
|
|
18
18
|
-- parked-tool-lists 升级到 7.132.0 之前:停驻行记着子代工具天花板 / 冻结的父约束链 / Skill 卡的清单绑定(7.52 在认领前按规范拼写读它们)的**候选**(见该段注)。
|
|
19
19
|
-- own-tool-lists-rollback 从 7.132.0 回滚到 7.131.x 之前:7.132.0 停驻、带 state.ownToolLists 的行(7.131.x 读不了)。
|
|
20
|
+
-- sealed-credentials-rollback 从 7.134.0 回滚到 7.133.x(或从 7.135.0 回滚到 7.134.x)之前:停驻、续跑上下文里提交体的凭据位上带封签的行(7.133.x 读不懂封签,续跑时把这些位当没有)的**候选**(见该段注)。
|
|
20
21
|
-- permissions-allow-list 换钉 7.117.0 之前:停驻、提交体 settings.permissions.allow 是非空数组且读法记号不是当前的 "allow_layer"(无记号 = 名单时代;"statement" = 表态时代)。
|
|
21
22
|
-- retired-mode-seed 换钉 7.113.0 之前:检查点的 inheritedGate 里仍带退役 mode-seed 成员。
|
|
22
23
|
|
|
@@ -115,6 +116,25 @@ FROM checkpoint k
|
|
|
115
116
|
WHERE k.status = 'pending'
|
|
116
117
|
AND JSON_CONTAINS_PATH(k.checkpoint, 'one', '$.state.ownToolLists');
|
|
117
118
|
|
|
119
|
+
-- drain-check:sealed-credentials-rollback:mysql —— 期望 hit_rows = 0;每一行 = 一条**候选**:从 7.134.0 回滚到 7.133.x 后续跑会丢掉请求凭据的停驻行。
|
|
120
|
+
-- 在**回滚之前**、对 7.134.0 的数据跑:7.134.0 把续跑上下文里提交体的凭据位(MCP / A2A 请求头与 env、settings.env、settings.webSearch.apiKey、http hook 请求头;7.135.0 起另有 command hook 的插件选项)
|
|
121
|
+
-- 封成封签(对象,格式词 "checkpoint-ctx-sealedbox-v1")才落盘;7.133.x 读不懂封签,续跑时把这些位当作没有(无凭据照跑、不报错)。出路:回滚前把它们决掉或取消(见随包 MIGRATION.md 7.134.0 节)。
|
|
122
|
+
-- 读哪一份续跑上下文:与续跑腿同(连接形与 permissions-allow-list 段逐字同,理由见该段注)。SQL 不走凭据位闭集 ⇒ 数的是**真超集**:提交体里任何一处有一个
|
|
123
|
+
-- JSON 串值恰为这个格式词即数(封签只落在凭据位上;体里别处恰好写着这个词的串值也会被数到 —— 多数,不漏)。本地脚本同名判据走服务里那一只凭据位走法(精确)。
|
|
124
|
+
-- 从 7.135.0 回滚到 7.134.x 之前同用本判据:7.135.0 起 command hook 条目的插件选项(settings.hooks.<事件>[].hooks[].plugin.options)也封成封签,7.134.x 不认这一位,
|
|
125
|
+
-- 续跑时那份 hooks 整只不采纳(其中的守卫不再拦)。本判据数任何凭据位上带封签的行,所以这一类也在候选里(超集)。
|
|
126
|
+
SELECT 'sealed-credentials-rollback' AS criterion, COUNT(*) AS hit_rows,
|
|
127
|
+
COALESCE(GROUP_CONCAT(k.session_id ORDER BY k.created_at_ms DESC SEPARATOR ','), '') AS sessions
|
|
128
|
+
FROM checkpoint k
|
|
129
|
+
WHERE k.status = 'pending'
|
|
130
|
+
AND EXISTS (SELECT 1
|
|
131
|
+
FROM checkpoint kk
|
|
132
|
+
LEFT JOIN workflow_agent_session w ON w.session_id = kk.session_id
|
|
133
|
+
LEFT JOIN workflow_run r ON r.id = w.run_id
|
|
134
|
+
JOIN checkpoint_ctx c ON c.session_id = COALESCE(JSON_UNQUOTE(JSON_EXTRACT(r.run, '$.originatingSessionId')), kk.session_id)
|
|
135
|
+
WHERE kk.token = k.token
|
|
136
|
+
AND LOCATE('"checkpoint-ctx-sealedbox-v1"', CAST(JSON_EXTRACT(c.ctx, '$.body') AS CHAR)) > 0);
|
|
137
|
+
|
|
118
138
|
-- drain-check:permissions-allow-list:mysql —— 期望 hit_rows = 0;每一行 = 一条升级后续跑会被拒的停驻行。
|
|
119
139
|
-- 读哪一份续跑上下文:与续跑腿同 —— workflow 子代的停驻行(在 workflow_agent_session 里登记过)续跑时读的是**发起这条 workflow 的会话**那一份
|
|
120
140
|
-- (workflow_run.run 的 originatingSessionId);其余行读自己会话那一份。一个子会话可以被好几条 workflow 记录点名(续跑链 / 分叉;7.118.0 起索引主键是
|
|
@@ -7,15 +7,16 @@
|
|
|
7
7
|
-- hit_rows 命中的停驻行数(pending 行里算命中的那些);**全部为 0 才算排空**,非 0 ⇒ 逐条答完或取消(各判据对应的升级 / 回滚说明见随包 MIGRATION.md);
|
|
8
8
|
-- sessions 命中行所在的会话 id,逗号连接,新的在前。
|
|
9
9
|
-- 每段只数 pending 行(已决 / 已过期的行不数);判据只看**键在不在 / 值形**,不读行的其余内容。
|
|
10
|
-
-- DB_BACKEND=local(File 店)没有 SQL:用同目录的 drain-check-local.mjs
|
|
10
|
+
-- DB_BACKEND=local(File 店)没有 SQL:用同目录的 drain-check-local.mjs,九条判据同名。
|
|
11
11
|
--
|
|
12
|
-
--
|
|
12
|
+
-- 九条判据(顺序同 drain-check-local.mjs 的判据表):
|
|
13
13
|
-- skill-grants-rollback 回滚到 7.115.x(引擎 7.40)之前:7.116.0 停驻的行带 7.40 不读的技能授予节 / 卡绑定 / 会话上下文里的人点名技能 / 还没被激活的技能声明的禁止清单。
|
|
14
14
|
-- retired-skill-manifest 升级到 7.116.0 之前:停驻、持久化提交体里技能(顶层 skills[] 或子代 agents[].skills[])还带已退役的 manifest 键。
|
|
15
15
|
-- skill-deny-inert 换钉 7.117.0 之前:停驻、提交体里技能(顶层 skills[] 或子代 agents[].skills[])的 disallowedTools 有引擎会读成空的条目的**候选**(见该段注)。
|
|
16
16
|
-- workflow-park-holder 换钉 7.118.0 之前 / 从 7.118.0 回滚到 7.117.x 之前:此刻待批、且子会话被 workflow park 索引点名的卡(workflow 子代卡;见该段注)。
|
|
17
17
|
-- parked-tool-lists 升级到 7.132.0 之前:停驻行记着子代工具天花板 / 冻结的父约束链 / Skill 卡的清单绑定(7.52 在认领前按规范拼写读它们)的**候选**(见该段注)。
|
|
18
18
|
-- own-tool-lists-rollback 从 7.132.0 回滚到 7.131.x 之前:7.132.0 停驻、带 state.ownToolLists 的行(7.131.x 读不了)。
|
|
19
|
+
-- sealed-credentials-rollback 从 7.134.0 回滚到 7.133.x(或从 7.135.0 回滚到 7.134.x)之前:停驻、续跑上下文里提交体的凭据位上带封签的行(7.133.x 读不懂封签,续跑时把这些位当没有)的**候选**(见该段注)。
|
|
19
20
|
-- permissions-allow-list 换钉 7.117.0 之前:停驻、提交体 settings.permissions.allow 是非空数组且读法记号不是当前的 "allow_layer"(无记号 = 名单时代;"statement" = 表态时代)。
|
|
20
21
|
-- retired-mode-seed 换钉 7.113.0 之前:检查点的 inheritedGate 里仍带退役 mode-seed 成员。
|
|
21
22
|
|
|
@@ -123,6 +124,25 @@ FROM checkpoint k
|
|
|
123
124
|
WHERE k.status = 'pending'
|
|
124
125
|
AND (k.checkpoint -> 'state') ? 'ownToolLists';
|
|
125
126
|
|
|
127
|
+
-- drain-check:sealed-credentials-rollback:pg —— 期望 hit_rows = 0;每一行 = 一条**候选**:从 7.134.0 回滚到 7.133.x 后续跑会丢掉请求凭据的停驻行。
|
|
128
|
+
-- 在**回滚之前**、对 7.134.0 的数据跑:7.134.0 把续跑上下文里提交体的凭据位(MCP / A2A 请求头与 env、settings.env、settings.webSearch.apiKey、http hook 请求头;7.135.0 起另有 command hook 的插件选项)
|
|
129
|
+
-- 封成封签(对象,格式词 "checkpoint-ctx-sealedbox-v1")才落盘;7.133.x 读不懂封签,续跑时把这些位当作没有(无凭据照跑、不报错)。出路:回滚前把它们决掉或取消(见随包 MIGRATION.md 7.134.0 节)。
|
|
130
|
+
-- 读哪一份续跑上下文:与续跑腿同(连接形与 permissions-allow-list 段逐字同,理由见该段注)。SQL 不走凭据位闭集 ⇒ 数的是**真超集**:提交体里任何一处有一个
|
|
131
|
+
-- JSON 串值恰为这个格式词即数(封签只落在凭据位上;体里别处恰好写着这个词的串值也会被数到 —— 多数,不漏)。本地脚本同名判据走服务里那一只凭据位走法(精确)。
|
|
132
|
+
-- 从 7.135.0 回滚到 7.134.x 之前同用本判据:7.135.0 起 command hook 条目的插件选项(settings.hooks.<事件>[].hooks[].plugin.options)也封成封签,7.134.x 不认这一位,
|
|
133
|
+
-- 续跑时那份 hooks 整只不采纳(其中的守卫不再拦)。本判据数任何凭据位上带封签的行,所以这一类也在候选里(超集)。
|
|
134
|
+
SELECT 'sealed-credentials-rollback' AS criterion, count(*) AS hit_rows,
|
|
135
|
+
coalesce(string_agg(k.session_id, ',' ORDER BY k.created_at_ms DESC), '') AS sessions
|
|
136
|
+
FROM checkpoint k
|
|
137
|
+
WHERE k.status = 'pending'
|
|
138
|
+
AND EXISTS (SELECT 1
|
|
139
|
+
FROM checkpoint kk
|
|
140
|
+
LEFT JOIN workflow_agent_session w ON w.session_id = kk.session_id
|
|
141
|
+
LEFT JOIN workflow_run r ON r.id = w.run_id
|
|
142
|
+
JOIN checkpoint_ctx c ON c.session_id = COALESCE(r.run::json->>'originatingSessionId', kk.session_id)
|
|
143
|
+
WHERE kk.token = k.token
|
|
144
|
+
AND strpos((c.ctx -> 'body')::text, '"checkpoint-ctx-sealedbox-v1"') > 0);
|
|
145
|
+
|
|
126
146
|
-- drain-check:permissions-allow-list:pg —— 期望 hit_rows = 0;每一行 = 一条升级后续跑会被拒的停驻行。
|
|
127
147
|
-- 读哪一份续跑上下文:与续跑腿同 —— workflow 子代的停驻行(在 workflow_agent_session 里登记过)续跑时读的是**发起这条 workflow 的会话**那一份
|
|
128
148
|
-- (workflow_run.run 的 originatingSessionId);其余行读自己会话那一份。一个子会话可以被好几条 workflow 记录点名(续跑链 / 分叉;7.118.0 起索引主键是
|
package/skills/loop.md
CHANGED
|
@@ -35,7 +35,7 @@ Then briefly confirm what's scheduled (id, human cadence, how to cancel with `Cr
|
|
|
35
35
|
With no interval, run one iteration of the task now, then call `ScheduleWakeup` to schedule when you resume:
|
|
36
36
|
|
|
37
37
|
- `delaySeconds`: how long to sleep (runtime clamps to [60, 3600]).
|
|
38
|
-
- `reason`: one short, specific sentence ("watching CI run
|
|
38
|
+
- `reason`: one short, specific sentence ("watching the release-branch CI run" beats "waiting") — shown to the user and telemetry.
|
|
39
39
|
- `prompt`: the same /loop input verbatim, so the next firing re-enters this skill and continues the loop. For an autonomous loop with no user prompt, pass the literal sentinel `<<autonomous-loop-dynamic>>` (never the CronCreate-mode `<<autonomous-loop>>` sentinel — ScheduleWakeup always uses the `-dynamic` variant).
|
|
40
40
|
- To END the loop: call `ScheduleWakeup` with `stop: true` and omit every other field — the loop ends immediately and no further wakeups fire.
|
|
41
41
|
|
package/dist/mcp-tool-faces.d.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `McpServerSpec.toolFaces` —— MCP 工具的**面覆盖层**(core 7.8.0 [ref] §1.1/§2.7;声明面
|
|
3
|
-
* settings-schema 1.9.0)。一条规则、三条腿共用(请求腿 `task-mcp.ts normalizeServer` / center 腿
|
|
4
|
-
* `web-admin-client/skills-mcp.ts resolveMcpServers` / 本地 config.d 腿 `config-provider.ts` 只做承载),
|
|
5
|
-
* 与 {@link import("./mcp-source-label.js").readMcpSourceLabel} 同一个「判据单点、三腿一致」的形。
|
|
6
|
-
*
|
|
7
|
-
* ## 分工(为什么本层**不**复述 core 的那张表)
|
|
8
|
-
* 覆盖层的**语义**校验属 core 的摄入侧,而且只有它做得了:`pathTarget.param` 是不是这只工具**物化后
|
|
9
|
-
* schema** 的顶层属性、审批卡要的键在不在、`ruleFace` 指的是不是标量键 —— 三件都要看远端 server 真发
|
|
10
|
-
* 回来的 schema,本层手里根本没有。core 的处置也已经定死:不合 ⇒ **这只工具在这条腿上不挂**,并通告
|
|
11
|
-
* 一次 `config.tool_face_invalid`(亲读 `dist/core/runner/tool-face-overlay.js` 的 `return undefined` 臂 ——
|
|
12
|
-
* 该文件 d.ts 头注里那句「the tool mounts BARE」是**过期**的,以实现为准)。
|
|
13
|
-
*
|
|
14
|
-
* 本层因此只做 core 的校验器**假定成立**的那一件事:**JSON 结构合不合 TS 型**。理由是硬的 —— core 的
|
|
15
|
-
* `toolFaceProblem` 是按 TS 型写的,`renderHints.summaryParams` 是个字符串时它会 `.find is not a function`
|
|
16
|
-
* 地把 prepare 整条炸掉,`ruleFace.params` 是个数字时 `for...of` 直接抛。原样透传一份任意 JSON 不是
|
|
17
|
-
* 「解析透明」,是把类型错误变成运行期崩溃。
|
|
18
|
-
*
|
|
19
|
-
* 闭词(`family` / `pathTarget.access` / `renderHints.approvalCard`)判据**取自 core 的导出常量**
|
|
20
|
-
* (`TOOL_FAMILIES` / `TOOL_PATH_ACCESSES` / `TOOL_APPROVAL_CARDS`),本仓一个词都不枚举 —— 与
|
|
21
|
-
* `MCP_DELIVERY_VERDICTS` 的消费姿势同款:词表单一属主在 core,抄一遍就是抄了一张会漂的表。
|
|
22
|
-
*
|
|
23
|
-
* ## 坏形的方向:**整条 server 不进**(fail-closed)
|
|
24
|
-
* 🔴 这一条被 codex 对抗复审 r1 的 [high] **翻正过一次**,把翻正的理由留在这里,因为它是本模块最容易
|
|
25
|
-
* 想错的一格:初版按 `contentOrigin` 的先例判「丢声明、留 server + 留痕」,而那条先例管的是**放宽**键
|
|
26
|
-
* (丢它 ⇒ 回落到过度标记 = fail-closed 的那一侧)。`toolFaces` 是**收窄**声明:它声明的 `pathTarget`
|
|
27
|
-
* 正是敏感路径策略、写围栏、编辑跟踪读的那一格 —— 丢掉它,那只工具就**无面挂载**,运维声明的保护
|
|
28
|
-
* 静默失效。codex 实测(同一只 MCP 写工具、同一个 `/work/.env` 目标,仅把 `renderHints.summaryParams`
|
|
29
|
-
* 从数组写成字符串):`createSensitivePathPolicy` 从 deny 变成 allow。一条 warn 补偿不了这个方向。
|
|
30
|
-
*
|
|
31
|
-
* 所以判据回到本仓对**收窄键**已经成文的那一条(`task-mcp.ts` 的 `allowTools`,[ref] / [ref] codex F1):
|
|
32
|
-
* **一个键在场就必须合法,否则这条 server 整条不进**。三问逐条:
|
|
33
|
-
* ① 谁需要 —— 在部署侧给 MCP 工具声明写围栏 / 审批卡 / 显示名的运维;
|
|
34
|
-
* ② 谁受伤 —— 覆盖层写错的那台 server:它**整条**不挂(请求腿进 `dropped` 并点名上报,center 腿跳过
|
|
35
|
-
* 该条、兄弟 server 照挂)。代价是真的(少一套工具),但它**响亮且立刻**;反方向的代价是一条
|
|
36
|
-
* **静默失效的安全声明**,而后者按 [ref] 不许存在于安全轴上;
|
|
37
|
-
* ③ 拿什么补偿 —— 报出来的名字本身:请求腿 `mcp_injection_dropped{dropped:[name]}`、center 腿
|
|
38
|
-
* `web_admin_mcp_tool_faces_invalid{server,problem,note}` 一条点名 warn(`problem` 里带工具名与哪一段不合;运维照着改那一行即可)。
|
|
39
|
-
* 每只工具的面是**整只**判(core 明写 "applied whole or not at all");而**任一只**判不出形 ⇒ 整条 server
|
|
40
|
-
* 不进 —— 「留下好的那几只」同样是让坏的那一只无面挂载,与整张丢没有区别。
|
|
41
|
-
*/
|
|
42
|
-
import { type McpServerSpec } from "@sema-agent/core";
|
|
43
|
-
type ToolFaces = NonNullable<McpServerSpec["toolFaces"]>;
|
|
44
|
-
/**
|
|
45
|
-
* 一条 server 条目的 `toolFaces` 判形结果:
|
|
46
|
-
* · `{ ok: true, faces }` —— 合形(`faces` 缺席 = 这台 server 没有覆盖层,或声明了一个**空**覆盖层:
|
|
47
|
-
* 两者对 core 同义,都不铸键);
|
|
48
|
-
* · `{ ok: false, problem }` —— 判不出形,**整条 server 不进**(方向与理由见模块头注),`problem` 是
|
|
49
|
-
* 给运维的一句点名(只带工具名与哪一段不合,不带面的值)。
|
|
50
|
-
*/
|
|
51
|
-
export type McpToolFacesRead = {
|
|
52
|
-
ok: true;
|
|
53
|
-
faces?: ToolFaces;
|
|
54
|
-
} | {
|
|
55
|
-
ok: false;
|
|
56
|
-
problem: string;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* 从任一腿的原始条目里读出 `toolFaces` —— **三条腿共用的唯一判据点**。
|
|
60
|
-
* 缺席 ⇒ 合形无覆盖层;整只不是对象 / **任一只**工具的面判不出形 ⇒ `ok:false`(调用方整条 server 不收)。
|
|
61
|
-
*
|
|
62
|
-
* 🔴 工具名是 `__proto__` ⇒ 同样判不出形,**响亮拒**:按名存面的记录装不下它 —— JSON 的自有键 `"__proto__"` 写进记录那一步走的是原型的设置器,
|
|
63
|
-
* 键从结果里消失而判官答 `ok`,那条 server 照挂、收窄面叠层被无声丢掉。方向与本模块头注同(收窄声明在场就必须原样可用)。
|
|
64
|
-
* 只拒这一个名字:`constructor` / `toString` 等其余根原型成员名写进记录是普通自有键、不丢,引擎按名查面也取得到 —— 拒它们是给重放存量 body 的腿
|
|
65
|
-
* 新添一条「整条 server 不进」,不是修这个病。
|
|
66
|
-
*/
|
|
67
|
-
export declare function readMcpToolFaces(v: unknown): McpToolFacesRead;
|
|
68
|
-
export {};
|
|
69
|
-
//# sourceMappingURL=mcp-tool-faces.d.ts.map
|
package/dist/mcp-tool-faces.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { TOOL_APPROVAL_CARDS, TOOL_FAMILIES, TOOL_PATH_ABSENCES, TOOL_PATH_ACCESSES, TOOL_PATH_BASES } from "@sema-agent/core";
|
|
2
|
-
import { isStringArray } from "@sema-agent/settings-schema";
|
|
3
|
-
import { quotedCallerText } from "./caller-text-echo.js";
|
|
4
|
-
function isRecord(v) {
|
|
5
|
-
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
6
|
-
}
|
|
7
|
-
function memberOf(table, v) {
|
|
8
|
-
return typeof v === "string" && table.includes(v);
|
|
9
|
-
}
|
|
10
|
-
function onlyKeys(rec, allowed) {
|
|
11
|
-
return Object.keys(rec).every((k) => allowed.includes(k));
|
|
12
|
-
}
|
|
13
|
-
function readOneFace(raw) {
|
|
14
|
-
if (!isRecord(raw))
|
|
15
|
-
return undefined;
|
|
16
|
-
if (!onlyKeys(raw, ["family", "pathTarget", "renderHints", "ruleFace"]))
|
|
17
|
-
return undefined;
|
|
18
|
-
const out = {};
|
|
19
|
-
if (raw.family !== undefined) {
|
|
20
|
-
if (!memberOf(TOOL_FAMILIES, raw.family))
|
|
21
|
-
return undefined;
|
|
22
|
-
out.family = raw.family;
|
|
23
|
-
}
|
|
24
|
-
if (raw.pathTarget !== undefined) {
|
|
25
|
-
const pt = raw.pathTarget;
|
|
26
|
-
if (!isRecord(pt) || typeof pt.param !== "string" || !memberOf(TOOL_PATH_ACCESSES, pt.access))
|
|
27
|
-
return undefined;
|
|
28
|
-
if (!onlyKeys(pt, ["param", "access", "aliases", "skillScopeEligible", "base", "absent", "patternParam"]))
|
|
29
|
-
return undefined;
|
|
30
|
-
if (pt.aliases !== undefined && !isStringArray(pt.aliases))
|
|
31
|
-
return undefined;
|
|
32
|
-
if (pt.skillScopeEligible !== undefined && typeof pt.skillScopeEligible !== "boolean")
|
|
33
|
-
return undefined;
|
|
34
|
-
if (pt.base !== undefined && !memberOf(TOOL_PATH_BASES, pt.base))
|
|
35
|
-
return undefined;
|
|
36
|
-
if (pt.absent !== undefined && !memberOf(TOOL_PATH_ABSENCES, pt.absent))
|
|
37
|
-
return undefined;
|
|
38
|
-
if (pt.patternParam !== undefined && typeof pt.patternParam !== "string")
|
|
39
|
-
return undefined;
|
|
40
|
-
out.pathTarget = {
|
|
41
|
-
param: pt.param,
|
|
42
|
-
access: pt.access,
|
|
43
|
-
...(pt.aliases !== undefined ? { aliases: pt.aliases } : {}),
|
|
44
|
-
...(pt.skillScopeEligible === true ? { skillScopeEligible: true } : {}),
|
|
45
|
-
...(pt.base !== undefined ? { base: pt.base } : {}),
|
|
46
|
-
...(pt.absent !== undefined ? { absent: pt.absent } : {}),
|
|
47
|
-
...(pt.patternParam !== undefined ? { patternParam: pt.patternParam } : {}),
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
if (raw.renderHints !== undefined) {
|
|
51
|
-
const rh = raw.renderHints;
|
|
52
|
-
if (!isRecord(rh) || !onlyKeys(rh, ["userFacingName", "activity", "summaryParams", "resultCards", "approvalCard"]))
|
|
53
|
-
return undefined;
|
|
54
|
-
if (rh.userFacingName !== undefined && typeof rh.userFacingName !== "string")
|
|
55
|
-
return undefined;
|
|
56
|
-
if (rh.activity !== undefined && typeof rh.activity !== "string")
|
|
57
|
-
return undefined;
|
|
58
|
-
if (rh.summaryParams !== undefined && !isStringArray(rh.summaryParams))
|
|
59
|
-
return undefined;
|
|
60
|
-
if (rh.resultCards !== undefined && !isStringArray(rh.resultCards))
|
|
61
|
-
return undefined;
|
|
62
|
-
if (rh.approvalCard !== undefined && !memberOf(TOOL_APPROVAL_CARDS, rh.approvalCard))
|
|
63
|
-
return undefined;
|
|
64
|
-
out.renderHints = {
|
|
65
|
-
...(rh.userFacingName !== undefined ? { userFacingName: rh.userFacingName } : {}),
|
|
66
|
-
...(rh.activity !== undefined ? { activity: rh.activity } : {}),
|
|
67
|
-
...(rh.summaryParams !== undefined ? { summaryParams: rh.summaryParams } : {}),
|
|
68
|
-
...(rh.resultCards !== undefined ? { resultCards: rh.resultCards } : {}),
|
|
69
|
-
...(rh.approvalCard !== undefined ? { approvalCard: rh.approvalCard } : {}),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
if (raw.ruleFace !== undefined) {
|
|
73
|
-
const rf = raw.ruleFace;
|
|
74
|
-
if (!isRecord(rf) || !onlyKeys(rf, ["primaryParams", "params"]))
|
|
75
|
-
return undefined;
|
|
76
|
-
if (rf.primaryParams !== undefined && !isStringArray(rf.primaryParams))
|
|
77
|
-
return undefined;
|
|
78
|
-
if (rf.params !== undefined && !isStringArray(rf.params))
|
|
79
|
-
return undefined;
|
|
80
|
-
out.ruleFace = {
|
|
81
|
-
...(rf.primaryParams !== undefined ? { primaryParams: rf.primaryParams } : {}),
|
|
82
|
-
...(rf.params !== undefined ? { params: rf.params } : {}),
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
return out;
|
|
86
|
-
}
|
|
87
|
-
export function readMcpToolFaces(v) {
|
|
88
|
-
if (v === undefined)
|
|
89
|
-
return { ok: true };
|
|
90
|
-
if (!isRecord(v))
|
|
91
|
-
return { ok: false, problem: `toolFaces is ${Array.isArray(v) ? "an array" : typeof v}, not an object of per-tool faces` };
|
|
92
|
-
const faces = {};
|
|
93
|
-
for (const [tool, raw] of Object.entries(v)) {
|
|
94
|
-
if (tool === "__proto__") {
|
|
95
|
-
return { ok: false, problem: `toolFaces names tool "__proto__" — a per-tool record cannot hold a face under that name (writing it sets the record's prototype instead of a key), so the declaration would silently vanish` };
|
|
96
|
-
}
|
|
97
|
-
const face = readOneFace(raw);
|
|
98
|
-
if (face === undefined)
|
|
99
|
-
return { ok: false, problem: `the declared face for tool ${quotedCallerText(tool)} does not fit the tool-face shape` };
|
|
100
|
-
faces[tool] = face;
|
|
101
|
-
}
|
|
102
|
-
return Object.keys(faces).length > 0 ? { ok: true, faces } : { ok: true };
|
|
103
|
-
}
|
|
104
|
-
//# sourceMappingURL=mcp-tool-faces.js.map
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export function journalEntryPayload(entry) {
|
|
2
|
-
return entry.parked !== undefined ? { payload: entry.parked, parked: true } : { payload: entry.result, parked: false };
|
|
3
|
-
}
|
|
4
|
-
export function journalRowPayloadOf(entry) {
|
|
5
|
-
const { payload, parked } = journalEntryPayload(entry);
|
|
6
|
-
return JSON.stringify(parked ? { parked: payload } : payload);
|
|
7
|
-
}
|
|
8
|
-
export const readJournalRowBody = (body) => {
|
|
9
|
-
if (typeof body !== "object" || body === null || Array.isArray(body)) {
|
|
10
|
-
return { problem: "expected a JSON object (a TaskResult, or the `{parked: …}` envelope)" };
|
|
11
|
-
}
|
|
12
|
-
if (!Object.hasOwn(body, "parked"))
|
|
13
|
-
return { value: { parked: false, payload: body } };
|
|
14
|
-
const payload = body.parked;
|
|
15
|
-
if (typeof payload !== "object" || payload === null || Array.isArray(payload)) {
|
|
16
|
-
return { problem: "the `parked` envelope does not carry an object" };
|
|
17
|
-
}
|
|
18
|
-
const terminal = payload.terminal;
|
|
19
|
-
if (terminal === undefined || terminal.kind !== "paused") {
|
|
20
|
-
return { problem: `recorded as PARKED but its stored terminal is "${terminal === undefined ? "absent" : terminal.kind}" (expected "paused") — a park row that cannot be driven must not be replayed as a completed result` };
|
|
21
|
-
}
|
|
22
|
-
return { value: { parked: true, payload: { ...payload, terminal } } };
|
|
23
|
-
};
|
|
24
|
-
export function journalEntryOfBody(callKey, body) {
|
|
25
|
-
return body.parked ? { callKey, parked: body.payload } : { callKey, result: body.payload };
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=workflow-journal-entry.js.map
|