@sema-agent/server 7.146.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 (398) hide show
  1. package/MIGRATION.md +384 -0
  2. package/README.md +1 -1
  3. package/README.zh-CN.md +1 -1
  4. package/USAGE.md +170 -66
  5. package/deploy/facts/lanes.json +7 -0
  6. package/deploy/sema-up/README.md +2 -2
  7. package/deploy/sema-up/chart/templates/_helpers.tpl +22 -0
  8. package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -4
  9. package/deploy/sema-up/chart/templates/server.yaml +5 -4
  10. package/deploy/sema-up/chart/values.yaml +1 -1
  11. package/deploy/sema-up/cluster-up.sh +2 -1
  12. package/deploy/sema-up/lib/flagshape.sh +4 -0
  13. package/deploy/sema-up/lib/lanes.json +2 -5
  14. package/deploy/sema-up/sema-up.sh +12 -9
  15. package/deploy/sema-up/stack/compose.yaml +5 -4
  16. package/deploy/sema-up/stack/sema-stack-cluster.yaml +4 -3
  17. package/dist/approval-card.d.ts +4 -4
  18. package/dist/approval.d.ts +3 -3
  19. package/dist/audit.js +2 -2
  20. package/dist/bench/s1/live-deps.js +3 -1
  21. package/dist/boot/crash-last.js +2 -1
  22. package/dist/boot/device-lane.js +5 -5
  23. package/dist/boot/engine-lease.d.ts +12 -11
  24. package/dist/boot/execution-env.d.ts +2 -1
  25. package/dist/boot/execution-env.js +45 -33
  26. package/dist/boot/execution-lane.d.ts +37 -9
  27. package/dist/boot/execution-lane.js +74 -20
  28. package/dist/boot/exit-boundary.d.ts +1 -1
  29. package/dist/boot/exit-last.js +2 -1
  30. package/dist/boot/governance-seams.d.ts +2 -2
  31. package/dist/boot/leader.js +1 -1
  32. package/dist/boot/memory-boundary.d.ts +11 -11
  33. package/dist/boot/memory-boundary.js +3 -3
  34. package/dist/boot/memory-consolidation.d.ts +13 -24
  35. package/dist/boot/memory-consolidation.js +0 -13
  36. package/dist/boot/org-memory.js +3 -2
  37. package/dist/boot/parked-revive-gate.d.ts +1 -1
  38. package/dist/boot/parked-revive-gate.js +1 -1
  39. package/dist/boot/reapers.js +1 -1
  40. package/dist/boot/resolve-spec.js +91 -111
  41. package/dist/boot/retention-lane.d.ts +4 -42
  42. package/dist/boot/session-faces.d.ts +1 -0
  43. package/dist/boot/session-faces.js +8 -2
  44. package/dist/boot/stage-01-config.d.ts +1 -1
  45. package/dist/boot/stage-01-config.js +6 -2
  46. package/dist/boot/stage-02-web-admin-pull.d.ts +1 -1
  47. package/dist/boot/stage-02-web-admin-pull.js +10 -8
  48. package/dist/boot/stage-03-store-backend.d.ts +1 -1
  49. package/dist/boot/stage-04-stores.d.ts +1 -1
  50. package/dist/boot/stage-05-execution-env.d.ts +2 -2
  51. package/dist/boot/stage-05-execution-env.js +3 -3
  52. package/dist/boot/stage-06-runners.d.ts +3 -3
  53. package/dist/boot/stage-06-runners.js +1 -3
  54. package/dist/boot/stage-07-capability-layer.d.ts +3 -3
  55. package/dist/boot/stage-07-capability-layer.js +4 -9
  56. package/dist/boot/stage-08-reapers.d.ts +3 -3
  57. package/dist/boot/stage-09-leader.d.ts +4 -3
  58. package/dist/boot/stage-10-http-server.d.ts +4 -3
  59. package/dist/boot/stage-10-http-server.js +2 -1
  60. package/dist/boot/stores.d.ts +9 -0
  61. package/dist/boot/stores.js +18 -7
  62. package/dist/boot/web-admin.js +3 -3
  63. package/dist/capabilities/center-plugins.d.ts +2 -0
  64. package/dist/capabilities/center-plugins.js +6 -2
  65. package/dist/capabilities/composite-members.d.ts +1 -0
  66. package/dist/capabilities/composite-members.js +1 -0
  67. package/dist/capabilities/execution-lane.d.ts +7 -7
  68. package/dist/capabilities/execution-lane.js +2 -2
  69. package/dist/capabilities/hands-lane.d.ts +1 -1
  70. package/dist/capabilities/scenarios.d.ts +32 -18
  71. package/dist/capabilities/scenarios.js +13 -9
  72. package/dist/capabilities/settings-contract.d.ts +29 -0
  73. package/dist/capabilities/settings-contract.js +14 -0
  74. package/dist/capabilities/skills.d.ts +5 -5
  75. package/dist/capability-facts.d.ts +38 -0
  76. package/dist/capability-facts.js +34 -1
  77. package/dist/center-credential-renewer.js +3 -2
  78. package/dist/config-catalog.js +6 -5
  79. package/dist/config-invariants.d.ts +18 -3
  80. package/dist/config-invariants.js +36 -19
  81. package/dist/config-lkg.d.ts +1 -1
  82. package/dist/config-lkg.js +5 -6
  83. package/dist/config-provider.js +2 -0
  84. package/dist/config-types.d.ts +190 -186
  85. package/dist/config.d.ts +68 -5
  86. package/dist/config.js +80 -54
  87. package/dist/degenerate-instrument.js +1 -1
  88. package/dist/deploy-facts.js +3 -2
  89. package/dist/deployment-shape.d.ts +21 -12
  90. package/dist/deployment-shape.js +24 -6
  91. package/dist/env-facts.d.ts +7 -5
  92. package/dist/env-facts.js +10 -6
  93. package/dist/execution-config-root.d.ts +5 -5
  94. package/dist/execution-config-root.js +5 -5
  95. package/dist/execution-env-purpose.d.ts +14 -0
  96. package/dist/execution-env-purpose.js +29 -0
  97. package/dist/execution-lane-caps.d.ts +49 -86
  98. package/dist/execution-lane-caps.js +52 -62
  99. package/dist/execution-placement.d.ts +18 -2
  100. package/dist/execution-placement.js +19 -0
  101. package/dist/file-history-disclosure.d.ts +2 -2
  102. package/dist/fleet/drain-entry.d.ts +17 -10
  103. package/dist/fleet/drain-entry.js +1 -1
  104. package/dist/fleet/serving-lease.js +3 -4
  105. package/dist/history-anchor.d.ts +22 -0
  106. package/dist/history-anchor.js +14 -0
  107. package/dist/hooks/command-spawn.d.ts +1 -4
  108. package/dist/hooks/command-spawn.js +0 -11
  109. package/dist/hooks/hook-runner.d.ts +52 -8
  110. package/dist/hooks/hook-runner.js +160 -36
  111. package/dist/http/approval-sweeps.d.ts +2 -5
  112. package/dist/http/approval-sweeps.js +3 -2
  113. package/dist/http/checkpoint-ctx.d.ts +17 -0
  114. package/dist/http/checkpoint-ctx.js +6 -0
  115. package/dist/http/claim-latency.d.ts +10 -0
  116. package/dist/http/claim-latency.js +12 -0
  117. package/dist/http/dispatch.js +1 -1
  118. package/dist/http/durable-run-leg.js +2 -1
  119. package/dist/http/execution-context.d.ts +3 -1
  120. package/dist/http/execution-context.js +4 -0
  121. package/dist/http/memory-compliance-failure-reply.d.ts +1 -1
  122. package/dist/http/memory-compliance-failure-reply.js +3 -0
  123. package/dist/http/memory-store-refusal-reply.d.ts +3 -3
  124. package/dist/http/memory-store-refusal-reply.js +3 -0
  125. package/dist/http/owner-access.d.ts +11 -0
  126. package/dist/http/owner-access.js +7 -4
  127. package/dist/http/principal-gate.d.ts +3 -14
  128. package/dist/http/principal-gate.js +0 -13
  129. package/dist/http/request-guards.d.ts +1 -1
  130. package/dist/http/resume-legs.d.ts +7 -10
  131. package/dist/http/resume-legs.js +79 -50
  132. package/dist/http/rewind-files-reply.d.ts +34 -0
  133. package/dist/http/rewind-files-reply.js +36 -0
  134. package/dist/http/route-ctx.d.ts +32 -16
  135. package/dist/http/route-table.js +2 -0
  136. package/dist/http/routes/approvals-assistant.js +5 -25
  137. package/dist/http/routes/capabilities.js +8 -2
  138. package/dist/http/routes/devices.js +1 -1
  139. package/dist/http/routes/memory-origin.d.ts +1 -1
  140. package/dist/http/routes/notify-wake.js +2 -1
  141. package/dist/http/routes/projects.d.ts +70 -0
  142. package/dist/http/routes/projects.js +86 -0
  143. package/dist/http/routes/rules.js +30 -2
  144. package/dist/http/routes/runs.js +8 -8
  145. package/dist/http/routes/session-sync.js +27 -10
  146. package/dist/http/routes/sessions.d.ts +7 -1
  147. package/dist/http/routes/sessions.js +104 -2
  148. package/dist/http/routes/tasks.js +9 -3
  149. package/dist/http/server.d.ts +24 -10
  150. package/dist/http/server.js +17 -6
  151. package/dist/http/stored-body-replay.d.ts +5 -3
  152. package/dist/http/stored-body-replay.js +10 -1
  153. package/dist/http/wire-types.d.ts +19 -10
  154. package/dist/index.d.ts +2 -2
  155. package/dist/index.js +1 -1
  156. package/dist/instruction-source-notice.d.ts +1 -1
  157. package/dist/memory-embedder-reembed.d.ts +38 -0
  158. package/dist/memory-embedder-reembed.js +20 -0
  159. package/dist/memory-incident-sink.d.ts +0 -28
  160. package/dist/memory-incident-sink.js +5 -0
  161. package/dist/memory-scope.d.ts +2 -2
  162. package/dist/memory-scope.js +1 -1
  163. package/dist/memory-store-refusal.d.ts +17 -4
  164. package/dist/memory-store-refusal.js +1 -1
  165. package/dist/memory-sync-client.d.ts +2 -0
  166. package/dist/memory-sync-client.js +13 -11
  167. package/dist/memory-sync.js +1 -1
  168. package/dist/model-compat.d.ts +35 -21
  169. package/dist/model-compat.js +49 -21
  170. package/dist/model-entry-refusal.d.ts +11 -1
  171. package/dist/model-entry-refusal.js +7 -0
  172. package/dist/namespaced-rule-name.d.ts +18 -1
  173. package/dist/namespaced-rule-name.js +12 -0
  174. package/dist/observability/fail-open.d.ts +17 -9
  175. package/dist/observability/fail-open.js +17 -9
  176. package/dist/observability/metrics.d.ts +2 -0
  177. package/dist/observability/metrics.js +2 -0
  178. package/dist/observability/secret-env-scrub.d.ts +30 -4
  179. package/dist/observability/secret-env-scrub.js +15 -3
  180. package/dist/orchestration/workflow-agent-session-index.d.ts +7 -12
  181. package/dist/orchestration/workflow-agent-session-index.js +1 -6
  182. package/dist/orchestration/workflow-completion-inbox.d.ts +26 -6
  183. package/dist/orchestration/workflow-completion-inbox.js +63 -45
  184. package/dist/org-memory-admission.d.ts +5 -2
  185. package/dist/org-memory-admission.js +25 -10
  186. package/dist/parked-decide.d.ts +33 -26
  187. package/dist/parked-decide.js +36 -44
  188. package/dist/plugins/approval-ask-store-file.d.ts +10 -2
  189. package/dist/plugins/approval-ask-store-file.js +37 -4
  190. package/dist/plugins/approval-ask-store-memory.d.ts +5 -3
  191. package/dist/plugins/approval-ask-store-memory.js +11 -2
  192. package/dist/plugins/approval-ask-store-sql.d.ts +3 -0
  193. package/dist/plugins/approval-ask-store-sql.js +3 -1
  194. package/dist/plugins/blob-backend.d.ts +38 -195
  195. package/dist/plugins/blob-backend.js +33 -229
  196. package/dist/plugins/caching-session-store.d.ts +9 -4
  197. package/dist/plugins/checkpoint-index-columns.d.ts +1 -1
  198. package/dist/plugins/checkpoint-index-columns.js +3 -2
  199. package/dist/plugins/checkpoint-store-face.d.ts +1 -1
  200. package/dist/plugins/device-store-sql.d.ts +2 -2
  201. package/dist/plugins/device-store-sql.js +5 -10
  202. package/dist/plugins/execution-lane-rename-m40.d.ts +20 -0
  203. package/dist/plugins/execution-lane-rename-m40.js +10 -0
  204. package/dist/plugins/execution-placement-sql.d.ts +63 -88
  205. package/dist/plugins/execution-placement-sql.js +94 -54
  206. package/dist/plugins/file-run-store.d.ts +26 -12
  207. package/dist/plugins/file-run-store.js +63 -63
  208. package/dist/plugins/imported-layer-root-retirement.d.ts +17 -8
  209. package/dist/plugins/imported-layer-root-retirement.js +4 -8
  210. package/dist/plugins/inbox-payload-column.d.ts +14 -0
  211. package/dist/plugins/inbox-payload-column.js +13 -0
  212. package/dist/plugins/local-checkpoint-store.d.ts +5 -0
  213. package/dist/plugins/local-checkpoint-store.js +11 -7
  214. package/dist/plugins/local-data-dir-modes-m39.d.ts +48 -0
  215. package/dist/plugins/local-data-dir-modes-m39.js +182 -0
  216. package/dist/plugins/local-engine-high-water.d.ts +11 -0
  217. package/dist/plugins/local-engine-high-water.js +59 -0
  218. package/dist/plugins/local-session-store.d.ts +91 -25
  219. package/dist/plugins/local-session-store.js +124 -45
  220. package/dist/plugins/local-task-attachment-store.d.ts +2 -0
  221. package/dist/plugins/local-task-attachment-store.js +10 -11
  222. package/dist/plugins/memory-embedder-fingerprint.d.ts +33 -10
  223. package/dist/plugins/memory-embedder-fingerprint.js +52 -12
  224. package/dist/plugins/memory-embedder.d.ts +1 -1
  225. package/dist/plugins/memory-embedder.js +2 -2
  226. package/dist/plugins/memory-engine-pg.d.ts +4 -3
  227. package/dist/plugins/memory-engine-pg.js +4 -4
  228. package/dist/plugins/memory-engine-sql-apply.d.ts +13 -4
  229. package/dist/plugins/memory-engine-sql-apply.js +1 -1
  230. package/dist/plugins/memory-engine-tidb.d.ts +8 -5
  231. package/dist/plugins/memory-engine-tidb.js +7 -8
  232. package/dist/plugins/one-time-migrations.d.ts +145 -35
  233. package/dist/plugins/one-time-migrations.js +272 -120
  234. package/dist/plugins/owner-only-file-mode.d.ts +29 -0
  235. package/dist/plugins/owner-only-file-mode.js +141 -0
  236. package/dist/plugins/permission-rule-store-file.d.ts +8 -8
  237. package/dist/plugins/permission-rule-store-file.js +14 -2
  238. package/dist/plugins/pg-pool.d.ts +2 -1
  239. package/dist/plugins/pg-pool.js +11 -4
  240. package/dist/plugins/release-version.d.ts +20 -0
  241. package/dist/plugins/release-version.js +28 -0
  242. package/dist/plugins/remote-env-adb.d.ts +20 -4
  243. package/dist/plugins/remote-env-adb.js +39 -11
  244. package/dist/plugins/remote-env-e2b.d.ts +12 -3
  245. package/dist/plugins/remote-env-e2b.js +6 -4
  246. package/dist/plugins/remote-env-host.d.ts +9 -1
  247. package/dist/plugins/remote-env-host.js +6 -5
  248. package/dist/plugins/remote-env-k8s.d.ts +5 -2
  249. package/dist/plugins/remote-env-k8s.js +15 -4
  250. package/dist/plugins/remote-env-local-docker.d.ts +4 -1
  251. package/dist/plugins/remote-env-local-docker.js +3 -3
  252. package/dist/plugins/remote-env-ssh.d.ts +8 -2
  253. package/dist/plugins/remote-env-ssh.js +26 -24
  254. package/dist/plugins/remote-shell.d.ts +59 -30
  255. package/dist/plugins/remote-shell.js +175 -62
  256. package/dist/plugins/retention-declaration.d.ts +37 -0
  257. package/dist/plugins/retention-declaration.js +9 -0
  258. package/dist/plugins/retention-deployment.d.ts +126 -0
  259. package/dist/plugins/retention-deployment.js +88 -0
  260. package/dist/plugins/retention-lane-store-sql.d.ts +74 -4
  261. package/dist/plugins/retention-lane-store-sql.js +103 -1
  262. package/dist/plugins/retention-sql.d.ts +29 -0
  263. package/dist/plugins/retention-sql.js +8 -0
  264. package/dist/plugins/schema-consistency.d.ts +0 -6
  265. package/dist/plugins/schema-consistency.js +1 -2
  266. package/dist/plugins/schema-ensure-legs.d.ts +1 -1
  267. package/dist/plugins/schema-ensure-legs.js +11 -1
  268. package/dist/plugins/session-ext-table.d.ts +74 -0
  269. package/dist/plugins/session-ext-table.js +121 -0
  270. package/dist/plugins/session-fork.d.ts +1 -1
  271. package/dist/plugins/session-row-sql.d.ts +8 -7
  272. package/dist/plugins/session-row-sql.js +15 -7
  273. package/dist/plugins/session-store-sql.d.ts +131 -0
  274. package/dist/plugins/session-store-sql.js +298 -0
  275. package/dist/plugins/session-workspace-cell.d.ts +2 -2
  276. package/dist/plugins/session-workspace-cell.js +2 -2
  277. package/dist/plugins/shared-memory-store-sql.d.ts +10 -0
  278. package/dist/plugins/shared-memory-store-sql.js +13 -13
  279. package/dist/plugins/snapshot-bucket-presence.js +1 -1
  280. package/dist/plugins/sql-driver.d.ts +23 -7
  281. package/dist/plugins/sql-driver.js +41 -8
  282. package/dist/plugins/sql-errors.d.ts +5 -2
  283. package/dist/plugins/sql-errors.js +4 -0
  284. package/dist/plugins/store-backend.d.ts +35 -8
  285. package/dist/plugins/store-backend.js +184 -62
  286. package/dist/plugins/store-contracts.d.ts +9 -2
  287. package/dist/plugins/store-contracts.js +1 -0
  288. package/dist/plugins/task-attachment-store.d.ts +6 -8
  289. package/dist/plugins/task-attachment-store.js +15 -10
  290. package/dist/plugins/task-list-store-sql.d.ts +1 -1
  291. package/dist/plugins/text-column-capacity.d.ts +21 -0
  292. package/dist/plugins/text-column-capacity.js +5 -0
  293. package/dist/plugins/tidb-pool.d.ts +3 -2
  294. package/dist/plugins/tidb-pool.js +19 -31
  295. package/dist/plugins/user-input-ledger-sql.d.ts +1 -1
  296. package/dist/read-face-posture.d.ts +6 -6
  297. package/dist/read-face-posture.js +2 -2
  298. package/dist/request-value-closure.d.ts +5 -5
  299. package/dist/request-value-closure.js +1 -1
  300. package/dist/rules-consent.d.ts +41 -13
  301. package/dist/rules-consent.js +101 -53
  302. package/dist/run-local.js +17 -13
  303. package/dist/runs.d.ts +48 -30
  304. package/dist/runs.js +26 -16
  305. package/dist/runtime-caps-resolver.d.ts +15 -8
  306. package/dist/runtime-caps-resolver.js +14 -10
  307. package/dist/sealed-key-layout.d.ts +2 -3
  308. package/dist/sealed-key-layout.js +0 -1
  309. package/dist/sealed-key.js +7 -5
  310. package/dist/security.d.ts +5 -3
  311. package/dist/sema-config-dir.js +2 -2
  312. package/dist/server-secret-env.d.ts +2 -0
  313. package/dist/service-version.d.ts +2 -1
  314. package/dist/service-version.js +2 -2
  315. package/dist/session-error-wire.d.ts +1 -1
  316. package/dist/session-incarnation.d.ts +8 -5
  317. package/dist/session-resident-background.d.ts +85 -32
  318. package/dist/session-resident-background.js +75 -7
  319. package/dist/session-row.d.ts +1 -1
  320. package/dist/session-sync-kernel.d.ts +1 -1
  321. package/dist/session-workspace.d.ts +11 -2
  322. package/dist/session-workspace.js +5 -0
  323. package/dist/sighup-idle.d.ts +1 -1
  324. package/dist/store-posture.d.ts +2 -1
  325. package/dist/stored-request-hooks-m20.d.ts +3 -2
  326. package/dist/stored-request-hooks-m20.js +19 -14
  327. package/dist/stores-sql/blob-index-sql.d.ts +148 -0
  328. package/dist/stores-sql/blob-index-sql.js +154 -0
  329. package/dist/stores-sql/checkpoint-store-sql.d.ts +1 -1
  330. package/dist/stores-sql/checkpoint-store-sql.js +11 -27
  331. package/dist/{plugins → stores-sql}/file-history-store-sql.d.ts +23 -11
  332. package/dist/{plugins → stores-sql}/file-history-store-sql.js +23 -18
  333. package/dist/{plugins → stores-sql}/pg-session-storage.d.ts +23 -76
  334. package/dist/{plugins → stores-sql}/pg-session-storage.js +80 -209
  335. package/dist/{plugins → stores-sql}/retention-store-sql.d.ts +123 -217
  336. package/dist/{plugins → stores-sql}/retention-store-sql.js +66 -190
  337. package/dist/{plugins → stores-sql}/session-event-payload.d.ts +1 -1
  338. package/dist/{plugins → stores-sql}/session-event-payload.js +1 -1
  339. package/dist/stores-sql/session-policy-store-sql.d.ts +1 -1
  340. package/dist/stores-sql/session-write-hooks.d.ts +59 -0
  341. package/dist/stores-sql/session-write-hooks.js +2 -0
  342. package/dist/{plugins → stores-sql}/tidb-session-storage.d.ts +10 -11
  343. package/dist/{plugins → stores-sql}/tidb-session-storage.js +10 -21
  344. package/dist/{plugins → stores-sql}/tidb-session-store.d.ts +32 -122
  345. package/dist/{plugins → stores-sql}/tidb-session-store.js +71 -171
  346. package/dist/stores-sql/tool-result-store-sql.d.ts +1 -1
  347. package/dist/stores-sql/tool-result-store-sql.js +1 -1
  348. package/dist/stores-sql/windowed-session-storage.d.ts +56 -0
  349. package/dist/stores-sql/windowed-session-storage.js +61 -0
  350. package/dist/task-a2a.d.ts +7 -1
  351. package/dist/task-a2a.js +15 -14
  352. package/dist/task-cwd.d.ts +11 -3
  353. package/dist/task-cwd.js +17 -1
  354. package/dist/task-mcp.d.ts +10 -2
  355. package/dist/task-mcp.js +13 -16
  356. package/dist/task-settings.d.ts +9 -4
  357. package/dist/task-settings.js +17 -6
  358. package/dist/tool-approval.d.ts +21 -8
  359. package/dist/tool-approval.js +10 -6
  360. package/dist/trace/core-keyset-guard.d.ts +9 -3
  361. package/dist/trace/engine-notice-wire.d.ts +1 -1
  362. package/dist/trace/engine-notice-wire.js +2 -0
  363. package/dist/trace/exit-seat.d.ts +23 -1
  364. package/dist/trace/exit-seat.js +3 -0
  365. package/dist/trace/project.d.ts +33 -16
  366. package/dist/trace/project.js +12 -9
  367. package/dist/trace/redact.d.ts +1 -1
  368. package/dist/trace/redact.js +61 -73
  369. package/dist/trace/self-minted-wire.d.ts +263 -10
  370. package/dist/trace/self-minted-wire.js +90 -2
  371. package/dist/trace/sema-provenance.d.ts +45 -41
  372. package/dist/trace/sema-provenance.js +81 -10
  373. package/dist/trace/task-notification-facets.d.ts +70 -2
  374. package/dist/trace/task-notification-facets.js +71 -1
  375. package/dist/trace/wire-projection-faces.d.ts +38 -2
  376. package/dist/trace/wire-projection-faces.js +26 -1
  377. package/dist/unread-request-members.d.ts +66 -0
  378. package/dist/unread-request-members.js +41 -0
  379. package/dist/user-input-ledger.d.ts +2 -2
  380. package/dist/web-admin-client/apply-effective.js +22 -26
  381. package/dist/web-admin-client/candidate-gate.d.ts +35 -3
  382. package/dist/web-admin-client/candidate-gate.js +53 -5
  383. package/dist/web-admin-client/center-request.d.ts +4 -1
  384. package/dist/web-admin-client/center-request.js +2 -1
  385. package/dist/web-admin-client/effective-keys.js +0 -1
  386. package/dist/web-admin-client/facade.d.ts +1 -1
  387. package/dist/web-admin-client/http-client.d.ts +1 -0
  388. package/dist/web-admin-client/http-client.js +17 -9
  389. package/dist/web-admin-client/restart-signal.js +5 -2
  390. package/dist/web-admin-client/skills-mcp.d.ts +20 -6
  391. package/dist/web-admin-client/skills-mcp.js +26 -21
  392. package/dist/web-admin-client/types.d.ts +34 -49
  393. package/docs/DEVICE-EXECUTOR-PROTOCOL.md +2 -2
  394. package/package.json +13 -12
  395. package/scripts/drain-check-local.mjs +2 -28
  396. package/scripts/drain-check.mysql.sql +2 -18
  397. package/scripts/drain-check.pg.sql +2 -18
  398. package/wire-changes/server@7.147.0.json +813 -0
