@sema-agent/server 7.131.0 → 7.133.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 (509) hide show
  1. package/MIGRATION.md +575 -0
  2. package/README.md +12 -9
  3. package/README.zh-CN.md +9 -6
  4. package/USAGE.md +326 -98
  5. package/deploy/sema-up/README.md +19 -1
  6. package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -2
  7. package/deploy/sema-up/chart/templates/server.yaml +5 -2
  8. package/deploy/sema-up/stack/compose.yaml +3 -0
  9. package/deploy/sema-up/stack/sema-stack-cluster.yaml +4 -2
  10. package/dist/adoption/plan.d.ts +3 -2
  11. package/dist/adoption/plan.js +7 -5
  12. package/dist/adoption/runner.js +3 -10
  13. package/dist/adoption/sql.d.ts +3 -2
  14. package/dist/adoption/sql.js +3 -5
  15. package/dist/adoption/wire.d.ts +4 -1
  16. package/dist/adoption/wire.js +1 -0
  17. package/dist/approval-ask-audit-store.d.ts +31 -13
  18. package/dist/approval-ask-audit-store.js +272 -74
  19. package/dist/approval-ask-machine.d.ts +15 -0
  20. package/dist/approval-ask-machine.js +6 -0
  21. package/dist/approval-ask-retention.d.ts +136 -0
  22. package/dist/approval-ask-retention.js +102 -0
  23. package/dist/approval-card.d.ts +82 -20
  24. package/dist/approval-card.js +46 -16
  25. package/dist/approval-deny-reasons.d.ts +1 -1
  26. package/dist/approval.d.ts +9 -0
  27. package/dist/approval.js +24 -3
  28. package/dist/audit.d.ts +33 -19
  29. package/dist/audit.js +12 -16
  30. package/dist/auth-bridge.d.ts +4 -0
  31. package/dist/auth-bridge.js +10 -11
  32. package/dist/bake-runner/main.js +3 -2
  33. package/dist/boot/deferred-sandbox-path-env.js +1 -1
  34. package/dist/boot/deployment-mods.d.ts +31 -0
  35. package/dist/boot/deployment-mods.js +26 -0
  36. package/dist/boot/execution-env.d.ts +1 -1
  37. package/dist/boot/execution-env.js +27 -12
  38. package/dist/boot/execution-lane.js +11 -0
  39. package/dist/boot/leader.js +2 -0
  40. package/dist/boot/memory-boundary.d.ts +2 -2
  41. package/dist/boot/memory-boundary.js +2 -2
  42. package/dist/boot/memory-consolidation.d.ts +5 -4
  43. package/dist/boot/memory-consolidation.js +7 -6
  44. package/dist/boot/org-delivery.d.ts +28 -0
  45. package/dist/boot/org-delivery.js +20 -0
  46. package/dist/boot/read-deny-anchor-audit.d.ts +17 -0
  47. package/dist/boot/read-deny-anchor-audit.js +36 -0
  48. package/dist/boot/reapers.d.ts +3 -0
  49. package/dist/boot/reapers.js +21 -1
  50. package/dist/boot/resolve-spec.d.ts +4 -5
  51. package/dist/boot/resolve-spec.js +74 -123
  52. package/dist/boot/runner-deps.d.ts +19 -8
  53. package/dist/boot/runner-deps.js +15 -2
  54. package/dist/boot/session-faces.d.ts +2 -7
  55. package/dist/boot/session-faces.js +4 -2
  56. package/dist/boot/stage-02-web-admin-pull.js +4 -1
  57. package/dist/boot/stage-03-store-backend.d.ts +1 -1
  58. package/dist/boot/stage-03-store-backend.js +2 -2
  59. package/dist/boot/stage-04-stores.d.ts +1 -1
  60. package/dist/boot/stage-05-execution-env.d.ts +4 -4
  61. package/dist/boot/stage-05-execution-env.js +7 -10
  62. package/dist/boot/stage-06-runners.d.ts +4 -2
  63. package/dist/boot/stage-06-runners.js +11 -7
  64. package/dist/boot/stage-07-capability-layer.d.ts +4 -2
  65. package/dist/boot/stage-07-capability-layer.js +27 -6
  66. package/dist/boot/stage-08-reapers.d.ts +4 -2
  67. package/dist/boot/stage-08-reapers.js +2 -2
  68. package/dist/boot/stage-09-leader.d.ts +6 -9
  69. package/dist/boot/stage-10-http-server.d.ts +6 -9
  70. package/dist/boot/stage-10-http-server.js +7 -9
  71. package/dist/boot/stores.d.ts +1 -1
  72. package/dist/boot/stores.js +7 -8
  73. package/dist/boot/web-admin.d.ts +4 -3
  74. package/dist/boot/web-admin.js +186 -98
  75. package/dist/boot/workflow-orchestration.d.ts +2 -0
  76. package/dist/boot/workflow-orchestration.js +2 -1
  77. package/dist/brain.js +25 -25
  78. package/dist/breaker-key.d.ts +6 -0
  79. package/dist/breaker-key.js +29 -0
  80. package/dist/budget.js +5 -4
  81. package/dist/caller-text-echo.d.ts +23 -0
  82. package/dist/caller-text-echo.js +21 -0
  83. package/dist/capabilities/brand-identity.d.ts +26 -0
  84. package/dist/capabilities/brand-identity.js +27 -0
  85. package/dist/capabilities/center-plugins.d.ts +7 -0
  86. package/dist/capabilities/center-plugins.js +1 -1
  87. package/dist/capabilities/center-prompts.d.ts +32 -59
  88. package/dist/capabilities/center-prompts.js +18 -32
  89. package/dist/capabilities/composite-members.d.ts +1 -1
  90. package/dist/capabilities/composite-members.js +1 -1
  91. package/dist/capabilities/engine-capabilities.js +2 -1
  92. package/dist/capabilities/execution-lane.js +2 -2
  93. package/dist/capabilities/hands-lane.d.ts +30 -6
  94. package/dist/capabilities/hands-lane.js +11 -1
  95. package/dist/capabilities/mcp-probe.d.ts +48 -3
  96. package/dist/capabilities/mcp-probe.js +47 -135
  97. package/dist/capabilities/scenarios.d.ts +95 -45
  98. package/dist/capabilities/scenarios.js +53 -38
  99. package/dist/capabilities/skills.d.ts +19 -4
  100. package/dist/capabilities/skills.js +30 -10
  101. package/dist/capability-facts.d.ts +34 -4
  102. package/dist/capability-facts.js +28 -2
  103. package/dist/center-config-tier.d.ts +69 -0
  104. package/dist/center-config-tier.js +42 -0
  105. package/dist/checkpoint-identity.d.ts +16 -0
  106. package/dist/checkpoint-identity.js +19 -0
  107. package/dist/config-catalog.d.ts +17 -10
  108. package/dist/config-catalog.js +47 -32
  109. package/dist/config-d-migration.d.ts +3 -1
  110. package/dist/config-d-migration.js +2 -2
  111. package/dist/config-dir-trust.d.ts +114 -0
  112. package/dist/config-dir-trust.js +388 -0
  113. package/dist/config-invariants.d.ts +18 -5
  114. package/dist/config-invariants.js +35 -3
  115. package/dist/config-lkg.d.ts +9 -9
  116. package/dist/config-lkg.js +20 -4
  117. package/dist/config-provider.d.ts +9 -2
  118. package/dist/config-provider.js +18 -6
  119. package/dist/config-types.d.ts +75 -20
  120. package/dist/config-types.js +8 -0
  121. package/dist/config.d.ts +13 -0
  122. package/dist/config.js +137 -62
  123. package/dist/delegated-session-owner.d.ts +185 -0
  124. package/dist/delegated-session-owner.js +119 -0
  125. package/dist/device-protocol.d.ts +5 -3
  126. package/dist/device-protocol.js +1 -1
  127. package/dist/device-ws-hub.js +21 -2
  128. package/dist/device-ws-protocol.d.ts +70 -6
  129. package/dist/device-ws-protocol.js +50 -22
  130. package/dist/elicitation.js +3 -2
  131. package/dist/entry-problems.d.ts +34 -0
  132. package/dist/entry-problems.js +14 -0
  133. package/dist/env-name-allowlist-knobs.d.ts +12 -2
  134. package/dist/env-name-allowlist-knobs.js +5 -4
  135. package/dist/exec-bounds.d.ts +15 -3
  136. package/dist/exec-bounds.js +4 -0
  137. package/dist/execution-lane-caps.d.ts +56 -10
  138. package/dist/execution-lane-caps.js +50 -0
  139. package/dist/field-conflict.d.ts +43 -0
  140. package/dist/field-conflict.js +20 -0
  141. package/dist/fleet/fleet-bus.d.ts +80 -6
  142. package/dist/fleet/fleet-bus.js +41 -9
  143. package/dist/hooks/classic-stations.d.ts +91 -0
  144. package/dist/hooks/classic-stations.js +27 -0
  145. package/dist/hooks/command-spawn.d.ts +57 -0
  146. package/dist/hooks/command-spawn.js +139 -0
  147. package/dist/hooks/hook-llm.d.ts +8 -5
  148. package/dist/hooks/hook-llm.js +79 -36
  149. package/dist/hooks/hook-runner.d.ts +349 -95
  150. package/dist/hooks/hook-runner.js +855 -568
  151. package/dist/hooks/hook-source.d.ts +44 -0
  152. package/dist/hooks/hook-source.js +40 -0
  153. package/dist/http/active-run-conflict.d.ts +5 -13
  154. package/dist/http/active-run-conflict.js +17 -27
  155. package/dist/http/admission.d.ts +8 -2
  156. package/dist/http/admission.js +188 -101
  157. package/dist/http/approval-sweeps.js +99 -21
  158. package/dist/http/caller-trust.d.ts +77 -0
  159. package/dist/http/caller-trust.js +143 -0
  160. package/dist/http/checkpoint-ctx.d.ts +41 -24
  161. package/dist/http/checkpoint-ctx.js +23 -16
  162. package/dist/http/claimed-run.d.ts +14 -0
  163. package/dist/http/claimed-run.js +15 -0
  164. package/dist/http/device-placement.d.ts +2 -4
  165. package/dist/http/device-placement.js +7 -11
  166. package/dist/http/dispatch.d.ts +0 -4
  167. package/dist/http/dispatch.js +15 -13
  168. package/dist/http/durable-run-leg.d.ts +6 -33
  169. package/dist/http/durable-run-leg.js +36 -10
  170. package/dist/http/health-self-report.d.ts +7 -5
  171. package/dist/http/health-self-report.js +4 -18
  172. package/dist/http/owner-access.d.ts +56 -0
  173. package/dist/http/owner-access.js +42 -0
  174. package/dist/http/principal-gate.d.ts +70 -28
  175. package/dist/http/principal-gate.js +61 -15
  176. package/dist/http/readiness.d.ts +11 -5
  177. package/dist/http/readiness.js +10 -3
  178. package/dist/http/refusal-body.d.ts +21 -0
  179. package/dist/http/refusal-body.js +4 -0
  180. package/dist/http/request-guards.d.ts +43 -23
  181. package/dist/http/request-guards.js +53 -17
  182. package/dist/http/resume-ctx-read.d.ts +2 -5
  183. package/dist/http/resume-ctx-read.js +7 -4
  184. package/dist/http/resume-legs.d.ts +28 -4
  185. package/dist/http/resume-legs.js +169 -91
  186. package/dist/http/retired-service-deps.d.ts +43 -0
  187. package/dist/http/retired-service-deps.js +18 -0
  188. package/dist/http/route-ctx.d.ts +44 -28
  189. package/dist/http/route-ctx.js +4 -0
  190. package/dist/http/route-table.js +2 -0
  191. package/dist/http/routes/a2a-serve.js +3 -4
  192. package/dist/http/routes/admin-config-refresh.js +1 -1
  193. package/dist/http/routes/admin-drain.js +1 -1
  194. package/dist/http/routes/admin-memory-optout.js +5 -1
  195. package/dist/http/routes/adoption.js +2 -9
  196. package/dist/http/routes/approvals-assistant.js +49 -48
  197. package/dist/http/routes/background.js +3 -2
  198. package/dist/http/routes/capabilities.js +21 -5
  199. package/dist/http/routes/config-catalog.d.ts +3 -3
  200. package/dist/http/routes/config-catalog.js +1 -1
  201. package/dist/http/routes/devices.js +3 -17
  202. package/dist/http/routes/diagnostics.js +6 -2
  203. package/dist/http/routes/images.js +6 -7
  204. package/dist/http/routes/leader.js +1 -8
  205. package/dist/http/routes/mcp-reconnect.d.ts +1 -1
  206. package/dist/http/routes/mcp-reconnect.js +3 -2
  207. package/dist/http/routes/memory-bundle.js +1 -1
  208. package/dist/http/routes/memory-compliance.js +1 -1
  209. package/dist/http/routes/memory-consolidation.js +1 -1
  210. package/dist/http/routes/memory-origin.js +1 -1
  211. package/dist/http/routes/memory-policy.d.ts +1 -1
  212. package/dist/http/routes/memory-policy.js +3 -2
  213. package/dist/http/routes/notify-wake.js +8 -21
  214. package/dist/http/routes/observability.js +2 -2
  215. package/dist/http/routes/principal-inbox.d.ts +39 -0
  216. package/dist/http/routes/principal-inbox.js +76 -0
  217. package/dist/http/routes/retention-ops.js +2 -9
  218. package/dist/http/routes/rules.js +5 -18
  219. package/dist/http/routes/runs.d.ts +5 -0
  220. package/dist/http/routes/runs.js +34 -107
  221. package/dist/http/routes/session-sync.js +15 -26
  222. package/dist/http/routes/sessions.js +30 -40
  223. package/dist/http/routes/shared-memory.js +2 -13
  224. package/dist/http/routes/side-query.js +8 -7
  225. package/dist/http/routes/tasks.js +67 -21
  226. package/dist/http/routes/workflows.d.ts +351 -0
  227. package/dist/http/routes/workflows.js +153 -119
  228. package/dist/http/send.d.ts +33 -10
  229. package/dist/http/send.js +21 -4
  230. package/dist/http/server.d.ts +27 -18
  231. package/dist/http/server.js +34 -6
  232. package/dist/http/stored-body-replay.js +17 -4
  233. package/dist/http/submit-ctx.d.ts +25 -0
  234. package/dist/http/submit-ctx.js +40 -0
  235. package/dist/http/submit-replay.d.ts +4 -3
  236. package/dist/http/submit-replay.js +5 -4
  237. package/dist/http/wire-types.d.ts +11 -8
  238. package/dist/index.d.ts +2 -2
  239. package/dist/index.js +1 -2
  240. package/dist/lane-home-probe.d.ts +112 -0
  241. package/dist/lane-home-probe.js +101 -0
  242. package/dist/leader/endpoint.d.ts +4 -1
  243. package/dist/leader/endpoint.js +11 -10
  244. package/dist/limit-refusal.d.ts +59 -0
  245. package/dist/limit-refusal.js +15 -0
  246. package/dist/main.js +1 -1
  247. package/dist/mcp-assertion-header.d.ts +32 -19
  248. package/dist/mcp-assertion-header.js +10 -9
  249. package/dist/mcp-tool-faces.d.ts +5 -0
  250. package/dist/mcp-tool-faces.js +6 -4
  251. package/dist/memory-project-layer.d.ts +37 -0
  252. package/dist/memory-project-layer.js +46 -0
  253. package/dist/memory-scope.d.ts +24 -17
  254. package/dist/memory-scope.js +24 -8
  255. package/dist/memory-sync-client.d.ts +27 -13
  256. package/dist/memory-sync-client.js +107 -18
  257. package/dist/model-entry-refusal.d.ts +9 -1
  258. package/dist/model-entry-refusal.js +6 -1
  259. package/dist/model-plane-face.d.ts +51 -0
  260. package/dist/model-plane-face.js +24 -0
  261. package/dist/model-provider.d.ts +44 -12
  262. package/dist/model-provider.js +21 -2
  263. package/dist/model-route-endpoint.d.ts +9 -12
  264. package/dist/model-route-endpoint.js +8 -11
  265. package/dist/model-route-env.d.ts +22 -0
  266. package/dist/model-route-env.js +2 -0
  267. package/dist/model-route-gap.d.ts +60 -30
  268. package/dist/model-route-gap.js +21 -15
  269. package/dist/observability/corrupt-read-seat.d.ts +7 -0
  270. package/dist/observability/corrupt-read-seat.js +9 -0
  271. package/dist/observability/cost-taxonomy.d.ts +7 -7
  272. package/dist/observability/err-text.d.ts +6 -0
  273. package/dist/observability/err-text.js +18 -4
  274. package/dist/observability/fail-open.d.ts +76 -14
  275. package/dist/observability/fail-open.js +76 -14
  276. package/dist/observability/metrics.js +4 -1
  277. package/dist/observability/prompt-manifest.d.ts +33 -82
  278. package/dist/observability/prompt-manifest.js +122 -17
  279. package/dist/observability/run-terminal.js +14 -6
  280. package/dist/observability/secret-env-scrub.d.ts +13 -1
  281. package/dist/observability/secret-env-scrub.js +13 -1
  282. package/dist/observability/tool-trace.d.ts +16 -21
  283. package/dist/observability/tool-trace.js +58 -49
  284. package/dist/operator-ask.d.ts +10 -0
  285. package/dist/operator-ask.js +3 -0
  286. package/dist/orchestration/workflow-agent-session-index.d.ts +12 -12
  287. package/dist/orchestration/workflow-agent-session-index.js +9 -13
  288. package/dist/orchestration/workflow-completion-inbox.d.ts +42 -15
  289. package/dist/orchestration/workflow-completion-inbox.js +13 -0
  290. package/dist/orchestration/workflow-notify-journal.d.ts +13 -32
  291. package/dist/orchestration/workflow-notify-journal.js +27 -34
  292. package/dist/orchestration/workflow-park-decision.d.ts +89 -0
  293. package/dist/orchestration/workflow-park-decision.js +118 -0
  294. package/dist/org-delivery-gate.d.ts +81 -0
  295. package/dist/org-delivery-gate.js +59 -0
  296. package/dist/panel-tool-names.d.ts +23 -0
  297. package/dist/panel-tool-names.js +8 -0
  298. package/dist/parked-decide.d.ts +39 -6
  299. package/dist/parked-decide.js +98 -51
  300. package/dist/parked-revive-surface.d.ts +9 -2
  301. package/dist/parked-revive-surface.js +11 -8
  302. package/dist/per-task-image.d.ts +7 -1
  303. package/dist/per-task-image.js +3 -3
  304. package/dist/permission-rule-list.d.ts +1 -1
  305. package/dist/permission-rule-list.js +2 -2
  306. package/dist/plain-string-record.d.ts +25 -0
  307. package/dist/plain-string-record.js +32 -0
  308. package/dist/plugins/approval-ask-store-file.d.ts +16 -1
  309. package/dist/plugins/approval-ask-store-file.js +21 -0
  310. package/dist/plugins/approval-ask-store-memory.d.ts +18 -1
  311. package/dist/plugins/approval-ask-store-memory.js +34 -2
  312. package/dist/plugins/approval-ask-store-sql.d.ts +25 -0
  313. package/dist/plugins/approval-ask-store-sql.js +37 -1
  314. package/dist/plugins/blob-backend.d.ts +83 -15
  315. package/dist/plugins/blob-backend.js +68 -15
  316. package/dist/plugins/breaker-state-sql.d.ts +2 -2
  317. package/dist/plugins/breaker-state-sql.js +4 -4
  318. package/dist/plugins/caching-session-store.d.ts +3 -0
  319. package/dist/plugins/caching-session-store.js +3 -0
  320. package/dist/plugins/checkpoint-store-sql.d.ts +28 -4
  321. package/dist/plugins/checkpoint-store-sql.js +59 -28
  322. package/dist/plugins/file-history-store-sql.d.ts +5 -2
  323. package/dist/plugins/file-history-store-sql.js +3 -1
  324. package/dist/plugins/file-run-store.d.ts +5 -13
  325. package/dist/plugins/file-run-store.js +9 -0
  326. package/dist/plugins/fork-routing-session-store.d.ts +9 -1
  327. package/dist/plugins/fork-routing-session-store.js +12 -1
  328. package/dist/plugins/host-platform.d.ts +2 -0
  329. package/dist/plugins/host-platform.js +2 -1
  330. package/dist/plugins/k8s-bg-scripts.d.ts +11 -0
  331. package/dist/plugins/k8s-bg-scripts.js +22 -0
  332. package/dist/plugins/local-checkpoint-store.d.ts +2 -0
  333. package/dist/plugins/local-checkpoint-store.js +11 -3
  334. package/dist/plugins/local-session-store.d.ts +1 -1
  335. package/dist/plugins/local-session-store.js +1 -1
  336. package/dist/plugins/local-session-window.d.ts +39 -0
  337. package/dist/plugins/local-session-window.js +54 -0
  338. package/dist/plugins/mailbox-recipient-lifecycle.d.ts +3 -2
  339. package/dist/plugins/mailbox-store-sql.d.ts +30 -48
  340. package/dist/plugins/mailbox-store-sql.js +77 -52
  341. package/dist/plugins/memory-embedder-fingerprint.js +2 -1
  342. package/dist/plugins/memory-run-store.d.ts +5 -13
  343. package/dist/plugins/memory-run-store.js +8 -0
  344. package/dist/plugins/one-time-migrations.d.ts +245 -93
  345. package/dist/plugins/one-time-migrations.js +668 -207
  346. package/dist/plugins/org-delivery-quota-store.d.ts +123 -0
  347. package/dist/plugins/org-delivery-quota-store.js +228 -0
  348. package/dist/plugins/permission-rule-store-sql.d.ts +13 -7
  349. package/dist/plugins/permission-rule-store-sql.js +4 -18
  350. package/dist/plugins/pg-pool.js +39 -7
  351. package/dist/plugins/pg-session-storage.d.ts +20 -8
  352. package/dist/plugins/pg-session-storage.js +34 -21
  353. package/dist/plugins/remote-env-adb.d.ts +12 -12
  354. package/dist/plugins/remote-env-adb.js +21 -6
  355. package/dist/plugins/remote-env-device.js +3 -0
  356. package/dist/plugins/remote-env-e2b.d.ts +1 -1
  357. package/dist/plugins/remote-env-e2b.js +21 -9
  358. package/dist/plugins/remote-env-host.d.ts +9 -9
  359. package/dist/plugins/remote-env-host.js +10 -32
  360. package/dist/plugins/remote-env-k8s.d.ts +103 -38
  361. package/dist/plugins/remote-env-k8s.js +288 -95
  362. package/dist/plugins/remote-env-local-docker.d.ts +27 -13
  363. package/dist/plugins/remote-env-local-docker.js +82 -11
  364. package/dist/plugins/remote-env-ssh.d.ts +21 -12
  365. package/dist/plugins/remote-env-ssh.js +117 -5
  366. package/dist/plugins/remote-shell.d.ts +0 -1
  367. package/dist/plugins/remote-shell.js +1 -2
  368. package/dist/plugins/retention-store-sql.js +6 -2
  369. package/dist/plugins/run-store-sql.d.ts +16 -14
  370. package/dist/plugins/run-store-sql.js +22 -2
  371. package/dist/plugins/schema-consistency.d.ts +54 -0
  372. package/dist/plugins/schema-consistency.js +52 -0
  373. package/dist/plugins/schema-indexes.js +2 -0
  374. package/dist/plugins/send-user-file.js +2 -2
  375. package/dist/plugins/session-epoch-anchor.d.ts +39 -0
  376. package/dist/plugins/session-epoch-anchor.js +22 -0
  377. package/dist/plugins/session-store.d.ts +18 -8
  378. package/dist/plugins/session-store.js +15 -4
  379. package/dist/plugins/shared-memory-store-sql.d.ts +9 -3
  380. package/dist/plugins/shared-memory-store-sql.js +5 -16
  381. package/dist/plugins/sql-driver.d.ts +205 -1
  382. package/dist/plugins/sql-driver.js +325 -13
  383. package/dist/plugins/sql-errors.d.ts +64 -0
  384. package/dist/plugins/sql-errors.js +57 -0
  385. package/dist/plugins/store-backend.d.ts +36 -1
  386. package/dist/plugins/store-backend.js +42 -15
  387. package/dist/plugins/store-contracts.d.ts +42 -0
  388. package/dist/plugins/store-contracts.js +1 -0
  389. package/dist/plugins/tidb-pool.d.ts +6 -1
  390. package/dist/plugins/tidb-pool.js +44 -10
  391. package/dist/plugins/tidb-session-storage.d.ts +8 -11
  392. package/dist/plugins/tidb-session-storage.js +6 -16
  393. package/dist/plugins/tidb-session-store.d.ts +24 -4
  394. package/dist/plugins/tidb-session-store.js +29 -5
  395. package/dist/plugins/workflow-journal-store-sql.d.ts +73 -19
  396. package/dist/plugins/workflow-journal-store-sql.js +19 -6
  397. package/dist/plugins/workflow-run-store-sql.d.ts +30 -8
  398. package/dist/plugins/workflow-run-store-sql.js +50 -9
  399. package/dist/posture-source.d.ts +18 -10
  400. package/dist/posture-source.js +4 -1
  401. package/dist/project-identity.d.ts +45 -6
  402. package/dist/project-identity.js +162 -8
  403. package/dist/project-layer-key.d.ts +28 -0
  404. package/dist/project-layer-key.js +29 -0
  405. package/dist/prompts-domain-validate.d.ts +17 -61
  406. package/dist/prompts-domain-validate.js +9 -119
  407. package/dist/question.js +3 -2
  408. package/dist/read-deny-entry.d.ts +25 -0
  409. package/dist/read-deny-entry.js +12 -0
  410. package/dist/read-face-posture.d.ts +37 -11
  411. package/dist/read-face-posture.js +32 -3
  412. package/dist/request-key-closure.d.ts +9 -2
  413. package/dist/request-key-closure.js +11 -5
  414. package/dist/request-value-closure.d.ts +5 -0
  415. package/dist/request-value-closure.js +11 -3
  416. package/dist/rule-entry-list.d.ts +38 -11
  417. package/dist/rule-entry-list.js +106 -30
  418. package/dist/rules-consent.js +3 -4
  419. package/dist/run-acceptance.d.ts +19 -3
  420. package/dist/run-acceptance.js +13 -1
  421. package/dist/run-local.js +54 -24
  422. package/dist/runs.d.ts +15 -8
  423. package/dist/runs.js +35 -1
  424. package/dist/runtime-caps-resolver.d.ts +16 -6
  425. package/dist/runtime-caps-resolver.js +18 -5
  426. package/dist/sandbox-pkg-source.d.ts +19 -1
  427. package/dist/sandbox-pkg-source.js +29 -7
  428. package/dist/security.d.ts +87 -9
  429. package/dist/security.js +52 -9
  430. package/dist/server-secret-env.d.ts +44 -18
  431. package/dist/server-secret-env.js +49 -8
  432. package/dist/session-error-wire.d.ts +19 -2
  433. package/dist/session-error-wire.js +5 -1
  434. package/dist/session-incarnation.d.ts +15 -5
  435. package/dist/session-incarnation.js +16 -9
  436. package/dist/session-titled-frame.d.ts +33 -0
  437. package/dist/session-titled-frame.js +4 -0
  438. package/dist/session-titler.d.ts +9 -1
  439. package/dist/session-titler.js +27 -6
  440. package/dist/spec-fields.d.ts +28 -16
  441. package/dist/spec-fields.js +66 -54
  442. package/dist/sql-engine-posture.d.ts +31 -4
  443. package/dist/sql-engine-posture.js +36 -1
  444. package/dist/stored-request-tool-axes-m19.d.ts +19 -4
  445. package/dist/stored-request-tool-axes-m19.js +30 -2
  446. package/dist/task-a2a.d.ts +9 -1
  447. package/dist/task-a2a.js +73 -47
  448. package/dist/task-cwd.d.ts +1 -1
  449. package/dist/task-mcp.d.ts +46 -58
  450. package/dist/task-mcp.js +82 -107
  451. package/dist/task-settings.d.ts +95 -108
  452. package/dist/task-settings.js +77 -98
  453. package/dist/text-bidi.d.ts +1 -48
  454. package/dist/text-bidi.js +3 -5
  455. package/dist/tighten-only-seats.d.ts +150 -0
  456. package/dist/tighten-only-seats.js +196 -0
  457. package/dist/tool-approval.d.ts +304 -88
  458. package/dist/tool-approval.js +623 -239
  459. package/dist/trace/core-keyset-guard.d.ts +122 -20
  460. package/dist/trace/engine-notice-wire.d.ts +11 -3
  461. package/dist/trace/engine-notice-wire.js +8 -1
  462. package/dist/trace/exit-seat.d.ts +28 -0
  463. package/dist/trace/exit-seat.js +76 -0
  464. package/dist/trace/ledger-events.d.ts +6 -3
  465. package/dist/trace/ledger-sink.js +4 -1
  466. package/dist/trace/model-segment.js +1 -1
  467. package/dist/trace/project.d.ts +98 -17
  468. package/dist/trace/project.js +98 -50
  469. package/dist/trace/projection-table.d.ts +100 -0
  470. package/dist/trace/projection-table.js +130 -0
  471. package/dist/trace/redact.d.ts +54 -0
  472. package/dist/trace/redact.js +778 -152
  473. package/dist/trace/self-minted-wire.d.ts +345 -1
  474. package/dist/trace/self-minted-wire.js +117 -1
  475. package/dist/trace/wire-projection-faces.d.ts +377 -3
  476. package/dist/trace/wire-projection-faces.js +164 -1
  477. package/dist/url-refusal.js +2 -0
  478. package/dist/web-admin-client/apply-effective.d.ts +12 -0
  479. package/dist/web-admin-client/apply-effective.js +56 -5
  480. package/dist/web-admin-client/candidate-gate.d.ts +6 -6
  481. package/dist/web-admin-client/candidate-gate.js +3 -3
  482. package/dist/web-admin-client/facade.d.ts +1 -1
  483. package/dist/web-admin-client/facade.js +1 -1
  484. package/dist/web-admin-client/http-client.js +0 -6
  485. package/dist/web-admin-client/read-face.js +5 -9
  486. package/dist/web-admin-client/read-warnings.d.ts +13 -0
  487. package/dist/web-admin-client/read-warnings.js +10 -0
  488. package/dist/web-admin-client/skills-mcp.d.ts +3 -0
  489. package/dist/web-admin-client/skills-mcp.js +11 -9
  490. package/dist/web-admin-client/types.d.ts +2 -3
  491. package/dist/workspace-cache.d.ts +35 -0
  492. package/dist/workspace-cache.js +36 -0
  493. package/dist/workspace-space.d.ts +3 -2
  494. package/dist/workspace-space.js +2 -0
  495. package/docs/DEVICE-EXECUTOR-PROTOCOL.md +65 -10
  496. package/package.json +8 -4
  497. package/scripts/drain-check-local.mjs +34 -1
  498. package/scripts/drain-check.mysql.sql +30 -2
  499. package/scripts/drain-check.pg.sql +29 -2
  500. package/dist/capabilities/memory-notice.d.ts +0 -138
  501. package/dist/capabilities/memory-notice.js +0 -64
  502. package/dist/capabilities/prompt.d.ts +0 -17
  503. package/dist/capabilities/prompt.js +0 -6
  504. package/dist/mcp-content-origin.d.ts +0 -34
  505. package/dist/mcp-content-origin.js +0 -10
  506. package/dist/tool-axis-words.d.ts +0 -27
  507. package/dist/tool-axis-words.js +0 -9
  508. package/dist/wire-name-bound.d.ts +0 -14
  509. package/dist/wire-name-bound.js +0 -13
