@sema-agent/server 7.131.0 → 7.133.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (509) hide show
  1. package/MIGRATION.md +575 -0
  2. package/README.md +12 -9
  3. package/README.zh-CN.md +9 -6
  4. package/USAGE.md +326 -98
  5. package/deploy/sema-up/README.md +19 -1
  6. package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -2
  7. package/deploy/sema-up/chart/templates/server.yaml +5 -2
  8. package/deploy/sema-up/stack/compose.yaml +3 -0
  9. package/deploy/sema-up/stack/sema-stack-cluster.yaml +4 -2
  10. package/dist/adoption/plan.d.ts +3 -2
  11. package/dist/adoption/plan.js +7 -5
  12. package/dist/adoption/runner.js +3 -10
  13. package/dist/adoption/sql.d.ts +3 -2
  14. package/dist/adoption/sql.js +3 -5
  15. package/dist/adoption/wire.d.ts +4 -1
  16. package/dist/adoption/wire.js +1 -0
  17. package/dist/approval-ask-audit-store.d.ts +31 -13
  18. package/dist/approval-ask-audit-store.js +272 -74
  19. package/dist/approval-ask-machine.d.ts +15 -0
  20. package/dist/approval-ask-machine.js +6 -0
  21. package/dist/approval-ask-retention.d.ts +136 -0
  22. package/dist/approval-ask-retention.js +102 -0
  23. package/dist/approval-card.d.ts +82 -20
  24. package/dist/approval-card.js +46 -16
  25. package/dist/approval-deny-reasons.d.ts +1 -1
  26. package/dist/approval.d.ts +9 -0
  27. package/dist/approval.js +24 -3
  28. package/dist/audit.d.ts +33 -19
  29. package/dist/audit.js +12 -16
  30. package/dist/auth-bridge.d.ts +4 -0
  31. package/dist/auth-bridge.js +10 -11
  32. package/dist/bake-runner/main.js +3 -2
  33. package/dist/boot/deferred-sandbox-path-env.js +1 -1
  34. package/dist/boot/deployment-mods.d.ts +31 -0
  35. package/dist/boot/deployment-mods.js +26 -0
  36. package/dist/boot/execution-env.d.ts +1 -1
  37. package/dist/boot/execution-env.js +27 -12
  38. package/dist/boot/execution-lane.js +11 -0
  39. package/dist/boot/leader.js +2 -0
  40. package/dist/boot/memory-boundary.d.ts +2 -2
  41. package/dist/boot/memory-boundary.js +2 -2
  42. package/dist/boot/memory-consolidation.d.ts +5 -4
  43. package/dist/boot/memory-consolidation.js +7 -6
  44. package/dist/boot/org-delivery.d.ts +28 -0
  45. package/dist/boot/org-delivery.js +20 -0
  46. package/dist/boot/read-deny-anchor-audit.d.ts +17 -0
  47. package/dist/boot/read-deny-anchor-audit.js +36 -0
  48. package/dist/boot/reapers.d.ts +3 -0
  49. package/dist/boot/reapers.js +21 -1
  50. package/dist/boot/resolve-spec.d.ts +4 -5
  51. package/dist/boot/resolve-spec.js +74 -123
  52. package/dist/boot/runner-deps.d.ts +19 -8
  53. package/dist/boot/runner-deps.js +15 -2
  54. package/dist/boot/session-faces.d.ts +2 -7
  55. package/dist/boot/session-faces.js +4 -2
  56. package/dist/boot/stage-02-web-admin-pull.js +4 -1
  57. package/dist/boot/stage-03-store-backend.d.ts +1 -1
  58. package/dist/boot/stage-03-store-backend.js +2 -2
  59. package/dist/boot/stage-04-stores.d.ts +1 -1
  60. package/dist/boot/stage-05-execution-env.d.ts +4 -4
  61. package/dist/boot/stage-05-execution-env.js +7 -10
  62. package/dist/boot/stage-06-runners.d.ts +4 -2
  63. package/dist/boot/stage-06-runners.js +11 -7
  64. package/dist/boot/stage-07-capability-layer.d.ts +4 -2
  65. package/dist/boot/stage-07-capability-layer.js +27 -6
  66. package/dist/boot/stage-08-reapers.d.ts +4 -2
  67. package/dist/boot/stage-08-reapers.js +2 -2
  68. package/dist/boot/stage-09-leader.d.ts +6 -9
  69. package/dist/boot/stage-10-http-server.d.ts +6 -9
  70. package/dist/boot/stage-10-http-server.js +7 -9
  71. package/dist/boot/stores.d.ts +1 -1
  72. package/dist/boot/stores.js +7 -8
  73. package/dist/boot/web-admin.d.ts +4 -3
  74. package/dist/boot/web-admin.js +186 -98
  75. package/dist/boot/workflow-orchestration.d.ts +2 -0
  76. package/dist/boot/workflow-orchestration.js +2 -1
  77. package/dist/brain.js +25 -25
  78. package/dist/breaker-key.d.ts +6 -0
  79. package/dist/breaker-key.js +29 -0
  80. package/dist/budget.js +5 -4
  81. package/dist/caller-text-echo.d.ts +23 -0
  82. package/dist/caller-text-echo.js +21 -0
  83. package/dist/capabilities/brand-identity.d.ts +26 -0
  84. package/dist/capabilities/brand-identity.js +27 -0
  85. package/dist/capabilities/center-plugins.d.ts +7 -0
  86. package/dist/capabilities/center-plugins.js +1 -1
  87. package/dist/capabilities/center-prompts.d.ts +32 -59
  88. package/dist/capabilities/center-prompts.js +18 -32
  89. package/dist/capabilities/composite-members.d.ts +1 -1
  90. package/dist/capabilities/composite-members.js +1 -1
  91. package/dist/capabilities/engine-capabilities.js +2 -1
  92. package/dist/capabilities/execution-lane.js +2 -2
  93. package/dist/capabilities/hands-lane.d.ts +30 -6
  94. package/dist/capabilities/hands-lane.js +11 -1
  95. package/dist/capabilities/mcp-probe.d.ts +48 -3
  96. package/dist/capabilities/mcp-probe.js +47 -135
  97. package/dist/capabilities/scenarios.d.ts +95 -45
  98. package/dist/capabilities/scenarios.js +53 -38
  99. package/dist/capabilities/skills.d.ts +19 -4
  100. package/dist/capabilities/skills.js +30 -10
  101. package/dist/capability-facts.d.ts +34 -4
  102. package/dist/capability-facts.js +28 -2
  103. package/dist/center-config-tier.d.ts +69 -0
  104. package/dist/center-config-tier.js +42 -0
  105. package/dist/checkpoint-identity.d.ts +16 -0
  106. package/dist/checkpoint-identity.js +19 -0
  107. package/dist/config-catalog.d.ts +17 -10
  108. package/dist/config-catalog.js +47 -32
  109. package/dist/config-d-migration.d.ts +3 -1
  110. package/dist/config-d-migration.js +2 -2
  111. package/dist/config-dir-trust.d.ts +114 -0
  112. package/dist/config-dir-trust.js +388 -0
  113. package/dist/config-invariants.d.ts +18 -5
  114. package/dist/config-invariants.js +35 -3
  115. package/dist/config-lkg.d.ts +9 -9
  116. package/dist/config-lkg.js +20 -4
  117. package/dist/config-provider.d.ts +9 -2
  118. package/dist/config-provider.js +18 -6
  119. package/dist/config-types.d.ts +75 -20
  120. package/dist/config-types.js +8 -0
  121. package/dist/config.d.ts +13 -0
  122. package/dist/config.js +137 -62
  123. package/dist/delegated-session-owner.d.ts +185 -0
  124. package/dist/delegated-session-owner.js +119 -0
  125. package/dist/device-protocol.d.ts +5 -3
  126. package/dist/device-protocol.js +1 -1
  127. package/dist/device-ws-hub.js +21 -2
  128. package/dist/device-ws-protocol.d.ts +70 -6
  129. package/dist/device-ws-protocol.js +50 -22
  130. package/dist/elicitation.js +3 -2
  131. package/dist/entry-problems.d.ts +34 -0
  132. package/dist/entry-problems.js +14 -0
  133. package/dist/env-name-allowlist-knobs.d.ts +12 -2
  134. package/dist/env-name-allowlist-knobs.js +5 -4
  135. package/dist/exec-bounds.d.ts +15 -3
  136. package/dist/exec-bounds.js +4 -0
  137. package/dist/execution-lane-caps.d.ts +56 -10
  138. package/dist/execution-lane-caps.js +50 -0
  139. package/dist/field-conflict.d.ts +43 -0
  140. package/dist/field-conflict.js +20 -0
  141. package/dist/fleet/fleet-bus.d.ts +80 -6
  142. package/dist/fleet/fleet-bus.js +41 -9
  143. package/dist/hooks/classic-stations.d.ts +91 -0
  144. package/dist/hooks/classic-stations.js +27 -0
  145. package/dist/hooks/command-spawn.d.ts +57 -0
  146. package/dist/hooks/command-spawn.js +139 -0
  147. package/dist/hooks/hook-llm.d.ts +8 -5
  148. package/dist/hooks/hook-llm.js +79 -36
  149. package/dist/hooks/hook-runner.d.ts +349 -95
  150. package/dist/hooks/hook-runner.js +855 -568
  151. package/dist/hooks/hook-source.d.ts +44 -0
  152. package/dist/hooks/hook-source.js +40 -0
  153. package/dist/http/active-run-conflict.d.ts +5 -13
  154. package/dist/http/active-run-conflict.js +17 -27
  155. package/dist/http/admission.d.ts +8 -2
  156. package/dist/http/admission.js +188 -101
  157. package/dist/http/approval-sweeps.js +99 -21
  158. package/dist/http/caller-trust.d.ts +77 -0
  159. package/dist/http/caller-trust.js +143 -0
  160. package/dist/http/checkpoint-ctx.d.ts +41 -24
  161. package/dist/http/checkpoint-ctx.js +23 -16
  162. package/dist/http/claimed-run.d.ts +14 -0
  163. package/dist/http/claimed-run.js +15 -0
  164. package/dist/http/device-placement.d.ts +2 -4
  165. package/dist/http/device-placement.js +7 -11
  166. package/dist/http/dispatch.d.ts +0 -4
  167. package/dist/http/dispatch.js +15 -13
  168. package/dist/http/durable-run-leg.d.ts +6 -33
  169. package/dist/http/durable-run-leg.js +36 -10
  170. package/dist/http/health-self-report.d.ts +7 -5
  171. package/dist/http/health-self-report.js +4 -18
  172. package/dist/http/owner-access.d.ts +56 -0
  173. package/dist/http/owner-access.js +42 -0
  174. package/dist/http/principal-gate.d.ts +70 -28
  175. package/dist/http/principal-gate.js +61 -15
  176. package/dist/http/readiness.d.ts +11 -5
  177. package/dist/http/readiness.js +10 -3
  178. package/dist/http/refusal-body.d.ts +21 -0
  179. package/dist/http/refusal-body.js +4 -0
  180. package/dist/http/request-guards.d.ts +43 -23
  181. package/dist/http/request-guards.js +53 -17
  182. package/dist/http/resume-ctx-read.d.ts +2 -5
  183. package/dist/http/resume-ctx-read.js +7 -4
  184. package/dist/http/resume-legs.d.ts +28 -4
  185. package/dist/http/resume-legs.js +169 -91
  186. package/dist/http/retired-service-deps.d.ts +43 -0
  187. package/dist/http/retired-service-deps.js +18 -0
  188. package/dist/http/route-ctx.d.ts +44 -28
  189. package/dist/http/route-ctx.js +4 -0
  190. package/dist/http/route-table.js +2 -0
  191. package/dist/http/routes/a2a-serve.js +3 -4
  192. package/dist/http/routes/admin-config-refresh.js +1 -1
  193. package/dist/http/routes/admin-drain.js +1 -1
  194. package/dist/http/routes/admin-memory-optout.js +5 -1
  195. package/dist/http/routes/adoption.js +2 -9
  196. package/dist/http/routes/approvals-assistant.js +49 -48
  197. package/dist/http/routes/background.js +3 -2
  198. package/dist/http/routes/capabilities.js +21 -5
  199. package/dist/http/routes/config-catalog.d.ts +3 -3
  200. package/dist/http/routes/config-catalog.js +1 -1
  201. package/dist/http/routes/devices.js +3 -17
  202. package/dist/http/routes/diagnostics.js +6 -2
  203. package/dist/http/routes/images.js +6 -7
  204. package/dist/http/routes/leader.js +1 -8
  205. package/dist/http/routes/mcp-reconnect.d.ts +1 -1
  206. package/dist/http/routes/mcp-reconnect.js +3 -2
  207. package/dist/http/routes/memory-bundle.js +1 -1
  208. package/dist/http/routes/memory-compliance.js +1 -1
  209. package/dist/http/routes/memory-consolidation.js +1 -1
  210. package/dist/http/routes/memory-origin.js +1 -1
  211. package/dist/http/routes/memory-policy.d.ts +1 -1
  212. package/dist/http/routes/memory-policy.js +3 -2
  213. package/dist/http/routes/notify-wake.js +8 -21
  214. package/dist/http/routes/observability.js +2 -2
  215. package/dist/http/routes/principal-inbox.d.ts +39 -0
  216. package/dist/http/routes/principal-inbox.js +76 -0
  217. package/dist/http/routes/retention-ops.js +2 -9
  218. package/dist/http/routes/rules.js +5 -18
  219. package/dist/http/routes/runs.d.ts +5 -0
  220. package/dist/http/routes/runs.js +34 -107
  221. package/dist/http/routes/session-sync.js +15 -26
  222. package/dist/http/routes/sessions.js +30 -40
  223. package/dist/http/routes/shared-memory.js +2 -13
  224. package/dist/http/routes/side-query.js +8 -7
  225. package/dist/http/routes/tasks.js +67 -21
  226. package/dist/http/routes/workflows.d.ts +351 -0
  227. package/dist/http/routes/workflows.js +153 -119
  228. package/dist/http/send.d.ts +33 -10
  229. package/dist/http/send.js +21 -4
  230. package/dist/http/server.d.ts +27 -18
  231. package/dist/http/server.js +34 -6
  232. package/dist/http/stored-body-replay.js +17 -4
  233. package/dist/http/submit-ctx.d.ts +25 -0
  234. package/dist/http/submit-ctx.js +40 -0
  235. package/dist/http/submit-replay.d.ts +4 -3
  236. package/dist/http/submit-replay.js +5 -4
  237. package/dist/http/wire-types.d.ts +11 -8
  238. package/dist/index.d.ts +2 -2
  239. package/dist/index.js +1 -2
  240. package/dist/lane-home-probe.d.ts +112 -0
  241. package/dist/lane-home-probe.js +101 -0
  242. package/dist/leader/endpoint.d.ts +4 -1
  243. package/dist/leader/endpoint.js +11 -10
  244. package/dist/limit-refusal.d.ts +59 -0
  245. package/dist/limit-refusal.js +15 -0
  246. package/dist/main.js +1 -1
  247. package/dist/mcp-assertion-header.d.ts +32 -19
  248. package/dist/mcp-assertion-header.js +10 -9
  249. package/dist/mcp-tool-faces.d.ts +5 -0
  250. package/dist/mcp-tool-faces.js +6 -4
  251. package/dist/memory-project-layer.d.ts +37 -0
  252. package/dist/memory-project-layer.js +46 -0
  253. package/dist/memory-scope.d.ts +24 -17
  254. package/dist/memory-scope.js +24 -8
  255. package/dist/memory-sync-client.d.ts +27 -13
  256. package/dist/memory-sync-client.js +107 -18
  257. package/dist/model-entry-refusal.d.ts +9 -1
  258. package/dist/model-entry-refusal.js +6 -1
  259. package/dist/model-plane-face.d.ts +51 -0
  260. package/dist/model-plane-face.js +24 -0
  261. package/dist/model-provider.d.ts +44 -12
  262. package/dist/model-provider.js +21 -2
  263. package/dist/model-route-endpoint.d.ts +9 -12
  264. package/dist/model-route-endpoint.js +8 -11
  265. package/dist/model-route-env.d.ts +22 -0
  266. package/dist/model-route-env.js +2 -0
  267. package/dist/model-route-gap.d.ts +60 -30
  268. package/dist/model-route-gap.js +21 -15
  269. package/dist/observability/corrupt-read-seat.d.ts +7 -0
  270. package/dist/observability/corrupt-read-seat.js +9 -0
  271. package/dist/observability/cost-taxonomy.d.ts +7 -7
  272. package/dist/observability/err-text.d.ts +6 -0
  273. package/dist/observability/err-text.js +18 -4
  274. package/dist/observability/fail-open.d.ts +76 -14
  275. package/dist/observability/fail-open.js +76 -14
  276. package/dist/observability/metrics.js +4 -1
  277. package/dist/observability/prompt-manifest.d.ts +33 -82
  278. package/dist/observability/prompt-manifest.js +122 -17
  279. package/dist/observability/run-terminal.js +14 -6
  280. package/dist/observability/secret-env-scrub.d.ts +13 -1
  281. package/dist/observability/secret-env-scrub.js +13 -1
  282. package/dist/observability/tool-trace.d.ts +16 -21
  283. package/dist/observability/tool-trace.js +58 -49
  284. package/dist/operator-ask.d.ts +10 -0
  285. package/dist/operator-ask.js +3 -0
  286. package/dist/orchestration/workflow-agent-session-index.d.ts +12 -12
  287. package/dist/orchestration/workflow-agent-session-index.js +9 -13
  288. package/dist/orchestration/workflow-completion-inbox.d.ts +42 -15
  289. package/dist/orchestration/workflow-completion-inbox.js +13 -0
  290. package/dist/orchestration/workflow-notify-journal.d.ts +13 -32
  291. package/dist/orchestration/workflow-notify-journal.js +27 -34
  292. package/dist/orchestration/workflow-park-decision.d.ts +89 -0
  293. package/dist/orchestration/workflow-park-decision.js +118 -0
  294. package/dist/org-delivery-gate.d.ts +81 -0
  295. package/dist/org-delivery-gate.js +59 -0
  296. package/dist/panel-tool-names.d.ts +23 -0
  297. package/dist/panel-tool-names.js +8 -0
  298. package/dist/parked-decide.d.ts +39 -6
  299. package/dist/parked-decide.js +98 -51
  300. package/dist/parked-revive-surface.d.ts +9 -2
  301. package/dist/parked-revive-surface.js +11 -8
  302. package/dist/per-task-image.d.ts +7 -1
  303. package/dist/per-task-image.js +3 -3
  304. package/dist/permission-rule-list.d.ts +1 -1
  305. package/dist/permission-rule-list.js +2 -2
  306. package/dist/plain-string-record.d.ts +25 -0
  307. package/dist/plain-string-record.js +32 -0
  308. package/dist/plugins/approval-ask-store-file.d.ts +16 -1
  309. package/dist/plugins/approval-ask-store-file.js +21 -0
  310. package/dist/plugins/approval-ask-store-memory.d.ts +18 -1
  311. package/dist/plugins/approval-ask-store-memory.js +34 -2
  312. package/dist/plugins/approval-ask-store-sql.d.ts +25 -0
  313. package/dist/plugins/approval-ask-store-sql.js +37 -1
  314. package/dist/plugins/blob-backend.d.ts +83 -15
  315. package/dist/plugins/blob-backend.js +68 -15
  316. package/dist/plugins/breaker-state-sql.d.ts +2 -2
  317. package/dist/plugins/breaker-state-sql.js +4 -4
  318. package/dist/plugins/caching-session-store.d.ts +3 -0
  319. package/dist/plugins/caching-session-store.js +3 -0
  320. package/dist/plugins/checkpoint-store-sql.d.ts +28 -4
  321. package/dist/plugins/checkpoint-store-sql.js +59 -28
  322. package/dist/plugins/file-history-store-sql.d.ts +5 -2
  323. package/dist/plugins/file-history-store-sql.js +3 -1
  324. package/dist/plugins/file-run-store.d.ts +5 -13
  325. package/dist/plugins/file-run-store.js +9 -0
  326. package/dist/plugins/fork-routing-session-store.d.ts +9 -1
  327. package/dist/plugins/fork-routing-session-store.js +12 -1
  328. package/dist/plugins/host-platform.d.ts +2 -0
  329. package/dist/plugins/host-platform.js +2 -1
  330. package/dist/plugins/k8s-bg-scripts.d.ts +11 -0
  331. package/dist/plugins/k8s-bg-scripts.js +22 -0
  332. package/dist/plugins/local-checkpoint-store.d.ts +2 -0
  333. package/dist/plugins/local-checkpoint-store.js +11 -3
  334. package/dist/plugins/local-session-store.d.ts +1 -1
  335. package/dist/plugins/local-session-store.js +1 -1
  336. package/dist/plugins/local-session-window.d.ts +39 -0
  337. package/dist/plugins/local-session-window.js +54 -0
  338. package/dist/plugins/mailbox-recipient-lifecycle.d.ts +3 -2
  339. package/dist/plugins/mailbox-store-sql.d.ts +30 -48
  340. package/dist/plugins/mailbox-store-sql.js +77 -52
  341. package/dist/plugins/memory-embedder-fingerprint.js +2 -1
  342. package/dist/plugins/memory-run-store.d.ts +5 -13
  343. package/dist/plugins/memory-run-store.js +8 -0
  344. package/dist/plugins/one-time-migrations.d.ts +245 -93
  345. package/dist/plugins/one-time-migrations.js +668 -207
  346. package/dist/plugins/org-delivery-quota-store.d.ts +123 -0
  347. package/dist/plugins/org-delivery-quota-store.js +228 -0
  348. package/dist/plugins/permission-rule-store-sql.d.ts +13 -7
  349. package/dist/plugins/permission-rule-store-sql.js +4 -18
  350. package/dist/plugins/pg-pool.js +39 -7
  351. package/dist/plugins/pg-session-storage.d.ts +20 -8
  352. package/dist/plugins/pg-session-storage.js +34 -21
  353. package/dist/plugins/remote-env-adb.d.ts +12 -12
  354. package/dist/plugins/remote-env-adb.js +21 -6
  355. package/dist/plugins/remote-env-device.js +3 -0
  356. package/dist/plugins/remote-env-e2b.d.ts +1 -1
  357. package/dist/plugins/remote-env-e2b.js +21 -9
  358. package/dist/plugins/remote-env-host.d.ts +9 -9
  359. package/dist/plugins/remote-env-host.js +10 -32
  360. package/dist/plugins/remote-env-k8s.d.ts +103 -38
  361. package/dist/plugins/remote-env-k8s.js +288 -95
  362. package/dist/plugins/remote-env-local-docker.d.ts +27 -13
  363. package/dist/plugins/remote-env-local-docker.js +82 -11
  364. package/dist/plugins/remote-env-ssh.d.ts +21 -12
  365. package/dist/plugins/remote-env-ssh.js +117 -5
  366. package/dist/plugins/remote-shell.d.ts +0 -1
  367. package/dist/plugins/remote-shell.js +1 -2
  368. package/dist/plugins/retention-store-sql.js +6 -2
  369. package/dist/plugins/run-store-sql.d.ts +16 -14
  370. package/dist/plugins/run-store-sql.js +22 -2
  371. package/dist/plugins/schema-consistency.d.ts +54 -0
  372. package/dist/plugins/schema-consistency.js +52 -0
  373. package/dist/plugins/schema-indexes.js +2 -0
  374. package/dist/plugins/send-user-file.js +2 -2
  375. package/dist/plugins/session-epoch-anchor.d.ts +39 -0
  376. package/dist/plugins/session-epoch-anchor.js +22 -0
  377. package/dist/plugins/session-store.d.ts +18 -8
  378. package/dist/plugins/session-store.js +15 -4
  379. package/dist/plugins/shared-memory-store-sql.d.ts +9 -3
  380. package/dist/plugins/shared-memory-store-sql.js +5 -16
  381. package/dist/plugins/sql-driver.d.ts +205 -1
  382. package/dist/plugins/sql-driver.js +325 -13
  383. package/dist/plugins/sql-errors.d.ts +64 -0
  384. package/dist/plugins/sql-errors.js +57 -0
  385. package/dist/plugins/store-backend.d.ts +36 -1
  386. package/dist/plugins/store-backend.js +42 -15
  387. package/dist/plugins/store-contracts.d.ts +42 -0
  388. package/dist/plugins/store-contracts.js +1 -0
  389. package/dist/plugins/tidb-pool.d.ts +6 -1
  390. package/dist/plugins/tidb-pool.js +44 -10
  391. package/dist/plugins/tidb-session-storage.d.ts +8 -11
  392. package/dist/plugins/tidb-session-storage.js +6 -16
  393. package/dist/plugins/tidb-session-store.d.ts +24 -4
  394. package/dist/plugins/tidb-session-store.js +29 -5
  395. package/dist/plugins/workflow-journal-store-sql.d.ts +73 -19
  396. package/dist/plugins/workflow-journal-store-sql.js +19 -6
  397. package/dist/plugins/workflow-run-store-sql.d.ts +30 -8
  398. package/dist/plugins/workflow-run-store-sql.js +50 -9
  399. package/dist/posture-source.d.ts +18 -10
  400. package/dist/posture-source.js +4 -1
  401. package/dist/project-identity.d.ts +45 -6
  402. package/dist/project-identity.js +162 -8
  403. package/dist/project-layer-key.d.ts +28 -0
  404. package/dist/project-layer-key.js +29 -0
  405. package/dist/prompts-domain-validate.d.ts +17 -61
  406. package/dist/prompts-domain-validate.js +9 -119
  407. package/dist/question.js +3 -2
  408. package/dist/read-deny-entry.d.ts +25 -0
  409. package/dist/read-deny-entry.js +12 -0
  410. package/dist/read-face-posture.d.ts +37 -11
  411. package/dist/read-face-posture.js +32 -3
  412. package/dist/request-key-closure.d.ts +9 -2
  413. package/dist/request-key-closure.js +11 -5
  414. package/dist/request-value-closure.d.ts +5 -0
  415. package/dist/request-value-closure.js +11 -3
  416. package/dist/rule-entry-list.d.ts +38 -11
  417. package/dist/rule-entry-list.js +106 -30
  418. package/dist/rules-consent.js +3 -4
  419. package/dist/run-acceptance.d.ts +19 -3
  420. package/dist/run-acceptance.js +13 -1
  421. package/dist/run-local.js +54 -24
  422. package/dist/runs.d.ts +15 -8
  423. package/dist/runs.js +35 -1
  424. package/dist/runtime-caps-resolver.d.ts +16 -6
  425. package/dist/runtime-caps-resolver.js +18 -5
  426. package/dist/sandbox-pkg-source.d.ts +19 -1
  427. package/dist/sandbox-pkg-source.js +29 -7
  428. package/dist/security.d.ts +87 -9
  429. package/dist/security.js +52 -9
  430. package/dist/server-secret-env.d.ts +44 -18
  431. package/dist/server-secret-env.js +49 -8
  432. package/dist/session-error-wire.d.ts +19 -2
  433. package/dist/session-error-wire.js +5 -1
  434. package/dist/session-incarnation.d.ts +15 -5
  435. package/dist/session-incarnation.js +16 -9
  436. package/dist/session-titled-frame.d.ts +33 -0
  437. package/dist/session-titled-frame.js +4 -0
  438. package/dist/session-titler.d.ts +9 -1
  439. package/dist/session-titler.js +27 -6
  440. package/dist/spec-fields.d.ts +28 -16
  441. package/dist/spec-fields.js +66 -54
  442. package/dist/sql-engine-posture.d.ts +31 -4
  443. package/dist/sql-engine-posture.js +36 -1
  444. package/dist/stored-request-tool-axes-m19.d.ts +19 -4
  445. package/dist/stored-request-tool-axes-m19.js +30 -2
  446. package/dist/task-a2a.d.ts +9 -1
  447. package/dist/task-a2a.js +73 -47
  448. package/dist/task-cwd.d.ts +1 -1
  449. package/dist/task-mcp.d.ts +46 -58
  450. package/dist/task-mcp.js +82 -107
  451. package/dist/task-settings.d.ts +95 -108
  452. package/dist/task-settings.js +77 -98
  453. package/dist/text-bidi.d.ts +1 -48
  454. package/dist/text-bidi.js +3 -5
  455. package/dist/tighten-only-seats.d.ts +150 -0
  456. package/dist/tighten-only-seats.js +196 -0
  457. package/dist/tool-approval.d.ts +304 -88
  458. package/dist/tool-approval.js +623 -239
  459. package/dist/trace/core-keyset-guard.d.ts +122 -20
  460. package/dist/trace/engine-notice-wire.d.ts +11 -3
  461. package/dist/trace/engine-notice-wire.js +8 -1
  462. package/dist/trace/exit-seat.d.ts +28 -0
  463. package/dist/trace/exit-seat.js +76 -0
  464. package/dist/trace/ledger-events.d.ts +6 -3
  465. package/dist/trace/ledger-sink.js +4 -1
  466. package/dist/trace/model-segment.js +1 -1
  467. package/dist/trace/project.d.ts +98 -17
  468. package/dist/trace/project.js +98 -50
  469. package/dist/trace/projection-table.d.ts +100 -0
  470. package/dist/trace/projection-table.js +130 -0
  471. package/dist/trace/redact.d.ts +54 -0
  472. package/dist/trace/redact.js +778 -152
  473. package/dist/trace/self-minted-wire.d.ts +345 -1
  474. package/dist/trace/self-minted-wire.js +117 -1
  475. package/dist/trace/wire-projection-faces.d.ts +377 -3
  476. package/dist/trace/wire-projection-faces.js +164 -1
  477. package/dist/url-refusal.js +2 -0
  478. package/dist/web-admin-client/apply-effective.d.ts +12 -0
  479. package/dist/web-admin-client/apply-effective.js +56 -5
  480. package/dist/web-admin-client/candidate-gate.d.ts +6 -6
  481. package/dist/web-admin-client/candidate-gate.js +3 -3
  482. package/dist/web-admin-client/facade.d.ts +1 -1
  483. package/dist/web-admin-client/facade.js +1 -1
  484. package/dist/web-admin-client/http-client.js +0 -6
  485. package/dist/web-admin-client/read-face.js +5 -9
  486. package/dist/web-admin-client/read-warnings.d.ts +13 -0
  487. package/dist/web-admin-client/read-warnings.js +10 -0
  488. package/dist/web-admin-client/skills-mcp.d.ts +3 -0
  489. package/dist/web-admin-client/skills-mcp.js +11 -9
  490. package/dist/web-admin-client/types.d.ts +2 -3
  491. package/dist/workspace-cache.d.ts +35 -0
  492. package/dist/workspace-cache.js +36 -0
  493. package/dist/workspace-space.d.ts +3 -2
  494. package/dist/workspace-space.js +2 -0
  495. package/docs/DEVICE-EXECUTOR-PROTOCOL.md +65 -10
  496. package/package.json +8 -4
  497. package/scripts/drain-check-local.mjs +34 -1
  498. package/scripts/drain-check.mysql.sql +30 -2
  499. package/scripts/drain-check.pg.sql +29 -2
  500. package/dist/capabilities/memory-notice.d.ts +0 -138
  501. package/dist/capabilities/memory-notice.js +0 -64
  502. package/dist/capabilities/prompt.d.ts +0 -17
  503. package/dist/capabilities/prompt.js +0 -6
  504. package/dist/mcp-content-origin.d.ts +0 -34
  505. package/dist/mcp-content-origin.js +0 -10
  506. package/dist/tool-axis-words.d.ts +0 -27
  507. package/dist/tool-axis-words.js +0 -9
  508. package/dist/wire-name-bound.d.ts +0 -14
  509. package/dist/wire-name-bound.js +0 -13
