@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
|
@@ -2,6 +2,7 @@ import { execFile } from "node:child_process";
|
|
|
2
2
|
import { promisify } from "node:util";
|
|
3
3
|
import { promises as fsp, realpathSync, existsSync, readFileSync, lstatSync, statSync } from "node:fs";
|
|
4
4
|
import { join, resolve, isAbsolute, sep } from "node:path";
|
|
5
|
+
import { ensureDir } from "@sema-agent/core";
|
|
5
6
|
import { assertConfined, loadSkills } from "./skills.js";
|
|
6
7
|
import { buildDisplaySafeUrl, redactSecrets } from "../trace/redact.js";
|
|
7
8
|
import { gitSubprocessEnv } from "../server-secret-env.js";
|
|
@@ -132,6 +133,9 @@ export function materializablePlugins(eff, allowHosts) {
|
|
|
132
133
|
return v.ok ? [{ name: v.name, url: v.url, ...(v.sha !== undefined ? { sha: v.sha } : {}) }] : [];
|
|
133
134
|
});
|
|
134
135
|
}
|
|
136
|
+
export function pluginCacheRootFor(dataRoot) {
|
|
137
|
+
return join(dataRoot, "plugin-cache");
|
|
138
|
+
}
|
|
135
139
|
export async function applyCenterPlugins(baseline, eff, opts) {
|
|
136
140
|
const shape = declaredPlugins(eff);
|
|
137
141
|
const out = { skills: [...baseline], failures: [], letGo: [], lkgUsed: [] };
|
|
@@ -165,12 +169,12 @@ export async function applyCenterPlugins(baseline, eff, opts) {
|
|
|
165
169
|
let materialized = false;
|
|
166
170
|
try {
|
|
167
171
|
await fsp.rm(staging, { recursive: true, force: true });
|
|
168
|
-
|
|
172
|
+
ensureDir(staging);
|
|
169
173
|
const plan = gitClonePlan({ url: v.url, dest: staging, sha: v.sha });
|
|
170
174
|
for (const step of plan.steps)
|
|
171
175
|
await runGit(step);
|
|
172
176
|
await fsp.rm(liveDir, { recursive: true, force: true });
|
|
173
|
-
|
|
177
|
+
ensureDir(join(opts.cacheRoot, v.name));
|
|
174
178
|
await fsp.rename(staging, liveDir);
|
|
175
179
|
materialized = true;
|
|
176
180
|
}
|
|
@@ -47,6 +47,7 @@ export declare const COMPOSITE_CAPABILITY_MEMBERS: {
|
|
|
47
47
|
readonly background: readonly ["listFace", "exitFaces"];
|
|
48
48
|
readonly taskSettings: readonly ["permissions", "permissionMode", "model", "outputStyle", "env", "hooks", "pluginHooks", "managedHookGroups", "httpHookAllowlists", "tightenOnlySeats", "approvalFrameFamilies", "autoCompactEnabled"];
|
|
49
49
|
readonly settings: readonly ["permissions"];
|
|
50
|
+
readonly settingsContract: readonly ["version", "hookEntryFields"];
|
|
50
51
|
readonly permissionModeAuto: readonly ["accepted", "classifierSeat", "entitlementSource", "armed", "reason", "model"];
|
|
51
52
|
readonly writeProtection: readonly ["armed", "rows", "replaced"];
|
|
52
53
|
readonly executionLane: readonly ["provider", "toolsOnThisHost", "isolated"];
|
|
@@ -8,6 +8,7 @@ export const COMPOSITE_CAPABILITY_MEMBERS = {
|
|
|
8
8
|
background: ["listFace", "exitFaces"],
|
|
9
9
|
taskSettings: ["permissions", "permissionMode", "model", "outputStyle", "env", "hooks", "pluginHooks", "managedHookGroups", "httpHookAllowlists", "tightenOnlySeats", "approvalFrameFamilies", "autoCompactEnabled"],
|
|
10
10
|
settings: ["permissions"],
|
|
11
|
+
settingsContract: ["version", "hookEntryFields"],
|
|
11
12
|
permissionModeAuto: ["accepted", "classifierSeat", "entitlementSource", "armed", "reason", "model"],
|
|
12
13
|
writeProtection: ["armed", "rows", "replaced"],
|
|
13
14
|
executionLane: ["provider", "toolsOnThisHost", "isolated"],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type ExecutionLane
|
|
1
|
+
import { type ExecutionLane } from "../execution-lane-caps.js";
|
|
2
2
|
export interface ExecutionLaneCapability {
|
|
3
|
-
/** 本部署的执行车道词(闭集 = {@link ExecutionLane}
|
|
3
|
+
/** 本部署的执行车道词(闭集 = {@link ExecutionLane} 八词;合成之后恒是部署声明的那一条;无手 = 声明的 `"none"`,见头注)。 */
|
|
4
4
|
readonly provider: ExecutionLane;
|
|
5
5
|
/** 工具跑的那台机器就是本进程这台吗(= server 盘上的绝对路径对模型的工具有没有意义)。
|
|
6
6
|
* 属主 = 部署形表行 `toolsOnThisHost`,与 `skills[].baseDir` 的铸点同一行。 */
|
|
@@ -11,13 +11,13 @@ export interface ExecutionLaneCapability {
|
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* 部署席 → 消费端窄投影。形照 `projectWebSearchCapability` / `projectSqlEngineCapability`:
|
|
14
|
-
* 不碰 config.ts(
|
|
14
|
+
* 不碰 config.ts(只从车道表模块取能力位,那是叶),于是本模块是叶。
|
|
15
15
|
*
|
|
16
|
-
* 🔴 本处**不写**任何缺席折词([ref] 门 D)
|
|
16
|
+
* 🔴 本处**不写**任何缺席折词([ref] 门 D):入参是已合成的配置,车道必在(没有声明的部署在合成步拒启)。
|
|
17
17
|
*/
|
|
18
18
|
export declare function projectExecutionLaneCapability(config: {
|
|
19
|
-
readonly remoteExec
|
|
20
|
-
readonly provider:
|
|
21
|
-
}
|
|
19
|
+
readonly remoteExec: {
|
|
20
|
+
readonly provider: ExecutionLane;
|
|
21
|
+
};
|
|
22
22
|
}): ExecutionLaneCapability;
|
|
23
23
|
//# sourceMappingURL=execution-lane.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DEPLOYMENT_SHAPE_PREDICATES } from "../deployment-shape.js";
|
|
2
|
-
import {
|
|
2
|
+
import { laneIsolated, laneWiresExecutionEnv } from "../execution-lane-caps.js";
|
|
3
3
|
export function projectExecutionLaneCapability(config) {
|
|
4
|
-
const lane =
|
|
4
|
+
const lane = config.remoteExec.provider;
|
|
5
5
|
const handsWired = laneWiresExecutionEnv(lane);
|
|
6
6
|
return {
|
|
7
7
|
provider: lane,
|
|
@@ -42,7 +42,7 @@ export declare function pickHandsRunner(hands: ScenarioHands, pair: HandsRunnerP
|
|
|
42
42
|
/**
|
|
43
43
|
* 一个场景在一台部署上起的 run **有没有工作区** —— core prepare 的 `handsEnabled`(`ownedEnv || deps.executionEnv`)在本仓的镜像,**唯一一只判官**。
|
|
44
44
|
* 两个条件缺一不可:场景挂手({@link pickHandsRunner} 选有手 Runner,即带 `executionEnvFactory` 的那只)∧ 这台部署的执行车道有手
|
|
45
|
-
* (`execution-lane-caps.ts` 的 `laneWiresExecutionEnv`:`
|
|
45
|
+
* (`execution-lane-caps.ts` 的 `laneWiresExecutionEnv`:`none` 车道整台没有 factory)。引擎对 `userAttachments` 里 `path` 条目的拒
|
|
46
46
|
* (`config.user_attachment_invalid`「this run has no workspace」)与场景详情读面的 `attachmentSupplies` 都落在这一只的答案上。
|
|
47
47
|
* **穷举 switch**:`ScenarioHands` 加词而此处不表态 = 编译红(与 {@link pickHandsRunner} 同一条纪律)。
|
|
48
48
|
*/
|
|
@@ -73,10 +73,9 @@ export declare function buildExcludeToolsSeat(scenarioExcludes: readonly string[
|
|
|
73
73
|
*/
|
|
74
74
|
export interface ScenarioContext {
|
|
75
75
|
/**
|
|
76
|
-
* 本请求的会话 id。属主 = `boot/resolve-spec.ts` 的 `
|
|
77
|
-
*
|
|
78
|
-
* 等于让一个租户读另一个租户的清单(同 spec
|
|
79
|
-
* body」的逐字纪律)。
|
|
76
|
+
* 本请求的会话 id。属主 = `boot/resolve-spec.ts` 的 `root`(= `opts.execution.root`:authorizer 解析 + 归属校验
|
|
77
|
+
* 过的那一只,续跑 = checkpoint 的会话),**绝不是 `body.sessionId`** —— 后者是调用方自报串,拿它当会话级设施的分区键
|
|
78
|
+
* 等于让一个租户读另一个租户的清单(同 spec 组装处那条「根来自执行上下文,绝不来自请求体」的逐字纪律)。
|
|
80
79
|
*
|
|
81
80
|
* 缺席 = 这条调用形本来就没有会话(`parked-revive-surface.ts` 对不交座的行、boot 期那一次 Agent 工具探针、
|
|
82
81
|
* `builtinScenarioDetails` 的工具名探针)。此时会话级设施退化为 per-call 实例 —— 不为它发明
|
|
@@ -105,7 +104,7 @@ export interface ScenarioDeps {
|
|
|
105
104
|
* could exfil via an arbitrary public URL; the SSRF floor only blocks internal). Single-user TOC keeps WebFetch. */
|
|
106
105
|
requirePrincipal?: boolean;
|
|
107
106
|
/**
|
|
108
|
-
* [ref]:这台部署的执行车道**有没有手**(`laneWiresExecutionEnv
|
|
107
|
+
* [ref]:这台部署的执行车道**有没有手**(`laneWiresExecutionEnv`;声明 `REMOTE_EXEC=none` = 没有)。场景详情读面据它与场景自己的 `hands` 表态一起答
|
|
109
108
|
* 「这个场景的 run 有没有工作区」({@link runHasWorkspace}),进而给出附件可受理供给集。**缺席按没有手读**(宁少说不多说:不广告一个会撞 400 的 `path`)。
|
|
110
109
|
*/
|
|
111
110
|
handsLane?: boolean;
|
|
@@ -350,6 +349,16 @@ export interface ScenarioRuling {
|
|
|
350
349
|
/** 纯场景名集合(principal/组名不上 wire);空 = 该 principal 无任何指派 = 无治理。 */
|
|
351
350
|
allowlist: string[];
|
|
352
351
|
}
|
|
352
|
+
/**
|
|
353
|
+
* 一次中心裁定读数(`principalCaps.scenarioRuling` / `peekScenarioRuling` 的答)—— **三态,各恰一条出路**({@link gateScenarioRequest} 逐态判):
|
|
354
|
+
* · {@link ScenarioRuling} —— 中心答了治理两键 ⇒ 按它执法(指派为缺省、白名单限点名);
|
|
355
|
+
* · `undefined`(**缺席**)—— 这一问没有中心可问,或中心答了但不管场景:部署没接中心(无中心 / 干跑 / `run-local` / 嵌入方不给)、
|
|
356
|
+
* 匿名运行(无 principal,零中心往返)、旧中心不发治理两键 ⇒ 无治理,请求名或部署缺省;
|
|
357
|
+
* · `"unavailable"`(**故障**)—— 部署接了中心、请求带 principal,而这一问答不出来:不可达 / 超时 / 答复读不出(非 2xx、体判坏、
|
|
358
|
+
* 回声不符、在飞期间凭据身份换了)/ 治理两键形不对 ⇒ 该 run 拒。这位主体此刻的指派与白名单不可知:缺省链可能比他的指派更宽,点名也判不了白名单。
|
|
359
|
+
* 缺席与故障的界画在「有没有中心可问」:读数的客户端只在部署接了中心时存在,没接中心的部署走不到故障态。
|
|
360
|
+
*/
|
|
361
|
+
export type ScenarioRulingRead = ScenarioRuling | "unavailable" | undefined;
|
|
353
362
|
/**
|
|
354
363
|
* 一个场景名的**来源**(闭集:新增一词 ⇒ {@link danglingScenarioRefusal} 的穷尽 switch 编译红)。
|
|
355
364
|
* · `ruling` —— 中心按主体指派的场景(`ScenarioRuling.scenario`);
|
|
@@ -373,17 +382,21 @@ export declare function danglingScenarioRefusal(name: string, source: ScenarioNa
|
|
|
373
382
|
/**
|
|
374
383
|
* resolveSpec 的执法入口(指派为默认、body.scenario 可换但限 allowlist)。返回本请求的
|
|
375
384
|
* **在册**生效场景名 —— 返回值一定在 `known` 里:下游直接按它取场景,没有「未知名 → default」的回退臂。
|
|
385
|
+
* 读数 `ruling` 三态各一条出路({@link ScenarioRulingRead}),判序:
|
|
386
|
+
*
|
|
387
|
+
* 1. body.scenario 显式给出而不在册 ⇒ typed 400 `scenario_unknown`(调用方的错;词表面先于治理面,不等中心)。
|
|
388
|
+
* 2. 读数 `"unavailable"`(中心配了却答不出)⇒ 503 `state.scenario_assignment_unavailable`(体 `permanence: "transient"`:这一拍答不出,
|
|
389
|
+
* 不是准入策略 —— 续跑腿据它不折成 409 `resume_blocked_by_policy`,见 `http/checkpoint-ctx.ts` 的 `resumeAssemblyRefusalAnswer`),点名与不点名同拒 ——
|
|
390
|
+
* 这位主体的指派与白名单此刻不可知,缺省链不能替他答,点名也判不了白名单。运维日志一行 `scenario_assignment_unavailable`(`principal`;
|
|
391
|
+
* 取数失败本身由主体客户端的 `onError` 另记一行)。
|
|
392
|
+
* 3. body.scenario 显式给出(在册):白名单非空且集外 ⇒ typed 400 `scenario_not_allowed`(附 allowlist —— 机器码归 wire、人话归壳 / web);
|
|
393
|
+
* 集内,或白名单为空(缺席 / 中心答了「无指派」)⇒ 用户主动切换赢。
|
|
394
|
+
* 4. body.scenario 未给:ruling 胜者 ⇒ 指派为默认;无胜者(缺席 / `scenario: null`)⇒ defaultScenario。链上的名字不在册 ⇒ 503
|
|
395
|
+
* `state.scenario_assignment_unknown`(部署的错 / 中心的错,不是调用方的错),**不**折 default({@link danglingScenarioRefusal})。
|
|
376
396
|
*
|
|
377
|
-
*
|
|
378
|
-
* (400 `scenario_not_allowed`,附 allowlist ——机器码归 wire、人话归壳/web);集内 ⇒ 用户主动切换赢。allowlist 为空
|
|
379
|
-
* (无 ruling / 该 principal 三层皆无指派 / caps 面故障)⇒ 无治理约束,现状放行(与「null 落兜底链」同一语义:分配面未覆盖 =
|
|
380
|
-
* 不收紧,恒不比没有治理时更宽;caps 故障不把用户锁死在 default——场景切换不是权限放大面,fail-open
|
|
381
|
-
* 到现状,与 workflows 面的 fail-closed 是刻意的 posture 差异,见 runtime-caps-resolver)。
|
|
382
|
-
* - body.scenario 未给:ruling 胜者 ⇒ 指派为默认;无胜者 ⇒ defaultScenario 现状链。链上的名字不在册 ⇒ 503
|
|
383
|
-
* `state.scenario_assignment_unknown`(部署的错 / 中心的错,不是调用方的错),**不**折 default
|
|
384
|
-
* ({@link danglingScenarioRefusal})。`principal` 只进那一行运维日志,不参与判定。
|
|
397
|
+
* `principal` 只进运维日志,不参与判定。
|
|
385
398
|
*/
|
|
386
|
-
export declare function gateScenarioRequest(ruling:
|
|
399
|
+
export declare function gateScenarioRequest(ruling: ScenarioRulingRead, bodyScenario: unknown, defaultScenario: string, known: readonly string[], logger?: Logger, principal?: string): string;
|
|
387
400
|
/**
|
|
388
401
|
* 一条请求的场景名过门 —— {@link gateScenarioRequest} 的**唯一一处实参装配**。
|
|
389
402
|
*
|
|
@@ -395,7 +408,8 @@ export declare function gateScenarioRequest(ruling: ScenarioRuling | undefined,
|
|
|
395
408
|
*
|
|
396
409
|
* 契约:`(principal, requested) => 在册的场景名`(返回值一定在册;被拒 ⇒ 抛 {@link gateScenarioRequest} 的那几只 typed 错,
|
|
397
410
|
* 读口不改写)。`requested` 非串(缺席)⇒ 门走指派链(ruling 胜者,否则部署缺省),与 run 时同一读法。
|
|
398
|
-
* `principalCaps` 缺席(无中心 / 干跑 / 嵌入方 / `run-local`)⇒
|
|
411
|
+
* `principalCaps` 缺席(无中心 / 干跑 / 嵌入方 / `run-local`)⇒ 读数恒缺席,门走「请求名或部署缺省」那条链;
|
|
412
|
+
* 在场 ⇒ 它的读数三态({@link ScenarioRulingRead})原样交门,故障态由门拒。
|
|
399
413
|
*/
|
|
400
414
|
export interface ScenarioGateSources {
|
|
401
415
|
readonly config: {
|
|
@@ -404,8 +418,8 @@ export interface ScenarioGateSources {
|
|
|
404
418
|
/** 场景表(活引用):词表按调用时的自有键取,与表同生同灭。 */
|
|
405
419
|
readonly scenarios: Readonly<Record<string, unknown>>;
|
|
406
420
|
readonly principalCaps: {
|
|
407
|
-
scenarioRuling(principal: string | undefined): Promise<
|
|
408
|
-
peekScenarioRuling(principal: string | undefined): Promise<
|
|
421
|
+
scenarioRuling(principal: string | undefined): Promise<ScenarioRulingRead>;
|
|
422
|
+
peekScenarioRuling(principal: string | undefined): Promise<ScenarioRulingRead>;
|
|
409
423
|
} | undefined;
|
|
410
424
|
readonly logger?: Logger;
|
|
411
425
|
}
|
|
@@ -413,7 +427,7 @@ export type ScenarioGate = (principal: string | undefined, requested: unknown) =
|
|
|
413
427
|
/**
|
|
414
428
|
* 门问中心裁定走哪条腿(闭集;新增一词 ⇒ 下面的穷尽 `switch` 编译红)—— 与 `resolveRuntimeCaps` / `peekRuntimeCaps` 是同一对:
|
|
415
429
|
* · `enforce` —— 任务提交腿:中心裁定走执法腿,center 硬失败铸下的 fail-closed 降级项两腿都认;
|
|
416
|
-
* · `peek` —— 读面(`GET /v1/capabilities/mcp` 状态面、`GET /v1/sessions/:id/mcp` / `…/a2a` 两张会话面板):只读腿,同一只缓存 / 同一条抓取 /
|
|
430
|
+
* · `peek` —— 读面(`GET /v1/capabilities/mcp` 状态面、`GET /v1/sessions/:id/mcp` / `…/a2a` 两张会话面板):只读腿,同一只缓存 / 同一条抓取 / 同一份读数(中心答不出 ⇒ 读面同拒),但硬失败铸的降级项只对读面自己算数,
|
|
417
431
|
* 不替这个主体的真提交留下 `{allowWorkflows:false, allowFork:false, autoMode:false}` 的短窗 deny(读面不许成为别人被拒的原因)。
|
|
418
432
|
*/
|
|
419
433
|
export type ScenarioGateLeg = "enforce" | "peek";
|
|
@@ -285,6 +285,7 @@ export function buildRunSkills(args, logger) {
|
|
|
285
285
|
logger?.warn("user_skills_dropped", { reason: "name reserved by scenario (or duplicate)", names: dropped });
|
|
286
286
|
return { specs, roster };
|
|
287
287
|
}
|
|
288
|
+
const SCENARIO_ASSIGNMENT_UNAVAILABLE_REFUSAL = "this principal's scenario assignment could not be read — the configuration center did not answer (unreachable, timed out, or an unreadable reply), so no scenario was assigned and nothing ran — retry once the center answers again (the operator restores the link from this deployment to its configuration center)";
|
|
288
289
|
function registeredScenariosClause(known) {
|
|
289
290
|
return `this deployment's scenarios are: ${known.join(", ")}`;
|
|
290
291
|
}
|
|
@@ -303,22 +304,25 @@ export function danglingScenarioRefusal(name, source, known) {
|
|
|
303
304
|
}
|
|
304
305
|
}
|
|
305
306
|
export function gateScenarioRequest(ruling, bodyScenario, defaultScenario, known, logger, principal) {
|
|
307
|
+
if (typeof bodyScenario === "string" && !known.includes(bodyScenario)) {
|
|
308
|
+
throw new HttpError(400, `unknown scenario "${bodyScenario}" — ${registeredScenariosClause(known)}`, {
|
|
309
|
+
code: "scenario_unknown",
|
|
310
|
+
extra: { known: [...known] },
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
if (ruling === "unavailable") {
|
|
314
|
+
logger?.warn("scenario_assignment_unavailable", principal !== undefined ? { principal } : {});
|
|
315
|
+
throw createCodedHttpError(503, "state.scenario_assignment_unavailable", SCENARIO_ASSIGNMENT_UNAVAILABLE_REFUSAL, { permanence: "transient" });
|
|
316
|
+
}
|
|
306
317
|
if (typeof bodyScenario === "string") {
|
|
307
|
-
const requested = bodyScenario;
|
|
308
|
-
if (!known.includes(requested)) {
|
|
309
|
-
throw new HttpError(400, `unknown scenario "${bodyScenario}" — ${registeredScenariosClause(known)}`, {
|
|
310
|
-
code: "scenario_unknown",
|
|
311
|
-
extra: { known: [...known] },
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
318
|
const allowed = ruling?.allowlist ?? [];
|
|
315
|
-
if (allowed.length > 0 && !allowed.includes(
|
|
319
|
+
if (allowed.length > 0 && !allowed.includes(bodyScenario)) {
|
|
316
320
|
throw new HttpError(400, `scenario "${bodyScenario}" is not in this principal's assigned allowlist`, {
|
|
317
321
|
code: "scenario_not_allowed",
|
|
318
322
|
extra: { allowlist: allowed },
|
|
319
323
|
});
|
|
320
324
|
}
|
|
321
|
-
return
|
|
325
|
+
return bodyScenario;
|
|
322
326
|
}
|
|
323
327
|
const [name, source] = ruling?.scenario != null ? [ruling.scenario, "ruling"] : [defaultScenario, "deployment"];
|
|
324
328
|
const refusal = danglingScenarioRefusal(name, source, known);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `GET /v1/capabilities` 的 `settingsContract` 位 —— **本服务内嵌的设置契约是哪一版、它的读者对每一型 hook 条目携带哪些字段**(版本位:恒在场,不随部署形变)。
|
|
3
|
+
*
|
|
4
|
+
* ## 病
|
|
5
|
+
* 一个键会不会被本服务的读者当契约外键剥掉(续跑重放腿)/ 在新提交面 400(键闭集门),今天消费方只能靠自己维护的「哪一版服务端认哪些键」代际表猜 ——
|
|
6
|
+
* 契约包一升版(例:19.0.0 起 command 条目承运 `args` / `onFailure`、http 条目承运 `onFailure`),那张表就漂。答案的真源在读者这一侧,所以由读者说。
|
|
7
|
+
*
|
|
8
|
+
* ## 形
|
|
9
|
+
* `{ version: string, hookEntryFields: { command | prompt | agent | http | mcp_tool: string[] } }`:
|
|
10
|
+
* · `version` —— 已装 `@sema-agent/settings-schema` 的 package.json 版本号,读口唯一(`web-admin-client/center-request.ts` 的 {@link SETTINGS_SCHEMA_VERSION},对中心协商的 major 也由它派生);
|
|
11
|
+
* · `hookEntryFields` —— 契约条目字段表按型的投影,**只投键名,不投取值类**;列序 = 契约分类器装上的条目的键序(判别位 `type` 不在列里)。
|
|
12
|
+
* 值源 = 契约包导出的字段表 {@link HOOK_ENTRY_FIELDS}(深冻结;本仓零镜像)—— 本模块不手抄、不另持。
|
|
13
|
+
* 「读者携带 ≠ 本服务执行」:本服务只跑 command / http / prompt / agent 四型(`mcp_tool` 整份拒,见 `hooks/hook-runner.ts` 的 `HOOK_ENTRY_TYPE_RUNS`),
|
|
14
|
+
* 列里也有本服务如实带、不执行的键(command 的 `rewakeMessage` / `rewakeSummary` / `cloud`、http 的 `cloud`、prompt 的 `continueOnBlock`);
|
|
15
|
+
* hooks 整只是否被采纳看 `taskSettings.hooks`;本位只答「契约面上这一型有哪些字段」。
|
|
16
|
+
*/
|
|
17
|
+
import { type HookEntryFields, type HookEntryType } from "@sema-agent/settings-schema/hooks";
|
|
18
|
+
/** 一型的契约字段名(导出字段表那一行的键;判别位 `type` 不在表里)。 */
|
|
19
|
+
export type HookContractEntryField<T extends HookEntryType> = Extract<keyof HookEntryFields[T], string>;
|
|
20
|
+
/** 能力位 `settingsContract` 的形。 */
|
|
21
|
+
export interface SettingsContractCapability {
|
|
22
|
+
readonly version: string;
|
|
23
|
+
readonly hookEntryFields: {
|
|
24
|
+
readonly [T in HookEntryType]: readonly HookContractEntryField<T>[];
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/** 能力位的值(纯数据;进程内不变,装载时投影一次)。列的顺序随导出表的型序。 */
|
|
28
|
+
export declare const SETTINGS_CONTRACT_CAPABILITY: SettingsContractCapability;
|
|
29
|
+
//# sourceMappingURL=settings-contract.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HOOK_ENTRY_FIELDS } from "@sema-agent/settings-schema/hooks";
|
|
2
|
+
import { SETTINGS_SCHEMA_VERSION } from "../web-admin-client/center-request.js";
|
|
3
|
+
const columnOf = (type) => Object.keys(HOOK_ENTRY_FIELDS[type]);
|
|
4
|
+
export const SETTINGS_CONTRACT_CAPABILITY = {
|
|
5
|
+
version: SETTINGS_SCHEMA_VERSION,
|
|
6
|
+
hookEntryFields: {
|
|
7
|
+
command: columnOf("command"),
|
|
8
|
+
prompt: columnOf("prompt"),
|
|
9
|
+
agent: columnOf("agent"),
|
|
10
|
+
http: columnOf("http"),
|
|
11
|
+
mcp_tool: columnOf("mcp_tool"),
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=settings-contract.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SkillSpec } from "@sema-agent/core";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ExecutionLane } from "../execution-lane-caps.js";
|
|
3
3
|
import { type Logger } from "../observability/logger.js";
|
|
4
4
|
/**
|
|
5
5
|
* Built-in skills baked into the image, loaded ONCE at startup (no per-task disk IO). A skill is a
|
|
@@ -79,13 +79,13 @@ export declare function loadSkills(dir: string, opts: LoadSkillsOptions): Loaded
|
|
|
79
79
|
* 各写一遍 `loadSkills(config.skillsDir, { toolsShareThisFilesystem: <车道判据>(config) })`,测试只能
|
|
80
80
|
* 直传布尔去证 `loadSkills`(`baked-skills.test.ts`),证不到「config → 装配腿 → baseDir」这一段;收成一只
|
|
81
81
|
* 之后,联合格从 config 走到 `baseDir`(`test/capabilities-http.test.ts` [ref] 段)证的就是两处装配点本人。
|
|
82
|
-
* 判据属主:部署形表行 `toolsOnThisHost`([ref]
|
|
82
|
+
* 判据属主:部署形表行 `toolsOnThisHost`([ref];无手车道 `none` ⇒ 假 ⇒ 目录形技能不带 `baseDir`)。
|
|
83
83
|
*/
|
|
84
84
|
export declare function loadDeploymentSkills(config: {
|
|
85
85
|
readonly skillsDir: string;
|
|
86
|
-
readonly remoteExec
|
|
87
|
-
readonly provider:
|
|
88
|
-
}
|
|
86
|
+
readonly remoteExec: {
|
|
87
|
+
readonly provider: ExecutionLane;
|
|
88
|
+
};
|
|
89
89
|
}, logger?: Logger): LoadedSkill[];
|
|
90
90
|
/** 一个技能范围交进 `TaskSpec` 的技能(场景工厂的 `skills`)。范围从哪来见 `scenarios.ts` 的 `BUILTIN_SCENARIO_SKILL_SCOPE`(center 场景 = 它自己的名字)。 */
|
|
91
91
|
export declare function skillsForScenario(loaded: readonly LoadedSkill[], scope: string): SkillSpec[];
|
|
@@ -25,6 +25,7 @@ import type { ServiceBlobExchange, ServiceFileHistoryStore } from "./plugins/sto
|
|
|
25
25
|
import { resolveStreamApprovalGate, type ApprovalFrameFamily } from "./tool-approval.js";
|
|
26
26
|
import { type WorkspaceSyncCapability } from "./workspace-space.js";
|
|
27
27
|
import type { WorkspaceCacheCapability } from "./workspace-cache.js";
|
|
28
|
+
import type { ResumeAnchorStore } from "./plugins/store-backend.js";
|
|
28
29
|
import type { EngineHandoverDoor } from "./boot/engine-lease.js";
|
|
29
30
|
/** why 闭集:词 → 给运维看的一句义(诊断 / 测试读它;wire 上的拒句由各门自写)。 */
|
|
30
31
|
export declare const CAPABILITY_FACT_WHY: {
|
|
@@ -44,6 +45,11 @@ export declare const CAPABILITY_FACT_WHY: {
|
|
|
44
45
|
readonly session_policy_store_absent: "no session policy store is wired";
|
|
45
46
|
readonly store_backend_absent: "no store backend is wired (DB_BACKEND=memory, multi-tenant bare boot, or half-configured SQL)";
|
|
46
47
|
readonly file_history_store_absent: "no file-history store is wired";
|
|
48
|
+
readonly resume_anchor_store_absent: "no rewind anchor map is wired (the handle → session-entry map a rewind target is read through)";
|
|
49
|
+
readonly execution_lane_handless: "the execution lane mounts no execution environment (REMOTE_EXEC=none), so a session has no working tree to rewind";
|
|
50
|
+
readonly workspace_rebuilt_per_task: "each task's workspace is rebuilt when the task starts on this deployment (a fresh directory, container or sandbox, or a restore from the workspace snapshot store that a rewind cannot yet take part in), so a rewind would not land in the tree the next task starts from";
|
|
51
|
+
readonly session_store_shared: "the session store is shared by several server instances (DB_BACKEND=mysql|pg) and no durable claim spans an out-of-run rewind yet, so a rewind could interleave with a run or another rewind started on another instance";
|
|
52
|
+
readonly file_history_preview_absent: "the file-history store implements no diffStats preview (the SQL backends)";
|
|
47
53
|
readonly session_export_absent: "the session store has no entry export faces (exportEntries / exportEntriesStream)";
|
|
48
54
|
readonly session_import_staging_absent: "the session store has no staged-import face (beginImportStaging)";
|
|
49
55
|
readonly policy_purge_absent: "the session policy store has no deleteBySession purge verb";
|
|
@@ -81,6 +87,7 @@ export declare const CAPABILITY_FACT_WHY: {
|
|
|
81
87
|
readonly read_root_grant_posture_refused: "this is not a single-user host-lane deployment (REMOTE_EXEC=host without REQUIRE_PRINCIPAL), the only posture that honors a read-directory grant";
|
|
82
88
|
readonly background_agent_store_absent: "no background-agent store is wired";
|
|
83
89
|
readonly sendfile_ledger_absent: "no SendUserFile ledger is wired";
|
|
90
|
+
readonly project_registry_absent: "no project registry is served here: projects are published only by the configuration center (settings-schema does not read the projects domain from the local config.d), and no center configuration is applied (SEMA_WEB_ADMIN_URL unset, or SEMA_WEB_ADMIN_DRY_RUN on)";
|
|
84
91
|
readonly workflow_engine_absent: "the workflow engine is not available on this worker";
|
|
85
92
|
readonly entitlement_resolver_absent: "self-orchestration is on for a multi-tenant worker with no per-principal entitlement source";
|
|
86
93
|
readonly workflow_run_store_absent: "no workflow run store is wired (SELF_ORCHESTRATION_ENABLED)";
|
|
@@ -201,6 +208,29 @@ export declare function sessionSyncFileHistory(d: Pick<Deps, "backend" | "sessio
|
|
|
201
208
|
historyStore: ServiceFileHistoryStore;
|
|
202
209
|
blobExchange: ServiceBlobExchange;
|
|
203
210
|
}>;
|
|
211
|
+
type RewindFilesWhy = "file_history_store_absent" | "session_head_face_absent" | "resume_anchor_store_absent" | "execution_lane_handless" | "workspace_rebuilt_per_task" | "session_store_shared";
|
|
212
|
+
/**
|
|
213
|
+
* run 外的「只恢复代码」口(`POST /v1/sessions/:id/rewind-files`,[ref])这台部署**解不解得出** —— 能力位 `sessionRewindFiles` 与该口的 501 读这一只。
|
|
214
|
+
* 四格缺一不可,每格都是那一口真要用的设施:文件历史店(引擎 `Runner.rewindFiles` 读的同一只;旋钮 `FILE_HISTORY_CAPTURE` 只关捕获、不摘店,
|
|
215
|
+
* 所以与它无关 —— 已存边界照常可回退)∧ 会话头读(属主门 + 坏档判据)∧ 锚店(`to` 手柄经它翻成 entry id,`history-anchor.ts`)∧ 执行车道有手
|
|
216
|
+
* (无手车道上引擎恒拒 `rewind.files_env_unsupported`:没有工作区可回退 —— 位说有而口恒拒不许发生)∧ 即时回退的工作区活过一次执行(部署形表行 `rewindableWorkspace`;
|
|
217
|
+
* 否则恢复的结果到不了下一次执行)∧ 会话店由本进程独占(local 后端:数据根被一个活进程锁住 ⇒ 引擎的进程内会话锁就是全局互斥;
|
|
218
|
+
* SQL 后端被多副本共用,而 run 外回退还没有一只跨副本的持久认领 —— 「先查认领再交引擎」只是检查不是互斥,所以在共享店上位为假、口 501,不留「检查即放行」)。
|
|
219
|
+
* 动词本身是引擎 `Runner` 的必有成员(型上必在),不是一格。
|
|
220
|
+
* 见证 = 判过在场的三只设施;路由在拒臂之后只读见证。
|
|
221
|
+
*/
|
|
222
|
+
export declare function sessionRewindFiles(d: Pick<Deps, "fileHistoryStore" | "resumeAnchorStore" | "sessionStorage" | "config" | "backend">): Fact<RewindFilesWhy, {
|
|
223
|
+
historyStore: ServiceFileHistoryStore;
|
|
224
|
+
anchors: ResumeAnchorStore;
|
|
225
|
+
sessionStorage: HeadReadingSessionStore;
|
|
226
|
+
}>;
|
|
227
|
+
/**
|
|
228
|
+
* 同一口的 `dryRun` **带不带改动统计** —— 能力位 `sessionRewindFilesPreview`。= 立即回退可用 ∧ 店实现了 core 契约的可选座 `diffStats`
|
|
229
|
+
* (引擎在 `dryRun` 上读的就是这一座:缺座 ⇒ 应答 `preview: null`)。逐后端如实:core 的文件店有,SQL 双生没有(那一座要的逐文件预览判官
|
|
230
|
+
* `previewFileDelta` 不在 core 包根导出面上,本仓不另写一份 —— 等 core 导出它,SQL 店补这一座、本位随之转真,路由零改)。本位为假**不是**口不收 `dryRun`:口照收,答 `preview: null`
|
|
231
|
+
* (「这台给不出统计」≠「什么都不会变」);所以本事实没有 501 拒点,只有能力位读它。
|
|
232
|
+
*/
|
|
233
|
+
export declare function sessionRewindFilesPreview(d: Pick<Deps, "fileHistoryStore" | "resumeAnchorStore" | "sessionStorage" | "config" | "backend">): Fact<RewindFilesWhy | "file_history_preview_absent">;
|
|
204
234
|
/** 持久审批底座(checkpoint 店)在场 —— `/v1/approvals/*` 与 `/v1/assistant/*` 整条车道、会话 wake 都站在它上面。 */
|
|
205
235
|
export declare function checkpointPark(d: Pick<Deps, "checkpointStore">): Fact<"checkpoint_store_absent", {
|
|
206
236
|
checkpointStore: Store<"checkpointStore">;
|
|
@@ -270,6 +300,14 @@ export declare function imagePool(d: Pick<Deps, "imageIndex">): Fact<"image_inde
|
|
|
270
300
|
export declare function agentRoster(d: Pick<Deps, "backgroundAgentStore">): Fact<"background_agent_store_absent", {
|
|
271
301
|
store: Store<"backgroundAgentStore">;
|
|
272
302
|
}>;
|
|
303
|
+
/**
|
|
304
|
+
* 项目登记簿在不在(`GET /v1/projects*` 的 501 与 `capabilities.projects` 同读)。登记簿只由配置中心下发(settings-schema 的本地读取集不收
|
|
305
|
+
* `projects` 域)⇒ 在场 ⟺ 中心腿在应用配置(配了中心 ∧ 非 dry-run)。这条判据住在 `centerEntitlementSourceWired`(同一件事:中心的配置
|
|
306
|
+
* 在这台部署上生效),这里读它,不写第二份条件。见证 = 登记簿那张表(`config.projects`,applyEffective 就地换代,引用恒定)。
|
|
307
|
+
*/
|
|
308
|
+
export declare function projectRegistry(d: Pick<Deps, "config">): Fact<"project_registry_absent", {
|
|
309
|
+
registry: ServiceConfig["projects"];
|
|
310
|
+
}>;
|
|
273
311
|
export declare function sendFileLedger(d: Pick<Deps, "sendFileLedger">): Fact<"sendfile_ledger_absent", {
|
|
274
312
|
ledger: Store<"sendFileLedger">;
|
|
275
313
|
}>;
|
package/dist/capability-facts.js
CHANGED
|
@@ -4,9 +4,11 @@ import { DEPLOYMENT_SHAPE_PREDICATES } from "./deployment-shape.js";
|
|
|
4
4
|
import { presentedApprovalFrameFamily, resolveStreamApprovalGate } from "./tool-approval.js";
|
|
5
5
|
import { selfOrchestrationDenial } from "./task-workflow.js";
|
|
6
6
|
import { centerEntitlementSourceWired } from "./runtime-caps-resolver.js";
|
|
7
|
+
import { WEB_ADMIN_ENV } from "@sema-agent/settings-schema";
|
|
7
8
|
import { blobExchangeOf, overwriteWipeIncapable } from "./session-sync.js";
|
|
8
9
|
import { WORKSPACE_PERSIST_DEFAULT, WORKSPACE_SNAPSHOT_KEEP_DEFAULT, workspaceSnapshotTimeoutOf } from "./workspace-space.js";
|
|
9
10
|
import { headReadOf } from "./session-incarnation.js";
|
|
11
|
+
import { laneWiresExecutionEnv } from "./execution-lane-caps.js";
|
|
10
12
|
export const CAPABILITY_FACT_WHY = {
|
|
11
13
|
run_store_absent: "no durable run store is wired (DB_BACKEND=mysql|pg|local)",
|
|
12
14
|
subagent_registry_absent: "the sub-agent steer registry is not wired",
|
|
@@ -24,6 +26,11 @@ export const CAPABILITY_FACT_WHY = {
|
|
|
24
26
|
session_policy_store_absent: "no session policy store is wired",
|
|
25
27
|
store_backend_absent: "no store backend is wired (DB_BACKEND=memory, multi-tenant bare boot, or half-configured SQL)",
|
|
26
28
|
file_history_store_absent: "no file-history store is wired",
|
|
29
|
+
resume_anchor_store_absent: "no rewind anchor map is wired (the handle → session-entry map a rewind target is read through)",
|
|
30
|
+
execution_lane_handless: "the execution lane mounts no execution environment (REMOTE_EXEC=none), so a session has no working tree to rewind",
|
|
31
|
+
workspace_rebuilt_per_task: "each task's workspace is rebuilt when the task starts on this deployment (a fresh directory, container or sandbox, or a restore from the workspace snapshot store that a rewind cannot yet take part in), so a rewind would not land in the tree the next task starts from",
|
|
32
|
+
session_store_shared: "the session store is shared by several server instances (DB_BACKEND=mysql|pg) and no durable claim spans an out-of-run rewind yet, so a rewind could interleave with a run or another rewind started on another instance",
|
|
33
|
+
file_history_preview_absent: "the file-history store implements no diffStats preview (the SQL backends)",
|
|
27
34
|
session_export_absent: "the session store has no entry export faces (exportEntries / exportEntriesStream)",
|
|
28
35
|
session_import_staging_absent: "the session store has no staged-import face (beginImportStaging)",
|
|
29
36
|
policy_purge_absent: "the session policy store has no deleteBySession purge verb",
|
|
@@ -61,6 +68,7 @@ export const CAPABILITY_FACT_WHY = {
|
|
|
61
68
|
read_root_grant_posture_refused: "this is not a single-user host-lane deployment (REMOTE_EXEC=host without REQUIRE_PRINCIPAL), the only posture that honors a read-directory grant",
|
|
62
69
|
background_agent_store_absent: "no background-agent store is wired",
|
|
63
70
|
sendfile_ledger_absent: "no SendUserFile ledger is wired",
|
|
71
|
+
project_registry_absent: `no project registry is served here: projects are published only by the configuration center (settings-schema does not read the projects domain from the local config.d), and no center configuration is applied (${WEB_ADMIN_ENV.url} unset, or ${WEB_ADMIN_ENV.dryRun} on)`,
|
|
64
72
|
workflow_engine_absent: "the workflow engine is not available on this worker",
|
|
65
73
|
entitlement_resolver_absent: "self-orchestration is on for a multi-tenant worker with no per-principal entitlement source",
|
|
66
74
|
workflow_run_store_absent: "no workflow run store is wired (SELF_ORCHESTRATION_ENABLED)",
|
|
@@ -195,6 +203,28 @@ export function sessionSyncFileHistory(d) {
|
|
|
195
203
|
const blobExchange = blobExchangeOf(sync.historyStore);
|
|
196
204
|
return blobExchange !== undefined ? yes({ historyStore: sync.historyStore, blobExchange }) : no("blob_exchange_absent");
|
|
197
205
|
}
|
|
206
|
+
export function sessionRewindFiles(d) {
|
|
207
|
+
if (d.fileHistoryStore === undefined)
|
|
208
|
+
return no("file_history_store_absent");
|
|
209
|
+
const owned = sessionOwnership(d);
|
|
210
|
+
if (!owned.available)
|
|
211
|
+
return owned;
|
|
212
|
+
if (d.resumeAnchorStore === undefined)
|
|
213
|
+
return no("resume_anchor_store_absent");
|
|
214
|
+
if (!laneWiresExecutionEnv(d.config.remoteExec.provider))
|
|
215
|
+
return no("execution_lane_handless");
|
|
216
|
+
if (!DEPLOYMENT_SHAPE_PREDICATES.rewindableWorkspace.holds(d.config))
|
|
217
|
+
return no("workspace_rebuilt_per_task");
|
|
218
|
+
if (d.backend?.kind !== "local")
|
|
219
|
+
return no("session_store_shared");
|
|
220
|
+
return yes({ historyStore: d.fileHistoryStore, anchors: d.resumeAnchorStore, sessionStorage: owned.sessionStorage });
|
|
221
|
+
}
|
|
222
|
+
export function sessionRewindFilesPreview(d) {
|
|
223
|
+
const rewind = sessionRewindFiles(d);
|
|
224
|
+
if (!rewind.available)
|
|
225
|
+
return rewind;
|
|
226
|
+
return rewind.historyStore.diffStats !== undefined ? YES : no("file_history_preview_absent");
|
|
227
|
+
}
|
|
198
228
|
export function checkpointPark(d) {
|
|
199
229
|
return d.checkpointStore !== undefined ? yes({ checkpointStore: d.checkpointStore }) : no("checkpoint_store_absent");
|
|
200
230
|
}
|
|
@@ -281,6 +311,9 @@ export function imagePool(d) {
|
|
|
281
311
|
export function agentRoster(d) {
|
|
282
312
|
return d.backgroundAgentStore !== undefined ? yes({ store: d.backgroundAgentStore }) : no("background_agent_store_absent");
|
|
283
313
|
}
|
|
314
|
+
export function projectRegistry(d) {
|
|
315
|
+
return centerEntitlementSourceWired(d.config) ? yes({ registry: d.config.projects }) : no("project_registry_absent");
|
|
316
|
+
}
|
|
284
317
|
export function sendFileLedger(d) {
|
|
285
318
|
return d.sendFileLedger !== undefined ? yes({ ledger: d.sendFileLedger }) : no("sendfile_ledger_absent");
|
|
286
319
|
}
|
|
@@ -456,7 +489,7 @@ export function hostScheduler(c) {
|
|
|
456
489
|
return no("scheduler_disabled");
|
|
457
490
|
if (c.requirePrincipal === true)
|
|
458
491
|
return no("multi_tenant_deployment");
|
|
459
|
-
if (c.remoteExec
|
|
492
|
+
if (c.remoteExec.provider !== "host")
|
|
460
493
|
return no("not_host_lane");
|
|
461
494
|
return YES;
|
|
462
495
|
}
|
|
@@ -4,6 +4,7 @@ import { basename, dirname, join } from "node:path";
|
|
|
4
4
|
import { WEB_ADMIN_ENV, WebAdminCredentialEnvelope, parseWebAdminCredentialFile } from "@sema-agent/settings-schema";
|
|
5
5
|
import { ACCESS_TOKEN_TTL_SECONDS, OAuthErrorResponse, TokenGrantResponse } from "@sema-agent/settings-schema/api/auth";
|
|
6
6
|
import { CENTER_PULL_TIMEOUT_MS, CenterRedirectRefusedError, centerTokenRefresh } from "./web-admin-client/center-request.js";
|
|
7
|
+
import { OWNER_ONLY_FILE_MODE } from "./plugins/owner-only-file-mode.js";
|
|
7
8
|
export const CENTER_CREDENTIAL_RENEW_LEAD_KEY = "CENTER_CREDENTIAL_RENEW_LEAD_MS";
|
|
8
9
|
export const CENTER_CREDENTIAL_RENEW_LEAD_DEFAULT_MS = 5 * 60_000;
|
|
9
10
|
export const CENTER_CREDENTIAL_RENEW_LEAD_MIN_MS = CENTER_PULL_TIMEOUT_MS;
|
|
@@ -51,10 +52,10 @@ const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
|
51
52
|
const tmpResiduePattern = (path) => new RegExp(`^\\.${escapeRegExp(basename(path))}\\.\\d+\\.[0-9a-f]{${TMP_RANDOM_BYTES * 2}}\\.tmp$`);
|
|
52
53
|
function prepareTmp(path, envelope, discard, onCleanupFailure) {
|
|
53
54
|
const tmp = join(dirname(path), tmpNameFor(path));
|
|
54
|
-
const fd = openSync(tmp, "wx",
|
|
55
|
+
const fd = openSync(tmp, "wx", OWNER_ONLY_FILE_MODE);
|
|
55
56
|
let written = false;
|
|
56
57
|
try {
|
|
57
|
-
fchmodSync(fd,
|
|
58
|
+
fchmodSync(fd, OWNER_ONLY_FILE_MODE);
|
|
58
59
|
writeFileSync(fd, `${JSON.stringify(envelope)}\n`, "utf8");
|
|
59
60
|
fsyncSync(fd);
|
|
60
61
|
written = true;
|
package/dist/config-catalog.js
CHANGED
|
@@ -15,7 +15,7 @@ import { AUTO_MODE_CLASSIFIER_TIMEOUT_BOUNDS, CENTER_BASE_URL_RULE, CONFIG_PROVI
|
|
|
15
15
|
import { DEVICE_HELLO_ACK_BOUNDS } from "./device-ws-protocol.js";
|
|
16
16
|
import { webSearchProviderFromEnv, WEB_SEARCH_PROVIDERS } from "./plugins/web-search.js";
|
|
17
17
|
import { AUTONOMY_MODES } from "./runtime-governance.js";
|
|
18
|
-
import {
|
|
18
|
+
import { ALL_EXECUTION_LANES, SANDBOX_READ_FLOOR_DEFAULT, SANDBOX_READ_FLOOR_WORDS } from "./execution-lane-caps.js";
|
|
19
19
|
import { MEMORY_ENGINE_BACKENDS, SESSION_BACKENDS, STORE_BACKENDS } from "@sema-agent/settings-schema/execution-lanes";
|
|
20
20
|
import { MODEL_PROVIDER_WORDS } from "./model-provider.js";
|
|
21
21
|
import { buildDisplaySafeUrlChecked } from "./trace/redact.js";
|
|
@@ -101,6 +101,7 @@ export const CONFIG_CATALOG = [
|
|
|
101
101
|
r("BG_AGENT_PARK_CLAIM_STALE_MS", "orchestration", "number", "parked 后台 agent 的 stale-claim 清算窗(ms;claimer 崩死的行由此解卡)", { staticDefault: String(60 * 60_000), configKey: "backgroundAgentParkClaimStaleMs" }),
|
|
102
102
|
r("BG_AGENT_RETENTION_MS", "orchestration", "number", "TERMINAL 后台 agent 行保留期(ms,reaper 按 scope 清)", { staticDefault: String(7 * 24 * 60 * 60 * 1000), danger: DATA, configKey: "backgroundAgentRetentionMs" }),
|
|
103
103
|
r("BG_AGENT_STALE_RUNNING_MS", "orchestration", "number", "running 后台 agent 行写者心跳断更超此值翻 failed(ms;下限 10min 硬钳)", { staticDefault: String(15 * 60_000), configKey: "backgroundAgentStaleRunningMs" }),
|
|
104
|
+
r("BG_AGENT_STALL_MS", "orchestration", "number", "会话驻留后台子代理的停滞收割窗(ms;最后一次工具活动距今超此值 ⇒ 行收成 killed、归因 system、run 中止;缺省 = 下限,只许拉大,无关闭档)", { derivedDefaultNote: "缺席 ⇒ max(600000, max(STREAM_ASK_WINDOW_MS, UNREACHED_ASK_TTL_MS, QUESTION_TTL_MS, MCP_ELICITATION_TTL_MS) + 引擎单命令上限(缺省 600000));单用户 posture 下 86400000 + 600000", configKey: "backgroundAgentStallMs" }),
|
|
104
105
|
r("BIND_HOST", "auth", "string", "监听绑址(显式值恒生效)", { danger: SEC, derivedDefaultNote: "缺席:无鉴权写面(allowUnauthedWrites ∧ 零凭证)自动收窄 127.0.0.1,其余全接口", resolve: (c) => c.bindHost ?? null }),
|
|
105
106
|
r("CENTER_CREDENTIAL_RENEW_LEAD_MS", "integrations", "number", `center 凭证续签提前量(ms;${WEB_ADMIN_ENV.tokenFile} 指向人的登录会话信封时,访问令牌离到期 ≤ 本值即由引擎续签并原子改写同一文件;0 = 关续签只读信封;其余须为 [${CENTER_CREDENTIAL_RENEW_LEAD_MIN_MS}, ${CENTER_CREDENTIAL_RENEW_LEAD_MAX_MS}] 内整数,坏值拒启;裸行 / 值形凭证不续签)`, { staticDefault: String(CENTER_CREDENTIAL_RENEW_LEAD_DEFAULT_MS), danger: SEC, configKey: "centerCredentialRenewLeadMs" }),
|
|
106
107
|
r("COMPLIANCE_ADDITIONAL_DENIES", "auth", "csv", "合规档位之上额外拒绝的能力名(只能收紧;词表=core 闭集,拼错拒启)", { danger: SEC }),
|
|
@@ -264,6 +265,7 @@ export const CONFIG_CATALOG = [
|
|
|
264
265
|
r("MEMORY_EMBEDDER_DIM", "memory", "number", "embeddings 维度声明"),
|
|
265
266
|
r("MEMORY_EMBEDDER_ENDPOINT", "memory", "url", "OpenAI 兼容 /embeddings 端点(pg 记忆后端的向量面)"),
|
|
266
267
|
r("MEMORY_EMBEDDER_MODEL", "memory", "string", "embeddings 模型名"),
|
|
268
|
+
r("MEMORY_EMBEDDER_REEMBED", "memory", "string", "清列重嵌的确认口令 `<model>/<dimensions>`:记下的 embedder 身份与配置对不上时,缺席 ⇒ 拒启、一行不清;在场且恰好点名配置的身份 ⇒ 清掉向量列按该身份重嵌一次(记下之后惰性);形不对或对不上 ⇒ 拒启", { danger: DATA }),
|
|
267
269
|
r("MEMORY_EMBEDDER_TIMEOUT_MS", "memory", "number", "单次 embed 活性上限(ms)", { staticDefault: "30000" }),
|
|
268
270
|
r("MEMORY_ENGINE", "memory", "enum", "记忆引擎总开关(注入式文件记忆面;双族词表,未知词拒启)", { enumValues: ["on", "off"], staticDefault: "on", configKey: "memoryEngineEnabled", booleanEnum: { true: "on", false: "off" } }),
|
|
269
271
|
r("MEMORY_ENGINE_BACKEND", "memory", "enum", "记忆持久面方言(file=现状;pg/mysql=DB 真身,多租户点亮的唯一门;方言与 DB_BACKEND 同字)", { enumValues: MEMORY_ENGINE_BACKENDS, staticDefault: "file", danger: DATA, configKey: "memoryEngineBackend" }),
|
|
@@ -372,8 +374,8 @@ export const CONFIG_CATALOG = [
|
|
|
372
374
|
r("MYSQL_PORT", "store", "number", "MySQL 协议端口", { staticDefault: "3306" }),
|
|
373
375
|
r("MYSQL_USER", "store", "string", "MySQL 协议用户", { danger: DATA }),
|
|
374
376
|
r("NO_PROXY", "limitsHttp", "csv", "不走代理的目标(小写 `no_proxy` 同认且优先);语法 = undici 的:逗号或空白分隔,`host` 精确且含其子域、`.host` / `*.host` 后缀、`host:port` 限端口、`*` 全直连;**回环 / 未指定地址目标无论写没写都直连**(本仓的无条件规则,不是 NO_PROXY 的一条);boot 冻结", { danger: SEC, derivedDefaultNote: "缺席 ⇒ 除回环外一律按 HTTP(S)_PROXY 走", resolve: (_c, env) => buildOutboundProxyPosture(env).noProxy }),
|
|
375
|
-
r("OPERATOR_PRINCIPALS", "auth", "csv", "operator 名单(全部运维面同一条读法:名单内的验过主体是运维;空名单 = 谁都不是;与 OPERATOR_SINGLE_USER
|
|
376
|
-
r("OPERATOR_SINGLE_USER", "auth", "boolean", "单用户形当自己运维的显式声明(true ⇒ 这台部署的每个调用方在全部运维面都是运维;只在 REQUIRE_PRINCIPAL 未开且 OPERATOR_PRINCIPALS
|
|
377
|
+
r("OPERATOR_PRINCIPALS", "auth", "csv", "operator 名单(全部运维面同一条读法:名单内的验过主体是运维;空名单 = 谁都不是;与 OPERATOR_SINGLE_USER 互斥;单用户部署与 OPERATOR_SINGLE_USER 二者必写其一,都不写则拒启 —— 服务进程起服第 1 段即拒,直接调 `createHttpServer` 的嵌入方装配时拒)", { danger: SEC, configKey: "operatorPrincipals" }),
|
|
378
|
+
r("OPERATOR_SINGLE_USER", "auth", "boolean", "单用户形当自己运维的显式声明(true ⇒ 这台部署的每个调用方在全部运维面都是运维;只在 REQUIRE_PRINCIPAL 未开且 OPERATOR_PRINCIPALS 为空时成立,否则拒启;单用户部署与具名 OPERATOR_PRINCIPALS 二者必写其一 —— 都不写则拒启(服务进程起服第 1 段;嵌入方装配运维面时),false 与缺席同判;起服冻结)", { staticDefault: "false", danger: SEC, configKey: "operatorSingleUser" }),
|
|
377
379
|
r("OTEL_EXPORTER_OTLP_ENDPOINT", "observability", "url", "OTLP 出口(设了=开 otel)"),
|
|
378
380
|
r("OTEL_EXPORTER_OTLP_HEADERS", "observability", "secret", "OTLP 出口头(k=v CSV;常载鉴权头 ⇒ 按凭据处置)", { danger: SEC }),
|
|
379
381
|
r("OTEL_EXPORT_INTERVAL_MS", "observability", "number", "OTLP 批报周期(ms)", { staticDefault: "15000" }),
|
|
@@ -407,9 +409,8 @@ export const CONFIG_CATALOG = [
|
|
|
407
409
|
r("READ_FACE", "orchestration", "enum", "READ 容纳面档位(env 逐键恒赢 center —— 部署主权表达)", { enumValues: ["open", "roots"], danger: SEC, derivedDefaultNote: "缺席 ⇒ 按 posture 派生(S-167):单用户 turnkey(REQUIRE_PRINCIPAL 未设)铸 open;多租户不铸键、core 默认 roots。生效来源见 GET /v1/diagnostics/wiring 的 readFace.source 四词", configKey: "readFace" }),
|
|
408
410
|
r("REAP_INTERVAL_SEC", "limitsHttp", "number", "reaper 周期(秒)", { staticDefault: "60", configKey: "reapIntervalSec" }),
|
|
409
411
|
r("REAP_RUN_STALE_SEC", "limitsHttp", "number", "run 活性判陈旧阈(秒)", { staticDefault: "120", configKey: "runStaleSec", center: cLimits("runStaleSec") }),
|
|
410
|
-
r("REMOTE_EXEC", "orchestration", "enum", "执行车道选择(点名而配不齐/认不出 ⇒ 拒启,绝不静默降级到 host/stub)。形 = 部署声明的有序车道表(逗号分隔、首项缺省,契约 runtime.execution.lanes 的渲染形);本引擎每个进程只装一条车道 ⇒ 表里不止一条拒启,单词照旧", { enumValues:
|
|
412
|
+
r("REMOTE_EXEC", "orchestration", "enum", "执行车道选择(点名而配不齐/认不出 ⇒ 拒启,绝不静默降级到 host/stub)。形 = 部署声明的有序车道表(逗号分隔、首项缺省,契约 runtime.execution.lanes 的渲染形);本引擎每个进程只装一条车道 ⇒ 表里不止一条拒启,单词照旧", { enumValues: ALL_EXECUTION_LANES, danger: SEC, derivedDefaultNote: "无缺省:每个部署都声明执行车道 —— 未声明(且 CONFIG_PROVIDER=local 时 config.d/remote-exec.json 也没点名)/ 空串 ⇒ 拒启,拒句给一行修法(保持 7.146.0 及更早的行为:CONFIG_PROVIDER 非 local 写 none,local 写 host)。none = 声明「不给工具执行环境」:**零手带工具**(手带整族不挂;活体读数:mountedBy=hands 条目 10 → 0),名册里其余工具照常执行,任务仍回 status=completed:凡需要手的请求,与「模型不肯用工具」在用户面同形。判据 = 活体 wiring_manifest 里 mountedBy=hands 的条目数,不按工具名点;名册总条数随 core 版本走,不写死。曾经把「未设」改成拒启的 REQUIRE_EXECUTION_LANE 已退役(墓碑:设了即拒启,见 retired[])", configKey: "remoteExec", resolve: (c) => c.remoteExec.provider }),
|
|
411
413
|
r("REMOTE_EXEC_HOME_DIR", "orchestration", "path", "执行环境的 home 目录(`~/` 形权限规则的基、引擎家锚拒读行的落点;core ExecutionEnv.homeDir 座)。声明与车道出厂答案(host ⇒ 本进程家目录,e2b ⇒ /home/user)都是主张:读得出家目录的车道(k8s / local-docker / ssh / adb / e2b / host)在每只执行环境开起来时拿环境里命令看到的 $HOME 证它(同一只判官、同一句拒),不一致或问不出 ⇒ 那只环境不开;不声明且车道没有出厂答案时,建环境那一拍实测 $HOME 填引擎手里的座(`~/` 形规则的下单门仍只认 boot 期答案);device 读不了 ⇒ 声明即座、起服 warn execution_lane_home_unmeasured 披露未实测", { danger: SEC, derivedDefaultNote: "缺席:host/in-process ⇒ os.homedir();e2b ⇒ /home/user(两者都在环境开起来时与 $HOME 对证);k8s/local-docker/ssh/adb ⇒ 建环境时实测 $HOME(实测缺席 ⇒ 那只环境的座缺席:泄内容的递归读全 shell 面真人问、只读面拒,并响 warn execution_lane_home_undeclared);device ⇒ 无(设备协议没有家目录读数:起服 warn execution_lane_home_undeclared);`~/` 形规则的下单门恒只认声明(无声明即 422 响亮拒)", configKey: "remoteExecHomeDir", resolve: (c) => c.remoteExecHomeDir ?? null }),
|
|
412
|
-
r("REQUIRE_EXECUTION_LANE", "orchestration", "boolean", "开了之后:REMOTE_EXEC 未点名 ∧ CONFIG_PROVIDER≠local ⇒ **拒启**并点名该设什么。默认关 = 照旧启动,但执行环境是进程内 stub、**零手带工具**(手带整族不挂;活体读数:mountedBy=hands 条目 10 → 0),名册里其余工具照常执行,任务仍回 status=completed —— 凡需要手的请求,与「模型不肯用工具」在用户面同形。判据 = 活体 wiring_manifest 里 mountedBy=hands 的条目数,不按工具名点;名册总条数随 core 版本走,不写死。托管/云部署推荐开(docs/DEPLOY-PREREQS.md)", { staticDefault: "false", danger: SEC, configKey: "requireExecutionLane" }),
|
|
413
414
|
r("REQUIRE_PRINCIPAL", "auth", "boolean", "多租户开关(posture 判别位:true ⇒ CC 能力族默认收紧)", { staticDefault: "false", danger: SEC, configKey: "requirePrincipal" }),
|
|
414
415
|
r("RESOURCE_SUSPEND", "approval", "boolean", "durable 路径 opt-in core resourceSuspend(预算/preempt ⇒ 可恢复挂起)", { staticDefault: "false", configKey: "resourceSuspend" }),
|
|
415
416
|
r("RESOURCE_SUSPEND_MAX_SLICES", "approval", "number", "resume 链片数上限(0=不设;零进展循环兜底)", { staticDefault: "0", configKey: "resourceSuspendMaxSlices" }),
|