@sema-agent/server 7.150.0 → 7.152.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (514) hide show
  1. package/MIGRATION.md +451 -0
  2. package/README.md +15 -3
  3. package/README.zh-CN.md +10 -2
  4. package/USAGE.md +144 -87
  5. package/deploy/sema-up/README.md +11 -4
  6. package/deploy/sema-up/chart/Chart.yaml +1 -1
  7. package/deploy/sema-up/chart/templates/NOTES.txt +5 -0
  8. package/deploy/sema-up/chart/templates/_helpers.tpl +15 -16
  9. package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -3
  10. package/deploy/sema-up/chart/templates/server.yaml +5 -3
  11. package/deploy/sema-up/chart/values-full-single.yaml +3 -1
  12. package/deploy/sema-up/chart/values.yaml +8 -1
  13. package/deploy/sema-up/cluster-up.sh +7 -6
  14. package/deploy/sema-up/kube-up.sh +6 -6
  15. package/deploy/sema-up/lib/flagshape.sh +36 -8
  16. package/deploy/sema-up/lib/helm-values-cluster.py +2 -0
  17. package/deploy/sema-up/lib/helm-values-kube.py +2 -0
  18. package/deploy/sema-up/machines.example.yaml +3 -1
  19. package/deploy/sema-up/sema-up.sh +22 -16
  20. package/dist/adoption/import.js +3 -3
  21. package/dist/approval-ask-audit-store.d.ts +1 -1
  22. package/dist/approval-ask-machine.d.ts +4 -10
  23. package/dist/approval-ask-retention.d.ts +1 -1
  24. package/dist/approval-card.d.ts +12 -14
  25. package/dist/approval-gate-currency.d.ts +9 -9
  26. package/dist/approval-gate-currency.js +3 -4
  27. package/dist/approval-hmac.d.ts +17 -1
  28. package/dist/approval-hmac.js +7 -1
  29. package/dist/approval-queue-kind.d.ts +1 -1
  30. package/dist/approval.d.ts +2 -2
  31. package/dist/approval.js +2 -2
  32. package/dist/auth-bridge.d.ts +20 -0
  33. package/dist/auth-bridge.js +9 -0
  34. package/dist/background-session-reap.d.ts +1 -1
  35. package/dist/bake-runner/main.d.ts +4 -2
  36. package/dist/bind-host.d.ts +3 -6
  37. package/dist/bind-host.js +4 -7
  38. package/dist/boot/budget-tracing.js +1 -1
  39. package/dist/boot/coordinators.d.ts +1 -1
  40. package/dist/boot/coordinators.js +9 -10
  41. package/dist/boot/device-lane.js +2 -0
  42. package/dist/boot/engine-lease.d.ts +5 -0
  43. package/dist/boot/engine-lease.js +1 -0
  44. package/dist/boot/execution-env.d.ts +9 -14
  45. package/dist/boot/execution-env.js +85 -22
  46. package/dist/boot/execution-lane.js +32 -5
  47. package/dist/boot/late-binds.d.ts +8 -4
  48. package/dist/boot/late-binds.js +7 -1
  49. package/dist/boot/leader.d.ts +31 -30
  50. package/dist/boot/leader.js +38 -28
  51. package/dist/boot/leg-path-adjudication.d.ts +40 -0
  52. package/dist/boot/leg-path-adjudication.js +18 -0
  53. package/dist/boot/memory-consolidation.d.ts +3 -2
  54. package/dist/boot/memory-consolidation.js +6 -6
  55. package/dist/boot/parked-revive-gate.js +3 -15
  56. package/dist/boot/reapers.d.ts +6 -1
  57. package/dist/boot/reapers.js +13 -2
  58. package/dist/boot/resolve-spec.d.ts +3 -3
  59. package/dist/boot/resolve-spec.js +43 -48
  60. package/dist/boot/runner-deps.d.ts +46 -35
  61. package/dist/boot/runner-deps.js +94 -91
  62. package/dist/boot/session-age-out.d.ts +36 -0
  63. package/dist/boot/session-age-out.js +101 -0
  64. package/dist/boot/session-faces.d.ts +5 -14
  65. package/dist/boot/session-faces.js +9 -5
  66. package/dist/boot/shutdown.d.ts +6 -0
  67. package/dist/boot/shutdown.js +10 -4
  68. package/dist/boot/stage-01-config.js +2 -0
  69. package/dist/boot/stage-02-web-admin-pull.js +4 -5
  70. package/dist/boot/stage-05-execution-env.d.ts +5 -3
  71. package/dist/boot/stage-05-execution-env.js +3 -2
  72. package/dist/boot/stage-06-runners.d.ts +9 -4
  73. package/dist/boot/stage-06-runners.js +24 -9
  74. package/dist/boot/stage-07-capability-layer.d.ts +8 -4
  75. package/dist/boot/stage-07-capability-layer.js +3 -2
  76. package/dist/boot/stage-08-reapers.d.ts +8 -4
  77. package/dist/boot/stage-08-reapers.js +4 -2
  78. package/dist/boot/stage-09-leader.d.ts +12 -5
  79. package/dist/boot/stage-09-leader.js +14 -5
  80. package/dist/boot/stage-10-http-server.d.ts +19 -5
  81. package/dist/boot/stage-10-http-server.js +14 -21
  82. package/dist/boot/stores.js +7 -4
  83. package/dist/boot/web-admin.js +5 -8
  84. package/dist/boot/workflow-orchestration.d.ts +7 -2
  85. package/dist/boot/workflow-orchestration.js +24 -7
  86. package/dist/bounded-rotation.d.ts +29 -0
  87. package/dist/bounded-rotation.js +24 -0
  88. package/dist/capabilities/approvals-push.d.ts +3 -3
  89. package/dist/capabilities/scenarios.d.ts +28 -13
  90. package/dist/capabilities/scenarios.js +2 -2
  91. package/dist/capability-facts.d.ts +43 -32
  92. package/dist/capability-facts.js +45 -51
  93. package/dist/card-rule-offers.d.ts +32 -0
  94. package/dist/card-rule-offers.js +130 -0
  95. package/dist/center-credential.d.ts +25 -6
  96. package/dist/center-credential.js +25 -5
  97. package/dist/config-catalog.d.ts +26 -7
  98. package/dist/config-catalog.js +26 -22
  99. package/dist/config-dir-trust.js +4 -2
  100. package/dist/config-invariants.d.ts +20 -8
  101. package/dist/config-invariants.js +55 -12
  102. package/dist/config-lkg.d.ts +5 -19
  103. package/dist/config-lkg.js +8 -62
  104. package/dist/config-provider.d.ts +1 -1
  105. package/dist/config-root-migration.d.ts +2 -2
  106. package/dist/config-types.d.ts +38 -42
  107. package/dist/config.d.ts +58 -7
  108. package/dist/config.js +90 -40
  109. package/dist/control-socket.d.ts +51 -0
  110. package/dist/control-socket.js +115 -0
  111. package/dist/deployment-governance.d.ts +2 -1
  112. package/dist/deployment-shape.d.ts +9 -1
  113. package/dist/deployment-shape.js +2 -1
  114. package/dist/device-protocol.d.ts +5 -4
  115. package/dist/device-protocol.js +1 -1
  116. package/dist/device-ws-hub.d.ts +7 -0
  117. package/dist/device-ws-hub.js +10 -3
  118. package/dist/device-ws-protocol.d.ts +63 -10
  119. package/dist/device-ws-protocol.js +56 -25
  120. package/dist/elicitation.js +2 -2
  121. package/dist/engine-identity.d.ts +19 -7
  122. package/dist/engine-identity.js +10 -2
  123. package/dist/entry-mode-clamp-notice.d.ts +2 -1
  124. package/dist/entry-problems.d.ts +40 -3
  125. package/dist/entry-problems.js +3 -1
  126. package/dist/execution-env-refusal.d.ts +29 -0
  127. package/dist/execution-env-refusal.js +8 -0
  128. package/dist/execution-lane-caps.d.ts +3 -1
  129. package/dist/field-conflict.d.ts +1 -1
  130. package/dist/file-history-capture.d.ts +11 -4
  131. package/dist/file-history-capture.js +9 -6
  132. package/dist/file-history-disclosure.d.ts +7 -5
  133. package/dist/file-history-disclosure.js +7 -5
  134. package/dist/fleet/drain-entry.d.ts +4 -0
  135. package/dist/fleet/engine-signal.d.ts +12 -29
  136. package/dist/fleet/engine-signal.js +1 -7
  137. package/dist/fleet-client.js +2 -5
  138. package/dist/gate-settlement.d.ts +1 -8
  139. package/dist/gate-settlement.js +0 -4
  140. package/dist/history-anchor.js +1 -1
  141. package/dist/hitl-delivery.d.ts +2 -3
  142. package/dist/hitl-delivery.js +0 -2
  143. package/dist/hooks/hook-llm.js +4 -2
  144. package/dist/hooks/hook-runner.d.ts +3 -2
  145. package/dist/hooks/hook-runner.js +18 -3
  146. package/dist/host-decision.d.ts +11 -11
  147. package/dist/host-lsp-manager.d.ts +2 -2
  148. package/dist/http/active-run-conflict.d.ts +35 -2
  149. package/dist/http/active-run-conflict.js +48 -19
  150. package/dist/http/admission.js +17 -2
  151. package/dist/http/approval-sweeps.d.ts +1 -1
  152. package/dist/http/approval-sweeps.js +10 -7
  153. package/dist/http/checkpoint-ctx.d.ts +4 -0
  154. package/dist/http/checkpoint-ctx.js +2 -0
  155. package/dist/http/dispatch.d.ts +8 -3
  156. package/dist/http/dispatch.js +59 -32
  157. package/dist/http/durable-run-leg.js +16 -17
  158. package/dist/http/health-reader.d.ts +16 -9
  159. package/dist/http/health-reader.js +2 -1
  160. package/dist/http/health-self-report.d.ts +9 -1
  161. package/dist/http/health-self-report.js +3 -1
  162. package/dist/http/owner-access.d.ts +33 -14
  163. package/dist/http/owner-access.js +40 -10
  164. package/dist/http/principal-gate.d.ts +49 -21
  165. package/dist/http/principal-gate.js +61 -11
  166. package/dist/http/request-channel.d.ts +23 -0
  167. package/dist/http/request-channel.js +9 -0
  168. package/dist/http/request-guards.js +17 -2
  169. package/dist/http/resume-ctx-read.js +42 -3
  170. package/dist/http/resume-legs.d.ts +4 -3
  171. package/dist/http/resume-legs.js +367 -117
  172. package/dist/http/route-ctx.d.ts +91 -15
  173. package/dist/http/route-ctx.js +17 -0
  174. package/dist/http/route-table.d.ts +5 -1
  175. package/dist/http/route-table.js +4 -0
  176. package/dist/http/routes/admin-config-refresh.js +3 -3
  177. package/dist/http/routes/admin-drain.d.ts +3 -0
  178. package/dist/http/routes/admin-drain.js +7 -7
  179. package/dist/http/routes/admin-memory-optout.d.ts +1 -1
  180. package/dist/http/routes/admin-memory-optout.js +3 -3
  181. package/dist/http/routes/adoption.js +3 -5
  182. package/dist/http/routes/agents-roster.js +2 -3
  183. package/dist/http/routes/approvals-assistant.d.ts +2 -1
  184. package/dist/http/routes/approvals-assistant.js +99 -51
  185. package/dist/http/routes/background.d.ts +3 -3
  186. package/dist/http/routes/capabilities.d.ts +4 -0
  187. package/dist/http/routes/capabilities.js +38 -10
  188. package/dist/http/routes/config-catalog.js +2 -2
  189. package/dist/http/routes/devices.js +1 -1
  190. package/dist/http/routes/diagnostics.d.ts +3 -3
  191. package/dist/http/routes/diagnostics.js +19 -7
  192. package/dist/http/routes/fleet.js +10 -8
  193. package/dist/http/routes/images.js +10 -10
  194. package/dist/http/routes/memory-bundle.js +3 -3
  195. package/dist/http/routes/memory-compliance.js +3 -3
  196. package/dist/http/routes/memory-consolidation.js +2 -2
  197. package/dist/http/routes/memory-origin.js +3 -3
  198. package/dist/http/routes/memory-policy.js +2 -2
  199. package/dist/http/routes/observability.js +3 -3
  200. package/dist/http/routes/projects.d.ts +3 -2
  201. package/dist/http/routes/projects.js +4 -5
  202. package/dist/http/routes/retention-ops.js +3 -3
  203. package/dist/http/routes/rules.js +5 -5
  204. package/dist/http/routes/run-permission-mode.d.ts +2 -1
  205. package/dist/http/routes/run-permission-mode.js +2 -2
  206. package/dist/http/routes/runs.d.ts +4 -9
  207. package/dist/http/routes/runs.js +171 -65
  208. package/dist/http/routes/session-sync.d.ts +22 -9
  209. package/dist/http/routes/session-sync.js +204 -107
  210. package/dist/http/routes/sessions-list.js +13 -7
  211. package/dist/http/routes/sessions.js +30 -15
  212. package/dist/http/routes/tasks.js +46 -41
  213. package/dist/http/routes/trace-usage.js +2 -2
  214. package/dist/http/routes/workflows.js +1 -1
  215. package/dist/http/server.d.ts +30 -30
  216. package/dist/http/server.js +16 -4
  217. package/dist/http/submit-ctx.d.ts +1 -1
  218. package/dist/http/submit-ctx.js +7 -4
  219. package/dist/http/wire-types.d.ts +14 -4
  220. package/dist/human-facing-args.d.ts +33 -0
  221. package/dist/human-facing-args.js +33 -0
  222. package/dist/identity-source.d.ts +20 -3
  223. package/dist/identity-source.js +14 -0
  224. package/dist/index.d.ts +5 -1
  225. package/dist/k8s-api-credentials.d.ts +29 -0
  226. package/dist/k8s-api-credentials.js +25 -0
  227. package/dist/lane-home-probe.d.ts +3 -7
  228. package/dist/lane-home-probe.js +2 -2
  229. package/dist/leader/diffup.d.ts +19 -0
  230. package/dist/leader/diffup.js +7 -0
  231. package/dist/leader/leader.d.ts +116 -11
  232. package/dist/leader/leader.js +69 -5
  233. package/dist/leader/repair-wire.js +2 -2
  234. package/dist/leader/run-entry.d.ts +2 -1
  235. package/dist/leader/run-entry.js +1 -1
  236. package/dist/leader/wire.d.ts +42 -132
  237. package/dist/leader/wire.js +81 -67
  238. package/dist/leg-facts.d.ts +13 -5
  239. package/dist/leg-facts.js +2 -1
  240. package/dist/memory-scope.d.ts +23 -11
  241. package/dist/memory-scope.js +18 -6
  242. package/dist/memory-sync-client.d.ts +30 -2
  243. package/dist/memory-sync-client.js +16 -9
  244. package/dist/model-entry-headers.d.ts +9 -10
  245. package/dist/model-entry-headers.js +0 -4
  246. package/dist/model-entry-refusal.d.ts +7 -4
  247. package/dist/model-entry-refusal.js +11 -5
  248. package/dist/model-plane-face.d.ts +1 -1
  249. package/dist/model-plane-face.js +3 -1
  250. package/dist/model-route-endpoint.d.ts +13 -7
  251. package/dist/model-route-endpoint.js +14 -11
  252. package/dist/model-select.d.ts +22 -0
  253. package/dist/model-select.js +9 -0
  254. package/dist/model-unreachable-notice.d.ts +11 -0
  255. package/dist/model-unreachable-notice.js +4 -4
  256. package/dist/object-store-buckets.d.ts +640 -6
  257. package/dist/object-store-buckets.js +166 -0
  258. package/dist/observability/err-text.d.ts +7 -0
  259. package/dist/observability/err-text.js +5 -0
  260. package/dist/observability/fail-open.d.ts +25 -17
  261. package/dist/observability/fail-open.js +25 -17
  262. package/dist/observability/logger.js +3 -1
  263. package/dist/observability/metrics.js +1 -0
  264. package/dist/operator-roster.d.ts +68 -0
  265. package/dist/operator-roster.js +32 -0
  266. package/dist/orchestration/workflow-notify-journal.d.ts +18 -1
  267. package/dist/orchestration/workflow-notify-journal.js +12 -1
  268. package/dist/orchestration/workflow-park-decision.d.ts +70 -18
  269. package/dist/orchestration/workflow-park-decision.js +49 -10
  270. package/dist/orchestration/workflow-park-holder.d.ts +65 -0
  271. package/dist/orchestration/workflow-park-holder.js +98 -0
  272. package/dist/orchestration/workflow-record-fence.d.ts +36 -0
  273. package/dist/orchestration/workflow-record-fence.js +42 -0
  274. package/dist/outbound-dispatcher.d.ts +71 -8
  275. package/dist/outbound-dispatcher.js +48 -7
  276. package/dist/owner-faces.d.ts +2 -2
  277. package/dist/parked-decide.d.ts +106 -55
  278. package/dist/parked-decide.js +153 -117
  279. package/dist/peer-directory.d.ts +2 -2
  280. package/dist/peer-inbound-face.d.ts +2 -6
  281. package/dist/peer-inbound-face.js +0 -3
  282. package/dist/permission-mode-admission.d.ts +74 -5
  283. package/dist/permission-mode-admission.js +56 -3
  284. package/dist/plugins/adoption-log-sql.d.ts +3 -1
  285. package/dist/plugins/adoption-log-sql.js +7 -1
  286. package/dist/plugins/approval-ask-store-file.d.ts +14 -2
  287. package/dist/plugins/approval-ask-store-file.js +11 -0
  288. package/dist/plugins/approval-ask-store-memory.d.ts +10 -1
  289. package/dist/plugins/approval-ask-store-memory.js +35 -10
  290. package/dist/plugins/approval-ask-store-sql.d.ts +69 -4
  291. package/dist/plugins/approval-ask-store-sql.js +45 -5
  292. package/dist/plugins/approval-exemption-store.js +3 -0
  293. package/dist/plugins/approval-nonce-store.js +2 -0
  294. package/dist/plugins/blob-backend.d.ts +83 -7
  295. package/dist/plugins/blob-backend.js +57 -6
  296. package/dist/plugins/breaker-state-sql.js +2 -0
  297. package/dist/plugins/caching-session-store.d.ts +9 -15
  298. package/dist/plugins/caching-session-store.js +6 -0
  299. package/dist/plugins/checkpoint-index-columns.d.ts +20 -16
  300. package/dist/plugins/checkpoint-index-columns.js +3 -6
  301. package/dist/plugins/checkpoint-store-face.d.ts +119 -61
  302. package/dist/plugins/checkpoint-store-face.js +134 -55
  303. package/dist/plugins/device-store-sql.js +6 -0
  304. package/dist/plugins/error-origin.d.ts +18 -0
  305. package/dist/plugins/error-origin.js +10 -0
  306. package/dist/plugins/execution-placement-sql.js +6 -6
  307. package/dist/plugins/image-bake-store-sql.js +6 -0
  308. package/dist/plugins/image-index-sql.js +4 -0
  309. package/dist/plugins/landed-attendants.d.ts +212 -0
  310. package/dist/plugins/landed-attendants.js +161 -0
  311. package/dist/plugins/leader-run-store-sql.js +4 -0
  312. package/dist/plugins/local-checkpoint-store.d.ts +13 -3
  313. package/dist/plugins/local-checkpoint-store.js +38 -49
  314. package/dist/plugins/local-session-live-reference.d.ts +40 -0
  315. package/dist/plugins/local-session-live-reference.js +39 -0
  316. package/dist/plugins/local-session-store.d.ts +71 -33
  317. package/dist/plugins/local-session-store.js +129 -27
  318. package/dist/plugins/memory-engine-pg.js +4 -0
  319. package/dist/plugins/memory-engine-sql-apply.js +5 -2
  320. package/dist/plugins/memory-engine-tidb.js +4 -0
  321. package/dist/plugins/memory-optout-grant-store-sql.js +4 -0
  322. package/dist/plugins/memory-sync-store-pg.js +5 -0
  323. package/dist/plugins/memory-sync-store-tidb.js +5 -0
  324. package/dist/plugins/one-time-migrations.d.ts +104 -80
  325. package/dist/plugins/one-time-migrations.js +226 -132
  326. package/dist/plugins/org-delivery-quota-store.js +4 -1
  327. package/dist/plugins/outcome-ledger-sql.js +2 -0
  328. package/dist/plugins/permission-rule-store-sql.js +11 -4
  329. package/dist/plugins/pg-cost-quota.js +4 -0
  330. package/dist/plugins/pg-pool.js +35 -10
  331. package/dist/plugins/pg-rate-limiter.js +2 -0
  332. package/dist/plugins/posix-shell-fs.d.ts +6 -1
  333. package/dist/plugins/posix-shell-fs.js +4 -1
  334. package/dist/plugins/remote-env-adb.d.ts +19 -15
  335. package/dist/plugins/remote-env-adb.js +41 -15
  336. package/dist/plugins/remote-env-connect-seat.d.ts +105 -0
  337. package/dist/plugins/remote-env-connect-seat.js +72 -0
  338. package/dist/plugins/remote-env-device.d.ts +22 -5
  339. package/dist/plugins/remote-env-device.js +106 -8
  340. package/dist/plugins/remote-env-e2b.d.ts +15 -6
  341. package/dist/plugins/remote-env-e2b.js +42 -32
  342. package/dist/plugins/remote-env-file-error.js +6 -2
  343. package/dist/plugins/remote-env-host.d.ts +46 -10
  344. package/dist/plugins/remote-env-host.js +124 -52
  345. package/dist/plugins/remote-env-k8s.d.ts +109 -41
  346. package/dist/plugins/remote-env-k8s.js +160 -54
  347. package/dist/plugins/remote-env-local-docker.d.ts +13 -8
  348. package/dist/plugins/remote-env-local-docker.js +34 -41
  349. package/dist/plugins/remote-env-ssh.d.ts +18 -12
  350. package/dist/plugins/remote-env-ssh.js +60 -59
  351. package/dist/plugins/remote-shell.d.ts +98 -1
  352. package/dist/plugins/remote-shell.js +218 -0
  353. package/dist/plugins/replica-registration.d.ts +1 -1
  354. package/dist/plugins/replica-registration.js +1 -1
  355. package/dist/plugins/resume-anchor-store-sql.d.ts +11 -2
  356. package/dist/plugins/resume-anchor-store-sql.js +12 -5
  357. package/dist/plugins/retention-lane-store-sql.js +4 -0
  358. package/dist/plugins/retention-sql.d.ts +20 -2
  359. package/dist/plugins/retention-sql.js +11 -0
  360. package/dist/plugins/run-store-sql.d.ts +21 -2
  361. package/dist/plugins/run-store-sql.js +31 -7
  362. package/dist/plugins/s3-presign.d.ts +23 -0
  363. package/dist/plugins/s3-presign.js +37 -3
  364. package/dist/plugins/scenario-prefix-switch-m42.d.ts +1 -1
  365. package/dist/plugins/scenario-prefix-switch-m42.js +2 -2
  366. package/dist/plugins/scheduler-support.d.ts +2 -2
  367. package/dist/plugins/scheduler-support.js +0 -3
  368. package/dist/plugins/schema-consistency.d.ts +4 -2
  369. package/dist/plugins/schema-consistency.js +19 -2
  370. package/dist/plugins/schema-indexes.js +2 -0
  371. package/dist/plugins/send-file-ledger.d.ts +2 -2
  372. package/dist/plugins/send-file-ledger.js +5 -2
  373. package/dist/plugins/send-user-file.d.ts +3 -4
  374. package/dist/plugins/send-user-file.js +56 -52
  375. package/dist/plugins/serving-requirement.d.ts +26 -7
  376. package/dist/plugins/serving-requirement.js +11 -4
  377. package/dist/plugins/session-birth.d.ts +6 -2
  378. package/dist/plugins/session-blob-claim-token.d.ts +15 -0
  379. package/dist/plugins/session-blob-claim-token.js +20 -0
  380. package/dist/plugins/session-blob-namespace.d.ts +46 -0
  381. package/dist/plugins/session-blob-namespace.js +116 -0
  382. package/dist/plugins/session-capture-record-store-sql.js +2 -0
  383. package/dist/plugins/session-ext-table.d.ts +14 -1
  384. package/dist/plugins/session-ext-table.js +5 -1
  385. package/dist/plugins/session-row-sql.d.ts +49 -2
  386. package/dist/plugins/session-row-sql.js +56 -13
  387. package/dist/plugins/session-store-sql.d.ts +34 -18
  388. package/dist/plugins/session-store-sql.js +98 -17
  389. package/dist/plugins/shared-memory-store-sql.d.ts +1 -0
  390. package/dist/plugins/shared-memory-store-sql.js +6 -2
  391. package/dist/plugins/snapshot-bucket-presence.d.ts +25 -2
  392. package/dist/plugins/snapshot-bucket-presence.js +8 -2
  393. package/dist/plugins/sql-driver.d.ts +2 -1
  394. package/dist/plugins/sql-driver.js +18 -3
  395. package/dist/plugins/sql-errors.d.ts +11 -6
  396. package/dist/plugins/sql-errors.js +5 -6
  397. package/dist/plugins/sql-json-column.d.ts +1 -1
  398. package/dist/plugins/stop-then-start-sentence.d.ts +10 -4
  399. package/dist/plugins/stop-then-start-sentence.js +14 -10
  400. package/dist/plugins/stop-then-start.d.ts +109 -0
  401. package/dist/plugins/stop-then-start.js +104 -0
  402. package/dist/plugins/store-backend.d.ts +84 -15
  403. package/dist/plugins/store-backend.js +236 -72
  404. package/dist/plugins/store-boundary.d.ts +57 -0
  405. package/dist/plugins/store-boundary.js +139 -0
  406. package/dist/plugins/store-contracts.d.ts +17 -0
  407. package/dist/plugins/store-fault-sentence-m53.d.ts +7 -0
  408. package/dist/plugins/store-fault-sentence-m53.js +25 -0
  409. package/dist/plugins/store-fault.d.ts +26 -7
  410. package/dist/plugins/store-fault.js +18 -2
  411. package/dist/plugins/task-attachment-store.d.ts +2 -1
  412. package/dist/plugins/task-attachment-store.js +14 -1
  413. package/dist/plugins/task-list-store-sql.d.ts +2 -2
  414. package/dist/plugins/task-list-store-sql.js +10 -8
  415. package/dist/plugins/tidb-cost-quota.js +4 -0
  416. package/dist/plugins/tidb-pool.js +21 -25
  417. package/dist/plugins/tidb-rate-limiter.js +4 -0
  418. package/dist/plugins/user-input-ledger-sql.js +4 -0
  419. package/dist/plugins/workflow-run-store-sql.d.ts +28 -10
  420. package/dist/plugins/workflow-run-store-sql.js +64 -4
  421. package/dist/plugins/workspace-custody.d.ts +4 -3
  422. package/dist/plugins/workspace-fill.d.ts +4 -7
  423. package/dist/plugins/workspace-fill.js +2 -1
  424. package/dist/plugins/write-behind-counter.js +5 -0
  425. package/dist/project-context.d.ts +0 -2
  426. package/dist/project-context.js +4 -8
  427. package/dist/project-registry.d.ts +46 -0
  428. package/dist/project-registry.js +44 -0
  429. package/dist/question.d.ts +2 -1
  430. package/dist/question.js +5 -13
  431. package/dist/request-form.d.ts +6 -1
  432. package/dist/request-form.js +4 -1
  433. package/dist/request-key-closure.js +1 -1
  434. package/dist/request-value-closure.d.ts +4 -0
  435. package/dist/request-value-closure.js +10 -0
  436. package/dist/rule-issue-reading.d.ts +1 -1
  437. package/dist/rules-consent.d.ts +1 -1
  438. package/dist/run-acceptance.d.ts +3 -2
  439. package/dist/run-acceptance.js +4 -6
  440. package/dist/run-local.js +9 -9
  441. package/dist/runs.d.ts +54 -16
  442. package/dist/runs.js +67 -13
  443. package/dist/runtime-governance.d.ts +5 -4
  444. package/dist/security.d.ts +30 -32
  445. package/dist/security.js +41 -7
  446. package/dist/sema-config-dir.d.ts +2 -1
  447. package/dist/server-secret-env.d.ts +12 -10
  448. package/dist/server-secret-env.js +24 -15
  449. package/dist/session-bindings.d.ts +82 -0
  450. package/dist/session-bindings.js +18 -0
  451. package/dist/session-children-retire.d.ts +2 -2
  452. package/dist/session-children-retire.js +2 -6
  453. package/dist/session-deletion.d.ts +16 -1
  454. package/dist/session-error-wire.d.ts +3 -3
  455. package/dist/session-error-wire.js +3 -3
  456. package/dist/session-incarnation.d.ts +10 -0
  457. package/dist/session-incarnation.js +10 -1
  458. package/dist/session-kind.d.ts +57 -0
  459. package/dist/session-kind.js +22 -0
  460. package/dist/session-row.d.ts +21 -1
  461. package/dist/session-row.js +7 -1
  462. package/dist/session-sync-kernel.d.ts +24 -14
  463. package/dist/session-sync-kernel.js +3 -6
  464. package/dist/session-sync.d.ts +25 -103
  465. package/dist/session-sync.js +14 -76
  466. package/dist/session-titler.d.ts +10 -3
  467. package/dist/session-titler.js +19 -6
  468. package/dist/ssh-host-key.d.ts +5 -0
  469. package/dist/ssh-host-key.js +3 -0
  470. package/dist/stores-sql/blob-index-sql.d.ts +30 -9
  471. package/dist/stores-sql/blob-index-sql.js +40 -21
  472. package/dist/stores-sql/checkpoint-store-sql.d.ts +54 -27
  473. package/dist/stores-sql/checkpoint-store-sql.js +70 -146
  474. package/dist/stores-sql/file-history-store-sql.d.ts +113 -15
  475. package/dist/stores-sql/file-history-store-sql.js +205 -95
  476. package/dist/stores-sql/pg-session-storage.d.ts +34 -7
  477. package/dist/stores-sql/pg-session-storage.js +37 -13
  478. package/dist/stores-sql/retention-store-sql.d.ts +1 -9
  479. package/dist/stores-sql/retention-store-sql.js +5 -19
  480. package/dist/stores-sql/session-policy-store-sql.d.ts +30 -7
  481. package/dist/stores-sql/session-policy-store-sql.js +61 -44
  482. package/dist/stores-sql/session-write-hooks.d.ts +11 -0
  483. package/dist/stores-sql/tidb-session-store.d.ts +58 -7
  484. package/dist/stores-sql/tidb-session-store.js +37 -13
  485. package/dist/submission-exit.d.ts +3 -2
  486. package/dist/submission-exit.js +9 -1
  487. package/dist/task-cwd.d.ts +2 -2
  488. package/dist/task-settings.d.ts +7 -5
  489. package/dist/task-settings.js +3 -3
  490. package/dist/terminal.d.ts +33 -2
  491. package/dist/terminal.js +139 -9
  492. package/dist/tool-approval.d.ts +465 -507
  493. package/dist/tool-approval.js +606 -1222
  494. package/dist/trace/core-keyset-guard.d.ts +1 -1
  495. package/dist/trace/ledger-events.d.ts +3 -3
  496. package/dist/trace/project.d.ts +2 -3
  497. package/dist/trace/redact.js +3 -2
  498. package/dist/trace/self-minted-wire.d.ts +571 -178
  499. package/dist/trace/self-minted-wire.js +189 -56
  500. package/dist/web-admin-client/apply-effective.js +2 -2
  501. package/dist/web-admin-client/read-warnings.d.ts +2 -2
  502. package/dist/web-admin-client/read-warnings.js +1 -1
  503. package/dist/web-admin-client/types.d.ts +1 -1
  504. package/dist/workspace-space.d.ts +10 -4
  505. package/dist/workspace-space.js +4 -1
  506. package/docs/DEVICE-EXECUTOR-PROTOCOL.md +79 -28
  507. package/package.json +7 -3
  508. package/scripts/embed-minimal.mjs +3 -3
  509. package/wire-changes/server@7.151.0.json +762 -0
  510. package/wire-changes/server@7.152.0.json +900 -0
  511. package/dist/config-d-migration.d.ts +0 -37
  512. package/dist/config-d-migration.js +0 -60
  513. package/dist/http/session-inherit-env.d.ts +0 -36
  514. package/dist/http/session-inherit-env.js +0 -6
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Workspace persistence by **space** (k8s lane) — the closed word set, the defaults, the retention domain and
3
- * the policy shape (pure leaf: no value imports from this repo — only a node builtin — so `config.ts`, the capability fact and the adapter
4
- * in `plugins/` can all import it without a load cycle). The effective policy has ONE reading: the capability fact `workspaceSpace`
3
+ * the policy shape (pure leaf: its only value imports are a node builtin and the object-store name leaf `object-store-buckets.ts`, itself
4
+ * import-free — so `config.ts`, the capability fact, the boot bucket check and the adapter in `plugins/` can all import it without a load cycle). The effective policy has ONE reading: the capability fact `workspaceSpace`
5
5
  * (`src/capability-facts.ts`).
