@sema-agent/server 7.145.0 → 7.147.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 +876 -0
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/USAGE.md +374 -99
- package/deploy/facts/CHANGES.json +25 -0
- package/deploy/facts/README.md +57 -0
- package/deploy/facts/lanes.json +61 -0
- package/deploy/facts/lanes.schema.json +57 -0
- package/deploy/facts/sandbox-rbac.json +113 -0
- package/deploy/facts/sandbox-rbac.schema.json +74 -0
- package/deploy/facts/sealed-key.json +9 -0
- package/deploy/facts/sealed-key.schema.json +52 -0
- package/deploy/sema-up/README.md +2 -2
- package/deploy/sema-up/chart/templates/_helpers.tpl +41 -0
- package/deploy/sema-up/chart/templates/sandbox-rbac.yaml +47 -7
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +9 -4
- package/deploy/sema-up/chart/templates/server.yaml +9 -4
- package/deploy/sema-up/chart/values.yaml +8 -1
- package/deploy/sema-up/cluster-up.sh +2 -1
- package/deploy/sema-up/lib/flagshape.sh +4 -0
- package/deploy/sema-up/lib/lanes.json +2 -5
- package/deploy/sema-up/sema-up.sh +12 -9
- package/deploy/sema-up/stack/compose.yaml +5 -4
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +34 -17
- package/dist/adoption/import-limits.d.ts +6 -0
- package/dist/adoption/import-limits.js +7 -0
- package/dist/adoption/import.d.ts +62 -0
- package/dist/adoption/import.js +107 -0
- package/dist/adoption/wire.d.ts +52 -0
- package/dist/adoption/wire.js +9 -0
- package/dist/approval-ask-machine.d.ts +2 -2
- package/dist/approval-card.d.ts +7 -16
- package/dist/approval-card.js +0 -4
- package/dist/approval-gate-currency.d.ts +1 -1
- package/dist/approval-gate-currency.js +1 -1
- package/dist/approval-reconciler.d.ts +1 -1
- package/dist/approval.d.ts +3 -3
- package/dist/audit.js +2 -2
- package/dist/bench/s1/live-deps.js +3 -1
- package/dist/boot/crash-last.js +2 -1
- package/dist/boot/deployment-mods.d.ts +11 -1
- package/dist/boot/deployment-mods.js +15 -2
- package/dist/boot/device-lane.js +7 -5
- package/dist/boot/engine-lease.d.ts +195 -22
- package/dist/boot/engine-lease.js +146 -20
- package/dist/boot/execution-env.d.ts +5 -0
- package/dist/boot/execution-env.js +57 -33
- package/dist/boot/execution-lane.d.ts +37 -9
- package/dist/boot/execution-lane.js +74 -20
- package/dist/boot/exit-boundary.d.ts +50 -0
- package/dist/boot/exit-boundary.js +32 -0
- package/dist/boot/exit-last.d.ts +20 -4
- package/dist/boot/exit-last.js +23 -5
- package/dist/boot/governance-seams.d.ts +2 -2
- package/dist/boot/governance-seams.js +1 -0
- package/dist/boot/leader.js +1 -1
- package/dist/boot/memory-boundary.d.ts +11 -11
- package/dist/boot/memory-boundary.js +3 -3
- package/dist/boot/memory-consolidation.d.ts +42 -41
- package/dist/boot/memory-consolidation.js +26 -28
- package/dist/boot/org-memory.js +3 -2
- package/dist/boot/parked-revive-gate.d.ts +1 -1
- package/dist/boot/parked-revive-gate.js +1 -1
- package/dist/boot/reapers.d.ts +12 -4
- package/dist/boot/reapers.js +40 -16
- package/dist/boot/resolve-spec.d.ts +2 -0
- package/dist/boot/resolve-spec.js +126 -123
- package/dist/boot/retention-lane.d.ts +4 -42
- package/dist/boot/runner-deps.js +1 -1
- package/dist/boot/session-faces.d.ts +1 -0
- package/dist/boot/session-faces.js +11 -3
- package/dist/boot/shutdown.js +27 -9
- package/dist/boot/stage-01-config.d.ts +1 -1
- package/dist/boot/stage-01-config.js +7 -3
- package/dist/boot/stage-02-web-admin-pull.d.ts +1 -1
- package/dist/boot/stage-02-web-admin-pull.js +10 -8
- package/dist/boot/stage-03-store-backend.d.ts +2 -1
- package/dist/boot/stage-03-store-backend.js +2 -2
- package/dist/boot/stage-04-stores.d.ts +2 -1
- package/dist/boot/stage-05-execution-env.d.ts +4 -1
- package/dist/boot/stage-05-execution-env.js +6 -6
- package/dist/boot/stage-06-runners.d.ts +5 -2
- package/dist/boot/stage-06-runners.js +12 -13
- package/dist/boot/stage-07-capability-layer.d.ts +5 -2
- package/dist/boot/stage-07-capability-layer.js +7 -7
- package/dist/boot/stage-08-reapers.d.ts +5 -2
- package/dist/boot/stage-08-reapers.js +3 -3
- package/dist/boot/stage-09-leader.d.ts +6 -2
- package/dist/boot/stage-10-http-server.d.ts +6 -2
- package/dist/boot/stage-10-http-server.js +5 -3
- package/dist/boot/stores.d.ts +10 -0
- package/dist/boot/stores.js +53 -26
- package/dist/boot/web-admin.js +3 -3
- package/dist/boot/workflow-orchestration.d.ts +1 -1
- package/dist/boot/workflow-orchestration.js +2 -1
- package/dist/capabilities/center-plugins.d.ts +2 -0
- package/dist/capabilities/center-plugins.js +6 -2
- package/dist/capabilities/composite-members.d.ts +4 -1
- package/dist/capabilities/composite-members.js +4 -1
- package/dist/capabilities/execution-lane.d.ts +7 -7
- package/dist/capabilities/execution-lane.js +2 -2
- package/dist/capabilities/hands-lane.d.ts +1 -1
- package/dist/capabilities/scenarios.d.ts +34 -20
- package/dist/capabilities/scenarios.js +13 -9
- package/dist/capabilities/settings-contract.d.ts +29 -0
- package/dist/capabilities/settings-contract.js +14 -0
- package/dist/capabilities/skills.d.ts +5 -5
- package/dist/capability-facts.d.ts +56 -1
- package/dist/capability-facts.js +59 -8
- package/dist/center-credential-renewer.js +3 -2
- package/dist/checkpoint-ctx-seal-m28.d.ts +1 -1
- package/dist/config-catalog.js +19 -9
- package/dist/config-invariants.d.ts +18 -3
- package/dist/config-invariants.js +36 -19
- package/dist/config-lkg.d.ts +1 -1
- package/dist/config-lkg.js +5 -6
- package/dist/config-provider.d.ts +2 -2
- package/dist/config-provider.js +2 -0
- package/dist/config-types.d.ts +228 -185
- package/dist/config.d.ts +74 -6
- package/dist/config.js +146 -64
- package/dist/degenerate-instrument.js +1 -1
- package/dist/deleted-session-ids.d.ts +19 -0
- package/dist/deleted-session-ids.js +26 -0
- package/dist/deploy-facts.d.ts +155 -0
- package/dist/deploy-facts.js +95 -0
- package/dist/deployment-shape.d.ts +21 -12
- package/dist/deployment-shape.js +24 -6
- package/dist/device-ws-hub.d.ts +48 -3
- package/dist/device-ws-hub.js +48 -2
- package/dist/env-facts.d.ts +7 -5
- package/dist/env-facts.js +10 -6
- package/dist/error-code-family.d.ts +35 -0
- package/dist/error-code-family.js +26 -0
- package/dist/execution-config-root.d.ts +5 -5
- package/dist/execution-config-root.js +5 -5
- package/dist/execution-env-purpose.d.ts +14 -0
- package/dist/execution-env-purpose.js +29 -0
- package/dist/execution-lane-caps.d.ts +49 -86
- package/dist/execution-lane-caps.js +52 -62
- package/dist/execution-placement.d.ts +18 -2
- package/dist/execution-placement.js +19 -0
- package/dist/file-history-disclosure.d.ts +2 -2
- package/dist/fleet/drain-entry.d.ts +46 -3
- package/dist/fleet/drain-entry.js +6 -0
- package/dist/fleet/fleet-bus.d.ts +2 -1
- package/dist/fleet/serving-lease.js +3 -4
- package/dist/history-anchor.d.ts +22 -0
- package/dist/history-anchor.js +14 -0
- package/dist/hooks/branch-transcript.d.ts +1 -1
- package/dist/hooks/branch-transcript.js +1 -0
- package/dist/hooks/classic-stations.d.ts +25 -8
- package/dist/hooks/classic-stations.js +29 -3
- package/dist/hooks/command-spawn.d.ts +1 -4
- package/dist/hooks/command-spawn.js +0 -11
- package/dist/hooks/hook-runner.d.ts +85 -24
- package/dist/hooks/hook-runner.js +326 -109
- package/dist/hooks/hook-source.d.ts +14 -2
- package/dist/hooks/hook-source.js +8 -0
- package/dist/http/active-run-conflict.d.ts +1 -1
- package/dist/http/active-run-conflict.js +1 -1
- package/dist/http/admission.js +11 -1
- package/dist/http/approval-sweeps.d.ts +2 -5
- package/dist/http/approval-sweeps.js +3 -2
- package/dist/http/checkpoint-ctx.d.ts +76 -71
- package/dist/http/checkpoint-ctx.js +40 -40
- package/dist/http/claim-latency.d.ts +10 -0
- package/dist/http/claim-latency.js +12 -0
- package/dist/http/dispatch.js +19 -3
- package/dist/http/durable-run-leg.d.ts +5 -0
- package/dist/http/durable-run-leg.js +3 -1
- package/dist/http/execution-context.d.ts +7 -1
- package/dist/http/execution-context.js +13 -0
- package/dist/http/health-self-report.d.ts +6 -2
- package/dist/http/health-self-report.js +3 -2
- package/dist/http/memory-compliance-failure-reply.d.ts +2 -2
- package/dist/http/memory-compliance-failure-reply.js +5 -15
- package/dist/http/memory-control-plane-corrupt-reply.d.ts +25 -0
- package/dist/http/memory-control-plane-corrupt-reply.js +19 -0
- package/dist/http/memory-store-refusal-reply.d.ts +3 -3
- package/dist/http/memory-store-refusal-reply.js +3 -0
- package/dist/http/owner-access.d.ts +11 -0
- package/dist/http/owner-access.js +7 -4
- package/dist/http/principal-gate.d.ts +28 -16
- package/dist/http/principal-gate.js +10 -19
- package/dist/http/request-guards.d.ts +2 -2
- package/dist/http/request-guards.js +5 -5
- package/dist/http/resume-legs.d.ts +29 -10
- package/dist/http/resume-legs.js +94 -56
- package/dist/http/rewind-files-reply.d.ts +34 -0
- package/dist/http/rewind-files-reply.js +36 -0
- package/dist/http/route-ctx.d.ts +43 -26
- package/dist/http/route-table.js +4 -0
- package/dist/http/routes/adoption.d.ts +11 -0
- package/dist/http/routes/adoption.js +80 -6
- package/dist/http/routes/agents-roster.js +1 -0
- package/dist/http/routes/approvals-assistant.js +7 -26
- package/dist/http/routes/background.js +1 -0
- package/dist/http/routes/capabilities.js +12 -3
- package/dist/http/routes/devices.js +1 -1
- package/dist/http/routes/diagnostics.d.ts +9 -14
- package/dist/http/routes/diagnostics.js +10 -20
- package/dist/http/routes/engine.d.ts +31 -0
- package/dist/http/routes/engine.js +81 -0
- package/dist/http/routes/memory-bundle.js +3 -0
- package/dist/http/routes/memory-consolidation.js +3 -5
- package/dist/http/routes/memory-origin.d.ts +2 -2
- package/dist/http/routes/memory-origin.js +2 -4
- package/dist/http/routes/memory-policy.js +5 -1
- package/dist/http/routes/notify-wake.js +2 -1
- package/dist/http/routes/observability.js +3 -6
- package/dist/http/routes/projects.d.ts +70 -0
- package/dist/http/routes/projects.js +86 -0
- package/dist/http/routes/rules.js +30 -2
- package/dist/http/routes/runs.js +15 -11
- package/dist/http/routes/session-sync.js +39 -35
- package/dist/http/routes/sessions-list.d.ts +1 -1
- package/dist/http/routes/sessions.d.ts +7 -1
- package/dist/http/routes/sessions.js +108 -2
- package/dist/http/routes/tasks.js +32 -8
- package/dist/http/routes/trace-usage.js +1 -1
- package/dist/http/run-concurrency-cap.d.ts +86 -0
- package/dist/http/run-concurrency-cap.js +54 -0
- package/dist/http/server.d.ts +31 -14
- package/dist/http/server.js +29 -3
- package/dist/http/stored-body-replay.d.ts +12 -7
- package/dist/http/stored-body-replay.js +28 -5
- package/dist/http/wire-types.d.ts +27 -13
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/instruction-source-notice.d.ts +1 -1
- package/dist/json-body-limit.d.ts +8 -0
- package/dist/json-body-limit.js +2 -0
- package/dist/leader/diffout.d.ts +1 -1
- package/dist/local-data-root.d.ts +2 -2
- package/dist/memory-embedder-reembed.d.ts +38 -0
- package/dist/memory-embedder-reembed.js +20 -0
- package/dist/memory-incident-sink.d.ts +0 -28
- package/dist/memory-incident-sink.js +5 -0
- package/dist/memory-operator-faces.d.ts +9 -4
- package/dist/memory-scope-stores.d.ts +9 -7
- package/dist/memory-scope-stores.js +3 -14
- package/dist/memory-scope.d.ts +38 -2
- package/dist/memory-scope.js +33 -2
- package/dist/memory-store-refusal.d.ts +17 -4
- package/dist/memory-store-refusal.js +1 -1
- package/dist/memory-sync-client.d.ts +2 -0
- package/dist/memory-sync-client.js +13 -11
- package/dist/memory-sync.js +1 -1
- package/dist/model-compat.d.ts +35 -21
- package/dist/model-compat.js +49 -21
- package/dist/model-entry-refusal.d.ts +11 -1
- package/dist/model-entry-refusal.js +7 -0
- package/dist/namespaced-rule-name.d.ts +18 -1
- package/dist/namespaced-rule-name.js +12 -0
- package/dist/net-address.d.ts +53 -0
- package/dist/net-address.js +111 -0
- package/dist/observability/fail-open.d.ts +29 -17
- package/dist/observability/fail-open.js +29 -17
- package/dist/observability/metrics.d.ts +2 -0
- package/dist/observability/metrics.js +2 -0
- package/dist/observability/secret-env-scrub.d.ts +30 -4
- package/dist/observability/secret-env-scrub.js +15 -3
- package/dist/orchestration/workflow-agent-session-index.d.ts +7 -12
- package/dist/orchestration/workflow-agent-session-index.js +1 -6
- package/dist/orchestration/workflow-completion-inbox.d.ts +26 -6
- package/dist/orchestration/workflow-completion-inbox.js +63 -45
- package/dist/orchestration/workflow-notify-journal.js +2 -3
- package/dist/org-delivery-gate.js +1 -1
- package/dist/org-memory-admission.d.ts +5 -2
- package/dist/org-memory-admission.js +25 -10
- package/dist/parked-decide.d.ts +33 -26
- package/dist/parked-decide.js +36 -44
- package/dist/peer-directory.d.ts +6 -12
- package/dist/peer-directory.js +5 -1
- package/dist/plugins/approval-ask-store-file.d.ts +10 -2
- package/dist/plugins/approval-ask-store-file.js +37 -4
- package/dist/plugins/approval-ask-store-memory.d.ts +5 -3
- package/dist/plugins/approval-ask-store-memory.js +11 -2
- package/dist/plugins/approval-ask-store-sql.d.ts +3 -0
- package/dist/plugins/approval-ask-store-sql.js +3 -1
- package/dist/plugins/blob-backend.d.ts +38 -195
- package/dist/plugins/blob-backend.js +33 -229
- package/dist/plugins/caching-session-store.d.ts +12 -5
- package/dist/plugins/caching-session-store.js +3 -0
- package/dist/plugins/checkpoint-index-columns.d.ts +1 -1
- package/dist/plugins/checkpoint-index-columns.js +3 -2
- package/dist/plugins/checkpoint-store-face.d.ts +426 -0
- package/dist/plugins/checkpoint-store-face.js +152 -0
- package/dist/plugins/device-store-sql.d.ts +2 -2
- package/dist/plugins/device-store-sql.js +5 -10
- package/dist/plugins/execution-lane-rename-m40.d.ts +20 -0
- package/dist/plugins/execution-lane-rename-m40.js +10 -0
- package/dist/plugins/execution-placement-sql.d.ts +63 -88
- package/dist/plugins/execution-placement-sql.js +94 -54
- package/dist/plugins/file-run-store.d.ts +26 -18
- package/dist/plugins/file-run-store.js +64 -75
- package/dist/plugins/fork-routing-session-store.d.ts +6 -2
- package/dist/plugins/fork-routing-session-store.js +2 -2
- package/dist/plugins/imported-layer-root-retirement.d.ts +22 -11
- package/dist/plugins/imported-layer-root-retirement.js +4 -8
- package/dist/plugins/inbox-payload-column.d.ts +14 -0
- package/dist/plugins/inbox-payload-column.js +13 -0
- package/dist/plugins/local-checkpoint-store.d.ts +7 -2
- package/dist/plugins/local-checkpoint-store.js +13 -8
- package/dist/plugins/local-data-dir-modes-m39.d.ts +48 -0
- package/dist/plugins/local-data-dir-modes-m39.js +182 -0
- package/dist/plugins/local-engine-high-water.d.ts +11 -0
- package/dist/plugins/local-engine-high-water.js +59 -0
- package/dist/plugins/local-session-store.d.ts +119 -30
- package/dist/plugins/local-session-store.js +156 -53
- package/dist/plugins/local-task-attachment-store.d.ts +2 -0
- package/dist/plugins/local-task-attachment-store.js +10 -11
- package/dist/plugins/memory-embedder-fingerprint.d.ts +33 -10
- package/dist/plugins/memory-embedder-fingerprint.js +52 -12
- package/dist/plugins/memory-embedder.d.ts +1 -1
- package/dist/plugins/memory-embedder.js +2 -2
- package/dist/plugins/memory-engine-pg.d.ts +30 -6
- package/dist/plugins/memory-engine-pg.js +96 -214
- package/dist/plugins/memory-engine-sql-apply.d.ts +130 -0
- package/dist/plugins/memory-engine-sql-apply.js +358 -0
- package/dist/plugins/memory-engine-tidb.d.ts +38 -9
- package/dist/plugins/memory-engine-tidb.js +99 -230
- package/dist/plugins/memory-key-guards.d.ts +1 -1
- package/dist/plugins/memory-origin-law.d.ts +3 -3
- package/dist/plugins/one-time-migrations.d.ts +169 -83
- package/dist/plugins/one-time-migrations.js +295 -235
- package/dist/plugins/owner-only-file-mode.d.ts +29 -0
- package/dist/plugins/owner-only-file-mode.js +141 -0
- package/dist/plugins/permission-rule-store-file.d.ts +17 -3
- package/dist/plugins/permission-rule-store-file.js +20 -1
- package/dist/plugins/pg-pool.d.ts +2 -1
- package/dist/plugins/pg-pool.js +12 -5
- package/dist/plugins/release-version.d.ts +20 -0
- package/dist/plugins/release-version.js +28 -0
- package/dist/plugins/remote-env-adb.d.ts +20 -4
- package/dist/plugins/remote-env-adb.js +39 -11
- package/dist/plugins/remote-env-e2b.d.ts +12 -3
- package/dist/plugins/remote-env-e2b.js +6 -4
- package/dist/plugins/remote-env-host.d.ts +9 -1
- package/dist/plugins/remote-env-host.js +6 -5
- package/dist/plugins/remote-env-k8s.d.ts +5 -2
- package/dist/plugins/remote-env-k8s.js +15 -4
- package/dist/plugins/remote-env-local-docker.d.ts +4 -1
- package/dist/plugins/remote-env-local-docker.js +3 -3
- package/dist/plugins/remote-env-ssh.d.ts +8 -2
- package/dist/plugins/remote-env-ssh.js +26 -24
- package/dist/plugins/remote-shell.d.ts +59 -30
- package/dist/plugins/remote-shell.js +175 -62
- package/dist/plugins/retention-declaration.d.ts +37 -0
- package/dist/plugins/retention-declaration.js +9 -0
- package/dist/plugins/retention-deployment.d.ts +126 -0
- package/dist/plugins/retention-deployment.js +88 -0
- package/dist/plugins/retention-lane-store-sql.d.ts +74 -4
- package/dist/plugins/retention-lane-store-sql.js +103 -1
- package/dist/plugins/retention-sql.d.ts +29 -0
- package/dist/plugins/retention-sql.js +8 -0
- package/dist/plugins/run-store-sql.js +2 -2
- package/dist/plugins/schema-consistency.d.ts +0 -6
- package/dist/plugins/schema-consistency.js +1 -2
- package/dist/plugins/schema-ensure-legs.d.ts +1 -1
- package/dist/plugins/schema-ensure-legs.js +13 -3
- package/dist/plugins/session-ext-table.d.ts +74 -0
- package/dist/plugins/session-ext-table.js +121 -0
- package/dist/plugins/session-fork.d.ts +31 -9
- package/dist/plugins/session-fork.js +3 -2
- package/dist/plugins/session-placement.d.ts +4 -2
- package/dist/plugins/session-row-sql.d.ts +8 -7
- package/dist/plugins/session-row-sql.js +15 -7
- package/dist/plugins/session-store-sql.d.ts +131 -0
- package/dist/plugins/session-store-sql.js +298 -0
- package/dist/plugins/session-workspace-cell.d.ts +2 -2
- package/dist/plugins/session-workspace-cell.js +2 -2
- package/dist/plugins/shared-memory-store-sql.d.ts +10 -0
- package/dist/plugins/shared-memory-store-sql.js +13 -13
- package/dist/plugins/snapshot-bucket-presence.js +1 -1
- package/dist/plugins/sql-driver.d.ts +23 -7
- package/dist/plugins/sql-driver.js +41 -8
- package/dist/plugins/sql-errors.d.ts +5 -2
- package/dist/plugins/sql-errors.js +4 -0
- package/dist/plugins/sql-json-column.d.ts +5 -1
- package/dist/plugins/store-backend.d.ts +46 -16
- package/dist/plugins/store-backend.js +192 -69
- package/dist/plugins/store-contracts.d.ts +10 -13
- package/dist/plugins/store-contracts.js +1 -9
- package/dist/plugins/store-sweep.d.ts +63 -0
- package/dist/plugins/store-sweep.js +48 -0
- package/dist/plugins/task-attachment-store.d.ts +6 -8
- package/dist/plugins/task-attachment-store.js +15 -10
- package/dist/plugins/task-list-store-sql.d.ts +1 -1
- package/dist/plugins/text-column-capacity.d.ts +21 -0
- package/dist/plugins/text-column-capacity.js +5 -0
- package/dist/plugins/tidb-pool.d.ts +3 -2
- package/dist/plugins/tidb-pool.js +20 -32
- package/dist/plugins/user-input-ledger-sql.d.ts +1 -1
- package/dist/prompt-screen.d.ts +6 -9
- package/dist/prompt-screen.js +2 -5
- package/dist/read-face-posture.d.ts +6 -6
- package/dist/read-face-posture.js +2 -2
- package/dist/request-value-closure.d.ts +5 -5
- package/dist/request-value-closure.js +1 -1
- package/dist/rules-consent.d.ts +48 -27
- package/dist/rules-consent.js +147 -23
- package/dist/run-cancel-context.d.ts +4 -1
- package/dist/run-cancel-context.js +2 -1
- package/dist/run-local.js +17 -13
- package/dist/runs.d.ts +48 -30
- package/dist/runs.js +27 -17
- package/dist/runtime-caps-resolver.d.ts +15 -8
- package/dist/runtime-caps-resolver.js +14 -10
- package/dist/sandbox-egress-policy.js +6 -11
- package/dist/sandbox-rbac-rules.d.ts +88 -0
- package/dist/sandbox-rbac-rules.js +80 -0
- package/dist/sealed-key-layout.d.ts +16 -0
- package/dist/sealed-key-layout.js +3 -0
- package/dist/sealed-key.js +8 -6
- package/dist/security.d.ts +43 -9
- package/dist/security.js +9 -2
- package/dist/sema-config-dir.js +2 -2
- package/dist/server-secret-env.d.ts +2 -0
- package/dist/service-version.d.ts +2 -1
- package/dist/service-version.js +2 -2
- package/dist/session-error-wire.d.ts +1 -1
- package/dist/session-incarnation.d.ts +8 -5
- package/dist/session-notify-door.d.ts +5 -3
- package/dist/session-resident-background.d.ts +110 -0
- package/dist/session-resident-background.js +88 -0
- package/dist/session-row.d.ts +1 -1
- package/dist/session-sync-kernel.d.ts +53 -14
- package/dist/session-sync-kernel.js +70 -1
- package/dist/session-sync.d.ts +5 -3
- package/dist/session-workspace.d.ts +12 -2
- package/dist/session-workspace.js +6 -0
- package/dist/sighup-idle.d.ts +9 -7
- package/dist/sighup-idle.js +4 -5
- package/dist/spec-fields.d.ts +16 -0
- package/dist/spec-fields.js +7 -0
- package/dist/store-posture.d.ts +2 -1
- package/dist/stored-request-env-credentials-m38.d.ts +3 -0
- package/dist/stored-request-env-credentials-m38.js +8 -0
- package/dist/stored-request-hooks-m20.d.ts +3 -2
- package/dist/stored-request-hooks-m20.js +19 -14
- package/dist/stored-request-prompt-profile-m30.d.ts +1 -1
- package/dist/stores-sql/blob-index-sql.d.ts +148 -0
- package/dist/stores-sql/blob-index-sql.js +154 -0
- package/dist/{plugins → stores-sql}/checkpoint-store-sql.d.ts +14 -428
- package/dist/{plugins → stores-sql}/checkpoint-store-sql.js +43 -220
- package/dist/{plugins → stores-sql}/file-history-store-sql.d.ts +23 -11
- package/dist/{plugins → stores-sql}/file-history-store-sql.js +23 -18
- package/dist/{plugins → stores-sql}/mailbox-store-sql.d.ts +2 -2
- package/dist/{plugins → stores-sql}/mailbox-store-sql.js +4 -4
- package/dist/{plugins → stores-sql}/pg-session-storage.d.ts +27 -67
- package/dist/{plugins → stores-sql}/pg-session-storage.js +82 -207
- package/dist/{plugins → stores-sql}/retention-store-sql.d.ts +123 -217
- package/dist/{plugins → stores-sql}/retention-store-sql.js +66 -190
- package/dist/{plugins → stores-sql}/roster-store-sql.d.ts +2 -2
- package/dist/{plugins → stores-sql}/roster-store-sql.js +1 -1
- package/dist/{plugins → stores-sql}/session-event-payload.d.ts +1 -1
- package/dist/{plugins → stores-sql}/session-event-payload.js +1 -1
- package/dist/stores-sql/session-policy-store-sql.d.ts +1 -1
- package/dist/stores-sql/session-write-hooks.d.ts +59 -0
- package/dist/stores-sql/session-write-hooks.js +2 -0
- package/dist/{plugins → stores-sql}/tidb-session-storage.d.ts +10 -11
- package/dist/{plugins → stores-sql}/tidb-session-storage.js +10 -21
- package/dist/{plugins → stores-sql}/tidb-session-store.d.ts +35 -112
- package/dist/{plugins → stores-sql}/tidb-session-store.js +73 -169
- package/dist/{plugins → stores-sql}/tool-result-store-sql.d.ts +3 -3
- package/dist/{plugins → stores-sql}/tool-result-store-sql.js +6 -6
- package/dist/stores-sql/windowed-session-storage.d.ts +56 -0
- package/dist/stores-sql/windowed-session-storage.js +61 -0
- package/dist/{plugins → stores-sql}/workflow-journal-store-sql.d.ts +7 -12
- package/dist/{plugins → stores-sql}/workflow-journal-store-sql.js +3 -8
- package/dist/task-a2a.d.ts +7 -1
- package/dist/task-a2a.js +15 -14
- package/dist/task-cwd.d.ts +11 -3
- package/dist/task-cwd.js +17 -1
- package/dist/task-mcp.d.ts +10 -2
- package/dist/task-mcp.js +13 -16
- package/dist/task-settings.d.ts +68 -8
- package/dist/task-settings.js +63 -6
- package/dist/tool-approval.d.ts +23 -10
- package/dist/tool-approval.js +10 -6
- package/dist/trace/core-keyset-guard.d.ts +17 -10
- package/dist/trace/engine-notice-wire.d.ts +1 -1
- package/dist/trace/engine-notice-wire.js +4 -0
- package/dist/trace/exit-seat.d.ts +29 -1
- package/dist/trace/exit-seat.js +4 -0
- package/dist/trace/project.d.ts +33 -16
- package/dist/trace/project.js +21 -9
- package/dist/trace/redact.d.ts +13 -2
- package/dist/trace/redact.js +347 -78
- package/dist/trace/self-minted-wire.d.ts +587 -16
- package/dist/trace/self-minted-wire.js +215 -9
- package/dist/trace/sema-provenance.d.ts +45 -41
- package/dist/trace/sema-provenance.js +81 -10
- package/dist/trace/task-notification-facets.d.ts +70 -2
- package/dist/trace/task-notification-facets.js +71 -1
- package/dist/trace/wire-projection-faces.d.ts +39 -3
- package/dist/trace/wire-projection-faces.js +27 -2
- package/dist/unread-request-members.d.ts +66 -0
- package/dist/unread-request-members.js +41 -0
- package/dist/usage-analytics.d.ts +4 -0
- package/dist/user-input-ledger.d.ts +2 -2
- package/dist/web-admin-client/apply-effective.js +22 -26
- package/dist/web-admin-client/candidate-gate.d.ts +35 -3
- package/dist/web-admin-client/candidate-gate.js +53 -5
- package/dist/web-admin-client/center-request.d.ts +4 -1
- package/dist/web-admin-client/center-request.js +2 -1
- package/dist/web-admin-client/effective-keys.js +0 -1
- package/dist/web-admin-client/facade.d.ts +1 -1
- package/dist/web-admin-client/http-client.d.ts +1 -0
- package/dist/web-admin-client/http-client.js +17 -9
- package/dist/web-admin-client/restart-signal.js +5 -2
- package/dist/web-admin-client/skills-mcp.d.ts +20 -6
- package/dist/web-admin-client/skills-mcp.js +26 -21
- package/dist/web-admin-client/types.d.ts +34 -49
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +2 -2
- package/package.json +22 -13
- package/scripts/drain-check-local.mjs +8 -55
- package/scripts/drain-check.mysql.sql +3 -40
- package/scripts/drain-check.pg.sql +3 -40
- package/skills/update-config.md +1 -1
- package/wire-changes/server@7.146.0.json +3221 -0
- package/wire-changes/server@7.147.0.json +813 -0
- package/dist/approval-batch-census.d.ts +0 -27
- package/dist/approval-batch-census.js +0 -27
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 请求面**来源**闭集 —— 一个 hook 组(`settings.hooks[event][i].source`)是谁写的。词表与「托管与否」的映射**只在这里**;
|
|
3
|
-
* hooks
|
|
3
|
+
* hooks 执行器按它分相、分车道(`hook-runner.ts` 的三相 / 两张注册),将来请求面别处的来源键(MCP 服务器条目)读同一张词表,不另立第二份。
|
|
4
4
|
*
|
|
5
5
|
* 词表(闭集;集外词 = 形错,受理面整份拒,fail-closed;缺席 = 非托管):
|
|
6
6
|
* · `managedPolicy` —— 组织策略(托管设置)。**托管**,且是终判相。
|
|
@@ -28,7 +28,7 @@ type HookSourcePrefix = keyof typeof HOOK_SOURCE_PREFIX_PHASE;
|
|
|
28
28
|
export type HookGroupSource = HookSourceWord | `${HookSourcePrefix}:${string}`;
|
|
29
29
|
/**
|
|
30
30
|
* 执行相 —— **固定次序**就是这张数组的次序:非托管 → 托管插件 → 托管策略(终判)。后一相在前一相的最终输入上跑;结果按信任序(倒序)读。
|
|
31
|
-
* 托管 =
|
|
31
|
+
* 托管 = 后两相;相按 {@link hookLaneOf} 归两条车道(每道一张引擎注册,见 `hook-runner.ts`)。
|
|
32
32
|
*/
|
|
33
33
|
export declare const HOOK_PHASES: readonly ["unmanaged", "managedPlugin", "managedPolicy"];
|
|
34
34
|
export type HookPhase = (typeof HOOK_PHASES)[number];
|
|
@@ -36,6 +36,18 @@ export type HookPhase = (typeof HOOK_PHASES)[number];
|
|
|
36
36
|
export declare const MAX_HOOK_SOURCE_NAME_CHARS = 128;
|
|
37
37
|
/** 受理面的读法:合形 ⇒ 来源;否则 `undefined`(调用方铸拒)。只认 own 词(`Object.hasOwn`:原型上的名字不是词表成员)。 */
|
|
38
38
|
export declare function readHookGroupSource(raw: unknown): HookGroupSource | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* 车道 —— **一条车道 = 一张引擎注册**(`hook-runner.ts` 的 `SETTINGS_HOOKS_REGISTRATIONS`):非托管相一道;托管两相(插件相 + 策略相)同一道。
|
|
41
|
+
* 每条车道自带引擎的 handler 预算与本服务的事件墙钟 / LLM 条数 / 账本,两道之间不共用任何一只钟。相 → 道只在这张表(`satisfies`:加一个相不写道 = 编译红)。
|
|
42
|
+
*/
|
|
43
|
+
declare const HOOK_PHASE_LANE: {
|
|
44
|
+
readonly unmanaged: "unmanaged";
|
|
45
|
+
readonly managedPlugin: "managed";
|
|
46
|
+
readonly managedPolicy: "managed";
|
|
47
|
+
};
|
|
48
|
+
export type HookLane = (typeof HOOK_PHASE_LANE)[HookPhase];
|
|
49
|
+
/** 来源 → 车道(经相;缺席 ⇒ 非托管)。帧上的 `lane` 位、车道注册的分组都读这一只。 */
|
|
50
|
+
export declare function hookLaneOf(source: HookGroupSource | undefined): HookLane;
|
|
39
51
|
/** 来源 → 相。缺席 ⇒ 非托管(老包不带 `source`:行为与此前逐字同)。 */
|
|
40
52
|
export declare function hookPhaseOf(source: HookGroupSource | undefined): HookPhase;
|
|
41
53
|
/** 拒句里的词表(由两张表派生,不另写一份)。 */
|
|
@@ -27,6 +27,14 @@ export function readHookGroupSource(raw) {
|
|
|
27
27
|
return undefined;
|
|
28
28
|
return raw;
|
|
29
29
|
}
|
|
30
|
+
const HOOK_PHASE_LANE = {
|
|
31
|
+
unmanaged: "unmanaged",
|
|
32
|
+
managedPlugin: "managed",
|
|
33
|
+
managedPolicy: "managed",
|
|
34
|
+
};
|
|
35
|
+
export function hookLaneOf(source) {
|
|
36
|
+
return HOOK_PHASE_LANE[hookPhaseOf(source)];
|
|
37
|
+
}
|
|
30
38
|
export function hookPhaseOf(source) {
|
|
31
39
|
if (source === undefined)
|
|
32
40
|
return "unmanaged";
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { type GovernancePosture } from "../runtime-governance.js";
|
|
17
17
|
import type { ShellGateDoctrine } from "@sema-agent/core";
|
|
18
18
|
import { type RunRecord } from "../plugins/store-contracts.js";
|
|
19
|
-
import { type PendingRowBinding } from "../plugins/checkpoint-store-
|
|
19
|
+
import { type PendingRowBinding } from "../plugins/checkpoint-store-face.js";
|
|
20
20
|
/** 与 runs.ts/tasks.ts 三个 409 位共享的旧文案(byte-frozen:api-error-text-freeze 门认这句)。 */
|
|
21
21
|
export declare const ACTIVE_RUN_CONFLICT_BASE_TEXT = "session already has an active run \u2014 POST /v1/runs/{activeTaskId}/cancel stops it (same-instance interactive runs abort immediately)";
|
|
22
22
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { governanceOriginOf } from "../runtime-governance.js";
|
|
2
2
|
import { isParkedRunStatus } from "../plugins/store-contracts.js";
|
|
3
|
-
import { LIVE_RUN_GATE_KINDS } from "../plugins/checkpoint-store-
|
|
3
|
+
import { LIVE_RUN_GATE_KINDS } from "../plugins/checkpoint-store-face.js";
|
|
4
4
|
import { recordFailOpen } from "../observability/fail-open.js";
|
|
5
5
|
import { refusalBody } from "./refusal-body.js";
|
|
6
6
|
import { trustedCheckpointId } from "../checkpoint-identity.js";
|
package/dist/http/admission.js
CHANGED
|
@@ -2,7 +2,8 @@ import { APPROVAL_REACH, IMAGE_ADMISSION, isApprovalReach, isPermissionMode, isT
|
|
|
2
2
|
import { isAtMentionable, matchCatalogModel, refusedCatalogEntry, selectableCatalog } from "../model-select.js";
|
|
3
3
|
import { echoModelRef, modelUnavailableMessage } from "../model-entry-refusal.js";
|
|
4
4
|
import { HttpError, sessionIdShapeIssue } from "../security.js";
|
|
5
|
-
import { MAX_SETTINGS_OUTPUT_STYLE_CHARS, MAX_SETTINGS_ENV_VARS, MAX_SETTINGS_ENV_KEY_CHARS, MAX_SETTINGS_ENV_VALUE_CHARS, PERMISSION_MODE_WORDS, parseTaskSettings, settingsPermissionBucketIssue, skillListingBudgetFractionOk, skillListingMaxDescOk, hooksKeyIssue, taskHooksHonored, taskSettingsKeyIssue } from "../task-settings.js";
|
|
5
|
+
import { MAX_SETTINGS_OUTPUT_STYLE_CHARS, MAX_SETTINGS_ENV_VARS, MAX_SETTINGS_ENV_KEY_CHARS, MAX_SETTINGS_ENV_VALUE_CHARS, PERMISSION_MODE_WORDS, autoCompactEnabledOk, parseTaskSettings, readSettingsEnv, settingsEnvCredentialIssue, settingsPermissionBucketIssue, skillListingBudgetFractionOk, skillListingMaxDescOk, hooksKeyIssue, taskHooksHonored, taskSettingsKeyIssue } from "../task-settings.js";
|
|
6
|
+
import { serverCredentialValueSources } from "../server-secret-env.js";
|
|
6
7
|
import { tightenOnlySeatIssue } from "../tighten-only-seats.js";
|
|
7
8
|
import { approvalFrameFamiliesIssue } from "../tool-approval.js";
|
|
8
9
|
import { buildEntryModeClampNotice } from "../entry-mode-clamp-notice.js";
|
|
@@ -284,6 +285,11 @@ export function createAdmission(ctx) {
|
|
|
284
285
|
return null;
|
|
285
286
|
}
|
|
286
287
|
}
|
|
288
|
+
const credentialIssue = settingsEnvCredentialIssue(readSettingsEnv(st).reaching, serverCredentialValueSources(deps.config.modelApiKeyEnv));
|
|
289
|
+
if (credentialIssue !== null) {
|
|
290
|
+
sendError(res, 400, "request.env_credential_refused", credentialIssue.message, { ...credentialIssue.fields });
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
287
293
|
}
|
|
288
294
|
if (st.ultracode !== undefined && typeof st.ultracode !== "boolean") {
|
|
289
295
|
sendError(res, 400, "request.field_invalid", "settings.ultracode must be a boolean");
|
|
@@ -297,6 +303,10 @@ export function createAdmission(ctx) {
|
|
|
297
303
|
sendError(res, 400, "request.field_invalid", "settings.skillListingMaxDescChars must be a positive integer");
|
|
298
304
|
return null;
|
|
299
305
|
}
|
|
306
|
+
if (st.autoCompactEnabled !== undefined && !autoCompactEnabledOk(st.autoCompactEnabled)) {
|
|
307
|
+
sendError(res, 400, "request.field_invalid", "settings.autoCompactEnabled must be a boolean");
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
300
310
|
if (st.hooks !== undefined && st.hooks !== null) {
|
|
301
311
|
const hooksParsed = parseHooksConfig(st.hooks);
|
|
302
312
|
if (!hooksParsed.config) {
|
|
@@ -6,16 +6,13 @@
|
|
|
6
6
|
* 不是请求流水线。`createWallClockJumpGuard` 建的 `denySweepClockGuard` 是 ① 的私有件,随它同居。
|
|
7
7
|
* ctx 字段 3 只(`deps` / `resumeCheckpoint` / `mayDiscloseRowError`),机器算(closure-free-vars)与手抄一致。
|
|
8
8
|
*/
|
|
9
|
-
import { type ParkedAskRedeemRequest } from "../tool-approval.js";
|
|
9
|
+
import { type ParkedAskRedeemRequest, type ParkedAskRedeemResult } from "../tool-approval.js";
|
|
10
10
|
import type { createResumeLegs } from "./resume-legs.js";
|
|
11
11
|
import type { FlatServiceDeps } from "./server.js";
|
|
12
12
|
export declare function createApprovalSweeps(ctx: {
|
|
13
13
|
deps: FlatServiceDeps;
|
|
14
14
|
} & Pick<ReturnType<typeof createResumeLegs>, "resumeCheckpoint" | "mayDiscloseRowError">): {
|
|
15
15
|
denyExpiredApprovals: (now: number) => Promise<void>;
|
|
16
|
-
redeemParkedAsk: (req: ParkedAskRedeemRequest) => Promise<
|
|
17
|
-
status: number;
|
|
18
|
-
body: Record<string, unknown>;
|
|
19
|
-
}>;
|
|
16
|
+
redeemParkedAsk: (req: ParkedAskRedeemRequest) => Promise<ParkedAskRedeemResult>;
|
|
20
17
|
};
|
|
21
18
|
//# sourceMappingURL=approval-sweeps.d.ts.map
|
|
@@ -231,8 +231,9 @@ export function createApprovalSweeps(ctx) {
|
|
|
231
231
|
...(req.gateBoundInputHash !== null ? { boundInputHash: req.gateBoundInputHash } : {}),
|
|
232
232
|
...(req.updatedInput !== undefined ? { updatedInput: req.updatedInput } : {}),
|
|
233
233
|
};
|
|
234
|
-
const
|
|
235
|
-
|
|
234
|
+
const remember = req.remember === "session" ? { grantedBy: req.principal ?? null, laneCannotRecord: "decide_once" } : undefined;
|
|
235
|
+
const out = await resumeCheckpoint(cp.sessionId, req.decision, req.note, hostDecisionFacts(req.decider, req.principal), req.httpReq, undefined, binding, remember, true, { principal: req.principal, explicitOperator: false });
|
|
236
|
+
return { status: out.status, body: out.body, ...(remember !== undefined ? { rememberApplied: out.rememberApplied === true } : {}) };
|
|
236
237
|
}
|
|
237
238
|
return { denyExpiredApprovals, redeemParkedAsk };
|
|
238
239
|
}
|
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 续跑重建输入(`checkpoint_ctx` 的行体,{@link CheckpointCtx})
|
|
2
|
+
* 续跑重建输入(`checkpoint_ctx` 的行体,{@link CheckpointCtx})的**写形**,以及「这条停驻行的持久化体在本版上能否重放」的四问与它们的答复。
|
|
3
3
|
*
|
|
4
|
-
* ##
|
|
5
|
-
* `settings.permissions.allow` 的读法换过两次:≤7.114.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* ## allow 读法问(常设规则,按行的写者版本;不是迁移、不读记号)
|
|
5
|
+
* `settings.permissions.allow` 的读法换过两次:≤7.114.x 是「名单」(名单外的工具一律拒);7.115.0–7.116.x 是「表态」(只回答没人表态的那一问);
|
|
6
|
+
* 7.117.0 起整份交给引擎的 allow 层(表里的调用免问)。续跑家族把**持久化的提交体**原样重放进 `resolveSpec` —— 7.117.0 之前写下、体里带非空 `allow` 的行
|
|
7
|
+
* 按今天的读法重放 = 静默放宽(名单外的工具放开 / 普通问不再问)。⇒ 规则一句:**体里 `allow` 在生效(非空数组,{@link bodyCarriesAllowList})而行的写者版本
|
|
8
|
+
* 证不出 ≥ {@link ALLOW_LAYER_READING_SINCE}(`CheckpointCtx.writerVersion` 缺席、读不出,或早于它)⇒ 拒**({@link allowListReadingRefusal},409 `checkpoint.unsupported_version`,行字节不动)。
|
|
9
|
+
* · 证据只有一个源:行上的写者版本(`route-ctx.ts` `CheckpointCtx.writerVersion`;7.124.0 起每一次写都带)。7.117.0–7.145.x 写过的 allow 读法记号
|
|
10
|
+
* 不是本问的读者 —— 记号写点已删(一次性迁移 M7 退役)、键在存量行上无人读;7.117.0–7.123.x 写下、带非空 `allow` 的行没有写者版本,同样拒(证不出;fail-closed)。
|
|
11
|
+
* · 写者版本因此是本问的拒因,而它的写点必须守住同一条律:**盖写者版本的写只发生在本进程按当前读法读过这份体之后** —— 新提交(受理门按当前读法读)、
|
|
12
|
+
* 或已经过了本判据的续跑腿写回(`resume-legs.ts` `commitResumeCtx`、在飞 run 的切档写回)。在判据之前盖版本 = 把一条旧行洗成新行。
|
|
13
|
+
* · 没有期限:日历窗关不证明旧行不在(留存拉长、备份恢复、`APPROVAL_TERMINAL_BACKSTOP_MS` 调长),所以这一问常设,不进一次性迁移登记表。
|
|
9
14
|
*
|
|
10
|
-
* ##
|
|
11
|
-
*
|
|
12
|
-
* 行留停驻、字节不动(拒发生在认领之前,run 行、卡、ctx 一个字节都不写);出路 = 作为新任务重提,这条任务若还停驻着先取消(`task_done` 唤醒停驻与 workflow 宿主那条腿没有可取消的 run)。
|
|
13
|
-
* **没有**「按旧读法继续读」的臂(那是第二种读法),也**没有**「按新读法静默续跑」的臂(那是对一条已提交任务的静默放宽)。
|
|
14
|
-
* · 记号 = 当前写点在体里带非空 `allow` 时写在 ctx 上的 `permissionsAllowReading`,闭集只有当前读法一个词({@link PERMISSIONS_ALLOW_READINGS})。
|
|
15
|
-
* 写点 = 每一次**新的**持久化写({@link buildCheckpointCtx} 是它们的唯一构造口);续跑腿的写回传的是读进来的那只 ctx(或其展开),记号随行,不重新判。
|
|
16
|
-
* · 拒句按「这行是在哪种读法下写的」分两句({@link ALLOW_LIST_READING_ERAS} 穷举):无记号(或记号认不得)= 名单时代;`"statement"` = 表态时代。
|
|
17
|
-
* · 体里没有 `allow`(或空数组 —— 三代都把空数组读成「没有」)的行不写记号、不受本规则影响。
|
|
18
|
-
*
|
|
19
|
-
* ## 第二问(7.117.0 起,引擎 7.42 逐字读规则条目;7.131.0 起覆盖全部工具名清单):工具名清单读成空的存量体
|
|
20
|
-
* 同一面上的第二个「新提交会被拒、存量体重放不能放过」:提交体里工具名清单 —— 技能(顶层 / 子代)的 `disallowedTools`(7.117.0:`"Bash "` 这类 7.41 去白后有效、
|
|
15
|
+
* ## 工具名清单问(7.117.0 起,引擎 7.42 逐字读规则条目;7.131.0 起覆盖全部工具名清单):工具名清单读成空的存量体
|
|
16
|
+
* 「新提交会被拒、存量体重放不能放过」:提交体里工具名清单 —— 技能(顶层 / 子代)的 `disallowedTools`(7.117.0:`"Bash "` 这类 7.41 去白后有效、
|
|
21
17
|
* 7.42 什么也不拒的条目)、子代定义的 `denyTools` / `allowTools`、顶层 `excludeTools` / `allowTools`(7.131.0:限制侧近似名 / 大小写孪生、退役名、文法读不出,放行侧只近似名)—— 有引擎读成空的条目 ⇒ 提交 400(`resolveSpec`,拒点);
|
|
22
18
|
* 存量停驻体重放 ⇒ 409 `resume_blocked_by_policy`(`blockedBy` = 该层的拒码)。判据函数 = `rule-entry-list.ts` `inertToolListEntryOf`。
|
|
23
19
|
*
|
|
24
|
-
* ##
|
|
20
|
+
* ## 模式词问(7.122.0):体里模式词的读法记号
|
|
25
21
|
* 7.122.0 起一条 run 的模式词只有一个源 —— 存储的提交体顶层 `permissionMode`(提交入口把运维 `AUTONOMY=plan` 的地板盖进去一次;`plan_review` 写回改它),
|
|
26
22
|
* 治理层不再在每一次续跑重钳。更早版本写下的行体里是**请求的原词**,运维的 plan 由治理层每段重新折上(7.121.x 及以前:只读手 + 写面 roots)。
|
|
27
23
|
* 那种行在本版上按体里的原词重放 = 静默放宽(`acceptEdits` / `bypassPermissions` 原词直接生效;无词 ⇒ 引擎读 checkpoint 记下的词)。
|
|
@@ -31,62 +27,63 @@
|
|
|
31
27
|
* 不受影响:那两种行在新旧两种读法下答同一个词。出路:作为新任务重提(仍停驻的先取消),或在它们收尾之前把 `AUTONOMY` 设成 `read-only`(按段的只读围栏,
|
|
32
28
|
* 与 7.121.x 的 `AUTONOMY=plan` 同一个结局,且没有入口地板 ⇒ 不拒)。删除条件登记在 `plugins/one-time-migrations.ts` 的 M12 行。
|
|
33
29
|
*
|
|
34
|
-
* ##
|
|
30
|
+
* ## 退役请求键问(7.137.0):体里的退役请求键
|
|
35
31
|
* 请求键退役之后({@link RETIRED_REQUEST_KEYS}:今天两只 —— `promptProfile` 换成布尔 `promptLean`,`rewindFiles` 是退役的旧文件还原拼法),新提交带它在键闭集门 400。存体里的旧键怎么办,闭集里每个键有
|
|
36
32
|
* **一个处置格**,住在哪张表就是哪个处置:**拒**表({@link REPLAY_REFUSED_RETIRED_KEYS},今天 `promptProfile`)是塑形过任务本身的键,**惰性**表({@link INERT_RETIRED_KEYS},今天 `rewindFiles`)是一次性键。
|
|
37
33
|
* · 拒表的键:存体里的旧键由一次性迁移在起服时原地改写
|
|
38
34
|
* (M30,`stored-request-prompt-profile-m30.ts`,行改写经本模块的 {@link rewriteStoredBodyKeys})。改写不到的残留行(窗内从没起过服的部署;起服扫描之后滚动升级里
|
|
39
|
-
* 旧副本才写下的行)体里仍带旧键 ⇒ 拒({@link retiredRequestKeyRefusal}
|
|
35
|
+
* 旧副本才写下的行)体里仍带旧键 ⇒ 拒({@link retiredRequestKeyRefusal},码同模式词读法拒:`checkpoint.unsupported_version`)。**没有**续跑时按旧键读的第二种读法,
|
|
40
36
|
* 也**没有**「旧键无人读、静默续跑」的臂:旧键还在 = 这份体没被改写过,它当年要的形本版读不出来。
|
|
41
37
|
* · 惰性表的键:一次性键 —— 只在提交的那一拍起作用(文件还原的一次性动作),续跑重建里没有任何一条腿读它,存体里留着它不要求任何事、不改变重放要做的事 ⇒ 不拒、不改写、续跑照常。
|
|
42
38
|
* 这不是上面那条「旧键无人读、静默续跑」的臂:那一臂的前提是读不出旧键会让续跑做一件提交时没要的事,惰性格的判据恰是「没有这个键,重放做的事一字不差」。
|
|
43
39
|
* 加一个退役键必须选格 —— 进拒表 ⇒ {@link retiredRequestKeyRefusal} 的 switch 与 `stored-body-replay.ts` 的迁移 id 表编译红,直到给它一句拒句和改写它的迁移;进惰性表 ⇒ 改动里要写明它为什么是一次性的。
|
|
44
40
|
*
|
|
45
41
|
* ## 一只判据、五个问点(`http/stored-body-replay.ts` 的 `storedBodyReplayRefusal` / 本模块的 {@link storedBodyReplayAnswer})
|
|
46
|
-
*
|
|
47
|
-
*
|
|
42
|
+
* 「这条停驻行的持久化体在本版上能否重放」只有**一个**读法:上面四问(加 `settings.env` 凭据那一臂,规则在 `stored-request-env-credentials-m38.ts`)合在 `stored-body-replay.ts` 的 `storedBodyReplayRefusal` 一处(allow 读法问的谓词在本模块;工具名清单问另读请求设置的解析层与
|
|
43
|
+
* 执行车道 / 配置根两个属主、模式词问读请求设置与治理两个属主 —— 本模块的值依赖要留在 node 内建 / 引擎包根之内,随包排空脚本经编译产物读它),答复合在 {@link storedBodyReplayAnswer} 一处。
|
|
48
44
|
* 问点五个,同调同答:续跑驱动段(`resume-legs.ts` `resolveResumeSpecOrBlocked`,另四条腿的唯一判点)· plan_review 的 prepare 段(读类拒,在 nonce 消费之前)·
|
|
49
45
|
* SLA 拒扫腿的跳过臂(`approval-sweeps.ts`)· 终态 run 的 steer 铸唤醒卡之前(`routes/runs.ts`:铸卡前先证明它赎得回,证不出 ⇒ 不铸、当场同一个拒)·
|
|
50
46
|
* `resolveSpec` 本身留作真正的拒点(提交腿 400;续跑腿在到它之前已被本判据答掉)。再开第六个问点必须调这两只,不许各判各的 —— 此前铸卡前只判了
|
|
51
|
-
*
|
|
47
|
+
* 一问,工具名清单那一问漏在外面,卡铸出来了、`/wake` 恒 409([ref] 合并复审两腿同报)。
|
|
52
48
|
*
|
|
53
49
|
* ## 凭据位密封(7.134.0;常设规则,不是迁移)
|
|
54
50
|
* 体里请求面凭据位上的值在 ctx 里只以封签存在 —— 写:{@link buildCheckpointCtx} / {@link sealCheckpointCtx} 一只封口;读:续跑上下文读口里一只开口
|
|
55
51
|
* {@link openCheckpointCtx};开不开 ⇒ `409 conflict.checkpoint_ctx_unsealable`。规则全文在本文件末段「凭据位密封」的头注。
|
|
56
|
-
*
|
|
57
|
-
* ## 何时删(一次性迁移,不是长期双读)
|
|
58
|
-
* 本判据、拒臂、记号写点与 `CheckpointCtx.permissionsAllowReading` 一起删,删除条件与窗登记在 `plugins/one-time-migrations.ts` 的
|
|
59
|
-
* 一次性迁移登记表(本条那一行):所有旧读法下停驻的行都已结束或被收割(停驻行的终局 = 落盘起 `TERMINAL_BACKSTOP_MS`,见
|
|
60
|
-
* `plugins/checkpoint-store-sql.ts`)之后的那个版本。删的时候记号的读者一起删。
|
|
61
52
|
*/
|
|
62
53
|
import type { PermissionMode } from "@sema-agent/core";
|
|
63
54
|
import type { CheckpointCtx } from "./route-ctx.js";
|
|
64
55
|
import type { TaskRequestBody } from "./wire-types.js";
|
|
65
56
|
import type { InertToolListEntry } from "../rule-entry-list.js";
|
|
66
57
|
import { type Refusal } from "./refusal-body.js";
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
-
export declare const PERMISSIONS_ALLOW_READINGS: readonly ["allow_layer"];
|
|
70
|
-
export type PermissionsAllowReading = (typeof PERMISSIONS_ALLOW_READINGS)[number];
|
|
71
|
-
/** 体里模式词的读法记号闭集(一词 = 当前读法):这一行体的顶层 `permissionMode` 是这条 run 模式词**唯一的源**(提交入口盖过运维地板、`plan_review` 写回改它),
|
|
72
|
-
* 续跑照它读、不再由治理层按段重钳。写点两个 = {@link buildCheckpointCtx}(每一次新的持久化写都写)与 {@link withPermissionModeRewritten}(`plan_review` 写回改词的那一拍写);
|
|
73
|
-
* **不改词**的续跑腿写回传原 ctx ⇒ 记号随行。 */
|
|
74
|
-
export declare const PERMISSION_MODE_READINGS: readonly ["entry_word"];
|
|
75
|
-
export type PermissionModeReading = (typeof PERMISSION_MODE_READINGS)[number];
|
|
76
|
-
/** 被拒的行是在哪种读法下写的(闭集;拒句按它穷举):`list` = 无记号或记号认不得(≤7.114.0 的名单读法;认不得的记号不是任何一代的证据,
|
|
77
|
-
* 按最早那一代说话);`statement` = 7.115.0–7.116.x 写下的表态读法。 */
|
|
78
|
-
export declare const ALLOW_LIST_READING_ERAS: readonly ["list", "statement"];
|
|
79
|
-
export type AllowListReadingEra = (typeof ALLOW_LIST_READING_ERAS)[number];
|
|
58
|
+
/** allow 层读法从这一版起(7.117.0):此前的写者对 `settings.permissions.allow` 是另一种读法(≤7.114.x 名单 / 7.115.0–7.116.x 表态)。规则见顶注「allow 读法问」。 */
|
|
59
|
+
export declare const ALLOW_LAYER_READING_SINCE = "7.117.0";
|
|
80
60
|
/**
|
|
81
61
|
* 体里的 `settings.permissions.allow` 是否**在生效**:非空数组(三代同一个「在」—— 空数组 = 没有)。
|
|
82
62
|
* 入参是持久化的 JSON(可能来自任何旧版本),逐层判形,不信型面。
|
|
83
63
|
*/
|
|
84
64
|
export declare function bodyCarriesAllowList(body: TaskRequestBody): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* 行的写者版本**证得出** ≥ {@link ALLOW_LAYER_READING_SINCE}:在场、读得出、三段数不小于它(三段相等时预发布算在它之前 —— semver 序,失效关闭方向)。
|
|
67
|
+
* 缺席 / 读不出(`"unknown"`、前导零、空标识段这类不合 SemVer 文法的串)/ 更早 ⇒ `false`。入参是持久化的 JSON,不信型面。
|
|
68
|
+
*/
|
|
69
|
+
export declare function writerReadsAllowLayer(writerVersion: unknown): boolean;
|
|
70
|
+
/** allow 读法问(顶注):体里 `allow` 在生效而写者版本证不出 ≥ {@link ALLOW_LAYER_READING_SINCE} ⇒ `true`(拒)。 */
|
|
71
|
+
export declare function allowListWriterUnproven(ctx: CheckpointCtx): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* allow 读法问的拒答复 —— 码 `checkpoint.unsupported_version`,409(卡仍 pending 时的 `retriable:true` 由 {@link resumeRefusalWithCard} 追加,本铸点不带;
|
|
74
|
+
* 两版本键由 {@link storedBodyReplayAnswer} 按那一码的键律补)。拒在认领之前,没有 `taskId`。句子一句:写者证不出是哪种读法(早于 7.117.0,或没记下版本 —— 7.124.0 之前的写者都不记),
|
|
75
|
+
* 两种旧读法各是什么、照今天的读法续跑会放宽什么,出路(作为新任务重提,仍停驻的先取消)。
|
|
76
|
+
* 🔴 形是给冻结门看的:`status: <三位数>, body: refusalBody({ errorCode: "<码>", message: "<整句双引号字面>"`,中间只许有空白。
|
|
77
|
+
*/
|
|
78
|
+
export declare function allowListReadingRefusal(): ResumeRefusalAnswer;
|
|
79
|
+
/** 体里模式词的读法记号闭集(一词 = 当前读法):这一行体的顶层 `permissionMode` 是这条 run 模式词**唯一的源**(提交入口盖过运维地板、`plan_review` 写回改它),
|
|
80
|
+
* 续跑照它读、不再由治理层按段重钳。写点两个 = {@link buildCheckpointCtx}(每一次新的持久化写都写)与 {@link withPermissionModeRewritten}(`plan_review` 写回改词的那一拍写);
|
|
81
|
+
* **不改词**的续跑腿写回传原 ctx ⇒ 记号随行。 */
|
|
82
|
+
export declare const PERMISSION_MODE_READINGS: readonly ["entry_word"];
|
|
83
|
+
export type PermissionModeReading = (typeof PERMISSION_MODE_READINGS)[number];
|
|
85
84
|
/**
|
|
86
85
|
* 一次**新的**持久化写的 ctx(提交腿 / `POST /v1/runs` 族 / leader worker)—— 写记号的唯一口。
|
|
87
86
|
*
|
|
88
|
-
* 调用方是「本进程刚按当前读法读过这份体」的写点:fresh 提交(受理门按当前读法读过 `allow`),或已经过了续跑拒臂的重放腿
|
|
89
|
-
* (`startFreshHostTurn` 把宿主的存量体交给 `POST /v1/runs` 同一条链 —— 它在那之前调过 `resolveResumeSpecOrBlocked`,没记号却带 `allow` 的体到不了这里)。
|
|
90
87
|
* 续跑腿的**写回**不经本函数:**不改词**的写回传读进来的 ctx(记号随行,不重新判 —— 在写回口重新判会把一条没记号的旧行「洗」成新行);
|
|
91
88
|
* **改词**的写回(只有 `plan_review` 的批准 / 编辑)经 {@link withPermissionModeRewritten}。两种写回落盘之前都过同一只封口 {@link sealCheckpointCtx}。
|
|
92
89
|
*
|
|
@@ -103,27 +100,27 @@ export declare function buildCheckpointCtx(fields: {
|
|
|
103
100
|
* 模式词的**第二个写者** —— `plan_review` 的批准 / 编辑把这条 run 的体词从 `plan` 写成批准的档(`resume-legs.ts` `drivePlanReview`,调用点只有那一处;
|
|
104
101
|
* `test/allow-list-reading-park-refusal.test.ts` 枚举调用点,多一处即红)。与 {@link buildCheckpointCtx} **同一条规则**:按当前读法写下的词,盖当前读法记号。
|
|
105
102
|
*
|
|
106
|
-
*
|
|
103
|
+
* 为什么记号必须随词一起写,而不是留给读的一侧去豁免:模式词问问的是「体的词是不是按当前读法写下的」,记号就是这句话的证据。改写之后体里的词是本版的 `plan_review`
|
|
107
104
|
* 刚写下的(一个人刚批准的档),它确实是 `entry_word` 读法的词;若只改体、记号缺席,重建段的同一问把它读成「7.121.x 的请求原词」,被地板钳回 `plan` ≠ 所写词 ⇒ 误拒
|
|
108
105
|
* 一条刚被批准的 run。判据侧(`stored-body-replay.ts`)**不为「plan_review 之后」另开特判臂** —— 读的一侧只有一个读法,写的一侧各自负责盖章。
|
|
109
106
|
*
|
|
110
107
|
* 为什么这不是在「洗」旧行:走到写回口的行,其**原体**已过 prepare 段的同一问(词被地板钳不变:词已是 `plan`,或本部署没有地板);原体的词会被地板钳的旧行
|
|
111
|
-
* (`acceptEdits` / `bypassPermissions` / 无词)在 prepare 段就被拒,到不了这里。入参 `ctx` 的其余位(memoryScope / 无人值守标
|
|
108
|
+
* (`acceptEdits` / `bypassPermissions` / 无词)在 prepare 段就被拒,到不了这里。入参 `ctx` 的其余位(memoryScope / 无人值守标)原样随行,只换体与模式词记号。
|
|
112
109
|
*
|
|
113
110
|
* 本模块零值依赖的闭包纪律不变(随包排空脚本经编译产物 import;`test/drain-check-local.test.ts`):本函数只用本模块内的东西。
|
|
114
111
|
*/
|
|
115
112
|
export declare function withPermissionModeRewritten(ctx: CheckpointCtx, body: TaskRequestBody): CheckpointCtx;
|
|
116
|
-
/** 行上带的是不是当前的模式词读法记号(
|
|
117
|
-
* 记号缺席或认不得 ⇒
|
|
113
|
+
/** 行上带的是不是当前的模式词读法记号(模式词问的记号那一半;另一半 —— 体的生效词被地板钳会不会变 —— 读请求设置的解析层,住在 `http/stored-body-replay.ts`)。
|
|
114
|
+
* 记号缺席或认不得 ⇒ 不是「按当前读法写下」的证据。 */
|
|
118
115
|
export declare function permissionModeReadingStated(ctx: CheckpointCtx): boolean;
|
|
119
116
|
/**
|
|
120
|
-
*
|
|
117
|
+
* 模式词问的拒答复 —— 码 `checkpoint.unsupported_version`,409(卡仍 pending 时体上的 `retriable:true` 由 {@link resumeRefusalWithCard} 追加,本铸点不带)。
|
|
121
118
|
* 句子说原因(更早的版本在每次续跑重钳运维的 AUTONOMY、没把它记进任务;本版只在提交时记一次 ⇒ 续跑会按任务提交时的原词跑)与两条出路。
|
|
122
119
|
* 🔴 形是给冻结门看的:`status: <三位数>, body: refusalBody({ errorCode: "<码>", message: "<整句双引号字面>"`,中间只许有空白。
|
|
123
120
|
*/
|
|
124
121
|
export declare function permissionModeReadingRefusal(): ResumeRefusalAnswer;
|
|
125
122
|
/**
|
|
126
|
-
*
|
|
123
|
+
* 退役请求键问:**退役的请求键**闭集 = 两张处置表之并(新提交在键闭集门 400;存体里还带着它 = 这份体是更早的写者写下的)。键住在哪张表就是它的处置格,规则全文见头注「退役请求键问」。
|
|
127
124
|
* 拒表:存体仍带它 ⇒ 续跑重放拒({@link retiredRequestKeyRefusal});加一个 ⇒ 加一行,那只函数的 switch 编译红直到给它一句拒句。今天一只:`promptProfile`(7.137.0 起换成布尔 `promptLean`;存体由 M30 起服改写)。
|
|
128
125
|
*/
|
|
129
126
|
export declare const REPLAY_REFUSED_RETIRED_KEYS: readonly ["promptProfile"];
|
|
@@ -135,7 +132,7 @@ export type RetiredRequestKey = (typeof RETIRED_REQUEST_KEYS)[number];
|
|
|
135
132
|
/** 存体顶层带的第一只**需要拒**的退役请求键(拒表序);惰性键不算,没有 ⇒ `undefined`。只看自有键(原型上的同名不算)。 */
|
|
136
133
|
export declare function retiredRequestKeyOf(body: unknown): ReplayRefusedRetiredKey | undefined;
|
|
137
134
|
/**
|
|
138
|
-
*
|
|
135
|
+
* 退役请求键问的拒答复 —— 码与落点同模式词读法拒(`checkpoint.unsupported_version`,409;卡仍 pending 时的 `retriable:true` 由 {@link resumeRefusalWithCard} 追加,本铸点不带)。
|
|
139
136
|
* 句子说键、它换成了什么、为什么不续跑,与两条出路(运维在一次性迁移的窗内重启本服务 ⇒ 起服改写存体、同一请求可再发;否则作为新任务重提,仍停驻的先取消)。不回显值。
|
|
140
137
|
* 🔴 形是给冻结门看的:`status: <三位数>, body: refusalBody({ errorCode: "<码>", message: <整句双引号字面 或 一只模板串>`,中间只许有空白(模板串形冻结的是骨架,`${…}` 折成一个洞)。
|
|
141
138
|
* **窗的日期不手写**:`rewriteWindowEnd` 由调用方交 —— 判据(`stored-body-replay.ts`)按「退役键 → 改写它的迁移」那张表读登记表该行的 `removableAfter`,窗只写在登记表一处;
|
|
@@ -143,32 +140,31 @@ export declare function retiredRequestKeyOf(body: unknown): ReplayRefusedRetired
|
|
|
143
140
|
* 删法见登记表 M30 的 `removal`(唯一来源)。
|
|
144
141
|
*/
|
|
145
142
|
export declare function retiredRequestKeyRefusal(key: ReplayRefusedRetiredKey, rewriteWindowEnd: string): ResumeRefusalAnswer;
|
|
146
|
-
/**
|
|
147
|
-
* 本行能否被按当前读法重放:体里 `allow` 在生效而行上的记号不是当前这一个词 ⇒ **不能**(`true` = 拒)。
|
|
148
|
-
* 记号缺席、是旧词(`"statement"`)或认不得(手改 / 将来的写者)⇒ 同样拒:只有当前这个词是「按当前读法写下」的证据。
|
|
149
|
-
*/
|
|
150
|
-
export declare function allowListReadingUnstated(ctx: CheckpointCtx): boolean;
|
|
151
|
-
/** 被拒的行是哪一代写的(只在 {@link allowListReadingUnstated} 为真时有意义):记号是 `"statement"` ⇒ 表态时代;其余(缺席 / 认不得)⇒ 名单时代。 */
|
|
152
|
-
export declare function allowListReadingEraOf(ctx: CheckpointCtx): AllowListReadingEra;
|
|
153
|
-
/**
|
|
154
|
-
* 拒的答复 —— 码与落点照「退役 mode-seed 行」的先例(`checkpoint.unsupported_version`,409;卡仍 pending 时的 `retriable:true` 由 {@link resumeRefusalWithCard} 追加,本铸点不带)。
|
|
155
|
-
* 拒在认领之前,所以没有 `taskId`(行没抢到就不造键)。句子按这一行是哪一代写的分两句(闭集穷举,加一代 ⇒ 编译红):说原因(这条任务停在哪种读法上、
|
|
156
|
-
* 照当前读法续跑会放宽什么)与出路(作为新任务重提,仍停驻的先取消)。
|
|
157
|
-
*
|
|
158
|
-
* 🔴 形是给冻结门看的(`api-error-text-freeze` 的 resume 家族收集器):`status: <三位数>, body: refusalBody({ errorCode: "<码>", message: "<整句双引号字面>"`,中间只许有空白。
|
|
159
|
-
*/
|
|
160
|
-
export declare function allowListReadingRefusal(era: AllowListReadingEra): ResumeRefusalAnswer;
|
|
161
143
|
/**
|
|
162
144
|
* 一条停驻行的持久化体在本版上**不能**重放时,是哪一条规则拒的(闭集;加一条 ⇒ {@link storedBodyReplayAnswer} 的 switch 编译红)。
|
|
163
145
|
* 答 `checkpoint.unsupported_version` 的三臂随带这一行的写者版本(续跑上下文的 `writerVersion`,缺席 = 本版之前写下的行)—— 那一码的两版本键由它铸({@link buildCheckpointVersionKeys})。
|
|
164
146
|
*/
|
|
165
|
-
export type StoredBodyReplayRefusal =
|
|
147
|
+
export type StoredBodyReplayRefusal =
|
|
148
|
+
/** 体里带非空 `settings.permissions.allow`、写者版本证不出 ≥ {@link ALLOW_LAYER_READING_SINCE}(顶注「allow 读法问」)。 */
|
|
149
|
+
{
|
|
166
150
|
readonly kind: "allow_list_reading";
|
|
167
|
-
readonly era: AllowListReadingEra;
|
|
168
151
|
readonly writerVersion?: string;
|
|
169
152
|
} | {
|
|
170
153
|
readonly kind: "inert_tool_list";
|
|
171
154
|
readonly entry: InertToolListEntry;
|
|
155
|
+
}
|
|
156
|
+
/** 存体 `settings.env` 带凭据条目、一次性迁移 M38 的剥键窗已关:`refusal` = 提交腿那只 400(`request.env_credential_refused`)的码、句子与机读位(由预判用同一只判据铸),答复折成 409 `resume_blocked_by_policy`。 */
|
|
157
|
+
| {
|
|
158
|
+
readonly kind: "settings_env_credential";
|
|
159
|
+
readonly refusal: Refusal;
|
|
160
|
+
}
|
|
161
|
+
/** 存体里有本版读者读不出、而本部署会采纳的成员(hooks / settings.env / permissions / MCP transport / A2A headers …;判据 `unread-request-members.ts`):`refusal` = 拒点 `resolveSpec` 抛的那只 400
|
|
162
|
+
* (`request.field_invalid`,`field` = 第一个坐标,句子点名全部坐标)的码、句子与机读位,答复折成 409 `resume_blocked_by_policy`;`members` = 判据交回的坐标(键路径与下标,不带值;与拒句同一个上限,截断由问点做),`memberCount` = 总数 —— 运维行读这两格。 */
|
|
163
|
+
| {
|
|
164
|
+
readonly kind: "unread_members";
|
|
165
|
+
readonly refusal: Refusal;
|
|
166
|
+
readonly members: readonly string[];
|
|
167
|
+
readonly memberCount: number;
|
|
172
168
|
} | {
|
|
173
169
|
readonly kind: "permission_mode_reading";
|
|
174
170
|
readonly stored: PermissionMode | undefined;
|
|
@@ -214,6 +210,13 @@ export interface ResumeRefusalAnswer {
|
|
|
214
210
|
* · (`retriable`,卡在才在)。
|
|
215
211
|
*/
|
|
216
212
|
export declare function resumeBlockedByPolicyAnswer(inner: Refusal): ResumeRefusalAnswer;
|
|
213
|
+
/**
|
|
214
|
+
* 续跑腿上认领之前一只 typed 拒的**唯一折法**(`resume-legs.ts` 的两处折叠口同调:装配 `resolveResumeSpec` 与停驻赎回的执行上下文)。一条律:
|
|
215
|
+
* 拒体自报这一拍答不出(`permanence: "transient"` —— 依赖此刻不可用,不是政策:今天 = 中心答不出场景裁定)⇒ 原码原状态原体(同一张卡在依赖恢复后可再决;
|
|
216
|
+
* SLA 拒扫腿按「其余 ≥400」逐拍重试,不把它当确定性拒过期掉);其余 ⇒ {@link resumeBlockedByPolicyAnswer}(准入策略挡住,`blockedBy` = 原码)。
|
|
217
|
+
* 两形之后都由调用方经 {@link resumeRefusalWithCard} 追加 `retriable`(卡仍 pending)。
|
|
218
|
+
*/
|
|
219
|
+
export declare function resumeAssemblyRefusalAnswer(status: number, inner: Refusal): ResumeRefusalAnswer;
|
|
217
220
|
/**
|
|
218
221
|
* 一次续跑的答复是不是 {@link resumeBlockedByPolicyAnswer} 铸的那一只(409 `resume_blocked_by_policy`)—— SLA 拒扫腿据此区分「同一份字节在本版永远被拒」与别的 ≥400
|
|
219
222
|
* (后者可能是瞬时的,照旧逐拍重试)。码的写端与读端住在同一个模块,读端不在别处第二次手拼这个字面。
|
|
@@ -231,26 +234,28 @@ export declare function isResumeBlockedByPolicy(answer: {
|
|
|
231
234
|
*/
|
|
232
235
|
export declare function resumeRefusalWithCard(answer: ResumeRefusalAnswer, cardPending: boolean): ResumeRefusalAnswer;
|
|
233
236
|
/**
|
|
234
|
-
* `stored-body-replay.ts` `storedBodyReplayRefusal` 的**日志字段**(三处问点同一形,各自只再加坐标键 `sessionId` / `taskId`):`kind`
|
|
237
|
+
* `stored-body-replay.ts` `storedBodyReplayRefusal` 的**日志字段**(三处问点同一形,各自只再加坐标键 `sessionId` / `taskId`):`kind` 判别,技能臂带 `layer`、退役键臂带 `key`、allow 读法臂带 `writerVersion`(有才在),`note` 一句出路。
|
|
235
238
|
* 事件名三个(问点各一:`resume_refused_stored_body` / `steer_wake_park_refused_stored_body` / `deny_sweep_stored_body_skipped`),字段形只有这一只。
|
|
236
239
|
*/
|
|
237
240
|
export declare function storedBodyReplayLogFields(refusal: StoredBodyReplayRefusal): {
|
|
238
241
|
kind: StoredBodyReplayRefusal["kind"];
|
|
239
|
-
|
|
242
|
+
writerVersion?: string;
|
|
240
243
|
layer?: InertToolListEntry["layer"];
|
|
241
244
|
storedMode?: PermissionMode | null;
|
|
242
245
|
floor?: PermissionMode;
|
|
243
246
|
key?: ReplayRefusedRetiredKey;
|
|
247
|
+
members?: readonly string[];
|
|
248
|
+
memberCount?: number;
|
|
244
249
|
note: string;
|
|
245
250
|
};
|
|
246
251
|
/**
|
|
247
|
-
* `stored-body-replay.ts` `storedBodyReplayRefusal` 的答复:每条规则一只既有铸点(allow
|
|
252
|
+
* `stored-body-replay.ts` `storedBodyReplayRefusal` 的答复:每条规则一只既有铸点(allow 读法 ⇒ {@link allowListReadingRefusal};模式词记号 ⇒ {@link permissionModeReadingRefusal};
|
|
248
253
|
* 退役请求键 ⇒ {@link retiredRequestKeyRefusal};这三只答 `checkpoint.unsupported_version`,体按那一码的键律补两版本键,`readerVersion` = 调用方传的本进程服务版本;工具名清单 ⇒ {@link resumeBlockedByPolicyAnswer},与提交腿的 400
|
|
249
254
|
* (该层的拒码:`request.field_invalid` / `config.agent.unknown_tool` / `config.tool_face_control`)同码同句 —— 体上只有这一个问题时;存量体同时还踩中 `resolveSpec` 更早的拒〔三桶超帽 / 托管姿态〕时,提交侧答更早那条、续跑侧答本句,两边都是拒,指路不同)。
|
|
250
255
|
*
|
|
251
256
|
* 🔴 `cardPending` —— **调用方交出的事实**:这一次拒的时候,有没有一张待批卡仍在等。`retriable:true` 说的恰是「卡仍 pending」,所以它只在卡在时在场(经
|
|
252
257
|
* {@link resumeRefusalWithCard} 一处写):续跑入口(`/decide` · `/resume` · `/wake` · plan_review · workflow 决定的新一跑,五个问点里除下面这一个之外全部)传 `true`;
|
|
253
|
-
* 终态 run 的 `POST /v1/runs/:id/steer` 在**铸唤醒卡之前**就拒,没有卡也没铸卡 ⇒ 传 `false`,体上不带 `retriable`(
|
|
258
|
+
* 终态 run 的 `POST /v1/runs/:id/steer` 在**铸唤醒卡之前**就拒,没有卡也没铸卡 ⇒ 传 `false`,体上不带 `retriable`(每条臂同一条律;其余键两种处境逐字相同 —— 同判同答)。
|
|
254
259
|
* 没有默认值:每个调用点必须说出这件事实。
|
|
255
260
|
*/
|
|
256
261
|
export declare function storedBodyReplayAnswer(refusal: StoredBodyReplayRefusal, readerVersion: string, cardPending: boolean): ResumeRefusalAnswer;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { refusalBody } from "./refusal-body.js";
|
|
2
|
-
export const
|
|
3
|
-
export const PERMISSION_MODE_READINGS = ["entry_word"];
|
|
4
|
-
export const ALLOW_LIST_READING_ERAS = ["list", "statement"];
|
|
2
|
+
export const ALLOW_LAYER_READING_SINCE = "7.117.0";
|
|
5
3
|
export function bodyCarriesAllowList(body) {
|
|
6
4
|
const settings = body?.settings;
|
|
7
5
|
if (settings === null || typeof settings !== "object" || Array.isArray(settings))
|
|
@@ -12,6 +10,33 @@ export function bodyCarriesAllowList(body) {
|
|
|
12
10
|
const allow = permissions["allow"];
|
|
13
11
|
return Array.isArray(allow) && allow.length > 0;
|
|
14
12
|
}
|
|
13
|
+
const SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
14
|
+
function readVersion(v) {
|
|
15
|
+
const m = SEMVER.exec(v);
|
|
16
|
+
return m === null ? undefined : { core: [Number(m[1]), Number(m[2]), Number(m[3])], pre: m[4] !== undefined };
|
|
17
|
+
}
|
|
18
|
+
export function writerReadsAllowLayer(writerVersion) {
|
|
19
|
+
if (typeof writerVersion !== "string")
|
|
20
|
+
return false;
|
|
21
|
+
const writer = readVersion(writerVersion);
|
|
22
|
+
const since = readVersion(ALLOW_LAYER_READING_SINCE);
|
|
23
|
+
if (writer === undefined)
|
|
24
|
+
return false;
|
|
25
|
+
for (let i = 0; i < 3; i++)
|
|
26
|
+
if (writer.core[i] !== since.core[i])
|
|
27
|
+
return writer.core[i] > since.core[i];
|
|
28
|
+
return !writer.pre;
|
|
29
|
+
}
|
|
30
|
+
export function allowListWriterUnproven(ctx) {
|
|
31
|
+
return bodyCarriesAllowList(ctx.body) && !writerReadsAllowLayer(ctx.writerVersion);
|
|
32
|
+
}
|
|
33
|
+
export function allowListReadingRefusal() {
|
|
34
|
+
return {
|
|
35
|
+
status: 409,
|
|
36
|
+
body: refusalBody({ errorCode: "checkpoint.unsupported_version", message: "this task's stored request carries settings.permissions.allow and was written by a server version that is earlier than 7.117.0 or that did not record its version (versions before 7.124.0 did not), so this server cannot tell how that list was meant to be read: 7.114.0 and earlier read it as a whitelist (every tool not on it was refused) and 7.115.0 to 7.116.x as a statement that answered only the question nobody else had answered, while this version hands it to the engine's allow layer, where each entry is a standing yes for the calls it covers, so continuing could give the task more tools or fewer questions than it was submitted with. Nothing was decided and nothing was resumed, and retrying will be refused the same way: submit the work again as a new task, and if this task is still suspended cancel it first (POST /v1/runs/:id/cancel)." }),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export const PERMISSION_MODE_READINGS = ["entry_word"];
|
|
15
40
|
export function buildCheckpointCtx(fields, sealer, sessionId) {
|
|
16
41
|
const ctx = {
|
|
17
42
|
body: fields.body,
|
|
@@ -19,7 +44,6 @@ export function buildCheckpointCtx(fields, sealer, sessionId) {
|
|
|
19
44
|
...(fields.memoryScope !== undefined ? { memoryScope: fields.memoryScope } : {}),
|
|
20
45
|
...(fields.unattendedLeg === true ? { unattendedLeg: true } : {}),
|
|
21
46
|
...(fields.promptScreened === true ? { promptScreened: true } : {}),
|
|
22
|
-
...(bodyCarriesAllowList(fields.body) ? { permissionsAllowReading: "allow_layer" } : {}),
|
|
23
47
|
permissionModeReading: "entry_word",
|
|
24
48
|
};
|
|
25
49
|
return sealCheckpointCtx(ctx, sealer, sessionId);
|
|
@@ -64,40 +88,6 @@ export function retiredRequestKeyRefusal(key, rewriteWindowEnd) {
|
|
|
64
88
|
}
|
|
65
89
|
}
|
|
66
90
|
}
|
|
67
|
-
export function allowListReadingUnstated(ctx) {
|
|
68
|
-
if (!bodyCarriesAllowList(ctx.body))
|
|
69
|
-
return false;
|
|
70
|
-
const reading = ctx.permissionsAllowReading;
|
|
71
|
-
return !(typeof reading === "string" && PERMISSIONS_ALLOW_READINGS.includes(reading));
|
|
72
|
-
}
|
|
73
|
-
export function allowListReadingEraOf(ctx) {
|
|
74
|
-
const reading = ctx.permissionsAllowReading;
|
|
75
|
-
return reading === "statement" ? "statement" : "list";
|
|
76
|
-
}
|
|
77
|
-
export function allowListReadingRefusal(era) {
|
|
78
|
-
switch (era) {
|
|
79
|
-
case "list":
|
|
80
|
-
return {
|
|
81
|
-
status: 409,
|
|
82
|
-
body: refusalBody({
|
|
83
|
-
errorCode: "checkpoint.unsupported_version",
|
|
84
|
-
message: "this task was suspended by an earlier server version that did not record how it read settings.permissions.allow (7.114.0 and earlier read it as a whitelist: every tool not on the list was refused); this version hands that list to the engine's allow layer, where each entry is a standing yes for the calls it covers, so continuing would give the task more tools than it was submitted with. Nothing was decided and nothing was resumed, and retrying will be refused the same way: submit the work again as a new task, and if this task is still suspended cancel it first (POST /v1/runs/:id/cancel). To allow only certain tools, use the session rules' toolAllow (PUT /v1/sessions/:id/policy) or the request's excludeTools.",
|
|
85
|
-
}),
|
|
86
|
-
};
|
|
87
|
-
case "statement":
|
|
88
|
-
return {
|
|
89
|
-
status: 409,
|
|
90
|
-
body: refusalBody({
|
|
91
|
-
errorCode: "checkpoint.unsupported_version",
|
|
92
|
-
message: "this task was suspended by an earlier server version (7.115.0 to 7.116.x) that read settings.permissions.allow as a statement that the named tools are allowed, which answered only the question nobody else had answered and never cleared an ordinary question such as a file write or a shell command; this version hands that list to the engine's allow layer, where an entry also clears those ordinary questions, so continuing would run calls without asking that the task was submitted to ask about. Nothing was decided and nothing was resumed, and retrying will be refused the same way: submit the work again as a new task, and if this task is still suspended cancel it first (POST /v1/runs/:id/cancel).",
|
|
93
|
-
}),
|
|
94
|
-
};
|
|
95
|
-
default: {
|
|
96
|
-
const unhandled = era;
|
|
97
|
-
throw new Error(`allow-list reading era ${String(unhandled)} has no refusal sentence`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
91
|
export function buildCheckpointVersionKeys(writerVersion, readerVersion) {
|
|
102
92
|
return writerVersion !== undefined ? { writerVersion, readerVersion } : {};
|
|
103
93
|
}
|
|
@@ -107,6 +97,9 @@ export function resumeBlockedByPolicyAnswer(inner) {
|
|
|
107
97
|
body: refusalBody({ errorCode: "resume_blocked_by_policy", message: `resume blocked by an admission policy change: ${inner.message} — nothing was resumed; if the task is still suspended on its approval, cancel it (POST /v1/runs/:id/cancel) to end it without another model turn`, facts: { blockedBy: inner.errorCode, ...inner.facts } }),
|
|
108
98
|
};
|
|
109
99
|
}
|
|
100
|
+
export function resumeAssemblyRefusalAnswer(status, inner) {
|
|
101
|
+
return inner.facts?.permanence === "transient" ? { status, body: refusalBody(inner) } : resumeBlockedByPolicyAnswer(inner);
|
|
102
|
+
}
|
|
110
103
|
export function isResumeBlockedByPolicy(answer) {
|
|
111
104
|
return answer.status === 409 && typeof answer.body === "object" && answer.body !== null && answer.body.errorCode === "resume_blocked_by_policy";
|
|
112
105
|
}
|
|
@@ -116,9 +109,13 @@ export function resumeRefusalWithCard(answer, cardPending) {
|
|
|
116
109
|
export function storedBodyReplayLogFields(refusal) {
|
|
117
110
|
switch (refusal.kind) {
|
|
118
111
|
case "allow_list_reading":
|
|
119
|
-
return { kind: refusal.kind,
|
|
112
|
+
return { kind: refusal.kind, ...(refusal.writerVersion !== undefined ? { writerVersion: refusal.writerVersion } : {}), note: "this session's stored request carries settings.permissions.allow and its writer version does not show it was written under the allow-layer reading (7.117.0 and later; versions before 7.124.0 recorded no writer version); it is not replayed under the current reading — the task stays suspended until someone cancels it" };
|
|
120
113
|
case "inert_tool_list":
|
|
121
114
|
return { kind: refusal.kind, layer: refusal.entry.layer, note: "this session's stored request carries a tool-list entry the engine reads as empty (a skill disallowedTools, an agent definition's denyTools / allowTools, the request's excludeTools / allowTools, or the rules in settings.permissions.deny / ask: a retired name, a case twin, a spelling no tool name can have, a rule core's grammar cannot compile, or a ~/ path rule on a lane with no home), or a permission list that is malformed or over the entry cap in either direction; it is not replayed — the task stays suspended until someone cancels it and resubmits with the entry fixed" };
|
|
115
|
+
case "settings_env_credential":
|
|
116
|
+
return { kind: refusal.kind, note: "this session's stored request carries credentials in settings.env (a credential variable name of this engine, or a value shaped like a secret) and the one-time window that dropped them on resume has closed; it is not replayed — the task stays suspended until someone cancels it and resubmits with the credentials moved into the engine's environment" };
|
|
117
|
+
case "unread_members":
|
|
118
|
+
return { kind: refusal.kind, members: refusal.members, memberCount: refusal.memberCount, note: "this session's stored request carries members this version's readers cannot take as written (named in the refusal: settings.hooks / settings.env / an MCP server's transport / an A2A peer's headers …) and this deployment would apply them; replaying it would run without them, so it is not replayed — the task stays suspended until someone cancels it and resubmits with those members in the current form" };
|
|
122
119
|
case "permission_mode_reading":
|
|
123
120
|
return { kind: refusal.kind, storedMode: refusal.stored ?? null, floor: refusal.floor, note: "this session's stored request was written before the operator's AUTONOMY plan floor was recorded in the task (earlier versions re-applied it on every resume); replaying it now would run under its submitted permission mode — the task stays suspended until someone cancels it, or AUTONOMY is set to read-only so it can finish with read-only hands" };
|
|
124
121
|
case "retired_request_key":
|
|
@@ -135,11 +132,14 @@ export function storedBodyReplayAnswer(refusal, readerVersion, cardPending) {
|
|
|
135
132
|
function storedBodyReplayArmAnswer(refusal, readerVersion) {
|
|
136
133
|
switch (refusal.kind) {
|
|
137
134
|
case "allow_list_reading": {
|
|
138
|
-
const answer = allowListReadingRefusal(
|
|
135
|
+
const answer = allowListReadingRefusal();
|
|
139
136
|
return { status: answer.status, body: { ...answer.body, ...buildCheckpointVersionKeys(refusal.writerVersion, readerVersion) } };
|
|
140
137
|
}
|
|
141
138
|
case "inert_tool_list":
|
|
142
139
|
return resumeBlockedByPolicyAnswer(refusal.entry.extra === undefined ? { errorCode: refusal.entry.code, message: refusal.entry.message } : { errorCode: refusal.entry.code, message: refusal.entry.message, facts: refusal.entry.extra });
|
|
140
|
+
case "settings_env_credential":
|
|
141
|
+
case "unread_members":
|
|
142
|
+
return resumeBlockedByPolicyAnswer(refusal.refusal);
|
|
143
143
|
case "permission_mode_reading": {
|
|
144
144
|
const answer = permissionModeReadingRefusal();
|
|
145
145
|
return { status: answer.status, body: { ...answer.body, ...buildCheckpointVersionKeys(refusal.writerVersion, readerVersion) } };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** `step` 标签的闭集:一个往返一个词。 */
|
|
2
|
+
export declare const EXECUTION_CLAIM_STEPS: readonly ["run_claim", "placement_commit"];
|
|
3
|
+
export type ExecutionClaimStep = (typeof EXECUTION_CLAIM_STEPS)[number];
|
|
4
|
+
/** 计时落点:`Metrics` 的 `observe` 子集(deps 上没有指标注册表、或只带计数的桩 ⇒ 不计,行为逐字不变)。 */
|
|
5
|
+
export interface ClaimLatencySink {
|
|
6
|
+
observe?(name: string, value: number, labels?: Record<string, string>): void;
|
|
7
|
+
}
|
|
8
|
+
/** 量一次认领往返(秒)。`claim` 是刚发出的往返(调用点在实参位置发起它,时钟随即起);抛也计、上抛原错。 */
|
|
9
|
+
export declare function timeClaim<T>(sink: ClaimLatencySink | undefined, step: ExecutionClaimStep, claim: Promise<T>): Promise<T>;
|
|
10
|
+
//# sourceMappingURL=claim-latency.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EXECUTION_CLAIM_METRIC } from "../observability/metrics.js";
|
|
2
|
+
export const EXECUTION_CLAIM_STEPS = ["run_claim", "placement_commit"];
|
|
3
|
+
export async function timeClaim(sink, step, claim) {
|
|
4
|
+
const started = performance.now();
|
|
5
|
+
try {
|
|
6
|
+
return await claim;
|
|
7
|
+
}
|
|
8
|
+
finally {
|
|
9
|
+
sink?.observe?.(EXECUTION_CLAIM_METRIC, (performance.now() - started) / 1000, { step });
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=claim-latency.js.map
|