@@ -0,0 +1,34 @@
1
+ /** `problems` 的条数上限(= 一张清单的条数帽 `MAX_ALLOW_LAYER_ENTRIES` 的数;数在这里写死一次,`rule-entry-list.ts` 的帽改了不应拖着机读位走 —— 两者是两个界)。 */
2
+ export declare const MAX_ENTRY_PROBLEMS = 1000;
3
+ /**
4
+ * 本仓自己铸的 `reason` 词(闭集;其余 `reason` 是引擎的词原样 —— 见文件头):
5
+ * · `not_in_roster` —— 受理应答 `warnings` 的词:放行侧选择器清单里的这个名字不在名册(引擎目录 ∪ 本仓自铸工具 ∪ 本请求挂的调用方工具)、也不是协议命名空间名(懒挂载),引擎照旧受理、之后只告运维;
6
+ * · `home_unresolvable` —— 设置规则 422 的词:`~/` 形路径规则而本部署解不出执行环境的家目录。
7
+ */
8
+ export declare const SERVER_ENTRY_PROBLEM_REASONS: readonly ["not_in_roster", "home_unresolvable"];
9
+ export type ServerEntryProblemReason = (typeof SERVER_ENTRY_PROBLEM_REASONS)[number];
10
+ /** 「读得出、却不在名册」的告知词({@link SERVER_ENTRY_PROBLEM_REASONS} 的第一员):`warnings` 里它之外的词都是引擎的条目读法读成空的原因词。 */
11
+ export declare const NOT_IN_ROSTER: ServerEntryProblemReason;
12
+ /** 一条问题(wire 形)。 */
13
+ export interface EntryProblem {
14
+ readonly code: string;
15
+ readonly field: string;
16
+ readonly entry: string;
17
+ readonly reason: string;
18
+ }
19
+ /** 铸一条问题:`entry` 收**原串**,这里过脱敏(调用方没有「忘了脱敏」的可能)。 */
20
+ export declare function entryProblem(code: string, field: string, rawEntry: string, reason: string): EntryProblem;
21
+ /** 拒体上的机读位(原样进 `HttpError.extra` / `refusalBody` 的 `facts`:顶层 `field` + 对象形 `detail`)。 */
22
+ export interface EntryProblemsFacts {
23
+ readonly field: string;
24
+ readonly detail: {
25
+ readonly problems: readonly EntryProblem[];
26
+ readonly total: number;
27
+ };
28
+ }
29
+ /**
30
+ * 一遍判下来的全部问题 ⇒ 拒体的机读位。**不能空**:没有问题就没有拒(调用方只在命中时调),空表是调用点的错,响亮抛。
31
+ * 顶层 `field` = 第一条问题的坐标(句子点名的那一张清单)。
32
+ */
33
+ export declare function entryProblemsFacts(found: readonly EntryProblem[]): EntryProblemsFacts;
34
+ //# sourceMappingURL=entry-problems.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { redactListEntry } from "./list-entry-display.js";
2
+ export const MAX_ENTRY_PROBLEMS = 1_000;
3
+ export const SERVER_ENTRY_PROBLEM_REASONS = ["not_in_roster", "home_unresolvable"];
4
+ export const NOT_IN_ROSTER = "not_in_roster";
5
+ export function entryProblem(code, field, rawEntry, reason) {
6
+ return { code, field, entry: redactListEntry(rawEntry), reason };
7
+ }
8
+ export function entryProblemsFacts(found) {
9
+ const first = found[0];
10
+ if (first === undefined)
11
+ throw new Error("entryProblemsFacts: a refusal needs at least one problem");
12
+ return { field: first.field, detail: { problems: found.length > MAX_ENTRY_PROBLEMS ? found.slice(0, MAX_ENTRY_PROBLEMS) : found, total: found.length } };
13
+ }
14
+ //# sourceMappingURL=entry-problems.js.map
@@ -10,6 +10,12 @@
10
10
  * 带外凭据(e2b / docker / k8s 车道本来就是多租户 fleet 的主形),与 LSP 那条「本机子进程」的形不同;多租户下起服说一句。
