@sema-agent/server 7.134.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 +134 -0
- package/USAGE.md +98 -30
- package/dist/adoption/plan.d.ts +1 -1
- package/dist/approval-ask-audit-store.d.ts +24 -24
- package/dist/approval-ask-machine.d.ts +2 -2
- package/dist/approval-card.d.ts +62 -150
- package/dist/approval-card.js +33 -51
- package/dist/approval-content-kind.d.ts +22 -5
- package/dist/approval-content-kind.js +8 -1
- package/dist/approval-deny-reasons.d.ts +1 -1
- package/dist/approval-gate-currency.d.ts +22 -3
- package/dist/approval-gate-currency.js +44 -18
- 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 +8 -8
- package/dist/approval.js +4 -2
- 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 +2 -2
- package/dist/boot/coordinators.js +2 -2
- 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 +1 -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/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 +11 -11
- package/dist/boot/runner-deps.js +3 -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.js +0 -2
- package/dist/boot/stores.js +2 -1
- package/dist/boot/web-admin.d.ts +17 -17
- package/dist/boot/web-admin.js +5 -10
- package/dist/boot/workflow-orchestration.js +2 -9
- package/dist/brain.d.ts +11 -11
- package/dist/budget.d.ts +4 -4
- 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 +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/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 +26 -25
- package/dist/capability-facts.js +14 -16
- package/dist/center-config-tier.d.ts +1 -1
- package/dist/center-credential.d.ts +4 -4
- 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/file-history-capture.d.ts +9 -9
- package/dist/file-history-disclosure.d.ts +23 -11
- package/dist/file-history-disclosure.js +7 -12
- package/dist/fleet/drain-entry.d.ts +2 -2
- package/dist/fleet/fleet-bus.d.ts +22 -14
- package/dist/fleet/fleet-bus.js +5 -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 +36 -18
- 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 +20 -5
- package/dist/http/approval-sweeps.d.ts +1 -1
- package/dist/http/approval-sweeps.js +2 -1
- package/dist/http/checkpoint-ctx.d.ts +39 -13
- package/dist/http/checkpoint-ctx.js +74 -35
- package/dist/http/dispatch.d.ts +3 -3
- package/dist/http/durable-run-leg.js +4 -3
- package/dist/http/idempotency.d.ts +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 +7 -7
- package/dist/http/principal-gate.js +3 -2
- package/dist/http/readiness.d.ts +1 -1
- package/dist/http/request-guards.d.ts +4 -4
- package/dist/http/request-guards.js +2 -1
- package/dist/http/resume-ctx-read.d.ts +7 -7
- package/dist/http/resume-ctx-read.js +1 -1
- package/dist/http/resume-legs.d.ts +3 -3
- package/dist/http/resume-legs.js +11 -8
- package/dist/http/route-ctx.d.ts +29 -29
- package/dist/http/route-table.d.ts +9 -9
- package/dist/http/routes/agents-roster.d.ts +1 -1
- package/dist/http/routes/approvals-assistant.d.ts +5 -5
- package/dist/http/routes/approvals-assistant.js +55 -15
- 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 +3 -3
- package/dist/http/routes/fleet.d.ts +1 -1
- package/dist/http/routes/fleet.js +2 -1
- 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/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/runs.js +22 -10
- package/dist/http/routes/session-sync.d.ts +1 -1
- package/dist/http/routes/session-sync.js +73 -44
- package/dist/http/routes/sessions-list.js +1 -1
- package/dist/http/routes/sessions.js +30 -44
- package/dist/http/routes/tasks.d.ts +1 -1
- package/dist/http/routes/trace-usage.d.ts +1 -1
- 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 +34 -34
- 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.js +1 -1
- 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 +28 -21
- 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 +6 -6
- package/dist/list-entry-display.d.ts +1 -1
- package/dist/lsp-evict.d.ts +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-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-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/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/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/outbound-dispatcher.d.ts +4 -4
- package/dist/parent-watch.d.ts +4 -4
- package/dist/parked-decide.d.ts +16 -15
- package/dist/parked-decide.js +5 -4
- 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 +2 -2
- 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/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 +23 -32
- package/dist/plugins/caching-session-store.js +5 -17
- 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 +44 -66
- package/dist/plugins/checkpoint-store-sql.js +55 -102
- 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 +10 -10
- package/dist/plugins/local-checkpoint-store.js +3 -4
- package/dist/plugins/local-session-store.d.ts +34 -38
- package/dist/plugins/local-session-store.js +20 -39
- package/dist/plugins/local-session-window.d.ts +1 -1
- 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 +66 -40
- package/dist/plugins/one-time-migrations.js +115 -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 +12 -19
- package/dist/plugins/permission-rule-store-sql.d.ts +38 -4
- package/dist/plugins/permission-rule-store-sql.js +67 -24
- 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 +8 -20
- package/dist/plugins/pg-session-storage.js +14 -27
- package/dist/plugins/remote-env-adb.d.ts +10 -10
- package/dist/plugins/remote-env-device.d.ts +10 -9
- package/dist/plugins/remote-env-device.js +6 -2
- 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.js +1 -1
- package/dist/plugins/session-placement.d.ts +1 -1
- 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 +16 -26
- package/dist/plugins/tidb-session-store.js +15 -27
- 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-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/runs.d.ts +13 -11
- package/dist/runs.js +15 -1
- 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 +3 -3
- package/dist/security.d.ts +23 -26
- 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 +7 -7
- 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 +4 -4
- 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 +34 -2
- package/dist/task-cwd.d.ts +7 -88
- package/dist/task-cwd.js +2 -15
- package/dist/task-mcp.d.ts +12 -8
- package/dist/task-mcp.js +19 -4
- package/dist/task-settings.d.ts +30 -18
- package/dist/task-settings.js +33 -3
- 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 +143 -197
- package/dist/tool-approval.js +13 -28
- package/dist/tool-rule-names.d.ts +2 -2
- package/dist/trace/core-keyset-guard.d.ts +12 -7
- 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 +31 -4
- package/dist/trace/exit-seat.js +41 -63
- package/dist/trace/ledger-events.d.ts +3 -3
- package/dist/trace/ledger-sink.d.ts +1 -1
- package/dist/trace/model-segment.d.ts +3 -3
- package/dist/trace/project.d.ts +47 -45
- package/dist/trace/project.js +33 -1
- package/dist/trace/redact.d.ts +44 -30
- package/dist/trace/redact.js +191 -89
- package/dist/trace/self-minted-wire.d.ts +35 -14
- package/dist/trace/self-minted-wire.js +8 -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 +3 -3
- package/dist/trace/wire-projection-faces.js +1 -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 +28 -3
- package/dist/web-admin-client/skills-mcp.js +29 -1
- package/dist/web-admin-client/types.d.ts +16 -9
- 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 +2 -1
- package/scripts/drain-check.mysql.sql +4 -2
- package/scripts/drain-check.pg.sql +4 -2
- package/skills/loop.md +1 -1
- package/dist/http/run-declared-families.d.ts +0 -16
- package/dist/http/run-declared-families.js +0 -12
- package/dist/orchestration/workflow-journal-entry.js +0 -27
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 审批卡的**卡词**读口(server 侧唯一一处)与保留问答工具名的再导出。
|
|
3
3
|
*
|
|
4
|
-
* ── 规则(core 7.49.0
|
|
4
|
+
* ── 规则(core 7.49.0 [ref] / [ref] A-S4)────────────────────────────────────────────────────────────
|
|
5
5
|
* 「这一问 / 这一行用哪张卡」只有一个事实源 = **引擎铸的 `approvalCard`**(闭集 core `TOOL_APPROVAL_CARDS`):活 ask 上是
|
|
6
6
|
* `AskRequest.approvalCard`,停驻行上是门的 `gate.approvalCard`(core `summarizeCheckpoint` 投给 `CheckpointSummary.approvalCard`
|
|
7
7
|
* 的同一个词)。停驻行到期走哪条路只有一个判官 = core `facetOf(gate)`(问答卡 ⇒ `B`,到期作废;其余审批门 ⇒ `A`,SLA 拒扫腿 deny)。
|
|
8
8
|
* 本仓**不从工具名回推卡**:此前的 `contentKindOf`(工具名 ⇒ `"content_ask"`)、两只店里按 `tool_name` 判问答的 SQL 字面臂与 LOCAL
|
|
9
|
-
* 比较,以及 wire 上的第二个卡词 `contentKind`,随
|
|
9
|
+
* 比较,以及 wire 上的第二个卡词 `contentKind`,随 [ref] 整删(零别名、零双读)。
|
|
10
10
|
*
|
|
11
11
|
* ── 存量行(7.49.0 之前的引擎停驻、门上没有卡)────────────────────────────────────────────────────────
|
|
12
12
|
* 按 core 的读法:**无卡 = 不是一问**(core 不从名字回推,本仓也不)。持久数据面不留第二种读法 —— 按工具名回退的臂一旦留下,
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
* 本仓 CHANGELOG 对应条目:旧问答行在队列上不带卡词;过了 deadline 走 SLA 拒扫腿(模型拿到一次「拒」),不再作废整条 run。
|
|
15
15
|
*
|
|
16
16
|
* ── 为什么保留工具名常量 ────────────────────────────────────────────────────────────────────────────
|
|
17
|
-
* `ASK_USER_QUESTION_TOOL_NAME` 是 core 根导出的那一枚(
|
|
17
|
+
* `ASK_USER_QUESTION_TOOL_NAME` 是 core 根导出的那一枚([ref]①:本仓一个字节都不自铸),仍有**决断面**的读者(回决时「批准问答必须
|
|
18
18
|
* 带答」、问答不可记为会话放行、durable 问答门的政策臂)—— 那几处与 core 自己的答案绑定(`engineCardOf`,按 wire 名)同读法,
|
|
19
19
|
* 不是卡的渲染读法,不在本模块的规则里。
|
|
20
20
|
*/
|
|
21
21
|
export { ASK_USER_QUESTION_TOOL_NAME } from "@sema-agent/core";
|
|
22
|
-
import { type ToolApprovalCard } from "@sema-agent/core";
|
|
22
|
+
import { PAUSE_REGISTRY, type GateKind, type ToolApprovalCard } from "@sema-agent/core";
|
|
23
23
|
/**
|
|
24
24
|
* 一格卡词的**闭集窄读**(三个载体共用这一只:活 ask、LOCAL 店的停驻门、SQL 店读出的门子树)。成员 ⇒ 那个词;缺席 ⇒ `undefined`(不计);
|
|
25
25
|
* 在场却不是成员(世代差 —— 新引擎加了卡词而本版没跟上 —— 或手改行)⇒ `undefined` + 计一次 `server.approval-card.closed-word-out-of-set`
|
|
@@ -32,7 +32,7 @@ export interface ParkedGateFace {
|
|
|
32
32
|
readonly approvalCard?: unknown;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
* 停驻行的卡 —— 读法只有引擎那一只:core 包根导出 `parkedApprovalCardOf(gate)`(core 7.54.0
|
|
35
|
+
* 停驻行的卡 —— 读法只有引擎那一只:core 包根导出 `parkedApprovalCardOf(gate)`(core 7.54.0 [ref] K2;审批门 = 门型的寄存臂是 `tool_approval`,
|
|
36
36
|
* 只在那里读卡,只有闭集成员算卡)。四态逐一处置(穷举 `switch`:core 加一态 ⇒ 编译红):`card` ⇒ 那个词;`no_card` / `not_approval` ⇒ 无卡;
|
|
37
37
|
* `unknown_word`(引擎交回**未经筛**的存储原值)⇒ 无卡 + 响亮:计一次 `server.approval-card.closed-word-out-of-set`(与 {@link readApprovalCard} 同一只计数、
|
|
38
38
|
* 同一只回显口径 —— 截 40、脱敏,对象只报形名)。修前本函数自己判「是不是审批门」(读 `PAUSE_REGISTRY` 的寄存臂)再交 {@link readApprovalCard},
|
|
@@ -44,4 +44,21 @@ export declare function parkedApprovalCard(gate: ParkedGateFace | undefined): To
|
|
|
44
44
|
* 门型不是 core 登记的门(存量行无门型 / 手改)⇒ `undefined`,调用方按「不是 `A`」处置(与无门型存量行的既有作废路同向)。
|
|
45
45
|
*/
|
|
46
46
|
export declare function parkedFacetOf(gate: ParkedGateFace | undefined): "A" | "B" | "-" | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* 审批门型 = core `PAUSE_REGISTRY` 里寄存臂是 `tool_approval` 的登记门 —— 与 core `parkedApprovalCardOf` 判「是不是审批门」同一条判据(只在这些门上读卡)。
|
|
49
|
+
* **派生,不手写**(core 7.55.0 [ref] P1 阶段二):此前本仓手写一份二员词表([ref] 时 core 没有导出词表),一次性迁移 M21 又自派生一份;
|
|
50
|
+
* core 加一行审批味的门,这里跟着变,零处要改。读者:决断口与拒扫腿按门型绑定取行(`gateKinds`)、`/decide` 的门型守卫、M21 / M29 的候选扫描。
|
|
51
|
+
* 到期分法**不**读这张表 —— SQL 里是由 core 两张表生成的 facet 谓词(`plugins/checkpoint-index-columns.ts`),JS 里是 {@link denySweepOwns}。
|
|
52
|
+
*/
|
|
53
|
+
export type ApprovalGateKind = {
|
|
54
|
+
[K in GateKind]: (typeof PAUSE_REGISTRY)[K]["pending"] extends "tool_approval" ? K : never;
|
|
55
|
+
}[GateKind];
|
|
56
|
+
export declare const APPROVAL_GATE_KINDS: readonly ApprovalGateKind[];
|
|
57
|
+
export declare function isApprovalGateKind(k: string | undefined): k is ApprovalGateKind;
|
|
58
|
+
/**
|
|
59
|
+
* 停驻行的到期归 SLA 拒扫腿(deny)而不是作废(expire)?—— **一只谓词** = core `facetOf(gate)` 读作 `A`(按 core 的定义,`A` 就是「审批门、deadline 是 SLA 拒」;
|
|
60
|
+
* 问答卡 ⇒ `B`,到期作废;非审批门 / 未登记门 / 无门 ⇒ 不归拒扫)。LOCAL 孪生的拒扫选行与作废腿的补集读这一只;SQL 孪生读由同两张表生成的谓词,逐行与它同答
|
|
61
|
+
* (`test/checkpoint-index-columns.test.ts` B 节)。修前多一个「∧ 审批门型」合取 —— 在 core 的登记表下恒真,删。
|
|
62
|
+
*/
|
|
63
|
+
export declare function denySweepOwns(gate: ParkedGateFace | undefined): boolean;
|
|
47
64
|
//# sourceMappingURL=approval-content-kind.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ASK_USER_QUESTION_TOOL_NAME } from "@sema-agent/core";
|
|
2
|
-
import { TOOL_APPROVAL_CARDS, facetOf, isGateKind, parkedApprovalCardOf } from "@sema-agent/core";
|
|
2
|
+
import { PAUSE_REGISTRY, TOOL_APPROVAL_CARDS, facetOf, isGateKind, parkedApprovalCardOf } from "@sema-agent/core";
|
|
3
3
|
import { recordFailOpen } from "./observability/fail-open.js";
|
|
4
4
|
import { redactSecrets } from "./trace/redact.js";
|
|
5
5
|
export function readApprovalCard(raw) {
|
|
@@ -33,4 +33,11 @@ export function parkedApprovalCard(gate) {
|
|
|
33
33
|
export function parkedFacetOf(gate) {
|
|
34
34
|
return gate !== undefined && isGateKind(gate.kind) ? facetOf({ kind: gate.kind, approvalCard: gate.approvalCard }) : undefined;
|
|
35
35
|
}
|
|
36
|
+
export const APPROVAL_GATE_KINDS = Object.keys(PAUSE_REGISTRY).filter((k) => PAUSE_REGISTRY[k].pending === "tool_approval");
|
|
37
|
+
export function isApprovalGateKind(k) {
|
|
38
|
+
return k !== undefined && APPROVAL_GATE_KINDS.includes(k);
|
|
39
|
+
}
|
|
40
|
+
export function denySweepOwns(gate) {
|
|
41
|
+
return parkedFacetOf(gate) === "A";
|
|
42
|
+
}
|
|
36
43
|
//# sourceMappingURL=approval-content-kind.js.map
|
|
@@ -95,7 +95,7 @@ export type ApprovalEndingCause = (typeof APPROVAL_ENDING_CAUSES)[keyof typeof A
|
|
|
95
95
|
/** 全部成因词(机器判据用:值域互不相同 + 列宽 ≤ 64 的钉子在 test/approval-reconciler.test.ts)。 */
|
|
96
96
|
export declare const ALL_APPROVAL_ENDING_CAUSES: readonly ApprovalEndingCause[];
|
|
97
97
|
/**
|
|
98
|
-
* 审计 settle 行 `cause` 的读盘词表(
|
|
98
|
+
* 审计 settle 行 `cause` 的读盘词表([ref] 形):{@link SettleCause} 的穷举,`satisfies Record<SettleCause, true>` ⇒ 闭集加一个非决断类的词而本表没跟 = **编译红**(多一个词同样红);
|
|
99
99
|
* 判定走 `Object.hasOwn`,原型链上的名字不算词。决断类三词({@link DecisionRefusalCause})拒一次决议、不结束一张卡 ⇒ 不是 settle 行的成因,读到它们照词表外处置(计坏行)。
|
|
100
100
|
* 唯一读者 = {@link isSettleCause}。
|
|
101
101
|
*/
|
|
@@ -9,9 +9,24 @@
|
|
|
9
9
|
* ## 判官
|
|
10
10
|
* 问题:**这把 gate token 是不是该会话当前待决的审批门?**(应答口的答法:`resumeCheckpoint` 的 stale 臂 —— 回显的 token ≠ 该会话当前待决的审批门 ⇒ `409 approval_stale`。)
|
|
11
11
|
* · {@link currentApprovalGateToken} —— 该会话当前待决的审批门(审批门型优先,没有再退到任一待决行);应答口读它,读口读它,别处不再内联第二份;
|
|
12
|
-
* · {@link readGateCurrency} —— 一把 token 对着它的读数:`current`
|
|
12
|
+
* · {@link readGateCurrency} —— 一把 token 对着它的读数:`current`(带那一行)/ `absent`(店里没有这一行)/ `settled`(行在,但不再是当前待决门:已结算、已过期、被取代);
|
|
13
13
|
* · {@link createParkedGateRead} —— 协调器读口的门读席:把读数译成读口要的四种读法({@link ParkedGateReading}),`state` 闭集不加字。
|
|
14
14
|
*
|
|
15
|
+
* ## 一个读数只取自一个时刻([ref])
|
|
16
|
+
* 门身份就是 token:引擎重开一张门(`reopen`:续跑腿在被批准的动作开跑之前失败)翻的是**同一行**(resolved → pending,token 不变)。所以「这张卡此刻在哪」可以在两次店读之间
|
|
17
|
+
* 来回变(待决 → 被决 → 被重开);判官的分类只用**同一时刻成立**的读数:
|
|
18
|
+
* ① 行不在 ⇒ `absent`;行不 pending ⇒ 按这一行分类(不 pending 的行不可能是「当前待决」的那一把,不必再问);
|
|
19
|
+
* ② 行 pending ⇒ 问「当前待决」,**问完再读一次行**:世代号没动(`rev`:core 的单调世代号,每一次 resolve / reopen 都推它)⇒ 两次行读之间没有 resolve / reopen 落地 ⇒
|
|
20
|
+
* 「当前待决」那一读时它就是这一行(连同行上的重开事实)⇒ 答的是它 ⇒ `current`(带这一行),答的不是它 ⇒ 被取代(`settled`);
|
|
21
|
+
* 世代号动了 ⇒ 两次行读之间这张卡被决又被重开 ⇒ 用新的那一行**从 ① 重判**(有界 {@link GATE_READ_ROUNDS};摸到上界 ⇒ 抛,读口按店故障姿势处置);
|
|
22
|
+
* 第二读不在 / 不再 pending ⇒ 从 ① 按它分类。两个答案(是 / 不是当前待决)过的是**同一道**世代号核对:
|
|
23
|
+
* 拿「被决那一瞬」读到的当前待决与「重开之后」读到的 pending 拼出 `void`,或拿第一读的旧行(那一刻它还不是当前待决、也还没被重开)答「当前待决」,都是同一种拼法。
|
|
24
|
+
*
|
|
25
|
+
* ## 被重开的门怎么读([ref])
|
|
26
|
+
* `current` 的那一行上若带 core 的重开事实(`reopenReason`,闭集 `REOPEN_REASONS`;下一次 resolve 清掉它),读法是 `open` + `reopened`:core 的因由词原样 +
|
|
27
|
+
* **重开之前的决议**(core 跨重开保留赢家 `resolvedOutcome`;读它的是已结算门 `decided` 的**同一只**决议读法 {@link decisionReading} —— 一个记录一个读者)。
|
|
28
|
+
* 那只读法读不出决议 ⇒ 只带因由词,不编一个决议;因由词不在 core 的闭集里(只有手改行带得出)⇒ 不带 `reopened`(读不懂的词说不出「重开」是哪一种)。
|
|
29
|
+
*
|
|
15
30
|
* ## `settled` 怎么译(读口只说 checkpoint 上有凭据的话;一条规矩)
|
|
16
31
|
* 落盘的行不受类型面约束(旧版 / 手改 / 坏体 / 更新版本 core 写下的行可带闭集外的词或坏形),所以已结算门只按**一条规矩**读:
|
|
17
32
|
* ① 两个闭集词(行的 `status`、结算记录的种类 `settlement.kind`)各查一张穷举表,**同一查法**({@link throughTable}:只认表自己的键,非字符串不进表):
|
|
@@ -45,16 +60,20 @@ export interface GateCurrencyStore {
|
|
|
45
60
|
* 无序读会选中别的门型 —— 没有审批门才退到任一待决行(错门型诊断由 `/decide` 的 gate-kind 守卫点名)。应答口的 stale 臂与按问读口读这一只。
|
|
46
61
|
*/
|
|
47
62
|
export declare function currentApprovalGateToken(cs: Pick<GateCurrencyStore, "findPendingTokenBySession">, sessionId: string): Promise<CheckpointToken | null | undefined>;
|
|
48
|
-
/** 一把 gate token
|
|
63
|
+
/** 一把 gate token 对着判官的读数(`current` / `settled` 带分类用的那一行)。 */
|
|
49
64
|
export type GateCurrency = {
|
|
50
65
|
readonly kind: "current";
|
|
66
|
+
readonly checkpoint: Checkpoint;
|
|
51
67
|
} | {
|
|
52
68
|
readonly kind: "absent";
|
|
53
69
|
} | {
|
|
54
70
|
readonly kind: "settled";
|
|
55
71
|
readonly checkpoint: Checkpoint;
|
|
56
72
|
};
|
|
57
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* 这把 gate token 是不是它那条会话当前待决的审批门 —— 分类只用同一时刻成立的读数(规矩见模块头注「一个读数只取自一个时刻」)。
|
|
75
|
+
* 读不出(店抛错)⇒ 原样上抛,由调用方的故障姿势处置;行一直在动、摸到 {@link GATE_READ_ROUNDS} ⇒ 抛。
|
|
76
|
+
*/
|
|
58
77
|
export declare function readGateCurrency(cs: GateCurrencyStore, gateToken: string): Promise<GateCurrency>;
|
|
59
78
|
/** 一个闭集词对已结算门的读法类:有人 / 有策略决过(往下读决议),或没有人决过它。 */
|
|
60
79
|
type SettledClass = "decided" | "void";
|
|
@@ -1,20 +1,32 @@
|
|
|
1
|
-
import { screenGateOutcome } from "@sema-agent/core";
|
|
1
|
+
import { REOPEN_REASONS, screenGateOutcome } from "@sema-agent/core";
|
|
2
2
|
import { approvalDecisionOfWinner } from "./plugins/checkpoint-store-sql.js";
|
|
3
|
-
import {
|
|
3
|
+
import {} from "./tool-approval.js";
|
|
4
|
+
import { APPROVAL_GATE_KINDS } from "./approval-content-kind.js";
|
|
4
5
|
export async function currentApprovalGateToken(cs, sessionId) {
|
|
5
6
|
return (await cs.findPendingTokenBySession(sessionId, undefined, { gateKinds: APPROVAL_GATE_KINDS })) ?? (await cs.findPendingTokenBySession(sessionId));
|
|
6
7
|
}
|
|
8
|
+
function revisionOf(cp) {
|
|
9
|
+
return cp.rev ?? 0;
|
|
10
|
+
}
|
|
11
|
+
const GATE_READ_ROUNDS = 3;
|
|
7
12
|
export async function readGateCurrency(cs, gateToken) {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const token = gateToken;
|
|
14
|
+
let row = await cs.get(token);
|
|
15
|
+
for (let round = 1;; round += 1) {
|
|
16
|
+
if (row === null)
|
|
17
|
+
return { kind: "absent" };
|
|
18
|
+
if (row.status !== "pending")
|
|
19
|
+
return { kind: "settled", checkpoint: row };
|
|
20
|
+
const isCurrent = (await currentApprovalGateToken(cs, row.sessionId)) === gateToken;
|
|
21
|
+
const again = await cs.get(token);
|
|
22
|
+
if (again !== null && again.status === "pending") {
|
|
23
|
+
if (revisionOf(again) === revisionOf(row))
|
|
24
|
+
return isCurrent ? { kind: "current", checkpoint: again } : { kind: "settled", checkpoint: again };
|
|
25
|
+
if (round === GATE_READ_ROUNDS)
|
|
26
|
+
throw new Error(`the checkpoint row moved between reads in ${GATE_READ_ROUNDS} rounds in a row (decided and reopened each time): there is no single-instant reading of its gate`);
|
|
27
|
+
}
|
|
28
|
+
row = again;
|
|
29
|
+
}
|
|
18
30
|
}
|
|
19
31
|
const SETTLED_GATE_READING = { resolved: "decided", expired: "void", pending: "void" };
|
|
20
32
|
export const SETTLEMENT_KIND_READING = {
|
|
@@ -42,17 +54,18 @@ function throughTable(table, word, field) {
|
|
|
42
54
|
return table[word] === "decided" ? "decided" : { kind: "void" };
|
|
43
55
|
}
|
|
44
56
|
function settledReading(checkpoint, gateBoundCallId) {
|
|
57
|
+
const byStatus = throughTable(SETTLED_GATE_READING, checkpoint.status, "checkpoint status");
|
|
58
|
+
return byStatus === "decided" ? decisionReading(checkpoint, gateBoundCallId) : byStatus;
|
|
59
|
+
}
|
|
60
|
+
function decisionReading(checkpoint, gateBoundCallId) {
|
|
45
61
|
try {
|
|
46
|
-
return
|
|
62
|
+
return readWinner(checkpoint, gateBoundCallId);
|
|
47
63
|
}
|
|
48
64
|
catch (e) {
|
|
49
65
|
return unreadable([`the settled row could not be read (${e instanceof Error ? e.name : "non-Error throw"})`]);
|
|
50
66
|
}
|
|
51
67
|
}
|
|
52
|
-
function
|
|
53
|
-
const byStatus = throughTable(SETTLED_GATE_READING, checkpoint.status, "checkpoint status");
|
|
54
|
-
if (byStatus !== "decided")
|
|
55
|
-
return byStatus;
|
|
68
|
+
function readWinner(checkpoint, gateBoundCallId) {
|
|
56
69
|
const winner = checkpoint.resolvedOutcome;
|
|
57
70
|
const recorded = winner?.gateOutcome;
|
|
58
71
|
const [defect, ...more] = screenGateOutcome(recorded, { reading: "archive" });
|
|
@@ -73,12 +86,25 @@ function readSettledRow(checkpoint, gateBoundCallId) {
|
|
|
73
86
|
const note = typeof winner?.reason === "string" && winner.reason !== "" ? winner.reason : undefined;
|
|
74
87
|
return { kind: "decided", decision: direction === "approve" ? "allow" : "deny", decidedAtMs: settlement.when, ...(note !== undefined ? { decisionNote: note } : {}) };
|
|
75
88
|
}
|
|
89
|
+
function isReopenReason(word) {
|
|
90
|
+
return typeof word === "string" && REOPEN_REASONS.includes(word);
|
|
91
|
+
}
|
|
92
|
+
function openReading(checkpoint, gateBoundCallId) {
|
|
93
|
+
const reason = checkpoint.reopenReason;
|
|
94
|
+
if (!isReopenReason(reason))
|
|
95
|
+
return { kind: "open" };
|
|
96
|
+
const prior = decisionReading(checkpoint, gateBoundCallId);
|
|
97
|
+
const reopened = prior.kind === "decided"
|
|
98
|
+
? { reason, decision: prior.decision, decidedAtMs: prior.decidedAtMs, ...(prior.decisionNote !== undefined ? { decisionNote: prior.decisionNote } : {}) }
|
|
99
|
+
: { reason };
|
|
100
|
+
return { kind: "open", reopened };
|
|
101
|
+
}
|
|
76
102
|
export function createParkedGateRead(cs) {
|
|
77
103
|
return async ({ gateToken, gateBoundCallId }) => {
|
|
78
104
|
const currency = await readGateCurrency(cs, gateToken);
|
|
79
105
|
switch (currency.kind) {
|
|
80
106
|
case "current":
|
|
81
|
-
return
|
|
107
|
+
return openReading(currency.checkpoint, gateBoundCallId);
|
|
82
108
|
case "absent":
|
|
83
109
|
return { kind: "unknown", why: "row_absent" };
|
|
84
110
|
case "settled":
|
package/dist/approval-hmac.d.ts
CHANGED
|
@@ -13,25 +13,25 @@ import type { ApprovalHmacKey } from "./auth-keys.js";
|
|
|
13
13
|
* 被接管的客户端 —— 正是 HMAC 要防的风险模型)可以在操作员批准同一个动作的那次决定里,把落账理由换成
|
|
14
14
|
* 别的:动作没变,**审计记录变了**。三方裁定纳入签名载荷,不留 `reasonUnsigned` 宽限代际(未上生产)。
|
|
15
15
|
*
|
|
16
|
-
* ── 🔴 **两把绑定的分工**(
|
|
16
|
+
* ── 🔴 **两把绑定的分工**([ref] F1 立此,别再把它们当成一回事)─────────────────────────────────
|
|
17
17
|
* `principal-jwt.ts` 的 `approvalBnd`(JWT `cnf.bnd`)只哈希**前三位** `[sessionId, boundCallId, boundInputHash]`
|
|
18
18
|
* —— 它绑的是**「哪一张卡」**(这份身份凭据被签发去决哪一次待决动作),所以决定内容改了它**不该**变。
|
|
19
19
|
* 本文件的 HMAC 信封绑的是**「决了什么」**—— 决定本身的每一个会改变后果的字段都在里面(`decision`、
|
|
20
|
-
* `reason`,以及
|
|
20
|
+
* `reason`,以及 [ref] 起的 `permissionModeAfter`)。⇒ 「同一张卡上把 approve 的档偷偷调宽」这件事,
|
|
21
21
|
* 结构上只有 HMAC 这一把拦得住;往 `cnf.bnd` 里加位既不解决它,还会把一份合法 JWT 绑死在一个它签发时
|
|
22
|
-
* 根本不知道的值上。**本次(
|
|
22
|
+
* 根本不知道的值上。**本次([ref] F1)只动 HMAC 这一把,`approvalBnd` 一个字节不动。**
|
|
23
23
|
*
|
|
24
24
|
* ── 🔴 字节构造规则(权威定义;跨仓签名器照此实现,docs/ASSISTANT-WIRE-CONTRACT.md §6.2 同源)──────────
|
|
25
25
|
* 被 HMAC 的是下面这个字符串的 **UTF-8 字节**:
|
|
26
26
|
* 1. **恒 5 元素、定序**的紧凑 JSON 数组(元素间**无空格**):
|
|
27
27
|
* `[sessionId, boundCallId|null, boundInputHash|null, decision, reason|null]`
|
|
28
28
|
* —— 恒定长度是刻意的:签名器里少一个"有 reason 才追加"的条件分支,就少一类跨实现漂移。
|
|
29
|
-
* 🔴 **唯一的例外是尾位**(
|
|
29
|
+
* 🔴 **唯一的例外是尾位**([ref],server 7.87.0 起是**一只扩展对象**;7.86.0 的裸尾位形已删除):
|
|
30
30
|
* 对扩展键**闭集** {@link APPROVAL_ENVELOPE_EXT_KEYS}(字典序即声明序)逐键判 `!== undefined`,
|
|
31
31
|
* 在场的收进一只对象 `ext`;**`ext` 为空 ⇒ 一个字节都不追加**(消息与 7.85.0 逐字节相同),
|
|
32
32
|
* 非空 ⇒ 追加为第 6 位 `[…head, ext]`。`JSON.stringify` 对 `ext` 的键序 = 插入序 = 闭集字典序,
|
|
33
33
|
* 所以规范化无歧义,**与调用方给键的顺序无关**。
|
|
34
|
-
* 为什么不继续用「裸的第 6、7 格」(
|
|
34
|
+
* 为什么不继续用「裸的第 6、7 格」([ref] 的形):两个扩展位都可选 ⇒ 只有 `answer` 在场时它落在
|
|
35
35
|
* 第 6 格、与 `permissionModeAfter` 撞位,靠类型猜是谁 = 签名歧义。扩展对象让「在场的是谁」自带
|
|
36
36
|
* 名字,而且以后再加决裁字段不动数组形(规则集不再长)。
|
|
37
37
|
* 向后兼容仍然成立的那一半:**不带任何扩展键的体**,字节与 7.85.0 逐字相同 ⇒ 不签这些位的既有
|
|
@@ -95,7 +95,7 @@ export interface ApprovalEnvelope {
|
|
|
95
95
|
decision: string;
|
|
96
96
|
reason?: string | null;
|
|
97
97
|
/**
|
|
98
|
-
* 🔴 **
|
|
98
|
+
* 🔴 **[ref](7.87.0)—— 操作员对一次 AskUserQuestion 的回答进签名载荷。**
|
|
99
99
|
*
|
|
100
100
|
* 它此前**不在**信封里 ⇒ 一个能改写线上字节的中间人(反代 / 被接管的客户端 —— 正是 HMAC 的风险
|
|
101
101
|
* 模型)可以在操作员签过的那次批准里只换 `answer`:动作没变、MAC 照过,**模型收到的答案变了**。
|
|
@@ -106,7 +106,7 @@ export interface ApprovalEnvelope {
|
|
|
106
106
|
*/
|
|
107
107
|
answer?: QuestionAnswerProjection;
|
|
108
108
|
/**
|
|
109
|
-
* 🔴 **
|
|
109
|
+
* 🔴 **[ref] 合并复审 F1 [high]**(7.86.0 立,[ref] 把它从裸尾位挪进扩展对象)—— `plan_review` 的
|
|
110
110
|
* `permissionModeAfter` 选的是**批准之后这条 run 有没有手**(`acceptEdits` = 工作目录内的写不再逐次
|
|
111
111
|
* 征询)。它铸下来时没有进签名载荷 ⇒ 中间人可以把操作员签的那次 `default` 批准原地改成 `acceptEdits`:
|
|
112
112
|
* 动作没变、MAC 照过,**权限变了**。
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref] / [ref] —— 「无人可答」的**政策感知终态 claim**:全仓唯一一只(NP-2 的政策结算抽出来,四处调用,不写第二份)。
|
|
3
3
|
*
|
|
4
4
|
* 一句话:一只没人答的 ask 在持久 ask 行上**落什么终局**,由部署政策(`UNATTENDED_APPROVAL_POLICY`)一处决定 ——
|
|
5
5
|
* · `park` ⇒ `expire` 意图:STREAM_PENDING→PARKING、批转投递面、同批流内兄弟连坐 VOID(park 路由的单位是整批,core 随后
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* 3. 两兜底臂 —— `ensureAsk` 行不可用 / ensure 身份不定(`tool-approval.ts` `landUnattendedOutcome`,只在交给 core 的是**结算**时
|
|
16
16
|
* 调:park 路由不是结算,行留给投递面的既有机器,park 行为逐字不变),以及后者迟到落盘那条行的收尾;
|
|
17
17
|
* 4. 崩溃恢复腿 —— 对账收敛器段二的孤儿 STREAM_PENDING 代打(`approval-reconciler.ts`):它就是窗到期竞争者在崩溃后的补位,
|
|
18
|
-
* 同一只 claim、同一个转移(
|
|
18
|
+
* 同一只 claim、同一个转移([ref] 之前它无条件 `expireAsk`,deny 部署上崩溃后行进 PARKING,run 完成后成不带来源的 DENIED)。
|
|
19
19
|
*
|
|
20
20
|
* 形:纯委托 —— 店的原子终局 claim(`ApprovalAskStore.claimTerminal`,三 twin 一台 CAS 机器,律 2)+ 政策→意图的穷举映射。
|
|
21
21
|
* 答案自足(律 1):赢 ⇒ `{claimed:true, voidedSiblings}`(refuse 恒空名单);输 ⇒ 携行真相;抛错 ⇒ 什么也不证明。
|
|
@@ -192,7 +192,7 @@ export interface ReconcileStats {
|
|
|
192
192
|
* (见 {@link RECONCILE_SEGMENT_BUDGET_MS})。 */
|
|
193
193
|
budgetExhausted: number;
|
|
194
194
|
/** 段二:被代打**窗到期终局 claim** 的孤儿 `STREAM_PENDING` 行数(赢 CAS 的)。「expired」指触发(窗过了没人收),
|
|
195
|
-
* 不指意图 —— 与 live 腿 `window_expired` 同一个读法:park 部署 ⇒ expire(进投递面);deny 部署 ⇒ refuse(当场落政策结算,
|
|
195
|
+
* 不指意图 —— 与 live 腿 `window_expired` 同一个读法:park 部署 ⇒ expire(进投递面);deny 部署 ⇒ refuse(当场落政策结算,[ref])。 */
|
|
196
196
|
orphansExpired: number;
|
|
197
197
|
}
|
|
198
198
|
/** 撤卡帧的投递面(逐 ctx 分发:durable 腿落账本、sync 腿 live,见 `ApprovalRevokeFrame` 顶注)。
|
|
@@ -226,13 +226,13 @@ export interface ApprovalReconcilerDeps {
|
|
|
226
226
|
adhocGraceMs: number;
|
|
227
227
|
orphanTtlMs: number;
|
|
228
228
|
/**
|
|
229
|
-
*
|
|
229
|
+
* [ref]:部署的无人值守政策(`UNATTENDED_APPROVAL_POLICY`)—— 段二孤儿代打打的是哪个终局 claim。**必填**、恒传(与协调器
|
|
230
230
|
* 读同一个部署值;没有缺省 —— 缺省 park 会让 deny 部署在崩溃恢复这一形上静默退回「进投递面 → 不带来源的 DENIED」)。
|
|
231
231
|
*/
|
|
232
232
|
unattendedPolicy: UnattendedApprovalPolicy;
|
|
233
233
|
emitRevoke?: ApprovalRevokeEmitter | undefined;
|
|
234
234
|
/**
|
|
235
|
-
*
|
|
235
|
+
* [ref]:park 提交的唯一观察点(`plugins/park-commit-watch.ts`;在场 ⇔ 本部署有 checkpoint 店)。在场 ⇒ 收敛器订阅它:一只审批停车行
|
|
236
236
|
* 提交的那一拍,对**这次调用**的 `PARKING` 行即时跑判据 1(与周期扫同一只执行体),`put` 等它收完才交还 core。缺席 ⇒ 只有周期扫(修前形)。
|
|
237
237
|
*/
|
|
238
238
|
parkCommits?: Pick<ParkCommitWatch, "onParkCommitted" | "track"> | undefined;
|
package/dist/approval.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { type ExecutionLane } from "./execution-lane-caps.js";
|
|
|
9
9
|
import { type ApprovalExemptionStore } from "./plugins/approval-exemption-store.js";
|
|
10
10
|
/**
|
|
11
11
|
* 门意图判据读的五个量(`ServiceConfig` 结构满足)。单独成型是为了让**热路径**能拿「候选视图」来判
|
|
12
|
-
* (
|
|
12
|
+
* ([ref] 波 2:`{ ...config, approvalRequire: 候选名单 }`)—— 判据只有一份,输入可以是活配置也可以是候选。
|
|
13
13
|
*/
|
|
14
14
|
export interface GateIntentView {
|
|
15
15
|
readonly approvalRequire: readonly string[];
|
|
@@ -21,7 +21,7 @@ export interface GateIntentView {
|
|
|
21
21
|
/**
|
|
22
22
|
* 三张审批名单(require / deny / never-auto)里**有没有一张在场** —— 「这台部署有一份要执行的审批策略」。
|
|
23
23
|
*
|
|
24
|
-
* 🔴
|
|
24
|
+
* 🔴 [ref] 波 2(codex r1 F1):leader 车道的 durable 审批席曾只按 `approvalRequire` 非空给出。require 名单转热之后,
|
|
25
25
|
* 中心热撤空它就把 leader worker 上**独立**的 deny / never-auto 两张表一起撤掉(主车道照旧 deny / ask)—— 三张表是
|
|
26
26
|
* 三条独立的限制,任何一张在场都要装策略。{@link hasOperatorGateIntent} 的名单三格就是本函数(同一判据,不写两份)。
|
|
27
27
|
*/
|
|
@@ -42,9 +42,9 @@ export declare function hasApprovalListIntent(config: Pick<GateIntentView, "appr
|
|
|
42
42
|
*/
|
|
43
43
|
export declare function hasOperatorGateIntent(config: GateIntentView): boolean;
|
|
44
44
|
/**
|
|
45
|
-
* 单用户 turnkey 的 **auto-accept 基线**适用吗 —— 单用户(
|
|
45
|
+
* 单用户 turnkey 的 **auto-accept 基线**适用吗 —— 单用户(部署形表行 `multiTenant` 不成立)∧ 运维零门意图。
|
|
46
46
|
*
|
|
47
|
-
* 🔴
|
|
47
|
+
* 🔴 [ref] 波 2 ③:**每请求现算**,不是 boot 常量。判据的输入 `approvalRequire` 自本批起在进程内会被中心
|
|
48
48
|
* 热换;boot 期算好的一个布尔会让「名单从空变非空」之后 allow-all 基线仍挂在每个新任务上 —— 运维刚表达的
|
|
49
49
|
* 门意图被基线静默吞掉([ref] 方向)。所以消费点(`boot/resolve-spec.ts` 每个任务、stage-07 的 boot 姿态行、
|
|
50
50
|
* run-local 的补偿 warn)一律调本函数,谁也不持有它的快照。
|
|
@@ -58,10 +58,10 @@ export declare function singleUserAutoAcceptBaselineApplies(config: GateIntentVi
|
|
|
58
58
|
* HIGH;与 env 墓碑族同谱系)。v4.3.0 的轮询门形(APPROVAL_REQUIRE + DB backend + DURABLE_APPROVAL 未设)在
|
|
59
59
|
* 5.0.0 只剩 core 每任务 warn——**原先拦、现在放**(方向反转)。「留 undefined 让 core warn」对新配置是
|
|
60
60
|
* 曝露误配,对升级存量是门静默消失,后者必须响亮。
|
|
61
|
-
* · **热路径**(
|
|
61
|
+
* · **热路径**([ref] 波 2 ④,`web-admin-client/apply-effective.ts` 的审批组 stage):对**候选视图**
|
|
62
62
|
* (活配置 + 候选名单)判,拒因 ⇒ 审批组**整组拒**、活配置零变化、世代账停旧代。进程在跑,拒启不是选项;
|
|
63
63
|
* 而放行一份「没有 checkpoint 店可停车」的名单 = 单用户 auto-accept 基线仍在、名单静默不生效。
|
|
64
|
-
* · **每个任务的装配**(
|
|
64
|
+
* · **每个任务的装配**([ref],`boot/resolve-spec.ts` 的 `resolveSpec` 头一道):对**活配置**判,拒因 ⇒ 请求 501
|
|
65
65
|
* `capability.checkpoint_store_required`。部署形到不了(boot 已拒启);可达的是嵌入方装配 / 直调 `resolveSpec`(自己递 ctx、没经 stage-07)。
|
|
66
66
|
* 修前这一形把审批基线静默铸成 `undefined`,请求的 allow 清「普通问」后任务零卡落盘 —— 同一条规则在起服层拒、在装配层静默 = 一事两读。
|
|
67
67
|
* `checkpointStorePresent` 是**部署事实**(本进程建没建出 checkpoint 店),不在 `ServiceConfig` 里 ⇒ 调用方显式递。
|
|
@@ -69,7 +69,7 @@ export declare function singleUserAutoAcceptBaselineApplies(config: GateIntentVi
|
|
|
69
69
|
*/
|
|
70
70
|
export declare function gateIntentUnserviceableReason(config: GateIntentView, checkpointStorePresent: boolean): string | undefined;
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* [ref] C3 —— 「**无应答面**」两条 boot warn 的判据与文案(纯函数;stage-07 只负责打日志)。
|
|
73
73
|
*
|
|
74
74
|
* 两条 warn 警的是同一类失败:一个 `ask` 发生了,而这台部署既没有活体协调器(`TOOL_APPROVAL_ENABLED`)也没有
|
|
75
75
|
* durable 停车(`DURABLE_APPROVAL`)⇒ core `resolveAsk` 无 onAsk ⇒ headless 自动拒(fail-closed,写进转录)。
|
|
@@ -191,7 +191,7 @@ export declare function createDeploymentListExemption(store: Pick<ApprovalExempt
|
|
|
191
191
|
*/
|
|
192
192
|
export declare const AUTO_APPROVE_BUDGET_APPROVER = "auto_approve_budget";
|
|
193
193
|
/**
|
|
194
|
-
* **请求叶策略:`settings.permissions.neverAuto`**(
|
|
194
|
+
* **请求叶策略:`settings.permissions.neverAuto`**([ref])—— 命中名单的工具恒问真人;名单外「本层没有意见」(裸 allow)。叶只管请求自己写的那张表,部署的 `APPROVAL_NEVER_AUTO`
|
|
195
195
|
* 在基线里({@link createDurableAskPolicy}),两者经 `tightenGoverned` 的 deny-wins 折叠取并:请求叶只会**多**问,删不掉基线里的任何一行。
|
|
196
196
|
*
|
|
197
197
|
* 名字读法与部署名单是**同一只**({@link createApprovalListVerdict} → 精确 ∪ covering,收紧臂读调用答得上的全部名字):一条规则只有一种读法。问的铸点是
|
package/dist/approval.js
CHANGED
|
@@ -2,7 +2,9 @@ import { createApprovalPolicy, isNamespacedCoveringRuleName, namespacedRuleNameC
|
|
|
2
2
|
import { operatorAlwaysHumanAsk, operatorAsk, requestAlwaysHumanAsk } from "./operator-ask.js";
|
|
3
3
|
import { ASK_USER_QUESTION_TOOL_NAME } from "./approval-content-kind.js";
|
|
4
4
|
import { isExplicitPosture } from "./posture-source.js";
|
|
5
|
+
import { DEPLOYMENT_SHAPE_PREDICATES } from "./deployment-shape.js";
|
|
5
6
|
import { handsOnWorkerFilePlane } from "./execution-lane-caps.js";
|
|
7
|
+
import { NAME_TABLE_BEHAVIOR } from "./namespaced-rule-name.js";
|
|
6
8
|
import { heldRuleName } from "./tool-rule-names.js";
|
|
7
9
|
import { DURABLE_CONVERGE_READ_TIMEOUT_MS, policyAskStandingAnswerFacts, standingAnswerDurablyRecordable } from "./tool-approval.js";
|
|
8
10
|
import { APPROVAL_EXEMPTED_EVENT } from "./plugins/approval-exemption-store.js";
|
|
@@ -16,7 +18,7 @@ export function hasOperatorGateIntent(config) {
|
|
|
16
18
|
(config.durableApproval && isExplicitPosture(config.durableApprovalSource)));
|
|
17
19
|
}
|
|
18
20
|
export function singleUserAutoAcceptBaselineApplies(config) {
|
|
19
|
-
return config
|
|
21
|
+
return !DEPLOYMENT_SHAPE_PREDICATES.multiTenant.holds(config) && !hasOperatorGateIntent(config);
|
|
20
22
|
}
|
|
21
23
|
export function gateIntentUnserviceableReason(config, checkpointStorePresent) {
|
|
22
24
|
if (!hasOperatorGateIntent(config) || checkpointStorePresent)
|
|
@@ -114,7 +116,7 @@ export function createDeploymentListExemption(store, sessionId, logger, leg) {
|
|
|
114
116
|
}
|
|
115
117
|
function createNameSetMatcher(names) {
|
|
116
118
|
const exact = new Set(names);
|
|
117
|
-
const covering = names.filter(isNamespacedCoveringRuleName);
|
|
119
|
+
const covering = names.filter((name) => isNamespacedCoveringRuleName(name, NAME_TABLE_BEHAVIOR));
|
|
118
120
|
if (covering.length === 0)
|
|
119
121
|
return (toolName) => exact.has(toolName);
|
|
120
122
|
return (toolName) => exact.has(toolName) || covering.some((rule) => namespacedRuleNameCovers(rule, toolName));
|
package/dist/auth-bridge.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Logger } from "./observability/logger.js";
|
|
|
3
3
|
import type { Metrics } from "./observability/metrics.js";
|
|
4
4
|
export type { VerifiedIdentity } from "@sema-agent/settings-schema/api/auth-bridge";
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* [ref] ② —— 鉴权桥 issuer 的**唯一**取值(装配 `boot/stage-09-leader.ts` 与 caps `centerWiring.issuer` 同读,不各写一份回退):
|
|
7
7
|
* 显式 `AUTH_BRIDGE_ISSUER`(`config.authBridgeIssuer`)恒赢 ⇒ `source:"explicit"`;缺席则回退中心基址 `webAdmin.baseUrl`
|
|
8
8
|
* (配了中心即默认开桥)⇒ `source:"fallback"`;两者都没有 ⇒ `undefined`(桥不装)。
|
|
9
9
|
*/
|
package/dist/auto-mode-face.d.ts
CHANGED
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
* capabilities 查询串不带 settings ⇒ 本面不产);
|
|
28
28
|
* · `resolver_fault` —— resolver 抛错(core 同形全拒:autoMode:false + onError phase config)。
|
|
29
29
|
*
|
|
30
|
-
* 🔴
|
|
30
|
+
* 🔴 [ref](core 7.34.0 提货):「这台机器上装的 core 用哪套武装极性」的**安装包探针**(按文本扫
|
|
31
31
|
* `dist/core/runner/prepare-task.js` 找 `autoModeRequested`)整只退役 —— 7.34.0 起那个键被引擎按名拒,探针的主判
|
|
32
|
-
* 恒假、佐证恒真 ⇒ 矛盾臂 fatal,整台 server 起服即拒(
|
|
32
|
+
* 恒假、佐证恒真 ⇒ 矛盾臂 fatal,整台 server 起服即拒([ref] 探针 7.34.0 读数的 13 只红文件同一根因)。
|
|
33
33
|
* 极性不再是运行期要猜的事实:本仓把 core **精确钉版**(`package.json`,`test/core-dependency-floor.test.ts` 承重),
|
|
34
34
|
* 钉住的那一版的武装谓词就是上面那一行,由类型面(`TaskSpec.permissionMode` / `RunnerDeps.autoMode` /
|
|
35
35
|
* `RuntimeCaps.autoMode`)与 core CHANGELOG 同时陈述。⇒ 旧式臂(「org 授予」极性)与 `engineArmsOnIntent` 座一并删,
|
|
@@ -51,7 +51,7 @@ import { type PermissionMode, type RunnerDeps, type RuntimeCaps } from "@sema-ag
|
|
|
51
51
|
* 本仓 [ref] 的跨仓诉求兑现;契约句 `classifier.seat.one_resolver` 逐字:引擎的武装点与**显示这个席**
|
|
52
52
|
* 的宿主读面调同一只导出函数,而不是各自从目录/角色/档位表再推一遍 —— 第二份推导就是第二个答案)。
|
|
53
53
|
*
|
|
54
|
-
* 🔴 **
|
|
54
|
+
* 🔴 **[ref]:本仓的自算分支已删**。修前这里调的是 `resolveTaskModel({modelRole:"classifier"})`,那只
|
|
55
55
|
* 回答的是「classifier **角色**解到谁」;引擎真正挑席时在角色没点名模型的情况下还要走 **tierBelowMain**
|
|
56
56
|
* (主模型档位**严格之下**、路由不同的最近一档)。两者在「档位表在场 + 没有 classifier 角色」这一形上
|
|
57
57
|
* 给出**不同的模型**(车FL U-3 坐实),读面于是对着 `sema doctor permissions` 报另一只模型。规则变少的
|
|
@@ -92,7 +92,7 @@ export declare const AUTO_MODE_UNARMED_REASON_SEMANTICS: {
|
|
|
92
92
|
readonly resolver_fault: "per-principal caps resolver 抛错/答非记录(core 同形全拒:autoMode:false + onError phase config)";
|
|
93
93
|
};
|
|
94
94
|
/** 装配面交给读面的三件事实(`main.ts` 从 runnerDeps / 合成后的 caps resolver 取,读面不自算)。
|
|
95
|
-
*
|
|
95
|
+
* [ref]:第四件「引擎半场到货位」(`engineArmsOnIntent`,安装包探针)随极性探针一起退役。 */
|
|
96
96
|
export interface AutoModeFaceDeps {
|
|
97
97
|
/** `RunnerDeps.autoMode !== undefined`——**读**装配点那一位,不写字面 true(与 parked-revive 的
|
|
98
98
|
* `autoModeSeatMounted` 同一纪律:席位哪天改成有条件挂载,这里不能静默错供)。 */
|
|
@@ -39,7 +39,7 @@ export interface SessionHardReap {
|
|
|
39
39
|
* + run 的 task id 就是会话 id 的 run 行;同一个 id 在别的 scope 是别的会话;别的会话的行永远不碰)—— 宽限里跑完处理器的进程答
|
|
40
40
|
* `already_gone`,屏蔽 / 没跑完的在这一枪组 SIGKILL(与 host 梯子自己到点的那一枪同拍,两枪都是组 SIGKILL,幂等)。同拍是设计内的:
|
|
41
41
|
* 两枪谁先是同一毫秒的定时器次序。硬面先打 ⇒ `killed`;梯子先打、引擎还没收割组长 ⇒ 硬面那一枪落在只剩僵尸的组上:darwin EPERM ⇒
|
|
42
|
-
* `no_pgid`(未确认)、linux ⇒ `killed`;已收割 ⇒ `already_gone`。受据按观察答(
|
|
42
|
+
* `no_pgid`(未确认)、linux ⇒ `killed`;已收割 ⇒ `already_gone`。受据按观察答([ref] 车PA 删了「已硬收过」闩:组信号任一成员收到即
|
|
43
43
|
* 成功,闩在部分送达时把活着读成没了),本函数也不为「让硬面先打」挪任何一拍。
|
|
44
44
|
*
|
|
45
45
|
* `scope` = 会话行属主 `owner ?? "default"`(与 core 注册铸值 `spec.principal ?? "default"` 同源 —— 缺席 scope 在 core 的
|
|
@@ -48,7 +48,7 @@ export interface SessionHardReap {
|
|
|
48
48
|
* 两处调用(见文件头 ①),都 `await`:E21 删除级联 `includeRetained:false`(显式活服务照留);停止口照传请求体。应答在硬面之后发,
|
|
49
49
|
* 代价 = 有 shell 行刚被软停的会话,DELETE / 停止口的应答慢到最后一行的「软停 + 宽限」(通常一次宽限;操作员旋钮 `HOST_BG_KILL_GRACE_MS`,缺省 1000;要几乎不等写 `1` ——
|
|
50
50
|
* `numEnvOr` 把 `0` 读作缺席、回落缺省,与它供的其余执行车道旋钮同一条语义)。
|
|
51
|
-
* 受委托帮手的 shell 挂在帮手自己的会话上,本函数碰不到(core KL-1107a /
|
|
51
|
+
* 受委托帮手的 shell 挂在帮手自己的会话上,本函数碰不到(core KL-1107a / [ref],候 core)。
|
|
52
52
|
* 注册表是**进程内**的:只收本副本上的行(多副本部署里别的副本上的行由那个副本自己的出口收)。
|
|
53
53
|
*/
|
|
54
54
|
export declare function reapSessionBackgroundHard(sessionId: string, scope: string, opts: {
|
|
@@ -21,7 +21,7 @@ interface RunnerEnv {
|
|
|
21
21
|
* `BUILD_SH_PATH`(缺省 `e2b-template/dev-sandbox/build.sh`)、`BAKE_DATA_DIR`(缺省 `/data`)、`LOG_LEVEL`(缺省 info)。
|
|
22
22
|
* · 数值四键(`parseNumOrFailNonNegative`,非数 / 负数拒启):`BAKE_HEARTBEAT_MS`(30000)、`BAKE_IDLE_POLL_MS`(5000)、
|
|
23
23
|
* `IMAGE_BAKE_MIN_FREE_GB`(20)、`BAKE_SHUTDOWN_GRACE_MS`(5000)。
|
|
24
|
-
* · `BAKE_ENV_ALLOW=NAME,NAME`(7.103.0,
|
|
24
|
+
* · `BAKE_ENV_ALLOW=NAME,NAME`(7.103.0,[ref] 残余):本进程 spawn 的每一只子进程组(build.sh 与 git fetch / docker push /
|
|
25
25
|
* docker image inspect / df)的 env 缺省 = 本进程 env 剥密(runner 自己的 `BAKE_RUNNER_TOKEN` 在内);名单点到的键从本进程 env **原样**
|
|
26
26
|
* 放回(部署方显式承担 —— 例如配方脚本真要一枚 `*_PASSWORD` 做 registry 登录)。与服务侧 `LSP_ENV_ALLOW` **同一只**解析器
|
|
27
27
|
* (`config.ts` `parseEnvNameAllowlist`)与同一只放行谓词:形错(空段 / 尾逗号 / 非变量名形 / 点名任一只名单型旋钮)⇒ **拒启**,拒句点名
|
|
@@ -34,7 +34,7 @@ declare function loadEnv(): RunnerEnv;
|
|
|
34
34
|
* carries the per-bake ingest secret header (so image-api can reject a stale/rogue runner — §P2.4e). */
|
|
35
35
|
declare function makeApiClient(env: RunnerEnv, log: BakeRunnerLogger): ImageApiClient;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* [ref] —— **bake-runner 自己的在飞进程组簿**。
|
|
38
38
|
*
|
|
39
39
|
* 为什么不复用 host 前台簿(`src/plugins/host-platform.ts` 的 `adoptHostForegroundChild`)—— **属主语义不同**
|
|
40
40
|
* (车LD §3(a) 判定):那本簿的契约逐字是「被一个**在飞 turn** 拥有的 host lane 前台 exec」,收割姿势是
|
|
@@ -33,7 +33,7 @@ export interface ChildHandle {
|
|
|
33
33
|
}>;
|
|
34
34
|
/** Send a signal to the process GROUP (SIGTERM then SIGKILL on the cancel/deadline path). */
|
|
35
35
|
killGroup(signal: NodeJS.Signals): void;
|
|
36
|
-
/** Does the process GROUP still have ANY member? (`kill(-pgid, 0)`.) 🔴
|
|
36
|
+
/** Does the process GROUP still have ANY member? (`kill(-pgid, 0)`.) 🔴 [ref] codex ①: this — not {@link exited} — is
|
|
37
37
|
* the group's lifetime. `exited` resolves when the LEADER exits; a leader that dies on SIGTERM can leave a
|
|
38
38
|
* TERM-immune descendant in the same group, and treating leader-exit as "the group is gone" lets it escape. */
|
|
39
39
|
groupAlive(): boolean;
|
|
@@ -103,7 +103,7 @@ export interface BakeRunnerOpts {
|
|
|
103
103
|
/** Minimum free GiB on /data at claim; below this the bake fails fast (507-class) rather than dying mid-build and
|
|
104
104
|
* leaving a half-layer (k3s + docker containerd both on /data — a fill triggers kubelet GC eviction — §P2.7). */
|
|
105
105
|
minFreeGb?: number;
|
|
106
|
-
/**
|
|
106
|
+
/** [ref] —— **一只注定要死的 build 进程组的「体面赴死窗」**(ms,`BAKE_SHUTDOWN_GRACE_MS`,默认 5000)。
|
|
107
107
|
*
|
|
108
108
|
* 两条路读同一个数,因为它们问的是**同一个问题**:
|
|
109
109
|
* · cancel / deadline 击杀({@link BakeRunner.runOne} 的 supervisor):SIGTERM → 本窗 → SIGKILL;
|
|
@@ -139,7 +139,7 @@ export declare class BakeRunner {
|
|
|
139
139
|
private readonly liveKills;
|
|
140
140
|
constructor(opts: BakeRunnerOpts);
|
|
141
141
|
/**
|
|
142
|
-
*
|
|
142
|
+
* [ref] —— **关机梯子**:幂等、可 await、四步,一处承重。
|
|
143
143
|
*
|
|
144
144
|
* ── 病(车LD §2.3,28 次真进程×两套运行时、零反例)───────────────────────────────
|
|
145
145
|
* 旧 `stop()` 只置一个 flag,而 `loop()` 此刻正 `await this.runOne(...)`、`runOne` 正 `await child.exited`
|
|
@@ -198,7 +198,7 @@ export declare class BakeRunner {
|
|
|
198
198
|
* 不受本进程信号支配(既有射程,非本批新开)。一次 SIGKILL 死在 docker build 中间会留悬挂层;
|
|
199
199
|
* dup-check + lockhash 保证重烤不被毒化,悬挂层本身由 docker 自己的 prune / 运维回收。
|
|
200
200
|
* (旧注声称“一条启动期的工作目录清扫会把它们收回去”—— **假补偿**:全 `src/` 无此实现,build.sh 侧也只有
|
|
201
|
-
* per-job workdir + `mktemp -d` 回退,没有任何启动期清扫 —— 车LD §3(3) 亲核,
|
|
201
|
+
* per-job workdir + `mktemp -d` 回退,没有任何启动期清扫 —— 车LD §3(3) 亲核,[ref] 删句:过期的“已被兜住”
|
|
202
202
|
* 声明比欠账更危险。真要做清扫,那是带自己设计的另一台车。)
|
|
203
203
|
*/
|
|
204
204
|
private killGroupLadder;
|
|
@@ -89,7 +89,7 @@ export declare function benchBaseSpec(rt: LiveRuntimeConfig, cellId: string): (o
|
|
|
89
89
|
/**
|
|
90
90
|
* Project a `SoloImplSpec` (budget already stamped by the harness, all keys in `limits`) onto the bench base TaskSpec.
|
|
91
91
|
* 🔴 7.106.0 合并复审 X3:SOLO 是**无人值守腿**(verify→fix 跑在一只不接 `onAsk` 的 Runner 上,没有审批席)⇒ 经 `withUnattendedLeg` 接
|
|
92
|
-
* 无人值守腿的合并口(
|
|
92
|
+
* 无人值守腿的合并口([ref] ①:`default` + 按类作答的 onAsk,无席)。修前裸 spec ⇒ core 7.34.0「缺席 =
|
|
93
93
|
* default」且无席 ⇒ 写与非只读命令 headless 拒、终态照旧 completed。SUP 不走这里:它有耐久审批席
|
|
94
94
|
* (checkpoint suspend),它的问要人答。
|
|
95
95
|
*/
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* 🔴 ENV GATING: the live path requires E2B_API_KEY + DEEPSEEK_API_KEY; absent → the driver refuses the live path
|
|
17
17
|
* with a clear message (never a silent fake run). The deterministic --dry-run never needs keys.
|
|
18
18
|
*
|
|
19
|
-
* 🔴 LEDGER I/O (
|
|
19
|
+
* 🔴 LEDGER I/O ([ref]): the WRITE side is the repo's shared append port — core `AppendLog` (lazy open, one `writeSync` loop per
|
|
20
20
|
* row, a failed write rolled back, a torn tail repaired on open AND before every append) — so a crash that tore the last
|
|
21
21
|
* row no longer glues the resume's first row onto the broken suffix (which lost that cell's row ⇒ one cell re-run at real
|
|
22
22
|
* E2B / DeepSeek cost). No fsync (a crash loses at most the tail row ⇒ that cell stays re-runnable — the same posture as before).
|
|
@@ -34,10 +34,10 @@ export interface LiveCoordinatorsCtx {
|
|
|
34
34
|
* 必须排在它之前;同款 holder 先例 = reaper 的 `getRunDenySweep`)。取到 undefined ⇒ 那条臂逐字回落
|
|
35
35
|
* 修前 404(partial 部署安全)。缺席(不传本键)⇒ 协调器整条迟到腿的 PARKED 臂恒 404。 */
|
|
36
36
|
getParkedRedeem?: () => ParkedAskRedeem | undefined;
|
|
37
|
-
/**
|
|
37
|
+
/** [ref] F1:checkpoint 店的 park 提交观察层(stage-06 与店同一处铸;在场 ⇔ 有 checkpoint 店)。协调器据它判「有序关停下的 park 路由
|
|
38
38
|
* 提交了没有」—— 审计 settle 行等 park 提交落定才写。缺席 = 没有 park 设施(core 在 ask 回调处就收场,没有提交这一步)。 */
|
|
39
39
|
parkCommits?: ParkCommitWatch;
|
|
40
|
-
/**
|
|
40
|
+
/** [ref]:checkpoint 店(stage-06 的**同一只**,与 `parkCommits` 同源;在场 ⇔ 有 park 设施)。协调器的按问读口据它判一张 `PARKED` 卡的门此刻还是不是该会话当前待决的审批门
|
|
41
41
|
* (判官 = `approval-gate-currency.ts`,应答口判 `approval_stale` 读的同一只)。缺席 ⇒ 读口只能说行说的话(`parked`)。
|
|
42
42
|
* 也是流内审批协议上场门的 park 设施位:在场性与实例是一个事实 —— 门的 `active` 臂交出去的就是这一只,缺席 ⇒ 协议不上场(`no_park_facility`)。 */
|
|
43
43
|
checkpointStore?: GateCurrencyStore;
|
|
@@ -9,7 +9,7 @@ import { createSandboxFileSend, TaskEnvRegistry } from "../capabilities/sandbox-
|
|
|
9
9
|
import { createSendUserFileIssuer } from "../plugins/send-user-file.js";
|
|
10
10
|
import { withLedgerRecording } from "../plugins/send-file-ledger.js";
|
|
11
11
|
import { basename, resolve } from "node:path";
|
|
12
|
-
import {
|
|
12
|
+
import { DEPLOYMENT_SHAPE_PREDICATES } from "../deployment-shape.js";
|
|
13
13
|
import { stat as fsStat, readFile as fsReadFile } from "node:fs/promises";
|
|
14
14
|
export function createLiveCoordinators(ctx) {
|
|
15
15
|
const { config, logger, backend, sendUserFileTaskEnvs, ruleConsent, ruleScopeRootFor, getParkedRedeem, parkCommits, checkpointStore } = ctx;
|
|
@@ -73,7 +73,7 @@ export function createLiveCoordinators(ctx) {
|
|
|
73
73
|
return undefined;
|
|
74
74
|
if (sendUserFileTaskEnvs)
|
|
75
75
|
return new SendUserFileEmitter();
|
|
76
|
-
if (
|
|
76
|
+
if (DEPLOYMENT_SHAPE_PREDICATES.callerOwnsWorkerDisk.holds(config))
|
|
77
77
|
return new SendUserFileEmitter();
|
|
78
78
|
return undefined;
|
|
79
79
|
})();
|