@sema-agent/server 7.146.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 +384 -0
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/USAGE.md +170 -66
- package/deploy/facts/lanes.json +7 -0
- package/deploy/sema-up/README.md +2 -2
- package/deploy/sema-up/chart/templates/_helpers.tpl +22 -0
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -4
- package/deploy/sema-up/chart/templates/server.yaml +5 -4
- package/deploy/sema-up/chart/values.yaml +1 -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 +4 -3
- package/dist/approval-card.d.ts +4 -4
- 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/device-lane.js +5 -5
- package/dist/boot/engine-lease.d.ts +12 -11
- package/dist/boot/execution-env.d.ts +2 -1
- package/dist/boot/execution-env.js +45 -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 +1 -1
- package/dist/boot/exit-last.js +2 -1
- package/dist/boot/governance-seams.d.ts +2 -2
- 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 +13 -24
- package/dist/boot/memory-consolidation.js +0 -13
- 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.js +1 -1
- package/dist/boot/resolve-spec.js +91 -111
- package/dist/boot/retention-lane.d.ts +4 -42
- package/dist/boot/session-faces.d.ts +1 -0
- package/dist/boot/session-faces.js +8 -2
- package/dist/boot/stage-01-config.d.ts +1 -1
- package/dist/boot/stage-01-config.js +6 -2
- 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 +1 -1
- package/dist/boot/stage-04-stores.d.ts +1 -1
- package/dist/boot/stage-05-execution-env.d.ts +2 -2
- package/dist/boot/stage-05-execution-env.js +3 -3
- package/dist/boot/stage-06-runners.d.ts +3 -3
- package/dist/boot/stage-06-runners.js +1 -3
- package/dist/boot/stage-07-capability-layer.d.ts +3 -3
- package/dist/boot/stage-07-capability-layer.js +4 -9
- package/dist/boot/stage-08-reapers.d.ts +3 -3
- package/dist/boot/stage-09-leader.d.ts +4 -3
- package/dist/boot/stage-10-http-server.d.ts +4 -3
- package/dist/boot/stage-10-http-server.js +2 -1
- package/dist/boot/stores.d.ts +9 -0
- package/dist/boot/stores.js +18 -7
- package/dist/boot/web-admin.js +3 -3
- package/dist/capabilities/center-plugins.d.ts +2 -0
- package/dist/capabilities/center-plugins.js +6 -2
- package/dist/capabilities/composite-members.d.ts +1 -0
- package/dist/capabilities/composite-members.js +1 -0
- 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 +32 -18
- 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 +38 -0
- package/dist/capability-facts.js +34 -1
- package/dist/center-credential-renewer.js +3 -2
- package/dist/config-catalog.js +6 -5
- 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.js +2 -0
- package/dist/config-types.d.ts +190 -186
- package/dist/config.d.ts +68 -5
- package/dist/config.js +80 -54
- package/dist/degenerate-instrument.js +1 -1
- package/dist/deploy-facts.js +3 -2
- package/dist/deployment-shape.d.ts +21 -12
- package/dist/deployment-shape.js +24 -6
- package/dist/env-facts.d.ts +7 -5
- package/dist/env-facts.js +10 -6
- 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 +17 -10
- package/dist/fleet/drain-entry.js +1 -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/command-spawn.d.ts +1 -4
- package/dist/hooks/command-spawn.js +0 -11
- package/dist/hooks/hook-runner.d.ts +52 -8
- package/dist/hooks/hook-runner.js +160 -36
- package/dist/http/approval-sweeps.d.ts +2 -5
- package/dist/http/approval-sweeps.js +3 -2
- package/dist/http/checkpoint-ctx.d.ts +17 -0
- package/dist/http/checkpoint-ctx.js +6 -0
- package/dist/http/claim-latency.d.ts +10 -0
- package/dist/http/claim-latency.js +12 -0
- package/dist/http/dispatch.js +1 -1
- package/dist/http/durable-run-leg.js +2 -1
- package/dist/http/execution-context.d.ts +3 -1
- package/dist/http/execution-context.js +4 -0
- package/dist/http/memory-compliance-failure-reply.d.ts +1 -1
- package/dist/http/memory-compliance-failure-reply.js +3 -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 +3 -14
- package/dist/http/principal-gate.js +0 -13
- package/dist/http/request-guards.d.ts +1 -1
- package/dist/http/resume-legs.d.ts +7 -10
- package/dist/http/resume-legs.js +79 -50
- 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 +32 -16
- package/dist/http/route-table.js +2 -0
- package/dist/http/routes/approvals-assistant.js +5 -25
- package/dist/http/routes/capabilities.js +8 -2
- package/dist/http/routes/devices.js +1 -1
- package/dist/http/routes/memory-origin.d.ts +1 -1
- package/dist/http/routes/notify-wake.js +2 -1
- 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 +8 -8
- package/dist/http/routes/session-sync.js +27 -10
- package/dist/http/routes/sessions.d.ts +7 -1
- package/dist/http/routes/sessions.js +104 -2
- package/dist/http/routes/tasks.js +9 -3
- package/dist/http/server.d.ts +24 -10
- package/dist/http/server.js +17 -6
- package/dist/http/stored-body-replay.d.ts +5 -3
- package/dist/http/stored-body-replay.js +10 -1
- package/dist/http/wire-types.d.ts +19 -10
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/instruction-source-notice.d.ts +1 -1
- 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-scope.d.ts +2 -2
- package/dist/memory-scope.js +1 -1
- 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/observability/fail-open.d.ts +17 -9
- package/dist/observability/fail-open.js +17 -9
- 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/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/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 +9 -4
- 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 +1 -1
- 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 -12
- package/dist/plugins/file-run-store.js +63 -63
- package/dist/plugins/imported-layer-root-retirement.d.ts +17 -8
- 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 +5 -0
- package/dist/plugins/local-checkpoint-store.js +11 -7
- 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 +91 -25
- package/dist/plugins/local-session-store.js +124 -45
- 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 +4 -3
- package/dist/plugins/memory-engine-pg.js +4 -4
- package/dist/plugins/memory-engine-sql-apply.d.ts +13 -4
- package/dist/plugins/memory-engine-sql-apply.js +1 -1
- package/dist/plugins/memory-engine-tidb.d.ts +8 -5
- package/dist/plugins/memory-engine-tidb.js +7 -8
- package/dist/plugins/one-time-migrations.d.ts +145 -35
- package/dist/plugins/one-time-migrations.js +272 -120
- 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 +8 -8
- package/dist/plugins/permission-rule-store-file.js +14 -2
- package/dist/plugins/pg-pool.d.ts +2 -1
- package/dist/plugins/pg-pool.js +11 -4
- 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/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 +11 -1
- 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 +1 -1
- 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/store-backend.d.ts +35 -8
- package/dist/plugins/store-backend.js +184 -62
- package/dist/plugins/store-contracts.d.ts +9 -2
- package/dist/plugins/store-contracts.js +1 -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 +19 -31
- package/dist/plugins/user-input-ledger-sql.d.ts +1 -1
- 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 +41 -13
- package/dist/rules-consent.js +101 -53
- package/dist/run-local.js +17 -13
- package/dist/runs.d.ts +48 -30
- package/dist/runs.js +26 -16
- package/dist/runtime-caps-resolver.d.ts +15 -8
- package/dist/runtime-caps-resolver.js +14 -10
- package/dist/sealed-key-layout.d.ts +2 -3
- package/dist/sealed-key-layout.js +0 -1
- package/dist/sealed-key.js +7 -5
- package/dist/security.d.ts +5 -3
- 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-resident-background.d.ts +85 -32
- package/dist/session-resident-background.js +75 -7
- package/dist/session-row.d.ts +1 -1
- package/dist/session-sync-kernel.d.ts +1 -1
- package/dist/session-workspace.d.ts +11 -2
- package/dist/session-workspace.js +5 -0
- package/dist/sighup-idle.d.ts +1 -1
- package/dist/store-posture.d.ts +2 -1
- package/dist/stored-request-hooks-m20.d.ts +3 -2
- package/dist/stored-request-hooks-m20.js +19 -14
- package/dist/stores-sql/blob-index-sql.d.ts +148 -0
- package/dist/stores-sql/blob-index-sql.js +154 -0
- package/dist/stores-sql/checkpoint-store-sql.d.ts +1 -1
- package/dist/stores-sql/checkpoint-store-sql.js +11 -27
- 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}/pg-session-storage.d.ts +23 -76
- package/dist/{plugins → stores-sql}/pg-session-storage.js +80 -209
- 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}/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 +32 -122
- package/dist/{plugins → stores-sql}/tidb-session-store.js +71 -171
- package/dist/stores-sql/tool-result-store-sql.d.ts +1 -1
- package/dist/stores-sql/tool-result-store-sql.js +1 -1
- package/dist/stores-sql/windowed-session-storage.d.ts +56 -0
- package/dist/stores-sql/windowed-session-storage.js +61 -0
- 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 +9 -4
- package/dist/task-settings.js +17 -6
- package/dist/tool-approval.d.ts +21 -8
- package/dist/tool-approval.js +10 -6
- package/dist/trace/core-keyset-guard.d.ts +9 -3
- package/dist/trace/engine-notice-wire.d.ts +1 -1
- package/dist/trace/engine-notice-wire.js +2 -0
- package/dist/trace/exit-seat.d.ts +23 -1
- package/dist/trace/exit-seat.js +3 -0
- package/dist/trace/project.d.ts +33 -16
- package/dist/trace/project.js +12 -9
- package/dist/trace/redact.d.ts +1 -1
- package/dist/trace/redact.js +61 -73
- package/dist/trace/self-minted-wire.d.ts +263 -10
- package/dist/trace/self-minted-wire.js +90 -2
- 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 +38 -2
- package/dist/trace/wire-projection-faces.js +26 -1
- package/dist/unread-request-members.d.ts +66 -0
- package/dist/unread-request-members.js +41 -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 +13 -12
- package/scripts/drain-check-local.mjs +2 -28
- package/scripts/drain-check.mysql.sql +2 -18
- package/scripts/drain-check.pg.sql +2 -18
- package/wire-changes/server@7.147.0.json +813 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* web-admin wire types — the web-admin `/api/config/effective` payload shapes (`CenterModel`,
|
|
3
|
-
* `CenterSkillManifest`, `CenterMcpServer`, `
|
|
3
|
+
* `CenterSkillManifest`, `CenterMcpServer`, `EffectiveConfig`; the `a2a` domain is the contract's own `A2aConfig`) plus the per-principal
|
|
4
4
|
* execution/session-mirror ruling shapes riding the caps view (`ExecutionRuling`/`SessionMirrorRuling`).
|
|
5
5
|
* Pure type/interface declarations — no runtime logic. Split out of `facade.ts` ([ref] A13,
|
|
6
6
|
* internal-lossless: the facade re-exports every symbol below unchanged).
|
|
7
7
|
*/
|
|
8
8
|
import type { ToolContentOrigin } from "@sema-agent/core";
|
|
9
|
+
import type { A2aConfig, ModelThinkingLevelMap } from "@sema-agent/settings-schema";
|
|
9
10
|
import type { Autonomy, CommandRule } from "../runtime-governance.js";
|
|
10
11
|
import type { DroppedCatalogEntry } from "./read-warnings.js";
|
|
11
12
|
export interface CenterModel {
|
|
@@ -28,6 +29,13 @@ export interface CenterModel {
|
|
|
28
29
|
tier?: string;
|
|
29
30
|
reasoning?: boolean;
|
|
30
31
|
vision?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* [ref](settings-schema 20.0.0 `ModelEntry.thinkingLevelMap`)—— 这条条目的逐档思考拼写,上引擎 `Model.thinkingLevelMap`(键 off / minimal / low / medium / high / xhigh / max;
|
|
34
|
+
* 串 = 供应商对这一档的值,`null` = 这一档不支持,没写的档 = 供应商缺省)。类型就是契约型(不是 `unknown`):与 {@link CenterModel.compat} 不同,这一席的**形归契约包判**
|
|
35
|
+
* (闭集键,坏形整条被读腿丢 —— 中心腿 `readEffectiveWire`、本地腿契约文件店同一只 zod),到得了这里的都是判过的;本服务不二判,`toModel` 原样交引擎。
|
|
36
|
+
* 缺席 = 未声明(不补 `{}`);`{}` = 声明了、无覆盖。env 腿没有这一席(声明座只有目录条目)。
|
|
37
|
+
*/
|
|
38
|
+
thinkingLevelMap?: ModelThinkingLevelMap;
|
|
31
39
|
contextWindow?: number;
|
|
32
40
|
maxTokens?: number;
|
|
33
41
|
/** [ref]① 1M dual-window (core 1.289 `Model.autoCompactTokens`): an EXPLICIT roster value wins the
|
|
@@ -48,10 +56,10 @@ export interface CenterModel {
|
|
|
48
56
|
* 此后记账,不回算窗口内历史(registry types.d.ts 同句契约)。 */
|
|
49
57
|
quotaWeight?: number;
|
|
50
58
|
/**
|
|
51
|
-
* [ref](settings-schema 1.10.0 `ModelEntry.compat`)——
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* enable_thinking=false`),而 `extraBody` 穿不过引擎的 OpenAI
|
|
59
|
+
* [ref](settings-schema 1.10.0 `ModelEntry.compat`)—— 这条目录条目对**它那条线路**的兼容声明,上 core `Model.compat`:
|
|
60
|
+
* openai-completions 条目 = `OpenAICompletionsCompat` 五键,anthropic-messages 条目 = `AnthropicMessagesCompat`([ref] (b) 起按线路读;此前 anthropic 条目一律整只丢)。
|
|
61
|
+
* 真需求 = vLLM / Qwen 类**缺省开思考**的网关:关思考只能靠 `thinkingFormat: "qwen-chat-template"`(`chat_template_kwargs.
|
|
62
|
+
* enable_thinking=false`),而 `extraBody` 穿不过引擎的 OpenAI 保留键表;adaptive 族 anthropic 端点(无 budget、关不掉)靠 `thinkingMode: "adaptive"`。
|
|
55
63
|
*
|
|
56
64
|
* 🔴 类型是 `unknown` 而不是那个结构,**刻意的**(与 {@link CenterMcpServer.toolFaces} 逐字同姿):本类型
|
|
57
65
|
* 是两条腿的**承载形**(本地 config.d 经 settings-schema 的 `z.unknown()` 解析透明地过来、远端 /effective
|
|
@@ -160,8 +168,9 @@ export interface CenterMcpServer {
|
|
|
160
168
|
toolFaces?: unknown;
|
|
161
169
|
/**
|
|
162
170
|
* [ref](settings-schema 12.2.x `McpServerSpec.toolAxes`,解析透明 `z.unknown()`)—— 部署侧为这台 server 的**每只工具**声明的
|
|
163
|
-
* 风险轴(
|
|
164
|
-
* `McpServerSpec.toolAxes
|
|
171
|
+
* 风险轴(引擎的成员集:`effect` / `egress` / `irreversibility` / `boundaryFlow`),键 = server 的**原始(未加命名空间)**工具名,上 core
|
|
172
|
+
* `McpServerSpec.toolAxes`。其中 `boundaryFlow: "engine"`(须同条 `egress: false`)声明一只引擎专用工具(设备车道的发射闸对它的调用不欠任何东西),
|
|
173
|
+
* 只有部署声明(本地 config.d / 中心)能写,请求侧写它被拒;两条部署腿都原样交给引擎判。
|
|
165
174
|
*
|
|
166
175
|
* 🔴 类型是 `unknown` 而不是那个结构,**刻意的**(与 {@link CenterMcpServer.toolFaces} 逐字同姿):本类型是两条部署腿的**承载形**
|
|
167
176
|
* (本地 config.d 经 `z.unknown()` 解析透明地过来、远端 /effective 是直读 JSON),形判与投影的单一属主是**引擎**根导出的
|
|
@@ -204,31 +213,8 @@ export interface CenterMcpServer {
|
|
|
204
213
|
};
|
|
205
214
|
}
|
|
206
215
|
/**
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* env, the center only ever stores the NAME. (A2A has a single transport — every peer is an https(s)
|
|
210
|
-
* endpoint — so unlike MCP there is no transport discriminant; the two ref-carrying shapes collapse to one.)
|
|
211
|
-
*/
|
|
212
|
-
export interface CenterA2aPeer {
|
|
213
|
-
name: string;
|
|
214
|
-
scenarios: string[];
|
|
215
|
-
enabled?: boolean;
|
|
216
|
-
/** The peer's service URL (also the origin the well-known agent-card path resolves against). */
|
|
217
|
-
url: string;
|
|
218
|
-
/** Explicit agent-card location when the peer does not publish at a well-known path. Set ⇒ used ALONE. */
|
|
219
|
-
cardUrl?: string;
|
|
220
|
-
/** env-NAME refs (header-name → ENV_NAME) resolved from THIS service's env at boot. A peer with ANY
|
|
221
|
-
* unset ref is SKIPPED wholesale (fail-safe — never dial a peer half-credentialed). */
|
|
222
|
-
headerRefs?: Record<string, string>;
|
|
223
|
-
/** [ref], same contract as the MCP side: the header name the runner injects the task's authenticated
|
|
224
|
-
* end-user principal into. Not a ref — a literal header NAME (the runner fills the value, never the model). */
|
|
225
|
-
principalHeader?: string;
|
|
226
|
-
/** Optional allowlist of the peer's skill ids to mount (others are not mounted). */
|
|
227
|
-
allowSkills?: string[];
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* #A4([ref] 窗三件批 件1;[ref]/[ref] 承诺件)—— READ 容纳面的 center 下发形(`CenterA2aPeer` 的
|
|
231
|
-
* 同族:一个 additive 顶层域,server 声明它才不会被静默丢弃)。四个成员逐一对应部署 env 的四键
|
|
216
|
+
* #A4([ref] 窗三件批 件1;[ref]/[ref] 承诺件)—— READ 容纳面的 center 下发形(一个 additive 顶层键,
|
|
217
|
+
* 不是契约域:server 声明它才不会被静默丢弃)。四个成员逐一对应部署 env 的四键
|
|
232
218
|
* (`READ_FACE` / `READ_DENY_PATTERNS` / `READ_DENY_BUILTIN_TIERS` / `READ_DENY_BUILTIN_EXCLUDE`),
|
|
233
219
|
* 消费半场 = `web-admin-client/read-face.ts` `applyCenterReadFace`。
|
|
234
220
|
*
|
|
@@ -334,11 +320,14 @@ export interface EffectiveConfig {
|
|
|
334
320
|
mcp?: {
|
|
335
321
|
servers: CenterMcpServer[];
|
|
336
322
|
};
|
|
337
|
-
/**
|
|
338
|
-
*
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
323
|
+
/** The deployment's resident outbound A2A peers — the contract's `a2a` domain (settings-schema 18.0.0, portable): `config.d/a2a.json`
|
|
324
|
+
* on the local leg, `/effective.a2a` on the center leg, both read through the contract. The local leg materializes the domain (no file ⇒
|
|
325
|
+
* `{ peers: [] }` — the reader is the contract itself, it always knows the domain); the center leg does NOT invent a domain the producer did not
|
|
326
|
+
* send (settings-schema 20.0.0 `WIRE_CARRIED_DOMAINS`: an `/effective` body without `a2a` — an older center that does not know the domain —
|
|
327
|
+
* reads ABSENT; `{ peers: [] }` = the center says "empty roster"). Absent and an empty `peers` ⇒ no peer is dialed (one state: `resolveA2aPeers`
|
|
328
|
+
* yields nothing / is not called, `a2aForScenario` yields undefined, the restart slice reads null). Optional because of that center leg and because
|
|
329
|
+
* the LKG replay (raw file, not read through the contract) may predate the domain. */
|
|
330
|
+
a2a?: A2aConfig;
|
|
342
331
|
/** Center-declared scenarios (composition-as-config; capability stays code-pinned): each entry names a
|
|
343
332
|
* deploy-registered TOOLSET (`none` / `repo-readonly`) + an optional static prompt (≤4KB, audited at
|
|
344
333
|
* publish). Restart-to-apply like skills/mcp (baked into the scenario table at boot). Center entries
|
|
@@ -360,14 +349,10 @@ export interface EffectiveConfig {
|
|
|
360
349
|
* `limits` 在 PORTABLE_DOMAINS 里)。
|
|
361
350
|
*/
|
|
362
351
|
limits?: EffectiveLimits;
|
|
363
|
-
/**
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
|
|
367
|
-
* 三个 runtime 字段;审计字段不进 ServiceConfig)。 */
|
|
368
|
-
projects?: {
|
|
369
|
-
projects?: Record<string, unknown>;
|
|
370
|
-
};
|
|
352
|
+
/** 项目登记簿(settings-schema `projects` 域)。wire 面 verbatim JSON —— settings-schema `ProjectsConfig` 的形状是
|
|
353
|
+
* `{projects: Record<projectId, ProjectRegistration>}`(skills / mcp 同款域包裹)。这里不声明更窄的型:判官是 settings-schema 的视图面读函数,
|
|
354
|
+
* 唯一调用点 applyEffective(→ config.projects,`ProjectRegistration` 原样)。 */
|
|
355
|
+
projects?: unknown;
|
|
371
356
|
/** settings-schema 0.6 起治理三件(autonomy/commandPolicy/approvalRequire)的**唯一**承运域(0.7.1 撤
|
|
372
357
|
* runtime 位双写镜像;顺序契约当年已走完:消费端先切、center 再撤)。键集与 schema `GovernanceConfig.shape`
|
|
373
358
|
* 逐字相等([ref] 件3 对账门钉)。消费:autonomy/commandPolicy 逐请求热(`stageRuntimeHot`,boot+refresh);
|
|
@@ -400,10 +385,10 @@ export interface EffectiveConfig {
|
|
|
400
385
|
/** (stage7 P5,registry-core 0.8 `execution` 域): the center-resolved per-principal execution
|
|
401
386
|
* ruling riding the caps view. `required=false` / ruling absent = no enforcement (legacy). `allowedLanes` is
|
|
402
387
|
* an OPEN value domain (adding one is never BREAKING; consumers tolerate unknown names). Known lane names:
|
|
403
|
-
* `host`/`e2b`/`k8s`/`ssh`/`adb`/`local-docker`/`device` (the REMOTE_EXEC
|
|
404
|
-
*
|
|
405
|
-
* `
|
|
406
|
-
*
|
|
388
|
+
* `host`/`e2b`/`k8s`/`ssh`/`adb`/`local-docker`/`device`/`none` (the REMOTE_EXEC lanes; `none` = a declared
|
|
389
|
+
* no-execution-environment lane). Since 7.147.0 every deployment declares its lane; the name earlier versions gave an
|
|
390
|
+
* unset lane (`in-process`) is retired and renamed `none` ⇒ admins writing `required=true` policies list `none` for workers
|
|
391
|
+
* without an execution environment (during the switch, list both names, then drop the old one — data, not a code double-read).
|
|
407
392
|
*
|
|
408
393
|
* 🔴 **`device` 是 per-principal 执行面上最需要写清的一条**(device-executor-lane-v2 §4.1 的 web-admin
|
|
409
394
|
* 行,车A-4 补):它是「在**员工自己的机器**上执行」的那条车道 —— 允许它 ≠ 允许一台云沙箱,而是允许
|
|
@@ -13,7 +13,7 @@ dials the device, so the device needs no inbound port, no public address and no
|
|
|
13
13
|
|
|
14
14
|
| Plane | Transport | Who calls whom | Where it is specified |
|
|
15
15
|
|---|---|---|---|
|
|
16
|
-
| Management / enrollment / binding | HTTPS, JSON | the user's client calls the server | `docs/ASSISTANT-WIRE-CONTRACT.md` §14 |
|
|
16
|
+
| Management / enrollment / binding | HTTPS, JSON | the user's client calls the server | the repository's `docs/ASSISTANT-WIRE-CONTRACT.md` §14 (not shipped in the npm package) |
|
|
17
17
|
| Executor | WebSocket (upgrade on the WS path below), text frames, JSON | the device connects out to the server | **this document** |
|
|
18
18
|
|
|
19
19
|
**Discovery before you connect**: `GET /v1/capabilities` carries a `deviceExecutor` key — either `false`
|
|
@@ -1104,5 +1104,5 @@ The short version for an executor implementer:
|
|
|
1104
1104
|
- a non-device deployment refuses the key outright rather than ignoring it.
|
|
1105
1105
|
|
|
1106
1106
|
The full contract — request shapes, every refusal code, the rebind verb, and the disclosed races — is in
|
|
1107
|
-
`docs/ASSISTANT-WIRE-CONTRACT.md` §14.6
|
|
1107
|
+
the repository's `docs/ASSISTANT-WIRE-CONTRACT.md` §14.6 and, for the management verbs, §14.1–14.5 (not shipped in the npm package). It is not repeated
|
|
1108
1108
|
here.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/server",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.147.0",
|
|
4
4
|
"description": "Sema Server — the server/API implementation layer for Sema, wiring core, registry, model providers, and cloud agent execution. Built on @sema-agent/core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -78,23 +78,23 @@
|
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@modelcontextprotocol/server": "2.4.0",
|
|
81
|
-
"@sema-agent/core": "7.
|
|
82
|
-
"@sema-agent/settings-schema": "
|
|
83
|
-
"e2b": "
|
|
84
|
-
"libsodium-wrappers": "
|
|
85
|
-
"mysql2": "
|
|
86
|
-
"pg": "
|
|
87
|
-
"ssh2": "
|
|
81
|
+
"@sema-agent/core": "7.65.0",
|
|
82
|
+
"@sema-agent/settings-schema": "20.0.0",
|
|
83
|
+
"e2b": "2.36.0",
|
|
84
|
+
"libsodium-wrappers": "0.8.4",
|
|
85
|
+
"mysql2": "3.22.6",
|
|
86
|
+
"pg": "8.22.0",
|
|
87
|
+
"ssh2": "1.17.0",
|
|
88
88
|
"typebox": "1.1.39",
|
|
89
89
|
"undici": "7.30.0",
|
|
90
|
-
"ws": "
|
|
91
|
-
"zod": "
|
|
90
|
+
"ws": "8.21.0",
|
|
91
|
+
"zod": "4.4.3"
|
|
92
92
|
},
|
|
93
93
|
"optionalDependencies": {
|
|
94
|
-
"sharp": "
|
|
94
|
+
"sharp": "0.35.3"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"@sema-agent/sdk": "
|
|
97
|
+
"@sema-agent/sdk": "36.0.0",
|
|
98
98
|
"@types/libsodium-wrappers": "^0.7.14",
|
|
99
99
|
"@types/node": "22.10.2",
|
|
100
100
|
"@types/pg": "^8.20.0",
|
|
@@ -103,6 +103,7 @@
|
|
|
103
103
|
"ajv": "^8.20.0",
|
|
104
104
|
"ajv-formats": "^3.0.1",
|
|
105
105
|
"core-mixed-version-reader": "npm:@sema-agent/core@7.54.1",
|
|
106
|
+
"semver": "7.8.5",
|
|
106
107
|
"tsx": "4.19.2",
|
|
107
108
|
"typescript": "5.7.2",
|
|
108
109
|
"vitest": "^4.1.8",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* 换钉前的**排空检查 —— `DB_BACKEND=local`(File 店)车道**,只读。随 npm 包出(`scripts/drain-check-local.mjs`)。
|
|
4
|
-
*
|
|
4
|
+
* 一次跑**七条判据**(判据表 {@link DRAIN_CRITERIA},每条一行末行、各自的命中行;SQL 车道的同一判据是同目录随包的 `drain-check.mysql.sql` / `drain-check.pg.sql`,
|
|
5
5
|
* 每条判据一段、段首标记 `-- drain-check:<判据名>:<后端>`,判据名与本表的 `name` 同一个词):
|
|
6
6
|
* · `skill-grants-rollback`(**回滚**到 7.115.x 前,即引擎从 7.41 退回 7.40):四样任一 ——
|
|
7
7
|
* ① pending 行带 `state.skillGrants`(本次 run 冻结在行上的技能授予行:模型激活 / 子代捕获写下的放行与禁止);
|
|
@@ -22,14 +22,6 @@
|
|
|
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` 仍带退役成员;
|
|
@@ -69,7 +61,6 @@
|
|
|
69
61
|
* ## 读数(机读末行 + 退出码)
|
|
70
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>` /
|
|
71
63
|
* `SKILL-DENY-INERT-ROW token=<token> sessionId=<id> createdAt=<ms> member=<skills|agents.skills>` /
|
|
72
|
-
* `WORKFLOW-PARK-ROW token=<token> sessionId=<id> createdAt=<ms> runId=<点名它的 run,逗号连接>` /
|
|
73
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>` /
|
|
74
65
|
* `SEALED-CREDENTIALS-ROW token=<token> sessionId=<id> createdAt=<ms> field=<第一处带封签的凭据位>|runId=<workflow 子代卡:点它的 run>` /
|
|
75
66
|
* `RETIRED-ROW token=<token> sessionId=<id> createdAt=<ms> member=<成员>`;
|
|
@@ -77,13 +68,12 @@
|
|
|
77
68
|
* `SKILL-GRANTS rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
78
69
|
* `RETIRED-SKILL-MANIFEST rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
79
70
|
* `SKILL-DENY-INERT rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
80
|
-
* `WORKFLOW-PARK-HOLDER rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
81
71
|
* `PARKED-TOOL-LISTS rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
82
72
|
* `OWN-TOOL-LISTS-ROLLBACK rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
83
73
|
* `SEALED-CREDENTIALS-ROLLBACK rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`,
|
|
84
74
|
* `RETIRED-MODE-SEED rows=<命中数> pending=<pending 行数> total=<行数> unknownEvents=<n> corrupt=<n> root=<实际读的数据根>`;
|
|
85
75
|
* `corrupt` = 共用扫描的坏记录 + 这条判据自己读不懂的旁路输入(读不懂的 ctx 档,文件名进 stderr —— 一份读不懂的 ctx 可能正是让某条 pending 行命中的那一份;
|
|
86
|
-
* `
|
|
76
|
+
* `sealed-credentials-rollback` 另读 workflow park 索引:索引账本里读不出的行,行号进 stderr);
|
|
87
77
|
* 没读成 / 不能下结论(rc 2 的几种缺席与不稳形)时前五个计数是 `-`、多一个 `reason=<词>`,**不会出现 `rows=0`**(下游读 `rows=0` 即「干净」);
|
|
88
78
|
* · rc 0 = 每条判据都零命中(可换钉 / 可回滚)· rc 1 = 有命中(逐行列出;答完或取消再跑)· rc 2 = 读不懂 / 没读成 / 不能下结论(账本里有本脚本不认的事件词 / 不合形的记录 / 读不懂的 ctx 档 /
|
|
89
79
|
* 数据根缺席 / 缺省根解析不可用 / 判据模块不可用(脚本隔壁没有 `dist/`:源码树没 build)/ 读期间文件一直在变 / 读文件出错 / 用法错)—— 不给结论(缺席 ≠ 干净:一条读不懂的记录可能正是让某行回到 pending 的那一条)。
|
|
@@ -413,22 +403,6 @@ export const DRAIN_CRITERIA = [
|
|
|
413
403
|
return hit === undefined ? undefined : ` member=${hit.layer}`;
|
|
414
404
|
},
|
|
415
405
|
},
|
|
416
|
-
{
|
|
417
|
-
// 换钉 7.118.0 之前:待批、且子会话被 workflow park 索引点名的卡(头注里那一条)。账本行的读法是服务里那一只(`readAgentSessionLedgerLine`,经编译产物取);
|
|
418
|
-
// 命中行点名点它的 run。表序 `RETIRED-MODE-SEED` 仍最后。
|
|
419
|
-
name: "workflow-park-holder",
|
|
420
|
-
tail: "WORKFLOW-PARK-HOLDER",
|
|
421
|
-
hit: "WORKFLOW-PARK-ROW",
|
|
422
|
-
load: (root, service) => {
|
|
423
|
-
const idx = readParkIndex(root, service.readAgentSessionLedgerLine);
|
|
424
|
-
return { input: idx.bySession, corrupt: idx.corrupt, unreadable: idx.unreadable };
|
|
425
|
-
},
|
|
426
|
-
judge: (row, input) => {
|
|
427
|
-
const bySession = /** @type {Map<string, string[]>} */ (input);
|
|
428
|
-
const runs = typeof row.sessionId === "string" ? bySession.get(row.sessionId) : undefined;
|
|
429
|
-
return runs === undefined ? undefined : ` runId=${runs.join(",")}`;
|
|
430
|
-
},
|
|
431
|
-
},
|
|
432
406
|
{
|
|
433
407
|
// 升级到 7.132.0 之前(引擎 7.52 在认领前按规范拼写读停驻行记下的工具名清单):pending 行带这三座任一 —— 子代的工具天花板 `state.toolCeiling`(键在场且不是空数组)、
|
|
434
408
|
// 冻结的父约束链 `state.inheritedGate.constraintChain`(非空数组)、Skill 卡的清单绑定 `pendingAction.boundGrantDigest`。7.51 按原拼写记它们,7.52 读到 `Bash(*)` / `Tool()` /
|
|
@@ -8,13 +8,12 @@
|
|
|
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 读不懂封签,续跑时把这些位当没有)的**候选**(见该段注)。
|
|
@@ -74,21 +73,6 @@ WHERE k.status = 'pending'
|
|
|
74
73
|
OR (JSON_TYPE(JSON_EXTRACT(c.ctx, '$.body.agents')) = 'ARRAY'
|
|
75
74
|
AND JSON_CONTAINS_PATH(c.ctx, 'one', '$.body.agents[*].skills[*].disallowedTools[0]'))));
|
|
76
75
|
|
|
77
|
-
-- drain-check:workflow-park-holder:mysql —— 期望 hit_rows = 0;每一行 = 一张待批的 workflow 子代卡(它的子会话被 workflow_agent_session 里的一条指针点名)。
|
|
78
|
-
-- 在**换钉之前**、对旧版本的数据跑:7.118.0 起 workflow 子代卡交给哪条 run 只看记录 parks[] 条目上的持有者位(parkedBy / generation),
|
|
79
|
-
-- 引擎 7.43 及以前写下的记录没有这两位 ⇒ 这样的卡升级后在决定口答 409 decide.workflow_parks_unreadable(更早的引擎写下、记录上根本没有 parks 的,答 409
|
|
80
|
-
-- conflict.resume_context_unavailable;卡都仍待批,出路相同 = 续跑那条 workflow run 再决)。
|
|
81
|
-
-- 换钉前把它们决掉(或取消发起它的任务)就省掉这一步。换钉之后再跑本段会把新引擎写下的卡也数进来(那时它不再是「会被拒的卡」的读数)。
|
|
82
|
-
-- 从 7.118.0 回滚到 7.117.x 之前、对 7.118.0 的数据跑:数出的就是全部待批的 workflow 子代卡 —— 回滚要删掉这张索引表(7.117.x 按旧主键重建,
|
|
83
|
-
-- 旧副本在新主键上写不进 / 读不准,见随包 MIGRATION.md 7.118.0 节),删表之后这些卡没有指针、决不掉;先把它们决掉或取消。
|
|
84
|
-
-- 对索引表用 EXISTS 而不 JOIN:一个子会话可以被好几条记录点名,JOIN 会把一张卡数成几张。
|
|
85
|
-
-- 窗与删码:本判据是一次性迁移 M9 的读侧半场 —— 窗口与删码清单见引擎启动期一次性迁移登记表(one-time-migrations)M9 一行,随 M9 一起删;这里不写第二份窗。
|
|
86
|
-
SELECT 'workflow-park-holder' AS criterion, COUNT(*) AS hit_rows,
|
|
87
|
-
COALESCE(GROUP_CONCAT(k.session_id ORDER BY k.created_at_ms DESC SEPARATOR ','), '') AS sessions
|
|
88
|
-
FROM checkpoint k
|
|
89
|
-
WHERE k.status = 'pending'
|
|
90
|
-
AND EXISTS (SELECT 1 FROM workflow_agent_session w WHERE w.session_id = k.session_id);
|
|
91
|
-
|
|
92
76
|
-- drain-check:parked-tool-lists:mysql —— 期望 hit_rows = 0;每一行 = 一条**候选**:升级到 7.132.0 后续跑可能在认领前被拒的停驻行。
|
|
93
77
|
-- 在**升级之前**、对 7.131.x 的数据跑。7.131.x 的引擎(7.51)把行上的三样按原拼写记下,7.132.0 的引擎(7.52)在认领前按规范拼写读它们:
|
|
94
78
|
-- 子代的工具天花板 state.toolCeiling(`Bash(*)` / `Tool()` / 内容形 / 读不出的名 / deny `*` ⇒ 409 checkpoint.config_refused,blockedBy = config.tool_face_control,field = inheritedGate);
|
|
@@ -7,13 +7,12 @@
|
|
|
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 读不懂封签,续跑时把这些位当没有)的**候选**(见该段注)。
|
|
@@ -83,21 +82,6 @@ WHERE k.status = 'pending'
|
|
|
83
82
|
jsonb_array_elements(CASE WHEN jsonb_typeof(a -> 'skills') = 'array' THEN a -> 'skills' ELSE '[]'::jsonb END) AS s) AS sk
|
|
84
83
|
WHERE jsonb_typeof(sk.s) = 'object' AND jsonb_typeof(sk.s -> 'disallowedTools') = 'array' AND (sk.s -> 'disallowedTools') <> '[]'::jsonb));
|
|
85
84
|
|
|
86
|
-
-- drain-check:workflow-park-holder:pg —— 期望 hit_rows = 0;每一行 = 一张待批的 workflow 子代卡(它的子会话被 workflow_agent_session 里的一条指针点名)。
|
|
87
|
-
-- 在**换钉之前**、对旧版本的数据跑:7.118.0 起 workflow 子代卡交给哪条 run 只看记录 parks[] 条目上的持有者位(parkedBy / generation),
|
|
88
|
-
-- 引擎 7.43 及以前写下的记录没有这两位 ⇒ 这样的卡升级后在决定口答 409 decide.workflow_parks_unreadable(更早的引擎写下、记录上根本没有 parks 的,答 409
|
|
89
|
-
-- conflict.resume_context_unavailable;卡都仍待批,出路相同 = 续跑那条 workflow run 再决)。
|
|
90
|
-
-- 换钉前把它们决掉(或取消发起它的任务)就省掉这一步。换钉之后再跑本段会把新引擎写下的卡也数进来(那时它不再是「会被拒的卡」的读数)。
|
|
91
|
-
-- 从 7.118.0 回滚到 7.117.x 之前、对 7.118.0 的数据跑:数出的就是全部待批的 workflow 子代卡 —— 回滚要删掉这张索引表(7.117.x 按旧主键重建,
|
|
92
|
-
-- 旧副本在新主键上写不进 / 读不准,见随包 MIGRATION.md 7.118.0 节),删表之后这些卡没有指针、决不掉;先把它们决掉或取消。
|
|
93
|
-
-- 对索引表用 EXISTS 而不 JOIN:一个子会话可以被好几条记录点名,JOIN 会把一张卡数成几张。
|
|
94
|
-
-- 窗与删码:本判据是一次性迁移 M9 的读侧半场 —— 窗口与删码清单见引擎启动期一次性迁移登记表(one-time-migrations)M9 一行,随 M9 一起删;这里不写第二份窗。
|
|
95
|
-
SELECT 'workflow-park-holder' AS criterion, count(*) AS hit_rows,
|
|
96
|
-
coalesce(string_agg(k.session_id, ',' ORDER BY k.created_at_ms DESC), '') AS sessions
|
|
97
|
-
FROM checkpoint k
|
|
98
|
-
WHERE k.status = 'pending'
|
|
99
|
-
AND EXISTS (SELECT 1 FROM workflow_agent_session w WHERE w.session_id = k.session_id);
|
|
100
|
-
|
|
101
85
|
-- drain-check:parked-tool-lists:pg —— 期望 hit_rows = 0;每一行 = 一条**候选**:升级到 7.132.0 后续跑可能在认领前被拒的停驻行。
|
|
102
86
|
-- 在**升级之前**、对 7.131.x 的数据跑。7.131.x 的引擎(7.51)把行上的三样按原拼写记下,7.132.0 的引擎(7.52)在认领前按规范拼写读它们:
|
|
103
87
|
-- 子代的工具天花板 state.toolCeiling(`Bash(*)` / `Tool()` / 内容形 / 读不出的名 / deny `*` ⇒ 409 checkpoint.config_refused,blockedBy = config.tool_face_control,field = inheritedGate);
|