11
11
  * · `BAKE_ENV_ALLOW`(S-684 残余,7.103.0)由 **bake-runner 进程**读(构建宿主守护进程:没有主体、没有租户 ⇒ 没有姿态列,
12
12
  * 不进 {@link describeAllowlistPostures} 的姿态句)。它与服务侧四只旋钮同一只解析器、同一只「点名放行」谓词、同一条「原文按凭据类」律。
13
+ * · `channel` = 这张名单**交给谁、在谁的减法之上**(闭集两词,解析器按它定「不许点哪些名」):
14
+ * - `host-put-back`(`LSP_ENV_ALLOW` / `BAKE_ENV_ALLOW`)—— 剥后放回形:宿主子进程的 env 先经唯一组合(引擎扣掉本服务自有凭据 + 形状剥),
15
+ * 名单点到的键再从本进程环境**原样**取回叠上去。点到本服务自有凭据名 = 把引擎刚扣下的那枚交回去 ⇒ 起服拒,判官 = 引擎同一只
16
+ * (`inheritEnvPolicyProblem`,读起服声明;与引擎拒嵌入方白名单同句)。
17
+ * - `sandbox-grant`(三只沙箱名单)—— 沙箱 env 的唯一来源(沙箱不从本进程继承任何东西),部署方显式交出的带外凭据(S-715 照转发);
18
+ * 本列不在「自有凭据」律的射程里,只拒点名名单型旋钮(原文按凭据类)。
13
19
  * 表是 `Record<旋钮, …>`:闭集加一只旋钮而不补行 = 编译红;行形随读它的进程定(服务进程 ⇒ 必须写姿态列)。
