@sema-agent/server 7.134.0 → 7.135.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 (458) hide show
  1. package/MIGRATION.md +134 -0
  2. package/USAGE.md +98 -30
  3. package/dist/adoption/plan.d.ts +1 -1
  4. package/dist/approval-ask-audit-store.d.ts +24 -24
  5. package/dist/approval-ask-machine.d.ts +2 -2
  6. package/dist/approval-card.d.ts +62 -150
  7. package/dist/approval-card.js +33 -51
  8. package/dist/approval-content-kind.d.ts +22 -5
  9. package/dist/approval-content-kind.js +8 -1
  10. package/dist/approval-deny-reasons.d.ts +1 -1
  11. package/dist/approval-gate-currency.d.ts +22 -3
  12. package/dist/approval-gate-currency.js +44 -18
  13. package/dist/approval-hmac.d.ts +7 -7
  14. package/dist/approval-policy-settlement.d.ts +2 -2
  15. package/dist/approval-reconciler.d.ts +3 -3
  16. package/dist/approval.d.ts +8 -8
  17. package/dist/approval.js +4 -2
  18. package/dist/auth-bridge.d.ts +1 -1
  19. package/dist/auto-mode-face.d.ts +4 -4
  20. package/dist/background-session-reap.d.ts +2 -2
  21. package/dist/bake-runner/main.d.ts +2 -2
  22. package/dist/bake-runner/runner.d.ts +4 -4
  23. package/dist/bench/s1/live-deps.d.ts +1 -1
  24. package/dist/bench/s1/run-firm.d.ts +1 -1
  25. package/dist/boot/coordinators.d.ts +2 -2
  26. package/dist/boot/coordinators.js +2 -2
  27. package/dist/boot/deferred-sandbox-path-env.d.ts +0 -6
  28. package/dist/boot/deferred-sandbox-path-env.js +0 -5
  29. package/dist/boot/engine-lease.d.ts +5 -5
  30. package/dist/boot/execution-env.d.ts +16 -15
  31. package/dist/boot/execution-env.js +19 -21
  32. package/dist/boot/fatal-exit.d.ts +2 -2
  33. package/dist/boot/late-binds.d.ts +1 -1
  34. package/dist/boot/leader.d.ts +1 -1
  35. package/dist/boot/memory-boundary.d.ts +2 -2
  36. package/dist/boot/memory-consolidation.d.ts +15 -15
  37. package/dist/boot/parked-revive-gate.d.ts +3 -3
  38. package/dist/boot/parked-revive-gate.js +3 -2
  39. package/dist/boot/reapers.d.ts +4 -4
  40. package/dist/boot/resolve-spec.d.ts +1 -1
  41. package/dist/boot/resolve-spec.js +28 -24
  42. package/dist/boot/runner-deps.d.ts +11 -11
  43. package/dist/boot/runner-deps.js +3 -2
  44. package/dist/boot/session-faces.d.ts +3 -3
  45. package/dist/boot/session-faces.js +11 -30
  46. package/dist/boot/shutdown.d.ts +5 -5
  47. package/dist/boot/side-query-lane.d.ts +2 -2
  48. package/dist/boot/stage-05-execution-env.js +4 -4
  49. package/dist/boot/stage-06-runners.js +0 -2
  50. package/dist/boot/stores.js +2 -1
  51. package/dist/boot/web-admin.d.ts +17 -17
  52. package/dist/boot/web-admin.js +5 -10
  53. package/dist/boot/workflow-orchestration.js +2 -9
  54. package/dist/brain.d.ts +11 -11
  55. package/dist/budget.d.ts +4 -4
  56. package/dist/capabilities/approvals-push.d.ts +4 -4
  57. package/dist/capabilities/builtin-tools.d.ts +5 -5
  58. package/dist/capabilities/center-plugins.d.ts +5 -5
  59. package/dist/capabilities/center-plugins.js +1 -1
  60. package/dist/capabilities/center-prompts.d.ts +1 -1
  61. package/dist/capabilities/center-wiring.d.ts +1 -1
  62. package/dist/capabilities/composite-members.d.ts +1 -1
  63. package/dist/capabilities/execution-lane.d.ts +5 -5
  64. package/dist/capabilities/execution-lane.js +2 -2
  65. package/dist/capabilities/hands-lane.d.ts +5 -5
  66. package/dist/capabilities/mcp-probe.d.ts +10 -7
  67. package/dist/capabilities/sandbox-file-send.d.ts +1 -18
  68. package/dist/capabilities/sandbox-file-send.js +0 -7
  69. package/dist/capabilities/scenarios.d.ts +28 -10
  70. package/dist/capabilities/scenarios.js +15 -5
  71. package/dist/capabilities/send-user-file-tool.d.ts +1 -1
  72. package/dist/capabilities/skills.d.ts +31 -12
  73. package/dist/capabilities/skills.js +23 -17
  74. package/dist/capabilities/tool-defer.d.ts +1 -1
  75. package/dist/capability-facts.d.ts +26 -25
  76. package/dist/capability-facts.js +14 -16
  77. package/dist/center-config-tier.d.ts +1 -1
  78. package/dist/center-credential.d.ts +4 -4
  79. package/dist/checkpoint-identity.d.ts +5 -0
  80. package/dist/checkpoint-identity.js +14 -0
  81. package/dist/config-catalog.d.ts +12 -12
  82. package/dist/config-invariants.d.ts +4 -4
  83. package/dist/config-invariants.js +3 -2
  84. package/dist/config-lkg.d.ts +1 -1
  85. package/dist/config-provider.d.ts +13 -13
  86. package/dist/config-provider.js +2 -1
  87. package/dist/config-types.d.ts +83 -83
  88. package/dist/config.d.ts +26 -24
  89. package/dist/config.js +12 -10
  90. package/dist/cross-session-settings.d.ts +1 -1
  91. package/dist/delegated-session-owner.d.ts +16 -13
  92. package/dist/delegated-session-owner.js +9 -10
  93. package/dist/deployment-governance.d.ts +16 -16
  94. package/dist/deployment-shape.d.ts +127 -0
  95. package/dist/deployment-shape.js +72 -0
  96. package/dist/device-store.d.ts +1 -1
  97. package/dist/device-ws-hub.d.ts +1 -1
  98. package/dist/egress-redirect.d.ts +1 -1
  99. package/dist/entry-mode-clamp-notice.d.ts +2 -2
  100. package/dist/env-facts.d.ts +10 -9
  101. package/dist/env-facts.js +1 -1
  102. package/dist/env-name-allowlist-knobs.d.ts +5 -5
  103. package/dist/exec-bounds.d.ts +2 -2
  104. package/dist/execution-lane-caps.d.ts +31 -43
  105. package/dist/execution-lane-caps.js +0 -13
  106. package/dist/file-history-capture.d.ts +9 -9
  107. package/dist/file-history-disclosure.d.ts +23 -11
  108. package/dist/file-history-disclosure.js +7 -12
  109. package/dist/fleet/drain-entry.d.ts +2 -2
  110. package/dist/fleet/fleet-bus.d.ts +22 -14
  111. package/dist/fleet/fleet-bus.js +5 -5
  112. package/dist/fleet/fleet-reconciler.d.ts +9 -9
  113. package/dist/fleet/subagent-tail-bus.d.ts +4 -4
  114. package/dist/fleet-client.d.ts +13 -13
  115. package/dist/fleet-lease.d.ts +16 -16
  116. package/dist/governance-http-status.d.ts +2 -2
  117. package/dist/hooks/hook-llm.d.ts +7 -7
  118. package/dist/hooks/hook-runner.d.ts +57 -30
  119. package/dist/hooks/hook-runner.js +36 -18
  120. package/dist/host-decision.d.ts +5 -5
  121. package/dist/host-lsp-manager.d.ts +5 -5
  122. package/dist/hosted-posture.d.ts +23 -13
  123. package/dist/hosted-posture.js +4 -9
  124. package/dist/http/admission.d.ts +2 -2
  125. package/dist/http/admission.js +20 -5
  126. package/dist/http/approval-sweeps.d.ts +1 -1
  127. package/dist/http/approval-sweeps.js +2 -1
  128. package/dist/http/checkpoint-ctx.d.ts +39 -13
  129. package/dist/http/checkpoint-ctx.js +74 -35
  130. package/dist/http/dispatch.d.ts +3 -3
  131. package/dist/http/durable-run-leg.js +4 -3
  132. package/dist/http/idempotency.d.ts +2 -2
  133. package/dist/http/mcp-dial-deadline.d.ts +7 -5
  134. package/dist/http/memory-compliance-failure-reply.d.ts +4 -4
  135. package/dist/http/owner-access.d.ts +4 -6
  136. package/dist/http/owner-access.js +1 -1
  137. package/dist/http/principal-gate.d.ts +7 -7
  138. package/dist/http/principal-gate.js +3 -2
  139. package/dist/http/readiness.d.ts +1 -1
  140. package/dist/http/request-guards.d.ts +4 -4
  141. package/dist/http/request-guards.js +2 -1
  142. package/dist/http/resume-ctx-read.d.ts +7 -7
  143. package/dist/http/resume-ctx-read.js +1 -1
  144. package/dist/http/resume-legs.d.ts +3 -3
  145. package/dist/http/resume-legs.js +11 -8
  146. package/dist/http/route-ctx.d.ts +29 -29
  147. package/dist/http/route-table.d.ts +9 -9
  148. package/dist/http/routes/agents-roster.d.ts +1 -1
  149. package/dist/http/routes/approvals-assistant.d.ts +5 -5
  150. package/dist/http/routes/approvals-assistant.js +55 -15
  151. package/dist/http/routes/background.d.ts +3 -3
  152. package/dist/http/routes/background.js +2 -2
  153. package/dist/http/routes/capabilities.d.ts +1 -1
  154. package/dist/http/routes/capabilities.js +16 -8
  155. package/dist/http/routes/config-catalog.d.ts +1 -1
  156. package/dist/http/routes/devices.d.ts +1 -1
  157. package/dist/http/routes/diagnostics.d.ts +3 -3
  158. package/dist/http/routes/fleet.d.ts +1 -1
  159. package/dist/http/routes/fleet.js +2 -1
  160. package/dist/http/routes/mcp-reconnect.d.ts +4 -4
  161. package/dist/http/routes/mcp-reconnect.js +3 -3
  162. package/dist/http/routes/memory-consolidation.d.ts +1 -1
  163. package/dist/http/routes/notify-wake.d.ts +1 -1
  164. package/dist/http/routes/notify-wake.js +2 -2
  165. package/dist/http/routes/rules.d.ts +1 -1
  166. package/dist/http/routes/runs.js +22 -10
  167. package/dist/http/routes/session-sync.d.ts +1 -1
  168. package/dist/http/routes/session-sync.js +73 -44
  169. package/dist/http/routes/sessions-list.js +1 -1
  170. package/dist/http/routes/sessions.js +30 -44
  171. package/dist/http/routes/tasks.d.ts +1 -1
  172. package/dist/http/routes/trace-usage.d.ts +1 -1
  173. package/dist/http/routes/workflows.d.ts +3 -0
  174. package/dist/http/routes/workflows.js +31 -28
  175. package/dist/http/send.d.ts +5 -5
  176. package/dist/http/server.d.ts +34 -34
  177. package/dist/http/session-inherit-env.d.ts +3 -3
  178. package/dist/http/sse-lifecycle.d.ts +1 -1
  179. package/dist/http/sse-log.d.ts +2 -2
  180. package/dist/http/submit-ctx.js +1 -1
  181. package/dist/http/sync-submit-body.d.ts +1 -1
  182. package/dist/http/verify-rounds.d.ts +1 -1
  183. package/dist/http/wire-types.d.ts +28 -21
  184. package/dist/instruction-source-notice.d.ts +2 -2
  185. package/dist/key-resolver.d.ts +3 -3
  186. package/dist/lane-home-probe.d.ts +1 -1
  187. package/dist/leader/diffout.d.ts +1 -1
  188. package/dist/leader/diffup.d.ts +2 -2
  189. package/dist/leader/endpoint.d.ts +1 -1
  190. package/dist/leader/fanout.d.ts +1 -1
  191. package/dist/leader/leader.d.ts +4 -4
  192. package/dist/leader/merge.d.ts +3 -3
  193. package/dist/leader/repair-wire.d.ts +1 -1
  194. package/dist/leader/wire.d.ts +6 -6
  195. package/dist/list-entry-display.d.ts +1 -1
  196. package/dist/lsp-evict.d.ts +1 -1
  197. package/dist/mcp-assertion-header.d.ts +1 -1
  198. package/dist/memory-layer-legacy-lock.d.ts +1 -1
  199. package/dist/memory-operator-faces.d.ts +1 -1
  200. package/dist/memory-posture.js +4 -2
  201. package/dist/memory-project-layer.d.ts +1 -1
  202. package/dist/memory-scope.d.ts +19 -19
  203. package/dist/memory-store-refusal.d.ts +4 -4
  204. package/dist/model-entry-headers.d.ts +2 -2
  205. package/dist/model-entry-refusal.d.ts +17 -17
  206. package/dist/model-provider.d.ts +10 -10
  207. package/dist/model-reach-scope.d.ts +1 -1
  208. package/dist/model-route-endpoint.d.ts +6 -6
  209. package/dist/model-route-url.d.ts +5 -5
  210. package/dist/model-select.d.ts +15 -6
  211. package/dist/model-select.js +5 -0
  212. package/dist/model-unreachable-notice.d.ts +3 -3
  213. package/dist/namespaced-rule-name.d.ts +15 -5
  214. package/dist/namespaced-rule-name.js +3 -2
  215. package/dist/observability/corrupt-read-seat.d.ts +9 -9
  216. package/dist/observability/cost-taxonomy.d.ts +1 -1
  217. package/dist/observability/err-text.d.ts +1 -1
  218. package/dist/observability/fail-open.d.ts +12 -8
  219. package/dist/observability/fail-open.js +12 -8
  220. package/dist/observability/metrics.d.ts +3 -3
  221. package/dist/observability/run-terminal.d.ts +36 -36
  222. package/dist/observability/secret-env-scrub.d.ts +3 -3
  223. package/dist/observability/tool-trace.d.ts +1 -1
  224. package/dist/operator-ask.d.ts +4 -4
  225. package/dist/orchestration/workflow-agent-session-index.d.ts +3 -3
  226. package/dist/orchestration/workflow-completion-inbox.d.ts +20 -5
  227. package/dist/orchestration/workflow-completion-inbox.js +29 -7
  228. package/dist/orchestration/workflow-notify-journal.d.ts +43 -19
  229. package/dist/orchestration/workflow-notify-journal.js +17 -0
  230. package/dist/outbound-dispatcher.d.ts +4 -4
  231. package/dist/parent-watch.d.ts +4 -4
  232. package/dist/parked-decide.d.ts +16 -15
  233. package/dist/parked-decide.js +5 -4
  234. package/dist/parked-revive-surface.d.ts +7 -7
  235. package/dist/parked-revive-surface.js +2 -3
  236. package/dist/peer-directory.d.ts +3 -3
  237. package/dist/peer-directory.js +1 -1
  238. package/dist/permission-rule-list.d.ts +10 -1
  239. package/dist/permission-rule-list.js +7 -5
  240. package/dist/permission-rule-vocab.d.ts +2 -2
  241. package/dist/plugins/adoption-log-sql.d.ts +1 -1
  242. package/dist/plugins/approval-ask-store-file.d.ts +8 -1
  243. package/dist/plugins/approval-ask-store-file.js +6 -3
  244. package/dist/plugins/approval-ask-store-memory.d.ts +11 -7
  245. package/dist/plugins/approval-ask-store-memory.js +11 -7
  246. package/dist/plugins/approval-ask-store-sql.d.ts +34 -15
  247. package/dist/plugins/approval-ask-store-sql.js +18 -5
  248. package/dist/plugins/approval-exemption-store.d.ts +3 -3
  249. package/dist/plugins/approval-nonce-store.d.ts +3 -3
  250. package/dist/plugins/background-agent-store-sql.d.ts +1 -1
  251. package/dist/plugins/background-shell-support.d.ts +2 -2
  252. package/dist/plugins/blob-backend.d.ts +1 -1
  253. package/dist/plugins/caching-session-store.d.ts +23 -32
  254. package/dist/plugins/caching-session-store.js +5 -17
  255. package/dist/plugins/checkpoint-index-columns.d.ts +81 -0
  256. package/dist/plugins/checkpoint-index-columns.js +62 -0
  257. package/dist/plugins/checkpoint-store-sql.d.ts +44 -66
  258. package/dist/plugins/checkpoint-store-sql.js +55 -102
  259. package/dist/plugins/device-store-sql.d.ts +7 -6
  260. package/dist/plugins/e2b-orphan-reclaim.d.ts +1 -1
  261. package/dist/plugins/ensure-schema-lock-policy.d.ts +1 -1
  262. package/dist/plugins/file-history-store-sql.d.ts +9 -7
  263. package/dist/plugins/file-history-store-sql.js +27 -15
  264. package/dist/plugins/file-run-store.d.ts +8 -8
  265. package/dist/plugins/fork-routing-session-store.d.ts +2 -2
  266. package/dist/plugins/fork-routing-session-store.js +1 -1
  267. package/dist/plugins/host-platform.d.ts +10 -10
  268. package/dist/plugins/image-bake-store-sql.d.ts +1 -1
  269. package/dist/plugins/image-index-sql.d.ts +1 -1
  270. package/dist/plugins/leader-run-store-sql.d.ts +1 -1
  271. package/dist/plugins/local-checkpoint-store.d.ts +10 -10
  272. package/dist/plugins/local-checkpoint-store.js +3 -4
  273. package/dist/plugins/local-session-store.d.ts +34 -38
  274. package/dist/plugins/local-session-store.js +20 -39
  275. package/dist/plugins/local-session-window.d.ts +1 -1
  276. package/dist/plugins/mailbox-store-sql.d.ts +2 -2
  277. package/dist/plugins/memory-engine-pg.d.ts +1 -1
  278. package/dist/plugins/memory-run-store.d.ts +4 -4
  279. package/dist/plugins/memory-sync-store-pg.d.ts +3 -3
  280. package/dist/plugins/one-time-migrations.d.ts +66 -40
  281. package/dist/plugins/one-time-migrations.js +115 -34
  282. package/dist/plugins/outcome-ledger-sql.d.ts +1 -1
  283. package/dist/plugins/park-commit-watch.d.ts +3 -3
  284. package/dist/plugins/permission-rule-store-file.d.ts +5 -5
  285. package/dist/plugins/permission-rule-store-file.js +12 -19
  286. package/dist/plugins/permission-rule-store-sql.d.ts +38 -4
  287. package/dist/plugins/permission-rule-store-sql.js +67 -24
  288. package/dist/plugins/pg-cost-quota.d.ts +1 -1
  289. package/dist/plugins/pg-pool.d.ts +2 -2
  290. package/dist/plugins/pg-pool.js +5 -2
  291. package/dist/plugins/pg-rate-limiter.d.ts +1 -1
  292. package/dist/plugins/pg-session-storage.d.ts +8 -20
  293. package/dist/plugins/pg-session-storage.js +14 -27
  294. package/dist/plugins/remote-env-adb.d.ts +10 -10
  295. package/dist/plugins/remote-env-device.d.ts +10 -9
  296. package/dist/plugins/remote-env-device.js +6 -2
  297. package/dist/plugins/remote-env-e2b.d.ts +3 -3
  298. package/dist/plugins/remote-env-host.d.ts +16 -16
  299. package/dist/plugins/remote-env-k8s.d.ts +8 -8
  300. package/dist/plugins/remote-env-local-docker.d.ts +2 -2
  301. package/dist/plugins/remote-env-ssh.d.ts +4 -4
  302. package/dist/plugins/remote-scratchpad.d.ts +2 -3
  303. package/dist/plugins/remote-scratchpad.js +0 -4
  304. package/dist/plugins/remote-shell.d.ts +6 -6
  305. package/dist/plugins/retention-lane-store-sql.d.ts +4 -4
  306. package/dist/plugins/retention-store-sql.d.ts +4 -4
  307. package/dist/plugins/roster-store-sql.d.ts +1 -1
  308. package/dist/plugins/run-store-sql.d.ts +8 -8
  309. package/dist/plugins/schema-consistency.d.ts +2 -2
  310. package/dist/plugins/schema-ensure-legs.d.ts +3 -3
  311. package/dist/plugins/schema-indexes.d.ts +1 -1
  312. package/dist/plugins/schema-live-columns.d.ts +1 -1
  313. package/dist/plugins/session-event-payload.d.ts +4 -4
  314. package/dist/plugins/session-fork.d.ts +34 -0
  315. package/dist/plugins/session-fork.js +29 -0
  316. package/dist/plugins/session-ownership.js +1 -1
  317. package/dist/plugins/session-placement.d.ts +1 -1
  318. package/dist/plugins/session-policy-store-sql.d.ts +12 -12
  319. package/dist/plugins/session-store.d.ts +2 -2
  320. package/dist/plugins/session-store.js +2 -2
  321. package/dist/plugins/shared-memory-store-sql.d.ts +2 -2
  322. package/dist/plugins/sql-driver.d.ts +8 -8
  323. package/dist/plugins/sql-errors.d.ts +1 -1
  324. package/dist/plugins/sql-json-column.d.ts +21 -21
  325. package/dist/plugins/sql-row-helpers.d.ts +2 -2
  326. package/dist/plugins/store-backend.d.ts +17 -16
  327. package/dist/plugins/store-backend.js +3 -3
  328. package/dist/plugins/store-contracts.d.ts +21 -21
  329. package/dist/plugins/task-attachment-store.d.ts +2 -2
  330. package/dist/plugins/task-list-store-sql.d.ts +1 -1
  331. package/dist/plugins/tidb-pool.d.ts +2 -2
  332. package/dist/plugins/tidb-pool.js +9 -2
  333. package/dist/plugins/tidb-session-store.d.ts +16 -26
  334. package/dist/plugins/tidb-session-store.js +15 -27
  335. package/dist/plugins/tool-result-store-sql.d.ts +1 -1
  336. package/dist/plugins/usage-window-store-sql.d.ts +3 -3
  337. package/dist/plugins/user-input-ledger-file.d.ts +1 -1
  338. package/dist/plugins/user-input-ledger-sql.d.ts +3 -3
  339. package/dist/plugins/web-search.d.ts +19 -5
  340. package/dist/plugins/web-search.js +19 -4
  341. package/dist/{orchestration/workflow-journal-entry.d.ts → plugins/workflow-journal-payload.d.ts} +23 -32
  342. package/dist/plugins/workflow-journal-payload.js +32 -0
  343. package/dist/plugins/workflow-journal-store-sql.d.ts +28 -14
  344. package/dist/plugins/workflow-journal-store-sql.js +34 -15
  345. package/dist/plugins/workflow-run-store-sql.d.ts +4 -4
  346. package/dist/posture-source.d.ts +11 -11
  347. package/dist/principal-jwt.d.ts +6 -6
  348. package/dist/project-identity.d.ts +3 -3
  349. package/dist/project-memory.d.ts +4 -4
  350. package/dist/read-face-posture.d.ts +7 -7
  351. package/dist/request-key-closure.d.ts +1 -1
  352. package/dist/request-key-closure.js +1 -1
  353. package/dist/request-value-closure.d.ts +15 -8
  354. package/dist/request-value-closure.js +2 -0
  355. package/dist/router/route-orchestration.d.ts +11 -16
  356. package/dist/router/route-orchestration.js +2 -12
  357. package/dist/rule-entry-list.d.ts +8 -7
  358. package/dist/rule-entry-list.js +2 -9
  359. package/dist/rules-consent.d.ts +6 -6
  360. package/dist/rules-consent.js +2 -0
  361. package/dist/run-cancel-context.d.ts +5 -5
  362. package/dist/run-local.d.ts +10 -10
  363. package/dist/runs.d.ts +13 -11
  364. package/dist/runs.js +15 -1
  365. package/dist/runtime-caps-resolver.d.ts +6 -6
  366. package/dist/runtime-governance.d.ts +9 -9
  367. package/dist/sandbox-pkg-source.d.ts +9 -31
  368. package/dist/sandbox-pkg-source.js +14 -8
  369. package/dist/sealed-key.d.ts +3 -3
  370. package/dist/security.d.ts +23 -26
  371. package/dist/security.js +12 -9
  372. package/dist/server-secret-env.d.ts +10 -10
  373. package/dist/session-children-retire.d.ts +1 -1
  374. package/dist/session-error-wire.d.ts +7 -7
  375. package/dist/session-incarnation.d.ts +52 -35
  376. package/dist/session-incarnation.js +23 -8
  377. package/dist/session-policy-wire.d.ts +27 -5
  378. package/dist/session-policy-wire.js +15 -1
  379. package/dist/session-records-skipped-notice.d.ts +1 -1
  380. package/dist/session-sync-kernel.d.ts +4 -4
  381. package/dist/session-sync.d.ts +49 -6
  382. package/dist/session-sync.js +52 -10
  383. package/dist/session-titler.d.ts +7 -6
  384. package/dist/session-titler.js +8 -13
  385. package/dist/session-watch.d.ts +3 -3
  386. package/dist/session-watch.js +4 -4
  387. package/dist/sighup-idle.d.ts +2 -2
  388. package/dist/spec-fields.d.ts +4 -4
  389. package/dist/sql-engine-posture.d.ts +3 -3
  390. package/dist/store-posture.d.ts +2 -2
  391. package/dist/stored-request-tool-axes-m19.d.ts +1 -1
  392. package/dist/task-a2a.d.ts +3 -1
  393. package/dist/task-a2a.js +34 -2
  394. package/dist/task-cwd.d.ts +7 -88
  395. package/dist/task-cwd.js +2 -15
  396. package/dist/task-mcp.d.ts +12 -8
  397. package/dist/task-mcp.js +19 -4
  398. package/dist/task-settings.d.ts +30 -18
  399. package/dist/task-settings.js +33 -3
  400. package/dist/task-workflow.d.ts +0 -24
  401. package/dist/task-workflow.js +2 -1
  402. package/dist/terminal.d.ts +5 -5
  403. package/dist/tighten-only-seats.d.ts +7 -6
  404. package/dist/tighten-only-seats.js +1 -1
  405. package/dist/tool-approval.d.ts +143 -197
  406. package/dist/tool-approval.js +13 -28
  407. package/dist/tool-rule-names.d.ts +2 -2
  408. package/dist/trace/core-keyset-guard.d.ts +12 -7
  409. package/dist/trace/engine-notice-wire.d.ts +5 -5
  410. package/dist/trace/engine-notice-wire.js +1 -0
  411. package/dist/trace/exit-seat.d.ts +31 -4
  412. package/dist/trace/exit-seat.js +41 -63
  413. package/dist/trace/ledger-events.d.ts +3 -3
  414. package/dist/trace/ledger-sink.d.ts +1 -1
  415. package/dist/trace/model-segment.d.ts +3 -3
  416. package/dist/trace/project.d.ts +47 -45
  417. package/dist/trace/project.js +33 -1
  418. package/dist/trace/redact.d.ts +44 -30
  419. package/dist/trace/redact.js +191 -89
  420. package/dist/trace/self-minted-wire.d.ts +35 -14
  421. package/dist/trace/self-minted-wire.js +8 -0
  422. package/dist/trace/sema-provenance.d.ts +1 -1
  423. package/dist/trace/task-notification-facets.d.ts +4 -4
  424. package/dist/trace/wire-projection-faces.d.ts +3 -3
  425. package/dist/trace/wire-projection-faces.js +1 -1
  426. package/dist/unattended-permission-mode.d.ts +5 -5
  427. package/dist/url-credential.d.ts +52 -0
  428. package/dist/url-credential.js +49 -0
  429. package/dist/url-refusal.d.ts +6 -2
  430. package/dist/url-refusal.js +8 -1
  431. package/dist/usage-analytics.d.ts +2 -2
  432. package/dist/user-input-ledger.d.ts +23 -23
  433. package/dist/web-admin-client/apply-effective.d.ts +5 -5
  434. package/dist/web-admin-client/apply-effective.js +2 -1
  435. package/dist/web-admin-client/apply-ledger.d.ts +2 -2
  436. package/dist/web-admin-client/center-request.d.ts +2 -2
  437. package/dist/web-admin-client/facade.d.ts +5 -5
  438. package/dist/web-admin-client/facade.js +1 -1
  439. package/dist/web-admin-client/hot-keys-registry.d.ts +2 -2
  440. package/dist/web-admin-client/http-client.d.ts +4 -4
  441. package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
  442. package/dist/web-admin-client/pull-state.d.ts +1 -1
  443. package/dist/web-admin-client/read-face.d.ts +2 -2
  444. package/dist/web-admin-client/read-warnings.d.ts +5 -5
  445. package/dist/web-admin-client/restart-signal.d.ts +6 -6
  446. package/dist/web-admin-client/skills-mcp.d.ts +28 -3
  447. package/dist/web-admin-client/skills-mcp.js +29 -1
  448. package/dist/web-admin-client/types.d.ts +16 -9
  449. package/dist/workspace-space.d.ts +5 -3
  450. package/dist/write-protection.d.ts +2 -2
  451. package/package.json +4 -3
  452. package/scripts/drain-check-local.mjs +2 -1
  453. package/scripts/drain-check.mysql.sql +4 -2
  454. package/scripts/drain-check.pg.sql +4 -2
  455. package/skills/loop.md +1 -1
  456. package/dist/http/run-declared-families.d.ts +0 -16
  457. package/dist/http/run-declared-families.js +0 -12
  458. package/dist/orchestration/workflow-journal-entry.js +0 -27
