@sema-agent/server 7.150.0 → 7.152.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 (514) hide show
  1. package/MIGRATION.md +451 -0
  2. package/README.md +15 -3
  3. package/README.zh-CN.md +10 -2
  4. package/USAGE.md +144 -87
  5. package/deploy/sema-up/README.md +11 -4
  6. package/deploy/sema-up/chart/Chart.yaml +1 -1
  7. package/deploy/sema-up/chart/templates/NOTES.txt +5 -0
  8. package/deploy/sema-up/chart/templates/_helpers.tpl +15 -16
  9. package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -3
  10. package/deploy/sema-up/chart/templates/server.yaml +5 -3
  11. package/deploy/sema-up/chart/values-full-single.yaml +3 -1
  12. package/deploy/sema-up/chart/values.yaml +8 -1
  13. package/deploy/sema-up/cluster-up.sh +7 -6
  14. package/deploy/sema-up/kube-up.sh +6 -6
  15. package/deploy/sema-up/lib/flagshape.sh +36 -8
  16. package/deploy/sema-up/lib/helm-values-cluster.py +2 -0
  17. package/deploy/sema-up/lib/helm-values-kube.py +2 -0
  18. package/deploy/sema-up/machines.example.yaml +3 -1
  19. package/deploy/sema-up/sema-up.sh +22 -16
  20. package/dist/adoption/import.js +3 -3
  21. package/dist/approval-ask-audit-store.d.ts +1 -1
  22. package/dist/approval-ask-machine.d.ts +4 -10
  23. package/dist/approval-ask-retention.d.ts +1 -1
  24. package/dist/approval-card.d.ts +12 -14
  25. package/dist/approval-gate-currency.d.ts +9 -9
  26. package/dist/approval-gate-currency.js +3 -4
  27. package/dist/approval-hmac.d.ts +17 -1
  28. package/dist/approval-hmac.js +7 -1
  29. package/dist/approval-queue-kind.d.ts +1 -1
  30. package/dist/approval.d.ts +2 -2
  31. package/dist/approval.js +2 -2
  32. package/dist/auth-bridge.d.ts +20 -0
  33. package/dist/auth-bridge.js +9 -0
  34. package/dist/background-session-reap.d.ts +1 -1
  35. package/dist/bake-runner/main.d.ts +4 -2
  36. package/dist/bind-host.d.ts +3 -6
  37. package/dist/bind-host.js +4 -7
  38. package/dist/boot/budget-tracing.js +1 -1
  39. package/dist/boot/coordinators.d.ts +1 -1
  40. package/dist/boot/coordinators.js +9 -10
  41. package/dist/boot/device-lane.js +2 -0
  42. package/dist/boot/engine-lease.d.ts +5 -0
  43. package/dist/boot/engine-lease.js +1 -0
  44. package/dist/boot/execution-env.d.ts +9 -14
  45. package/dist/boot/execution-env.js +85 -22
  46. package/dist/boot/execution-lane.js +32 -5
  47. package/dist/boot/late-binds.d.ts +8 -4
  48. package/dist/boot/late-binds.js +7 -1
  49. package/dist/boot/leader.d.ts +31 -30
  50. package/dist/boot/leader.js +38 -28
  51. package/dist/boot/leg-path-adjudication.d.ts +40 -0
  52. package/dist/boot/leg-path-adjudication.js +18 -0
  53. package/dist/boot/memory-consolidation.d.ts +3 -2
  54. package/dist/boot/memory-consolidation.js +6 -6
  55. package/dist/boot/parked-revive-gate.js +3 -15
  56. package/dist/boot/reapers.d.ts +6 -1
  57. package/dist/boot/reapers.js +13 -2
  58. package/dist/boot/resolve-spec.d.ts +3 -3
  59. package/dist/boot/resolve-spec.js +43 -48
  60. package/dist/boot/runner-deps.d.ts +46 -35
  61. package/dist/boot/runner-deps.js +94 -91
  62. package/dist/boot/session-age-out.d.ts +36 -0
  63. package/dist/boot/session-age-out.js +101 -0
  64. package/dist/boot/session-faces.d.ts +5 -14
  65. package/dist/boot/session-faces.js +9 -5
  66. package/dist/boot/shutdown.d.ts +6 -0
  67. package/dist/boot/shutdown.js +10 -4
  68. package/dist/boot/stage-01-config.js +2 -0
  69. package/dist/boot/stage-02-web-admin-pull.js +4 -5
  70. package/dist/boot/stage-05-execution-env.d.ts +5 -3
  71. package/dist/boot/stage-05-execution-env.js +3 -2
  72. package/dist/boot/stage-06-runners.d.ts +9 -4
  73. package/dist/boot/stage-06-runners.js +24 -9
  74. package/dist/boot/stage-07-capability-layer.d.ts +8 -4
  75. package/dist/boot/stage-07-capability-layer.js +3 -2
  76. package/dist/boot/stage-08-reapers.d.ts +8 -4
  77. package/dist/boot/stage-08-reapers.js +4 -2
  78. package/dist/boot/stage-09-leader.d.ts +12 -5
  79. package/dist/boot/stage-09-leader.js +14 -5
  80. package/dist/boot/stage-10-http-server.d.ts +19 -5
  81. package/dist/boot/stage-10-http-server.js +14 -21
  82. package/dist/boot/stores.js +7 -4
  83. package/dist/boot/web-admin.js +5 -8
  84. package/dist/boot/workflow-orchestration.d.ts +7 -2
  85. package/dist/boot/workflow-orchestration.js +24 -7
  86. package/dist/bounded-rotation.d.ts +29 -0
  87. package/dist/bounded-rotation.js +24 -0
  88. package/dist/capabilities/approvals-push.d.ts +3 -3
  89. package/dist/capabilities/scenarios.d.ts +28 -13
  90. package/dist/capabilities/scenarios.js +2 -2
  91. package/dist/capability-facts.d.ts +43 -32
  92. package/dist/capability-facts.js +45 -51
  93. package/dist/card-rule-offers.d.ts +32 -0
  94. package/dist/card-rule-offers.js +130 -0
  95. package/dist/center-credential.d.ts +25 -6
  96. package/dist/center-credential.js +25 -5
  97. package/dist/config-catalog.d.ts +26 -7
  98. package/dist/config-catalog.js +26 -22
  99. package/dist/config-dir-trust.js +4 -2
  100. package/dist/config-invariants.d.ts +20 -8
  101. package/dist/config-invariants.js +55 -12
  102. package/dist/config-lkg.d.ts +5 -19
  103. package/dist/config-lkg.js +8 -62
  104. package/dist/config-provider.d.ts +1 -1
  105. package/dist/config-root-migration.d.ts +2 -2
  106. package/dist/config-types.d.ts +38 -42
  107. package/dist/config.d.ts +58 -7
  108. package/dist/config.js +90 -40
  109. package/dist/control-socket.d.ts +51 -0
  110. package/dist/control-socket.js +115 -0
  111. package/dist/deployment-governance.d.ts +2 -1
  112. package/dist/deployment-shape.d.ts +9 -1
  113. package/dist/deployment-shape.js +2 -1
  114. package/dist/device-protocol.d.ts +5 -4
  115. package/dist/device-protocol.js +1 -1
  116. package/dist/device-ws-hub.d.ts +7 -0
  117. package/dist/device-ws-hub.js +10 -3
  118. package/dist/device-ws-protocol.d.ts +63 -10
  119. package/dist/device-ws-protocol.js +56 -25
  120. package/dist/elicitation.js +2 -2
  121. package/dist/engine-identity.d.ts +19 -7
  122. package/dist/engine-identity.js +10 -2
  123. package/dist/entry-mode-clamp-notice.d.ts +2 -1
  124. package/dist/entry-problems.d.ts +40 -3
  125. package/dist/entry-problems.js +3 -1
  126. package/dist/execution-env-refusal.d.ts +29 -0
  127. package/dist/execution-env-refusal.js +8 -0
  128. package/dist/execution-lane-caps.d.ts +3 -1
  129. package/dist/field-conflict.d.ts +1 -1
  130. package/dist/file-history-capture.d.ts +11 -4
  131. package/dist/file-history-capture.js +9 -6
  132. package/dist/file-history-disclosure.d.ts +7 -5
  133. package/dist/file-history-disclosure.js +7 -5
  134. package/dist/fleet/drain-entry.d.ts +4 -0
  135. package/dist/fleet/engine-signal.d.ts +12 -29
  136. package/dist/fleet/engine-signal.js +1 -7
  137. package/dist/fleet-client.js +2 -5
  138. package/dist/gate-settlement.d.ts +1 -8
  139. package/dist/gate-settlement.js +0 -4
  140. package/dist/history-anchor.js +1 -1
  141. package/dist/hitl-delivery.d.ts +2 -3
  142. package/dist/hitl-delivery.js +0 -2
  143. package/dist/hooks/hook-llm.js +4 -2
  144. package/dist/hooks/hook-runner.d.ts +3 -2
  145. package/dist/hooks/hook-runner.js +18 -3
  146. package/dist/host-decision.d.ts +11 -11
  147. package/dist/host-lsp-manager.d.ts +2 -2
  148. package/dist/http/active-run-conflict.d.ts +35 -2
  149. package/dist/http/active-run-conflict.js +48 -19
  150. package/dist/http/admission.js +17 -2
  151. package/dist/http/approval-sweeps.d.ts +1 -1
  152. package/dist/http/approval-sweeps.js +10 -7
  153. package/dist/http/checkpoint-ctx.d.ts +4 -0
  154. package/dist/http/checkpoint-ctx.js +2 -0
  155. package/dist/http/dispatch.d.ts +8 -3
  156. package/dist/http/dispatch.js +59 -32
  157. package/dist/http/durable-run-leg.js +16 -17
  158. package/dist/http/health-reader.d.ts +16 -9
  159. package/dist/http/health-reader.js +2 -1
  160. package/dist/http/health-self-report.d.ts +9 -1
  161. package/dist/http/health-self-report.js +3 -1
  162. package/dist/http/owner-access.d.ts +33 -14
  163. package/dist/http/owner-access.js +40 -10
  164. package/dist/http/principal-gate.d.ts +49 -21
  165. package/dist/http/principal-gate.js +61 -11
  166. package/dist/http/request-channel.d.ts +23 -0
  167. package/dist/http/request-channel.js +9 -0
  168. package/dist/http/request-guards.js +17 -2
  169. package/dist/http/resume-ctx-read.js +42 -3
  170. package/dist/http/resume-legs.d.ts +4 -3
  171. package/dist/http/resume-legs.js +367 -117
  172. package/dist/http/route-ctx.d.ts +91 -15
  173. package/dist/http/route-ctx.js +17 -0
  174. package/dist/http/route-table.d.ts +5 -1
  175. package/dist/http/route-table.js +4 -0
  176. package/dist/http/routes/admin-config-refresh.js +3 -3
  177. package/dist/http/routes/admin-drain.d.ts +3 -0
  178. package/dist/http/routes/admin-drain.js +7 -7
  179. package/dist/http/routes/admin-memory-optout.d.ts +1 -1
  180. package/dist/http/routes/admin-memory-optout.js +3 -3
  181. package/dist/http/routes/adoption.js +3 -5
  182. package/dist/http/routes/agents-roster.js +2 -3
  183. package/dist/http/routes/approvals-assistant.d.ts +2 -1
  184. package/dist/http/routes/approvals-assistant.js +99 -51
  185. package/dist/http/routes/background.d.ts +3 -3
  186. package/dist/http/routes/capabilities.d.ts +4 -0
  187. package/dist/http/routes/capabilities.js +38 -10
  188. package/dist/http/routes/config-catalog.js +2 -2
  189. package/dist/http/routes/devices.js +1 -1
  190. package/dist/http/routes/diagnostics.d.ts +3 -3
  191. package/dist/http/routes/diagnostics.js +19 -7
  192. package/dist/http/routes/fleet.js +10 -8
  193. package/dist/http/routes/images.js +10 -10
  194. package/dist/http/routes/memory-bundle.js +3 -3
  195. package/dist/http/routes/memory-compliance.js +3 -3
  196. package/dist/http/routes/memory-consolidation.js +2 -2
  197. package/dist/http/routes/memory-origin.js +3 -3
  198. package/dist/http/routes/memory-policy.js +2 -2
  199. package/dist/http/routes/observability.js +3 -3
  200. package/dist/http/routes/projects.d.ts +3 -2
  201. package/dist/http/routes/projects.js +4 -5
  202. package/dist/http/routes/retention-ops.js +3 -3
  203. package/dist/http/routes/rules.js +5 -5
  204. package/dist/http/routes/run-permission-mode.d.ts +2 -1
  205. package/dist/http/routes/run-permission-mode.js +2 -2
  206. package/dist/http/routes/runs.d.ts +4 -9
  207. package/dist/http/routes/runs.js +171 -65
  208. package/dist/http/routes/session-sync.d.ts +22 -9
  209. package/dist/http/routes/session-sync.js +204 -107
  210. package/dist/http/routes/sessions-list.js +13 -7
  211. package/dist/http/routes/sessions.js +30 -15
  212. package/dist/http/routes/tasks.js +46 -41
  213. package/dist/http/routes/trace-usage.js +2 -2
  214. package/dist/http/routes/workflows.js +1 -1
  215. package/dist/http/server.d.ts +30 -30
  216. package/dist/http/server.js +16 -4
  217. package/dist/http/submit-ctx.d.ts +1 -1
  218. package/dist/http/submit-ctx.js +7 -4
  219. package/dist/http/wire-types.d.ts +14 -4
  220. package/dist/human-facing-args.d.ts +33 -0
  221. package/dist/human-facing-args.js +33 -0
  222. package/dist/identity-source.d.ts +20 -3
  223. package/dist/identity-source.js +14 -0
  224. package/dist/index.d.ts +5 -1
  225. package/dist/k8s-api-credentials.d.ts +29 -0
  226. package/dist/k8s-api-credentials.js +25 -0
  227. package/dist/lane-home-probe.d.ts +3 -7
  228. package/dist/lane-home-probe.js +2 -2
  229. package/dist/leader/diffup.d.ts +19 -0
  230. package/dist/leader/diffup.js +7 -0
  231. package/dist/leader/leader.d.ts +116 -11
  232. package/dist/leader/leader.js +69 -5
  233. package/dist/leader/repair-wire.js +2 -2
  234. package/dist/leader/run-entry.d.ts +2 -1
  235. package/dist/leader/run-entry.js +1 -1
  236. package/dist/leader/wire.d.ts +42 -132
  237. package/dist/leader/wire.js +81 -67
  238. package/dist/leg-facts.d.ts +13 -5
  239. package/dist/leg-facts.js +2 -1
  240. package/dist/memory-scope.d.ts +23 -11
  241. package/dist/memory-scope.js +18 -6
  242. package/dist/memory-sync-client.d.ts +30 -2
  243. package/dist/memory-sync-client.js +16 -9
  244. package/dist/model-entry-headers.d.ts +9 -10
  245. package/dist/model-entry-headers.js +0 -4
  246. package/dist/model-entry-refusal.d.ts +7 -4
  247. package/dist/model-entry-refusal.js +11 -5
  248. package/dist/model-plane-face.d.ts +1 -1
  249. package/dist/model-plane-face.js +3 -1
  250. package/dist/model-route-endpoint.d.ts +13 -7
  251. package/dist/model-route-endpoint.js +14 -11
  252. package/dist/model-select.d.ts +22 -0
  253. package/dist/model-select.js +9 -0
  254. package/dist/model-unreachable-notice.d.ts +11 -0
  255. package/dist/model-unreachable-notice.js +4 -4
  256. package/dist/object-store-buckets.d.ts +640 -6
  257. package/dist/object-store-buckets.js +166 -0
  258. package/dist/observability/err-text.d.ts +7 -0
  259. package/dist/observability/err-text.js +5 -0
  260. package/dist/observability/fail-open.d.ts +25 -17
  261. package/dist/observability/fail-open.js +25 -17
  262. package/dist/observability/logger.js +3 -1
  263. package/dist/observability/metrics.js +1 -0
  264. package/dist/operator-roster.d.ts +68 -0
  265. package/dist/operator-roster.js +32 -0
  266. package/dist/orchestration/workflow-notify-journal.d.ts +18 -1
  267. package/dist/orchestration/workflow-notify-journal.js +12 -1
  268. package/dist/orchestration/workflow-park-decision.d.ts +70 -18
  269. package/dist/orchestration/workflow-park-decision.js +49 -10
  270. package/dist/orchestration/workflow-park-holder.d.ts +65 -0
  271. package/dist/orchestration/workflow-park-holder.js +98 -0
  272. package/dist/orchestration/workflow-record-fence.d.ts +36 -0
  273. package/dist/orchestration/workflow-record-fence.js +42 -0
  274. package/dist/outbound-dispatcher.d.ts +71 -8
  275. package/dist/outbound-dispatcher.js +48 -7
  276. package/dist/owner-faces.d.ts +2 -2
  277. package/dist/parked-decide.d.ts +106 -55
  278. package/dist/parked-decide.js +153 -117
  279. package/dist/peer-directory.d.ts +2 -2
  280. package/dist/peer-inbound-face.d.ts +2 -6
  281. package/dist/peer-inbound-face.js +0 -3
  282. package/dist/permission-mode-admission.d.ts +74 -5
  283. package/dist/permission-mode-admission.js +56 -3
  284. package/dist/plugins/adoption-log-sql.d.ts +3 -1
  285. package/dist/plugins/adoption-log-sql.js +7 -1
  286. package/dist/plugins/approval-ask-store-file.d.ts +14 -2
  287. package/dist/plugins/approval-ask-store-file.js +11 -0
  288. package/dist/plugins/approval-ask-store-memory.d.ts +10 -1
  289. package/dist/plugins/approval-ask-store-memory.js +35 -10
  290. package/dist/plugins/approval-ask-store-sql.d.ts +69 -4
  291. package/dist/plugins/approval-ask-store-sql.js +45 -5
  292. package/dist/plugins/approval-exemption-store.js +3 -0
  293. package/dist/plugins/approval-nonce-store.js +2 -0
  294. package/dist/plugins/blob-backend.d.ts +83 -7
  295. package/dist/plugins/blob-backend.js +57 -6
  296. package/dist/plugins/breaker-state-sql.js +2 -0
  297. package/dist/plugins/caching-session-store.d.ts +9 -15
  298. package/dist/plugins/caching-session-store.js +6 -0
  299. package/dist/plugins/checkpoint-index-columns.d.ts +20 -16
  300. package/dist/plugins/checkpoint-index-columns.js +3 -6
  301. package/dist/plugins/checkpoint-store-face.d.ts +119 -61
  302. package/dist/plugins/checkpoint-store-face.js +134 -55
  303. package/dist/plugins/device-store-sql.js +6 -0
  304. package/dist/plugins/error-origin.d.ts +18 -0
  305. package/dist/plugins/error-origin.js +10 -0
  306. package/dist/plugins/execution-placement-sql.js +6 -6
  307. package/dist/plugins/image-bake-store-sql.js +6 -0
  308. package/dist/plugins/image-index-sql.js +4 -0
  309. package/dist/plugins/landed-attendants.d.ts +212 -0
  310. package/dist/plugins/landed-attendants.js +161 -0
  311. package/dist/plugins/leader-run-store-sql.js +4 -0
  312. package/dist/plugins/local-checkpoint-store.d.ts +13 -3
  313. package/dist/plugins/local-checkpoint-store.js +38 -49
  314. package/dist/plugins/local-session-live-reference.d.ts +40 -0
  315. package/dist/plugins/local-session-live-reference.js +39 -0
  316. package/dist/plugins/local-session-store.d.ts +71 -33
  317. package/dist/plugins/local-session-store.js +129 -27
  318. package/dist/plugins/memory-engine-pg.js +4 -0
  319. package/dist/plugins/memory-engine-sql-apply.js +5 -2
  320. package/dist/plugins/memory-engine-tidb.js +4 -0
  321. package/dist/plugins/memory-optout-grant-store-sql.js +4 -0
  322. package/dist/plugins/memory-sync-store-pg.js +5 -0
  323. package/dist/plugins/memory-sync-store-tidb.js +5 -0
  324. package/dist/plugins/one-time-migrations.d.ts +104 -80
  325. package/dist/plugins/one-time-migrations.js +226 -132
  326. package/dist/plugins/org-delivery-quota-store.js +4 -1
  327. package/dist/plugins/outcome-ledger-sql.js +2 -0
  328. package/dist/plugins/permission-rule-store-sql.js +11 -4
  329. package/dist/plugins/pg-cost-quota.js +4 -0
  330. package/dist/plugins/pg-pool.js +35 -10
  331. package/dist/plugins/pg-rate-limiter.js +2 -0
  332. package/dist/plugins/posix-shell-fs.d.ts +6 -1
  333. package/dist/plugins/posix-shell-fs.js +4 -1
  334. package/dist/plugins/remote-env-adb.d.ts +19 -15
  335. package/dist/plugins/remote-env-adb.js +41 -15
  336. package/dist/plugins/remote-env-connect-seat.d.ts +105 -0
  337. package/dist/plugins/remote-env-connect-seat.js +72 -0
  338. package/dist/plugins/remote-env-device.d.ts +22 -5
  339. package/dist/plugins/remote-env-device.js +106 -8
  340. package/dist/plugins/remote-env-e2b.d.ts +15 -6
  341. package/dist/plugins/remote-env-e2b.js +42 -32
  342. package/dist/plugins/remote-env-file-error.js +6 -2
  343. package/dist/plugins/remote-env-host.d.ts +46 -10
  344. package/dist/plugins/remote-env-host.js +124 -52
  345. package/dist/plugins/remote-env-k8s.d.ts +109 -41
  346. package/dist/plugins/remote-env-k8s.js +160 -54
  347. package/dist/plugins/remote-env-local-docker.d.ts +13 -8
  348. package/dist/plugins/remote-env-local-docker.js +34 -41
  349. package/dist/plugins/remote-env-ssh.d.ts +18 -12
  350. package/dist/plugins/remote-env-ssh.js +60 -59
  351. package/dist/plugins/remote-shell.d.ts +98 -1
  352. package/dist/plugins/remote-shell.js +218 -0
  353. package/dist/plugins/replica-registration.d.ts +1 -1
  354. package/dist/plugins/replica-registration.js +1 -1
  355. package/dist/plugins/resume-anchor-store-sql.d.ts +11 -2
  356. package/dist/plugins/resume-anchor-store-sql.js +12 -5
  357. package/dist/plugins/retention-lane-store-sql.js +4 -0
  358. package/dist/plugins/retention-sql.d.ts +20 -2
  359. package/dist/plugins/retention-sql.js +11 -0
  360. package/dist/plugins/run-store-sql.d.ts +21 -2
  361. package/dist/plugins/run-store-sql.js +31 -7
  362. package/dist/plugins/s3-presign.d.ts +23 -0
  363. package/dist/plugins/s3-presign.js +37 -3
  364. package/dist/plugins/scenario-prefix-switch-m42.d.ts +1 -1
  365. package/dist/plugins/scenario-prefix-switch-m42.js +2 -2
  366. package/dist/plugins/scheduler-support.d.ts +2 -2
  367. package/dist/plugins/scheduler-support.js +0 -3
  368. package/dist/plugins/schema-consistency.d.ts +4 -2
  369. package/dist/plugins/schema-consistency.js +19 -2
  370. package/dist/plugins/schema-indexes.js +2 -0
  371. package/dist/plugins/send-file-ledger.d.ts +2 -2
  372. package/dist/plugins/send-file-ledger.js +5 -2
  373. package/dist/plugins/send-user-file.d.ts +3 -4
  374. package/dist/plugins/send-user-file.js +56 -52
  375. package/dist/plugins/serving-requirement.d.ts +26 -7
  376. package/dist/plugins/serving-requirement.js +11 -4
  377. package/dist/plugins/session-birth.d.ts +6 -2
  378. package/dist/plugins/session-blob-claim-token.d.ts +15 -0
  379. package/dist/plugins/session-blob-claim-token.js +20 -0
  380. package/dist/plugins/session-blob-namespace.d.ts +46 -0
  381. package/dist/plugins/session-blob-namespace.js +116 -0
  382. package/dist/plugins/session-capture-record-store-sql.js +2 -0
  383. package/dist/plugins/session-ext-table.d.ts +14 -1
  384. package/dist/plugins/session-ext-table.js +5 -1
  385. package/dist/plugins/session-row-sql.d.ts +49 -2
  386. package/dist/plugins/session-row-sql.js +56 -13
  387. package/dist/plugins/session-store-sql.d.ts +34 -18
  388. package/dist/plugins/session-store-sql.js +98 -17
  389. package/dist/plugins/shared-memory-store-sql.d.ts +1 -0
  390. package/dist/plugins/shared-memory-store-sql.js +6 -2
  391. package/dist/plugins/snapshot-bucket-presence.d.ts +25 -2
  392. package/dist/plugins/snapshot-bucket-presence.js +8 -2
  393. package/dist/plugins/sql-driver.d.ts +2 -1
  394. package/dist/plugins/sql-driver.js +18 -3
  395. package/dist/plugins/sql-errors.d.ts +11 -6
  396. package/dist/plugins/sql-errors.js +5 -6
  397. package/dist/plugins/sql-json-column.d.ts +1 -1
  398. package/dist/plugins/stop-then-start-sentence.d.ts +10 -4
  399. package/dist/plugins/stop-then-start-sentence.js +14 -10
  400. package/dist/plugins/stop-then-start.d.ts +109 -0
  401. package/dist/plugins/stop-then-start.js +104 -0
  402. package/dist/plugins/store-backend.d.ts +84 -15
  403. package/dist/plugins/store-backend.js +236 -72
  404. package/dist/plugins/store-boundary.d.ts +57 -0
  405. package/dist/plugins/store-boundary.js +139 -0
  406. package/dist/plugins/store-contracts.d.ts +17 -0
  407. package/dist/plugins/store-fault-sentence-m53.d.ts +7 -0
  408. package/dist/plugins/store-fault-sentence-m53.js +25 -0
  409. package/dist/plugins/store-fault.d.ts +26 -7
  410. package/dist/plugins/store-fault.js +18 -2
  411. package/dist/plugins/task-attachment-store.d.ts +2 -1
  412. package/dist/plugins/task-attachment-store.js +14 -1
  413. package/dist/plugins/task-list-store-sql.d.ts +2 -2
  414. package/dist/plugins/task-list-store-sql.js +10 -8
  415. package/dist/plugins/tidb-cost-quota.js +4 -0
  416. package/dist/plugins/tidb-pool.js +21 -25
  417. package/dist/plugins/tidb-rate-limiter.js +4 -0
  418. package/dist/plugins/user-input-ledger-sql.js +4 -0
  419. package/dist/plugins/workflow-run-store-sql.d.ts +28 -10
  420. package/dist/plugins/workflow-run-store-sql.js +64 -4
  421. package/dist/plugins/workspace-custody.d.ts +4 -3
  422. package/dist/plugins/workspace-fill.d.ts +4 -7
  423. package/dist/plugins/workspace-fill.js +2 -1
  424. package/dist/plugins/write-behind-counter.js +5 -0
  425. package/dist/project-context.d.ts +0 -2
  426. package/dist/project-context.js +4 -8
  427. package/dist/project-registry.d.ts +46 -0
  428. package/dist/project-registry.js +44 -0
  429. package/dist/question.d.ts +2 -1
  430. package/dist/question.js +5 -13
  431. package/dist/request-form.d.ts +6 -1
  432. package/dist/request-form.js +4 -1
  433. package/dist/request-key-closure.js +1 -1
  434. package/dist/request-value-closure.d.ts +4 -0
  435. package/dist/request-value-closure.js +10 -0
  436. package/dist/rule-issue-reading.d.ts +1 -1
  437. package/dist/rules-consent.d.ts +1 -1
  438. package/dist/run-acceptance.d.ts +3 -2
  439. package/dist/run-acceptance.js +4 -6
  440. package/dist/run-local.js +9 -9
  441. package/dist/runs.d.ts +54 -16
  442. package/dist/runs.js +67 -13
  443. package/dist/runtime-governance.d.ts +5 -4
  444. package/dist/security.d.ts +30 -32
  445. package/dist/security.js +41 -7
  446. package/dist/sema-config-dir.d.ts +2 -1
  447. package/dist/server-secret-env.d.ts +12 -10
  448. package/dist/server-secret-env.js +24 -15
  449. package/dist/session-bindings.d.ts +82 -0
  450. package/dist/session-bindings.js +18 -0
  451. package/dist/session-children-retire.d.ts +2 -2
  452. package/dist/session-children-retire.js +2 -6
  453. package/dist/session-deletion.d.ts +16 -1
  454. package/dist/session-error-wire.d.ts +3 -3
  455. package/dist/session-error-wire.js +3 -3
  456. package/dist/session-incarnation.d.ts +10 -0
  457. package/dist/session-incarnation.js +10 -1
  458. package/dist/session-kind.d.ts +57 -0
  459. package/dist/session-kind.js +22 -0
  460. package/dist/session-row.d.ts +21 -1
  461. package/dist/session-row.js +7 -1
  462. package/dist/session-sync-kernel.d.ts +24 -14
  463. package/dist/session-sync-kernel.js +3 -6
  464. package/dist/session-sync.d.ts +25 -103
  465. package/dist/session-sync.js +14 -76
  466. package/dist/session-titler.d.ts +10 -3
  467. package/dist/session-titler.js +19 -6
  468. package/dist/ssh-host-key.d.ts +5 -0
  469. package/dist/ssh-host-key.js +3 -0
  470. package/dist/stores-sql/blob-index-sql.d.ts +30 -9
  471. package/dist/stores-sql/blob-index-sql.js +40 -21
  472. package/dist/stores-sql/checkpoint-store-sql.d.ts +54 -27
  473. package/dist/stores-sql/checkpoint-store-sql.js +70 -146
  474. package/dist/stores-sql/file-history-store-sql.d.ts +113 -15
  475. package/dist/stores-sql/file-history-store-sql.js +205 -95
  476. package/dist/stores-sql/pg-session-storage.d.ts +34 -7
  477. package/dist/stores-sql/pg-session-storage.js +37 -13
  478. package/dist/stores-sql/retention-store-sql.d.ts +1 -9
  479. package/dist/stores-sql/retention-store-sql.js +5 -19
  480. package/dist/stores-sql/session-policy-store-sql.d.ts +30 -7
  481. package/dist/stores-sql/session-policy-store-sql.js +61 -44
  482. package/dist/stores-sql/session-write-hooks.d.ts +11 -0
  483. package/dist/stores-sql/tidb-session-store.d.ts +58 -7
  484. package/dist/stores-sql/tidb-session-store.js +37 -13
  485. package/dist/submission-exit.d.ts +3 -2
  486. package/dist/submission-exit.js +9 -1
  487. package/dist/task-cwd.d.ts +2 -2
  488. package/dist/task-settings.d.ts +7 -5
  489. package/dist/task-settings.js +3 -3
  490. package/dist/terminal.d.ts +33 -2
  491. package/dist/terminal.js +139 -9
  492. package/dist/tool-approval.d.ts +465 -507
  493. package/dist/tool-approval.js +606 -1222
  494. package/dist/trace/core-keyset-guard.d.ts +1 -1
  495. package/dist/trace/ledger-events.d.ts +3 -3
  496. package/dist/trace/project.d.ts +2 -3
  497. package/dist/trace/redact.js +3 -2
  498. package/dist/trace/self-minted-wire.d.ts +571 -178
  499. package/dist/trace/self-minted-wire.js +189 -56
  500. package/dist/web-admin-client/apply-effective.js +2 -2
  501. package/dist/web-admin-client/read-warnings.d.ts +2 -2
  502. package/dist/web-admin-client/read-warnings.js +1 -1
  503. package/dist/web-admin-client/types.d.ts +1 -1
  504. package/dist/workspace-space.d.ts +10 -4
  505. package/dist/workspace-space.js +4 -1
  506. package/docs/DEVICE-EXECUTOR-PROTOCOL.md +79 -28
  507. package/package.json +7 -3
  508. package/scripts/embed-minimal.mjs +3 -3
  509. package/wire-changes/server@7.151.0.json +762 -0
  510. package/wire-changes/server@7.152.0.json +900 -0
  511. package/dist/config-d-migration.d.ts +0 -37
  512. package/dist/config-d-migration.js +0 -60
  513. package/dist/http/session-inherit-env.d.ts +0 -36
  514. package/dist/http/session-inherit-env.js +0 -6
