@sema-agent/server 7.52.0 → 7.53.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.
Files changed (328) hide show
  1. package/USAGE.md +22 -5
  2. package/dist/adoption/plan.d.ts +3 -3
  3. package/dist/adoption/quiesce.d.ts +1 -1
  4. package/dist/adoption/sql.d.ts +2 -2
  5. package/dist/adoption/wire.d.ts +1 -1
  6. package/dist/approval-ask-machine.d.ts +2 -2
  7. package/dist/approval-card.d.ts +18 -18
  8. package/dist/approval-deny-reasons.d.ts +1 -1
  9. package/dist/approval-hmac.d.ts +2 -2
  10. package/dist/approval-reconciler.d.ts +14 -14
  11. package/dist/approval.d.ts +2 -2
  12. package/dist/audit.d.ts +4 -4
  13. package/dist/auth-keys.d.ts +6 -6
  14. package/dist/bench/l8/artifact.d.ts +6 -1
  15. package/dist/bench/l8/artifact.js +2 -27
  16. package/dist/bench/l8/escape.d.ts +3 -3
  17. package/dist/bench/l8/index.d.ts +1 -1
  18. package/dist/bench/s1/arms.d.ts +3 -3
  19. package/dist/bench/s1/oracle.d.ts +2 -2
  20. package/dist/bench/s1/reviewer.d.ts +1 -1
  21. package/dist/bench/s1/row.d.ts +5 -5
  22. package/dist/bench/s1/runner-ctx.d.ts +3 -3
  23. package/dist/boot/config-center.d.ts +14 -7
  24. package/dist/boot/config-center.js +2 -0
  25. package/dist/boot/coordinators.d.ts +4 -4
  26. package/dist/boot/crash-last.d.ts +1 -1
  27. package/dist/boot/device-lane.d.ts +3 -3
  28. package/dist/boot/device-lane.js +2 -0
  29. package/dist/boot/engine-lease.d.ts +4 -4
  30. package/dist/boot/governance-seams.d.ts +5 -5
  31. package/dist/boot/leader.d.ts +5 -5
  32. package/dist/boot/limit-sync.d.ts +1 -1
  33. package/dist/boot/memory-boundary.d.ts +5 -5
  34. package/dist/boot/memory-consolidation.d.ts +8 -2
  35. package/dist/boot/memory-consolidation.js +1 -0
  36. package/dist/boot/org-memory.d.ts +5 -5
  37. package/dist/boot/parked-revive-gate.d.ts +6 -6
  38. package/dist/boot/permission-rules-audit.d.ts +2 -2
  39. package/dist/boot/reapers.d.ts +8 -8
  40. package/dist/boot/resolve-spec.d.ts +4 -4
  41. package/dist/boot/retention-lane.d.ts +1 -1
  42. package/dist/boot/runner-deps.d.ts +33 -27
  43. package/dist/boot/runner-deps.js +2 -1
  44. package/dist/boot/runtime-caps.d.ts +4 -4
  45. package/dist/boot/session-faces.d.ts +1 -1
  46. package/dist/boot/shutdown.d.ts +10 -10
  47. package/dist/boot/side-query-lane.d.ts +14 -14
  48. package/dist/boot/stores.js +5 -0
  49. package/dist/boot/task-list-lane.d.ts +3 -3
  50. package/dist/boot/webfetch-summarize-lane.d.ts +9 -9
  51. package/dist/boot/workflow-orchestration.d.ts +1 -1
  52. package/dist/bounded-session-map.d.ts +1 -1
  53. package/dist/brain.d.ts +3 -3
  54. package/dist/budget.d.ts +3 -3
  55. package/dist/canonical-json.d.ts +53 -0
  56. package/dist/canonical-json.js +48 -0
  57. package/dist/capabilities/center-prompts.d.ts +13 -13
  58. package/dist/capabilities/collab-workflows.d.ts +1 -1
  59. package/dist/capabilities/hands-lane.d.ts +4 -4
  60. package/dist/capabilities/memory-notice.d.ts +4 -4
  61. package/dist/capabilities/prompt.d.ts +2 -2
  62. package/dist/capabilities/sandbox-file-send.d.ts +2 -2
  63. package/dist/capabilities/scenarios.d.ts +16 -16
  64. package/dist/capabilities/skills.d.ts +1 -1
  65. package/dist/capabilities/team.d.ts +3 -3
  66. package/dist/capabilities/tool-defer.d.ts +6 -6
  67. package/dist/config-catalog.d.ts +139 -0
  68. package/dist/config-catalog.js +556 -0
  69. package/dist/config-center/apply-effective.d.ts +20 -7
  70. package/dist/config-center/apply-effective.js +45 -0
  71. package/dist/config-center/apply-ledger.d.ts +6 -6
  72. package/dist/config-center/facade.d.ts +3 -2
  73. package/dist/config-center/hot-keys-registry.d.ts +2 -2
  74. package/dist/config-center/http-client.d.ts +5 -5
  75. package/dist/config-center/mcp-revocation.d.ts +6 -4
  76. package/dist/config-center/mcp-revocation.js +2 -12
  77. package/dist/config-center/restart-signal.d.ts +11 -1
  78. package/dist/config-center/restart-signal.js +1 -1
  79. package/dist/config-center/skills-mcp.d.ts +2 -2
  80. package/dist/config-center/stage-limits.d.ts +3 -3
  81. package/dist/config-center/types.d.ts +23 -19
  82. package/dist/config-invariants.d.ts +1 -1
  83. package/dist/config-provider.d.ts +2 -2
  84. package/dist/config-types.d.ts +157 -134
  85. package/dist/config.d.ts +32 -24
  86. package/dist/config.js +48 -6
  87. package/dist/degenerate-instrument.d.ts +1 -1
  88. package/dist/deployment-governance.d.ts +13 -13
  89. package/dist/device-store.d.ts +2 -2
  90. package/dist/device-ws-hub.d.ts +6 -4
  91. package/dist/device-ws-hub.js +9 -3
  92. package/dist/device-ws-protocol.d.ts +3 -3
  93. package/dist/digest-form.d.ts +1 -1
  94. package/dist/elicitation.d.ts +1 -1
  95. package/dist/env-facts.d.ts +7 -7
  96. package/dist/execution-lane-caps.d.ts +5 -5
  97. package/dist/fleet/fleet-bus.d.ts +56 -53
  98. package/dist/fleet/fleet-reconciler.d.ts +2 -2
  99. package/dist/fleet/fleet-terminal-window.d.ts +1 -1
  100. package/dist/fleet/subagent-tail-bus.d.ts +3 -3
  101. package/dist/fleet-client.d.ts +3 -3
  102. package/dist/fleet-lease.d.ts +1 -1
  103. package/dist/hooks/branch-transcript.d.ts +2 -2
  104. package/dist/hooks/cc-agent-hook-prompt.d.ts +2 -2
  105. package/dist/hooks/cc-stop-prompt.d.ts +2 -2
  106. package/dist/hooks/hook-llm.d.ts +1 -1
  107. package/dist/hooks/hook-runner.d.ts +12 -5
  108. package/dist/http/active-run-conflict.d.ts +31 -33
  109. package/dist/http/active-run-conflict.js +4 -2
  110. package/dist/http/route-ctx.d.ts +23 -21
  111. package/dist/http/routes/a2a-serve.d.ts +2 -2
  112. package/dist/http/routes/admin-config-refresh.d.ts +1 -1
  113. package/dist/http/routes/admin-drain.d.ts +4 -4
  114. package/dist/http/routes/admin-memory-optout.d.ts +5 -5
  115. package/dist/http/routes/adoption.d.ts +1 -1
  116. package/dist/http/routes/agents-roster.d.ts +1 -1
  117. package/dist/http/routes/approvals-assistant.d.ts +6 -6
  118. package/dist/http/routes/approvals-assistant.js +4 -1
  119. package/dist/http/routes/capabilities.d.ts +1 -1
  120. package/dist/http/routes/capabilities.js +1 -0
  121. package/dist/http/routes/config-catalog.d.ts +28 -0
  122. package/dist/http/routes/config-catalog.js +42 -0
  123. package/dist/http/routes/diagnostics.d.ts +2 -2
  124. package/dist/http/routes/fleet.d.ts +1 -1
  125. package/dist/http/routes/images.d.ts +1 -1
  126. package/dist/http/routes/leader.d.ts +1 -1
  127. package/dist/http/routes/memory-bundle.d.ts +4 -4
  128. package/dist/http/routes/memory-bundle.js +2 -3
  129. package/dist/http/routes/memory-compliance.d.ts +7 -7
  130. package/dist/http/routes/memory-consolidation.d.ts +1 -1
  131. package/dist/http/routes/memory-origin.d.ts +9 -9
  132. package/dist/http/routes/memory-policy.d.ts +3 -3
  133. package/dist/http/routes/notify-wake.d.ts +1 -1
  134. package/dist/http/routes/observability.d.ts +1 -1
  135. package/dist/http/routes/retention-ops.d.ts +1 -1
  136. package/dist/http/routes/rules.d.ts +3 -3
  137. package/dist/http/routes/run-memory-capture.d.ts +1 -1
  138. package/dist/http/routes/runs.d.ts +3 -3
  139. package/dist/http/routes/runs.js +12 -17
  140. package/dist/http/routes/session-sync.d.ts +2 -2
  141. package/dist/http/routes/sessions-list.d.ts +1 -1
  142. package/dist/http/routes/sessions.d.ts +9 -1
  143. package/dist/http/routes/sessions.js +61 -1
  144. package/dist/http/routes/shared-memory.d.ts +1 -1
  145. package/dist/http/routes/side-query.d.ts +1 -1
  146. package/dist/http/routes/tasks.d.ts +1 -1
  147. package/dist/http/routes/trace-usage.d.ts +1 -1
  148. package/dist/http/routes/workflows.d.ts +1 -1
  149. package/dist/http/run-meta.d.ts +1 -1
  150. package/dist/http/send.d.ts +6 -6
  151. package/dist/http/server.d.ts +84 -67
  152. package/dist/http/server.js +25 -12
  153. package/dist/http/sse-lifecycle.d.ts +1 -1
  154. package/dist/http/sse-log.d.ts +6 -6
  155. package/dist/http/verify-rounds.d.ts +3 -3
  156. package/dist/http/wire-gate.d.ts +2 -2
  157. package/dist/http/wire-types.d.ts +38 -38
  158. package/dist/key-resolver.d.ts +1 -1
  159. package/dist/leader/diffout.d.ts +2 -2
  160. package/dist/leader/diffup.d.ts +1 -1
  161. package/dist/leader/endpoint.d.ts +1 -1
  162. package/dist/leader/fanout.d.ts +6 -6
  163. package/dist/leader/grader-env-factory.d.ts +1 -1
  164. package/dist/leader/leader.d.ts +12 -12
  165. package/dist/leader/merge.d.ts +3 -3
  166. package/dist/leader/planner.d.ts +5 -5
  167. package/dist/leader/repair-oracle.d.ts +1 -1
  168. package/dist/leader/wire.d.ts +9 -9
  169. package/dist/lsp/manager.d.ts +2 -2
  170. package/dist/lsp/types.d.ts +1 -1
  171. package/dist/lsp/ws-transport.d.ts +2 -2
  172. package/dist/main.js +13 -2
  173. package/dist/mcp-content-origin.d.ts +1 -1
  174. package/dist/memory-bundle-engine.d.ts +5 -3
  175. package/dist/memory-bundle-engine.js +2 -2
  176. package/dist/memory-operator-faces.d.ts +41 -11
  177. package/dist/memory-operator-faces.js +12 -0
  178. package/dist/memory-origin-fence.d.ts +20 -35
  179. package/dist/memory-origin-fence.js +41 -1
  180. package/dist/memory-posture.d.ts +6 -6
  181. package/dist/memory-scope.d.ts +7 -7
  182. package/dist/model-select.d.ts +5 -5
  183. package/dist/observability/cost-quota.d.ts +6 -6
  184. package/dist/observability/cost-taxonomy.d.ts +2 -2
  185. package/dist/observability/fail-open.d.ts +1 -5
  186. package/dist/observability/fail-open.js +0 -4
  187. package/dist/observability/metrics.d.ts +1 -1
  188. package/dist/observability/prompt-manifest.d.ts +8 -8
  189. package/dist/observability/rate-limit.d.ts +2 -2
  190. package/dist/observability/secret-env-scrub.d.ts +1 -1
  191. package/dist/observability/tool-trace.d.ts +1 -1
  192. package/dist/orchestration/hardened-vm-runner.d.ts +6 -6
  193. package/dist/orchestration/hardened-vm-worker-runner.d.ts +1 -1
  194. package/dist/orchestration/subagent-steer.d.ts +3 -3
  195. package/dist/orchestration/workflow-agent-steer.d.ts +1 -1
  196. package/dist/orchestration/workflow-completion-inbox.d.ts +6 -6
  197. package/dist/orchestration/workflow-notify-journal.d.ts +6 -6
  198. package/dist/parent-watch.d.ts +1 -1
  199. package/dist/parked-decide.d.ts +11 -11
  200. package/dist/plan-cache-probe.d.ts +1 -1
  201. package/dist/plugins/adoption-log-sql.d.ts +4 -4
  202. package/dist/plugins/approval-ask-store-memory.d.ts +1 -1
  203. package/dist/plugins/approval-ask-store-memory.js +12 -0
  204. package/dist/plugins/approval-ask-store-sql.d.ts +39 -17
  205. package/dist/plugins/approval-ask-store-sql.js +23 -6
  206. package/dist/plugins/approval-payload-fingerprint.d.ts +23 -0
  207. package/dist/plugins/approval-payload-fingerprint.js +23 -0
  208. package/dist/plugins/background-agent-store-sql.d.ts +8 -8
  209. package/dist/plugins/background-shell-support.d.ts +12 -12
  210. package/dist/plugins/blob-backend.d.ts +3 -3
  211. package/dist/plugins/breaker-state-sql.d.ts +3 -3
  212. package/dist/plugins/caching-session-store.d.ts +6 -6
  213. package/dist/plugins/checkpoint-store-sql.d.ts +162 -66
  214. package/dist/plugins/checkpoint-store-sql.js +76 -33
  215. package/dist/plugins/device-store-sql.d.ts +4 -3
  216. package/dist/plugins/e2b-orphan-reclaim.d.ts +3 -3
  217. package/dist/plugins/file-history-store-sql.d.ts +9 -8
  218. package/dist/plugins/file-run-store.d.ts +27 -27
  219. package/dist/plugins/fork-routing-session-store.d.ts +9 -9
  220. package/dist/plugins/image-bake-store-sql.d.ts +1 -1
  221. package/dist/plugins/image-index-sql.d.ts +2 -2
  222. package/dist/plugins/k8s-bg-scripts.d.ts +1 -1
  223. package/dist/plugins/k8s-exec-protocol.d.ts +1 -1
  224. package/dist/plugins/leader-run-store-sql.d.ts +1 -1
  225. package/dist/plugins/local-checkpoint-store.d.ts +26 -17
  226. package/dist/plugins/local-checkpoint-store.js +21 -11
  227. package/dist/plugins/local-session-store.d.ts +5 -5
  228. package/dist/plugins/mailbox-store-sql.d.ts +6 -6
  229. package/dist/plugins/memory-embedder-fingerprint.d.ts +2 -2
  230. package/dist/plugins/memory-engine-pg.d.ts +1 -1
  231. package/dist/plugins/memory-engine-tidb.d.ts +1 -1
  232. package/dist/plugins/memory-key-guards.d.ts +3 -3
  233. package/dist/plugins/memory-optout-grant-store-sql.d.ts +10 -10
  234. package/dist/plugins/memory-origin-law.d.ts +13 -13
  235. package/dist/plugins/memory-run-store.d.ts +12 -12
  236. package/dist/plugins/outcome-ledger-sql.d.ts +3 -3
  237. package/dist/plugins/permission-rule-store-file.d.ts +3 -3
  238. package/dist/plugins/permission-rule-store-sql.d.ts +38 -33
  239. package/dist/plugins/permission-rule-store-sql.js +7 -12
  240. package/dist/plugins/pg-cost-quota.d.ts +2 -2
  241. package/dist/plugins/pg-pool.js +5 -0
  242. package/dist/plugins/pg-query.d.ts +1 -1
  243. package/dist/plugins/pg-rate-limiter.d.ts +2 -2
  244. package/dist/plugins/pg-session-storage.d.ts +9 -9
  245. package/dist/plugins/remote-env-adb.d.ts +1 -1
  246. package/dist/plugins/remote-env-device.d.ts +2 -2
  247. package/dist/plugins/remote-env-e2b.d.ts +11 -11
  248. package/dist/plugins/remote-env-file-error.d.ts +2 -2
  249. package/dist/plugins/remote-env-host.d.ts +10 -10
  250. package/dist/plugins/remote-env-k8s.d.ts +7 -7
  251. package/dist/plugins/remote-env-local-docker.d.ts +1 -1
  252. package/dist/plugins/remote-env-ssh.d.ts +9 -9
  253. package/dist/plugins/remote-scratchpad.d.ts +1 -1
  254. package/dist/plugins/resume-anchor-store-sql.d.ts +1 -1
  255. package/dist/plugins/retention-lane-store-sql.d.ts +2 -2
  256. package/dist/plugins/retention-store-sql.d.ts +11 -11
  257. package/dist/plugins/roster-store-sql.d.ts +5 -5
  258. package/dist/plugins/run-store-sql.d.ts +12 -12
  259. package/dist/plugins/scheduler-support.d.ts +1 -1
  260. package/dist/plugins/send-user-file.d.ts +1 -1
  261. package/dist/plugins/session-capture-record-store-sql.d.ts +99 -0
  262. package/dist/plugins/session-capture-record-store-sql.js +110 -0
  263. package/dist/plugins/session-placement.d.ts +1 -1
  264. package/dist/plugins/session-policy-store-sql.d.ts +2 -2
  265. package/dist/plugins/session-store.d.ts +3 -3
  266. package/dist/plugins/shared-memory-store-sql.d.ts +5 -5
  267. package/dist/plugins/sql-driver.d.ts +7 -7
  268. package/dist/plugins/sql-errors.d.ts +2 -2
  269. package/dist/plugins/sql-escape.d.ts +1 -1
  270. package/dist/plugins/sql-row-helpers.d.ts +1 -1
  271. package/dist/plugins/store-backend.d.ts +32 -19
  272. package/dist/plugins/store-backend.js +4 -0
  273. package/dist/plugins/store-contracts.d.ts +9 -9
  274. package/dist/plugins/task-list-store-sql.d.ts +3 -3
  275. package/dist/plugins/tidb-cost-quota.d.ts +3 -3
  276. package/dist/plugins/tidb-pool.js +9 -0
  277. package/dist/plugins/tidb-rate-limiter.d.ts +2 -2
  278. package/dist/plugins/tidb-session-storage.d.ts +2 -2
  279. package/dist/plugins/tidb-session-store.d.ts +11 -11
  280. package/dist/plugins/tool-result-store-sql.d.ts +8 -8
  281. package/dist/plugins/usage-window-store-sql.d.ts +3 -3
  282. package/dist/plugins/web-search.d.ts +7 -7
  283. package/dist/plugins/workflow-journal-store-sql.d.ts +6 -6
  284. package/dist/plugins/workflow-run-store-sql.d.ts +1 -1
  285. package/dist/plugins/write-behind-counter.d.ts +6 -6
  286. package/dist/principal-jwt.d.ts +2 -2
  287. package/dist/project-memory.d.ts +1 -1
  288. package/dist/prompts-domain-validate.d.ts +8 -8
  289. package/dist/question.d.ts +3 -3
  290. package/dist/resource-suspend.d.ts +4 -4
  291. package/dist/resource-window.d.ts +3 -3
  292. package/dist/router/route-orchestration.d.ts +1 -1
  293. package/dist/rules-consent.d.ts +48 -40
  294. package/dist/run-local.d.ts +5 -5
  295. package/dist/run-local.js +28 -4
  296. package/dist/runs.d.ts +19 -19
  297. package/dist/runtime-caps-resolver.d.ts +6 -6
  298. package/dist/runtime-governance.d.ts +7 -7
  299. package/dist/security.d.ts +13 -13
  300. package/dist/session-leaf-bus.d.ts +1 -1
  301. package/dist/session-sync-content.d.ts +4 -4
  302. package/dist/session-sync-kernel.d.ts +2 -2
  303. package/dist/session-sync.d.ts +13 -13
  304. package/dist/session-titler.d.ts +1 -1
  305. package/dist/session-watch.d.ts +3 -3
  306. package/dist/shared-memory-scope-authorizer.d.ts +4 -4
  307. package/dist/sighup-idle.d.ts +1 -1
  308. package/dist/spec-fields.d.ts +20 -20
  309. package/dist/ssh-host-key.d.ts +5 -5
  310. package/dist/store-live-probe.d.ts +2 -2
  311. package/dist/task-cwd.d.ts +11 -11
  312. package/dist/task-mcp.d.ts +5 -5
  313. package/dist/task-settings.d.ts +35 -35
  314. package/dist/task-workflow.d.ts +3 -3
  315. package/dist/text-bidi.d.ts +1 -1
  316. package/dist/tool-approval.d.ts +171 -160
  317. package/dist/tool-approval.js +33 -28
  318. package/dist/trace/core-keyset-guard.d.ts +21 -7
  319. package/dist/trace/engine-notice-wire.d.ts +6 -6
  320. package/dist/trace/injection-tier.d.ts +2 -2
  321. package/dist/trace/ledger-events.d.ts +3 -3
  322. package/dist/trace/ledger-sink.d.ts +7 -7
  323. package/dist/trace/project.d.ts +35 -30
  324. package/dist/trace/project.js +9 -0
  325. package/dist/turn-activity.d.ts +4 -4
  326. package/dist/usage-analytics.d.ts +1 -1
  327. package/dist/wall-clock-jump-guard.d.ts +3 -3
  328. package/package.json +6 -6
