@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
|
@@ -9,13 +9,16 @@
|
|
|
9
9
|
* `terminalFrameFacets` 统一铸:`spawnName` / `handback` / `compaction`;
|
|
10
10
|
* · {@link resupplyFields} —— 重供两键([ref]):`resupplied` / `attempt`。
|
|
11
11
|
* 全部是引擎铸的闭形值(身份键 / 闭集词 / 计数 / 布尔),零模型自由文本 ⇒ 不过 `redactSecrets`;判不过形 ⇒ 那一键
|
|
12
|
-
* 缺席(不折默认、不编值)
|
|
13
|
-
*
|
|
12
|
+
* 缺席(不折默认、不编值)。
|
|
13
|
+
* [ref] 起第三组:会话箱车道的三只**载体** —— {@link sessionBoxCarrierFields}:`crossSessionMessage` / `crossSessionNotice` /
|
|
14
|
+
* `inboxNotice`(同一条律;载体带别处来的自由文本,经出口座 —— 座由腿给,见 {@link FrameTextSeat})。它们的侧记 `_sema_provenance`
|
|
15
|
+
* (含 typed 的 `peerMeta.notice`)是同帧另一只键,判据在 `sema-provenance.ts`(一只 wire 键一个判据文件,两腿共用)。
|
|
14
16
|
* 🔴 NP-5(7.100.0 合并复审 [ref] 交叉表 #7):「在场但读不出」经 present-iff 投影脸族的唯一丢弃留痕 `dropProjectedFace`
|
|
15
17
|
* (`./projection-drop.ts`,`server.trace.projection-input-malformed`)计一次再丢;**缺席从不计数**。此前这里静默丢,
|
|
16
18
|
* 而同批 `wiring_manifest.teamRole` 走那只计数 —— 同一条规则两种处置。
|
|
17
19
|
*/
|
|
18
20
|
import { type HandbackState, type TaskNotificationPayload } from "@sema-agent/core";
|
|
21
|
+
import { type ExitSeat, type SafeText } from "./exit-seat.js";
|
|
19
22
|
/**
|
|
20
23
|
* 委派终态帧 `compaction` facet 的形 —— **从 core 载荷派生,不手写**(NP-7,7.100.0 合并复审 [ref] 交叉表 #9,opus A5)。
|
|
21
24
|
* 修前是手写的 `{ passes; breakerOpen; kind? }`:core 给它加成员时 tsc 不红、逐挑处把新成员静默丢(变异探针实测:给 core 的
|
|
@@ -61,5 +64,70 @@ export declare function resupplyFields(n: TaskNotificationFacetInput): {
|
|
|
61
64
|
resupplied?: true;
|
|
62
65
|
attempt?: number;
|
|
63
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* 一只 `task_notification` 帧的自由文本从哪一行出口座出门 —— **座由腿给,判据不分腿**:
|
|
69
|
+
* · live 三腿(sync SSE / bg·resume 账本行):`trace-frame-text`(不设界,与同帧 `summary` / `result` 同一行);
|
|
70
|
+
* · park 腿(入会话收件、下一次开流 drain):`inbox-frame-text`(界 4000,与 park 条目既有的文本位同额 —— `payload` 列是 TEXT)。
|
|
71
|
+
* 两行同一个脱敏 scope,所以界内的文本两腿逐字节同;非文本成员两腿恒逐字节同。
|
|
72
|
+
*/
|
|
73
|
+
export type FrameTextSeat = Extract<ExitSeat, "trace-frame-text" | "inbox-frame-text">;
|
|
74
|
+
type Faces = typeof import("./wire-projection-faces.js").WIRE_PROJECTION_FACES;
|
|
75
|
+
/** 登记表嵌套面那一行的 `excluded`(「哪个成员不投」的单写者)读成联合型 —— 本文件与 `sema-provenance.ts` 的投影型 = core 型减它。 */
|
|
76
|
+
export type FaceExcluded<F extends keyof Faces> = Faces[F]["excluded"][number];
|
|
77
|
+
type CrossSessionMessage = NonNullable<TaskNotificationPayload["crossSessionMessage"]>;
|
|
78
|
+
type CrossSessionNotice = NonNullable<TaskNotificationPayload["crossSessionNotice"]>;
|
|
79
|
+
type InboxNotice = NonNullable<TaskNotificationPayload["inboxNotice"]>;
|
|
80
|
+
/** 消息载体的 wire 形:core 型减登记表排除;`fromName`(发信方原始显示名)与 `body`(对端正文)是出口座铸的 {@link SafeText}。 */
|
|
81
|
+
export type CrossSessionMessageWire = Omit<CrossSessionMessage, "fromName" | "body" | FaceExcluded<"task_notification_cross_session_message">> & {
|
|
82
|
+
fromName?: SafeText;
|
|
83
|
+
body: SafeText;
|
|
84
|
+
};
|
|
85
|
+
/** 通告载体的 wire 形:`kind` 闭二词 + `text`(drain 由 typed notice 渲的句子,句子里嵌着别的会话的标签与那一行 ⇒ 经座)。 */
|
|
86
|
+
export type CrossSessionNoticeWire = Omit<CrossSessionNotice, "text" | FaceExcluded<"task_notification_cross_session_notice">> & {
|
|
87
|
+
text: SafeText;
|
|
88
|
+
};
|
|
89
|
+
/** 收件箱通告载体的 wire 形:四个计数(`box` 登记不投 —— 同帧已有)。 */
|
|
90
|
+
export type InboxNoticeWire = Omit<InboxNotice, FaceExcluded<"task_notification_inbox_notice">>;
|
|
91
|
+
/** 通告载体的 `kind` 闭集。core 只在型上写这两个词、没导出常量 ⇒ 本表 + 两向锚(`satisfies` 保表内无词表外的词;穷举保词表无表外的词 —— core 加 / 删词 ⇒ tsc 红)。 */
|
|
92
|
+
export declare const CROSS_SESSION_NOTICE_KINDS: readonly ["delivery_notice", "idle_notice"];
|
|
93
|
+
/** 一只嵌套键的判决:读得出 ⇒ 要上 wire 的形;读不出 ⇒ 理由(调用方整键丢并计一次)。 */
|
|
94
|
+
export type Verdict<W> = {
|
|
95
|
+
readonly wire: W;
|
|
96
|
+
} | {
|
|
97
|
+
readonly why: string;
|
|
98
|
+
};
|
|
99
|
+
/** 成员读法(本文件与 `sema-provenance.ts` 共用的一组;只判形,不改值)。 */
|
|
100
|
+
/** 纯数据记录:原型是 `Object.prototype` 或 `null`(类实例 / `Date` / `Map` / 数组不算 —— 成员全可选的容器不判原型就会把它们读成 `{}`)。 */
|
|
101
|
+
export declare const isPlainObject: (v: unknown) => v is Record<string, unknown>;
|
|
102
|
+
export declare const isString: (v: unknown) => v is string;
|
|
103
|
+
/** 闭集成员判定 —— 集是 core 导出的常量(不手抄,[ref]),或 core 只在型上写词时本仓经两向锚钉住的词表。 */
|
|
104
|
+
export declare const memberOf: <T extends string>(set: readonly T[]) => (v: unknown) => v is T;
|
|
105
|
+
/** 可选成员:缺席读得出(缺席即缺席,不计数),在场按 `guard` 判。 */
|
|
106
|
+
export declare const optional: <T>(guard: (v: unknown) => v is T) => (v: unknown) => v is T | undefined;
|
|
107
|
+
/** 两条腿入参的形(运行期载荷,先当 `unknown` 收、判过形才成 typed)。 */
|
|
108
|
+
export interface SessionBoxCarrierInput {
|
|
109
|
+
crossSessionMessage?: unknown;
|
|
110
|
+
crossSessionNotice?: unknown;
|
|
111
|
+
inboxNotice?: unknown;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* 会话箱车道的三只载体(core 的 session-box drain 唯一铸点;在场 = 渲染判别,core 优先序 agentMessage → crossSessionMessage →
|
|
115
|
+
* crossSessionNotice → inboxNotice,本服务不判跨键优先 —— 那是消费端的渲染律)。规则与本文件其余两组同一条:逐成员挑、在场才带、
|
|
116
|
+
* **在场却读不出 ⇒ 那一只载体整键丢并计一次**(半张卡比没有卡更坏:成员缺席在这些形上是一句正面陈述,读不出若只丢那个成员,
|
|
117
|
+
* 等于替 producer 说了一句它没说的话)、缺席不计。不跨键判(哪个 lane 词配哪只载体是产生者的律,core 在铸点守)。
|
|
118
|
+
* · `crossSessionMessage` —— 对端会话的一条信:`from`(规范编码的发信地址,回信抄进 `to` 的那一串)/ `fromSession` / `fromScope` 身份逐字
|
|
119
|
+
* (遮身份会把两个合法地址塌成一个值,与 `spawnName` 同律);`fromMode` 闭集取 core 的 `PERMISSION_MODE_CLASSES`;`fromName`(原始显示名,
|
|
120
|
+
* core 只在建信封时规范化)与 `body`(对端正文,UNTRUSTED)经座。
|
|
121
|
+
* · `crossSessionNotice` —— `kind` 闭二词({@link CROSS_SESSION_NOTICE_KINDS});`text` 经座。typed 位(`state` / `refSeq` / …)在侧记的
|
|
122
|
+
* `peerMeta.notice`(core:「a host renders a card from there, never by parsing `text`」)—— 不平铺进这里(同一事实只一个读点)。
|
|
123
|
+
* · `inboxNotice` —— `pending` / `delivered` 必需、`urgent` / `resupplied` 可选,全是计数(非负整数)逐字;`box` 不读不投(登记表排除)。
|
|
124
|
+
*/
|
|
125
|
+
export declare function sessionBoxCarrierFields(n: SessionBoxCarrierInput, seat: FrameTextSeat): {
|
|
126
|
+
crossSessionMessage?: CrossSessionMessageWire;
|
|
127
|
+
crossSessionNotice?: CrossSessionNoticeWire;
|
|
128
|
+
inboxNotice?: InboxNoticeWire;
|
|
129
|
+
};
|
|
130
|
+
/** 判决落定:读得出 ⇒ 形;读不出 ⇒ 交给调用点的丢弃口(字面面名留在调用点,普查门 GU-2 按它点名)。 */
|
|
131
|
+
export declare const settle: <W>(v: Verdict<W>, drop: (why: string) => undefined) => W | undefined;
|
|
64
132
|
export {};
|
|
65
133
|
//# sourceMappingURL=task-notification-facets.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { COMPACTION_KINDS, HANDBACK_STATES } from "@sema-agent/core";
|
|
1
|
+
import { COMPACTION_KINDS, HANDBACK_STATES, PERMISSION_MODE_CLASSES } from "@sema-agent/core";
|
|
2
|
+
import { seatText } from "./exit-seat.js";
|
|
2
3
|
import { dropProjectedFace } from "./projection-drop.js";
|
|
3
4
|
export function terminalFrameFacetFields(n) {
|
|
4
5
|
const spawnName = n.spawnName === undefined ? undefined : typeof n.spawnName === "string" ? n.spawnName : dropProjectedFace("task_notification.spawnName is not a string");
|
|
@@ -28,4 +29,73 @@ export function resupplyFields(n) {
|
|
|
28
29
|
...(attempt !== undefined ? { attempt } : {}),
|
|
29
30
|
};
|
|
30
31
|
}
|
|
32
|
+
export const CROSS_SESSION_NOTICE_KINDS = ["delivery_notice", "idle_notice"];
|
|
33
|
+
const _noticeKindsExhaustive = true;
|
|
34
|
+
void _noticeKindsExhaustive;
|
|
35
|
+
export const isPlainObject = (v) => {
|
|
36
|
+
if (typeof v !== "object" || v === null || Array.isArray(v))
|
|
37
|
+
return false;
|
|
38
|
+
const proto = Object.getPrototypeOf(v);
|
|
39
|
+
return proto === Object.prototype || proto === null;
|
|
40
|
+
};
|
|
41
|
+
export const isString = (v) => typeof v === "string";
|
|
42
|
+
const isCount = (v) => Number.isInteger(v) && v >= 0;
|
|
43
|
+
export const memberOf = (set) => (v) => set.includes(v);
|
|
44
|
+
export const optional = (guard) => (v) => v === undefined || guard(v);
|
|
45
|
+
const optString = optional(isString);
|
|
46
|
+
const optCount = optional(isCount);
|
|
47
|
+
const optModeClass = optional(memberOf(PERMISSION_MODE_CLASSES));
|
|
48
|
+
const isNoticeKind = memberOf(CROSS_SESSION_NOTICE_KINDS);
|
|
49
|
+
export function sessionBoxCarrierFields(n, seat) {
|
|
50
|
+
const message = n.crossSessionMessage === undefined ? undefined : settle(crossSessionMessageOf(n.crossSessionMessage, seat), (why) => dropProjectedFace("task_notification.crossSessionMessage " + why));
|
|
51
|
+
const notice = n.crossSessionNotice === undefined ? undefined : settle(crossSessionNoticeOf(n.crossSessionNotice, seat), (why) => dropProjectedFace("task_notification.crossSessionNotice " + why));
|
|
52
|
+
const inbox = n.inboxNotice === undefined ? undefined : settle(inboxNoticeOf(n.inboxNotice), (why) => dropProjectedFace("task_notification.inboxNotice " + why));
|
|
53
|
+
return {
|
|
54
|
+
...(message !== undefined ? { crossSessionMessage: message } : {}),
|
|
55
|
+
...(notice !== undefined ? { crossSessionNotice: notice } : {}),
|
|
56
|
+
...(inbox !== undefined ? { inboxNotice: inbox } : {}),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export const settle = (v, drop) => ("why" in v ? drop(v.why) : v.wire);
|
|
60
|
+
function crossSessionMessageOf(raw, seat) {
|
|
61
|
+
if (!isPlainObject(raw))
|
|
62
|
+
return { why: "is not a plain-data record" };
|
|
63
|
+
const { from, fromSession, fromName, fromMode, fromScope, body } = raw;
|
|
64
|
+
if (!isString(from) || !isString(body))
|
|
65
|
+
return { why: "is missing a string from / body" };
|
|
66
|
+
if (!optString(fromSession) || !optString(fromName) || !optString(fromScope))
|
|
67
|
+
return { why: "has a present fromSession / fromName / fromScope that is not a string" };
|
|
68
|
+
if (!optModeClass(fromMode))
|
|
69
|
+
return { why: "fromMode is outside core PERMISSION_MODE_CLASSES" };
|
|
70
|
+
return {
|
|
71
|
+
wire: {
|
|
72
|
+
from,
|
|
73
|
+
...(fromSession !== undefined ? { fromSession } : {}),
|
|
74
|
+
...(fromName !== undefined ? { fromName: seatText(seat, fromName) } : {}),
|
|
75
|
+
...(fromMode !== undefined ? { fromMode } : {}),
|
|
76
|
+
...(fromScope !== undefined ? { fromScope } : {}),
|
|
77
|
+
body: seatText(seat, body),
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function crossSessionNoticeOf(raw, seat) {
|
|
82
|
+
if (!isPlainObject(raw))
|
|
83
|
+
return { why: "is not a plain-data record" };
|
|
84
|
+
const { kind, text } = raw;
|
|
85
|
+
if (!isNoticeKind(kind))
|
|
86
|
+
return { why: "kind is outside delivery_notice / idle_notice" };
|
|
87
|
+
if (!isString(text))
|
|
88
|
+
return { why: "is missing a string text" };
|
|
89
|
+
return { wire: { kind, text: seatText(seat, text) } };
|
|
90
|
+
}
|
|
91
|
+
function inboxNoticeOf(raw) {
|
|
92
|
+
if (!isPlainObject(raw))
|
|
93
|
+
return { why: "is not a plain-data record" };
|
|
94
|
+
const { pending, delivered, urgent, resupplied } = raw;
|
|
95
|
+
if (!isCount(pending) || !isCount(delivered))
|
|
96
|
+
return { why: "is missing a non-negative integer pending / delivered" };
|
|
97
|
+
if (!optCount(urgent) || !optCount(resupplied))
|
|
98
|
+
return { why: "has a present urgent / resupplied that is not a non-negative integer" };
|
|
99
|
+
return { wire: { pending, delivered, ...(urgent !== undefined ? { urgent } : {}), ...(resupplied !== undefined ? { resupplied } : {}) } };
|
|
100
|
+
}
|
|
31
101
|
//# sourceMappingURL=task-notification-facets.js.map
|
|
@@ -100,7 +100,7 @@ export type DeclaredKey = ManifestShape & {
|
|
|
100
100
|
*/
|
|
101
101
|
export declare const FRAME_ENVELOPE_KEYS: readonly ["type", "sourceTaskId", "bgAgentId"];
|
|
102
102
|
/** 探针文件要从 `@sema-agent/core` 具名导入的类型(`coreType` 表达式里用到的全部名字)。 */
|
|
103
|
-
export declare const WIRE_PROJECTION_CORE_IMPORTS: readonly ["TaskEvent", "BrainStatus", "TaskNotificationPayload", "WiringManifest", "EngineNotice", "MemoryImportReport", "OriginClearanceRow", "OriginClearanceEvent", "MemoryEntryOrigin", "TraceEvent", "PromptManifestIdentity", "PromptIdentityLayers", "PromptManifestSelectors", "PromptManifestSection", "PromptChainLink", "SupersededOverlay", "ToolDisclosureManifest"];
|
|
103
|
+
export declare const WIRE_PROJECTION_CORE_IMPORTS: readonly ["TaskEvent", "BrainStatus", "TaskNotificationPayload", "WiringManifest", "EngineNotice", "MemoryImportReport", "OriginClearanceRow", "OriginClearanceEvent", "MemoryEntryOrigin", "TraceEvent", "PromptManifestIdentity", "PromptIdentityLayers", "PromptManifestSelectors", "PromptManifestSection", "PromptChainLink", "SupersededOverlay", "ToolDisclosureManifest", "SemaProvenance", "MailboxPeerMeta", "MailboxPeerNoticeMeta", "CrossSessionEnvelopeFields"];
|
|
104
104
|
/**
|
|
105
105
|
* `wiring_manifest` 的 **operator 面多投的那几段**(`wiringManifestOperatorEventData` 在租户形之上加的段)。
|
|
106
106
|
* operator 行的 `excluded` = 租户行减本常量(派生);四段各自的受众裁定在 `core-keyset-guard.ts` ⑥b。
|
|
@@ -171,7 +171,7 @@ export declare const WIRE_PROJECTION_FACES: {
|
|
|
171
171
|
readonly workspace_changed: {
|
|
172
172
|
readonly projector: "workspaceChangedEventData";
|
|
173
173
|
readonly coreType: string;
|
|
174
|
-
readonly excluded: readonly ["root", "remote", "entered", "project"];
|
|
174
|
+
readonly excluded: readonly ["root", "remote", "entered", "project", "session"];
|
|
175
175
|
readonly minted: readonly [];
|
|
176
176
|
};
|
|
177
177
|
readonly status: {
|
|
@@ -219,10 +219,46 @@ export declare const WIRE_PROJECTION_FACES: {
|
|
|
219
219
|
readonly task_notification: {
|
|
220
220
|
readonly projector: "taskNotificationEventData";
|
|
221
221
|
readonly coreType: `TaskNotificationPayload & ${string}`;
|
|
222
|
-
readonly excluded: readonly ["peer", "
|
|
222
|
+
readonly excluded: readonly ["peer", "received"];
|
|
223
223
|
readonly unwrapped: readonly ["notification"];
|
|
224
224
|
readonly minted: readonly ["injected"];
|
|
225
225
|
};
|
|
226
|
+
readonly task_notification_cross_session_message: {
|
|
227
|
+
readonly projector: "taskNotificationEventData";
|
|
228
|
+
readonly coreType: "CrossSessionEnvelopeFields & NonNullable<TaskNotificationPayload[\"crossSessionMessage\"]>";
|
|
229
|
+
readonly excluded: readonly [];
|
|
230
|
+
readonly minted: readonly [];
|
|
231
|
+
};
|
|
232
|
+
readonly task_notification_cross_session_notice: {
|
|
233
|
+
readonly projector: "taskNotificationEventData";
|
|
234
|
+
readonly coreType: "NonNullable<TaskNotificationPayload[\"crossSessionNotice\"]>";
|
|
235
|
+
readonly excluded: readonly [];
|
|
236
|
+
readonly minted: readonly [];
|
|
237
|
+
};
|
|
238
|
+
readonly task_notification_inbox_notice: {
|
|
239
|
+
readonly projector: "taskNotificationEventData";
|
|
240
|
+
readonly coreType: "NonNullable<TaskNotificationPayload[\"inboxNotice\"]>";
|
|
241
|
+
readonly excluded: readonly ["box"];
|
|
242
|
+
readonly minted: readonly [];
|
|
243
|
+
};
|
|
244
|
+
readonly task_notification_provenance: {
|
|
245
|
+
readonly projector: "taskNotificationEventData";
|
|
246
|
+
readonly coreType: "SemaProvenance";
|
|
247
|
+
readonly excluded: readonly [];
|
|
248
|
+
readonly minted: readonly [];
|
|
249
|
+
};
|
|
250
|
+
readonly task_notification_peer_meta: {
|
|
251
|
+
readonly projector: "taskNotificationEventData";
|
|
252
|
+
readonly coreType: "MailboxPeerMeta";
|
|
253
|
+
readonly excluded: readonly ["senderKey", "gateReceiptId", "occupant", "fromOccupant"];
|
|
254
|
+
readonly minted: readonly [];
|
|
255
|
+
};
|
|
256
|
+
readonly task_notification_peer_notice: {
|
|
257
|
+
readonly projector: "taskNotificationEventData";
|
|
258
|
+
readonly coreType: "MailboxPeerNoticeMeta";
|
|
259
|
+
readonly excluded: readonly [];
|
|
260
|
+
readonly minted: readonly [];
|
|
261
|
+
};
|
|
226
262
|
readonly wiring_manifest_tenant: {
|
|
227
263
|
readonly projector: "wiringManifestEventData";
|
|
228
264
|
readonly coreType: `WiringManifest & ${string}`;
|
|
@@ -17,6 +17,10 @@ export const WIRE_PROJECTION_CORE_IMPORTS = [
|
|
|
17
17
|
"PromptChainLink",
|
|
18
18
|
"SupersededOverlay",
|
|
19
19
|
"ToolDisclosureManifest",
|
|
20
|
+
"SemaProvenance",
|
|
21
|
+
"MailboxPeerMeta",
|
|
22
|
+
"MailboxPeerNoticeMeta",
|
|
23
|
+
"CrossSessionEnvelopeFields",
|
|
20
24
|
];
|
|
21
25
|
const arm = (name) => `Extract<TaskEvent, { type: "${name}" }>`;
|
|
22
26
|
const MANIFEST_FRAME = `Extract<TraceEvent, { kind: "prompt.assembled" }>`;
|
|
@@ -34,7 +38,7 @@ export const WIRE_PROJECTION_FACES = {
|
|
|
34
38
|
tool_roster_delta: { projector: "toolRosterDeltaEventData", coreType: arm("tool_roster_delta"), excluded: [], minted: [] },
|
|
35
39
|
diagnostics: { projector: "diagnosticsEventData", coreType: arm("diagnostics"), excluded: [], minted: [] },
|
|
36
40
|
steering_injected: { projector: "steeringInjectedEventData", coreType: arm("steering_injected"), excluded: [], minted: [] },
|
|
37
|
-
workspace_changed: { projector: "workspaceChangedEventData", coreType: arm("workspace_changed"), excluded: ["root", "remote", "entered", "project"], minted: [] },
|
|
41
|
+
workspace_changed: { projector: "workspaceChangedEventData", coreType: arm("workspace_changed"), excluded: ["root", "remote", "entered", "project", "session"], minted: [] },
|
|
38
42
|
status: { projector: "brainStatusEventData", coreType: `BrainStatus & ${arm("status")}`, excluded: [], minted: [] },
|
|
39
43
|
compacted: { projector: "compactedEventData", coreType: arm("compacted"), excluded: [], minted: [] },
|
|
40
44
|
context_usage: { projector: "contextUsageEventData", coreType: arm("context_usage"), excluded: [], minted: [] },
|
|
@@ -45,10 +49,31 @@ export const WIRE_PROJECTION_FACES = {
|
|
|
45
49
|
task_notification: {
|
|
46
50
|
projector: "taskNotificationEventData",
|
|
47
51
|
coreType: `TaskNotificationPayload & ${arm("task_notification")}`,
|
|
48
|
-
excluded: ["peer", "
|
|
52
|
+
excluded: ["peer", "received"],
|
|
49
53
|
unwrapped: ["notification"],
|
|
50
54
|
minted: ["injected"],
|
|
51
55
|
},
|
|
56
|
+
task_notification_cross_session_message: {
|
|
57
|
+
projector: "taskNotificationEventData",
|
|
58
|
+
coreType: `CrossSessionEnvelopeFields & NonNullable<TaskNotificationPayload["crossSessionMessage"]>`,
|
|
59
|
+
excluded: [],
|
|
60
|
+
minted: [],
|
|
61
|
+
},
|
|
62
|
+
task_notification_cross_session_notice: {
|
|
63
|
+
projector: "taskNotificationEventData",
|
|
64
|
+
coreType: `NonNullable<TaskNotificationPayload["crossSessionNotice"]>`,
|
|
65
|
+
excluded: [],
|
|
66
|
+
minted: [],
|
|
67
|
+
},
|
|
68
|
+
task_notification_inbox_notice: {
|
|
69
|
+
projector: "taskNotificationEventData",
|
|
70
|
+
coreType: `NonNullable<TaskNotificationPayload["inboxNotice"]>`,
|
|
71
|
+
excluded: ["box"],
|
|
72
|
+
minted: [],
|
|
73
|
+
},
|
|
74
|
+
task_notification_provenance: { projector: "taskNotificationEventData", coreType: "SemaProvenance", excluded: [], minted: [] },
|
|
75
|
+
task_notification_peer_meta: { projector: "taskNotificationEventData", coreType: "MailboxPeerMeta", excluded: ["senderKey", "gateReceiptId", "occupant", "fromOccupant"], minted: [] },
|
|
76
|
+
task_notification_peer_notice: { projector: "taskNotificationEventData", coreType: "MailboxPeerNoticeMeta", excluded: [], minted: [] },
|
|
52
77
|
wiring_manifest_tenant: {
|
|
53
78
|
projector: "wiringManifestEventData",
|
|
54
79
|
coreType: `WiringManifest & ${arm("wiring_manifest")}`,
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 「请求里有本版读者读不出、而这台部署本会采纳的成员」—— **一只**判据,两个调用点:`boot/resolve-spec.ts` 装配腿首(**拒点**;两腿同判)与
|
|
3
|
+
* `http/stored-body-replay.ts` 的存体重放预判(五个续跑问点同调,认领之前答)。
|
|
4
|
+
*
|
|
5
|
+
* ## 律(一条)
|
|
6
|
+
* 请求的某个成员,本版的读者读不出(整只不交,或其中几处不交给引擎),而这台部署对这个成员本会采纳(读得出就会生效)⇒ 这份请求不跑。
|
|
7
|
+
* · 新提交:`settings.env` 有成员不是帽内串 ⇒ 本判据是唯一的拒点(受理门只判形与帽;HTTP 新提交也走到这里)—— 采纳 env 的车道上 400,其余车道零变;
|
|
8
|
+
* 其余成员在受理门 / 腿首按各自的判据已 400(本判据在新提交腿上对它们只接得住绕过受理门直调 `resolveSpec` 的嵌入方);
|
|
9
|
+
* · 续跑重放(盘上的存量请求体,升级前受理时读得出、本版读不出):拒续跑 —— 409 `resume_blocked_by_policy`(`blockedBy` = `request.field_invalid`,
|
|
10
|
+
* `field` = 第一个读不出的坐标,句子点名全部坐标、不回显值),卡仍待决、行不动;出路 = 取消后按本版的形重提。
|
|
11
|
+
* 修前续跑重放腿把读不出的成员丢掉照跑,只留一行运维 warn(`task_settings_deferred` / `mcp_transport_members_dropped` / `a2a_peer_headers_members_dropped`):
|
|
12
|
+
* 丢掉的可能是同一份 hooks 里真在拦的守卫、MCP 服务的鉴权头 —— 调用方只看到续跑成功。三条 warn 与 P-DEBT 计数随本判据删除。
|
|
13
|
+
*
|
|
14
|
+
* ## 成员(三座,闭集)
|
|
15
|
+
* · `settings.<键>`:请求设置解析层(`task-settings.ts` `parseTaskSettings`)报 `deferred` 的键 —— `hooks`(唯一读者拒;续跑重放腿上一次性迁移 M20 的窗开着时先剥键重读,过了就读得出)、
|
|
16
|
+
* `env`(有成员读不出:不是对象 / 过帽 / 值不是帽内的串;空记录不算)、`permissions`(不是对象 / 桶不合法)、「只收紧」座位(座位门不过)。采纳与否按键({@link settingsMemberHonored}):
|
|
17
|
+
* `hooks` 读 `taskHooksHonored`;`env` 的读者有两个 —— 模型的工具 shell(部署形表行 `callerCwd`)与 settings hooks 的子进程 env / http `$NAME` 插值源(`taskHooksHonored` ∧ 这份请求带着读得出的 hooks),
|
|
18
|
+
* 任一在 ⇒ 采纳;其余每条车道都采纳;
|
|
19
|
+
* · `mcpServers[<下标>].transport.<路径>`:请求面 MCP 条目挂得上、名字不被部署占住(部署声明过的名字一律关给请求面,与挂载的合并同一只 `deploymentClosedMcpNames`)、
|
|
20
|
+
* transport 却有几处不交给引擎(`task-mcp.ts` `requestMcpTransportUnread`);采纳 = `mcpInjectionHonored`;
|
|
21
|
+
* · `a2aPeers[<下标>].headers.<成员>`:请求面 A2A 对端挂得上、`headers` 里剔掉的成员(`task-a2a.ts` `requestA2aHeadersUnread`);采纳 = `a2aInjectionHonored`。
|
|
22
|
+
* 坐标只有键路径与下标(成员名只会是读器的保留名),不带值、不带调用方写的名字。
|
|
23
|
+
* A2A 一座不看部署同名占位:A2A 的占位是**按场景**的部署对端(`a2aForScenario`),存体预判在认领之前答、不知道这一跑落在哪个场景 ⇒ 一只读不出的对端若会输给同场景的部署同名对端(不挂),
|
|
24
|
+
* 本判据照样拒 —— 方向是多拒一次(出路同上),不是少拦。MCP 的占位与场景无关(部署声明过的全部名字),所以 MCP 一座按占位判。
|
|
25
|
+
*
|
|
26
|
+
* ## 不在射程内(已披露)
|
|
27
|
+
* 读者把**整条**摘下的条目(MCP / A2A 条目不是对象、硬键坏形:有用户面通告 `mcp.injection_dropped` / 运维 warn `a2a_injection_dropped`)、条目上被丢的软键
|
|
28
|
+
* (`contentOrigin` 降级、`elicitation` / `source` 读不出)不在本判据里。
|
|
29
|
+
*/
|
|
30
|
+
import { type LaneAxisInput, type PrincipalAxisInput } from "./deployment-shape.js";
|
|
31
|
+
import { type SettingsEnvLayer } from "./task-settings.js";
|
|
32
|
+
import { mcpInjectionHonored } from "./task-mcp.js";
|
|
33
|
+
import type { CenterMcp } from "./config-types.js";
|
|
34
|
+
import { type A2aGateConfig } from "./task-a2a.js";
|
|
35
|
+
import type { StoredToolAxesRereadM19 } from "./stored-request-tool-axes-m19.js";
|
|
36
|
+
import type { Refusal } from "./http/refusal-body.js";
|
|
37
|
+
/** 判据读的部署事实(`ServiceConfig` 结构上满足):租户轴、已合成的车道、两只注入闸的否决位、部署的 MCP 声明(占住的名字)。 */
|
|
38
|
+
export type UnreadMembersDeployment = PrincipalAxisInput & LaneAxisInput & A2aGateConfig & Parameters<typeof mcpInjectionHonored>[0] & {
|
|
39
|
+
readonly mcpServers?: Pick<CenterMcp, "servers" | "reservedNames"> | undefined;
|
|
40
|
+
};
|
|
41
|
+
/** 请求里本判据读的三座(原样;调用方从请求体取 —— `resolveSpec` 的 A2A 一座递它腿首那一份快照)。 */
|
|
42
|
+
export interface UnreadMembersRequest {
|
|
43
|
+
readonly settings: unknown;
|
|
44
|
+
readonly mcpServers: unknown;
|
|
45
|
+
readonly a2aPeers: unknown;
|
|
46
|
+
}
|
|
47
|
+
/** 读的是哪条腿,与那条腿的读法座:续跑重放腿递 M19 的重读座(调用方求值一次,挂载那一读用同一份)与「今天」(M20 的窗按它问);新提交腿两座都没有。 */
|
|
48
|
+
export type UnreadMembersLeg = {
|
|
49
|
+
readonly replay: false;
|
|
50
|
+
readonly settingsEnv?: SettingsEnvLayer | undefined;
|
|
51
|
+
} | {
|
|
52
|
+
readonly replay: true;
|
|
53
|
+
readonly today: string;
|
|
54
|
+
readonly storedToolAxes: StoredToolAxesRereadM19 | undefined;
|
|
55
|
+
readonly settingsEnv?: SettingsEnvLayer | undefined;
|
|
56
|
+
};
|
|
57
|
+
/** 拒句(与运维行)至多点名的坐标数(余下的报总数)。 */
|
|
58
|
+
export declare const MAX_NAMED_MEMBERS = 8;
|
|
59
|
+
/** 读不出、而本部署会采纳的成员坐标(文档序:设置 → MCP → A2A);空 = 这份请求的每个成员都读得出(或读不出的那几个本部署本来就不采纳)。 */
|
|
60
|
+
export declare function unreadRequestMembers(request: UnreadMembersRequest, deployment: UnreadMembersDeployment, leg: UnreadMembersLeg): readonly string[];
|
|
61
|
+
/**
|
|
62
|
+
* 判据命中的拒:码 `request.field_invalid`(各成员的新提交判据答的同一个码),`field` = 第一个坐标,句子点名全部坐标(至多 {@link MAX_NAMED_MEMBERS} 个,余下报总数)。
|
|
63
|
+
* 拒点(`resolveSpec`)把它抛成 400;续跑口把它折成 409 `resume_blocked_by_policy`(预判与折叠调同一只折法,同码同句)。纯数据。
|
|
64
|
+
*/
|
|
65
|
+
export declare function unreadRequestMembersRefusal(members: readonly [string, ...string[]]): Refusal;
|
|
66
|
+
//# sourceMappingURL=unread-request-members.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { DEPLOYMENT_SHAPE_PREDICATES } from "./deployment-shape.js";
|
|
2
|
+
import { parseTaskSettings, taskHooksHonored } from "./task-settings.js";
|
|
3
|
+
import { deploymentClosedMcpNames, mcpInjectionHonored, requestMcpTransportUnread } from "./task-mcp.js";
|
|
4
|
+
import { a2aInjectionHonored, requestA2aHeadersUnread } from "./task-a2a.js";
|
|
5
|
+
import { storedHooksRereadM20 } from "./stored-request-hooks-m20.js";
|
|
6
|
+
export const MAX_NAMED_MEMBERS = 8;
|
|
7
|
+
function settingsMemberHonored(key, deployment, carriesHooks) {
|
|
8
|
+
switch (key) {
|
|
9
|
+
case "hooks":
|
|
10
|
+
return taskHooksHonored(deployment);
|
|
11
|
+
case "env":
|
|
12
|
+
return DEPLOYMENT_SHAPE_PREDICATES.callerCwd.holds(deployment) || (carriesHooks && taskHooksHonored(deployment));
|
|
13
|
+
default:
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function unreadRequestMembers(request, deployment, leg) {
|
|
18
|
+
const hooksReread = leg.replay && taskHooksHonored(deployment) ? storedHooksRereadM20(leg.today) : undefined;
|
|
19
|
+
const settings = parseTaskSettings(request.settings, { ...(hooksReread !== undefined ? { storedHooksReread: hooksReread } : {}), ...(leg.settingsEnv !== undefined ? { settingsEnv: leg.settingsEnv } : {}) });
|
|
20
|
+
const carriesHooks = settings.settings?.hooks !== undefined;
|
|
21
|
+
const out = settings.deferred.filter((key) => settingsMemberHonored(key, deployment, carriesHooks)).map((key) => `settings.${key}`);
|
|
22
|
+
const storedToolAxes = leg.replay ? leg.storedToolAxes : undefined;
|
|
23
|
+
if (mcpInjectionHonored(deployment)) {
|
|
24
|
+
const closed = deploymentClosedMcpNames(deployment.mcpServers?.servers.map((s) => s.spec), deployment.mcpServers?.reservedNames ?? []);
|
|
25
|
+
out.push(...requestMcpTransportUnread(request.mcpServers, closed, storedToolAxes));
|
|
26
|
+
}
|
|
27
|
+
if (a2aInjectionHonored(deployment))
|
|
28
|
+
out.push(...requestA2aHeadersUnread(request.a2aPeers, storedToolAxes));
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
export function unreadRequestMembersRefusal(members) {
|
|
32
|
+
const named = members.slice(0, MAX_NAMED_MEMBERS);
|
|
33
|
+
const more = members.length > named.length ? ` (and ${members.length - named.length} more)` : "";
|
|
34
|
+
return {
|
|
35
|
+
errorCode: "request.field_invalid",
|
|
36
|
+
message: `this request carries ${members.length === 1 ? "a member" : "members"} this server version's readers cannot take as written, on a deployment that would apply ${members.length === 1 ? "it" : "them"}: ` +
|
|
37
|
+
`${named.join(", ")}${more} — running it would silently leave ${members.length === 1 ? "that member" : "those members"} out (a hook that guards a tool, an MCP server's credentials); submit it again with ${members.length === 1 ? "this member" : "these members"} in the current form`,
|
|
38
|
+
facts: { field: members[0] },
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=unread-request-members.js.map
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
* 第二种口径不完整:**有 echo 行但缺数值键**(该键按 0 计入 ⇒ 总量偏低)——两臂同义:别把总数当精确值;
|
|
17
17
|
* - 行内数值键一律走 {@link numOf} 守卫:数据源是 DB 里的 JSON,裸算术遇缺席/非数会 NaN 毒掉整窗(#59);
|
|
18
18
|
* - 扫窗有行数上限(store 侧 LIMIT)——触顶时结果携带 `truncated:true`(诚实截断,绝不静默)。
|
|
19
|
+
*
|
|
20
|
+
* 窗契约(三个后端同一条,`usageScan(fromMs, toMs)`):窗是**半开 `[fromMs, toMs)`** —— 创建毫秒 `t` 满足 `fromMs <= t < toMs` 的行才计
|
|
21
|
+
* (内存 / 文件腿 `t < fromMs || t >= toMs` 跳过;SQL 腿 `created_at >= ? AND created_at < ?`,列是毫秒精度)。上界**不含**。
|
|
22
|
+
* 路由 `/v1/usage/*` 的**缺省** `to` 取 `now + 1`(「到此刻为止,含此刻」是缺省值的定义,店不为它开特例);请求显式给的 `to` 原义不变(不含)。
|
|
19
23
|
*/
|
|
20
24
|
/** store 侧 usageScan 的行投影(所有后端同形状;createdAtMs=epoch ms)。 */
|
|
21
25
|
export interface UsageRow {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
* 转移只有四条(open → settled | converged;converged → announced),两只孪生都按 CAS 守它们(File 单进程 = 内存判;SQL = `WHERE state=…`)。
|
|
47
47
|
* · `erased` —— ([ref])**会话树删除**:该会话此前的每一次受理(不论状态)离开账本。行随会话走 —— 账本行的唯一归属键就是 `sessionId`,
|
|
48
48
|
* 所以两条删会话树的级联(在线删除协调器 `boot/session-faces.ts` 的 `purgeSession`、托管留存的事务化孪生
|
|
49
|
-
* `retention-
|
|
49
|
+
* `plugins/retention-deployment.ts` 的 `deleteDeploymentSessionRows`)各有一臂删它,谓词同一只(`session_id` 单键,店动词 `deleteBySession`)。
|
|
50
50
|
* File 孪生的盘上形 = 一行会话级墓碑 `{ kind:"erased", sessionId, at }`(与 workflow 完成信箱 `drain{sessionId}` 同形),
|
|
51
51
|
* 只擦它**之前**的同会话行 —— 会话 id 删后可被重新登记,之后的受理属于下一位住客;SQL 孪生 = 真删行。被删受理上迟到的转移全输
|
|
52
52
|
* (行不在了,与「未知 acceptId」同一条守卫)。
|
|
@@ -264,7 +264,7 @@ export interface UserInputLedgerStore {
|
|
|
264
264
|
/** [ref] —— **会话树删除**:删掉该会话**每一种状态**的受理,回删除条数(没有可删的 ⇒ 0、零写;幂等)。按 `session_id` 单键:行上没有属主列,
|
|
265
265
|
* 会话所有权由调用方证过(在线删除 = 路由的 DELETE 门;留存 = 候选集本身出自本域加锁读的 `session_meta`),与 anchors / exemptions /
|
|
266
266
|
* attachments 同律。调用方 = 在线删除协调器(`boot/session-faces.ts` `purgeSession` 的一腿);托管留存的事务化孪生不调店、在自己的事务里
|
|
267
|
-
* 发**同一只谓词**(`retention-
|
|
267
|
+
* 发**同一只谓词**(`retention-deployment.ts` `deleteDeploymentSessionRows` ④)。写不进 ⇒ 抛(协调器据此不删会话本体,幂等重试收敛)。 */
|
|
268
268
|
deleteBySession(sessionId: string): Promise<number>;
|
|
269
269
|
}
|
|
270
270
|
/** 收敛判词读的 run 店面(只读一只动词)。 */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { expandTiers, modelOriginOf, resolveTaskModel as coreResolveTaskModel } from "@sema-agent/core";
|
|
2
|
-
import { CATALOG_REPLACES_ENV_MODELS_CODE, SandboxGitConfig, WEB_ADMIN_ENV, envModelsDecisionTag, formatConfigPath, narrowAtMention, resolveActiveTiers, resolveCatalogDefaultModel, sanitizeZodError } from "@sema-agent/settings-schema";
|
|
2
|
+
import { CATALOG_REPLACES_ENV_MODELS_CODE, SandboxGitConfig, WEB_ADMIN_ENV, envModelsDecisionTag, formatConfigPath, narrowAtMention, parseDomainSalvaged, resolveActiveTiers, resolveCatalogDefaultModel, sanitizeZodError } from "@sema-agent/settings-schema";
|
|
3
3
|
import { modelKeyPoison } from "../key-resolver.js";
|
|
4
4
|
import { DEFAULT_MODEL_REF, buildEnvModelIdNotServedNotice, mintCapabilityKeys, readAtMention, servedModelTableLeg } from "../model-select.js";
|
|
5
5
|
import { applyAutoCompactWindow, buildModelCostKey, isRosterGateArmed, ownCredentialHitsInForce, parseAutonomy, unmatchableToolNamesRefusal } from "../config.js";
|
|
6
|
-
import { NAME_TABLE_BEHAVIOR } from "../namespaced-rule-name.js";
|
|
6
|
+
import { NAME_TABLE_BEHAVIOR, retiredWithoutSuccessorEntries } from "../namespaced-rule-name.js";
|
|
7
7
|
import { buildModelCompat, readModelCompat } from "../model-compat.js";
|
|
8
8
|
import { buildModelHeadersKey } from "../model-entry-headers.js";
|
|
9
9
|
import { validateCommandRules } from "../runtime-governance.js";
|
|
@@ -29,13 +29,11 @@ function envDerivedModel(config) {
|
|
|
29
29
|
}
|
|
30
30
|
function toModel(m, envDefaults = {}, logger) {
|
|
31
31
|
const thinkingDefault = envDefaults.defaultThinking;
|
|
32
|
-
const declared = readModelCompat(m.compat);
|
|
32
|
+
const declared = readModelCompat(m.api, m.compat);
|
|
33
33
|
if (!declared.ok)
|
|
34
34
|
logger?.warn("model_compat_dropped", { model: m.name, issue: declared.issue, hint: "the per-model wire-compat declaration was dropped whole — the engine falls back to its own inference (today's behaviour); fix the entry to make it live" });
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
const compat = m.provider === "anthropic" ? undefined : buildModelCompat(declared.ok ? declared.compat : undefined, envDefaults.compat);
|
|
35
|
+
const envCompat = envDefaults.api === m.api ? envDefaults.compat : undefined;
|
|
36
|
+
const compat = buildModelCompat(m.api, declared.ok ? declared.compat : undefined, envCompat);
|
|
39
37
|
const model = {
|
|
40
38
|
id: m.id,
|
|
41
39
|
name: m.name,
|
|
@@ -52,6 +50,7 @@ function toModel(m, envDefaults = {}, logger) {
|
|
|
52
50
|
params: { ...(m.tier ? { tier: m.tier } : {}), promptCacheFamily: m.provider === "anthropic" ? "input-excludes-cached" : "input-includes-cached" },
|
|
53
51
|
...(thinkingDefault ? { defaultThinking: thinkingDefault } : {}),
|
|
54
52
|
...(compat ? { compat } : {}),
|
|
53
|
+
...(m.thinkingLevelMap !== undefined ? { thinkingLevelMap: m.thinkingLevelMap } : {}),
|
|
55
54
|
...(m.extraBody ? { extraBody: m.extraBody } : {}),
|
|
56
55
|
...buildModelHeadersKey(m.name, m.headers, m.api),
|
|
57
56
|
};
|
|
@@ -399,7 +398,7 @@ function stageModelPlane(config, eff, source, logger, sealedKeys) {
|
|
|
399
398
|
const modelApiKeyEnv = {};
|
|
400
399
|
const modelApiKeys = {};
|
|
401
400
|
const envModel = envDerivedModel(config);
|
|
402
|
-
const envDefaults = { maxTokens: envModel.maxTokens, contextWindow: envModel.contextWindow, charsPerToken: envModel.charsPerToken, defaultThinking: envModel.defaultThinking, compat: envModel.compat };
|
|
401
|
+
const envDefaults = { maxTokens: envModel.maxTokens, contextWindow: envModel.contextWindow, charsPerToken: envModel.charsPerToken, defaultThinking: envModel.defaultThinking, api: envModel.api, compat: envModel.compat };
|
|
403
402
|
for (const m of usable) {
|
|
404
403
|
if (m.baseUrl)
|
|
405
404
|
logger?.warn("web_admin_model_base_url", { model: m.name, baseUrl: buildDisplaySafeUrl(m.baseUrl), hint: "registry-directed gateway override — this model's key authenticates AGAINST THIS URL" });
|
|
@@ -543,22 +542,10 @@ function stageEffective(config, eff, logger, opts) {
|
|
|
543
542
|
const approvalGate = stageApprovalGate(config, eff.governance, opts, logger);
|
|
544
543
|
const limits = stageLimits(config, { version: typeof eff.version === "number" ? eff.version : 0, ...("limits" in eff ? { limits: eff.limits } : {}) }, logger);
|
|
545
544
|
const hot = stageRuntimeHot(config, eff.governance, logger);
|
|
546
|
-
const
|
|
547
|
-
const
|
|
548
|
-
|
|
549
|
-
? (
|
|
550
|
-
: {}) ?? {};
|
|
551
|
-
const projects = {};
|
|
552
|
-
for (const [pid, reg] of Object.entries(rawProjects)) {
|
|
553
|
-
if (!reg || typeof reg !== "object" || Array.isArray(reg))
|
|
554
|
-
continue;
|
|
555
|
-
const r = reg;
|
|
556
|
-
projects[pid] = {
|
|
557
|
-
...(typeof r.displayName === "string" ? { displayName: r.displayName } : {}),
|
|
558
|
-
...(Array.isArray(r.gitRemotes) ? { gitRemotes: r.gitRemotes.filter((x) => typeof x === "string") } : {}),
|
|
559
|
-
...(Array.isArray(r.defaultScopes) ? { defaultScopes: r.defaultScopes.filter((x) => typeof x === "string") } : {}),
|
|
560
|
-
};
|
|
561
|
-
}
|
|
545
|
+
const projectWarnings = [];
|
|
546
|
+
const projects = eff.projects === undefined ? {} : { ...parseDomainSalvaged("projects", eff.projects, (w) => projectWarnings.push(w)).projects };
|
|
547
|
+
for (const w of projectWarnings)
|
|
548
|
+
logger?.warn("web_admin_projects_read_warning", { kind: w.kind, ...(w.kind === "entry-dropped" ? { entry: formatConfigPath(w.path), ...(w.reasonCode !== undefined ? { reasonCode: w.reasonCode } : {}) } : {}) });
|
|
562
549
|
const sandboxGit = stageSandboxGit(eff, logger);
|
|
563
550
|
return {
|
|
564
551
|
version: typeof eff.version === "number" && Number.isFinite(eff.version) ? eff.version : 0,
|
|
@@ -635,7 +622,7 @@ function stageApprovalRequire(raw) {
|
|
|
635
622
|
return { ok: false, detail, reason: detail, names: nonString.map((e) => `[${e.i}]`), kept: KEPT_WOULD_REMOVE_GATE };
|
|
636
623
|
}
|
|
637
624
|
const names = raw.filter((n) => typeof n === "string").map((n) => n.trim()).filter((n) => n.length > 0);
|
|
638
|
-
const unmatchable = unmatchableToolNamesRefusal("published governance.approvalRequire", names, { consumer: "tool-name-table", behavior: NAME_TABLE_BEHAVIOR });
|
|
625
|
+
const unmatchable = unmatchableToolNamesRefusal("published governance.approvalRequire", names, { consumer: "tool-name-table", behavior: NAME_TABLE_BEHAVIOR, noticeSeat: "server" });
|
|
639
626
|
if (unmatchable !== undefined) {
|
|
640
627
|
return {
|
|
641
628
|
ok: false,
|
|
@@ -645,7 +632,7 @@ function stageApprovalRequire(raw) {
|
|
|
645
632
|
kept: KEPT_WOULD_MATCH_NOTHING,
|
|
646
633
|
};
|
|
647
634
|
}
|
|
648
|
-
return { ok: true, value: names };
|
|
635
|
+
return { ok: true, value: names, skipped: retiredWithoutSuccessorEntries(names, NAME_TABLE_BEHAVIOR) };
|
|
649
636
|
}
|
|
650
637
|
function unserviceableOnLeg(leg, candidate) {
|
|
651
638
|
switch (leg.leg) {
|
|
@@ -672,6 +659,7 @@ function stageApprovalGate(config, gov, leg, logger) {
|
|
|
672
659
|
};
|
|
673
660
|
const raw = gov?.approvalRequire;
|
|
674
661
|
let next;
|
|
662
|
+
let skipped = [];
|
|
675
663
|
if (raw === undefined) {
|
|
676
664
|
next = [...approvalEnvBaseline.get(config)];
|
|
677
665
|
}
|
|
@@ -680,10 +668,18 @@ function stageApprovalGate(config, gov, leg, logger) {
|
|
|
680
668
|
if (!verdict.ok)
|
|
681
669
|
return refuse(verdict);
|
|
682
670
|
next = verdict.value;
|
|
671
|
+
skipped = verdict.skipped;
|
|
683
672
|
}
|
|
684
673
|
const unserviceable = unserviceableOnLeg(leg, { ...config, approvalRequire: next });
|
|
685
674
|
if (unserviceable !== undefined)
|
|
686
675
|
return refuse({ detail: unserviceable, reason: unserviceable, names: next, kept: KEPT_WOULD_NEVER_PARK });
|
|
676
|
+
if (skipped.length > 0) {
|
|
677
|
+
logger?.warn("web_admin_approval_require_legacy_tool_name", {
|
|
678
|
+
names: skipped.map((s) => s.entry),
|
|
679
|
+
guidance: skipped.map((s) => s.guidance),
|
|
680
|
+
note: "published governance.approvalRequire names tools the engine retired with no successor — they reach no tool this server knows, so those entries guard nothing (kept as written: a tool of that exact name mounted by an embedder is still matched); the list is applied; remove them from the published list if written for the retired tool",
|
|
681
|
+
});
|
|
682
|
+
}
|
|
687
683
|
const same = next.length === config.approvalRequire.length && next.every((n, i) => n === config.approvalRequire[i]);
|
|
688
684
|
return same ? {} : { next };
|
|
689
685
|
}
|
|
@@ -39,9 +39,21 @@ export interface CandidateDomainError {
|
|
|
39
39
|
/** 判官拒一份候选的成因(闭集):某个域判形失败(含 prompts 面)`domain_invalid` ∪ 被拒文档自带的词(契约闭集 `CONFIG_DOCUMENT_REFUSAL_REASONS`:
|
|
40
40
|
* `empty` / `invalid_json` / `not_object` / `io` / `too_deep` 文件层,`retired_domain` 墓碑)—— 被拒文档的词表只在契约一处定义,这里派生(契约加词 ⇒ 按词穷举的读者编译红)。 */
|
|
41
41
|
export type CandidateRejectReason = "domain_invalid" | ConfigDocumentRefusalReason;
|
|
42
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* 拒因的**类词**(闭集,机读,不含任何自由文本):这一条拒是哪一类事 —— 拒启句(`defaultModelRefusal` 的回落原因)只许据它说「为什么」,**不许**抄 `error` 原文(见 {@link CandidateDomainRejection.kind})。
|
|
44
|
+
* 成因词 {@link CandidateRejectReason} 已是闭集,但 `io` 一个词盖了三件事(悬空符号链接 / 权限 / I/O 故障),类词把悬空链接拆出来:
|
|
45
|
+
* `schema_invalid`(域判形失败 / 引用悬空 / prompts 坏形)· `empty` · `parse_error`(JSON 解析不过)· `not_object` · `too_deep` · `retired_domain`(退役域墓碑)· `dangling_symlink` · `unreadable`(在场却读不出的其余形)。
|
|
46
|
+
*/
|
|
47
|
+
export declare const CANDIDATE_REJECTION_KINDS: readonly ["schema_invalid", "empty", "parse_error", "not_object", "too_deep", "retired_domain", "dangling_symlink", "unreadable"];
|
|
48
|
+
export type CandidateRejectionKind = (typeof CANDIDATE_REJECTION_KINDS)[number];
|
|
49
|
+
/**
|
|
50
|
+
* 拒判里的一条:哪一域、为什么(读腿 / 契约包的原句)、成因词、类词。`config_candidate_rejected` 行的 `errors` 就是这一列。
|
|
51
|
+
* `error` 是读腿 / 契约的原句(可能点名链接指向的目标路径等操作数),**只走 warn 行**;`kind` 是机读的类词(只在 {@link judgeConfigCandidate} 铸一次),
|
|
52
|
+
* 拒启句读 `kind` 不读 `error`。
|
|
53
|
+
*/
|
|
43
54
|
export interface CandidateDomainRejection extends CandidateDomainError {
|
|
44
55
|
readonly reason: CandidateRejectReason;
|
|
56
|
+
readonly kind: CandidateRejectionKind;
|
|
45
57
|
}
|
|
46
58
|
/** 判官的输入:一份读出来的候选。`refusedDocuments` = 读腿交出的被拒文档(两条读腿同形,契约的类型 `ConfigDocumentRefusal`;判官只读文档名、拒句与成因词)。 */
|
|
47
59
|
export interface ConfigCandidateRead {
|
|
@@ -82,19 +94,39 @@ export declare function buildCandidateRejectedFields(r: {
|
|
|
82
94
|
* 最近一次被判官整拒的候选的**结论**(纯数据)—— 判官判决的持有形:`domains` 就是 {@link judgeConfigCandidate} 交出的 `rejected.domains`(排序去重的域名集),
|
|
83
95
|
* 一个字没改写;`source` = 这份候选是哪种配置源读出来的(`"local"` 本地 `config.d` / `"remote"` 中心);`at` = 判官判下这份候选的时刻(毫秒)。
|
|
84
96
|
* 持有者(`boot/web-admin.ts` 的 `candidateRejection`)是它的**唯一**座:`config_candidate_rejected` 日志行的去重键与 `GET /v1/models.candidateRejected`
|
|
85
|
-
* 的投影({@link buildCandidateRejectedWire})
|
|
97
|
+
* 的投影({@link buildCandidateRejectedWire})读的是同一份。`errors` 是判官交出的 `rejected.errors` 那一列的**同一个数组**(`config_candidate_rejected` 行体的 `errors` 也是它,
|
|
98
|
+
* {@link buildCandidateRejectedFields}):进程内的读者 —— 起服期「回落 env 之后没有缺省模型」的拒启句(`defaultModelRefusal` 的回落原因)—— 读它点名被拒的文档与拒码,
|
|
99
|
+
* 不读日志、不自铸第二份。拒因文案(`errors`)与文件路径(`dir`)只走日志与这条进程内的读,**不上 wire**:wire 投影 {@link buildCandidateRejectedWire} 只挑 `domains` / `at` / `source` 三键。
|
|
86
100
|
*/
|
|
87
101
|
export interface CandidateRejection {
|
|
88
102
|
readonly version: number;
|
|
89
103
|
readonly domains: readonly string[];
|
|
90
104
|
readonly source: "local" | "remote";
|
|
91
105
|
readonly at: number;
|
|
106
|
+
readonly errors: readonly CandidateDomainRejection[];
|
|
107
|
+
/** 本地读腿的配置根(`config_candidate_rejected` 行的 `dir` 同一个值;远程读腿缺席)—— 拒启句据它 + 域名点得出被拒文档的路径。 */
|
|
108
|
+
readonly dir?: string;
|
|
92
109
|
}
|
|
93
110
|
export declare function candidateRejectionOf(r: {
|
|
94
111
|
readonly effective: EffectiveConfig;
|
|
95
112
|
}, verdict: Extract<ConfigCandidateVerdict, {
|
|
96
113
|
verdict: "rejected";
|
|
97
|
-
}>, source: CandidateRejection["source"], at: number): CandidateRejection;
|
|
114
|
+
}>, source: CandidateRejection["source"], at: number, dir?: string): CandidateRejection;
|
|
115
|
+
/**
|
|
116
|
+
* 拒启句里「回落原因」的一格(纯数据):被拒的文档名 · 成因词(拒码)· 原因类词 · 被拒文档的路径(本地读腿才有)。
|
|
117
|
+
* **不含** `error` 原文:契约句 / 读腿句里的链接目标路径等操作数只留在 `config_candidate_rejected` 行(那里已过产出边界脱敏)。
|
|
118
|
+
*/
|
|
119
|
+
export interface CandidateRejectionNote {
|
|
120
|
+
readonly document: string;
|
|
121
|
+
readonly code: CandidateRejectReason;
|
|
122
|
+
readonly cause: string;
|
|
123
|
+
readonly path?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* {@link CandidateRejection} 的拒因列 → 拒启句的「回落原因」格(`defaultModelRefusal` 的视图成员读它)。来源就是判官交出的那一列 `errors`(与 `config_candidate_rejected` 行同一份),
|
|
127
|
+
* 路径 = `<dir>/config.d/<域>.json`(拒行「据 dir + 域点得出文件」的同一读法,`localConfigDirOf` 是本仓 `config.d` 路径的唯一写法)。
|
|
128
|
+
*/
|
|
129
|
+
export declare function buildCandidateRejectionNotes(rejection: Pick<CandidateRejection, "errors" | "dir">): CandidateRejectionNote[];
|
|
98
130
|
/** `GET /v1/models` 顶层 `candidateRejected` 的 wire 形(契约 §A.1d「`GET /v1/models` 的 `candidateRejected`」):域名闭集词 + ISO 时刻 + 源形态,零自由文本。 */
|
|
99
131
|
export interface CandidateRejectedWire {
|
|
100
132
|
readonly domains: string[];
|