@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
@@ -66,6 +66,7 @@ export interface SessionFacesCtx {
66
66
  export declare function createSessionFaces(ctx: SessionFacesCtx): {
67
67
  ownerAware: OwnerAwareSessionStore;
68
68
  sessionAudit: ((sessionId: string, opts?: SessionAuditReadOpts) => Promise<{
69
+ projectId?: string | undefined;
69
70
  agent?: import("../session-agent.js").SessionAgent | undefined;
70
71
  owner: string | null;
71
72
  sessionId: string;
@@ -1,5 +1,6 @@
1
1
  import { buildRewindHandles, buildSessionAudit, buildSessionAuditLocal, buildSessionAuditPg } from "../audit.js";
2
2
  import { readSessionAgent } from "../session-agent.js";
3
+ import { readSessionProjectId, sessionWorkspaceStoreOf } from "../session-workspace.js";
3
4
  import { makeDegenerateInstrument } from "../degenerate-instrument.js";
4
5
  import { PlanCacheProbe } from "../plan-cache-probe.js";
5
6
  import { purgeScratchpadDir } from "../env-facts.js";
@@ -21,6 +22,7 @@ export function createSessionFaces(ctx) {
21
22
  const auditLocalRows = localSessionRowsOf(backend);
22
23
  const ownerAware = sessionStore;
23
24
  const headOf = headReadOf(sessionStore);
25
+ const workspaceStore = sessionWorkspaceStoreOf(sessionStore);
24
26
  const sessionAudit = mysqlPool || auditPgPool || auditLocalRows
25
27
  ? async (sessionId, opts) => {
26
28
  const handles = opts !== undefined && resumeAnchorStore !== undefined ? buildRewindHandles(await resumeAnchorStore.listBySession(sessionId), opts.reader) : undefined;
@@ -31,9 +33,13 @@ export function createSessionFaces(ctx) {
31
33
  : await buildSessionAuditLocal(auditLocalRows, sessionId, handles);
32
34
  if (!audit)
33
35
  return undefined;
34
- const [head, agent] = await Promise.all([headOf?.(sessionId), opts !== undefined ? readSessionAgent(ownerAware, sessionId) : undefined]);
36
+ const [head, agent, projectId] = await Promise.all([
37
+ headOf?.(sessionId),
38
+ opts !== undefined ? readSessionAgent(ownerAware, sessionId) : undefined,
39
+ opts !== undefined ? readSessionProjectId(workspaceStore, sessionId) : undefined,
40
+ ]);
35
41
  const owner = head?.owner;
36
- return { ...audit, owner: owner ?? null, ...(agent !== undefined ? { agent } : {}) };
42
+ return { ...audit, owner: owner ?? null, ...(agent !== undefined ? { agent } : {}), ...(projectId !== undefined ? { projectId } : {}) };
37
43
  }
38
44
  : undefined;
39
45
  const sessionWatchRegistry = headOf
@@ -1,5 +1,5 @@
1
1
  export declare function runStage01(): {
2
- config: import("../config-types.js").ServiceConfig;
2
+ config: import("../config-types.js").LoadedConfig;
3
3
  localRoot: string;
4
4
  logger: import("../observability/logger.js").Logger;
5
5
  metrics: import("../observability/metrics.js").Metrics;
@@ -1,7 +1,7 @@
1
1
  import { homedir } from "node:os";
2
2
  import { loadConfig, logConfigDiagnostics, splitLocalRoots } from "../config.js";
3
3
  import { configLocalRoot } from "../config-provider.js";
4
- import { crossInvariant } from "../config-invariants.js";
4
+ import { operatorDeclarationRefusal, runStaleHeartbeatRefusal } from "../config-invariants.js";
5
5
  import { drainNumEnvWarnings } from "../plugins/remote-shell.js";
6
6
  import { setWebSearchBadPayloadObserver } from "../plugins/web-search.js";
7
7
  import { createLogger } from "../observability/logger.js";
@@ -20,10 +20,14 @@ export function runStage01() {
20
20
  declareServerWithheldEnv();
21
21
  const config = loadConfig();
22
22
  bindOwnCredentialsConfig(config);
23
- const runStaleFailure = crossInvariant("run-stale-heartbeat").check({ live: config, next: config });
23
+ const runStaleFailure = runStaleHeartbeatRefusal(config);
24
24
  if (runStaleFailure !== undefined) {
25
25
  throw new Error(runStaleFailure);
26
26
  }
27
+ const operatorDeclarationFailure = operatorDeclarationRefusal(config);
28
+ if (operatorDeclarationFailure !== undefined) {
29
+ throw new Error(operatorDeclarationFailure);
30
+ }
27
31
  const logger = createLogger(config.logLevel);
28
32
  const metrics = createMetrics();
29
33
  installFailOpenRecorder({ logger, metrics, redactDetail: redactSecrets });
@@ -1,8 +1,8 @@
1
1
  import type { runStage01 } from "./stage-01-config.js";
2
2
  export declare function runStage02(ctx: Awaited<ReturnType<typeof runStage01>>): Promise<{
3
+ config: import("../config-types.js").ServiceConfig;
3
4
  ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
4
5
  webAdmin: import("./web-admin.js").WebAdminRuntime;
5
- config: import("../config-types.js").ServiceConfig;
6
6
  localRoot: string;
7
7
  logger: import("../index.js").Logger;
8
8
  metrics: import("../index.js").Metrics;
@@ -1,7 +1,8 @@
1
1
  import { createUnpricedCeilingVerdict } from "./unpriced-ceiling-verdict.js";
2
2
  import { createWebAdminRuntime } from "./web-admin.js";
3
- import { composeExecutionLane, FILE_SOURCED_LANES } from "./execution-lane.js";
3
+ import { composeExecutionLane, HTTP_SERVICE_LANE_ENTRY } from "./execution-lane.js";
4
4
  import { configSourceKind } from "../config-provider.js";
5
+ import { buildCandidateRejectionNotes } from "../web-admin-client/candidate-gate.js";
5
6
  import { logConfigDirMigration, migrateLocalConfigDirectory } from "../config-d-migration.js";
6
7
  import { logEnvModelsMigration, runEnvModelsMigration } from "../config-root-migration.js";
7
8
  import { assertLocalConfigDirTrusted } from "../config-dir-trust.js";
@@ -10,18 +11,19 @@ import { isRosterGateArmed } from "../config.js";
10
11
  import { judgeServedModelRoute } from "../model-route-endpoint.js";
11
12
  import { servedModelTableLeg } from "../model-select.js";
12
13
  export async function runStage02(ctx) {
13
- const { config, localRoot, logger, metrics } = ctx;
14
- const configSource = configSourceKind(config);
14
+ const { config: loaded, localRoot, logger, metrics } = ctx;
15
+ const configSource = configSourceKind(loaded);
15
16
  if (configSource === "local") {
16
- await assertLocalConfigDirTrusted({ root: localRoot, declaredOwnerUid: config.configLocalOwnerUid });
17
- const envModelsMigration = { root: localRoot, env: process.env, envTableIsPlaceholder: isRosterGateArmed(config.webAdmin) };
17
+ await assertLocalConfigDirTrusted({ root: localRoot, declaredOwnerUid: loaded.configLocalOwnerUid });
18
+ const envModelsMigration = { root: localRoot, env: process.env, envTableIsPlaceholder: isRosterGateArmed(loaded.webAdmin) };
18
19
  logEnvModelsMigration(logger, envModelsMigration, await runEnvModelsMigration(envModelsMigration));
19
20
  logConfigDirMigration(logger, await migrateLocalConfigDirectory(localRoot));
20
21
  }
21
- await composeExecutionLane(config, { configSource, localRoot, logger, drivesFromFile: FILE_SOURCED_LANES });
22
+ const config = await composeExecutionLane(loaded, { configSource, localRoot, logger, entry: HTTP_SERVICE_LANE_ENTRY });
22
23
  const webAdmin = await createWebAdminRuntime({ config, logger, metrics, localRoot });
23
24
  const servedLeg = servedModelTableLeg(config);
24
- const noDefaultModel = defaultModelRefusal(config, servedLeg);
25
+ const rejection = webAdmin.candidateRejectionState();
26
+ const noDefaultModel = defaultModelRefusal({ models: config.models, modelRefusals: config.modelRefusals, candidateRejectionNotes: rejection === undefined ? undefined : buildCandidateRejectionNotes(rejection) }, servedLeg);
25
27
  if (noDefaultModel !== undefined) {
26
28
  throw new Error(noDefaultModel);
27
29
  }
@@ -35,6 +37,6 @@ export async function runStage02(ctx) {
35
37
  }
36
38
  const ceilingVerdict = createUnpricedCeilingVerdict({ config, logger });
37
39
  ceilingVerdict.judge();
38
- return { ...ctx, ceilingVerdict, webAdmin };
40
+ return { ...ctx, config, ceilingVerdict, webAdmin };
39
41
  }
40
42
  //# sourceMappingURL=stage-02-web-admin-pull.js.map
@@ -24,9 +24,9 @@ export declare function runStage03(ctx: Awaited<ReturnType<typeof runStage02>>):
24
24
  taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
25
25
  taskListLane: import("./task-list-lane.js").TaskListLane;
26
26
  usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
27
+ config: import("../config-types.js").ServiceConfig;
27
28
  ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
28
29
  webAdmin: import("./web-admin.js").WebAdminRuntime;
29
- config: import("../config-types.js").ServiceConfig;
30
30
  localRoot: string;
31
31
  logger: import("../index.js").Logger;
32
32
  metrics: import("../index.js").Metrics;
@@ -54,9 +54,9 @@ export declare function runStage04(ctx: Awaited<ReturnType<typeof runStage03>>):
54
54
  taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
55
55
  taskListLane: import("./task-list-lane.js").TaskListLane;
56
56
  usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
57
+ config: import("../config-types.js").ServiceConfig;
57
58
  ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
58
59
  webAdmin: import("./web-admin.js").WebAdminRuntime;
59
- config: import("../config-types.js").ServiceConfig;
60
60
  localRoot: string;
61
61
  logger: import("../index.js").Logger;
62
62
  metrics: import("../index.js").Metrics;
@@ -8,7 +8,7 @@ export declare function runStage05(ctx: Awaited<ReturnType<typeof runStage04>>):
8
8
  dropSessionScoped: (sid: string) => void;
9
9
  executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
10
10
  fenceSessionOwner: (sid: string, owner: string | null) => void;
11
- sessionResidentBackground: () => number;
11
+ sessionResidentBackground: () => import("../session-resident-background.js").SessionResidentCounts;
12
12
  lspManager: import("@sema-agent/core").NodeLspManager | import("../lsp/manager.js").E2bLspManager | undefined;
13
13
  spaceReclaimer: import("../workspace-space.js").SpaceReclaimer | undefined;
14
14
  sandboxPodReaper: import("../plugins/k8s-pod-reaper.js").SandboxPodReaper | undefined;
@@ -75,9 +75,9 @@ export declare function runStage05(ctx: Awaited<ReturnType<typeof runStage04>>):
75
75
  taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
76
76
  taskListLane: import("./task-list-lane.js").TaskListLane;
77
77
  usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
78
+ config: import("../config-types.js").ServiceConfig;
78
79
  ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
79
80
  webAdmin: import("./web-admin.js").WebAdminRuntime;
80
- config: import("../config-types.js").ServiceConfig;
81
81
  localRoot: string;
82
82
  logger: import("../index.js").Logger;
83
83
  metrics: import("../index.js").Metrics;
@@ -10,12 +10,12 @@ import { SANDBOX_GIT_PLANE_OFF_TEXT } from "../sandbox-git-plane.js";
10
10
  import { createPeerDesk } from "../peer-seat.js";
11
11
  export async function runStage05(ctx) {
12
12
  const { backend, config, instanceId, logger, metrics, sessionStore, taskAttachmentStore } = ctx;
13
- const deviceLane = config.remoteExec?.provider === "device" ? createDeviceLane({ config, logger, metrics, backend, seat: sessionStore.executionPlacement, replicaId: instanceId }) : undefined;
13
+ const deviceLane = config.remoteExec.provider === "device" ? createDeviceLane({ config, logger, metrics, backend, seat: sessionStore.executionPlacement, replicaId: instanceId }) : undefined;
14
14
  const headOf = headReadOf(sessionStore);
15
15
  const spaceCommits = backend !== undefined ? () => runStore : undefined;
16
16
  const { perTaskImage, sessionEnvSelection, perSessionCwd, setSessionCwd, setSessionShellEnv, setSessionInheritEnv, fenceSessionOwner, dropSessionScoped, sessionResidentBackground, executionEnvFactory, worktreeReap, sendUserFileTaskEnvs, lspManager, spaceReclaimer, sandboxSecretSeatGate, sandboxPodReaper, sandboxGitPlane: sandboxGitPlaneSeat, } = createExecutionEnv({ config, logger, metrics, taskAttachmentStore, ...(deviceLane ? { deviceLane } : {}), ...(spaceCommits !== undefined ? { spaceCommits } : {}), ...(headOf !== undefined ? { headOf } : {}), ...(backend !== undefined ? { runRows: () => runStore } : {}) });
17
- assertDeviceLaneWired(config.remoteExec?.provider === "device", deviceLane, executionEnvFactory !== undefined);
18
- if (deviceLane !== undefined && config.remoteExec?.provider === "device")
17
+ assertDeviceLaneWired(config.remoteExec.provider === "device", deviceLane, executionEnvFactory !== undefined);
18
+ if (deviceLane !== undefined && config.remoteExec.provider === "device")
19
19
  await noteDeviceRelayBindings(config.remoteExec.relay, deviceLane.store, logger);
20
20
  assertWorkspaceSpaceReadable(facts.workspaceSpace(config), { headOf, spaceCommits }, facts.workspaceCache(config), sessionStoreLabelOf(config.sessionBackend, backend?.kind));
21
21
  if (sandboxSecretSeatGate !== undefined)
@@ -30,7 +30,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
30
30
  outcomeSink: import("../plugins/file-outcome-sink.js").OutcomeSink | undefined;
31
31
  principalCaps: import("../runtime-caps-resolver.js").PrincipalEntitlementsClient | undefined;
32
32
  question: import("../question.js").QuestionCoordinator | undefined;
33
- retentionExecutor: import("../plugins/retention-store-sql.js").SqlRetentionStore | undefined;
33
+ retentionExecutor: import("../plugins/retention-deployment.js").RetentionExecutor | undefined;
34
34
  retentionLaneStore: import("../plugins/retention-lane-store-sql.js").RetentionLaneStore | undefined;
35
35
  runner: Runner;
36
36
  runnerDeps: import("@sema-agent/core").RunnerDeps;
@@ -69,7 +69,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
69
69
  dropSessionScoped: (sid: string) => void;
70
70
  executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
71
71
  fenceSessionOwner: (sid: string, owner: string | null) => void;
72
- sessionResidentBackground: () => number;
72
+ sessionResidentBackground: () => import("../session-resident-background.js").SessionResidentCounts;
73
73
  lspManager: import("@sema-agent/core").NodeLspManager | import("../lsp/manager.js").E2bLspManager | undefined;
74
74
  spaceReclaimer: import("../workspace-space.js").SpaceReclaimer | undefined;
75
75
  sandboxPodReaper: import("../plugins/k8s-pod-reaper.js").SandboxPodReaper | undefined;
@@ -136,9 +136,9 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
136
136
  taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
137
137
  taskListLane: import("./task-list-lane.js").TaskListLane;
138
138
  usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
139
+ config: import("../config-types.js").ServiceConfig;
139
140
  ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
140
141
  webAdmin: import("./web-admin.js").WebAdminRuntime;
141
- config: import("../config-types.js").ServiceConfig;
142
142
  localRoot: string;
143
143
  logger: import("../index.js").Logger;
144
144
  metrics: import("../index.js").Metrics;
@@ -6,7 +6,6 @@ import { ForkRoutingSessionStore } from "../plugins/fork-routing-session-store.j
6
6
  import { withoutHands } from "../capabilities/hands-lane.js";
7
7
  import { isBrandedDeployment } from "../capabilities/brand-identity.js";
8
8
  import { hasServiceAuth } from "../http/server.js";
9
- import { operatorRosterPresent } from "../http/principal-gate.js";
10
9
  import { workflowModelAllowlistFor } from "../task-workflow.js";
11
10
  import { createHookLlm, buildHookFailureText } from "../hooks/hook-llm.js";
12
11
  import { assertRetentionLaneWirable } from "./retention-lane.js";
@@ -28,7 +27,7 @@ import { createSharedMemoryScopeAuthorizer } from "../shared-memory-scope-author
28
27
  import { mountOrgDeliveryGate } from "./org-delivery.js";
29
28
  import { parkedAskRedeem, runStore } from "./late-binds.js";
30
29
  import { withInternalRunEnvs } from "../internal-run-env.js";
31
- import { retentionSweepRuns } from "../plugins/retention-store-sql.js";
30
+ import { retentionSweepRuns } from "../plugins/retention-declaration.js";
32
31
  import { createOperatorFaceIncidentSink } from "../memory-incident-sink.js";
33
32
  export async function runStage06(ctx) {
34
33
  const { backend, backgroundAgentStore, brain, engineDataRoot, peerDesk, config, webAdmin, consolidationValve, deploymentMods, executionEnvFactory, fileHistoryStore, localRoot, logger, lspManager, mailboxRecipientLifecycle, mailboxStore, memoryEngine, memorySyncRunner, metrics, perSessionCwd, permissionRuleProvider, pricing, rosterStore, ruleConsent, sendUserFileTaskEnvs, sessionCaptureRecords, sessionPolicyStore, sessionStore, taskAttachmentStore, taskListLane, toolResultStore, tracer, usageWindowStore } = ctx;
@@ -112,7 +111,6 @@ export async function runStage06(ctx) {
112
111
  : undefined;
113
112
  for (const w of buildConsolidationValveAudit({
114
113
  valve: consolidationValve,
115
- operatorRosterPresent: operatorRosterPresent(config),
116
114
  hasServiceAuth: hasServiceAuth(config),
117
115
  allowUnauthedWrites: config.allowUnauthedWrites ?? false,
118
116
  }).warnings) {
@@ -47,7 +47,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
47
47
  outcomeSink: import("../plugins/file-outcome-sink.js").OutcomeSink | undefined;
48
48
  principalCaps: import("../runtime-caps-resolver.js").PrincipalEntitlementsClient | undefined;
49
49
  question: import("../question.js").QuestionCoordinator | undefined;
50
- retentionExecutor: import("../plugins/retention-store-sql.js").SqlRetentionStore | undefined;
50
+ retentionExecutor: import("../plugins/retention-deployment.js").RetentionExecutor | undefined;
51
51
  retentionLaneStore: import("../plugins/retention-lane-store-sql.js").RetentionLaneStore | undefined;
52
52
  runner: import("@sema-agent/core").Runner;
53
53
  runnerDeps: import("@sema-agent/core").RunnerDeps;
@@ -86,7 +86,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
86
86
  dropSessionScoped: (sid: string) => void;
87
87
  executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
88
88
  fenceSessionOwner: (sid: string, owner: string | null) => void;
89
- sessionResidentBackground: () => number;
89
+ sessionResidentBackground: () => import("../session-resident-background.js").SessionResidentCounts;
90
90
  lspManager: import("@sema-agent/core").NodeLspManager | import("../lsp/manager.js").E2bLspManager | undefined;
91
91
  spaceReclaimer: import("../workspace-space.js").SpaceReclaimer | undefined;
92
92
  sandboxPodReaper: import("../plugins/k8s-pod-reaper.js").SandboxPodReaper | undefined;
@@ -153,9 +153,9 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
153
153
  taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
154
154
  taskListLane: import("./task-list-lane.js").TaskListLane;
155
155
  usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
156
+ config: import("../config-types.js").ServiceConfig;
156
157
  ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
157
158
  webAdmin: import("./web-admin.js").WebAdminRuntime;
158
- config: import("../config-types.js").ServiceConfig;
159
159
  localRoot: string;
160
160
  logger: import("../index.js").Logger;
161
161
  metrics: import("../index.js").Metrics;
@@ -14,7 +14,7 @@ import { buildScenarios, builtinScenarioDetails, danglingScenarioRefusal } from
14
14
  import { isBrandedDeployment } from "../capabilities/brand-identity.js";
15
15
  import { RateLimiter } from "../observability/rate-limit.js";
16
16
  import { explicitOperatorOk } from "../http/server.js";
17
- import { buildOperatorUndeclaredNotice, buildServiceTokenPostureNotice } from "../http/principal-gate.js";
17
+ import { buildServiceTokenPostureNotice } from "../http/principal-gate.js";
18
18
  import { selfOrchestrationDenial } from "../task-workflow.js";
19
19
  import { centerEntitlementSourceWired } from "../runtime-caps-resolver.js";
20
20
  import { reclaimOrphansAtBoot } from "../boot-reclaim.js";
@@ -87,7 +87,7 @@ export async function runStage07(ctx) {
87
87
  })()
88
88
  : undefined;
89
89
  const imageIndex = backend?.imageIndex ? backend.imageIndex() : undefined;
90
- const selectEnvTool = config.selectEnvironmentTool && config.remoteExec?.provider === "k8s" && imageIndex
90
+ const selectEnvTool = config.selectEnvironmentTool && config.remoteExec.provider === "k8s" && imageIndex
91
91
  ? selectEnvironmentTool({
92
92
  catalog: imageIndex,
93
93
  selection: sessionEnvSelection,
@@ -99,11 +99,6 @@ export async function runStage07(ctx) {
99
99
  logger.info("image_bakes_enabled", { operators: config.operatorPrincipals.length, runner: config.imageBakes.runnerPrincipal });
100
100
  if (durableEnabled)
101
101
  logger.info("durable_approval_enabled", { toolApprovalGate: config.approvalRequire.length });
102
- {
103
- const undeclared = buildOperatorUndeclaredNotice(config);
104
- if (undeclared)
105
- logger.warn(undeclared.event, undeclared.fields);
106
- }
107
102
  {
108
103
  const posture = buildServiceTokenPostureNotice(config);
109
104
  if (posture)
@@ -128,7 +123,7 @@ export async function runStage07(ctx) {
128
123
  }
129
124
  }
130
125
  for (const w of buildNoResponderBootWarns({
131
- lane: executionLaneOf(config.remoteExec?.provider),
126
+ lane: config.remoteExec.provider,
132
127
  selfOrchestrationEnabled: config.selfOrchestrationEnabled,
133
128
  approvalFaceWired: toolApproval !== undefined || durableEnabled,
134
129
  }))
@@ -182,7 +177,7 @@ export async function runStage07(ctx) {
182
177
  const webFetchSummarize = createWebFetchSummarizeLane({ brain, config, getKeyResolver: () => webAdmin.getKeyResolver(), logger });
183
178
  const scenarioDeps = {
184
179
  runner, subRunner, model: DEFAULT_MODEL_REF, skills, repoClient, requirePrincipal: config.requirePrincipal,
185
- handsLane: laneWiresExecutionEnv(executionLaneOf(config.remoteExec?.provider)),
180
+ handsLane: laneWiresExecutionEnv(config.remoteExec.provider),
186
181
  webSearch: webSearch ? webSearch : undefined, logger, webFetchSummarize,
187
182
  backgroundAgentStore: backgroundAgentStore ? backgroundAgentStore : undefined,
188
183
  checkpointStore: checkpointStore ? checkpointStore : undefined,
@@ -60,7 +60,7 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
60
60
  outcomeSink: import("../plugins/file-outcome-sink.js").OutcomeSink | undefined;
61
61
  principalCaps: import("../runtime-caps-resolver.js").PrincipalEntitlementsClient | undefined;
62
62
  question: import("../question.js").QuestionCoordinator | undefined;
63
- retentionExecutor: import("../plugins/retention-store-sql.js").SqlRetentionStore | undefined;
63
+ retentionExecutor: import("../plugins/retention-deployment.js").RetentionExecutor | undefined;
64
64
  retentionLaneStore: import("../plugins/retention-lane-store-sql.js").RetentionLaneStore | undefined;
65
65
  runner: Runner;
66
66
  runnerDeps: import("@sema-agent/core").RunnerDeps;
@@ -99,7 +99,7 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
99
99
  dropSessionScoped: (sid: string) => void;
100
100
  executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
101
101
  fenceSessionOwner: (sid: string, owner: string | null) => void;
102
- sessionResidentBackground: () => number;
102
+ sessionResidentBackground: () => import("../session-resident-background.js").SessionResidentCounts;
103
103
  lspManager: import("@sema-agent/core").NodeLspManager | import("../lsp/manager.js").E2bLspManager | undefined;
104
104
  spaceReclaimer: import("../workspace-space.js").SpaceReclaimer | undefined;
105
105
  sandboxPodReaper: import("../plugins/k8s-pod-reaper.js").SandboxPodReaper | undefined;
@@ -166,9 +166,9 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
166
166
  taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
167
167
  taskListLane: import("./task-list-lane.js").TaskListLane;
168
168
  usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
169
+ config: import("../config-types.js").ServiceConfig;
169
170
  ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
170
171
  webAdmin: import("./web-admin.js").WebAdminRuntime;
171
- config: import("../config-types.js").ServiceConfig;
172
172
  localRoot: string;
173
173
  logger: import("../index.js").Logger;
174
174
  metrics: import("../index.js").Metrics;
@@ -18,6 +18,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
18
18
  }>) | undefined;
19
19
  webAdminJwtVerifier: import("../auth-bridge.js").WebAdminJwtVerifier | undefined;
20
20
  sessionAudit: ((sessionId: string, opts?: import("../audit.js").SessionAuditReadOpts) => Promise<{
21
+ projectId?: string | undefined;
21
22
  agent?: import("../session-agent.js").SessionAgent | undefined;
22
23
  owner: string | null;
23
24
  sessionId: string;
@@ -84,7 +85,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
84
85
  outcomeSink: import("../plugins/file-outcome-sink.js").OutcomeSink | undefined;
85
86
  principalCaps: import("../runtime-caps-resolver.js").PrincipalEntitlementsClient | undefined;
86
87
  question: import("../question.js").QuestionCoordinator | undefined;
87
- retentionExecutor: import("../plugins/retention-store-sql.js").SqlRetentionStore | undefined;
88
+ retentionExecutor: import("../plugins/retention-deployment.js").RetentionExecutor | undefined;
88
89
  retentionLaneStore: import("../plugins/retention-lane-store-sql.js").RetentionLaneStore | undefined;
89
90
  runner: import("@sema-agent/core").Runner;
90
91
  runnerDeps: import("@sema-agent/core").RunnerDeps;
@@ -123,7 +124,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
123
124
  dropSessionScoped: (sid: string) => void;
124
125
  executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
125
126
  fenceSessionOwner: (sid: string, owner: string | null) => void;
126
- sessionResidentBackground: () => number;
127
+ sessionResidentBackground: () => import("../session-resident-background.js").SessionResidentCounts;
127
128
  lspManager: import("@sema-agent/core").NodeLspManager | import("../lsp/manager.js").E2bLspManager | undefined;
128
129
  spaceReclaimer: import("../workspace-space.js").SpaceReclaimer | undefined;
129
130
  sandboxPodReaper: import("../plugins/k8s-pod-reaper.js").SandboxPodReaper | undefined;
@@ -190,9 +191,9 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
190
191
  taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
191
192
  taskListLane: import("./task-list-lane.js").TaskListLane;
192
193
  usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
194
+ config: import("../config-types.js").ServiceConfig;
193
195
  ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
194
196
  webAdmin: import("./web-admin.js").WebAdminRuntime;
195
- config: import("../config-types.js").ServiceConfig;
196
197
  localRoot: string;
197
198
  logger: import("../index.js").Logger;
198
199
  metrics: import("../index.js").Metrics;
@@ -17,6 +17,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
17
17
  }>) | undefined;
18
18
  webAdminJwtVerifier: import("../auth-bridge.js").WebAdminJwtVerifier | undefined;
19
19
  sessionAudit: ((sessionId: string, opts?: import("../audit.js").SessionAuditReadOpts) => Promise<{
20
+ projectId?: string | undefined;
20
21
  agent?: import("../session-agent.js").SessionAgent | undefined;
21
22
  owner: string | null;
22
23
  sessionId: string;
@@ -83,7 +84,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
83
84
  outcomeSink: import("../plugins/file-outcome-sink.js").OutcomeSink | undefined;
84
85
  principalCaps: import("../runtime-caps-resolver.js").PrincipalEntitlementsClient | undefined;
85
86
  question: import("../question.js").QuestionCoordinator | undefined;
86
- retentionExecutor: import("../plugins/retention-store-sql.js").SqlRetentionStore | undefined;
87
+ retentionExecutor: import("../plugins/retention-deployment.js").RetentionExecutor | undefined;
87
88
  retentionLaneStore: import("../plugins/retention-lane-store-sql.js").RetentionLaneStore | undefined;
88
89
  runner: import("@sema-agent/core").Runner;
89
90
  runnerDeps: import("@sema-agent/core").RunnerDeps;
@@ -122,7 +123,7 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
122
123
  dropSessionScoped: (sid: string) => void;
123
124
  executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
124
125
  fenceSessionOwner: (sid: string, owner: string | null) => void;
125
- sessionResidentBackground: () => number;
126
+ sessionResidentBackground: () => import("../session-resident-background.js").SessionResidentCounts;
126
127
  lspManager: import("@sema-agent/core").NodeLspManager | import("../lsp/manager.js").E2bLspManager | undefined;
127
128
  spaceReclaimer: import("../workspace-space.js").SpaceReclaimer | undefined;
128
129
  sandboxPodReaper: import("../plugins/k8s-pod-reaper.js").SandboxPodReaper | undefined;
@@ -189,9 +190,9 @@ export declare function runStage10(ctx: Awaited<ReturnType<typeof runStage09>>):
189
190
  taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
190
191
  taskListLane: import("./task-list-lane.js").TaskListLane;
191
192
  usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
193
+ config: import("../config-types.js").ServiceConfig;
192
194
  ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
193
195
  webAdmin: import("./web-admin.js").WebAdminRuntime;
194
- config: import("../config-types.js").ServiceConfig;
195
196
  localRoot: string;
196
197
  logger: import("../index.js").Logger;
197
198
  metrics: import("../index.js").Metrics;
@@ -85,7 +85,7 @@ export async function runStage10(ctx) {
85
85
  sessionAudit,
86
86
  routeJudgeBrain: brain,
87
87
  purgeSession: purgeSession ? purgeSession : undefined,
88
- bindSessionInheritEnv: executionLaneOf(config.remoteExec?.provider) === "host" ? setSessionInheritEnv : undefined,
88
+ bindSessionInheritEnv: config.remoteExec.provider === "host" ? setSessionInheritEnv : undefined,
89
89
  subagentTaskOutput: (handle, access) => backgroundAgentOutput(defaultTaskRegistry, handle, access, backgroundAgentStore),
90
90
  taskHandleOutput: (handle, access) => taskHandleOutput(defaultTaskRegistry, handle, access, backgroundAgentStore),
91
91
  taskHandleStop: (handle, access) => taskHandleStop(defaultTaskRegistry, handle, access, backgroundAgentStore),
@@ -174,6 +174,7 @@ export async function runStage10(ctx) {
174
174
  sealedKeyPublic: webAdmin.sealedKeyPublic,
175
175
  sandboxGitPlane,
176
176
  deploymentModPackages: deploymentModsLoaded.length,
177
+ perSessionCwd,
177
178
  instanceId,
178
179
  capabilities: {
179
180
  version: serviceVersion(),
@@ -1,3 +1,4 @@
1
+ import { sessionBoxMountVerdict } from "@sema-agent/core";
1
2
  import type { ServiceConfig } from "../config.js";
2
3
  import { type MemorySyncRunner } from "../memory-sync-client.js";
3
4
  import type { Logger } from "../observability/logger.js";
@@ -20,6 +21,14 @@ export interface OpenStoresCtx {
20
21
  * 不在这里手抄一份,也不在别处再求一遍(手抄的判据会漂,漂的方向要么是拒启误伤、要么是该拒不拒;再求一遍的 park 设施位手上没有那只店)。本函数只做探:有 SQL 池就探,local 后端无池则无事。
21
22
  */
22
23
  export declare function assertApprovalAskRuleMaterialOnBackend(backend: StoreBackend | undefined): Promise<void>;
24
+ /**
25
+ * 起服报告 `session_box_mount` 那一行(纯数据):引擎会话盒挂载判官的判决 → 级别与键集,唯一一处。挂得上 ⇒ info `{ peerLaneMountable: true }`;
26
+ * 挂不上 ⇒ warn `{ peerLaneMountable: false, peerLaneRefusal: <引擎的码>, reason: <引擎的句> }`。{@link openStores} 对本部署装的那一对店问一次、按它落行。
27
+ */
28
+ export declare function buildSessionBoxMountLine(verdict: ReturnType<typeof sessionBoxMountVerdict>): {
29
+ readonly level: "info" | "warn";
30
+ readonly fields: Readonly<Record<string, unknown>>;
31
+ };
23
32
  export declare function openStores(ctx: OpenStoresCtx): Promise<{
24
33
  backend: StoreBackend | undefined;
25
34
  storePosture: import("../store-posture.js").StorePosture;
@@ -1,5 +1,5 @@
1
1
  import { join } from "node:path";
2
- import { FileBackgroundAgentStore, FileMailboxStore, FileRosterStore, InMemoryUsageWindowStore, mailboxCrossProcessMountVerdict } from "@sema-agent/core";
2
+ import { FileBackgroundAgentStore, FileMailboxStore, FileRosterStore, InMemoryUsageWindowStore, sessionBoxMountVerdict } from "@sema-agent/core";
3
3
  import { createCorruptReadFailOpenSeat } from "../observability/corrupt-read-seat.js";
4
4
  import { startMemorySyncRunner } from "../memory-sync-client.js";
5
5
  import { errorCodeOf, errorKindOf } from "../observability/err-text.js";
@@ -35,8 +35,9 @@ import { assertToolResultProvenanceSchema } from "../stores-sql/tool-result-stor
35
35
  import { assertPermissionRuleApprovalSchema, assertPermissionRuleTicketSchema } from "../plugins/permission-rule-store-sql.js";
36
36
  import { assertApprovalAskRuleMaterialSchema } from "../plugins/approval-ask-store-sql.js";
37
37
  import { assertSchemaMatchesCode } from "../plugins/schema-consistency.js";
38
+ import { assertSessionExtCascadeOn } from "../plugins/session-ext-table.js";
38
39
  import { SqlCheckpointStore, assertCheckpointColumnSchema } from "../stores-sql/checkpoint-store-sql.js";
39
- import { assertFileHistorySchema } from "../plugins/file-history-store-sql.js";
40
+ import { assertFileHistorySchema } from "../stores-sql/file-history-store-sql.js";
40
41
  import { buildMemoryBoundaryLaneFacts, buildMemoryWriteBoundaryAudit } from "./memory-boundary.js";
41
42
  import { buildMemoryPosture } from "../memory-posture.js";
42
43
  import { headReadOf } from "../session-incarnation.js";
@@ -57,6 +58,11 @@ export async function assertApprovalAskRuleMaterialOnBackend(backend) {
57
58
  else if (mysqlPool)
58
59
  await assertApprovalAskRuleMaterialSchema(async (sql) => ({ rows: (await mysqlPool.query(sql))[0] }), "mysql");
59
60
  }
61
+ export function buildSessionBoxMountLine(verdict) {
62
+ return verdict.ok
63
+ ? { level: "info", fields: { peerLaneMountable: true } }
64
+ : { level: "warn", fields: { peerLaneMountable: false, peerLaneRefusal: verdict.code, reason: verdict.reason } };
65
+ }
60
66
  export async function openStores(ctx) {
61
67
  const { config, logger, metrics, localRoot } = ctx;
62
68
  let backend;
@@ -98,6 +104,10 @@ export async function openStores(ctx) {
98
104
  await assertFileHistorySchema(async (sql) => ({ rows: (await pgPool.query(sql)).rows }), "pg");
99
105
  else if (mysqlPool)
100
106
  await assertFileHistorySchema(async (sql) => ({ rows: (await mysqlPool.query(sql))[0] }), "mysql");
107
+ if (pgPool)
108
+ await assertSessionExtCascadeOn(pgDriver(pgPool));
109
+ else if (mysqlPool)
110
+ await assertSessionExtCascadeOn(mysqlDriver(mysqlPool));
101
111
  }
102
112
  if (backend)
103
113
  await runAndLogOneTimeMigrations(logger, backend);
@@ -159,7 +169,7 @@ export async function openStores(ctx) {
159
169
  });
160
170
  if (embedder !== undefined && config.memoryEmbedder !== undefined) {
161
171
  await ensurePgMemoryEmbedderMetaSchema(q);
162
- await reconcileEmbedderFingerprint(q, { model: config.memoryEmbedder.model, dimensions: config.memoryEmbedder.dimensions }, { log: logger });
172
+ await reconcileEmbedderFingerprint(q, { model: config.memoryEmbedder.model, dimensions: config.memoryEmbedder.dimensions }, { log: logger, reembedConfirmed: config.memoryEmbedder.reembedConfirmed === true });
163
173
  }
164
174
  else {
165
175
  logger.info("memory_embedder_identity_absent", {
@@ -322,13 +332,10 @@ export async function openStores(ctx) {
322
332
  if (mailboxStore)
323
333
  mailboxRecipientLifecycle = recipientLifecycleOf(mailboxStore);
324
334
  if (mailboxStore) {
325
- const laneVerdict = mailboxCrossProcessMountVerdict(mailboxStore);
326
335
  logger.info("mailbox_store_enabled", {
327
336
  backend: pgPool ? "pg" : mysqlPool ? "mysql" : "file",
328
337
  crossProcessSafe: mailboxStore.crossProcessSafe,
329
338
  recipientTombstones: pgPool !== undefined || mysqlPool !== undefined,
330
- peerLaneMountable: laneVerdict.ok,
331
- ...(laneVerdict.ok ? {} : { peerLaneRefusal: laneVerdict.code }),
332
339
  });
333
340
  }
334
341
  }
@@ -397,7 +404,7 @@ export async function openStores(ctx) {
397
404
  await ensurePgDeviceSchema(async (text, params) => pgPool.query(text, params));
398
405
  if (mysqlPool)
399
406
  await ensureTiDBDeviceSchema(mysqlPool);
400
- if (config.remoteExec?.provider === "device") {
407
+ if (config.remoteExec.provider === "device") {
401
408
  if (pgPool)
402
409
  await assertDeviceAuditRebindEventSchema(pgDriver(pgPool));
403
410
  else if (mysqlPool)
@@ -429,6 +436,10 @@ export async function openStores(ctx) {
429
436
  });
430
437
  }
431
438
  metrics.dynamicGauge("sessions_warm", "Sessions held in the warm cache", () => sessionStore.size);
439
+ if (mailboxStore !== undefined) {
440
+ const line = buildSessionBoxMountLine(sessionBoxMountVerdict(mailboxStore, sessionStore));
441
+ logger[line.level]("session_box_mount", line.fields);
442
+ }
432
443
  const breakerState = backend?.breaker && config.resilience.circuitBreaker
433
444
  ? backend
434
445
  .breaker((streak) => {
@@ -7,7 +7,7 @@ import { stableStringify } from "@sema-agent/settings-schema/hash";
7
7
  import { buildModelRefusalsSignal } from "../model-entry-refusal.js";
8
8
  import { CenterPromptSource, FilePromptArtifactStore, FilePromptSourceStateStore, MemoryPromptArtifactStore, MemoryPromptSourceStateStore, } from "@sema-agent/core";
9
9
  import { buildPricing } from "../budget.js";
10
- import { applyCenterPlugins } from "../capabilities/center-plugins.js";
10
+ import { applyCenterPlugins, pluginCacheRootFor } from "../capabilities/center-plugins.js";
11
11
  import { applyCenterArtifact, centerSourceOnError, withPromptArtifactBackfill } from "../capabilities/center-prompts.js";
12
12
  import { centerScenarios, centerScenarioDetails } from "../capabilities/scenarios.js";
13
13
  import { isRosterGateArmed } from "../config.js";
@@ -213,7 +213,7 @@ export async function createWebAdminRuntime(ctx) {
213
213
  const domains = verdict.domains.join(",");
214
214
  if (candidateRejection?.version === r.effective.version && candidateRejection.domains.join(",") === domains)
215
215
  return;
216
- admitArrival(ordinal, candidateRejectionOf(r, verdict, candidateSource().kind, Date.now()));
216
+ admitArrival(ordinal, candidateRejectionOf(r, verdict, candidateSource().kind, Date.now(), localDirField.dir));
217
217
  logger.warn("config_candidate_rejected", buildCandidateRejectedFields(r, verdict, leg, { lkgVersion: latestEffective?.version ?? "(env)", ...localDirField }));
218
218
  };
219
219
  const noteSourceAtApplied = () => {
@@ -776,7 +776,7 @@ export async function createWebAdminRuntime(ctx) {
776
776
  skills = await applySkillsManifest(skills, effective.skills, candidateSource(), logger);
777
777
  if (effective?.plugins !== undefined) {
778
778
  const pluginOut = await applyCenterPlugins(skills, effective, {
779
- cacheRoot: join(config.localDataRoot ?? join(homedir(), ".ai-agent"), "plugin-cache"),
779
+ cacheRoot: pluginCacheRootFor(config.localDataRoot ?? join(homedir(), ".ai-agent")),
780
780
  allowHosts: config.pluginsAllowHosts,
781
781
  toolsShareThisFilesystem: DEPLOYMENT_SHAPE_PREDICATES.toolsOnThisHost.holds(config),
782
782
  logger,
@@ -97,6 +97,8 @@ export declare function materializablePlugins(eff: {
97
97
  url: string;
98
98
  sha?: string;
99
99
  }>;
100
+ /** 中心 plugin 缓存根 `<数据根>/plugin-cache`(组合根传给 {@link applyCenterPlugins} 的 `cacheRoot` 与一次性迁移 M39 的名册同读这一只)。 */
101
+ export declare function pluginCacheRootFor(dataRoot: string): string;
100
102
  /** 总入口(条款 3/7/8):逐条物化 + 装载 + 让位合并。materialize 盘位 = `<cacheRoot>/<name>/live`
101
103
  * (成功后原子 rename 替换,失败保留旧盘位 = LKG)。 */
102
104
  export declare function applyCenterPlugins(baseline: LoadedSkill[], eff: {