@@ -34,6 +34,6 @@ export declare function openStores(ctx: OpenStoresCtx): Promise<{
34
34
  usageWindowStore: import("@sema-agent/core").UsageWindowStore | undefined;
35
35
  memoryPosture: import("../memory-posture.js").MemoryPosture;
36
36
  taskListLane: import("./task-list-lane.js").TaskListLane;
37
- sqlEngineFacts: (() => import("../plugins/sql-driver.js").SqlEngineFacts | null) | undefined;
37
+ sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
38
38
  }>;
39
39
  //# sourceMappingURL=stores.d.ts.map
@@ -37,7 +37,7 @@ import { assertFileHistorySchema } from "../plugins/file-history-store-sql.js";
37
37
  import { resolveStreamApprovalGate } from "../tool-approval.js";
38
38
  import { buildMemoryBoundaryLaneFacts, buildMemoryWriteBoundaryAudit, effectiveMemoryPersistenceCapable } from "./memory-boundary.js";
39
39
  import { buildMemoryPosture } from "../memory-posture.js";
40
- import { establishSqlEnginePosture } from "../sql-engine-posture.js";
40
+ import { establishSqlEnginePosture, sqlPoolsOf } from "../sql-engine-posture.js";
41
41
  import { buildStorePosture } from "../store-posture.js";
