@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
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
* symbols WITHOUT touching the orchestration module — session-sync.ts value-imports StoreBackend and type-imports
|
|
7
7
|
* security's OwnerAwareSessionStore, so importing it from security.ts formed the repo's only true type cycle
|
|
8
8
|
* (security ↔ session-sync; lens2 §B/§E). This file imports nothing from the repo but TYPES from leaves (core types, and
|
|
9
|
-
* the session-face type from `session-incarnation.ts`, itself a leaf) — a leaf, same shape as session-sync-content.ts.
|
|
9
|
+
* the session-face type from `session-incarnation.ts`, itself a leaf) — a leaf, same shape as session-sync-content.ts. Its one VALUE import is
|
|
10
|
+
* core's `SessionError` class (the closed-set store error the three adapters already throw). session-sync.ts re-exports everything here, so existing import sites
|
|
10
11
|
* keep working unchanged.
|
|
11
12
|
*/
|
|
12
|
-
import type
|
|
13
|
+
import { SessionError, type SessionTreeEntry } from "@sema-agent/core";
|
|
13
14
|
import type { SessionFace } from "./session-incarnation.js";
|
|
14
15
|
/**
|
|
15
16
|
* P1d-β (PUSH streaming, sema-internal server/docs/DESIGN-session-sync.md §15 + the persistence synthesis) — a TWO-PHASE STAGED import
|
|
@@ -22,9 +23,10 @@ import type { SessionFace } from "./session-incarnation.js";
|
|
|
22
23
|
*
|
|
23
24
|
* Invariants the implementations uphold:
|
|
24
25
|
* - The staging rows live under `stagingId = ${realSessionId}#stg-${token}` (the `#` is illegal in a real uuidv7, so
|
|
25
|
-
* it can NEVER collide with a real session id) and have NO `session_meta` row → they are INVISIBLE to wake /
|
|
26
|
-
* / listSessions (the existing orphan invariant) until `commit`
|
|
27
|
-
* commit point
|
|
26
|
+
* it can NEVER collide with a real session id) and have NO `session_meta` row → they are INVISIBLE to wake / the head read (`headOf`)
|
|
27
|
+
* / listSessions (the existing orphan invariant) until `commit`'s transaction COMMITs the real session_meta row together
|
|
28
|
+
* with the swap (the sole commit point; a fresh push claims that row first inside the same txn, invisible to everyone else
|
|
29
|
+
* until COMMIT). A crash before commit leaves only collectable orphan staging rows, never a half-session.
|
|
28
30
|
* - `appendBatch` is IDEMPOTENT (INSERT … ON DUPLICATE KEY / ON CONFLICT DO NOTHING on the `(session_id, entry_id)`
|
|
29
31
|
* uk), so a re-streamed batch (a resumed Phase B) is a no-op.
|
|
30
32
|
* - `commit` re-classifies the relation IN-TXN against the dst's CURRENT entry ids (closing the Phase-A plan→commit
|
|
@@ -38,23 +40,48 @@ export interface StagingHandle {
|
|
|
38
40
|
/** Append a bounded batch of entries to the staging id, re-seq'd dense from a running counter held in the handle.
|
|
39
41
|
* Idempotent (ON DUPLICATE KEY / ON CONFLICT DO NOTHING) — a re-streamed batch is a no-op. One txn per batch. */
|
|
40
42
|
appendBatch(entries: SessionTreeEntry[]): Promise<void>;
|
|
41
|
-
/** ATOMICALLY swap the staged rows into the real session id (ONE txn):
|
|
42
|
-
*
|
|
43
|
-
*
|
|
43
|
+
/** ATOMICALLY swap the staged rows into the real session id (ONE txn): owner CAS ({@link StagedCommitOptions.expectedOwner},
|
|
44
|
+
* before anything about the row is classified or reported, so a refused commit reveals nothing about a row it did not judge — no
|
|
45
|
+
* placement, no relation, no entry ids) → in-txn re-classify
|
|
46
|
+
* (TOCTOU close) → purge dst → row-key rename staging→real → session_meta settled; COMMIT is the commit point. `owner` is re-stamped (§9).
|
|
47
|
+
* Throws {@link StagedCommitOwnerChangedError} when the owner cell is not the one the import's gate judged, and
|
|
48
|
+
* {@link SyncConflictError} on an unconsented fork/stale flip — both after rolling back. Returns the committed relation **and the settled session
|
|
44
49
|
* face** — the occupant (owner + incarnation) the commit left in the real session id, read INSIDE the same txn (the local
|
|
45
50
|
* store: the same hold of the session's write lock), never re-read afterwards. The post-commit replays conditioned on the
|
|
46
51
|
* occupant (the session row's two bits) write on exactly this face — a session deleted and re-created after the commit,
|
|
47
52
|
* even by the same owner, is a different occupant and is not written. A row without an incarnation is refused at that read
|
|
48
53
|
* (`sessionFaceFromRow`, the same law as every face read). */
|
|
49
|
-
commit(owner: string | null, opts
|
|
50
|
-
resolution?: "overwrite-dst";
|
|
51
|
-
}): Promise<{
|
|
54
|
+
commit(owner: string | null, opts: StagedCommitOptions): Promise<{
|
|
52
55
|
relation: SyncRelation["relation"];
|
|
53
56
|
face: SessionFace;
|
|
54
57
|
}>;
|
|
55
58
|
/** Drop the staging rows (Phase B aborted before commit) — DELETE the staging-id session_event rows. Idempotent. */
|
|
56
59
|
abort(): Promise<void>;
|
|
57
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* What a staged commit is conditioned on ([ref] — one gate predicate, two phases). `expectedOwner` = the owner cell the import's gate
|
|
63
|
+
* judged when it opened the staging, in the head-read reading (`headOf(id)?.owner`): `undefined` = no such session (a fresh push), `null` = ownerless, a string =
|
|
64
|
+
* that owner. The route judges `mayTouch` on that cell at Phase A and again on the session's current cell right before Phase B commits; the
|
|
65
|
+
* commit itself lands only on that same cell — each store compares it inside the commit txn (local: inside the session's write lock) and, when
|
|
66
|
+
* the cell differs, rolls back and throws {@link StagedCommitOwnerChangedError} without writing a byte. The compare is on the owner cell, not
|
|
67
|
+
* on the incarnation: the gate's predicate reads only the owner (plus placement, which the commit gate refuses on its own), so a same-owner
|
|
68
|
+
* re-create is judged the same and is not a reason to refuse.
|
|
69
|
+
*/
|
|
70
|
+
export interface StagedCommitOptions {
|
|
71
|
+
readonly expectedOwner: string | null | undefined;
|
|
72
|
+
readonly resolution?: "overwrite-dst";
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The staged commit's owner CAS did not hold: the session's owner cell at commit time is not the one the import's gate judged (another replica
|
|
76
|
+
* deleted / re-created / claimed / created the session while the import streamed). Code = core's closed-set `conflict` (wire: the import face's
|
|
77
|
+
* row in `session-error-wire.ts`, 409); thrown after the commit txn rolled back — the destination is untouched. The three stores throw this one
|
|
78
|
+
* class (one sentence, minted here).
|
|
79
|
+
*/
|
|
80
|
+
export declare class StagedCommitOwnerChangedError extends SessionError {
|
|
81
|
+
constructor(sessionId: string);
|
|
82
|
+
}
|
|
83
|
+
/** The owner-cell comparison of {@link StagedCommitOptions.expectedOwner} against a store's own owner read (`headOf(id)?.owner`; `undefined` = no row). */
|
|
84
|
+
export declare function ownerCellIs(expectedOwner: string | null | undefined, actual: string | null | undefined): boolean;
|
|
58
85
|
/** A session store that can stage a streamed import (P1d-β). The 3 backends implement it; the in-memory dev store
|
|
59
86
|
* does not → the method is optional (the route 501s when absent, parity with the other §0.5 optional seams). */
|
|
60
87
|
export type ImportStagingStore = {
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import { SessionError } from "@sema-agent/core";
|
|
2
|
+
export class StagedCommitOwnerChangedError extends SessionError {
|
|
3
|
+
constructor(sessionId) {
|
|
4
|
+
super("conflict", `session ${sessionId}: owner changed while the import streamed — the staged commit was rolled back`);
|
|
5
|
+
this.name = "StagedCommitOwnerChangedError";
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export function ownerCellIs(expectedOwner, actual) {
|
|
9
|
+
return expectedOwner === undefined ? actual === undefined : actual !== undefined && (actual ?? null) === expectedOwner;
|
|
10
|
+
}
|
|
1
11
|
export function stagingIdFor(realSessionId, token) {
|
|
2
12
|
return `${realSessionId}#stg-${token}`;
|
|
3
13
|
}
|
package/dist/session-sync.d.ts
CHANGED
|
@@ -45,12 +45,31 @@
|
|
|
45
45
|
*/
|
|
46
46
|
import type { StoreBackend } from "./plugins/store-backend.js";
|
|
47
47
|
import { type SyncRelation } from "./session-sync-kernel.js";
|
|
48
|
-
import { type SessionTreeEntry, type SessionRulesRecord, type FileHistoryExport, type FileHistoryResult, type SessionPermissionRules, type StoredSessionRules, type SessionPolicyStore } from "@sema-agent/core";
|
|
48
|
+
import { type SessionTreeEntry, type SessionRulesRecord, type FileHistoryError, type FileHistoryExport, type FileHistoryResult, type SessionPermissionRules, type StoredSessionRules, type SessionPolicyStore } from "@sema-agent/core";
|
|
49
49
|
import type { ServiceFileHistoryStore, ServiceSessionPolicyStore, ResumeAnchorStore } from "./plugins/store-backend.js";
|
|
50
|
+
/**
|
|
51
|
+
* core 7.55.0 [ref] T2([ref]):一只会话的文件历史**读不全**(撕裂 / 读不出的边界、读不出的跟踪集 —— 店的 `exportHistory` 答 `{ ok: false }`,`adopt_failed`
|
|
52
|
+
* 带店判的 `permanence`)。它**不是**「没有历史」:读成 `null` 的同步会把这只会话的全部 rewind 历史丢在路上、还答成功。会话同步的两只拉取口
|
|
53
|
+
* (manifest、history blob)对它答同一句 503 `state.file_history_unreadable`(路由 `sendFileHistoryUnreadable`)。
|
|
54
|
+
*/
|
|
55
|
+
export declare class FileHistoryUnreadableError extends Error {
|
|
56
|
+
readonly sessionId: string;
|
|
57
|
+
readonly failure: FileHistoryError;
|
|
58
|
+
readonly code = "state.file_history_unreadable";
|
|
59
|
+
constructor(sessionId: string, failure: FileHistoryError);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 一只会话的文件历史导出 —— `exportHistory` 三臂的**唯一读法**(会话同步两只拉取口都经它):`{ ok: true, history }` ⇒ 信封;`{ ok: true, history: null }`
|
|
63
|
+
* ⇒ `null`(没有可导出的,null 的唯一意思);`{ ok: false }` ⇒ 抛 {@link FileHistoryUnreadableError}(读不全不是没有)。店不带 `exportHistory` ⇒ 不是 2c 历史源 ⇒ `null`。
|
|
64
|
+
*/
|
|
65
|
+
export declare function exportedFileHistory(store: Pick<ServiceFileHistoryStore, "exportHistory">, sessionId: string): Promise<FileHistoryExport | null>;
|
|
50
66
|
/** A blob getter: content-addressed bytes for a sha256 hash, or `undefined` if the source can't supply them.
|
|
51
67
|
* Returned by {@link exportSessionManifest} (closes over the source store); consumed wherever a caller pulls
|
|
52
68
|
* content-addressed history bytes lazily (the live PUSH route's `importHistory` replay). */
|
|
53
69
|
export type BlobGetter = (hash: string) => Promise<Uint8Array | undefined>;
|
|
70
|
+
/** 一只文件历史店自己的 blob 取值口({@link BlobGetter}):店带 `getBlob` ⇒ 绑在店上;没有这条面(core 的 local 文件店)⇒ 恒答 `undefined`(「这里取不到」)。
|
|
71
|
+
* 拉取面(manifest 的 `getBlob`)、identical 自愈臂、提交臂三处读同一只,不各写一份「无面则 undefined」。 */
|
|
72
|
+
export declare function blobGetterOf(store: Pick<ServiceFileHistoryStore, "getBlob">): BlobGetter;
|
|
54
73
|
/** The history-import capability face of a `FileHistoryStore` (`importHistory` is OPTIONAL on the core
|
|
55
74
|
* contract — a store without it cannot be a 2c history sink). */
|
|
56
75
|
export interface FileHistoryImportFace {
|
|
@@ -61,6 +80,21 @@ export interface FileHistoryImportFace {
|
|
|
61
80
|
* `undefined` when absent. Callers gate on the RETURN VALUE, not a separate `typeof` check, so there is
|
|
62
81
|
* exactly one place that knows the shape of the probe. */
|
|
63
82
|
export declare function fileHistoryImportFace(fs: unknown): FileHistoryImportFace | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* {@link replayFileHistory} 的结果 = 店的 {@link FileHistoryResult};失败臂可再带 `missingBlob` —— 这一次尝试里**重放自己交给店的 getter 亲口答过 `undefined`** 的那枚 hash
|
|
85
|
+
* (「这枚 blob 不在」是 getter 观察到的事实,不是从店码里猜的:同一个 `adopt_failed` 也可能是取值抛了 / 发布步撞上库的故障,那两形 `missingBlob` 缺席)。
|
|
86
|
+
* 下发口({@link sendFileHistoryReplayFailure} 在路由里)据它铸 wire `missing_blob`,否则原样送店的码。
|
|
87
|
+
*/
|
|
88
|
+
export type FileHistoryReplayResult = {
|
|
89
|
+
readonly ok: true;
|
|
90
|
+
} | {
|
|
91
|
+
readonly ok: false;
|
|
92
|
+
readonly error: FileHistoryError;
|
|
93
|
+
readonly missingBlob?: string;
|
|
94
|
+
};
|
|
95
|
+
export type FileHistoryReplayFailure = Extract<FileHistoryReplayResult, {
|
|
96
|
+
ok: false;
|
|
97
|
+
}>;
|
|
64
98
|
/**
|
|
65
99
|
* The 2c PUSH replay of a session's file-history graph — keep-SOURCE convergence over core's
|
|
66
100
|
* non-destructive-target law. `importHistory` refuses a target that already holds a DIFFERENT graph
|
|
@@ -75,10 +109,14 @@ export declare function fileHistoryImportFace(fs: unknown): FileHistoryImportFac
|
|
|
75
109
|
* is left EMPTY — worse than the moment before this call, but strictly self-healing: the client re-PUTs
|
|
76
110
|
* the blob and re-POSTs, and the retry lands on an empty target (importHistory's first-import arm).
|
|
77
111
|
* The alternative (keeping the old graph) would wedge every retry on the same typed conflict forever.
|
|
112
|
+
*
|
|
113
|
+
* 缺 blob 的事实只在这里读一次:每次尝试给店的 getter 都包一层观察,店取到 `undefined` 就记下那枚 hash(按次计,替换臂的第二次尝试从空白起),
|
|
114
|
+
* 失败时随结果交出({@link FileHistoryReplayResult.missingBlob})。预检({@link sessionSyncFileHistory} 事实 + `hasBlobs`)管「这台部署根本收不到 / 索引里没有」,
|
|
115
|
+
* 这里管「预检过了而这一枚取不到」(对象存储里已丢 / 校验和不符按缺席读 / 预检与重放之间被孤儿回收清走)—— 同一只不变量的两端,wire 上同一个词。
|
|
78
116
|
*/
|
|
79
117
|
export declare function replayFileHistory(store: ServiceFileHistoryStore, scope: string, envelope: FileHistoryExport, srcGetBlob: BlobGetter, opts: {
|
|
80
118
|
allowReplace: boolean;
|
|
81
|
-
}): Promise<
|
|
119
|
+
}): Promise<FileHistoryReplayResult>;
|
|
82
120
|
/**
|
|
83
121
|
* The portable state of ONE session, ready to replay into another backend. Blobs are deliberately NOT inlined
|
|
84
122
|
* (§5: a turn's working-tree blobs can be tens of MiB → OOM/413 if buffered); each snapshot carries only its
|
|
@@ -147,7 +185,7 @@ export interface SessionManifest {
|
|
|
147
185
|
* with the history store's own export verb.)
|
|
148
186
|
*/
|
|
149
187
|
export declare function exportSessionManifest(sessionId: string, srcBackend: StoreBackend,
|
|
150
|
-
/**
|
|
188
|
+
/** [ref]:文件历史读**装配结果**(捕获脸),不直取 `srcBackend.fileHistory()` —— 「这台部署有没有文件历史店」
|
|
151
189
|
* 只在 `assembleFileHistory` 判一次。同一个后端铸的同一只店,四店同源的不变式不变。 */
|
|
152
190
|
historyStore: ServiceFileHistoryStore): Promise<{
|
|
153
191
|
manifest: SessionManifest;
|
|
@@ -165,14 +203,19 @@ export declare function planSync(sessionId: string, srcBackend: StoreBackend, ds
|
|
|
165
203
|
* 无条件写都 rev+1,而 rev 是 operator 乐观锁的 CAS 令牌(`PutRulesOptions.expectedRev`),
|
|
166
204
|
* 幂等重试/无害重复同步不该把在途 CAS 打失败。归一化用 core 的 `normalizeRules`(store 落盘
|
|
167
205
|
* 前走同一函数 ⇒ 两侧同坐标);它略过店的戳 `rev` / `gen`(`listBySession` 的 rules 含 rev,
|
|
168
|
-
* 它不是内容;core 7.51.0
|
|
206
|
+
* 它不是内容;core 7.51.0 [ref] 起 `normalizeRules` 自己略过,修前的 `stripRev` 包裹随之退役)。
|
|
169
207
|
* 两侧过的是同一只形读法(core 7.51.0 `readSessionRulesShape`):`incoming` 由写口读者(引擎的写口判官)交出,`stored` 由店的读回交出 ——
|
|
170
208
|
* 店读回读不出形的行答 `corrupt`、根本到不了这里,所以 `normalizeRules` 对两侧都不抛(修前本仓的读回比引擎宽,另有一只判官先挡一次)。
|
|
171
209
|
* 🔴 字节同 ≠ 意思同(core 7.51.2 行自带文法戳;codex r1 [high] 验真):`normalizeRules` 把店的戳 `rev` / `gen` / `grammar` 都略过,而同一串桶字节在两种文法里是两句话 ——
|
|
172
210
|
* 目的行无戳(文法 0:`toolAllow` 里的 `Bash(rm:*)` 什么都不放行)、导入记录带 `grammar: 1`(放行 rm),只比字节会判「同内容」、零次 putRules、同步答 200 而目的行仍是旧意思。
|
|
173
211
|
* 所以字节同之外还问引擎的收紧比对 `loosenReasons` **双向**(两侧各在自己的文法里读:`stored` 带 `rev`,`incoming` 带 `grammar`):两个方向都「没放宽」才是同一句话;
|
|
174
|
-
* 意思不同就交给 `putRules` 的判官(非 operator ⇒ `loosen_forbidden`;operator ⇒ 改写成当前文法、盖戳)。本仓仍零处读 / 比戳值;意思由引擎说。
|
|
175
|
-
|
|
212
|
+
* 意思不同就交给 `putRules` 的判官(非 operator ⇒ `loosen_forbidden`;operator ⇒ 改写成当前文法、盖戳)。本仓仍零处读 / 比戳值;意思由引擎说。
|
|
213
|
+
* 🔴 core 7.55.0 [ref]:行还有一格 **operator 部分**(`StoredSessionRules.operatorRules`:非 operator 的写只能收回非 operator 写加上去的东西;缺席 = 整行归 operator)。
|
|
214
|
+
* 桶同、意思同,这一次写仍可能挪动它 —— operator 重放把整行变成 operator 的(引擎写口判官的答:operator 写的值整只归 operator)。只比桶会判「同内容」⇒ 零次 putRules ⇒
|
|
215
|
+
* 属主盖过戳的目的行保持「属主收得回」,源端 operator 断言过的条目在目的端被属主一条非 operator 的写收回(安全轴的静默放宽)。所以第三问:这一次写之后的部分
|
|
216
|
+
* = 引擎写口判官对(目的行, 记录, 这次重放的态度)的答,与目的行现有的部分按同一读法(缺席 = 整行)比;不同就交给 `putRules`。判官拒 ⇒ 原样上抛(`putRules` 会拒同一句)。
|
|
217
|
+
* `operator` 必填:同一份记录在 operator 与非 operator 的重放下是两种写(漏传是编译错,不是一条静默的读法)。 */
|
|
218
|
+
export declare function sameRulesContent(stored: StoredSessionRules | null, incoming: SessionPermissionRules, operator: boolean): boolean;
|
|
176
219
|
/** [ref] ① 的重放腿共享实现:PUSH 路由的两条 policy 重放腿(Phase A identical 短路支 / Phase B
|
|
177
220
|
* commit 后支)都从这里走 —— 等内容跳过(rev 零漂移),真变更照常落地(E6 tighten-only 门在
|
|
178
221
|
* putRules 内部,此处不重述)。 */
|
package/dist/session-sync.js
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
import { classifySyncRelationship } from "./session-sync-kernel.js";
|
|
2
2
|
import { loosenReasons, normalizeRules } from "@sema-agent/core";
|
|
3
|
+
import { headReadOf } from "./session-incarnation.js";
|
|
4
|
+
import { judgeSessionRulesWrite } from "@sema-agent/core";
|
|
5
|
+
export class FileHistoryUnreadableError extends Error {
|
|
6
|
+
sessionId;
|
|
7
|
+
failure;
|
|
8
|
+
code = "state.file_history_unreadable";
|
|
9
|
+
constructor(sessionId, failure) {
|
|
10
|
+
super(`file history of session ${sessionId} cannot be read whole (${failure.code}): ${failure.message}`);
|
|
11
|
+
this.sessionId = sessionId;
|
|
12
|
+
this.failure = failure;
|
|
13
|
+
this.name = "FileHistoryUnreadableError";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export async function exportedFileHistory(store, sessionId) {
|
|
17
|
+
if (typeof store.exportHistory !== "function")
|
|
18
|
+
return null;
|
|
19
|
+
const exported = await store.exportHistory(sessionId);
|
|
20
|
+
if (!exported.ok)
|
|
21
|
+
throw new FileHistoryUnreadableError(sessionId, exported.error);
|
|
22
|
+
return exported.history;
|
|
23
|
+
}
|
|
24
|
+
export function blobGetterOf(store) {
|
|
25
|
+
const get = store.getBlob?.bind(store);
|
|
26
|
+
return get ? (hash) => get(hash) : async () => undefined;
|
|
27
|
+
}
|
|
3
28
|
export function fileHistoryImportFace(fs) {
|
|
4
29
|
const candidate = fs?.importHistory;
|
|
5
30
|
if (typeof candidate !== "function")
|
|
@@ -11,10 +36,21 @@ export async function replayFileHistory(store, scope, envelope, srcGetBlob, opts
|
|
|
11
36
|
if (face === undefined) {
|
|
12
37
|
return { ok: false, error: { code: "unsupported_format", message: "this deployment's file-history store has no importHistory seam" } };
|
|
13
38
|
}
|
|
14
|
-
|
|
39
|
+
const attempt = async () => {
|
|
40
|
+
let missing;
|
|
41
|
+
const observed = async (hash) => {
|
|
42
|
+
const bytes = await srcGetBlob(hash);
|
|
43
|
+
if (bytes === undefined && missing === undefined)
|
|
44
|
+
missing = hash;
|
|
45
|
+
return bytes;
|
|
46
|
+
};
|
|
47
|
+
const r = await face.importHistory(scope, envelope, observed);
|
|
48
|
+
return r.ok || missing === undefined ? r : { ok: false, error: r.error, missingBlob: missing };
|
|
49
|
+
};
|
|
50
|
+
let r = await attempt();
|
|
15
51
|
if (!r.ok && r.error.code === "conflict" && opts.allowReplace && typeof store.deleteBySession === "function") {
|
|
16
52
|
await store.deleteBySession(scope);
|
|
17
|
-
r = await
|
|
53
|
+
r = await attempt();
|
|
18
54
|
}
|
|
19
55
|
return r;
|
|
20
56
|
}
|
|
@@ -29,10 +65,10 @@ export async function exportSessionManifest(sessionId, srcBackend, historyStore)
|
|
|
29
65
|
const entryIds = await listEntryIds(sessionId);
|
|
30
66
|
if (entryIds === null)
|
|
31
67
|
return null;
|
|
32
|
-
const
|
|
33
|
-
const leafId =
|
|
68
|
+
const headOf = headReadOf(session);
|
|
69
|
+
const leafId = headOf ? ((await headOf(sessionId))?.leafId ?? null) : null;
|
|
34
70
|
const fs = historyStore;
|
|
35
|
-
const fileHistory =
|
|
71
|
+
const fileHistory = await exportedFileHistory(fs, sessionId);
|
|
36
72
|
const policyStore = srcBackend.sessionPolicy();
|
|
37
73
|
const policy = typeof policyStore.listBySession === "function"
|
|
38
74
|
? await policyStore.listBySession(sessionId)
|
|
@@ -43,8 +79,7 @@ export async function exportSessionManifest(sessionId, srcBackend, historyStore)
|
|
|
43
79
|
if (summaryOf === undefined)
|
|
44
80
|
throw new Error("exportSessionManifest: the session store has no row read face (sessionSummaryOf) — the sessionSync fact should have refused this deployment");
|
|
45
81
|
const row = await summaryOf(sessionId);
|
|
46
|
-
const
|
|
47
|
-
const getBlob = getBlobFn ? (hash) => getBlobFn(hash) : async () => undefined;
|
|
82
|
+
const getBlob = blobGetterOf(fs);
|
|
48
83
|
return {
|
|
49
84
|
manifest: { sessionId, entryIds, entryCount: entryIds.length, leafId, fileHistory, policy, anchors, ...(row !== undefined ? { title: row.title, pinned: row.pinned } : {}) },
|
|
50
85
|
getBlob,
|
|
@@ -57,18 +92,25 @@ export async function planSync(sessionId, srcBackend, dstBackend) {
|
|
|
57
92
|
const dstEntries = (await ownerAware(dstBackend).exportEntries?.(sessionId)) ?? null;
|
|
58
93
|
return classifySyncRelationship(srcEntries, dstEntries);
|
|
59
94
|
}
|
|
60
|
-
export function sameRulesContent(stored, incoming) {
|
|
95
|
+
export function sameRulesContent(stored, incoming, operator) {
|
|
61
96
|
if (stored === null)
|
|
62
97
|
return false;
|
|
63
98
|
const norm = (r) => JSON.stringify(normalizeRules(r));
|
|
64
99
|
if (norm(stored) !== norm(incoming))
|
|
65
100
|
return false;
|
|
66
|
-
|
|
101
|
+
if (loosenReasons(stored, incoming).length !== 0 || loosenReasons(incoming, stored).length !== 0)
|
|
102
|
+
return false;
|
|
103
|
+
return operatorPartUnmoved(stored, incoming, operator);
|
|
104
|
+
}
|
|
105
|
+
function operatorPartUnmoved(stored, incoming, operator) {
|
|
106
|
+
const next = judgeSessionRulesWrite(stored, incoming, { operator });
|
|
107
|
+
const partOf = (row) => JSON.stringify(normalizeRules(row.operatorRules ?? row));
|
|
108
|
+
return partOf(next) === partOf(stored);
|
|
67
109
|
}
|
|
68
110
|
export async function replayPolicyRecords(store, sessionId, records, operatorOk) {
|
|
69
111
|
for (const rec of records) {
|
|
70
112
|
const cur = await store.getRules(sessionId, rec.principal);
|
|
71
|
-
if (sameRulesContent(cur, rec.rules))
|
|
113
|
+
if (sameRulesContent(cur, rec.rules, operatorOk))
|
|
72
114
|
continue;
|
|
73
115
|
await store.putRules(sessionId, rec.principal, rec.rules, { operator: operatorOk });
|
|
74
116
|
}
|
package/dist/session-titler.d.ts
CHANGED
|
@@ -27,10 +27,6 @@
|
|
|
27
27
|
import type { HookLlmFailureCode } from "./hooks/hook-runner.js";
|
|
28
28
|
import { type SessionTitledFrame } from "./session-titled-frame.js";
|
|
29
29
|
export interface SessionTitlerDeps {
|
|
30
|
-
/** Secret scrub applied to the RAW llm text before sanitize/persist (workflow audit 2026-07-13: the
|
|
31
|
-
* objective may carry a pasted secret and the model can echo it into the title — titles are persisted,
|
|
32
|
-
* listed over HTTP, and logged, all outside the trace redact pipeline; wire src/trace/redact.ts here). */
|
|
33
|
-
redact?: (text: string) => string;
|
|
34
30
|
/** Write-once store leg (SQL twins / local sidecar). Resolves false when a title already existed. */
|
|
35
31
|
setTitleIfNull(sessionId: string, title: string): Promise<boolean>;
|
|
36
32
|
/** Cheap pre-LLM probe: "titled" = skip (a restart/evicted-seen/another replica
|
|
@@ -68,8 +64,13 @@ export interface SessionTitler {
|
|
|
68
64
|
* 已有标题 / 竞态输了 / 模型失败 / 空标题 / 这个会话已有一次在飞的调用,都不调。回调同步执行、**不许抛**;抛了也不影响已落行的标题(见下 `frame_failed`)。 */
|
|
69
65
|
maybeTitle(sessionId: string, objective: string, model?: string, onTitled?: (frame: SessionTitledFrame) => void): void;
|
|
70
66
|
}
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
/** 标题的显示预算(码元,含截断记号)—— 界的属主是出口座的 `session-title` 行,这里读它;落在 `title` 列宽 `SESSION_TITLE_MAX_CHARS`(session-row.ts)之内。 */
|
|
68
|
+
export declare const TITLE_MAX_CHARS: number;
|
|
69
|
+
/**
|
|
70
|
+
* 模型回的标题 → 落行的标题:**经出口座的 `session-title` 行**([ref])—— 脱敏(按单行出门形读:被控制字符拆开、被换行拆开的令牌都读过)→ 渲染 →
|
|
71
|
+
* 单行化(换行折成空格、剥控制与双向字符、去首尾空白与首尾引号)→ 按记号边界截到 {@link TITLE_MAX_CHARS} 码元(含 `…`)。
|
|
72
|
+
* 此前是「可选注入的脱敏 → 剥 → 截」三步各在一处:没注入就不脱;剥在脱之后,BEL 拆开的令牌两半在剥时拼回整枚;截在脱之后,界切进记号留半枚。
|
|
73
|
+
*/
|
|
73
74
|
export declare function sanitizeTitle(raw: string): string;
|
|
74
75
|
export declare function buildTitlePrompt(objective: string): string;
|
|
75
76
|
export declare function createSessionTitler(deps: SessionTitlerDeps): SessionTitler;
|
package/dist/session-titler.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { stripControlAndBidi } from "@sema-agent/settings-schema";
|
|
2
1
|
import { recordFailOpen } from "./observability/fail-open.js";
|
|
3
|
-
import {
|
|
2
|
+
import { seatMaxChars, seatText } from "./trace/exit-seat.js";
|
|
4
3
|
import { userAuthoredText } from "./user-authored-text.js";
|
|
5
4
|
import { buildSessionTitledFrame } from "./session-titled-frame.js";
|
|
6
|
-
export const TITLE_MAX_CHARS =
|
|
5
|
+
export const TITLE_MAX_CHARS = seatMaxChars("session-title");
|
|
7
6
|
const OBJECTIVE_SNIPPET_CHARS = 600;
|
|
8
7
|
const LLM_TIMEOUT_MS = 15_000;
|
|
9
8
|
const NO_ROW_RETRY_MS = 20_000;
|
|
10
|
-
const FAIL_CAUSE_KEY_CHARS = 80;
|
|
11
9
|
const SEEN_CAP = 10_000;
|
|
12
10
|
function failOpenTagFor(code) {
|
|
13
11
|
switch (code) {
|
|
@@ -30,9 +28,7 @@ function failOpenTagFor(code) {
|
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
30
|
export function sanitizeTitle(raw) {
|
|
33
|
-
|
|
34
|
-
const unquoted = oneLine.replace(/^["'「『]+/, "").replace(/["'」』]+$/, "").trim();
|
|
35
|
-
return unquoted.length > TITLE_MAX_CHARS ? `${unquoted.slice(0, TITLE_MAX_CHARS - 1)}…` : unquoted;
|
|
31
|
+
return seatText("session-title", raw);
|
|
36
32
|
}
|
|
37
33
|
export function buildTitlePrompt(objective) {
|
|
38
34
|
const text = userAuthoredText(objective);
|
|
@@ -46,11 +42,10 @@ export function buildTitlePrompt(objective) {
|
|
|
46
42
|
}
|
|
47
43
|
export function createSessionTitler(deps) {
|
|
48
44
|
const seen = new Set();
|
|
49
|
-
const redactedError = (error) => redactSecrets(error);
|
|
50
45
|
const logFailure = (sessionId, error, code) => {
|
|
51
|
-
const safe =
|
|
52
|
-
deps.logger?.debug?.("session_title_failed", { sessionId, error: safe
|
|
53
|
-
recordFailOpen(failOpenTagFor(code), safe
|
|
46
|
+
const safe = seatText("operator-log-text", error);
|
|
47
|
+
deps.logger?.debug?.("session_title_failed", { sessionId, error: safe });
|
|
48
|
+
recordFailOpen(failOpenTagFor(code), safe);
|
|
54
49
|
};
|
|
55
50
|
const probeOrContinue = async (sessionId, continueWord) => deps
|
|
56
51
|
.probeTitle(sessionId)
|
|
@@ -90,7 +85,7 @@ export function createSessionTitler(deps) {
|
|
|
90
85
|
logFailure(sessionId, r.error, r.code);
|
|
91
86
|
return;
|
|
92
87
|
}
|
|
93
|
-
const title = sanitizeTitle(
|
|
88
|
+
const title = sanitizeTitle(r.text);
|
|
94
89
|
if (!title) {
|
|
95
90
|
deps.metrics?.inc("session_title_total", { outcome: "empty" });
|
|
96
91
|
return;
|
|
@@ -112,7 +107,7 @@ export function createSessionTitler(deps) {
|
|
|
112
107
|
}
|
|
113
108
|
catch (e) {
|
|
114
109
|
deps.metrics?.inc("session_title_total", { outcome: "frame_failed" });
|
|
115
|
-
deps.logger?.warn?.("session_titled_frame_failed", { sessionId, error:
|
|
110
|
+
deps.logger?.warn?.("session_titled_frame_failed", { sessionId, error: seatText("operator-log-text", String(e)) });
|
|
116
111
|
}
|
|
117
112
|
}
|
|
118
113
|
})().catch((e) => {
|
package/dist/session-watch.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* - **冷启动 warm**:新条目 lastChangeAt=0(没观测到变化就不算热)——首拍一次 hotMs 快确认后即落
|
|
17
17
|
* warm 拍距,直到真观测到跳变才进热窗(codex:重连风暴下 256 会话×200ms=对存储的自造尖峰)。
|
|
18
18
|
*
|
|
19
|
-
* Deliberately backend-agnostic (tidb|pg|local all go through
|
|
19
|
+
* Deliberately backend-agnostic (tidb|pg|local all go through the session store's one by-id read `headOf` — the seamless-local-cloud
|
|
20
20
|
* invariant): no PG LISTEN/NOTIFY specialization, no shared bus. Latest-wins semantics: subscribers
|
|
21
21
|
* converge on the newest leafId; intermediate hops may be dropped (content still comes from tail faces).
|
|
22
22
|
*/
|
|
@@ -38,7 +38,7 @@ export declare class SessionWatchRegistry {
|
|
|
38
38
|
/** 五轮复审:owner 与 leaf **同拍原子读**——探针每拍先核 owner(被删=undefined/换主=≠条目 owner
|
|
39
39
|
* ⇒ dropSession 断全部订阅者),匹配才应用 leaf。跨副本 reclaim 的披露窗从 25s 心跳收紧到
|
|
40
40
|
* ≤一个探针拍(hot 200ms/warm 2s),且旧流在新主推进**之前**先死(owner 检查先于 leaf 应用)。 */
|
|
41
|
-
private readonly
|
|
41
|
+
private readonly readHead;
|
|
42
42
|
private readonly entries;
|
|
43
43
|
private readonly hotMs;
|
|
44
44
|
private readonly warmMs;
|
|
@@ -48,7 +48,7 @@ export declare class SessionWatchRegistry {
|
|
|
48
48
|
/** 五轮复审:owner 与 leaf **同拍原子读**——探针每拍先核 owner(被删=undefined/换主=≠条目 owner
|
|
49
49
|
* ⇒ dropSession 断全部订阅者),匹配才应用 leaf。跨副本 reclaim 的披露窗从 25s 心跳收紧到
|
|
50
50
|
* ≤一个探针拍(hot 200ms/warm 2s),且旧流在新主推进**之前**先死(owner 检查先于 leaf 应用)。 */
|
|
51
|
-
|
|
51
|
+
readHead: (sessionId: string) => Promise<{
|
|
52
52
|
leafId: string | null | undefined;
|
|
53
53
|
owner: string | null | undefined;
|
|
54
54
|
}>, opts?: SessionWatchOptions);
|
package/dist/session-watch.js
CHANGED
|
@@ -5,14 +5,14 @@ export function posIntEnv(raw, fallback, max = 3_600_000) {
|
|
|
5
5
|
return Number.isInteger(n) && n > 0 && n <= max ? n : fallback;
|
|
6
6
|
}
|
|
7
7
|
export class SessionWatchRegistry {
|
|
8
|
-
|
|
8
|
+
readHead;
|
|
9
9
|
entries = new Map();
|
|
10
10
|
hotMs;
|
|
11
11
|
warmMs;
|
|
12
12
|
hotWindowMs;
|
|
13
13
|
maxWatched;
|
|
14
|
-
constructor(
|
|
15
|
-
this.
|
|
14
|
+
constructor(readHead, opts) {
|
|
15
|
+
this.readHead = readHead;
|
|
16
16
|
this.hotMs = opts?.hotMs ?? 200;
|
|
17
17
|
this.warmMs = opts?.warmMs ?? 2000;
|
|
18
18
|
this.hotWindowMs = opts?.hotWindowMs ?? 60_000;
|
|
@@ -109,7 +109,7 @@ export class SessionWatchRegistry {
|
|
|
109
109
|
e.urgent = false;
|
|
110
110
|
const revAtStart = e.rev;
|
|
111
111
|
try {
|
|
112
|
-
const head = await this.
|
|
112
|
+
const head = await this.readHead(sessionId);
|
|
113
113
|
if (this.entries.get(sessionId) !== e)
|
|
114
114
|
return;
|
|
115
115
|
if (head.owner === undefined || head.owner !== e.owner) {
|
package/dist/sighup-idle.d.ts
CHANGED
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
*
|
|
10
10
|
* 诚实边界:idle-but-live 的 peer(两 turn 之间静默超过窗口)会碰到引擎已退→壳 dead-respawn 1-2s 自愈
|
|
11
11
|
* (伤害面从 mid-turn 斩降级为冷启动)。
|
|
12
|
-
*
|
|
12
|
+
* [ref]:附着(打开着的 SSE 流)是判据的第二格 `attached` —— 只读订阅自此不进 inflight(排空不该等一个看着的壳),而一个只挂着订阅流的
|
|
13
13
|
* peer 壳(cli 附着形:`GET /v1/approvals/stream` 常开)仍然是「有人在用」,靠这一格不被当成孤儿。修前这一形是订阅流被算进 inflight
|
|
14
14
|
* 时顺带挡住的;拆开之后两件事各有一格,规则不变:inflight = 0 ∧ attached = 0 ∧ 活性静默满窗才关。
|
|
15
15
|
*/
|
|
16
16
|
export interface SighupIdleDeps {
|
|
17
17
|
/** This replica's in-flight legs (drainState.inflight). */
|
|
18
18
|
inflight: () => number;
|
|
19
|
-
/**
|
|
19
|
+
/** [ref]:打开着的 SSE 流条数(drainState.attachedStreams,附着租约同一只 getter)。> 0 ⇒ 有壳挂着,同 inflight 一样重置窗口。
|
|
20
20
|
* 缺席 ⇒ 视为 0(单测 / 嵌入形)。 */
|
|
21
21
|
attached?: () => number;
|
|
22
22
|
/** MONOTONIC-clock ms of the last non-probe HTTP request (drainState.lastActivityAt). Covers what inflight
|
package/dist/spec-fields.d.ts
CHANGED
|
@@ -44,9 +44,9 @@ export declare function normalizeResumeAtMode(v: unknown, resumeAtResolved: bool
|
|
|
44
44
|
* **技能**条数帽不是同一轴:技能清单由引擎按预算渲染(超了裁描述),agent 定义没有那个预算面。 */
|
|
45
45
|
export declare const MAX_TASK_AGENTS = 32;
|
|
46
46
|
/**
|
|
47
|
-
* core 7.41.0
|
|
47
|
+
* core 7.41.0 [ref] —— 技能的两只清单 `allowedTools` / `disallowedTools`(`dist/core/agent-definition.d.ts`:本次 run 的 allow 规则来源 /
|
|
48
48
|
* deny 规则来源,不是围栏)的**形**谓词。两道技能门(顶层 `body.skills[]` 的 `validateUserSkills`、`agents[].skills[]` 的
|
|
49
|
-
* {@link SKILL_FIELD_SHAPES})**同一只**:一边判一边不判 = 同一个键两种话(
|
|
49
|
+
* {@link SKILL_FIELD_SHAPES})**同一只**:一边判一边不判 = 同一个键两种话([ref] baseDir 吃过的亏)。
|
|
50
50
|
*
|
|
51
51
|
* 本谓词只判「字符串数组」(core 7.42.0 起与请求的 `settings.permissions.allow`、运维的 `APPROVAL_GRANT` **同一只**:`rule-entry-list.ts` 的
|
|
52
52
|
* `ruleEntryListShapeOk`):引擎直接 `for (const entry of list)` —— 一个裸字符串 `"Bash"` 会被逐字符迭代成 `B` / `a` / `s` / `h` 四条
|
|
@@ -80,7 +80,7 @@ export interface TaskAgentsRefusal {
|
|
|
80
80
|
/** [ref] 单条 agent 定义的形状裁决:null=合法;否则一句可 400 的英文错误(不带索引,调用方自己加)。
|
|
81
81
|
* 白名单外键 fail-loud —— 与 resilience/limits 的「容忍未知键」相反:agents 是能力定义,静默丢字段 =
|
|
82
82
|
* 定义被悄悄削(一个丢掉的 isolation 就是放宽),比 400 更危险,故整条拒。`allowTools` / `denyTools` 本门只判形与条数(`toolList`),
|
|
83
|
-
* **名字归引擎一只判**(core 7.49.0
|
|
83
|
+
* **名字归引擎一只判**(core 7.49.0 [ref] / [ref] 第二步起与根 run 的 `allowTools` / `excludeTools` 是同一只选择器,开跑前,三来源同判):core 7.51.0 [ref] 起
|
|
84
84
|
* 没有任何工具答应的名字(无人挂的名、大小写孪生 / 退役名 `bash` / `BASH`)**引擎不拒 run** —— 条目原样保留、经 onError(config)告知一次(带该写的拼法);
|
|
85
85
|
* 其中**写错现名的**(`denyTools:["BASH"]` 想禁的照用 = 静默放行;`allowTools:["BASH"]` 想放的什么也没放 = 静默收窄)由 `resolveSpec` 前置拒:**限制侧**(`denyTools`)四类全拒(近似名 · 退役名 · 文法读不出 · `*`),
|
|
86
86
|
* **放行侧**(`allowTools`)只拒近似名 —— 放行侧的内容形 / 没有后继的退役名 / 文法读不出照 7.130.0 受理、交引擎既有通告(有后继的退役名〔`bash` · `Task`〕与文法读不出的放行条目引擎在子代 prepare 整 run 拒 `config.agent.unknown_tool`,根 `allowTools` 拒 `config.tool_face_control`,同步腿两码同为 400〔`runs.ts` `PREPARE_REFUSAL_HTTP_STATUS`〕;`rule-entry-list.ts` `inertToolListEntryOf`:近似名提交 400 `config.agent.unknown_tool` 点名现名、续跑按方向分流;
|
|
@@ -150,7 +150,7 @@ export declare function retainBackgroundProcessesFromBody(raw: unknown, requireP
|
|
|
150
150
|
* undefined(不挂键=core 缺省,byte-compat)。HTTP 门另有 fail-loud 400(提交面邻居姿势)。 */
|
|
151
151
|
export declare function toolNameListFromBody(raw: unknown): string[] | undefined;
|
|
152
152
|
/**
|
|
153
|
-
*
|
|
153
|
+
* [ref](core 7.49.0 [ref] / [ref])—— body.allowTools → `TaskSpec.allowTools`:引擎的**可用性选择器**,原样透传。
|
|
154
154
|
*
|
|
155
155
|
* 一条规则:这一 run 能用哪些工具由引擎一只运算答(`universe ∩ ceiling ∩ allow − deny`,prepare 对真实挂载的一切算一次)。
|
|
156
156
|
* 本仓**零读法** —— 不算补集、不逐项过滤(`[]` = 什么都不给,是合法值,不折成缺席;非串条目与未知名由引擎在 prepare 拒,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref] —— SQL **引擎姿态**的运维读面(单一推导点,同 `memory-posture.ts` 的形制)。
|
|
3
3
|
*
|
|
4
4
|
* ## 病
|
|
5
5
|
*
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* `sql-driver.ts` 的连接初始化在**每条池连接**上钉死这两件事并**回读复核**(`@contract txn.read-semantics`)。
|
|
13
13
|
* 本模块把那份读数拿出来,一次推导两个读面:operator 面(`GET /v1/diagnostics/wiring` 的 `sqlEngine` 段,
|
|
14
|
-
* 全量)与消费端面(`GET /v1/capabilities` 的 `store.sql` 位(7.106.0 起;此前顶层 `sql`,
|
|
14
|
+
* 全量)与消费端面(`GET /v1/capabilities` 的 `store.sql` 位(7.106.0 起;此前顶层 `sql`,[ref] ①),窄投影)。两面同源 —— 「诊断页说悲观、能力位说
|
|
15
15
|
* 乐观」在结构上不可能。
|
|
16
16
|
*
|
|
17
17
|
* ## 两条诚实纪律(与 memory-posture 同源)
|
|
@@ -52,7 +52,7 @@ export type SqlEngineSeatIssue = "required" | "bad_shape";
|
|
|
52
52
|
* 都是 fail-closed:墙门只认这一席,席坏了或漏了,代价是每份超出库墙的体照样受理或每次提交 500,不是起服时一句话。
|
|
53
53
|
*/
|
|
54
54
|
export declare function sqlEngineSeatIssue(backend: Pick<StoreBackend, "mysqlPool" | "pgPool"> | undefined, sqlEngine: unknown): SqlEngineSeatIssue | undefined;
|
|
55
|
-
/** 消费端窄投影(`GET /v1/capabilities` 的 `store.sql` 位;7.106.0 前是顶层 `sql`,
|
|
55
|
+
/** 消费端窄投影(`GET /v1/capabilities` 的 `store.sql` 位;7.106.0 前是顶层 `sql`,[ref] ①)。`null` = 驱动此刻给不出事实 ⇒ `store.sql` 缺席。 */
|
|
56
56
|
export interface SqlEngineCapability {
|
|
57
57
|
engine: SqlEngineFacts["engine"];
|
|
58
58
|
isolation: string;
|
package/dist/store-posture.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref] ①(设计稿 v1.1 §2①)—— 「这台副本**真的在持久化吗**」的单一推导点:caps `store`、`/health.storeDegraded` / `durable:false`、
|
|
3
3
|
* gauge `store_backend_degraded` 三面读**同一只装配值**({@link StorePosture},`boot/stores.ts` 铸一次)。
|
|
4
4
|
*
|
|
5
5
|
* ## 病
|
|
@@ -53,7 +53,7 @@ export interface StoreCapability {
|
|
|
53
53
|
readonly durable: boolean;
|
|
54
54
|
readonly degradedReason?: StoreDegradedReason;
|
|
55
55
|
/** 7.105.0 及以前的顶层 `sql` 对象,原样搬入(`{engine, isolation, txnMode}`)。present-iff `backend ∈ {mysql, pg}` ∧ 驱动此刻给得出
|
|
56
|
-
* 回读复核过的事实 —— 最近一次连接初始化被拒(
|
|
56
|
+
* 回读复核过的事实 —— 最近一次连接初始化被拒([ref] ④)时驱动交 `null`,本键随之缺席(此前是顶层 `sql:null`)。 */
|
|
57
57
|
readonly sql?: SqlEngineCapability;
|
|
58
58
|
}
|
|
59
59
|
/** 装配值 → caps 投影(纯函数)。 */
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* ⇒ 永远批不过去。持久数据面不能「翻红」,所以给它一次性迁移:窗开着时,续跑重放腿把判官判不过的那一格按升级前的读法重读一次,产物**再交同一只判官**
|
|
10
10
|
* (不过 ⇒ 原臂:整条不进);真挂上的这类 server 由请求腿说一行运维 warn `mcp_tool_axes_read_as_before_upgrade`。窗关之后回到今天的读法,删码零行为变化。
|
|
11
11
|
*
|
|
12
|
-
* ## A2A 一面(同一种病,同一只重读座;core 7.53.0
|
|
12
|
+
* ## A2A 一面(同一种病,同一只重读座;core 7.53.0 [ref] 提货批)
|
|
13
13
|
* core 7.53.0 起 A2A 请求腿的 `toolAxes` 读者也是引擎的判官(`readToolAxes(…, "a2a")`)。7.131.x 的 A2A 请求腿读者对每只 skill 的记录只挑三个轴、**多余成员静默忽略**、
|
|
14
14
|
* 照挂 ⇒ 存量体里带多余成员的那条对端,续跑重放时整条不进,停驻在它某只 skill 审批上的任务同样永远批不过去。同一只重读座覆盖它,律只有一句:**重读复现那一面升级前
|
|
15
15
|
* 的读法,一个成员都不多救** —— A2A 那一面交 {@link readA2aToolAxesAsServer7131M19}(7.131.x 的读者逐字:未知成员忽略;已知轴写坏 —— `effect` / `irreversibility` 出词表、
|
package/dist/task-a2a.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ export interface A2aGateConfig {
|
|
|
61
61
|
* hand every consumer an affordance whose every use 400s (`config.locked_key`); "says yes ⟺ route
|
|
62
62
|
* works" breaks on the spot. Same conjunction, same reason, as `mcpInjectionHonored`'s lock veto;
|
|
63
63
|
* ② the compliance posture denies `a2a_peers` — advertised-but-refused again;
|
|
64
|
-
* ③ multi-tenant (
|
|
64
|
+
* ③ multi-tenant (deployment-shape row `multiTenant`) — a tenant cannot point the shared worker at an agent.
|
|
65
65
|
*
|
|
66
66
|
* ⚠️ **`resolveComplianceDenies` is deliberately NOT wrapped in try/catch** (same ruling as the MCP twin):
|
|
67
67
|
* it is fail-loud on a posture outside the closed set, and the posture has already been validated twice
|
|
@@ -80,6 +80,8 @@ export declare function validateRequestA2a(raw: unknown): {
|
|
|
80
80
|
ok: A2aServerSpec[];
|
|
81
81
|
dropped: string[];
|
|
82
82
|
} | null;
|
|
83
|
+
/** fresh 提交腿的 `a2aPeers` URL 门:{@link requestA2aPeerUrlRefusal} 有答案 ⇒ 同步 400(码 / 句 / 机读位原样)。 */
|
|
84
|
+
export declare function assertRequestA2aPeerUrls(bodyA2a: unknown): void;
|
|
83
85
|
/**
|
|
84
86
|
* DESIGN-269 §2.4 —— **同步**拒面:部署锁了 `a2a` 而请求仍带 `a2aPeers` ⇒ 400 `config.locked_key`
|
|
85
87
|
* (逐字沿用 `assertRequestMcpUnlocked` 的裁定,连错误码都同一个 —— 消费端判的是「某个键被行政锁住了」,
|