@@ -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,146 +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_TRUSTED_PROXY_CIDRS`([ref];缺席 = 名单空 = 不读任何代理头,帽键 = socket 对端)= per-remote 帽键的可信代理
1046
- * 名单(规范 CIDR 文本)。socket 对端落在名单内,汇聚端才读 `X-Forwarded-For`、取自右向左第一个名单外地址作帽键。
1047
- * 坏项拒启([ref] A 档),拒因见 config.ts `parseDeviceTrustedProxyCidrsEnv`;唯一消费点 = `boot/device-lane.ts` 透传汇聚端。 */
1048
- trustedProxyCidrs?: readonly string[];
1049
- /** `DEVICE_ENROLL_TOKEN_TTL_SEC`(§4.7 第五个旋钮;默认 900 = §7-T5 ① 的 15min)= enrollment
1050
- * token 的有效期**时长**(整秒,自 **DB now** 起算 —— 时间权威是库,不是副本墙钟)。唯一消费点 =
1051
- * 签发动词 `POST /v1/devices/enroll-tokens`(`http/routes/devices.ts`);[ref] 之前它刻意未铸
1052
- * (端点不存在 ⇒ 铸了就是一个「配了不生效」的死键,[ref] 病族),随该端点同批铸 + 接线。
1053
- * 域 = `[1, 86400]` 的十进制正整数,坏值**拒启**([ref] A 档;解析器 `parseDeviceEnrollTokenTtlEnv`)。
1054
- * 缺席 ⇒ 签发点的属主默认 900(不在 config 层抄第二份默认,与本族其余旋钮同姿势)。 */
1055
- enrollTokenTtlSec?: number;
1056
- /** `DEVICE_RELAY_URL` = 设备入口的运维声明,**必填**(缺席 / 空串 / 只含空白 ⇒ 配置期拒起:契约包车道表 device 行的必需键,同所有车道的必需键判官 `laneMissingEnv`;值的文法与凭据形由解析器 `parseDeviceRelayUrlEnv` 拒):
1057
- * `{ kind: "url" }` = 设备连不到本引擎自己的地址(引擎在中继 / 网关之后)时该拨的那一个 ws(s) URL,**逐字**上能力面 `deviceExecutor.relayUrl`
1058
- * (唯一消费点 `http/routes/capabilities.ts`);`{ kind: "none" }`(字面 `none`)= 没有中继,设备按本引擎地址 + `deviceExecutor.wsPath` 拨号,能力面不带 `relayUrl`。
1059
- * 必填的理由:「设备拨哪里」只有运维知道;缺席曾被读成「直拨」,于是撤掉中继声明而根会话行上还有设备绑定时,设备改拨引擎地址(入口已收窄则拨不到)、
1060
- * 绑定却留在格上 —— 缺席与「声明了直拨」是两件事,只有后者放行。`none` ∧ 有绑定 ⇒ 起服 warn 点名绑定数(`boot/device-lane.ts`)。
1061
- * **不派生**:`FLEET_ADVERTISE_ADDRESS` 是对中心公告的地址(内网 pod IP / 容器别名),受众不是用户机器上的设备;从它拼出来的入口对设备多半不可达。
1062
- * URL 形门 = ws / wss 绝对地址,无 userinfo / query / fragment、不带凭据形(值逐字上能力面),坏值**拒启**。 */
1063
- relay: DeviceRelayDeclaration;
1064
- /** `DEVICE_SUPERSEDE`(默认 `stale_only`)= 同 deviceId 二连的顶替策略(§5.2)。 */
1065
- supersede?: "stale_only" | "deny";
1066
- } | {
1067
- provider: "local-docker";
1068
- image: string;
1069
- mountPath?: string;
1070
- dockerPath?: string;
1071
- dockerHost?: string;
1072
- memory?: string;
1073
- cpus?: number;
1074
- pidsLimit?: number;
1075
- dropAllCaps?: boolean;
1076
- network?: "none" | "bridge" | "host";
1077
- commandTimeoutMs?: number;
1078
- /** [ref] —— `DOCKER_SANDBOX_ENV=NAME,NAME` 点到、且本进程环境里真有的键 ⇒ 原值(与 e2b 的 `sandboxEnv` 同一只解析器、
1079
- * 同一只谓词;每条 `docker exec` 以 `-e K=V` 注入)。键缺席 = 旋钮未设 / 空串。 */
1080
- env?: Record<string, string>;
1081
- };
1064
+ remoteExec: RemoteExecConfig;
1082
1065
  /**
1083
1066
  * SVC-3 git-WORKTREE ISOLATION ([ref] CORE-6). Opt-in (WORKTREE_ISOLATION_ENABLED + WORKTREE_REPO_ROOT).
1084
1067
  * When set, the deployment's `executionEnvFactory` is wrapped so an agent core marks `isolation:"worktree"`
@@ -1366,11 +1349,12 @@ export interface ServiceConfigFlat {
1366
1349
  /** Principals allowed to act as OPERATORS (`OPERATOR_PRINCIPALS`): every operator face reads it through the one reading
1367
1350
  * `explicitOperatorOk` (`http/principal-gate.ts`) — e.g. the F4 approval queue (`/v1/approvals`): list ANY owner's pending +
1368
1351
  * decide. A non-operator principal may only LIST ITS OWN pending. **Empty = no one is an operator** ([ref]: the old
1369
- * "empty = everyone on the approval queue" reading is gone); a single-user deployment that wants to be its own operator
1370
- * 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). */
1371
1354
  operatorPrincipals: string[];
1372
1355
  /** `OPERATOR_SINGLE_USER=true` —— 单用户形显式声明「这台部署的每个调用方都是运维」([ref],[ref] ① 裁 A)。缺席 = 不声明(没人是,除非在名单里)。
1373
1356
  * 只在单用户形(`REQUIRE_PRINCIPAL` 未开)且名单为空时成立 —— 否则拒启(`config-invariants.ts` 的 `operator-single-user`:一个事实一个来源)。
1357
+ * 单用户形上它与具名名单二者必有其一,都没有 ⇒ 拒启(服务进程起服第 1 段;嵌入方在 `createHttpServer`;`operator-declaration-required`,[ref];`false` 与缺席同判)。
1374
1358
  * env 独有(没有中心写位),起服冻结。读法只有 `explicitOperatorOk` / `operatorRosterPresent` 两只。 */
1375
1359
  operatorSingleUser?: boolean;
1376
1360
  /**
@@ -1680,6 +1664,13 @@ export interface ServiceConfigFlat {
1680
1664
  * failed/stoppedBy=system(诚实终态,跨实例读面永不虚构存活)。core 契约要求 ≥10min(60s 心跳的
1681
1665
  * 安全裕度),**下限 10min 硬钳**。Default 15min。`BG_AGENT_STALE_RUNNING_MS`。 */
1682
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;
1683
1674
  /** core 1.382([ref],[ref] 提货单④)`TaskRegistry.reconcileParkedAgents` 的 stale-claim 清算窗
1684
1675
  * ——core 该整块逻辑被 `opts.staleClaimMaxAgeMs !== undefined` 门住,缺席 = **整块清算永不运行**
1685
1676
  * (claim 后 claimer 进程崩死的行永久卡在"已 claim 不可再 claim"态,只能等 checkpoint TTL 自然过期;
@@ -1908,7 +1899,7 @@ export interface ServiceConfigFlat {
1908
1899
  * under the shared-engine shape (several shell sessions on one config, engine rides the FIRST shell's process
1909
1900
  * group per the T11 anti-orphan call) other live sessions may still be using this engine, so an unconditional
1910
1901
  * drain kills a peer mid-turn (499) and 503s new submits. Instead SIGHUP arms an idle watch: shut down only
1911
- * after `inflight()` (bg/resume legs + live streams — the blocking set `http + leader`; session-resident background shells/monitors are in the `/health.inflight` total but do not block) 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`
1912
1903
  * (peers stay fully served). A true orphan (last window closed) self-terminates when the window expires —