14
20
  *
15
21
  * 🔴 **姿态列只在这里写一次**([ref];7.101.0 合并复审 O9):凡要对人说「多租户下哪只旋钮忽略、哪只照转发」的句子,一律取
@@ -28,14 +34,18 @@ export type EnvNameAllowlistPosture = {
28
34
  readonly kind: "ignored";
29
35
  readonly why: string;
30
36
  };
31
- /** 服务侧旋钮一行:拒句示例 + 多租户姿态。 */
37
+ /** 名单交给谁、在谁的减法之上(闭集;规则见表头注 `channel` 一条)。 */
38
+ export type EnvNameAllowlistChannel = "host-put-back" | "sandbox-grant";
39
+ /** 服务侧旋钮一行:拒句示例 + 交付形 + 多租户姿态。 */
32
40
  export interface ServerEnvNameAllowlistKnobRow {
33
41
  readonly example: string;
42
+ readonly channel: EnvNameAllowlistChannel;
34
43
  readonly multiTenant: EnvNameAllowlistPosture;
35
44
  }
36
- /** runner 旋钮一行:只有拒句示例(没有姿态可言)。 */
45
+ /** runner 旋钮一行:拒句示例 + 交付形(没有姿态可言)。 */
37
46
  export interface RunnerEnvNameAllowlistKnobRow {
38
47
  readonly example: string;
48
+ readonly channel: EnvNameAllowlistChannel;
39
49
  }