package/dist/config.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { type Model } from "@sema-agent/core";
2
2
  import type { Autonomy } from "./runtime-governance.js";
3
3
  import type { ServiceConfig, ServiceConfigFlat, ServiceConfigGroups } from "./config-types.js";
4
- /** design/158 A1: the config TYPE face lives in the leaf module config-types.ts; re-exported here so
4
+ /** [ref] A1: the config TYPE face lives in the leaf module config-types.ts; re-exported here so
5
5
  * every existing `from "./config.js"` importer compiles unchanged (pure-type consumers should prefer
6
6
  * importing config-types.js directly — a type-only leaf, no loader baggage). */
7
- export type { ServiceConfig, ScopedMcpServer, ImageBakeConfig, ServiceConfigFlat, ServiceConfigGroups, ServiceStoreConfig, ServiceModelPlaneConfig, ServiceApprovalConfig, ServiceMemoryConfig, ServiceAuthConfig, ServiceOrchestrationConfig, ServiceLimitsHttpConfig, ServiceObservabilityConfig, ServiceIntegrationsConfig, MemoryEmbedderConfig, // #228:embedder 坐标(plugins/memory-embedder.ts 消费同一属主类型)
7
+ export type { ServiceConfig, ScopedMcpServer, ImageBakeConfig, ServiceConfigFlat, ServiceConfigGroups, ServiceStoreConfig, ServiceModelPlaneConfig, ServiceApprovalConfig, ServiceMemoryConfig, ServiceAuthConfig, ServiceOrchestrationConfig, ServiceLimitsHttpConfig, ServiceObservabilityConfig, ServiceIntegrationsConfig, MemoryEmbedderConfig, // [ref]:embedder 坐标(plugins/memory-embedder.ts 消费同一属主类型)
8
8
  A2aServeConfig, A2aServeSkill, RetentionMode, RetentionSweepConfig, MemoryConsolidationDriverConfig, } from "./config-types.js";
9
9
  export { RETENTION_MODES, MEMORY_CONSOLIDATION_MIN_INTERVAL_SEC } from "./config-types.js";
10
10
  /** Parse the AUTONOMY env into a validated autonomy mode. Unset/empty → undefined (unmanaged → no extra
@@ -13,13 +13,21 @@ export { RETENTION_MODES, MEMORY_CONSOLIDATION_MIN_INTERVAL_SEC } from "./config
13
13
  * config overlay (config-center/facade.ts `applyRuntimeHot`) can re-derive the ENV BASELINE to revert to when center
14
14
  * stops managing `autonomy` (a stale center override must not stick — see applyRuntimeHot). */
15
15
  export declare function parseAutonomy(raw: string | undefined): Autonomy | undefined;
16
- /** design/166-T1 — parse `USAGE_WINDOWS`(单键 JSON 数组;逐窗散键在窗数可变时组合爆炸,JSON 是唯一
16
+ /** [ref]-T1 — parse `USAGE_WINDOWS`(单键 JSON 数组;逐窗散键在窗数可变时组合爆炸,JSON 是唯一
17
17
  * 封闭形)。unset/空串 → undefined(关)。fail-loud 族(numEnv 同纪律):坏 JSON/非数组/空数组/
18
- * 非正有限整数/未知 anchor 全部 boot throw 点名——「设了但无意义」静默关掉=部署方以为有治理实际没有。
19
- * server 严于 core(core 允 maxTokens=0=恒拒锅;这里要求正整数,0 配置显然是笔误不是意图)。 */
18
+ * 坏值/未知 anchor 全部 boot throw 点名——「设了但无意义」静默关掉=部署方以为有治理实际没有。
19
+ * [ref](core 7.0.0 `UsageWindow.maxCostUsd`,dist/core/usage-window-store.d.ts:44-68 亲读):
20
+ * `maxTokens` 与 `maxCostUsd` 是两只**独立** ceiling——each optional on its own、**at least one
21
+ * required**(双缺=拒:a window with neither admits nothing it can govern),whichever fills first
22
+ * 即耗尽;缺席的 ceiling 不参与(非 0、非 ∞)。修前这里的白名单重铸只认三键,$ 键配了也被静默
23
+ * 剥掉——正是本函数要消灭的那族病自己。
24
+ * server 严于 core(core 允两 ceiling 取 0=恒满锁死窗;这里都要求正数,0 配置显然是笔误不是意图);
25
+ * `maxCostUsd` 另提前执行 core 的 micro-USD 门(×1e6 仍有限——超界 ceiling 在账本单位里读作 ∞,
26
+ * 「看起来被治理、实际什么都不拦」,core 在门口拒,这里拒在 boot)。 */
20
27
  export declare function parseUsageWindows(raw: string | undefined): readonly {
21
28
  windowMs: number;
22
- maxTokens: number;
29
+ maxTokens?: number;
30
+ maxCostUsd?: number;
23
31
  anchor: "first-use" | "rolling";
24
32
  }[] | undefined;
25
33
  /** Numeric env with validation: a non-numeric value FAILS at startup instead of silently becoming `NaN`
@@ -56,7 +64,7 @@ export declare function parseNumOrFailNonNegative(name: string, raw: string | un
56
64
  * logger exists. main.ts drains this once after createLogger and warns per entry ("configured X=raw is
57
65
  * invalid, using the default"). Module-level on purpose; drain clears it (repeat loadConfig in tests is fine). */
58
66
  /**
59
- * #210(黑板 [3425]③):一条配置诊断的**种类**。
67
+ * [ref](黑板 [ref]③):一条配置诊断的**种类**。
60
68
  *
61
69
  * ⚠️ 为什么是显式 `kind` 而不是「`used` 在不在场」(codex 自审 R2-F1 真修):第一版拿可选字段当判别式,
62
70
  * 于是三件语义完全不同的事挤在两个出口上 —— 空串**保留原值**被报成「越界夹取」、坏值**回默认**因为带了
@@ -82,7 +90,7 @@ export declare function drainConfigNotices(): Array<{
82
90
  event: string;
83
91
  fields: Record<string, string>;
84
92
  }>;
85
- /** F10 (codex audit): drain + log BOTH pre-logger diagnostic collectors (S20 soft-knob warnings + [792]④ boot
93
+ /** F10 (codex audit): drain + log BOTH pre-logger diagnostic collectors (S20 soft-knob warnings + [ref]④ boot
86
94
  * notices) in one place. EVERY entrypoint that calls loadConfig() then builds a logger must call this right
87
95
  * after (main.ts, run-local.ts) — a new entry that forgets it would silently drop operator-facing diagnostics
88
96
  * (run-local historically did exactly that), so the drain lives beside the collectors, not in one entrypoint. */
@@ -91,7 +99,7 @@ export declare function logConfigDiagnostics(logger: {
91
99
  info?: (event: string, fields?: Record<string, unknown>) => void;
92
100
  debug?: (event: string, fields?: Record<string, unknown>) => void;
93
101
  }): void;
94
- /** design/158 N8/N9 — the BOOLEAN member of this module's env-parser family (`env`/`env2`/`numEnv`/
102
+ /** [ref] N8/N9 — the BOOLEAN member of this module's env-parser family (`env`/`env2`/`numEnv`/
95
103
  * `numEnvBounded`/`optFinitePositiveEnv`/`enumEnv`/`headerNameEnv`/`firstSetEnv`). Until now booleans were the
96
104
  * one type parsed by a hand-written literal comparison at every single site, and that is exactly why the same
97
105
  * `*_ENABLED` suffix grew FOUR incompatible polarities (opt-in `=== "true"`, opt-out `!== "false"`, the posture
@@ -122,7 +130,7 @@ export interface ConfigKnobRecord {
122
130
  }
123
131
  /** The registered boolean knobs, sorted by name — the data behind `logConfigDiagnostics`'s polarity table. */
124
132
  export declare function configKnobTable(): ConfigKnobRecord[];
125
- /** design/158 N8 (D-family) + server 3.0.0 墓碑 —— a knob whose CANONICAL name is positive (`X_ENABLED`,
133
+ /** [ref] N8 (D-family) + server 3.0.0 墓碑 —— a knob whose CANONICAL name is positive (`X_ENABLED`,
126
134
  * default ON) and whose retired negative name (`X_DISABLED`) is now a **fail-loud tombstone**.
127
135
  *
128
136
  * Why the flip at all: `X_DISABLED !== "true"` is a double negative at the read site, so the four knobs that
@@ -130,7 +138,7 @@ export declare function configKnobTable(): ConfigKnobRecord[];
130
138
  * without inverting twice in your head, and `projectMemoryDisabled` was the ONE negative boolean on a
131
139
  * `ServiceConfig` that otherwise carries 16 positive `*Enabled`/`*Allowed` fields.
132
140
  *
133
- * 🔴 3.0.0([1989],clay 令「不做兼容」):旧名不再有兼容窗——**设了就拒启**。这个函数保留 legacy 形参
141
+ * 🔴 3.0.0([ref],clay 令「不做兼容」):旧名不再有兼容窗——**设了就拒启**。这个函数保留 legacy 形参
134
142
  * 不是为了继续读它,而正是为了**认出它在场并拒绝启动**(把墓碑放在唯一知道这对名字关系的地方)。
135
143
  *
136
144
  * Resolution order:
@@ -149,12 +157,12 @@ export declare const configLkgEnabled: () => boolean;
149
157
  export declare const hostBackgroundShellEnabled: () => boolean;
150
158
  /** The `host` exec lane's spool-file stdio form; false ⇒ the pre-1.226 pipe fallback (read per exec). */
151
159
  export declare const hostExecSpoolEnabled: () => boolean;
152
- /** [818]① 1M dual-window (core 1.289 `Model.autoCompactTokens`): an EXPLICIT positive value wins (env
160
+ /** [ref]① 1M dual-window (core 1.289 `Model.autoCompactTokens`): an EXPLICIT positive value wins (env
153
161
  * `MODEL_AUTO_COMPACT_TOKENS` / center roster `autoCompactTokens`); else the **model-id table** applies —
154
162
  * sonnet-5-family id ∧ contextWindow>=1e6 ⇒ 967000 (the faithful shape of CC's single-entry per-model
155
163
  * config; a small-window sonnet is NOT derived — a field above the physical window is undefined core
156
164
  * behavior); anything else ⇒ REMOVED (a spread-inherited value from a bigger-window base model would
157
- * mis-trigger a small window). ⚠️ A-065 P2-6 rescinded the old `contextWindow>=1e6 ⇒ 967000` derivation:
165
+ * mis-trigger a small window). ⚠️ [ref] P2-6 rescinded the old `contextWindow>=1e6 ⇒ 967000` derivation:
158
166
  * it handed a sonnet-5-only constant to ANY 1M model with no corpus/upstream backing (the earlier note
159
167
  * here claiming this was "the exact CC alignment core recommends embedders set" mis-read core's per-model
160
168
  * advice as a width rule). Returns a discriminant so the env lane can turn the removed implicit value into
@@ -163,7 +171,7 @@ export declare const hostExecSpoolEnabled: () => boolean;
163
171
  export declare function applyAutoCompactWindow(m: Model, explicit?: number): "explicit" | "sonnet5" | "removed-1m" | "removed";
164
172
  /**
165
173
  * 一条工具名**永不匹配任何现役工具**的三种拼法,及其修正指引。审批/权限名单是 server 侧 ToolPolicy 的
166
- * RAW 逐字比对(canonicalToolName 折叠面已随 core 5.0.0 RB-476 退役),所以写错的名字不会报错、只会静默
174
+ * RAW 逐字比对(canonicalToolName 折叠面已随 core 5.0.0 [ref] 退役),所以写错的名字不会报错、只会静默
167
175
  * 不生效——对 deny/ask 名单而言这是**失守方向**(运维/客户端以为加了门,实际什么都没加)。
168
176
  *
169
177
  * 判据在此**单点成文**,三条腿共用(它们此前各自为政,拼法覆盖面不一致才是真缺口):
@@ -173,7 +181,7 @@ export declare function applyAutoCompactWindow(m: Model, explicit?: number): "ex
173
181
  * ③ per-request 腿(`settings.permissions.{ask,deny}`,task-settings.ts)—— 该请求 422。
174
182
  *
175
183
  * 五种拼法:
176
- * - CC 形规则条目(`Bash(ps:*)`/`Edit(src/**)`,#186 [3047]§七 装机实测):CC 的权限规则 DSL 写法。这些
184
+ * - CC 形规则条目(`Bash(ps:*)`/`Edit(src/**)`,[ref] [ref]§七 装机实测):CC 的权限规则 DSL 写法。这些
177
185
  * 名单比的是**整串工具名**,带括号那串不是任何活工具的名字 ⇒ 永不匹配。指引=按命令名走
178
186
  * `runtime.commandPolicy`,整条 shell 进门走 `MANUAL_MODE_SHELL_GATE=always`。判别式见
179
187
  * {@link findCcRuleFormNames}(它同时是 `allow` 腿的**唯一**判据,见下方例外说明)。
@@ -183,19 +191,19 @@ export declare function applyAutoCompactWindow(m: Model, explicit?: number): "ex
183
191
  * 少一段同样永不匹配。旧判据「含 `__` 且 protocolOf 认不出」放过了这一族(前缀恰好认得出),从另一侧
184
192
  * 漏出去,失守方向与 `figma__x` 完全相同。
185
193
  * - **core 的文法编不出来的串**(名字里带反斜杠、单条 >512 字符、空串):判词取自 core 自己的
186
- * `validatePermissionRules`,见 {@link uncompilableRuleGuidance}。#359①(A-075.5)补齐 ——
194
+ * `validatePermissionRules`,见 {@link uncompilableRuleGuidance}。[ref]①([ref])补齐 ——
187
195
  * 此前只有 `ask` 腿(经 `createPermissionRulePolicy` 的 throw)拒得出这一族,`deny` 静默 no-op。
188
196
  *
189
197
  * 已接受的权衡(与退役表墓碑同一条):部署自有工具真叫 `figma__x` 的极端形会被误拒——boot 期无 roster 可
190
198
  * 豁免,且失败响亮、指引明确,好过静默失守。
191
199
  *
192
- * 🔴 **三条腿的消费者现已全部认 covering**(#450 孪生修,[5246];此前本段记的「分家」已作废):
200
+ * 🔴 **三条腿的消费者现已全部认 covering**([ref] 孪生修,[ref];此前本段记的「分家」已作废):
193
201
  * core 的每一只 name-keyed policy(`createAllowDenyPolicy` / `createPermissionRulePolicy` /
194
202
  * `createApprovalPolicy`)都解 covering 拼法,而 operator 腿的消费者 `createDurableAskPolicy`
195
203
  * (`src/approval.ts`)自 core 5.60.1 的谓词根导出到货后,deny/neverAuto/require 三集合也改成
196
204
  * 「精确 ∪ covering」(同一只 `namespacedRuleNameCovers`)。于是本函数放行的
197
205
  * `<ns>__<server>__*` / `<ns>__<server>__<glob>` 在**每一条**腿上都是**真判**,不再是
198
- * 「放行进 no-op」—— 而那正是 #450 病形(`APPROVAL_DENY=mcp__figma__*` 判 allow)的根。
206
+ * 「放行进 no-op」—— 而那正是 [ref] 病形(`APPROVAL_DENY=mcp__figma__*` 判 allow)的根。
199
207
  *
200
208
  * ⚠️ 仍然拒的那一格,理由**换了**(别再照旧引「approval.ts 还不认」):`<ns>__<peer>` **两段形**
201
209
  * (`mcp__figma`)core 全家解成 covering,本函数判它「缺段」拒。挡它的不再是消费腿的能力,而是
@@ -213,23 +221,23 @@ export declare function findUnmatchableToolNames(names: readonly string[]): Unma
213
221
  /** {@link findUnmatchableToolNames} 的成句形——三条腿的文案同源(只有前缀/出口不同)。 */
214
222
  export declare function formatUnmatchableToolNames(source: string, bad: readonly UnmatchableToolName[]): string;
215
223
  /**
216
- * design/170 件B/C/D —— 三条**部署治理声明**的 env 解析(auth 域的一段,fail-loud 全在这里)。
224
+ * [ref] 件B/C/D —— 三条**部署治理声明**的 env 解析(auth 域的一段,fail-loud 全在这里)。
217
225
  *
218
226
  * 三条的词表真源都在 core(`ComplianceProfile` / `ComplianceCapability` / `LOCKED_KEY_REGISTRY`),本函数
219
227
  * 只负责「env 文本 → 闭集值」这一步,并且**每一步坏值都拒启**:这三根旋钮全在安全/治理轴上,一个静默
220
- * 不生效的档位或一个拼错的锁键,是「以为在管、其实没管」——比没配更贵(#210 A 档 + design/170 §3.4)。
228
+ * 不生效的档位或一个拼错的锁键,是「以为在管、其实没管」——比没配更贵([ref] A 档 + [ref] §3.4)。
221
229
  *
222
230
  * 半配也拒:`COMPLIANCE_ADDITIONAL_DENIES` 没有 profile 可收紧时是一句无处安放的话,静默丢掉它等于
223
231
  * 让 operator 以为多禁了一条(与 `MEMORY_EMBEDDER_*` 的半配拒启同族)。
224
232
  */
225
- /** #270 车2 —— sweep 节律的上界(秒)。`setInterval` 的 delay 是 32 位有符号毫秒(2^31-1);越界会被
233
+ /** [ref] 车2 —— sweep 节律的上界(秒)。`setInterval` 的 delay 是 32 位有符号毫秒(2^31-1);越界会被
226
234
  * Node **重置成 1ms**,理由与拒启判据见调用点。导出供判据与文档单点引用。 */
227
235
  export declare const RETENTION_SWEEP_INTERVAL_MAX_SEC: number;
228
236
  /** 域:limits+http(限额与 HTTP 面)—— 端口、附件/工作区体积与 TTL、成本与速率天花板、排空窗、回收周期。 */
229
237
  /**
230
- * #322:limitsHttp 组里**有下限**的三个数值旋钮的下限值 —— env 腿(夹取+点名)与 center 热腿(整批拒)
238
+ * [ref]:limitsHttp 组里**有下限**的三个数值旋钮的下限值 —— env 腿(夹取+点名)与 center 热腿(整批拒)
231
239
  * 共用同一组阈值。判据同源、**处置刻意不同**:env 值是既有部署的存量,夹取不打断服务;center 发布是一次
232
- * 显式且可重发的动作,拒绝才是有意义的反馈(#123 响亮拒)。
240
+ * 显式且可重发的动作,拒绝才是有意义的反馈([ref] 响亮拒)。
233
241
  */
234
242
  export declare const LIMITS_HTTP_FLOORS: {
235
243
  readonly attachmentMaxBytes: 1024;
@@ -249,7 +257,7 @@ export declare const CONFIG_GROUP_KEYS: {
249
257
  * `loadConfig` 是主调用点;测试夹具(test/helpers/make-config.ts)构造 `ServiceConfigFlat` 后同样过它。 */
250
258
  export declare function attachConfigGroups(flat: ServiceConfigFlat): ServiceConfig;
251
259
  export declare function loadConfig(): ServiceConfig;
252
- /** 有效监听绑址([1934])。**显式 `BIND_HOST`/`HOST` 恒生效**(operator 保留在任何形下明示暴露的
260
+ /** 有效监听绑址([ref])。**显式 `BIND_HOST`/`HOST` 恒生效**(operator 保留在任何形下明示暴露的
253
261
  * 权利);未显式时:**无鉴权写面 ⇒ 127.0.0.1**,其余 ⇒ undefined(Node 默认全接口,既有部署零影响)。
254
262
  *
255
263
  * 为什么缺省要自己收窄、而不是只加旋钮:桌面形的安全结论原本写着「safe ONLY because HOST is
package/dist/config.js CHANGED
@@ -38,18 +38,38 @@ export function parseUsageWindows(raw) {
38
38
  parsed = JSON.parse(v);
39
39
  }
40
40
  catch (e) {
41
- throw new Error(`env USAGE_WINDOWS is not valid JSON: ${String(e)} — expected e.g. [{"windowMs":18000000,"maxTokens":5000000,"anchor":"first-use"}]`);
41
+ throw new Error(`env USAGE_WINDOWS is not valid JSON: ${String(e)} — expected e.g. [{"windowMs":18000000,"maxTokens":5000000,"anchor":"first-use"}] or [{"windowMs":604800000,"maxCostUsd":25,"anchor":"rolling"}]`);
42
42
  }
43
43
  if (!Array.isArray(parsed) || parsed.length === 0) {
44
- throw new Error(`env USAGE_WINDOWS must be a NON-EMPTY JSON array of {windowMs,maxTokens,anchor} (an empty array is a governance no-op nobody chose — unset the env to turn windows off)`);
44
+ throw new Error(`env USAGE_WINDOWS must be a NON-EMPTY JSON array of {windowMs, maxTokens?, maxCostUsd?, anchor} (an empty array is a governance no-op nobody chose — unset the env to turn windows off)`);
45
45
  }
46
46
  const out = parsed.map((w, i) => {
47
47
  const o = w;
48
48
  const posInt = (n) => typeof n === "number" && Number.isInteger(n) && n > 0;
49
- if (typeof w !== "object" || w === null || !posInt(o.windowMs) || !posInt(o.maxTokens) || (o.anchor !== "first-use" && o.anchor !== "rolling")) {
50
- throw new Error(`env USAGE_WINDOWS[${i}] is invalid: expected {windowMs: positive int ms, maxTokens: positive int, anchor: "first-use"|"rolling"} (got ${JSON.stringify(w)})`);
49
+ const posUsd = (n) => typeof n === "number" && Number.isFinite(n) && n > 0 && Number.isFinite(n * 1e6);
50
+ if (typeof w !== "object" || w === null || !posInt(o.windowMs) || (o.anchor !== "first-use" && o.anchor !== "rolling")) {
51
+ throw new Error(`env USAGE_WINDOWS[${i}] is invalid: expected {windowMs: positive int ms, maxTokens?: positive int, maxCostUsd?: positive USD, anchor: "first-use"|"rolling"} (got ${JSON.stringify(w)})`);
51
52
  }
52
- return Object.freeze({ windowMs: o.windowMs, maxTokens: o.maxTokens, anchor: o.anchor });
53
+ for (const k of Object.keys(w)) {
54
+ if (k !== "windowMs" && k !== "maxTokens" && k !== "maxCostUsd" && k !== "anchor") {
55
+ throw new Error(`env USAGE_WINDOWS[${i}] is invalid: unknown key \`${k}\` — the window shape is the CLOSED set {windowMs, maxTokens?, maxCostUsd?, anchor}; a misspelled ceiling (e.g. \`maxCostUSD\`) must not silently leave the deployment ungoverned (got ${JSON.stringify(w)})`);
56
+ }
57
+ }
58
+ if (o.maxTokens === undefined && o.maxCostUsd === undefined) {
59
+ throw new Error(`env USAGE_WINDOWS[${i}] is invalid: at least one ceiling is required — \`maxTokens\` (tokens) and/or \`maxCostUsd\` (absolute USD); a window with neither admits nothing it can govern (got ${JSON.stringify(w)})`);
60
+ }
61
+ if (o.maxTokens !== undefined && !posInt(o.maxTokens)) {
62
+ throw new Error(`env USAGE_WINDOWS[${i}] is invalid: \`maxTokens\` (when present) must be a positive integer (got ${JSON.stringify(w)})`);
63
+ }
64
+ if (o.maxCostUsd !== undefined && !posUsd(o.maxCostUsd)) {
65
+ throw new Error(`env USAGE_WINDOWS[${i}] is invalid: \`maxCostUsd\` (when present) must be a positive finite USD amount that stays finite in micro-USD (× 1e6) (got ${JSON.stringify(w)})`);
66
+ }
67
+ return Object.freeze({
68
+ windowMs: o.windowMs,
69
+ ...(o.maxTokens !== undefined ? { maxTokens: o.maxTokens } : {}),
70
+ ...(o.maxCostUsd !== undefined ? { maxCostUsd: o.maxCostUsd } : {}),
71
+ anchor: o.anchor,
72
+ });
53
73
  });
54
74
  return Object.freeze(out);
55
75
  }
@@ -252,6 +272,26 @@ function optNumEnvStrict(name) {
252
272
  return undefined;
253
273
  return parseNumOrFail(name, raw);
254
274
  }
275
+ function parseDevicePreAuthPerRemoteEnv() {
276
+ const raw = process.env.DEVICE_MAX_PREAUTH_PER_REMOTE;
277
+ if (raw === undefined || raw === "")
278
+ return undefined;
279
+ if (raw === "off")
280
+ return "off";
281
+ if (!/^[1-9]\d*$/.test(raw)) {
282
+ throw new Error(`env DEVICE_MAX_PREAUTH_PER_REMOTE=${JSON.stringify(raw)} must be a positive integer or the literal "off" — ` +
283
+ `a malformed cap would otherwise run as the default (8) while the operator believes their value is in force ` +
284
+ `(#210: deployment knobs never fall back silently). "0" is not a valid cap (it would refuse every device handshake); ` +
285
+ `use "off" to disable the per-remote layer explicitly (reverse-proxy / NAT deployments collapse source IPs, A-075.52).`);
286
+ }
287
+ const n = Number(raw);
288
+ if (!Number.isSafeInteger(n)) {
289
+ throw new Error(`env DEVICE_MAX_PREAUTH_PER_REMOTE=${raw.length > 24 ? `${raw.slice(0, 24)}…(${raw.length} digits)` : raw} overflows the safe-integer range — ` +
290
+ `Number() would read it as ${n}, and a cap of Infinity silently disables the per-remote layer without taking the explicit "off" arm. ` +
291
+ `Use a value within Number.MAX_SAFE_INTEGER, or the literal "off".`);
292
+ }
293
+ return n;
294
+ }
255
295
  function parseFileHistoryRetention() {
256
296
  const raw = process.env.FILE_HISTORY_RETENTION_KEEP;
257
297
  if (raw === undefined || raw === "")
@@ -1283,6 +1323,7 @@ function parseAuthDomain(ctx) {
1283
1323
  autonomy: parseAutonomy(process.env.AUTONOMY),
1284
1324
  ...parseGovernanceDeclarations(),
1285
1325
  operatorPrincipals: csv("OPERATOR_PRINCIPALS"),
1326
+ configCatalogEnabled: boolEnv("CONFIG_CATALOG_ENABLED", true),
1286
1327
  principalJwtPubkeys,
1287
1328
  principalJwtIss,
1288
1329
  principalJwtAud,
@@ -1434,6 +1475,7 @@ function parseOrchestrationDomain(ctx) {
1434
1475
  ...((n) => (n !== undefined ? { reconnectGraceMs: n } : {}))(optNumEnvStrict("DEVICE_RECONNECT_GRACE_MS")),
1435
1476
  ...((n) => (n !== undefined ? { execTimeoutMs: n } : {}))(optNumEnvStrict("DEVICE_EXEC_TIMEOUT_MS")),
1436
1477
  ...((n) => (n !== undefined ? { maxInflightPerDevice: n } : {}))(optNumEnvStrict("DEVICE_MAX_INFLIGHT_PER_DEVICE")),
1478
+ ...((n) => (n !== undefined ? { maxPreAuthPerRemote: n } : {}))(parseDevicePreAuthPerRemoteEnv()),
1437
1479
  ...(process.env.DEVICE_SUPERSEDE ? { supersede: enumEnv("DEVICE_SUPERSEDE", "stale_only", ["stale_only", "deny"]) } : {}),
1438
1480
  }
1439
1481
  :
@@ -1725,7 +1767,7 @@ const MEMORY_GROUP_KEYS = [
1725
1767
  const AUTH_GROUP_KEYS = [
1726
1768
  "authToken", "authTokens", "allowUnauthedWrites", "corsOrigins", "principalHeader", "requirePrincipal", "autonomy",
1727
1769
  "commandPolicy", "compliancePosture", "lockedConfigKeys", "retentionPolicy", "retentionSweep",
1728
- "operatorPrincipals", "principalJwtPubkeys", "principalJwtIss", "principalJwtAud",
1770
+ "operatorPrincipals", "configCatalogEnabled", "principalJwtPubkeys", "principalJwtIss", "principalJwtAud",
1729
1771
  "principalJwtMaxTtlSec", "bindHost", "bindHostSource",
1730
1772
  ];
1731
1773
  const ORCHESTRATION_GROUP_KEYS = [
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * When a task fails with `errorCode === "output.degenerate"` (core 1.59), core hands back
5
5
  * `salvagedOutput` = the degenerate turn's text — **already tail-TRIMMED at the brain stream layer**.
6
- * 🔴 A-057.52 correction (this note used to claim "the **whole** text, good head + looped garbage tail";
6
+ * 🔴 [ref] correction (this note used to claim "the **whole** text, good head + looped garbage tail";
7
7
  * that was true of core 1.59 and false of every engine that ships `trimDegenerateTail` — verified against
8
8
  * the installed dist, not against JSDoc): on the main path `assemble-result` fills the seat from the same
9
9
  * final message the brain already trimmed, so what arrives here is `head + exactly ONE copy of the
@@ -27,7 +27,7 @@ export interface PathAdjudication {
27
27
  /** 相对路径基准(core 的 `rootPath`)。缺席 ⇒ 相对形在真身那层判不了,补词法臂(见下)。 */
28
28
  readonly cwd?: string;
29
29
  }
30
- /** #152([2703] 案二):durable 部署上的 AskUserQuestion 门的活体面探针(QuestionCoordinator 的切面)。 */
30
+ /** [ref]([ref] 案二):durable 部署上的 AskUserQuestion 门的活体面探针(QuestionCoordinator 的切面)。 */
31
31
  export interface LiveQuestionFace {
32
32
  hasLiveContext(): boolean;
33
33
  }
@@ -41,11 +41,11 @@ export interface DurableApprovalSeat {
41
41
  readonly onExempted?: DurableAskOptions["onExempted"];
42
42
  }
43
43
  /**
44
- * #152([2703] 案二):durable 部署上的 AskUserQuestion 门。活体面(QuestionCoordinator)缺席 ⇒ 原形
44
+ * [ref]([ref] 案二):durable 部署上的 AskUserQuestion 门。活体面(QuestionCoordinator)缺席 ⇒ 原形
45
45
  * `createDurableQuestionPolicy()`(恒 ask ⇒ 恒 durable park)。在场 ⇒ **判决时**按活流上下文分腿:
46
46
  * 活流腿(bg/SSE,coordinator.runWithContext 包裹且投递面此刻可达,ALS 判)allow——工具执行落到
47
47
  * RunnerDeps.onQuestion 的 coordinator,问正在 tail 流的活人;无活流腿(sync /v1/tasks、verify/cascade、
48
- * durable resume 驱动、断连后的 detach 腿)ask——durable park 原语义逐字保留(#166 后无活流腿放行执行
48
+ * durable resume 驱动、断连后的 detach 腿)ask——durable park 原语义逐字保留([ref] 后无活流腿放行执行
49
49
  * 也不会产出空答:coordinator 无 ALS ctx ⇒ 冻结 `{kind:"unavailable"}`(src/question.ts),永不悬挂;
50
50
  * park 仍是把问题送到人面前的唯一那条腿,正当性不变、只是反事实前提换了)。
51
51
  * 工具名字面量与 server.ts 的 pre-CAS 守卫同源("AskUserQuestion",core 未根导出常量)。
@@ -59,7 +59,7 @@ export declare function createDurableQuestionGate(live: LiveQuestionFace | undef
59
59
  /**
60
60
  * 沙箱 lane 上**相对形**写目标的守卫补层用 env(codex 交叉复审 round1 finding 1,红先复现)。
61
61
  *
62
- * 缺口:沙箱 lane 的守卫策略拿不到 `rootPath`(沙箱 cwd 不是 server 能猜的,#165 裁定 1),而
62
+ * 缺口:沙箱 lane 的守卫策略拿不到 `rootPath`(沙箱 cwd 不是 server 能猜的,[ref] 裁定 1),而
63
63
  * `DeferredSandboxPathEnv.absolutePath` 对相对形一律报错。core 的 `canonicalizeTarget` 在
64
64
  * **absolutePath 失败**这一支不置 `unresolvedSymlink`,于是守卫策略走的是
65
65
  * 「判不了就弃权」的 `allow`(dist 亲读)。写门在场时这条腿被门的 `ask` 兜住;而
@@ -72,10 +72,10 @@ export declare function createDurableQuestionGate(live: LiveQuestionFace | undef
72
72
  *
73
73
  * 三条不可动的边界:
74
74
  * · **绝对形一律弃权**(absolutePath 报错 ⇒ canon 失败且非 unresolvedSymlink ⇒ core 判 allow):
75
- * 绝对形归真身裁决那一层,#165「真身胜过名字」的裁定(域内良性软链名叫 `.ssh` 只 ask)不受影响。
75
+ * 绝对形归真身裁决那一层,[ref]「真身胜过名字」的裁定(域内良性软链名叫 `.ssh` 只 ask)不受影响。
76
76
  * · **只会 deny,不会放行**:相对形自身拼写里出现的段,解析成绝对路径后仍在,所以词法命中即真命中;
77
77
  * 反过来一条名叫 `.env` 而真身良性的相对软链会被误 deny —— 方向是 fail-closed,与守卫集语义同向。
78
- * · **覆盖面(2026-08-08 按 core 5.19.0 #108 校正;旧文见下方「历史」段)**:本层只在
78
+ * · **覆盖面(2026-08-08 按 core 5.19.0 [ref] 校正;旧文见下方「历史」段)**:本层只在
79
79
  * `ToolCallRequest.cwd` **缺席**那一形上说话。core 5.19.0 起每条路径解析型守卫按 `req.cwd ?? rootPath`
80
80
  * 解析写目标(dist `core/sensitive-path-policy.js`),而 `canonicalizeTarget` 拿到 baseCwd 后会先把
81
81
  * 相对形**拼成绝对形**再交给 env(dist `tools/fs/safety.js` 的 `baseCwd && !isAbsolutePathForm(...)`
@@ -89,12 +89,12 @@ export declare function createDurableQuestionGate(live: LiveQuestionFace | undef
89
89
  *
90
90
  * 📜 **历史(留档,别当现状读)**:2026-08-08 之前本层的覆盖面到「cwd 里的守卫段看不见」为止——
91
91
  * 本层把相对形挂在 `/` 上,而工具挂在 engine 活 cwd 上,`cd .git` 后 `Write("config")` 真写
92
- * `<root>/.git/config` 而本层只看得到 `/config` ⇒ 弃权。design/181 刀3 的口径更正查明这条残余面
92
+ * `<root>/.git/config` 而本层只看得到 `/config` ⇒ 弃权。[ref] 刀3 的口径更正查明这条残余面
93
93
  * **不是沙箱 lane 局部的**:host 腿虽供了 `rootPath`,那也是装配期的静态值,一样追不上被 Bash `cd`
94
94
  * 就地改写的 `cwdRef.current`(run-local 端到端真复现:`cd .git/hooks` 后 `Write("pre-commit")` 真落盘)。
95
95
  * 当年判定属主是引擎那条缝(不是任何一条消费腿——在消费腿里自己拿静态 cwd 追 `cd`,是拿会漂的复制品
96
96
  * 追引擎的真值,本文件反复点名的病),并把两条钉写成「引擎缝落地后一起翻面」。**该缝即 core backlog
97
- * #108,已在 5.19.0 到货**,两条钉按上述翻面完毕。另一条备选收口(守卫集开启即把沙箱 lane 相对写
97
+ * [ref],已在 5.19.0 到货**,两条钉按上述翻面完毕。另一条备选收口(守卫集开启即把沙箱 lane 相对写
98
98
  * 一律 deny,有真受损方且无对应旋钮)因此作废,无需部署方拍板。
99
99
  */
100
100
  export declare class RelativeTargetLexicalEnv extends StubExecutionEnv {
@@ -105,7 +105,7 @@ export declare class RelativeTargetLexicalEnv extends StubExecutionEnv {
105
105
  exists(_path: string, _abortSignal?: AbortSignal): Promise<Result<boolean, FileError>>;
106
106
  }
107
107
  /**
108
- * boot 期的守卫集**可编译性**门(#177 收口①,随 design/181 件一搬进本口 —— 三条消费腿同得)。
108
+ * boot 期的守卫集**可编译性**门([ref] 收口①,随 [ref] 件一搬进本口 —— 三条消费腿同得)。
109
109
  *
110
110
  * 守卫集的编译发生在**每个请求**上。core 的 `compilePatterns` 对「一个路径段都没有」的模式(`"/"`、
111
111
  * `"//"`)THROW,那条 throw 会变成**每一个任务一条 500**,且运维从错误里看不出是自己的 env 写错了。
@@ -126,7 +126,7 @@ export interface GateSeatView {
126
126
  readonly singleUserAutoAcceptBaseline: boolean;
127
127
  }
128
128
  /**
129
- * UNGATED 信号的**补偿**(design/181 件一收编 / 件三三腿同得)。
129
+ * UNGATED 信号的**补偿**([ref] 件一收编 / 件三三腿同得)。
130
130
  *
131
131
  * 审批基线铺开之后 core 的 `hasEffectAwareGate` 恒真,于是它那条 "write-capable hand tools are present
132
132
  * but UNGATED" 的 onError 不再触发(判据是 `policyLayers.length > 0`,prepare-task dist 亲读)。那条信号
@@ -136,12 +136,12 @@ export interface GateSeatView {
136
136
  * 判据(与信号消失的条件逐字互补):守卫集在场 ∧ 两条产**真**门的腿都不在场(durable 门关 ∧ 单用户
137
137
  * auto-accept 基线不适用)。三个量都是部署常量 ⇒ 消费腿在 boot 期说一次,不是每任务一次。
138
138
  *
139
- * ⚠️ 单一属主(design/181 件三):HTTP 腿与 run-local 腿共用本判据与文案。两处各写一份 = 一处改了另一处
139
+ * ⚠️ 单一属主([ref] 件三):HTTP 腿与 run-local 腿共用本判据与文案。两处各写一份 = 一处改了另一处
140
140
  * 没改,而两份都长得像对的 —— 那正是本文件存在的理由。
141
141
  */
142
142
  export declare function buildOnlySensitiveBaselineWarning(config: Pick<DeploymentGovernanceConfigView, "sensitiveWritePatterns">, seat: GateSeatView): OperatorWarning | undefined;
143
143
  /**
144
- * `applyRuntimeGovernance` 的 governance 实参预铸(design/181 件一)。
144
+ * `applyRuntimeGovernance` 的 governance 实参预铸([ref] 件一)。
145
145
  *
146
146
  * 键存在性 profile 逐字保持消费腿原样:`autonomy`/`commandPolicy` 恒在场(值可为 `undefined`),
147
147
  * `manualModeShellGate`/`sensitivePathPolicy` 按在场性条件展开 —— `applyRuntimeGovernance` 的
@@ -149,7 +149,7 @@ export declare function buildOnlySensitiveBaselineWarning(config: Pick<Deploymen
149
149
  */
150
150
  export declare function createDeploymentGovernanceInputs(config: DeploymentGovernanceConfigView, pathAdjudication: PathAdjudication): DeploymentGovernanceInputs;
151
151
  /**
152
- * 审批基线 —— `applyRuntimeGovernance` 那个 base 的 `toolPolicy` 座(design/181 件一)。**恒非
152
+ * 审批基线 —— `applyRuntimeGovernance` 那个 base 的 `toolPolicy` 座([ref] 件一)。**恒非
153
153
  * `undefined`**:治理层是 tighten-only 的叠加层,没有基线可叠时它自己也产不出「门在场」这件事。
154
154
  *
155
155
  * 两形:
@@ -29,7 +29,7 @@ export declare const DEVICE_ERROR_CODES: {
29
29
  /** 反枚举 404:设备不存在 **与** 设备不是你的,逐字节同形。 */
30
30
  readonly NOT_FOUND: "not_found.device";
31
31
  };
32
- /** {@link DEVICE_ERROR_CODES} 的值联合 —— 闭集(未知码 = 编译错误,#157 词表纪律)。 */
32
+ /** {@link DEVICE_ERROR_CODES} 的值联合 —— 闭集(未知码 = 编译错误,[ref] 词表纪律)。 */
33
33
  export type DeviceErrorCode = (typeof DEVICE_ERROR_CODES)[keyof typeof DEVICE_ERROR_CODES];
34
34
  /**
35
35
  * 限流拒绝复用**既有**的通用码(`docs/ASSISTANT-WIRE-CONTRACT.md` 已收录,429)。
@@ -151,7 +151,7 @@ export declare function assertEnrollTokenHashShape(tokenHash: string): void;
151
151
  /**
152
152
  * 闭集列的**读侧**解码 —— 三个 `parse*` 是这些词表的唯一解码点(SQL 店读回的字符串必须经此)。
153
153
  *
154
- * 🔴 认不出的值 = **抛**,不是静默 cast(#157:安全轴的未知词是 fail-loud 而不是 fail-open)。
154
+ * 🔴 认不出的值 = **抛**,不是静默 cast([ref]:安全轴的未知词是 fail-loud 而不是 fail-open)。
155
155
  * 一行 `status='disabled'` 的设备如果被 `as DeviceStatus` 静默放行,准入链的 `status === "revoked"`
156
156
  * 判据就对它返回「不是吊销的」⇒ 一台被管理面停用的设备照常领活。写侧不可能产出这些值(入参是
157
157
  * TS 闭集),所以出现即「有人跳过本店直接写库」或「跨版本降级读新词」,两者都必须响亮。
@@ -31,7 +31,7 @@
31
31
  * ⚠️ 将来出现**第二个** upgrade 消费方时,这里要改成一张路由表 —— 两个 `server.on("upgrade")`
32
32
  * 监听器会**同时**收到每一次 upgrade,各自「不认就 404」会互相把对方的连接打死。
33
33
  *
34
- * ── 安全轴姿势(#157)────────────────────────────────────────────────────────────────────────────
34
+ * ── 安全轴姿势([ref])────────────────────────────────────────────────────────────────────────────
35
35
  * 未知帧型 / 坏形帧 / 世代不符 / pending 外 instructionId = **响亮拒 + 审计行**,没有一处空 catch,
36
36
  * 没有一处「认不出就当默认值」。审计写失败本身也是响亮的(logger.error + 计数),不是静默吞。
37
37
  */
@@ -75,7 +75,7 @@ export type DeviceDispatchInput = {
75
75
  *
76
76
  * 用途在 device lane 上是**保护型写原语**(`writeFileGuarded`/`writeFileExclusive`):它们的缺席被
77
77
  * core 读成「后端没有这个原语」并降级成非原子写,所以「铸的时候没有、下发的时候有了」= 一次静默的
78
- * 保护降级(#157)。本座本身与语义无关,只做集合判断。
78
+ * 保护降级([ref])。本座本身与语义无关,只做集合判断。
79
79
  */
80
80
  refuseIfDeclared?: readonly DeviceInstructionKind[];
81
81
  /**
@@ -151,8 +151,10 @@ export interface DeviceWsHubOptions {
151
151
  chunkBufferMaxBytes?: number;
152
152
  /** codex R1-F3:本副本**未鉴权**连接的并发帽(超额在 upgrade 阶段就 503 拒)。 */
153
153
  maxPreAuthConnections?: number;
154
- /** codex R1-F3:单来源地址的未鉴权连接并发帽。 */
155
- maxPreAuthConnectionsPerRemote?: number;
154
+ /** codex R1-F3:单来源地址的未鉴权连接并发帽。[ref]([ref]):字面 `off` = 显式停用该层——
155
+ * 帽键是裸 remoteAddress,XFF 反代 / 公司 NAT 部署形把全员折叠成单键,这层从公平层退化成
156
+ * 「全员共享一份预算」;停层后全局帽(`maxPreAuthConnections`)照常兜底。 */
157
+ maxPreAuthConnectionsPerRemote?: number | "off";
156
158
  }
157
159
  export interface DeviceWsHub {
158
160
  /** 把 `GET /v1/device/ws` 的 upgrade 处理器挂到裸 `http.Server` 上。 */
@@ -735,9 +735,15 @@ export function createDeviceWsHub(options) {
735
735
  if (draining || closed)
736
736
  return refuseUpgrade(socket, 503);
737
737
  const remoteKey = req.socket.remoteAddress ?? "unknown";
738
- if (preAuthCount >= maxPreAuthConnections || (preAuthByRemote.get(remoteKey) ?? 0) >= maxPreAuthConnectionsPerRemote) {
739
- metrics?.inc("device_preauth_refused_total");
740
- logger?.warn("device_preauth_cap_hit", { remoteKey, preAuthCount, cap: maxPreAuthConnections });
738
+ const perRemoteCount = preAuthByRemote.get(remoteKey) ?? 0;
739
+ const globalHit = preAuthCount >= maxPreAuthConnections;
740
+ const perRemoteHit = maxPreAuthConnectionsPerRemote !== "off" && perRemoteCount >= maxPreAuthConnectionsPerRemote;
741
+ if (globalHit || perRemoteHit) {
742
+ const arm = globalHit ? (perRemoteHit ? "both" : "global") : "per_remote";
743
+ metrics?.inc("device_preauth_refused_total", { arm });
744
+ logger?.warn("device_preauth_cap_hit", {
745
+ remoteKey, arm, preAuthCount, cap: maxPreAuthConnections, perRemoteCount, perRemoteCap: maxPreAuthConnectionsPerRemote,
746
+ });
741
747
  return refuseUpgrade(socket, 503);
742
748
  }
743
749
  preAuthCount += 1;
@@ -3,7 +3,7 @@ import type { ExecutionErrorCode, FileErrorCode } from "@sema-agent/core";
3
3
  export declare const DEVICE_WS_PATH = "/v1/device/ws";
4
4
  /** 本 server 铸/认的协议版本。加帧/加字段 = additive 不升版;改语义 = 升版(§5.6)。 */
5
5
  export declare const DEVICE_PROTOCOL_VERSION = 1;
6
- /** 低于此版本 ⇒ `helloReject: protocol_version_unsupported`(响亮拒,不静默降级,#157)。 */
6
+ /** 低于此版本 ⇒ `helloReject: protocol_version_unsupported`(响亮拒,不静默降级,[ref])。 */
7
7
  export declare const DEVICE_MIN_PROTOCOL_VERSION = 1;
8
8
  /** 签名的 domain tag —— 换域即换 tag,防止别处的 Ed25519 签名被拿来当握手用。 */
9
9
  export declare const DEVICE_HELLO_DOMAIN_TAG = "sema.device.hello.v1";
@@ -373,7 +373,7 @@ export declare function formatGeneration(n: number): string;
373
373
  * 设备帧的唯一解析入口。
374
374
  *
375
375
  * 🔴 顺序是 帽 → JSON → 对象 → 帧型 → 形:每一步都有自己的拒因词,审计行才能回答「它到底哪儿坏了」。
376
- * 没有任何一步会「尽量修一下再放行」——安全轴上的坏形帧只有响亮拒一条路(#157)。
376
+ * 没有任何一步会「尽量修一下再放行」——安全轴上的坏形帧只有响亮拒一条路([ref])。
377
377
  */
378
378
  export declare function parseDeviceFrameText(text: string, opts?: {
379
379
  maxBytes?: number;
@@ -396,7 +396,7 @@ export declare function buildHelloSignaturePayload(input: {
396
396
  /**
397
397
  * 验签判决。`reason` **只进日志**(wire 上永远是同一个 `auth_failed` —— 反枚举),但它必须存在:
398
398
  * 一个「公钥导入失败」和一个「签名对不上」在运维上是两回事,把它们一起折成 `false` 就等于把
399
- * 「这台设备的公钥列存坏了」这条事实永久删掉(#191 门② SHAPE C:错误要**当数据交出**,不是吞掉)。
399
+ * 「这台设备的公钥列存坏了」这条事实永久删掉([ref] 门② SHAPE C:错误要**当数据交出**,不是吞掉)。
400
400
  */
401
401
  export type HelloSignatureVerdict = {
402
402
  ok: true;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/158 R12 收编叶子 — the sha256 content-address SHAPE constants, single-sourced. A neutral leaf (no
2
+ * [ref] R12 收编叶子 — the sha256 content-address SHAPE constants, single-sourced. A neutral leaf (no
3
3
  * imports of its own) so both `security.ts`-adjacent modules and prompt/image/session-sync consumers can
4
4
  * depend on it without a layering edge. Six call sites across the tree each ran their OWN literal copy of one
5
5
  * of these two regexes (a bare-hex form and a scheme-qualified form) — same shape, independently typed out.
@@ -15,7 +15,7 @@ export interface ElicitationFrame {
15
15
  mode?: "form";
16
16
  /** "elicitation_complete" only: how it resolved. */
17
17
  action?: McpElicitResponse["action"];
18
- /** Server-signed emit timestamp (additive, [2805]§五→[2806]). These side-frames are SERVER-minted — they have
18
+ /** Server-signed emit timestamp (additive, [ref]§五→[ref]). These side-frames are SERVER-minted — they have
19
19
  * no core-stream anchor, so no `eventId` (absence is honest, not an omission); this is the frame's own time
20
20
  * coordinate instead, same posture as the stream-approval frames' `serverNowMs`. */
21
21
  serverNowMs?: number;
@@ -4,16 +4,16 @@ export interface SandboxEnvFacts {
4
4
  capabilities?: string[];
5
5
  pkgSource?: string;
6
6
  egress?: "none" | "allowlist" | "full";
7
- /** [820]③ scratchpad first wave: core `TaskSpec.envFacts.scratchpadDir` (field + prompt chain —
7
+ /** [ref]③ scratchpad first wave: core `TaskSpec.envFacts.scratchpadDir` (field + prompt chain —
8
8
  * buildScratchpadSection — shipped in core 1.257.3; only this server half was missing). Core renders the
9
9
  * "# Scratchpad Directory" block steering temp files away from /tmp AND the user's project. Core's prompt
10
10
  * wording promises: session-specific, isolated from the user's project, "can generally be used without
11
11
  * permission prompts" — that last clause is exactly the exemption domain createFsWriteGatePolicy.exemptDirs
12
- * will honor ([819]③/[820]①), so the path is produced by the single-source {@link scratchpadDirFor} and the
12
+ * will honor ([ref]③/[ref]①), so the path is produced by the single-source {@link scratchpadDirFor} and the
13
13
  * 1.290 wiring must reference the SAME function for exemptDirs. */
14
14
  scratchpadDir?: string;
15
- /** [1467]②(core 1.360 B 半场)durable resume 铸句真值——server 按**车道能力面**填(部署静态事实,
16
- * 非车道名判——[1452]③ 诚实裁:缺席字段=core 零句,绝不写死车道行为):
15
+ /** [ref]②(core 1.360 B 半场)durable resume 铸句真值——server 按**车道能力面**填(部署静态事实,
16
+ * 非车道名判——[ref]③ 诚实裁:缺席字段=core 零句,绝不写死车道行为):
17
17
  * - e2b:VM snapshot suspend/resume ⇒ processes+scratch 双 preserved。
18
18
  * - k8s(s3Snapshot):resume=fresh pod+workspace untar ⇒ processes+scratch 双 lost(note 讲清
19
19
  * workspace 文件已从快照恢复——「scratch lost」≠「工作丢了」)。
@@ -61,7 +61,7 @@ export declare function scratchpadSessionSegment(sessionId: string): string;
61
61
  /** THE scratchpad path convention: `<localDataRoot>/scratchpad/<sessionSegment>`. Session-scoped (core's
62
62
  * prompt says "session-specific" — every task on the session shares one dir, which is the useful semantics:
63
63
  * intermediate artifacts survive across turns/resume legs). Exported as the single source both the envFacts
64
- * composer (below) and the future createFsWriteGatePolicy `exemptDirs` wiring ([820]①, 1.290) must use. */
64
+ * composer (below) and the future createFsWriteGatePolicy `exemptDirs` wiring ([ref]①, 1.290) must use. */
65
65
  export declare function scratchpadDirFor(localDataRoot: string, sessionId: string): string;
66
66
  /** Resolve + CREATE the session scratchpad dir (mkdir -p, idempotent). Returns the path, or undefined when
67
67
  * creation fails (honest-facts posture: never advertise a directory that does not exist — same class as
@@ -69,7 +69,7 @@ export declare function scratchpadDirFor(localDataRoot: string, sessionId: strin
69
69
  * {@link purgeScratchpadDir}(session delete)+ {@link sweepStaleScratchpads}(mtime 周期扫),keyed by the
70
70
  * same scratchpadDirFor convention;接线(E21 DELETE purge + 周期 sweep)在 main.ts 侧(D 组)。 */
71
71
  export declare function ensureScratchpadDir(localDataRoot: string, sessionId: string): Promise<string | undefined>;
72
- /** G3([816] 壳侧承诺③/[820]③,[1840]§四接单):**壳供** scratchpad 路径的验收门。
72
+ /** G3([ref] 壳侧承诺③/[ref]③,[ref]§四接单):**壳供** scratchpad 路径的验收门。
73
73
  *
74
74
  * 壳(cli)vendored getScratchpadDir 算出 per-session scratchpad 路径随 `TaskRequest.scratchpadDir` 发来;
75
75
  * 接受后它**优先于** server 自算(ensureScratchpadDir),喂 main.ts 的同一单点(envFacts 事实 +
@@ -81,7 +81,7 @@ export declare function ensureScratchpadDir(localDataRoot: string, sessionId: st
81
81
  * - 绝对路径 + ≤{@link MAX_PATH}(core 渲染上限同源,超限=core 只能给模型假路径)+ canonical
82
82
  * 深度 ≥3(裸 /、/tmp、/home 一整块系统目录不能当豁免域;穿越形按 resolve 归一后判);
83
83
  * - mkdir -p 确保存在(gate 的 canonicalize 与 core 根围栏都要真目录)。
84
- * 敏感路径的最后一道**不在**写门折叠里(#177 起搬家):守卫集 `SENSITIVE_WRITE_PATTERNS` 由
84
+ * 敏感路径的最后一道**不在**写门折叠里([ref] 起搬家):守卫集 `SENSITIVE_WRITE_PATTERNS` 由
85
85
  * governance 拍(boot/resolve-spec.ts → applyRuntimeGovernance)无条件铸成 DENY 基线,经 tightenTaskSpec
86
86
  * 与写门 deny-wins 折叠 —— 结论不变(deny 恒赢,本函数放出的 exemptDirs 越不过它),但施加点已换。 */
87
87
  export declare function acceptShellScratchpadDir(raw: unknown, opts: {
@@ -8,7 +8,7 @@
8
8
  * `isRemoteScratchpadLane` 查一个 `Set`、`isSandboxPathAdjudicationLane` 取 `!== "host"` 的否定、
9
9
  * `sandboxSendLaneEnabled` 是一串 if。于是「lane 词表加一个词」的病形不是编译错,是**每一处的默认
10
10
  * 答案静默错**:新词不在 Set 里 ⇒ 静默 false;不等于 `"host"` ⇒ 静默 true。没有一处会报,每一处都
11
- * 给出一个**没有人表过态**的答案(DISEASE-SHAPES V1/V2;#157 执行车道轴的同族病)。
11
+ * 给出一个**没有人表过态**的答案(DISEASE-SHAPES V1/V2;[ref] 执行车道轴的同族病)。
12
12
  *
13
13
  * ## 本模块 = 那张表的单源(三件)
14
14
  *
@@ -33,7 +33,7 @@
33
33
  * 车道语义绑死(host 的单用户前提),所以进了 {@link LaneCapability} 的第三个词而不是靠调用方记住。
34
34
  *
35
35
  * 依赖纪律:本文件是**叶**(只 type-import config-types),不引 config.ts —— config.ts 反过来引它取
36
- * {@link RemoteExecProvider}(#157 必需 env 表按同一联合键控)。
36
+ * {@link RemoteExecProvider}([ref] 必需 env 表按同一联合键控)。
37
37
  */
38
38
  import type { ServiceConfigFlat } from "./config-types.js";
39
39
  /** 一位能力的三态。`single-user-only` = 车道支持,但只在单用户部署(`requirePrincipal !== true`)开 ——
@@ -74,7 +74,7 @@ export interface ExecutionLaneCaps {
74
74
  readonly suspendable: LaneCapability;
75
75
  /** `/tmp/scratchpad/<sessionId>` 远端约定。判别式:`plugins/remote-scratchpad.ts` 的 `isRemoteScratchpadLane`。 */
76
76
  readonly remoteScratchpad: LaneCapability;
77
- /** 写门走 #165 的 `DeferredSandboxPathEnv` 代理裁决(而不是直接拿 worker 本机 fs 裁)。
77
+ /** 写门走 [ref] 的 `DeferredSandboxPathEnv` 代理裁决(而不是直接拿 worker 本机 fs 裁)。
78
78
  * 判别式:`boot/deferred-sandbox-path-env.ts` 的 `isSandboxPathAdjudicationLane`。 */
79
79
  readonly sandboxPathAdjudication: LaneCapability;
80
80
  /** git-worktree 隔离。判别式:`boot/execution-env.ts` 的 host 臂 vs `worktree_isolation_unsupported_lane` warn。 */
@@ -97,7 +97,7 @@ export interface ExecutionLaneCaps {
97
97
  * · `callerCwd: supported` —— 员工在自己设备的项目目录里干活是这条车道的**存在理由**;host 闸防的
98
98
  * 「跨租户宿主路径穿越」在此结构性不存在(路径落在发起者自己的设备上,归属已由 deviceId↔principal
99
99
  * 绑定验证),故不要求单用户。今天 `cwdHonored` 还答 false ⇒ 登记在 {@link PLANNED_LANE_DIVERGENCES}。
100
- * · `sandboxPathAdjudication: supported` —— 自动判真且**这是深思后的正确默认**:写门经 #165 代理把四读
100
+ * · `sandboxPathAdjudication: supported` —— 自动判真且**这是深思后的正确默认**:写门经 [ref] 代理把四读
101
101
  * 原语转发到设备取真文件系统事实,云盘永不参与设备写目标的裁决。
102
102
  * · `remoteScratchpad: supported` —— executor 平台闭集 = darwin|linux,`/tmp/scratchpad/<sessionId>`
103
103
  * 的惰性 mkdir 约定原样适用;不加词则 scratchpad envFact 对模型整块缺席。
@@ -119,7 +119,7 @@ export declare const ALL_EXECUTION_LANES: readonly ExecutionLane[];
119
119
  *
120
120
  * · `undefined`(REMOTE_EXEC 未设)⇒ `"in-process"`,那是真车道不是缺席;
121
121
  * · 认不出的词 ⇒ `undefined`,**调用方必须 fail-closed**(禁静默按某个默认车道处理)。生产链上这一臂
122
- * 不可达:`loadConfig` 的 #157 拒启门先咬未知词;它存在是为了消费点自卫时有个响亮出口。
122
+ * 不可达:`loadConfig` 的 [ref] 拒启门先咬未知词;它存在是为了消费点自卫时有个响亮出口。
123
123
  */
124
124
  export declare function executionLaneOf(provider: string | undefined): ExecutionLane | undefined;
125
125
  /** 把一位能力在**具体部署**上落成布尔:租户面是唯一入参(旋钮由消费点自己再合取)。