@sema-agent/server 7.148.0 → 7.150.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 (360) hide show
  1. package/MIGRATION.md +551 -9
  2. package/README.md +17 -2
  3. package/README.zh-CN.md +5 -1
  4. package/USAGE.md +126 -68
  5. package/dist/adoption/wire.d.ts +3 -3
  6. package/dist/approval-card.d.ts +33 -33
  7. package/dist/approval-gate-currency.d.ts +1 -1
  8. package/dist/approval-leg-origin.d.ts +33 -0
  9. package/dist/approval-leg-origin.js +4 -0
  10. package/dist/audit.d.ts +1 -1
  11. package/dist/audit.js +2 -2
  12. package/dist/auth-bridge.d.ts +9 -1
  13. package/dist/auth-bridge.js +4 -4
  14. package/dist/auth-keys.d.ts +10 -1
  15. package/dist/auth-keys.js +8 -0
  16. package/dist/background-session-reap.d.ts +1 -1
  17. package/dist/boot/deferred-sandbox-path-env.d.ts +5 -3
  18. package/dist/boot/deferred-sandbox-path-env.js +1 -2
  19. package/dist/boot/execution-env.js +10 -11
  20. package/dist/boot/execution-lane.d.ts +6 -4
  21. package/dist/boot/execution-lane.js +3 -1
  22. package/dist/boot/org-delivery.d.ts +3 -2
  23. package/dist/boot/parked-revive-gate.d.ts +5 -5
  24. package/dist/boot/parked-revive-gate.js +2 -3
  25. package/dist/boot/resolve-spec.d.ts +4 -5
  26. package/dist/boot/resolve-spec.js +66 -28
  27. package/dist/boot/retention-lane.d.ts +1 -1
  28. package/dist/boot/runner-deps.js +3 -1
  29. package/dist/boot/session-faces.js +21 -21
  30. package/dist/boot/stage-01-config.d.ts +1 -0
  31. package/dist/boot/stage-01-config.js +4 -3
  32. package/dist/boot/stage-02-web-admin-pull.d.ts +1 -0
  33. package/dist/boot/stage-02-web-admin-pull.js +10 -2
  34. package/dist/boot/stage-03-store-backend.d.ts +1 -0
  35. package/dist/boot/stage-03-store-backend.js +4 -4
  36. package/dist/boot/stage-04-stores.d.ts +1 -0
  37. package/dist/boot/stage-05-execution-env.d.ts +1 -0
  38. package/dist/boot/stage-06-runners.d.ts +2 -1
  39. package/dist/boot/stage-06-runners.js +1 -2
  40. package/dist/boot/stage-07-capability-layer.d.ts +2 -1
  41. package/dist/boot/stage-07-capability-layer.js +1 -1
  42. package/dist/boot/stage-08-reapers.d.ts +2 -1
  43. package/dist/boot/stage-09-leader.d.ts +2 -1
  44. package/dist/boot/stage-10-http-server.d.ts +35 -2
  45. package/dist/boot/stage-10-http-server.js +9 -4
  46. package/dist/boot/stores.d.ts +3 -0
  47. package/dist/boot/stores.js +22 -19
  48. package/dist/boot/web-admin.d.ts +1 -1
  49. package/dist/capabilities/tool-defer.d.ts +1 -1
  50. package/dist/capability-facts.d.ts +70 -60
  51. package/dist/capability-facts.js +45 -49
  52. package/dist/card-settle-stored-scope.d.ts +56 -0
  53. package/dist/card-settle-stored-scope.js +27 -0
  54. package/dist/card-void.d.ts +7 -12
  55. package/dist/card-void.js +2 -7
  56. package/dist/config-catalog.d.ts +12 -0
  57. package/dist/config-catalog.js +37 -33
  58. package/dist/config-invariants.d.ts +5 -4
  59. package/dist/config-invariants.js +4 -4
  60. package/dist/config-types.d.ts +49 -16
  61. package/dist/config.d.ts +6 -5
  62. package/dist/config.js +35 -24
  63. package/dist/context-window-notice.d.ts +31 -0
  64. package/dist/context-window-notice.js +28 -0
  65. package/dist/deployment-governance.d.ts +7 -28
  66. package/dist/deployment-governance.js +1 -14
  67. package/dist/deployment-shape.d.ts +20 -11
  68. package/dist/deployment-shape.js +1 -0
  69. package/dist/device-ws-hub.d.ts +1 -0
  70. package/dist/device-ws-hub.js +64 -28
  71. package/dist/device-ws-protocol.d.ts +20 -6
  72. package/dist/device-ws-protocol.js +9 -2
  73. package/dist/engine-identity.d.ts +7 -1
  74. package/dist/engine-identity.js +5 -0
  75. package/dist/env-name-allowlist-knobs.d.ts +6 -5
  76. package/dist/env-name-allowlist-knobs.js +5 -0
  77. package/dist/execution-lane-caps.d.ts +20 -5
  78. package/dist/execution-lane-caps.js +18 -4
  79. package/dist/field-conflict.d.ts +2 -2
  80. package/dist/fleet/engine-signal.d.ts +14 -1
  81. package/dist/fleet/engine-signal.js +5 -1
  82. package/dist/fleet/fleet-reconciler.d.ts +1 -1
  83. package/dist/fleet/serving-lease.d.ts +18 -3
  84. package/dist/fleet/serving-lease.js +81 -35
  85. package/dist/fleet-client.d.ts +13 -11
  86. package/dist/fleet-client.js +53 -33
  87. package/dist/history-anchor.js +1 -1
  88. package/dist/hitl-delivery.d.ts +1 -3
  89. package/dist/hitl-delivery.js +1 -1
  90. package/dist/hooks/command-spawn.d.ts +7 -2
  91. package/dist/hooks/command-spawn.js +13 -6
  92. package/dist/hooks/hook-runner.d.ts +5 -0
  93. package/dist/hooks/hook-runner.js +11 -7
  94. package/dist/http/active-run-conflict.d.ts +3 -7
  95. package/dist/http/active-run-conflict.js +2 -2
  96. package/dist/http/admission.js +5 -5
  97. package/dist/http/approval-sweeps.js +5 -3
  98. package/dist/http/caller-trust.d.ts +2 -2
  99. package/dist/http/caller-trust.js +3 -3
  100. package/dist/http/checkpoint-ctx.d.ts +18 -63
  101. package/dist/http/checkpoint-ctx.js +1 -24
  102. package/dist/http/claim-heartbeat.d.ts +6 -6
  103. package/dist/http/claim-heartbeat.js +6 -6
  104. package/dist/http/claimed-run.d.ts +16 -9
  105. package/dist/http/claimed-run.js +8 -0
  106. package/dist/http/dispatch.js +7 -5
  107. package/dist/http/durable-run-leg.d.ts +8 -1
  108. package/dist/http/durable-run-leg.js +34 -15
  109. package/dist/http/execution-context.d.ts +115 -14
  110. package/dist/http/execution-context.js +130 -40
  111. package/dist/http/owner-access.d.ts +246 -21
  112. package/dist/http/owner-access.js +186 -8
  113. package/dist/http/principal-gate.d.ts +18 -11
  114. package/dist/http/principal-gate.js +3 -1
  115. package/dist/http/readiness.d.ts +4 -2
  116. package/dist/http/resume-ctx-read.d.ts +14 -3
  117. package/dist/http/resume-ctx-read.js +24 -3
  118. package/dist/http/resume-legs.d.ts +35 -3
  119. package/dist/http/resume-legs.js +262 -106
  120. package/dist/http/route-ctx.d.ts +29 -11
  121. package/dist/http/routes/a2a-serve.js +17 -14
  122. package/dist/http/routes/approvals-assistant.d.ts +3 -2
  123. package/dist/http/routes/approvals-assistant.js +11 -11
  124. package/dist/http/routes/capabilities.js +5 -4
  125. package/dist/http/routes/config-catalog.d.ts +1 -1
  126. package/dist/http/routes/diagnostics.d.ts +3 -1
  127. package/dist/http/routes/diagnostics.js +30 -5
  128. package/dist/http/routes/mcp-reconnect.js +2 -2
  129. package/dist/http/routes/memory-origin.d.ts +1 -1
  130. package/dist/http/routes/notify-wake.js +2 -3
  131. package/dist/http/routes/principal-inbox.d.ts +3 -1
  132. package/dist/http/routes/principal-inbox.js +3 -2
  133. package/dist/http/routes/projects.d.ts +1 -0
  134. package/dist/http/routes/projects.js +5 -3
  135. package/dist/http/routes/retention-ops.d.ts +1 -1
  136. package/dist/http/routes/run-permission-mode.d.ts +1 -1
  137. package/dist/http/routes/run-permission-mode.js +2 -2
  138. package/dist/http/routes/runs.d.ts +1 -1
  139. package/dist/http/routes/runs.js +33 -37
  140. package/dist/http/routes/session-memory-sync.js +4 -5
  141. package/dist/http/routes/session-sync.d.ts +24 -5
  142. package/dist/http/routes/session-sync.js +45 -37
  143. package/dist/http/routes/sessions-list.d.ts +1 -1
  144. package/dist/http/routes/sessions.d.ts +1 -1
  145. package/dist/http/routes/sessions.js +18 -44
  146. package/dist/http/routes/tasks.js +136 -101
  147. package/dist/http/routes/trace-usage.js +14 -14
  148. package/dist/http/routes/workflows.d.ts +1 -0
  149. package/dist/http/routes/workflows.js +20 -38
  150. package/dist/http/server.d.ts +12 -9
  151. package/dist/http/server.js +35 -6
  152. package/dist/http/stored-body-replay.d.ts +3 -24
  153. package/dist/http/stored-body-replay.js +2 -12
  154. package/dist/http/submit-ctx.d.ts +2 -2
  155. package/dist/http/submit-ctx.js +5 -5
  156. package/dist/http/submit-replay.d.ts +15 -2
  157. package/dist/http/submit-replay.js +10 -4
  158. package/dist/http/wire-types.d.ts +6 -3
  159. package/dist/index.d.ts +3 -1
  160. package/dist/index.js +1 -0
  161. package/dist/leader/endpoint.js +9 -8
  162. package/dist/leg-facts.d.ts +13 -2
  163. package/dist/leg-facts.js +2 -0
  164. package/dist/local-store-declaration.d.ts +54 -0
  165. package/dist/local-store-declaration.js +59 -0
  166. package/dist/mcp-assertion-header.d.ts +1 -1
  167. package/dist/mcp-assertion-header.js +1 -1
  168. package/dist/mcp-authorization-face.d.ts +18 -14
  169. package/dist/mcp-authorization-face.js +3 -2
  170. package/dist/memory-project-layer.js +1 -1
  171. package/dist/memory-scope.d.ts +4 -4
  172. package/dist/memory-scope.js +4 -4
  173. package/dist/memory-store-refusal.d.ts +1 -1
  174. package/dist/memory-sync-client.js +2 -2
  175. package/dist/model-context-window.d.ts +50 -11
  176. package/dist/model-context-window.js +20 -1
  177. package/dist/model-entry-refusal.d.ts +5 -4
  178. package/dist/model-entry-refusal.js +17 -3
  179. package/dist/model-reach-scope.d.ts +2 -1
  180. package/dist/observability/corrupt-read-seat.d.ts +1 -1
  181. package/dist/observability/fail-open.d.ts +19 -7
  182. package/dist/observability/fail-open.js +19 -7
  183. package/dist/observability/logger.d.ts +7 -0
  184. package/dist/observability/logger.js +3 -1
  185. package/dist/observability/metrics.js +1 -1
  186. package/dist/observability/run-terminal.d.ts +1 -1
  187. package/dist/observability/run-terminal.js +1 -0
  188. package/dist/observability/secret-env-scrub.d.ts +1 -1
  189. package/dist/observability/secret-env-scrub.js +1 -1
  190. package/dist/org-delivery-gate.d.ts +31 -6
  191. package/dist/org-delivery-gate.js +7 -4
  192. package/dist/owner-faces.d.ts +30 -5
  193. package/dist/owner-faces.js +2 -0
  194. package/dist/park-row-commit.d.ts +67 -0
  195. package/dist/park-row-commit.js +76 -0
  196. package/dist/parked-decide.d.ts +9 -7
  197. package/dist/parked-decide.js +25 -6
  198. package/dist/peer-directory.d.ts +1 -1
  199. package/dist/peer-seat.d.ts +1 -1
  200. package/dist/peer-seat.js +52 -59
  201. package/dist/plugins/adoption-log-sql.d.ts +3 -3
  202. package/dist/plugins/adoption-log-sql.js +19 -19
  203. package/dist/plugins/approval-ask-store-sql.d.ts +1 -1
  204. package/dist/plugins/approval-ask-store-sql.js +3 -5
  205. package/dist/plugins/approval-exemption-skill-cutoff.d.ts +64 -0
  206. package/dist/plugins/approval-exemption-skill-cutoff.js +122 -0
  207. package/dist/plugins/approval-exemption-skill-m46.d.ts +0 -6
  208. package/dist/plugins/approval-exemption-skill-m46.js +6 -10
  209. package/dist/plugins/approval-exemption-store.d.ts +26 -1
  210. package/dist/plugins/approval-exemption-store.js +28 -19
  211. package/dist/plugins/ensure-schema-lock-policy.d.ts +36 -3
  212. package/dist/plugins/ensure-schema-lock-policy.js +75 -9
  213. package/dist/plugins/exec-path-law.d.ts +34 -0
  214. package/dist/plugins/exec-path-law.js +13 -0
  215. package/dist/plugins/file-run-store.d.ts +22 -9
  216. package/dist/plugins/file-run-store.js +51 -23
  217. package/dist/plugins/local-checkpoint-store.d.ts +8 -1
  218. package/dist/plugins/local-checkpoint-store.js +5 -1
  219. package/dist/plugins/local-data-root-admission.d.ts +52 -0
  220. package/dist/plugins/local-data-root-admission.js +100 -0
  221. package/dist/plugins/local-engine-high-water.d.ts +28 -7
  222. package/dist/plugins/local-engine-high-water.js +27 -22
  223. package/dist/plugins/local-session-store.d.ts +134 -49
  224. package/dist/plugins/local-session-store.js +149 -108
  225. package/dist/plugins/memory-run-store.d.ts +14 -9
  226. package/dist/plugins/memory-run-store.js +48 -22
  227. package/dist/plugins/one-time-migration-marker.d.ts +19 -3
  228. package/dist/plugins/one-time-migration-marker.js +7 -1
  229. package/dist/plugins/one-time-migrations.d.ts +110 -59
  230. package/dist/plugins/one-time-migrations.js +224 -136
  231. package/dist/plugins/org-delivery-quota-store.d.ts +34 -11
  232. package/dist/plugins/org-delivery-quota-store.js +29 -14
  233. package/dist/plugins/permission-rule-store-sql.d.ts +1 -1
  234. package/dist/plugins/permission-rule-store-sql.js +5 -9
  235. package/dist/plugins/pg-pool.d.ts +1 -1
  236. package/dist/plugins/pg-pool.js +14 -12
  237. package/dist/plugins/posix-shell-fs.js +4 -2
  238. package/dist/plugins/remote-env-adb.js +3 -2
  239. package/dist/plugins/remote-env-device.d.ts +3 -2
  240. package/dist/plugins/remote-env-device.js +8 -6
  241. package/dist/plugins/remote-env-e2b.d.ts +4 -8
  242. package/dist/plugins/remote-env-e2b.js +21 -15
  243. package/dist/plugins/remote-env-host.d.ts +51 -10
  244. package/dist/plugins/remote-env-host.js +97 -31
  245. package/dist/plugins/remote-env-k8s.js +7 -4
  246. package/dist/plugins/remote-env-local-docker.d.ts +6 -3
  247. package/dist/plugins/remote-env-local-docker.js +11 -25
  248. package/dist/plugins/remote-env-ssh.js +4 -3
  249. package/dist/plugins/remote-shell.d.ts +3 -1
  250. package/dist/plugins/remote-shell.js +3 -3
  251. package/dist/plugins/replica-registration.d.ts +35 -0
  252. package/dist/plugins/replica-registration.js +48 -0
  253. package/dist/plugins/retention-lane-store-sql.d.ts +1 -1
  254. package/dist/plugins/run-store-sql.d.ts +27 -8
  255. package/dist/plugins/run-store-sql.js +46 -18
  256. package/dist/plugins/scenario-prefix-switch-m42.d.ts +8 -12
  257. package/dist/plugins/scenario-prefix-switch-m42.js +9 -6
  258. package/dist/plugins/schema-consistency.d.ts +91 -5
  259. package/dist/plugins/schema-consistency.js +189 -7
  260. package/dist/plugins/schema-drift-sentence.d.ts +6 -5
  261. package/dist/plugins/schema-drift-sentence.js +13 -5
  262. package/dist/plugins/serving-requirement.d.ts +49 -0
  263. package/dist/plugins/serving-requirement.js +53 -0
  264. package/dist/plugins/session-placement.d.ts +5 -4
  265. package/dist/plugins/shell-sentinel-owner-m48.d.ts +22 -0
  266. package/dist/plugins/shell-sentinel-owner-m48.js +6 -0
  267. package/dist/plugins/stop-then-start-sentence.d.ts +55 -0
  268. package/dist/plugins/stop-then-start-sentence.js +51 -0
  269. package/dist/plugins/store-backend.d.ts +23 -9
  270. package/dist/plugins/store-backend.js +58 -24
  271. package/dist/plugins/store-contracts.d.ts +45 -5
  272. package/dist/plugins/store-contracts.js +19 -0
  273. package/dist/plugins/tidb-pool.d.ts +11 -6
  274. package/dist/plugins/tidb-pool.js +22 -12
  275. package/dist/plugins/workspace-custody.d.ts +44 -0
  276. package/dist/plugins/workspace-custody.js +47 -0
  277. package/dist/process-instance.d.ts +3 -0
  278. package/dist/process-instance.js +7 -0
  279. package/dist/project-context.d.ts +66 -0
  280. package/dist/project-context.js +70 -0
  281. package/dist/project-identity.d.ts +8 -7
  282. package/dist/project-identity.js +40 -17
  283. package/dist/project-layer-key.d.ts +13 -2
  284. package/dist/project-layer-key.js +9 -1
  285. package/dist/question.d.ts +9 -21
  286. package/dist/question.js +28 -19
  287. package/dist/read-deny-floor-notice.d.ts +36 -0
  288. package/dist/read-deny-floor-notice.js +40 -0
  289. package/dist/{plain-string-record.d.ts → request-declaration-disposition.d.ts} +9 -23
  290. package/dist/request-declaration-disposition.js +39 -0
  291. package/dist/run-cancel-card.d.ts +28 -0
  292. package/dist/run-cancel-card.js +20 -0
  293. package/dist/run-cancel-context.d.ts +10 -0
  294. package/dist/run-cancel-context.js +1 -0
  295. package/dist/run-local.js +28 -13
  296. package/dist/runs.d.ts +31 -7
  297. package/dist/runs.js +34 -16
  298. package/dist/security.d.ts +3 -3
  299. package/dist/server-secret-env.d.ts +34 -20
  300. package/dist/server-secret-env.js +61 -18
  301. package/dist/session-agent.d.ts +4 -12
  302. package/dist/session-agent.js +0 -6
  303. package/dist/session-children-retire.d.ts +6 -3
  304. package/dist/session-children-retire.js +2 -5
  305. package/dist/session-incarnation.d.ts +18 -4
  306. package/dist/session-incarnation.js +4 -1
  307. package/dist/session-notify-door.d.ts +4 -4
  308. package/dist/session-notify-door.js +5 -6
  309. package/dist/session-rules-seat.d.ts +4 -3
  310. package/dist/session-rules-seat.js +3 -11
  311. package/dist/session-sync.js +3 -3
  312. package/dist/session-workspace.d.ts +3 -3
  313. package/dist/store-admission.d.ts +33 -0
  314. package/dist/store-admission.js +49 -0
  315. package/dist/store-posture.d.ts +5 -0
  316. package/dist/store-posture.js +18 -1
  317. package/dist/stores-sql/checkpoint-store-sql.d.ts +22 -3
  318. package/dist/stores-sql/checkpoint-store-sql.js +109 -23
  319. package/dist/stores-sql/file-history-store-sql.d.ts +1 -1
  320. package/dist/stores-sql/file-history-store-sql.js +3 -5
  321. package/dist/stores-sql/retention-store-sql.d.ts +1 -1
  322. package/dist/stores-sql/tool-result-store-sql.d.ts +1 -1
  323. package/dist/stores-sql/tool-result-store-sql.js +4 -6
  324. package/dist/task-a2a.d.ts +3 -8
  325. package/dist/task-a2a.js +25 -27
  326. package/dist/task-cwd.d.ts +27 -10
  327. package/dist/task-cwd.js +3 -0
  328. package/dist/task-mcp.d.ts +3 -3
  329. package/dist/task-mcp.js +1 -1
  330. package/dist/task-settings.d.ts +13 -0
  331. package/dist/task-settings.js +14 -7
  332. package/dist/terminal.d.ts +2 -0
  333. package/dist/terminal.js +21 -6
  334. package/dist/tool-approval.d.ts +50 -41
  335. package/dist/tool-approval.js +96 -73
  336. package/dist/trace/engine-notice-wire.d.ts +38 -21
  337. package/dist/trace/engine-notice-wire.js +25 -4
  338. package/dist/trace/ledger-sink.d.ts +3 -1
  339. package/dist/trace/project.d.ts +8 -5
  340. package/dist/trace/project.js +11 -9
  341. package/dist/trace/projection-table.d.ts +33 -2
  342. package/dist/trace/redact.d.ts +12 -0
  343. package/dist/trace/redact.js +5 -1
  344. package/dist/trace/self-minted-wire.d.ts +268 -56
  345. package/dist/trace/self-minted-wire.js +110 -40
  346. package/dist/trace/tool-card.d.ts +3 -0
  347. package/dist/trace/tool-card.js +24 -0
  348. package/dist/trace/tool-output-media.d.ts +2 -1
  349. package/dist/unattended-permission-mode.d.ts +1 -1
  350. package/dist/web-admin-client/apply-effective.d.ts +1 -1
  351. package/dist/web-admin-client/apply-effective.js +22 -9
  352. package/dist/web-admin-client/effective-keys.d.ts +1 -1
  353. package/dist/web-admin-client/skills-mcp.d.ts +1 -1
  354. package/docs/DEVICE-EXECUTOR-PROTOCOL.md +57 -29
  355. package/docs/error-text-lexicon.json +317 -0
  356. package/package.json +4 -2
  357. package/scripts/embed-minimal.mjs +183 -0
  358. package/wire-changes/server@7.149.0.json +372 -0
  359. package/wire-changes/server@7.150.0.json +335 -0
  360. package/dist/plain-string-record.js +0 -70