@@ -11,11 +11,13 @@ import { MAX_HOOK_NOTICE_TEXT_CHARS, boundedNoticeText } from "../fleet/fleet-bu
11
11
  import { recordFailOpen } from "../observability/fail-open.js";
12
12
  import { LIMIT_REASONS } from "../limit-refusal.js";
13
13
  import { clipDataText, echoCallerText } from "../caller-text-echo.js";
14
+ import { seatText } from "../trace/exit-seat.js";
14
15
  import { redactSecrets, buildDisplaySafeUrl } from "../trace/redact.js";
15
16
  import { canonicalJsonStringify } from "@sema-agent/core";
16
17
  import { ccPromptSystemFor, wrapCondition, parseCcVerdict, CC_EVALUATOR_MAX_OUTPUT_TOKENS } from "./cc-stop-prompt.js";
17
18
  import { ccAgentHookSystemFor } from "./cc-agent-hook-prompt.js";
18
19
  import { renderBranchTranscript } from "./branch-transcript.js";
20
+ import { buildRequestUrlCredentialRefusal, findUrlCredential, urlCredentialHeaderExit } from "../url-credential.js";
19
21
  import { HOOK_PHASES, HOOK_SOURCE_VOCABULARY_SENTENCE, hookPhaseOf, readHookGroupSource } from "./hook-source.js";
