@sema-agent/server 7.138.0 → 7.140.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 (332) hide show
  1. package/MIGRATION.md +457 -7
  2. package/README.md +7 -4
  3. package/README.zh-CN.md +6 -4
  4. package/USAGE.md +91 -41
  5. package/deploy/sema-up/README.md +1 -1
  6. package/deploy/sema-up/lib/lanes.json +3 -2
  7. package/dist/adoption/runner.js +1 -1
  8. package/dist/adoption/sql.js +1 -1
  9. package/dist/adoption/wire.d.ts +3 -3
  10. package/dist/approval-card.d.ts +26 -26
  11. package/dist/bench/s1/arms.d.ts +1 -1
  12. package/dist/bench/s1/arms.js +1 -3
  13. package/dist/bench/s1/live-deps.js +3 -2
  14. package/dist/bench/s1/row.d.ts +5 -2
  15. package/dist/bench/s1/row.js +2 -22
  16. package/dist/bench/s1/run-firm.js +2 -2
  17. package/dist/boot/adoption.js +1 -1
  18. package/dist/boot/device-lane.d.ts +8 -3
  19. package/dist/boot/device-lane.js +7 -2
  20. package/dist/boot/execution-env.d.ts +4 -2
  21. package/dist/boot/execution-env.js +28 -34
  22. package/dist/boot/execution-lane.d.ts +9 -1
  23. package/dist/boot/execution-lane.js +6 -1
  24. package/dist/boot/governance-seams.d.ts +3 -2
  25. package/dist/boot/governance-seams.js +9 -11
  26. package/dist/boot/memory-boundary.d.ts +14 -51
  27. package/dist/boot/memory-boundary.js +10 -20
  28. package/dist/boot/memory-consolidation.d.ts +15 -11
  29. package/dist/boot/memory-consolidation.js +25 -14
  30. package/dist/boot/resolve-spec.d.ts +4 -6
  31. package/dist/boot/resolve-spec.js +10 -13
  32. package/dist/boot/retention-lane.d.ts +5 -5
  33. package/dist/boot/retention-lane.js +0 -6
  34. package/dist/boot/runner-deps.d.ts +6 -4
  35. package/dist/boot/runner-deps.js +3 -1
  36. package/dist/boot/session-faces.d.ts +0 -3
  37. package/dist/boot/session-faces.js +15 -8
  38. package/dist/boot/stage-02-web-admin-pull.js +2 -2
  39. package/dist/boot/stage-03-store-backend.d.ts +2 -6
  40. package/dist/boot/stage-03-store-backend.js +2 -3
  41. package/dist/boot/stage-04-stores.d.ts +2 -6
  42. package/dist/boot/stage-04-stores.js +5 -5
  43. package/dist/boot/stage-05-execution-env.d.ts +2 -6
  44. package/dist/boot/stage-05-execution-env.js +2 -2
  45. package/dist/boot/stage-06-runners.d.ts +2 -6
  46. package/dist/boot/stage-06-runners.js +2 -3
  47. package/dist/boot/stage-07-capability-layer.d.ts +2 -6
  48. package/dist/boot/stage-08-reapers.d.ts +2 -6
  49. package/dist/boot/stage-09-leader.d.ts +2 -6
  50. package/dist/boot/stage-09-leader.js +1 -2
  51. package/dist/boot/stage-10-http-server.d.ts +2 -6
  52. package/dist/boot/stage-10-http-server.js +7 -6
  53. package/dist/boot/stores.d.ts +3 -6
  54. package/dist/boot/stores.js +27 -40
  55. package/dist/boot/task-list-lane.d.ts +1 -1
  56. package/dist/boot/task-list-lane.js +1 -1
  57. package/dist/boot/web-admin.js +37 -11
  58. package/dist/capabilities/execution-lane.d.ts +2 -2
  59. package/dist/capabilities/mcp-probe.js +1 -1
  60. package/dist/capabilities/scenarios.d.ts +1 -1
  61. package/dist/capability-facts.d.ts +15 -7
  62. package/dist/capability-facts.js +8 -3
  63. package/dist/config-catalog.js +9 -8
  64. package/dist/config-invariants.d.ts +23 -3
  65. package/dist/config-invariants.js +42 -0
  66. package/dist/config-provider.d.ts +33 -37
  67. package/dist/config-provider.js +51 -30
  68. package/dist/config-types.d.ts +21 -7
  69. package/dist/config.d.ts +33 -0
  70. package/dist/config.js +46 -16
  71. package/dist/delegated-session-owner.d.ts +4 -3
  72. package/dist/delegated-session-owner.js +1 -1
  73. package/dist/deployment-shape.d.ts +10 -9
  74. package/dist/deployment-shape.js +4 -4
  75. package/dist/device-enrollment.d.ts +41 -2
  76. package/dist/device-enrollment.js +27 -12
  77. package/dist/device-store.d.ts +58 -85
  78. package/dist/device-store.js +19 -49
  79. package/dist/device-ws-hub.js +2 -1
  80. package/dist/env-name-allowlist-knobs.d.ts +5 -4
  81. package/dist/exec-cut.d.ts +60 -0
  82. package/dist/exec-cut.js +36 -0
  83. package/dist/execution-lane-caps.d.ts +115 -105
  84. package/dist/execution-lane-caps.js +76 -82
  85. package/dist/execution-placement.d.ts +259 -0
  86. package/dist/execution-placement.js +199 -0
  87. package/dist/field-conflict.d.ts +3 -2
  88. package/dist/field-conflict.js +1 -0
  89. package/dist/hosted-posture.d.ts +2 -2
  90. package/dist/http/admission.js +8 -19
  91. package/dist/http/checkpoint-ctx.d.ts +21 -12
  92. package/dist/http/checkpoint-ctx.js +4 -2
  93. package/dist/http/claimed-run.d.ts +1 -1
  94. package/dist/http/durable-run-leg.js +9 -5
  95. package/dist/http/execution-context.d.ts +218 -0
  96. package/dist/http/execution-context.js +330 -0
  97. package/dist/http/memory-compliance-failure-reply.d.ts +3 -1
  98. package/dist/http/memory-compliance-failure-reply.js +5 -0
  99. package/dist/http/memory-layer-reply.d.ts +30 -0
  100. package/dist/http/memory-layer-reply.js +24 -0
  101. package/dist/http/resume-legs.js +63 -36
  102. package/dist/http/retired-service-deps.d.ts +1 -1
  103. package/dist/http/retired-service-deps.js +1 -1
  104. package/dist/http/route-ctx.d.ts +14 -8
  105. package/dist/http/routes/adoption.js +1 -1
  106. package/dist/http/routes/background.d.ts +29 -1
  107. package/dist/http/routes/background.js +29 -2
  108. package/dist/http/routes/devices.d.ts +13 -19
  109. package/dist/http/routes/devices.js +21 -26
  110. package/dist/http/routes/memory-bundle.js +3 -0
  111. package/dist/http/routes/memory-compliance.js +8 -1
  112. package/dist/http/routes/memory-consolidation.js +12 -1
  113. package/dist/http/routes/memory-origin.js +14 -2
  114. package/dist/http/routes/memory-policy.js +5 -0
  115. package/dist/http/routes/session-sync.js +110 -15
  116. package/dist/http/routes/sessions.d.ts +6 -0
  117. package/dist/http/routes/sessions.js +143 -22
  118. package/dist/http/routes/side-query.d.ts +12 -4
  119. package/dist/http/routes/side-query.js +4 -5
  120. package/dist/http/routes/tasks.js +41 -33
  121. package/dist/http/server.d.ts +40 -44
  122. package/dist/http/server.js +13 -2
  123. package/dist/http/session-inherit-env.d.ts +3 -4
  124. package/dist/http/session-inherit-env.js +1 -1
  125. package/dist/http/wire-types.d.ts +8 -12
  126. package/dist/identity-source.d.ts +1 -1
  127. package/dist/identity-source.js +1 -1
  128. package/dist/index.d.ts +1 -0
  129. package/dist/lane-home-probe.d.ts +68 -42
  130. package/dist/lane-home-probe.js +53 -30
  131. package/dist/leader/wire.js +5 -4
  132. package/dist/memory-bundle-engine.d.ts +16 -9
  133. package/dist/memory-bundle-engine.js +29 -6
  134. package/dist/memory-operator-faces.d.ts +85 -30
  135. package/dist/memory-operator-faces.js +136 -30
  136. package/dist/memory-project-layer.d.ts +3 -21
  137. package/dist/memory-project-layer.js +11 -8
  138. package/dist/memory-scope-stores.d.ts +73 -0
  139. package/dist/memory-scope-stores.js +86 -0
  140. package/dist/memory-scope.d.ts +29 -5
  141. package/dist/memory-scope.js +16 -4
  142. package/dist/memory-sync-client.d.ts +70 -18
  143. package/dist/memory-sync-client.js +215 -117
  144. package/dist/memory-sync.d.ts +1 -1
  145. package/dist/memory-sync.js +3 -2
  146. package/dist/observability/cost-taxonomy.d.ts +2 -2
  147. package/dist/observability/fail-open.d.ts +12 -0
  148. package/dist/observability/fail-open.js +12 -0
  149. package/dist/observability/run-terminal.js +0 -1
  150. package/dist/orchestration/workflow-notify-journal.js +4 -4
  151. package/dist/org-memory-admission.d.ts +4 -3
  152. package/dist/org-memory-admission.js +6 -6
  153. package/dist/parked-decide.d.ts +34 -9
  154. package/dist/parked-decide.js +12 -19
  155. package/dist/parked-revive-surface.d.ts +12 -15
  156. package/dist/parked-revive-surface.js +3 -6
  157. package/dist/peer-seat.d.ts +13 -7
  158. package/dist/peer-seat.js +37 -3
  159. package/dist/plugins/adoption-log-sql.js +4 -4
  160. package/dist/plugins/approval-ask-store-file.d.ts +7 -0
  161. package/dist/plugins/approval-ask-store-file.js +11 -0
  162. package/dist/plugins/approval-ask-store-memory.d.ts +6 -0
  163. package/dist/plugins/approval-ask-store-memory.js +12 -0
  164. package/dist/plugins/approval-ask-store-sql.d.ts +22 -5
  165. package/dist/plugins/approval-ask-store-sql.js +44 -26
  166. package/dist/plugins/approval-nonce-store.js +4 -4
  167. package/dist/plugins/blob-backend.d.ts +4 -4
  168. package/dist/plugins/blob-backend.js +7 -7
  169. package/dist/plugins/breaker-state-sql.js +2 -2
  170. package/dist/plugins/caching-session-store.d.ts +6 -2
  171. package/dist/plugins/caching-session-store.js +9 -3
  172. package/dist/plugins/checkpoint-index-columns.js +2 -2
  173. package/dist/plugins/checkpoint-store-sql.d.ts +6 -5
  174. package/dist/plugins/checkpoint-store-sql.js +21 -23
  175. package/dist/plugins/device-store-sql.d.ts +25 -51
  176. package/dist/plugins/device-store-sql.js +68 -122
  177. package/dist/plugins/ensure-index.d.ts +1 -2
  178. package/dist/plugins/execution-placement-sql.d.ts +151 -0
  179. package/dist/plugins/execution-placement-sql.js +223 -0
  180. package/dist/plugins/file-history-store-sql.d.ts +9 -8
  181. package/dist/plugins/file-history-store-sql.js +9 -9
  182. package/dist/plugins/file-run-store.d.ts +6 -1
  183. package/dist/plugins/file-run-store.js +4 -0
  184. package/dist/plugins/fork-routing-session-store.d.ts +6 -0
  185. package/dist/plugins/fork-routing-session-store.js +16 -0
  186. package/dist/plugins/image-bake-store-sql.js +9 -9
  187. package/dist/plugins/image-index-sql.js +11 -11
  188. package/dist/plugins/leader-run-store-sql.js +4 -4
  189. package/dist/plugins/local-session-store.d.ts +149 -50
  190. package/dist/plugins/local-session-store.js +382 -107
  191. package/dist/plugins/mailbox-store-sql.d.ts +2 -1
  192. package/dist/plugins/mailbox-store-sql.js +4 -4
  193. package/dist/plugins/memory-engine-tidb.js +5 -5
  194. package/dist/plugins/memory-key-guards.d.ts +4 -0
  195. package/dist/plugins/memory-key-guards.js +1 -0
  196. package/dist/plugins/memory-optout-grant-store-sql.js +1 -1
  197. package/dist/plugins/memory-run-store.d.ts +1 -1
  198. package/dist/plugins/memory-sync-store-tidb.js +3 -3
  199. package/dist/plugins/one-time-migrations.d.ts +117 -8
  200. package/dist/plugins/one-time-migrations.js +408 -38
  201. package/dist/plugins/org-delivery-quota-store.js +2 -2
  202. package/dist/plugins/outcome-ledger-sql.d.ts +2 -2
  203. package/dist/plugins/outcome-ledger-sql.js +2 -2
  204. package/dist/plugins/permission-rule-store-sql.d.ts +17 -19
  205. package/dist/plugins/permission-rule-store-sql.js +29 -32
  206. package/dist/plugins/pg-pool.d.ts +7 -3
  207. package/dist/plugins/pg-session-storage.d.ts +31 -20
  208. package/dist/plugins/pg-session-storage.js +120 -52
  209. package/dist/plugins/remote-env-adb.d.ts +18 -19
  210. package/dist/plugins/remote-env-adb.js +91 -66
  211. package/dist/plugins/remote-env-device.d.ts +23 -31
  212. package/dist/plugins/remote-env-device.js +19 -17
  213. package/dist/plugins/remote-env-e2b.d.ts +27 -21
  214. package/dist/plugins/remote-env-e2b.js +91 -45
  215. package/dist/plugins/remote-env-file-error.d.ts +3 -1
  216. package/dist/plugins/remote-env-file-error.js +9 -3
  217. package/dist/plugins/remote-env-host.d.ts +31 -34
  218. package/dist/plugins/remote-env-host.js +91 -72
  219. package/dist/plugins/remote-env-k8s.d.ts +13 -29
  220. package/dist/plugins/remote-env-k8s.js +63 -55
  221. package/dist/plugins/remote-env-local-docker.d.ts +24 -12
  222. package/dist/plugins/remote-env-local-docker.js +49 -61
  223. package/dist/plugins/remote-env-ssh.d.ts +11 -19
  224. package/dist/plugins/remote-env-ssh.js +74 -57
  225. package/dist/plugins/remote-shell.d.ts +100 -3
  226. package/dist/plugins/remote-shell.js +166 -2
  227. package/dist/plugins/resume-anchor-store-sql.js +2 -2
  228. package/dist/plugins/retention-lane-store-sql.d.ts +1 -1
  229. package/dist/plugins/retention-lane-store-sql.js +2 -2
  230. package/dist/plugins/retention-store-sql.d.ts +10 -7
  231. package/dist/plugins/retention-store-sql.js +13 -7
  232. package/dist/plugins/run-store-sql.d.ts +13 -3
  233. package/dist/plugins/run-store-sql.js +20 -15
  234. package/dist/plugins/schema-consistency.d.ts +21 -11
  235. package/dist/plugins/schema-consistency.js +15 -9
  236. package/dist/plugins/schema-drift-sentence.d.ts +27 -0
  237. package/dist/plugins/schema-drift-sentence.js +38 -0
  238. package/dist/plugins/schema-ensure-legs.d.ts +2 -3
  239. package/dist/plugins/schema-ensure-legs.js +2 -2
  240. package/dist/plugins/schema-live-columns.d.ts +1 -1
  241. package/dist/plugins/session-capture-record-store-sql.js +1 -1
  242. package/dist/plugins/session-fork.d.ts +54 -0
  243. package/dist/plugins/session-fork.js +38 -1
  244. package/dist/plugins/session-row-sql.d.ts +22 -0
  245. package/dist/plugins/session-row-sql.js +81 -0
  246. package/dist/plugins/session-rules-column.d.ts +1 -1
  247. package/dist/plugins/session-rules-column.js +1 -1
  248. package/dist/plugins/session-store.d.ts +1 -1
  249. package/dist/plugins/session-workspace-cell.d.ts +1 -1
  250. package/dist/plugins/session-workspace-cell.js +1 -1
  251. package/dist/plugins/shared-memory-store-sql.js +2 -2
  252. package/dist/plugins/sql-driver.d.ts +10 -5
  253. package/dist/plugins/sql-driver.js +6 -6
  254. package/dist/plugins/sql-errors.js +1 -1
  255. package/dist/plugins/store-backend.d.ts +5 -7
  256. package/dist/plugins/store-backend.js +23 -11
  257. package/dist/plugins/store-contracts.d.ts +25 -5
  258. package/dist/plugins/task-list-store-sql.js +11 -11
  259. package/dist/plugins/tidb-pool.d.ts +12 -7
  260. package/dist/plugins/tidb-pool.js +13 -7
  261. package/dist/plugins/tidb-session-storage.js +4 -4
  262. package/dist/plugins/tidb-session-store.d.ts +57 -26
  263. package/dist/plugins/tidb-session-store.js +127 -59
  264. package/dist/plugins/tool-result-store-sql.d.ts +5 -4
  265. package/dist/plugins/tool-result-store-sql.js +21 -13
  266. package/dist/plugins/user-input-ledger-sql.js +2 -2
  267. package/dist/plugins/workflow-journal-store-sql.js +5 -5
  268. package/dist/plugins/workflow-run-store-sql.js +19 -19
  269. package/dist/plugins/write-behind-counter.d.ts +2 -3
  270. package/dist/plugins/write-behind-counter.js +5 -5
  271. package/dist/project-memory.d.ts +9 -15
  272. package/dist/project-memory.js +5 -4
  273. package/dist/request-key-closure.js +1 -1
  274. package/dist/request-value-closure.d.ts +6 -7
  275. package/dist/request-value-closure.js +1 -3
  276. package/dist/resource-suspend.d.ts +14 -12
  277. package/dist/resource-suspend.js +1 -1
  278. package/dist/resource-window.d.ts +4 -3
  279. package/dist/run-local.d.ts +6 -0
  280. package/dist/run-local.js +34 -35
  281. package/dist/runs.d.ts +10 -5
  282. package/dist/runs.js +52 -66
  283. package/dist/security.d.ts +38 -12
  284. package/dist/security.js +8 -2
  285. package/dist/server-secret-env.d.ts +9 -5
  286. package/dist/session-children-retire.d.ts +27 -9
  287. package/dist/session-children-retire.js +9 -5
  288. package/dist/session-incarnation.d.ts +20 -10
  289. package/dist/session-incarnation.js +5 -3
  290. package/dist/session-policy-wire.d.ts +1 -1
  291. package/dist/session-row.d.ts +114 -5
  292. package/dist/session-row.js +55 -5
  293. package/dist/session-titler.d.ts +2 -2
  294. package/dist/sql-engine-posture.d.ts +1 -1
  295. package/dist/sql-engine-posture.js +1 -1
  296. package/dist/{plugins → stores-sql}/background-agent-store-sql.d.ts +2 -2
  297. package/dist/{plugins → stores-sql}/background-agent-store-sql.js +8 -8
  298. package/dist/{plugins → stores-sql}/session-policy-store-sql.d.ts +7 -5
  299. package/dist/{plugins → stores-sql}/session-policy-store-sql.js +12 -12
  300. package/dist/{plugins → stores-sql}/usage-window-store-sql.d.ts +1 -1
  301. package/dist/{plugins → stores-sql}/usage-window-store-sql.js +3 -3
  302. package/dist/task-a2a.d.ts +1 -1
  303. package/dist/task-a2a.js +5 -6
  304. package/dist/task-cwd.d.ts +6 -1
  305. package/dist/task-mcp.d.ts +22 -9
  306. package/dist/task-mcp.js +17 -9
  307. package/dist/terminal.d.ts +27 -0
  308. package/dist/terminal.js +6 -0
  309. package/dist/tool-approval.d.ts +6 -0
  310. package/dist/tool-approval.js +8 -1
  311. package/dist/trace/project.d.ts +1 -0
  312. package/dist/trace/project.js +1 -0
  313. package/dist/trace/redact.d.ts +3 -1
  314. package/dist/trace/redact.js +80 -28
  315. package/dist/trace/self-minted-wire.d.ts +169 -2
  316. package/dist/trace/self-minted-wire.js +54 -1
  317. package/dist/url-refusal.d.ts +1 -1
  318. package/dist/web-admin-client/apply-effective.d.ts +17 -3
  319. package/dist/web-admin-client/apply-effective.js +20 -10
  320. package/dist/web-admin-client/candidate-gate.d.ts +11 -7
  321. package/dist/web-admin-client/candidate-gate.js +1 -1
  322. package/dist/web-admin-client/http-client.d.ts +5 -4
  323. package/dist/web-admin-client/http-client.js +2 -2
  324. package/dist/web-admin-client/read-warnings.d.ts +7 -17
  325. package/dist/web-admin-client/read-warnings.js +5 -9
  326. package/dist/web-admin-client/skills-mcp.js +3 -2
  327. package/dist/web-admin-client/types.d.ts +6 -0
  328. package/package.json +3 -3
  329. package/wire-changes/server@7.139.0.json +348 -0
  330. package/wire-changes/server@7.140.0.json +184 -0
  331. package/dist/http/device-placement.d.ts +0 -175
  332. package/dist/http/device-placement.js +0 -145