6
6
  *
7
7
  * The law (one fact, one seat): a k8s pod's `/workspace` is durable across runs as an object-store "space" owned by the
@@ -63,8 +63,14 @@ export interface WorkspaceSpacePolicy {
63
63
  export interface WorkspaceSyncCapability extends WorkspaceSpacePolicy {
64
64
  timeoutMs: number;
65
65
  }
66
- /** `WORKSPACE_SNAPSHOT_PREFIX` unset ⇒ this prefix (the first segment of every snapshot object key of both lanes). */
67
- export declare const WORKSPACE_SNAPSHOT_PREFIX_DEFAULT = "kata";
66
+ /**
67
+ * The key prefix of a k8s snapshot store — the ONE reading of `WORKSPACE_SNAPSHOT_PREFIX` (unset ⇒ `WORKSPACE_SNAPSHOT_PREFIX_DEFAULT`): the adapter
68
+ * signs every snapshot key under it, and the boot bucket check lists under it (`<prefix>/`), so the check asks for the same prefix the adapter writes —
69
+ * a credential whose listing is granted by prefix answers the check exactly as it answers the adapter. Its form is judged by {@link snapshotKeyPrefixProblem}.
70
+ */
71
+ export declare function workspaceSnapshotPrefixOf(store: {
72
+ readonly keyPrefix?: string;
73
+ } | undefined): string;
68
74
  /**
69
75
  * The ONE form of a snapshot-key segment — the partition (incarnation / session id), the snapshot id, the object name and each segment of
70
76
  * the key prefix all pass it before a key is signed: it starts with a letter or digit, then letters, digits, `.`, `_`, `-`. No `/`, no `..`,
@@ -1,4 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
+ import { WORKSPACE_SNAPSHOT_PREFIX_DEFAULT } from "./object-store-buckets.js";
2
3
  export const K8S_WORKSPACE_MOUNT_DEFAULT = "/workspace";
3
4
  export const WORKSPACE_PERSIST_WORDS = ["space", "off"];
4
5
  export const WORKSPACE_PERSIST_DEFAULT = "space";
@@ -9,7 +10,9 @@ export const WORKSPACE_SNAPSHOT_TIMEOUT_MS_RANGE = { min: 30_000, max: 3_600_000
9
10
  export function workspaceSnapshotTimeoutOf(lane) {
10
11
  return lane.workspaceSnapshotTimeoutMs ?? WORKSPACE_SNAPSHOT_TIMEOUT_MS_DEFAULT;
11
12
  }
12
- export const WORKSPACE_SNAPSHOT_PREFIX_DEFAULT = "kata";
13
+ export function workspaceSnapshotPrefixOf(store) {
14
+ return store?.keyPrefix ?? WORKSPACE_SNAPSHOT_PREFIX_DEFAULT;
15
+ }
13
16
  export const SNAPSHOT_KEY_SEGMENT = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
14
17
  export const WORKSPACE_SNAPSHOT_PREFIX_INVALID = "config.workspace_snapshot_prefix_invalid";
15
18
  export function snapshotKeyPrefixProblem(prefix) {
@@ -152,8 +152,9 @@ pre-auth frame closes the connection outright.
152
152
 
153
153
  **Which revision to declare.** `challenge.protocolVersion` is the highest protocol revision this server speaks
154
154
  (`DEVICE_MIN_PROTOCOL_VERSION` is the lowest it accepts, §2.1). Put the highest revision *you* implement that is
155
- not above `challenge.protocolVersion` into `hello.protocolVersion` — the same integer you sign (§1.3) — and emit
156
- only the `errorCode` words of that revision (the revision table in §2.1). Nothing is renegotiated after `hello`:
155
+ not above `challenge.protocolVersion` into `hello.protocolVersion` — the same integer you sign (§1.3) — declare in
156
+ `supports` only the instruction kinds of that revision, and emit only the `errorCode` words of that revision (the revision
157
+ table in §2.1). Nothing is renegotiated after `hello`:
157
158
  the revision you declared is the contract for the whole connection. If the highest revision you implement is below
158
159
  `DEVICE_MIN_PROTOCOL_VERSION`, the server answers `helloReject: protocol_version_unsupported` (§1.4).
159
160
  Revisions are cumulative on the executor's side: an executor that implements revision *N* implements every revision
@@ -249,7 +250,7 @@ sign exactly these bytes with the device's Ed25519 private key.
249
250
 
250
251
  | Code | Meaning | What the executor should do |
251
252
  |---|---|---|
252
- | `auth_failed` | deliberately ambiguous: unknown device id, malformed id, malformed epoch, bad signature, or the server's device registry was unreachable | do **not** hammer: back off exponentially. If it never clears, the enrollment is gone — re-enroll. The server will not tell you which of these it was (anti-enumeration) |
253
+ | `auth_failed` | deliberately ambiguous: unknown device id, malformed id, malformed epoch, bad signature, the server's device registry was unreachable, or — on a deployment that confines service principals — the device's owner is currently named in the operator roster's drain-only tier (a tier whose identity counts only on the drain endpoint, so it may not use the device lane; the device registration and the key stay valid) | do **not** hammer: back off exponentially, and never delete the key on `auth_failed` alone. If it never clears, the enrollment may be gone — re-enroll — unless the owner is confined as described: registering again under that identity is refused with `403 auth.principal_confined`, and the cure is on the operator's side. The server will not tell you which of these it was (anti-enumeration); the confinement cause is judged after the signature verifies, so only the holder of the device key can ever meet it. It is not terminal: when the owner is back in the ordinary tier (the deployment's roster is read at process start), the next reconnect succeeds, and the code set and the revision are unchanged |
253
254
  | `revoked` | this device has been revoked. Terminal | stop reconnecting, delete the private key, ask the user to re-enroll (it yields a new `deviceId`) |
254
255
  | `protocol_version_unsupported` | your `protocolVersion` is outside the range this server accepts; the frame carries `minProtocolVersion` and a one-line `message` that names your revision, the range and — below the floor — the change at the floor revision (§2.1) | upgrade the executor (`message` is fit to show as is). Never retry-with-a-different-version in a loop |
255
256
  | `draining` | this replica is shutting down or upgrading and takes no new connections | reconnect with backoff; a replacement replica will accept you |
@@ -345,7 +346,7 @@ base64 inside JSON fields.
345
346
  | Constant | Value | Meaning |
346
347
  |---|---|---|
347
348
  | `DEVICE_WS_PATH` | `/v1/device/ws` | the upgrade path (prefer the `wsPath` from `/v1/capabilities`) |
348
- | `DEVICE_PROTOCOL_VERSION` | `5` | the protocol revision this server speaks (the highest it accepts) |
349
+ | `DEVICE_PROTOCOL_VERSION` | `6` | the protocol revision this server speaks (the highest it accepts) |
349
350
  | `DEVICE_MIN_PROTOCOL_VERSION` | `5` | the lowest revision it accepts (the revision table says why); below it (or above the highest), a loud `helloReject` — never a silent downgrade |
350
351
  | `DEVICE_HELLO_DOMAIN_TAG` | `sema.device.hello.v1` | the handshake signature domain tag (§1.3) |
351
352
 
@@ -366,36 +367,43 @@ cap. An instruction whose frame would be over it is refused before dispatch (you
366
367
  chunks are sliced so that a chunk frame, base64 and envelope included, fits. You can therefore cap the frames you
367
368
  accept at `maxFrameBytes`.
368
369
 
369
- #### Protocol revisions and the `errorCode` set
370
+ #### Protocol revisions: the `errorCode` set and the instruction kinds
370
371
 
371
372
  The protocol revision is the only thing an executor can read *before* it sends `hello` (the `challenge` frame
372
373
  carries it), so everything you must know to be correct on this server is a function of the revision, not a
373
- separate list: the set of `errorCode` words the server accepts from you, and what the frames it sends you mean.
374
- The table gives, per revision, the words **added** at that revision and any other change made at it; the word set
375
- at revision *N* is the union of the rows up to *N*, and the full set at the current revision is the §3.3 table.
374
+ separate list: the set of `errorCode` words the server accepts from you, the set of instruction kinds it may send you,
375
+ and what the frames it sends you mean. The table gives, per revision, the words **added** to each set at that revision
376
+ and any other change made at it; a set at revision *N* is the union of its column's rows up to *N*, and the full sets at
377
+ the current revision are the §3.3 table (`errorCode`) and the §3.1 table (instruction kinds, in this order).
376
378
 
377
379
  <!-- closed-set: DEVICE_OUTCOME_ERROR_CODES_BY_REVISION -->
378
380
 
379
- | Revision | `errorCode` words added at this revision | Other change at this revision |
380
- |---|---|---|
381
- | `1` | `aborted`, `already_exists`, `auth_failed`, `callback_error`, `invalid`, `is_directory`, `not_directory`, `not_found`, `not_supported`, `outcome_unknown`, `permission_denied`, `precondition_failed`, `shell_unavailable`, `spawn_error`, `suspended`, `target_unavailable`, `timeout`, `transport_lost`, `unknown` | — |
382
- | `2` | `liveness_no_output` | — |
383
- | `3` | `name_too_long` | — |
384
- | `4` | `symlink_loop` | — |
385
- | `5` | — | every path an instruction carries (`args.path`, `args.paths`, `cwd`) arrives **unfolded** (since server 7.150.0): absolute as written, or anchored at the session's working directory, with `.` / `..` / empty segments kept — the server anchors and never folds. Resolve it as your filesystem does and judge containment on where it resolves (§3.1, §6 item 6). An executor written for revision 4 or below expects folded paths, so this is also the lowest revision the server accepts |
381
+ | Revision | `errorCode` words added at this revision | Instruction kinds added at this revision | Other change at this revision |
382
+ |---|---|---|---|
383
+ | `1` | `aborted`, `already_exists`, `auth_failed`, `callback_error`, `invalid`, `is_directory`, `not_directory`, `not_found`, `not_supported`, `outcome_unknown`, `permission_denied`, `precondition_failed`, `shell_unavailable`, `spawn_error`, `suspended`, `target_unavailable`, `timeout`, `transport_lost`, `unknown` | `exec`, `execStream`, `readTextFile`, `readTextLines`, `readBinaryFile`, `writeFile`, `writeFileExclusive`, `writeFileGuarded`, `appendFile`, `fileInfo`, `listDir`, `canonicalPath`, `exists`, `readLink`, `createDir`, `remove`, `createTempDir`, `createTempFile`, `statBatch` | — |
384
+ | `2` | `liveness_no_output` | — | — |
385
+ | `3` | `name_too_long` | — | — |
386
+ | `4` | `symlink_loop` | — | — |
387
+ | `5` | — | — | every path an instruction carries (`args.path`, `args.paths`, `cwd`) arrives **unfolded** (since server 7.150.0): absolute as written, or anchored at the session's working directory, with `.` / `..` / empty segments kept — the server anchors and never folds. Resolve it as your filesystem does and judge containment on where it resolves (§3.1, §6 item 6). An executor written for revision 4 or below expects folded paths, so this is also the lowest revision the server accepts |
388
+ | `6` | — | `openBound` | — |
386
389
 
387
390
  Rules: adding a frame or a field is additive and does not raise the revision. Every other change
388
- raises `DEVICE_PROTOCOL_VERSION` and adds a row here — a word added to a closed set the server *accepts from you*
389
- (today: the `errorCode` set; second column), or a **semantic change**, a change in what a frame the server sends you
390
- means (third column): a semantic change raises the revision. A released row never changes. When an executor written for
391
+ raises `DEVICE_PROTOCOL_VERSION` and adds a row here — a word added to either closed set of the instruction exchange:
392
+ an `errorCode` word the server *accepts from you* (second column) or an instruction kind the server *sends you*
393
+ (third column) — or a **semantic change**, a change in what a frame the server sends you means (fourth column):
394
+ a semantic change raises the revision. A released row never changes. The server sends a kind only on a connection
395
+ whose declared revision is at or above the row that added it, and only if that connection's `supports` declares it
396
+ (§3.2): a kind above your revision is never sent to you, so an executor written for the older revision still honors
397
+ the newer one and the lowest accepted revision stays where it was (revision 6 added `openBound`; a revision-5 executor
398
+ never receives it). When an executor written for
391
399
  an older revision cannot honor the change, the same release raises `DEVICE_MIN_PROTOCOL_VERSION` to the new
392
400
  revision, so such an executor is refused once at `hello` (§1.4) instead of failing call by call.
393
- Declare a revision as §1.2 says and send only the words of that revision: an executor
401
+ Declare a revision as §1.2 says and use only the words of that revision: an executor
394
402
  that declared revision 1 never sends `liveness_no_output` (the server does not police this per connection — it
395
403
  decodes every connection against the current revision's full set — but a word above your declared revision is outside
396
- your contract). The same sets are importable:
397
- `DEVICE_OUTCOME_ERROR_CODES_BY_REVISION` and `deviceOutcomeErrorCodesAt(revision)` from
398
- `@sema-agent/server/device-protocol`.
404
+ your contract), and a kind above your declared revision in `supports` is ignored like a word the server does not know.
405
+ The same sets are importable: `DEVICE_OUTCOME_ERROR_CODES_BY_REVISION` / `deviceOutcomeErrorCodesAt(revision)` and
406
+ `DEVICE_INSTRUCTION_KINDS_BY_REVISION` / `deviceInstructionKindsAt(revision)` from `@sema-agent/server/device-protocol`.
399
407
 
400
408
  ### 2.2 Device → server frames
401
409
 
@@ -532,6 +540,7 @@ entry can be asked again as written.
532
540
  | `createTempDir` | `{ prefix? }` | `{ok:true, kind:"write", canonicalPath}` | the created directory's path **is** the receipt |
533
541
  | `createTempFile` | `{ prefix?, suffix? }` | `{ok:true, kind:"write", canonicalPath}` | same |
534
542
  | `statBatch` | `{ paths: string[] }` | `{ok:true, kind:"stat", …}` | declared but **not dispatched today** (see §8) |
543
+ | `openBound` | `{ path, op, identity?, kind?, max? }` | per `op`: `open` / `size` / `list` ⇒ `{ok:true, kind:"stat", …}`, `readBytes` ⇒ `{ok:true, kind:"read"}` | **optional face**, revision 6 — a bound read: the object judged is the object read (§3.7) |
535
544
 
536
545
  The server checks the outcome *kind* against the instruction kind. Answering an `execStream` with
537
546
  `{ok:true, kind:"void"}` — a perfectly well-formed frame — is refused as a protocol violation and the
@@ -540,22 +549,26 @@ outcome are always accepted.
540
549
 
541
550
  ### 3.2 Declaring what you implement: `hello.supports`
542
551
 
543
- `supports` is a plain `string[]` of instruction kinds. The server intersects it with its own closed set;
544
- **a kind you do not declare is never dispatched to you**, and a call that needs it fails loudly with
545
- `not_supported` instead of silently doing something else. A kind the server does not recognize is simply
546
- ignored (that is how a newer executor talks to an older server without breaking it).
552
+ `supports` is a plain `string[]` of instruction kinds. The server intersects it with the kinds of the revision you declared
553
+ (§2.1); **a kind you do not declare is never dispatched to you**, and a call that needs it fails loudly with
554
+ `not_supported` instead of silently doing something else. A kind the server does not recognize — or one above the
555
+ revision you declared — is simply ignored (that is how a newer executor talks to an older server without breaking it).
547
556
 
548
- Three faces are **presence-typed**, which is a stronger statement than "optional":
557
+ Four faces are **presence-typed**, which is a stronger statement than "optional":
549
558
 
550
559
  - `writeFileExclusive` — atomic create-if-absent
551
560
  - `writeFileGuarded` — verify-and-write in one atomic step
552
561
  - `readLink` — read a symlink target
562
+ - `openBound` — a bound read (§3.7): every answer is about the object that was opened and checked
553
563
 
554
564
  The engine decides *at environment-construction time* whether these exist, and when they do not it
555
565
  degrades honestly (an advisory check instead of an atomic one). **Therefore: absence is absence. Never
556
566
  emulate a guarded or exclusive write with a two-step "check then write".** A two-step emulation reopens
557
567
  exactly the race the atomic primitive exists to close, while wearing the face of an atomic operation —
558
- which is worse than not having it, because nothing downstream can tell.
568
+ which is worse than not having it, because nothing downstream can tell. The same holds for `openBound`:
569
+ **never emulate it with `fileInfo` + `readBinaryFile`** (two path reads cannot tell that the bytes came from the
570
+ object that was judged); without it, the engine simply does not bind a read on this device (a path attachment is
571
+ accepted and reported `not_attached`).
559
572
 
560
573
  Two more consequences you must design for:
561
574
 
@@ -712,8 +725,45 @@ side**. Verifying with `stat` and then writing is exactly the emulation that is
712
725
  - `readLink` — optional but strongly recommended: it is the fourth governance read, and its absence makes
713
726
  symlink adjudication coarser.
714
727
  - `writeFileExclusive`, `writeFileGuarded` — optional; implement them only if you can do them atomically.
728
+ - `openBound` — optional (revision 6); without it a path attachment on this device is accepted but not attached (§3.7).
715
729
  - `statBatch` — safe to omit today.
716
730
 
731
+
732
+ ### 3.7 `openBound` and its four answers
733
+
734
+ `openBound` is a revision-6 kind: the server sends it only on a connection whose `hello.protocolVersion` is 6 or above
735
+ **and** whose `supports` declares it. On a revision-5 connection the face is absent, exactly as if you had not declared
736
+ it (the engine does not bind a read; a path attachment is reported `not_attached`).
737
+
738
+ The protocol has no handle that lives across instructions, so the engine's bound-read object is answered one
739
+ instruction per answer. Every `openBound` instruction is a **complete rebinding**: open `path` locally (do not
740
+ follow a final symbolic link), ask the kernel **once, through that open**, which path the opened object now has and
741
+ what it is, answer **through that same open**, then close it. Never read the path a second time to answer.
742
+
743
+ <!-- closed-set: DEVICE_BOUND_READ_OPS -->
744
+
745
+ | `op` | Carries | Answer with | Refuse with |
746
+ |---|---|---|---|
747
+ | `open` | `path` | `{ok:true, kind:"stat", identity, info}` — `identity` = the opened object's `<device>:<inode>`; `info.kind` is `file` or `dir` | `precondition_failed` (the final component is a link, or the opened object is not at `path`); `invalid` (neither a regular file nor a directory) |
748
+ | `size` | `path`, `identity`, `kind` | `{ok:true, kind:"stat", info}` — `info.size` = the current size | `precondition_failed` when the object opened now is not `identity` / `kind` or not at `path` |
749
+ | `readBytes` | `path`, `identity`, `kind`, `max` | `{ok:true, kind:"read"}`, the bytes as `data` chunks | as `size`, plus `invalid` when the file is over `max` bytes when the read starts (read nothing) |
750
+ | `list` | `path`, `identity`, `kind` | `{ok:true, kind:"stat", entries}` — the opened directory's direct children, links not followed; the server reads only each entry's leaf name | as `size` |
751
+
752
+ Rules:
753
+
754
+ - **One observation per answer.** The check that the opened object is at `path` must be a single observation of
755
+ that open (Linux: `readlink("/proc/self/fd/<fd>")`; macOS: an open with `O_NOFOLLOW_ANY` refuses a link on any
756
+ component, so the open itself is the observation). Separate `fstat` / `lstat` / `realpath` calls are three
757
+ observations that a directory swapped in and out between them gets through. If your platform cannot give one
758
+ observation, answer `not_supported` — the engine reads that as "this face is absent here".
759
+ - **Identity and kind both.** For `size` / `readBytes` / `list`, the object you opened must equal both `identity`
760
+ and `kind` from the `open` answer, else `precondition_failed`. Two opens whose identities are equal do not prove
761
+ they opened one object after an inode number was reused; that residue is accepted by the engine's contract.
762
+ - **Bounded.** An open can block (a FIFO swapped in under the path); the whole answer must finish within the
763
+ instruction's `timeoutMs` and your executor must not leave the blocked open behind.
764
+ - **No privilege above the session's own commands.** Open as the same user that runs the session's `exec`.
765
+ - Error codes are the words of your declared revision (§2.1); nothing new is needed.
766
+
717
767
  ---
718
768
 
719
769
  ## 4. Streaming execution
@@ -1055,6 +1105,7 @@ These two are a real distinction to the caller: `not_started` is safely retryabl
1055
1105
 
1056
1106
  - [ ] `readLink` (recommended soon after — it is the fourth governance read)
1057
1107
  - [ ] `writeFileExclusive`, `writeFileGuarded` — declare only when atomic (§3.2)
1108
+ - [ ] `openBound` — declare only with one observation per answer, and only when you declare revision 6 or above (§3.7)
1058
1109
  - [ ] `statBatch` — not dispatched today
1059
1110
 
1060
1111
  **Process shape (recommended)**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/server",
3
- "version": "7.150.0",
3
+ "version": "7.152.0",
4
4
  "description": "Sema Server — the server/API implementation layer for Sema, wiring core, registry, model providers, and cloud agent execution. Built on @sema-agent/core.",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",
@@ -25,6 +25,10 @@
25
25
  "types": "./dist/model-route-env.d.ts",
26
26
  "default": "./dist/model-route-env.js"
27
27
  },
28
+ "./object-store-buckets": {
29
+ "types": "./dist/object-store-buckets.d.ts",
30
+ "default": "./dist/object-store-buckets.js"
31
+ },
28
32
  "./package.json": "./package.json",
29
33
  "./deploy/sema-up/lanes.json": "./deploy/sema-up/lib/lanes.json",
30
34
  "./deploy/facts/CHANGES.json": "./deploy/facts/CHANGES.json",
@@ -83,8 +87,8 @@
83
87
  },
84
88
  "dependencies": {
85
89
  "@modelcontextprotocol/server": "2.4.0",
86
- "@sema-agent/core": "7.66.0",
87
- "@sema-agent/settings-schema": "25.1.0",
90
+ "@sema-agent/core": "7.66.1",
91
+ "@sema-agent/settings-schema": "26.0.0",
88
92
  "e2b": "2.36.0",
89
93
  "libsodium-wrappers": "0.8.4",
90
94
  "mysql2": "3.22.6",
@@ -10,7 +10,7 @@
10
10
  // and a clean-up that did not happen is `failed step=cleanup` — neither is ever reported as a refusal of the omitted seat.
11
11
  //
12
12
  // The assembly order is the README "Library embedding" chain: `declareServerWithheldEnv()` → `loadConfig()` → `composeExecutionLane(config, ctx)` →
13
- // `judgeServedModelRoute(config, { envTableIsPlaceholder })` (the route judge, once after the config-source apply; `loadConfig()` does not judge routes) →
13
+ // `judgeServedModelRoute(config, { envTableIsPlaceholder, webAdminIsConfigSource })` (the route judge, once after the config-source apply; `loadConfig()` does not judge routes) →
14
14
  // the nine required `createHttpServer` seats (the type `ServiceCoreDeps`) → `createHttpServer(deps)`. It imports the package root `@sema-agent/server` and the
15
15
  // engine package `@sema-agent/core` (the server's pinned dependency, owner of the `Runner` class), never a path inside `dist/`.
16
16
  // The service it assembles runs on the host lane against a throwaway local data root and listens on a kernel-assigned loopback port; it takes no task,
@@ -84,8 +84,8 @@ try {
84
84
  const logger = createLogger("error");
85
85
  const config = await composeExecutionLane(loadConfig(), { configSource: undefined, localRoot: dataRoot, logger, entry: HTTP_SERVICE_LANE_ENTRY });
86
86
  // The route judge runs after the config-source apply, never inside `loadConfig()`: a model row with no endpoint would otherwise travel to the first model call.
87
- // No center here ⇒ the env table is the served table, not a placeholder awaiting a catalog.
88
- const routeGap = judgeServedModelRoute(config, { envTableIsPlaceholder: false });
87
+ // No center here ⇒ the env table is the served table, not a placeholder awaiting a catalog; and no web-admin config source either (`configSource: undefined` above).
88
+ const routeGap = judgeServedModelRoute(config, { envTableIsPlaceholder: false, webAdminIsConfigSource: false });
89
89
  if (routeGap !== undefined) throw new Error(routeGap.reason);
90
90
 
91
91
  // ── seats: peerDesk, deploymentMods (package root: createPeerDesk; `[]` = no mods) ────────────────────────────────────────────────────────