20
22
  import { commandLineChars, composeHookEnvLayer, hookPluginChars, planCommandSpawn, readHookArgs, readHookPlugin } from "./command-spawn.js";
21
23
  export const MAX_HOOK_ENTRIES_PER_EVENT = 32;
@@ -102,9 +104,7 @@ export const MAX_MATCHER_EVAL_CHARS = MAX_HOOK_COMMAND_CHARS;
102
104
  export const ADMISSION_MATCHER_BUDGET = { budgetMs: 1_000, totalMs: 5_000 };
103
105
  export const MATCHER_ECHO_CHARS = 200;
104
106
  export const IF_ECHO_CHARS = 200;
105
- const LOG_PREVIEW_ECHO_CHARS = 200;
106
- const LOG_ERROR_ECHO_CHARS = 300;
107
- const LOG_MESSAGE_ECHO_CHARS = 500;
107
+ const BLANKED_HEADER_ECHO_CHARS = 200;
108
108
  const MATCHER_UNJUDGED_TAG = "server.hooks.matcher-unjudged";
109
109
  function matcherReadsWireToolName(event) {
110
110
  return HOOK_EVENT_OWNER[event] === "engine" && HOOK_EVENT_MATCHER_FIELD[event] === "tool_name";
@@ -331,6 +331,24 @@ export function hooksMatcherIssue(config, depth, budget = {}) {
331
331
  }
332
332
  return undefined;
333
333
  }
