@sema-agent/server 7.147.0 → 7.149.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 +1468 -24
- package/README.md +35 -7
- package/README.zh-CN.md +18 -8
- package/USAGE.md +444 -193
- package/deploy/sema-up/README.md +16 -5
- package/deploy/sema-up/chart/templates/NOTES.txt +1 -1
- package/deploy/sema-up/chart/templates/_helpers.tpl +20 -4
- package/deploy/sema-up/chart/values.yaml +3 -2
- package/deploy/sema-up/cluster-up.sh +74 -176
- package/deploy/sema-up/kube-up.sh +29 -49
- package/deploy/sema-up/lib/chart-run.sh +23 -0
- package/deploy/sema-up/lib/dataroot.sh +3 -3
- package/deploy/sema-up/lib/health.sh +62 -13
- package/deploy/sema-up/lib/helm-values-cluster.py +18 -0
- package/deploy/sema-up/lib/helm-values-kube.py +35 -0
- package/deploy/sema-up/lib/regcred.py +8 -0
- package/deploy/sema-up/lib/remote/helm-install.sh +3 -0
- package/deploy/sema-up/lib/remote/image-import.sh +6 -0
- package/deploy/sema-up/lib/remote/machine-precheck.sh +11 -0
- package/deploy/sema-up/lib/remote/region-probe.sh +3 -0
- package/deploy/sema-up/lib/remote/stack-ready.sh +26 -0
- package/deploy/sema-up/lib/remote/vxlan-guard.sh +8 -0
- package/deploy/sema-up/lib/render-stack.py +17 -0
- package/deploy/sema-up/lib/shell-text.sh +87 -0
- package/deploy/sema-up/lib/usage-flags.txt +10 -0
- package/deploy/sema-up/lib/usage-head.txt +1 -0
- package/deploy/sema-up/lib/usage-tail.txt +13 -0
- package/deploy/sema-up/preflight.sh +10 -8
- package/deploy/sema-up/sema-up.sh +14 -39
- package/deploy/sema-up/smoke.sh +7 -6
- package/deploy/sema-up/stack/compose.dataroot.yaml +3 -0
- package/deploy/sema-up/stack/compose.yaml +13 -1
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +21 -0
- package/dist/adoption/plan.d.ts +24 -0
- package/dist/adoption/plan.js +53 -1
- package/dist/adoption/runner.d.ts +10 -1
- package/dist/adoption/runner.js +36 -16
- package/dist/approval-card.d.ts +36 -38
- package/dist/approval-gate-currency.js +3 -2
- package/dist/approval-leg-origin.d.ts +33 -0
- package/dist/approval-leg-origin.js +4 -0
- package/dist/approval-reconciler.d.ts +4 -13
- package/dist/approval-reconciler.js +2 -2
- package/dist/approval.d.ts +13 -11
- package/dist/approval.js +3 -3
- package/dist/audit.d.ts +10 -3
- package/dist/audit.js +15 -7
- package/dist/auth-bridge.d.ts +9 -15
- package/dist/auth-bridge.js +4 -11
- package/dist/auth-keys.d.ts +10 -1
- package/dist/auth-keys.js +8 -0
- package/dist/auto-mode-face.d.ts +10 -7
- package/dist/auto-mode-face.js +7 -4
- package/dist/background-agent-name.d.ts +19 -1
- package/dist/background-agent-name.js +12 -2
- package/dist/background-session-reap.d.ts +1 -1
- package/dist/bake-runner/main.js +9 -6
- package/dist/bench/s1/arms.js +6 -5
- package/dist/bench/s1/live-deps.js +5 -2
- package/dist/bench/s1/run-firm.js +6 -5
- package/dist/bind-host.d.ts +25 -0
- package/dist/bind-host.js +25 -0
- package/dist/boot/adoption.d.ts +3 -0
- package/dist/boot/adoption.js +1 -0
- package/dist/boot/deployment-mods.d.ts +1 -1
- package/dist/boot/execution-env.d.ts +17 -7
- package/dist/boot/execution-env.js +47 -42
- package/dist/boot/execution-lane.d.ts +6 -4
- package/dist/boot/execution-lane.js +3 -1
- package/dist/boot/exit-boundary.d.ts +2 -2
- package/dist/boot/exit-boundary.js +6 -5
- package/dist/boot/fatal-exit.d.ts +3 -5
- package/dist/boot/fatal-exit.js +2 -2
- package/dist/boot/leader.d.ts +15 -0
- package/dist/boot/leader.js +17 -15
- package/dist/boot/memory-consolidation.d.ts +37 -29
- package/dist/boot/memory-consolidation.js +11 -5
- package/dist/boot/org-delivery.d.ts +3 -2
- package/dist/boot/org-memory.js +1 -1
- package/dist/boot/parked-revive-gate.js +2 -2
- package/dist/boot/reapers.d.ts +4 -3
- package/dist/boot/reapers.js +19 -16
- package/dist/boot/resolve-spec.d.ts +5 -3
- package/dist/boot/resolve-spec.js +60 -70
- package/dist/boot/retention-lane.d.ts +4 -4
- package/dist/boot/retention-lane.js +2 -2
- package/dist/boot/runner-deps.d.ts +28 -7
- package/dist/boot/runner-deps.js +14 -5
- package/dist/boot/runtime-caps.d.ts +2 -2
- package/dist/boot/runtime-caps.js +16 -2
- package/dist/boot/session-faces.d.ts +16 -7
- package/dist/boot/session-faces.js +114 -94
- package/dist/boot/shutdown.d.ts +5 -4
- package/dist/boot/shutdown.js +6 -4
- package/dist/boot/stage-01-config.d.ts +1 -0
- package/dist/boot/stage-01-config.js +13 -4
- package/dist/boot/stage-02-web-admin-pull.d.ts +2 -0
- package/dist/boot/stage-02-web-admin-pull.js +16 -3
- package/dist/boot/stage-03-store-backend.d.ts +4 -0
- package/dist/boot/stage-03-store-backend.js +4 -3
- package/dist/boot/stage-04-stores.d.ts +3 -0
- package/dist/boot/stage-04-stores.js +2 -2
- package/dist/boot/stage-05-execution-env.d.ts +8 -3
- package/dist/boot/stage-05-execution-env.js +2 -2
- package/dist/boot/stage-06-runners.d.ts +12 -13
- package/dist/boot/stage-06-runners.js +23 -15
- package/dist/boot/stage-07-capability-layer.d.ts +13 -9
- package/dist/boot/stage-07-capability-layer.js +5 -3
- package/dist/boot/stage-08-reapers.d.ts +13 -9
- package/dist/boot/stage-08-reapers.js +3 -3
- package/dist/boot/stage-09-leader.d.ts +14 -16
- package/dist/boot/stage-09-leader.js +12 -4
- package/dist/boot/stage-10-http-server.d.ts +14 -16
- package/dist/boot/stage-10-http-server.js +7 -4
- package/dist/boot/store-evidence.d.ts +20 -0
- package/dist/boot/store-evidence.js +13 -0
- package/dist/boot/stores.d.ts +6 -0
- package/dist/boot/stores.js +41 -27
- package/dist/boot/task-list-lane.d.ts +4 -4
- package/dist/boot/web-admin.d.ts +4 -2
- package/dist/boot/web-admin.js +55 -35
- package/dist/boot/webfetch-summarize-lane.d.ts +1 -1
- package/dist/boot-reclaim.d.ts +3 -1
- package/dist/boot-reclaim.js +1 -1
- package/dist/brain.d.ts +7 -18
- package/dist/brain.js +5 -17
- package/dist/budget.js +6 -6
- package/dist/capabilities/center-plugins.d.ts +7 -1
- package/dist/capabilities/center-plugins.js +32 -10
- package/dist/capabilities/center-wiring.js +1 -1
- package/dist/capabilities/composite-members.d.ts +2 -2
- package/dist/capabilities/composite-members.js +2 -2
- package/dist/capabilities/repo-tools.d.ts +2 -0
- package/dist/capabilities/repo-tools.js +14 -12
- package/dist/capabilities/scenarios.d.ts +6 -15
- package/dist/capabilities/scenarios.js +11 -16
- package/dist/capabilities/skills.d.ts +1 -1
- package/dist/capabilities/tool-defer.d.ts +1 -1
- package/dist/capability-facts.d.ts +39 -11
- package/dist/capability-facts.js +35 -7
- package/dist/card-settle-stored-scope.d.ts +56 -0
- package/dist/card-settle-stored-scope.js +27 -0
- package/dist/card-void.d.ts +8 -13
- package/dist/card-void.js +2 -7
- package/dist/center-credential-renewer.d.ts +6 -2
- package/dist/center-credential-renewer.js +7 -3
- package/dist/config-catalog.d.ts +28 -1
- package/dist/config-catalog.js +95 -85
- package/dist/config-dir-trust.d.ts +37 -4
- package/dist/config-dir-trust.js +88 -44
- package/dist/config-invariants.d.ts +43 -3
- package/dist/config-invariants.js +69 -5
- package/dist/config-lkg.d.ts +23 -1
- package/dist/config-lkg.js +17 -3
- package/dist/config-provider.d.ts +9 -9
- package/dist/config-provider.js +25 -110
- package/dist/config-pull-failure.d.ts +50 -0
- package/dist/config-pull-failure.js +48 -0
- package/dist/config-types.d.ts +62 -21
- package/dist/config.d.ts +14 -21
- package/dist/config.js +141 -64
- package/dist/context-window-notice.d.ts +31 -0
- package/dist/context-window-notice.js +28 -0
- package/dist/delegated-session-owner.d.ts +1 -1
- package/dist/deleted-session-ids.d.ts +3 -2
- package/dist/deployment-governance.d.ts +3 -3
- package/dist/deployment-shape.d.ts +46 -11
- package/dist/deployment-shape.js +8 -0
- package/dist/egress-redirect.d.ts +25 -7
- package/dist/egress-redirect.js +20 -2
- package/dist/elicitation.d.ts +6 -5
- package/dist/elicitation.js +23 -22
- package/dist/engine-identity.d.ts +28 -0
- package/dist/engine-identity.js +10 -0
- package/dist/entry-problems.d.ts +5 -7
- package/dist/entry-problems.js +1 -1
- package/dist/env-facts.js +2 -1
- package/dist/env-name-allowlist-knobs.d.ts +6 -5
- package/dist/env-name-allowlist-knobs.js +5 -0
- package/dist/env-witness.d.ts +7 -0
- package/dist/env-witness.js +16 -0
- package/dist/execution-lane-caps.d.ts +25 -23
- package/dist/execution-lane-caps.js +18 -26
- package/dist/execution-placement.d.ts +58 -18
- package/dist/execution-placement.js +41 -2
- package/dist/field-conflict.d.ts +7 -11
- package/dist/field-conflict.js +3 -3
- package/dist/file-history-capture.d.ts +3 -3
- package/dist/file-history-disclosure.js +1 -0
- package/dist/fleet/fleet-bus.d.ts +21 -3
- package/dist/fleet/fleet-bus.js +35 -25
- package/dist/fleet/fleet-reconciler.js +2 -2
- package/dist/fleet/serving-lease.js +3 -3
- package/dist/fleet-client.js +3 -3
- package/dist/fleet-lease.d.ts +0 -1
- package/dist/fleet-lease.js +4 -5
- package/dist/history-anchor.d.ts +23 -3
- package/dist/history-anchor.js +24 -4
- package/dist/hitl-delivery.d.ts +90 -0
- package/dist/hitl-delivery.js +98 -0
- package/dist/hooks/classic-stations.d.ts +8 -11
- package/dist/hooks/classic-stations.js +0 -7
- package/dist/hooks/command-spawn.d.ts +7 -2
- package/dist/hooks/command-spawn.js +13 -6
- package/dist/hooks/hook-llm.d.ts +5 -1
- package/dist/hooks/hook-llm.js +24 -15
- package/dist/hooks/hook-runner.d.ts +72 -57
- package/dist/hooks/hook-runner.js +271 -193
- package/dist/host-lsp-manager.d.ts +22 -8
- package/dist/host-lsp-manager.js +4 -1
- package/dist/http/active-run-conflict.d.ts +2 -43
- package/dist/http/active-run-conflict.js +3 -7
- package/dist/http/admission.d.ts +4 -18
- package/dist/http/admission.js +76 -79
- package/dist/http/approval-sweeps.d.ts +3 -3
- package/dist/http/approval-sweeps.js +56 -31
- package/dist/http/caller-trust.d.ts +8 -10
- package/dist/http/caller-trust.js +1 -2
- package/dist/http/claim-heartbeat.d.ts +49 -0
- package/dist/http/claim-heartbeat.js +46 -0
- package/dist/http/claimed-run.d.ts +16 -8
- package/dist/http/claimed-run.js +8 -0
- package/dist/http/dispatch.d.ts +8 -1
- package/dist/http/dispatch.js +78 -30
- package/dist/http/durable-run-leg.d.ts +11 -4
- package/dist/http/durable-run-leg.js +45 -21
- package/dist/http/execution-context.d.ts +122 -47
- package/dist/http/execution-context.js +135 -43
- package/dist/http/health-reader.d.ts +36 -0
- package/dist/http/health-reader.js +21 -0
- package/dist/http/health-self-report.d.ts +9 -9
- package/dist/http/health-self-report.js +4 -4
- package/dist/http/idempotency.d.ts +9 -5
- package/dist/http/idempotency.js +4 -4
- package/dist/http/memory-compliance-failure-reply.d.ts +15 -16
- package/dist/http/memory-compliance-failure-reply.js +4 -2
- package/dist/http/memory-face-fault-reply.d.ts +67 -0
- package/dist/http/memory-face-fault-reply.js +71 -0
- package/dist/http/memory-store-refusal-reply.d.ts +1 -1
- package/dist/http/memory-store-refusal-reply.js +3 -0
- package/dist/http/owner-access.d.ts +392 -67
- package/dist/http/owner-access.js +370 -35
- package/dist/http/principal-gate.d.ts +39 -89
- package/dist/http/principal-gate.js +26 -68
- package/dist/http/refusal-body.d.ts +35 -2
- package/dist/http/refusal-body.js +34 -0
- package/dist/http/request-guards.d.ts +9 -13
- package/dist/http/request-guards.js +34 -68
- package/dist/http/resume-composition.d.ts +37 -0
- package/dist/http/resume-composition.js +18 -0
- package/dist/http/resume-ctx-read.d.ts +46 -12
- package/dist/http/resume-ctx-read.js +31 -6
- package/dist/http/resume-legs.d.ts +54 -19
- package/dist/http/resume-legs.js +408 -196
- package/dist/http/retired-skill-manifest.d.ts +1 -1
- package/dist/http/route-ctx.d.ts +31 -32
- package/dist/http/routes/a2a-serve.d.ts +43 -5
- package/dist/http/routes/a2a-serve.js +60 -37
- package/dist/http/routes/admin-config-refresh.js +2 -2
- package/dist/http/routes/admin-drain.js +2 -2
- package/dist/http/routes/admin-memory-optout.js +4 -3
- package/dist/http/routes/adoption.d.ts +3 -0
- package/dist/http/routes/adoption.js +17 -10
- package/dist/http/routes/agents-roster.js +13 -7
- package/dist/http/routes/approvals-assistant.js +73 -67
- package/dist/http/routes/attachments.js +2 -2
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/background.js +9 -17
- package/dist/http/routes/capabilities.js +16 -19
- package/dist/http/routes/config-catalog.js +2 -2
- package/dist/http/routes/devices.d.ts +3 -3
- package/dist/http/routes/devices.js +4 -4
- package/dist/http/routes/diagnostics.d.ts +29 -3
- package/dist/http/routes/diagnostics.js +49 -18
- package/dist/http/routes/engine.js +2 -2
- package/dist/http/routes/fleet.js +5 -3
- package/dist/http/routes/images.js +10 -6
- package/dist/http/routes/leader.d.ts +7 -2
- package/dist/http/routes/leader.js +12 -3
- package/dist/http/routes/mcp-reconnect.d.ts +1 -1
- package/dist/http/routes/mcp-reconnect.js +7 -15
- package/dist/http/routes/memory-bundle.js +4 -7
- package/dist/http/routes/memory-compliance.js +4 -4
- package/dist/http/routes/memory-consolidation.js +6 -9
- package/dist/http/routes/memory-origin.d.ts +2 -0
- package/dist/http/routes/memory-origin.js +7 -8
- package/dist/http/routes/memory-policy.js +17 -12
- package/dist/http/routes/notify-wake.js +10 -19
- package/dist/http/routes/observability.js +3 -3
- package/dist/http/routes/principal-inbox.d.ts +4 -2
- package/dist/http/routes/principal-inbox.js +5 -4
- package/dist/http/routes/projects.d.ts +1 -1
- package/dist/http/routes/projects.js +3 -2
- package/dist/http/routes/retention-ops.js +6 -9
- package/dist/http/routes/rules.js +20 -5
- package/dist/http/routes/run-memory-capture.d.ts +2 -2
- package/dist/http/routes/run-memory-capture.js +6 -12
- package/dist/http/routes/run-permission-mode.d.ts +2 -2
- package/dist/http/routes/run-permission-mode.js +10 -17
- package/dist/http/routes/runs.js +155 -237
- package/dist/http/routes/session-memory-sync.d.ts +2 -2
- package/dist/http/routes/session-memory-sync.js +7 -13
- package/dist/http/routes/session-sync.d.ts +28 -7
- package/dist/http/routes/session-sync.js +63 -50
- package/dist/http/routes/sessions-list.d.ts +3 -3
- package/dist/http/routes/sessions-list.js +9 -9
- package/dist/http/routes/sessions.js +87 -124
- package/dist/http/routes/shared-memory.js +6 -6
- package/dist/http/routes/side-query.js +2 -2
- package/dist/http/routes/tasks.js +237 -187
- package/dist/http/routes/trace-usage.d.ts +0 -12
- package/dist/http/routes/trace-usage.js +40 -46
- package/dist/http/routes/workflows.d.ts +39 -4
- package/dist/http/routes/workflows.js +42 -14
- package/dist/http/run-concurrency-cap.d.ts +20 -12
- package/dist/http/run-concurrency-cap.js +39 -26
- package/dist/http/run-read-face.d.ts +3 -5
- package/dist/http/run-read-face.js +8 -13
- package/dist/http/send.d.ts +12 -3
- package/dist/http/send.js +42 -6
- package/dist/http/server.d.ts +43 -45
- package/dist/http/server.js +61 -11
- package/dist/http/sse-log.d.ts +17 -10
- package/dist/http/sse-log.js +7 -7
- package/dist/http/stored-body-replay.d.ts +12 -0
- package/dist/http/stored-body-replay.js +2 -2
- package/dist/http/submit-ctx.d.ts +17 -8
- package/dist/http/submit-ctx.js +8 -5
- package/dist/http/submit-replay.d.ts +19 -6
- package/dist/http/submit-replay.js +18 -6
- package/dist/http/sync-submit-body.d.ts +3 -4
- package/dist/http/sync-submit-body.js +4 -5
- package/dist/http/wire-types.d.ts +4 -3
- package/dist/identity-source.d.ts +36 -5
- package/dist/identity-source.js +27 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +2 -0
- package/dist/key-resolver.d.ts +32 -0
- package/dist/key-resolver.js +23 -9
- package/dist/leader/diffup.js +2 -1
- package/dist/leader/endpoint.d.ts +26 -5
- package/dist/leader/endpoint.js +154 -14
- package/dist/leader/fanout.d.ts +3 -0
- package/dist/leader/fanout.js +78 -63
- package/dist/leader/leader.d.ts +16 -0
- package/dist/leader/leader.js +43 -3
- package/dist/leader/merge.d.ts +9 -1
- package/dist/leader/merge.js +16 -1
- package/dist/leader/repair-wire.js +1 -1
- package/dist/leader/wire.d.ts +36 -3
- package/dist/leader/wire.js +59 -18
- package/dist/leg-facts.d.ts +7 -2
- package/dist/leg-facts.js +1 -0
- package/dist/local-store-declaration.d.ts +54 -0
- package/dist/local-store-declaration.js +59 -0
- package/dist/lsp-evict.d.ts +6 -4
- package/dist/lsp-evict.js +2 -3
- package/dist/mcp-assertion-header.d.ts +1 -1
- package/dist/mcp-assertion-header.js +1 -1
- package/dist/memory-operator-faces.d.ts +5 -4
- package/dist/memory-operator-faces.js +1 -1
- package/dist/memory-project-layer.js +1 -1
- package/dist/memory-scope.d.ts +33 -6
- package/dist/memory-scope.js +68 -19
- package/dist/memory-store-refusal.d.ts +5 -2
- package/dist/memory-sync-client.d.ts +3 -2
- package/dist/memory-sync-client.js +8 -5
- package/dist/model-compat.d.ts +17 -8
- package/dist/model-compat.js +6 -2
- package/dist/model-context-window.d.ts +57 -0
- package/dist/model-context-window.js +21 -0
- package/dist/model-entry-headers.d.ts +46 -4
- package/dist/model-entry-headers.js +2 -2
- package/dist/model-entry-refusal.d.ts +40 -20
- package/dist/model-entry-refusal.js +57 -30
- package/dist/model-plane-face.d.ts +19 -11
- package/dist/model-plane-face.js +9 -1
- package/dist/model-plane-probe.d.ts +2 -0
- package/dist/model-plane-probe.js +17 -0
- package/dist/model-provider.d.ts +3 -3
- package/dist/model-reach-scope.d.ts +2 -1
- package/dist/model-route-endpoint.d.ts +9 -5
- package/dist/model-route-endpoint.js +29 -7
- package/dist/model-select.d.ts +16 -0
- package/dist/model-select.js +4 -0
- package/dist/mountinfo.d.ts +37 -0
- package/dist/mountinfo.js +47 -0
- package/dist/namespaced-rule-name.d.ts +23 -14
- package/dist/namespaced-rule-name.js +8 -11
- package/dist/net-address.d.ts +1 -1
- package/dist/observability/corrupt-read-seat.d.ts +4 -4
- package/dist/observability/corrupt-read-seat.js +5 -3
- package/dist/observability/fail-open.d.ts +72 -40
- package/dist/observability/fail-open.js +74 -40
- package/dist/observability/logger.d.ts +22 -1
- package/dist/observability/logger.js +89 -12
- package/dist/observability/metrics.js +4 -5
- package/dist/observability/otel-exporter.js +2 -1
- package/dist/observability/principal-context.d.ts +14 -7
- package/dist/observability/principal-context.js +8 -3
- package/dist/observability/run-terminal.d.ts +7 -1
- package/dist/observability/run-terminal.js +6 -2
- package/dist/observability/secret-env-scrub.d.ts +1 -1
- package/dist/observability/secret-env-scrub.js +1 -1
- package/dist/orchestration/hardened-vm-runner.d.ts +1 -0
- package/dist/orchestration/hardened-vm-runner.js +11 -5
- package/dist/orchestration/hardened-vm-worker-runner.d.ts +0 -14
- package/dist/orchestration/hardened-vm-worker-runner.js +5 -0
- package/dist/orchestration/hardened-vm-worker.js +2 -1
- package/dist/orchestration/workflow-completion-inbox.d.ts +3 -3
- package/dist/orchestration/workflow-completion-inbox.js +3 -2
- package/dist/org-delivery-gate.d.ts +36 -10
- package/dist/org-delivery-gate.js +12 -8
- package/dist/outbound-dispatcher.d.ts +1 -1
- package/dist/outbound-dispatcher.js +6 -12
- package/dist/owner-brands.d.ts +81 -0
- package/dist/owner-brands.js +42 -0
- package/dist/owner-faces.d.ts +532 -0
- package/dist/owner-faces.js +126 -0
- package/dist/park-row-commit.d.ts +67 -0
- package/dist/park-row-commit.js +76 -0
- package/dist/parked-decide.d.ts +76 -12
- package/dist/parked-decide.js +152 -11
- package/dist/parked-revive-surface.d.ts +14 -4
- package/dist/parked-revive-surface.js +5 -4
- package/dist/peer-directory.d.ts +7 -9
- package/dist/peer-directory.js +3 -2
- package/dist/permission-rule-vocab.d.ts +53 -8
- package/dist/permission-rule-vocab.js +30 -2
- package/dist/plugins/adoption-log-sql.d.ts +3 -25
- package/dist/plugins/adoption-log-sql.js +23 -21
- package/dist/plugins/approval-ask-retired-delete-by-task-m50.d.ts +7 -0
- package/dist/plugins/approval-ask-retired-delete-by-task-m50.js +17 -0
- package/dist/plugins/approval-ask-store-file.d.ts +18 -7
- package/dist/plugins/approval-ask-store-file.js +37 -14
- package/dist/plugins/approval-ask-store-memory.d.ts +12 -4
- package/dist/plugins/approval-ask-store-memory.js +24 -10
- package/dist/plugins/approval-ask-store-sql.d.ts +40 -21
- package/dist/plugins/approval-ask-store-sql.js +44 -15
- package/dist/plugins/approval-exemption-skill-cutoff.d.ts +64 -0
- package/dist/plugins/approval-exemption-skill-cutoff.js +122 -0
- package/dist/plugins/approval-exemption-skill-m46.d.ts +14 -0
- package/dist/plugins/approval-exemption-skill-m46.js +21 -0
- package/dist/plugins/approval-exemption-store.d.ts +32 -2
- package/dist/plugins/approval-exemption-store.js +42 -19
- package/dist/plugins/approval-nonce-store.d.ts +39 -12
- package/dist/plugins/approval-nonce-store.js +72 -23
- package/dist/plugins/blob-backend.d.ts +2 -0
- package/dist/plugins/blob-backend.js +9 -6
- package/dist/plugins/caching-session-store.d.ts +13 -1
- package/dist/plugins/caching-session-store.js +43 -4
- package/dist/plugins/checkpoint-index-columns.d.ts +32 -5
- package/dist/plugins/checkpoint-index-columns.js +36 -1
- package/dist/plugins/checkpoint-store-face.d.ts +83 -10
- package/dist/plugins/checkpoint-store-face.js +18 -1
- package/dist/plugins/device-store-sql.js +1 -0
- package/dist/plugins/ensure-index.d.ts +13 -1
- package/dist/plugins/ensure-index.js +154 -21
- package/dist/plugins/ensure-schema-lock-policy.d.ts +36 -18
- package/dist/plugins/ensure-schema-lock-policy.js +76 -9
- package/dist/plugins/file-run-store.d.ts +85 -32
- package/dist/plugins/file-run-store.js +177 -94
- package/dist/plugins/host-platform.d.ts +24 -3
- package/dist/plugins/host-platform.js +15 -1
- package/dist/plugins/image-bake-store-sql.js +2 -0
- package/dist/plugins/imported-layer-root-retirement.d.ts +2 -2
- package/dist/plugins/k8s-pod-reaper.d.ts +1 -3
- package/dist/plugins/k8s-pod-reaper.js +0 -1
- package/dist/plugins/leader-run-store-sql.d.ts +22 -0
- package/dist/plugins/leader-run-store-sql.js +34 -4
- package/dist/plugins/local-checkpoint-store.d.ts +62 -23
- package/dist/plugins/local-checkpoint-store.js +197 -77
- package/dist/plugins/local-data-dir-modes-m39.js +2 -1
- package/dist/plugins/local-data-root-admission.d.ts +52 -0
- package/dist/plugins/local-data-root-admission.js +100 -0
- package/dist/plugins/local-docker-capacity.d.ts +93 -0
- package/dist/plugins/local-docker-capacity.js +194 -0
- package/dist/plugins/local-docker-reaper.d.ts +92 -0
- package/dist/plugins/local-docker-reaper.js +102 -0
- package/dist/plugins/local-engine-high-water.d.ts +29 -6
- package/dist/plugins/local-engine-high-water.js +27 -19
- package/dist/plugins/local-session-store.d.ts +458 -140
- package/dist/plugins/local-session-store.js +906 -292
- package/dist/plugins/local-session-window.d.ts +3 -2
- package/dist/plugins/local-session-window.js +3 -2
- package/dist/plugins/local-sidecar-quarantine.js +3 -2
- package/dist/plugins/local-task-attachment-store.d.ts +18 -1
- package/dist/plugins/local-task-attachment-store.js +22 -1
- package/dist/plugins/memory-embedder.js +9 -7
- package/dist/plugins/memory-engine-pg.d.ts +3 -2
- package/dist/plugins/memory-engine-pg.js +14 -5
- package/dist/plugins/memory-engine-sql-apply.d.ts +8 -4
- package/dist/plugins/memory-engine-sql-apply.js +6 -8
- package/dist/plugins/memory-engine-tidb.d.ts +4 -2
- package/dist/plugins/memory-engine-tidb.js +11 -2
- package/dist/plugins/memory-optout-grant-store-sql.d.ts +1 -1
- package/dist/plugins/memory-optout-grant-store-sql.js +3 -3
- package/dist/plugins/memory-run-store.d.ts +53 -36
- package/dist/plugins/memory-run-store.js +116 -88
- package/dist/plugins/one-time-migration-marker.d.ts +26 -0
- package/dist/plugins/one-time-migration-marker.js +13 -0
- package/dist/plugins/one-time-migrations.d.ts +214 -47
- package/dist/plugins/one-time-migrations.js +481 -135
- package/dist/plugins/org-delivery-quota-store.d.ts +34 -11
- package/dist/plugins/org-delivery-quota-store.js +31 -15
- package/dist/plugins/permission-rule-store-file.d.ts +3 -3
- package/dist/plugins/permission-rule-store-sql.d.ts +5 -64
- package/dist/plugins/permission-rule-store-sql.js +11 -95
- package/dist/plugins/pg-pool.d.ts +2 -32
- package/dist/plugins/pg-pool.js +24 -17
- package/dist/plugins/remote-env-device.d.ts +3 -2
- package/dist/plugins/remote-env-e2b.d.ts +8 -32
- package/dist/plugins/remote-env-e2b.js +44 -32
- package/dist/plugins/remote-env-host.d.ts +51 -17
- package/dist/plugins/remote-env-host.js +111 -42
- package/dist/plugins/remote-env-k8s.d.ts +40 -45
- package/dist/plugins/remote-env-k8s.js +111 -60
- package/dist/plugins/remote-env-local-docker.d.ts +152 -15
- package/dist/plugins/remote-env-local-docker.js +352 -72
- package/dist/plugins/remote-scratchpad.js +4 -0
- package/dist/plugins/retention-deployment.d.ts +49 -17
- package/dist/plugins/retention-deployment.js +39 -8
- package/dist/plugins/run-preview-m45.d.ts +11 -0
- package/dist/plugins/run-preview-m45.js +19 -0
- package/dist/plugins/run-store-sql.d.ts +82 -75
- package/dist/plugins/run-store-sql.js +164 -125
- package/dist/plugins/s3-answer.d.ts +2 -1
- package/dist/plugins/sandbox-reaper.d.ts +26 -0
- package/dist/plugins/sandbox-reaper.js +2 -0
- package/dist/plugins/scenario-prefix-switch-m42.d.ts +56 -0
- package/dist/plugins/scenario-prefix-switch-m42.js +56 -0
- package/dist/plugins/scheduler-support.d.ts +16 -1
- package/dist/plugins/scheduler-support.js +22 -2
- package/dist/plugins/schema-consistency.d.ts +131 -14
- package/dist/plugins/schema-consistency.js +388 -18
- package/dist/plugins/schema-drift-sentence.d.ts +10 -6
- package/dist/plugins/schema-drift-sentence.js +15 -7
- package/dist/plugins/schema-ensure-legs.d.ts +9 -0
- package/dist/plugins/schema-ensure-legs.js +1 -1
- package/dist/plugins/schema-indexes.js +3 -0
- package/dist/plugins/schema-live-columns.d.ts +14 -5
- package/dist/plugins/schema-live-columns.js +10 -10
- package/dist/plugins/send-user-file.js +2 -1
- package/dist/plugins/session-birth.d.ts +37 -0
- package/dist/plugins/session-birth.js +38 -0
- package/dist/plugins/session-epoch-anchor.d.ts +40 -12
- package/dist/plugins/session-epoch-anchor.js +33 -11
- package/dist/plugins/session-ext-table.d.ts +27 -3
- package/dist/plugins/session-ext-table.js +19 -6
- package/dist/plugins/session-fork.d.ts +15 -1
- package/dist/plugins/session-fork.js +3 -0
- package/dist/plugins/session-ownership.d.ts +1 -1
- package/dist/plugins/session-placement.d.ts +27 -20
- package/dist/plugins/session-placement.js +15 -12
- package/dist/plugins/session-row-sql.d.ts +12 -0
- package/dist/plugins/session-row-sql.js +3 -3
- package/dist/plugins/session-run-rollup.d.ts +29 -0
- package/dist/plugins/session-run-rollup.js +40 -0
- package/dist/plugins/session-store-sql.d.ts +38 -12
- package/dist/plugins/session-store-sql.js +130 -30
- package/dist/plugins/session-withdraw-sql.d.ts +36 -0
- package/dist/plugins/session-withdraw-sql.js +42 -0
- package/dist/plugins/shared-memory-store-sql.d.ts +0 -69
- package/dist/plugins/shared-memory-store-sql.js +2 -1
- package/dist/plugins/shell-sentinel-owner-m48.d.ts +42 -0
- package/dist/plugins/shell-sentinel-owner-m48.js +9 -0
- package/dist/plugins/snapshot-bucket-presence.d.ts +2 -1
- package/dist/plugins/sql-driver.d.ts +1 -1
- package/dist/plugins/sql-driver.js +2 -1
- package/dist/plugins/sql-errors.d.ts +32 -5
- package/dist/plugins/sql-errors.js +55 -7
- package/dist/plugins/sql-json-column.d.ts +8 -7
- package/dist/plugins/sql-json-column.js +10 -6
- package/dist/plugins/stop-then-start-sentence.d.ts +16 -0
- package/dist/plugins/stop-then-start-sentence.js +7 -0
- package/dist/plugins/store-backend.d.ts +99 -16
- package/dist/plugins/store-backend.js +230 -65
- package/dist/plugins/store-contracts.d.ts +123 -33
- package/dist/plugins/store-contracts.js +38 -1
- package/dist/plugins/store-fault.d.ts +28 -2
- package/dist/plugins/store-fault.js +20 -2
- package/dist/plugins/task-attachment-store.d.ts +15 -3
- package/dist/plugins/task-attachment-store.js +22 -9
- package/dist/plugins/tidb-pool.d.ts +11 -6
- package/dist/plugins/tidb-pool.js +39 -18
- package/dist/plugins/web-search.js +5 -3
- package/dist/plugins/workflow-run-store-sql.d.ts +6 -1
- package/dist/plugins/workflow-run-store-sql.js +11 -5
- package/dist/plugins/workspace-custody.d.ts +44 -0
- package/dist/plugins/workspace-custody.js +47 -0
- package/dist/principal-jwt.d.ts +4 -4
- package/dist/principal-jwt.js +20 -5
- package/dist/principal-shape.d.ts +41 -0
- package/dist/principal-shape.js +19 -0
- package/dist/project-identity.d.ts +8 -7
- package/dist/project-identity.js +40 -17
- package/dist/project-layer-key.d.ts +13 -2
- package/dist/project-layer-key.js +9 -1
- package/dist/question.d.ts +13 -23
- package/dist/question.js +21 -39
- package/dist/read-deny-floor-notice.d.ts +36 -0
- package/dist/read-deny-floor-notice.js +40 -0
- package/dist/{plain-string-record.d.ts → request-declaration-disposition.d.ts} +9 -23
- package/dist/request-declaration-disposition.js +39 -0
- package/dist/request-declaration-refusal.d.ts +35 -12
- package/dist/request-declaration-refusal.js +21 -9
- package/dist/request-form.d.ts +58 -0
- package/dist/request-form.js +72 -0
- package/dist/request-image-urls.d.ts +8 -2
- package/dist/request-image-urls.js +2 -1
- package/dist/request-images.d.ts +20 -0
- package/dist/request-images.js +59 -0
- package/dist/request-key-closure.d.ts +6 -7
- package/dist/request-key-closure.js +15 -2
- package/dist/resource-suspend.d.ts +7 -16
- package/dist/resource-suspend.js +1 -1
- package/dist/retired-name-host-notice.d.ts +21 -0
- package/dist/retired-name-host-notice.js +12 -0
- package/dist/rule-entry-list.d.ts +2 -2
- package/dist/rule-entry-list.js +3 -4
- package/dist/rule-issue-reading.d.ts +58 -0
- package/dist/rule-issue-reading.js +14 -0
- package/dist/rules-consent.d.ts +5 -3
- package/dist/rules-consent.js +1 -0
- package/dist/run-acceptance.d.ts +3 -1
- package/dist/run-acceptance.js +3 -0
- package/dist/run-cancel-card.d.ts +28 -0
- package/dist/run-cancel-card.js +19 -0
- package/dist/run-cancel-context.d.ts +10 -0
- package/dist/run-cancel-context.js +1 -0
- package/dist/run-local.d.ts +14 -6
- package/dist/run-local.js +117 -90
- package/dist/run-stale-default.d.ts +7 -0
- package/dist/run-stale-default.js +2 -0
- package/dist/runs.d.ts +56 -21
- package/dist/runs.js +73 -43
- package/dist/runtime-caps-resolver.d.ts +21 -6
- package/dist/runtime-caps-resolver.js +17 -4
- package/dist/runtime-governance.d.ts +2 -2
- package/dist/runtime-governance.js +5 -3
- package/dist/sealed-key-layout.d.ts +12 -5
- package/dist/sealed-key-layout.js +5 -0
- package/dist/sealed-key.d.ts +12 -2
- package/dist/sealed-key.js +115 -27
- package/dist/security.d.ts +128 -158
- package/dist/security.js +163 -59
- package/dist/sema-config-dir.d.ts +20 -0
- package/dist/sema-config-dir.js +25 -0
- package/dist/server-secret-env.d.ts +55 -25
- package/dist/server-secret-env.js +75 -22
- package/dist/session-agent.d.ts +3 -2
- package/dist/session-children-retire.d.ts +13 -8
- package/dist/session-children-retire.js +9 -7
- package/dist/session-deletion.d.ts +88 -0
- package/dist/session-deletion.js +8 -0
- package/dist/session-erase.d.ts +145 -0
- package/dist/session-erase.js +115 -0
- package/dist/session-error-wire.d.ts +5 -5
- package/dist/session-error-wire.js +1 -1
- package/dist/session-incarnation.d.ts +52 -5
- package/dist/session-incarnation.js +19 -2
- package/dist/session-policy-wire.d.ts +6 -3
- package/dist/session-policy-wire.js +11 -1
- package/dist/session-resident-background.d.ts +0 -71
- package/dist/session-resident-background.js +4 -3
- package/dist/session-row.d.ts +2 -1
- package/dist/session-rules-seat.d.ts +12 -0
- package/dist/session-rules-seat.js +19 -0
- package/dist/session-titler.d.ts +7 -15
- package/dist/session-titler.js +1 -1
- package/dist/session-workspace.d.ts +3 -3
- package/dist/spec-fields.d.ts +57 -3
- package/dist/spec-fields.js +72 -51
- package/dist/store-admission.d.ts +33 -0
- package/dist/store-admission.js +49 -0
- package/dist/store-posture.d.ts +141 -20
- package/dist/store-posture.js +205 -3
- package/dist/stored-request-hooks-m20.js +2 -2
- package/dist/stores-sql/background-agent-store-sql.d.ts +11 -2
- package/dist/stores-sql/background-agent-store-sql.js +73 -20
- package/dist/stores-sql/checkpoint-store-sql.d.ts +34 -29
- package/dist/stores-sql/checkpoint-store-sql.js +78 -49
- package/dist/stores-sql/file-history-store-sql.d.ts +1 -1
- package/dist/stores-sql/file-history-store-sql.js +3 -5
- package/dist/stores-sql/mailbox-store-sql.d.ts +7 -4
- package/dist/stores-sql/mailbox-store-sql.js +31 -32
- package/dist/stores-sql/pg-session-storage.d.ts +7 -5
- package/dist/stores-sql/pg-session-storage.js +54 -46
- package/dist/stores-sql/retention-store-sql.d.ts +87 -19
- package/dist/stores-sql/retention-store-sql.js +92 -27
- package/dist/stores-sql/session-policy-store-sql.d.ts +32 -10
- package/dist/stores-sql/session-policy-store-sql.js +44 -36
- package/dist/stores-sql/session-write-hooks.d.ts +12 -6
- package/dist/stores-sql/tidb-session-storage.d.ts +4 -4
- package/dist/stores-sql/tidb-session-storage.js +13 -8
- package/dist/stores-sql/tidb-session-store.d.ts +36 -17
- package/dist/stores-sql/tidb-session-store.js +69 -39
- package/dist/stores-sql/tool-result-store-sql.d.ts +1 -1
- package/dist/stores-sql/tool-result-store-sql.js +4 -6
- package/dist/stores-sql/windowed-session-storage.d.ts +5 -0
- package/dist/stores-sql/windowed-session-storage.js +9 -0
- package/dist/submission-exit.d.ts +50 -0
- package/dist/submission-exit.js +108 -0
- package/dist/task-a2a.d.ts +3 -8
- package/dist/task-a2a.js +28 -30
- package/dist/task-cwd.d.ts +43 -7
- package/dist/task-cwd.js +11 -0
- package/dist/task-mcp.d.ts +3 -3
- package/dist/task-mcp.js +4 -4
- package/dist/task-settings.d.ts +14 -10
- package/dist/task-settings.js +19 -7
- package/dist/terminal.d.ts +27 -43
- package/dist/terminal.js +49 -14
- package/dist/tool-approval.d.ts +173 -163
- package/dist/tool-approval.js +247 -232
- package/dist/trace/core-keyset-guard.d.ts +13 -6
- package/dist/trace/core-vocab-wire.d.ts +95 -0
- package/dist/trace/core-vocab-wire.js +15 -0
- package/dist/trace/engine-notice-wire.d.ts +24 -21
- package/dist/trace/engine-notice-wire.js +7 -3
- package/dist/trace/exit-seat.d.ts +30 -4
- package/dist/trace/exit-seat.js +40 -36
- package/dist/trace/extension-call-face.d.ts +3 -2
- package/dist/trace/extension-call-face.js +3 -1
- package/dist/trace/ledger-events.d.ts +4 -7
- package/dist/trace/ledger-sink.d.ts +4 -31
- package/dist/trace/ledger-sink.js +0 -11
- package/dist/trace/model-segment.d.ts +5 -5
- package/dist/trace/model-segment.js +5 -5
- package/dist/trace/project.d.ts +59 -44
- package/dist/trace/project.js +60 -26
- package/dist/trace/redact.d.ts +135 -27
- package/dist/trace/redact.js +884 -260
- package/dist/trace/self-minted-wire.d.ts +567 -20
- package/dist/trace/self-minted-wire.js +205 -24
- package/dist/trace/wire-projection-faces.d.ts +5 -6
- package/dist/trace/wire-projection-faces.js +2 -2
- package/dist/upstream-body.d.ts +23 -0
- package/dist/upstream-body.js +16 -0
- package/dist/url-refusal.d.ts +3 -3
- package/dist/url-refusal.js +11 -4
- package/dist/user-authored-text.d.ts +1 -1
- package/dist/user-input-ledger.d.ts +7 -8
- package/dist/user-input-ledger.js +1 -1
- package/dist/web-admin-client/apply-effective.d.ts +6 -3
- package/dist/web-admin-client/apply-effective.js +33 -23
- package/dist/web-admin-client/apply-ledger.d.ts +16 -7
- package/dist/web-admin-client/apply-ledger.js +5 -2
- package/dist/web-admin-client/center-request.d.ts +2 -2
- package/dist/web-admin-client/center-request.js +15 -15
- package/dist/web-admin-client/effective-keys.d.ts +1 -1
- package/dist/web-admin-client/effective-keys.js +1 -1
- package/dist/web-admin-client/entry-metadata.d.ts +8 -0
- package/dist/web-admin-client/entry-metadata.js +13 -0
- package/dist/web-admin-client/http-client.d.ts +1 -1
- package/dist/web-admin-client/http-client.js +23 -4
- package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
- package/dist/web-admin-client/mcp-revocation.js +2 -1
- package/dist/web-admin-client/read-warnings.d.ts +1 -0
- package/dist/web-admin-client/read-warnings.js +1 -0
- package/dist/web-admin-client/restart-signal.js +8 -4
- package/dist/web-admin-client/skills-mcp.d.ts +2 -2
- package/dist/web-admin-client/types.d.ts +1 -2
- package/dist/workspace-space.d.ts +3 -2
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +4 -4
- package/docs/error-text-lexicon.json +317 -0
- package/package.json +8 -3
- package/scripts/drain-check-local.mjs +118 -147
- package/scripts/drain-check.mysql.sql +22 -2
- package/scripts/drain-check.pg.sql +22 -2
- package/scripts/embed-minimal.mjs +183 -0
- package/wire-changes/server@7.148.0.json +1517 -0
- package/wire-changes/server@7.149.0.json +372 -0
- package/dist/http/memory-control-plane-corrupt-reply.d.ts +0 -25
- package/dist/http/memory-control-plane-corrupt-reply.js +0 -19
- package/dist/http/memory-layer-reply.d.ts +0 -30
- package/dist/http/memory-layer-reply.js +0 -24
- package/dist/lsp/e2b-bridge.d.ts +0 -57
- package/dist/lsp/e2b-bridge.js +0 -139
- package/dist/lsp/e2b-manager.d.ts +0 -93
- package/dist/lsp/e2b-manager.js +0 -178
- package/dist/lsp/lsp-frames.d.ts +0 -14
- package/dist/lsp/lsp-frames.js +0 -25
- package/dist/lsp/manager.d.ts +0 -129
- package/dist/lsp/manager.js +0 -127
- package/dist/lsp/types.d.ts +0 -12
- package/dist/lsp/types.js +0 -2
- package/dist/lsp/ws-transport.d.ts +0 -40
- package/dist/lsp/ws-transport.js +0 -210
- package/dist/plain-string-record.js +0 -70
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { DEPLOYMENT_SHAPE_PREDICATES } from "./deployment-shape.js";
|
|
2
|
+
import { SESSION_DURABILITY } from "./plugins/session-placement.js";
|
|
3
|
+
export const LOCAL_STORE_DECLARATION_WORDS = ["ephemeral"];
|
|
4
|
+
export const LOCAL_STORE_DECLARATION_RULES = ["declared_ephemeral", "callers_own_volatile_disk", "store_design"];
|
|
5
|
+
export function engineDurabilityOfDeclarationRule(rule) {
|
|
6
|
+
switch (rule) {
|
|
7
|
+
case "declared_ephemeral":
|
|
8
|
+
case "callers_own_volatile_disk":
|
|
9
|
+
return "process-local";
|
|
10
|
+
case "store_design":
|
|
11
|
+
return SESSION_DURABILITY;
|
|
12
|
+
default: {
|
|
13
|
+
const unhandled = rule;
|
|
14
|
+
throw new Error(`store posture: no ruling for local store declaration rule ${String(unhandled)}`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function localStoreDeclarationOf(deployment, dataRootMedium) {
|
|
19
|
+
const of = (rule) => ({ rule, durability: engineDurabilityOfDeclarationRule(rule) });
|
|
20
|
+
const word = deployment.localStoreDurability;
|
|
21
|
+
switch (word) {
|
|
22
|
+
case "ephemeral":
|
|
23
|
+
return of("declared_ephemeral");
|
|
24
|
+
case undefined:
|
|
25
|
+
if (dataRootMedium === "ephemeral" && DEPLOYMENT_SHAPE_PREDICATES.callerOwnsWorkerDisk.holds(deployment))
|
|
26
|
+
return of("callers_own_volatile_disk");
|
|
27
|
+
return of("store_design");
|
|
28
|
+
default: {
|
|
29
|
+
const unhandled = word;
|
|
30
|
+
throw new Error(`unhandled LOCAL_STORE_DURABILITY word ${JSON.stringify(unhandled)}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export function describeLocalStoreDeclaration(d) {
|
|
35
|
+
switch (d.rule) {
|
|
36
|
+
case "declared_ephemeral":
|
|
37
|
+
return "the operator declared LOCAL_STORE_DURABILITY=ephemeral";
|
|
38
|
+
case "callers_own_volatile_disk":
|
|
39
|
+
return "the store sits on the caller's own disk (host execution lane, single owner), and that disk does not survive a container / Pod replacement";
|
|
40
|
+
case "store_design":
|
|
41
|
+
return "the local file store's own declaration";
|
|
42
|
+
default: {
|
|
43
|
+
const unhandled = d.rule;
|
|
44
|
+
throw new Error(`store posture: no wording for local store declaration rule ${String(unhandled)}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export function parseLocalStoreDurabilityWord(raw) {
|
|
49
|
+
const w = raw?.trim() ?? "";
|
|
50
|
+
if (w === "")
|
|
51
|
+
return undefined;
|
|
52
|
+
const word = LOCAL_STORE_DECLARATION_WORDS.find((x) => x === w);
|
|
53
|
+
if (word !== undefined)
|
|
54
|
+
return word;
|
|
55
|
+
throw new Error(`LOCAL_STORE_DURABILITY=${JSON.stringify(raw)} is not a recognized declaration — the only word is ${LOCAL_STORE_DECLARATION_WORDS.map((x) => `"${x}"`).join(", ")} ` +
|
|
56
|
+
`(the local store declares itself process-local: sessions, parked approvals and memory do not survive a container / Pod replacement). ` +
|
|
57
|
+
`Leave it unset for the store's own durable declaration. Refusing to boot rather than reading a declaration nobody can read as either one.`);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=local-store-declaration.js.map
|
package/dist/lsp-evict.d.ts
CHANGED
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
* while the dir is rm'd (rooted there, it just sees ENOENT). Only the ephemeral lane is wrapped by the caller — the
|
|
9
9
|
* caller-cwd (deployment-shape row `callerCwd`) persistent-project path keeps its warm server (stable root, reused across turns = CC-parity, no leak).
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* The manager is the one the mint point `createLspManager` returns (core `NodeLspManager`), typed by the one method used
|
|
12
|
+
* (`Pick<NodeLspManager, "evict">`: the class has private members, so a structural test stub could not stand in for the
|
|
13
|
+
* whole class type). The env stays structural: an env without a string `cwd` / callable `destroy` is returned UNWRAPPED
|
|
14
|
+
* (probe-guarded), so this is a safe no-op wherever that precondition doesn't hold.
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
+
import type { NodeLspManager } from "@sema-agent/core";
|
|
17
|
+
export declare function evictLspOnDestroy<E extends object>(env: E, lsp: Pick<NodeLspManager, "evict">): E;
|
|
16
18
|
//# sourceMappingURL=lsp-evict.d.ts.map
|
package/dist/lsp-evict.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export function evictLspOnDestroy(env, lsp) {
|
|
2
|
-
const evict = lsp?.evict;
|
|
3
2
|
const e = env;
|
|
4
|
-
if (typeof
|
|
3
|
+
if (typeof e.cwd !== "string" || typeof e.destroy !== "function")
|
|
5
4
|
return env;
|
|
6
5
|
const origDestroy = e.destroy.bind(e);
|
|
7
6
|
const root = e.cwd;
|
|
8
7
|
e.destroy = () => {
|
|
9
|
-
void evict
|
|
8
|
+
void lsp.evict(root).catch(() => { });
|
|
10
9
|
return origDestroy();
|
|
11
10
|
};
|
|
12
11
|
return env;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* 请求面条目的形 = 契约包的请求传输形({@link RequestMcpServerSpec}:stdio 带 `env`、http 带 `headers` / `principalHeader` / `assertionHeader`),wire 上的形由它说。
|
|
6
6
|
* 交给引擎的声明不带件值:引擎的声明收据对带 `headers` / `env` 的声明整条拒,件由部署的对端座在发送时作答。所以每条条目按它那一臂的处置表
|
|
7
7
|
* ({@link MCP_STDIO_TRANSPORT_DISPOSITION} / {@link MCP_HTTP_TRANSPORT_DISPOSITION})拆成草稿:`env` / `headers` 进草稿的件,`assertionHeader` 承载不发送,其余进声明。
|
|
8
|
-
* 拆法只有 `
|
|
8
|
+
* 拆法只有 `request-declaration-disposition.ts` 的 `splitDeclaration` 一只、键的去处只有表一处说;两张表各带三道编译格(请求臂加 / 减键、引擎臂加键、引擎臂删键都编译红)。
|
|
9
9
|
* 草稿只有胜出者(部署同名者赢,`task-mcp.ts` 的 `mergeRequestMcp`)才经对端座的唯一铸点(`peer-seat.ts` 的 `mintDeclaration`)登记,登记换来的引用放进声明的传输臂。
|
|
10
10
|
*
|
|
11
11
|
* ## `assertionHeader`:一条律,一个键一种读法
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { splitDeclaration } from "./
|
|
1
|
+
import { splitDeclaration } from "./request-declaration-disposition.js";
|
|
2
2
|
export const MCP_STDIO_TRANSPORT_DISPOSITION = { args: "engine", command: "engine", env: "seat", kind: "engine" };
|
|
3
3
|
export const MCP_HTTP_TRANSPORT_DISPOSITION = { assertionHeader: "withheld", headers: "seat", kind: "engine", principalHeader: "engine", url: "engine" };
|
|
4
4
|
const MCP_REQUEST_TRANSPORT_ARMS = {
|
|
@@ -178,9 +178,9 @@ export interface MemoryOriginFaces {
|
|
|
178
178
|
origin: MemoryEntryOrigin;
|
|
179
179
|
provenance: EntryProvenanceAccount;
|
|
180
180
|
}>>;
|
|
181
|
-
/** §13-4② 读半场:清标审计账(
|
|
182
|
-
*
|
|
183
|
-
listClearances: (at?: MemoryLayerSeat) => OriginClearanceRow[]
|
|
181
|
+
/** §13-4② 读半场:清标审计账(**异步** —— core 7.66.0 [ref] 起 `listOriginClearances` 经引擎的治理店读那份账(`Promise`;
|
|
182
|
+
* File 后端 = 同一份控制面文件、同字节);账本损坏 ⇒ `ControlPlaneCorruptError`,fail-closed,绝不回半张表)。 */
|
|
183
|
+
listClearances: (at?: MemoryLayerSeat) => Promise<OriginClearanceRow[]>;
|
|
184
184
|
/** §13-4② 写半场:审计化的 UN-MARK 阀门。拒因族是 core 的**闭集码**,本层零翻译原样上抛。 */
|
|
185
185
|
clear: (entryId: string, input: {
|
|
186
186
|
requestId: string;
|
|
@@ -199,7 +199,8 @@ export interface MemoryOriginFaces {
|
|
|
199
199
|
* ## 控制面归属:判据与合规两口**逐字同一条**(§1 F-9 裁),但理由更硬
|
|
200
200
|
*
|
|
201
201
|
* 亲读 core 5.59.0(不信 JSDoc,读 `engine.js` 实装):
|
|
202
|
-
* · `listOriginClearances` = `readOriginClearances(this.controlDir)`;
|
|
202
|
+
* · `listOriginClearances` = `readOriginClearances(this.controlDir)`(core 7.66.0 [ref] 起经引擎的治理店 `this.governanceStore` 读,答 `Promise`;
|
|
203
|
+
* 本族只挂在自带控制面的 File 后端上,那只店就是同一控制面上的 File 店 —— 同目录、同名、同字节);
|
|
203
204
|
* · `clearEntryOrigin` 整条弧都压在 `this.controlDir` 上 —— 写前开行(`openOriginClearance`)、
|
|
204
205
|
* 墓碑落定登记(`markOriginClearanceTombstoned`)、终态事件(`settleOriginClearance`);
|
|
205
206
|
* · `listExternalOriginEntries` 每一行都要 `provenanceOf`,而它读 `challengedEntryIds` /
|
|
@@ -80,7 +80,7 @@ export function createMemoryOriginFaces(stores, opts) {
|
|
|
80
80
|
});
|
|
81
81
|
return {
|
|
82
82
|
listExternal: async (scopes) => engineOf(memoryStoreForRequest(stores, scopes)).listExternalOriginEntries(scopes),
|
|
83
|
-
listClearances: (at) => engineOf(memoryStoreForRequest(stores, seatLayers(at))).listOriginClearances(),
|
|
83
|
+
listClearances: async (at) => engineOf(memoryStoreForRequest(stores, seatLayers(at))).listOriginClearances(),
|
|
84
84
|
clear: async (entryId, input, at) => engineOf(memoryStoreForRequest(stores, seatLayers(at))).clearEntryOrigin(entryId, input),
|
|
85
85
|
};
|
|
86
86
|
}
|
|
@@ -29,7 +29,7 @@ export function createMemoryProjectLayers(deps) {
|
|
|
29
29
|
};
|
|
30
30
|
return {
|
|
31
31
|
async prepare(config, scope, taskRoot) {
|
|
32
|
-
const layer = memoryProjectLayerFor(config, scope, taskRoot);
|
|
32
|
+
const layer = await memoryProjectLayerFor(config, scope, taskRoot);
|
|
33
33
|
const current = layer?.key.scope;
|
|
34
34
|
if (layer === undefined || current === undefined)
|
|
35
35
|
return layer?.key;
|
package/dist/memory-scope.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FileMemoryEngineBackend, type TaskSpec } from "@sema-agent/core";
|
|
2
2
|
import type { ServiceConfig } from "./config-types.js";
|
|
3
3
|
import { type ExecutionLane } from "./execution-lane-caps.js";
|
|
4
|
+
import type { Logger } from "./observability/logger.js";
|
|
4
5
|
import { type MemoryProjectKey, type ProjectLayerOfTask } from "./project-identity.js";
|
|
5
6
|
/** 前缀词表本体(供门/诊断读;判定一律走 {@link isV2ScopeKey},别在别处重写 startsWith 链)。 */
|
|
6
7
|
export declare const V2_SCOPE_PREFIXES: readonly string[];
|
|
@@ -61,8 +62,8 @@ export declare function memoryScopeFor(config: ServiceConfig, principal?: string
|
|
|
61
62
|
* 读不到(根在沙箱/设备盘上,或 host 车道会话没登记 cwd、spec 期还不知道根)⇒ 调用方传 `undefined` ⇒ `{ absent: "unreadable" }`,
|
|
62
63
|
* core 铸 operator 通知 `memory.project_scope_absent`,写照常落全局层 —— **响亮**,不是静默落 `local`。
|
|
63
64
|
*
|
|
64
|
-
* 🔴 [ref] 键形:项目层 = **全局层的属主 × 项目身份**,`userrepo:<属主段>/<档>.<摘要>`(文法 `project-layer-key.ts`,身份 `project-identity.ts`
|
|
65
|
-
*
|
|
65
|
+
* 🔴 [ref] 键形:项目层 = **全局层的属主 × 项目身份**,`userrepo:<属主段>/<档>.<摘要>`(文法 `project-layer-key.ts`,身份 `project-identity.ts`
|
|
66
|
+
* —— 检出带 `.sema/project` 记号 ⇒ 记号档,读法与引擎判官同一只;没有记号 ⇒ git 根回落);属主 = `projectLayerOwnerOf(scope)`。
|
|
66
67
|
*
|
|
67
68
|
* 🔴 **写家只落复制路径覆盖得到的层**(7.98.0 合并复审 F1,主会话裁「统一规则,不做特判」):写家 = 读列表里、本部署
|
|
68
69
|
* **每一条已配置的复制路径都覆盖到**的最具体的一层。项目层不在覆盖面里 ⇒ 本任务**不按项目键控**,写家落全局层 —— 否则开了
|
|
@@ -76,9 +77,9 @@ export declare function memoryScopeFor(config: ServiceConfig, principal?: string
|
|
|
76
77
|
* · 记忆面暗(`scope` 缺席)—— 没有 spec 可铸,也就不读盘;
|
|
77
78
|
* · 本任务的项目层不在复制覆盖面里(见上)—— 让位给全局层。
|
|
78
79
|
*/
|
|
79
|
-
export declare function memoryProjectKeyFor(config: Pick<ServiceConfig, "requirePrincipal" | "memorySync">, scope: string | undefined, taskRoot: string | undefined): MemoryProjectKey | undefined
|
|
80
|
+
export declare function memoryProjectKeyFor(config: Pick<ServiceConfig, "requirePrincipal" | "memorySync">, scope: string | undefined, taskRoot: string | undefined): Promise<MemoryProjectKey | undefined>;
|
|
80
81
|
/** {@link memoryProjectKeyFor} 的同一条规则,带上本 checkout 要折进当前层的旧层(`memory-project-layer.ts` 读它)。 */
|
|
81
|
-
export declare function memoryProjectLayerFor(config: Pick<ServiceConfig, "requirePrincipal" | "memorySync">, scope: string | undefined, taskRoot: string | undefined): ProjectLayerOfTask | undefined
|
|
82
|
+
export declare function memoryProjectLayerFor(config: Pick<ServiceConfig, "requirePrincipal" | "memorySync">, scope: string | undefined, taskRoot: string | undefined): Promise<ProjectLayerOfTask | undefined>;
|
|
82
83
|
/**
|
|
83
84
|
* 本部署记忆的**复制覆盖面** —— 唯一属主(7.98.0 合并复审 F1)。「复制路径」= 把某一层记忆搬出本机的腿;今天只有一条:
|
|
84
85
|
* TOC 同步客户端腿(`MEMORY_SYNC_*`,`memory-sync-client.ts`)。🔴 [ref]:一条复制路径复制**它那一层**(`config.memorySync.scope`)
|
|
@@ -177,17 +178,26 @@ export declare function fileMemoryEngineRoot(config: Pick<ServiceConfig, "memory
|
|
|
177
178
|
* 一条路径的**规范形**(给 {@link judgeMemoryRootOutsideDataRoot} 的 `canonical` 座用的生产实现):
|
|
178
179
|
* · 既存的绝对路径 ⇒ **原样**交给 `realpath`(`.native`:大小写不敏感的文件系统上返回盘上的拼写;符号链接、macOS 的 `/var` → `/private/var` 在这一步展平)。
|
|
179
180
|
* 不先在字串上折 `..`:操作系统在展开符号链接**之后**才折 `..`,`/link/..` 的真身是链接目标的父目录,字串折叠会把它读成 `/`;
|
|
180
|
-
* · 其余(尚不存在 / 相对)⇒
|
|
181
|
+
* · 其余(尚不存在 / 相对)⇒ 绝对化(**不折叠**)后逐段走:既存的前缀每进一段取一次 `realpath`(符号链接在这一步展开),`..` 折在**已展开**的前缀上 ——
|
|
182
|
+
* 与操作系统同序(`/别名/../新目录` 的真身在链接目标的父目录下;先在字串上折会读成别名的父目录,判到另一只挂载上);第一段不存在起,余下是尚不存在的尾巴
|
|
183
|
+
* (尾巴只做字串规范化,与 `mkdir -p` 建出来的同形)。
|
|
181
184
|
*
|
|
182
185
|
* 为什么按「最深既存祖先」而不是直接 `realpath(p)`:boot 期记忆根常常还没建出来(新数据根),`realpath` 对不存在的路径抛 ENOENT,
|
|
183
186
|
* 而数据根那一侧已经存在、会被展平 —— 两侧拼写空间不一样,同一个目录会被读成「不在其下」。祖先用 `existsSync` 找(它对 ENOENT / ENOTDIR / EACCES / ELOOP
|
|
184
187
|
* 一律答 `false`,不抛),所以走到的那一级一定 stat 得动;`realpath` 仍可能在「探完到取值之间目录被挪走 / 搜索权限被收」的竞态里抛 ——
|
|
185
188
|
* 不在本函数里吞(吞了就是一条无声的降级臂),由 boot 调用点接住并响亮报一行(`memory_engine_dir_check_unavailable`),起服照常。
|
|
186
189
|
*
|
|
187
|
-
* 取舍:尾巴(不存在的那几段)
|
|
190
|
+
* 取舍:尾巴(不存在的那几段)只比规范化字串,**不折大小写**,尾巴里的 `..` 按字串折:两个只差大小写、且都还不存在的拼写在大小写不敏感的盘上会被读成两处 ——
|
|
188
191
|
* 方向是多报一条 warn(这条判据的失败方向),不会漏报。
|
|
189
192
|
*/
|
|
190
193
|
export declare function canonicalPathOf(p: string): string;
|
|
194
|
+
/**
|
|
195
|
+
* **路径包含**(含相等)的判官:`child` 是不是 `root` 本身或它的后代 —— `path.relative(canonical(root), canonical(child))` 不是 `..`、不以 `..` 加分隔符起头、也不是绝对路径(跨盘符)。
|
|
196
|
+
* `..` 要按**整段**判:名为 `..data` 的子目录在其下;`startsWith("..")` 会把它读成在其外。`canonical` 座缺省 `path.resolve`(字串规范形),boot 递 {@link canonicalPathOf} 取符号链接展平后的形;
|
|
197
|
+
* 两侧同一只座(先 root、后 child)。读者两处:记忆根「在数据根之外」那一判({@link judgeMemoryRootOutsideDataRoot})与起服时「配置根是不是工作区的祖先」那一判(`sema-config-dir.ts`);
|
|
198
|
+
* 树里别处内联的同形表达式(`boot/deployment-mods.ts` · `plugins/local-data-dir-modes-m39.ts` · `plugins/remote-env-host.ts` · `plugins/worktree-isolation.ts`)不在本次收口范围。
|
|
199
|
+
*/
|
|
200
|
+
export declare function pathIsWithin(root: string, child: string, canonical?: (p: string) => string): boolean;
|
|
191
201
|
/** {@link judgeMemoryRootOutsideDataRoot} 的读数:记忆引擎的根落在本机数据根**之外**。三键即 boot 日志行的字段(`hint` 是一句带两条真路径的人话)。 */
|
|
192
202
|
export type MemoryRootOutsideDataRoot = {
|
|
193
203
|
readonly root: string;
|
|
@@ -273,6 +283,23 @@ onIncident?: (err: Error & {
|
|
|
273
283
|
backend: FileMemoryEngineBackend;
|
|
274
284
|
root: string;
|
|
275
285
|
} | undefined;
|
|
286
|
+
/**
|
|
287
|
+
* **起服期读 file 记忆控制面账本的形:一行 warn,不拒启**([ref])。
|
|
288
|
+
*
|
|
289
|
+
* 病:core >= 7.64.0 的 File 记忆店不再升级「绑定之前」的旧形账本(裸 id → rev 映射)—— 构造器既不碰盘也不抛,读账本的那一刻才抛
|
|
290
|
+
* `ControlPlaneCorruptError`,本仓的记忆面把它答成 `500 internal.memory_control_plane_corrupt`(`http/memory-face-fault-reply.ts`)。
|
|
291
|
+
* 于是升级前账本还是旧形(或任何引擎拒的形)的 file 记忆部署,升级后**起服一切正常、第一次读账本的记忆面才 500**,起服日志里零提示。
|
|
292
|
+
*
|
|
293
|
+
* 读法:只经 core 导出读口 `readMemoryLedgerForm`(只读、不升级、不加锁、不建文件)问「账本是什么形」—— 本仓不自读账本文件、不认它的文件名
|
|
294
|
+
* (一件事一个读者)。答词是闭集三个,穷尽 `switch`。位置 = 构造 file 后端之前:boot 与 run-local 两个宿主各在 {@link memoryEngineBackendFor} 前调一次;
|
|
295
|
+
* 坐标取 {@link fileMemoryPlaneFor} 单铸点,与那只工厂同门(工厂不接线的部署形 —— 多租户 / `MEMORY_ENGINE=off` / 平面分裂车道未 allow —— 这里也不读)。
|
|
296
|
+
*
|
|
297
|
+
* 失败方向:**披露面,不拒启**(不是安全轴;拒启要新码、另票):
|
|
298
|
+
* · `malformed` ⇒ 一行 warn `memory_ledger_malformed`(`root` 数据根 · `controlDir` 控制面目录 · `hint` 一句带出路的话);`v2` / `absent` ⇒ 零输出;
|
|
299
|
+
* · 读口自己抛(账本路径是目录 / 无权读 / 环路:引擎答「没有形」,既不是 `absent` 也不是 `malformed`)⇒ 另报一行 `memory_ledger_check_unavailable`
|
|
300
|
+
* (类名 + 机器码,不带消息原文,与 `memory_engine_dir_check_unavailable` 同形),照常起服,不编一个形。
|
|
301
|
+
*/
|
|
302
|
+
export declare function announceMemoryLedgerForm(config: ServiceConfig, fallbackRoot: string | undefined, log: Logger): Promise<void>;
|
|
276
303
|
/**
|
|
277
304
|
* core 7.49.0 [ref] —— **记忆店根搬动 ⇒ 拒启**(不降级)。店根的物理路径是控制面里的一条记录(`root-anchor.json`),每次打开都比对;
|
|
278
305
|
* 目录被搬走 / 换成指向别处的链接之后,File 后端的**构造器**就抛 `memory.target_outside_store`(`detail` 恰在这一形上带
|
package/dist/memory-scope.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { existsSync, realpathSync } from "node:fs";
|
|
2
|
-
import {
|
|
3
|
-
import { FileMemoryEngineBackend, resolveMemoryEngineRoot, deriveControlPlaneDir, formatUserScope, formatProjScope, normalizeMemorySpec } from "@sema-agent/core";
|
|
2
|
+
import { dirname, isAbsolute, join, parse, relative, resolve, sep } from "node:path";
|
|
3
|
+
import { FileMemoryEngineBackend, readMemoryLedgerForm, resolveMemoryEngineRoot, deriveControlPlaneDir, formatUserScope, formatProjScope, normalizeMemorySpec } from "@sema-agent/core";
|
|
4
4
|
import { capabilitiesFor, executionLaneOf } from "./execution-lane-caps.js";
|
|
5
|
+
import { errorCodeOf, errorKindOf } from "./observability/err-text.js";
|
|
5
6
|
import { assertMemoryScopeWidth } from "./plugins/memory-key-guards.js";
|
|
6
7
|
import { projectLayerForTaskRoot } from "./project-identity.js";
|
|
7
8
|
import { parseProjectLayerKey, projectLayerOwnerOf } from "./project-layer-key.js";
|
|
@@ -33,13 +34,13 @@ export function memoryScopeFor(config, principal, projectId) {
|
|
|
33
34
|
}
|
|
34
35
|
return config.memoryScope;
|
|
35
36
|
}
|
|
36
|
-
export function memoryProjectKeyFor(config, scope, taskRoot) {
|
|
37
|
-
return memoryProjectLayerFor(config, scope, taskRoot)?.key;
|
|
37
|
+
export async function memoryProjectKeyFor(config, scope, taskRoot) {
|
|
38
|
+
return (await memoryProjectLayerFor(config, scope, taskRoot))?.key;
|
|
38
39
|
}
|
|
39
|
-
export function memoryProjectLayerFor(config, scope, taskRoot) {
|
|
40
|
+
export async function memoryProjectLayerFor(config, scope, taskRoot) {
|
|
40
41
|
if (config.requirePrincipal === true || scope === undefined)
|
|
41
42
|
return undefined;
|
|
42
|
-
const layer = projectLayerForTaskRoot(taskRoot, projectLayerOwnerOf(scope));
|
|
43
|
+
const layer = await projectLayerForTaskRoot(taskRoot, projectLayerOwnerOf(scope));
|
|
43
44
|
if (layer.key.scope !== undefined && !replicationCovers(memoryReplicationCoverage(config), layer.key.scope))
|
|
44
45
|
return undefined;
|
|
45
46
|
return layer;
|
|
@@ -113,25 +114,40 @@ export function fileMemoryEngineRoot(config, fallbackRoot) {
|
|
|
113
114
|
export function canonicalPathOf(p) {
|
|
114
115
|
if (isAbsolute(p) && existsSync(p))
|
|
115
116
|
return realpathSync.native(p);
|
|
116
|
-
const abs =
|
|
117
|
-
|
|
117
|
+
const abs = isAbsolute(p) ? p : `${process.cwd()}${sep}${p}`;
|
|
118
|
+
const { root } = parse(abs);
|
|
119
|
+
let existing = root;
|
|
118
120
|
const tail = [];
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
for (const seg of abs.slice(root.length).split(sep === "\\" ? /[\\/]+/ : /\/+/)) {
|
|
122
|
+
if (seg === "" || seg === ".")
|
|
123
|
+
continue;
|
|
124
|
+
if (tail.length > 0) {
|
|
125
|
+
if (seg === "..")
|
|
126
|
+
tail.pop();
|
|
127
|
+
else
|
|
128
|
+
tail.push(seg);
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (seg === "..") {
|
|
132
|
+
existing = dirname(existing);
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
const next = join(existing, seg);
|
|
136
|
+
if (existsSync(next))
|
|
137
|
+
existing = realpathSync.native(next);
|
|
138
|
+
else
|
|
139
|
+
tail.push(seg);
|
|
125
140
|
}
|
|
126
|
-
return join(
|
|
141
|
+
return join(existing, ...tail);
|
|
142
|
+
}
|
|
143
|
+
export function pathIsWithin(root, child, canonical = resolve) {
|
|
144
|
+
const rel = relative(canonical(root), canonical(child));
|
|
145
|
+
return rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);
|
|
127
146
|
}
|
|
128
147
|
export function judgeMemoryRootOutsideDataRoot(a) {
|
|
129
148
|
if (!a.dataRoot)
|
|
130
149
|
return undefined;
|
|
131
|
-
|
|
132
|
-
const rel = relative(canonical(a.dataRoot), canonical(a.memoryRoot));
|
|
133
|
-
const inside = rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);
|
|
134
|
-
if (inside)
|
|
150
|
+
if (pathIsWithin(a.dataRoot, a.memoryRoot, a.canonical))
|
|
135
151
|
return undefined;
|
|
136
152
|
return {
|
|
137
153
|
root: a.memoryRoot,
|
|
@@ -171,6 +187,39 @@ export function memoryEngineBackendFor(config, fallbackRoot, onIncident) {
|
|
|
171
187
|
}
|
|
172
188
|
return { backend, root: plane.root };
|
|
173
189
|
}
|
|
190
|
+
const MEMORY_LEDGER_MIGRATION_EXIT = "先用上一版引擎开一次再升级";
|
|
191
|
+
export async function announceMemoryLedgerForm(config, fallbackRoot, log) {
|
|
192
|
+
const plane = fileMemoryPlaneFor(config, fallbackRoot);
|
|
193
|
+
if (plane === undefined)
|
|
194
|
+
return;
|
|
195
|
+
const where = { root: plane.root, controlDir: plane.controlDir };
|
|
196
|
+
let form;
|
|
197
|
+
try {
|
|
198
|
+
form = await readMemoryLedgerForm(plane.controlDir);
|
|
199
|
+
}
|
|
200
|
+
catch (err) {
|
|
201
|
+
log.warn("memory_ledger_check_unavailable", { ...where, errorKind: errorKindOf(err), errorCode: errorCodeOf(err) });
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
switch (form) {
|
|
205
|
+
case "v2":
|
|
206
|
+
case "absent":
|
|
207
|
+
return;
|
|
208
|
+
case "malformed":
|
|
209
|
+
log.warn("memory_ledger_malformed", {
|
|
210
|
+
...where,
|
|
211
|
+
hint: `the memory control plane at ${plane.controlDir} holds a committed-rev ledger this engine refuses to read — the memory faces that read it answer ` +
|
|
212
|
+
`500 internal.memory_control_plane_corrupt (the server itself starts regardless). If it is the pre-binding v1 form (a bare id → rev map, no longer ` +
|
|
213
|
+
`upgraded on open), the exit is, from MIGRATION.md: 「${MEMORY_LEDGER_MIGRATION_EXIT}」`,
|
|
214
|
+
});
|
|
215
|
+
return;
|
|
216
|
+
default: {
|
|
217
|
+
const unknownForm = form;
|
|
218
|
+
log.warn("memory_ledger_check_unavailable", { ...where, errorKind: `UnknownLedgerForm:${String(unknownForm)}` });
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
174
223
|
export function memoryStoreRootMovedRefusal(e) {
|
|
175
224
|
const err = e;
|
|
176
225
|
const d = err?.detail;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* **店形拒**(store-form refusal)在本仓的唯一读法属主(纯叶:零 http / 零 boot 依赖)—— core 店形拒**一族**(族表 `STORE_FORM_REFUSAL_CODES`,引擎 7.
|
|
2
|
+
* **店形拒**(store-form refusal)在本仓的唯一读法属主(纯叶:零 http / 零 boot 依赖)—— core 店形拒**一族**(族表 `STORE_FORM_REFUSAL_CODES`,引擎 7.66.0 起四码;
|
|
3
3
|
* 本仓按族读,下面点名的成员只是举例与历史,不是判据):
|
|
4
4
|
* · `memory.target_outside_store`(core 7.31.1 [ref]):记忆 store 里的一个目录经软链通到了 store **外**(或 store 根在 backend 打开 / 引擎首次
|
|
5
5
|
* 挂载之后被改指)⇒ 引擎对落点在外的删 / 写 / 重放 / 自身写一律**不做**;
|
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
* (`detail.form` ∈ `symlink` | `file` | `other`,`lstat` 判、不跟链)。修前 core 对这一形抛不带码的 `ControlPlaneCorruptError`(与真控制面损坏同类同形),
|
|
8
8
|
* 平铺布局(条目直接住在 home 里)于是答 500,而同一换法在嵌套布局下一层答 409 —— 现在两布局同答这一码;
|
|
9
9
|
* · `memory.control_plane_links_unsupported`(core 7.65.0):记忆控制面所在的文件系统不能建硬链接 ⇒ File 记忆店在打开处被拒(构造期抛 ⇒ 起服拒;
|
|
10
|
-
* 引擎 mount 时开它自己的店被拒 ⇒ Runner 记忆相 fail-open,这一跑 memoryless,见 `memory-incident-sink.ts`)
|
|
10
|
+
* 引擎 mount 时开它自己的店被拒 ⇒ Runner 记忆相 fail-open,这一跑 memoryless,见 `memory-incident-sink.ts`);
|
|
11
|
+
* · `memory.control_plane_strays`(core 7.66.0 [ref] HB-5):后端自带治理店(不是引擎控制面上那只 File 店),而控制面里还留着旧的治理文档 /
|
|
12
|
+
* 控制对象 ⇒ 引擎构造期拒、一个字节不写(句子点名 `adoptReplicaControlPlane`)。本服务三种后端都构造不出这一形(File 后端钉住自己的控制面、
|
|
13
|
+
* 治理店就是那只;SQL 两只不带治理店 ⇒ 引擎用控制面上的 File 店)—— 按族入族,零专门臂。
|
|
11
14
|
* 族里各码的形相同:普通 `Error` + `.code` + `.detail`(`{ path }`;home 那一码多 `form`),**句子以码领头、不含任何宿主路径**(core 7.44.0 起,
|
|
12
15
|
* 路径只在 `detail.path`)。core 的读法:operator 要处置的盘形(去掉那只链 / 放回真目录),**不是**可重试的 IO 故障,也**不是**对调用方的裁决;
|
|
13
16
|
* 盘形修好之前重发恒拒。本仓据此一条规则:族内同答、409、码原样;路径只进运维行(HTTP 映射一处,见 `http/memory-store-refusal-reply.ts`)。
|
|
@@ -25,8 +25,9 @@ export declare function buildMemorySyncEnabledFields(peer: string, scope: string
|
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
27
|
* fetch transport(core `MemorySyncTransport` 的部署实现)。`peer` = {@link memorySyncPeerOf}(`url`)(建时铸一次;拒的地址在这里抛,一个请求都不发),
|
|
28
|
-
* `post` 打 `${peer}${path}`(core 传来的 path 以 `/` 开头);`token` 走 Authorization: Bearer(与中心侧
|
|
29
|
-
* 非 2xx throw(status +
|
|
28
|
+
* `post` 打 `${peer}${path}`(core 传来的 path 以 `/` 开头);`token` 走 Authorization: Bearer(与中心侧 gatedSubject 的 verified-principal 门对齐)。
|
|
29
|
+
* 非 2xx throw(status + 体长 —— 体的字节不进报错句,与配置中心拉取同一条律:摘录在座前切会把跨界的令牌切成脱敏器认不出的前缀,座后切又会因前面的凭据被压短而
|
|
30
|
+
* 越过原来的源界、带出词表不认的形;对端是本服务的 `MEMORY_SYNC_SERVE`,拒因在对端自己的运维行);2xx 返回解码后的 JSON(解码经上游读口,不是 JSON ⇒ 句子只带体长;形状校验在 core
|
|
30
31
|
* parseMemorySyncResponse,职责不重复)。`timeoutMs`(缺省 60s,AbortSignal.timeout)是活性保护:fire-and-forget 轮挂死会把 inflight 节流永久卡住
|
|
31
32
|
* (undici 默认 headers 超时 300s 太钝)。
|
|
32
33
|
*/
|
|
@@ -3,12 +3,14 @@ import { readFile, readdir, rename, rmdir, stat } from "node:fs/promises";
|
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { carriesCredential, ensureDir, syncMemoryScope, } from "@sema-agent/core";
|
|
5
5
|
import { replicationCovers } from "./memory-scope.js";
|
|
6
|
-
import { parseProjectLayerKey } from "./project-layer-key.js";
|
|
6
|
+
import { compareProjectLayersForSync, parseProjectLayerKey } from "./project-layer-key.js";
|
|
7
7
|
import { atomicWriteFileAsync } from "./plugins/owner-only-file-mode.js";
|
|
8
8
|
import { ONE_TIME_MIGRATIONS, migrationWindowOpen } from "./plugins/one-time-migrations.js";
|
|
9
9
|
import { buildMemorySyncIdentityBootRefusal, readMemorySyncIdentity } from "./memory-sync-identity.js";
|
|
10
10
|
import { buildDisplaySafeUrl } from "./trace/redact.js";
|
|
11
|
+
import { createEgressFetch } from "./egress-redirect.js";
|
|
11
12
|
import { errorText } from "./observability/err-text.js";
|
|
13
|
+
import { buildBodyWithheldNote, parseUpstreamJson } from "./upstream-body.js";
|
|
12
14
|
export function memorySyncPeerOf(url) {
|
|
13
15
|
const r = readMemorySyncIdentity(url);
|
|
14
16
|
if ("flaw" in r) {
|
|
@@ -22,7 +24,8 @@ export function buildMemorySyncEnabledFields(peer, scope, cursorPath) {
|
|
|
22
24
|
}
|
|
23
25
|
export function createMemorySyncTransport(opts) {
|
|
24
26
|
const peer = memorySyncPeerOf(opts.url);
|
|
25
|
-
const
|
|
27
|
+
const injected = opts.fetchImpl;
|
|
28
|
+
const fetchImpl = createEgressFetch("declare the final address as MEMORY_SYNC_URL", injected === undefined ? undefined : (input, init) => injected(typeof input === "string" ? input : input instanceof URL ? input.href : input.url, init ?? {}));
|
|
26
29
|
const timeoutMs = opts.timeoutMs ?? 60_000;
|
|
27
30
|
return Object.freeze({
|
|
28
31
|
peer,
|
|
@@ -35,8 +38,8 @@ export function createMemorySyncTransport(opts) {
|
|
|
35
38
|
});
|
|
36
39
|
const text = await res.text();
|
|
37
40
|
if (!res.ok)
|
|
38
|
-
throw new Error(`memory sync POST ${path}: HTTP ${res.status} ${text
|
|
39
|
-
return
|
|
41
|
+
throw new Error(`memory sync POST ${path}: HTTP ${res.status} ${buildBodyWithheldNote(text)}`);
|
|
42
|
+
return parseUpstreamJson(text);
|
|
40
43
|
},
|
|
41
44
|
});
|
|
42
45
|
}
|
|
@@ -269,7 +272,7 @@ export function createMemorySyncRunner(opts) {
|
|
|
269
272
|
opts.log.warn("memory_sync_layer_enumeration_unsupported", { scope: opts.scope, reason: local.reason, note: "only the sync layer and tracked project layers are synced" });
|
|
270
273
|
}
|
|
271
274
|
const projectLayers = new Set([...(local.supported ? local.scopes : []), ...tracked].filter(isCoveredProjectLayer));
|
|
272
|
-
return [opts.scope, ...[...projectLayers].sort()];
|
|
275
|
+
return [opts.scope, ...[...projectLayers].sort(compareProjectLayersForSync)];
|
|
273
276
|
};
|
|
274
277
|
const syncLayer = async (scope, reason, calls) => {
|
|
275
278
|
const cursorPath = memorySyncCursorPath(memoryEngineDir, scope);
|
package/dist/model-compat.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* (`thinkingFormat: "qwen-chat-template"`),否则 auto 档每一轮都白烧一段思考。
|
|
15
15
|
*
|
|
16
16
|
* ## 对表全部**从 core 的型面铸**,本仓一个词都不枚举
|
|
17
|
-
* `
|
|
17
|
+
* `THINKING_TIER_TABLE` / `MODEL_THINKING_LEVEL_TABLE` / `THINKING_FORMAT_TABLE` / `MAX_TOKENS_FIELD_TABLE` / `THINKING_MODE_TABLE` 都是 `Record<闭集词, true>`,
|
|
18
18
|
* `COMPAT_KEY_READERS` 是 `{ [A in 线路]: { [K in keyof Required<Model<A>["compat"]>]: 读器 } }` 的**映射型**(线路 = 契约 `ModelEntry.api` 的闭集):
|
|
19
19
|
* core 加词/删词、加键/删键,或契约加一条线路,表当场 tsc 红(`MODEL_DEGRADE_ON` 的 `Set<DegradeReason>` 同款纪律)。
|
|
20
20
|
* 映射型这一步是刻意的 —— 只钉「键集相等」会留下一个洞:core 加一键、有人把它补进白名单却忘了写读器,
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* 判形**整只判**(每条线路内):任一键不合 —— 含写了另一条线路的键 —— ⇒ 整只声明不收(和 `toolFaces` 每只工具「applied whole or not at all」
|
|
33
33
|
* 同律)。留下好的那几键 = 让运维以为整条声明生效了,而实际发出去的请求是半张脸。
|
|
34
34
|
*/
|
|
35
|
-
import type
|
|
35
|
+
import { type Model } from "@sema-agent/core";
|
|
36
36
|
import type { ModelEntry } from "@sema-agent/settings-schema";
|
|
37
37
|
/** 目录条目的线路闭集 = 契约 `ModelEntry.api`(契约加一条线路 ⇒ 读器表缺一行 ⇒ tsc 红)。 */
|
|
38
38
|
export type CatalogApi = ModelEntry["api"];
|
|
@@ -42,13 +42,22 @@ export type CompatOf<A extends CatalogApi> = NonNullable<Model<A>["compat"]>;
|
|
|
42
42
|
export type OpenAICompletionsCompat = CompatOf<"openai-completions">;
|
|
43
43
|
/** core `AnthropicMessagesCompat`。 */
|
|
44
44
|
export type AnthropicMessagesCompat = CompatOf<"anthropic-messages">;
|
|
45
|
-
/**
|
|
46
|
-
* `
|
|
47
|
-
*
|
|
45
|
+
/** 六档思考**梯**(core `ThinkingLevel`:一个端点吃得下哪几档的 effort 梯子)。型取自梯子座本身 —— `compat.reasoningEffortLevels`
|
|
46
|
+
* (anthropic 线路的 `effortLevels` 同型)—— 而不是模型缺省档座:core 7.66.0 [ref] HB-1 起两座分家,缺省档多一档 `off`,梯子仍是六档
|
|
47
|
+
* (`off` 永远不是梯子上的一级)。`MODEL_REASONING_EFFORT_LEVELS` / `compat.reasoningEffortLevels` / `compat.effortLevels` 共用**这一张**表;
|
|
48
|
+
* 上游加一档而这里不补 ⇒ 编译红([ref] 件⑤ 起的锁步姿势)。 */
|
|
49
|
+
export type ThinkingTier = NonNullable<OpenAICompletionsCompat["reasoningEffortLevels"]>[number];
|
|
50
|
+
/** 六档梯闭集(有序:低→高,取自上表的书写序),梯子两根旋钮的拒因文案与读器的单一真源。 */
|
|
51
|
+
export declare const THINKING_LEVELS: readonly ThinkingTier[];
|
|
52
|
+
export declare const isThinkingTier: (w: unknown) => w is ThinkingTier;
|
|
53
|
+
/** 模型**缺省档**(core `ModelThinkingLevel` = `off` + 六档;`Model.defaultThinking` 的型):请求与角色都没点档时这只模型的请求走哪一档,
|
|
54
|
+
* `off` = 缺省关(引擎发线路上的显式关),**不是**「没有缺省」—— 没有缺省 = 不铸键(core 7.66.0 [ref])。表 = 梯子六档 + `off`(展开同一张梯表,不写第二份);
|
|
55
|
+
* core 给缺省档座加 / 删一词而这里不跟 ⇒ 编译红。 */
|
|
48
56
|
export type ModelThinkingLevel = NonNullable<Model["defaultThinking"]>;
|
|
49
|
-
/**
|
|
50
|
-
export declare const
|
|
51
|
-
|
|
57
|
+
/** 七档缺省闭集(六档梯在前、`off` 在末,取自上表的书写序):`MODEL_DEFAULT_THINKING` 的目录 `enumValues` 与拒因文案的单一真源。 */
|
|
58
|
+
export declare const MODEL_THINKING_LEVELS: readonly ModelThinkingLevel[];
|
|
59
|
+
/** 七档判词 = core 包根的 `isThinkingLevel`(引擎自己判这七档的那一只;上表只留作有序列表与编译期锁步,不另写第二只判词)。 */
|
|
60
|
+
export declare const isModelThinkingLevel: (w: unknown) => w is ModelThinkingLevel;
|
|
52
61
|
/** `thinkingFormat` 七词闭集(core:openai / openrouter / deepseek / together / zai / qwen / qwen-chat-template)。 */
|
|
53
62
|
export type ModelThinkingFormat = NonNullable<OpenAICompletionsCompat["thinkingFormat"]>;
|
|
54
63
|
export declare const THINKING_FORMATS: readonly ModelThinkingFormat[];
|
package/dist/model-compat.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { isThinkingLevel } from "@sema-agent/core";
|
|
2
|
+
const THINKING_TIER_TABLE = { minimal: true, low: true, medium: true, high: true, xhigh: true, max: true };
|
|
3
|
+
export const THINKING_LEVELS = Object.keys(THINKING_TIER_TABLE);
|
|
3
4
|
export const isThinkingTier = (w) => typeof w === "string" && THINKING_LEVELS.includes(w);
|
|
5
|
+
const MODEL_THINKING_LEVEL_TABLE = { ...THINKING_TIER_TABLE, off: true };
|
|
6
|
+
export const MODEL_THINKING_LEVELS = Object.keys(MODEL_THINKING_LEVEL_TABLE);
|
|
7
|
+
export const isModelThinkingLevel = (w) => isThinkingLevel(w);
|
|
4
8
|
const THINKING_FORMAT_TABLE = { openai: true, openrouter: true, deepseek: true, together: true, zai: true, qwen: true, "qwen-chat-template": true };
|
|
5
9
|
export const THINKING_FORMATS = Object.keys(THINKING_FORMAT_TABLE);
|
|
6
10
|
export const isThinkingFormat = (w) => typeof w === "string" && THINKING_FORMATS.includes(w);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A model's context window: ONE resolver, ONE spelling of the assumed number, ONE word for where the window came from.
|
|
3
|
+
*
|
|
4
|
+
* ## The rule
|
|
5
|
+
* A window is either **declared** — someone along the model's inheritance chain wrote a number: the catalog entry's `contextWindow`,
|
|
6
|
+
* the deployment's `MODEL_CONTEXT_WINDOW` (inherited by every catalog entry that writes none, BL-8), or `MODEL_CHEAP_CONTEXT_WINDOW`
|
|
7
|
+
* (the cheap slot; unset ⇒ it inherits the main slot's resolution) — or **assumed**: nobody along the chain wrote one, and this server
|
|
8
|
+
* fills {@link ASSUMED_CONTEXT_WINDOW}. {@link resolveContextWindow} is the only place that decides; it hands back the number AND its
|
|
9
|
+
* source as one value, and an inheriting reader passes the parent's resolution down whole — so the source travels with the number and
|
|
10
|
+
* no reader re-derives "was it declared?" on its own.
|
|
11
|
+
*
|
|
12
|
+
* Readers: the env leg (`config.ts`: main slot, cheap slot inheriting the main resolution), the center leg (`web-admin-client/apply-effective.ts`:
|
|
13
|
+
* entry → env main resolution), and the config catalog's default note (`config-catalog.ts`, which describes the assumed arm and so names the constant).
|
|
14
|
+
* The source is disclosed twice and read from the same per-model table both times (`ServiceConfig.contextWindowSources`): the `GET /v1/models`
|
|
15
|
+
* row key `contextWindowSource`, and the operator line {@link buildContextWindowAssumedNotice} (once per served model whose window is assumed; the one
|
|
16
|
+
* emitter is `context-window-notice.ts`, run after the served table settles).
|
|
17
|
+
*
|
|
18
|
+
* ## The assumed number
|
|
19
|
+
* A conservative guess, not a measurement: the engine needs a window to size its compaction trigger and the tool-schema defer
|
|
20
|
+
* threshold, and an undeclared window must never be read optimistically — so every model that reaches the engine carries SOME window,
|
|
21
|
+
* declared or this one. "Conservative" has one meaning here: the number is no larger than the smallest real window any model family in
|
|
22
|
+
* this stack's own deployments is known to declare, so an undeclared window errs toward "compaction and tool-schema deferral start
|
|
23
|
+
* earlier than the model needs", not toward "the model reaches its limit before compaction starts". It is ONE number, not a table keyed
|
|
24
|
+
* by model family — a per-family table would be a second source for the same fact. A model whose real window is larger declares it
|
|
25
|
+
* (catalog entry `contextWindow` / `MODEL_CONTEXT_WINDOW`); the disclosure above is how an operator / client learns which rows still
|
|
26
|
+
* ride on this number.
|
|
27
|
+
*
|
|
28
|
+
* Pure leaf: no imports.
|
|
29
|
+
*/
|
|
30
|
+
export declare const ASSUMED_CONTEXT_WINDOW = 131072;
|
|
31
|
+
/** Where a model's window came from — closed set; consumers switch exhaustively. */
|
|
32
|
+
export declare const CONTEXT_WINDOW_SOURCES: readonly ["declared", "assumed"];
|
|
33
|
+
export type ContextWindowSource = (typeof CONTEXT_WINDOW_SOURCES)[number];
|
|
34
|
+
/** A resolved window: the number the engine gets and where it came from (one value — never split across two reads). */
|
|
35
|
+
export interface ResolvedContextWindow {
|
|
36
|
+
readonly window: number;
|
|
37
|
+
readonly source: ContextWindowSource;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The one resolver. `declared` = the number this level of the chain wrote (`undefined` = wrote none); `inherited` = the parent level's
|
|
41
|
+
* resolution (omitted at the root ⇒ the assumed arm). Declared ⇒ that number, `declared`; otherwise the parent's resolution unchanged —
|
|
42
|
+
* a catalog entry that writes no window under a deployment that declared `MODEL_CONTEXT_WINDOW` is declared, under one that did not it is assumed.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveContextWindow(declared: number | undefined, inherited?: ResolvedContextWindow): ResolvedContextWindow;
|
|
45
|
+
/**
|
|
46
|
+
* The operator line for one served model whose window is assumed (plain data; both legs emit this shape, the event name lives here only).
|
|
47
|
+
* `declareAt` names where the operator writes the number to make it declared (the env knob for an env slot, the catalog entry otherwise).
|
|
48
|
+
*/
|
|
49
|
+
export declare function buildContextWindowAssumedNotice(row: {
|
|
50
|
+
readonly model: string;
|
|
51
|
+
readonly window: number;
|
|
52
|
+
readonly declareAt: string;
|
|
53
|
+
}): {
|
|
54
|
+
readonly event: "model_context_window_assumed";
|
|
55
|
+
readonly fields: Record<string, string>;
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=model-context-window.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const ASSUMED_CONTEXT_WINDOW = 131072;
|
|
2
|
+
export const CONTEXT_WINDOW_SOURCES = ["declared", "assumed"];
|
|
3
|
+
const ASSUMED = Object.freeze({ window: ASSUMED_CONTEXT_WINDOW, source: "assumed" });
|
|
4
|
+
export function resolveContextWindow(declared, inherited = ASSUMED) {
|
|
5
|
+
return declared !== undefined ? { window: declared, source: "declared" } : inherited;
|
|
6
|
+
}
|
|
7
|
+
export function buildContextWindowAssumedNotice(row) {
|
|
8
|
+
return {
|
|
9
|
+
event: "model_context_window_assumed",
|
|
10
|
+
fields: {
|
|
11
|
+
model: row.model,
|
|
12
|
+
contextWindow: String(row.window),
|
|
13
|
+
declareAt: row.declareAt,
|
|
14
|
+
note: `no context window is declared for model "${row.model}" — this server assumes ${row.window} tokens (a conservative guess, not a measurement): ` +
|
|
15
|
+
`the engine sizes its compaction trigger on it, so a model whose real window is smaller reaches its limit before compaction starts, ` +
|
|
16
|
+
`and a model whose real window is larger compacts earlier than it needs to. ` +
|
|
17
|
+
`GET /v1/models marks this row contextWindowSource:"assumed". Declare the real window at ${row.declareAt} — said once per model.`,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=model-context-window.js.map
|