@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,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[];
|
|
@@ -1,11 +1,40 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { localConfigDirOf } from "../config-dir-trust.js";
|
|
1
3
|
import { judgePromptsWire } from "../prompts-domain-validate.js";
|
|
4
|
+
export const CANDIDATE_REJECTION_KINDS = ["schema_invalid", "empty", "parse_error", "not_object", "too_deep", "retired_domain", "dangling_symlink", "unreadable"];
|
|
5
|
+
const DANGLING_LINK_MARK = " is a dangling symbolic link (";
|
|
6
|
+
function rejectionKindOf(reason, error) {
|
|
7
|
+
switch (reason) {
|
|
8
|
+
case "domain_invalid":
|
|
9
|
+
return "schema_invalid";
|
|
10
|
+
case "empty":
|
|
11
|
+
return "empty";
|
|
12
|
+
case "invalid_json":
|
|
13
|
+
return "parse_error";
|
|
14
|
+
case "not_object":
|
|
15
|
+
return "not_object";
|
|
16
|
+
case "too_deep":
|
|
17
|
+
return "too_deep";
|
|
18
|
+
case "retired_domain":
|
|
19
|
+
return "retired_domain";
|
|
20
|
+
case "io":
|
|
21
|
+
return error.includes(DANGLING_LINK_MARK) ? "dangling_symlink" : "unreadable";
|
|
22
|
+
default: {
|
|
23
|
+
const unhandled = reason;
|
|
24
|
+
throw new Error(`unhandled candidate reject reason: ${JSON.stringify(unhandled)}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function rejectionOf(domain, error, reason) {
|
|
29
|
+
return { domain, error, reason, kind: rejectionKindOf(reason, error) };
|
|
30
|
+
}
|
|
2
31
|
export function judgeConfigCandidate(r) {
|
|
3
32
|
const prompts = r.effective.prompts;
|
|
4
33
|
const promptsGate = prompts === undefined ? undefined : judgePromptsWire(prompts);
|
|
5
34
|
const errors = [
|
|
6
|
-
...(r.domainErrors ?? []).map((de) => (
|
|
7
|
-
...(promptsGate !== undefined && !promptsGate.ok ? [
|
|
8
|
-
...(r.refusedDocuments ?? []).map((d) => (
|
|
35
|
+
...(r.domainErrors ?? []).map((de) => rejectionOf(de.domain, de.error, "domain_invalid")),
|
|
36
|
+
...(promptsGate !== undefined && !promptsGate.ok ? [rejectionOf("prompts", promptsGate.error, "domain_invalid")] : []),
|
|
37
|
+
...(r.refusedDocuments ?? []).map((d) => rejectionOf(d.document, d.error, d.reason)),
|
|
9
38
|
];
|
|
10
39
|
if (errors.length === 0)
|
|
11
40
|
return { verdict: "clean", prompts: promptsGate?.ok ? promptsGate.artifact : undefined };
|
|
@@ -24,8 +53,27 @@ export function buildCandidateRejectedFields(r, verdict, leg, ctx) {
|
|
|
24
53
|
note: "candidate rejected whole (§9.5-5) — live config keeps the last-known-good; fix the named files to unblock",
|
|
25
54
|
};
|
|
26
55
|
}
|
|
27
|
-
export function candidateRejectionOf(r, verdict, source, at) {
|
|
28
|
-
return { version: r.effective.version, domains: verdict.domains, source, at };
|
|
56
|
+
export function candidateRejectionOf(r, verdict, source, at, dir) {
|
|
57
|
+
return { version: r.effective.version, domains: verdict.domains, source, at, errors: verdict.errors, ...(dir !== undefined ? { dir } : {}) };
|
|
58
|
+
}
|
|
59
|
+
const KIND_CAUSE = {
|
|
60
|
+
schema_invalid: "the domain failed its schema",
|
|
61
|
+
empty: "empty file",
|
|
62
|
+
parse_error: "parse error",
|
|
63
|
+
not_object: "not a JSON object",
|
|
64
|
+
too_deep: "nested too deep",
|
|
65
|
+
retired_domain: "retired domain file",
|
|
66
|
+
dangling_symlink: "dangling symbolic link",
|
|
67
|
+
unreadable: "unreadable",
|
|
68
|
+
};
|
|
69
|
+
export function buildCandidateRejectionNotes(rejection) {
|
|
70
|
+
const configDir = rejection.dir === undefined ? undefined : localConfigDirOf(rejection.dir);
|
|
71
|
+
return rejection.errors.map((e) => ({
|
|
72
|
+
document: e.domain,
|
|
73
|
+
code: e.reason,
|
|
74
|
+
cause: KIND_CAUSE[e.kind],
|
|
75
|
+
...(configDir !== undefined ? { path: join(configDir, `${e.domain}.json`) } : {}),
|
|
76
|
+
}));
|
|
29
77
|
}
|
|
30
78
|
export function buildCandidateRejectedWire(rejection) {
|
|
31
79
|
return { domains: [...rejection.domains], at: new Date(rejection.at).toISOString(), source: rejection.source };
|
|
@@ -2,7 +2,10 @@ import { type CenterCredentialSource } from "../center-credential.js";
|
|
|
2
2
|
export declare const SCHEMA_MAJOR_HEADER = "x-sema-schema-major";
|
|
3
3
|
/** 8s:对中心请求 / 响应式调用的传输上界(拉配置 / 两条 principal 视图 / 内容拉取 / 凭证续签同一值)。 */
|
|
4
4
|
export declare const CENTER_PULL_TIMEOUT_MS = 8000;
|
|
5
|
-
/** 已装 settings-schema
|
|
5
|
+
/** 已装 settings-schema 的版本号 —— 本仓**唯一**的读口(包自己的 `./package.json` 出口,JSON 模块导入见上):对中心协商用的 major(下)与能力位
|
|
6
|
+
* `settingsContract.version`(`capabilities/settings-contract.ts`)同读这一只。 */
|
|
7
|
+
export declare const SETTINGS_SCHEMA_VERSION: string;
|
|
8
|
+
/** 已装 settings-schema 的 major(由 {@link SETTINGS_SCHEMA_VERSION} 机器派生)。版本号不成形 ⇒ 模块装载即抛(装坏了的包不该带着一个猜出来的
|
|
6
9
|
* major 去跟中心协商 wire 形)。 */
|
|
7
10
|
export declare const SETTINGS_SCHEMA_MAJOR: string;
|
|
8
11
|
/** 一个中心端点 = 基址 + 凭证来源(`ServiceConfig.webAdmin` 结构上满足)。 */
|
|
@@ -7,8 +7,9 @@ import { buildHttpUrlRefusal } from "../url-refusal.js";
|
|
|
7
7
|
import { egressRedirectRefusal } from "../egress-redirect.js";
|
|
8
8
|
export const SCHEMA_MAJOR_HEADER = "x-sema-schema-major";
|
|
9
9
|
export const CENTER_PULL_TIMEOUT_MS = 8000;
|
|
10
|
+
export const SETTINGS_SCHEMA_VERSION = settingsSchemaPackage.version;
|
|
10
11
|
export const SETTINGS_SCHEMA_MAJOR = (() => {
|
|
11
|
-
const version =
|
|
12
|
+
const version = SETTINGS_SCHEMA_VERSION;
|
|
12
13
|
const m = /^(\d+)\.\d+\.\d+/.exec(version);
|
|
13
14
|
if (m === null)
|
|
14
15
|
throw new Error(`cannot derive ${SCHEMA_MAJOR_HEADER}: @sema-agent/settings-schema package.json has version ${JSON.stringify(version)}`);
|
|
@@ -24,7 +24,6 @@ const GOVERNANCE_DOMAIN_KEY_TABLE = {
|
|
|
24
24
|
};
|
|
25
25
|
export const GOVERNANCE_DOMAIN_KEYS = Object.keys(GOVERNANCE_DOMAIN_KEY_TABLE);
|
|
26
26
|
export const NON_DOMAIN_EFFECTIVE_KEYS = {
|
|
27
|
-
a2a: "R-15 裁开域([4384]),但 settings-schema 至 1.3.0 未开(DOMAINS 无 a2a)——S-31 件2 BLOCKED on schema:远端腿靠 readEffectiveWire 的 open-world verbatim 透传(DESIGN-269),本地腿不可达(FileConfigStore 只读 PORTABLE_DOMAINS)。schema 开域之日按墓碑流程收线。",
|
|
28
27
|
readFace: "R-15 裁**暂不开域**([4384]:env 逐键恒赢语义下收益薄,⚪ 呈现制过渡)——#A4 的远端腿同靠 open-world 透传;本地腿四键由 env / 引擎默认独占。若来日改裁开域,同上墓碑机制。",
|
|
29
28
|
sandboxGit: "契约的 wire-only 键(settings-schema 14.7.0 `EffectiveWire.sandboxGit`):web-admin 按部署登记册投影,不是存储域 —— `buildEffective` 从不产它、`readEffectiveWire` 逐字承运;判它的唯一座位 `SandboxGitConfig` 在 stageEffective 调一次。本地腿不可达(`config.d` 只读便携域)⇒ 本地配置源恒缺席(沙箱 git 平面读 `no_origins`)。",
|
|
30
29
|
};
|
|
@@ -52,5 +52,5 @@ export { mutateInPlace, applyEffective, NO_CENTER_EFFECTIVE, isNoCenterEffective
|
|
|
52
52
|
export { restartReasons, modelPlaneChanged, type RestartSlice, type RestartSliceCtx, type EngineRestartSignal, } from "./restart-signal.js";
|
|
53
53
|
export { applySkillsManifest, installedSkillMatchesManifest, skillManifestEntriesNotInstalled, skillToolListsOf, resolveMcpServers, mcpForScenario, resolveA2aPeers, a2aForScenario } from "./skills-mcp.js";
|
|
54
54
|
export { applyCenterReadFace, buildReadFaceBaseline, buildReadFaceSwapCandidate, restoreReadFaceBaseline, CENTER_READ_FACE_LIVE_KEYS, type CenterReadFaceApply, type CenterReadFaceReport, type ReadFaceBaseline, type ReadFaceSeat } from "./read-face.js";
|
|
55
|
-
export type { CenterSkillManifest, CenterMcpServer,
|
|
55
|
+
export type { CenterSkillManifest, CenterMcpServer, CenterModel, CenterReadFace, EffectiveConfig, ExecutionRuling, SessionMirrorRuling, } from "./types.js";
|
|
56
56
|
//# sourceMappingURL=facade.d.ts.map
|
|
@@ -53,6 +53,7 @@ export declare function fetchPrincipalCaps(center: CenterEndpoint, principal: st
|
|
|
53
53
|
runtimeCaps: EntitlementRuntimeCaps | null;
|
|
54
54
|
configured: boolean;
|
|
55
55
|
scenario?: ScenarioRuling;
|
|
56
|
+
scenarioDrift?: string;
|
|
56
57
|
execution?: ExecutionRuling;
|
|
57
58
|
executionDrift?: string;
|
|
58
59
|
orgMemory?: unknown;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
import { readEffectiveWire, PrincipalCapsWire } from "@sema-agent/settings-schema";
|
|
2
|
+
import { isStringArray, readEffectiveWire, PrincipalCapsWire } from "@sema-agent/settings-schema";
|
|
3
3
|
import { separateRetiredDomains, splitFoldedReadWarnings, withDroppedCatalogEntries } from "./read-warnings.js";
|
|
4
4
|
import { CENTER_PULL_TIMEOUT_MS, centerFetch } from "./center-request.js";
|
|
5
5
|
import { answerStillCurrent } from "../center-credential.js";
|
|
@@ -38,14 +38,7 @@ export async function fetchPrincipalCaps(center, principal, etag, fetchImpl, wor
|
|
|
38
38
|
return {
|
|
39
39
|
runtimeCaps: body.runtimeCaps ?? null,
|
|
40
40
|
configured: Boolean(body.configured),
|
|
41
|
-
...(
|
|
42
|
-
? {
|
|
43
|
-
scenario: {
|
|
44
|
-
scenario: typeof body.scenario === "string" ? body.scenario : null,
|
|
45
|
-
allowlist: Array.isArray(body.allowlist) ? body.allowlist.filter((s) => typeof s === "string") : [],
|
|
46
|
-
},
|
|
47
|
-
}
|
|
48
|
-
: {}),
|
|
41
|
+
...scenarioRulingOf(body),
|
|
49
42
|
...((() => {
|
|
50
43
|
const isRecord = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
51
44
|
const exRaw = body.execution;
|
|
@@ -73,6 +66,21 @@ export async function fetchPrincipalCaps(center, principal, etag, fetchImpl, wor
|
|
|
73
66
|
etag: raw.etag,
|
|
74
67
|
};
|
|
75
68
|
}
|
|
69
|
+
function scenarioRulingOf(body) {
|
|
70
|
+
const hasScenario = "scenario" in body;
|
|
71
|
+
const hasAllowlist = "allowlist" in body;
|
|
72
|
+
if (!hasScenario && !hasAllowlist)
|
|
73
|
+
return {};
|
|
74
|
+
if (!hasScenario || !hasAllowlist)
|
|
75
|
+
return { scenarioDrift: `${hasScenario ? "allowlist" : "scenario"} is missing while ${hasScenario ? "scenario" : "allowlist"} is present` };
|
|
76
|
+
const { scenario, allowlist } = body;
|
|
77
|
+
if (scenario !== null && typeof scenario !== "string")
|
|
78
|
+
return { scenarioDrift: `scenario is ${Array.isArray(scenario) ? "array" : typeof scenario}, expected string or null` };
|
|
79
|
+
if (!isStringArray(allowlist)) {
|
|
80
|
+
return { scenarioDrift: Array.isArray(allowlist) ? "allowlist has a non-string element, expected string[]" : `allowlist is ${allowlist === null ? "null" : typeof allowlist}, expected string[]` };
|
|
81
|
+
}
|
|
82
|
+
return { scenario: { scenario: typeof scenario === "string" ? scenario : null, allowlist: [...allowlist] } };
|
|
83
|
+
}
|
|
76
84
|
function assertPrincipalEcho(echoed, principal) {
|
|
77
85
|
if (echoed !== undefined && echoed !== principal) {
|
|
78
86
|
throw new Error(`web-admin principal-caps response echoes principal ${JSON.stringify(echoed)} but ${JSON.stringify(principal)} was requested — discarding the whole response`);
|
|
@@ -2,6 +2,7 @@ import { resolveActiveTiers, resolveCatalogDefaultModel } from "@sema-agent/sett
|
|
|
2
2
|
import { stableStringify } from "@sema-agent/settings-schema/hash";
|
|
3
3
|
import { DEFAULT_PLUGIN_ALLOW_HOSTS, materializablePlugins } from "../capabilities/center-plugins.js";
|
|
4
4
|
import { CENTER_READ_FACE_LIVE_KEYS } from "./read-face.js";
|
|
5
|
+
import { enabledA2aPeerView } from "./skills-mcp.js";
|
|
5
6
|
const RESTART_SLICES = ["skills", "mcp", "a2a", "scenarios", "degrade-route", "read-face", "memory-consolidation"];
|
|
6
7
|
function enabledOnly(rows) {
|
|
7
8
|
if (!rows)
|
|
@@ -41,8 +42,10 @@ function restartSliceValue(eff, slice, ctx) {
|
|
|
41
42
|
}
|
|
42
43
|
case "mcp":
|
|
43
44
|
return enabledOnly(eff.mcp?.servers);
|
|
44
|
-
case "a2a":
|
|
45
|
-
|
|
45
|
+
case "a2a": {
|
|
46
|
+
const views = (eff.a2a?.peers ?? []).flatMap((peer) => enabledA2aPeerView(peer) ?? []);
|
|
47
|
+
return views.length > 0 ? views : null;
|
|
48
|
+
}
|
|
46
49
|
case "scenarios":
|
|
47
50
|
return enabledOnly(eff.scenarios?.scenarios);
|
|
48
51
|
case "read-face": {
|
|
@@ -4,7 +4,8 @@ import type { Logger } from "../observability/logger.js";
|
|
|
4
4
|
import { type PeerDesk, type PeerLease } from "../peer-seat.js";
|
|
5
5
|
import type { LoadedSkill } from "../capabilities/skills.js";
|
|
6
6
|
import type { ConfigProvider } from "../config-provider.js";
|
|
7
|
-
import type {
|
|
7
|
+
import type { CenterMcpServer, CenterSkillManifest } from "./types.js";
|
|
8
|
+
import type { A2aConfig, A2aPeerSpec } from "@sema-agent/settings-schema";
|
|
8
9
|
/**
|
|
9
10
|
* 技能正文的来源 = **拉到这份清单的配置源自己**([ref]):`fetchSkillContent(contentHash)` 按 hash 答正文 —— 远程 = 中心内容端点
|
|
10
11
|
* (传输自验 hash;未知 hash ⇒ `undefined`),本地 = config.d 里内联的正文(与清单同一种容错读);`skillBodyCacheDir` = 这只配置源
|
|
@@ -68,8 +69,8 @@ export declare function resolveMcpServers(mcp: {
|
|
|
68
69
|
* [ref]:alias 窗撤销,单键命中(同 `skillsForScenario`)。 */
|
|
69
70
|
export declare function mcpForScenario(center: CenterMcp | undefined, scenario: string): McpServerSpec[] | undefined;
|
|
70
71
|
/**
|
|
71
|
-
* DESIGN-269 §2.1 —— resolve
|
|
72
|
-
* each applies to. Exact sibling of {@link resolveMcpServers}, same three rules:
|
|
72
|
+
* DESIGN-269 §2.1 —— resolve the deployment's A2A peers (the `a2a` domain: `config.d/a2a.json` on the local leg, `/effective.a2a` on the
|
|
73
|
+
* center leg — one declaration seat, both legs read through the contract) into core `A2aServerSpec`s + the scenarios each applies to. Exact sibling of {@link resolveMcpServers}, same three rules:
|
|
73
74
|
* · header-NAME refs → real values from THIS service's env (the secret boundary is unchanged — the center
|
|
74
75
|
* never holds the bearer), registered on `desk` under `rosterLease` (`mintDeclaration`, only for a peer that mounts); the spec carries the minted
|
|
75
76
|
* reference, never the values. A peer with ANY missing ref is SKIPPED wholesale (`resolveRefs` → null):
|
|
@@ -85,9 +86,22 @@ export declare function mcpForScenario(center: CenterMcp | undefined, scenario:
|
|
|
85
86
|
* the caller. Absent face > a face that quietly launders trust. (`allowSkills` is the operator's real
|
|
86
87
|
* knob here: narrow WHAT mounts, never re-label what it does.)
|
|
87
88
|
*/
|
|
88
|
-
export declare function resolveA2aPeers(a2a:
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
export declare function resolveA2aPeers(a2a: A2aConfig, desk: Pick<PeerDesk, "declare">, rosterLease: PeerLease, logger?: Logger): ScopedA2aPeer[];
|
|
90
|
+
/** 解析器从一条 a2a 对端上真读的七键,读成同一件事的写法归一成一形:`cardUrl` / `principalHeader` 空串 ≡ 缺席、`allowSkills` 空表 ≡ 缺席
|
|
91
|
+
* (不收窄)、`headerRefs` 空记录 ≡ 缺席(没有件)、`scenarios` 缺席 ≡ `[]`(全场景)。禁用的对端 ⇒ undefined(解析器跳过,零运行期效果)。
|
|
92
|
+
* 两个读者:{@link resolveA2aPeers}(拨号的输入就是它)与 restart 片 `a2a`(指纹的就是它 —— 只指纹真重启的字段,与模型条目同律)。
|
|
93
|
+
* 七键名单只在这里成文:解析器多读一个键而这里没投 ⇒ 解析器读不到(编译红);片不会漏签。
|
|
94
|
+
* `enabled` / `scenarios` 按可缺席读:型上它们恒在(契约读口补缺省),但 LKG 回放不经读口(删除条件同解析器的名字臂)。 */
|
|
95
|
+
export interface A2aPeerView {
|
|
96
|
+
name: string;
|
|
97
|
+
url: string;
|
|
98
|
+
cardUrl?: string;
|
|
99
|
+
headerRefs?: Record<string, string>;
|
|
100
|
+
principalHeader?: string;
|
|
101
|
+
allowSkills?: string[];
|
|
102
|
+
scenarios: string[];
|
|
103
|
+
}
|
|
104
|
+
export declare function enabledA2aPeerView(peer: A2aPeerSpec): A2aPeerView | undefined;
|
|
91
105
|
/** The A2A peers applicable to a scenario: tagged with it, or untagged (global). undefined when none.
|
|
92
106
|
* Twin of {@link mcpForScenario} — `undefined` (not `[]`) is load-bearing: an empty array would put an
|
|
93
107
|
* `a2a: []` key on the spec, i.e. "this deployment declares an empty peer set", where absence means
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { readMcpSourceLabel } from "../mcp-source-label.js";
|
|
2
2
|
import { skillContentHash } from "@sema-agent/settings-schema";
|
|
3
|
-
import { judgeSessionMetaKey, readMcpToolAxes, readToolFaces } from "@sema-agent/core";
|
|
3
|
+
import { ensureDir, judgeSessionMetaKey, readMcpToolAxes, readToolFaces } from "@sema-agent/core";
|
|
4
4
|
import { MCP_CONTENT_ORIGINS, describeBadContentOrigin, describeBadWireName, isContentOriginWord, isUsableWireName } from "@sema-agent/settings-schema";
|
|
5
5
|
import { noteMcpAssertionHeaderNotSent, withholdsMcpAssertionHeader } from "../mcp-assertion-header.js";
|
|
6
6
|
import { mintDeclaration, peerSentence } from "../peer-seat.js";
|
|
7
7
|
import { SHA256_HEX_RE } from "../digest-form.js";
|
|
8
|
+
import { atomicWriteFileAsync } from "../plugins/owner-only-file-mode.js";
|
|
8
9
|
export function skillToolListsOf(source) {
|
|
9
10
|
return {
|
|
10
11
|
...(source.allowedTools !== undefined ? { allowedTools: [...source.allowedTools] } : {}),
|
|
@@ -62,10 +63,8 @@ export async function applySkillsManifest(baseline, manifest, bodies, logger) {
|
|
|
62
63
|
return;
|
|
63
64
|
const hex = hash.replace(/^sha256:/, "");
|
|
64
65
|
pendingWrites.push((async () => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
await fsp.writeFile(tmp, content, { mode: 0o600 });
|
|
68
|
-
await fsp.rename(tmp, joinPath(diskCacheDir, hex));
|
|
66
|
+
ensureDir(diskCacheDir);
|
|
67
|
+
await atomicWriteFileAsync(joinPath(diskCacheDir, hex), content, { durability: "best-effort" });
|
|
69
68
|
})().catch((err) => logger?.warn("web_admin_skill_cache_write_failed", { hash, err: String(err) })));
|
|
70
69
|
};
|
|
71
70
|
const byName = new Map(baseline.map((s) => [s.spec.name, s]));
|
|
@@ -211,35 +210,41 @@ export function mcpForScenario(center, scenario) {
|
|
|
211
210
|
}
|
|
212
211
|
export function resolveA2aPeers(a2a, desk, rosterLease, logger) {
|
|
213
212
|
const out = [];
|
|
214
|
-
for (const
|
|
215
|
-
|
|
213
|
+
for (const declared of a2a.peers ?? []) {
|
|
214
|
+
const view = enabledA2aPeerView(declared);
|
|
215
|
+
if (view === undefined)
|
|
216
216
|
continue;
|
|
217
|
-
if (!isUsableWireName(
|
|
217
|
+
if (!isUsableWireName(view.name)) {
|
|
218
218
|
logger?.warn("web_admin_a2a_name_unusable", {
|
|
219
|
-
peer: describeBadWireName(
|
|
219
|
+
peer: describeBadWireName(view.name),
|
|
220
220
|
note: "peer SKIPPED — an A2A peer name is its identity (it lands as the roster's `origin.peer`) and core REFUSES an out-of-bound name at prepare, which would fail every task in this scenario. Shorten the name and republish; sibling peers are unaffected.",
|
|
221
221
|
});
|
|
222
222
|
continue;
|
|
223
223
|
}
|
|
224
|
-
const
|
|
224
|
+
const { headerRefs, scenarios, ...spec } = view;
|
|
225
|
+
const headers = resolveRefs(headerRefs, spec.name, "header", logger, "web_admin_a2a_env_missing", "skipping this A2A peer — referenced env var is unset in this service");
|
|
225
226
|
if (headers === null)
|
|
226
227
|
continue;
|
|
227
|
-
const draft = {
|
|
228
|
-
|
|
229
|
-
name: p.name,
|
|
230
|
-
url: p.url,
|
|
231
|
-
...(p.cardUrl ? { cardUrl: p.cardUrl } : {}),
|
|
232
|
-
...(p.principalHeader ? { principalHeader: p.principalHeader } : {}),
|
|
233
|
-
...(p.allowSkills && p.allowSkills.length > 0 ? { allowSkills: p.allowSkills } : {}),
|
|
234
|
-
},
|
|
235
|
-
pieces: headers,
|
|
236
|
-
};
|
|
237
|
-
out.push({ scenarios: p.scenarios ?? [], spec: mintDeclaration(desk, draft, rosterLease) });
|
|
228
|
+
const draft = { spec, pieces: headers };
|
|
229
|
+
out.push({ scenarios, spec: mintDeclaration(desk, draft, rosterLease) });
|
|
238
230
|
}
|
|
239
231
|
if (out.length > 0)
|
|
240
232
|
logger?.info("web_admin_a2a", { peers: out.map((p) => p.spec.name) });
|
|
241
233
|
return out;
|
|
242
234
|
}
|
|
235
|
+
export function enabledA2aPeerView(peer) {
|
|
236
|
+
if (peer.enabled === false)
|
|
237
|
+
return undefined;
|
|
238
|
+
return {
|
|
239
|
+
name: peer.name,
|
|
240
|
+
url: peer.url,
|
|
241
|
+
...(peer.cardUrl ? { cardUrl: peer.cardUrl } : {}),
|
|
242
|
+
...(peer.headerRefs && Object.keys(peer.headerRefs).length > 0 ? { headerRefs: peer.headerRefs } : {}),
|
|
243
|
+
...(peer.principalHeader ? { principalHeader: peer.principalHeader } : {}),
|
|
244
|
+
...(peer.allowSkills && peer.allowSkills.length > 0 ? { allowSkills: peer.allowSkills } : {}),
|
|
245
|
+
scenarios: peer.scenarios ?? [],
|
|
246
|
+
};
|
|
247
|
+
}
|
|
243
248
|
export function a2aForScenario(peers, scenario) {
|
|
244
249
|
if (!peers || peers.length === 0)
|
|
245
250
|
return undefined;
|