@sema-agent/server 7.145.0 → 7.147.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 (526) hide show
  1. package/MIGRATION.md +876 -0
  2. package/README.md +1 -1
  3. package/README.zh-CN.md +1 -1
  4. package/USAGE.md +374 -99
  5. package/deploy/facts/CHANGES.json +25 -0
  6. package/deploy/facts/README.md +57 -0
  7. package/deploy/facts/lanes.json +61 -0
  8. package/deploy/facts/lanes.schema.json +57 -0
  9. package/deploy/facts/sandbox-rbac.json +113 -0
  10. package/deploy/facts/sandbox-rbac.schema.json +74 -0
  11. package/deploy/facts/sealed-key.json +9 -0
  12. package/deploy/facts/sealed-key.schema.json +52 -0
  13. package/deploy/sema-up/README.md +2 -2
  14. package/deploy/sema-up/chart/templates/_helpers.tpl +41 -0
  15. package/deploy/sema-up/chart/templates/sandbox-rbac.yaml +47 -7
  16. package/deploy/sema-up/chart/templates/server-v4pro.yaml +9 -4
  17. package/deploy/sema-up/chart/templates/server.yaml +9 -4
  18. package/deploy/sema-up/chart/values.yaml +8 -1
  19. package/deploy/sema-up/cluster-up.sh +2 -1
  20. package/deploy/sema-up/lib/flagshape.sh +4 -0
  21. package/deploy/sema-up/lib/lanes.json +2 -5
  22. package/deploy/sema-up/sema-up.sh +12 -9
  23. package/deploy/sema-up/stack/compose.yaml +5 -4
  24. package/deploy/sema-up/stack/sema-stack-cluster.yaml +34 -17
  25. package/dist/adoption/import-limits.d.ts +6 -0
  26. package/dist/adoption/import-limits.js +7 -0
  27. package/dist/adoption/import.d.ts +62 -0
  28. package/dist/adoption/import.js +107 -0
  29. package/dist/adoption/wire.d.ts +52 -0
  30. package/dist/adoption/wire.js +9 -0
  31. package/dist/approval-ask-machine.d.ts +2 -2
  32. package/dist/approval-card.d.ts +7 -16
  33. package/dist/approval-card.js +0 -4
  34. package/dist/approval-gate-currency.d.ts +1 -1
  35. package/dist/approval-gate-currency.js +1 -1
  36. package/dist/approval-reconciler.d.ts +1 -1
  37. package/dist/approval.d.ts +3 -3
  38. package/dist/audit.js +2 -2
  39. package/dist/bench/s1/live-deps.js +3 -1
  40. package/dist/boot/crash-last.js +2 -1
  41. package/dist/boot/deployment-mods.d.ts +11 -1
  42. package/dist/boot/deployment-mods.js +15 -2
  43. package/dist/boot/device-lane.js +7 -5
  44. package/dist/boot/engine-lease.d.ts +195 -22
  45. package/dist/boot/engine-lease.js +146 -20
  46. package/dist/boot/execution-env.d.ts +5 -0
  47. package/dist/boot/execution-env.js +57 -33
  48. package/dist/boot/execution-lane.d.ts +37 -9
  49. package/dist/boot/execution-lane.js +74 -20
  50. package/dist/boot/exit-boundary.d.ts +50 -0
  51. package/dist/boot/exit-boundary.js +32 -0
  52. package/dist/boot/exit-last.d.ts +20 -4
  53. package/dist/boot/exit-last.js +23 -5
  54. package/dist/boot/governance-seams.d.ts +2 -2
  55. package/dist/boot/governance-seams.js +1 -0
  56. package/dist/boot/leader.js +1 -1
  57. package/dist/boot/memory-boundary.d.ts +11 -11
  58. package/dist/boot/memory-boundary.js +3 -3
  59. package/dist/boot/memory-consolidation.d.ts +42 -41
  60. package/dist/boot/memory-consolidation.js +26 -28
  61. package/dist/boot/org-memory.js +3 -2
  62. package/dist/boot/parked-revive-gate.d.ts +1 -1
  63. package/dist/boot/parked-revive-gate.js +1 -1
  64. package/dist/boot/reapers.d.ts +12 -4
  65. package/dist/boot/reapers.js +40 -16
  66. package/dist/boot/resolve-spec.d.ts +2 -0
  67. package/dist/boot/resolve-spec.js +126 -123
  68. package/dist/boot/retention-lane.d.ts +4 -42
  69. package/dist/boot/runner-deps.js +1 -1
  70. package/dist/boot/session-faces.d.ts +1 -0
  71. package/dist/boot/session-faces.js +11 -3
  72. package/dist/boot/shutdown.js +27 -9
  73. package/dist/boot/stage-01-config.d.ts +1 -1
  74. package/dist/boot/stage-01-config.js +7 -3
  75. package/dist/boot/stage-02-web-admin-pull.d.ts +1 -1
  76. package/dist/boot/stage-02-web-admin-pull.js +10 -8
  77. package/dist/boot/stage-03-store-backend.d.ts +2 -1
  78. package/dist/boot/stage-03-store-backend.js +2 -2
  79. package/dist/boot/stage-04-stores.d.ts +2 -1
  80. package/dist/boot/stage-05-execution-env.d.ts +4 -1
  81. package/dist/boot/stage-05-execution-env.js +6 -6
  82. package/dist/boot/stage-06-runners.d.ts +5 -2
  83. package/dist/boot/stage-06-runners.js +12 -13
  84. package/dist/boot/stage-07-capability-layer.d.ts +5 -2
  85. package/dist/boot/stage-07-capability-layer.js +7 -7
  86. package/dist/boot/stage-08-reapers.d.ts +5 -2
  87. package/dist/boot/stage-08-reapers.js +3 -3
  88. package/dist/boot/stage-09-leader.d.ts +6 -2
  89. package/dist/boot/stage-10-http-server.d.ts +6 -2
  90. package/dist/boot/stage-10-http-server.js +5 -3
  91. package/dist/boot/stores.d.ts +10 -0
  92. package/dist/boot/stores.js +53 -26
  93. package/dist/boot/web-admin.js +3 -3
  94. package/dist/boot/workflow-orchestration.d.ts +1 -1
  95. package/dist/boot/workflow-orchestration.js +2 -1
  96. package/dist/capabilities/center-plugins.d.ts +2 -0
  97. package/dist/capabilities/center-plugins.js +6 -2
  98. package/dist/capabilities/composite-members.d.ts +4 -1
  99. package/dist/capabilities/composite-members.js +4 -1
  100. package/dist/capabilities/execution-lane.d.ts +7 -7
  101. package/dist/capabilities/execution-lane.js +2 -2
  102. package/dist/capabilities/hands-lane.d.ts +1 -1
  103. package/dist/capabilities/scenarios.d.ts +34 -20
  104. package/dist/capabilities/scenarios.js +13 -9
  105. package/dist/capabilities/settings-contract.d.ts +29 -0
  106. package/dist/capabilities/settings-contract.js +14 -0
  107. package/dist/capabilities/skills.d.ts +5 -5
  108. package/dist/capability-facts.d.ts +56 -1
  109. package/dist/capability-facts.js +59 -8
  110. package/dist/center-credential-renewer.js +3 -2
  111. package/dist/checkpoint-ctx-seal-m28.d.ts +1 -1
  112. package/dist/config-catalog.js +19 -9
  113. package/dist/config-invariants.d.ts +18 -3
  114. package/dist/config-invariants.js +36 -19
  115. package/dist/config-lkg.d.ts +1 -1
  116. package/dist/config-lkg.js +5 -6
  117. package/dist/config-provider.d.ts +2 -2
  118. package/dist/config-provider.js +2 -0
  119. package/dist/config-types.d.ts +228 -185
  120. package/dist/config.d.ts +74 -6
  121. package/dist/config.js +146 -64
  122. package/dist/degenerate-instrument.js +1 -1
  123. package/dist/deleted-session-ids.d.ts +19 -0
  124. package/dist/deleted-session-ids.js +26 -0
  125. package/dist/deploy-facts.d.ts +155 -0
  126. package/dist/deploy-facts.js +95 -0
  127. package/dist/deployment-shape.d.ts +21 -12
  128. package/dist/deployment-shape.js +24 -6
  129. package/dist/device-ws-hub.d.ts +48 -3
  130. package/dist/device-ws-hub.js +48 -2
  131. package/dist/env-facts.d.ts +7 -5
  132. package/dist/env-facts.js +10 -6
  133. package/dist/error-code-family.d.ts +35 -0
  134. package/dist/error-code-family.js +26 -0
  135. package/dist/execution-config-root.d.ts +5 -5
  136. package/dist/execution-config-root.js +5 -5
  137. package/dist/execution-env-purpose.d.ts +14 -0
  138. package/dist/execution-env-purpose.js +29 -0
  139. package/dist/execution-lane-caps.d.ts +49 -86
  140. package/dist/execution-lane-caps.js +52 -62
  141. package/dist/execution-placement.d.ts +18 -2
  142. package/dist/execution-placement.js +19 -0
  143. package/dist/file-history-disclosure.d.ts +2 -2
  144. package/dist/fleet/drain-entry.d.ts +46 -3
  145. package/dist/fleet/drain-entry.js +6 -0
  146. package/dist/fleet/fleet-bus.d.ts +2 -1
  147. package/dist/fleet/serving-lease.js +3 -4
  148. package/dist/history-anchor.d.ts +22 -0
  149. package/dist/history-anchor.js +14 -0
  150. package/dist/hooks/branch-transcript.d.ts +1 -1
  151. package/dist/hooks/branch-transcript.js +1 -0
  152. package/dist/hooks/classic-stations.d.ts +25 -8
  153. package/dist/hooks/classic-stations.js +29 -3
  154. package/dist/hooks/command-spawn.d.ts +1 -4
  155. package/dist/hooks/command-spawn.js +0 -11
  156. package/dist/hooks/hook-runner.d.ts +85 -24
  157. package/dist/hooks/hook-runner.js +326 -109
  158. package/dist/hooks/hook-source.d.ts +14 -2
  159. package/dist/hooks/hook-source.js +8 -0
  160. package/dist/http/active-run-conflict.d.ts +1 -1
  161. package/dist/http/active-run-conflict.js +1 -1
  162. package/dist/http/admission.js +11 -1
  163. package/dist/http/approval-sweeps.d.ts +2 -5
  164. package/dist/http/approval-sweeps.js +3 -2
  165. package/dist/http/checkpoint-ctx.d.ts +76 -71
  166. package/dist/http/checkpoint-ctx.js +40 -40
  167. package/dist/http/claim-latency.d.ts +10 -0
  168. package/dist/http/claim-latency.js +12 -0
  169. package/dist/http/dispatch.js +19 -3
  170. package/dist/http/durable-run-leg.d.ts +5 -0
  171. package/dist/http/durable-run-leg.js +3 -1
  172. package/dist/http/execution-context.d.ts +7 -1
  173. package/dist/http/execution-context.js +13 -0
  174. package/dist/http/health-self-report.d.ts +6 -2
  175. package/dist/http/health-self-report.js +3 -2
  176. package/dist/http/memory-compliance-failure-reply.d.ts +2 -2
  177. package/dist/http/memory-compliance-failure-reply.js +5 -15
  178. package/dist/http/memory-control-plane-corrupt-reply.d.ts +25 -0
  179. package/dist/http/memory-control-plane-corrupt-reply.js +19 -0
  180. package/dist/http/memory-store-refusal-reply.d.ts +3 -3
  181. package/dist/http/memory-store-refusal-reply.js +3 -0
  182. package/dist/http/owner-access.d.ts +11 -0
  183. package/dist/http/owner-access.js +7 -4
  184. package/dist/http/principal-gate.d.ts +28 -16
  185. package/dist/http/principal-gate.js +10 -19
  186. package/dist/http/request-guards.d.ts +2 -2
  187. package/dist/http/request-guards.js +5 -5
  188. package/dist/http/resume-legs.d.ts +29 -10
  189. package/dist/http/resume-legs.js +94 -56
  190. package/dist/http/rewind-files-reply.d.ts +34 -0
  191. package/dist/http/rewind-files-reply.js +36 -0
  192. package/dist/http/route-ctx.d.ts +43 -26
  193. package/dist/http/route-table.js +4 -0
  194. package/dist/http/routes/adoption.d.ts +11 -0
  195. package/dist/http/routes/adoption.js +80 -6
  196. package/dist/http/routes/agents-roster.js +1 -0
  197. package/dist/http/routes/approvals-assistant.js +7 -26
  198. package/dist/http/routes/background.js +1 -0
  199. package/dist/http/routes/capabilities.js +12 -3
  200. package/dist/http/routes/devices.js +1 -1
  201. package/dist/http/routes/diagnostics.d.ts +9 -14
  202. package/dist/http/routes/diagnostics.js +10 -20
  203. package/dist/http/routes/engine.d.ts +31 -0
  204. package/dist/http/routes/engine.js +81 -0
  205. package/dist/http/routes/memory-bundle.js +3 -0
  206. package/dist/http/routes/memory-consolidation.js +3 -5
  207. package/dist/http/routes/memory-origin.d.ts +2 -2
  208. package/dist/http/routes/memory-origin.js +2 -4
  209. package/dist/http/routes/memory-policy.js +5 -1
  210. package/dist/http/routes/notify-wake.js +2 -1
  211. package/dist/http/routes/observability.js +3 -6
  212. package/dist/http/routes/projects.d.ts +70 -0
  213. package/dist/http/routes/projects.js +86 -0
  214. package/dist/http/routes/rules.js +30 -2
  215. package/dist/http/routes/runs.js +15 -11
  216. package/dist/http/routes/session-sync.js +39 -35
  217. package/dist/http/routes/sessions-list.d.ts +1 -1
  218. package/dist/http/routes/sessions.d.ts +7 -1
  219. package/dist/http/routes/sessions.js +108 -2
  220. package/dist/http/routes/tasks.js +32 -8
  221. package/dist/http/routes/trace-usage.js +1 -1
  222. package/dist/http/run-concurrency-cap.d.ts +86 -0
  223. package/dist/http/run-concurrency-cap.js +54 -0
  224. package/dist/http/server.d.ts +31 -14
  225. package/dist/http/server.js +29 -3
  226. package/dist/http/stored-body-replay.d.ts +12 -7
  227. package/dist/http/stored-body-replay.js +28 -5
  228. package/dist/http/wire-types.d.ts +27 -13
  229. package/dist/index.d.ts +2 -2
  230. package/dist/index.js +1 -1
  231. package/dist/instruction-source-notice.d.ts +1 -1
  232. package/dist/json-body-limit.d.ts +8 -0
  233. package/dist/json-body-limit.js +2 -0
  234. package/dist/leader/diffout.d.ts +1 -1
  235. package/dist/local-data-root.d.ts +2 -2
  236. package/dist/memory-embedder-reembed.d.ts +38 -0
  237. package/dist/memory-embedder-reembed.js +20 -0
  238. package/dist/memory-incident-sink.d.ts +0 -28
  239. package/dist/memory-incident-sink.js +5 -0
  240. package/dist/memory-operator-faces.d.ts +9 -4
  241. package/dist/memory-scope-stores.d.ts +9 -7
  242. package/dist/memory-scope-stores.js +3 -14
  243. package/dist/memory-scope.d.ts +38 -2
  244. package/dist/memory-scope.js +33 -2
  245. package/dist/memory-store-refusal.d.ts +17 -4
  246. package/dist/memory-store-refusal.js +1 -1
  247. package/dist/memory-sync-client.d.ts +2 -0
  248. package/dist/memory-sync-client.js +13 -11
  249. package/dist/memory-sync.js +1 -1
  250. package/dist/model-compat.d.ts +35 -21
  251. package/dist/model-compat.js +49 -21
  252. package/dist/model-entry-refusal.d.ts +11 -1
  253. package/dist/model-entry-refusal.js +7 -0
  254. package/dist/namespaced-rule-name.d.ts +18 -1
  255. package/dist/namespaced-rule-name.js +12 -0
  256. package/dist/net-address.d.ts +53 -0
  257. package/dist/net-address.js +111 -0
  258. package/dist/observability/fail-open.d.ts +29 -17
  259. package/dist/observability/fail-open.js +29 -17
  260. package/dist/observability/metrics.d.ts +2 -0
  261. package/dist/observability/metrics.js +2 -0
  262. package/dist/observability/secret-env-scrub.d.ts +30 -4
  263. package/dist/observability/secret-env-scrub.js +15 -3
  264. package/dist/orchestration/workflow-agent-session-index.d.ts +7 -12
  265. package/dist/orchestration/workflow-agent-session-index.js +1 -6
  266. package/dist/orchestration/workflow-completion-inbox.d.ts +26 -6
  267. package/dist/orchestration/workflow-completion-inbox.js +63 -45
  268. package/dist/orchestration/workflow-notify-journal.js +2 -3
  269. package/dist/org-delivery-gate.js +1 -1
  270. package/dist/org-memory-admission.d.ts +5 -2
  271. package/dist/org-memory-admission.js +25 -10
  272. package/dist/parked-decide.d.ts +33 -26
  273. package/dist/parked-decide.js +36 -44
  274. package/dist/peer-directory.d.ts +6 -12
  275. package/dist/peer-directory.js +5 -1
  276. package/dist/plugins/approval-ask-store-file.d.ts +10 -2
  277. package/dist/plugins/approval-ask-store-file.js +37 -4
  278. package/dist/plugins/approval-ask-store-memory.d.ts +5 -3
  279. package/dist/plugins/approval-ask-store-memory.js +11 -2
  280. package/dist/plugins/approval-ask-store-sql.d.ts +3 -0
  281. package/dist/plugins/approval-ask-store-sql.js +3 -1
  282. package/dist/plugins/blob-backend.d.ts +38 -195
  283. package/dist/plugins/blob-backend.js +33 -229
  284. package/dist/plugins/caching-session-store.d.ts +12 -5
  285. package/dist/plugins/caching-session-store.js +3 -0
  286. package/dist/plugins/checkpoint-index-columns.d.ts +1 -1
  287. package/dist/plugins/checkpoint-index-columns.js +3 -2
  288. package/dist/plugins/checkpoint-store-face.d.ts +426 -0
  289. package/dist/plugins/checkpoint-store-face.js +152 -0
  290. package/dist/plugins/device-store-sql.d.ts +2 -2
  291. package/dist/plugins/device-store-sql.js +5 -10
  292. package/dist/plugins/execution-lane-rename-m40.d.ts +20 -0
  293. package/dist/plugins/execution-lane-rename-m40.js +10 -0
  294. package/dist/plugins/execution-placement-sql.d.ts +63 -88
  295. package/dist/plugins/execution-placement-sql.js +94 -54
  296. package/dist/plugins/file-run-store.d.ts +26 -18
  297. package/dist/plugins/file-run-store.js +64 -75
  298. package/dist/plugins/fork-routing-session-store.d.ts +6 -2
  299. package/dist/plugins/fork-routing-session-store.js +2 -2
  300. package/dist/plugins/imported-layer-root-retirement.d.ts +22 -11
  301. package/dist/plugins/imported-layer-root-retirement.js +4 -8
  302. package/dist/plugins/inbox-payload-column.d.ts +14 -0
  303. package/dist/plugins/inbox-payload-column.js +13 -0
  304. package/dist/plugins/local-checkpoint-store.d.ts +7 -2
  305. package/dist/plugins/local-checkpoint-store.js +13 -8
  306. package/dist/plugins/local-data-dir-modes-m39.d.ts +48 -0
  307. package/dist/plugins/local-data-dir-modes-m39.js +182 -0
  308. package/dist/plugins/local-engine-high-water.d.ts +11 -0
  309. package/dist/plugins/local-engine-high-water.js +59 -0
  310. package/dist/plugins/local-session-store.d.ts +119 -30
  311. package/dist/plugins/local-session-store.js +156 -53
  312. package/dist/plugins/local-task-attachment-store.d.ts +2 -0
  313. package/dist/plugins/local-task-attachment-store.js +10 -11
  314. package/dist/plugins/memory-embedder-fingerprint.d.ts +33 -10
  315. package/dist/plugins/memory-embedder-fingerprint.js +52 -12
  316. package/dist/plugins/memory-embedder.d.ts +1 -1
  317. package/dist/plugins/memory-embedder.js +2 -2
  318. package/dist/plugins/memory-engine-pg.d.ts +30 -6
  319. package/dist/plugins/memory-engine-pg.js +96 -214
  320. package/dist/plugins/memory-engine-sql-apply.d.ts +130 -0
  321. package/dist/plugins/memory-engine-sql-apply.js +358 -0
  322. package/dist/plugins/memory-engine-tidb.d.ts +38 -9
  323. package/dist/plugins/memory-engine-tidb.js +99 -230
  324. package/dist/plugins/memory-key-guards.d.ts +1 -1
  325. package/dist/plugins/memory-origin-law.d.ts +3 -3
  326. package/dist/plugins/one-time-migrations.d.ts +169 -83
  327. package/dist/plugins/one-time-migrations.js +295 -235
  328. package/dist/plugins/owner-only-file-mode.d.ts +29 -0
  329. package/dist/plugins/owner-only-file-mode.js +141 -0
  330. package/dist/plugins/permission-rule-store-file.d.ts +17 -3
  331. package/dist/plugins/permission-rule-store-file.js +20 -1
  332. package/dist/plugins/pg-pool.d.ts +2 -1
  333. package/dist/plugins/pg-pool.js +12 -5
  334. package/dist/plugins/release-version.d.ts +20 -0
  335. package/dist/plugins/release-version.js +28 -0
  336. package/dist/plugins/remote-env-adb.d.ts +20 -4
  337. package/dist/plugins/remote-env-adb.js +39 -11
  338. package/dist/plugins/remote-env-e2b.d.ts +12 -3
  339. package/dist/plugins/remote-env-e2b.js +6 -4
  340. package/dist/plugins/remote-env-host.d.ts +9 -1
  341. package/dist/plugins/remote-env-host.js +6 -5
  342. package/dist/plugins/remote-env-k8s.d.ts +5 -2
  343. package/dist/plugins/remote-env-k8s.js +15 -4
  344. package/dist/plugins/remote-env-local-docker.d.ts +4 -1
  345. package/dist/plugins/remote-env-local-docker.js +3 -3
  346. package/dist/plugins/remote-env-ssh.d.ts +8 -2
  347. package/dist/plugins/remote-env-ssh.js +26 -24
  348. package/dist/plugins/remote-shell.d.ts +59 -30
  349. package/dist/plugins/remote-shell.js +175 -62
  350. package/dist/plugins/retention-declaration.d.ts +37 -0
  351. package/dist/plugins/retention-declaration.js +9 -0
  352. package/dist/plugins/retention-deployment.d.ts +126 -0
  353. package/dist/plugins/retention-deployment.js +88 -0
  354. package/dist/plugins/retention-lane-store-sql.d.ts +74 -4
  355. package/dist/plugins/retention-lane-store-sql.js +103 -1
  356. package/dist/plugins/retention-sql.d.ts +29 -0
  357. package/dist/plugins/retention-sql.js +8 -0
  358. package/dist/plugins/run-store-sql.js +2 -2
  359. package/dist/plugins/schema-consistency.d.ts +0 -6
  360. package/dist/plugins/schema-consistency.js +1 -2
  361. package/dist/plugins/schema-ensure-legs.d.ts +1 -1
  362. package/dist/plugins/schema-ensure-legs.js +13 -3
  363. package/dist/plugins/session-ext-table.d.ts +74 -0
  364. package/dist/plugins/session-ext-table.js +121 -0
  365. package/dist/plugins/session-fork.d.ts +31 -9
  366. package/dist/plugins/session-fork.js +3 -2
  367. package/dist/plugins/session-placement.d.ts +4 -2
  368. package/dist/plugins/session-row-sql.d.ts +8 -7
  369. package/dist/plugins/session-row-sql.js +15 -7
  370. package/dist/plugins/session-store-sql.d.ts +131 -0
  371. package/dist/plugins/session-store-sql.js +298 -0
  372. package/dist/plugins/session-workspace-cell.d.ts +2 -2
  373. package/dist/plugins/session-workspace-cell.js +2 -2
  374. package/dist/plugins/shared-memory-store-sql.d.ts +10 -0
  375. package/dist/plugins/shared-memory-store-sql.js +13 -13
  376. package/dist/plugins/snapshot-bucket-presence.js +1 -1
  377. package/dist/plugins/sql-driver.d.ts +23 -7
  378. package/dist/plugins/sql-driver.js +41 -8
  379. package/dist/plugins/sql-errors.d.ts +5 -2
  380. package/dist/plugins/sql-errors.js +4 -0
  381. package/dist/plugins/sql-json-column.d.ts +5 -1
  382. package/dist/plugins/store-backend.d.ts +46 -16
  383. package/dist/plugins/store-backend.js +192 -69
  384. package/dist/plugins/store-contracts.d.ts +10 -13
  385. package/dist/plugins/store-contracts.js +1 -9
  386. package/dist/plugins/store-sweep.d.ts +63 -0
  387. package/dist/plugins/store-sweep.js +48 -0
  388. package/dist/plugins/task-attachment-store.d.ts +6 -8
  389. package/dist/plugins/task-attachment-store.js +15 -10
  390. package/dist/plugins/task-list-store-sql.d.ts +1 -1
  391. package/dist/plugins/text-column-capacity.d.ts +21 -0
  392. package/dist/plugins/text-column-capacity.js +5 -0
  393. package/dist/plugins/tidb-pool.d.ts +3 -2
  394. package/dist/plugins/tidb-pool.js +20 -32
  395. package/dist/plugins/user-input-ledger-sql.d.ts +1 -1
  396. package/dist/prompt-screen.d.ts +6 -9
  397. package/dist/prompt-screen.js +2 -5
  398. package/dist/read-face-posture.d.ts +6 -6
  399. package/dist/read-face-posture.js +2 -2
  400. package/dist/request-value-closure.d.ts +5 -5
  401. package/dist/request-value-closure.js +1 -1
  402. package/dist/rules-consent.d.ts +48 -27
  403. package/dist/rules-consent.js +147 -23
  404. package/dist/run-cancel-context.d.ts +4 -1
  405. package/dist/run-cancel-context.js +2 -1
  406. package/dist/run-local.js +17 -13
  407. package/dist/runs.d.ts +48 -30
  408. package/dist/runs.js +27 -17
  409. package/dist/runtime-caps-resolver.d.ts +15 -8
  410. package/dist/runtime-caps-resolver.js +14 -10
  411. package/dist/sandbox-egress-policy.js +6 -11
  412. package/dist/sandbox-rbac-rules.d.ts +88 -0
  413. package/dist/sandbox-rbac-rules.js +80 -0
  414. package/dist/sealed-key-layout.d.ts +16 -0
  415. package/dist/sealed-key-layout.js +3 -0
  416. package/dist/sealed-key.js +8 -6
  417. package/dist/security.d.ts +43 -9
  418. package/dist/security.js +9 -2
  419. package/dist/sema-config-dir.js +2 -2
  420. package/dist/server-secret-env.d.ts +2 -0
  421. package/dist/service-version.d.ts +2 -1
  422. package/dist/service-version.js +2 -2
  423. package/dist/session-error-wire.d.ts +1 -1
  424. package/dist/session-incarnation.d.ts +8 -5
  425. package/dist/session-notify-door.d.ts +5 -3
  426. package/dist/session-resident-background.d.ts +110 -0
  427. package/dist/session-resident-background.js +88 -0
  428. package/dist/session-row.d.ts +1 -1
  429. package/dist/session-sync-kernel.d.ts +53 -14
  430. package/dist/session-sync-kernel.js +70 -1
  431. package/dist/session-sync.d.ts +5 -3
  432. package/dist/session-workspace.d.ts +12 -2
  433. package/dist/session-workspace.js +6 -0
  434. package/dist/sighup-idle.d.ts +9 -7
  435. package/dist/sighup-idle.js +4 -5
  436. package/dist/spec-fields.d.ts +16 -0
  437. package/dist/spec-fields.js +7 -0
  438. package/dist/store-posture.d.ts +2 -1
  439. package/dist/stored-request-env-credentials-m38.d.ts +3 -0
  440. package/dist/stored-request-env-credentials-m38.js +8 -0
  441. package/dist/stored-request-hooks-m20.d.ts +3 -2
  442. package/dist/stored-request-hooks-m20.js +19 -14
  443. package/dist/stored-request-prompt-profile-m30.d.ts +1 -1
  444. package/dist/stores-sql/blob-index-sql.d.ts +148 -0
  445. package/dist/stores-sql/blob-index-sql.js +154 -0
  446. package/dist/{plugins → stores-sql}/checkpoint-store-sql.d.ts +14 -428
  447. package/dist/{plugins → stores-sql}/checkpoint-store-sql.js +43 -220
  448. package/dist/{plugins → stores-sql}/file-history-store-sql.d.ts +23 -11
  449. package/dist/{plugins → stores-sql}/file-history-store-sql.js +23 -18
  450. package/dist/{plugins → stores-sql}/mailbox-store-sql.d.ts +2 -2
  451. package/dist/{plugins → stores-sql}/mailbox-store-sql.js +4 -4
  452. package/dist/{plugins → stores-sql}/pg-session-storage.d.ts +27 -67
  453. package/dist/{plugins → stores-sql}/pg-session-storage.js +82 -207
  454. package/dist/{plugins → stores-sql}/retention-store-sql.d.ts +123 -217
  455. package/dist/{plugins → stores-sql}/retention-store-sql.js +66 -190
  456. package/dist/{plugins → stores-sql}/roster-store-sql.d.ts +2 -2
  457. package/dist/{plugins → stores-sql}/roster-store-sql.js +1 -1
  458. package/dist/{plugins → stores-sql}/session-event-payload.d.ts +1 -1
  459. package/dist/{plugins → stores-sql}/session-event-payload.js +1 -1
  460. package/dist/stores-sql/session-policy-store-sql.d.ts +1 -1
  461. package/dist/stores-sql/session-write-hooks.d.ts +59 -0
  462. package/dist/stores-sql/session-write-hooks.js +2 -0
  463. package/dist/{plugins → stores-sql}/tidb-session-storage.d.ts +10 -11
  464. package/dist/{plugins → stores-sql}/tidb-session-storage.js +10 -21
  465. package/dist/{plugins → stores-sql}/tidb-session-store.d.ts +35 -112
  466. package/dist/{plugins → stores-sql}/tidb-session-store.js +73 -169
  467. package/dist/{plugins → stores-sql}/tool-result-store-sql.d.ts +3 -3
  468. package/dist/{plugins → stores-sql}/tool-result-store-sql.js +6 -6
  469. package/dist/stores-sql/windowed-session-storage.d.ts +56 -0
  470. package/dist/stores-sql/windowed-session-storage.js +61 -0
  471. package/dist/{plugins → stores-sql}/workflow-journal-store-sql.d.ts +7 -12
  472. package/dist/{plugins → stores-sql}/workflow-journal-store-sql.js +3 -8
  473. package/dist/task-a2a.d.ts +7 -1
  474. package/dist/task-a2a.js +15 -14
  475. package/dist/task-cwd.d.ts +11 -3
  476. package/dist/task-cwd.js +17 -1
  477. package/dist/task-mcp.d.ts +10 -2
  478. package/dist/task-mcp.js +13 -16
  479. package/dist/task-settings.d.ts +68 -8
  480. package/dist/task-settings.js +63 -6
  481. package/dist/tool-approval.d.ts +23 -10
  482. package/dist/tool-approval.js +10 -6
  483. package/dist/trace/core-keyset-guard.d.ts +17 -10
  484. package/dist/trace/engine-notice-wire.d.ts +1 -1
  485. package/dist/trace/engine-notice-wire.js +4 -0
  486. package/dist/trace/exit-seat.d.ts +29 -1
  487. package/dist/trace/exit-seat.js +4 -0
  488. package/dist/trace/project.d.ts +33 -16
  489. package/dist/trace/project.js +21 -9
  490. package/dist/trace/redact.d.ts +13 -2
  491. package/dist/trace/redact.js +347 -78
  492. package/dist/trace/self-minted-wire.d.ts +587 -16
  493. package/dist/trace/self-minted-wire.js +215 -9
  494. package/dist/trace/sema-provenance.d.ts +45 -41
  495. package/dist/trace/sema-provenance.js +81 -10
  496. package/dist/trace/task-notification-facets.d.ts +70 -2
  497. package/dist/trace/task-notification-facets.js +71 -1
  498. package/dist/trace/wire-projection-faces.d.ts +39 -3
  499. package/dist/trace/wire-projection-faces.js +27 -2
  500. package/dist/unread-request-members.d.ts +66 -0
  501. package/dist/unread-request-members.js +41 -0
  502. package/dist/usage-analytics.d.ts +4 -0
  503. package/dist/user-input-ledger.d.ts +2 -2
  504. package/dist/web-admin-client/apply-effective.js +22 -26
  505. package/dist/web-admin-client/candidate-gate.d.ts +35 -3
  506. package/dist/web-admin-client/candidate-gate.js +53 -5
  507. package/dist/web-admin-client/center-request.d.ts +4 -1
  508. package/dist/web-admin-client/center-request.js +2 -1
  509. package/dist/web-admin-client/effective-keys.js +0 -1
  510. package/dist/web-admin-client/facade.d.ts +1 -1
  511. package/dist/web-admin-client/http-client.d.ts +1 -0
  512. package/dist/web-admin-client/http-client.js +17 -9
  513. package/dist/web-admin-client/restart-signal.js +5 -2
  514. package/dist/web-admin-client/skills-mcp.d.ts +20 -6
  515. package/dist/web-admin-client/skills-mcp.js +26 -21
  516. package/dist/web-admin-client/types.d.ts +34 -49
  517. package/docs/DEVICE-EXECUTOR-PROTOCOL.md +2 -2
  518. package/package.json +22 -13
  519. package/scripts/drain-check-local.mjs +8 -55
  520. package/scripts/drain-check.mysql.sql +3 -40
  521. package/scripts/drain-check.pg.sql +3 -40
  522. package/skills/update-config.md +1 -1
  523. package/wire-changes/server@7.146.0.json +3221 -0
  524. package/wire-changes/server@7.147.0.json +813 -0
  525. package/dist/approval-batch-census.d.ts +0 -27
  526. package/dist/approval-batch-census.js +0 -27