@@ -4,9 +4,8 @@ import { recordFailOpen } from "../observability/fail-open.js";
4
4
  import { decodeCheckpointScope } from "../security.js";
5
5
  import { createApprovalBaselinePolicy, createDeploymentGovernanceInputs, } from "../deployment-governance.js";
6
6
  import { applyRuntimeGovernance } from "../runtime-governance.js";
7
- import { DeferredSandboxPathEnv, sandboxPathEnvSlots } from "./deferred-sandbox-path-env.js";
8
- import { DEPLOYMENT_SHAPE_PREDICATES } from "../deployment-shape.js";
9
- import { executionLaneHomeDir } from "../execution-lane-caps.js";
7
+ import { sandboxPathEnvSlots } from "./deferred-sandbox-path-env.js";
8
+ import { createLegPathAdjudication } from "./leg-path-adjudication.js";
10
9
  import { createSessionExemptionRead } from "../approval.js";
11
10
  import { seatText } from "../trace/exit-seat.js";
12
11
  function hostGateCwd(config, localRoot) {
@@ -17,18 +16,7 @@ export function createParkedReviveInheritedGate(deps) {
17
16
  const slots = deps.slots ?? sandboxPathEnvSlots;
18
17
  return async (row, identity) => {
19
18
  const metadata = await chainMetadataOf(deps, row, identity);
20
- const laneHome = executionLaneHomeDir(config);
21
- const homeBase = laneHome !== undefined ? { taskHome: laneHome } : {};
22
- const pathAdjudication = DEPLOYMENT_SHAPE_PREDICATES.sandboxPathAdjudication.holds(config)
23
- ? {
24
- env: new DeferredSandboxPathEnv({
25
- sessionId: row.sessionId,
26
- slots,
27
- logger: { warn: (event, fields) => logger.warn(event, { ...(fields ?? {}), lane: config.remoteExec.provider, leg: "parked_revive" }) },
28
- }),
29
- ...homeBase,
30
- }
31
- : { env: createHostAdjudicationEnv(config, localRoot), ...homeBase };
19
+ const pathAdjudication = createLegPathAdjudication(config, { sessionId: row.sessionId, leg: "parked_revive", hostArm: () => ({ env: createHostAdjudicationEnv(config, localRoot) }) }, { slots, logger });
32
20
  const rootSessionId = row.rootSessionId;
33
21
  const baseline = createApprovalBaselinePolicy(config, {
34
22
  kind: "durable",
@@ -28,6 +28,7 @@ import type { ToolApprovalCoordinator } from "../tool-approval.js";
28
28
  import type { ParkCommitWatch } from "../plugins/park-commit-watch.js";
29
29
  import { type SandboxReaper } from "../plugins/sandbox-reaper.js";
30
30
  import { type AuditRotationPort } from "../approval-ask-retention.js";
31
+ import type { HolderPullTally } from "../orchestration/workflow-park-holder.js";
31
32
  /** [ref] / [ref]§五(sema-comms `audits/failopen-governance-176.md` §7 "Z 类 1 条"):default consecutive-failure
32
33
  * count before a reaper leg's swallowed error gets a `warn` line. The ~15 `.catch(() => undefined)` sites
33
34
  * below are correct in DIRECTION (a hiccuping periodic sweep must never crash the whole tick loop — one bad
@@ -103,6 +104,8 @@ export interface ReapersCtx {
103
104
  * `TOOL_APPROVAL_ENABLED=false` 的部署恒 undefined ⇒ 收敛器照常收敛,只是不发通知帧(壳侧靠
104
105
  * 重连 preamble 对账,见 approval-card.ts 的 `ApprovalRevokeFrame` 顶注)。 */
105
106
  toolApproval: ToolApprovalCoordinator | undefined;
107
+ /** workflow 停驻卡持有进程的拉取腿(`orchestration/workflow-park-holder.ts`;第 8 段按决定店 / 执行器视图在场装配)。缺席 = 没有 workflow 停驻车道 ⇒ 本腿零调用。 */
108
+ workflowParkHolderPull?: () => Promise<HolderPullTally>;
106
109
  /** [ref]:规则店的**保留期口**。`PERMISSION_RULES_ENABLED=false` 或后端没实装 ⇒ undefined
107
110
  * ⇒ 本腿根本不注册(零扫描),与它的同族旋钮腿同姿势。
108
111
  *
@@ -122,6 +125,8 @@ export interface ReapersCtx {
122
125
  approvalAskAudit: AuditRotationPort | undefined;
123
126
  /** 晚绑(server 造出来才有)——见文件头「位置即契约」①。 */
124
127
  getRunDenySweep: () => ((now: number) => Promise<void>) | undefined;
128
+ /** 会话老化腿(晚绑:它要的删除协调器在第 9 段铸,`late-binds.ts` 的 `sessionAgeOut`)。缺席 = 这台部署记不了会话种类 / 还没绑 ⇒ 本腿零调用。 */
129
+ getSessionAgeOut?: () => (() => Promise<unknown>) | undefined;
125
130
  /** 本车道的沙箱回收座(`plugins/sandbox-reaper.ts`;第 5 段与 run 工厂同一份车道配置铸):k8s 车道 = 沙箱 Pod reaper(`plugins/k8s-pod-reaper.ts`),local-docker 车道 = 无主容器 reaper
126
131
  * (`plugins/local-docker-reaper.ts`)。缺席 = 别的车道 ⇒ 本腿零调用。一次部署一条执行车道 ⇒ 一只座、一个节拍。 */
127
132
  sandboxReaper?: SandboxReaper;
@@ -189,7 +194,7 @@ interface ReapSessionsInputs {
189
194
  * 抛的后果是安全的:core 两条臂的 release 都在 try 内、且计数在 release **之后**递增 ⇒ 抛 = 不计数
190
195
  * + 下一 tick 重新枚举重试(失败经济学与 core 的成文一致:泄漏给下一轮,而不是谎报已清)。
191
196
  *
192
- * 抽成具名工厂而不是就地闭包的理由与 `createEngineNoticeSeat` 逐字同一条:判据在**值**上
197
+ * 抽成具名工厂而不是就地闭包的理由与当年 leader 通告席那只判据函数逐字同一条:判据在**值**上
193
198
  * (哪只店被调),源码文本门看不出对错,只有行为测得出来。
194
199
  */
195
200
  export declare function createPlacementAwareReapSessions(deps: ReapSessionsInputs): ReapSessionsFacade;
@@ -86,7 +86,7 @@ export function createPlacementAwareReapSessions(deps) {
86
86
  };
87
87
  }
88
88
  export function startReapers(ctx) {
89
- const { config, logger, metrics, localRoot, backend, subRunner, runStore, checkpointStore, parkCommits, rateLimiter, costQuota, storeSweep, fileHistoryErasure, taskAttachmentStore, imageBakes, worktreeReap, workflowNotifyGate, workflowRecoverOpts, sqlWorkflowRunStore, workflowNotifyJournal, backgroundAgentStore, mailboxStore, toolApproval, permissionRuleStores, approvalNonceStore, getRunDenySweep, userInputLedger, approvalAskAudit, sandboxReaper, } = ctx;
89
+ const { config, logger, metrics, localRoot, backend, subRunner, runStore, checkpointStore, parkCommits, rateLimiter, costQuota, storeSweep, fileHistoryErasure, taskAttachmentStore, imageBakes, worktreeReap, workflowNotifyGate, workflowRecoverOpts, sqlWorkflowRunStore, workflowNotifyJournal, backgroundAgentStore, mailboxStore, toolApproval, permissionRuleStores, approvalNonceStore, getRunDenySweep, getSessionAgeOut, userInputLedger, approvalAskAudit, sandboxReaper, workflowParkHolderPull, } = ctx;
90
90
  const leg = (p) => {
91
91
  if (p !== undefined)
92
92
  trackMaintenanceLeg(p);
@@ -119,6 +119,7 @@ export function startReapers(ctx) {
119
119
  const approvalNonceReapExpiredGuard = createThrottledReaperCatch("approval_nonce_reap_expired", logger);
120
120
  const runsFailSuspendedExpiredCheckpointGuard = createThrottledReaperCatch("runs_fail_suspended_expired_checkpoint", logger);
121
121
  const runDenySweepGuard = createThrottledReaperCatch("run_deny_sweep", logger);
122
+ const sessionAgeOutGuard = createThrottledReaperCatch("session_age_out", logger);
122
123
  const runsReapSuspendedGuard = createThrottledReaperCatch("runs_reap_suspended", logger);
123
124
  const checkpointReapCtxGuard = createThrottledReaperCatch("checkpoint_reap_ctx", logger);
124
125
  const storeSweepGuards = {
@@ -158,11 +159,13 @@ export function startReapers(ctx) {
158
159
  const approvalReconcileGuard = createThrottledReaperCatch("approval_reconcile", logger);
159
160
  const approvalSuspendedPollGuard = createThrottledReaperCatch("approval_suspended_poll", logger);
160
161
  let approvalSuspendedPollInFlight = false;
162
+ const workflowParkHolderPullGuard = createThrottledReaperCatch("workflow_park_holder_pull", logger);
163
+ let workflowParkHolderPullInFlight = false;
161
164
  const permissionRuleReapGuard = createThrottledReaperCatch("permission_rule_reap_expired", logger);
162
165
  let permissionRuleReapInFlight = false;
163
166
  let approvalReconcileInFlight = false;
164
167
  const approvalReconciler = (() => {
165
- if (!config.streamApproval.enabled || !backend)
168
+ if (!backend)
166
169
  return undefined;
167
170
  return createApprovalReconciler({
168
171
  askStore: backend.approvalAsk(),
@@ -265,6 +268,8 @@ export function startReapers(ctx) {
265
268
  leg(getRunDenySweep()?.(Date.now())
266
269
  .then(() => runDenySweepGuard.onSuccess(), runDenySweepGuard.onError));
267
270
  }
271
+ leg(getSessionAgeOut?.()?.()
272
+ .then(() => sessionAgeOutGuard.onSuccess(), sessionAgeOutGuard.onError));
268
273
  leg(approvalNonceStore
269
274
  ?.reapExpired()
270
275
  .then(reapCount("approval_nonces_reaped_total", {}))
@@ -360,6 +365,12 @@ export function startReapers(ctx) {
360
365
  .then(() => approvalSuspendedPollGuard.onSuccess(), approvalSuspendedPollGuard.onError)
361
366
  .finally(() => (approvalSuspendedPollInFlight = false)));
362
367
  }
368
+ if (workflowParkHolderPull && !workflowParkHolderPullInFlight) {
369
+ workflowParkHolderPullInFlight = true;
370
+ leg(workflowParkHolderPull()
371
+ .then(() => workflowParkHolderPullGuard.onSuccess(), workflowParkHolderPullGuard.onError)
372
+ .finally(() => (workflowParkHolderPullInFlight = false)));
373
+ }
363
374
  if (!permissionRuleReapInFlight) {
364
375
  permissionRuleReapInFlight = true;
365
376
  leg(permissionRuleStores
@@ -33,9 +33,9 @@ export interface ResolveSpecCtx {
33
33
  /** 活引用(registry 热应用换引用)—— 见文件头「位置即契约」。 */
34
34
  getKeyResolver: () => ReturnType<typeof createKeyResolver>;
35
35
  taskAttachmentStore: TaskAttachmentStore | undefined;
36
- perSessionCwd: Map<string, string>;
37
- setSessionCwd: (sid: string, cwd: string) => void;
38
- setSessionShellEnv: (sid: string, env: Record<string, string>) => void;
36
+ /** 会话登记簿的工作目录那一格(**只读**:这条腿没带工作目录时它是会话上已登记的那一枚)。会话绑定(cwd / shellEnv / inheritEnv)本装配器只判、只算
37
+ * (`LegFacts.sessionBindings`),写在路由层 run 认领之后的唯一提交点(`session-bindings.ts` 的 `commitLegBindings`)—— 律见那只文件头注。 */
38
+ perSessionCwd: ReadonlyMap<string, string>;
39
39
  /** 两张 per-session 登记簿的**租户围栏**(codex R1-F1):每次提交对拍本会话的主人,换主即清。
40
40
  * 论证(为什么 device lane 把这条从「不需要」变成「必需」)逐字见 `createSessionScopedRegistries` 头注。 */
41
41
  fenceSessionOwner: (sid: string, owner: string | null, incarnation?: string) => void;
@@ -18,6 +18,7 @@ import { headerStr } from "../http/principal-gate.js";
18
18
  import { routeListFilter } from "../http/owner-access.js";
19
19
  import { projectRegistry } from "../capability-facts.js";
20
20
  import { projectContextOf } from "../project-context.js";
21
+ import { memorySeedOf, memorySeedScopesOf } from "../project-registry.js";
21
22
  import { explicitOperatorOk } from "../http/server.js";
22
23
  import { isAtMentionable, matchCatalogModel, pickUserModel, refusedCatalogEntry, terminalCatalogName } from "../model-select.js";
23
24
  import { echoModelRef, modelNotAllowedMessage, modelUnavailableMessage, refusedNameLogField } from "../model-entry-refusal.js";
@@ -59,10 +60,12 @@ import { inertToolListEntryOf } from "../rule-entry-list.js";
59
60
  import { assertAttachmentIdsShape, assertImageProfileLane, assertInheritEnvServed, assertToolListsReadable, assertWriteFaceAdmitted, bodyImageProfileOf, scenarioRequestedBy } from "../request-form.js";
60
61
  import { TENANCY_WALL_CLOCK_BASE_SEC, enableForkFromBody, normalizeRetainSubagentSessions, selfOrchestrationFromBody } from "../task-workflow.js";
61
62
  import { redactSecrets } from "../trace/redact.js";
62
- import { DeferredSandboxPathEnv, sandboxPathEnvSlots } from "./deferred-sandbox-path-env.js";
63
- import { executionLaneHomeDir, executionLaneOf, laneIsolated, laneWiresExecutionEnv } from "../execution-lane-caps.js";
63
+ import { sandboxPathEnvSlots } from "./deferred-sandbox-path-env.js";
64
+ import { createLegPathAdjudication } from "./leg-path-adjudication.js";
65
+ import { executionLaneOf, laneIsolated, laneWiresExecutionEnv } from "../execution-lane-caps.js";
64
66
  import { executionConfigRootOf } from "../execution-config-root.js";
65
67
  import { withUnattendedLeg } from "../unattended-permission-mode.js";
68
+ import { bindingsOf } from "../session-bindings.js";
66
69
  import { fieldConflictFacts } from "../field-conflict.js";
67
70
  function identityAxesOf(auth) {
68
71
  const subject = auth?.subject === undefined ? undefined : recoveredSubject(auth.subject);
@@ -74,7 +77,7 @@ function unrooted(spec) {
74
77
  return resolved;
75
78
  }
76
79
  export function createResolveSpec(ctx) {
77
- const { config, logger, metrics, localRoot, scenarios, principalCaps, centerRuntimeCapsResolver, getKeyResolver, taskAttachmentStore, perSessionCwd, setSessionCwd, setSessionShellEnv, fenceSessionOwner, hookLlm, hookAgent, belowTaskChainPatterns, fleetBus, hookWakeBus, historyAnchors, ownerAware, taskLimitCaps, taskTimeoutSec, selectEnvTool, sendUserFileToolSpec, memoryEngine, memorySyncRunner, durableEnabled, approvalExemptionStore, checkpointStore, imageIndex, perTaskImage, sessionEnvSelection, questionSeat, approverSeat, lockedKeys, loadedSkills, peerDesk, } = ctx;
80
+ const { config, logger, metrics, localRoot, scenarios, principalCaps, centerRuntimeCapsResolver, getKeyResolver, taskAttachmentStore, perSessionCwd, fenceSessionOwner, hookLlm, hookAgent, belowTaskChainPatterns, fleetBus, hookWakeBus, historyAnchors, ownerAware, taskLimitCaps, taskTimeoutSec, selectEnvTool, sendUserFileToolSpec, memoryEngine, memorySyncRunner, durableEnabled, approvalExemptionStore, checkpointStore, imageIndex, perTaskImage, sessionEnvSelection, questionSeat, approverSeat, lockedKeys, loadedSkills, peerDesk, } = ctx;
78
81
  const deploymentSkillSources = new Map(loadedSkills.map((k) => [k.spec.name, k.source]));
79
82
  const scenarioGate = createScenarioGate({ config, scenarios, principalCaps, logger }, "enforce");
80
83
  const sessionHeadOf = headReadOf(ownerAware);
@@ -85,10 +88,10 @@ export function createResolveSpec(ctx) {
85
88
  approvalSeat: durableEnabled ? "durable" : "absent",
86
89
  singleUserAutoAcceptBaseline: singleUserAutoAcceptBaselineApplies(config),
87
90
  });
88
- const realTaskRootOf = (root) => {
91
+ const realTaskRootOf = (legSessionCwd) => {
89
92
  if (DEPLOYMENT_SHAPE_PREDICATES.sandboxPathAdjudication.holds(config))
90
93
  return undefined;
91
- const sessionCwd = effectiveHostWorkspace(perSessionCwd.get(root), {});
94
+ const sessionCwd = effectiveHostWorkspace(legSessionCwd, {});
92
95
  return sessionCwd ?? (laneWiresExecutionEnv(config.remoteExec.provider) ? undefined : process.cwd());
93
96
  };
94
97
  const memoryProjectLayers = createMemoryProjectLayers({ stores: memoryEngine, syncRunner: memorySyncRunner, log: logger });
@@ -114,13 +117,18 @@ export function createResolveSpec(ctx) {
114
117
  assertRequestMcpEntries(body.mcpServers);
115
118
  const submittedProjectId = auth?.resolvedProjectId ?? (typeof body.projectId === "string" && body.projectId ? body.projectId.toLowerCase() : undefined);
116
119
  const legProjectId = await legProjectIdOf(submittedProjectId, sessionWorkspace, root);
120
+ const registryFact = projectRegistry({ config });
121
+ const registry = registryFact.available ? registryFact.registry : undefined;
122
+ const projectViewer = opts?.leg === "fresh" && req !== undefined ? routeListFilter(req, { config }, "project-get") : undefined;
123
+ const memorySeed = opts?.leg === "fresh" ? memorySeedOf(registry, submittedProjectId, projectViewer) : opts?.memorySeed;
124
+ if (opts?.leg !== "fresh" && memorySeed === undefined && submittedProjectId !== undefined)
125
+ logger.warn("resume_memory_seed_unjudged", { sessionId: root, projectId: submittedProjectId, note: "this continuation's stored rebuild input carries no memory-seed judgment (it was parked before this server version judged one), so the project registry's default read layers are not applied to it; submit the work again as a new task to have them" });
117
126
  let projectContext;
118
127
  if (opts?.leg === "fresh") {
119
- const registry = projectRegistry({ config });
120
128
  const decision = projectContextOf({
121
129
  projectId: legProjectId,
122
- registry: registry.available ? registry.registry : undefined,
123
- viewer: req === undefined ? undefined : routeListFilter(req, { config }, "project-get"),
130
+ registry,
131
+ viewer: projectViewer,
124
132
  pathsHonored: DEPLOYMENT_SHAPE_PREDICATES.callerOwnsWorkerDisk.holds(config),
125
133
  requestCwd: typeof body.cwd === "string" && body.cwd.length > 0,
126
134
  projectMemoryOff: body.projectMemory === "disabled",
@@ -229,12 +237,12 @@ export function createResolveSpec(ctx) {
229
237
  const gated = await gateScenarioAndAppend(body, auth, root, opts, settingsEnv);
230
238
  const effMode = effectivePermissionMode(body, gated.parsedSettings.settings);
231
239
  assertWriteFaceAdmitted(effMode, config);
232
- const lane = bindSettingsCwdEnvAndModel(body, auth, root, gated, opts, legCwd);
233
- const anchors = await resolveHistoryAnchors(body, req, auth, root, submittedProjectId, legProjectId);
234
- const projectKey = memoryEngine ? await memoryProjectLayers.prepare(config, auth?.memoryScope, realTaskRootOf(root)) : undefined;
240
+ const lane = judgeSettingsCwdEnvAndModel(body, auth, root, gated, opts, legCwd);
241
+ const anchors = await resolveHistoryAnchors(body, req, auth, root, memorySeedScopesOf(registry, memorySeed), legProjectId);
242
+ const projectKey = memoryEngine ? await memoryProjectLayers.prepare(config, auth?.memoryScope, realTaskRootOf(lane.sessionCwd)) : undefined;
235
243
  const runSkills = buildRunSkills({ scenario: gated.cap.skills, request: body.skills, disable: body.disableSkills === true, deploymentSources: deploymentSkillSources }, logger);
236
244
  const spec = assembleSpecLiteral(body, auth, root, req, opts, { ...gated, ...lane, ...anchors, projectKey, a2aPeers, storedToolAxes, runSkills, projectBrief: projectContext?.brief }, effMode);
237
- const folded = await foldGovernanceAndSettings(body, auth, root, spec, gated, projectContext?.brief);
245
+ const folded = await foldGovernanceAndSettings(body, auth, root, spec, gated, projectContext?.brief, lane.sessionCwd);
238
246
  const retiredNotice = opts.onNotice !== undefined ? buildNeverAutoRetiredNotice(gated.parsedSettings.settings?.tightenOnly?.neverAuto, root) : undefined;
239
247
  if (retiredNotice !== undefined)
240
248
  opts.onNotice?.(retiredNotice);
@@ -243,13 +251,12 @@ export function createResolveSpec(ctx) {
243
251
  scratchpadDir: folded.scratchpadDir,
244
252
  hostSemanticsLane: folded.hostSemanticsLane,
245
253
  });
246
- const registeredCwd = perSessionCwd.get(root);
247
- return { spec: final, facts: { hands: gated.hands, skills: runSkills.roster, sessionWitness: gated.sessionWitness, ...(registeredCwd !== undefined ? { registeredCwd } : {}), ...(projectContext !== undefined ? { projectContext } : {}) } };
254
+ return { spec: final, facts: { hands: gated.hands, skills: runSkills.roster, sessionWitness: gated.sessionWitness, sessionBindings: lane.sessionBindings, ...(projectContext !== undefined ? { projectContext } : {}), ...(memorySeed !== undefined ? { memorySeed } : {}) } };
248
255
  };
249
256
  const gateScenarioAndAppend = async (body, auth, root, opts, settingsEnv) => {
250
257
  const { parts: subjectParts, person } = identityAxesOf(auth);
251
258
  const requestedScenario = scenarioRequestedBy(subjectParts?.scenario, body.scenario);
252
- const scenarioName = await scenarioGate(person, requestedScenario);
259
+ const { scenario: scenarioName } = await scenarioGate(person, requestedScenario);
253
260
  const rootFace = sessionHeadOf === undefined ? undefined : sessionFaceOfHead(root, await sessionHeadOf(root));
254
261
  const sessionWitness = { sessionId: root, owner: rootFace?.owner ?? null, incarnation: rootFace?.incarnation ?? null };
255
262
  const cap = selectScenario(scenarios, scenarioName)(body, person, { sessionId: sessionWitness.sessionId, delegationRoot: sessionWitness });
@@ -302,22 +309,24 @@ export function createResolveSpec(ctx) {
302
309
  }
303
310
  return { scenarioName, cap, hands: cap.hands, acceptedAppend, objective, parsedSettings, attachmentNotice, sessionWitness };
304
311
  };
305
- const bindSettingsCwdEnvAndModel = (body, auth, root, gated, opts, cwd) => {
312
+ const judgeSettingsCwdEnvAndModel = (body, auth, root, gated, opts, cwd) => {
306
313
  const { objective, parsedSettings } = gated;
307
314
  const cwdWriteGate = DEPLOYMENT_SHAPE_PREDICATES.callerCwd.holds(config);
308
315
  const execLane = config.remoteExec.provider;
309
316
  fenceSessionOwner(root, auth?.subject ?? null, opts.execution.occupant?.incarnation);
317
+ let boundCwd;
310
318
  if (typeof cwd === "string" && cwd.length > 0) {
311
319
  if (cwdWriteGate && isAbsoluteHostPath(cwd))
312
- setSessionCwd(root, cwd);
320
+ boundCwd = cwd;
313
321
  else if (DEPLOYMENT_SHAPE_PREDICATES.noHandsSingleUser.holds(config) && isAbsoluteHostPath(cwd) && satisfiedByProcessCwd(cwd, realpathSync))
314
322
  logger.debug("task_cwd_inherited", { lane: execLane, sessionId: root });
315
323
  else
316
324
  logger.warn("task_cwd_ignored", { honored: cwdWriteGate, lane: execLane, sessionId: root });
317
325
  }
326
+ let boundShellEnv;
318
327
  if (parsedSettings.settings?.shellEnv) {
319
328
  if (cwdWriteGate)
320
- setSessionShellEnv(root, parsedSettings.settings.shellEnv);
329
+ boundShellEnv = parsedSettings.settings.shellEnv;
321
330
  else if (DEPLOYMENT_SHAPE_PREDICATES.noHandsSingleUser.holds(config)) {
322
331
  const requested = parsedSettings.settings.shellEnv;
323
332
  const mismatched = shellEnvMismatchCount(requested, process.env);
@@ -329,6 +338,8 @@ export function createResolveSpec(ctx) {
329
338
  else
330
339
  logger.warn("task_shell_env_ignored", { honored: false, lane: execLane, sessionId: root });
331
340
  }
341
+ const sessionCwd = boundCwd ?? perSessionCwd.get(root);
342
+ const sessionBindings = bindingsOf(sessionCwd, boundShellEnv, body.inheritEnv);
332
343
  const taskHooks = (() => {
333
344
  const hc = parsedSettings.settings?.hooks;
334
345
  if (!hc)
@@ -340,7 +351,7 @@ export function createResolveSpec(ctx) {
340
351
  return createSettingsHooksRegistrations(hc, {
341
352
  logger,
342
353
  sessionId: root,
343
- cwd: perSessionCwd.get(root) ?? process.cwd(),
354
+ cwd: sessionCwd ?? process.cwd(),
344
355
  hookEnvAllow: config.hookEnvAllow,
345
356
  ...(parsedSettings.settings?.shellEnv ? { shellEnv: parsedSettings.settings.shellEnv } : {}),
346
357
  httpHookAllowlistLayers: parsedSettings.settings?.httpHookAllowlist !== undefined ? [parsedSettings.settings.httpHookAllowlist] : [],
@@ -390,9 +401,9 @@ export function createResolveSpec(ctx) {
390
401
  metrics.inc("task_model_unknown_fallback_total");
391
402
  logger.warn("task_model_unknown_fallback", { requested: echoModelRef(picked.unknownExplicit), fallback: picked.model, sessionId: root });
392
403
  }
393
- return { taskHooks, additionalDirectories, additionalReadDirectories, wireCatalog, picked };
404
+ return { taskHooks, additionalDirectories, additionalReadDirectories, wireCatalog, picked, sessionBindings, sessionCwd };
394
405
  };
395
- const resolveHistoryAnchors = async (body, req, auth, root, submittedProjectId, legProjectId) => {
406
+ const resolveHistoryAnchors = async (body, req, auth, root, s4DefaultScopes, legProjectId) => {
396
407
  const anchorReader = req === undefined ? undefined : anchorReaderOf(req, { config, logger }, claimCallerOf(identityAxesOf(auth).subject, config));
397
408
  let resumeAtEntryId;
398
409
  if (typeof body.resumeAt === "string" && body.resumeAt.length > 0) {
@@ -406,7 +417,6 @@ export function createResolveSpec(ctx) {
406
417
  throw new HttpError(501, "rewind-files-to is not available on this worker (no session-store backend for the anchor map)");
407
418
  rewindFilesToEntryId = await resolveHistoryAnchor("rewindFilesTo", anchorsResolvable, anchorReader, root, body.rewindFilesTo, auth?.subject ?? null, "rewindFilesTo");
408
419
  }
409
- const s4DefaultScopes = submittedProjectId ? config.projects[submittedProjectId]?.defaultScopes : undefined;
410
420
  return { resumeAtEntryId, rewindFilesToEntryId, s4DefaultScopes, legProjectId };
411
421
  };
412
422
  const declaresInteractivePosture = (body, req, opts) => {
@@ -433,7 +443,7 @@ export function createResolveSpec(ctx) {
433
443
  ...(body.outputStyle !== undefined ? { outputStyle: body.outputStyle } : {}),
434
444
  ...(body.projectMemory !== undefined ? { projectMemory: body.projectMemory } : {}),
435
445
  ...(legProjectId !== undefined ? { projectId: legProjectId } : {}),
436
- principal: taskSpecIdentityOf(subjectParts).principal,
446
+ ...taskSpecIdentityOf(subjectParts),
437
447
  images: body.images,
438
448
  ...(body.userAttachments !== undefined ? { userAttachments: body.userAttachments } : {}),
439
449
  ...(body.clientContext ? { clientContext: { timeZone: body.clientContext.timeZone, userEmail: body.clientContext.userEmail } } : {}),
@@ -471,7 +481,7 @@ export function createResolveSpec(ctx) {
471
481
  ...(declaresInteractivePosture(body, req, opts) ? { interactionPosture: "interactive" } : {}),
472
482
  ...(body.approvalReach !== undefined ? { approvalReach: body.approvalReach } : {}),
473
483
  ...(typeof body.oneShot === "boolean" ? { oneShot: body.oneShot } : {}),
474
- resilience: normalizeResilience(body.resilience, explicitOperatorOk(person, config)),
484
+ resilience: normalizeResilience(body.resilience, explicitOperatorOk(person, config, "operate")),
475
485
  finalVerification: cap.finalVerification === true || body.finalVerification === true ? true : undefined,
476
486
  attachments: normalizeAttachments(body.attachments),
477
487
  ...(taskHooks.length > 0 ? { mods: [...taskHooks] } : {}),
@@ -584,32 +594,17 @@ export function createResolveSpec(ctx) {
584
594
  };
585
595
  return spec;
586
596
  };
587
- const foldGovernanceAndSettings = async (body, auth, root, spec, gated, projectBrief) => {
597
+ const foldGovernanceAndSettings = async (body, auth, root, spec, gated, projectBrief, legSessionCwd) => {
588
598
  const { acceptedAppend, parsedSettings } = gated;
589
599
  const hostSemanticsLane = !DEPLOYMENT_SHAPE_PREDICATES.sandboxPathAdjudication.holds(config);
590
- const laneHomeBase = () => {
591
- const home = executionLaneHomeDir(config);
592
- return home !== undefined ? { taskHome: home } : {};
593
- };
594
- const pathAdjudication = hostSemanticsLane
595
- ? (() => {
596
- const realRoot = realTaskRootOf(root);
600
+ const pathAdjudication = createLegPathAdjudication(config, {
601
+ sessionId: root,
602
+ hostArm: () => {
603
+ const realRoot = realTaskRootOf(legSessionCwd);
597
604
  const gateCwd = realRoot ?? join(config.localDataRoot ?? localRoot, "fs-write-gate-unrooted");
598
- return {
599
- env: new NodeExecutionEnv({ cwd: gateCwd }),
600
- cwd: gateCwd,
601
- ...(realRoot !== undefined ? { taskRoot: realRoot } : {}),
602
- ...laneHomeBase(),
603
- };
604
- })()
605
- : {
606
- env: new DeferredSandboxPathEnv({
607
- sessionId: root,
608
- slots: sandboxPathEnvSlots,
609
- logger: { warn: (event, fields) => logger.warn(event, { ...(fields ?? {}), lane: config.remoteExec.provider }) },
610
- }),
611
- ...laneHomeBase(),
612
- };
605
+ return { env: new NodeExecutionEnv({ cwd: gateCwd }), cwd: gateCwd, ...(realRoot !== undefined ? { taskRoot: realRoot } : {}) };
606
+ },
607
+ }, { slots: sandboxPathEnvSlots, logger });
613
608
  const governedBase = applyRuntimeGovernance(spec, createDeploymentGovernanceInputs(config, pathAdjudication));
614
609
  let governed = governedBase;
615
610
  let effectiveSettings = parsedSettings.settings;
@@ -668,7 +663,7 @@ export function createResolveSpec(ctx) {
668
663
  const resolved = await resolveSandboxImageRef({
669
664
  profile: taskImageProfile,
670
665
  ...(capsNeeded && capsNeeded.length > 0 ? { capabilitiesNeeded: capsNeeded } : {}),
671
- viewer: { operator: explicitOperatorOk(person, config), tenantId: person ?? null },
666
+ viewer: { operator: explicitOperatorOk(person, config, "operate"), tenantId: person ?? null },
672
667
  index: imageIndex,
673
668
  });
674
669
  if (!resolved.ok)
@@ -206,6 +206,13 @@ export interface RunnerDepsCtx {
206
206
  sharedMemoryStores: RunnerDeps["sharedMemoryStores"];
207
207
  toolResultStore: ToolResultStoreFull | undefined;
208
208
  sessionPolicyStore: ReturnType<StoreBackend["sessionPolicy"]> | undefined;
209
+ /**
210
+ * [ref] §K —— per-principal 运行期准入的**收紧面**(`boot/runtime-caps.ts` 一处合成;缺席 = 这条部署腿没有 per-principal 收紧,
211
+ * 部署级缺省照管)。进{@link createSharedRunnerDeps 共享基座}:引擎按腿以 `spec.principal` 解它(每条腿各解一次),委派子代的主体由引擎的
212
+ * 父 spec 座继承 —— 子腿是同一个主体,跑它的那只 Runner 不挂 = 中心对这个主体的拒位(bypass / fork / 自编排 / auto / 强制门 / 观察者 /
213
+ * 记忆 opt-out)与中心硬故障时的 fail-closed 降级项一位都到不了子腿(安全轴 fail-open)。它不是会话设施(不同于 selfOrchestration /
214
+ * scheduler / memory 那几席),所以没有「子腿刻意不给」的理由。
215
+ */
209
216
  runtimeCapsResolver: RunnerDeps["runtimeCapsResolver"];
210
217
  /** [ref] per-edited-file rewind history (core `RunnerDeps.fileHistoryStore`; replaces the retired E19
211
218
  * whole-tree snapshot seat — core 94632197 renamed the seat, not a coexistence). WIRING IS THE OPT-IN.
@@ -238,7 +245,7 @@ export interface RunnerDepsCtx {
238
245
  lspManager: RunnerDeps["lspManager"];
239
246
  fleetBus: FleetEventBus;
240
247
  /** 部署座的 mods 注册(起服第 5 段装配口 `assembleDeploymentMods` 铸:自铸 + 运维声明的包,起服自证过)—— 主 / handless / hookAgent / sub 经本共享基座、
241
- * leader 车道的路由 / worker / 修复腿经 `LeaderWireConfig.mods`(`boot/leader.ts` 递同一份),每一只 Runner 同一份。 */
248
+ * leader 车道的路由 / worker / 修复腿经部署平面层(同一铸点),每一只 Runner 同一份。 */
242
249
  deploymentMods: NonNullable<RunnerDeps["mods"]>;
243
250
  workflowRunStore: WorkflowRunStore | undefined;
244
251
  workflowJournalStore: ServiceWorkflowJournalStore | undefined;
@@ -246,9 +253,22 @@ export interface RunnerDepsCtx {
246
253
  workflowNotifyGate: WorkflowNotifyGate | undefined;
247
254
  deliverWorkflowCompletion: (p: WorkflowCompletionPayload) => Promise<void>;
248
255
  }
249
- /** [ref] A10 留档发现②:main runner `RunnerDeps` 与 main.ts subRunner 字面量之间此前手工重复
250
- * 的 ~15 个键,类型标注见 {@link createSharedRunnerDeps} 头注。 */
251
- export type SharedRunnerDeps = Pick<RunnerDeps, "brain" | "readFace" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "readDenyFloorRequired" | "memoryDelegationEvidence" | "memoryProvenance" | "memoryCapturePolicy" | "delegationEntryCaps" | "crossSessionInbound" | "crossSessionDialogExpiry" | "writeProtectedPaths" | "memoryEngineDir" | "allowedTools" | "crossBoundaryPosture" | "models" | "roles" | "tiers" | "pricing" | "tracer" | "promptSource" | "executionEnvFactory" | "lspManager" | "backgroundAgentStore" | "mailboxStore" | "rosterStore" | "mods" | "toolResultStore" | "checkpointStore" | "fileHistoryStore" | "fileHistoryCapture" | "hands" | "sessionPolicyStore" | "usageWindows" | "usageWindowStore" | "memoryScopeAdmission" | "deploymentMemoryScopes" | "sharedMemoryStores" | "compliancePostureResolver" | "lockedConfig" | "retentionPolicy" | "onNotice" | "mcpRevocations" | "peerSeat">;
256
+ /**
257
+ * **部署平面层**:一台部署对**每一条腿说同一句话**的键 —— 收紧面(治理三座 / 按主体准入 / MCP 撤销台账 / 部署姿态座席族 / 豁免根)+ 计量面
258
+ * (tracer / 治理窗两键)+ 服务表(brain / 模型目录 / 定价 / 提示词目录)+ 部署座 / 手带 + 两条披露出口(通告 / 错误)。
259
+ * 律:本进程每一只跑带主体 spec 的 Runner —— 主 / 无手 / hook 代理 / 子代 / run-local,**以及 leader 车道的每一只** —— 展开**同一层**
260
+ * ({@link createDeploymentPlaneDeps},唯一铸点);新的部署键进这一层即到达全部 Runner,没有哪条车道逐席搬运。
261
+ * 不在这一层的是**会话设施**({@link SessionFacilityDeps}):各车道按自己的生命周期自选(leader 的沙盒、停驻店与会话店归 leader)。
262
+ */
263
+ export type DeploymentPlaneDeps = Pick<RunnerDeps, "brain" | "models" | "roles" | "tiers" | "pricing" | "tracer" | "promptSource" | keyof DeploymentPostureSeats | "mods" | "hands" | "usageWindows" | "usageWindowStore" | "compliancePostureResolver" | "lockedConfig" | "retentionPolicy" | "onNotice" | "onError" | "runtimeCapsResolver" | "mcpRevocations" | "memoryEngineDir">;
264
+ /**
265
+ * **会话设施层**:停驻店、卸载店、后台子代店 / 信箱 / 名册、文件历史、会话规则、记忆三席、LSP、对端座、执行环境工厂 —— 按会话 / 车道的
266
+ * 生命周期选,不是部署对每条腿说的话。起服的主 / 子 Runner 与 run-local 经共享基座取全套;leader 车道不取(它的沙盒、停驻店、会话店按 worker
267
+ * 自己的生命周期给,`leader/wire.ts`)。
268
+ */
269
+ export type SessionFacilityDeps = Pick<RunnerDeps, "executionEnvFactory" | "lspManager" | "backgroundAgentStore" | "mailboxStore" | "rosterStore" | "toolResultStore" | "checkpointStore" | "fileHistoryStore" | "fileHistoryCapture" | "sessionPolicyStore" | "memoryScopeAdmission" | "deploymentMemoryScopes" | "sharedMemoryStores" | "peerSeat">;
270
+ /** 共享基座 = 部署平面层 + 会话设施层(起服主 / 子 Runner 与 run-local 的两只 Runner 展开它)。 */
271
+ export type SharedRunnerDeps = DeploymentPlaneDeps & SessionFacilityDeps;
252
272
  /**
253
273
  * [ref] A10 留档发现②(review 2026-07-29,[ref]§三族A 同源修补的延续):main runner 的
254
274
  * `RunnerDeps` 字面量(下方 `createRunnerDeps`)与 `main.ts` 里 subRunner 的 `new Runner({...})`
@@ -274,8 +294,17 @@ export type SharedRunnerDeps = Pick<RunnerDeps, "brain" | "readFace" | "readDeny
274
294
  * [ref]§三族A 已用「直引 `runnerDeps.X`」修过(main.ts 两处引用同一个 `runnerDeps` 实例的同一
275
295
  * 属性,比再抽一层共享基座更强的同源保证),不重复收纳进这里。
276
296
  */
277
- /** 基座真实消费的窄面(Pick)——subRunner 调用点(main.ts)只需凑这 13 个字段,不必造全量 ctx。 */
278
- export type SharedRunnerDepsCtx = Pick<RunnerDepsCtx, "config" | "brain" | "pricing" | "tracer" | "promptSource" | "executionEnvFactory" | "lspManager" | "backgroundAgentStore" | "mailboxStore" | "rosterStore" | "deploymentMods" | "toolResultStore" | "checkpointStore" | "fileHistoryStore" | "sessionPolicyStore" | "commitCoAuthor" | "usageWindowStore" | "orgMemoryAdmission" | "sharedMemoryStores" | "logger" | "governanceSeams" | "mcpRevocations" | "metrics" | "engineDataRoot" | "peerDesk">;
297
+ /** 部署平面层的输入(窄面)。`onError` = 本进程的错误汇(起服 = `createRunnerDeps` 铸的那一只,run-local = 它自己的那一只):必填键(值可缺席),
298
+ * 每个平面层调用点都得回答「这条腿的引擎错误交给谁」—— 它是按主体准入 resolver 抛 / 治理窗最终扣账失败的唯一出口,与 resolver、窗席同生共死。 */
299
+ export type DeploymentPlaneCtx = Pick<RunnerDepsCtx, "config" | "brain" | "pricing" | "tracer" | "promptSource" | "deploymentMods" | "usageWindowStore" | "logger" | "governanceSeams" | "mcpRevocations" | "metrics" | "engineDataRoot" | "runtimeCapsResolver"> & {
300
+ readonly onError: RunnerDeps["onError"];
301
+ };
302
+ /** 平面层里**车道给**的一格:提交署名(`hands.commitCoAuthor`;起服 / run-local 各按品牌算一次,leader 车道不署名 ⇒ `undefined`)。 */
303
+ export interface DeploymentPlaneLane {
304
+ readonly commitCoAuthor: RunnerDepsCtx["commitCoAuthor"];
305
+ }
306
+ /** 共享基座的输入 = 平面层的输入 + 会话设施的输入。 */
307
+ export type SharedRunnerDepsCtx = DeploymentPlaneCtx & Pick<RunnerDepsCtx, "executionEnvFactory" | "lspManager" | "backgroundAgentStore" | "mailboxStore" | "rosterStore" | "toolResultStore" | "checkpointStore" | "fileHistoryStore" | "sessionPolicyStore" | "commitCoAuthor" | "orgMemoryAdmission" | "sharedMemoryStores" | "peerDesk">;
279
308
  /** 转发席只需要 `inc` —— 刻意窄到这一个动词,免得把整只 Metrics 拖进这条纯转发腿。 */
280
309
  export interface EngineNoticeMetricsSeat {
281
310
  inc: (name: string, labels?: Record<string, string>) => void;
@@ -292,39 +321,14 @@ export declare function createEngineNoticeForwarder(logger: {
292
321
  export declare function installDefaultEngineNoticeSeat(logger: {
293
322
  warn: (msg: string, fields?: Record<string, unknown>) => void;
294
323
  }, metrics?: EngineNoticeMetricsSeat): void;
295
- /**
296
- * `onNotice` **席**的装配判据本身 —— 「`warn` 真在场才铸席」这一条从此是**一个可直接调用的函数**,
297
- * 不是散在装配点、只能靠扫源码文本去猜的一行三元(codex 交叉复审 R1-[medium],验真后修)。
298
- *
299
- * 病(实测):把 leader 的门写成 `cfg.logger ? ((m, x) => cfg.logger?.warn?.(m, x)) : undefined` 时,
300
- * 「装配点切片里出现过 `warn` 这个词」这类**源码文本**判据一律照绿 —— 而只装了 `info` 的部署会拿到一个
301
- * truthy 闭包、照样铸席,通告随后被可选链**静默吞掉**,比不铸席更坏(不铸时 core 至少还打它自己的
302
- * `console.warn`,响亮权留在原处)。任何「在这段文本里找关键字」的门都挡不住这一族变异,因为病灶在
303
- * **值**(闭包 truthy)而不在字面。⇒ 把判据搬进函数,让它可以被**行为**测:info-only ⇒ 空席;带 warn ⇒
304
- * 具名转发体。
305
- *
306
- * 命名(CLAUDE.md 工厂律):返回的袋子里装的是**活闭包**(有行为)⇒ `create*`,不是 `build*`。
307
- * 返回**展开形**(`{}` 或 `{ onNotice }`)而不是 `onNotice: undefined`。理由是**键卫生**,不是 core 行为
308
- * (R3 复扫更正:core 5.28 的 `deliverEngineNotice` 只判 `typeof onNotice === "function"`,显式 `undefined`
309
- * 与键缺席在 core 那侧行为逐字相同、响亮权都留在 core——旧句「显式 undefined 也算 host 接管」与真码相反):
310
- * 展开形让 `new Runner({...seat})` 的键集只随真装配变化,EXPECTED_SHARED_KEYS 类的键集绊线才数得准。
311
- */
312
- export declare function createEngineNoticeSeat(logger: {
313
- warn?: (msg: string, fields?: Record<string, unknown>) => void;
314
- } | undefined, router?: EngineNoticeRouter): {
315
- onNotice?: NonNullable<RunnerDeps["onNotice"]>;
316
- };
317
324
  /**
318
325
  * [ref](黑板 [ref],[ref] 登记)—— **部署姿态座席族**:运维在配置面写下的姿态(READ 面四席 + 记忆三席 +
319
326
  * 委派入口 caps)。core 明写「每个 run 读**准备它的那只 Runner** 的 deps」⇒ 一台部署里跑任务的**每一只**
320
- * Runner 都必须带同一份:主 runner / subRunner / run-local(经 {@link createSharedRunnerDeps} 展开)+
321
- * **leader lane 五只**(`boot/leader.ts` → `LeaderWireConfig.deploymentPosture` → `src/leader/wire.ts`
322
- * 五处 `...deploymentPostureSeat`)。
327
+ * Runner 都必须带同一份:本进程每一只 Runner 经部署平面层({@link createDeploymentPlaneDeps})展开它 —— 主 runner / subRunner /
328
+ * run-local 经共享基座,leader 车道的四只经 `LeaderWireConfig.plane`。
323
329
  *
324
330
  * 🔴 本函数是这一族**唯一**的取值点。两处各读一遍 config 就是 [ref]§三族A「主挂了、副漏挂」的病族形——
325
- * [ref] 正是 leader 那条腿漏了**全族**(修前 wire.ts 五处一席都没有;边界曾靠
326
- * `test/memory-delegation-evidence-lane.test.ts` ⑤ 组的机器门如实登记,现已翻成正向门)。leader 不许自己
327
- * 再读 config 铸一份,只吃本函数经 cfg 递过去的产物(`test/leader-deployment-posture-seats.test.ts` ③ 钉)。
331
+ * [ref] 正是 leader 那条腿漏了**全族**。平面层每次铸都现调本函数(中心热换 READ 面之后新构造的 Runner 读新档,[ref])。
328
332
  *
329
333
  * 纯数据(键值全是 config 透传,无闭包)⇒ `build*`(CLAUDE.md 工厂律)。键**恒在场**、缺席 = `undefined`
330
334
  * ([ref] S4 house style;core 消费点全按 `!== undefined` / `??` 判 —— dist
@@ -352,7 +356,7 @@ export declare function crossBoundaryPostureOf(requirePrincipal: boolean): Cross
352
356
  /**
353
357
  * 手带(`RunnerDeps.hands`)的**唯一**铸点(纯数据 ⇒ `build*`)。两格两个来源:署名由腿给(两条腿判据不同,见 {@link RunnerDepsCtx.commitCoAuthor};
354
358
  * leader 车道今天不署名,显式交 `undefined`),前台命令超时转后台读部署旋钮 `AUTO_BACKGROUND_ON_TIMEOUT` —— 旋钮的读点只有这里。
355
- * 共享基座(主 / 无手 / hook 代理 / 子代,HTTP 与 run-local 两条腿)与 leader 车道(`boot/leader.ts` → `LeaderWireConfig.hands`)同调这一只:
359
+ * 部署平面层调这一只(署名一格由车道给,{@link DeploymentPlaneLane}):
356
360
  * 有手的每一只 Runner 都拿到它,`/health.autoBackgroundOnTimeout` 说「生效」时没有哪只 Runner 例外。
357
361
  */
358
362
  export declare function buildHandsBand(config: Pick<ServiceConfig, "autoBackgroundOnTimeout">, commitCoAuthor: RunnerDepsCtx["commitCoAuthor"]): NonNullable<RunnerDeps["hands"]>;
@@ -364,6 +368,13 @@ export declare function buildDeploymentPostureSeats(config: DeploymentPostureCon
364
368
  * 喂的是 `config.readDenyPatterns`(运维 ∪ 中心 read-face 的行),不是座席族并入 LKG 派生行之后的那一份 —— 派生行是根锚。绝不抛(纯诊断面)。
365
369
  */
366
370
  export declare function announceReadDenyRows(config: Pick<ServiceConfig, "readDenyPatterns">, logger: Pick<Logger, "warn">): void;
371
+ /**
372
+ * **部署平面层的唯一铸点**({@link DeploymentPlaneDeps})。纯函数、无副作用(读拒行的进场告知留在共享基座 —— leader 每构造一只 Runner 调本函数一次,
373
+ * 告知不随它重复)。每次调用现读 `config`:部署姿态座席族与模型目录会被中心热换,逐调用现构的 Runner(leader 车道)读到的是构造那一刻的代,
374
+ * 与主车道经 swap 门换代同代([ref]);起服的主 / 子 Runner 各展开一次,同一份 ctx ⇒ 同值同引用。
375
+ * 署名一格车道给({@link DeploymentPlaneLane});其余每一格对每一条腿同一句话。
376
+ */
377
+ export declare function createDeploymentPlaneDeps(ctx: DeploymentPlaneCtx, lane: DeploymentPlaneLane): DeploymentPlaneDeps;
367
378
  export declare function createSharedRunnerDeps(ctx: SharedRunnerDepsCtx): SharedRunnerDeps;
368
379
  /**
369
380
  * 这台部署**声明本机属主的规则桶**吗(core `RunnerDeps.localOwnerRules`:不带主体的 run 经规则店的 `forLocalOwner()` 读持久规则,而不是读零规则)。