334
+ export function hooksUrlCredentialIssue(config) {
335
+ for (const [event, groups] of Object.entries(config)) {
336
+ for (const [groupIndex, group] of (groups ?? []).entries()) {
337
+ for (const [entryIndex, entry] of group.hooks.entries()) {
338
+ if (entry.type !== "http")
339
+ continue;
340
+ const credential = findUrlCredential(entry.url);
341
+ if (credential !== undefined)
342
+ return { event, groupIndex, entryIndex, credential };
343
+ }
344
+ }
345
+ }
346
+ return undefined;
347
+ }
348
+ export function buildHooksUrlCredentialRefusal(issue) {
349
+ const entry = `settings.hooks.${issue.event}[${issue.groupIndex}].hooks[${issue.entryIndex}]`;
350
+ return buildRequestUrlCredentialRefusal(`${entry}.url`, issue.credential, urlCredentialHeaderExit(`${entry}.headers`));
351
+ }
334
352
  const HOOKS_PIECE_MEANING = {
335
353
  "hooks-not-object": "`hooks` must be an object keyed by hook event name",
336
354
  "unknown-event": "not a hook event name",
@@ -504,10 +522,10 @@ const MAX_LLM_ENTRIES_PER_EVENT = 4;
504
522
  const DEFAULT_PROMPT_HOOK_TIMEOUT_SECONDS = 30;
505
523
  const DEFAULT_AGENT_HOOK_TIMEOUT_SECONDS = 120;
506
524
  function logHookCommandFailed(ctx, event, run) {
507
- ctx.logger.warn("hook_command_failed", { event, code: run.code, stderr: echoCallerText(run.stderr, { maxChars: LOG_ERROR_ECHO_CHARS }) });
525
+ ctx.logger.warn("hook_command_failed", { event, code: run.code, stderr: seatText("operator-log-error", run.stderr) });
508
526
  }
509
527
  function logHookSystemMessage(ctx, event, message) {
510
- ctx.logger.info("hook_system_message", { event, message: echoCallerText(message, { maxChars: LOG_MESSAGE_ECHO_CHARS }) });
528
+ ctx.logger.info("hook_system_message", { event, message: seatText("operator-log-message", message) });
511
529
  }
512
530
  function hookDisplayName(entry) {
513
531
  if (typeof entry.statusMessage === "string" && entry.statusMessage.length > 0)
@@ -536,7 +554,7 @@ function emitHookNotice(ctx, n) {
536
554
  }
537
555
  catch (e) {
538
556
  recordFailOpen("server.hooks.notice-sink-threw", `kind=${n.kind} event=${n.event}`);
539
- ctx.logger.warn("hook_notice_sink_threw", { kind: n.kind, event: n.event, error: echoCallerText(String(e), { maxChars: LOG_PREVIEW_ECHO_CHARS }) });
557
+ ctx.logger.warn("hook_notice_sink_threw", { kind: n.kind, event: n.event, error: seatText("operator-log-text", String(e)) });
540
558
  }
541
559
  }
542
560
  function noteHookFailure(ctx, args) {
@@ -557,7 +575,7 @@ function noteHookFailure(ctx, args) {
557
575
  }
558
576
  function noteMatcherOverBudget(ctx, args) {
559
577
  const budgetMs = ADMISSION_MATCHER_BUDGET.budgetMs;
560
- const shown = (text) => echoCallerText(boundedNoticeText(text), { maxChars: MATCHER_ECHO_CHARS });
578
+ const shown = (text) => seatText("operator-log-text", text);
561
579
  const expression = shown(args.expression);
562
580
  const value = shown(args.value);
563
581
  ctx.logger.warn("hook_matcher_over_budget", { event: args.event, scope: args.scope, expression, value, budgetMs, selected: true });
@@ -879,7 +897,7 @@ async function fireAsyncCommandHook(entry, payload, ctx, event, halt) {
879
897
  }
880
898
  child.on("error", (e) => {
881
899
  clearTimeout(timer);
882
- ctx.logger.warn("hook_async_failed", { event, reason: "spawn_failed", error: echoCallerText(String(e), { maxChars: LOG_ERROR_ECHO_CHARS }) });
900
+ ctx.logger.warn("hook_async_failed", { event, reason: "spawn_failed", error: seatText("operator-log-error", String(e)) });
883
901
  noteHookFailure(ctx, { event, entry, reason: "spawn_failed", stderr: String(e), toolName: toolNameOf(payload) });
884
902
  });
885
903
  child.on("close", (code) => {
@@ -902,14 +920,14 @@ async function fireAsyncCommandHook(entry, payload, ctx, event, halt) {
902
920
  ctx.logger.info("hook_async_rewake_delivered", { event, chars: text.length });
903
921
  else
904
922
  ctx.logger.warn("hook_async_rewake_dropped", { event, reason: "no_live_stream" });
905
- }, (e) => ctx.logger.warn("hook_async_rewake_dropped", { event, reason: "wake_failed", error: echoCallerText(String(e), { maxChars: LOG_PREVIEW_ECHO_CHARS }) }));
923
+ }, (e) => ctx.logger.warn("hook_async_rewake_dropped", { event, reason: "wake_failed", error: seatText("operator-log-text", String(e)) }));
906
924
  });
907
925
  child.stdin?.on("error", () => { });
908
926
  child.stdin?.end(`${JSON.stringify(boundedToolInputPayload(payload))}\n`);
909
927
  child.unref();
910
928
  }
911
929
  catch (e) {
912
- ctx.logger.warn("hook_async_failed", { event, reason: "spawn_failed", error: echoCallerText(String(e), { maxChars: LOG_ERROR_ECHO_CHARS }) });
930
+ ctx.logger.warn("hook_async_failed", { event, reason: "spawn_failed", error: seatText("operator-log-error", String(e)) });
913
931
  noteHookFailure(ctx, { event, entry, reason: "spawn_failed", stderr: String(e), toolName: toolNameOf(payload) });
914
932
  }
915
933
  }
@@ -996,7 +1014,7 @@ async function runHttpHook(entry, payload, ctx, event) {
996
1014
  blankedCount: interpolated.blanked.length,
997
1015
  blanked: interpolated.blanked
998
1016
  .slice(0, MAX_BLANKED_REFERENCES_LOGGED)
999
- .map(({ header, name, reason }) => ({ header: echoCallerText(header, { maxChars: LOG_PREVIEW_ECHO_CHARS }), name: echoCallerText(name, { maxChars: LOG_PREVIEW_ECHO_CHARS }), reason })),
1017
+ .map(({ header, name, reason }) => ({ header: echoCallerText(header, { maxChars: BLANKED_HEADER_ECHO_CHARS }), name: echoCallerText(name, { maxChars: BLANKED_HEADER_ECHO_CHARS }), reason })),
1000
1018
  });
1001
1019
  }
1002
1020
  const headers = { "content-type": "application/json", ...interpolated.headers };