@@ -22,7 +22,7 @@ import type { GitApiKind } from "./git-api-kind.js";
22
22
  import type { CustomPkgSource } from "./sandbox-pkg-source.js";
23
23
  import type { MemoryEngineBackend, StoreBackend as StoreBackendWord } from "@sema-agent/settings-schema/execution-lanes";
24
24
  import { DRAIN_GRACE_FLOOR_MS } from "@sema-agent/settings-schema/fleet";
25
- import type { AtMention, SandboxGitConfig } from "@sema-agent/settings-schema";
25
+ import type { AtMention, ProjectRegistration, SandboxGitConfig } from "@sema-agent/settings-schema";
26
26
  import type { ModsDeclaration } from "./mods-declaration.js";
27
27
  /** [ref]:记忆向量面的 embedder 坐标(env `MEMORY_EMBEDDER_*` 解析结果;单一属主 = 本类型,
28
28
  * `plugins/memory-embedder.ts` 的工厂直接消费它,不复制形状)。语义与三问见
@@ -39,6 +39,9 @@ export interface MemoryEmbedderConfig {
39
39
  timeoutMs: number;
40
40
  /** 可选 Bearer(自托管 TEI/vllm/ollama 通常不需要;公有云端点需要)。 */
41
41
  apiKey?: string;