42
42
  import { buildDisplaySafeUrl } from "../trace/redact.js";
43
43
  const DARK_REASON_PROSE = {
@@ -377,7 +377,7 @@ export async function openStores(ctx) {
377
377
  ...(config.memorySync.maxPushEntries !== undefined ? { maxPushEntries: config.memorySync.maxPushEntries } : {}),
378
378
  ...(config.memorySync.maxPullEntries !== undefined ? { maxPullEntries: config.memorySync.maxPullEntries } : {}),
379
379
  });
380
- logger.info("memory_sync_enabled", { url: buildDisplaySafeUrl(config.memorySync.url), scope: config.memorySync.scope, cursorPath: memorySyncRunner.cursorPath });
380
+ logger.info("memory_sync_enabled", { url: buildDisplaySafeUrl(config.memorySync.url), scope: config.memorySync.scope, cursorPath: memorySyncRunner.cursorPathFor(config.memorySync.scope) });
381
381
  memorySyncRunner.trigger("boot");
382
382
  }
383
383
  else {
@@ -393,11 +393,10 @@ export async function openStores(ctx) {
393
393
  await ensureTiDBTaskListSchema(mysqlPool);
394
394
  return createTaskListLane({ mysqlPool, pgPool, logger });
395
395
  })();
396
- let sqlEngineFacts;
396
+ let sqlEngine;
397
397
  {
398
- const mysqlPool = backend?.mysqlPool?.();
399
- const pgPool = backend?.pgPool?.();
400
- sqlEngineFacts = await establishSqlEnginePosture({ mysqlPool, pgPool });
398
+ const { mysqlPool, pgPool } = sqlPoolsOf(backend);
399
+ sqlEngine = await establishSqlEnginePosture({ mysqlPool, pgPool });
401
400
  if (pgPool)
402
401
  await ensurePgDeviceSchema(async (text, params) => pgPool.query(text, params));
403
402
  if (mysqlPool)
@@ -437,7 +436,7 @@ export async function openStores(ctx) {
437
436
  const breakerState = backend?.breaker && config.resilience.circuitBreaker
438
437
  ? backend
439
438
  .breaker((streak) => {
440
- metrics.setGauge("counter_flush_fail_streak", streak, { table: "circuit_breaker", kind: "write_through" });
439
+ metrics.setGauge("counter_flush_fail_streak", streak, { table: "breaker_state", kind: "write_through" });
441
440
  if (streak > 0)
442
441
  metrics.inc("breaker_writethrough_failed_total", { backend: backend.kind });
443
442
  if (streak === 3)
@@ -450,7 +449,7 @@ export async function openStores(ctx) {
450
449
  return {
451
450
  backend, storePosture, memoryEngine, engineDataRoot, memorySyncCursors, rosterStore, backgroundAgentStore, mailboxRecipientLifecycle,
452
451
  taskAttachmentStore, mailboxStore, memoryExportBackend, memorySyncRunner, sessionStore, breakerState,
453
- usageWindowStore, memoryPosture, taskListLane, sqlEngineFacts,
452
+ usageWindowStore, memoryPosture, taskListLane, sqlEngine,
454
453
  };
455
454
  }
456
455
  //# sourceMappingURL=stores.js.map
@@ -1,10 +1,10 @@
1
1
  import { type ModelRefusalsSignal } from "@sema-agent/settings-schema";
2
2
  import { CenterPromptSource, type SwappableDeps } from "@sema-agent/core";
3
3
  import { buildPricing } from "../budget.js";
4
- import { type PromptsDomainFaces } from "../prompts-domain-validate.js";
5
4
  import { type Scenario, type ScenarioDeps, type ScenarioDetail } from "../capabilities/scenarios.js";
6
5
  import type { LoadedSkill } from "../capabilities/skills.js";
7
6
  import { type ServiceConfig } from "../config.js";
7
+ import { type CenterIdentityNotice } from "../center-config-tier.js";
8
8
  import { type CenterCredentialHealthView } from "../center-credential-renewer.js";
9
9
  import { type ModelKeyRef } from "../key-resolver.js";
10
10
  import type { Logger } from "../observability/logger.js";
@@ -84,6 +84,9 @@ export interface WebAdminRuntime {
84
84
  stopRefreshLoop(): void;
85
85
  /** S-698:`/health.centerCredential` 的取值口 —— 凭证来源的健康态 + 续签器状态;都健康 / 没有中心 ⇒ `undefined`(键缺席)。 */
86
86
  centerCredentialState(): CenterCredentialHealthView | undefined;
87
+ /** S-667:`/health.centerIdentityNotice` 的取值口 —— 中心凭证换人后的**最近一条**通告(`center_identity_demoted` 已降到无中心配置档 / `center_identity_landed`
88
+ * 新身份的配置已换上;码、冻结句与状态机见 `center-config-tier.ts`)。从未换过人 / 没有中心 ⇒ `undefined`(键缺席)。值形就是 wire 形 `{ code, message, at }`。 */
89
+ centerIdentityNoticeState(): CenterIdentityNotice | undefined;
87
90
  /** [ref](core 5.50 [ref]):mid-turn MCP 撤销台账读口,喂 `RunnerDeps.mcpRevocations` 席。
88
91
  * **取走即声明接线**——调用本方法后,restart 信号的 mcp 片对纯删除向豁免(台账即时承接);
89
92
  * 不取 ⇒ 旧 restart 语义逐字保留(fail-closed)。 */
@@ -96,8 +99,6 @@ export interface WebAdminRuntime {
96
99
  getKeyResolver(): ((model: ModelKeyRef) => Promise<{
97
100
  apiKey: string;
98
101
  } | undefined>) | undefined;
99
- /** 晚绑取值:center 提示词面(热采用,新任务边界生效)。 */
100
- getCenterPrompts(): PromptsDomainFaces | undefined;
101
102
  /** boot ready 门:布防(`CONFIG_REQUIRE_ROSTER=true`,远程 registry 非 dryRun)且 roster 未落地 =
102
103
  * 计费提交 503 + /health ready:false。缺省未布防 ⇒ 恒 true。 */
103
104
  modelReady(): boolean;
@@ -8,25 +8,28 @@ 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
10
  import { applyCenterPlugins } from "../capabilities/center-plugins.js";
11
- import { applyCatalogToSource, withPromptArtifactBackfill } from "../capabilities/center-prompts.js";
12
- import { CORE_ENGINE_VERSION } from "../prompts-domain-validate.js";
11
+ import { applyCenterArtifact, centerSourceOnError, withPromptArtifactBackfill } from "../capabilities/center-prompts.js";
13
12
  import { centerScenarios, centerScenarioDetails } from "../capabilities/scenarios.js";
14
13
  import { isRosterGateArmed } from "../config.js";
14
+ import { toolsRunOnThisHost } from "../task-cwd.js";
15
15
  import { defaultLkgPath, defaultSkillCacheDir, saveLkg, loadLkg, legacyV1LkgPath, migrateV1Lkg } from "../config-lkg.js";
16
16
  import { answerStillCurrent, centerStateBin, credentialIdentityNow, judgeCenterCredentialAtBoot } from "../center-credential.js";
17
+ import { createCenterConfigTier } from "../center-config-tier.js";
17
18
  import { buildCenterCredentialHealthView, createCenterCredentialRenewer } from "../center-credential-renewer.js";
18
19
  import { centerManagedConfigKeys } from "../web-admin-client/apply-effective.js";
19
20
  import { createConfigProvider, raceBootFetch, serviceConfigSourceKind, BOOT_FETCH_DEFERRED } from "../config-provider.js";
21
+ import { ConfigDirUntrustedError } from "../config-dir-trust.js";
20
22
  import { createKeyResolver } from "../key-resolver.js";
21
23
  import { buildSealedKeyPublicFace, ensureSealedKeyStore, reportExecutionPublicKey } from "../sealed-key.js";
22
- import { applyEffective, applyCenterReadFace, buildReadFaceBaseline, buildReadFaceSwapCandidate, restoreReadFaceBaseline, mutateInPlace, logEffectiveDiff, applySkillsManifest, resolveMcpServers, resolveA2aPeers, restartReasons, modelPlaneChanged, withModelPlaneOf, fullyLandedForLkg, fetchPromptArtifact } from "../web-admin-client/facade.js";
24
+ import { applyEffective, applyCenterReadFace, buildReadFaceBaseline, buildReadFaceSwapCandidate, restoreReadFaceBaseline, mutateInPlace, logEffectiveDiff, applySkillsManifest, resolveMcpServers, resolveA2aPeers, restartReasons, modelPlaneChanged, withModelPlaneOf, fullyLandedForLkg, NO_CENTER_EFFECTIVE, isNoCenterEffective, fetchPromptArtifact } from "../web-admin-client/facade.js";
23
25
  import { buildConfigHandoff, buildRestartSignal, configHandoffMissing } from "../fleet/engine-signal.js";
24
26
  import { createMcpRevocationLedger, enabledMcpEntries } from "../web-admin-client/mcp-revocation.js";
25
- import { buildUnreadConfigFileFields } from "../web-admin-client/read-warnings.js";
27
+ import { buildUnreadConfigFileFields, buildUnreadConfigKeyFields } from "../web-admin-client/read-warnings.js";
26
28
  import { CONFIG_DOMAIN_INVALID_NOTE, buildCandidateRejectedFields, candidateRejectionOf, judgeConfigCandidate } from "../web-admin-client/candidate-gate.js";
27
29
  import { SHA256_HEX_RE } from "../digest-form.js";
28
30
  import { BOOT_REJUDGE_OF_REFUSED_GROUP, createConfigApplyLedger, modelPlaneCommitted, refusedGroups } from "../web-admin-client/apply-ledger.js";
29
- import { buildDeploymentPostureSeats } from "./runner-deps.js";
31
+ import { announceReadDenyRows, buildDeploymentPostureSeats } from "./runner-deps.js";
32
+ import { echoCallerText } from "../caller-text-echo.js";
30
33
  function lkgReadNote(scope) {
31
34
  switch (scope) {
32
35
  case "whole":
@@ -87,6 +90,21 @@ export async function createWebAdminRuntime(ctx) {
87
90
  ? createCenterCredentialRenewer({ source: cc.credential, centerUrl: cc.baseUrl, leadMs: config.centerCredentialRenewLeadMs, logger })
88
91
  : undefined;
89
92
  const currentIdentity = () => (cc === undefined ? undefined : credentialIdentityNow(cc.credential));
93
+ const tier = createCenterConfigTier();
94
+ const announceTier = (n) => {
95
+ switch (n.code) {
96
+ case "center_identity_demoted":
97
+ logger.warn(n.code, { at: n.at, message: n.message, ...(n.retained !== undefined ? { retained: n.retained } : {}), note: "the credential identity changed: the previous account's center configuration is dropped (every center-supplied hot face is back on its env base, the center prompt layer is withdrawn, the Runners run the env model table) and a pull for the new identity is under way; skills / MCP / A2A / scenarios are baked at boot and stay the previous account's until a restart (see /health.restart)" });
98
+ return;
99
+ case "center_identity_landed":
100
+ logger.info(n.code, { at: n.at, message: n.message });
101
+ return;
102
+ default: {
103
+ const unknownCode = n.code;
104
+ throw new Error(`announceTier: unknown notice code ${JSON.stringify(unknownCode)}`);
105
+ }
106
+ }
107
+ };
90
108
  const candidateIdentity = new WeakMap();
91
109
  const candidateIdentityOf = (eff) => candidateIdentity.get(eff);
92
110
  const validatorIdentity = new Map();
@@ -134,6 +152,7 @@ export async function createWebAdminRuntime(ctx) {
134
152
  ...(config.configProvider ? { provider: config.configProvider } : {}),
135
153
  ...(cc ? { webAdmin: { baseUrl: cc.baseUrl, credential: cc.credential, worker: cc.worker, dryRun: cc.dryRun } } : {}),
136
154
  localDir: localRoot,
155
+ localOwnerUid: config.configLocalOwnerUid,
137
156
  ...(config.configLkgEnabled ? { skillBodyCacheDir: defaultSkillCacheDir(config) } : {}),
138
157
  })
139
158
  : undefined;
@@ -143,6 +162,8 @@ export async function createWebAdminRuntime(ctx) {
143
162
  const warnReadNotices = (r, phase) => {
144
163
  for (const f of r.unreadFiles ?? [])
145
164
  logger.warn("config_unread_file", buildUnreadConfigFileFields(f, localDirField.dir));
165
+ for (const k of r.unreadKeys ?? [])
166
+ logger.warn("config_unread_key", buildUnreadConfigKeyFields(k, localDirField.dir));
146
167
  for (const d of r.droppedEntries ?? []) {
147
168
  logger.warn("config_entry_dropped", {
148
169
  domain: d.domain,
@@ -202,15 +223,15 @@ export async function createWebAdminRuntime(ctx) {
202
223
  applyLedger.recordApply(rep);
203
224
  publishModelRefusals(buildModelRefusalsSignal(rep.modelRefusals));
204
225
  };
205
- let centerPrompts;
206
- let pendingCatalogFaces;
226
+ let adoptedArtifact;
227
+ let pendingCenterTarget;
207
228
  const retryPendingCatalog = async (phase) => {
208
- if (!pendingCatalogFaces)
229
+ if (!pendingCenterTarget)
209
230
  return;
210
- const { target } = pendingCatalogFaces;
211
- if (await applyCatalogToSource(catalogSource, target, centerPrompts, logger, phase)) {
212
- centerPrompts = target;
213
- pendingCatalogFaces = undefined;
231
+ const { target } = pendingCenterTarget;
232
+ if (await applyCenterArtifact(catalogSource, target, adoptedArtifact, logger, phase)) {
233
+ adoptedArtifact = target;
234
+ pendingCenterTarget = undefined;
214
235
  }
215
236
  };
216
237
  const promptEpochDir = join(config.localDataRoot ?? localRoot, "prompt-epoch");
@@ -253,6 +274,7 @@ export async function createWebAdminRuntime(ctx) {
253
274
  },
254
275
  });
255
276
  const withByDigestBackfill = (inner) => cc?.baseUrl ? withPromptArtifactBackfill(inner, (d) => fetchPromptArtifact(cc, d), logger) : inner;
277
+ const sourceOnError = centerSourceOnError(logger);
256
278
  const promptSource = (() => {
257
279
  try {
258
280
  const bootBin = promptStateBin();
@@ -261,15 +283,15 @@ export async function createWebAdminRuntime(ctx) {
261
283
  return new CenterPromptSource({
262
284
  store: withByDigestBackfill(new FilePromptArtifactStore(promptEpochDir)),
263
285
  stateStore: recordingStateStore(binnedPromptStateStore(fileStateStoreFor)),
264
- engineVersion: CORE_ENGINE_VERSION,
286
+ onError: sourceOnError,
265
287
  });
266
288
  }
267
289
  catch (e) {
268
- logger.warn("center_prompts_store_unwritable", { dir: promptEpochDir, err: String(e), note: "file-backed prompt-epoch store unavailable — memory fallback (catalog candidate not restart-durable); built-ins/declaration axis unaffected" });
290
+ logger.warn("center_prompts_store_unwritable", { dir: promptEpochDir, err: String(e), note: "file-backed prompt-epoch store unavailable — memory fallback (the center candidate is not restart-durable); built-ins unaffected" });
269
291
  return new CenterPromptSource({
270
292
  store: withByDigestBackfill(new MemoryPromptArtifactStore()),
271
293
  stateStore: recordingStateStore(binnedPromptStateStore(storePerBin(() => new MemoryPromptSourceStateStore()))),
272
- engineVersion: CORE_ENGINE_VERSION,
294
+ onError: sourceOnError,
273
295
  });
274
296
  }
275
297
  })();
@@ -281,14 +303,14 @@ export async function createWebAdminRuntime(ctx) {
281
303
  };
282
304
  const rebasePromptState = async (identity, phase) => {
283
305
  promptStateIdentity = identity;
284
- centerPrompts = undefined;
285
- pendingCatalogFaces = undefined;
306
+ adoptedArtifact = undefined;
307
+ pendingCenterTarget = undefined;
286
308
  promptPersisted = undefined;
287
309
  try {
288
310
  await promptSource.restore();
289
311
  }
290
312
  catch (e) {
291
- logger.warn("center_prompts_catalog_restore_failed", { phase, err: String(e), note: "the persisted catalog state for this credential identity could not be loaded — catalog candidate absent until the next adopt; declaration axis and built-ins unaffected" });
313
+ logger.warn("center_prompts_catalog_restore_failed", { phase, err: String(e), note: "the persisted center-layer state for this credential identity could not be loaded — the center candidate is absent until the next adopt; built-ins unaffected" });
292
314
  }
293
315
  if (cc !== undefined && identity !== undefined && currentIdentity() !== identity) {
294
316
  promptStateIdentity = undefined;
@@ -299,41 +321,42 @@ export async function createWebAdminRuntime(ctx) {
299
321
  if (configProvider && !cc?.dryRun)
300
322
  await rebasePromptState(promptStateIdentity, "boot");
301
323
  const adoptCenterPrompts = async (eff, prompts, phase) => {
324
+ if (isNoCenterEffective(eff)) {
325
+ await rebasePromptState(undefined, phase);
326
+ return;
327
+ }
302
328
  const adoptedIdentity = candidateIdentityOf(eff);
303
329
  if (adoptedIdentity !== undefined && adoptedIdentity !== promptStateIdentity) {
304
330
  await rebasePromptState(adoptedIdentity, phase);
305
331
  }
306
332
  if (prompts === undefined) {
307
- if (centerPrompts)
308
- logger.info("center_prompts_cleared", { phase, note: "effective carries no prompts key (publish gate off) — built-in providers resume" });
309
- const cleared = await applyCatalogToSource(catalogSource, undefined, centerPrompts, logger, phase);
333
+ if (adoptedArtifact)
334
+ logger.info("center_prompts_cleared", { phase, note: "effective carries no prompts key (publish gate off / nothing published) — the built-in prompt serves new tasks" });
335
+ const cleared = await applyCenterArtifact(catalogSource, undefined, adoptedArtifact, logger, phase);
310
336
  if (cleared) {
311
- centerPrompts = undefined;
312
- pendingCatalogFaces = undefined;
337
+ adoptedArtifact = undefined;
338
+ pendingCenterTarget = undefined;
313
339
  }
314
340
  else {
315
- pendingCatalogFaces = { target: undefined };
341
+ pendingCenterTarget = { target: undefined };
316
342
  }
317
343
  return;
318
344
  }
319
- if (centerPrompts?.identity !== prompts.identity) {
345
+ if (adoptedArtifact?.artifactDigest !== prompts.artifactDigest) {
320
346
  logger.info("center_prompts_adopted", {
321
347
  phase,
322
- axes: prompts.axes,
323
- ...(prompts.declarations
324
- ? { packId: prompts.declarations.packId, contentDigest: prompts.declarations.contentDigest, sections: prompts.declarations.sections.length, scenarioOverrides: Object.keys(prompts.declarations.scenarioOverrides ?? {}).length }
325
- : {}),
326
- ...(prompts.catalog ? { artifactDigest: prompts.catalog.artifact.artifactDigest, catalogDigest: prompts.catalog.artifact.payload.catalogDigest, sourceRevision: prompts.catalog.sourceRevision } : {}),
327
- note: "new tasks assemble the new pack (epoch re-pins at the next task boundary); in-flight sessions stay pinned",
348
+ artifactDigest: prompts.artifactDigest,
349
+ sourceRevision: prompts.sourceRevision,
350
+ note: "new sessions adopt this center layer (a session pins it at its first run); in-flight sessions stay pinned",
328
351
  });
329
352
  }
330
- const transitioned = await applyCatalogToSource(catalogSource, prompts, centerPrompts, logger, phase);
353
+ const transitioned = await applyCenterArtifact(catalogSource, prompts, adoptedArtifact, logger, phase);
331
354
  if (transitioned) {
332
- centerPrompts = prompts;
333
- pendingCatalogFaces = undefined;
355
+ adoptedArtifact = prompts;
356
+ pendingCenterTarget = undefined;
334
357
  }
335
358
  else {
336
- pendingCatalogFaces = { target: prompts };
359
+ pendingCenterTarget = { target: prompts };
337
360
  }
338
361
  };
339
362
  let bootConfigPending;
@@ -349,14 +372,20 @@ export async function createWebAdminRuntime(ctx) {
349
372
  return ledger;
350
373
  };
351
374
  const noteHandoff = (next) => {
352
- const applied = next.applied ?? handoff.applied;
375
+ const applied = next.noneApplied === true ? undefined : (next.applied ?? handoff.applied);
353
376
  const durable = next.durable ?? handoff.durable;
354
377
  handoff = { ...(applied !== undefined ? { applied } : {}), ...(durable !== undefined ? { durable } : {}) };
355
378
  latchHandoff();
356
379
  };
357
- const markApplied = (gen, version) => {
358
- applyLedger.applied(gen, version);
359
- noteHandoff({ applied: version });
380
+ const markApplied = (gen, eff) => {
381
+ applyLedger.applied(gen, eff.version);
382
+ if (isNoCenterEffective(eff))
383
+ noteHandoff({ noneApplied: true });
384
+ else
385
+ noteHandoff({ applied: eff.version });
386
+ const landed = tier.committed(candidateIdentityOf(eff));
387
+ if (landed !== undefined)
388
+ announceTier(landed);
360
389
  };
361
390
  let lkgBooted = false;
362
391
  let bootLkgCandidate;
@@ -481,7 +510,7 @@ export async function createWebAdminRuntime(ctx) {
481
510
  const lkgIdentity = candidateIdentityOf(lkgR.effective);
482
511
  if (lkgSurvivesRestart && lkgIdentity !== undefined)
483
512
  noteHandoff({ durable: { version: lkgR.effective.version, identity: lkgIdentity } });
484
- markApplied(lkgGen, lkgR.effective.version);
513
+ markApplied(lkgGen, lkgR.effective);
485
514
  await adoptCenterPrompts(lkgR.effective, lkgR.prompts, "boot-lkg");
486
515
  const lkgPlane = modelPlaneCommitted(lkgReport);
487
516
  if (lkgPlane)
@@ -586,7 +615,7 @@ export async function createWebAdminRuntime(ctx) {
586
615
  recordApply(rep);
587
616
  },
588
617
  });
589
- markApplied(bootGen, r.effective.version);
618
+ markApplied(bootGen, r.effective);
590
619
  const bootClean = fullyLandedForLkg(r, bootReport);
591
620
  if (bootClean)
592
621
  ccEtag = r.etag;
@@ -623,11 +652,13 @@ export async function createWebAdminRuntime(ctx) {
623
652
  }
624
653
  }
625
654
  catch (err) {
655
+ if (err instanceof ConfigDirUntrustedError)
656
+ throw err;
626
657
  if (bootApplyPhase)
627
658
  logger.warn("config_apply_refused", { source: configProvider.kind, err: String(err), note: "the pulled candidate failed to apply at boot — falling back to the LKG / env; this is not a reachability failure" });
628
659
  else
629
660
  logger.warn("config_source_unreachable_using_env", { source: configProvider.kind, err: String(err) });
630
- await bootFallBackWhole(`${bootApplyPhase ? "boot apply refused" : "boot fetch failed"}: ${String(err).slice(0, 120)}`);
661
+ await bootFallBackWhole(`${bootApplyPhase ? "boot apply refused" : "boot fetch failed"}: ${echoCallerText(String(err), { maxChars: 120 })}`);
631
662
  }
632
663
  if (!dryRun && cc !== undefined && currentIdentity() !== promptStateIdentity)
633
664
  await rebasePromptState(currentIdentity(), "boot-end");
@@ -666,8 +697,11 @@ export async function createWebAdminRuntime(ctx) {
666
697
  restoreReadFaceBaseline(config, before);
667
698
  throw err;
668
699
  }
700
+ if (changedSeats.includes("readDenyPatterns"))
701
+ announceReadDenyRows(config, logger);
669
702
  };
670
703
  let ccTimer;
704
+ let unwatchCredential;
671
705
  return {
672
706
  providerKind: configProvider?.kind,
673
707
  sealedKeyPublic: sealedKeys === undefined ? undefined : buildSealedKeyPublicFace(sealedKeys),
@@ -678,7 +712,6 @@ export async function createWebAdminRuntime(ctx) {
678
712
  },
679
713
  mcpRevocationState: () => (configProvider ? mcpRevocations.view() : undefined),
680
714
  getKeyResolver: () => keyResolver,
681
- getCenterPrompts: () => centerPrompts,
682
715
  modelReady: () => modelReadyState.ready,
683
716
  onSelfReportChange: (listener) => {
684
717
  selfReportListeners.push(listener);
@@ -707,6 +740,7 @@ export async function createWebAdminRuntime(ctx) {
707
740
  const pluginOut = await applyCenterPlugins(skills, effective, {
708
741
  cacheRoot: join(config.localDataRoot ?? join(homedir(), ".ai-agent"), "plugin-cache"),
709
742
  allowHosts: config.pluginsAllowHosts,
743
+ toolsShareThisFilesystem: toolsRunOnThisHost(config),
710
744
  logger,
711
745
  }).catch((err) => {
712
746
  logger.warn("center_plugins_apply_failed", { error: err instanceof Error ? err.message : String(err) });
@@ -839,6 +873,69 @@ export async function createWebAdminRuntime(ctx) {
839
873
  if (configProvider) {
840
874
  const ccRef = config.webAdmin;
841
875
  let refreshInFlight = false;
876
+ let followUp = false;
877
+ let ownRead = false;
878
+ const commitHot = async (c) => {
879
+ const { eff, prompts, gen, phase } = c;
880
+ const noCenter = isNoCenterEffective(eff);
881
+ const planeChanged = noCenter || modelPlaneChanged(appliedPlaneEff, eff);
882
+ let report;
883
+ const committed = applyEffective(config, eff, logger, {
884
+ leg: "hot",
885
+ checkpointStorePresent,
886
+ sealedKeys,
887
+ generation: gen,
888
+ report: (rep) => {
889
+ report = rep;
890
+ recordApply(rep);
891
+ },
892
+ ...(planeChanged ? { swapPlane: swapRunnerDeps } : {}),
893
+ });
894
+ if (!committed)
895
+ return { committed: false, report, planeCommitted: false };
896
+ mutateInPlace(pricing, buildPricing(config.models));
897
+ keyResolver = createKeyResolver(config.modelApiKeyEnv, process.env, config.modelApiKeys);
898
+ limitSync?.sync();
899
+ ceilingVerdict?.judge();
900
+ if (phase !== "boot-deferred")
901
+ mcpRevocations.applyEnabledEntries(enabledMcpEntries(eff.mcp));
902
+ applyLiveReadFace(eff, swapRunnerDeps, phase);
903
+ markApplied(gen, eff);
904
+ const planeCommitted = modelPlaneCommitted(report);
905
+ if (planeCommitted)
906
+ appliedPlaneEff = noCenter ? undefined : eff;
907
+ planeDeferredNoHandoff = undefined;
908
+ await adoptCenterPrompts(eff, prompts, phase);
909
+ if (planeCommitted)
910
+ markRosterLanded(eff);
911
+ if (tier.drifted(currentIdentity()))
912
+ requestTick();
913
+ return { committed: true, report, planeCommitted };
914
+ };
915
+ const demoteToNoCenter = async (awaiting) => {
916
+ const gen = reserveArrivalGeneration();
917
+ applyLedger.seenTarget(gen, NO_CENTER_EFFECTIVE.version);
918
+ const hot = await commitHot({ eff: NO_CENTER_EFFECTIVE, prompts: undefined, gen, phase: "no-center" });
919
+ if (!hot.committed) {
920
+ throw new Error("the no-center tier was refused (the Runners did not accept the env model table) — the previous account's center configuration is still in force; retried next tick");
921
+ }
922
+ if (hot.report !== undefined && !hot.report.fullyApplied) {
923
+ logger.warn("center_identity_demotion_partial", { groups: refusedGroups(hot.report).map((g) => g.group), note: "a group of the no-center tier was refused — that group keeps its previous values (loud; the env base for that group could not be applied)" });
924
+ }
925
+ noteCandidateVerdict(gen, undefined);
926
+ latestEffective = undefined;
927
+ ccEtag = undefined;
928
+ announceTier(tier.demote(awaiting, hot.report !== undefined ? refusedGroups(hot.report).map((g) => g.group) : []));
929
+ };
930
+ const reconcileCenterIdentity = async (identity) => {
931
+ if (identity === undefined || !tier.drifted(identity))
932
+ return;
933
+ if (tier.isDemoted()) {
934
+ tier.retarget(identity);
935
+ return;
936
+ }
937
+ await demoteToNoCenter(identity);
938
+ };
842
939
  const refreshTick = async (arrival) => {
843
940
  if (refreshInFlight)
844
941
  return "ok";
@@ -850,6 +947,15 @@ export async function createWebAdminRuntime(ctx) {
850
947
  const refreshTickRan = async (arrival) => {
851
948
  refreshInFlight = true;
852
949
  try {
950
+ let ownIdentity;
951
+ ownRead = true;
952
+ try {
953
+ ownIdentity = currentIdentity();
954
+ }
955
+ finally {
956
+ ownRead = false;
957
+ }
958
+ await reconcileCenterIdentity(ownIdentity);
853
959
  await retryPendingCatalog("refresh-retry");
854
960
  if (planeDeferredNoHandoff) {
855
961
  metrics.inc("models_tiers_plane_deferred_stuck_total");
@@ -875,6 +981,7 @@ export async function createWebAdminRuntime(ctx) {
875
981
  }
876
982
  }
877
983
  if (r) {
984
+ await reconcileCenterIdentity(candidateIdentityOf(r.effective));
878
985
  const tickGen = arrival !== undefined ? useArrivalGeneration(r.effective.version, arrival.ordinal) : generationOf(r.effective.version);
879
986
  applyLedger.seenTarget(tickGen, r.effective.version);
880
987
  const verdict = judgeConfigCandidate(r);
@@ -889,35 +996,10 @@ export async function createWebAdminRuntime(ctx) {
889
996
  ccEtag = r.etag;
890
997
  }
891
998
  else {
892
- const planeChanged = modelPlaneChanged(appliedPlaneEff, r.effective);
893
- let applyReport;
894
- const committed = applyEffective(config, r.effective, logger, {
895
- leg: "hot",
896
- checkpointStorePresent,
897
- sealedKeys,
898
- generation: tickGen,
899
- report: (rep) => {
900
- applyReport = rep;
901
- recordApply(rep);
902
- },
903
- ...(planeChanged ? { swapPlane: swapRunnerDeps } : {}),
904
- });
905
- if (!committed)
999
+ const hot = await commitHot({ eff: r.effective, prompts: verdict.prompts, gen: tickGen, phase: "refresh" });
1000
+ if (!hot.committed)
906
1001
  return "ok";
907
- mutateInPlace(pricing, buildPricing(config.models));
908
- keyResolver = createKeyResolver(config.modelApiKeyEnv, process.env, config.modelApiKeys);
909
- limitSync?.sync();
910
- ceilingVerdict?.judge();
911
- mcpRevocations.applyEnabledEntries(enabledMcpEntries(r.effective.mcp));
912
- applyLiveReadFace(r.effective, swapRunnerDeps, "refresh");
913
- markApplied(tickGen, r.effective.version);
914
- const tickPlane = modelPlaneCommitted(applyReport);
915
- if (tickPlane)
916
- appliedPlaneEff = r.effective;
917
- planeDeferredNoHandoff = undefined;
918
- await adoptCenterPrompts(r.effective, verdict.prompts, "refresh");
919
- if (tickPlane)
920
- markRosterLanded(r.effective);
1002
+ const applyReport = hot.report;
921
1003
  if (!fullyLandedForLkg(r, applyReport)) {
922
1004
  ccEtag = undefined;
923
1005
  const refused = applyReport ? refusedGroups(applyReport) : [];
@@ -962,13 +1044,39 @@ export async function createWebAdminRuntime(ctx) {
962
1044
  return inFlight;
963
1045
  const p = refreshTick(arrival).finally(() => {
964
1046
  inFlight = undefined;
1047
+ afterLane();
965
1048
  });
966
1049
  inFlight = p;
967
1050
  return p;
968
1051
  };
1052
+ const requestTick = () => {
1053
+ if (ccTimer === undefined || ownRead)
1054
+ return;
1055
+ if (inFlight !== undefined || refreshInFlight) {
1056
+ followUp = true;
1057
+ return;
1058
+ }
1059
+ queueMicrotask(() => void runTick());
1060
+ };
1061
+ const afterLane = () => {
1062
+ if (!followUp)
1063
+ return;
1064
+ followUp = false;
1065
+ if (tier.drifted(currentIdentity()))
1066
+ requestTick();
1067
+ };
1068
+ unwatchCredential =
1069
+ ccRef !== undefined && !ccRef.dryRun && configProvider.kind === "remote"
1070
+ ? ccRef.credential.onRead((read) => {
1071
+ if (tier.drifted(read.identity))
1072
+ requestTick();
1073
+ })
1074
+ : undefined;
969
1075
  manualRefresh = runTick;
970
1076
  ccTimer = setInterval(() => void runTick(), 60_000);
971
1077
  ccTimer.unref?.();
1078
+ if (tier.drifted(currentIdentity()))
1079
+ requestTick();
972
1080
  const deferredBootApply = async (r, arrivalGen) => {
973
1081
  if (!r)
974
1082
  return;
@@ -985,6 +1093,7 @@ export async function createWebAdminRuntime(ctx) {
985
1093
  }
986
1094
  finally {
987
1095
  refreshInFlight = false;
1096
+ afterLane();
988
1097
  }
989
1098
  };
990
1099
  const deferredBootApplyInner = async (r, lateGen) => {
@@ -1001,34 +1110,10 @@ export async function createWebAdminRuntime(ctx) {
1001
1110
  ccEtag = r.etag;
1002
1111
  return;
1003
1112
  }
1004
- const planeChangedLate = modelPlaneChanged(appliedPlaneEff, r.effective);
1005
- let applyReportLate;
1006
- const committedLate = applyEffective(config, r.effective, logger, {
1007
- leg: "hot",
1008
- checkpointStorePresent,
1009
- sealedKeys,
1010
- generation: lateGen,
1011
- report: (rep) => {
1012
- applyReportLate = rep;
1013
- recordApply(rep);
1014
- },
1015
- ...(planeChangedLate ? { swapPlane: swapRunnerDeps } : {}),
1016
- });
1017
- if (!committedLate)
1113
+ const hotLate = await commitHot({ eff: r.effective, prompts: lateVerdict.prompts, gen: lateGen, phase: "boot-deferred" });
1114
+ if (!hotLate.committed)
1018
1115
  return;
1019
- mutateInPlace(pricing, buildPricing(config.models));
1020
- keyResolver = createKeyResolver(config.modelApiKeyEnv, process.env, config.modelApiKeys);
1021
- limitSync?.sync();
1022
- ceilingVerdict?.judge();
1023
- applyLiveReadFace(r.effective, swapRunnerDeps, "boot-deferred");
1024
- markApplied(lateGen, r.effective.version);
1025
- const latePlane = modelPlaneCommitted(applyReportLate);
1026
- if (latePlane)
1027
- appliedPlaneEff = r.effective;
1028
- planeDeferredNoHandoff = undefined;
1029
- await adoptCenterPrompts(r.effective, lateVerdict.prompts, "boot-deferred");
1030
- if (latePlane)
1031
- markRosterLanded(r.effective);
1116
+ const applyReportLate = hotLate.report;
1032
1117
  if (!fullyLandedForLkg(r, applyReportLate)) {
1033
1118
  ccEtag = undefined;
1034
1119
  const refusedLate = applyReportLate ? refusedGroups(applyReportLate) : [];
@@ -1069,10 +1154,13 @@ export async function createWebAdminRuntime(ctx) {
1069
1154
  ccTimer = undefined;
1070
1155
  }
1071
1156
  credentialRenewer?.stop();
1157
+ unwatchCredential?.();
1158
+ unwatchCredential = undefined;
1072
1159
  },
1073
1160
  centerCredentialState() {
1074
1161
  return cc === undefined ? undefined : buildCenterCredentialHealthView(cc.credential.health(), credentialRenewer);
1075
1162
  },
1163
+ centerIdentityNoticeState: () => tier.notice(),
1076
1164
  };
1077
1165
  }
1078
1166
  //# sourceMappingURL=web-admin.js.map
@@ -15,6 +15,7 @@ import { type WorkflowRun, type WorkflowRunStore } from "@sema-agent/core";
15
15
  import type { ServiceConfig } from "../config.js";
16
16
  import { FleetEventBus } from "../fleet/fleet-bus.js";
17
17
  import { type WorkflowAgentSessionIndex } from "../orchestration/workflow-agent-session-index.js";
18
+ import type { WorkflowParkDecisionStore } from "../orchestration/workflow-park-decision.js";
18
19
  import type { Logger } from "../observability/logger.js";
19
20
  import type { Metrics } from "../observability/metrics.js";
20
21
  import { type WorkflowCompletionInbox } from "../orchestration/workflow-completion-inbox.js";
@@ -49,5 +50,6 @@ export declare function createWorkflowOrchestration(ctx: WorkflowOrchestrationCt
49
50
  publishTerminalFleetRow?: (id: string, run: WorkflowRun) => void;
50
51
  };
51
52
  workflowAgentSessionIndex: WorkflowAgentSessionIndex | undefined;
53
+ workflowParkDecisions: WorkflowParkDecisionStore | undefined;
52
54
  };
53
55
  //# sourceMappingURL=workflow-orchestration.d.ts.map
@@ -66,6 +66,7 @@ export function createWorkflowOrchestration(ctx) {
66
66
  ? backend.workflowAgentSessionIndex()
67
67
  : new LocalWorkflowAgentSessionIndex(join(config.localDataRoot ?? localRoot, "workflows"), undefined))
68
68
  : undefined;
69
+ const workflowParkDecisions = config.selfOrchestrationEnabled && backend !== undefined && (sqlWorkflowRunStore !== undefined || backend.kind === "local") ? backend.workflowParkDecisions?.() : undefined;
69
70
  const workflowRunStore = baseWorkflowRunStore
70
71
  ? new JournalingWorkflowRunStore(baseWorkflowRunStore, workflowNotifyGate, fleetBus, workflowAgentSessionIndex)
71
72
  : undefined;
@@ -82,7 +83,7 @@ export function createWorkflowOrchestration(ctx) {
82
83
  return {
83
84
  sqlWorkflowRunStore, workflowNotifyJournal, workflowCompletionInbox, deliverWorkflowCompletion,
84
85
  workflowNotifyGate, fleetBus, workflowRunStore, workflowJournalStore, outcomeSink,
85
- workflowAgentRegistry, subagentSteerRegistry, workflowRecoverOpts, workflowAgentSessionIndex,
86
+ workflowAgentRegistry, subagentSteerRegistry, workflowRecoverOpts, workflowAgentSessionIndex, workflowParkDecisions,
86
87
  };
87
88
  }
88
89
  //# sourceMappingURL=workflow-orchestration.js.map