@@ -9,7 +9,8 @@
9
9
  * 消费方取自**同一个** `RunnerDeps` 对象(`principalInboxConsumerOf(runnerDeps)`),不从 config 再读一遍(core 契约原句:
10
10
  * 「over the same RunnerDeps the deployment runs its legs with」)。
11
11
  */
12
- import { type MailboxStore, type OrgDeliveryGate, type RunnerDeps } from "@sema-agent/core";
12
+ import { type MailboxStore, type RunnerDeps } from "@sema-agent/core";
13
+ import { type ServerOrgDeliveryGate } from "../org-delivery-gate.js";
13
14
  import type { OrgMemoryDirectory } from "../org-memory-admission.js";
14
15
  import type { StoreBackend } from "../plugins/store-backend.js";
15
16
  import type { Logger } from "../observability/logger.js";
@@ -24,5 +25,5 @@ export interface OrgDeliveryMountInput {
24
25
  readonly logger: Pick<Logger, "info">;
25
26
  }
26
27
  /** 门在座 ⇒ 门;部署没声明消费方 ⇒ `undefined`;声明了而前提缺 ⇒ 抛(拒启)。 */
27
- export declare function mountOrgDeliveryGate(input: OrgDeliveryMountInput): OrgDeliveryGate | undefined;
28
+ export declare function mountOrgDeliveryGate(input: OrgDeliveryMountInput): ServerOrgDeliveryGate | undefined;
28
29
  //# sourceMappingURL=org-delivery.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { type BackgroundAgentRecord, type RunnerDeps, type ToolExecuteContext } from "@sema-agent/core";