42
+ /** 运维已确认「记下的身份与本身份对不上时,清掉向量列、按本身份重嵌」(env `MEMORY_EMBEDDER_REEMBED=<model>/<dimensions>`,
43
+ * config 层已判过它恰好点名本身份)。缺席 = 未确认 ⇒ 指纹门对不上就拒启、一行不清。只交给指纹门,不是 transport 参数。 */
44
+ reembedConfirmed?: true;
42
45
  }
43
46
  /**
44
47
  * [ref] §4 —— 托管留存的**灰度档**闭集。`as const` 数组是词表的唯一真源(config 解析、能力位、审计行
@@ -503,6 +506,159 @@ export interface ImageBakeConfig {
503
506
  /** Service configuration, read from environment — the **平铺面**(the ONE storage location for every
504
507
  * field). `ServiceConfig` (bottom of this file) = this flat face **plus** nine read-only group views;
505
508
  * fixtures that CONSTRUCT a config literal build this type and hand it to `attachConfigGroups`. */
509
+ /**
510
+ * The deployment's execution lane, as COMPOSED ([ref] v1b + [ref]; PEER adapters). Every deployment names it: the env
511
+ * `REMOTE_EXEC` (one lane word), or — with `CONFIG_PROVIDER=local` — `config.d/remote-exec.json`; the execution-lane composition step
512
+ * (`boot/execution-lane.ts`) refuses to start when neither declares one. `ServiceConfig.remoteExec` is therefore always present; only the raw
513
+ * shape `loadConfig()` returns ({@link LoadedConfig}) may lack it. `none` = the agent's tools get no execution environment (no factory,
514
+ * no `executionEnv`). Secrets (apiKey/privateKey) ONLY from env.
515
+ * - `e2b` → per-task E2B Firecracker VM (isolated, suspendable). The default code-agent worker.
516
+ * - `k8s` → per-task Kata pod on our k3s (isolated, NOT suspendable — no managed memory
517
+ * snapshot). Self-hosted sandbox lane; auth = explicit K8S_* env or in-cluster service account.
518
+ * - `ssh` → a real host over SSH (NOT isolated/suspendable; [ref] §5). AI-orchestrated batch deploy.
519
+ * - `adb` → a real device over ADB (NOT isolated/suspendable). On-device APP testing.
520
+ */
521
+ export type RemoteExecConfig = {
522
+ provider: "e2b";
523
+ apiKey: string;
524
+ template?: string;
525
+ timeoutMs?: number;
526
+ livenessMs?: number;
527
+ allowInternetAccess?: boolean;
528
+ /** [ref] —— `E2B_SANDBOX_ENV=NAME,NAME` 点到、且本进程环境里真有的键 ⇒ 原值(经唯一的「点名放行」谓词 `allowlistedEnv`,
529
+ * 空串值照带)。键缺席 = 旋钮未设 / 空串;名单形错(空段 / 非变量名形 / 点名名单型旋钮)拒启,源里没有的名按序号 warn。 */
530
+ sandboxEnv?: Record<string, string>;
531
+ mountPath?: string;
532
+ /** [ref]:崩溃遗留沙盒回收腿(E2B_ORPHAN_RECLAIM,默认 true;判据与 v1 边界见
533
+ * plugins/e2b-orphan-reclaim.ts 头注)。 */
534
+ orphanReclaim?: boolean;
535
+ } | {
536
+ provider: "k8s";
537
+ image: string;
538
+ apiUrl?: string;
539
+ token?: string;
540
+ caCert?: string;
541
+ insecureTls?: boolean;
542
+ /** `K8S_NAMESPACE` — the namespace the sandbox pods live in. REQUIRED, no default: the loader refuses to start when `REMOTE_EXEC=k8s` names the
543
+ * lane without it, so this arm never carries an absent namespace and no consumer needs a fallback of its own. */
544
+ namespace: string;
545
+ runtimeClass?: string;
546
+ mountPath?: string;
547
+ timeoutMs?: number;
548
+ /** `K8S_LIVENESS_MS` — the lane's liveness bound (ms; the `E2B_LIVENESS_MS` twin, same parser; absent ⇒ the adapter's
549
+ * default 120 s): cuts a command silent for this long ONLY when its caller stated no timeout (`exec-bounds.ts`). */
550
+ livenessMs?: number;
551
+ /** Resource-profile knobs: sandbox pod limits (adapter defaults: 2Gi / 1 cpu). */
552
+ memory?: string;
553
+ cpu?: string;
554
+ /** `K8S_SANDBOX_IPV6`(闭集与缺省的属主 `sandbox-egress-policy.ts`):`disabled` ⇒ 沙箱 pod 级 sysctl 关 IPv6;`enabled` ⇒ pod spec 不带 sysctl。
555
+ * loader 恒铸;可选只为手搓配置。 */
556
+ sandboxIpv6?: import("./sandbox-egress-policy.js").SandboxIpv6;
557
+ /** `K8S_SANDBOX_BROKER_IMAGE` — the member git-credential broker container's image (`containers[1]` of a member's sandbox pod; this
558
+ * engine's own image is the recommended value — the broker is a program of this package at a fixed path, `broker/constants.ts`). Absent /
559
+ * empty ⇒ the plane is off (`credentialPlane.sandboxGit` = `broker_image_unset`) and no pod carries a broker. */
560
+ brokerImage?: string;
561
+ /** `K8S_SANDBOX_ENV=NAME,NAME` 点到、且本进程环境里真有的键 ⇒ 原值(与 e2b 的 `sandboxEnv` 同名同形、同一只解析器、同一只谓词 `allowlistedEnv`,
562
+ * 空串值照带)。只进 pod 容器 env;装配点与包源派生 env 合并一处,显式名单胜。键缺席 = 旋钮未设 / 空串(零转发)。 */
563
+ sandboxEnv?: Record<string, string>;
564
+ s3Snapshot?: {
565
+ endpoint: string;
566
+ bucket: string;
567
+ accessKey: string;
568
+ secretKey: string;
569
+ region?: string;
570
+ keyPrefix?: string;
571
+ presignTtlSec?: number;
572
+ };
573
+ /** Workspace persistence by space key (`WORKSPACE_PERSIST`) and snapshots kept per space key (`WORKSPACE_SNAPSHOT_KEEP`).
574
+ * The loader always mints both on this arm; optional only so hand-built configs may omit them. Effective policy =
575
+ * the capability fact `workspaceSpace` (`capability-facts.ts`, the one reading: defaults applied there, absent store ⇒
576
+ * unavailable). */
577
+ workspacePersist?: import("./workspace-space.js").WorkspacePersist;
578
+ workspaceSnapshotKeep?: number;
579
+ /** `WORKSPACE_SNAPSHOT_TIMEOUT_MS` — the lane's one data bound (`workspace-space.ts`); the loader always mints it, the boot
580
+ * assembly hands it to the adapter as `dataTimeoutMs`, the capability fact reports it (`workspaceSync.timeoutMs`). */
581
+ workspaceSnapshotTimeoutMs?: number;
582
+ /** The build-cache volume per workspace space (`WORKSPACE_CACHE=volume`, `_SIZE`, `_MOUNT`; `workspace-cache.ts`); present iff
583
+ * `volume`. Effective policy = the capability fact `workspaceCache`. */
584
+ workspaceCache?: import("./workspace-cache.js").WorkspaceCacheCapability;
585
+ /** `WORKSPACE_SNAPSHOT_EXCLUDE` — the snapshot's tar exclusion table (closed item form, `workspace-space.ts`); present iff
586
+ * non-empty. Handed to the adapter's one tar upload (both snapshot lanes); never on the wire. */
587
+ workspaceSnapshotExclude?: readonly string[];
588
+ } | {
589
+ provider: "ssh";
590
+ host: string;
591
+ port?: number;
592
+ username: string;
593
+ privateKey: string;
594
+ mountPath?: string;
595
+ hostKey?: {
596
+ fingerprintSha256?: string;
597
+ knownHostsPath?: string;
598
+ };
599
+ } | {
600
+ provider: "adb";
601
+ serial: string;
602
+ adbPath?: string;
603
+ mountPath?: string;
604
+ } | {
605
+ provider: "host";
606
+ workspaceBase?: string;
607
+ commandTimeoutMs?: number;
608
+ } | {
609
+ provider: "none";
610
+ } | {
611
+ provider: "device";
612
+ /** `DEVICE_DELIVERY_TIMEOUT_MS`(默认 10s)= 等在途槽的上限;到期 = `device.busy`(§5.5)。 */
613
+ deliveryTimeoutMs?: number;
614
+ /** `DEVICE_RECONNECT_GRACE_MS`(默认 120s)= 断连后在途不判丢的窗(§5.4 同 epoch 重连)。 */
615
+ reconnectGraceMs?: number;
616
+ /** `DEVICE_EXEC_TIMEOUT_MS`(默认 1800s)= 指令级默认超时;core 的 per-command `timeout` 可收紧。 */
617
+ execTimeoutMs?: number;
618
+ /** `DEVICE_MAX_INFLIGHT_PER_DEVICE`(§11-O3 clay 已裁 = 4)。 */
619
+ maxInflightPerDevice?: number;
620
+ /** `DEVICE_MAX_PREAUTH_PER_REMOTE`(默认 8;字面 `off` = 显式停用 per-remote 层)= 未鉴权
621
+ * 握手的 per-remote 并发帽([ref]/[ref]:帽键是裸 remoteAddress——XFF 反代 / 公司 NAT 部署
622
+ * 形会把全员折叠成单键,per-remote 层退化成共享预算而非公平层,`off` + 全局帽 64 是诚实形)。
623
+ * 坏值拒启([ref] A 档),词表与拒因见 config.ts `parseDevicePreAuthPerRemoteEnv`。 */
624
+ maxPreAuthPerRemote?: number | "off";
625
+ /** `DEVICE_TRUSTED_PROXY_CIDRS`([ref];缺席 = 名单空 = 不读任何代理头,帽键 = socket 对端)= per-remote 帽键的可信代理
626
+ * 名单(规范 CIDR 文本)。socket 对端落在名单内,汇聚端才读 `X-Forwarded-For`、取自右向左第一个名单外地址作帽键。
627
+ * 坏项拒启([ref] A 档),拒因见 config.ts `parseDeviceTrustedProxyCidrsEnv`;唯一消费点 = `boot/device-lane.ts` 透传汇聚端。 */
628
+ trustedProxyCidrs?: readonly string[];
629
+ /** `DEVICE_ENROLL_TOKEN_TTL_SEC`(§4.7 第五个旋钮;默认 900 = §7-T5 ① 的 15min)= enrollment
630
+ * token 的有效期**时长**(整秒,自 **DB now** 起算 —— 时间权威是库,不是副本墙钟)。唯一消费点 =
631
+ * 签发动词 `POST /v1/devices/enroll-tokens`(`http/routes/devices.ts`);[ref] 之前它刻意未铸
632
+ * (端点不存在 ⇒ 铸了就是一个「配了不生效」的死键,[ref] 病族),随该端点同批铸 + 接线。
633
+ * 域 = `[1, 86400]` 的十进制正整数,坏值**拒启**([ref] A 档;解析器 `parseDeviceEnrollTokenTtlEnv`)。
634
+ * 缺席 ⇒ 签发点的属主默认 900(不在 config 层抄第二份默认,与本族其余旋钮同姿势)。 */
635
+ enrollTokenTtlSec?: number;
636
+ /** `DEVICE_RELAY_URL` = 设备入口的运维声明,**必填**(缺席 / 空串 / 只含空白 ⇒ 配置期拒起:契约包车道表 device 行的必需键,同所有车道的必需键判官 `laneMissingEnv`;值的文法与凭据形由解析器 `parseDeviceRelayUrlEnv` 拒):
637
+ * `{ kind: "url" }` = 设备连不到本引擎自己的地址(引擎在中继 / 网关之后)时该拨的那一个 ws(s) URL,**逐字**上能力面 `deviceExecutor.relayUrl`
638
+ * (唯一消费点 `http/routes/capabilities.ts`);`{ kind: "none" }`(字面 `none`)= 没有中继,设备按本引擎地址 + `deviceExecutor.wsPath` 拨号,能力面不带 `relayUrl`。
639
+ * 必填的理由:「设备拨哪里」只有运维知道;缺席曾被读成「直拨」,于是撤掉中继声明而根会话行上还有设备绑定时,设备改拨引擎地址(入口已收窄则拨不到)、
640
+ * 绑定却留在格上 —— 缺席与「声明了直拨」是两件事,只有后者放行。`none` ∧ 有绑定 ⇒ 起服 warn 点名绑定数(`boot/device-lane.ts`)。
641
+ * **不派生**:`FLEET_ADVERTISE_ADDRESS` 是对中心公告的地址(内网 pod IP / 容器别名),受众不是用户机器上的设备;从它拼出来的入口对设备多半不可达。
642
+ * URL 形门 = ws / wss 绝对地址,无 userinfo / query / fragment、不带凭据形(值逐字上能力面),坏值**拒启**。 */
643
+ relay: DeviceRelayDeclaration;
644
+ /** `DEVICE_SUPERSEDE`(默认 `stale_only`)= 同 deviceId 二连的顶替策略(§5.2)。 */
645
+ supersede?: "stale_only" | "deny";
646
+ } | {
647
+ provider: "local-docker";
648
+ image: string;
649
+ mountPath?: string;
650
+ dockerPath?: string;
651
+ dockerHost?: string;
652
+ memory?: string;
653
+ cpus?: number;
654
+ pidsLimit?: number;
655
+ dropAllCaps?: boolean;
656
+ network?: "none" | "bridge" | "host";
657
+ commandTimeoutMs?: number;
658
+ /** [ref] —— `DOCKER_SANDBOX_ENV=NAME,NAME` 点到、且本进程环境里真有的键 ⇒ 原值(与 e2b 的 `sandboxEnv` 同一只解析器、
659
+ * 同一只谓词;每条 `docker exec` 以 `-e K=V` 注入)。键缺席 = 旋钮未设 / 空串。 */
660
+ env?: Record<string, string>;
661
+ };
506
662
  export interface ServiceConfigFlat {
507
663
  port: number;
508
664
  /** OpenAI-compatible model gateway base URL (without /chat/completions) — `MODEL_GATEWAY_BASEURL`.
@@ -646,17 +802,12 @@ export interface ServiceConfigFlat {
646
802
  * Runner construction and re-expanded on every refresh-time plane swap (`Runner.swapDeps`) — HOT, same as
647
803
  * models/roles; mutateInPlace keeps the reference. */
648
804
  tiers: Record<string, string>;
649
- /** 142-S4(registry-core 0.10.0 projects 域):center 项目登记簿的 service 消费面 —
650
- * 键=projectId(PROJECT_ID_REGEX,generic lowercase UUID)。消费点:①`memoryScopeFor` 第三参数
651
- * (projectId 在场 ⇒ 项目盘 v2 键 `proj:<tenant>/<projectId>`);②`defaultScopes` 作
652
- * `TaskSpec.memory.scopes` 的种子(v2 scope 键串,OPEN 值域——本表只登记不解释)。NO env source —
653
- * populated ONLY by applyEffective(mutateInPlace,boot+refresh 整表替换);env lane 恒空(INERT)。
654
- * ProjectRegistration 的审计字段(registeredBy/registeredAt/notes)不进 ServiceConfig(runtime 不消费)。 */
655
- projects: Record<string, {
656
- displayName?: string;
657
- gitRemotes?: string[];
658
- defaultScopes?: string[];
659
- }>;
805
+ /** 项目登记簿(settings-schema `projects` 域):键 = projectId(小写规范 UUID),值 = settings-schema 的 `ProjectRegistration` **原样**
806
+ * (本仓不持第二份项目型、不挑键 —— 形与判官只在 settings-schema)。读者:`GET /v1/projects` 读面(`http/routes/projects.ts`);
807
+ * `defaultScopes` 作 `TaskSpec.memory.scopes` 的种子(v2 scope 键串,OPEN 值域 —— 本表只登记不解释)与 org 记忆准入的部署 scope 集。
808
+ * NO env source —— 只由 applyEffective 经 settings-schema 的视图面读函数判过后填(mutateInPlace,boot + refresh 整表替换);
809
+ * 本地腿恒空(settings-schema 的本地读取集不收 `projects`)。 */
810
+ projects: Record<string, ProjectRegistration>;
660
811
  /** Role → model map (1.24): `subagent`/`summarize` → the cheap model when `MODEL_CHEAP_ID` is set
661
812
  * (delegated children + compaction get cheap), `default` stays on the main model. Keys are the engine's role
662
813
  * words (core `MODEL_ROLES`, six since 7.49.0). */
@@ -889,22 +1040,13 @@ export interface ServiceConfigFlat {
889
1040
  /** 件A 目录 unavailable 退避窗(ms)——取数失败的退避语义(bound center hammering),不是策略负结果。
890
1041
  * 默认 10s。env `MEMORY_ORG_UNAVAILABLE_BACKOFF_MS`(numEnvBounded)。 */
891
1042
  memoryOrgUnavailableBackoffMs: number;
892
- /** [ref] v1b + [ref]: opt-in remote execution backend (PEER adapters, chosen by REMOTE_EXEC). Unset
893
- * → in-process stub env ([ref]: this used to read "OA/review deployments", a scenario family retired wholesale
894
- * in 5.0.0 — see RETIRED_ENVS; the real discriminant is CONFIG_PROVIDER, and REQUIRE_EXECUTION_LANE turns this
895
- * arm into a boot refusal). Secrets (apiKey/privateKey) ONLY from env.
896
- * - `e2b` → per-task E2B Firecracker VM (isolated, suspendable). The default code-agent worker.
897
- * - `k8s` → per-task Kata pod on our k3s (isolated, NOT suspendable — no managed memory
898
- * snapshot). Self-hosted sandbox lane; auth = explicit K8S_* env or in-cluster service account.
899
- * - `ssh` → a real host over SSH (NOT isolated/suspendable; [ref] §5). AI-orchestrated batch deploy.
900
- * - `adb` → a real device over ADB (NOT isolated/suspendable). On-device APP testing. */
901
1043
  /**
902
1044
  * [ref]④ —— `REMOTE_EXEC_HOME_DIR`:**执行环境的 home 目录**(core `ExecutionEnv.homeDir`),
903
1045
  * `~/…` 形权限规则(`Edit(~/.ssh/**)`)唯一的基,绝对路径。
904
1046
  *
905
1047
  * 部署级旋钮,**跨车道同一根**(不按 provider 分七根 —— 它回答的是同一个问题:「这条部署的手,
906
1048
  * 跑在哪个用户的 home 下」)。显式声明**恒赢**;缺席时只有 home 属于车道本身的那几条车道有答案
907
- * (host/in-process = `os.homedir()`、e2b = 平台固定用户),k8s/local-docker(镜像属性)、
1049
+ * (host/none = `os.homedir()`、e2b = 平台固定用户),k8s/local-docker(镜像属性)、
908
1050
  * ssh(目标机登录用户)、adb/device 一律缺席 ⇒ `~/` 规则在下单时被 422 响亮拒。
909
1051
  * 声明与出厂答案都只是**主张**:读得出家目录的车道(device 之外的六条)在每只执行环境开起来时拿环境里命令看到的 `$HOME` 证它,
910
1052
  * 不一致 / 读不出 ⇒ 那只环境不开(拒句点名两值与改法);device 读不了 ⇒ 声明即座,起服披露「来自声明、未实测」。
@@ -912,26 +1054,6 @@ export interface ServiceConfigFlat {
912
1054
  * 非绝对路径 ⇒ **拒启**([ref] A 档;core 侧同判为 `config.execution_env_home_dir_invalid`)。
913
1055
  */
914
1056
  remoteExecHomeDir?: string;
915
- /**
916
- * [ref] —— `REQUIRE_EXECUTION_LANE`:**「没点名车道」要不要拒启**。默认 **false**(缺省行为逐字不变)。
917
- *
918
- * `REMOTE_EXEC` 未设/空串 **∧** `CONFIG_PROVIDER ≠ local` ⇒ {@link remoteExec} 缺席 ⇒ `boot/execution-env.ts`
919
- * 一条工厂臂都不走 ⇒ core 的 `handsEnabled` 为 false ⇒ **整条手带一件不挂**,而任务照跑、回执
920
- * `status=completed`。[ref] 的 fail-closed 门只咬「点了名却配不齐/认不出」,**「根本没点名」是文档化的
921
- * 部署姿态**,所以那道门放行。
922
- *
923
- * 本键把那条姿态交回给运维表态:`true` ⇒ 装配尾**拒启**并点名该设什么(`config.ts` 跨域不变量区)。
924
- * 🔴 **为什么默认 off**:今天正在无手运行而自己不知道的部署(根 `docker-compose.yml` / review compose /
925
- * `--sandbox=kata` 档 / web-admin 编排器起的 worker)会**升级即挂**,而其中一部分只跑只读/分析任务、
926
- * 今天「能用」。缺省翻面留到下一个 major,翻之前生态有一版时间适配。托管清单推荐开
927
- * (`docs/DEPLOY-PREREQS.md`)。
928
- * 运维读面(2026-09-22 主会话验收订正:车原写「`GET /v1/diagnostics/wiring` 的 `executionLane.requireExecutionLane`」,
929
- * 而该端点当时**没有** `executionLane` 段、`src/` 零投影 —— 一句没兑现的承诺,按 [ref] 不信 JSDoc 只信实现行的纪律改写):
930
- * boot 期 `exec_lane_selected` 一行(`config.ts` 装配尾,带 `lane` / `source`)+ `GET /v1/config/catalog` 的目录行。
931
- * 本键的**有效值今天没有运行期读面**;要出就随 [ref] 的执行座三态在一处铸,不在这里单独长一位。
932
- * ([ref] 起诊断面**有了** `executionLane` 段,但它就是能力面那一只投影 `{provider, toolsOnThisHost, isolated?}`,**不带**本键。)
933
- */
934
- requireExecutionLane: boolean;
935
1057
  /**
936
1058
  * 沙箱 git 平面的有效配置块(本部署经凭据代理路由哪些 git origin;契约 `SandboxGitConfig`:规范形 origin ≤ 16、两两不同、`connectUrl` 必 https、空表合法)。
937
1059
  * **唯一来源 = 中心有效配置**(`/effective` 的 `sandboxGit`,web-admin 按部署登记册投影;无 env 旋钮,本地配置源没有这一块);唯一判官 = `stageEffective`
@@ -939,142 +1061,7 @@ export interface ServiceConfigFlat {
939
1061
  * 热:读者(平面座 `sandbox-git-plane.ts` 的每一次读)逐次现读这一键,不捕获对象本身。缺席 = 没有这一块(与契约「可选、无默认」同一种缺席读法,不另设 null)。
940
1062
  */
941
1063
  sandboxGit?: SandboxGitConfig;
942
- remoteExec?: {
943
- provider: "e2b";
944
- apiKey: string;
945
- template?: string;
946
- timeoutMs?: number;
947
- livenessMs?: number;
948
- allowInternetAccess?: boolean;
949
- /** [ref] —— `E2B_SANDBOX_ENV=NAME,NAME` 点到、且本进程环境里真有的键 ⇒ 原值(经唯一的「点名放行」谓词 `allowlistedEnv`,
950
- * 空串值照带)。键缺席 = 旋钮未设 / 空串;名单形错(空段 / 非变量名形 / 点名名单型旋钮)拒启,源里没有的名按序号 warn。 */
951
- sandboxEnv?: Record<string, string>;
952
- mountPath?: string;
953
- /** [ref]:崩溃遗留沙盒回收腿(E2B_ORPHAN_RECLAIM,默认 true;判据与 v1 边界见
954
- * plugins/e2b-orphan-reclaim.ts 头注)。 */
955
- orphanReclaim?: boolean;
956
- } | {
957
- provider: "k8s";
958
- image: string;
959
- apiUrl?: string;
960
- token?: string;
961
- caCert?: string;
962
- insecureTls?: boolean;
963
- /** `K8S_NAMESPACE` — the namespace the sandbox pods live in. REQUIRED, no default: the loader refuses to start when `REMOTE_EXEC=k8s` names the
964
- * lane without it, so this arm never carries an absent namespace and no consumer needs a fallback of its own. */
965
- namespace: string;
966
- runtimeClass?: string;
967
- mountPath?: string;
968
- timeoutMs?: number;
969
- /** `K8S_LIVENESS_MS` — the lane's liveness bound (ms; the `E2B_LIVENESS_MS` twin, same parser; absent ⇒ the adapter's
970
- * default 120 s): cuts a command silent for this long ONLY when its caller stated no timeout (`exec-bounds.ts`). */
971
- livenessMs?: number;
972
- /** Resource-profile knobs: sandbox pod limits (adapter defaults: 2Gi / 1 cpu). */
973
- memory?: string;
974
- cpu?: string;
975
- /** `K8S_SANDBOX_IPV6`(闭集与缺省的属主 `sandbox-egress-policy.ts`):`disabled` ⇒ 沙箱 pod 级 sysctl 关 IPv6;`enabled` ⇒ pod spec 不带 sysctl。
976
- * loader 恒铸;可选只为手搓配置。 */
977
- sandboxIpv6?: import("./sandbox-egress-policy.js").SandboxIpv6;
978
- /** `K8S_SANDBOX_BROKER_IMAGE` — the member git-credential broker container's image (`containers[1]` of a member's sandbox pod; this
979
- * engine's own image is the recommended value — the broker is a program of this package at a fixed path, `broker/constants.ts`). Absent /
980
- * empty ⇒ the plane is off (`credentialPlane.sandboxGit` = `broker_image_unset`) and no pod carries a broker. */
981
- brokerImage?: string;
982
- /** `K8S_SANDBOX_ENV=NAME,NAME` 点到、且本进程环境里真有的键 ⇒ 原值(与 e2b 的 `sandboxEnv` 同名同形、同一只解析器、同一只谓词 `allowlistedEnv`,
983
- * 空串值照带)。只进 pod 容器 env;装配点与包源派生 env 合并一处,显式名单胜。键缺席 = 旋钮未设 / 空串(零转发)。 */
984
- sandboxEnv?: Record<string, string>;
985
- s3Snapshot?: {
986
- endpoint: string;
987
- bucket: string;
988
- accessKey: string;
989
- secretKey: string;
990
- region?: string;
991
- keyPrefix?: string;
992
- presignTtlSec?: number;
993
- };
994
- /** Workspace persistence by space key (`WORKSPACE_PERSIST`) and snapshots kept per space key (`WORKSPACE_SNAPSHOT_KEEP`).
995
- * The loader always mints both on this arm; optional only so hand-built configs may omit them. Effective policy =
996
- * the capability fact `workspaceSpace` (`capability-facts.ts`, the one reading: defaults applied there, absent store ⇒
997
- * unavailable). */
998
- workspacePersist?: import("./workspace-space.js").WorkspacePersist;
999
- workspaceSnapshotKeep?: number;
1000
- /** `WORKSPACE_SNAPSHOT_TIMEOUT_MS` — the lane's one data bound (`workspace-space.ts`); the loader always mints it, the boot
1001
- * assembly hands it to the adapter as `dataTimeoutMs`, the capability fact reports it (`workspaceSync.timeoutMs`). */
1002
- workspaceSnapshotTimeoutMs?: number;
1003
- /** The build-cache volume per workspace space (`WORKSPACE_CACHE=volume`, `_SIZE`, `_MOUNT`; `workspace-cache.ts`); present iff
1004
- * `volume`. Effective policy = the capability fact `workspaceCache`. */
1005
- workspaceCache?: import("./workspace-cache.js").WorkspaceCacheCapability;
1006
- /** `WORKSPACE_SNAPSHOT_EXCLUDE` — the snapshot's tar exclusion table (closed item form, `workspace-space.ts`); present iff
1007
- * non-empty. Handed to the adapter's one tar upload (both snapshot lanes); never on the wire. */
1008
- workspaceSnapshotExclude?: readonly string[];
1009
- } | {
1010
- provider: "ssh";
1011
- host: string;
1012
- port?: number;
1013
- username: string;
1014
- privateKey: string;
1015
- mountPath?: string;
1016
- hostKey?: {
1017
- fingerprintSha256?: string;
1018
- knownHostsPath?: string;
1019
- };
1020
- } | {
1021
- provider: "adb";
1022
- serial: string;
1023
- adbPath?: string;
1024
- mountPath?: string;
1025
- } | {
1026
- provider: "host";
1027
- workspaceBase?: string;
1028
- commandTimeoutMs?: number;
1029
- singleMachineDefault?: true;
1030
- } | {
1031
- provider: "device";
1032
- /** `DEVICE_DELIVERY_TIMEOUT_MS`(默认 10s)= 等在途槽的上限;到期 = `device.busy`(§5.5)。 */
1033
- deliveryTimeoutMs?: number;
1034
- /** `DEVICE_RECONNECT_GRACE_MS`(默认 120s)= 断连后在途不判丢的窗(§5.4 同 epoch 重连)。 */
1035
- reconnectGraceMs?: number;
1036
- /** `DEVICE_EXEC_TIMEOUT_MS`(默认 1800s)= 指令级默认超时;core 的 per-command `timeout` 可收紧。 */
1037
- execTimeoutMs?: number;
1038
- /** `DEVICE_MAX_INFLIGHT_PER_DEVICE`(§11-O3 clay 已裁 = 4)。 */
1039
- maxInflightPerDevice?: number;
1040
- /** `DEVICE_MAX_PREAUTH_PER_REMOTE`(默认 8;字面 `off` = 显式停用 per-remote 层)= 未鉴权
1041
- * 握手的 per-remote 并发帽([ref]/[ref]:帽键是裸 remoteAddress——XFF 反代 / 公司 NAT 部署
1042
- * 形会把全员折叠成单键,per-remote 层退化成共享预算而非公平层,`off` + 全局帽 64 是诚实形)。
1043
- * 坏值拒启([ref] A 档),词表与拒因见 config.ts `parseDevicePreAuthPerRemoteEnv`。 */
1044
- maxPreAuthPerRemote?: number | "off";
1045
- /** `DEVICE_ENROLL_TOKEN_TTL_SEC`(§4.7 第五个旋钮;默认 900 = §7-T5 ① 的 15min)= enrollment
1046
- * token 的有效期**时长**(整秒,自 **DB now** 起算 —— 时间权威是库,不是副本墙钟)。唯一消费点 =
1047
- * 签发动词 `POST /v1/devices/enroll-tokens`(`http/routes/devices.ts`);[ref] 之前它刻意未铸
1048
- * (端点不存在 ⇒ 铸了就是一个「配了不生效」的死键,[ref] 病族),随该端点同批铸 + 接线。
1049
- * 域 = `[1, 86400]` 的十进制正整数,坏值**拒启**([ref] A 档;解析器 `parseDeviceEnrollTokenTtlEnv`)。
1050
- * 缺席 ⇒ 签发点的属主默认 900(不在 config 层抄第二份默认,与本族其余旋钮同姿势)。 */
1051
- enrollTokenTtlSec?: number;
1052
- /** `DEVICE_RELAY_URL` = 设备入口的运维声明,**必填**(缺席 / 空串 / 只含空白 ⇒ 配置期拒起:契约包车道表 device 行的必需键,同所有车道的必需键判官 `laneMissingEnv`;值的文法与凭据形由解析器 `parseDeviceRelayUrlEnv` 拒):
1053
- * `{ kind: "url" }` = 设备连不到本引擎自己的地址(引擎在中继 / 网关之后)时该拨的那一个 ws(s) URL,**逐字**上能力面 `deviceExecutor.relayUrl`
1054
- * (唯一消费点 `http/routes/capabilities.ts`);`{ kind: "none" }`(字面 `none`)= 没有中继,设备按本引擎地址 + `deviceExecutor.wsPath` 拨号,能力面不带 `relayUrl`。
1055
- * 必填的理由:「设备拨哪里」只有运维知道;缺席曾被读成「直拨」,于是撤掉中继声明而根会话行上还有设备绑定时,设备改拨引擎地址(入口已收窄则拨不到)、
1056
- * 绑定却留在格上 —— 缺席与「声明了直拨」是两件事,只有后者放行。`none` ∧ 有绑定 ⇒ 起服 warn 点名绑定数(`boot/device-lane.ts`)。
1057
- * **不派生**:`FLEET_ADVERTISE_ADDRESS` 是对中心公告的地址(内网 pod IP / 容器别名),受众不是用户机器上的设备;从它拼出来的入口对设备多半不可达。
1058
- * URL 形门 = ws / wss 绝对地址,无 userinfo / query / fragment、不带凭据形(值逐字上能力面),坏值**拒启**。 */
1059
- relay: DeviceRelayDeclaration;
1060
- /** `DEVICE_SUPERSEDE`(默认 `stale_only`)= 同 deviceId 二连的顶替策略(§5.2)。 */
1061
- supersede?: "stale_only" | "deny";
1062
- } | {
1063
- provider: "local-docker";
1064
- image: string;
1065
- mountPath?: string;
1066
- dockerPath?: string;
1067
- dockerHost?: string;
1068
- memory?: string;
1069
- cpus?: number;
1070
- pidsLimit?: number;
1071
- dropAllCaps?: boolean;
1072
- network?: "none" | "bridge" | "host";
1073
- commandTimeoutMs?: number;
1074
- /** [ref] —— `DOCKER_SANDBOX_ENV=NAME,NAME` 点到、且本进程环境里真有的键 ⇒ 原值(与 e2b 的 `sandboxEnv` 同一只解析器、
1075
- * 同一只谓词;每条 `docker exec` 以 `-e K=V` 注入)。键缺席 = 旋钮未设 / 空串。 */
1076
- env?: Record<string, string>;
1077
- };
1064
+ remoteExec: RemoteExecConfig;
1078
1065
  /**
1079
1066
  * SVC-3 git-WORKTREE ISOLATION ([ref] CORE-6). Opt-in (WORKTREE_ISOLATION_ENABLED + WORKTREE_REPO_ROOT).
1080
1067
  * When set, the deployment's `executionEnvFactory` is wrapped so an agent core marks `isolation:"worktree"`
@@ -1299,6 +1286,10 @@ export interface ServiceConfigFlat {
1299
1286
  attachmentMimeAllowlist?: string[];
1300
1287
  /** D-1 未绑定附件 TTL(上传后从未被任何 task 引用的行,过期由 reaper 收割;缺省 24h)。 */
1301
1288
  attachmentUnboundTtlMs: number;
1289
+ /** 收编批量导入 `POST /v1/adoption/:id/sessions`:每请求最多几个会话信封(`ADOPTION_IMPORT_MAX_SESSIONS`;缺省 / 地板见 `adoption/import-limits.ts`)。 */
1290
+ adoptionImportMaxSessions: number;
1291
+ /** 收编批量导入:每个会话信封最多多少字节(信封 JSON 的 UTF-8 字节;`ADOPTION_IMPORT_MAX_SESSION_BYTES`;缺省 / 地板 / 上帽见 `adoption/import-limits.ts`)。 */
1292
+ adoptionImportMaxSessionBytes: number;
1302
1293
  /** Header carrying the authenticated principal (S6). Identity never comes from the body. */
1303
1294
  principalHeader: string;
1304
1295
  /** Require the principal header on task requests (set true in multi-tenant production). */
@@ -1358,13 +1349,23 @@ export interface ServiceConfigFlat {
1358
1349
  /** Principals allowed to act as OPERATORS (`OPERATOR_PRINCIPALS`): every operator face reads it through the one reading
1359
1350
  * `explicitOperatorOk` (`http/principal-gate.ts`) — e.g. the F4 approval queue (`/v1/approvals`): list ANY owner's pending +
1360
1351
  * decide. A non-operator principal may only LIST ITS OWN pending. **Empty = no one is an operator** ([ref]: the old
1361
- * "empty = everyone on the approval queue" reading is gone); a single-user deployment that wants to be its own operator
1362
- * declares {@link operatorSingleUser}. */
1352
+ * "empty = everyone on the approval queue" reading is gone). A single-user deployment must answer "who operates it" — a named list here or {@link operatorSingleUser}; neither ⇒ refusal
1353
+ * (`operator-declaration-required`: the server process refuses at boot stage 1, and `createHttpServer` refuses for every assembler, embedders included). */
1363
1354
  operatorPrincipals: string[];
1364
1355
  /** `OPERATOR_SINGLE_USER=true` —— 单用户形显式声明「这台部署的每个调用方都是运维」([ref],[ref] ① 裁 A)。缺席 = 不声明(没人是,除非在名单里)。
1365
1356
  * 只在单用户形(`REQUIRE_PRINCIPAL` 未开)且名单为空时成立 —— 否则拒启(`config-invariants.ts` 的 `operator-single-user`:一个事实一个来源)。
1357
+ * 单用户形上它与具名名单二者必有其一,都没有 ⇒ 拒启(服务进程起服第 1 段;嵌入方在 `createHttpServer`;`operator-declaration-required`,[ref];`false` 与缺席同判)。
1366
1358
  * env 独有(没有中心写位),起服冻结。读法只有 `explicitOperatorOk` / `operatorRosterPresent` 两只。 */
1367
1359
  operatorSingleUser?: boolean;
1360
+ /**
1361
+ * `SERVICE_TOKEN_ACTS_FOR_DEPLOYMENT` —— 「出示这台部署的 service 凭据、不报主体的调用方是谁」的**唯一声明座**。缺省 `true`(不设 = 今天的读法):
1362
+ * 它代部署本人说话(fleet 调用方,运维聚合口的 service 臂);`false` ⇒ 它是**无身份调用方**,各面按既有的「过了凭据门、没有主体」那一臂答
1363
+ * (fleet 读面 401 identity、运维聚合口 401 operator、舰队流多租 401 principal_required / 单用户落 `default`、写档 401 identity、无主 placed 子代 404)。
1364
+ * 只改一处:`http/principal-gate.ts` 的 `actsForDeployment` 多这一个合取项 —— 它的两个读者(fleet 调用方的凭据臂、`/metrics*` 的 service 臂)一次继承,
1365
+ * 零新拒码、零新闸点;自报位 `/health.auth.serviceTokenActsForDeployment` = 配了 service 凭据 ∧ 本位。没配 service 凭据的部署上声明 `false` 是空真(那一臂本来就够不着)。
1366
+ * env 独有(词表布尔,词表外拒启;没有 `config.d` 文件形、没有中心写位),起服读一次、热路径够不着(不是热键)。
1367
+ */
1368
+ serviceTokenActsForDeployment: boolean;
1368
1369
  /**
1369
1370
  * DESIGN-278 §5 S2([ref])—— `GET /v1/config/catalog`(配置目录自描述端点)的显式旋钮。
1370
1371
  * 默认 **ON**(设计稿 §0.5:合规部署可关)。端点本身已是 operator-only(`explicitOperatorOk`,
@@ -1615,7 +1616,7 @@ export interface ServiceConfigFlat {
1615
1616
  * tools for a declared `plan` itself, and no plan entry clamps the hands (only `AUTONOMY=read-only` does). */
1616
1617
  planModeEnabled: boolean;
1617
1618
  /**
1618
- * `HOOKS_TIMEOUT_MS` —— 请求 `settings.hooks` 那张 mods 注册(`settings.hooks`)每个 handler 的时间预算(ms;一个事件跑一遍本请求的钩子条目)。
1619
+ * `HOOKS_TIMEOUT_MS` —— 请求 hooks 的每张车道注册(`settings.hooks` / `settings.hooks.managed`,各一份同值)每个 handler 的时间预算(ms;一个事件跑一遍这条车道的钩子条目)。
1619
1620
  * **缺席 = 不铸键**;唯一读法 = `hooks/hook-runner.ts` 的 `settingsHooksBudgetMs`(未设 ⇒ 600000,单条命令超时的上限;这只数是引擎的钟,不是钩子子进程的墙钟)。
1620
1621
  *
1621
1622
  * 🔴 `0` 是有效值(引擎按字面:零预算,下一个定时器拍就到期),不是「未设」;
@@ -1663,6 +1664,13 @@ export interface ServiceConfigFlat {
1663
1664
  * failed/stoppedBy=system(诚实终态,跨实例读面永不虚构存活)。core 契约要求 ≥10min(60s 心跳的
1664
1665
  * 安全裕度),**下限 10min 硬钳**。Default 15min。`BG_AGENT_STALE_RUNNING_MS`。 */
1665
1666
  backgroundAgentStaleRunningMs: number;
1667
+ /** 会话驻留后台子代理的**停滞收割窗**(ms):一行 `running` 的会话驻留后台子代理最后一次工具活动距今超过它 ⇒ 引擎把行收成 `killed`(归因 `system`)、
1668
+ * run 中止(引擎的 `TaskRegistry.reapStaleSessionBackgroundAgents`;按静默判,不按年龄)。收割在 `/health.inflight` 计法表的读口上、数活之前做
1669
+ * (`session-resident-background.ts`)—— 判停四处与 `/health` 读同一只读口,于是阻断集里的后台子代理一项有了上界。
1670
+ * 与 `backgroundAgentStaleRunningMs` 不是同一个窗:那只量**写者进程**的 60 s 心跳(进程死没死),这只量**子代**的工具活动(子代卡没卡),
1671
+ * 一条 30 min 的工具调用就是 30 min 静默。缺省 = 下限 = `backgroundAgentStallFloorMs(…)` 的派生值(等人的四个窗取大 + 引擎单命令上限,
1672
+ * 单用户 posture 下 ≈ 24 h 10 min),只许拉大,没有「关」。`BG_AGENT_STALL_MS`。 */
1673
+ backgroundAgentStallMs: number;
1666
1674
  /** core 1.382([ref],[ref] 提货单④)`TaskRegistry.reconcileParkedAgents` 的 stale-claim 清算窗
1667
1675
  * ——core 该整块逻辑被 `opts.staleClaimMaxAgeMs !== undefined` 门住,缺席 = **整块清算永不运行**
1668
1676
  * (claim 后 claimer 进程崩死的行永久卡在"已 claim 不可再 claim"态,只能等 checkpoint TTL 自然过期;
@@ -1891,7 +1899,7 @@ export interface ServiceConfigFlat {
1891
1899
  * under the shared-engine shape (several shell sessions on one config, engine rides the FIRST shell's process
1892
1900
  * group per the T11 anti-orphan call) other live sessions may still be using this engine, so an unconditional
1893
1901
  * drain kills a peer mid-turn (499) and 503s new submits. Instead SIGHUP arms an idle watch: shut down only
1894
- * after `inflight()` (bg/resume legs + live streams) has been 0 for this long, WITHOUT flipping `draining`
1902
+ * after `inflight()` (bg/resume legs + live streams + background sub-agents that outlived their leg — the blocking set `http + leader + backgroundAgents`; session-resident background shells/monitors are in the `/health.inflight` total but do not block) has been 0 for this long, WITHOUT flipping `draining`
1895
1903
  * (peers stay fully served). A true orphan (last window closed) self-terminates when the window expires —
1896
1904
  * T11 stands, just bounded instead of immediate. A SECOND SIGHUP (or SIGTERM) escalates to the normal drain
1897
1905
  * path. Default 120s, floor 5s. Env: SIGHUP_IDLE_GRACE_MS. */
@@ -1940,6 +1948,20 @@ export interface ServiceConfigFlat {
1940
1948
  * `SEMA_PARENT_PID` 在不在场(operator-knob 铁律)。 Env: `ENGINE_ORPHAN_LINGER_MS`(默认 2000,闭区间
1941
1949
  * [1000, 86400000])。 */
1942
1950
  engineOrphanLingerMs: number;
1951
+ /** [ref]:**首次附着前**的宽限窗 —— 引擎起服以来还没有过任何非探针 HTTP 请求(态「候首触」)时,三合取要**持续**成立多久才自退;
1952
+ * 生效窗 = `max(`{@link engineLingerMs}`, 本值)`(宽限只拉长不缩短;`ENGINE_AUTO_EXIT` 关着 ⇒ owned 窗 = ∞ ⇒ 它也是 ∞)。首个非探针请求
1953
+ * 到达之后回到 {@link engineLingerMs}、单向;父死之后一律 {@link engineOrphanLingerMs}(孤儿压过候首触)。默认 **180000**:防的是一次性
1954
+ * `-p` 壳在 spawn 与首次接触之间被饿住(高载宿主 / CI)超过 owned 窗 —— 从没被碰过的引擎此前按 owned 窗自退,壳醒来起步失败。
1955
+ * `0` = 不给额外宽限(逐字回到本键之前的行为);小于 owned 窗的值同样落成 owned 窗。与两只静默窗**同一只校验器、同一对上下界**,
1956
+ * 多放行字面 `0`(别的零形照常拒);`1..999`(秒当毫秒)与其余坏值**拒启**;解析**无条件**(operator-knob 铁律)。 Env: `ENGINE_FIRST_ATTACH_MS`(默认 180000,
1957
+ * 取值 `0` 或闭区间 [1000, 86400000])。 */
1958
+ engineFirstAttachMs: number;
1959
+ /** [ref]([ref] v3):**交接车道**的静默窗 —— 壳经 `POST /v1/engine/handover` 把引擎交给后台、自己退出之后,三合取(无附着 ∧ 无在飞 ∧
1960
+ * 无运行中、引擎一退就会被收掉的后台 shell)要**持续**成立多久才自退。下一只壳 `POST /v1/engine/attach` 即离开本车道。默认 **1800000**(30 min):
1961
+ * 防的是「用户忘了后台引擎」,不是上限 —— 后台 shell 在跑时本窗不起算(那正是选「后台继续」的意思)。与其余三只窗**同一只校验器**,下界单独是
1962
+ * 60000(交接后的窗比壳重启窗还短没有意义);坏值**拒启**;解析**无条件**(operator-knob 铁律,不看 `ENGINE_AUTO_EXIT` / `SEMA_PARENT_PID`)。
1963
+ * Env: `ENGINE_HANDOVER_LINGER_MS`(默认 1800000,闭区间 [60000, 86400000])。 */
1964
+ engineHandoverLingerMs: number;
1943
1965
  /** E23 (shell-host contract): inbound MCP elicitation HITL. When enabled, the service mounts `RunnerDeps.onElicit` + the
1944
1966
  * `POST /v1/elicitations/:id/respond` route so an opted-in MCP server (`McpServerSpec.elicitation`, itself default
1945
1967
  * OFF) can ask the END USER for input mid-tool-call. LIVE-ONLY (no durable suspend; lost on crash/replica-change).
@@ -2170,6 +2192,14 @@ export interface ServiceConfigFlat {
2170
2192
  logLevel: "debug" | "info" | "warn" | "error";
2171
2193
  /** Per-principal request cap per minute on task/run endpoints. 0 disables. */
2172
2194
  rateLimitPerMin: number;
2195
+ /** `RUN_MAX_CONCURRENT`:本副本**在飞 run 的全局上限**(整数,0 / 缺省 = 不设)。一条新提交要起 run 时,在飞数已到帽 ⇒ 429 `limit.rate_exceeded`
2196
+ * + 机读 `reason: "run_concurrency_cap"` + `retryAfterSec: 5`(同值 `Retry-After` 头)。数的是 `inflightRuns ∪ steerableRuns`(与 `drainState.inflight` 同源);
2197
+ * 判点在三个提交门(`POST /v1/runs` 与 A2A `message/send`、`POST /v1/tasks`、`POST /v1/tasks/stream`)的幂等重放之后;续跑 / 唤醒 / 审批作答不判。
2198
+ * 属主 `http/run-concurrency-cap.ts`。 */
2199
+ runMaxConcurrent: number;
2200
+ /** `RUN_MAX_CONCURRENT_PER_PRINCIPAL`:同一**已验提交主体**(`gatedPrincipal`,与成本配额门同键)在本副本的在飞 run 上限(整数,0 / 缺省 = 不设)。
2201
+ * 无主体请求(无头 service 凭据)不判这一帽,只受 {@link ServiceConfigFlat.runMaxConcurrent}。 */
2202
+ runMaxConcurrentPerPrincipal: number;
2173
2203
  /** Operator CEILING on per-task cost (USD) / tokens (1.37 budget gate). A request may ask for a
2174
2204
  * LOWER limit but is capped to this; 0/unset = no ceiling. The review gateway sets these to stop a
2175
2205
  * single task from burning the shared cloud key. Enforced by core (failed + errorCode budget.*). */
@@ -2337,11 +2367,11 @@ export type ServiceMemoryConfig = Pick<ServiceConfigFlat, "memoryEngineEnabled"
2337
2367
  * 三者都是 operator 在配置面写下的**治理声明**(与 autonomy/commandPolicy 同族),不是存储旋钮
2338
2368
  * ——`retentionPolicy` 尤其容易被误归 store 组:它的消费点是 core 的启动期能力校验与将来的调度面,
2339
2369
  * config 这一层它只是一句声明。 */
2340
- export type ServiceAuthConfig = Pick<ServiceConfigFlat, "authToken" | "authTokens" | "allowUnauthedWrites" | "corsOrigins" | "principalHeader" | "requirePrincipal" | "autonomy" | "commandPolicy" | "compliancePosture" | "lockedConfigKeys" | "configCatalogEnabled" | "retentionPolicy" | "retentionSweep" | "operatorPrincipals" | "operatorSingleUser" | "principalJwtPubkeys" | "principalJwtIss" | "principalJwtAud" | "authBridgeIssuer" | "principalJwtMaxTtlSec" | "bindHost" | "bindHostSource">;
2370
+ export type ServiceAuthConfig = Pick<ServiceConfigFlat, "authToken" | "authTokens" | "allowUnauthedWrites" | "corsOrigins" | "principalHeader" | "requirePrincipal" | "autonomy" | "commandPolicy" | "compliancePosture" | "lockedConfigKeys" | "configCatalogEnabled" | "retentionPolicy" | "retentionSweep" | "operatorPrincipals" | "operatorSingleUser" | "serviceTokenActsForDeployment" | "principalJwtPubkeys" | "principalJwtIss" | "principalJwtAud" | "authBridgeIssuer" | "principalJwtMaxTtlSec" | "bindHost" | "bindHostSource">;
2341
2371
  /** 组:orchestration(编排 + 执行车道 + 沙箱面 + workflow/后台 agent 存留)。 */
2342
- export type ServiceOrchestrationConfig = Pick<ServiceConfigFlat, "sandboxGit" | "remoteExec" | "remoteExecHomeDir" | "requireExecutionLane" | "worktreeIsolation" | "leaderEnabled" | "leaderFanoutEnabled" | "routerEnabled" | "selfOrchestrationEnabled" | "selfOrchestrationModels" | "selfOrchestrationWorkerIsolation" | "forkEnabled" | "experimentalObserverAgents" | "schedulerEnabled" | "schedulerSessionWakeup" | "schedulerSessionLifetime" | "schedulerStorePath" | "planModeEnabled" | "hooksTimeoutMs" | "workflowRunStoreBackend" | "workflowOrphanGraceMs" | "workflowJournalRetentionMs" | "workflowRunRetentionMs" | "usageWindows" | "workflowAgentsReadOnly" | "workflowSizeGuideline" | "backgroundAgentRetentionMs" | "backgroundAgentStaleRunningMs" | "backgroundAgentParkClaimStaleMs" | "delegationEntryCaps" | "rosterRetentionMs" | "leaderRunStaleMs" | "scratchpadSweepTtlMs" | "sandboxPkgSource" | "sandboxPkgSourceCustom" | "sessionAutoTitle" | "sessionAutoTitleSource" | "selectEnvironmentTool" | "envFactsEnabled" | "toolDeferLongtail" | "lspEnabled" | "lspHostEnabled" | "lspEnvAllow" | "imageBakes" | "readFace" | "readFaceSource" | "taskWriteFaceEscalation" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "readDenyFloorRequired" | "sandboxReadFloor" | "agentConfigDir" | "configLkgPath" | "configLkgEnabled">;
2372
+ export type ServiceOrchestrationConfig = Pick<ServiceConfigFlat, "sandboxGit" | "remoteExec" | "remoteExecHomeDir" | "worktreeIsolation" | "leaderEnabled" | "leaderFanoutEnabled" | "routerEnabled" | "selfOrchestrationEnabled" | "selfOrchestrationModels" | "selfOrchestrationWorkerIsolation" | "forkEnabled" | "experimentalObserverAgents" | "schedulerEnabled" | "schedulerSessionWakeup" | "schedulerSessionLifetime" | "schedulerStorePath" | "planModeEnabled" | "hooksTimeoutMs" | "workflowRunStoreBackend" | "workflowOrphanGraceMs" | "workflowJournalRetentionMs" | "workflowRunRetentionMs" | "usageWindows" | "workflowAgentsReadOnly" | "workflowSizeGuideline" | "backgroundAgentRetentionMs" | "backgroundAgentStaleRunningMs" | "backgroundAgentStallMs" | "backgroundAgentParkClaimStaleMs" | "delegationEntryCaps" | "rosterRetentionMs" | "leaderRunStaleMs" | "scratchpadSweepTtlMs" | "sandboxPkgSource" | "sandboxPkgSourceCustom" | "sessionAutoTitle" | "sessionAutoTitleSource" | "selectEnvironmentTool" | "envFactsEnabled" | "toolDeferLongtail" | "lspEnabled" | "lspHostEnabled" | "lspEnvAllow" | "imageBakes" | "readFace" | "readFaceSource" | "taskWriteFaceEscalation" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "readDenyFloorRequired" | "sandboxReadFloor" | "agentConfigDir" | "configLkgPath" | "configLkgEnabled">;
2343
2373
  /** 组:limitsHttp(HTTP 面 + 各类上限/配额/回收窗)。 */
2344
- export type ServiceLimitsHttpConfig = Pick<ServiceConfigFlat, "port" | "attachmentOrphanGraceMs" | "workspaceFileMaxBytes" | "attachmentMaxBytes" | "attachmentMimeAllowlist" | "attachmentUnboundTtlMs" | "infraCostRates" | "drainGraceMs" | "drainSecondSignalMinGapMs" | "sighupIdleGraceMs" | "parentPid" | "engineAutoExit" | "engineLingerMs" | "engineOrphanLingerMs" | "rateLimitPerMin" | "maxTaskCostUsd" | "maxTaskTokens" | "maxPrincipalCostUsd" | "costQuotaWindowSec" | "reapIntervalSec" | "runStaleSec" | "toolResultTtlSec">;
2374
+ export type ServiceLimitsHttpConfig = Pick<ServiceConfigFlat, "port" | "attachmentOrphanGraceMs" | "workspaceFileMaxBytes" | "attachmentMaxBytes" | "attachmentMimeAllowlist" | "attachmentUnboundTtlMs" | "adoptionImportMaxSessions" | "adoptionImportMaxSessionBytes" | "infraCostRates" | "drainGraceMs" | "drainSecondSignalMinGapMs" | "sighupIdleGraceMs" | "parentPid" | "engineAutoExit" | "engineLingerMs" | "engineOrphanLingerMs" | "engineFirstAttachMs" | "engineHandoverLingerMs" | "rateLimitPerMin" | "runMaxConcurrent" | "runMaxConcurrentPerPrincipal" | "maxTaskCostUsd" | "maxTaskTokens" | "maxPrincipalCostUsd" | "costQuotaWindowSec" | "reapIntervalSec" | "runStaleSec" | "toolResultTtlSec">;
2345
2375
  /** 组:observability(可观测)。 */
2346
2376
  export type ServiceObservabilityConfig = Pick<ServiceConfigFlat, "metricsToken" | "traceToken" | "toolTrace" | "traceThinking" | "logLevel" | "otel">;
2347
2377
  /** 组:integrations(外部集成)。`mcpServers` / `a2aPeers` 由 web-admin 适配器填(无 env 腿),归本组。 */
@@ -2362,4 +2392,17 @@ export interface ServiceConfigGroups {
2362
2392
  /** Service configuration = 平铺面(唯一存储处,消费点原样) ∩ 九个组视图(additive,不可枚举)。 */
2363
2393
  export interface ServiceConfig extends ServiceConfigFlat, ServiceConfigGroups {
2364
2394
  }
2395
+ /**
2396
+ * `loadConfig()` 的产物 —— **raw** 形(合成之前):执行车道可以缺席(env `REMOTE_EXEC` 未设;`CONFIG_PROVIDER=local` 下车道也可以由
2397
+ * `config.d/remote-exec.json` 声明,读它是合成步的事)。缺席不是任何车道:读者不得把它折成某条车道。只有执行车道合成步
2398
+ * (`boot/execution-lane.ts` 的 `composeExecutionLane`)把它收成 {@link ServiceConfig}(composed:`remoteExec` 必在)—— 没有显式声明 ⇒ 拒启。
2399
+ * 装配链上合成之后的每一段、`createHttpServer`、run-local 只收 composed 形 ⇒ 漏调合成步的嵌入方 tsc 红(这就是通知)。
2400
+ * 组视图 `orchestration` 与平铺面是同一个对象的两个取景器,所以车道位在两处一起放宽。
2401
+ */
2402
+ export type LoadedConfig = Omit<ServiceConfig, "remoteExec" | "orchestration"> & {
2403
+ remoteExec?: RemoteExecConfig;
2404
+ orchestration: Omit<ServiceOrchestrationConfig, "remoteExec"> & {
2405
+ remoteExec?: RemoteExecConfig;
2406
+ };
2407
+ };
2365
2408
  //# sourceMappingURL=config-types.d.ts.map