1913
1904
  * T11 stands, just bounded instead of immediate. A SECOND SIGHUP (or SIGTERM) escalates to the normal drain
1914
1905
  * path. Default 120s, floor 5s. Env: SIGHUP_IDLE_GRACE_MS. */
@@ -2378,7 +2369,7 @@ export type ServiceMemoryConfig = Pick<ServiceConfigFlat, "memoryEngineEnabled"
2378
2369
  * config 这一层它只是一句声明。 */
2379
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">;
2380
2371
  /** 组:orchestration(编排 + 执行车道 + 沙箱面 + workflow/后台 agent 存留)。 */
2381
- 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">;
2382
2373
  /** 组:limitsHttp(HTTP 面 + 各类上限/配额/回收窗)。 */
2383
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">;
2384
2375
  /** 组:observability(可观测)。 */
@@ -2401,4 +2392,17 @@ export interface ServiceConfigGroups {
2401
2392
  /** Service configuration = 平铺面(唯一存储处,消费点原样) ∩ 九个组视图(additive,不可枚举)。 */
2402
2393
  export interface ServiceConfig extends ServiceConfigFlat, ServiceConfigGroups {
2403
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
+ };
2404
2408
  //# sourceMappingURL=config-types.d.ts.map
package/dist/config.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import { type Model, type PathRuleBases, type PermissionRule } from "@sema-agent/core";
2
2
  import { type ConfigProviderWord } from "./config-types.js";
3
3
  import { type CenterEndpoint } from "./web-admin-client/center-request.js";
4
+ import { type ExecutionLane } from "./execution-lane-caps.js";
4
5
  import { type Autonomy } from "./runtime-governance.js";
5
6
  import { type RunnerEnvNameAllowlistKnob, type ServerEnvNameAllowlistKnob } from "./env-name-allowlist-knobs.js";
6
- import type { ServiceConfig, ServiceConfigFlat, ServiceConfigGroups } from "./config-types.js";
7
+ import type { ServiceConfig, LoadedConfig, RemoteExecConfig, ServiceConfigFlat, ServiceConfigGroups } from "./config-types.js";
7
8
  /** [ref] A1: the config TYPE face lives in the leaf module config-types.ts; re-exported here so
8
9
  * every existing `from "./config.js"` importer compiles unchanged (pure-type consumers should prefer
9
10
  * importing config-types.js directly — a type-only leaf, no loader baggage). */
10
- export type { ServiceConfig, ScopedMcpServer, ImageBakeConfig, ServiceConfigFlat, ServiceConfigGroups, ServiceStoreConfig, ServiceModelPlaneConfig, ServiceApprovalConfig, ServiceMemoryConfig, ServiceAuthConfig, ServiceOrchestrationConfig, ServiceLimitsHttpConfig, ServiceObservabilityConfig, ServiceIntegrationsConfig, MemoryEmbedderConfig, // [ref]:embedder 坐标(plugins/memory-embedder.ts 消费同一属主类型)
11
+ export type { ServiceConfig, LoadedConfig, RemoteExecConfig, ScopedMcpServer, ImageBakeConfig, ServiceConfigFlat, ServiceConfigGroups, ServiceStoreConfig, ServiceModelPlaneConfig, ServiceApprovalConfig, ServiceMemoryConfig, ServiceAuthConfig, ServiceOrchestrationConfig, ServiceLimitsHttpConfig, ServiceObservabilityConfig, ServiceIntegrationsConfig, MemoryEmbedderConfig, // [ref]:embedder 坐标(plugins/memory-embedder.ts 消费同一属主类型)
11
12
  A2aServeConfig, A2aServeSkill, RetentionMode, RetentionSweepConfig, MemoryConsolidationDriverConfig, } from "./config-types.js";
12
13
  export { RETENTION_MODES, MEMORY_CONSOLIDATION_MIN_INTERVAL_SEC } from "./config-types.js";
13
14
  /** Parse the AUTONOMY env into a validated autonomy mode. Unset/empty → undefined (unmanaged → no extra
@@ -113,7 +114,7 @@ export declare function drainConfigNotices(): ConfigNotice[];
113
114
  * 不许被悄悄猜成某一种意思)。
114
115
  *
115
116
  * 修前这根旋钮是开放词,而一个认不出的词在同一进程里被读成两种意思:配置源判官(`configProviderKind`)把它当 `local`
116
- * (读 `config.d/`、执行车道合成步照读 `remote-exec.json`),这里的隐式 host 臂与车道落点披露却按字面 `=== "local"`
117
+ * (读 `config.d/`、执行车道合成步照读 `remote-exec.json`),当时的隐式 host 臂与车道落点披露(7.147.0 随「车道恒具名」退役)却按字面 `=== "local"`
117
118
  * 判它**不是** local;web-admin 工厂同样按字面只在 `"local"` 上递本地根,于是配置源的根落回 `process.cwd()`、
118
119
  * 合成步读的是 `localRoot` —— 两个根分家。收成闭集 + 一个读点之后,这三处读的是同一个值。
119
120
  * 调用方两处、读的是同一张闭集:`loadConfig` 开头一次;`run-local` 在 `loadConfig` 之前一次(本入口只装本地配置源,词是 `remote` 就在这里拒 ——
@@ -187,6 +188,14 @@ export declare function buildUnpricedCeilingNotice(models: Record<string, Model>
187
188
  event: string;
188
189
  fields: Record<string, string>;
189
190
  } | undefined;
191
+ /** 入口程序可以替部署声明的车道:不要坐标 env 之外的任何必需件的那两条(`host` 的坐标可选、`none` 零字段)。 */
192
+ export type EntryDeclarableLane = Extract<ExecutionLane, "host" | "none">;
193
+ /**
194
+ * 这两条车道的配置形(唯一铸点):env 声明了它们时由 {@link loadConfig} 的车道链调,入口程序自身声明它们时由执行车道合成步调 —— 坐标 env 同一读法。
195
+ * DUAL-MODE §5:`host` = 在这台机器上跑、无容器(坐标 `HOST_WORKSPACE_BASE` / `HOST_COMMAND_TIMEOUT_MS` 可选,无必需 env)。
196
+ * 契约 18.0.0:`none` = 部署声明「智能体的工具没有执行环境」(零字段、无必需 env)。
197
+ */
198
+ export declare function entryDeclarableRemoteExec(lane: EntryDeclarableLane): RemoteExecConfig;
190
199
  /** [ref] N8/N9 — the BOOLEAN member of this module's env-parser family (`env`/`env2`/`numEnv`/
191
200
  * `numEnvBounded`/`optFinitePositiveEnv`/`enumEnv`/`headerNameEnv`). Until now booleans were the
192
201
  * one type parsed by a hand-written literal comparison at every single site, and that is exactly why the same
@@ -291,7 +300,9 @@ export declare function isRosterGateArmed(webAdmin: ServiceConfig["webAdmin"]):
291
300
  * {@link findCcRuleFormNames}(它同时是 `allow` 腿的**唯一**判据,见下方例外说明)。
292
301
  * - 退役名(`bash`/`Task`/`KillShell`…)与 pre-prefix 短名(`figma__x`):[ref](core 7.41.0 [ref])起判据是 core 导出的
293
302
  * **那一只** `judgeRuleToolName`(准备阶段、两只会话规则店、本仓会话规则写口同调),本函数零手写臂;指引 = core 表给的现役指引 /
294
- * 补全协议前缀。
303
+ * 补全协议前缀。退役名里**没有后继**的那一种(判词 `retired` 不带 `currentName`:`TeamCreate` / `TaskOutput` / `MultiEdit`)不在拒面 ——
304
+ * `namespaced-rule-name.ts` 的 `isRetiredWithoutSuccessor` 是唯一读法:**有通告席的表**({@link UnmatchableToolNameJudgment} 的 `noticeSeat`)上这一行不拒、原样留着,
305
+ * 读这张表的一方说一句(引擎读的请求规则桶由引擎通告;只有本服务读的运维 / 中心名单由装配处日志点名);没有通告席的表(请求体 `neverAuto`)照拒。
295
306
  * - 够不着挂载工具的协议名:**对端段铸不出**(`mcp__github.com`、`mcp__github.com__*`、对端段里的部分通配 `mcp__git*`、超长 / 归一后带连串下划线的服务器段、对端段为空的
296
307
  * `mcp__` / `mcp____x`)—— 前缀对,但引擎铸注册名时归一对端段,而规则对对端段逐字比,永不匹配。判官是引擎的 `judgeRuleToolName`(core 7.43.0 [ref] (b)
297
308
  * 的判词 `unmintable_segment`,句子带它的 guidance 与 1:1 现名);本仓 7.116.0–7.117.x 那只自比 `mintNamespacePrefix` 的对照随之退役。
@@ -353,6 +364,13 @@ export type UnmatchableToolNameJudgment = {
353
364
  readonly consumer: RuleEntryConsumer;
354
365
  readonly behavior: PermissionRule["behavior"];
355
366
  readonly pathBases?: PathRuleBases;
367
+ /**
368
+ * 这张表上退役且**无后继**的名字({@link isRetiredWithoutSuccessor})由谁说那一句:`engine` = 引擎准备期名字审计铸 `config.legacy_tool_name`
369
+ * (表经带名单投影的策略到达引擎:请求体 `settings.permissions.deny` / `ask`);`server` = 本服务读这张表的那一处落一行日志(运维 `APPROVAL_REQUIRE` /
370
+ * `DENY` / `NEVER_AUTO` 起服、中心 `governance.approvalRequire` 落配)。**在场才不拒**:不拒必须配恰一句话;缺席 = 这张表没有通告席(请求体
371
+ * `settings.permissions.neverAuto`:引擎不读这张表,它编成的策略不带名单投影)⇒ 照拒;放行那一天由本服务铸通告(引擎导出「条目 + 句」源之后),那时加第三个席位词。
372
+ */
373
+ readonly noticeSeat?: "engine" | "server";
356
374
  };
357
375
  /**
358
376
  * 「这张表里有永远不会生效的条目」的**判据与拒因句,同一只函数**(返回 `undefined` = 通过;拒 ⇒ 句子 + 被点名的条目)。
@@ -401,6 +419,47 @@ export declare function approvalGrantRefusal(names: unknown): string | undefined
401
419
  /** [ref] 车2 —— sweep 节律的上界(秒)。`setInterval` 的 delay 是 32 位有符号毫秒(2^31-1);越界会被
402
420
  * Node **重置成 1ms**,理由与拒启判据见调用点。导出供判据与文档单点引用。 */
403
421
  export declare const RETENTION_SWEEP_INTERVAL_MAX_SEC: number;
422
+ /** 域:orchestration(编排 + 执行车道)—— remoteExec 五车道/worktree 隔离、leader/router/scheduler/fork、
423
+ * workflow 与后台 agent 的存留旋钮、沙箱面(pkg 源/env facts/LSP)、烤镜像门。 */
424
+ /**
425
+ * 「按静默判死」的地板 = 引擎写者心跳(60 s)的十倍 —— 引擎给两只按静默收割的同一句参考:耐久行的 stale-running 翻转窗(`BG_AGENT_STALE_RUNNING_MS` 的硬钳)
426
+ * 与会话驻留后台子代理的停滞收割窗(`BG_AGENT_STALL_MS` 派生值的地板)。一句参考一个数。
427
+ */
428
+ export declare const BG_AGENT_SILENCE_FLOOR_MS: number;
429
+ /**
430
+ * `BG_AGENT_STALL_MS`(会话驻留后台子代理的停滞收割窗)的**缺省,同时是下限** —— 唯一计算处(装配读它当缺省与钳位,目录行的派生说明写它的公式,钉断言它)。
431
+ *
432
+ * 引擎按**工具活动**判静默(子代一次工具开始 / 结束算一拍),两拍之间可以合法地静默多久 = 一步:一轮模型输出,接一次工具调用(先在门上等人,再执行)。
433
+ * 本部署说得出上限的两段:
434
+ * · 等人:四个等人窗取大 —— 活审批卡窗(`STREAM_ASK_WINDOW_MS`,单用户 posture 缺省 24 h)、没人在场时铸的审批卡窗(`UNREACHED_ASK_TTL_MS`)、
435
+ * `AskUserQuestion` 窗(`QUESTION_TTL_MS`)、MCP elicitation 窗(`MCP_ELICITATION_TTL_MS`)。子代在这些窗里等人时行是 `running`(只有窗满之后的
436
+ * 耐久停驻才转 `parked`),窗不取大就会把一只等你回来批的子代当僵尸收掉。四个窗不按「这一门开没开」挑 —— 「开没开」的判在各门自己的装配点,
437
+ * 这里再判一次就是第二个读者;没开的门的窗只会让下限偏大(方向 = 多等),要收紧就调小那个窗(门没开时它本来就不起作用)。
438
+ * · 执行:引擎给单条命令的上限(`resolveBashTimeoutCaps().maxMs`,引擎读法的唯一出口,缺省 600 s)。
439
+ * 不进派生的三类(这只窗的误杀面,补偿是把旋钮拉大):
440
+ * · MCP 调用:引擎的时限缺省 1e8 ms(约 27.8 h,引擎刻意取大、交给任务级预算管;进程 env `MCP_TOOL_TIMEOUT` / `MCP_TOOL_TIMEOUT_TOTAL`),
441
+ * 读法不在引擎包根导出 —— 本服务另读那两个 env、另抄那个常数就是第二个读者;调用中的进度通知也不给本行打拍;
442
+ * · 前台嵌套委派:子委派里的工具活动与等人都不给本行打拍(引擎只认带本行派生调用号的工具开始 / 结束),整段委派对本行是一次静默;
443
+ * · 一轮模型输出的总时长(流式文本不打拍)。
444
+ * 另:引擎按墙钟(`Date.now()`)记最后一拍、也按墙钟量静默 —— 墙钟前跳或整机睡眠超过窗,醒来的第一读就会收掉睡前那一拍之后再没打拍的行。
445
+ * 地板 {@link BG_AGENT_SILENCE_FLOOR_MS}:两段都被调到很小时窗也不低于引擎的参考值。
446
+ */
447
+ export declare function backgroundAgentStallFloorMs(f: {
448
+ readonly streamApproval: {
449
+ readonly windowMs: number;
450
+ readonly unreachedTtlMs: number;
451
+ };
452
+ /** 缺席 = 问答协调器的出厂窗(与协调器构造时的回落同一个常量)。 */
453
+ readonly questionThrottle?: {
454
+ readonly ttlMs: number;
455
+ } | undefined;
456
+ readonly mcpElicitation: {
457
+ readonly throttle: {
458
+ readonly ttlMs: number;
459
+ };
460
+ };
461
+ readonly commandCeilingMs: number;
462
+ }): number;
404
463
  /** 域:limits+http(限额与 HTTP 面)—— 端口、附件/工作区体积与 TTL、成本与速率天花板、排空窗、回收周期。 */
405
464
  /**
406
465
  * [ref]:limitsHttp 组里**有下限**的三个数值旋钮的下限值 —— env 腿(夹取+点名)与 center 热腿(整批拒)
@@ -461,7 +520,11 @@ export declare const CONFIG_GROUP_KEYS: {
461
520
  *
462
521
  * `loadConfig` 是主调用点;测试夹具(test/helpers/make-config.ts)构造 `ServiceConfigFlat` 后同样过它。 */
463
522
  export declare function attachConfigGroups(flat: ServiceConfigFlat): ServiceConfig;
464
- export declare function loadConfig(): ServiceConfig;
523
+ /**
524
+ * env → **raw** 配置({@link LoadedConfig}):执行车道可以缺席(env 没有点名)。只有执行车道合成步(`composeExecutionLane`)把它收成
525
+ * {@link ServiceConfig} —— 车道必须来自显式声明(文件 / env / 入口程序自身),否则拒启;合成之前没有读者读车道。
526
+ */
527
+ export declare function loadConfig(): LoadedConfig;
465
528
  /** 有效监听绑址([ref])。**显式 `BIND_HOST`/`HOST` 恒生效**(operator 保留在任何形下明示暴露的
466
529
  * 权利);未显式时:**无鉴权写面 ⇒ 127.0.0.1**,其余 ⇒ undefined(Node 默认全接口,既有部署零影响)。
467
530
  *