2
2
  import type { ServiceConfig } from "../config.js";
3
3
  import type { RunnerDepsOnAsk } from "./runner-deps.js";
4
- import { type ApprovalBaselineConfigView, type DeploymentGovernanceConfigView, type LiveQuestionFace } from "../deployment-governance.js";
4
+ import { type ApprovalBaselineConfigView, type DeploymentGovernanceConfigView } from "../deployment-governance.js";
5
5
  import { type SandboxPathEnvSlots } from "./deferred-sandbox-path-env.js";
6
6
  import type { ApprovalExemptionStore } from "../plugins/approval-exemption-store.js";
7
7
  /** 本腿读的配置切面(`ServiceConfig` 结构满足)。两个构造口各自的切面 + lane 判别式读的 `remoteExec`。 */
@@ -15,9 +15,9 @@ export interface ParkedReviveGateConfigView extends DeploymentGovernanceConfigVi
15
15
  export interface ParkedReviveGateDeps {
16
16
  /** ⚠️ **活引用**:热改字段(autonomy/commandPolicy/守卫集/审批四旋钮)每次赎回现读,见下方「禁 memoize」。 */
17
17
  readonly config: ParkedReviveGateConfigView;
18
- /** [ref]:活体 AskUserQuestion 面。赎回腿今天无 ALS ctx ⇒ 判 ask,与原形同判。
19
- * ⚠️ 它同时是**决议链元数据** `contentMandate` 的唯一判据(见 {@link mandatePostureOf})。 */
20
- readonly question: LiveQuestionFace | undefined;
18
+ /** 问题席在场(与 resolve-spec 的 `questionSeat` 同一位,装配点递的是同一只协调器的在场性)。
19
+ * 它是**决议链元数据** `contentMandate` 的唯一判据(见 {@link chainMetadataOf})。 */
20
+ readonly questionSeat: boolean;
21
21
  /**
22
22
  * 部署级活体审批席 —— `RunnerDeps.onAsk` 的**同源铸法**(main.ts 递 `createRunnerDepsOnAsk(toolApproval)`,
23
23
  * 单一属主同 boot/runner-deps.ts)。
@@ -90,7 +90,7 @@ export type RebuiltParentConstraint = NonNullable<RebuiltInheritedGate["parentCo
90
90
  /**
91
91
  * 赎回腿的父约束链重建([ref] 件二)。
92
92
  *
93
- * 语义:**同/跨副本一致地重建「部署 ⊇ 操作员」两层完整链**——审批基线(durable question 门 + F4 高危写
93
+ * 语义:**同/跨副本一致地重建「部署 ⊇ 操作员」两层完整链**——审批基线(core 的问答策略 + F4 高危写
94
94
  * 审批门 + 部署名单那一问的豁免读面)作 base 的 `toolPolicy` 座,经**折叠属主** `applyRuntimeGovernance`
95
95
  * (→ core `tightenTaskSpec`)叠上部署治理段(autonomy / commandPolicy / MANUAL_MODE_SHELL_GATE /
96
96
  * 守卫集),取其 `toolPolicy` 装进单层 `parentConstraints`。
@@ -13,7 +13,7 @@ function hostGateCwd(config, localRoot) {
13
13
  return join(config.localDataRoot ?? localRoot, "parked-revive-unrooted");
14
14
  }
15
15
  export function createParkedReviveInheritedGate(deps) {
16
- const { config, question, approvalExemptionStore, logger, localRoot, approverSeat } = deps;
16
+ const { config, approvalExemptionStore, logger, localRoot, approverSeat } = deps;
17
17
  const slots = deps.slots ?? sandboxPathEnvSlots;
18
18
  return async (row, identity) => {
19
19
  const metadata = await chainMetadataOf(deps, row, identity);
@@ -32,7 +32,6 @@ export function createParkedReviveInheritedGate(deps) {
32
32
  const rootSessionId = row.rootSessionId;
33
33
  const baseline = createApprovalBaselinePolicy(config, {
34
34
  kind: "durable",
35
- question,
36
35
  ...(approvalExemptionStore !== undefined && rootSessionId ? { exemption: createSessionExemptionRead(approvalExemptionStore, rootSessionId, logger, "deployment_list", "parked_revive") } : {}),
37
36
  });
38
37
  const governed = applyRuntimeGovernance({ objective: "", toolPolicy: baseline }, createDeploymentGovernanceInputs(config, pathAdjudication));
@@ -53,7 +52,7 @@ async function chainMetadataOf(deps, row, identity) {
53
52
  const forced = caps?.forceDurableGate === true;
54
53
  return {
55
54
  ...(forced || deps.approverSeat === undefined ? { durableMandate: true } : {}),
56
- ...(forced || deps.question === undefined ? { contentMandate: true } : {}),
55
+ ...(forced || !deps.questionSeat ? { contentMandate: true } : {}),
57
56
  ...autoModePostureOf(deps, row, caps),
58
57
  };
59
58
  }
@@ -3,7 +3,6 @@ import { sendUserFileTool } from "../capabilities/send-user-file-tool.js";
3
3
  import { selectScenario } from "../capabilities/scenarios.js";
4
4
  import type { LoadedSkill } from "../capabilities/skills.js";
5
5
  import type { ServiceConfig } from "../config.js";
6
- import { type LiveQuestionFace } from "../deployment-governance.js";
7
6
  import { FleetEventBus } from "../fleet/fleet-bus.js";
8
7
  import { type HookLlmCall } from "../hooks/hook-runner.js";
9
8
  import type { createHookLlm } from "../hooks/hook-llm.js";
@@ -64,10 +63,10 @@ export interface ResolveSpecCtx {
64
63
  /** [ref]:记忆同步腿(开 `MEMORY_SYNC_*` 且记忆引擎接线时在场)—— 项目层准备一步把本任务的项目层交给它跟踪(`memory-project-layer.ts`)。 */
65
64
  memorySyncRunner: MemorySyncRunner | undefined;
66
65
  durableEnabled: boolean;
67
- /** [ref] ([ref] 案二):活体 AskUserQuestion 面(QuestionCoordinator 的判决探针切面)。在场(=
68
- * ASK_QUESTION_ENABLED)时 durable question 门按活流上下文分腿、spec 不再 stamp QUESTION_AWAITS_RESUME
69
- * (否则 spec.onQuestion 恒遮蔽 RunnerDeps.onQuestion 的活人腿);缺席时行为与旧形逐字一致。 */
70
- liveQuestionFace: LiveQuestionFace | undefined;
66
+ /** 问题席在场(= `ASK_QUESTION_ENABLED` 装了 `QuestionCoordinator`,`RunnerDeps.onQuestion` 是它):本仓「问题席在不在」这一事实的**一位**,
67
+ * 三个读者同读 —— 本文件的 posture 判据与 sentinel 铸不铸、赎回链的 `contentMandate`(`parked-revive-gate.ts`)。在场 ⇒ spec 不铸
68
+ * `QUESTION_AWAITS_RESUME`(否则 `spec.onQuestion` 恒遮蔽 `RunnerDeps.onQuestion` 的问题席);落点归 core 的同步优先。 */
69
+ questionSeat: boolean;
71
70
  /**
72
71
  * [ref] 件C —— 部署级**活体审批席**(`RunnerDeps.onAsk` 的同源铸法,main.ts 递
73
72
  * `createRunnerDepsOnAsk(toolApproval)`;单一属主同 `boot/runner-deps.ts`,与 `parked-revive-gate.ts`
@@ -15,9 +15,12 @@ import { acceptShellScratchpadDir, buildEnvFacts, egressForRemoteExec, ensureScr
15
15
  import { FleetEventBus } from "../fleet/fleet-bus.js";
16
16
  import { createSettingsHooksRegistrations, settingsHooksBudgetMs } from "../hooks/hook-runner.js";
17
17
  import { headerStr } from "../http/principal-gate.js";
18
+ import { routeListFilter } from "../http/owner-access.js";
19
+ import { projectRegistry } from "../capability-facts.js";
20
+ import { projectContextOf } from "../project-context.js";
18
21
  import { explicitOperatorOk } from "../http/server.js";
19
22
  import { isAtMentionable, matchCatalogModel, pickUserModel, refusedCatalogEntry, terminalCatalogName } from "../model-select.js";
20
- import { echoModelRef, modelNotAllowedMessage, modelUnavailableMessage } from "../model-entry-refusal.js";
23
+ import { echoModelRef, modelNotAllowedMessage, modelUnavailableMessage, refusedNameLogField } from "../model-entry-refusal.js";
21
24
  import { PerTaskImageRegistry, resolveSandboxImageRef } from "../per-task-image.js";
22
25
  import { remoteScratchpadDirFor } from "../plugins/remote-scratchpad.js";
23
26
  import { attachmentBindRefusalAnswer, bindAttachmentsForTask } from "../plugins/task-attachment-store.js";
@@ -48,7 +51,7 @@ import { storedToolAxesRereadM19 } from "../stored-request-tool-axes-m19.js";
48
51
  import { storedHooksRereadM20 } from "../stored-request-hooks-m20.js";
49
52
  import { storedEnvCredentialsDropM38 } from "../stored-request-env-credentials-m38.js";
50
53
  import { serverCredentialValueSources } from "../server-secret-env.js";
51
- import { MAX_SETTINGS_OUTPUT_STYLE_CHARS, REQUEST_SETTINGS_REFUSAL_PREFIX, SETTINGS_RULE_REFUSAL_CODE, SettingsRuleRefusalError, acceptAppendSystemPrompt, applyTaskSettings, createWorkflowAskPolicy, effectivePermissionMode, effectiveThinking, parseTaskSettings, readSettingsEnv, taskHooksHonored, settingsEnvCredentialIssue, settingsPermissionBucketIssue, withoutKeys } from "../task-settings.js";
54
+ import { MAX_SETTINGS_OUTPUT_STYLE_CHARS, REQUEST_SETTINGS_REFUSAL_PREFIX, SETTINGS_RULE_REFUSAL_CODE, SettingsRuleRefusalError, acceptAppendSystemPrompt, acceptOutputStyle, appendFold, applyTaskSettings, createWorkflowAskPolicy, effectivePermissionMode, effectiveThinking, parseTaskSettings, readSettingsEnv, taskHooksHonored, settingsEnvCredentialIssue, settingsPermissionBucketIssue, withoutKeys } from "../task-settings.js";
52
55
  import { tightenOnlySeatIssue } from "../tighten-only-seats.js";
53
56
  import { buildNeverAutoRetiredNotice } from "../retired-name-host-notice.js";
54
57
  import { entryProblemsFacts } from "../entry-problems.js";
@@ -71,7 +74,7 @@ function unrooted(spec) {
71
74
  return resolved;
72
75
  }
73
76
  export function createResolveSpec(ctx) {
74
- const { config, logger, metrics, localRoot, scenarios, principalCaps, centerRuntimeCapsResolver, getKeyResolver, taskAttachmentStore, perSessionCwd, setSessionCwd, setSessionShellEnv, fenceSessionOwner, hookLlm, hookAgent, belowTaskChainPatterns, fleetBus, hookWakeBus, historyAnchors, ownerAware, taskLimitCaps, taskTimeoutSec, selectEnvTool, sendUserFileToolSpec, memoryEngine, memorySyncRunner, durableEnabled, approvalExemptionStore, checkpointStore, imageIndex, perTaskImage, sessionEnvSelection, liveQuestionFace, approverSeat, lockedKeys, loadedSkills, peerDesk, } = ctx;
77
+ const { config, logger, metrics, localRoot, scenarios, principalCaps, centerRuntimeCapsResolver, getKeyResolver, taskAttachmentStore, perSessionCwd, setSessionCwd, setSessionShellEnv, fenceSessionOwner, hookLlm, hookAgent, belowTaskChainPatterns, fleetBus, hookWakeBus, historyAnchors, ownerAware, taskLimitCaps, taskTimeoutSec, selectEnvTool, sendUserFileToolSpec, memoryEngine, memorySyncRunner, durableEnabled, approvalExemptionStore, checkpointStore, imageIndex, perTaskImage, sessionEnvSelection, questionSeat, approverSeat, lockedKeys, loadedSkills, peerDesk, } = ctx;
75
78
  const deploymentSkillSources = new Map(loadedSkills.map((k) => [k.spec.name, k.source]));
76
79
  const scenarioGate = createScenarioGate({ config, scenarios, principalCaps, logger }, "enforce");
77
80
  const sessionHeadOf = headReadOf(ownerAware);
@@ -109,9 +112,40 @@ export function createResolveSpec(ctx) {
109
112
  }
110
113
  if (opts?.leg === "fresh")
111
114
  assertRequestMcpEntries(body.mcpServers);
115
+ const submittedProjectId = auth?.resolvedProjectId ?? (typeof body.projectId === "string" && body.projectId ? body.projectId.toLowerCase() : undefined);
116
+ const legProjectId = await legProjectIdOf(submittedProjectId, sessionWorkspace, root);
117
+ let projectContext;
118
+ if (opts?.leg === "fresh") {
119
+ const registry = projectRegistry({ config });
120
+ const decision = projectContextOf({
121
+ projectId: legProjectId,
122
+ registry: registry.available ? registry.registry : undefined,
123
+ viewer: req === undefined ? undefined : routeListFilter(req, { config }, "project-get"),
124
+ pathsHonored: DEPLOYMENT_SHAPE_PREDICATES.callerOwnsWorkerDisk.holds(config),
125
+ requestCwd: typeof body.cwd === "string" && body.cwd.length > 0,
126
+ projectMemoryOff: body.projectMemory === "disabled",
127
+ });
128
+ projectContext = decision.context;
129
+ if (decision.withheldPathItems > 0)
130
+ logger.warn("task_project_paths_ignored", { lane: config.remoteExec.provider, pathItems: decision.withheldPathItems, sessionId: root });
131
+ if (projectContext?.brief !== undefined) {
132
+ const append = acceptAppendSystemPrompt(body.appendSystemPrompt);
133
+ const style = acceptOutputStyle(body.settings?.outputStyle);
134
+ const fold = appendFold([append, projectContext.brief, style]);
135
+ if (fold.chars > MAX_SETTINGS_OUTPUT_STYLE_CHARS) {
136
+ const members = append !== undefined ? ["appendSystemPrompt", "projectId"] : ["projectId"];
137
+ if (style !== undefined)
138
+ members.push("settings.outputStyle");
139
+ throw new HttpError(400, `the project brief this run inherits from project ${projectContext.projectId} (its goal, notes and context items) folds into one system-prompt block with appendSystemPrompt and settings.outputStyle — combined they must be at most ${MAX_SETTINGS_OUTPUT_STYLE_CHARS} characters (including the 2-char joiners), and they are ${fold.chars}. Shorten what you send, send projectMemory: "disabled" to run without the project's context, or have the project's goal / notes shortened in the registry.`, { code: "request.field_conflict", extra: { ...fieldConflictFacts("system_prompt_fold", members, { count: fold.chars, cap: MAX_SETTINGS_OUTPUT_STYLE_CHARS }) } });
140
+ }
141
+ }
142
+ }
143
+ else
144
+ projectContext = opts?.projectContext;
145
+ const legCwd = projectContext?.cwd ?? body.cwd;
112
146
  if (opts?.leg === "fresh") {
113
147
  const conflict = scratchpadCoveringTaskRoot({
114
- cwd: body.cwd,
148
+ cwd: legCwd,
115
149
  shellScratchpadDir: body.scratchpadDir,
116
150
  localDataRoot: config.localDataRoot ?? localRoot,
117
151
  sessionId: root,
@@ -119,7 +153,11 @@ export function createResolveSpec(ctx) {
119
153
  callerOwnsWorkerDisk: DEPLOYMENT_SHAPE_PREDICATES.callerOwnsWorkerDisk.holds(config),
120
154
  });
121
155
  if (conflict) {
122
- throw new HttpError(400, `cwd "${conflict.cwd.asSpelled}" is inside this session's scratchpad "${conflict.scratchpadDir.asSpelled}" — the scratchpad is the fs-write gate's EXEMPT directory, so a task rooted there would auto-approve every write under its own root and the engine refuses to build the gate at all (config.write_exempt_dir_covers_root). Point cwd at the project directory instead (or send no cwd and let the session keep the one it has): this session registers the cwd you send, so a task that happens not to mount the write gate would still leave every LATER task on this session rooted in the exemption. A workflow that really is meant to write without prompts says so with a knob that means it (a permission mode, an open write face) and still keeps its root outside the scratchpad — those knobs do not lift this refusal, because the conflict is between two fields of this request, not a permission level.`, { code: "request.field_conflict", extra: { ...fieldConflictFacts("scratchpad_root", body.scratchpadDir === conflict.scratchpadDir.asSpelled ? ["cwd", "scratchpadDir"] : ["cwd"]), cwd: conflict.cwd, scratchpadDir: conflict.scratchpadDir } });
156
+ const cwdCoordinate = projectContext?.cwd !== undefined ? "projectId" : "cwd";
157
+ const fields = body.scratchpadDir === conflict.scratchpadDir.asSpelled ? [cwdCoordinate, "scratchpadDir"] : [cwdCoordinate];
158
+ throw new HttpError(400, cwdCoordinate === "projectId"
159
+ ? `the working directory "${conflict.cwd.asSpelled}" this run inherits from project ${projectContext?.projectId} (its first folder) is inside this session's scratchpad "${conflict.scratchpadDir.asSpelled}" — the scratchpad is the fs-write gate's EXEMPT directory, so a task rooted there would auto-approve every write under its own root and the engine refuses to build the gate at all (config.write_exempt_dir_covers_root). Send a cwd outside the scratchpad with this request, or have the project's first folder moved out of it in the registry.`
160
+ : `cwd "${conflict.cwd.asSpelled}" is inside this session's scratchpad "${conflict.scratchpadDir.asSpelled}" — the scratchpad is the fs-write gate's EXEMPT directory, so a task rooted there would auto-approve every write under its own root and the engine refuses to build the gate at all (config.write_exempt_dir_covers_root). Point cwd at the project directory instead (or send no cwd and let the session keep the one it has): this session registers the cwd you send, so a task that happens not to mount the write gate would still leave every LATER task on this session rooted in the exemption. A workflow that really is meant to write without prompts says so with a knob that means it (a permission mode, an open write face) and still keeps its root outside the scratchpad — those knobs do not lift this refusal, because the conflict is between two fields of this request, not a permission level.`, { code: "request.field_conflict", extra: { ...fieldConflictFacts("scratchpad_root", fields), cwd: conflict.cwd, scratchpadDir: conflict.scratchpadDir } });
123
161
  }
124
162
  }
125
163
  const offFieldIssue = singleMemberOffFieldIssue(body);
@@ -191,12 +229,12 @@ export function createResolveSpec(ctx) {
191
229
  const gated = await gateScenarioAndAppend(body, auth, root, opts, settingsEnv);
192
230
  const effMode = effectivePermissionMode(body, gated.parsedSettings.settings);
193
231
  assertWriteFaceAdmitted(effMode, config);
194
- const lane = bindSettingsCwdEnvAndModel(body, auth, root, gated, opts);
195
- const anchors = await resolveHistoryAnchors(body, req, auth, root);
232
+ const lane = bindSettingsCwdEnvAndModel(body, auth, root, gated, opts, legCwd);
233
+ const anchors = await resolveHistoryAnchors(body, req, auth, root, submittedProjectId, legProjectId);
196
234
  const projectKey = memoryEngine ? await memoryProjectLayers.prepare(config, auth?.memoryScope, realTaskRootOf(root)) : undefined;
197
235
  const runSkills = buildRunSkills({ scenario: gated.cap.skills, request: body.skills, disable: body.disableSkills === true, deploymentSources: deploymentSkillSources }, logger);
198
- const spec = assembleSpecLiteral(body, auth, root, req, opts, { ...gated, ...lane, ...anchors, projectKey, a2aPeers, storedToolAxes, runSkills }, effMode);
199
- const folded = await foldGovernanceAndSettings(body, auth, root, spec, gated);
236
+ const spec = assembleSpecLiteral(body, auth, root, req, opts, { ...gated, ...lane, ...anchors, projectKey, a2aPeers, storedToolAxes, runSkills, projectBrief: projectContext?.brief }, effMode);
237
+ const folded = await foldGovernanceAndSettings(body, auth, root, spec, gated, projectContext?.brief);
200
238
  const retiredNotice = opts.onNotice !== undefined ? buildNeverAutoRetiredNotice(gated.parsedSettings.settings?.tightenOnly?.neverAuto, root) : undefined;
201
239
  if (retiredNotice !== undefined)
202
240
  opts.onNotice?.(retiredNotice);
@@ -205,7 +243,8 @@ export function createResolveSpec(ctx) {
205
243
  scratchpadDir: folded.scratchpadDir,
206
244
  hostSemanticsLane: folded.hostSemanticsLane,
207
245
  });
208
- return { spec: final, facts: { hands: gated.hands, skills: runSkills.roster, sessionWitness: gated.sessionWitness } };
246
+ const registeredCwd = perSessionCwd.get(root);
247
+ return { spec: final, facts: { hands: gated.hands, skills: runSkills.roster, sessionWitness: gated.sessionWitness, ...(registeredCwd !== undefined ? { registeredCwd } : {}), ...(projectContext !== undefined ? { projectContext } : {}) } };
209
248
  };
210
249
  const gateScenarioAndAppend = async (body, auth, root, opts, settingsEnv) => {
211
250
  const { parts: subjectParts, person } = identityAxesOf(auth);
@@ -263,15 +302,15 @@ export function createResolveSpec(ctx) {
263
302
  }
264
303
  return { scenarioName, cap, hands: cap.hands, acceptedAppend, objective, parsedSettings, attachmentNotice, sessionWitness };
265
304
  };
266
- const bindSettingsCwdEnvAndModel = (body, auth, root, gated, opts) => {
305
+ const bindSettingsCwdEnvAndModel = (body, auth, root, gated, opts, cwd) => {
267
306
  const { objective, parsedSettings } = gated;
268
307
  const cwdWriteGate = DEPLOYMENT_SHAPE_PREDICATES.callerCwd.holds(config);
269
308
  const execLane = config.remoteExec.provider;
270
309
  fenceSessionOwner(root, auth?.subject ?? null, opts.execution.occupant?.incarnation);
271
- if (typeof body.cwd === "string" && body.cwd.length > 0) {
272
- if (cwdWriteGate && isAbsoluteHostPath(body.cwd))
273
- setSessionCwd(root, body.cwd);
274
- else if (DEPLOYMENT_SHAPE_PREDICATES.noHandsSingleUser.holds(config) && isAbsoluteHostPath(body.cwd) && satisfiedByProcessCwd(body.cwd, realpathSync))
310
+ if (typeof cwd === "string" && cwd.length > 0) {
311
+ if (cwdWriteGate && isAbsoluteHostPath(cwd))
312
+ setSessionCwd(root, cwd);
313
+ else if (DEPLOYMENT_SHAPE_PREDICATES.noHandsSingleUser.holds(config) && isAbsoluteHostPath(cwd) && satisfiedByProcessCwd(cwd, realpathSync))
275
314
  logger.debug("task_cwd_inherited", { lane: execLane, sessionId: root });
276
315
  else
277
316
  logger.warn("task_cwd_ignored", { honored: cwdWriteGate, lane: execLane, sessionId: root });
@@ -302,6 +341,7 @@ export function createResolveSpec(ctx) {
302
341
  logger,
303
342
  sessionId: root,
304
343
  cwd: perSessionCwd.get(root) ?? process.cwd(),
344
+ hookEnvAllow: config.hookEnvAllow,
305
345
  ...(parsedSettings.settings?.shellEnv ? { shellEnv: parsedSettings.settings.shellEnv } : {}),
306
346
  httpHookAllowlistLayers: parsedSettings.settings?.httpHookAllowlist !== undefined ? [parsedSettings.settings.httpHookAllowlist] : [],
307
347
  belowTaskChainPatterns,
@@ -336,7 +376,7 @@ export function createResolveSpec(ctx) {
336
376
  throw new HttpError(400, modelUnavailableMessage(source === "mention" ? "@-mention" : "model", requested, name, refusal), { code: "request.model_unavailable" });
337
377
  }
338
378
  metrics.inc("task_model_unavailable_fallback_total");
339
- logger.warn("task_model_unavailable_fallback", { requested: echoModelRef(requested), name, code: refusal.code, source, fallback: picked.model, sessionId: root });
379
+ logger.warn("task_model_unavailable_fallback", { requested: echoModelRef(requested), ...refusedNameLogField("name", name), code: refusal.code, source, fallback: picked.model, sessionId: root });
340
380
  }
341
381
  if (picked.notAllowed !== undefined) {
342
382
  const { requested, resolved, source } = picked.notAllowed;
@@ -352,7 +392,7 @@ export function createResolveSpec(ctx) {
352
392
  }
353
393
  return { taskHooks, additionalDirectories, additionalReadDirectories, wireCatalog, picked };
354
394
  };
355
- const resolveHistoryAnchors = async (body, req, auth, root) => {
395
+ const resolveHistoryAnchors = async (body, req, auth, root, submittedProjectId, legProjectId) => {
356
396
  const anchorReader = req === undefined ? undefined : anchorReaderOf(req, { config, logger }, claimCallerOf(identityAxesOf(auth).subject, config));
357
397
  let resumeAtEntryId;
358
398
  if (typeof body.resumeAt === "string" && body.resumeAt.length > 0) {
@@ -366,9 +406,7 @@ export function createResolveSpec(ctx) {
366
406
  throw new HttpError(501, "rewind-files-to is not available on this worker (no session-store backend for the anchor map)");
367
407
  rewindFilesToEntryId = await resolveHistoryAnchor("rewindFilesTo", anchorsResolvable, anchorReader, root, body.rewindFilesTo, auth?.subject ?? null, "rewindFilesTo");
368
408
  }
369
- const submittedProjectId = auth?.resolvedProjectId ?? (typeof body.projectId === "string" && body.projectId ? body.projectId.toLowerCase() : undefined);
370
409
  const s4DefaultScopes = submittedProjectId ? config.projects[submittedProjectId]?.defaultScopes : undefined;
371
- const legProjectId = await legProjectIdOf(submittedProjectId, sessionWorkspace, root);
372
410
  return { resumeAtEntryId, rewindFilesToEntryId, s4DefaultScopes, legProjectId };
373
411
  };
374
412
  const declaresInteractivePosture = (body, req, opts) => {
@@ -376,7 +414,7 @@ export function createResolveSpec(ctx) {
376
414
  return false;
377
415
  if (body.verify === true || body.cascade === true)
378
416
  return false;
379
- if (liveQuestionFace === undefined)
417
+ if (!questionSeat)
380
418
  return false;
381
419
  if (body.interactiveTools === false)
382
420
  return false;
@@ -387,11 +425,11 @@ export function createResolveSpec(ctx) {
387
425
  };
388
426
  const assembleSpecLiteral = (body, auth, root, req, opts, parts, effMode) => {
389
427
  const { parts: subjectParts, person } = identityAxesOf(auth);
390
- const { scenarioName, cap, hands, acceptedAppend, parsedSettings, attachmentNotice, taskHooks, additionalDirectories, additionalReadDirectories, wireCatalog, picked, resumeAtEntryId, rewindFilesToEntryId, s4DefaultScopes, legProjectId, projectKey, a2aPeers, storedToolAxes, runSkills, } = parts;
428
+ const { scenarioName, cap, hands, acceptedAppend, parsedSettings, attachmentNotice, taskHooks, additionalDirectories, additionalReadDirectories, wireCatalog, picked, resumeAtEntryId, rewindFilesToEntryId, s4DefaultScopes, legProjectId, projectKey, a2aPeers, storedToolAxes, runSkills, projectBrief, } = parts;
391
429
  const spec = {
392
430
  objective: attachmentNotice ? `${picked.cleanedObjective}\n\n${attachmentNotice}` : picked.cleanedObjective,
393
431
  ...buildPromptSeats(scenarioName, cap.prompt, typeof body.systemPrompt === "string" ? body.systemPrompt : undefined),
394
- appendSystemPrompt: acceptedAppend,
432
+ appendSystemPrompt: appendFold([acceptedAppend, projectBrief]).text,
395
433
  ...(body.outputStyle !== undefined ? { outputStyle: body.outputStyle } : {}),
396
434
  ...(body.projectMemory !== undefined ? { projectMemory: body.projectMemory } : {}),
397
435
  ...(legProjectId !== undefined ? { projectId: legProjectId } : {}),
@@ -516,11 +554,10 @@ export function createResolveSpec(ctx) {
516
554
  ...(parsedSettings.settings?.skillListingBudgetFraction !== undefined ? { skillListingBudgetFraction: parsedSettings.settings.skillListingBudgetFraction } : {}),
517
555
  ...(parsedSettings.settings?.skillListingMaxDescChars !== undefined ? { skillListingMaxDescChars: parsedSettings.settings.skillListingMaxDescChars } : {}),
518
556
  mcp: resolveRequestMcp(mcpForScenario(config.mcpServers, scenarioName), body.mcpServers, config, peerDesk, opts.lease, logger, opts?.onNotice !== undefined ? { sessionId: root, emit: opts.onNotice } : undefined, storedToolAxes),
519
- a2a: resolveRequestA2a(a2aForScenario(config.a2aPeers, scenarioName), a2aPeers, config, peerDesk, opts.lease, logger, opts?.leg === "fresh" ? "fresh" : "resume", storedToolAxes),
557
+ a2a: resolveRequestA2a(a2aForScenario(config.a2aPeers, scenarioName), a2aPeers, config, peerDesk, opts.lease, logger, storedToolAxes),
520
558
  toolPolicy: toolPolicyForHands(hands, durableEnabled
521
559
  ? createApprovalBaselinePolicy(config, {
522
560
  kind: "durable",
523
- question: liveQuestionFace,
524
561
  ...(approvalExemptionStore !== undefined ? { exemption: createSessionExemptionRead(approvalExemptionStore, root, logger, "deployment_list") } : {}),
525
562
  })
526
563
  : singleUserAutoAcceptBaselineApplies(config)
@@ -541,13 +578,13 @@ export function createResolveSpec(ctx) {
541
578
  totalBudgetUsd: config.resourceSuspendTotalBudgetUsd,
542
579
  maxSlices: config.resourceSuspendMaxSlices,
543
580
  })),
544
- ...(liveQuestionFace === undefined ? { onQuestion: QUESTION_AWAITS_RESUME } : {}),
581
+ ...(questionSeat ? {} : { onQuestion: QUESTION_AWAITS_RESUME }),
545
582
  }
546
583
  : {}),
547
584
  };
548
585
  return spec;
549
586
  };
550
- const foldGovernanceAndSettings = async (body, auth, root, spec, gated) => {
587
+ const foldGovernanceAndSettings = async (body, auth, root, spec, gated, projectBrief) => {
551
588
  const { acceptedAppend, parsedSettings } = gated;
552
589
  const hostSemanticsLane = !DEPLOYMENT_SHAPE_PREDICATES.sandboxPathAdjudication.holds(config);
553
590
  const laneHomeBase = () => {
@@ -576,8 +613,9 @@ export function createResolveSpec(ctx) {
576
613
  const governedBase = applyRuntimeGovernance(spec, createDeploymentGovernanceInputs(config, pathAdjudication));
577
614
  let governed = governedBase;
578
615
  let effectiveSettings = parsedSettings.settings;
579
- if (effectiveSettings?.outputStyle && acceptedAppend && acceptedAppend.length + 2 + effectiveSettings.outputStyle.length > MAX_SETTINGS_OUTPUT_STYLE_CHARS) {
580
- logger.warn("output_style_dropped", { detail: `combined append carriers exceed the ${MAX_SETTINGS_OUTPUT_STYLE_CHARS} cap (rider ${acceptedAppend.length} + style ${effectiveSettings.outputStyle.length}) — style dropped (pre-cap stored body on a resume leg?)`, sessionId: root });
616
+ const foldedChars = effectiveSettings?.outputStyle ? appendFold([acceptedAppend, projectBrief, effectiveSettings.outputStyle]).chars : 0;
617
+ if (effectiveSettings?.outputStyle && foldedChars > MAX_SETTINGS_OUTPUT_STYLE_CHARS) {
618
+ logger.warn("output_style_dropped", { detail: `combined append carriers exceed the ${MAX_SETTINGS_OUTPUT_STYLE_CHARS} cap (rider ${acceptedAppend?.length ?? 0} + project brief ${projectBrief?.length ?? 0} + style ${effectiveSettings.outputStyle.length}, ${foldedChars} with joiners) — style dropped (pre-cap stored body on a resume leg?)`, sessionId: root });
581
619
  const { outputStyle: _dropped2, ...rest2 } = effectiveSettings;
582
620
  effectiveSettings = Object.keys(rest2).length > 0 ? rest2 : undefined;
583
621
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * [ref] 车2 —— 托管留存的 **sweep lane**(设计稿 `docs/DESIGN-270-retention-lane.md` v1.3 §3/§4/§7)。
2
+ * [ref] 车2 —— 托管留存的 **sweep lane**(设计稿 `docs/[ref]-retention-lane.md` v1.3 §3/§4/§7)。
3
3
  *
4
4
  * ── 为什么是独立文件、独立定时器,而不是折进 `startReapers()`(设计稿 §3 首条)───────────────────
5
5
  * `boot/reapers.ts` 里那二十条腿全都是**容忍多副本**的幂等清理:每台副本各扫各的,重复扫一遍只是浪费。
@@ -9,6 +9,7 @@ import { createHardenedVmRunner } from "../orchestration/hardened-vm-runner.js";
9
9
  import { createWorkerHardenedVmRunner } from "../orchestration/hardened-vm-worker-runner.js";
10
10
  import { WorkflowAgentRegistry } from "../orchestration/workflow-agent-steer.js";
11
11
  import { defaultEngineNoticeRouter, redactNoticeMessage, redactNoticeRuleText } from "../trace/engine-notice-wire.js";
12
+ import { presentEngineNotice } from "../read-deny-floor-notice.js";
12
13
  import { WorkflowNotifyGate } from "../orchestration/workflow-notify-journal.js";
13
14
  import { makeLoadProjectMemory, makeProbeInstructionSources } from "../project-memory.js";
14
15
  import { createInstructionSourceSeat } from "../instruction-source-notice.js";
@@ -48,7 +49,8 @@ export const PROMPT_CACHE_BREAK_CAUSE_LEVEL = {
48
49
  const PROMPT_CACHE_BREAK_LEVELS = new Map(Object.entries(PROMPT_CACHE_BREAK_CAUSE_LEVEL));
49
50
  const CEILING_ORIGINS = new Set(["walltime", "turns"]);
50
51
  export function createEngineNoticeForwarder(logger, router = defaultEngineNoticeRouter, metrics) {
51
- return (notice) => {
52
+ return (engineNotice) => {
53
+ const notice = presentEngineNotice(engineNotice);
52
54
  const detail = redactNoticeRuleText(notice.code, notice.detail);
53
55
  const message = redactNoticeMessage(notice.message);
54
56
  logger.warn("engine_notice", { code: notice.code, message, ...(detail !== undefined ? { detail } : {}) });
@@ -1,5 +1,5 @@
1
1
  import { buildRewindHandles, buildSessionAudit, buildSessionAuditLocal, buildSessionAuditPg } from "../audit.js";
2
- import { readSessionAgent } from "../session-agent.js";
2
+ import { readSessionAgent } from "../http/owner-access.js";
3
3
  import { readSessionProjectId, sessionWorkspaceStoreOf } from "../session-workspace.js";
4
4
  import { makeDegenerateInstrument } from "../degenerate-instrument.js";
5
5
  import { PlanCacheProbe } from "../plan-cache-probe.js";
@@ -24,27 +24,27 @@ export function createSessionFaces(ctx) {
24
24
  const ownerAware = sessionStore;
25
25
  const headOf = headReadOf(sessionStore);
26
26
  const workspaceStore = sessionWorkspaceStoreOf(sessionStore);
27
- const sessionAudit = mysqlPool || auditPgPool || auditLocalRows
28
- ? async (sessionId, opts) => {
29
- const handles = opts !== undefined && resumeAnchorStore !== undefined ? buildRewindHandles(await resumeAnchorStore.listBySession(sessionId), opts.reader) : undefined;
30
- const audit = mysqlPool
31
- ? await buildSessionAudit(mysqlPool, sessionId, handles)
32
- : auditPgPool
33
- ? await buildSessionAuditPg(auditPgPool, sessionId, handles)
34
- : await buildSessionAuditLocal(auditLocalRows, sessionId, handles);
35
- if (!audit)
36
- return undefined;
37
- const [head, agent, projectId] = await Promise.all([
38
- headOf?.(sessionId),
39
- opts !== undefined ? readSessionAgent(ownerAware, sessionId) : undefined,
40
- opts !== undefined ? readSessionProjectId(workspaceStore, sessionId) : undefined,
41
- ]);
42
- const owner = head?.owner;
43
- return { ...audit, owner: owner ?? null, ...(agent !== undefined ? { agent } : {}), ...(projectId !== undefined ? { projectId } : {}) };
44
- }
45
- : undefined;
27
+ const readSessionView = async (sessionId, opts) => {
28
+ const handles = opts !== undefined && resumeAnchorStore !== undefined ? buildRewindHandles(await resumeAnchorStore.listBySession(sessionId), opts.reader) : undefined;
29
+ const audit = mysqlPool
30
+ ? await buildSessionAudit(mysqlPool, sessionId, handles)
31
+ : auditPgPool
32
+ ? await buildSessionAuditPg(auditPgPool, sessionId, handles)
33
+ : await buildSessionAuditLocal(auditLocalRows, sessionId, handles);
34
+ if (!audit)
35
+ return undefined;
36
+ const [head, agent, projectId] = await Promise.all([
37
+ headOf?.(sessionId),
38
+ opts !== undefined ? readSessionAgent(ownerAware, sessionId) : undefined,
39
+ opts !== undefined ? readSessionProjectId(workspaceStore, sessionId) : undefined,
40
+ ]);
41
+ const owner = head?.owner;
42
+ return { ...audit, owner: owner ?? null, ...(agent !== undefined ? { agent } : {}), ...(projectId !== undefined ? { projectId } : {}) };
43
+ };
44
+ const sessionAudit = mysqlPool || auditPgPool || auditLocalRows ? readSessionView : undefined;
45
+ const probeWatchedHead = async (sid) => (headOf === undefined ? { owner: undefined, leafId: null } : ((await headOf(sid)) ?? { owner: undefined, leafId: null }));
46
46
  const sessionWatchRegistry = headOf
47
- ? new SessionWatchRegistry(async (sid) => (await headOf(sid)) ?? { owner: undefined, leafId: null }, {
47
+ ? new SessionWatchRegistry(probeWatchedHead, {
48
48
  hotMs: posIntEnv(process.env.SESSION_EVENTS_HOT_MS, 200),
49
49
  warmMs: posIntEnv(process.env.SESSION_EVENTS_WARM_MS, 2000),
50
50
  maxWatchedSessions: posIntEnv(process.env.SESSION_EVENTS_MAX_PROBES, 512, 100_000),
@@ -1,5 +1,6 @@
1
1
  export declare function runStage01(): {
2
2
  config: import("../config-types.js").LoadedConfig;
3
+ localAdmission: import("../plugins/local-data-root-admission.js").LocalDataRootAdmission | undefined;
3
4
  localRoot: string;
4
5
  logger: import("../observability/logger.js").Logger;
5
6
  metrics: import("../observability/metrics.js").Metrics;
@@ -13,8 +13,9 @@ import { installSecretEnvScrubRecorder } from "../observability/secret-env-scrub
13
13
  import { setRunTerminalLogObserver } from "../observability/run-terminal.js";
14
14
  import { setRedactionObserver } from "../trace/redact.js";
15
15
  import { installOutboundDispatcher } from "../outbound-dispatcher.js";
16
- import { provisionSemaConfigDir } from "../sema-config-dir.js";
17
16
  import { bindOwnCredentialsConfig, declareServerWithheldEnv } from "../server-secret-env.js";
17
+ import { admitLocalDataRoot } from "../plugins/local-data-root-admission.js";
18
+ import { localBackendRootOf } from "../plugins/store-backend.js";
18
19
  import { installDefaultEngineNoticeSeat } from "./runner-deps.js";
19
20
  export function runStage01() {
20
21
  declareServerWithheldEnv();
@@ -62,7 +63,7 @@ export function runStage01() {
62
63
  else
63
64
  logger.info("run_failed", fields);
64
65
  });
65
- provisionSemaConfigDir(config, logger);
66
+ const localAdmission = config.dbBackend === "local" ? admitLocalDataRoot(localBackendRootOf(config)) : undefined;
66
67
  const localRoot = configLocalRoot(config);
67
68
  const rootsSplit = splitLocalRoots({
68
69
  localDataRoot: config.localDataRoot,
@@ -77,6 +78,6 @@ export function runStage01() {
77
78
  });
78
79
  }
79
80
  installOutboundDispatcher(logger);
80
- return { config, localRoot, logger, metrics };
81
+ return { config, localAdmission, localRoot, logger, metrics };
81
82
  }
82
83
  //# sourceMappingURL=stage-01-config.js.map
@@ -4,6 +4,7 @@ export declare function runStage02(ctx: Awaited<ReturnType<typeof runStage01>>):
4
4
  ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
5
5
  storeEvidence: import("../store-posture.js").StoreEvidence;
6
6
  webAdmin: import("./web-admin.js").WebAdminRuntime;
7
+ localAdmission: import("../plugins/local-data-root-admission.js").LocalDataRootAdmission | undefined;
7
8
  localRoot: string;
8
9
  logger: import("../index.js").Logger;
9
10
  metrics: import("../index.js").Metrics;
@@ -12,18 +12,25 @@ import { defaultModelRefusal, refusedNameMintedRefusal } from "../model-entry-re
12
12
  import { isRosterGateArmed } from "../config.js";
13
13
  import { judgeServedModelRoute } from "../model-route-endpoint.js";
14
14
  import { servedModelTableLeg } from "../model-select.js";
15
+ import { warnAssumedContextWindows } from "../context-window-notice.js";
15
16
  import { captureBootStoreEvidence } from "./store-evidence.js";
17
+ import { admitStoreDurability } from "../store-admission.js";
18
+ import { provisionSemaConfigDir } from "../sema-config-dir.js";
16
19
  export async function runStage02(ctx) {
17
20
  const { config: loaded, localRoot, logger, metrics } = ctx;
18
21
  const storeEvidence = await captureBootStoreEvidence({ config: loaded, localRoot });
19
22
  const configSource = configSourceKind(loaded);
20
23
  if (configSource === "local") {
21
24
  await assertLocalConfigDirTrusted({ root: localRoot, declaredOwnerUid: loaded.configLocalOwnerUid });
22
- const envModelsMigration = { root: localRoot, env: process.env, envTableIsPlaceholder: isRosterGateArmed(loaded.webAdmin) };
23
- logEnvModelsMigration(logger, envModelsMigration, await runEnvModelsMigration(envModelsMigration));
24
25
  logConfigDirMigration(logger, await migrateLocalConfigDirectory(localRoot));
25
26
  }
26
27
  const config = await composeExecutionLane(loaded, { configSource, localRoot, logger, entry: HTTP_SERVICE_LANE_ENTRY });
28
+ admitStoreDurability(config, storeEvidence);
29
+ provisionSemaConfigDir(config, logger);
30
+ if (configSource === "local") {
31
+ const envModelsMigration = { root: localRoot, env: process.env, envTableIsPlaceholder: isRosterGateArmed(config.webAdmin) };
32
+ logEnvModelsMigration(logger, envModelsMigration, await runEnvModelsMigration(envModelsMigration));
33
+ }
27
34
  announceConfigRootEnclosingWorkspace(config, logger, launchWorkspaceOf(config));
28
35
  const webAdmin = await createWebAdminRuntime({ config, logger, metrics, localRoot });
29
36
  const servedLeg = servedModelTableLeg(config);
@@ -40,6 +47,7 @@ export async function runStage02(ctx) {
40
47
  if (mintedRefused !== undefined) {
41
48
  throw new Error(mintedRefused);
42
49
  }
50
+ warnAssumedContextWindows(config, logger, { envTableIsPlaceholder: isRosterGateArmed(config.webAdmin) });
43
51
  const ceilingVerdict = createUnpricedCeilingVerdict({ config, logger });
44
52
  ceilingVerdict.judge();
45
53
  return { ...ctx, config, ceilingVerdict, storeEvidence, webAdmin };
@@ -30,6 +30,7 @@ export declare function runStage03(ctx: Awaited<ReturnType<typeof runStage02>>):
30
30
  ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
31
31
  storeEvidence: import("../store-posture.js").StoreEvidence;
32
32
  webAdmin: import("./web-admin.js").WebAdminRuntime;
33
+ localAdmission: import("../plugins/local-data-root-admission.js").LocalDataRootAdmission | undefined;
33
34
  localRoot: string;
34
35
  logger: import("../index.js").Logger;
35
36
  metrics: import("../index.js").Metrics;
@@ -1,10 +1,10 @@
1
- import { uuidv7 } from "@sema-agent/core";
1
+ import { processInstanceId } from "../process-instance.js";
2
2
  import { openStores } from "./stores.js";
3
3
  export async function runStage03(ctx) {
4
- const { config, localRoot, logger, metrics, storeEvidence } = ctx;
5
- const { backend, storePosture, memoryEngine, engineDataRoot, memorySyncCursors, rosterStore, backgroundAgentStore, sessionCaptureRecords, taskAttachmentStore, mailboxStore, mailboxRecipientLifecycle, memoryExportStores, memorySyncRunner, sessionStore, breakerState, usageWindowStore, memoryPosture, taskListLane, sqlEngine, storeSweep, } = await openStores({ config, logger, metrics, localRoot, storeEvidence });
4
+ const { config, localAdmission, localRoot, logger, metrics, storeEvidence } = ctx;
5
+ const { backend, storePosture, memoryEngine, engineDataRoot, memorySyncCursors, rosterStore, backgroundAgentStore, sessionCaptureRecords, taskAttachmentStore, mailboxStore, mailboxRecipientLifecycle, memoryExportStores, memorySyncRunner, sessionStore, breakerState, usageWindowStore, memoryPosture, taskListLane, sqlEngine, storeSweep, } = await openStores({ config, logger, metrics, localRoot, storeEvidence, localAdmission });
6
6
  const adoptionWiring = { memoryEngine: memoryExportStores !== undefined, taskAttachment: taskAttachmentStore !== undefined };
7
- const instanceId = uuidv7();
7
+ const instanceId = processInstanceId();
8
8
  return { ...ctx, adoptionWiring, backend, backgroundAgentStore, breakerState, engineDataRoot, instanceId, mailboxRecipientLifecycle, mailboxStore, memoryEngine, memoryExportStores, memoryPosture, memorySyncCursors, memorySyncRunner, rosterStore, sessionCaptureRecords, sessionStore, sqlEngine, storePosture, storeSweep, taskAttachmentStore, taskListLane, usageWindowStore };
9
9
  }
10
10
  //# sourceMappingURL=stage-03-store-backend.js.map
@@ -59,6 +59,7 @@ export declare function runStage04(ctx: Awaited<ReturnType<typeof runStage03>>):
59
59
  ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
60
60
  storeEvidence: import("../store-posture.js").StoreEvidence;
61
61
  webAdmin: import("./web-admin.js").WebAdminRuntime;
62
+ localAdmission: import("../plugins/local-data-root-admission.js").LocalDataRootAdmission | undefined;
62
63
  localRoot: string;
63
64
  logger: import("../index.js").Logger;
64
65
  metrics: import("../index.js").Metrics;
@@ -82,6 +82,7 @@ export declare function runStage05(ctx: Awaited<ReturnType<typeof runStage04>>):
82
82
  ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
83
83
  storeEvidence: import("../store-posture.js").StoreEvidence;
84
84
  webAdmin: import("./web-admin.js").WebAdminRuntime;
85
+ localAdmission: import("../plugins/local-data-root-admission.js").LocalDataRootAdmission | undefined;
85
86
  localRoot: string;
86
87
  logger: import("../index.js").Logger;
87
88
  metrics: import("../index.js").Metrics;
@@ -54,7 +54,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
54
54
  };
55
55
  workflowRunStore: import("../orchestration/workflow-notify-journal.js").JournalingWorkflowRunStore | undefined;
56
56
  workflowsCapable: boolean;
57
- orgDeliveryGate: import("@sema-agent/core").OrgDeliveryGate | undefined;
57
+ orgDeliveryGate: import("../org-delivery-gate.js").ServerOrgDeliveryGate | undefined;
58
58
  deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
59
59
  deploymentModsLoaded: readonly import("./deployment-mods.js").LoadedModPackage[];
60
60
  belowTaskChainPatterns: readonly string[];
@@ -137,6 +137,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
137
137
  ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
138
138
  storeEvidence: import("../store-posture.js").StoreEvidence;
139
139
  webAdmin: import("./web-admin.js").WebAdminRuntime;
140
+ localAdmission: import("../plugins/local-data-root-admission.js").LocalDataRootAdmission | undefined;
140
141
  localRoot: string;
141
142
  logger: import("../index.js").Logger;
142
143
  metrics: import("../index.js").Metrics;
@@ -1,7 +1,6 @@
1
1
  import { createSessionEraseSettler } from "../session-erase.js";
2
2
  import { Runner, InMemoryToolResultStore, TtlSessionStore, uuidv7, createAllowDenyPolicy, workflowsCapability } from "@sema-agent/core";
3
3
  import { createEngineSessionRulesSeat } from "../session-rules-seat.js";
4
- import { headReadOf } from "../session-incarnation.js";
5
4
  import { outwardPlane } from "../terminal.js";
6
5
  import { createSessionTitler } from "../session-titler.js";
7
6
  import { cardRuleScopeRoot } from "../task-cwd.js";
@@ -133,7 +132,7 @@ export async function runStage06(ctx) {
133
132
  }
134
133
  const mcpRevocations = webAdmin.takeMcpRevocations();
135
134
  const workflowModelAllowlistSnapshot = workflowModelAllowlistFor(config) ?? [];
136
- const engineSessionRules = sessionPolicyStore ? createEngineSessionRulesSeat(sessionPolicyStore, headReadOf(sessionStore)) : undefined;
135
+ const engineSessionRules = sessionPolicyStore ? createEngineSessionRulesSeat(sessionPolicyStore, sessionStore) : undefined;
137
136
  const runnerDeps = createRunnerDeps({
138
137
  consolidationSeat,
139
138
  commitCoAuthor,
@@ -76,7 +76,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
76
76
  };
77
77
  workflowRunStore: import("../orchestration/workflow-notify-journal.js").JournalingWorkflowRunStore | undefined;
78
78
  workflowsCapable: boolean;
79
- orgDeliveryGate: import("@sema-agent/core").OrgDeliveryGate | undefined;
79
+ orgDeliveryGate: import("../org-delivery-gate.js").ServerOrgDeliveryGate | undefined;
80
80
  deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
81
81
  deploymentModsLoaded: readonly import("./deployment-mods.js").LoadedModPackage[];
82
82
  belowTaskChainPatterns: readonly string[];
@@ -159,6 +159,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
159
159
  ceilingVerdict: import("./unpriced-ceiling-verdict.js").UnpricedCeilingVerdict;
160
160
  storeEvidence: import("../store-posture.js").StoreEvidence;
161
161
  webAdmin: import("./web-admin.js").WebAdminRuntime;
162
+ localAdmission: import("../plugins/local-data-root-admission.js").LocalDataRootAdmission | undefined;
162
163
  localRoot: string;
163
164
  logger: import("../index.js").Logger;
164
165
  metrics: import("../index.js").Metrics;