@@ -1034,7 +1052,7 @@ async function runHttpHook(entry, payload, ctx, event) {
1034
1052
  if (trimmed === "")
1035
1053
  return { code: 0, stdout: "{}", stderr: "", timedOut: false };
1036
1054
  if (!parseHookStdout(body)) {
1037
- ctx.logger.warn("hook_http_non_json_response", { url: buildDisplaySafeUrl(entry.url), preview: echoCallerText(trimmed, { maxChars: LOG_PREVIEW_ECHO_CHARS }) });
1055
+ ctx.logger.warn("hook_http_non_json_response", { url: buildDisplaySafeUrl(entry.url), preview: seatText("operator-log-text", trimmed) });
1038
1056
  noteHookFailure(ctx, {
1039
1057
  event: eventOfPayload(payload),
1040
1058
  entry,
@@ -1086,7 +1104,7 @@ function readHookStdout(ran, event, ctx, payload, ledger) {
1086
1104
  return out;
1087
1105
  const t = run.stdout.trim();
1088
1106
  if (t.startsWith("{") || t.startsWith("[")) {
1089
- ctx.logger.warn("hook_bad_json_output", { event, type: entry.type, preview: echoCallerText(t, { maxChars: LOG_PREVIEW_ECHO_CHARS }) });
1107
+ ctx.logger.warn("hook_bad_json_output", { event, type: entry.type, preview: seatText("operator-log-text", t) });
1090
1108
  noteHookFailure(ctx, { event, entry, reason: "bad_json", exitCode: run.code, stderr: run.stderr, toolName: toolNameOf(payload) });
1091
1109
  ledger.unrun(ran.source, entry, "bad_json");
1092
1110
  }
@@ -1193,7 +1211,7 @@ async function runMatchingEntries(event, groups, matchValue, payload, ctx, onceF
1193
1211
  return { kind: "halted" };
1194
1212
  }
1195
1213
  if (run.spawnError) {
1196
- ctx.logger.warn(entry.type === "http" ? "hook_http_request_failed" : entry.type === "prompt" || entry.type === "agent" ? "hook_llm_failed" : "hook_command_spawn_failed", { event, type: entry.type, error: echoCallerText(run.spawnError, { maxChars: LOG_ERROR_ECHO_CHARS }) });
1214
+ ctx.logger.warn(entry.type === "http" ? "hook_http_request_failed" : entry.type === "prompt" || entry.type === "agent" ? "hook_llm_failed" : "hook_command_spawn_failed", { event, type: entry.type, error: seatText("operator-log-error", run.spawnError) });
1197
1215
  if (!run.noticed)
1198
1216
  noteHookFailure(ctx, { event, entry, reason: "spawn_failed", exitCode: run.code, stderr: run.spawnError, ...(toolName !== undefined ? { toolName } : {}) });
1199
1217
  return { kind: "unrun", reason: "spawn_failed" };
@@ -1411,7 +1429,7 @@ export function createSettingsHooksRegistration(config, ctx, budgetMs) {
1411
1429
  unknownDecision = true;
1412
1430
  ctx.logger.warn("hook_permission_decision_unknown", {
1413
1431
  event: "PreToolUse",
1414
- decision: echoCallerText(typeof decision === "string" ? decision : typeof decision, { maxChars: LOG_PREVIEW_ECHO_CHARS }),
1432
+ decision: seatText("operator-log-text", typeof decision === "string" ? decision : typeof decision),
1415
1433
  tool: toolName,
1416
1434
  effect: "hook ruling not honored (closed word set is allow|deny|ask); this call falls back to the engine gate",
1417
1435
  });
@@ -1675,7 +1693,7 @@ export function createSettingsHooksRegistration(config, ctx, budgetMs) {
1675
1693
  branch = await sctx.getBranch?.();
1676
1694
  }
1677
1695
  catch (e) {
1678
- ctx.logger.warn("hook_stop_branch_failed", { error: echoCallerText(e instanceof Error ? e.message : String(e), { maxChars: LOG_ERROR_ECHO_CHARS }) });
1696
+ ctx.logger.warn("hook_stop_branch_failed", { error: seatText("operator-log-error", e instanceof Error ? e.message : String(e)) });
1679
1697
  }
1680
1698
  const rendered = renderBranchTranscript(branch);
1681
1699
  if (rendered.sufficient) {
@@ -1718,7 +1736,7 @@ export function createSettingsHooksRegistration(config, ctx, budgetMs) {
1718
1736
  if (v.ok)
1719
1737
  continue;
1720
1738
  if (v.impossible) {
1721
- ctx.logger.warn("hook_stop_condition_impossible", { event: "Stop", reason: echoCallerText(v.reason?.trim() ?? "", { maxChars: LOG_MESSAGE_ECHO_CHARS }) });
1739
+ ctx.logger.warn("hook_stop_condition_impossible", { event: "Stop", reason: seatText("operator-log-message", v.reason?.trim() ?? "") });
1722
1740
  continue;
1723
1741
  }
1724
1742
  if (block === undefined)
@@ -1728,7 +1746,7 @@ export function createSettingsHooksRegistration(config, ctx, budgetMs) {
1728
1746
  const out = llmExtra && entry.type === "prompt" ? parseHookStdout(run.stdout) : readHookStdout(ran, "Stop", ctx, payload, ledger);
1729
1747
  if (!out) {
1730
1748
  if (llmExtra && entry.type === "prompt") {
1731
- ctx.logger.warn("hook_llm_unparsed_verdict", { event: "Stop", head: echoCallerText(run.stdout.trim(), { maxChars: LOG_PREVIEW_ECHO_CHARS }) });
1749
+ ctx.logger.warn("hook_llm_unparsed_verdict", { event: "Stop", head: seatText("operator-log-text", run.stdout.trim()) });
1732
1750
  emitHookNotice(ctx, { kind: "hook_decision_unavailable", event: "Stop", reason: "unparsed" });
1733
1751
  ledger.unrun(ran.source, entry, "bad_json", "the prompt hook's answer could not be read as a verdict");
1734
1752
  }
@@ -44,7 +44,7 @@ import { type AskOutcome, type HostDecider, type PermissionResult, type ResumeOu
44
44
  * 这个事实铸(`human_refused` / `approval_window_expired` / `policy_refused`)。core 若改这一格的词表,
45
45
  * 读它的每一处编译期先红。
46
46
  *
47
- * 🔴 **S-558:为什么这一格住在本叶子模块**(此前是 `tool-approval.ts` 的模块私有型):来源位随决议
47
+ * 🔴 **[ref]:为什么这一格住在本叶子模块**(此前是 `tool-approval.ts` 的模块私有型):来源位随决议
48
48
  * **落持久行**之后,店(`src/plugins/approval-ask-store-sql.ts` 的 `AskRow.settledBy` /
49
49
  * `DecideAskInput.settledBy`)与协调器都要说同一个型 —— 而店不能反向依赖协调器。本模块只依赖
50
50
  * `@sema-agent/core`,与同住的 {@link HostDecision}(耐久腿的同位事实)恰好是一对:一条决议的来源
@@ -54,7 +54,7 @@ export type HostSettledBy = NonNullable<Extract<AskOutcome, {
54
54
  allow: boolean;
55
55
  }>["settledBy"]>;
56
56
  /** 直接取 core `ResumeOutcome` policy_ask 臂的 `hostDecision` 型 —— 本仓不复述那几个词(第二铸点)。它的 `decidedBy` 就是 core 的 `HostDecider`
57
- * (core 7.45.0 #1387:三个型位读同一只闭集)。**谁结束了这次等待**的闭集只有 core 包根那一只(`HOST_DECIDERS` / `HostDecider` / `isHostDecider`)。 */
57
+ * (core 7.45.0 [ref]:三个型位读同一只闭集)。**谁结束了这次等待**的闭集只有 core 包根那一只(`HOST_DECIDERS` / `HostDecider` / `isHostDecider`)。 */
58
58
  export type HostDecision = Extract<ResumeOutcome, {
59
59
  gate: "policy_ask";
60
60
  }>["hostDecision"];
@@ -72,14 +72,14 @@ export type HostDecision = Extract<ResumeOutcome, {
72
72
  * · `plan_review` 不读这只键:引擎的 plan_review 结局形没有决定者位(core 的结局规整会把别的键整只重建掉),收下它就是
73
73
  * 一句「已记」的空话。那一门照兄弟门字段那一族拒(`approvals-assistant.ts` 的回决门族派生),候 core 给座。
74
74
  *
75
- * 词表的来源:core 包根的 `HOST_DECIDERS` / `HostDecider` / `isHostDecider`(core 7.45.0 #1387;此前包根只有型,本仓手写一只闭集常量 + 两道
75
+ * 词表的来源:core 包根的 `HOST_DECIDERS` / `HostDecider` / `isHostDecider`(core 7.45.0 [ref];此前包根只有型,本仓手写一只闭集常量 + 两道
76
76
  * 编译门双向咬它 —— 那份手抄随本版退役)。wire 闭集 = 那只词表去掉扫的那一个词,运行期值与型都从它派生,没有第二份词表。
77
77
  */
78
78
  /** 只有本服务自己的截止扫说得出的那一个词 —— core 词表里唯一不上 wire 的成员(`satisfies`:core 改名 / 退役它 ⇒ 这里编译红)。 */
79
79
  declare const SWEEP_ONLY_DECIDER = "sla_timeout";
80
80
  /** wire 上的出处词(决定体 `decidedBy` 的值域)= core 闭集去掉扫的那一个。 */
81
81
  export type ApprovalDecidedBy = Exclude<HostDecider, typeof SWEEP_ONLY_DECIDER>;
82
- /** wire 闭集的运行期值:core `HOST_DECIDERS`(#1387)去掉扫的那一个,顺序随 core。core 加一个词 ⇒ 它在这里自动在场(决定口的门照收;两只座的映射
82
+ /** wire 闭集的运行期值:core `HOST_DECIDERS`([ref])去掉扫的那一个,顺序随 core。core 加一个词 ⇒ 它在这里自动在场(决定口的门照收;两只座的映射
83
83
  * {@link liveSettledBy} 的穷举 `switch` 编译红,由人裁它在同步座上怎么落)。 */
84
84
  export declare const APPROVAL_DECIDED_BY: readonly ApprovalDecidedBy[];
85
85
  /** 闭集外的拒句(三条决定口同一句;码按各口既有约定,见 {@link readDecidedBy})。成员表派生自 {@link APPROVAL_DECIDED_BY}(词表一个来源;今天字节与 7.118.0 同)。 */
@@ -141,7 +141,7 @@ export declare function readDecidedBy(raw: unknown, directDoorActive: boolean):
141
141
  */
142
142
  export declare function liveSettledBy(decidedBy: ApprovalDecidedBy): Extract<HostSettledBy, "policy"> | undefined;
143
143
  /**
144
- * 引擎自己的那一条例外:**一张要人的卡不归策略答** —— 判官是 core 的 `policyCannotAnswer(question, decidedBy)`(#1395 包根导出;引擎的续跑入口、
144
+ * 引擎自己的那一条例外:**一张要人的卡不归策略答** —— 判官是 core 的 `policyCannotAnswer(question, decidedBy)`([ref] 包根导出;引擎的续跑入口、
145
145
  * 执行带与同步座读同一条)。本仓**只在自己的副作用先于引擎落地的两条口**上于裁决之前问它(live `/respond`:会话放行 / 常驻规则 / 一条按 approve
146
146
  * 回放的 DECIDED 行;耐久 ask 账:一条宣称 approve 的 DECIDED 行),并且只问**放行**那一向(与引擎续跑入口同:拒永远答得了)。耐久 `/decide` 不判:
147
147
  * 引擎在 CAS 之前就拒(`checkpoint.invalid_outcome`,卡留 pending),本口的副作用全在引擎受理之后 —— 在那里再问一次就是第二个判官。
@@ -1,7 +1,7 @@
1
1
  /**
2
- * S-616(core 7.30.1 #1073 提货)—— **宿主车道本地语言服务器**的唯一构造点。
2
+ * [ref](core 7.30.1 [ref] 提货)—— **宿主车道本地语言服务器**的唯一构造点。
3
3
  *
4
- * ## 病(DEBTS S-684 同轴的第二条,7.99.0 修复验证 opus 腿普查带出)
4
+ * ## 病(DEBTS [ref] 同轴的第二条,7.99.0 修复验证 opus 腿普查带出)
5
5
  * core 的 `NodeLspManager` 默认 spawn(`defaultLspSpawn`)在 7.30.1 之前**不带 env** ⇒ 语言服务器整份继承本进程的
6
6
  * `process.env`,脑钥 / 仓库令牌 / 本仓自己的凭据键全在里面,而语言服务器会执行仓里的代码(构建脚本、插件、
7
7
  * 工作区配置)。7.30.1 起 core 默认改成 `scrubSecretEnv(process.env)`(按键名**形状**剥),并开了
@@ -9,10 +9,10 @@
9
9
  * 本仓唯一组合 `hostSubprocessEnv` 的结果 —— 引擎 `inheritedHostEnv("scrub")` ∪ 点名放回)。
10
10
  *
11
11
  * ## 规则(一句)
12
- * 语言服务器子进程的 env = 引擎 `inheritedHostEnv("scrub")`(形状剥 ∪ 本进程起服声明的自有凭据名)∪ 部署方点名放回的键(S-699,见下节;缺省空名单)——
12
+ * 语言服务器子进程的 env = 引擎 `inheritedHostEnv("scrub")`(形状剥 ∪ 本进程起服声明的自有凭据名)∪ 部署方点名放回的键([ref],见下节;缺省空名单)——
13
13
  * 剥除与模型可驱动的 host shell(`inheritEnv:"scrub"`)
14
14
  * 和 project-memory 的 git 子进程**同一只函数**:目录 `type:"secret"` 键按名剥 ∘ core 形状规则按形剥。只交 core 的默认
15
- * 会漏掉形状规则认不出的本仓凭据键(当时是 `OTEL_EXPORTER_OTLP_HEADERS`,core 7.33.7 #1180 起 core 按名剥它;今天只剩名单型旋钮三只),那正是 S-684 当初的病形。
15
+ * 会漏掉形状规则认不出的本仓凭据键(当时是 `OTEL_EXPORTER_OTLP_HEADERS`,core 7.33.7 [ref] 起 core 按名剥它;今天只剩名单型旋钮三只),那正是 [ref] 当初的病形。
16
16
  * 剥掉了什么经既有观测面留痕(site = `server.lsp.spawn-env`,每 site×key 一次披露 + 逐次计数)—— core 那侧
17
17
  * 刻意不报(无收集器,KL),本仓这一格补上。
18
18
  *
@@ -20,7 +20,7 @@
20
20
  * env 在**构造时**取一次快照(boot / run-local 起腿时),而不是 core 默认那样每次 spawn 现取:`NodeLspManagerOptions.env`
21
21
  * 是一份静态记录。本仓的 `process.env` 是 boot 期输入(热配置走 web-admin,不改 `process.env`),两者在本仓部署上同值。
22
22
  *
23
- * ## 点名放行(S-699,`LSP_ENV_ALLOW`)
23
+ * ## 点名放行([ref],`LSP_ENV_ALLOW`)
24
24
  * 剥除会连语言服务器自己的真实依赖一起剥掉(`.npmrc` 的 `${NPM_TOKEN}` 插值、rust-analyzer `cargo metadata` 私有 registry 的
25
25
  * `CARGO_REGISTRIES_<名>_TOKEN` —— 形状规则按名判,分不出「给语言服务器用的令牌」与「编排器的令牌」)。出路 = 部署方点名:
26
26
  * env = 引擎 `inheritedHostEnv("scrub")` 之上把 `config.lspEnvAllow` 点到的键经 `allowlistedEnv`(与沙箱三腿
@@ -1,5 +1,5 @@
1
1
  /**
2
- * S-591 / S-564(车LT,7.95.0)→ S-671 / B-10(车NB,7.99.0)—— **「这台部署是不是托管 / 多租」的单一铸点**。
2
+ * [ref] / [ref](车LT,7.95.0)→ [ref] / B-10(车NB,7.99.0)—— **「这台部署是不是托管 / 多租」的单一铸点**。
3
3
  *
4
4
  * ## 为什么是一处
5
5
  *
@@ -11,14 +11,12 @@
11
11
  * ⚠️ 这句话此前在本仓被抄成「`boot/resolve-spec.ts` 阶段④ 的 `partitions` 字面量」——`src/` 里**没有**
12
12
  * 那个字面量(全仓 `partitions` 的 src 命中全是注释;尺子:同目录 `config` 3721 命中)。手抄的**坐标**
13
13
  * 比手抄的值更难发现烂掉,[ref] 的第一排查点就是它;
14
- * · 能力授予面的赦免挂在 **`requirePrincipal !== true`** 上 —— 但**三条面各有各的谓词,不是一只**
15
- * (异源复核实测,别照「它们都一样」写):
16
- * · `settings.hooks` —— `task-settings.ts` 的 `taskHooksHonored`(唯一属主;resolve-spec 装配 / 受理面 / 能力位三处同调),判据**只有**
17
- * `requirePrincipal !== true` ⇒ 采纳,否则忽略(**不看车道**,任何 `REMOTE_EXEC` 都一样);
18
- * · `additionalDirectories` / `additionalReadDirectories` —— **只有** `cwdHonored`
19
- * (= `provider === "host" ∧ requirePrincipal !== true`);
20
- * · `settings.env` / `cwd` —— `cwdHonored ‖ deviceCwdHonored`,而
21
- * **`deviceCwdHonored` 这一臂里没有 `requirePrincipal` 项**(`task-cwd.ts`:device 车道上那条路径落在
14
+ * · 能力授予面的赦免挂在「单主」上 —— 但**三条面读的是部署形表(`deployment-shape.ts`)里三个不同的行**
15
+ * (异源复核实测,别照「它们都一样」写;[ref] 起三行并排在一张表里,轴列即差异):
16
+ * · `settings.hooks` —— `task-settings.ts` 的 `taskHooksHonored`(唯一属主;resolve-spec 装配 / 受理面 / 能力位三处同调)= 表行
17
+ * `multiTenant` 的反面 ⇒ 采纳,否则忽略(**不看车道**,任何 `REMOTE_EXEC` 都一样);
18
+ * · `additionalDirectories` / `additionalReadDirectories` —— 表行 `callerOwnsWorkerDisk`(手在本 worker 盘上 ∧ 单主 = 今天只有 host);
19
+ * · `settings.env` / `cwd` —— 表行 `callerCwd`(读能力表 `callerCwd` 位:host 单主才开,**device 不读租户**:那条路径落在
22
20
  * **发起者自己的设备**上,归属由 `device_session` 绑定行验过 ⇒ 跨租户面结构性不存在)。
23
21
  *
24
22
  * ⇒ 先把这个判定位铸成**一处**,再让各条腿都读它(clay 裁定③,2026-09-22):**不许各自加特判**——
@@ -36,7 +34,7 @@
36
34
  * ⇒ 签发方配置是**身份验签轴**(谁的 JWT 算数),不是租户轴(这台机器有几个主人)。「受控于控制面」
37
35
  * (`SEMA_WEB_ADMIN_*`,含 worker 名)同理是 fleet 管理轴,本判据同样不读。
38
36
  *
39
- * 随两臂一起删掉的(按类删干净,规则集变小):S-564 腿①「托管 ∧ 未开 `REQUIRE_PRINCIPAL` ⇒ 拒启」
37
+ * 随两臂一起删掉的(按类删干净,规则集变小):[ref] 腿①「托管 ∧ 未开 `REQUIRE_PRINCIPAL` ⇒ 拒启」
40
38
  * (判据只剩读 `requirePrincipal` 的那一臂之后,那条合取恒假 ⇒ 结构上不可达)及其跨键不变量行;
41
39
  * `run-local.ts` 为那两臂清 env 的清除口。
42
40
  *
@@ -85,7 +83,7 @@ export interface HostedPostureFacts {
85
83
  readonly evidence: readonly HostedEvidence[];
86
84
  }
87
85
  /**
88
- * 判定位的**唯一**铸点(纯数据 ⇒ `build*`)。托管 ⇔ `requirePrincipal === true`([ref] ①)。
86
+ * 判定位的**唯一**铸点(纯数据 ⇒ `build*`)。托管 ⇔ 部署形表行 `multiTenant`(= 运维声明 `REQUIRE_PRINCIPAL=true`,[ref] ①)。
89
87
  *
90
88
  * `evidence` 仍是数组(按词表顺序收**全部**命中):拒因逐字点它们,运维才知道改哪儿;词表是闭集,
91
89
  * 形状不随词数变。
@@ -99,7 +97,19 @@ export declare function hostedEvidenceNote(e: HostedEvidence): string;
99
97
  export type TaskWriteFaceInput = TaskHostPostureScope & Readonly<Pick<ServiceConfigFlat, "taskWriteFaceEscalation">>;
100
98
  /** 任务层宿主姿态声明被拒时的 wire 子码(附录 A 的 `request.` 族)。 */
101
99
  export declare const HOST_POSTURE_REFUSED_CODE = "request.host_posture_refused";
102
- /** 射程判据读的键集(托管证据 + 车道)。 */
100
+ /**
101
+ * **射程判据** —— 这台部署认不认「任务层替它声明的宿主姿态」?
102
+ *
103
+ * 两条腿读它,都是**真的开门**的声明 ⇒ 都响亮拒(同码 {@link HOST_POSTURE_REFUSED_CODE}、同状态 422):
104
+ * · 腿② 写容纳面(bypassPermissions 开的写面)—— {@link taskWriteFaceRefusal};
105
+ * · 腿④ [ref] host shell 继承整份用户环境(`inheritEnv:"all"`)—— {@link taskInheritEnvRefusal}。
106
+ * [ref] 前还有腿③(`approverPosture`,忽略 + 留声),随那个请求键一起退役。射程只铸在这一处,同族声明读同一只。
107
+ *
108
+ * 🔴 **device 车道不适用(clay 裁定③ 2026-09-22)**:device 车道上 host 闸防的那个跨租户宿主穿越**结构性不存在**
109
+ * (路径落在**发起者自己的设备**上,归属由 `device_session` 绑定行 + 准入链的 owner 谓词验过),叠加 clay [ref]
110
+ * 「device 零额外审批」⇒ 在那条车道上拿租户声明当判据就是**用错轴**。与 `settings.env` / `cwd` 两键在那条车道上的既有臂同源同形。
111
+ * [ref] 起射程判据 = 部署形表行 `taskHostPostureDeclarations`(device 车道 ∨ 单主;轴列 lane + principal);下面是它读的键集(托管证据 + 车道)。
112
+ */
103
113
  export type TaskHostPostureScope = HostedPostureInput & Readonly<Pick<ServiceConfigFlat, "remoteExec">>;
104
114
  /**
105
115
  * **腿②** —— 这条请求要掀开写围栏,这台部署给不给?返回拒因;`undefined` = 放行。
@@ -109,7 +119,7 @@ export type TaskHostPostureScope = HostedPostureInput & Readonly<Pick<ServiceCon
109
119
  * governance 的 `overrides.writeFace="roots"` 去压——实测 core 的 `tightenTaskSpec` 在
110
120
  * base `open` × override `roots` 上**静默**取 `roots`(该函数零回调形参 ⇒ 没有留痕通道)。
111
121
  *
112
- * 🔴 **射程(含 device 车道那条对位臂)在共用谓词 {@link hostPostureDeclarationsHonored} 上** ——
122
+ * 🔴 **射程(含 device 车道那条对位臂)在部署形表行 `taskHostPostureDeclarations` 上** ——
113
123
  * 两条腿同射程、不同处置,射程只有一处答案。
114
124
  */
115
125
  export declare function taskWriteFaceRefusal(c: TaskWriteFaceInput): string | undefined;
@@ -1,9 +1,9 @@
1
1
  import { TASK_WRITE_FACE_ESCALATIONS } from "./config-types.js";
2
- import { deviceCwdHonored } from "./task-cwd.js";
2
+ import { DEPLOYMENT_SHAPE_PREDICATES } from "./deployment-shape.js";
3
3
  export const HOSTED_EVIDENCE_WORDS = ["require-principal"];
4
4
  export function buildHostedPosture(c) {
5
5
  const evidence = [];
6
- if (c.requirePrincipal === true)
6
+ if (DEPLOYMENT_SHAPE_PREDICATES.multiTenant.holds(c))
7
7
  evidence.push("require-principal");
8
8
  return { hosted: evidence.length > 0, evidence };
9
9
  }
@@ -17,11 +17,6 @@ function hostedBecause(facts) {
17
17
  return facts.evidence.map(hostedEvidenceNote).join("; ");
18
18
  }
19
19
  export const HOST_POSTURE_REFUSED_CODE = "request.host_posture_refused";
20
- function hostPostureDeclarationsHonored(c) {
21
- if (deviceCwdHonored(c))
22
- return true;
23
- return !buildHostedPosture(c).hosted;
24
- }
25
20
  export function taskWriteFaceRefusal(c) {
26
21
  switch (c.taskWriteFaceEscalation) {
27
22
  case "allow":
@@ -39,7 +34,7 @@ export function taskWriteFaceRefusal(c) {
39
34
  `Set TASK_WRITE_FACE_ESCALATION to one of ${TASK_WRITE_FACE_ESCALATIONS.join(" | ")}, or unset it to let the deployment posture decide.`);
40
35
  }
41
36
  }
42
- if (hostPostureDeclarationsHonored(c))
37
+ if (DEPLOYMENT_SHAPE_PREDICATES.taskHostPostureDeclarations.holds(c))
43
38
  return undefined;
44
39
  const facts = buildHostedPosture(c);
45
40
  return (`permissionMode:"bypassPermissions" opens the WRITE containment face (the engine's bypassPermissions mode writes outside the write roots) — the run could write outside the task root. ` +
@@ -47,7 +42,7 @@ export function taskWriteFaceRefusal(c) {
47
42
  `Set TASK_WRITE_FACE_ESCALATION=allow if the DEPLOYMENT permits the task layer to open it, or omit permissionMode:"bypassPermissions".`);
48
43
  }
49
44
  export function taskInheritEnvRefusal(c) {
50
- if (hostPostureDeclarationsHonored(c))
45
+ if (DEPLOYMENT_SHAPE_PREDICATES.taskHostPostureDeclarations.holds(c))
51
46
  return undefined;
52
47
  const facts = buildHostedPosture(c);
53
48
  return (`inheritEnv:"all" hands the model-driven host shell this machine's WHOLE environment (credential-shaped variables included — the host lane scrubs them by default). ` +
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 提交准入(S-147 切片:`http/server.ts` 的 `prepareSpec` 与它的模块级校验词表逐字搬家,正文一字未改)。
2
+ * 提交准入([ref] 切片:`http/server.ts` 的 `prepareSpec` 与它的模块级校验词表逐字搬家,正文一字未改)。
3
3
  * 读体 → 验型 → 授权 → 建 spec 的**唯一**一条链;tasks / runs / A2A 三个提交面共用它(抄一份 = 抄一份会漂的 400)。
4
4
  * ctx 字段 3 只(`deps` / `readJson` / `runnerFor`),机器算(closure-free-vars)与手抄一致。
5
5
  */
@@ -59,7 +59,7 @@ export interface UserSkillsRefusal {
59
59
  readonly facts?: LimitFacts;
60
60
  }
61
61
  /**
62
- * core 7.41.0 #1303 —— 顶层技能带 `manifest` 的拒因句(单铸点)。出路只点本服务上**真存在**的旋钮:技能的两只清单
62
+ * core 7.41.0 [ref] —— 顶层技能带 `manifest` 的拒因句(单铸点)。出路只点本服务上**真存在**的旋钮:技能的两只清单
63
63
  * (`allowedTools` / `disallowedTools`)、圈工具 = deny 规则(请求 `settings.permissions.deny` / 运维 `APPROVAL_DENY`)或子代定义的
64
64
  * `agents[].allowTools`、圈写路径 = 会话规则 `allowDirs`(`PUT /v1/sessions/:id/policy`)。
65
65
  */
@@ -2,7 +2,7 @@ import { APPROVAL_REACH, MCP_IMAGE_MAX_BASE64, isApprovalReach, isPermissionMode
2
2
  import { isAtMentionable, matchCatalogModel, refusedCatalogEntry, selectableCatalog } from "../model-select.js";
3
3
  import { echoModelRef, modelUnavailableMessage } from "../model-entry-refusal.js";
4
4
  import { HttpError, sessionIdShapeIssue } from "../security.js";
5
- import { MAX_SETTINGS_OUTPUT_STYLE_CHARS, MAX_SETTINGS_ENV_VARS, MAX_SETTINGS_ENV_KEY_CHARS, MAX_SETTINGS_ENV_VALUE_CHARS, PERMISSION_MODE_WORDS, parseTaskSettings, settingsPermissionBucketIssue, skillListingBudgetFractionOk, skillListingMaxDescOk, stampEntryPermissionMode, taskHooksHonored, taskSettingsKeyIssue } from "../task-settings.js";
5
+ import { MAX_SETTINGS_OUTPUT_STYLE_CHARS, MAX_SETTINGS_ENV_VARS, MAX_SETTINGS_ENV_KEY_CHARS, MAX_SETTINGS_ENV_VALUE_CHARS, PERMISSION_MODE_WORDS, parseTaskSettings, settingsPermissionBucketIssue, skillListingBudgetFractionOk, skillListingMaxDescOk, hooksKeyIssue, stampEntryPermissionMode, taskHooksHonored, taskSettingsKeyIssue } from "../task-settings.js";
6
6
  import { tightenOnlySeatIssue } from "../tighten-only-seats.js";
7
7
  import { approvalFrameFamiliesIssue } from "../tool-approval.js";
8
8
  import { buildEntryModeClampNotice } from "../entry-mode-clamp-notice.js";
@@ -10,8 +10,8 @@ import { autonomyModeFloor } from "../runtime-governance.js";
10
10
  import { taskBodyKeyIssue } from "../request-key-closure.js";
11
11
  import { FILE_HISTORY_DISABLED_NO_RESTORE, fileHistoryRestoreConflict, fileHistoryRestoreKeysInBody, inheritEnvFieldIssue, singleMemberOffFieldIssue } from "../request-value-closure.js";
12
12
  import * as facts from "../capability-facts.js";
13
- import { buildHooksRefusal, parseHooksConfig, hooksMatcherIssue } from "../hooks/hook-runner.js";
14
- import { judgeRequestWebSearch } from "../plugins/web-search.js";
13
+ import { buildHooksRefusal, buildHooksUrlCredentialRefusal, parseHooksConfig, hooksMatcherIssue, hooksUrlCredentialIssue } from "../hooks/hook-runner.js";
14
+ import { judgeFreshRequestWebSearch } from "../plugins/web-search.js";
15
15
  import { normalizeApproachNotice, skillToolListOk, unknownTaskAgentModelRef, validateTaskAgents } from "../spec-fields.js";
16
16
  import { allowSelectorWarningsOf, skillToolListsOverCap } from "../rule-entry-list.js";
17
17
  import { limitFacts, limitRefusal } from "../limit-refusal.js";
@@ -300,6 +300,21 @@ export function createAdmission(ctx) {
300
300
  sendError(res, 400, "request.field_invalid", refusal.message, { field: refusal.field, detail: refusal.detail });
301
301
  return null;
302
302
  }
303
+ {
304
+ const hooksKeys = hooksKeyIssue(st.hooks, hooksParsed.config);
305
+ if (hooksKeys) {
306
+ sendError(res, 400, "request.body_shape", hooksKeys.message, { unknownKeys: hooksKeys.unknownKeys, unsupportedKeys: hooksKeys.unsupportedKeys });
307
+ return null;
308
+ }
309
+ }
310
+ {
311
+ const hookUrl = hooksUrlCredentialIssue(hooksParsed.config);
312
+ if (hookUrl !== undefined) {
313
+ const refusal = buildHooksUrlCredentialRefusal(hookUrl);
314
+ sendError(res, 400, "request.field_invalid", refusal.message, refusal.facts);
315
+ return null;
316
+ }
317
+ }
303
318
  const toolMatcher = hooksMatcherIssue(hooksParsed.config, taskHooksHonored(deps.config) ? "regex" : "literal");
304
319
  if (toolMatcher !== undefined) {
305
320
  const refusal = buildHooksRefusal(toolMatcher);
@@ -308,9 +323,9 @@ export function createAdmission(ctx) {
308
323
  }
309
324
  }
310
325
  {
311
- const webSearchVerdict = judgeRequestWebSearch(st.webSearch);
326
+ const webSearchVerdict = judgeFreshRequestWebSearch(st.webSearch);
312
327
  if (webSearchVerdict.kind === "malformed") {
313
- sendError(res, 400, "request.field_invalid", webSearchVerdict.issue);
328
+ sendError(res, 400, "request.field_invalid", webSearchVerdict.issue, webSearchVerdict.facts);
314
329
  return null;
315
330
  }
316
331
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 审批扫腿(S-147 切片:`http/server.ts` 5196–5488 逐字搬家,正文一字未改)——两条不经 HTTP 路由的赎回口:
2
+ * 审批扫腿([ref] 切片:`http/server.ts` 5196–5488 逐字搬家,正文一字未改)——两条不经 HTTP 路由的赎回口:
3
3
  * ①`denyExpiredApprovals`([ref] D-D,SLA 到期的 deny-sweep,main.ts 的 reaper 按拍调);
4
4
  * ②`redeemParkedAsk`([ref],live 回决腿的 PARKED 赎回席,装配层接进协调器的晚绑座)。
5
5
  * 两者都走 resume 家族的 `resumeCheckpoint`,所以它们的属主是「谁在无 HTTP 请求的情况下替人做决定」这件事,
@@ -3,7 +3,8 @@ const errText = (e) => redactHead(e instanceof Error ? e.message : String(e), 20
3
3
  import { findParkOrigin } from "../parked-decide.js";
4
4
  import { decodeCheckpointScope } from "../security.js";
5
5
  import { hostDecisionFacts } from "../host-decision.js";
6
- import { APPROVAL_GATE_KINDS } from "../tool-approval.js";
6
+ import {} from "../tool-approval.js";
7
+ import { APPROVAL_GATE_KINDS } from "../approval-content-kind.js";
7
8
  import { createWallClockJumpGuard } from "../wall-clock-jump-guard.js";
8
9
  import { gatedPrincipal, hasServiceAuth } from "./principal-gate.js";
9
10
  import { costQuotaRefusalOf } from "./request-guards.js";
@@ -223,13 +223,17 @@ export declare function storedBodyReplayAnswer(refusal: StoredBodyReplayRefusal,
223
223
  * 封签里装的是那个 JSON 值本身,开封逐字还原。字典位上的容器本身不是字典(串 / 数组 / `null` / 封签形对象)⇒ 整只容器当一个值封。
224
224
  * 于是落盘形里凭据位上**只有本封口铸的封签**,没有哪个值能「原样存下、续跑时被开成别的东西」(调用方送一只封签形对象 ⇒ 存的是再封一层,
225
225
  * 开出来还是那只对象 —— 与新提交腿看到的同一个值)。没有封签器而有值要封 ⇒ 抛 {@link CheckpointCtxUnsealableError}(`no_key_store`,调用方在写之前拒)。
226
- * · **读法记号**(与本文件另两只记号同一条「写的人盖章」):封口铸出的每一份落盘形都带 `credentialSeal: CHECKPOINT_CTX_SEAL_ALG` —— 这一行的凭据位
227
- * **全部**由本封口封过。没有记号的行是 7.134.0 之前的写者写下的:那时没有任何写者封值,所以它凭据位上的封签形对象只可能是调用方原样送来的,不是封签。
226
+ * · **读法记号**(与本文件另两只记号同一条「写的人盖章」):封口铸出的每一份落盘形都带 `credentialSeal: CHECKPOINT_CTX_SEAL_ALG` 与
227
+ * `credentialSlotGeneration`(= 这一行里**带值的**凭据位最新的那一代,最小 1)—— 这一行的凭据位全部由本封口封过,且它用到的位不比这一代新。
228
+ * 代数取「用到的」而不取「本版的」:不带新位值的行与上一代的写者写下的同形,回滚到上一代照读;代数比读者新 ⇒ 这一行**一定**带着读者不认识的位 ⇒ 读者整行拒。没有记号的行是 7.134.0 之前的写者写下的:
229
+ * 那时没有任何写者封值,所以它凭据位上的封签形对象只可能是调用方原样送来的,不是封签。代数缺席的带记号行是 7.134.0 的写者写下的 —— 它封的是第 1 代
230
+ * (闭集每行的 `since`);某一位的 `since` 大于这一行封过的代数 ⇒ 那一位上的值不论长什么样都没被封过(一只恰好长成封签形的明文字典也是明文)。
228
231
  * 记号只在落盘形上(开口交出的开封形里没有它;写回再封时重新盖)。
229
232
  * · **读**:一只开口 {@link openCheckpointCtx},唯一调用方 = 续跑上下文唯一读口 `resume-ctx-read.ts` 的 `readResumeCtx`(读出的 ctx 在任何消费者
230
- * 看到之前已开封)。行带当前记号:凭据位上封签 ⇒ 开(开不开 ⇒ 拒);带 `sealed` 键却不是本闭集的封签形(含将来的 `alg`)⇒ 拒 `unrecognized_seal`;
231
- * 其余任何值 ⇒ 拒 `plaintext`。行没有记号 ⇒ 凭据位上**任何**值(含封签形对象)⇒ 拒 `plaintext`(更早版本写下、M28 还没扫到);记号认不得(将来的格式)⇒
232
- * 凭据位上任何值 ⇒ 拒 `unrecognized_seal`。凭据位上没有值的行不论记号照常开。
233
+ * 看到之前已开封)。逐值判词 = {@link credentialValueReading}(开口与 M28 同一只):行带当前记号、这一位在它封过的那一代里:凭据位上封签 ⇒ 开(开不开 ⇒ 拒);
234
+ * 带 `sealed` 键却不是本闭集的封签形(含将来的 `alg`)⇒ 拒 `unrecognized_seal`;其余任何值 ⇒ 拒 `plaintext`。这一位比行封过的代数新 ⇒ 任何值 ⇒ 拒 `plaintext`。
235
+ * 行没有记号 ⇒ 凭据位上**任何**值(含封签形对象)⇒ 拒 `plaintext`(更早版本写下、M28 还没扫到);记号认不得(将来的格式)⇒
236
+ * 凭据位上任何值 ⇒ 拒 `unrecognized_seal`,凭据位上没有值的行不论记号照常开;代数认不得(比本版新 / 不是正整数)⇒ **整行**拒 `unrecognized_seal`(`field` = 记号位名),不看已知位上有没有值。
233
237
  * **拒** = 读口第四态 `unsealable`(`field` = 哪一个凭据位,`reason` ∈ {@link CHECKPOINT_CTX_UNSEALABLE_REASONS}),各续跑入口答
234
238
  * `409 conflict.checkpoint_ctx_unsealable`(`resume-ctx-read.ts` 的 `resumeCtxUnsealableAnswer`)。**没有**明文回落臂、**没有**静默丢键臂。
235
239
  * · **装配**:`checkpointStore` 在场而封签器缺席 ⇒ 拒启({@link CHECKPOINT_CTX_SEALING_REQUIRED};`createHttpServer` 与起服第 6 段同一句)。
@@ -266,31 +270,47 @@ export interface CheckpointCtxSealing extends CheckpointCtxSealer, CheckpointCtx
266
270
  * **凭据位闭集**(提交体里值为凭据的位置)。路径段 `*` = 那一格容器的**每一个成员**:数组的每一项、字典的每一个值(一只走法,不分容器种类 —— 字典成员的点名形
267
271
  * `field` 是 `.<键>`,数组是 `[<下标>]`)。`map` = 那一格是串值字典,**每一个值**都是凭据(不分哪一键);`value` = 那一格本身是凭据。
268
272
  * 入表判据(一条):请求面上**为承载凭据而设**的字段 —— 静态请求头(MCP http 传输、A2A 对端〔引擎型注:「e.g. an auth bearer」〕、http hook 条目)、
269
- * 交给子进程的 env(MCP stdio 传输、任务 shell 的 `settings.env`)、请求自带的搜索后端钥匙。http hook 的头与另两种静态头同判:契约包的条目形是
273
+ * 交给子进程的 env(MCP stdio 传输、任务 shell 的 `settings.env`、command hook 条目的插件选项)、请求自带的搜索后端钥匙。http hook 的头与另两种静态头同判:契约包的条目形是
270
274
  * `headers: Record<string, string>`、受理面(`parseHooksConfig`)只判条数与字数、`interpolateHookEnvVars` 只换 `$NAME` 引用而字面值原样上 wire ——
271
- * 头值可以就是字面的 `Authorization: Bearer …`。hooks 的形 = 事件名 → 匹配组数组 → 组的 `hooks` 数组 → 条目;只有 `type:"http"` 的条目有 `headers`,
275
+ * 头值可以就是字面的 `Authorization: Bearer …`。插件选项与 `settings.env` 同判:`plugin.options` 的每一个值就是 hook 子进程环境里的 `CLAUDE_PLUGIN_OPTION_<KEY>`
276
+ * (`hooks/command-spawn.ts` 的 `hookPluginEnv`),参照实现也把 sensitive 选项照样交进这一族环境变量 —— 值是不是秘密不是本层能判的,所以整格封,不判值形。
277
+ * hooks 的形 = 事件名 → 匹配组数组 → 组的 `hooks` 数组 → 条目;只有 `type:"http"` 的条目有 `headers`、只有带 `plugin` 的 command 条目有 `plugin.options`,
272
278
  * 别的条目在那一段缺席、走法照常不往下走。**不入表**:命令行 / URL / 工具实参之类自由文本(不是凭据字段;它们里有没有秘密不是本层能判的)。
273
- * 加一位 = 加一行,读写两侧与一次性迁移 M28 共用 {@link mapCredentialSlots} 一只走法,自动覆盖。
279
+ * 加一位 = 加一行,读写两侧与一次性迁移 M28 共用 {@link mapCredentialSlots} 一只走法:写侧与读侧立即覆盖;已落盘的行由 M28 补封 ——
280
+ * 新行的 `since` 取下一代:封口铸的落盘形盖「这一行里带值的位最新的那一代」(`credentialSlotGeneration`),读者据它判那一行用到、封过哪几位 —— 代数更早的行上新位的值一律是明文(记号本身不证明它封过新位)。
281
+ * M28 封的是「读口会答 `plaintext` 的每一个值」({@link credentialValueReading}),所以新加的一位上的明文在带记号的行里也被补封(只在 M28 的窗内;窗外加位要另起迁移)。
274
282
  */
275
283
  export declare const CHECKPOINT_CTX_CREDENTIAL_SLOTS: readonly [{
276
284
  readonly path: readonly ["mcpServers", "*", "transport", "headers"];
277
285
  readonly holds: "map";
286
+ readonly since: 1;
278
287
  }, {
279
288
  readonly path: readonly ["mcpServers", "*", "transport", "env"];
280
289
  readonly holds: "map";
290
+ readonly since: 1;
281
291
  }, {
282
292
  readonly path: readonly ["a2aPeers", "*", "headers"];
283
293
  readonly holds: "map";
294
+ readonly since: 1;
284
295
  }, {
285
296
  readonly path: readonly ["settings", "env"];
286
297
  readonly holds: "map";
298
+ readonly since: 1;
287
299
  }, {
288
300
  readonly path: readonly ["settings", "webSearch", "apiKey"];
289
301
  readonly holds: "value";
302
+ readonly since: 1;
290
303
  }, {
291
304
  readonly path: readonly ["settings", "hooks", "*", "*", "hooks", "*", "headers"];
292
305
  readonly holds: "map";
306
+ readonly since: 1;
307
+ }, {
308
+ readonly path: readonly ["settings", "hooks", "*", "*", "hooks", "*", "plugin", "options"];
309
+ readonly holds: "map";
310
+ readonly since: 2;
293
311
  }];
312
+ /** 本版闭集的代数 = 表里最大的 `since`(读者认得的最新一代)。落盘形的 `credentialSlotGeneration` 不大于它;大于它的行是更新的写者带着本版不认识的位写下的。 */
313
+ export declare const CHECKPOINT_CTX_CREDENTIAL_GENERATION: number;
294
314
  /** 开不开 / 封不了的成因(闭集):`no_key_store` = 这台副本没有封签器(没有保管店);`key_not_held` = 封它的那把钥匙不在这台副本的保管店里
295
315
  * (多副本不共享 `<数据根>/sealed-key/`,或保管目录被换过);`unopenable` = 钥匙在、开不开(密文坏 / 不是这一行封的 / 不是停驻行信封);
296
316
  * `plaintext` = 凭据位上是明文(更早版本的写者);`unrecognized_seal` = 带 `sealed` 键却不是本闭集的封签形(含将来的 `alg`)。 */
@@ -312,6 +332,8 @@ export type StoredCheckpointCtx = Omit<CheckpointCtx, "body"> & {
312
332
  readonly [key: string]: unknown;
313
333
  };
314
334
  readonly credentialSeal?: typeof CHECKPOINT_CTX_SEAL_ALG;
335
+ /** 这一行的写者封过的闭集代数(读法记号的另一半;缺席 + 带 `credentialSeal` = 7.134.0 的写者 = 第 1 代)。 */
336
+ readonly credentialSlotGeneration?: number;
315
337
  };
316
338
  declare const sealedCheckpointCtxBrand: unique symbol;
317
339
  /**
@@ -323,7 +345,7 @@ export type SealedCheckpointCtx = StoredCheckpointCtx & {
323
345
  readonly [sealedCheckpointCtxBrand]: true;
324
346
  };
325
347
  /** 装配期拒启的那一句(`createHttpServer` 与起服第 6 段同调;一句、一个出口)。 */
326
- export declare const CHECKPOINT_CTX_SEALING_REQUIRED = "a durable checkpoint store is wired but checkpointCtxSealing is not: suspended tasks keep the request's credentials (MCP / A2A headers and env values, settings.env, settings.webSearch.apiKey, http hook headers) in their resume context, and they are stored sealed or not at all \u2014 give the service a sealed-key store for them (this service builds it under <data root>/sealed-key/checkpoint-ctx-keys/ at boot; a failure there is the earlier checkpoint_ctx_sealing_unavailable warning \u2014 make that directory creatable and chmod-able by the service, or repair or remove a key file there whose public and private halves do not belong together), or, when embedding, pass checkpointCtxSealing: await ensureCheckpointCtxSealing(sealedKeyDir); refusing to start rather than write credentials in plaintext";
348
+ export declare const CHECKPOINT_CTX_SEALING_REQUIRED = "a durable checkpoint store is wired but checkpointCtxSealing is not: suspended tasks keep the request's credentials (MCP / A2A headers and env values, settings.env, settings.webSearch.apiKey, http hook headers, command hook plugin options) in their resume context, and they are stored sealed or not at all \u2014 give the service a sealed-key store for them (this service builds it under <data root>/sealed-key/checkpoint-ctx-keys/ at boot; a failure there is the earlier checkpoint_ctx_sealing_unavailable warning \u2014 make that directory creatable and chmod-able by the service, or repair or remove a key file there whose public and private halves do not belong together), or, when embedding, pass checkpointCtxSealing: await ensureCheckpointCtxSealing(sealedKeyDir); refusing to start rather than write credentials in plaintext";
327
349
  /** 封签形的判官(恰三键、三值皆串、`alg` 是本闭集那一个词)。 */
328
350
  export declare function isSealedCheckpointValue(v: unknown): v is SealedCheckpointValue;
329
351
  /**
@@ -343,7 +365,7 @@ export type OpenedCheckpointCtx = {
343
365
  };
344
366
  /**
345
367
  * **开口**(读的一侧唯一的一只;唯一调用方 = 续跑上下文读口 `readResumeCtx`):落盘形 ⇒ 开封形。`opener` 缺席 = 这台副本没有保管店(体里有封签就
346
- * `no_key_store`;没有凭据的行照常开)。判词见本段头注。
368
+ * `no_key_store`;没有凭据的行照常开)。判词见本段头注与 {@link credentialValueReading}。
347
369
  */
348
370
  export declare function openCheckpointCtx(stored: StoredCheckpointCtx, opener: CheckpointCtxOpener | undefined, sessionId: string): OpenedCheckpointCtx;
349
371
  /**
@@ -354,9 +376,13 @@ export declare function openCheckpointCtx(stored: StoredCheckpointCtx, opener: C
354
376
  export declare function sealedCredentialFieldOf(stored: unknown): string | undefined;
355
377
  /**
356
378
  * 🔴 **一次性迁移 M28 的行改写**(窗与删法见 `plugins/one-time-migrations.ts` 登记表 M28;编排 = `checkpoint-ctx-seal-m28.ts`):一行存量 ctx
357
- * (持久化 JSON,不信型面)**没有读法记号**(= 7.134.0 之前的写者写下的)⇒ 凭据位上的**每一个值**(含调用方原样送来的封签形对象)用同一只封口封好、盖记号 ——
358
- * 与写侧 {@link sealCheckpointCtx} 同一条规则。带记号的行(本版写下的,或本条已改写过的)、记号认不得的行 ⇒ `undefined`(不写:第二跑零命中;认不得的留给读口拒);
359
- * 凭据位上没有值 ⇒ `undefined`(不写);体不是对象 ⇒ `undefined`(读口自己的形判接住)。其余位(另两只记号、写者版本、非凭据字段)原样。
379
+ * (持久化 JSON,不信型面)凭据位上**读口会答 `plaintext` 的每一个值**({@link credentialValueReading},与开口同一只判词)用同一只封口封好、盖记号 ——
380
+ * 与写侧 {@link sealCheckpointCtx} 同一条规则。两种存量行落在这一条里:
381
+ * · 没有读法记号的行(7.134.0 之前的写者)—— 每一个值都是 `plaintext`(含调用方原样送来的封签形对象)⇒ 全封;
382
+ * · 带当前记号、而某一位比行封过的代数新的行(7.134.0 的写者封第 1 代,没封第 2 代的 `plugin.options`)—— 那一位上的值不论长什么样都是明文 ⇒ 封
383
+ * (恰好长成封签形的选项字典按字典容器整只封,开出来还是那只字典);行封过的那一代里的封签不动。改写后的行盖「带值的位最新的那一代」(与封口同一条)。
384
+ * 读口会答 `seal` / `unrecognized_seal` 的值不动(认不得的留给读口拒);一个值都没封 ⇒ `undefined`(不写:第二跑零命中;记号认不得的行因此一个字节不动);
385
+ * 体不是对象 ⇒ `undefined`(读口自己的形判接住)。其余位(另两只记号、写者版本、非凭据字段)原样。
360
386
  */
361
387
  export declare function sealStoredCheckpointCtxM28(stored: object, sealer: CheckpointCtxSealer, sessionId: string): {
362
388
  readonly ctx: SealedCheckpointCtx;