40
50
  export type EnvNameAllowlistKnobTable = {
41
51
  readonly [K in EnvNameAllowlistKnob]: K extends ServerEnvNameAllowlistKnob ? ServerEnvNameAllowlistKnobRow : RunnerEnvNameAllowlistKnobRow;
@@ -1,12 +1,13 @@
1
1
  export const ENV_NAME_ALLOWLIST_KNOBS = {
2
2
  LSP_ENV_ALLOW: {
3
3
  example: "LSP_ENV_ALLOW=NPM_TOKEN,CARGO_REGISTRIES_MY_REG_TOKEN",
4
+ channel: "host-put-back",
4
5
  multiTenant: { kind: "ignored", why: "the host-lane language server is not started in this posture, and the language-server env keeps the full secret strip" },
5
6
  },
6
- E2B_SANDBOX_ENV: { example: "E2B_SANDBOX_ENV=GIT_TOKEN,NPM_TOKEN", multiTenant: { kind: "honored" } },
7
- DOCKER_SANDBOX_ENV: { example: "DOCKER_SANDBOX_ENV=GIT_TOKEN,NPM_TOKEN", multiTenant: { kind: "honored" } },
8
- K8S_SANDBOX_ENV: { example: "K8S_SANDBOX_ENV=GIT_TOKEN,NPM_TOKEN", multiTenant: { kind: "honored" } },
9
- BAKE_ENV_ALLOW: { example: "BAKE_ENV_ALLOW=REGISTRY_PASSWORD,NPM_TOKEN" },
7
+ E2B_SANDBOX_ENV: { example: "E2B_SANDBOX_ENV=GIT_TOKEN,NPM_TOKEN", channel: "sandbox-grant", multiTenant: { kind: "honored" } },
8
+ DOCKER_SANDBOX_ENV: { example: "DOCKER_SANDBOX_ENV=GIT_TOKEN,NPM_TOKEN", channel: "sandbox-grant", multiTenant: { kind: "honored" } },
9
+ K8S_SANDBOX_ENV: { example: "K8S_SANDBOX_ENV=GIT_TOKEN,NPM_TOKEN", channel: "sandbox-grant", multiTenant: { kind: "honored" } },
10
+ BAKE_ENV_ALLOW: { example: "BAKE_ENV_ALLOW=REGISTRY_PASSWORD,NPM_TOKEN", channel: "host-put-back" },
10
11
  };
11
12
  export const ENV_NAME_ALLOWLIST_KNOB_NAMES = new Set(Object.keys(ENV_NAME_ALLOWLIST_KNOBS));
12
13
  const POSTURE_PHRASE = {
@@ -12,8 +12,10 @@
12
12
  * 是它报的那一界。
13
13
  *
14
14
  * 与 core 远端契约(`ExecStreamOptions.readTimeoutMs`:「缺省也 SHOULD 有活性界,一条命令不得等到环境死」)的对齐:
15
- * 说了墙钟的命令被墙钟兜住,不会无限等;两界都没说的命令,在有活性界的车道(k8s / e2b)上仍由它兜底。切断码沿用 core 的 `timeout`(core 远端码表
16
- * 把墙钟与活性两种超界都归这一词);两者靠句子区分 —— 独立的活性码属于 core 的码表。
15
+ * 说了墙钟的命令被墙钟兜住,不会无限等;两界都没说的命令,在有活性界的车道(k8s / e2b)上仍由它兜底。**切断码按触发的那一界**(core 7.52.0 #1795:
16
+ * 两套执行码闭集各有一词):墙钟 ⇒ `timeout`;静默界(调用方的 `readTimeoutMs` 或车道活性界)⇒ `liveness_no_output`,带窗口秒数 `noOutputSec`(车道的界 /
17
+ * 调用方说的静默界,从不是请求的预算)—— 两者解释自己用的是两个数,消费方(core 的 Bash 工具:「no output for N s」对「timed out after N s」)按码分。
18
+ * 静默切断的码、句、秒数只在 {@link buildLivenessCut} 一处铸,六车道同读。
17
19
  *
18
20
  * 不在本律里的界(adapter 自己的上限,不是调用方说的话,不关活性界):k8s 文件读写的数据上限 `dataTimeoutMs`、e2b 交给
19
21
  * 供应商的沙箱寿命上限。adapter 自己的整段数据搬运(k8s 快照 tar 上 / 下)天生静默,它们**自己说**一个墙钟(数据上限),
@@ -64,6 +66,16 @@ export declare function firstBoundOf(bounds: CommandBounds): {
64
66
  readonly ms: number;
65
67
  readonly cut: "wall" | LivenessBound;
66
68
  } | undefined;
67
- /** 活性切断的句子 —— 六条车道(host / e2b / k8s / ssh / adb / local-docker)唯一铸点(车道兜底的界点名旋钮与出路;调用方自己说的界点名那一参数)。 */
69
+ /**
70
+ * 🔴 **一次静默切断 —— 唯一铸点**(六条车道 host / e2b / k8s / ssh / adb / local-docker 同读;纯数据,车道用它构造自己那一型的错误):
71
+ * 码恒为 `liveness_no_output`(core 7.52.0 #1795;墙钟切断照旧 `timeout`,不经本函数),句子 = {@link livenessCutMessage},`noOutputSec` = 静默窗口的整秒数
72
+ * (core `ExecutionError` 第五构造参;core 读它时向下取整、不足 1 秒不说 —— 本函数同读:不足 1 秒的窗口不带这一位)。远端流式错误(`RemoteExecutionError`)没有这一位的座,只带码与句。
73
+ */
74
+ export declare function buildLivenessCut(bound: LivenessBound): {
75
+ readonly code: "liveness_no_output";
76
+ readonly message: string;
77
+ readonly noOutputSec?: number;
78
+ };
79
+ /** 活性切断的句子 —— {@link buildLivenessCut} 的句子半(车道兜底的界点名旋钮与出路;调用方自己说的界点名那一参数)。车道不直调它:码与句一处铸。 */
68
80
  export declare function livenessCutMessage(bound: LivenessBound): string;
69
81
  //# sourceMappingURL=exec-bounds.d.ts.map
@@ -26,6 +26,10 @@ function spoken(ms) {
26
26
  return `${ms} ms`;
27
27
  return ms % 1000 === 0 ? `${ms / 1000} s` : `${(ms / 1000).toFixed(1)} s`;
28
28
  }
29
+ export function buildLivenessCut(bound) {
30
+ const sec = Math.floor(bound.ms / 1000);
31
+ return { code: "liveness_no_output", message: livenessCutMessage(bound), ...(sec >= 1 ? { noOutputSec: sec } : {}) };
32
+ }
29
33
  export function livenessCutMessage(bound) {
30
34
  switch (bound.setBy) {
31
35
  case "lane":
@@ -58,8 +58,8 @@ export interface ExecutionLaneCaps {
58
58
  * `lane === undefined || lane === "host"` 的同义形,分叉过就是记忆边界判错盘)。读本位的真装配点:
59
59
  * `boot/deferred-sandbox-path-env.ts` 的 `isSandboxPathAdjudicationLane`(resolve-spec 写门 / parked 赎回腿 /
60
60
  * 执行环境装配三处的唯一属主)、`memory-scope.ts` 的 `memoryEngineRemoteLanePosture`、
61
- * `boot/memory-boundary.ts` 的 `buildMemoryBoundaryLaneFacts`(stores)、`capabilities/memory-notice.ts` 的
62
- * `buildNoticeLaneFacts`(resolve-spec)。⚠️ `in-process` 在本位上是 YES(hooks/进程内读确实在本机盘上),
61
+ * `boot/memory-boundary.ts` 的 `buildMemoryBoundaryLaneFacts`(stores)。(「本会话没有持久记忆」的披露归引擎判、引擎渲染 ——
62
+ * 目录条目 `core/memory.no-persistent-store`,本仓只交 spec 上的事实,不再读本位做判别。)⚠️ `in-process` 在本位上是 YES(hooks/进程内读确实在本机盘上),
63
63
  * 但它**没有手** —— 问「手在不在本机盘上」要读 {@link handsOnWorkerFilePlane},不是只读本位。 */
64
64
  readonly hostFilePlane: LaneCapability;
65
65
  /** core 的 `isRemoteExecutionEnv` 对本车道的判决(鸭子类型,**含 host**)= core 拿没拿到执行环境 = 手带挂没挂。
@@ -134,7 +134,7 @@ export declare function executionLaneRow(lane: RemoteExecProvider): ExecutionLan
134
134
  /**
135
135
  * 一条车道**必需**的 env 键名 = 正本表行的 `requiredEnv ∪ requiredSecretEnv`(次序:非密坐标在前、密钥在后 —— 与 7.113.0 本仓手写表逐字同)。
136
136
  * 读者:`config.ts` 的 [ref] 拒启门(点了名却缺件 ⇒ 点名缺哪几键)、部署面门(`test/deploy-lanes-contract.test.ts`:`lanes.json` 每行登记
137
- * 本车道必需键、根 / review compose 透传全部车道必需键之并)、`scripts/gen-lanes-json.mjs`(从同一张正本生成 `lanes.json` 的必需键列)。
137
+ * 本车道必需键)、`scripts/gen-deploy-lanes.ts`(从同一张正本生成 `lanes.json` 的必需键列,以及根 / review compose 与 sema-up 栈 compose 里的必需键透传)。
138
138
  * device 没有必需 env(设备是运行期连进来的;它的 boot 前提是跨键的,在跨域不变量区拒启)。
139
139
  */
140
140
  export declare function laneRequiredEnv(lane: RemoteExecProvider): readonly string[];
@@ -185,7 +185,7 @@ export declare function executionLaneOf(provider: string | undefined): Execution
185
185
  * 实现会让无手部署**继续**挂 SendUserFile,与意图相反;本函数按意图实现(收车档 che-MA 写明)。
186
186
  *
187
187
  * 三个消费点问的都是这一句,**同一只函数**,不许各写一份 `=== "host"`:
188
- * ① `task-cwd.ts` 的 `toolsRunOnThisHost` —— wire `executionLane.toolsOnThisHost` + 出厂技能 `baseDir`;
188
+ * ① `task-cwd.ts` 的 `toolsRunOnThisHost` —— wire `executionLane.toolsOnThisHost` + 出厂自扫技能与中心 plugin 技能的 `baseDir`;
189
189
  * ② `boot/coordinators.ts` 的 SendUserFile 本机腿(经 ①;[ref] ③「无手不挂」);
190
190
  * ③ `approval.ts` 的 `buildNoResponderBootWarns` —— 写门的 ask 只在「有手写本机盘」时才会发生。
191
191
  */
@@ -202,6 +202,33 @@ export declare function handsOnWorkerFilePlane(lane: ExecutionLane): boolean;
202
202
  * 穷举 switch、无 default 臂:车道加词而此处不表态 = 编译红。
203
203
  */
204
204
  export declare function laneBindsReads(lane: ExecutionLane): boolean;
205
+ /**
206
+ * 「这条车道的执行环境**自己读得出家目录**」—— 没声明 `REMOTE_EXEC_HOME_DIR` 时,车道建环境那一拍问一次执行环境的 `$HOME` 填 `ExecutionEnv.homeDir` 的座
207
+ * (取值律与座的唯一属主 = `lane-home-probe.ts` 的 `LaneHomeSeat`)。
208
+ * · `k8s` / `local-docker` / `ssh` / `adb` —— 家目录是镜像 / 目标机登录用户 / 设备 shell 的属性,执行环境开起来之后一条命令就读得出,真;
209
+ * · `device` —— 设备协议(hello / 指令集)没有家目录读数:读它要么走协议新增一格(协议对端在别仓),要么往员工自己的机器上多跑一条未经策略门的命令,都不是本函数能替它定的,假;
210
+ * · `host` / `in-process` / `e2b` —— 家目录是车道自己的事实(`executionLaneHomeDir` 在 boot 期就有答案),无物可测,假。
211
+ * 起服的「家目录答不出」那一行只留给 **家目录答不出 ∧ 车道又读不了** 的车道({@link buildUndeclaredHomeNote});读得了的车道缺席时由环境自己响(`LaneHomeSeat`)。
212
+ * 穷举 switch、无 default 臂:车道加词而此处不表态 = 编译红。
213
+ */
214
+ export declare function laneMeasuresHome(lane: ExecutionLane): boolean;
215
+ /** 车道行声明的读面缺省(`READ_FACE` 缺席时,这条车道自己的那一份)。 */
216
+ export type LaneReadFaceDefault = "open" | "roots";
217
+ /**
218
+ * S-1492(clay 裁 [ref])—— **车道行显式声明读面缺省 `readFaceDefault`**:`READ_FACE` 没人表态时,这条车道自己的执行体该不该读面放开。
219
+ * · `open` —— 隔离型车道(`e2b` / `k8s` / `local-docker`:每任务一只沙箱,OS 级隔离边界,`tenantSeparationBasis === "isolation"`):沙箱内部就是模型的整个世界,
220
+ * 读面缺省放开(`auto` 连续干活不再每碰一个根外路径就出卡;写面 / deny 表 / 审批模式不受影响)。
221
+ * · `roots` —— 其余车道(`host` / `in-process` / `ssh` / `adb` / `device`):车道本身不给读面任何放开的理由 —— 手落在一台真机 / 共享目标 / 员工设备上。
222
+ * **`roots` 不是「钉死 roots」**:它的意思是「本车道不替运维声明缺省」,缺省回到既有的 posture 派生(单用户 turnkey ⇒ `open`〔来源 `posture`〕;多租户 ⇒ 引擎默认 `roots`),
223
+ * 这些车道上的读面一个字节不变。优先序见 `posture-source.ts`(`env` > `center` > `lane` > `posture` > `engine-default`)。
224
+ *
225
+ * 🔴 这是**部署信任决定**不是技术默认:`open` 读面在沙箱里等于「沙箱能看见的都可读」—— 共享卷 / 镜像内凭据 / bind mount 进沙箱的宿主文件,在 `roots` 面上本有强制问
226
+ * (`bypass` 也清不掉),`open` 面零问。所以声明是**显式属性**(可审计,本函数的每个臂都要有人写),告诫句 {@link LANE_OPEN_READ_FACE_CAUTION} 随它走。
227
+ * 穷举 switch、无 default 臂:车道加词而此处不表态 = 编译红。与能力表 `isolation` 位的关系由对账测试钉死(`open` ⟺ `laneIsolated`)。
228
+ */
229
+ export declare function laneReadFaceDefault(lane: ExecutionLane): LaneReadFaceDefault;
230
+ /** 声明 `open` 的那一句**挂载告诫**(运维面指路句与车道文档同读这一句):把宿主目录 / 共享卷挂进隔离沙箱的部署,在 `open` 面上宿主文件对模型零问可读。 */
231
+ export declare const LANE_OPEN_READ_FACE_CAUTION = "a deployment that mounts host paths or shared volumes into the sandbox (hostPath, bind mount) exposes those host files to reads on an open face \u2014 pin READ_FACE=roots or add read-deny rows (READ_DENY_PATTERNS) for them";
205
232
  /**
206
233
  * S-281 —— 「这条车道的手在不在 OS 级隔离边界里」。**全仓唯一**的布尔判别式(读表 `isolation` 位,见该位头注的读者清单)。
207
234
  * 穷举 switch、无 default 臂:`isolation` 的型只有两档,加档 = 编译红。
@@ -211,6 +238,13 @@ export declare function laneBindsReads(lane: ExecutionLane): boolean;
211
238
  * 不是 false。boot 行只在装出了执行环境工厂时才打,够不着那一格。
212
239
  */
213
240
  export declare function laneIsolated(lane: ExecutionLane): boolean;
241
+ /**
242
+ * core 拿没拿到执行环境 = 这条车道**有没有手**(能力表 `coreRemoteExecutionEnv` 位)的唯一布尔口。读者四处:路由的「有没有执行环境」(`boot/resolve-spec.ts`)、
243
+ * wire `executionLane.isolated` 的在场判据(`capabilities/execution-lane.ts`)、记忆边界审计的车道位(`boot/memory-boundary.ts`)、场景详情的附件供给集
244
+ * (`boot/stage-07-capability-layer.ts` 把它填进 `ScenarioDeps.handsLane`:「这一 run 有没有工作区」的车道半场)—— 同读这一只,没有各写一份 `=== "supported"`。
245
+ * 穷举 switch、无 default 臂:该位的型三档(supported / unsupported / single-user-only)都要表态,加档 = 编译红。
246
+ */
247
+ export declare function laneWiresExecutionEnv(lane: ExecutionLane): boolean;
214
248
  /**
215
249
  * S-281 —— 这条车道是不是**单机形缺省**落点(`REMOTE_EXEC` 未设 / 空串 ∧ `CONFIG_PROVIDER=local`,没人点名)。
216
250
  * 判据 = 装配出的车道值自己带的记号 `singleMachineDefault`(唯一写者 = `config.ts` 三元链的隐式 host 尾臂;显式 `REMOTE_EXEC=host`
@@ -274,11 +308,14 @@ export interface LaneHomeDeployment {
274
308
  * (`task-settings.ts` 的 `rejectUnmatchableSettingsNames`)在 home 未知时整表拒 `~/` 形 ——
275
309
  * **于是远端部署根本写不出 `~/` 规则**,恒 422。
276
310
  *
277
- * ## 本函数 = 那个值的**单一属主**
278
- * 两个消费面读同一份,不许各算各的(两处不同 = 一条规则在 422 门上被拒、却在引擎里编得出来,或反之):
279
- * ① 每只 adapter 的 `homeDir` 座(`boot/execution-env.ts` 把本函数的答案递进 adapter 配置);
280
- * ② 规则基 `PathRuleBases.home`(`boot/resolve-spec.ts` / `boot/parked-revive-gate.ts` 的
281
- * `pathAdjudication.taskHome`)。
311
+ * ## 本函数 = **boot 期就答得出的** home 的单一属主
312
+ * 三个消费面读同一份,不许各算各的(两处不同 = 一条规则在 422 门上被拒、却在引擎里编得出来,或反之):
313
+ * ① 每只 adapter 的 `homeDir` 座的**声明那一半**(`boot/execution-env.ts` 把本函数的答案递进 adapter 配置;
314
+ * k8s / local-docker / ssh / adb 四条车道的座 = 本函数答案 ∨ 车道建环境时实测,取值律在 `lane-home-probe.ts` 的 `LaneHomeSeat`);
315
+ * ② 规则基 `PathRuleBases.home`(`boot/resolve-spec.ts` / `boot/parked-revive-gate.ts` 的 `pathAdjudication.taskHome`);
316
+ * ③ 422 前置门与能力披露(`task-settings.ts` / `deployment-governance.ts`)。
317
+ * ②③ 在下单那一刻就要答,那一刻执行环境还没开 —— 它们只读本函数,**读不到实测值**:没声明的 k8s / local-docker / ssh / adb 部署上,座有实测值而 ②③ 仍按「缺席」办
318
+ * (`~/` 形规则下单拒 —— 偏严的方向,不会出现「门放行而引擎编不出」)。
282
319
  *
283
320
  * ## 一条规则,不是七条特判
284
321
  * **运维显式声明恒赢**(`REMOTE_EXEC_HOME_DIR`,部署级旋钮,不挂任何客户端表态);没有声明时,
@@ -292,9 +329,18 @@ export interface LaneHomeDeployment {
292
329
  * · `adb` —— Android 没有 POSIX 意义上的登录 home;
293
330
  * · `device` —— 员工自己的机器,运行期才连进来。
294
331
  * 这五条一律**缺席**(诚实:不猜一个目录去守)。缺席的后果是 `~/` 规则在下单时被 422 响亮拒,
295
- * 与 core 的 `missingBase:"home"` 同向 —— 这正是负控要的那一格。
332
+ * 与 core 的 `missingBase:"home"` 同向 —— 这正是负控要的那一格。其中 `k8s` / `local-docker` / `ssh` / `adb` 的**引擎手里那一只座**另有实测的来源
333
+ * (建环境时问 `$HOME`,{@link laneMeasuresHome});本函数不替它回答 —— boot 期确实不知道。
296
334
  *
297
335
  * 认不出的车道 ⇒ `undefined`(调用方 fail-closed)。生产链上不可达:`loadConfig` 的 [ref] 拒启门先咬。
298
336
  */
299
337
  export declare function executionLaneHomeDir(deployment: LaneHomeDeployment): string | undefined;
338
+ /**
339
+ * 「这条部署的执行车道**有手**、家目录答不出、**而车道又没有读数办法**」时起服那一行的 `note`(纯字符串 ⇒ `build*`);否则 `undefined`(不出这一行)。
340
+ * 判据只读 {@link executionLaneHomeDir}(boot 期的家目录)、能力表 `coreRemoteExecutionEnv` 位(有没有手)与 {@link laneMeasuresHome}(读不读得出):不另写车道清单。
341
+ * 读得出的车道(k8s / local-docker / ssh / adb)没声明时由环境建起来那一拍实测,实测缺席才由那只环境响同一只事件码(`LaneHomeSeat`)—— 起服不替它们先说。
342
+ * 代价如实:引擎 7.52.0 起家锚拒读行放不下 ⇒ 每一次泄内容的递归读在全 shell 面强制问人(allow / 模式 / bypass 都放不掉)、只读面拒;`~/` 形规则在下单时
343
+ * 就被 422 拒。出路只有一条:声明执行环境的家目录(`$HOME` 读出来的那个绝对路径)。这句话陈述的是事实,不是告警 —— 要它消失就声明家目录。
344
+ */
345
+ export declare function buildUndeclaredHomeNote(deployment: LaneHomeDeployment): string | undefined;
300
346
  //# sourceMappingURL=execution-lane-caps.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import { homedir } from "node:os";
2
2
  import { EXECUTION_LANE_WORDS as DECLARABLE_LANE_WORDS, EXECUTION_LANES } from "@sema-agent/settings-schema/execution-lanes";
3
+ import { DECLARE_HOME_REMEDY, buildHomeAbsentNote } from "./lane-home-probe.js";
3
4
  const NO = "unsupported";
4
5
  const YES = "supported";
5
6
  const SU = "single-user-only";
@@ -216,6 +217,35 @@ export function laneBindsReads(lane) {
216
217
  return false;
217
218
  }
218
219
  }
220
+ export function laneMeasuresHome(lane) {
221
+ switch (lane) {
222
+ case "k8s":
223
+ case "local-docker":
224
+ case "ssh":
225
+ case "adb":
226
+ return true;
227
+ case "device":
228
+ case "host":
229
+ case "in-process":
230
+ case "e2b":
231
+ return false;
232
+ }
233
+ }
234
+ export function laneReadFaceDefault(lane) {
235
+ switch (lane) {
236
+ case "e2b":
237
+ case "k8s":
238
+ case "local-docker":
239
+ return "open";
240
+ case "host":
241
+ case "in-process":
242
+ case "ssh":
243
+ case "adb":
244
+ case "device":
245
+ return "roots";
246
+ }
247
+ }
248
+ export const LANE_OPEN_READ_FACE_CAUTION = "a deployment that mounts host paths or shared volumes into the sandbox (hostPath, bind mount) exposes those host files to reads on an open face — pin READ_FACE=roots or add read-deny rows (READ_DENY_PATTERNS) for them";
219
249
  export function laneIsolated(lane) {
220
250
  const isolation = executionLaneCaps(lane).isolation;
221
251
  switch (isolation) {
@@ -225,6 +255,16 @@ export function laneIsolated(lane) {
225
255
  return false;
226
256
  }
227
257
  }
258
+ export function laneWiresExecutionEnv(lane) {
259
+ const wired = executionLaneCaps(lane).coreRemoteExecutionEnv;
260
+ switch (wired) {
261
+ case "supported":
262
+ return true;
263
+ case "unsupported":
264
+ case "single-user-only":
265
+ return false;
266
+ }
267
+ }
228
268
  export function isSingleMachineDefaultLane(remoteExec) {
229
269
  return remoteExec?.provider === "host" && remoteExec.singleMachineDefault === true;
230
270
  }
@@ -261,4 +301,14 @@ export function executionLaneHomeDir(deployment) {
261
301
  return undefined;
262
302
  }
263
303
  }
304
+ export function buildUndeclaredHomeNote(deployment) {
305
+ if (executionLaneHomeDir(deployment) !== undefined)
306
+ return undefined;
307
+ const lane = executionLaneOf(deployment.remoteExec?.provider);
308
+ if (lane === undefined || executionLaneCaps(lane).coreRemoteExecutionEnv !== "supported")
309
+ return undefined;
310
+ if (laneMeasuresHome(lane))
311
+ return undefined;
312
+ return buildHomeAbsentNote(lane, "REMOTE_EXEC_HOME_DIR is unset, and this lane cannot read its execution environment's home", DECLARE_HOME_REMEDY);
313
+ }
264
314
  //# sourceMappingURL=execution-lane-caps.js.map
@@ -0,0 +1,43 @@
1
+ /** 冲突的类(闭集)。同一个约束的几个拒点同一个词;新增一类见文件头。 */
2
+ export declare const FIELD_CONFLICT_KINDS: readonly ["cascade_verify", "image_profile", "resume_anchor", "system_prompt_fold", "file_history_restore", "skills_disabled", "existing_session", "scratchpad_root", "ask_answer", "policy_person_ask", "plan_edit", "plan_mode_after", "bound_call_door", "remember_decision"];
3
+ /** 冲突的类(闭集词)。 */
4
+ export type FieldConflictKind = (typeof FIELD_CONFLICT_KINDS)[number];
5
+ /**
6
+ * 每一类允许点名的请求体坐标(铸点的 `fields` 按所属类的行检查)。键序无意义;值是该类可出现的坐标的联合。
7
+ * 动态下标的坐标用模板字面量型(`agents[1].skills`)。
8
+ */
9
+ export interface FieldConflictCoordinates {
10
+ readonly cascade_verify: "verify" | "cascade" | "sandboxImageProfile" | "resumeAt" | "suggestNextPrompts";
11
+ readonly image_profile: "capabilitiesNeeded" | "sandboxImageProfile";
12
+ readonly resume_anchor: "resumeAtMode" | "resumeAt";
13
+ readonly system_prompt_fold: "appendSystemPrompt" | "settings.outputStyle";
14
+ readonly file_history_restore: "fileHistory" | "restoreFiles" | "rewindFilesTo" | "rewindFiles";
15
+ readonly skills_disabled: "disableSkills" | "skills" | `agents[${number}].skills`;
16
+ readonly existing_session: "requireExistingSession" | "sessionId";
17
+ readonly scratchpad_root: "cwd" | "scratchpadDir";
18
+ readonly ask_answer: "decision" | "answer";
19
+ readonly policy_person_ask: "decision" | "decidedBy";
20
+ readonly plan_edit: "decision" | "editedPlan";
21
+ readonly plan_mode_after: "decision" | "permissionModeAfter";
22
+ readonly bound_call_door: "boundCallId";
23
+ readonly remember_decision: "remember" | "decision";
24
+ }
25
+ /** 折叠上限那一类另带的度量位:合起来的量与帽。 */
26
+ export interface FieldConflictMeasure {
27
+ readonly count: number;
28
+ readonly cap: number;
29
+ }
30
+ /** 拒体上的 `detail`。 */
31
+ export type FieldConflictDetail<K extends FieldConflictKind = FieldConflictKind> = {
32
+ readonly kind: K;
33
+ readonly fields: readonly FieldConflictCoordinates[K][];
34
+ } & Partial<FieldConflictMeasure>;
35
+ /** 一处冲突的机读位(原样进拒体:`sendError` 的 extra / `HttpError.extra` / 手拼体的展开;型别名而不是接口 —— 要能直接当 `Record<string, unknown>` 用)。 */
36
+ export type FieldConflictFacts<K extends FieldConflictKind = FieldConflictKind> = {
37
+ readonly detail: FieldConflictDetail<K>;
38
+ };
39
+ /**
40
+ * 铸一处冲突的机读位。`fields` 至少一个坐标、主语在前;`measure` 只有折叠上限那一类给。
41
+ */
42
+ export declare function fieldConflictFacts<K extends FieldConflictKind>(kind: K, fields: readonly [FieldConflictCoordinates[K], ...FieldConflictCoordinates[K][]], measure?: FieldConflictMeasure): FieldConflictFacts<K>;
43
+ //# sourceMappingURL=field-conflict.d.ts.map
@@ -0,0 +1,20 @@
1
+ export const FIELD_CONFLICT_KINDS = [
2
+ "cascade_verify",
3
+ "image_profile",
4
+ "resume_anchor",
5
+ "system_prompt_fold",
6
+ "file_history_restore",
7
+ "skills_disabled",
8
+ "existing_session",
9
+ "scratchpad_root",
10
+ "ask_answer",
11
+ "policy_person_ask",
12
+ "plan_edit",
13
+ "plan_mode_after",
14
+ "bound_call_door",
15
+ "remember_decision",
16
+ ];
17
+ export function fieldConflictFacts(kind, fields, measure) {
18
+ return { detail: { kind, fields: [...fields], ...(measure === undefined ? {} : { count: measure.count, cap: measure.cap }) } };
19
+ }
20
+ //# sourceMappingURL=field-conflict.js.map
@@ -306,12 +306,12 @@ export type FleetFrame = {
306
306
  * 4. 🔴 **纯 observe,不改变运行** —— 它走 fleet 流(常开推送道),**不是** `additionalContext`
307
307
  * (那个通道本身会让这一轮不结束,见 hook-runner 折叠处那段旁注)。
308
308
  *
309
- * ⚠️ 可见性**与 `bg_notification` 同为 fail-CLOSED**(本帧**两族 kind 同规**):带 `ownerSessionId`
309
+ * ⚠️ 可见性**与 `bg_notification` 同为 fail-CLOSED**(本帧**每一族 kind 同规**):带 `ownerSessionId`
310
310
  * 的帧只投给能证明是自己的订阅方(`undefined` ⇒ 对 scoped 订阅方**丢弃**)。理由同源:一条关于别人
311
311
  * 会话的通知落到这个壳上,会让用户以为是自己这轮出了问题。
312
312
  *
313
- * ⚠️ `kind` 是**闭集**:第二族(`hook_non_blocking_failure`,[ref])见下。加族必须同时在
314
- * {@link hookNoticeWire} 表态(穷举 switch ⇒ 漏表态=编译红)。
313
+ * ⚠️ `kind` 是**闭集**:第二族(`hook_non_blocking_failure`,[ref])、第三族(`hook_managed_unrun`,托管车道)、第四族(`hook_verdict_untrusted`,判词不可信)见下。
314
+ * 加族必须同时在 {@link hookNoticeWire} 与发布口的 `boundedHookNotice` 表态(两处都是穷举 switch ⇒ 漏表态=编译红)。
315
315
  */
316
316
  export interface HookDecisionUnavailable {
317
317
  kind: "hook_decision_unavailable";
@@ -357,9 +357,12 @@ export interface HookNonBlockingFailure {
357
357
  * - `asyncRewake` 的 exit 2 是**契约动作**(唤醒模型),不是故障,不进本族;
358
358
  * · `timeout` —— 条目超时被击杀(无退出码);
359
359
  * · `spawn_failed` —— 起不来 / http 连不上 / LLM 载体失败(无退出码);
360
- * · `bad_json` —— exit 0 但 stdout 看着是 JSON 却读不成决策对象(裁决静默丢失的那一形)。
360
+ * · `bad_json` —— exit 0 但 stdout 看着是 JSON 却读不成决策对象(裁决静默丢失的那一形);
361
+ * · `matcher_over_budget` —— 这条 hook 所在组的 `matcher`(或条目自己的 `if` 条件)在这次事件的这个名字上求值没在预算内结束(灾难回溯;S-1017)。
362
+ * **不是 hook 脚本坏了,是它的选中条件不可求值**:server 按「选中」处理(守卫不被跳过,条目照跑),此帧说的是「这只 matcher 在这个名字上跑不完」。
363
+ * **一组一帧**(`if` 一条目一帧),`hookName` / `entryType` 指认组的第一个条目,`detail` 点名 matcher、名字、额度与组里的条目数;无 `exitCode` / `stderr`。
361
364
  */
362
- reason: "exit_nonzero" | "timeout" | "spawn_failed" | "bad_json";
365
+ reason: "exit_nonzero" | "timeout" | "spawn_failed" | "bad_json" | "matcher_over_budget";
363
366
  /** hook 身份(CC `OG`/`AEe` 锚:`statusMessage` 优先,否则 command / url / prompt),已脱敏+有界。
364
367
  * ⚠️ http 条目取 URL 时**剥掉 query 与 fragment**([ref] codex R1-F1:端点凭据最常见的挂法是
365
368
  * `?token=…`,而通用脱敏器只认 `user:pass@` 形)。要更友好的名字,作者有 `statusMessage`。 */
@@ -375,8 +378,79 @@ export interface HookNonBlockingFailure {
375
378
  /** 补充说明(已脱敏)。 */
376
379
  detail?: string;
377
380
  }
381
+ /**
382
+ * **一条托管 hook 没跑成**的观测帧(第三族;[ref] 托管车道)。
383
+ *
384
+ * ── 它解决什么 ────────────────────────────────────────────────────────────────────────────────
385
+ * 请求的 hook 组带来源(`source`);托管组(`managedPolicy` / `managedPlugin:<name>`)是组织策略的守卫。执行器把托管条目放在独立车道里、
386
+ * 在非托管改写之后的最终输入上跑;一条**同步**托管条目若没能给出合法裁决(exit 0 且无判词 / 闭集判词)或合法否决(exit 2 / `decision:"block"` /
387
+ * `continue:false`),就是「没跑成」—— `PreToolUse` 上结论在没有否决时折 `ask`(人在环;不采信非托管的放行;任何一相的否决仍是最后一票),其余事件上结论不变,但**这一帧必发**:
388
+ * 托管守卫没看住这一次,不能只进服务端日志。与上面两族同为纯 observe、同走 fleet 流、同为 fail-CLOSED 可见性。
389
+ *
390
+ * ⚠️ 一条未跑成的托管条目一帧(不收敛那一形指认重判那一遍里改写的条目;墙钟耗尽那一形只指认撞上的那一条)。`async` / `asyncRewake` 条目不在判据里(本就不阻断)。
391
+ */
392
+ export interface HookManagedUnrun {
393
+ kind: "hook_managed_unrun";
394
+ /** 哪个 hook 事件。`PreToolUse` 上这一条置位托管车道:没有否决时这次调用折 `ask`(本帧不断言这次调用怎么收场);其余事件结论不变。 */
395
+ event: string;
396
+ /**
397
+ * 为什么没跑成(闭集;每个词对应执行器里一条既有的跳过 / 故障臂):
398
+ * · `matcher_invalid` —— 组的 matcher 编不过(该组不跑);
399
+ * · `llm_carrier_unavailable` / `llm_cap` —— prompt / agent 条目没有模型载体 / 超出每事件的 LLM 条目数;
400
+ * · `powershell_unsupported` —— `shell:"powershell"` 条目(本服务不跑);
401
+ * · `if_unevaluable` —— 条目的 `if` 条件评不出;
402
+ * · `budget_exhausted` —— 托管车道的事件墙钟耗尽:撞上的那一条记一帧,同一次执行里其后的条目不再起、不逐条记(PreToolUse 逐组执行 ⇒ 至多每组一帧);
403
+ * · `spawn_failed` / `timeout` —— 起不来 / 超时被收;
404
+ * · `exit_nonzero` —— 退出码非 0 非 2;`bad_json` —— 看着是 JSON 却读不成(含 http 条目 2xx 回了非 JSON 体、Stop × prompt 的判词读不出);`decision_out_of_set` —— `permissionDecision` 不在 allow / deny / ask 里;
405
+ * · `evidence_unavailable` —— Stop × prompt 条目因会话证据面不足(或运维关了 transcript)被滤掉没跑;
406
+ * · `rewrite_unsettled` —— 一个托管相(插件相 / 策略相)改写了输入、按新输入把那一相重判一遍后仍交回不同的值(不收敛;「改写」按值判,恒等回显不算)。
407
+ */
408
+ reason: "matcher_invalid" | "llm_carrier_unavailable" | "llm_cap" | "powershell_unsupported" | "if_unevaluable" | "budget_exhausted" | "spawn_failed" | "timeout" | "exit_nonzero" | "bad_json" | "decision_out_of_set" | "evidence_unavailable" | "rewrite_unsettled";
409
+ /** 那一组的来源词(`managedPolicy` 或 `managedPlugin:<name>`;名只留痕)。 */
410
+ source: string;
411
+ /** hook 身份(同 `hook_non_blocking_failure`:`statusMessage` 优先,否则 command / url〔剥 query〕/ prompt),已脱敏 + 有界。 */
412
+ hookName: string;
413
+ entryType: "command" | "http" | "prompt" | "agent";
414
+ /** 工具事件才有。 */
415
+ toolName?: string;
416
+ /** 补充说明(已脱敏)。 */
417
+ detail?: string;
418
+ }
419
+ /**
420
+ * **一条 hook 的判词不可信**的观测帧(第四族;两车道同形、同一只铸点 `noteVerdictUntrusted`)。
421
+ *
422
+ * ── 它解决什么 ────────────────────────────────────────────────────────────────────────────────
423
+ * 一条律(R5):条目没拿到完整载荷,或是被超预算的 matcher **按选中**拉进来的 ⇒ 它的否决算数(deny / exit 2 / `decision:"block"` / `continue:false` / ask),
424
+ * 它的放行与 `updatedInput` 不作数。这条律在两车道上都成立,所以只有一种帧:成因(`reason`)、车道(`lane`)与身份都是机读位,壳不解析句子。
425
+ * 每车道一条出帧条件:托管车道 = 条目拿着不可信成因跑完即发,不看它自己判什么(托管车道随之置位:`PreToolUse` 在没有否决时折 `ask`);
426
+ * 非托管车道 = 它给了放行或真改写(恒等回显不算)而被丢时发。今天只在有放行词的 `PreToolUse` 上成立。
427
+ * **本帧不断言这次调用怎么收场**:托管条目自己否决 ⇒ 这次是 deny、帧照发;同组另有可信放行 ⇒ 非托管这一帧照发、这次照放行 —— 结局看调用自己的结果。
428
+ * 与上面三族同为纯 observe、同走 fleet 流、同为 fail-CLOSED 可见性。
429
+ */
430
+ export interface HookVerdictUntrusted {
431
+ kind: "hook_verdict_untrusted";
432
+ /** 哪个 hook 事件(今天恒 `PreToolUse`)。 */
433
+ event: string;
434
+ /**
435
+ * 判词为什么不可信(闭集):
436
+ * · `input_truncated` —— 条目没拿到完整载荷:`tool_input` 超上限被换成截断标记,或 prompt / agent 条目的整份载荷文本按同一上限被截尾;
437
+ * · `matcher_over_budget` —— 组的 matcher(或条目 `if` 的名部)求值超预算、条目被**按选中**跑了(本义选不选它不知道;同一次另有 `hook_non_blocking_failure{matcher_over_budget}` 说「选中条件不可求值」)。
438
+ */
439
+ reason: "input_truncated" | "matcher_over_budget";
440
+ /** 条目所在的车道(由来源闭集的那一张表读出:`managedPolicy` / `managedPlugin:*` ⇒ `managed`,其余与缺席 ⇒ `unmanaged`)。车道的后果见上:读这一位,不从 `source` 重推。 */
441
+ lane: "managed" | "unmanaged";
442
+ /** hook 身份(同 `hook_non_blocking_failure`),已脱敏 + 有界。 */
443
+ hookName: string;
444
+ entryType: "command" | "http" | "prompt" | "agent";
445
+ /** 工具事件才有。 */
446
+ toolName?: string;
447
+ /** 那一组声明的来源词(两车道都给;缺席 = 组没声明,只可能是非托管)。名只留痕,不作判据。 */
448
+ source?: string;
449
+ /** 补充说明(已脱敏;人读,机读只看 `reason` / `lane`)。 */
450
+ detail?: string;
451
+ }
378
452
  /** 生产者视角的观测面(hook-runner 铸的形):归属位由 boot 层在发布时补。 */
379
- export type HookNoticeObservation = HookDecisionUnavailable | HookNonBlockingFailure;
453
+ export type HookNoticeObservation = HookDecisionUnavailable | HookNonBlockingFailure | HookManagedUnrun | HookVerdictUntrusted;
380
454
  /** 租户/会话归属位 —— **只用于过滤,上 wire 前剥**(见 `hookNoticeWire`)。 */
381
455
  export interface HookNoticeOwnership {
382
456
  /** 租户可见性(发布前带,上 wire 前剥)。 */
@@ -57,6 +57,46 @@ export function hookNoticeWire(n) {
57
57
  ...(n.stderr !== undefined ? { stderr: n.stderr } : {}),
58
58
  ...(n.detail !== undefined ? { detail: n.detail } : {}),
59
59
  };
60
+ case "hook_managed_unrun":
61
+ return {
62
+ kind: n.kind,
63
+ event: n.event,
64
+ reason: n.reason,
65
+ source: n.source,
66
+ hookName: n.hookName,
67
+ entryType: n.entryType,
68
+ ...(n.toolName !== undefined ? { toolName: n.toolName } : {}),
69
+ ...(n.detail !== undefined ? { detail: n.detail } : {}),
70
+ };
71
+ case "hook_verdict_untrusted":
72
+ return {
73
+ kind: n.kind,
74
+ event: n.event,
75
+ reason: n.reason,
76
+ lane: n.lane,
77
+ hookName: n.hookName,
78
+ entryType: n.entryType,
79
+ ...(n.toolName !== undefined ? { toolName: n.toolName } : {}),
80
+ ...(n.source !== undefined ? { source: n.source } : {}),
81
+ ...(n.detail !== undefined ? { detail: n.detail } : {}),
82
+ };
83
+ }
84
+ }
85
+ function boundedHookNotice(notice) {
86
+ const detail = notice.detail !== undefined ? { detail: boundedNoticeText(notice.detail) } : {};
87
+ switch (notice.kind) {
88
+ case "hook_decision_unavailable":
89
+ return { ...notice, ...detail };
90
+ case "hook_non_blocking_failure":
91
+ return { ...notice, hookName: boundedNoticeText(notice.hookName), ...(notice.stderr !== undefined ? { stderr: boundedNoticeText(notice.stderr) } : {}), ...detail };
92
+ case "hook_managed_unrun":
93
+ return { ...notice, hookName: boundedNoticeText(notice.hookName), source: boundedNoticeText(notice.source), ...detail };
94
+ case "hook_verdict_untrusted":
95
+ return { ...notice, hookName: boundedNoticeText(notice.hookName), ...(notice.source !== undefined ? { source: boundedNoticeText(notice.source) } : {}), ...detail };
96
+ default: {
97
+ const unhandled = notice;
98
+ throw new Error(`boundedHookNotice: unhandled hook notice kind ${JSON.stringify(unhandled)}`);
99
+ }
60
100
  }
61
101
  }
62
102
  export class FleetEventBus {
@@ -84,15 +124,7 @@ export class FleetEventBus {
84
124
  this.emit({ type: "task", row: merged, ts: this.now() });
85
125
  }
86
126
  publishHookNotice(notice) {
87
- const bounded = notice.kind === "hook_non_blocking_failure"
88
- ? {
89
- ...notice,
90
- hookName: boundedNoticeText(notice.hookName),
91
- ...(notice.stderr !== undefined ? { stderr: boundedNoticeText(notice.stderr) } : {}),
92
- ...(notice.detail !== undefined ? { detail: boundedNoticeText(notice.detail) } : {}),
93
- }
94
- : { ...notice, ...(notice.detail !== undefined ? { detail: boundedNoticeText(notice.detail) } : {}) };
95
- this.emit({ type: "hook_notice", notice: bounded, ts: this.now() });
127
+ this.emit({ type: "hook_notice", notice: boundedHookNotice(notice), ts: this.now() });
96
128
  }
97
129
  removeTask(id, opts) {
98
130
  const existing = this.tasks.get(id);