@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,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* 换钉前的**排空检查 —— `DB_BACKEND=local`(File 店)车道**,只读。随 npm 包出(`scripts/drain-check-local.mjs`)。
|
|
4
|
-
*
|
|
4
|
+
* 一次跑**七条判据**(判据表 {@link DRAIN_CRITERIA},每条一行末行、各自的命中行;SQL 车道的同一判据是同目录随包的 `drain-check.mysql.sql` / `drain-check.pg.sql`,
|
|
5
5
|
* 每条判据一段、段首标记 `-- drain-check:<判据名>:<后端>`,判据名与本表的 `name` 同一个词):
|
|
6
6
|
* · `skill-grants-rollback`(**回滚**到 7.115.x 前,即引擎从 7.41 退回 7.40):四样任一 ——
|
|
7
7
|
* ① pending 行带 `state.skillGrants`(本次 run 冻结在行上的技能授予行:模型激活 / 子代捕获写下的放行与禁止);
|
|
@@ -22,21 +22,9 @@
|
|
|
22
22
|
* 判据**就是**服务提交与续跑两腿同经的那一只判官(`src/rule-entry-list.ts`:两腿经 `inertToolListEntryOf` 判全部工具名清单,它先调技能两层的取清单函数 `skillDenyInertEntryOf`,
|
|
23
23
|
* 后者调引擎包根的 `compileAllowList`),本脚本取的是技能两层那一只,经编译产物 `dist/rule-entry-list.js` 取 —— 不写第二份。7.131.0 起读成空即拒的清单扩到根 run 的 `allowTools` / `excludeTools` 与子代定义的 `allowTools` / `denyTools`,
|
|
24
24
|
* 本判据(窗在 7.117.0)与随包 SQL 孪生**仍只数技能两层**,不覆盖那几张清单(续跑时的 409 是它们的响亮道);
|
|
25
|
-
* · `workflow-park-holder`(换钉 7.118.0 前,引擎 7.44.0 起 workflow 子代卡交给哪条 run 只看记录 `parks[]` 条目上的持有者位 `parkedBy` / `generation`):
|
|
26
|
-
* pending 行的子会话被 workflow park 索引点名(`<数据根>/workflows/workflow-agent-sessions/index.jsonl`:一行 = 一条 workflow run 的整份指针集
|
|
27
|
-
* `{ runId, rows: [{ sessionId, runId, agentKey, scope }] }`,同一条 run 后写的一行整份覆盖先写的,空集 = 它不再点名任何子会话)= 一张待批的 workflow 子代卡。
|
|
28
|
-
* 在**换钉之前、对旧版本的数据**跑:引擎 7.43 及以前写下的记录没有持有者位 ⇒ 这样的卡升级后在决定口答 409 `decide.workflow_parks_unreadable`
|
|
29
|
-
* (更早的引擎写下、记录上根本没有 `parks` 的,答 409 `conflict.resume_context_unavailable`;卡都仍待批,出路相同 = 续跑那条 workflow run 再决,见随包 `MIGRATION.md` 7.118.0 节);换钉之后再跑会把新引擎写下的卡也数进来。命中行点名点它的 run(`runId=`)。
|
|
30
|
-
* 账本行的读法是服务里那一只(`src/orchestration/workflow-agent-session-index.ts` 的 `readAgentSessionLedgerLine`),经编译产物
|
|
31
|
-
* `dist/orchestration/workflow-agent-session-index.js` 取 —— 本脚本只按 runId 折叠;读不出的行计入 `corrupt`(rc 2:读不出的那一行可能正是点名某张待批卡的那一份);
|
|
32
|
-
* 窗与删码:本判据是一次性迁移 M9 的读侧半场 —— 窗口与删码清单见引擎启动期一次性迁移登记表(one-time-migrations)M9 一行,随 M9 一起删;这里不写第二份窗。
|
|
33
25
|
* · `parked-tool-lists`(升级到 7.132.0 前)/ `own-tool-lists-rollback`(从 7.132.0 回滚前):停驻行记下的工具名清单 / 7.52 写下的 `ownToolLists`(判据与出路见判据表那两条的注);
|
|
34
26
|
* · `sealed-credentials-rollback`(从 7.134.0 回滚前;从 7.135.0 / 7.136.0 回滚到上一版前同用):续跑上下文的凭据位上带封签的 pending 行(7.133.x 读不懂封签,续跑时把这些位当没有;判据与出路见判据表那一条的注);
|
|
35
27
|
* · `retired-mode-seed`(换钉 7.113.0 前,core 7.39.0 删掉退役 mode-seed 的一次性迁移):pending 行的 `state.inheritedGate` 仍带退役成员;
|
|
36
|
-
* · `permissions-allow-list`(换钉 7.117.0 前,本服务把 `settings.permissions.allow` 整份交给引擎的 allow 层):pending 行所在会话的续跑上下文
|
|
37
|
-
* (`checkpoint-ctx/*.json` 的信封 `{ sessionId, updatedAt, ctx }`)里,`ctx.body.settings.permissions.allow` 是非空数组,且 `ctx.permissionsAllowReading` 不是 `"allow_layer"`
|
|
38
|
-
* (无记号 = 名单时代写下的;`"statement"` = 表态时代写下的)—— 这样的行在 7.117.0 上续跑会被拒(行字节不动;出路按停驻种类分,见随包 `MIGRATION.md` 7.117.0 节)。判据**就是**服务续跑腿拒臂的那一只函数(`src/http/checkpoint-ctx.ts` 的 `allowListReadingUnstated`),
|
|
39
|
-
* 经包里脚本隔壁的编译产物 `dist/http/checkpoint-ctx.js` 取(与缺省数据根经 `dist/local-data-root.js` 取同一姿势;7.122.0 起该模块零值依赖 —— 存量体能否重放的整只判据移到了 `dist/http/stored-body-replay.js`,本脚本不读它;7.117.0–7.121.x 该模块经 `dist/rule-entry-list.js` 依赖引擎包根)—— 本脚本不写第二份。
|
|
40
28
|
* 扫描骨架(快照 + 账本折成当前行、一致性重读、数据根判定)各条判据共用;判据只回答「这一条 pending 行算不算命中」。
|
|
41
29
|
*
|
|
42
30
|
* ## 为什么是一只脚本,不是一行 grep
|
|
@@ -73,22 +61,19 @@
|
|
|
73
61
|
* ## 读数(机读末行 + 退出码)
|
|
74
62
|
* · 每条命中一行:`SKILL-GRANTS-ROW token=<token> sessionId=<id> createdAt=<ms> member=<skillGrants|boundGrantDigest|userInvokedSkills|disallowedTools>` / `SKILL-MANIFEST-ROW token=<token> sessionId=<id> createdAt=<ms> member=<skills|agents.skills>` /
|
|
75
63
|
* `SKILL-DENY-INERT-ROW token=<token> sessionId=<id> createdAt=<ms> member=<skills|agents.skills>` /
|
|
76
|
-
* `WORKFLOW-PARK-ROW token=<token> sessionId=<id> createdAt=<ms> runId=<点名它的 run,逗号连接>` /
|
|
77
64
|
* `PARKED-TOOL-LISTS-ROW token=<token> sessionId=<id> createdAt=<ms> member=<toolCeiling|constraintChain|boundGrantDigest>` / `OWN-TOOL-LISTS-ROW token=<token> sessionId=<id> createdAt=<ms>` /
|
|
78
65
|
* `SEALED-CREDENTIALS-ROW token=<token> sessionId=<id> createdAt=<ms> field=<第一处带封签的凭据位>|runId=<workflow 子代卡:点它的 run>` /
|
|
79
|
-
* `
|
|
80
|
-
* · 每条判据一行末行(表序;`RETIRED-MODE-SEED` 那一行恒在最后,7.113.0
|
|
66
|
+
* `RETIRED-ROW token=<token> sessionId=<id> createdAt=<ms> member=<成员>`;
|
|
67
|
+
* · 每条判据一行末行(表序;`RETIRED-MODE-SEED` 那一行恒在最后,7.113.0 起读「最后一行」的下游不受影响):
|
|
81
68
|
* `SKILL-GRANTS rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
82
69
|
* `RETIRED-SKILL-MANIFEST rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
83
70
|
* `SKILL-DENY-INERT rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
84
|
-
* `WORKFLOW-PARK-HOLDER rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
85
71
|
* `PARKED-TOOL-LISTS rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
86
72
|
* `OWN-TOOL-LISTS-ROLLBACK rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
87
73
|
* `SEALED-CREDENTIALS-ROLLBACK rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
88
|
-
* `PERMISSIONS-ALLOW-LIST rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
89
74
|
* `RETIRED-MODE-SEED rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`;
|
|
90
|
-
* `corrupt` = 共用扫描的坏记录 + 这条判据自己读不懂的旁路输入(
|
|
91
|
-
* `
|
|
75
|
+
* `corrupt` = 共用扫描的坏记录 + 这条判据自己读不懂的旁路输入(读不懂的 ctx 档,文件名进 stderr —— 一份读不懂的 ctx 可能正是让某条 pending 行命中的那一份;
|
|
76
|
+
* `sealed-credentials-rollback` 另读 workflow park 索引:索引账本里读不出的行,行号进 stderr);
|
|
92
77
|
* 没读成 / 不能下结论(rc 2 的几种缺席与不稳形)时前五个计数是 `-`、多一个 `reason=<词>`,**不会出现 `rows=0`**(下游读 `rows=0` 即「干净」);
|
|
93
78
|
* · rc 0 = 每条判据都零命中(可换钉 / 可回滚)· rc 1 = 有命中(逐行列出;答完或取消再跑)· rc 2 = 读不懂 / 没读成 / 不能下结论(账本里有本脚本不认的事件词 / 不合形的记录 / 读不懂的 ctx 档 /
|
|
94
79
|
* 数据根缺席 / 缺省根解析不可用 / 判据模块不可用(脚本隔壁没有 `dist/`:源码树没 build)/ 读期间文件一直在变 / 读文件出错 / 用法错)—— 不给结论(缺席 ≠ 干净:一条读不懂的记录可能正是让某行回到 pending 的那一条)。
|
|
@@ -100,7 +85,7 @@ import { join } from "node:path";
|
|
|
100
85
|
import { fileURLToPath } from "node:url";
|
|
101
86
|
|
|
102
87
|
/** 从脚本隔壁的编译产物取来的服务判据(脚本不持第二份实现)。
|
|
103
|
-
* @typedef {{
|
|
88
|
+
* @typedef {{ sealedCredentialFieldOf: (ctx: unknown) => string | undefined, retiredSkillManifestLayerOf: (body: unknown) => "skills" | "agents.skills" | undefined, skillDenyInertEntryOf: (body: unknown) => { layer: "skills" | "agents.skills", message: string } | undefined, readAgentSessionLedgerLine: (v: unknown) => { runId: string, rows: Array<{ sessionId: string }> } | undefined }} ServiceCriteria */
|
|
104
89
|
|
|
105
90
|
/** 读期间文件在变时的有界重读次数(含第一次)。 */
|
|
106
91
|
const STABLE_READ_ATTEMPTS = 3;
|
|
@@ -386,7 +371,7 @@ export const DRAIN_CRITERIA = [
|
|
|
386
371
|
},
|
|
387
372
|
{
|
|
388
373
|
// 升级到 7.116.0 之前:停驻、持久化体里技能还带退役 `manifest` 的行(头注第二条判据)。判据函数是服务里那一只(`retiredSkillManifestLayerOf`,经编译产物取);
|
|
389
|
-
// 命中行点名是顶层 `skills[]` 还是子代 `agents[].skills[]`。表序紧跟回滚前那一条 —— `
|
|
374
|
+
// 命中行点名是顶层 `skills[]` 还是子代 `agents[].skills[]`。表序紧跟回滚前那一条 —— `RETIRED-MODE-SEED` 仍最后。
|
|
390
375
|
name: "retired-skill-manifest",
|
|
391
376
|
tail: "RETIRED-SKILL-MANIFEST",
|
|
392
377
|
hit: "SKILL-MANIFEST-ROW",
|
|
@@ -403,7 +388,7 @@ export const DRAIN_CRITERIA = [
|
|
|
403
388
|
},
|
|
404
389
|
{
|
|
405
390
|
// 换钉 7.117.0 之前:停驻、持久化体里某只技能的拒侧清单有引擎读成空的条目(头注里那一条)。判据函数是服务提交与续跑两腿同经的那一只(`skillDenyInertEntryOf`,经编译产物取);
|
|
406
|
-
//
|
|
391
|
+
// 命中行点名层。
|
|
407
392
|
name: "skill-deny-inert",
|
|
408
393
|
tail: "SKILL-DENY-INERT",
|
|
409
394
|
hit: "SKILL-DENY-INERT-ROW",
|
|
@@ -418,22 +403,6 @@ export const DRAIN_CRITERIA = [
|
|
|
418
403
|
return hit === undefined ? undefined : ` member=${hit.layer}`;
|
|
419
404
|
},
|
|
420
405
|
},
|
|
421
|
-
{
|
|
422
|
-
// 换钉 7.118.0 之前:待批、且子会话被 workflow park 索引点名的卡(头注里那一条)。账本行的读法是服务里那一只(`readAgentSessionLedgerLine`,经编译产物取);
|
|
423
|
-
// 命中行点名点它的 run。表序在 `permissions-allow-list` 之前 —— 那一条仍倒数第二、`RETIRED-MODE-SEED` 仍最后。
|
|
424
|
-
name: "workflow-park-holder",
|
|
425
|
-
tail: "WORKFLOW-PARK-HOLDER",
|
|
426
|
-
hit: "WORKFLOW-PARK-ROW",
|
|
427
|
-
load: (root, service) => {
|
|
428
|
-
const idx = readParkIndex(root, service.readAgentSessionLedgerLine);
|
|
429
|
-
return { input: idx.bySession, corrupt: idx.corrupt, unreadable: idx.unreadable };
|
|
430
|
-
},
|
|
431
|
-
judge: (row, input) => {
|
|
432
|
-
const bySession = /** @type {Map<string, string[]>} */ (input);
|
|
433
|
-
const runs = typeof row.sessionId === "string" ? bySession.get(row.sessionId) : undefined;
|
|
434
|
-
return runs === undefined ? undefined : ` runId=${runs.join(",")}`;
|
|
435
|
-
},
|
|
436
|
-
},
|
|
437
406
|
{
|
|
438
407
|
// 升级到 7.132.0 之前(引擎 7.52 在认领前按规范拼写读停驻行记下的工具名清单):pending 行带这三座任一 —— 子代的工具天花板 `state.toolCeiling`(键在场且不是空数组)、
|
|
439
408
|
// 冻结的父约束链 `state.inheritedGate.constraintChain`(非空数组)、Skill 卡的清单绑定 `pendingAction.boundGrantDigest`。7.51 按原拼写记它们,7.52 读到 `Bash(*)` / `Tool()` /
|
|
@@ -472,7 +441,6 @@ export const DRAIN_CRITERIA = [
|
|
|
472
441
|
// 命中行点名第一处凭据位(`field=`,键名;值从不出来);读不懂的 ctx 档 / 索引账本行计入 `corrupt`(rc 2)。
|
|
473
442
|
// 读哪一份续跑上下文与续跑腿同:workflow 子代卡(子会话被 park 索引点名)续跑读**发起会话**那一份,而发起会话记在引擎的 run 账里(引擎自己的账本格式,本脚本不重抄)
|
|
474
443
|
// ⇒ 子代卡数的是真超集:自己那一份带封签,或数据根里任一份 ctx 带封签,即记为候选并点名点它的 run(`runId=`)—— 与随包 SQL 孪生同为超集,不漏。
|
|
475
|
-
// 表序在 `permissions-allow-list` 之前 —— 那一条仍倒数第二、`RETIRED-MODE-SEED` 仍最后。
|
|
476
444
|
name: "sealed-credentials-rollback",
|
|
477
445
|
tail: "SEALED-CREDENTIALS-ROLLBACK",
|
|
478
446
|
hit: "SEALED-CREDENTIALS-ROW",
|
|
@@ -493,20 +461,6 @@ export const DRAIN_CRITERIA = [
|
|
|
493
461
|
return runs !== undefined && anySealed ? ` runId=${runs.join(",")}` : undefined;
|
|
494
462
|
},
|
|
495
463
|
},
|
|
496
|
-
{
|
|
497
|
-
name: "permissions-allow-list",
|
|
498
|
-
tail: "PERMISSIONS-ALLOW-LIST",
|
|
499
|
-
hit: "ALLOW-LIST-ROW",
|
|
500
|
-
load: (root, service) => {
|
|
501
|
-
const idx = readCtxIndex(root);
|
|
502
|
-
return { input: { bySession: idx.bySession, unstated: service.allowListReadingUnstated }, corrupt: idx.corrupt, unreadable: idx.unreadable };
|
|
503
|
-
},
|
|
504
|
-
judge: (row, input) => {
|
|
505
|
-
const { bySession, unstated } = /** @type {{ bySession: Map<string, Record<string, unknown>>, unstated: (ctx: Record<string, unknown>) => boolean }} */ (input);
|
|
506
|
-
const ctx = typeof row.sessionId === "string" ? bySession.get(row.sessionId) : undefined;
|
|
507
|
-
return ctx !== undefined && unstated(ctx) ? "" : undefined;
|
|
508
|
-
},
|
|
509
|
-
},
|
|
510
464
|
{
|
|
511
465
|
name: "retired-mode-seed",
|
|
512
466
|
tail: "RETIRED-MODE-SEED",
|
|
@@ -535,7 +489,6 @@ function unreadableReport(reason, sentence, rootEcho) {
|
|
|
535
489
|
async function loadServiceCriteria(rootEcho) {
|
|
536
490
|
/** @type {Array<[string, () => Promise<Record<string, unknown>>, string]>} 〔产物相对路径(报告用), 取模块, 导出名〕 */
|
|
537
491
|
const wanted = [
|
|
538
|
-
["dist/http/checkpoint-ctx.js", () => import("../dist/http/checkpoint-ctx.js"), "allowListReadingUnstated"],
|
|
539
492
|
["dist/http/checkpoint-ctx.js", () => import("../dist/http/checkpoint-ctx.js"), "sealedCredentialFieldOf"],
|
|
540
493
|
["dist/http/retired-skill-manifest.js", () => import("../dist/http/retired-skill-manifest.js"), "retiredSkillManifestLayerOf"],
|
|
541
494
|
["dist/rule-entry-list.js", () => import("../dist/rule-entry-list.js"), "skillDenyInertEntryOf"],
|
|
@@ -8,17 +8,15 @@
|
|
|
8
8
|
-- sessions 命中行所在的会话 id,逗号连接,新的在前。以 hit_rows 为准:这一列被会话变量 group_concat_max_len(缺省 1024 字节)截断时,列出的会话数会少于 hit_rows ——
|
|
9
9
|
-- 先处理列出的再跑一次,或先在同一个会话里 SET SESSION group_concat_max_len = 1048576; 再跑本文件(本文件自己只含 SELECT)。
|
|
10
10
|
-- 每段只数 pending 行(已决 / 已过期的行不数);判据只看**键在不在 / 值形**,不读行的其余内容。
|
|
11
|
-
-- DB_BACKEND=local(File 店)没有 SQL:用同目录的 drain-check-local.mjs
|
|
11
|
+
-- DB_BACKEND=local(File 店)没有 SQL:用同目录的 drain-check-local.mjs,七条判据同名。
|
|
12
12
|
--
|
|
13
|
-
--
|
|
13
|
+
-- 七条判据(顺序同 drain-check-local.mjs 的判据表):
|
|
14
14
|
-- skill-grants-rollback 回滚到 7.115.x(引擎 7.40)之前:7.116.0 停驻的行带 7.40 不读的技能授予节 / 卡绑定 / 会话上下文里的人点名技能 / 还没被激活的技能声明的禁止清单。
|
|
15
15
|
-- retired-skill-manifest 升级到 7.116.0 之前:停驻、持久化提交体里技能(顶层 skills[] 或子代 agents[].skills[])还带已退役的 manifest 键。
|
|
16
16
|
-- skill-deny-inert 换钉 7.117.0 之前:停驻、提交体里技能(顶层 skills[] 或子代 agents[].skills[])的 disallowedTools 有引擎会读成空的条目的**候选**(见该段注)。
|
|
17
|
-
-- workflow-park-holder 换钉 7.118.0 之前 / 从 7.118.0 回滚到 7.117.x 之前:此刻待批、且子会话被 workflow park 索引点名的卡(workflow 子代卡;见该段注)。
|
|
18
17
|
-- parked-tool-lists 升级到 7.132.0 之前:停驻行记着子代工具天花板 / 冻结的父约束链 / Skill 卡的清单绑定(7.52 在认领前按规范拼写读它们)的**候选**(见该段注)。
|
|
19
18
|
-- own-tool-lists-rollback 从 7.132.0 回滚到 7.131.x 之前:7.132.0 停驻、带 state.ownToolLists 的行(7.131.x 读不了)。
|
|
20
19
|
-- sealed-credentials-rollback 从 7.134.0 回滚到 7.133.x(或从 7.135.0 回滚到 7.134.x、从 7.136.0 回滚到 7.135.x)之前:停驻、续跑上下文里提交体的凭据位上带封签的行(7.133.x 读不懂封签,续跑时把这些位当没有)的**候选**(见该段注)。
|
|
21
|
-
-- permissions-allow-list 换钉 7.117.0 之前:停驻、提交体 settings.permissions.allow 是非空数组且读法记号不是当前的 "allow_layer"(无记号 = 名单时代;"statement" = 表态时代)。
|
|
22
20
|
-- retired-mode-seed 换钉 7.113.0 之前:检查点的 inheritedGate 里仍带退役 mode-seed 成员。
|
|
23
21
|
|
|
24
22
|
-- drain-check:skill-grants-rollback:mysql —— 期望 hit_rows = 0;每一行 = 一条回滚到 7.115.x 后续跑会丢技能禁止行 / 不核卡绑定的停驻行。
|
|
@@ -75,21 +73,6 @@ WHERE k.status = 'pending'
|
|
|
75
73
|
OR (JSON_TYPE(JSON_EXTRACT(c.ctx, '$.body.agents')) = 'ARRAY'
|
|
76
74
|
AND JSON_CONTAINS_PATH(c.ctx, 'one', '$.body.agents[*].skills[*].disallowedTools[0]'))));
|
|
77
75
|
|
|
78
|
-
-- drain-check:workflow-park-holder:mysql —— 期望 hit_rows = 0;每一行 = 一张待批的 workflow 子代卡(它的子会话被 workflow_agent_session 里的一条指针点名)。
|
|
79
|
-
-- 在**换钉之前**、对旧版本的数据跑:7.118.0 起 workflow 子代卡交给哪条 run 只看记录 parks[] 条目上的持有者位(parkedBy / generation),
|
|
80
|
-
-- 引擎 7.43 及以前写下的记录没有这两位 ⇒ 这样的卡升级后在决定口答 409 decide.workflow_parks_unreadable(更早的引擎写下、记录上根本没有 parks 的,答 409
|
|
81
|
-
-- conflict.resume_context_unavailable;卡都仍待批,出路相同 = 续跑那条 workflow run 再决)。
|
|
82
|
-
-- 换钉前把它们决掉(或取消发起它的任务)就省掉这一步。换钉之后再跑本段会把新引擎写下的卡也数进来(那时它不再是「会被拒的卡」的读数)。
|
|
83
|
-
-- 从 7.118.0 回滚到 7.117.x 之前、对 7.118.0 的数据跑:数出的就是全部待批的 workflow 子代卡 —— 回滚要删掉这张索引表(7.117.x 按旧主键重建,
|
|
84
|
-
-- 旧副本在新主键上写不进 / 读不准,见随包 MIGRATION.md 7.118.0 节),删表之后这些卡没有指针、决不掉;先把它们决掉或取消。
|
|
85
|
-
-- 对索引表用 EXISTS 而不 JOIN:一个子会话可以被好几条记录点名,JOIN 会把一张卡数成几张。
|
|
86
|
-
-- 窗与删码:本判据是一次性迁移 M9 的读侧半场 —— 窗口与删码清单见引擎启动期一次性迁移登记表(one-time-migrations)M9 一行,随 M9 一起删;这里不写第二份窗。
|
|
87
|
-
SELECT 'workflow-park-holder' AS criterion, COUNT(*) AS hit_rows,
|
|
88
|
-
COALESCE(GROUP_CONCAT(k.session_id ORDER BY k.created_at_ms DESC SEPARATOR ','), '') AS sessions
|
|
89
|
-
FROM checkpoint k
|
|
90
|
-
WHERE k.status = 'pending'
|
|
91
|
-
AND EXISTS (SELECT 1 FROM workflow_agent_session w WHERE w.session_id = k.session_id);
|
|
92
|
-
|
|
93
76
|
-- drain-check:parked-tool-lists:mysql —— 期望 hit_rows = 0;每一行 = 一条**候选**:升级到 7.132.0 后续跑可能在认领前被拒的停驻行。
|
|
94
77
|
-- 在**升级之前**、对 7.131.x 的数据跑。7.131.x 的引擎(7.51)把行上的三样按原拼写记下,7.132.0 的引擎(7.52)在认领前按规范拼写读它们:
|
|
95
78
|
-- 子代的工具天花板 state.toolCeiling(`Bash(*)` / `Tool()` / 内容形 / 读不出的名 / deny `*` ⇒ 409 checkpoint.config_refused,blockedBy = config.tool_face_control,field = inheritedGate);
|
|
@@ -119,7 +102,7 @@ WHERE k.status = 'pending'
|
|
|
119
102
|
-- drain-check:sealed-credentials-rollback:mysql —— 期望 hit_rows = 0;每一行 = 一条**候选**:从 7.134.0 回滚到 7.133.x 后续跑会丢掉请求凭据的停驻行。
|
|
120
103
|
-- 在**回滚之前**、对 7.134.0 的数据跑:7.134.0 把续跑上下文里提交体的凭据位(MCP / A2A 请求头与 env、settings.env、settings.webSearch.apiKey、http hook 请求头;7.135.0 起另有 command hook 的插件选项)
|
|
121
104
|
-- 封成封签(对象,格式词 "checkpoint-ctx-sealedbox-v1")才落盘;7.133.x 读不懂封签,续跑时把这些位当作没有(无凭据照跑、不报错)。出路:回滚前把它们决掉或取消(见随包 MIGRATION.md 7.134.0 节)。
|
|
122
|
-
-- 读哪一份续跑上下文:与续跑腿同(连接形与
|
|
105
|
+
-- 读哪一份续跑上下文:与续跑腿同(连接形与 skill-deny-inert 段逐字同,理由见该段注)。SQL 不走凭据位闭集 ⇒ 数的是**真超集**:提交体里任何一处有一个
|
|
123
106
|
-- JSON 串值恰为这个格式词即数(封签只落在凭据位上;体里别处恰好写着这个词的串值也会被数到 —— 多数,不漏)。本地脚本同名判据走服务里那一只凭据位走法(精确)。
|
|
124
107
|
-- 从 7.135.0 回滚到 7.134.x 之前同用本判据:7.135.0 起 command hook 条目的插件选项(settings.hooks.<事件>[].hooks[].plugin.options)也封成封签,7.134.x 不认这一位,
|
|
125
108
|
-- 续跑时那份 hooks 整只不采纳(其中的守卫不再拦)。本判据数任何凭据位上带封签的行,所以这一类也在候选里(超集)。
|
|
@@ -137,26 +120,6 @@ WHERE k.status = 'pending'
|
|
|
137
120
|
WHERE kk.token = k.token
|
|
138
121
|
AND LOCATE('"checkpoint-ctx-sealedbox-v1"', CAST(JSON_EXTRACT(c.ctx, '$.body') AS CHAR)) > 0);
|
|
139
122
|
|
|
140
|
-
-- drain-check:permissions-allow-list:mysql —— 期望 hit_rows = 0;每一行 = 一条升级后续跑会被拒的停驻行。
|
|
141
|
-
-- 读哪一份续跑上下文:与续跑腿同 —— workflow 子代的停驻行(在 workflow_agent_session 里登记过)续跑时读的是**发起这条 workflow 的会话**那一份
|
|
142
|
-
-- (workflow_run.run 的 originatingSessionId);其余行读自己会话那一份。一个子会话可以被好几条 workflow 记录点名(续跑链 / 分叉;7.118.0 起索引主键是
|
|
143
|
-
-- (session_id, run_id)),续跑腿读的是其中**持有者**那条记录的发起会话,持有者通常是链上最新的、不是最老的,SQL 判不出是哪一条 ⇒ 数的是真超集:
|
|
144
|
-
-- 任一条指针记录的发起会话命中即数(指针没有记录 / 记录没有发起会话 ⇒ 读这张卡自己会话的);整条连接链包在对这张卡的 EXISTS 里(kk = 这张卡本身,按主键取回),一张卡只数一次。
|
|
145
|
-
-- 判据 = 服务续跑腿拒臂的同一句话:提交体 settings.permissions.allow 是非空数组,且上下文的读法记号 permissionsAllowReading 不是当前的 "allow_layer"。
|
|
146
|
-
SELECT 'permissions-allow-list' AS criterion, COUNT(*) AS hit_rows,
|
|
147
|
-
COALESCE(GROUP_CONCAT(k.session_id ORDER BY k.created_at_ms DESC SEPARATOR ','), '') AS sessions
|
|
148
|
-
FROM checkpoint k
|
|
149
|
-
WHERE k.status = 'pending'
|
|
150
|
-
AND EXISTS (SELECT 1
|
|
151
|
-
FROM checkpoint kk
|
|
152
|
-
LEFT JOIN workflow_agent_session w ON w.session_id = kk.session_id
|
|
153
|
-
LEFT JOIN workflow_run r ON r.id = w.run_id
|
|
154
|
-
JOIN checkpoint_ctx c ON c.session_id = COALESCE(JSON_UNQUOTE(JSON_EXTRACT(r.run, '$.originatingSessionId')), kk.session_id)
|
|
155
|
-
WHERE kk.token = k.token
|
|
156
|
-
AND JSON_TYPE(JSON_EXTRACT(c.ctx, '$.body.settings.permissions.allow')) = 'ARRAY'
|
|
157
|
-
AND JSON_LENGTH(JSON_EXTRACT(c.ctx, '$.body.settings.permissions.allow')) > 0
|
|
158
|
-
AND COALESCE(JSON_UNQUOTE(JSON_EXTRACT(c.ctx, '$.permissionsAllowReading')), '') <> 'allow_layer');
|
|
159
|
-
|
|
160
123
|
-- drain-check:retired-mode-seed:mysql —— 期望 hit_rows = 0;每一行 = 一条升级后会被拒的停放行。
|
|
161
124
|
-- 判据逐字照引擎 refuseRetiredModeSeed:inheritedGate 带 autoModeRequested / approverPosture(任何值,含 JSON null),或 shellGate 不是 "always"(含 JSON null)。
|
|
162
125
|
SELECT 'retired-mode-seed' AS criterion, COUNT(*) AS hit_rows,
|
|
@@ -7,17 +7,15 @@
|
|
|
7
7
|
-- hit_rows 命中的停驻行数(pending 行里算命中的那些);**全部为 0 才算排空**,非 0 ⇒ 逐条答完或取消(各判据对应的升级 / 回滚说明见随包 MIGRATION.md);
|
|
8
8
|
-- sessions 命中行所在的会话 id,逗号连接,新的在前。
|
|
9
9
|
-- 每段只数 pending 行(已决 / 已过期的行不数);判据只看**键在不在 / 值形**,不读行的其余内容。
|
|
10
|
-
-- DB_BACKEND=local(File 店)没有 SQL:用同目录的 drain-check-local.mjs
|
|
10
|
+
-- DB_BACKEND=local(File 店)没有 SQL:用同目录的 drain-check-local.mjs,七条判据同名。
|
|
11
11
|
--
|
|
12
|
-
--
|
|
12
|
+
-- 七条判据(顺序同 drain-check-local.mjs 的判据表):
|
|
13
13
|
-- skill-grants-rollback 回滚到 7.115.x(引擎 7.40)之前:7.116.0 停驻的行带 7.40 不读的技能授予节 / 卡绑定 / 会话上下文里的人点名技能 / 还没被激活的技能声明的禁止清单。
|
|
14
14
|
-- retired-skill-manifest 升级到 7.116.0 之前:停驻、持久化提交体里技能(顶层 skills[] 或子代 agents[].skills[])还带已退役的 manifest 键。
|
|
15
15
|
-- skill-deny-inert 换钉 7.117.0 之前:停驻、提交体里技能(顶层 skills[] 或子代 agents[].skills[])的 disallowedTools 有引擎会读成空的条目的**候选**(见该段注)。
|
|
16
|
-
-- workflow-park-holder 换钉 7.118.0 之前 / 从 7.118.0 回滚到 7.117.x 之前:此刻待批、且子会话被 workflow park 索引点名的卡(workflow 子代卡;见该段注)。
|
|
17
16
|
-- parked-tool-lists 升级到 7.132.0 之前:停驻行记着子代工具天花板 / 冻结的父约束链 / Skill 卡的清单绑定(7.52 在认领前按规范拼写读它们)的**候选**(见该段注)。
|
|
18
17
|
-- own-tool-lists-rollback 从 7.132.0 回滚到 7.131.x 之前:7.132.0 停驻、带 state.ownToolLists 的行(7.131.x 读不了)。
|
|
19
18
|
-- sealed-credentials-rollback 从 7.134.0 回滚到 7.133.x(或从 7.135.0 回滚到 7.134.x、从 7.136.0 回滚到 7.135.x)之前:停驻、续跑上下文里提交体的凭据位上带封签的行(7.133.x 读不懂封签,续跑时把这些位当没有)的**候选**(见该段注)。
|
|
20
|
-
-- permissions-allow-list 换钉 7.117.0 之前:停驻、提交体 settings.permissions.allow 是非空数组且读法记号不是当前的 "allow_layer"(无记号 = 名单时代;"statement" = 表态时代)。
|
|
21
19
|
-- retired-mode-seed 换钉 7.113.0 之前:检查点的 inheritedGate 里仍带退役 mode-seed 成员。
|
|
22
20
|
|
|
23
21
|
-- drain-check:skill-grants-rollback:pg —— 期望 hit_rows = 0;每一行 = 一条回滚到 7.115.x 后续跑会丢技能禁止行 / 不核卡绑定的停驻行。
|
|
@@ -84,21 +82,6 @@ WHERE k.status = 'pending'
|
|
|
84
82
|
jsonb_array_elements(CASE WHEN jsonb_typeof(a -> 'skills') = 'array' THEN a -> 'skills' ELSE '[]'::jsonb END) AS s) AS sk
|
|
85
83
|
WHERE jsonb_typeof(sk.s) = 'object' AND jsonb_typeof(sk.s -> 'disallowedTools') = 'array' AND (sk.s -> 'disallowedTools') <> '[]'::jsonb));
|
|
86
84
|
|
|
87
|
-
-- drain-check:workflow-park-holder:pg —— 期望 hit_rows = 0;每一行 = 一张待批的 workflow 子代卡(它的子会话被 workflow_agent_session 里的一条指针点名)。
|
|
88
|
-
-- 在**换钉之前**、对旧版本的数据跑:7.118.0 起 workflow 子代卡交给哪条 run 只看记录 parks[] 条目上的持有者位(parkedBy / generation),
|
|
89
|
-
-- 引擎 7.43 及以前写下的记录没有这两位 ⇒ 这样的卡升级后在决定口答 409 decide.workflow_parks_unreadable(更早的引擎写下、记录上根本没有 parks 的,答 409
|
|
90
|
-
-- conflict.resume_context_unavailable;卡都仍待批,出路相同 = 续跑那条 workflow run 再决)。
|
|
91
|
-
-- 换钉前把它们决掉(或取消发起它的任务)就省掉这一步。换钉之后再跑本段会把新引擎写下的卡也数进来(那时它不再是「会被拒的卡」的读数)。
|
|
92
|
-
-- 从 7.118.0 回滚到 7.117.x 之前、对 7.118.0 的数据跑:数出的就是全部待批的 workflow 子代卡 —— 回滚要删掉这张索引表(7.117.x 按旧主键重建,
|
|
93
|
-
-- 旧副本在新主键上写不进 / 读不准,见随包 MIGRATION.md 7.118.0 节),删表之后这些卡没有指针、决不掉;先把它们决掉或取消。
|
|
94
|
-
-- 对索引表用 EXISTS 而不 JOIN:一个子会话可以被好几条记录点名,JOIN 会把一张卡数成几张。
|
|
95
|
-
-- 窗与删码:本判据是一次性迁移 M9 的读侧半场 —— 窗口与删码清单见引擎启动期一次性迁移登记表(one-time-migrations)M9 一行,随 M9 一起删;这里不写第二份窗。
|
|
96
|
-
SELECT 'workflow-park-holder' AS criterion, count(*) AS hit_rows,
|
|
97
|
-
coalesce(string_agg(k.session_id, ',' ORDER BY k.created_at_ms DESC), '') AS sessions
|
|
98
|
-
FROM checkpoint k
|
|
99
|
-
WHERE k.status = 'pending'
|
|
100
|
-
AND EXISTS (SELECT 1 FROM workflow_agent_session w WHERE w.session_id = k.session_id);
|
|
101
|
-
|
|
102
85
|
-- drain-check:parked-tool-lists:pg —— 期望 hit_rows = 0;每一行 = 一条**候选**:升级到 7.132.0 后续跑可能在认领前被拒的停驻行。
|
|
103
86
|
-- 在**升级之前**、对 7.131.x 的数据跑。7.131.x 的引擎(7.51)把行上的三样按原拼写记下,7.132.0 的引擎(7.52)在认领前按规范拼写读它们:
|
|
104
87
|
-- 子代的工具天花板 state.toolCeiling(`Bash(*)` / `Tool()` / 内容形 / 读不出的名 / deny `*` ⇒ 409 checkpoint.config_refused,blockedBy = config.tool_face_control,field = inheritedGate);
|
|
@@ -127,7 +110,7 @@ WHERE k.status = 'pending'
|
|
|
127
110
|
-- drain-check:sealed-credentials-rollback:pg —— 期望 hit_rows = 0;每一行 = 一条**候选**:从 7.134.0 回滚到 7.133.x 后续跑会丢掉请求凭据的停驻行。
|
|
128
111
|
-- 在**回滚之前**、对 7.134.0 的数据跑:7.134.0 把续跑上下文里提交体的凭据位(MCP / A2A 请求头与 env、settings.env、settings.webSearch.apiKey、http hook 请求头;7.135.0 起另有 command hook 的插件选项)
|
|
129
112
|
-- 封成封签(对象,格式词 "checkpoint-ctx-sealedbox-v1")才落盘;7.133.x 读不懂封签,续跑时把这些位当作没有(无凭据照跑、不报错)。出路:回滚前把它们决掉或取消(见随包 MIGRATION.md 7.134.0 节)。
|
|
130
|
-
-- 读哪一份续跑上下文:与续跑腿同(连接形与
|
|
113
|
+
-- 读哪一份续跑上下文:与续跑腿同(连接形与 skill-deny-inert 段逐字同,理由见该段注)。SQL 不走凭据位闭集 ⇒ 数的是**真超集**:提交体里任何一处有一个
|
|
131
114
|
-- JSON 串值恰为这个格式词即数(封签只落在凭据位上;体里别处恰好写着这个词的串值也会被数到 —— 多数,不漏)。本地脚本同名判据走服务里那一只凭据位走法(精确)。
|
|
132
115
|
-- 从 7.135.0 回滚到 7.134.x 之前同用本判据:7.135.0 起 command hook 条目的插件选项(settings.hooks.<事件>[].hooks[].plugin.options)也封成封签,7.134.x 不认这一位,
|
|
133
116
|
-- 续跑时那份 hooks 整只不采纳(其中的守卫不再拦)。本判据数任何凭据位上带封签的行,所以这一类也在候选里(超集)。
|
|
@@ -145,26 +128,6 @@ WHERE k.status = 'pending'
|
|
|
145
128
|
WHERE kk.token = k.token
|
|
146
129
|
AND strpos((c.ctx -> 'body')::text, '"checkpoint-ctx-sealedbox-v1"') > 0);
|
|
147
130
|
|
|
148
|
-
-- drain-check:permissions-allow-list:pg —— 期望 hit_rows = 0;每一行 = 一条升级后续跑会被拒的停驻行。
|
|
149
|
-
-- 读哪一份续跑上下文:与续跑腿同 —— workflow 子代的停驻行(在 workflow_agent_session 里登记过)续跑时读的是**发起这条 workflow 的会话**那一份
|
|
150
|
-
-- (workflow_run.run 的 originatingSessionId);其余行读自己会话那一份。一个子会话可以被好几条 workflow 记录点名(续跑链 / 分叉;7.118.0 起索引主键是
|
|
151
|
-
-- (session_id, run_id)),续跑腿读的是其中**持有者**那条记录的发起会话,持有者通常是链上最新的、不是最老的,SQL 判不出是哪一条 ⇒ 数的是真超集:
|
|
152
|
-
-- 任一条指针记录的发起会话命中即数(指针没有记录 / 记录没有发起会话 ⇒ 读这张卡自己会话的);整条连接链包在对这张卡的 EXISTS 里(kk = 这张卡本身,按主键取回),一张卡只数一次。
|
|
153
|
-
-- 判据 = 服务续跑腿拒臂的同一句话:提交体 settings.permissions.allow 是非空数组,且上下文的读法记号 permissionsAllowReading 不是当前的 "allow_layer"。
|
|
154
|
-
SELECT 'permissions-allow-list' AS criterion, count(*) AS hit_rows,
|
|
155
|
-
coalesce(string_agg(k.session_id, ',' ORDER BY k.created_at_ms DESC), '') AS sessions
|
|
156
|
-
FROM checkpoint k
|
|
157
|
-
WHERE k.status = 'pending'
|
|
158
|
-
AND EXISTS (SELECT 1
|
|
159
|
-
FROM checkpoint kk
|
|
160
|
-
LEFT JOIN workflow_agent_session w ON w.session_id = kk.session_id
|
|
161
|
-
LEFT JOIN workflow_run r ON r.id = w.run_id
|
|
162
|
-
JOIN checkpoint_ctx c ON c.session_id = COALESCE(r.run::json->>'originatingSessionId', kk.session_id)
|
|
163
|
-
WHERE kk.token = k.token
|
|
164
|
-
AND jsonb_typeof(c.ctx #> '{body,settings,permissions,allow}') = 'array'
|
|
165
|
-
AND (c.ctx #> '{body,settings,permissions,allow}') <> '[]'::jsonb
|
|
166
|
-
AND (c.ctx -> 'permissionsAllowReading') IS DISTINCT FROM '"allow_layer"'::jsonb);
|
|
167
|
-
|
|
168
131
|
-- drain-check:retired-mode-seed:pg —— 期望 hit_rows = 0;每一行 = 一条升级后会被拒的停放行。
|
|
169
132
|
-- 判据逐字照引擎 refuseRetiredModeSeed:inheritedGate 带 autoModeRequested / approverPosture(任何值,含 JSON null),或 shellGate 不是 "always"(含 JSON null)。
|
|
170
133
|
SELECT 'retired-mode-seed' AS criterion, count(*) AS hit_rows,
|
package/skills/update-config.md
CHANGED
|
@@ -90,7 +90,7 @@ Prefer editing the catalog when it exists (it never carries secrets); only touch
|
|
|
90
90
|
|
|
91
91
|
This skill never handles credential values (API keys, tokens, anything shaped like `*_KEY` / `*_TOKEN` / `apiKey`). Whatever a tool shows you from a settings file enters the model context and the session transcript, and a settings file may already hold credentials the user put there (an `env` block, a `webSearch.apiKey`). A line-oriented read does not keep them out: `grep` for one key prints its whole line, and a one-line or minified JSON file is a single line. So:
|
|
92
92
|
|
|
93
|
-
- Never write a credential value into any settings file, and never read one back or restate it. If the user asks you to set an API key or token, decline to write it and tell them to export it in the environment the engine starts from (shell profile / service unit), out of band.
|
|
93
|
+
- Never write a credential value into any settings file, and never read one back or restate it. If the user asks you to set an API key or token, decline to write it and tell them to export it in the environment the engine starts from (shell profile / service unit), out of band. The engine itself refuses a request whose settings `env` block carries a credential — a credential variable name such as `MODEL_API_KEY`, or a value shaped like a key or token — with `400 request.env_credential_refused`, so a credential left in an `env` block breaks every request sent from that settings file until it is moved out.
|
|
94
94
|
- For model changes prefer `config.d/models.json`: it names credentials by env var only and is safe to read and edit.
|
|
95
95
|
- Never open a settings file that may hold credentials (`settings.json` / `settings.local.json` at any layer) with any tool that reads file contents — Read, Grep, Edit, Write, or Bash `cat` / `head` / `tail` / `less` / `jq` / `grep` / `sed` / `awk`. Change it with one short script that parses the JSON, touches only the key you were asked to change, writes the file back, and prints nothing but the names of the keys it changed. The script must never print file contents or exception messages: on any failure it prints a fixed error code and exits non-zero (a runtime's own error for a malformed file can quote the offending line, credentials included). For example, to set the main model slot:
|
|
96
96
|
|