@sema-agent/server 7.52.1 → 7.54.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/USAGE.md +7 -1
- package/dist/adoption/plan.d.ts +3 -3
- package/dist/adoption/quiesce.d.ts +1 -1
- package/dist/adoption/sql.d.ts +2 -2
- package/dist/adoption/wire.d.ts +1 -1
- package/dist/approval-ask-machine.d.ts +2 -2
- package/dist/approval-card.d.ts +18 -18
- package/dist/approval-deny-reasons.d.ts +1 -1
- package/dist/approval-hmac.d.ts +2 -2
- package/dist/approval-reconciler.d.ts +14 -14
- package/dist/approval.d.ts +2 -2
- package/dist/audit.d.ts +4 -4
- package/dist/auth-keys.d.ts +6 -6
- package/dist/bench/l8/artifact.d.ts +6 -1
- package/dist/bench/l8/artifact.js +2 -27
- package/dist/bench/l8/escape.d.ts +3 -3
- package/dist/bench/l8/index.d.ts +1 -1
- package/dist/bench/s1/arms.d.ts +3 -3
- package/dist/bench/s1/oracle.d.ts +2 -2
- package/dist/bench/s1/reviewer.d.ts +1 -1
- package/dist/bench/s1/row.d.ts +5 -5
- package/dist/bench/s1/runner-ctx.d.ts +3 -3
- package/dist/boot/config-center.d.ts +14 -7
- package/dist/boot/config-center.js +4 -2
- package/dist/boot/coordinators.d.ts +4 -4
- package/dist/boot/crash-last.d.ts +1 -1
- package/dist/boot/device-lane.d.ts +3 -3
- package/dist/boot/engine-lease.d.ts +4 -4
- package/dist/boot/governance-seams.d.ts +5 -5
- package/dist/boot/leader.d.ts +5 -5
- package/dist/boot/leader.js +2 -0
- package/dist/boot/limit-sync.d.ts +1 -1
- package/dist/boot/memory-boundary.d.ts +5 -5
- package/dist/boot/memory-consolidation.d.ts +8 -2
- package/dist/boot/memory-consolidation.js +1 -0
- package/dist/boot/org-memory.d.ts +5 -5
- package/dist/boot/parked-revive-gate.d.ts +6 -6
- package/dist/boot/permission-rules-audit.d.ts +2 -2
- package/dist/boot/reapers.d.ts +8 -8
- package/dist/boot/resolve-spec.d.ts +4 -4
- package/dist/boot/resolve-spec.js +1 -3
- package/dist/boot/retention-lane.d.ts +1 -1
- package/dist/boot/runner-deps.d.ts +53 -27
- package/dist/boot/runner-deps.js +16 -9
- package/dist/boot/runtime-caps.d.ts +4 -4
- package/dist/boot/session-faces.d.ts +1 -1
- package/dist/boot/shutdown.d.ts +10 -10
- package/dist/boot/shutdown.js +1 -1
- package/dist/boot/side-query-lane.d.ts +14 -14
- package/dist/boot/stores.js +5 -0
- package/dist/boot/task-list-lane.d.ts +3 -3
- package/dist/boot/webfetch-summarize-lane.d.ts +9 -9
- package/dist/boot/workflow-orchestration.d.ts +1 -1
- package/dist/bounded-session-map.d.ts +1 -1
- package/dist/brain.d.ts +3 -3
- package/dist/budget.d.ts +3 -3
- package/dist/canonical-json.d.ts +53 -0
- package/dist/canonical-json.js +48 -0
- package/dist/capabilities/center-prompts.d.ts +13 -13
- package/dist/capabilities/collab-workflows.d.ts +1 -1
- package/dist/capabilities/hands-lane.d.ts +4 -4
- package/dist/capabilities/memory-notice.d.ts +4 -4
- package/dist/capabilities/prompt.d.ts +2 -2
- package/dist/capabilities/sandbox-file-send.d.ts +2 -2
- package/dist/capabilities/scenarios.d.ts +16 -16
- package/dist/capabilities/skills.d.ts +1 -1
- package/dist/capabilities/team.d.ts +13 -12
- package/dist/capabilities/tool-defer.d.ts +6 -6
- package/dist/config-catalog.d.ts +139 -0
- package/dist/config-catalog.js +556 -0
- package/dist/config-center/apply-effective.d.ts +42 -30
- package/dist/config-center/apply-effective.js +69 -62
- package/dist/config-center/apply-ledger.d.ts +6 -6
- package/dist/config-center/effective-keys.d.ts +30 -0
- package/dist/config-center/effective-keys.js +49 -0
- package/dist/config-center/facade.d.ts +6 -5
- package/dist/config-center/facade.js +1 -1
- package/dist/config-center/hot-keys-registry.d.ts +2 -2
- package/dist/config-center/http-client.d.ts +5 -5
- package/dist/config-center/mcp-revocation.d.ts +6 -4
- package/dist/config-center/mcp-revocation.js +2 -12
- package/dist/config-center/restart-signal.d.ts +11 -1
- package/dist/config-center/restart-signal.js +4 -10
- package/dist/config-center/skills-mcp.d.ts +2 -2
- package/dist/config-center/stage-limits.d.ts +3 -3
- package/dist/config-center/types.d.ts +42 -59
- package/dist/config-invariants.d.ts +1 -1
- package/dist/config-lkg.js +7 -1
- package/dist/config-provider.d.ts +2 -2
- package/dist/config-provider.js +1 -1
- package/dist/config-types.d.ts +140 -132
- package/dist/config.d.ts +22 -22
- package/dist/config.js +2 -1
- package/dist/degenerate-instrument.d.ts +1 -1
- package/dist/deployment-governance.d.ts +13 -13
- package/dist/device-enrollment.d.ts +5 -3
- package/dist/device-store.d.ts +17 -3
- package/dist/device-store.js +2 -0
- package/dist/device-ws-hub.d.ts +10 -5
- package/dist/device-ws-hub.js +25 -5
- package/dist/device-ws-protocol.d.ts +3 -3
- package/dist/digest-form.d.ts +1 -1
- package/dist/elicitation.d.ts +1 -1
- package/dist/env-facts.d.ts +7 -7
- package/dist/execution-lane-caps.d.ts +5 -5
- package/dist/fleet/fleet-bus.d.ts +53 -53
- package/dist/fleet/fleet-reconciler.d.ts +2 -2
- package/dist/fleet/fleet-terminal-window.d.ts +1 -1
- package/dist/fleet/subagent-tail-bus.d.ts +3 -3
- package/dist/fleet-client.d.ts +3 -3
- package/dist/fleet-lease.d.ts +1 -1
- package/dist/hooks/branch-transcript.d.ts +2 -2
- package/dist/hooks/cc-agent-hook-prompt.d.ts +2 -2
- package/dist/hooks/cc-stop-prompt.d.ts +2 -2
- package/dist/hooks/hook-llm.d.ts +1 -1
- package/dist/hooks/hook-runner.d.ts +5 -5
- package/dist/http/active-run-conflict.d.ts +31 -33
- package/dist/http/active-run-conflict.js +4 -2
- package/dist/http/route-ctx.d.ts +22 -22
- package/dist/http/routes/a2a-serve.d.ts +2 -2
- package/dist/http/routes/admin-config-refresh.d.ts +1 -1
- package/dist/http/routes/admin-drain.d.ts +4 -4
- package/dist/http/routes/admin-memory-optout.d.ts +5 -5
- package/dist/http/routes/adoption.d.ts +1 -1
- package/dist/http/routes/agents-roster.d.ts +1 -1
- package/dist/http/routes/approvals-assistant.d.ts +6 -6
- package/dist/http/routes/approvals-assistant.js +4 -1
- package/dist/http/routes/capabilities.d.ts +1 -1
- package/dist/http/routes/capabilities.js +1 -0
- package/dist/http/routes/config-catalog.d.ts +28 -0
- package/dist/http/routes/config-catalog.js +42 -0
- package/dist/http/routes/diagnostics.d.ts +2 -2
- package/dist/http/routes/fleet.d.ts +1 -1
- package/dist/http/routes/images.d.ts +1 -1
- package/dist/http/routes/leader.d.ts +1 -1
- package/dist/http/routes/memory-bundle.d.ts +4 -4
- package/dist/http/routes/memory-compliance.d.ts +7 -7
- package/dist/http/routes/memory-consolidation.d.ts +1 -1
- package/dist/http/routes/memory-origin.d.ts +9 -9
- package/dist/http/routes/memory-policy.d.ts +3 -3
- package/dist/http/routes/notify-wake.d.ts +1 -1
- package/dist/http/routes/observability.d.ts +1 -1
- package/dist/http/routes/retention-ops.d.ts +1 -1
- package/dist/http/routes/rules.d.ts +3 -3
- package/dist/http/routes/run-memory-capture.d.ts +1 -1
- package/dist/http/routes/runs.d.ts +3 -3
- package/dist/http/routes/runs.js +12 -17
- package/dist/http/routes/session-sync.d.ts +2 -2
- package/dist/http/routes/sessions-list.d.ts +1 -1
- package/dist/http/routes/sessions.d.ts +9 -1
- package/dist/http/routes/sessions.js +60 -0
- package/dist/http/routes/shared-memory.d.ts +1 -1
- package/dist/http/routes/side-query.d.ts +1 -1
- package/dist/http/routes/tasks.d.ts +1 -1
- package/dist/http/routes/trace-usage.d.ts +1 -1
- package/dist/http/routes/workflows.d.ts +1 -1
- package/dist/http/run-meta.d.ts +1 -1
- package/dist/http/send.d.ts +6 -6
- package/dist/http/server.d.ts +84 -67
- package/dist/http/server.js +39 -10
- package/dist/http/sse-lifecycle.d.ts +1 -1
- package/dist/http/sse-log.d.ts +6 -6
- package/dist/http/verify-rounds.d.ts +3 -3
- package/dist/http/wire-gate.d.ts +2 -2
- package/dist/http/wire-types.d.ts +57 -38
- package/dist/key-resolver.d.ts +1 -1
- package/dist/leader/diffout.d.ts +2 -2
- package/dist/leader/diffup.d.ts +1 -1
- package/dist/leader/endpoint.d.ts +1 -1
- package/dist/leader/fanout.d.ts +6 -6
- package/dist/leader/grader-env-factory.d.ts +1 -1
- package/dist/leader/leader.d.ts +12 -12
- package/dist/leader/merge.d.ts +3 -3
- package/dist/leader/planner.d.ts +5 -5
- package/dist/leader/repair-oracle.d.ts +1 -1
- package/dist/leader/wire.d.ts +21 -9
- package/dist/leader/wire.js +6 -5
- package/dist/lsp/manager.d.ts +2 -2
- package/dist/lsp/types.d.ts +1 -1
- package/dist/lsp/ws-transport.d.ts +2 -2
- package/dist/main.js +12 -2
- package/dist/mcp-content-origin.d.ts +1 -1
- package/dist/memory-bundle-engine.d.ts +5 -3
- package/dist/memory-bundle-engine.js +2 -2
- package/dist/memory-operator-faces.d.ts +41 -11
- package/dist/memory-operator-faces.js +12 -0
- package/dist/memory-origin-fence.d.ts +1 -1
- package/dist/memory-origin-fence.js +2 -13
- package/dist/memory-posture.d.ts +6 -6
- package/dist/memory-scope.d.ts +7 -7
- package/dist/model-select.d.ts +5 -5
- package/dist/observability/cost-quota.d.ts +6 -6
- package/dist/observability/cost-taxonomy.d.ts +2 -2
- package/dist/observability/fail-open.d.ts +17 -5
- package/dist/observability/fail-open.js +16 -4
- package/dist/observability/metrics.d.ts +1 -1
- package/dist/observability/prompt-manifest.d.ts +8 -8
- package/dist/observability/rate-limit.d.ts +2 -2
- package/dist/observability/secret-env-scrub.d.ts +1 -1
- package/dist/observability/tool-trace.d.ts +1 -1
- package/dist/orchestration/hardened-vm-runner.d.ts +6 -6
- package/dist/orchestration/hardened-vm-worker-runner.d.ts +1 -1
- package/dist/orchestration/subagent-steer.d.ts +3 -3
- package/dist/orchestration/workflow-agent-steer.d.ts +1 -1
- package/dist/orchestration/workflow-completion-inbox.d.ts +6 -6
- package/dist/orchestration/workflow-notify-journal.d.ts +6 -6
- package/dist/parent-watch.d.ts +1 -1
- package/dist/parked-decide.d.ts +11 -11
- package/dist/plan-cache-probe.d.ts +1 -1
- package/dist/plugins/adoption-log-sql.d.ts +4 -4
- package/dist/plugins/approval-ask-store-memory.d.ts +1 -1
- package/dist/plugins/approval-ask-store-memory.js +12 -0
- package/dist/plugins/approval-ask-store-sql.d.ts +39 -17
- package/dist/plugins/approval-ask-store-sql.js +23 -6
- package/dist/plugins/approval-payload-fingerprint.d.ts +23 -0
- package/dist/plugins/approval-payload-fingerprint.js +23 -0
- package/dist/plugins/background-agent-store-sql.d.ts +8 -8
- package/dist/plugins/background-shell-support.d.ts +12 -12
- package/dist/plugins/blob-backend.d.ts +3 -3
- package/dist/plugins/breaker-state-sql.d.ts +3 -3
- package/dist/plugins/caching-session-store.d.ts +6 -6
- package/dist/plugins/checkpoint-store-sql.d.ts +162 -66
- package/dist/plugins/checkpoint-store-sql.js +76 -33
- package/dist/plugins/device-store-sql.d.ts +4 -3
- package/dist/plugins/e2b-orphan-reclaim.d.ts +3 -3
- package/dist/plugins/file-history-store-sql.d.ts +9 -8
- package/dist/plugins/file-run-store.d.ts +27 -27
- package/dist/plugins/fork-routing-session-store.d.ts +9 -9
- package/dist/plugins/image-bake-store-sql.d.ts +1 -1
- package/dist/plugins/image-index-sql.d.ts +2 -2
- package/dist/plugins/k8s-bg-scripts.d.ts +1 -1
- package/dist/plugins/k8s-exec-protocol.d.ts +1 -1
- package/dist/plugins/leader-run-store-sql.d.ts +1 -1
- package/dist/plugins/local-checkpoint-store.d.ts +26 -17
- package/dist/plugins/local-checkpoint-store.js +21 -11
- package/dist/plugins/local-session-store.d.ts +5 -5
- package/dist/plugins/mailbox-store-sql.d.ts +6 -6
- package/dist/plugins/memory-embedder-fingerprint.d.ts +2 -2
- package/dist/plugins/memory-engine-pg.d.ts +1 -1
- package/dist/plugins/memory-engine-tidb.d.ts +1 -1
- package/dist/plugins/memory-key-guards.d.ts +3 -3
- package/dist/plugins/memory-optout-grant-store-sql.d.ts +10 -10
- package/dist/plugins/memory-origin-law.d.ts +13 -13
- package/dist/plugins/memory-run-store.d.ts +12 -12
- package/dist/plugins/outcome-ledger-sql.d.ts +3 -3
- package/dist/plugins/permission-rule-store-file.d.ts +3 -3
- package/dist/plugins/permission-rule-store-sql.d.ts +38 -33
- package/dist/plugins/permission-rule-store-sql.js +7 -12
- package/dist/plugins/pg-cost-quota.d.ts +2 -2
- package/dist/plugins/pg-pool.d.ts +29 -2
- package/dist/plugins/pg-pool.js +50 -2
- package/dist/plugins/pg-query.d.ts +1 -1
- package/dist/plugins/pg-rate-limiter.d.ts +2 -2
- package/dist/plugins/pg-session-storage.d.ts +9 -9
- package/dist/plugins/remote-env-adb.d.ts +1 -1
- package/dist/plugins/remote-env-device.d.ts +6 -4
- package/dist/plugins/remote-env-device.js +4 -1
- package/dist/plugins/remote-env-e2b.d.ts +11 -11
- package/dist/plugins/remote-env-file-error.d.ts +2 -2
- package/dist/plugins/remote-env-host.d.ts +10 -10
- package/dist/plugins/remote-env-k8s.d.ts +7 -7
- package/dist/plugins/remote-env-local-docker.d.ts +1 -1
- package/dist/plugins/remote-env-ssh.d.ts +9 -9
- package/dist/plugins/remote-scratchpad.d.ts +1 -1
- package/dist/plugins/resume-anchor-store-sql.d.ts +1 -1
- package/dist/plugins/retention-lane-store-sql.d.ts +2 -2
- package/dist/plugins/retention-store-sql.d.ts +11 -11
- package/dist/plugins/roster-store-sql.d.ts +6 -8
- package/dist/plugins/run-store-sql.d.ts +12 -12
- package/dist/plugins/scheduler-support.d.ts +1 -1
- package/dist/plugins/send-user-file.d.ts +1 -1
- package/dist/plugins/session-capture-record-store-sql.d.ts +99 -0
- package/dist/plugins/session-capture-record-store-sql.js +110 -0
- package/dist/plugins/session-placement.d.ts +1 -1
- package/dist/plugins/session-policy-store-sql.d.ts +2 -2
- package/dist/plugins/session-store.d.ts +3 -3
- package/dist/plugins/shared-memory-store-sql.d.ts +5 -5
- package/dist/plugins/sql-driver.d.ts +7 -7
- package/dist/plugins/sql-errors.d.ts +2 -2
- package/dist/plugins/sql-escape.d.ts +1 -1
- package/dist/plugins/sql-row-helpers.d.ts +1 -1
- package/dist/plugins/store-backend.d.ts +32 -19
- package/dist/plugins/store-backend.js +5 -1
- package/dist/plugins/store-contracts.d.ts +9 -9
- package/dist/plugins/task-list-store-sql.d.ts +3 -3
- package/dist/plugins/tidb-cost-quota.d.ts +3 -3
- package/dist/plugins/tidb-pool.d.ts +13 -0
- package/dist/plugins/tidb-pool.js +9 -0
- package/dist/plugins/tidb-rate-limiter.d.ts +2 -2
- package/dist/plugins/tidb-session-storage.d.ts +2 -2
- package/dist/plugins/tidb-session-store.d.ts +11 -11
- package/dist/plugins/tool-result-store-sql.d.ts +8 -8
- package/dist/plugins/usage-window-store-sql.d.ts +3 -3
- package/dist/plugins/web-search.d.ts +7 -7
- package/dist/plugins/workflow-journal-store-sql.d.ts +6 -6
- package/dist/plugins/workflow-run-store-sql.d.ts +1 -1
- package/dist/plugins/write-behind-counter.d.ts +6 -6
- package/dist/principal-jwt.d.ts +2 -2
- package/dist/project-memory.d.ts +1 -1
- package/dist/prompts-domain-validate.d.ts +8 -8
- package/dist/question.d.ts +3 -3
- package/dist/resource-suspend.d.ts +4 -4
- package/dist/resource-window.d.ts +3 -3
- package/dist/router/route-orchestration.d.ts +1 -1
- package/dist/rules-consent.d.ts +48 -40
- package/dist/run-local.d.ts +5 -5
- package/dist/runs.d.ts +19 -19
- package/dist/runtime-caps-resolver.d.ts +6 -6
- package/dist/runtime-governance.d.ts +11 -7
- package/dist/runtime-governance.js +23 -1
- package/dist/security.d.ts +13 -13
- package/dist/session-leaf-bus.d.ts +1 -1
- package/dist/session-sync-content.d.ts +4 -4
- package/dist/session-sync-kernel.d.ts +2 -2
- package/dist/session-sync.d.ts +13 -13
- package/dist/session-titler.d.ts +1 -1
- package/dist/session-watch.d.ts +3 -3
- package/dist/shared-memory-scope-authorizer.d.ts +4 -4
- package/dist/sighup-idle.d.ts +1 -1
- package/dist/spec-fields.d.ts +20 -20
- package/dist/ssh-host-key.d.ts +5 -5
- package/dist/store-live-probe.d.ts +2 -2
- package/dist/task-cwd.d.ts +11 -11
- package/dist/task-mcp.d.ts +5 -5
- package/dist/task-settings.d.ts +35 -35
- package/dist/task-workflow.d.ts +3 -3
- package/dist/text-bidi.d.ts +1 -1
- package/dist/tool-approval.d.ts +186 -182
- package/dist/tool-approval.js +247 -120
- package/dist/trace/core-keyset-guard.d.ts +19 -5
- package/dist/trace/engine-notice-wire.d.ts +7 -7
- package/dist/trace/engine-notice-wire.js +2 -0
- package/dist/trace/injection-tier.d.ts +11 -21
- package/dist/trace/injection-tier.js +3 -4
- package/dist/trace/ledger-events.d.ts +3 -3
- package/dist/trace/ledger-sink.d.ts +7 -7
- package/dist/trace/project.d.ts +31 -30
- package/dist/trace/project.js +1 -0
- package/dist/turn-activity.d.ts +4 -4
- package/dist/usage-analytics.d.ts +1 -1
- package/dist/wall-clock-jump-guard.d.ts +3 -3
- package/package.json +6 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* **引擎接线**(core 5.57.0 `MemoryEngine.provenanceOf` / `eraseMemoryEntries`,
|
|
2
|
+
* [ref] 件③ —— `GET /v1/memory/entries/:entryId/provenance` · `POST /v1/memory/erase` 两口的
|
|
3
|
+
* **引擎接线**(core 5.57.0 `MemoryEngine.provenanceOf` / `eraseMemoryEntries`,[ref] v2-a/v2-b)。
|
|
4
4
|
*
|
|
5
5
|
* ## 为什么是一个模块而不是 main.ts 里直接 new
|
|
6
6
|
*
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* ⇒ 裁:`controlPlaneRoot` 缺席 ⇒ 本工厂返回 **undefined**,两口整个不挂载,HTTP 面诚实 501。今天满足这一
|
|
26
26
|
* 条的只有 core 自带的 `FileMemoryEngineBackend`(它把控制面写死在 config-root 一侧);本仓两只 SQL 记忆
|
|
27
27
|
* 孪生(`plugins/memory-engine-{pg,tidb}.ts`)没有这个面 ⇒ 在那些部署上两口不挂。SQL 控制面是 core 的候升件
|
|
28
|
-
* (
|
|
28
|
+
* ([ref] §0b-4 咨询单),**绝不**在本层为它们现造一个「够用的」控制面 —— 那是把一个 core 拒绝生产的
|
|
29
29
|
* 半吊子治理面自己造出来,与 bundle 那条「a governance-less export is the laundering shape」同族。
|
|
30
30
|
*
|
|
31
31
|
* 🔴 这条判断是承重的,所以它有**机器钉**而不是只有这段注释:`test/memory-operator-faces.test.ts` 用一只
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
*
|
|
37
37
|
* 判据是一次**属性检查**、boot 期就判得出、而且是**永久**缺席(换后端才会变)——不是瞬时状态。照旧挂着
|
|
38
38
|
* 就成了「能力位说 yes、每一次调用都确定性失败」,而本仓「says yes ⟺ route works」是结构性承诺。
|
|
39
|
-
* (这条纪律是
|
|
39
|
+
* (这条纪律是 [ref] 提货批被 codex 交叉复审驳倒后立的,见 memory-bundle-engine.ts 头注。)
|
|
40
40
|
*
|
|
41
41
|
* ⚠️ **刻意不把审计/托管/证据三个可选面编进构造判定**:`committedSnapshotOf` / `custodyOf` 缺席时 core
|
|
42
42
|
* 明写要诚实答 `binding:"unknown"` / `contentState:"capability-absent"` / `custody:"capability-absent"`
|
|
43
|
-
* (
|
|
43
|
+
* ([ref] absence-reports-not-silent-green,engine.d.ts:748 逐字),那是一个**答得出话**的部署;把它们编进
|
|
44
44
|
* 构造判定会让这种部署整口消失,把 core 的诚实答案换成一句 501 谎话。`eraseWithEvidence` 同理:缺它时
|
|
45
45
|
* core 自己响亮拒(`memory.erasure_evidence_unavailable`),那是**运行期**的诚实拒,与「换部署形态才行」
|
|
46
46
|
* 不是一回事(附录 A 两条分列)。
|
|
47
47
|
*/
|
|
48
|
-
import { type EntryProvenanceAccount, type MemoryBackend, type MemoryEntryOrigin, type MemoryErasureAttestation, type OriginClearanceRow } from "@sema-agent/core";
|
|
48
|
+
import { type EntryProvenanceAccount, type MemoryBackend, type MemoryEntryOrigin, type MemoryErasureAttestation, type OriginClearanceRow, type SessionCaptureRecordStore, type SessionMemoryStatus } from "@sema-agent/core";
|
|
49
49
|
/**
|
|
50
50
|
* 控制面归属判据 —— 三个记忆操作面(合规两口 / 外源标记三口 / consolidation 阀门的 D1 拒启门)共用的
|
|
51
51
|
* **同一只**谓词:backend 的面上带**非空** `controlPlaneRoot` 才算归属在案。空串与缺席同判「不归属」:
|
|
@@ -128,6 +128,7 @@ opts?: {
|
|
|
128
128
|
onIncident?: (err: Error & {
|
|
129
129
|
code?: string;
|
|
130
130
|
}) => void;
|
|
131
|
+
captureRecordStore?: SessionCaptureRecordStore;
|
|
131
132
|
}): MemoryComplianceFaces | undefined;
|
|
132
133
|
/** 件② 三口 HTTP 面消费的窄能力面(`ServiceDeps.memoryOriginFace` 的实参来源)。 */
|
|
133
134
|
export interface MemoryOriginFaces {
|
|
@@ -135,7 +136,7 @@ export interface MemoryOriginFaces {
|
|
|
135
136
|
* §13-4① 视图面:点名 scope 里**每一条**带外源标记的条目 + 它的出处账。
|
|
136
137
|
*
|
|
137
138
|
* 🔴 `scopes` 由**调用方**给,本层不发明默认值:v1 本仓没有任何 scope 枚举读面(core 5.59.0 的
|
|
138
|
-
* `listMemoryScopes` 已到 File 腿、SQL 腿是 core 候升件
|
|
139
|
+
* `listMemoryScopes` 已到 File 腿、SQL 腿是 core 候升件 [ref]④,本仓尚未接线),而「空 scope 名单」
|
|
139
140
|
* 与「查全店」在这条路上是两件事 —— 猜一个默认名单会让审计的**不完备变成静默的**(空数组与
|
|
140
141
|
* 「这些 scope 干净」同形)。缺参时路由那侧 400 并指路,理由与文案同源于此。
|
|
141
142
|
*/
|
|
@@ -161,8 +162,8 @@ export interface MemoryOriginFaces {
|
|
|
161
162
|
}>;
|
|
162
163
|
}
|
|
163
164
|
/**
|
|
164
|
-
*
|
|
165
|
-
* `listOriginClearances` / `clearEntryOrigin`,
|
|
165
|
+
* [ref] 件② —— 外源标记人面的**引擎接线**(core 5.59.0 `MemoryEngine.listExternalOriginEntries` /
|
|
166
|
+
* `listOriginClearances` / `clearEntryOrigin`,[ref] §13-4①②)。
|
|
166
167
|
*
|
|
167
168
|
* ## 控制面归属:判据与合规两口**逐字同一条**(§1 F-9 裁),但理由更硬
|
|
168
169
|
*
|
|
@@ -182,11 +183,11 @@ export interface MemoryOriginFaces {
|
|
|
182
183
|
* 而且下一次 resume 调用大概率落到另一台副本、读不到那行 ⇒ 一条被清标的记忆连同它的托管字节一起消失。
|
|
183
184
|
* 本仓是 stateless replicas(CLAUDE.md 首段)。所以判在**构造期**:工厂返 undefined、三口整个不挂、
|
|
184
185
|
* HTTP 面诚实 501,与 `createMemoryComplianceFaces` 同形同码不同文案(要查的旋钮不是同一个)。
|
|
185
|
-
* SQL 控制面是 core 的候升件(
|
|
186
|
+
* SQL 控制面是 core 的候升件([ref] §0b-4 / [ref]④),**绝不**在本层为它现造一个。
|
|
186
187
|
*
|
|
187
188
|
* ## 刻意不做的两件事
|
|
188
189
|
*
|
|
189
|
-
* ⚠️ **不把 `listScopes` 编进构造判定**:core 5.59.0 长出了 `listMemoryScopes`(
|
|
190
|
+
* ⚠️ **不把 `listScopes` 编进构造判定**:core 5.59.0 长出了 `listMemoryScopes`([ref]③,File 腿在场、
|
|
190
191
|
* SQL 腿候升),但那是**发现链**的面,不是本族三口的执行前提 —— 把它编进来会让一个「scope 名由运维
|
|
191
192
|
* 自己拿着」的部署整口消失。发现链的不完备由 `GET …/external` 缺参时的 400 文案如实说出来。
|
|
192
193
|
* ⚠️ **不在 seam 里翻译拒因码**:core 的 origin-clear 族是**闭集**,翻译点只有一个(路由的 switch),
|
|
@@ -207,5 +208,34 @@ opts?: {
|
|
|
207
208
|
onIncident?: (err: Error & {
|
|
208
209
|
code?: string;
|
|
209
210
|
}) => void;
|
|
211
|
+
captureRecordStore?: SessionCaptureRecordStore;
|
|
210
212
|
}): MemoryOriginFaces | undefined;
|
|
213
|
+
/** [ref] seam① 的窄能力面(`ServiceDeps.sessionMemoryStatus` 的实参来源)。 */
|
|
214
|
+
export interface SessionMemoryStatusFace {
|
|
215
|
+
status: (sessionId: string) => Promise<SessionMemoryStatus>;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* [ref] seam①([ref] §S-7,core 7.0.2 [ref] 件1)—— `GET /v1/sessions/:id/memory-status` 的引擎面。
|
|
219
|
+
* 命名照 CLAUDE.md 工厂律:返回带行为的活对象 ⇒ `create*`。
|
|
220
|
+
*
|
|
221
|
+
* 挂载判据与合规/清标两族**同一条 F-9 裁**(`backendOwnsControlPlane`,理由见文件头):
|
|
222
|
+
* `committedCount` / `foldedCount` / `lastCaptureAt` 读的是引擎控制面的 lineage 台账 ——
|
|
223
|
+
* 控制面归属缺席的部署上(两只 SQL 记忆孪生),core 会把控制面落到**副本本地盘**,一个「可读的空目录」
|
|
224
|
+
* 让 core 面答出 `committedCount: 0`(readLineageRecord 对空目录**不抛**,亲读 engine.js)——
|
|
225
|
+
* 那是**说谎的 0**,比缺席更坏(S-7 的诚实键律:可读零必须是真零)。⇒ 归属缺席 ⇒ 工厂返 undefined,
|
|
226
|
+
* HTTP 面诚实 501,与 erase/origin 同码同分支。
|
|
227
|
+
*
|
|
228
|
+
* `captureRecordStore` = [ref]② 的 SQL 载体(main.ts 单实例,与 Runner/其余引擎同源 —— 全站同批注入律,
|
|
229
|
+
* 机器钉 capture-optout-lane ②):`captureOptedOut` / `optOutSource` 两键经它读,多副本部署上答的才是
|
|
230
|
+
* 跨副本的真记录。缺席(local 车道)⇒ core 文件三腿,单机字节不变。
|
|
231
|
+
*
|
|
232
|
+
* 面**不抛**(core 契约:sessionMemoryStatus never throws —— 每个事实源各自 catch 折缺席键);
|
|
233
|
+
* 不接 onIncident:这条只读路径上今天零 sink 站点,而且缺席键本身就是它的披露形。
|
|
234
|
+
*/
|
|
235
|
+
export declare function createSessionMemoryStatusFace(store: {
|
|
236
|
+
backend: MemoryBackend;
|
|
237
|
+
root: string;
|
|
238
|
+
}, opts?: {
|
|
239
|
+
captureRecordStore?: SessionCaptureRecordStore;
|
|
240
|
+
}): SessionMemoryStatusFace | undefined;
|
|
211
241
|
//# sourceMappingURL=memory-operator-faces.d.ts.map
|
|
@@ -43,6 +43,7 @@ export function createMemoryComplianceFaces(store, opts) {
|
|
|
43
43
|
backend: store.backend,
|
|
44
44
|
memoryDir: store.root,
|
|
45
45
|
...(opts?.onIncident !== undefined ? { onIncident: opts.onIncident } : {}),
|
|
46
|
+
...(opts?.captureRecordStore !== undefined ? { captureRecordStore: opts.captureRecordStore } : {}),
|
|
46
47
|
});
|
|
47
48
|
return {
|
|
48
49
|
provenanceOf: (entryId) => engine.provenanceOf(entryId),
|
|
@@ -66,6 +67,7 @@ export function createMemoryOriginFaces(store, opts) {
|
|
|
66
67
|
backend: store.backend,
|
|
67
68
|
memoryDir: store.root,
|
|
68
69
|
...(opts?.onIncident !== undefined ? { onIncident: opts.onIncident } : {}),
|
|
70
|
+
...(opts?.captureRecordStore !== undefined ? { captureRecordStore: opts.captureRecordStore } : {}),
|
|
69
71
|
});
|
|
70
72
|
return {
|
|
71
73
|
listExternal: (scopes) => engine.listExternalOriginEntries(scopes),
|
|
@@ -73,4 +75,14 @@ export function createMemoryOriginFaces(store, opts) {
|
|
|
73
75
|
clear: (entryId, input) => engine.clearEntryOrigin(entryId, input),
|
|
74
76
|
};
|
|
75
77
|
}
|
|
78
|
+
export function createSessionMemoryStatusFace(store, opts) {
|
|
79
|
+
if (!backendOwnsControlPlane(store.backend))
|
|
80
|
+
return undefined;
|
|
81
|
+
const engine = new MemoryEngine({
|
|
82
|
+
backend: store.backend,
|
|
83
|
+
memoryDir: store.root,
|
|
84
|
+
...(opts?.captureRecordStore !== undefined ? { captureRecordStore: opts.captureRecordStore } : {}),
|
|
85
|
+
});
|
|
86
|
+
return { status: (sessionId) => engine.sessionMemoryStatus(sessionId) };
|
|
87
|
+
}
|
|
76
88
|
//# sourceMappingURL=memory-operator-faces.js.map
|
|
@@ -3,7 +3,7 @@ import { type MemoryExportBundle } from "@sema-agent/core";
|
|
|
3
3
|
export declare const ORIGIN_AWARE_QUERY = "originAware";
|
|
4
4
|
/** 从 `URLSearchParams` 读能力位:`originAware=1` ⇒ true;缺席/其它值 ⇒ false(老客户端假定)。 */
|
|
5
5
|
export declare function readOriginAware(params: URLSearchParams): boolean;
|
|
6
|
-
/** 「这条条目带 origin 标吗」—— 载体三形(G53 [
|
|
6
|
+
/** 「这条条目带 origin 标吗」—— 载体三形(G53 [ref] + codex R1-high 后齐):
|
|
7
7
|
* ① 顶层 `origin`(listExternal 投影行)—— own 键在场且非 undefined 即带标(不读形;typed null/坏形也算:
|
|
8
8
|
* core 读取器对 null 会抛,围栏对读不出的载体只许扣留不许放行);
|
|
9
9
|
* ② `frontmatter.origin`(core `MemoryEntry`,138 S3)—— 同 own 键判;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { committedOriginOf } from "@sema-agent/core";
|
|
3
|
+
import { canonicalJson } from "./canonical-json.js";
|
|
3
4
|
export const ORIGIN_AWARE_QUERY = "originAware";
|
|
4
5
|
export function readOriginAware(params) {
|
|
5
6
|
return params.get(ORIGIN_AWARE_QUERY) === "1";
|
|
@@ -33,18 +34,6 @@ export function buildOriginFence(entries, originAware) {
|
|
|
33
34
|
function sha256Line(text) {
|
|
34
35
|
return createHash("sha256").update(`${text}\n`, "utf8").digest("hex");
|
|
35
36
|
}
|
|
36
|
-
function canonicalJsonStringify(value) {
|
|
37
|
-
if (Array.isArray(value))
|
|
38
|
-
return `[${value.map((v) => (v === undefined || typeof v === "function" || typeof v === "symbol" ? "null" : canonicalJsonStringify(v))).join(",")}]`;
|
|
39
|
-
if (value !== null && typeof value === "object") {
|
|
40
|
-
const rec = value;
|
|
41
|
-
const keys = Object.keys(rec)
|
|
42
|
-
.filter((k) => rec[k] !== undefined)
|
|
43
|
-
.sort();
|
|
44
|
-
return `{${keys.map((k) => `${JSON.stringify(k)}:${canonicalJsonStringify(rec[k])}`).join(",")}}`;
|
|
45
|
-
}
|
|
46
|
-
return JSON.stringify(value);
|
|
47
|
-
}
|
|
48
37
|
export function buildOriginFencedBundle(bundle, originAware) {
|
|
49
38
|
if (originAware)
|
|
50
39
|
return bundle;
|
|
@@ -58,7 +47,7 @@ export function buildOriginFencedBundle(bundle, originAware) {
|
|
|
58
47
|
integrity: {
|
|
59
48
|
entryCount: kept.length,
|
|
60
49
|
revs: Object.fromEntries(kept.map((e) => [e.id, e.rev])),
|
|
61
|
-
sectionHashes: { ...bundle.integrity.sectionHashes, entries: sha256Line(
|
|
50
|
+
sectionHashes: { ...bundle.integrity.sectionHashes, entries: sha256Line(canonicalJson(kept)) },
|
|
62
51
|
},
|
|
63
52
|
withheldOriginTagged: withheld,
|
|
64
53
|
};
|
package/dist/memory-posture.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref] 件2/件3 —— 记忆面**姿态**的单一推导点。
|
|
3
3
|
*
|
|
4
4
|
* ## 病
|
|
5
5
|
*
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* ## 两条诚实纪律
|
|
18
18
|
*
|
|
19
|
-
* ① **档位取实例真值,不按后端推断**([
|
|
19
|
+
* ① **档位取实例真值,不按后端推断**([ref] 裁①/[ref]①的延续):`vectorMode` 是「后端上限 × embedder
|
|
20
20
|
* 在场」的推断结果,两支 SQL 后端各自的实例 getter 才是真值;file 引擎**根本没有**这个指示面
|
|
21
21
|
* (core 的 `MemoryBackend` 契约里没有 `vectorMode`,亲验),所以它报 `null` —— 「没有这个指示面」与
|
|
22
22
|
* 「档位是词面」是两件事,折成一件就是编一个数出来。
|
|
@@ -51,20 +51,20 @@ export interface MemoryPosture {
|
|
|
51
51
|
dimensions: number;
|
|
52
52
|
} | null;
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* [ref](core 5.45.0 [ref]):本部署给委派臂设的**证据标准**(`MEMORY_DELEGATION_EVIDENCE`)。
|
|
55
55
|
*
|
|
56
56
|
* 🔴 `null` = **本部署没设这个键** ⇒ 引擎按它自己的缺省跑。**不是**「等于 static-face」—— 那句话是
|
|
57
57
|
* 关于 core 缺省的知识声明,本读面不替 core 宣布它(`vectorMode: null` 同一条诚实纪律:
|
|
58
58
|
* 「没有这个指示面」与「档位是词面」是两件事)。运维要知道「实际生效的是哪一档」,读这一位 +
|
|
59
59
|
* 实装 core 的契约,两件事分开摆。
|
|
60
60
|
*
|
|
61
|
-
* 受众 = **operator 面独占**:与 `darkReason`/`multiTenant`/embedder 身份同判(
|
|
61
|
+
* 受众 = **operator 面独占**:与 `darkReason`/`multiTenant`/embedder 身份同判([ref] 件3 的分界),
|
|
62
62
|
* 刻意**不**进 `GET /v1/capabilities` 的窄投影 —— 证据标准回答的是「这台机器怎么判污染」,是运维
|
|
63
63
|
* 诊断料,不是任何持凭证调用方该读的位。
|
|
64
64
|
*/
|
|
65
65
|
delegationEvidence: "static-face" | "attested-only" | null;
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
67
|
+
* [ref] 件4(core 5.46.0 [ref] §13-3):本部署的 **provenance 姿态**(`MEMORY_PROVENANCE`)——
|
|
68
68
|
* 一个会话被判为已暴露之后,它的记忆写是**带标收录**(`carry`)还是**整体隔离**(`off`)。
|
|
69
69
|
*
|
|
70
70
|
* 🔴 `null` = **本部署没设这个键** ⇒ 引擎按它自己的缺省跑。**不是**「等于 carry」——
|
|
@@ -75,7 +75,7 @@ export interface MemoryPosture {
|
|
|
75
75
|
*/
|
|
76
76
|
provenance: "off" | "carry" | null;
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
78
|
+
* [ref] §3.1(core 7.0.0 片3,[ref] S-1b):本部署的 **capture 姿态**(`MEMORY_CAPTURE_POLICY`)——
|
|
79
79
|
* per-principal `allowMemoryOptOut` verdict 被读进的那个框(`open` fail-safe / `governed` fail-closed /
|
|
80
80
|
* `capture-required` 全拒)。
|
|
81
81
|
*
|
package/dist/memory-scope.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare const V2_SCOPE_PREFIXES: readonly string[];
|
|
|
11
11
|
* 校验点 fail-loud。
|
|
12
12
|
*/
|
|
13
13
|
export declare function isV2ScopeKey(key: string): boolean;
|
|
14
|
-
/** Resolve the memory scope for a request (
|
|
14
|
+
/** Resolve the memory scope for a request ([ref] S1 — the file-based memory engine is the only plane).
|
|
15
15
|
*
|
|
16
16
|
* SINGLE-USER (REQUIRE_PRINCIPAL !== "true"): ONE shared scope — `config.memoryScope` (default "local"),
|
|
17
17
|
* regardless of any principal label the caller self-reports (a single-user worker's `anon:*` / ad-hoc
|
|
@@ -26,12 +26,12 @@ export declare function isV2ScopeKey(key: string): boolean;
|
|
|
26
26
|
* security.ts 把身份轴守住了,但 `formatUserScope`/`formatProjScope` 的段编码(百分号转义)会
|
|
27
27
|
* **膨胀**——非 ASCII principal 编码后可超列宽,此前落裸 SQL 错。产出处响亮拒,错误可分类。
|
|
28
28
|
*
|
|
29
|
-
*
|
|
29
|
+
* [ref] 件1:定义**搬去** `plugins/memory-key-guards.ts`(列宽与 store 写口同源单一属主),此处
|
|
30
30
|
* 只再导出——旧 import 路径(本文件)逐字不变,`memoryScopeFor` 的产出处消费点也不变。 */
|
|
31
31
|
export { MEMORY_SCOPE_COLUMN_CHARS, assertMemoryScopeWidth } from "./plugins/memory-key-guards.js";
|
|
32
32
|
export declare function memoryScopeFor(config: ServiceConfig, principal?: string, projectId?: string): string | undefined;
|
|
33
33
|
/**
|
|
34
|
-
* N0 (通宵测试 2026-07-09,三重坐实 e2b+kata+代码): the file memory engine (core
|
|
34
|
+
* N0 (通宵测试 2026-07-09,三重坐实 e2b+kata+代码): the file memory engine (core [ref]) materializes and
|
|
35
35
|
* harvests via `node:fs` on the WORKER's local fs, while a remote exec lane routes the model's file tools to
|
|
36
36
|
* the SANDBOX fs — the planes never meet: materialized memory is invisible inside the sandbox (the injected
|
|
37
37
|
* instructions burn failing Write turns) and sandbox writes are never harvested (add=0). Until core defines
|
|
@@ -67,7 +67,7 @@ engineWired: boolean): {
|
|
|
67
67
|
effect: string;
|
|
68
68
|
} | undefined;
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
70
|
+
* [ref] S1 wiring gate (pure — unit-testable without booting main): build the file-based memory-engine
|
|
71
71
|
* backend for this deployment, or `undefined` when memory must stay dark.
|
|
72
72
|
*
|
|
73
73
|
* - SINGLE-USER TURNKEY ONLY (`requirePrincipal !== true`): the engine's file basement
|
|
@@ -91,13 +91,13 @@ export declare function memoryEngineBackendFor(config: ServiceConfig, fallbackRo
|
|
|
91
91
|
/**
|
|
92
92
|
* MF-30 memory PAUSE (option B, per-request — clay 2026-06-27): build the `TaskSpec.memory` spec for ONE run from
|
|
93
93
|
* the resolved memory `scope` + the request's `memoryWrite` toggle. `memoryWrite === false` ⇒ `writeScope: null`
|
|
94
|
-
* (
|
|
94
|
+
* ([ref] engine read-only: normalizeMemorySpec's writeScope:null — materialize/read still works, harvest
|
|
95
95
|
* commits nothing). Absent/true ⇒ normal read+write. No scope (engine off / multi-tenant dark) ⇒ undefined
|
|
96
96
|
* (memory feature off for this run). Pure (testable in isolation) — main.ts's resolveSpec composes it with the
|
|
97
97
|
* engine-backend presence guard.
|
|
98
98
|
*/
|
|
99
99
|
export declare function memorySpecForRequest(scope: string | undefined, memoryWrite: boolean | undefined, defaultScopes?: string[],
|
|
100
|
-
/**
|
|
100
|
+
/** [ref] 件A([ref] 件3④):origin 盖章的部署形态维(N2)。`multiTenant=true`(requirePrincipal)
|
|
101
101
|
* ⇒ 登记簿 defaultScopes 的 org 键按 **request** 盖章(条目由调用方 projectId 选定=caller 可影响的
|
|
102
102
|
* 选择器,core 准入门据此过目录判决);单用户 ⇒ 一律 deployment(operator 登记簿条目归 deployment,
|
|
103
103
|
* 否则单用户部署被自家规则整拒——v4 §0 伤害①的成立前提)。缺参=旧调用形,不盖章(整键缺席=
|
|
@@ -105,7 +105,7 @@ export declare function memorySpecForRequest(scope: string | undefined, memoryWr
|
|
|
105
105
|
originPolicy?: {
|
|
106
106
|
multiTenant: boolean;
|
|
107
107
|
},
|
|
108
|
-
/**
|
|
108
|
+
/** [ref] §2.1([ref]):请求的 `memoryCapture:"off"` 声明 ⇒ `TaskSpec.memory.capture:"off"`(单成员闭集,
|
|
109
109
|
* 拼写门在 prepareSpec 的 400 门 + core 的 `config.memory_capture_spelling`)。缺席 ⇒ 键不铸(缺席就是照常采集
|
|
110
110
|
* 的唯一形)。与 `memoryWrite` 正交:那是「本 run 只读平面」,这是「本会话永远不进长期记忆」。 */
|
|
111
111
|
memoryCapture?: "off"): {
|
package/dist/model-select.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* untrusted body/text can pick WHICH configured model but can never inject a baseUrl/apiKey (parseModelMention
|
|
11
11
|
* only ever returns an allow-listed catalog name).
|
|
12
12
|
*
|
|
13
|
-
* [
|
|
13
|
+
* [ref]②(生产实锤:面板上选了 A 模型,实际跑的是目录里的另一个):
|
|
14
14
|
* - explicit ref 走 name+id 双键索引({@link matchCatalogModel})——壳 boot 回读的 mainLoopModel 是 **id 形**,
|
|
15
15
|
* 目录键是 **name 形**,单键索引把 id 形请求当「未知」静默落 default = session 中途静默换模型(最恶性的
|
|
16
16
|
* 上下文污染路径)。
|
|
@@ -29,7 +29,7 @@ export declare function resolveTaskModel(bodyModel: unknown, objective: string,
|
|
|
29
29
|
unknownExplicit?: string;
|
|
30
30
|
notAllowed?: ModelNotAllowed;
|
|
31
31
|
};
|
|
32
|
-
/**
|
|
32
|
+
/** [ref] 判别式拒因:名单在场且这次**用户选择**落在名单外。`resolved` 已是目录 name 形(归一后)。 */
|
|
33
33
|
export interface ModelNotAllowed {
|
|
34
34
|
/** 调用方发来的原始 ref(name / 档位词 / 别名 / id / `@name`),已做过日志安全的 repr 归一。 */
|
|
35
35
|
requested: string;
|
|
@@ -39,7 +39,7 @@ export interface ModelNotAllowed {
|
|
|
39
39
|
source: "explicit" | "mention";
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* [ref] / [ref] —— **归一条款**:membership 判定前把 ref 归一到**终端 catalog 条目**再比。
|
|
43
43
|
*
|
|
44
44
|
* 为什么不能拿字符串直接跟名单比:`expandTiers` 的增广目录里,档位词(`pro`)与 CC 别名(`sonnet`)
|
|
45
45
|
* 的值与 `config.models[<name>]` 是**同一个对象引用**——裸串比较会让 `@pro` 跳过一张按 name 写的名单
|
|
@@ -62,7 +62,7 @@ export interface ModelNotAllowed {
|
|
|
62
62
|
*/
|
|
63
63
|
export declare function isModelAllowlisted(ref: string, catalog: Record<string, unknown>, allowlist: readonly string[] | undefined): boolean;
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* [ref] —— ref → **终端 catalog name**(拒因/日志的可读形)。
|
|
66
66
|
*
|
|
67
67
|
* 为什么不是 `matchCatalogModel` 的返回值:增广目录里 `pro`/`opus`/`default` 都是**真实存在的键**,
|
|
68
68
|
* 于是 `matchCatalogModel("pro")` 回的就是 `"pro"` —— 那是用户点的那个别名,不是他真会跑的模型。
|
|
@@ -71,7 +71,7 @@ export declare function isModelAllowlisted(ref: string, catalog: Record<string,
|
|
|
71
71
|
*/
|
|
72
72
|
export declare function terminalCatalogName(ref: string, catalog: Record<string, unknown>): string | undefined;
|
|
73
73
|
/**
|
|
74
|
-
* [
|
|
74
|
+
* [ref]② name+id 双键目录索引:返回 ref 命中的目录 **name 键**(spec.model 的规范形),未知 → undefined。
|
|
75
75
|
* - name 命中用 Object.hasOwn(🔴 不用真值索引:Object.prototype 继承键 "constructor"/"__proto__" 等在裸
|
|
76
76
|
* 索引下是真值,会跳过 allow-list——沿袭原实现的纪律)。
|
|
77
77
|
* - id 命中扫目录值(`Model.id`),跳过 "default" 别名键(它与其指向的真身共享 id,解析到别名会让 /model
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Per-principal CUMULATIVE cost quota (
|
|
2
|
+
* Per-principal CUMULATIVE cost quota ([ref]/27 follow-up). The per-task `maxCostUsd` gate caps a
|
|
3
3
|
* SINGLE task; this caps a principal's spend ACROSS tasks within a rolling fixed window. Spend is the
|
|
4
4
|
* authoritative integer `costMicroUsd` accumulated by the tracer (so it includes council/team
|
|
5
5
|
* sub-tasks, via the principal ALS context). A new task is REFUSED once the window's accumulated cost
|
|
@@ -19,8 +19,8 @@ export interface QuotaDecision {
|
|
|
19
19
|
}
|
|
20
20
|
/** The hot-path surface shared by the in-memory {@link CostQuota} (single replica) and the cross-replica
|
|
21
21
|
* {@link import("../plugins/tidb-cost-quota.js").TiDBCostQuota}. `key` is opaque (principal today;
|
|
22
|
-
* principal/team/feature later —
|
|
23
|
-
/**
|
|
22
|
+
* principal/team/feature later — [ref] N3), so both stores are key-based. */
|
|
23
|
+
/** [ref] 批1:配额的**值换代**入参(四实现类同一形;单位与构造参数一致 —— USD/秒 → micro/ms 的换算
|
|
24
24
|
* 只有一处,`boot/limit-sync.ts` 的 `buildQuotaBounds`)。`limitMicroUsd <= 0` = **关断哨兵**。 */
|
|
25
25
|
export interface QuotaLimits {
|
|
26
26
|
limitMicroUsd: number;
|
|
@@ -29,20 +29,20 @@ export interface QuotaLimits {
|
|
|
29
29
|
export interface QuotaTracker {
|
|
30
30
|
check(key: string): QuotaDecision;
|
|
31
31
|
add(key: string, micro: number): void;
|
|
32
|
-
/**
|
|
32
|
+
/** [ref]:值换代座位。**接口级**声明——新实现漏掉它 = 编译红,而不是热更新在那条腿上静默失效。 */
|
|
33
33
|
setLimits(next: QuotaLimits): void;
|
|
34
34
|
}
|
|
35
35
|
export declare class CostQuota implements QuotaTracker {
|
|
36
36
|
private readonly now;
|
|
37
37
|
private windows;
|
|
38
|
-
/** 🔴 不再 `readonly`:限额/窗长是比较参数,换代只动它们,窗内已累计的花费一个不动(
|
|
38
|
+
/** 🔴 不再 `readonly`:限额/窗长是比较参数,换代只动它们,窗内已累计的花费一个不动([ref] §5)。 */
|
|
39
39
|
private limitMicroUsd;
|
|
40
40
|
private windowMs;
|
|
41
41
|
/** @param limitMicroUsd ceiling per window (integer micro-USD; `<=0` = OFF sentinel). @param windowMs rolling window. */
|
|
42
42
|
constructor(limitMicroUsd: number, windowMs: number, now?: () => number);
|
|
43
43
|
/**
|
|
44
44
|
* 值换代。两件事**语义不同**,别混:
|
|
45
|
-
* · **限额**换代 = 纯比较参数 ⇒ 窗内已累计的花费一个不动(
|
|
45
|
+
* · **限额**换代 = 纯比较参数 ⇒ 窗内已累计的花费一个不动([ref] §5 定案:调小当场更严)。
|
|
46
46
|
* · **窗长**换代 = 换**记账周期** ⇒ 当代累计重开。
|
|
47
47
|
*
|
|
48
48
|
* 🔴 后者是 codex R1-F4(真 finding,红先):SQL 腿的窗长是**桶键的一部分**(`floor(now/windowMs)`),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref] b (item 3) — the INFRA cost axes the SERVICE owns, composed with core's LLM-family `costBreakdown`
|
|
3
3
|
* for the supervisor cost surface.
|
|
4
4
|
*
|
|
5
|
-
* (
|
|
5
|
+
* ([ref] N24: moved here from the single-file `src/finance/` directory — lens4 §4.4 flagged the "cost"
|
|
6
6
|
* concept as split across `finance/cost-taxonomy.ts` + `observability/cost-quota.ts` + `budget.ts`. Chose
|
|
7
7
|
* "dissolve finance/, fold into observability/" over "collect all three into finance/": this module + the
|
|
8
8
|
* quota tracker are both cost REPORT/GUARD layers that feed metrics/decisions (observability's existing
|
|
@@ -81,10 +81,6 @@ export declare const FAIL_OPEN_TAGS: {
|
|
|
81
81
|
readonly cls: "P-DEBT";
|
|
82
82
|
readonly note: "跨副本赎回 parked 审批时,祖先层在 park 时是 **auto-mode 武装**的,但那只分类器是祖先任务上的活闭包(绑着它自己的转写窗+brain),跨进程重建不出来 ⇒ 本仓交一只如实拒答的 decider,core 收到 `unavailable` 后**不产生任何自动裁决**、原样落到祖先冻结审批席那条链(本腿的席位又是无 ALS 的降级形 ⇒ 再 park 给人)。方向:分类器本会 allow 的改成问人(更严),本会 block 的也改成问人(**不是自动放行**,但比自动拒松一档)⇒ 记债不当合法兜底。计数 = 「丢了祖先分类器判决的继承 ask」次数。收口件二选一:core 把分类器判据持久进链条目,或让祖先 decider 有可跨进程重建的形。";
|
|
83
83
|
};
|
|
84
|
-
readonly "server.hitl.row-derived-approve-drops-updated-input": {
|
|
85
|
-
readonly cls: "P-DEBT";
|
|
86
|
-
readonly note: "A-054.15:一条**持久 ask 行**上的 `DECIDED=approve` 被回放成裸 `true` 交给 core —— 而人当时可能是带 **ctrl+g 编辑**批的(`updatedInput`)。持久层没有该列(`AskRow`/`DecideAskInput` 皆无),行读不出「这次批准是否改写过实参」,于是 core 的 `d.updatedInput === undefined` 分支落回**原始未改写**实参执行:人批的是改写后的命令,真跑的是原命令 —— 一次**执行面宽于人所批准**的扩权,方向错的一侧,故记债不当合法兜底。四个同形站点全部计在本 tag 下(只在真把 `true` 交出去时计,不在读到行时计):`replayTerminalAskRow` 的三个消费点(`ensureAsk` 幂等回放 / `convergeFromDurableState` / 店报错臂的 `readDecidedForRecovery`)与 `runs.ts` 的 `syncLiveFromDecidedRow`(settled>0 才算)。⚠️ 计数是**上限**不是实数:分不出这次 approve 原本带没带编辑(能分出来就不用记债了),真丢的是其中带编辑的那一部分。补偿:回体在这条路上**省略** `updatedInputForwarded`(从不发 false = 成文的否定信号)。终局收口 = 给 ask 行加 `updated_input` 列(店语义级,须本模块属主立件),届时本 tag 同批销。";
|
|
87
|
-
};
|
|
88
84
|
readonly "server.e2b.orphan-skip-unknown": {
|
|
89
85
|
readonly cls: "F";
|
|
90
86
|
readonly note: "#242 E2B 孤儿回收对一只沙盒**判不了属主/活性**(metadata 缺 taskId 的病态形 / run 行状态词在 LIVE 与 TERMINAL 两表之外 / getRun 抛错)⇒ 恒不杀,本轮跳过。方向纪律:回收是清理型能力,缺席判据=不动作——误杀是杀活任务的手,漏杀只是钱;但每次跳过必须计数,否则「回收在跑却总有几只杀不掉」的病灶(店故障/新状态词未收编/别家部署共用 key)永不显形。";
|
|
@@ -153,6 +149,22 @@ export declare const FAIL_OPEN_TAGS: {
|
|
|
153
149
|
readonly cls: "F";
|
|
154
150
|
readonly note: "S-15 twin 保留条款(core 7.0.0 design/381 §片2 的 SQL 孪生):boundary 提交后的自剪 pass(core 共享选择函数 `fileHistoryBoundariesToKeep` + 既有 `reap` 级联)失败 ⇒ 本轮 boundary **已提交**、rewind 座照常,只是这一轮没剪。放行的是「GC 失败不失败用户这一轮」(core InMemory/File 参照同形 `reap(...).catch(() => {})`,但参照是无声吞,本仓走留痕三件套);最坏后果 = 该 scope 暂时超上限一个 boundary,下一次提交的 pass 按**当前全集**重算、连它一起剪(不累积欠账)。detail 带 scope / entry / 异常文案。";
|
|
155
151
|
};
|
|
152
|
+
readonly "server.approval.ambiguous-cas.expire": {
|
|
153
|
+
readonly cls: "P-DEBT";
|
|
154
|
+
readonly note: "S-25(设计件 2026-08-31 §3 步骤 3;DEBTS S-25 / #290):流内 ask 的**窗到期臂**打 `expireAsk` CAS 抛错或超墙钟(不知道做没做成)之后,恢复读口 6 格退避 7 次读(≈3.1s;末格睡后仍再读一次,末格不是盲窗 —— codex R1-F1)都读不出行 ⇒ 按本臂意图投影结算 = park 路由(`\"unavailable\"`;`deny` 政策下 `{allow:false,settledBy:\"timeout\"}`)并留 park 墓碑。方向 fail-closed(无 DECIDED=approve 行绝不执行工具),但行**可能**已被另一副本判成 DECIDED(approve) 而本腿没兑现 —— 人批了、工具不跑、run 再挂起要人再批一次 = 丢一次人类决议,故记债不当合法兜底。补偿:core 侧仍 pending 的 checkpoint(人再批一次就走)+ 跨副本收敛器兜底(它落地后本 tag 降 F)。**不计**的形:行读得出、只是仍 STREAM_PENDING / 行不在 —— 那是本臂的期望态(K1),零退避直接投影(codex-R2-2 / R3-1 钉;throw 类 K2 的 pending 投影前重打一把本臂幂等 CAS 换持久背书,R3-F2);编辑在飞标记在场 ⇒ 有界让路、用尽走 park 路由(标记的事不是店的债,codex R1-F2/R2-F2;负终态与带载荷 approve 不受标记压制,R2-F1/R3-F1);行读出 DECIDED ⇒ 按人的决议结算,也不计。detail 带 askId 与读次数。";
|
|
155
|
+
};
|
|
156
|
+
readonly "server.approval.ambiguous-cas.cancel": {
|
|
157
|
+
readonly cls: "P-DEBT";
|
|
158
|
+
readonly note: "S-25 同族第二员:**取消臂**(task signal abort / 连接全灭同路)打 `transitionAsk(STREAM_PENDING→VOID)` CAS 抛错或超墙钟之后,恢复读口 7 次读都读不出行 ⇒ 按本臂意图投影结算 = 裸 `settle(false,\"expired\")`(D1 纯进程内语义,不留墓碑:run 已拆,迟到的 Yes 无处兑)。S-25 之前这条 catch **不读行**直接 fail-open —— 行已 DECIDED(approve) 时把人的批准翻成拒绝、回决端点只能如实 404(round6 钉曾把这一形记成「局部竞态残影」);现在只有店持续读不出才走到这里,债的语义与 expire 员同(行可能已 DECIDED 而本腿没兑现),按臂分计是为了让「哪条臂在丢决议」在遥测里读得出。";
|
|
159
|
+
};
|
|
160
|
+
readonly "server.approval.ambiguous-cas.unreachable": {
|
|
161
|
+
readonly cls: "P-DEBT";
|
|
162
|
+
readonly note: "S-25 同族第三员:**emit 全灭臂**(开卡帧两族都没送到任何连接)打 `expireAsk` CAS 抛错或超墙钟之后,恢复读口 7 次读都读不出行 ⇒ 按本臂意图投影结算 = `emitFailed` ⇒ `\"unavailable\"`(park 路由;`deny` 政策下 deny),不留墓碑(卡没到任何人手上,无人持有这把 approvalId)。S-25 之前这条 catch 不读行直接强改 —— 正是 round2 finding A「durable 行已批准、活终局被 emit 全灭强改成 unavailable」的 catch 同形缺口;现在行读出 DECIDED ⇒ 按人的决议结算,只有店持续读不出才计数。";
|
|
163
|
+
};
|
|
164
|
+
readonly "server.pg-pool.idle-client-error": {
|
|
165
|
+
readonly cls: "F";
|
|
166
|
+
readonly note: "S-55(test [5864] 独立复现):pg 连接池里一条连接被外部终止(pg_terminate_backend / 云端故障切换 / LB 空闲回收)或自身网络错误。**两态一 tag,detail 判别**(`state=idle` / `state=checked-out`;先例=park 墓碑行的两臂 detail 判别):①idle 态 —— node-postgres 语义(pg-pool@3.14.0 makeIdleListener):池在 emit 'error' **之前**已 `_remove` 掉该 client,坏连接自然淘汰,下次 acquire 发新连接,在飞查询零影响;修前 Pool 上无 'error' 监听 ⇒ EventEmitter 把事件转 throw ⇒ uncaughtException ⇒ 整进程 exit 1。②checked-out 态(codex R1-[high] 补,同批修)—— pg-pool 借出时摘 idle 监听(index.js:344),`pool.connect()` 显式持有的连接(事务)在 checkout 期死时 client 直接 emit 'error' 同样打死进程;守卫只观察:中毒 client 的后续查询由 pg 以 `_queryable=false` 响亮拒,归还时池淘汰;同一次 checkout 的死可能双发事件(FATAL 消息 + socket end),warn 逐枚、计数按 checkout 去重。放行的最坏后果 = 下一次 acquire 多付一次建连,故 F 类。必须留痕:「连接不断被外部杀」(故障切换风暴 / 回收策略过激 / 有人在库上清连接)与「一切正常」在服务面同形;每次事件另有逐次结构化 warn(`pg_pool_idle_client_error` / `pg_pool_checked_out_client_error`,含 code/severity),本计数让频率曲线可读。`pool.query()` 快路不在洞内(pg-pool 自带 checkout 期 once('error') 守卫)。mysql2 孪生(tidb-pool)**不同病**:PoolConnection 构造器恒挂 once('error') 库内吞并淘汰、借出期同在(坐标成文在 createTidbPool 头注),故无同族 tag。";
|
|
167
|
+
};
|
|
156
168
|
};
|
|
157
169
|
/** 词表键推导的闭集类型——未登记的 tag 传不进 {@link recordFailOpen}(编译期拒)。 */
|
|
158
170
|
export type FailOpenTag = keyof typeof FAIL_OPEN_TAGS;
|
|
@@ -163,7 +175,7 @@ export type FailOpenTag = keyof typeof FAIL_OPEN_TAGS;
|
|
|
163
175
|
* 断连会让保护型计数涨两次(open 一次、complete 又一次),真正的 open 失败率被面包屑的假阳性盖住。
|
|
164
176
|
* 只有 open 帧是"人在环这道门被跳过"的证据,其余都是体验损失。
|
|
165
177
|
*
|
|
166
|
-
* ⚠️ **两条 question 臂在生产上已不可达**(
|
|
178
|
+
* ⚠️ **两条 question 臂在生产上已不可达**([ref] 之后,2026-08-07):本函数唯一的生产调用点是
|
|
167
179
|
* `routes/tasks.ts` 的 `emitAsk` 断流臂,而 question 与 question_complete 两型帧都先过同文件
|
|
168
180
|
* `emitQuestion` 的断流守卫(两道守卫同步相邻、其间无 await)并在断流时 throw,永不抵达这里;另一条
|
|
169
181
|
* question 路(`runs.ts` 的 durable append)根本不经 emitAsk。在产的只剩 elicitation 族与 default。
|
|
@@ -72,10 +72,6 @@ export const FAIL_OPEN_TAGS = {
|
|
|
72
72
|
cls: "P-DEBT",
|
|
73
73
|
note: "跨副本赎回 parked 审批时,祖先层在 park 时是 **auto-mode 武装**的,但那只分类器是祖先任务上的活闭包(绑着它自己的转写窗+brain),跨进程重建不出来 ⇒ 本仓交一只如实拒答的 decider,core 收到 `unavailable` 后**不产生任何自动裁决**、原样落到祖先冻结审批席那条链(本腿的席位又是无 ALS 的降级形 ⇒ 再 park 给人)。方向:分类器本会 allow 的改成问人(更严),本会 block 的也改成问人(**不是自动放行**,但比自动拒松一档)⇒ 记债不当合法兜底。计数 = 「丢了祖先分类器判决的继承 ask」次数。收口件二选一:core 把分类器判据持久进链条目,或让祖先 decider 有可跨进程重建的形。",
|
|
74
74
|
},
|
|
75
|
-
"server.hitl.row-derived-approve-drops-updated-input": {
|
|
76
|
-
cls: "P-DEBT",
|
|
77
|
-
note: "A-054.15:一条**持久 ask 行**上的 `DECIDED=approve` 被回放成裸 `true` 交给 core —— 而人当时可能是带 **ctrl+g 编辑**批的(`updatedInput`)。持久层没有该列(`AskRow`/`DecideAskInput` 皆无),行读不出「这次批准是否改写过实参」,于是 core 的 `d.updatedInput === undefined` 分支落回**原始未改写**实参执行:人批的是改写后的命令,真跑的是原命令 —— 一次**执行面宽于人所批准**的扩权,方向错的一侧,故记债不当合法兜底。四个同形站点全部计在本 tag 下(只在真把 `true` 交出去时计,不在读到行时计):`replayTerminalAskRow` 的三个消费点(`ensureAsk` 幂等回放 / `convergeFromDurableState` / 店报错臂的 `readDecidedForRecovery`)与 `runs.ts` 的 `syncLiveFromDecidedRow`(settled>0 才算)。⚠️ 计数是**上限**不是实数:分不出这次 approve 原本带没带编辑(能分出来就不用记债了),真丢的是其中带编辑的那一部分。补偿:回体在这条路上**省略** `updatedInputForwarded`(从不发 false = 成文的否定信号)。终局收口 = 给 ask 行加 `updated_input` 列(店语义级,须本模块属主立件),届时本 tag 同批销。",
|
|
78
|
-
},
|
|
79
75
|
"server.e2b.orphan-skip-unknown": {
|
|
80
76
|
cls: "F",
|
|
81
77
|
note: "#242 E2B 孤儿回收对一只沙盒**判不了属主/活性**(metadata 缺 taskId 的病态形 / run 行状态词在 LIVE 与 TERMINAL 两表之外 / getRun 抛错)⇒ 恒不杀,本轮跳过。方向纪律:回收是清理型能力,缺席判据=不动作——误杀是杀活任务的手,漏杀只是钱;但每次跳过必须计数,否则「回收在跑却总有几只杀不掉」的病灶(店故障/新状态词未收编/别家部署共用 key)永不显形。",
|
|
@@ -144,6 +140,22 @@ export const FAIL_OPEN_TAGS = {
|
|
|
144
140
|
cls: "F",
|
|
145
141
|
note: "S-15 twin 保留条款(core 7.0.0 design/381 §片2 的 SQL 孪生):boundary 提交后的自剪 pass(core 共享选择函数 `fileHistoryBoundariesToKeep` + 既有 `reap` 级联)失败 ⇒ 本轮 boundary **已提交**、rewind 座照常,只是这一轮没剪。放行的是「GC 失败不失败用户这一轮」(core InMemory/File 参照同形 `reap(...).catch(() => {})`,但参照是无声吞,本仓走留痕三件套);最坏后果 = 该 scope 暂时超上限一个 boundary,下一次提交的 pass 按**当前全集**重算、连它一起剪(不累积欠账)。detail 带 scope / entry / 异常文案。",
|
|
146
142
|
},
|
|
143
|
+
"server.approval.ambiguous-cas.expire": {
|
|
144
|
+
cls: "P-DEBT",
|
|
145
|
+
note: "S-25(设计件 2026-08-31 §3 步骤 3;DEBTS S-25 / #290):流内 ask 的**窗到期臂**打 `expireAsk` CAS 抛错或超墙钟(不知道做没做成)之后,恢复读口 6 格退避 7 次读(≈3.1s;末格睡后仍再读一次,末格不是盲窗 —— codex R1-F1)都读不出行 ⇒ 按本臂意图投影结算 = park 路由(`\"unavailable\"`;`deny` 政策下 `{allow:false,settledBy:\"timeout\"}`)并留 park 墓碑。方向 fail-closed(无 DECIDED=approve 行绝不执行工具),但行**可能**已被另一副本判成 DECIDED(approve) 而本腿没兑现 —— 人批了、工具不跑、run 再挂起要人再批一次 = 丢一次人类决议,故记债不当合法兜底。补偿:core 侧仍 pending 的 checkpoint(人再批一次就走)+ 跨副本收敛器兜底(它落地后本 tag 降 F)。**不计**的形:行读得出、只是仍 STREAM_PENDING / 行不在 —— 那是本臂的期望态(K1),零退避直接投影(codex-R2-2 / R3-1 钉;throw 类 K2 的 pending 投影前重打一把本臂幂等 CAS 换持久背书,R3-F2);编辑在飞标记在场 ⇒ 有界让路、用尽走 park 路由(标记的事不是店的债,codex R1-F2/R2-F2;负终态与带载荷 approve 不受标记压制,R2-F1/R3-F1);行读出 DECIDED ⇒ 按人的决议结算,也不计。detail 带 askId 与读次数。",
|
|
146
|
+
},
|
|
147
|
+
"server.approval.ambiguous-cas.cancel": {
|
|
148
|
+
cls: "P-DEBT",
|
|
149
|
+
note: "S-25 同族第二员:**取消臂**(task signal abort / 连接全灭同路)打 `transitionAsk(STREAM_PENDING→VOID)` CAS 抛错或超墙钟之后,恢复读口 7 次读都读不出行 ⇒ 按本臂意图投影结算 = 裸 `settle(false,\"expired\")`(D1 纯进程内语义,不留墓碑:run 已拆,迟到的 Yes 无处兑)。S-25 之前这条 catch **不读行**直接 fail-open —— 行已 DECIDED(approve) 时把人的批准翻成拒绝、回决端点只能如实 404(round6 钉曾把这一形记成「局部竞态残影」);现在只有店持续读不出才走到这里,债的语义与 expire 员同(行可能已 DECIDED 而本腿没兑现),按臂分计是为了让「哪条臂在丢决议」在遥测里读得出。",
|
|
150
|
+
},
|
|
151
|
+
"server.approval.ambiguous-cas.unreachable": {
|
|
152
|
+
cls: "P-DEBT",
|
|
153
|
+
note: "S-25 同族第三员:**emit 全灭臂**(开卡帧两族都没送到任何连接)打 `expireAsk` CAS 抛错或超墙钟之后,恢复读口 7 次读都读不出行 ⇒ 按本臂意图投影结算 = `emitFailed` ⇒ `\"unavailable\"`(park 路由;`deny` 政策下 deny),不留墓碑(卡没到任何人手上,无人持有这把 approvalId)。S-25 之前这条 catch 不读行直接强改 —— 正是 round2 finding A「durable 行已批准、活终局被 emit 全灭强改成 unavailable」的 catch 同形缺口;现在行读出 DECIDED ⇒ 按人的决议结算,只有店持续读不出才计数。",
|
|
154
|
+
},
|
|
155
|
+
"server.pg-pool.idle-client-error": {
|
|
156
|
+
cls: "F",
|
|
157
|
+
note: "S-55(test [5864] 独立复现):pg 连接池里一条连接被外部终止(pg_terminate_backend / 云端故障切换 / LB 空闲回收)或自身网络错误。**两态一 tag,detail 判别**(`state=idle` / `state=checked-out`;先例=park 墓碑行的两臂 detail 判别):①idle 态 —— node-postgres 语义(pg-pool@3.14.0 makeIdleListener):池在 emit 'error' **之前**已 `_remove` 掉该 client,坏连接自然淘汰,下次 acquire 发新连接,在飞查询零影响;修前 Pool 上无 'error' 监听 ⇒ EventEmitter 把事件转 throw ⇒ uncaughtException ⇒ 整进程 exit 1。②checked-out 态(codex R1-[high] 补,同批修)—— pg-pool 借出时摘 idle 监听(index.js:344),`pool.connect()` 显式持有的连接(事务)在 checkout 期死时 client 直接 emit 'error' 同样打死进程;守卫只观察:中毒 client 的后续查询由 pg 以 `_queryable=false` 响亮拒,归还时池淘汰;同一次 checkout 的死可能双发事件(FATAL 消息 + socket end),warn 逐枚、计数按 checkout 去重。放行的最坏后果 = 下一次 acquire 多付一次建连,故 F 类。必须留痕:「连接不断被外部杀」(故障切换风暴 / 回收策略过激 / 有人在库上清连接)与「一切正常」在服务面同形;每次事件另有逐次结构化 warn(`pg_pool_idle_client_error` / `pg_pool_checked_out_client_error`,含 code/severity),本计数让频率曲线可读。`pool.query()` 快路不在洞内(pg-pool 自带 checkout 期 once('error') 守卫)。mysql2 孪生(tidb-pool)**不同病**:PoolConnection 构造器恒挂 once('error') 库内吞并淘汰、借出期同在(坐标成文在 createTidbPool 头注),故无同族 tag。",
|
|
158
|
+
},
|
|
147
159
|
};
|
|
148
160
|
export function failOpenTagForDroppedFrame(frameType) {
|
|
149
161
|
switch (frameType) {
|
|
@@ -18,7 +18,7 @@ export declare class Metrics {
|
|
|
18
18
|
setGauge(name: string, value: number, labels?: Labels): void;
|
|
19
19
|
addGauge(name: string, delta: number, labels?: Labels): void;
|
|
20
20
|
observe(name: string, value: number, labels?: Labels): void;
|
|
21
|
-
/** [
|
|
21
|
+
/** [ref] 2-j:dynamic gauge 求值抛错不再折成 0 —— 0 是该 gauge 的合法读数,折 0 让故障态与真实 0
|
|
22
22
|
* 在 wire 上逐字节不可区分(与上方 inc 静默 no-op 同族:观测面的 fail-silent 正是观测要消灭的东西)。
|
|
23
23
|
* 披露方向:错帧**不发样本行**(缺席=读数未知,面板显示 no data 而非假 0)+ 计
|
|
24
24
|
* `metric_gauge_eval_errors_total{name}`(响亮、可告警)。每次求值(每次刮取/snapshot)错一次计一次;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** The whitelisted projection of core's `prompt.assembled` trace event ([
|
|
1
|
+
/** The whitelisted projection of core's `prompt.assembled` trace event ([ref]② web observability slice A:
|
|
2
2
|
* the manifest reaches the durable run event log + turns/stream). Built FIELD-BY-FIELD at record time
|
|
3
3
|
* (never a spread — the 1.72 task_progress lesson: a future core field must not ride the durable wire raw).
|
|
4
4
|
* Carries ONLY ids/digests/counts by core's manifest contract (no prompt bodies; hashes are core-salted) —
|
|
@@ -10,7 +10,7 @@ export interface PromptManifestRecord {
|
|
|
10
10
|
chars: number;
|
|
11
11
|
hash: string;
|
|
12
12
|
}>;
|
|
13
|
-
/** `contentHash`(core 1.315 [
|
|
13
|
+
/** `contentHash`(core 1.315 [ref]①):operator 声明 section 的**非盐化**对账锚(core 已对 text 校验
|
|
14
14
|
* 后透传)——盐化 `hash` 恒在旁;端到端对账链(center 发布→manifest)经本投影,必须透传不可吞。 */
|
|
15
15
|
sections?: Array<{
|
|
16
16
|
id: string;
|
|
@@ -31,7 +31,7 @@ export interface PromptManifestRecord {
|
|
|
31
31
|
shapeDigest: string;
|
|
32
32
|
wireSchemaDigest: string;
|
|
33
33
|
}>;
|
|
34
|
-
/** core 5.15.0(
|
|
34
|
+
/** core 5.15.0([ref]):deferred 披露策略自证三键(诊断值,零内容)。缺席=core <5.15 或无 deferred。 */
|
|
35
35
|
toolDisclosure?: {
|
|
36
36
|
deferredTools: number;
|
|
37
37
|
strategy: string;
|
|
@@ -67,7 +67,7 @@ export declare function promptManifestRecordOf(e: {
|
|
|
67
67
|
shapeDigest: string;
|
|
68
68
|
wireSchemaDigest: string;
|
|
69
69
|
}>;
|
|
70
|
-
/** core 5.15.0(
|
|
70
|
+
/** core 5.15.0([ref],[ref] 提货②):deferred 工具的披露策略自证——{deferredTools(数), strategy
|
|
71
71
|
* ("static"|"swap"), source(四值:`spec` / `env` / `default` / `degraded_no_direct_lane`)}。
|
|
72
72
|
* 诊断三键(数 + 两闭集词,零内容)。词表属主是 core(`core/trace.d.ts` 的 `source` 联合),本仓宽收
|
|
73
73
|
* ⇒ 词错不会红,所以照抄时务必对表:`degraded_no_direct_lane` = 直呼车道联锁把 `static` 请求收窄成
|
|
@@ -81,7 +81,7 @@ export declare function promptManifestRecordOf(e: {
|
|
|
81
81
|
totalChars: number;
|
|
82
82
|
}): PromptManifestRecord;
|
|
83
83
|
/**
|
|
84
|
-
* [
|
|
84
|
+
* [ref]② per-task prompt-manifest accumulator — the `ModelUsageTracker`(budget.ts)pattern: the
|
|
85
85
|
* `prompt.assembled` tracer hook is SYNC/no-IO, so it cannot persist; it RECORDS here (registered
|
|
86
86
|
* top-level runs only — the same leak fence: sub-task manifests are never registered, never leak), and
|
|
87
87
|
* the durable run lifecycle DRAINS the pending records into `prompt_assembled` events. Two departures
|
|
@@ -95,7 +95,7 @@ export declare function promptManifestRecordOf(e: {
|
|
|
95
95
|
* delete the NEW leg's registration/pending manifest. Identity-guarded like the sibling
|
|
96
96
|
* inflight/steerable teardowns.
|
|
97
97
|
*/
|
|
98
|
-
/** [
|
|
98
|
+
/** [ref]③ — `config.assembled` 的白名单投影(core 1.346 trace:catalogVersion/fields[来源标注]/
|
|
99
99
|
* overrideReasons)。fields 已是 core 精选的观测形(digest-free、有界);32KiB 罩防未来膨胀。 */
|
|
100
100
|
export declare function configAssembledRecordOf(e: {
|
|
101
101
|
catalogVersion?: unknown;
|
|
@@ -105,7 +105,7 @@ export declare function configAssembledRecordOf(e: {
|
|
|
105
105
|
}): Record<string, unknown> | undefined;
|
|
106
106
|
export declare class PromptManifestTracker {
|
|
107
107
|
private readonly byTask;
|
|
108
|
-
/** [
|
|
108
|
+
/** [ref]③:config.assembled 的同生命周期伴随记录(register 同门、drainConfig 同拍)。队列形
|
|
109
109
|
* (codex F2):cascade 每 rung 独立解析配置,后到覆盖会把先前已计费 rung 的生效配置抹掉——与
|
|
110
110
|
* prompt manifests 同姿势逐条保序。 */
|
|
111
111
|
private readonly configByTask;
|
|
@@ -116,7 +116,7 @@ export declare class PromptManifestTracker {
|
|
|
116
116
|
register(taskId: string): number;
|
|
117
117
|
/** Queue this prepare's manifest — ONLY for a registered top-level run (else a no-op). Sync, never throws. */
|
|
118
118
|
record(taskId: string, m: PromptManifestRecord): void;
|
|
119
|
-
/** [
|
|
119
|
+
/** [ref]③:队一条 config.assembled 投影(同 register 门;逐条保序——cascade 每 rung 各留其形)。 */
|
|
120
120
|
recordConfig(taskId: string, rec: Record<string, unknown>): void;
|
|
121
121
|
/** Return-and-clear ALL pending config records in emission order; `undefined` when none. */
|
|
122
122
|
drainConfig(taskId: string): Array<Record<string, unknown>> | undefined;
|
|
@@ -10,7 +10,7 @@ export interface RateDecision {
|
|
|
10
10
|
retryAfterSec: number;
|
|
11
11
|
remaining: number;
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
13
|
+
/** [ref] 批1:限额的**值换代**入参(六实现类同一形)。语义定案([ref] §5):窗口内计数**不清零**,
|
|
14
14
|
* 新限额即时用于比较 —— 调小 = 窗内立刻更严(可能当场 429,符合运营意图),调大 = 立刻放宽。 */
|
|
15
15
|
export interface RateLimits {
|
|
16
16
|
/** 每窗请求上限;`<= 0` = **关断哨兵**(恒放行、不记账、SQL 腿不起刷新环)。 */
|
|
@@ -21,7 +21,7 @@ export interface RateLimits {
|
|
|
21
21
|
export interface RateGate {
|
|
22
22
|
check(key: string): RateDecision;
|
|
23
23
|
sweep(now?: number): void;
|
|
24
|
-
/**
|
|
24
|
+
/** [ref]:值换代座位。**接口级**声明(不是各类自选):新实现漏掉它 = 编译红,而不是热更新在那条腿上静默失效。 */
|
|
25
25
|
setLimits(next: RateLimits): void;
|
|
26
26
|
}
|
|
27
27
|
export declare class RateLimiter implements RateGate {
|
|
@@ -16,7 +16,7 @@ export declare function isKnownDenySource(v: unknown): v is PermissionDeniedSour
|
|
|
16
16
|
*/
|
|
17
17
|
export declare function createPermissionDeniedMeter(metrics: Pick<Metrics, "inc">): Hooks;
|
|
18
18
|
/**
|
|
19
|
-
* prove-before-scale stopgap (
|
|
19
|
+
* prove-before-scale stopgap ([ref]): a no-op observer hook that logs every tool call (pre + post)
|
|
20
20
|
* to the worker log — INCLUDING resumed legs that `GET /v1/runs/:id/events` does NOT surface (the
|
|
21
21
|
* streaming-resume observability gap, service[15] API request #2). Gated by `TOOL_TRACE=true`; OFF by
|
|
22
22
|
* default (no prod noise).
|