@@ -83,10 +83,10 @@ export declare const RuleOfferSchema: z.ZodUnion<readonly [z.ZodObject<{
83
83
  kind: z.ZodLiteral<"single">;
84
84
  rule: z.ZodString;
85
85
  match: z.ZodEnum<{
86
- name: "name";
87
- tool: "tool";
88
86
  host: "host";
87
+ name: "name";
89
88
  path: "path";
89
+ tool: "tool";
90
90
  exact: "exact";
91
91
  pattern: "pattern";
92
92
  prefix: "prefix";
@@ -102,10 +102,10 @@ export declare const RuleOfferSchema: z.ZodUnion<readonly [z.ZodObject<{
102
102
  kind: z.ZodLiteral<"command">;
103
103
  rule: z.ZodString;
104
104
  match: z.ZodEnum<{
105
- name: "name";
106
- tool: "tool";
107
105
  host: "host";
106
+ name: "name";
108
107
  path: "path";
108
+ tool: "tool";
109
109
  exact: "exact";
110
110
  pattern: "pattern";
111
111
  prefix: "prefix";
@@ -554,21 +554,21 @@ export declare const ApprovalCardSchema: z.ZodObject<{
554
554
  rememberRefused: z.ZodOptional<z.ZodLiteral<true>>;
555
555
  approvalCard: z.ZodOptional<z.ZodEnum<{
556
556
  question: "question";
557
- skill: "skill";
558
557
  plan: "plan";
559
- shell: "shell";
558
+ skill: "skill";
560
559
  workflow: "workflow";
561
- fetch: "fetch";
562
- "file-write": "file-write";
563
560
  "file-edit": "file-edit";
561
+ "file-write": "file-write";
564
562
  "notebook-edit": "notebook-edit";
563
+ shell: "shell";
564
+ fetch: "fetch";
565
565
  generic: "generic";
566
566
  }>>;
567
567
  inputHasBidi: z.ZodOptional<z.ZodLiteral<true>>;
568
568
  allowRuleShadowed: z.ZodOptional<z.ZodArray<z.ZodObject<{
569
569
  member: z.ZodEnum<{
570
- skill: "skill";
571
570
  hook: "hook";
571
+ skill: "skill";
572
572
  deployment: "deployment";
573
573
  request: "request";
574
574
  persisted: "persisted";
@@ -580,10 +580,10 @@ export declare const ApprovalCardSchema: z.ZodObject<{
580
580
  kind: z.ZodLiteral<"single">;
581
581
  rule: z.ZodString;
582
582
  match: z.ZodEnum<{
583
- name: "name";
584
- tool: "tool";
585
583
  host: "host";
584
+ name: "name";
586
585
  path: "path";
586
+ tool: "tool";
587
587
  exact: "exact";
588
588
  pattern: "pattern";
589
589
  prefix: "prefix";
@@ -599,10 +599,10 @@ export declare const ApprovalCardSchema: z.ZodObject<{
599
599
  kind: z.ZodLiteral<"command">;
600
600
  rule: z.ZodString;
601
601
  match: z.ZodEnum<{
602
- name: "name";
603
- tool: "tool";
604
602
  host: "host";
603
+ name: "name";
605
604
  path: "path";
605
+ tool: "tool";
606
606
  exact: "exact";
607
607
  pattern: "pattern";
608
608
  prefix: "prefix";
@@ -669,8 +669,8 @@ export declare const ApprovalCardSchema: z.ZodObject<{
669
669
  }, z.core.$strict>>>;
670
670
  personalRuleDotsAbsent: z.ZodOptional<z.ZodCustom<AskEvidenceAbsence, AskEvidenceAbsence>>;
671
671
  }, z.core.$strict>>;
672
- askClass: z.ZodOptional<z.ZodCustom<"probe" | "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", "probe" | "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary">>;
673
- classes: z.ZodOptional<z.ZodArray<z.ZodCustom<"probe" | "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", "probe" | "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary">>>;
672
+ askClass: z.ZodOptional<z.ZodCustom<"mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary">>;
673
+ classes: z.ZodOptional<z.ZodArray<z.ZodCustom<"mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary">>>;
674
674
  fromSubagent: z.ZodOptional<z.ZodLiteral<true>>;
675
675
  sourceTaskId: z.ZodOptional<z.ZodString>;
676
676
  sourceAgentName: z.ZodOptional<z.ZodString>;
@@ -708,21 +708,21 @@ export declare const ApprovalCardEnvelopeSchema: z.ZodObject<{
708
708
  rememberRefused: z.ZodOptional<z.ZodLiteral<true>>;
709
709
  approvalCard: z.ZodOptional<z.ZodEnum<{
710
710
  question: "question";
711
- skill: "skill";
712
711
  plan: "plan";
713
- shell: "shell";
712
+ skill: "skill";
714
713
  workflow: "workflow";
715
- fetch: "fetch";
716
- "file-write": "file-write";
717
714
  "file-edit": "file-edit";
715
+ "file-write": "file-write";
718
716
  "notebook-edit": "notebook-edit";
717
+ shell: "shell";
718
+ fetch: "fetch";
719
719
  generic: "generic";
720
720
  }>>;
721
721
  inputHasBidi: z.ZodOptional<z.ZodLiteral<true>>;
722
722
  allowRuleShadowed: z.ZodOptional<z.ZodArray<z.ZodObject<{
723
723
  member: z.ZodEnum<{
724
- skill: "skill";
725
724
  hook: "hook";
725
+ skill: "skill";
726
726
  deployment: "deployment";
727
727
  request: "request";
728
728
  persisted: "persisted";
@@ -734,10 +734,10 @@ export declare const ApprovalCardEnvelopeSchema: z.ZodObject<{
734
734
  kind: z.ZodLiteral<"single">;
735
735
  rule: z.ZodString;
736
736
  match: z.ZodEnum<{
737
- name: "name";
738
- tool: "tool";
739
737
  host: "host";
738
+ name: "name";
740
739
  path: "path";
740
+ tool: "tool";
741
741
  exact: "exact";
742
742
  pattern: "pattern";
743
743
  prefix: "prefix";
@@ -753,10 +753,10 @@ export declare const ApprovalCardEnvelopeSchema: z.ZodObject<{
753
753
  kind: z.ZodLiteral<"command">;
754
754
  rule: z.ZodString;
755
755
  match: z.ZodEnum<{
756
- name: "name";
757
- tool: "tool";
758
756
  host: "host";
757
+ name: "name";
759
758
  path: "path";
759
+ tool: "tool";
760
760
  exact: "exact";
761
761
  pattern: "pattern";
762
762
  prefix: "prefix";
@@ -823,8 +823,8 @@ export declare const ApprovalCardEnvelopeSchema: z.ZodObject<{
823
823
  }, z.core.$strict>>>;
824
824
  personalRuleDotsAbsent: z.ZodOptional<z.ZodCustom<AskEvidenceAbsence, AskEvidenceAbsence>>;
825
825
  }, z.core.$strict>>;
826
- askClass: z.ZodOptional<z.ZodCustom<"probe" | "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", "probe" | "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary">>;
827
- classes: z.ZodOptional<z.ZodArray<z.ZodCustom<"probe" | "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", "probe" | "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary">>>;
826
+ askClass: z.ZodOptional<z.ZodCustom<"mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary">>;
827
+ classes: z.ZodOptional<z.ZodArray<z.ZodCustom<"mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", "mode" | "hook" | "org_rule" | "write_protection" | "target_unresolved" | "content_question" | "ask_rule" | "denial_limit_fallback" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "rule_unreadable" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary">>>;
828
828
  fromSubagent: z.ZodOptional<z.ZodLiteral<true>>;
829
829
  sourceTaskId: z.ZodOptional<z.ZodString>;
830
830
  sourceAgentName: z.ZodOptional<z.ZodString>;
@@ -95,7 +95,7 @@ export declare function bindingFromCheckpoint(cp: Checkpoint | null): {
95
95
  boundInputHash: string;
96
96
  } | undefined;
97
97
  /** The non-optional C1 finance taxonomy the harness always emits (core's `CoreStatsSubset.costBreakdown` is
98
- * OPTIONAL for back-compat, but the producer ALWAYS fills all four lines — this is that concrete shape). */
98
+ * OPTIONAL for back-compat, but the producer ALWAYS fills its three required lines — this is that concrete shape). */
99
99
  type CostBreakdown = NonNullable<CoreStatsSubset["costBreakdown"]>;
100
100
  /** The s1.v1 `stats` the producer emits — a `CoreStatsSubset` with `costBreakdown` + `humanReview` ALWAYS present
101
101
  * (core types them optional; the harness never omits them, so it works with concrete, non-undefined locals). */
@@ -24,7 +24,7 @@ export function bindingFromCheckpoint(cp) {
24
24
  }
25
25
  const ORACLE_UNDELIVERED = { delivered: false, hiddenTestsGreen: false, buildPassed: false, invariantsOk: false };
26
26
  function emptyCostBreakdown() {
27
- return { llmRootMicroUsd: 0, nestedSubagentMicroUsd: 0, memoryConsolidationMicroUsd: 0, compactionMicroUsd: 0 };
27
+ return { llmRootMicroUsd: 0, nestedSubagentMicroUsd: 0, compactionMicroUsd: 0 };
28
28
  }
29
29
  export function classifyRunStatus(input) {
30
30
  if (input.status === "failed")
@@ -40,7 +40,6 @@ export function captureStats(stats) {
40
40
  costBreakdown: {
41
41
  llmRootMicroUsd: bd.llmRootMicroUsd,
42
42
  nestedSubagentMicroUsd: bd.nestedSubagentMicroUsd,
43
- memoryConsolidationMicroUsd: bd.memoryConsolidationMicroUsd,
44
43
  compactionMicroUsd: bd.compactionMicroUsd,
45
44
  },
46
45
  humanReview: { count: hr.count, totalWaitMs: hr.totalWaitMs, gates: hr.gates },
@@ -55,7 +54,6 @@ export async function driveSupSuspendResume(initial, deps, implSpec, trap, advan
55
54
  return;
56
55
  c1Acc.llmRootMicroUsd += b.llmRootMicroUsd;
57
56
  c1Acc.nestedSubagentMicroUsd += b.nestedSubagentMicroUsd;
58
- c1Acc.memoryConsolidationMicroUsd += b.memoryConsolidationMicroUsd;
59
57
  c1Acc.compactionMicroUsd += b.compactionMicroUsd;
60
58
  };
61
59
  let exitedViaBreak = false;
@@ -6,7 +6,7 @@ import { withUnattendedLeg } from "../../unattended-permission-mode.js";
6
6
  import { createBrain } from "../../brain.js";
7
7
  import { buildPricing } from "../../budget.js";
8
8
  import { RemoteContainerExecutionEnv } from "../../plugins/remote-env-e2b.js";
9
- import { E2B_SANDBOX_HOME } from "../../execution-lane-caps.js";
9
+ import { buildLaneHomeClaim } from "../../execution-lane-caps.js";
10
10
  import { createDurableAskPolicy } from "../../approval.js";
11
11
  import { runOracle as runStandaloneOracle } from "./oracle.js";
12
12
  import { makeRepairOracle } from "./repair-oracle-adapter.js";
@@ -68,9 +68,10 @@ const sh = (env) => async (cmd) => {
68
68
  return { code: r.value.exitCode, out: (r.value.stdout + r.value.stderr).trim() };
69
69
  };
70
70
  async function provisionSandbox(rt, role, cellId) {
71
+ const homeSeat = rt.e2bTemplate ? {} : buildLaneHomeClaim({ remoteExec: { provider: "e2b" } });
71
72
  const env = new RemoteContainerExecutionEnv({
72
73
  apiKey: rt.e2bApiKey,
73
- homeDir: E2B_SANDBOX_HOME,
74
+ ...homeSeat,
74
75
  ...(rt.e2bTemplate ? { template: rt.e2bTemplate } : {}),
75
76
  timeoutMs: rt.sandboxTimeoutMs ?? 600_000,
76
77
  metadata: { s1Cell: cellId, s1Role: role },
@@ -34,8 +34,11 @@ export type { RunRecord, OracleVerdicts, DeliveryDecision, CoreStatsSubset, Inte
34
34
  /** The schema version stamped into every row — the field-contract handshake with core's metric tool. */
35
35
  export declare const S1_SCHEMA_VERSION: "s1.v1";
36
36
  export type S1SchemaVersion = typeof S1_SCHEMA_VERSION;
37
- /** The INSTALLED core version, read from node_modules at load(SPEC §0 provenance-honesty——接入审计 L16:
38
- * 硬钉 "1.111.0" 在 core 升到 1.258.x 后让 harness 每行 meta.coreVersion 输出错误溯源;动态读=永不再漂)。 */
37
+ /** The INSTALLED core version (SPEC §0 provenance-honesty — a hard-pinned "1.111.0" once drifted past a core upgrade and stamped every row's
38
+ * `meta.coreVersion` with the wrong provenance). Read from core's own root export `CONTRACT_KIT_ENGINE_VERSION` — the engine's
39
+ * `package.json` version, resolved by the engine itself ("unknown" only under a bundler that severed the module from its package root) —
40
+ * not by walking the installed package's directory from here (the dependency-direction gate, `test/dependency-direction-gate.test.ts` R2,
41
+ * bans reading core's install tree by file-system path). */
39
42
  export declare const S1_CORE_VERSION: string;
40
43
  /** The arm tag as emitted on the wire (lowercase — the s1.v1 contract value; the internal `Arm` is uppercase). The
41
44
  * harness emits a SUBSET of core's `RunRecord["arm"]` (which also carries "sup-vf", an S1b ablation S1 does not run). */
@@ -1,27 +1,7 @@
1
1
  import { buildReport, trulyCorrect, } from "@sema-agent/core/bench";
2
- import { createRequire } from "node:module";
3
- import { readFileSync, existsSync } from "node:fs";
4
- import { dirname, join } from "node:path";
2
+ import { CONTRACT_KIT_ENGINE_VERSION } from "@sema-agent/core";
5
3
  export const S1_SCHEMA_VERSION = "s1.v1";
6
- export const S1_CORE_VERSION = (() => {
7
- try {
8
- const require = createRequire(import.meta.url);
9
- let dir = dirname(require.resolve("@sema-agent/core"));
10
- for (let i = 0; i < 6; i++) {
11
- const pj = join(dir, "package.json");
12
- if (existsSync(pj)) {
13
- const parsed = JSON.parse(readFileSync(pj, "utf8"));
14
- if (parsed.name === "@sema-agent/core" && parsed.version)
15
- return parsed.version;
16
- }
17
- dir = dirname(dir);
18
- }
19
- return "unknown";
20
- }
21
- catch {
22
- return "unknown";
23
- }
24
- })();
4
+ export const S1_CORE_VERSION = CONTRACT_KIT_ENGINE_VERSION;
25
5
  export function armTag(arm) {
26
6
  switch (arm) {
27
7
  case "SOLO":
@@ -109,7 +109,7 @@ function infraFailedRow(cell, ctx) {
109
109
  oracle: { delivered: false, hiddenTestsGreen: false, buildPassed: false, invariantsOk: false },
110
110
  delivery: { withheld: false },
111
111
  stats: {
112
- costBreakdown: { llmRootMicroUsd: 0, nestedSubagentMicroUsd: 0, memoryConsolidationMicroUsd: 0, compactionMicroUsd: 0 },
112
+ costBreakdown: { llmRootMicroUsd: 0, nestedSubagentMicroUsd: 0, compactionMicroUsd: 0 },
113
113
  humanReview: { count: 0, totalWaitMs: 0, gates: [] },
114
114
  },
115
115
  wallTimeSec: 0,
@@ -221,7 +221,7 @@ export function positiveIntArg(raw, def, flag) {
221
221
  function dryRunMockFactory() {
222
222
  return (trap, seed) => {
223
223
  const stats = {
224
- costBreakdown: { llmRootMicroUsd: 50_000, nestedSubagentMicroUsd: 0, memoryConsolidationMicroUsd: 0, compactionMicroUsd: 0 },
224
+ costBreakdown: { llmRootMicroUsd: 50_000, nestedSubagentMicroUsd: 0, compactionMicroUsd: 0 },
225
225
  humanReview: { count: 0, totalWaitMs: 0, gates: [] },
226
226
  };
227
227
  const green = trap.id !== "C2-honest-bound";
@@ -5,7 +5,7 @@ export async function runAdoptionBootScan(ctx) {
5
5
  return { scanned: 0, resumed: [], stalled: [], rejected: [], failed: [] };
6
6
  const runner = createAdoptionRunner({
7
7
  store,
8
- dialect: ctx.backend?.kind === "pg" ? "pg" : "tidb",
8
+ dialect: ctx.backend?.kind === "pg" ? "pg" : "mysql",
9
9
  now: ctx.now ?? Date.now,
10
10
  logger: ctx.logger,
11
11
  });
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * [ref] A10 分段 —— **device lane 的装配件**(device-executor-lane-v2 §4.6/§4.7/§5,车A-4)。
3
3
  *
4
- * 一处建齐三件活对象:**店**(四表双库的 `DeviceStore`)→ **准入链**(`DeviceEnrollment`,含跨副本
4
+ * 一处建齐三件活对象:**店**(三表双库的 `DeviceStore`;绑定写在根会话行的执行格上)→ **准入链**(`DeviceEnrollment`,读会话店的执行席,含跨副本
5
5
  * 限速座)→ **WS 汇聚端**(`DeviceWsHub`)。三件的依赖是单向的(hub 吃 store+enrollment),所以它们
6
6
  * 必须在同一处按序建 —— 拆到三处装配点会让「hub 拿到的是不是同一只店」变成一个要读三个文件才答得出
7
7
  * 的问题(而答错的后果是 presence 与租约各写各的)。
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import { type DeviceEnrollment } from "../device-enrollment.js";
17
17
  import type { DeviceStore } from "../device-store.js";
18
+ import type { ExecutionPlacementSeat } from "../execution-placement.js";
18
19
  import { type DeviceWsHub } from "../device-ws-hub.js";
19
20
  import type { ServiceConfig } from "../config.js";
20
21
  import type { Logger } from "../observability/logger.js";
@@ -25,6 +26,8 @@ export interface DeviceLaneCtx {
25
26
  logger: Logger;
26
27
  metrics: Metrics;
27
28
  backend: StoreBackend | undefined;
29
+ /** 会话店的执行席(`sessionStore.executionPlacement`):根会话 ↔ 设备绑定的唯一载体与唯一读。device 车道只在 SQL 后端 ⇒ 席恒在;缺 = 装配缝 ⇒ 本函数响亮抛。 */
30
+ seat: ExecutionPlacementSeat | undefined;
28
31
  /** 本副本 id(写进连接租约行 —— §4.6 的跨副本排障面)。 */
29
32
  replicaId: string;
30
33
  }
@@ -32,6 +35,8 @@ export interface DeviceLane {
32
35
  store: DeviceStore;
33
36
  enrollment: DeviceEnrollment;
34
37
  hub: DeviceWsHub;
38
+ /** 会话店的执行席(准入链、工厂、换绑门读的同一只)。 */
39
+ seat: ExecutionPlacementSeat;
35
40
  }
36
41
  /**
37
42
  * 注册口(`POST /v1/devices/enroll`,pre-auth)的限速策略 —— **本车道自己的地板,不挂任何运维旋钮**。
@@ -49,7 +54,7 @@ export declare const DEVICE_ENROLL_RATE_POLICY: {
49
54
  readonly windowMs: 60000;
50
55
  };
51
56
  /**
52
- * 建齐 device lane 的三件。返回 `undefined` = **建不起来**(没有 SQL 后端 ⇒ 没有四表店)。
57
+ * 建齐 device lane 的三件。返回 `undefined` = **建不起来**(没有 SQL 后端 ⇒ 没有设备店)。
53
58
  *
54
59
  * 只在调用方判定本部署是 device 车道时调用;非 device 车道调用它是纯浪费(会白建一只 WS server)。
55
60
  */
@@ -61,7 +66,7 @@ export declare function createDeviceLane(ctx: DeviceLaneCtx): DeviceLane | undef
61
66
  * config 层的门①判的是「运维配没配 SQL 坐标」——那句话回答的是**意图**。它回答不了「这次启动**真的
62
67
  * 拿到**了店吗」:`openStoreBackendWithFallback` 曾在 `SESSION_BACKEND=auto` 下,SQL 连不上 /
63
68
  * 建表失败 ⇒ `backend=undefined` + 一条 warn 就继续启动(那条降级臂已退役:配了 DSN 的库窗内重试、到窗拒启,见 `plugins/store-open-wait.ts`;
64
- * 仍走得到本门的形:`DB_BACKEND=mysql|pg` 声明了 SQL 而 `SESSION_BACKEND=memory`,刻意不持久 ⇒ 不开店)。那次启动里 device lane 的四表整个不在,
69
+ * 仍走得到本门的形:`DB_BACKEND=mysql|pg` 声明了 SQL 而 `SESSION_BACKEND=memory`,刻意不持久 ⇒ 不开店)。那次启动里 device lane 的表整个不在,
65
70
  * 而 `boot/execution-env.ts` 的第七臂拿不到三件 ⇒ `executionEnvFactory` 落 `undefined` ⇒ core 拿
66
71
  * `StubExecutionEnv`:**一台自称在员工设备上执行的 worker 实际在自己进程里跑,而且回执同形**。
67
72
  * 那正是 [ref]「执行车道禁静默降级」点名的样板病,也正是 A-1 那条临时门当初要拦的东西 —— 换执法点,
@@ -2,13 +2,18 @@ import { createDeviceEnrollment, createFixedWindowRateLimiter } from "../device-
2
2
  import { createDeviceWsHub } from "../device-ws-hub.js";
3
3
  export const DEVICE_ENROLL_RATE_POLICY = { limit: 10, windowMs: 60_000 };
4
4
  export function createDeviceLane(ctx) {
5
- const { config, logger, metrics, backend, replicaId } = ctx;
5
+ const { config, logger, metrics, backend, replicaId, seat } = ctx;
6
6
  const store = backend?.device?.();
7
7
  if (!store)
8
8
  return undefined;
9
+ if (seat === undefined) {
10
+ throw new Error("device lane: the device store is wired but the session store carries no execution placement seat — the session↔device binding lives on the " +
11
+ "root session row and is read only through that seat; refusing to start a device lane that could neither bind nor read a binding (assembly bug)");
12
+ }
9
13
  const knobs = config.remoteExec?.provider === "device" ? config.remoteExec : undefined;
10
14
  const enrollment = createDeviceEnrollment({
11
15
  store,
16
+ seat,
12
17
  rateLimiter: createFixedWindowRateLimiter(DEVICE_ENROLL_RATE_POLICY),
13
18
  });
14
19
  const hub = createDeviceWsHub({
@@ -33,7 +38,7 @@ export function createDeviceLane(ctx) {
33
38
  maxPreAuthPerRemote: knobs?.maxPreAuthPerRemote ?? 8,
34
39
  enrollRateLimit: `${DEVICE_ENROLL_RATE_POLICY.limit}/${DEVICE_ENROLL_RATE_POLICY.windowMs / 1000}s per caller identity (per replica; independent of RATE_LIMIT_RPM)`,
35
40
  });
36
- return { store, enrollment, hub };
41
+ return { store, enrollment, hub, seat };
37
42
  }
38
43
  export function assertDeviceLaneWired(isDeviceLane, lane, hasFactory) {
39
44
  if (!isDeviceLane)
@@ -1,11 +1,12 @@
1
1
  import { TaskEnvRegistry } from "../capabilities/sandbox-file-send.js";
2
2
  import { SessionEnvironmentSelection } from "../capabilities/select-environment-tool.js";
3
- import type { ServiceConfig } from "../config.js";
3
+ import { type ServiceConfig } from "../config.js";
4
4
  import type { Logger } from "../observability/logger.js";
5
5
  import type { Metrics } from "../observability/metrics.js";
6
6
  import { PerTaskImageRegistry } from "../per-task-image.js";
7
7
  import type { DeviceEnrollment } from "../device-enrollment.js";
8
8
  import type { DeviceStore } from "../device-store.js";
9
+ import type { ExecutionPlacementSeat } from "../execution-placement.js";
9
10
  import type { DeviceWsHub } from "../device-ws-hub.js";
10
11
  import { k8sExecutionEnvFactory, type K8sEnvConfig, type K8sEnvDeps, type SandboxSecretSeat } from "../plugins/remote-env-k8s.js";
11
12
  import { type SandboxGitPlane, type SandboxGitRunRows } from "../sandbox-git-plane.js";
@@ -117,11 +118,12 @@ export declare function assertWorkspaceSpaceReadable(space: ReturnType<typeof fa
117
118
  readonly headOf: HeadRead | undefined;
118
119
  readonly spaceCommits: (() => SpaceCommitRows | undefined) | undefined;
119
120
  }, cache: ReturnType<typeof facts.workspaceCache>, sessionStoreLabel: string): void;
120
- /** device lane 的三件活对象(店 / 汇聚端 / 准入链)。缺席 = 本部署没有 device 车道。 */
121
+ /** device lane 的活对象(店 / 汇聚端 / 准入链 + 会话店的执行席 —— 绑定的唯一载体与唯一读,工厂与准入链读同一只)。缺席 = 本部署没有 device 车道。 */
121
122
  export interface DeviceLaneWiring {
122
123
  store: DeviceStore;
123
124
  hub: DeviceWsHub;
124
125
  enrollment: DeviceEnrollment;
126
+ seat: ExecutionPlacementSeat;
125
127
  }
126
128
  export interface ExecutionEnvCtx {
127
129
  config: ServiceConfig;
@@ -4,6 +4,7 @@ import { createHostLspManager } from "../host-lsp-manager.js";
4
4
  import { TaskEnvRegistry } from "../capabilities/sandbox-file-send.js";
5
5
  import { DEPLOYMENT_SHAPE_PREDICATES } from "../deployment-shape.js";
6
6
  import { SessionEnvironmentSelection } from "../capabilities/select-environment-tool.js";
7
+ import { sandboxEnvNamesInForce } from "../config.js";
7
8
  import { createE2bLspManager } from "../lsp/e2b-manager.js";
8
9
  import { evictLspOnDestroy } from "../lsp-evict.js";
9
10
  import { PerTaskImageRegistry } from "../per-task-image.js";
@@ -11,7 +12,7 @@ import { adbExecutionEnvFactory } from "../plugins/remote-env-adb.js";
11
12
  import { deviceExecutionEnvFactory } from "../plugins/remote-env-device.js";
12
13
  import { e2bExecutionEnvFactory } from "../plugins/remote-env-e2b.js";
13
14
  import { hostExecutionEnvFactory, RemoteHostExecutionEnv } from "../plugins/remote-env-host.js";
14
- import { boundedStoreCall, checkSandboxEgressPolicy, createSandboxPodApi, createSpaceReclaimer, K8S_SANDBOX_NAMESPACE_DEFAULT, k8sExecutionEnvFactory, readSandboxSecretSeat, rpcTimeoutMsOf } from "../plugins/remote-env-k8s.js";
15
+ import { boundedStoreCall, checkSandboxEgressPolicy, createSandboxPodApi, createSpaceReclaimer, k8sExecutionEnvFactory, readSandboxSecretSeat, rpcTimeoutMsOf } from "../plugins/remote-env-k8s.js";
15
16
  import { podSpecPatchBrokerRefusal, SANDBOX_SECRET_SEAT_VERBS } from "../plugins/k8s-exec-protocol.js";
16
17
  import { judgeSandboxGitPlane, runIdentitySourceOf, sandboxBrokerSeatOf, sandboxGitPlaneAsksSecretSeat, sandboxGitPlanePremisesOf } from "../sandbox-git-plane.js";
17
18
  import { createSandboxPodReaper } from "../plugins/k8s-pod-reaper.js";
@@ -33,8 +34,9 @@ import { createCacheMissMemory } from "../workspace-cache.js";
33
34
  import { workspaceSnapshotTimeoutOf } from "../workspace-space.js";
34
35
  import { sayEgressPolicyReading } from "../sandbox-egress-policy.js";
35
36
  import { sandboxPathEnvSlots, withSandboxPathEnvSlot } from "./deferred-sandbox-path-env.js";
36
- import { LANE_HOME_UNDECLARED_EVENT, createLaneHomeAbsenceReporter } from "../lane-home-probe.js";
37
- import { REMOTE_EXEC_PROVIDER_WORDS, buildUndeclaredHomeNote, executionLaneHomeDir, executionLaneOf, laneBindsReads, laneIsolated } from "../execution-lane-caps.js";
37
+ import { createLaneHomeAbsenceReporter } from "../lane-home-probe.js";
38
+ import { REMOTE_EXEC_PROVIDER_WORDS, buildLaneHomeBootNote, buildLaneHomeClaim, capabilitiesFor, executionLaneOf, laneBindsReads, laneIsolated } from "../execution-lane-caps.js";
39
+ import { warnReadDenyFloorUnkept } from "./execution-lane.js";
38
40
  function boundedSessionSetter(map, maxEntries) {
39
41
  return (sid, value) => {
40
42
  map.delete(sid);
@@ -43,24 +45,6 @@ function boundedSessionSetter(map, maxEntries) {
43
45
  map.delete(map.keys().next().value);
44
46
  };
45
47
  }
46
- function forwardedSandboxEnvKeys(remoteExec) {
47
- switch (remoteExec.provider) {
48
- case "e2b":
49
- case "k8s":
50
- return Object.keys(remoteExec.sandboxEnv ?? {}).sort();
51
- case "local-docker":
52
- return Object.keys(remoteExec.env ?? {}).sort();
53
- case "ssh":
54
- case "adb":
55
- case "host":
56
- case "device":
57
- return [];
58
- default: {
59
- const unreachable = remoteExec;
60
- throw new Error(`unhandled remote-exec provider: ${String(unreachable.provider)}`);
61
- }
62
- }
63
- }
64
48
  function buildSandboxLaneEnv(config, explicit) {
65
49
  const secretEnv = { ...(explicit ?? {}) };
66
50
  const env = Object.fromEntries(Object.entries(derivePkgSourceEnv(config.sandboxPkgSource, config.sandboxPkgSourceCustom)).filter(([name]) => !Object.hasOwn(secretEnv, name)));
@@ -173,7 +157,7 @@ export async function ensureSandboxSecretSeat(k8sCfg, logger, deps, read = () =>
173
157
  const names = Object.keys(k8sCfg.podSecretEnv ?? {});
174
158
  if (names.length === 0)
175
159
  return;
176
- const namespace = k8sCfg.namespace ?? K8S_SANDBOX_NAMESPACE_DEFAULT;
160
+ const namespace = k8sCfg.namespace;
177
161
  const seat = await read();
178
162
  switch (seat.state) {
179
163
  case "granted":
@@ -235,10 +219,15 @@ function buildRealSystemNote(remoteExec) {
235
219
  "and the Bash read boundary is a text-level friction floor, not a safety boundary; the safety boundary is a sandbox lane: " +
236
220
  `set REMOTE_EXEC=${sandboxLanes} (see docs/DEPLOY-PREREQS.md, section "S-281")`);
237
221
  }
222
+ function hostWorktreeUnwrappedRefusal() {
223
+ return Object.assign(new Error('isolation "worktree" was requested but cannot be honored: this host lane has no worktree wrapper active ' +
224
+ "(WORKTREE_ISOLATION_ENABLED=true together with WORKTREE_REPO_ROOT=<a git repository> turns it on; a repo root that does not exist or has no `.git` leaves it off — see the boot log), " +
225
+ "and the base host environment would place the sub-agent in an empty temporary directory instead of an isolated checkout. " +
226
+ "The sub-agent was not started (fail-closed — no silent fallback to the shared working tree)."), { code: "isolation.unavailable" });
227
+ }
238
228
  export function createExecutionEnv(ctx) {
239
229
  const { config, logger, metrics, taskAttachmentStore } = ctx;
240
- const laneHomeDir = executionLaneHomeDir(config);
241
- const homeDirSeat = laneHomeDir !== undefined ? { homeDir: laneHomeDir } : {};
230
+ const homeDirSeat = buildLaneHomeClaim(config);
242
231
  const homeAbsentNotice = { onHomeAbsent: createLaneHomeAbsenceReporter((event, fields) => logger.warn(event, fields)) };
243
232
  const perTaskImage = new PerTaskImageRegistry();
244
233
  const sessionEnvSelection = new SessionEnvironmentSelection();
@@ -256,7 +245,7 @@ export function createExecutionEnv(ctx) {
256
245
  if (config.remoteExec?.provider === "e2b") {
257
246
  executionEnvFactory = e2bExecutionEnvFactory({
258
247
  apiKey: config.remoteExec.apiKey,
259
- ...homeDirSeat,
248
+ ...homeDirSeat, ...homeAbsentNotice,
260
249
  ...(config.remoteExec.template ? { template: config.remoteExec.template } : {}),
261
250
  ...(config.remoteExec.timeoutMs != null ? { timeoutMs: config.remoteExec.timeoutMs } : {}),
262
251
  ...(config.remoteExec.livenessMs != null ? { livenessMs: config.remoteExec.livenessMs } : {}),
@@ -275,7 +264,7 @@ export function createExecutionEnv(ctx) {
275
264
  ...(config.remoteExec.token ? { token: config.remoteExec.token } : {}),
276
265
  ...(config.remoteExec.caCert ? { caCert: config.remoteExec.caCert } : {}),
277
266
  ...(config.remoteExec.insecureTls ? { insecureTls: true } : {}),
278
- ...(config.remoteExec.namespace ? { namespace: config.remoteExec.namespace } : {}),
267
+ namespace: config.remoteExec.namespace,
279
268
  ...(config.remoteExec.runtimeClass != null ? { runtimeClass: config.remoteExec.runtimeClass } : {}),
280
269
  ...(config.remoteExec.mountPath ? { mountPath: config.remoteExec.mountPath } : {}),
281
270
  ...(config.remoteExec.timeoutMs != null ? { timeoutMs: config.remoteExec.timeoutMs } : {}),
@@ -312,7 +301,7 @@ export function createExecutionEnv(ctx) {
312
301
  };
313
302
  sandboxPodReaper = createSandboxPodReaper({ api: createSandboxPodApi(k8sCfg), logger, metrics });
314
303
  void checkSandboxEgressPolicy(k8sCfg)
315
- .then((gaps) => sayEgressPolicyReading(gaps, logger, k8sCfg.namespace ?? K8S_SANDBOX_NAMESPACE_DEFAULT))
304
+ .then((gaps) => sayEgressPolicyReading(gaps, logger, k8sCfg.namespace))
316
305
  .catch((e) => logger.error("sandbox_egress_policy_check_crashed", { error: e instanceof Error ? e.message : String(e), effect: "the sandbox egress self-check did not complete this boot — the lane runs; the egress policy was not read" }));
317
306
  }
318
307
  else if (config.remoteExec?.provider === "ssh") {
@@ -332,6 +321,7 @@ export function createExecutionEnv(ctx) {
332
321
  hub: ctx.deviceLane.hub,
333
322
  store: ctx.deviceLane.store,
334
323
  enrollment: ctx.deviceLane.enrollment,
324
+ seat: ctx.deviceLane.seat,
335
325
  ...homeDirSeat,
336
326
  ...(config.remoteExec.execTimeoutMs != null ? { execTimeoutMs: config.remoteExec.execTimeoutMs } : {}),
337
327
  perSessionCwd,
@@ -368,13 +358,15 @@ export function createExecutionEnv(ctx) {
368
358
  if (hostScheduler)
369
359
  logger.info(`R7: self-wake scheduler enabled (host lane), store=${schedulerStorePath}`);
370
360
  const hostCfg = {
371
- ...homeDirSeat,
361
+ ...homeDirSeat, ...homeAbsentNotice,
372
362
  ...(config.remoteExec.workspaceBase ? { workspaceBase: config.remoteExec.workspaceBase } : {}),
373
363
  ...(config.remoteExec.commandTimeoutMs != null ? { commandTimeoutMs: config.remoteExec.commandTimeoutMs } : {}),
374
364
  ...(hostScheduler ? { scheduler: hostScheduler } : {}),
375
365
  backgroundShell: config.requirePrincipal !== true,
376
366
  };
377
367
  executionEnvFactory = (ctx) => {
368
+ if (ctx.isolation === "worktree")
369
+ throw hostWorktreeUnwrappedRefusal();
378
370
  const cwd = effectiveHostWorkspace(perSessionCwd.get(ctx.sessionId), ctx);
379
371
  const shellEnv = perSessionShellEnv.get(ctx.sessionId);
380
372
  const inheritEnv = perSessionInheritEnv.get(ctx.sessionId);
@@ -414,7 +406,7 @@ export function createExecutionEnv(ctx) {
414
406
  logger.error("worktree_isolation_disabled_bad_repo_root", {
415
407
  repoRoot: wtRoot,
416
408
  reason: existsSync(wtRoot) ? "not a git repository (no .git)" : "path does not exist",
417
- note: "WORKTREE_ISOLATION_ENABLED is set but WORKTREE_REPO_ROOT is not a usable git repo — isolation left OFF; isolation:'worktree' agents run on the shared base env. Fix the path or unset the flag.",
409
+ note: "WORKTREE_ISOLATION_ENABLED is set but WORKTREE_REPO_ROOT is not a usable git repo — isolation left OFF; isolation:'worktree' workflow agents are refused (isolation.unavailable) until it is fixed. Fix the path or unset the flag.",
418
410
  });
419
411
  }
420
412
  else if (config.remoteExec?.provider === "host") {
@@ -473,16 +465,18 @@ export function createExecutionEnv(ctx) {
473
465
  if (executionEnvFactory) {
474
466
  const isolated = laneIsolated(executionLaneOf(config.remoteExec.provider));
475
467
  const suspendable = DEPLOYMENT_SHAPE_PREDICATES.suspendableHands.holds(config);
476
- const sandboxEnvKeys = forwardedSandboxEnvKeys(config.remoteExec);
477
- logger.info("remote_exec_enabled", { provider: config.remoteExec.provider, isolated, suspendable, ...(sandboxEnvKeys.length > 0 ? { sandboxEnvKeys } : {}) });
468
+ const keepsReadFloor = capabilitiesFor(config).keepsReadFloor;
469
+ const sandboxEnvKeys = [...sandboxEnvNamesInForce(config)].sort();
470
+ logger.info("remote_exec_enabled", { provider: config.remoteExec.provider, isolated, suspendable, keepsReadFloor, ...(sandboxEnvKeys.length > 0 ? { sandboxEnvKeys } : {}) });
478
471
  if (!isolated)
479
472
  logger.warn("remote_exec_real_system", { provider: config.remoteExec.provider, note: buildRealSystemNote(config.remoteExec) });
480
- const homeNote = buildUndeclaredHomeNote(config);
481
- if (homeNote !== undefined)
482
- logger.warn(LANE_HOME_UNDECLARED_EVENT, { provider: config.remoteExec.provider, note: homeNote });
473
+ const homeLine = buildLaneHomeBootNote(config);
474
+ if (homeLine !== undefined)
475
+ logger.warn(homeLine.event, { provider: config.remoteExec.provider, note: homeLine.note });
483
476
  if (executionLaneOf(config.remoteExec.provider) === "host")
484
477
  logger.info("task_inherit_env_honored", { honored: taskInheritEnvRefusal(config) === undefined });
485
478
  }
479
+ warnReadDenyFloorUnkept(config, logger);
486
480
  const lspProvider = config.remoteExec?.provider;
487
481
  const lspLane = executionLaneOf(lspProvider);
488
482
  const lspLaneBindsReads = lspLane !== undefined && laneBindsReads(lspLane);
@@ -1,11 +1,12 @@
1
1
  import { type CrossInvariantView } from "../config-invariants.js";
2
2
  import type { ServiceConfig } from "../config-types.js";
3
+ import { buildReadDenyFloorUnkeptNote } from "../execution-lane-caps.js";
3
4
  import type { Logger } from "../observability/logger.js";
4
5
  /** `config.d/remote-exec.json` 能写进来的车道(文件契约里不带密钥名、可 1:1 映射的两条;e2b/k8s/ssh/adb 要 NAME→值解析,尚未接线)。 */
5
6
  export declare const FILE_SOURCED_LANES: readonly ["host", "local-docker"];
6
7
  export type FileSourcedLane = (typeof FILE_SOURCED_LANES)[number];
7
8
  export interface ExecutionLaneComposeCtx {
8
- /** 本入口的配置源形态(`configProviderKind` / `serviceConfigSourceKind` 的答案 —— 与它真建的 provider 同一只判据)。
9
+ /** 本入口的配置源形态(`configSourceKind` 的答案 —— 与它真建的 provider 同一只判据)。
9
10
  * 只有 `local` 才读文件;`undefined` = 纯 env 部署。 */
10
11
  readonly configSource: "local" | "remote" | undefined;
11
12
  /** 配置根(与配置源同一个根,不分裂)。 */
@@ -28,6 +29,13 @@ export declare function composeExecutionLane(config: ServiceConfig, ctx: Executi
28
29
  * 非宿主车道零动作 —— 不解析、不装观察者。
29
30
  */
30
31
  export declare function settleHostLaneShell(config: Pick<ServiceConfig, "remoteExec">, logger: Pick<Logger, "info" | "warn">): Promise<void>;
32
+ /**
33
+ * **读地板的起服一行**:部署要求读拒表的字节地板(`READ_DENY_FLOOR_REQUIRED=true`)而最终车道的执行环境块不守 ⇒ 每条读拒表有行的 run 都在准备期拒 ——
34
+ * 起服先说清后果与出路(`warn read_deny_floor_required_unkept { provider, note }`;判据与句子的唯一属主 `buildReadDenyFloorUnkeptNote`)。
35
+ * 两个入口调同一只(与 {@link settleHostLaneShell} 同形):HTTP 服务在执行环境装配里(`boot/execution-env.ts`,有没有执行环境工厂都调),`run-local` 在宿主车道定下之后 ——
36
+ * 旋钮两个入口都递给引擎(`RunnerDeps.readDenyFloorRequired`),所以两个入口都要先说。不要求 / 车道守地板 ⇒ 零动作。
37
+ */
38
+ export declare function warnReadDenyFloorUnkept(config: Parameters<typeof buildReadDenyFloorUnkeptNote>[0], logger: Pick<Logger, "warn">): void;
31
39
  /**
32
40
  * 车道合成之后的跨域不变量 —— 表(`config-invariants.ts`)里读 `remoteExec.provider` 的那几条,boot 期 `live === next`。
33
41
  * 同步、纯判据:只读 config,不碰文件(测试可以对 `loadConfig()` 的产物直接调它)。
@@ -1,7 +1,7 @@
1
1
  import { loadRemoteExec } from "@sema-agent/settings-schema/node";
2
2
  import { assertLocalConfigDirTrusted } from "../config-dir-trust.js";
3
3
  import { crossInvariant } from "../config-invariants.js";
4
- import { executionLaneOf, laneIsolated } from "../execution-lane-caps.js";
4
+ import { buildReadDenyFloorUnkeptNote, executionLaneOf, laneIsolated } from "../execution-lane-caps.js";
5
5
  import { buildReadFacePostureNotice, settleDerivedReadFace } from "../read-face-posture.js";
6
6
  import { settleHostShellAtBoot } from "../plugins/host-platform.js";
7
7
  export const FILE_SOURCED_LANES = ["host", "local-docker"];
@@ -23,6 +23,11 @@ export async function settleHostLaneShell(config, logger) {
23
23
  return;
24
24
  await settleHostShellAtBoot(logger);
25
25
  }
26
+ export function warnReadDenyFloorUnkept(config, logger) {
27
+ const note = buildReadDenyFloorUnkeptNote(config);
28
+ if (note !== undefined)
29
+ logger.warn("read_deny_floor_required_unkept", { provider: config.remoteExec?.provider, note });
30
+ }
26
31
  export function assertExecutionLaneInvariants(config) {
27
32
  const judge = (id) => crossInvariant(id).check({ live: config, next: config });
28
33
  const leader = judge("leader-host-lane");