@sema-agent/server 7.134.0 → 7.136.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 (550) hide show
  1. package/MIGRATION.md +197 -1
  2. package/USAGE.md +147 -42
  3. package/deploy/sema-up/README.md +1 -1
  4. package/deploy/sema-up/chart/templates/NOTES.txt +1 -1
  5. package/deploy/sema-up/chart/values.yaml +1 -1
  6. package/dist/adoption/plan.d.ts +1 -1
  7. package/dist/approval-ask-audit-store.d.ts +24 -24
  8. package/dist/approval-ask-machine.d.ts +2 -2
  9. package/dist/approval-card.d.ts +122 -154
  10. package/dist/approval-card.js +50 -51
  11. package/dist/approval-content-kind.d.ts +23 -5
  12. package/dist/approval-content-kind.js +8 -1
  13. package/dist/approval-deny-reasons.d.ts +1 -1
  14. package/dist/approval-gate-currency.d.ts +22 -3
  15. package/dist/approval-gate-currency.js +44 -18
  16. package/dist/approval-hmac.d.ts +7 -7
  17. package/dist/approval-policy-settlement.d.ts +2 -2
  18. package/dist/approval-reconciler.d.ts +3 -3
  19. package/dist/approval.d.ts +8 -8
  20. package/dist/approval.js +4 -2
  21. package/dist/auth-bridge.d.ts +35 -6
  22. package/dist/auth-bridge.js +20 -3
  23. package/dist/auto-mode-face.d.ts +4 -4
  24. package/dist/background-session-reap.d.ts +2 -2
  25. package/dist/bake-runner/main.d.ts +2 -2
  26. package/dist/bake-runner/runner.d.ts +4 -4
  27. package/dist/bench/s1/live-deps.d.ts +1 -1
  28. package/dist/bench/s1/run-firm.d.ts +1 -1
  29. package/dist/boot/budget-tracing.d.ts +1 -2
  30. package/dist/boot/budget-tracing.js +2 -2
  31. package/dist/boot/coordinators.d.ts +2 -2
  32. package/dist/boot/coordinators.js +2 -2
  33. package/dist/boot/deferred-sandbox-path-env.d.ts +0 -6
  34. package/dist/boot/deferred-sandbox-path-env.js +0 -5
  35. package/dist/boot/engine-lease.d.ts +5 -5
  36. package/dist/boot/execution-env.d.ts +16 -15
  37. package/dist/boot/execution-env.js +19 -21
  38. package/dist/boot/fatal-exit.d.ts +2 -2
  39. package/dist/boot/late-binds.d.ts +1 -1
  40. package/dist/boot/leader.d.ts +1 -1
  41. package/dist/boot/memory-boundary.d.ts +2 -2
  42. package/dist/boot/memory-consolidation.d.ts +15 -15
  43. package/dist/boot/org-memory.js +1 -1
  44. package/dist/boot/parked-revive-gate.d.ts +3 -3
  45. package/dist/boot/parked-revive-gate.js +3 -2
  46. package/dist/boot/reapers.d.ts +4 -4
  47. package/dist/boot/resolve-spec.d.ts +1 -1
  48. package/dist/boot/resolve-spec.js +36 -29
  49. package/dist/boot/runner-deps.d.ts +11 -11
  50. package/dist/boot/runner-deps.js +7 -4
  51. package/dist/boot/session-faces.d.ts +3 -3
  52. package/dist/boot/session-faces.js +11 -30
  53. package/dist/boot/shutdown.d.ts +5 -5
  54. package/dist/boot/side-query-lane.d.ts +2 -2
  55. package/dist/boot/stage-04-stores.d.ts +1 -1
  56. package/dist/boot/stage-05-execution-env.d.ts +1 -1
  57. package/dist/boot/stage-05-execution-env.js +4 -4
  58. package/dist/boot/stage-06-runners.d.ts +1 -1
  59. package/dist/boot/stage-06-runners.js +0 -2
  60. package/dist/boot/stage-07-capability-layer.d.ts +1 -1
  61. package/dist/boot/stage-08-reapers.d.ts +1 -1
  62. package/dist/boot/stage-09-leader.d.ts +1 -1
  63. package/dist/boot/stage-10-http-server.d.ts +1 -1
  64. package/dist/boot/stores.js +4 -4
  65. package/dist/boot/web-admin.d.ts +17 -17
  66. package/dist/boot/web-admin.js +15 -27
  67. package/dist/boot/workflow-orchestration.js +2 -9
  68. package/dist/brain.d.ts +11 -11
  69. package/dist/brain.js +12 -3
  70. package/dist/budget.d.ts +7 -7
  71. package/dist/budget.js +4 -0
  72. package/dist/capabilities/approvals-push.d.ts +4 -4
  73. package/dist/capabilities/builtin-tools.d.ts +5 -5
  74. package/dist/capabilities/center-plugins.d.ts +5 -5
  75. package/dist/capabilities/center-plugins.js +1 -1
  76. package/dist/capabilities/center-prompts.d.ts +1 -1
  77. package/dist/capabilities/center-wiring.d.ts +1 -1
  78. package/dist/capabilities/composite-members.d.ts +1 -1
  79. package/dist/capabilities/execution-lane.d.ts +5 -5
  80. package/dist/capabilities/execution-lane.js +2 -2
  81. package/dist/capabilities/hands-lane.d.ts +5 -5
  82. package/dist/capabilities/mcp-probe.d.ts +11 -7
  83. package/dist/capabilities/sandbox-file-send.d.ts +1 -18
  84. package/dist/capabilities/sandbox-file-send.js +0 -7
  85. package/dist/capabilities/scenarios.d.ts +28 -10
  86. package/dist/capabilities/scenarios.js +15 -5
  87. package/dist/capabilities/send-user-file-tool.d.ts +1 -1
  88. package/dist/capabilities/skills.d.ts +31 -12
  89. package/dist/capabilities/skills.js +23 -17
  90. package/dist/capabilities/tool-defer.d.ts +1 -1
  91. package/dist/capability-facts.d.ts +29 -32
  92. package/dist/capability-facts.js +17 -21
  93. package/dist/center-config-tier.d.ts +1 -1
  94. package/dist/center-credential.d.ts +22 -8
  95. package/dist/center-credential.js +18 -3
  96. package/dist/checkpoint-identity.d.ts +5 -0
  97. package/dist/checkpoint-identity.js +14 -0
  98. package/dist/config-catalog.d.ts +12 -12
  99. package/dist/config-catalog.js +12 -10
  100. package/dist/config-d-migration.js +1 -1
  101. package/dist/config-invariants.d.ts +5 -5
  102. package/dist/config-invariants.js +11 -2
  103. package/dist/config-lkg.d.ts +1 -39
  104. package/dist/config-lkg.js +1 -83
  105. package/dist/config-provider.d.ts +13 -13
  106. package/dist/config-provider.js +2 -1
  107. package/dist/config-types.d.ts +95 -87
  108. package/dist/config.d.ts +26 -24
  109. package/dist/config.js +38 -18
  110. package/dist/cross-session-settings.d.ts +1 -1
  111. package/dist/delegated-session-owner.d.ts +16 -13
  112. package/dist/delegated-session-owner.js +9 -10
  113. package/dist/deployment-governance.d.ts +16 -16
  114. package/dist/deployment-shape.d.ts +127 -0
  115. package/dist/deployment-shape.js +72 -0
  116. package/dist/device-store.d.ts +1 -1
  117. package/dist/device-ws-hub.d.ts +1 -1
  118. package/dist/egress-redirect.d.ts +1 -1
  119. package/dist/elicitation.d.ts +8 -7
  120. package/dist/elicitation.js +9 -8
  121. package/dist/entry-mode-clamp-notice.d.ts +2 -2
  122. package/dist/env-facts.d.ts +10 -9
  123. package/dist/env-facts.js +1 -1
  124. package/dist/env-name-allowlist-knobs.d.ts +5 -5
  125. package/dist/exec-bounds.d.ts +2 -2
  126. package/dist/execution-lane-caps.d.ts +31 -43
  127. package/dist/execution-lane-caps.js +0 -13
  128. package/dist/file-history-capture.d.ts +9 -9
  129. package/dist/file-history-disclosure.d.ts +25 -11
  130. package/dist/file-history-disclosure.js +25 -14
  131. package/dist/fleet/drain-entry.d.ts +2 -2
  132. package/dist/fleet/fleet-bus.d.ts +22 -14
  133. package/dist/fleet/fleet-bus.js +5 -5
  134. package/dist/fleet/fleet-reconciler.d.ts +9 -9
  135. package/dist/fleet/subagent-tail-bus.d.ts +4 -4
  136. package/dist/fleet-client.d.ts +45 -14
  137. package/dist/fleet-client.js +24 -4
  138. package/dist/fleet-lease.d.ts +23 -19
  139. package/dist/fleet-lease.js +31 -23
  140. package/dist/governance-http-status.d.ts +2 -2
  141. package/dist/hooks/hook-llm.d.ts +7 -7
  142. package/dist/hooks/hook-llm.js +14 -8
  143. package/dist/hooks/hook-runner.d.ts +58 -31
  144. package/dist/hooks/hook-runner.js +37 -19
  145. package/dist/host-decision.d.ts +5 -5
  146. package/dist/host-lsp-manager.d.ts +5 -5
  147. package/dist/hosted-posture.d.ts +23 -13
  148. package/dist/hosted-posture.js +4 -9
  149. package/dist/http/admission.d.ts +2 -2
  150. package/dist/http/admission.js +20 -5
  151. package/dist/http/approval-sweeps.d.ts +1 -1
  152. package/dist/http/approval-sweeps.js +2 -1
  153. package/dist/http/checkpoint-ctx.d.ts +62 -17
  154. package/dist/http/checkpoint-ctx.js +78 -35
  155. package/dist/http/dispatch.d.ts +3 -3
  156. package/dist/http/dispatch.js +9 -9
  157. package/dist/http/durable-run-leg.js +4 -3
  158. package/dist/http/idempotency.d.ts +2 -2
  159. package/dist/http/mcp-dial-deadline.d.ts +7 -5
  160. package/dist/http/memory-compliance-failure-reply.d.ts +4 -4
  161. package/dist/http/owner-access.d.ts +4 -6
  162. package/dist/http/owner-access.js +1 -1
  163. package/dist/http/principal-gate.d.ts +7 -7
  164. package/dist/http/principal-gate.js +3 -2
  165. package/dist/http/readiness.d.ts +1 -1
  166. package/dist/http/request-guards.d.ts +4 -4
  167. package/dist/http/request-guards.js +2 -1
  168. package/dist/http/resume-ctx-read.d.ts +9 -23
  169. package/dist/http/resume-ctx-read.js +2 -3
  170. package/dist/http/resume-legs.d.ts +3 -3
  171. package/dist/http/resume-legs.js +11 -8
  172. package/dist/http/route-ctx.d.ts +29 -29
  173. package/dist/http/route-table.d.ts +9 -9
  174. package/dist/http/routes/agents-roster.d.ts +1 -1
  175. package/dist/http/routes/approvals-assistant.d.ts +5 -7
  176. package/dist/http/routes/approvals-assistant.js +101 -26
  177. package/dist/http/routes/background.d.ts +3 -3
  178. package/dist/http/routes/background.js +2 -2
  179. package/dist/http/routes/capabilities.d.ts +1 -1
  180. package/dist/http/routes/capabilities.js +16 -8
  181. package/dist/http/routes/config-catalog.d.ts +1 -1
  182. package/dist/http/routes/devices.d.ts +1 -1
  183. package/dist/http/routes/diagnostics.d.ts +3 -3
  184. package/dist/http/routes/fleet.d.ts +1 -1
  185. package/dist/http/routes/fleet.js +2 -1
  186. package/dist/http/routes/mcp-reconnect.d.ts +4 -4
  187. package/dist/http/routes/mcp-reconnect.js +3 -3
  188. package/dist/http/routes/memory-consolidation.d.ts +1 -1
  189. package/dist/http/routes/notify-wake.d.ts +1 -1
  190. package/dist/http/routes/notify-wake.js +2 -2
  191. package/dist/http/routes/rules.d.ts +1 -1
  192. package/dist/http/routes/runs.js +23 -11
  193. package/dist/http/routes/session-sync.d.ts +1 -1
  194. package/dist/http/routes/session-sync.js +97 -46
  195. package/dist/http/routes/sessions-list.js +1 -1
  196. package/dist/http/routes/sessions.js +43 -53
  197. package/dist/http/routes/tasks.d.ts +1 -1
  198. package/dist/http/routes/trace-usage.d.ts +1 -1
  199. package/dist/http/routes/workflows.d.ts +3 -0
  200. package/dist/http/routes/workflows.js +31 -28
  201. package/dist/http/send.d.ts +5 -5
  202. package/dist/http/server.d.ts +34 -34
  203. package/dist/http/session-inherit-env.d.ts +3 -3
  204. package/dist/http/sse-lifecycle.d.ts +1 -1
  205. package/dist/http/sse-log.d.ts +2 -2
  206. package/dist/http/submit-ctx.js +1 -1
  207. package/dist/http/sync-submit-body.d.ts +1 -1
  208. package/dist/http/verify-rounds.d.ts +1 -1
  209. package/dist/http/wire-types.d.ts +33 -24
  210. package/dist/index.d.ts +1 -0
  211. package/dist/index.js +1 -0
  212. package/dist/instruction-source-notice.d.ts +2 -2
  213. package/dist/key-resolver.d.ts +3 -3
  214. package/dist/lane-home-probe.d.ts +1 -1
  215. package/dist/leader/diffout.d.ts +1 -1
  216. package/dist/leader/diffup.d.ts +2 -2
  217. package/dist/leader/endpoint.d.ts +1 -1
  218. package/dist/leader/fanout.d.ts +1 -1
  219. package/dist/leader/leader.d.ts +4 -4
  220. package/dist/leader/merge.d.ts +3 -3
  221. package/dist/leader/repair-wire.d.ts +1 -1
  222. package/dist/leader/wire.d.ts +6 -6
  223. package/dist/list-entry-display.d.ts +1 -1
  224. package/dist/lsp-evict.d.ts +1 -1
  225. package/dist/mcp-assertion-header.d.ts +1 -1
  226. package/dist/memory-layer-legacy-lock.d.ts +1 -1
  227. package/dist/memory-operator-faces.d.ts +1 -1
  228. package/dist/memory-posture.js +4 -2
  229. package/dist/memory-project-layer.d.ts +1 -1
  230. package/dist/memory-scope.d.ts +19 -19
  231. package/dist/memory-store-refusal.d.ts +4 -4
  232. package/dist/model-entry-headers.d.ts +2 -2
  233. package/dist/model-entry-refusal.d.ts +17 -17
  234. package/dist/model-provider.d.ts +10 -10
  235. package/dist/model-reach-scope.d.ts +1 -1
  236. package/dist/model-route-endpoint.d.ts +6 -6
  237. package/dist/model-route-gap.d.ts +49 -4
  238. package/dist/model-route-gap.js +34 -1
  239. package/dist/model-route-url.d.ts +5 -5
  240. package/dist/model-select.d.ts +15 -6
  241. package/dist/model-select.js +5 -0
  242. package/dist/model-unreachable-notice.d.ts +3 -3
  243. package/dist/namespaced-rule-name.d.ts +15 -5
  244. package/dist/namespaced-rule-name.js +3 -2
  245. package/dist/object-store-buckets.d.ts +13 -0
  246. package/dist/object-store-buckets.js +3 -0
  247. package/dist/observability/corrupt-read-seat.d.ts +9 -9
  248. package/dist/observability/cost-taxonomy.d.ts +1 -1
  249. package/dist/observability/err-text.d.ts +1 -1
  250. package/dist/observability/fail-open.d.ts +17 -13
  251. package/dist/observability/fail-open.js +17 -13
  252. package/dist/observability/metrics.d.ts +3 -3
  253. package/dist/observability/metrics.js +1 -1
  254. package/dist/observability/principal-context.d.ts +4 -1
  255. package/dist/observability/principal-context.js +6 -1
  256. package/dist/observability/run-terminal.d.ts +36 -36
  257. package/dist/observability/secret-env-scrub.d.ts +3 -3
  258. package/dist/observability/tool-trace.d.ts +1 -1
  259. package/dist/operator-ask.d.ts +4 -4
  260. package/dist/orchestration/workflow-agent-session-index.d.ts +3 -3
  261. package/dist/orchestration/workflow-completion-inbox.d.ts +20 -5
  262. package/dist/orchestration/workflow-completion-inbox.js +29 -7
  263. package/dist/orchestration/workflow-notify-journal.d.ts +43 -19
  264. package/dist/orchestration/workflow-notify-journal.js +17 -0
  265. package/dist/outbound-dispatcher.d.ts +4 -4
  266. package/dist/parent-watch.d.ts +4 -4
  267. package/dist/parked-decide.d.ts +20 -18
  268. package/dist/parked-decide.js +31 -11
  269. package/dist/parked-revive-surface.d.ts +7 -7
  270. package/dist/parked-revive-surface.js +2 -3
  271. package/dist/peer-directory.d.ts +5 -4
  272. package/dist/peer-directory.js +6 -6
  273. package/dist/permission-rule-list.d.ts +10 -1
  274. package/dist/permission-rule-list.js +7 -5
  275. package/dist/permission-rule-vocab.d.ts +2 -2
  276. package/dist/plugins/adoption-log-sql.d.ts +1 -1
  277. package/dist/plugins/approval-ask-store-file.d.ts +8 -1
  278. package/dist/plugins/approval-ask-store-file.js +6 -3
  279. package/dist/plugins/approval-ask-store-memory.d.ts +11 -7
  280. package/dist/plugins/approval-ask-store-memory.js +11 -7
  281. package/dist/plugins/approval-ask-store-sql.d.ts +42 -15
  282. package/dist/plugins/approval-ask-store-sql.js +21 -5
  283. package/dist/plugins/approval-exemption-store.d.ts +3 -3
  284. package/dist/plugins/approval-nonce-store.d.ts +3 -3
  285. package/dist/plugins/background-agent-store-sql.d.ts +1 -1
  286. package/dist/plugins/background-shell-support.d.ts +2 -2
  287. package/dist/plugins/blob-backend.d.ts +1 -1
  288. package/dist/plugins/blob-backend.js +2 -1
  289. package/dist/plugins/caching-session-store.d.ts +23 -32
  290. package/dist/plugins/caching-session-store.js +5 -17
  291. package/dist/plugins/checkpoint-index-columns.d.ts +130 -0
  292. package/dist/plugins/checkpoint-index-columns.js +90 -0
  293. package/dist/plugins/checkpoint-store-sql.d.ts +71 -69
  294. package/dist/plugins/checkpoint-store-sql.js +109 -127
  295. package/dist/plugins/device-store-sql.d.ts +7 -6
  296. package/dist/plugins/e2b-orphan-reclaim.d.ts +1 -1
  297. package/dist/plugins/ensure-schema-lock-policy.d.ts +1 -1
  298. package/dist/plugins/file-history-store-sql.d.ts +15 -7
  299. package/dist/plugins/file-history-store-sql.js +55 -36
  300. package/dist/plugins/file-run-store.d.ts +8 -8
  301. package/dist/plugins/fork-routing-session-store.d.ts +2 -2
  302. package/dist/plugins/fork-routing-session-store.js +1 -1
  303. package/dist/plugins/host-platform.d.ts +10 -10
  304. package/dist/plugins/image-bake-store-sql.d.ts +1 -1
  305. package/dist/plugins/image-index-sql.d.ts +1 -1
  306. package/dist/plugins/leader-run-store-sql.d.ts +1 -1
  307. package/dist/plugins/local-checkpoint-store.d.ts +10 -10
  308. package/dist/plugins/local-checkpoint-store.js +7 -7
  309. package/dist/plugins/local-session-store.d.ts +34 -38
  310. package/dist/plugins/local-session-store.js +20 -39
  311. package/dist/plugins/local-session-window.d.ts +1 -1
  312. package/dist/plugins/mailbox-store-sql.d.ts +2 -2
  313. package/dist/plugins/memory-engine-pg.d.ts +1 -1
  314. package/dist/plugins/memory-run-store.d.ts +4 -4
  315. package/dist/plugins/memory-sync-store-pg.d.ts +3 -3
  316. package/dist/plugins/one-time-migrations.d.ts +73 -54
  317. package/dist/plugins/one-time-migrations.js +131 -134
  318. package/dist/plugins/outcome-ledger-sql.d.ts +1 -1
  319. package/dist/plugins/park-commit-watch.d.ts +3 -3
  320. package/dist/plugins/permission-rule-store-file.d.ts +5 -5
  321. package/dist/plugins/permission-rule-store-file.js +12 -19
  322. package/dist/plugins/permission-rule-store-sql.d.ts +38 -4
  323. package/dist/plugins/permission-rule-store-sql.js +67 -24
  324. package/dist/plugins/pg-cost-quota.d.ts +1 -1
  325. package/dist/plugins/pg-pool.d.ts +2 -2
  326. package/dist/plugins/pg-pool.js +5 -2
  327. package/dist/plugins/pg-rate-limiter.d.ts +1 -1
  328. package/dist/plugins/pg-session-storage.d.ts +8 -20
  329. package/dist/plugins/pg-session-storage.js +14 -27
  330. package/dist/plugins/remote-env-adb.d.ts +10 -10
  331. package/dist/plugins/remote-env-device.d.ts +10 -9
  332. package/dist/plugins/remote-env-device.js +6 -2
  333. package/dist/plugins/remote-env-e2b.d.ts +3 -3
  334. package/dist/plugins/remote-env-host.d.ts +16 -16
  335. package/dist/plugins/remote-env-k8s.d.ts +26 -13
  336. package/dist/plugins/remote-env-k8s.js +24 -7
  337. package/dist/plugins/remote-env-local-docker.d.ts +2 -2
  338. package/dist/plugins/remote-env-ssh.d.ts +4 -4
  339. package/dist/plugins/remote-scratchpad.d.ts +2 -3
  340. package/dist/plugins/remote-scratchpad.js +0 -4
  341. package/dist/plugins/remote-shell.d.ts +6 -6
  342. package/dist/plugins/retention-lane-store-sql.d.ts +4 -4
  343. package/dist/plugins/retention-store-sql.d.ts +4 -4
  344. package/dist/plugins/roster-store-sql.d.ts +1 -1
  345. package/dist/plugins/run-store-sql.d.ts +8 -8
  346. package/dist/plugins/s3-answer.d.ts +15 -0
  347. package/dist/plugins/s3-answer.js +5 -0
  348. package/dist/plugins/schema-consistency.d.ts +2 -2
  349. package/dist/plugins/schema-ensure-legs.d.ts +3 -3
  350. package/dist/plugins/schema-indexes.d.ts +1 -1
  351. package/dist/plugins/schema-live-columns.d.ts +1 -1
  352. package/dist/plugins/session-event-payload.d.ts +4 -4
  353. package/dist/plugins/session-fork.d.ts +34 -0
  354. package/dist/plugins/session-fork.js +29 -0
  355. package/dist/plugins/session-ownership.js +1 -1
  356. package/dist/plugins/session-placement.d.ts +1 -1
  357. package/dist/plugins/session-policy-store-sql.d.ts +12 -12
  358. package/dist/plugins/session-store.d.ts +2 -2
  359. package/dist/plugins/session-store.js +2 -2
  360. package/dist/plugins/shared-memory-store-sql.d.ts +2 -2
  361. package/dist/plugins/snapshot-bucket-presence.d.ts +39 -4
  362. package/dist/plugins/snapshot-bucket-presence.js +35 -7
  363. package/dist/plugins/sql-driver.d.ts +8 -8
  364. package/dist/plugins/sql-errors.d.ts +40 -1
  365. package/dist/plugins/sql-errors.js +49 -1
  366. package/dist/plugins/sql-json-column.d.ts +21 -21
  367. package/dist/plugins/sql-row-helpers.d.ts +2 -2
  368. package/dist/plugins/store-backend.d.ts +17 -16
  369. package/dist/plugins/store-backend.js +3 -3
  370. package/dist/plugins/store-contracts.d.ts +21 -21
  371. package/dist/plugins/store-fault.d.ts +4 -0
  372. package/dist/plugins/store-fault.js +8 -0
  373. package/dist/plugins/task-attachment-store.d.ts +2 -2
  374. package/dist/plugins/task-list-store-sql.d.ts +1 -1
  375. package/dist/plugins/tidb-pool.d.ts +2 -2
  376. package/dist/plugins/tidb-pool.js +10 -3
  377. package/dist/plugins/tidb-session-store.d.ts +16 -26
  378. package/dist/plugins/tidb-session-store.js +15 -27
  379. package/dist/plugins/tool-result-store-sql.d.ts +1 -1
  380. package/dist/plugins/usage-window-store-sql.d.ts +3 -3
  381. package/dist/plugins/user-input-ledger-file.d.ts +1 -1
  382. package/dist/plugins/user-input-ledger-sql.d.ts +3 -3
  383. package/dist/plugins/web-search.d.ts +19 -5
  384. package/dist/plugins/web-search.js +20 -5
  385. package/dist/{orchestration/workflow-journal-entry.d.ts → plugins/workflow-journal-payload.d.ts} +23 -32
  386. package/dist/plugins/workflow-journal-payload.js +32 -0
  387. package/dist/plugins/workflow-journal-store-sql.d.ts +28 -14
  388. package/dist/plugins/workflow-journal-store-sql.js +34 -15
  389. package/dist/plugins/workflow-run-store-sql.d.ts +4 -4
  390. package/dist/posture-source.d.ts +11 -11
  391. package/dist/principal-jwt.d.ts +6 -6
  392. package/dist/project-identity.d.ts +3 -3
  393. package/dist/project-memory.d.ts +4 -4
  394. package/dist/read-face-posture.d.ts +7 -7
  395. package/dist/request-declaration-refusal.d.ts +94 -0
  396. package/dist/request-declaration-refusal.js +78 -0
  397. package/dist/request-image-urls.d.ts +6 -0
  398. package/dist/request-image-urls.js +27 -0
  399. package/dist/request-key-closure.d.ts +6 -1
  400. package/dist/request-key-closure.js +5 -2
  401. package/dist/request-value-closure.d.ts +15 -8
  402. package/dist/request-value-closure.js +2 -0
  403. package/dist/router/route-orchestration.d.ts +11 -16
  404. package/dist/router/route-orchestration.js +2 -12
  405. package/dist/rule-entry-list.d.ts +8 -7
  406. package/dist/rule-entry-list.js +2 -9
  407. package/dist/rules-consent.d.ts +6 -6
  408. package/dist/rules-consent.js +2 -0
  409. package/dist/run-cancel-context.d.ts +5 -5
  410. package/dist/run-local.d.ts +10 -10
  411. package/dist/runs.d.ts +13 -11
  412. package/dist/runs.js +15 -1
  413. package/dist/runtime-caps-resolver.d.ts +6 -6
  414. package/dist/runtime-caps-resolver.js +1 -1
  415. package/dist/runtime-governance.d.ts +9 -9
  416. package/dist/sandbox-pkg-source.d.ts +17 -12
  417. package/dist/sandbox-pkg-source.js +14 -9
  418. package/dist/sealed-key.d.ts +22 -3
  419. package/dist/sealed-key.js +47 -4
  420. package/dist/security.d.ts +23 -26
  421. package/dist/security.js +12 -9
  422. package/dist/server-secret-env.d.ts +10 -10
  423. package/dist/session-children-retire.d.ts +1 -1
  424. package/dist/session-error-wire.d.ts +7 -7
  425. package/dist/session-incarnation.d.ts +65 -37
  426. package/dist/session-incarnation.js +30 -12
  427. package/dist/session-policy-wire.d.ts +27 -5
  428. package/dist/session-policy-wire.js +15 -1
  429. package/dist/session-records-skipped-notice.d.ts +1 -1
  430. package/dist/session-row.d.ts +3 -17
  431. package/dist/session-row.js +4 -0
  432. package/dist/session-sync-kernel.d.ts +4 -4
  433. package/dist/session-sync.d.ts +61 -6
  434. package/dist/session-sync.js +55 -10
  435. package/dist/session-titler.d.ts +7 -6
  436. package/dist/session-titler.js +8 -13
  437. package/dist/session-watch.d.ts +3 -3
  438. package/dist/session-watch.js +4 -4
  439. package/dist/sighup-idle.d.ts +2 -2
  440. package/dist/spec-fields.d.ts +4 -4
  441. package/dist/sql-engine-posture.d.ts +3 -3
  442. package/dist/store-posture.d.ts +2 -2
  443. package/dist/stored-request-tool-axes-m19.d.ts +1 -1
  444. package/dist/task-a2a.d.ts +52 -79
  445. package/dist/task-a2a.js +224 -62
  446. package/dist/task-cwd.d.ts +7 -88
  447. package/dist/task-cwd.js +2 -15
  448. package/dist/task-mcp.d.ts +13 -17
  449. package/dist/task-mcp.js +29 -49
  450. package/dist/task-settings.d.ts +30 -18
  451. package/dist/task-settings.js +33 -3
  452. package/dist/task-workflow.d.ts +0 -24
  453. package/dist/task-workflow.js +2 -1
  454. package/dist/terminal.d.ts +5 -5
  455. package/dist/tighten-only-seats.d.ts +7 -6
  456. package/dist/tighten-only-seats.js +1 -1
  457. package/dist/tool-approval.d.ts +166 -207
  458. package/dist/tool-approval.js +61 -61
  459. package/dist/tool-rule-names.d.ts +2 -2
  460. package/dist/trace/core-keyset-guard.d.ts +13 -8
  461. package/dist/trace/engine-notice-wire.d.ts +5 -5
  462. package/dist/trace/engine-notice-wire.js +1 -0
  463. package/dist/trace/exit-seat.d.ts +31 -4
  464. package/dist/trace/exit-seat.js +69 -67
  465. package/dist/trace/ledger-events.d.ts +3 -3
  466. package/dist/trace/ledger-sink.d.ts +1 -1
  467. package/dist/trace/model-segment.d.ts +3 -3
  468. package/dist/trace/project.d.ts +47 -45
  469. package/dist/trace/project.js +33 -1
  470. package/dist/trace/redact.d.ts +61 -31
  471. package/dist/trace/redact.js +394 -153
  472. package/dist/trace/self-minted-wire.d.ts +302 -14
  473. package/dist/trace/self-minted-wire.js +87 -0
  474. package/dist/trace/sema-provenance.d.ts +1 -1
  475. package/dist/trace/task-notification-facets.d.ts +4 -4
  476. package/dist/trace/wire-projection-faces.d.ts +3 -3
  477. package/dist/trace/wire-projection-faces.js +1 -1
  478. package/dist/unattended-permission-mode.d.ts +5 -5
  479. package/dist/url-credential-refusal.d.ts +52 -0
  480. package/dist/url-credential-refusal.js +14 -0
  481. package/dist/url-refusal.d.ts +16 -3
  482. package/dist/url-refusal.js +15 -2
  483. package/dist/usage-analytics.d.ts +2 -2
  484. package/dist/user-input-ledger.d.ts +23 -23
  485. package/dist/web-admin-client/apply-effective.d.ts +5 -5
  486. package/dist/web-admin-client/apply-effective.js +2 -1
  487. package/dist/web-admin-client/apply-ledger.d.ts +2 -2
  488. package/dist/web-admin-client/center-request.d.ts +2 -2
  489. package/dist/web-admin-client/facade.d.ts +5 -5
  490. package/dist/web-admin-client/facade.js +1 -1
  491. package/dist/web-admin-client/hot-keys-registry.d.ts +2 -2
  492. package/dist/web-admin-client/http-client.d.ts +4 -4
  493. package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
  494. package/dist/web-admin-client/pull-state.d.ts +1 -1
  495. package/dist/web-admin-client/read-face.d.ts +2 -2
  496. package/dist/web-admin-client/read-warnings.d.ts +5 -5
  497. package/dist/web-admin-client/restart-signal.d.ts +6 -6
  498. package/dist/web-admin-client/skills-mcp.d.ts +28 -3
  499. package/dist/web-admin-client/skills-mcp.js +29 -1
  500. package/dist/web-admin-client/types.d.ts +16 -9
  501. package/dist/workspace-space.d.ts +32 -3
  502. package/dist/workspace-space.js +26 -0
  503. package/dist/write-protection.d.ts +2 -2
  504. package/package.json +5 -3
  505. package/scripts/drain-check-local.mjs +4 -2
  506. package/scripts/drain-check.mysql.sql +6 -2
  507. package/scripts/drain-check.pg.sql +6 -2
  508. package/skills/loop.md +1 -1
  509. package/skills/schedule.md +1 -1
  510. package/wire-changes/server@7.104.0.json +134 -0
  511. package/wire-changes/server@7.105.0.json +53 -0
  512. package/wire-changes/server@7.106.0.json +475 -0
  513. package/wire-changes/server@7.107.0.json +64 -0
  514. package/wire-changes/server@7.108.0.json +153 -0
  515. package/wire-changes/server@7.109.0.json +46 -0
  516. package/wire-changes/server@7.110.0.json +90 -0
  517. package/wire-changes/server@7.111.0.json +86 -0
  518. package/wire-changes/server@7.112.0.json +60 -0
  519. package/wire-changes/server@7.113.0.json +26 -0
  520. package/wire-changes/server@7.114.0.json +26 -0
  521. package/wire-changes/server@7.115.0.json +97 -0
  522. package/wire-changes/server@7.116.0.json +218 -0
  523. package/wire-changes/server@7.116.1.json +26 -0
  524. package/wire-changes/server@7.117.0.json +65 -0
  525. package/wire-changes/server@7.118.0.json +129 -0
  526. package/wire-changes/server@7.119.0.json +65 -0
  527. package/wire-changes/server@7.120.0.json +89 -0
  528. package/wire-changes/server@7.121.0.json +219 -0
  529. package/wire-changes/server@7.122.0.json +54 -0
  530. package/wire-changes/server@7.123.0.json +26 -0
  531. package/wire-changes/server@7.124.0.json +336 -0
  532. package/wire-changes/server@7.124.1.json +26 -0
  533. package/wire-changes/server@7.125.0.json +111 -0
  534. package/wire-changes/server@7.126.0.json +285 -0
  535. package/wire-changes/server@7.127.0.json +77 -0
  536. package/wire-changes/server@7.127.1.json +26 -0
  537. package/wire-changes/server@7.127.2.json +53 -0
  538. package/wire-changes/server@7.128.0.json +26 -0
  539. package/wire-changes/server@7.129.0.json +106 -0
  540. package/wire-changes/server@7.129.1.json +26 -0
  541. package/wire-changes/server@7.130.0.json +26 -0
  542. package/wire-changes/server@7.131.0.json +118 -0
  543. package/wire-changes/server@7.132.0.json +226 -0
  544. package/wire-changes/server@7.133.0.json +1155 -0
  545. package/wire-changes/server@7.134.0.json +107 -0
  546. package/wire-changes/server@7.135.0.json +174 -0
  547. package/wire-changes/server@7.136.0.json +448 -0
  548. package/dist/http/run-declared-families.d.ts +0 -16
  549. package/dist/http/run-declared-families.js +0 -12
  550. package/dist/orchestration/workflow-journal-entry.js +0 -27
@@ -109,7 +109,7 @@ export declare function submissionIdemOf(raw: string, caller: IdemCaller, body:
109
109
  */
110
110
  export declare function inflightKeyOf(idem: RunIdemBinding, face: SubmitReplayFace, clientTaskId?: string): string;
111
111
  /**
112
- * 提交腿的**运行结局**(在飞合流共享的那一只)—— `status` + `body` 是它一直以来的两位;S-528 起多一位
112
+ * 提交腿的**运行结局**(在飞合流共享的那一只)—— `status` + `body` 是它一直以来的两位;[ref] 起多一位
113
113
  * `wiringManifest`。
114
114
  *
115
115
  * 🔴 **为什么回执挂在 outcome 上、不铸进 `body`**(codex 对抗复审 [medium],红先复现后修):在飞合流按资源族
@@ -132,7 +132,7 @@ export declare function inflightKeyOf(idem: RunIdemBinding, face: SubmitReplayFa
132
132
  export interface SubmitOutcome {
133
133
  status: number;
134
134
  body: unknown;
135
- /** S-528:本条 run 的起手接线回执(present-iff 引擎真产了 `wiring_manifest` 帧)。 */
135
+ /** [ref]:本条 run 的起手接线回执(present-iff 引擎真产了 `wiring_manifest` 帧)。 */
136
136
  wiringManifest?: WiringManifestReceipt;
137
137
  }
138
138
  //# sourceMappingURL=idempotency.d.ts.map
@@ -1,10 +1,10 @@
1
1
  /**
2
- * S-431 —— 一条 HTTP 请求愿意等**一次远端 MCP 拨号**多久:**一只数、一只 helper**,两口共读。
2
+ * [ref] —— 一条 HTTP 请求愿意等**一次远端 MCP 拨号**多久:**一只数、一只 helper**,两口共读。
3
3
  *
4
4
  * 同一类动作(连一台远端 MCP 服务器 + 列它的工具)在本仓有两张 HTTP 面:
5
5
  * · `GET /v1/sessions/:id/mcp` 面板(`routes/sessions.ts`)—— 物化部署缺省场景的申报,到点答 200 `degraded:true`;
6
6
  * · `POST /v1/sessions/:id/mcp/reconnect`(`routes/mcp-reconnect.ts`)—— 在飞 run 上重拨一台,到点答 503。
7
- * 修前面板有期限、reconnect 是裸 `await`(S-431):同一件事两个读法,一台拨不通 / 半开的远端能把后者挂很久。
7
+ * 修前面板有期限、reconnect 是裸 `await`([ref]):同一件事两个读法,一台拨不通 / 半开的远端能把后者挂很久。
8
8
  * 两口各自**到点答什么**不同(面板是只读的部署面,有一个诚实的空形;reconnect 是一次交易,没有结果就没有
9
9
  * 一个能当 `outcome` 的词)—— 但**等多久**是一个事实,所以只有一个数。
10
10
  *
@@ -26,9 +26,11 @@ export declare class DeadlineExceeded extends Error {
26
26
  * 让**应答**不再等 `work`:`work` 先落定就原样交出(resolve / reject 都不变形),期限先到就 reject
27
27
  * {@link DeadlineExceeded}。
28
28
  *
29
- * 🔴 **只界应答,不取消 `work`**:本函数不持有任何取消把手 —— core 的 `TaskStream.reconnectMcpServer` 与
30
- * `materializeMcpTools` 都不收 `AbortSignal`(d.ts 逐字),所以期限到点后底层拨号**继续跑**,落定时
31
- * 才释放它占的连接 / 子进程。调用点必须把这句话交代给调用方(reconnect 的 503 文案、契约 §G.7c)。
29
+ * 🔴 **只界应答,本身不取消 `work`**:本函数不持有任何取消把手 —— 取消是调用点的事,两口各自读 core 动词的形:
30
+ * · 面板的 `materializeMcpTools` 自 core 7.55.0([ref])起收末位 `signal`:面板在期限到点时触发它,在飞的拨号就停、半开连接被关
31
+ * (`routes/sessions.ts`);
32
+ * · reconnect 的 `TaskStream.reconnectMcpServer(server)` 仍不收 `AbortSignal`(d.ts 逐字)⇒ 期限到点后底层重拨**继续跑**,落定时
33
+ * 才释放它占的连接 / 子进程。这一口必须把这句话交代给调用方(reconnect 的 503 文案、契约 §G.7c)。
32
34
  * 迟到的落定(尤其迟到的 reject)挂一条吞掉,免得没人 await 它时变成未处理拒绝。
33
35
  */
34
36
  export declare function raceDeadline<T>(work: Promise<T>, deadlineMs: number): Promise<T>;
@@ -1,16 +1,16 @@
1
1
  /**
2
- * S-930 —— 记忆合规面(抹除 / 出处)上 core **已分类拒**的**唯一** HTTP 映射。两面同调:
2
+ * [ref] —— 记忆合规面(抹除 / 出处)上 core **已分类拒**的**唯一** HTTP 映射。两面同调:
3
3
  * · operator 面 `routes/memory-compliance.ts`(`POST /v1/memory/erase` · `GET /v1/memory/entries/:entryId/provenance`);
4
4
  * · 会话所有者自助抹除面 `routes/sessions.ts`(`POST /v1/sessions/:id/memory/erase`)。
5
5
  *
6
- * ## 病(sdk 车 SH 黑盒实证,S-930)
6
+ * ## 病(sdk 车 SH 黑盒实证,[ref])
7
7
  * 修前自助面在路由里自写了一份更窄的分类:只认 `config.memory_erasure_request`(400)与 `memory.target_outside_store`(409),
8
8
  * core 的另外三只 409 与 `ControlPlaneCorruptError` 全落 500 `internal.error` —— 「同一个 requestId 拿去抹另一个会话」这种**调用方自己
9
9
  * 能改**的错被说成服务器坏了。两份分类 = 两个判官,少的那份恒是静默的一份。现在**码与状态**只在这里判一次,两面同读。
10
10
  *
11
11
  * ## 规则(三层,与 operator 面既有层序逐字同序)
12
12
  * ① core 的**本口专属**码(闭集穷举 `switch`,见 {@link sentCoreCode})—— 码与状态两面同;文案按受众(下一节,一条规则);
13
- * ② **店形拒**两码 `memory.target_outside_store`(core 7.31.1 #1094)/ `memory.scope_home_not_directory`(core 7.44.0 #1368)—— 跨面 store 状态码,409、码原样
13
+ * ② **店形拒**两码 `memory.target_outside_store`(core 7.31.1 [ref])/ `memory.scope_home_not_directory`(core 7.44.0 [ref])—— 跨面 store 状态码,409、码原样
14
14
  * (判据 `memory-store-refusal.ts` 一只;运维行 `memory_store_form_refused { code, path?, form? }` 两受众同一只铸点,路径只在那里);
15
15
  * ③ `ControlPlaneCorruptError` —— typed 500 `internal.memory_control_plane_corrupt`(fail-closed 信号,一码两义见下);
16
16
  * 其余 ⇒ `false`(未分类,调用方发它自己那句 500 且**不回显**内部文本)。
@@ -30,7 +30,7 @@ import type { ServerResponse } from "node:http";
30
30
  import type { Logger } from "../observability/logger.js";
31
31
  /**
32
32
  * 已分类拒 → HTTP 状态的**唯一**码表 = 自铸 wire 值登记处的 `sessionMemoryEraseStatus` 集(F3:wire 变更清单从同一张表 diff,状态改一处、
33
- * 清单跟着列)。两面同读(S-930:码与状态只判一次)。键写错 ⇒ tsc 红(索引的是 `as const` 表的键)。
33
+ * 清单跟着列)。两面同读([ref]:码与状态只判一次)。键写错 ⇒ tsc 红(索引的是 `as const` 表的键)。
34
34
  */
35
35
  /** 读这张映射的受众(闭集)。会话所有者受众必须交一只 `withheld` —— 被换成固定句的 core 原句落到那里(运维材料不许丢)。 */
36
36
  export type MemoryComplianceAudience = {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 🔴 **属主存取器**(S-487 RH-3 第一期)——「这个调用方读得到这一行 run / 会话吗」的行只经这里取得。
2
+ * 🔴 **属主存取器**([ref] RH-3 第一期)——「这个调用方读得到这一行 run / 会话吗」的行只经这里取得。
3
3
  *
4
4
  * ## 律(一条)
5
5
  * 判官只有一只:run 行 = `principal-gate.ts` 的 `runOwnerReadable`(三条放行臂,含 [ref] C8 窄互认),会话行 = `sessionOwnerReadable`
@@ -39,14 +39,12 @@ export declare function readOwnedRun(config: OwnerAccessConfig, runStore: {
39
39
  getRun(taskId: string): Promise<RunRecord | undefined>;
40
40
  }, principal: Principal | undefined, taskId: string, arm: OwnerArm): Promise<RunRecord | undefined>;
41
41
  /**
42
- * 会话行读口:属主一读 + 无主时 placement 一格(`sessionOwnerCellOf`,S-1770)+ 会话面判官。`undefined` = 没有这只会话(`ownerOf` 答 `undefined`)≡ 读不到。
43
- * 读回的那一格交给调用点(要按属主作答的口用它)。店的读失败照常抛(500,绝不当成「读不到」或「读得到」)。
42
+ * 会话行读口:属主一读(会话店唯一的按 id 读 `headOf(id)?.owner`)+ 无主时 placement 一格(`sessionOwnerCellOf`,[ref])+ 会话面判官。
43
+ * `undefined` = 没有这只会话(头读答 `undefined`)≡ 读不到。读回的那一格交给调用点(要按属主作答的口用它)。店的读失败照常抛(500,绝不当成「读不到」或「读得到」)。
44
44
  */
45
45
  export declare function readOwnedSession(w: IdentityWiring & {
46
46
  readonly config: OwnerAccessConfig;
47
- }, store: Pick<OwnerAwareSessionStore, "placementOf"> & {
48
- ownerOf(sessionId: string): Promise<string | null | undefined>;
49
- }, caller: SessionCaller, sessionId: string, arm: OwnerArm): Promise<SessionOwnerCell | undefined>;
47
+ }, store: Pick<OwnerAwareSessionStore, "placementOf"> & Required<Pick<OwnerAwareSessionStore, "headOf">>, caller: SessionCaller, sessionId: string, arm: OwnerArm): Promise<SessionOwnerCell | undefined>;
50
48
  /**
51
49
  * leader 登记表的判官形(boot 装配一次,`createLeaderEndpoint` 的必填席)—— leader 模块不再自判属主(修前它手抄 `owner == null || owner === requester`,
52
50
  * 缺 C8 窄互认臂而注称 mirrors runOwnerOk)。leader 腿的调用方身份经幂等身份结构(`IdemCaller.principal`,即 `gatedPrincipal` 的回值)转手而来,
@@ -30,7 +30,7 @@ export async function readOwnedRun(config, runStore, principal, taskId, arm) {
30
30
  return row !== undefined && runRowReadable(config, principal, row.owner, arm) ? row : undefined;
31
31
  }
32
32
  export async function readOwnedSession(w, store, caller, sessionId, arm) {
33
- const owner = await store.ownerOf(sessionId);
33
+ const owner = (await store.headOf(sessionId))?.owner;
34
34
  if (owner === undefined)
35
35
  return undefined;
36
36
  const cell = await sessionOwnerCellOf(store, sessionId, owner);
@@ -42,7 +42,7 @@ export declare function gatedPrincipal(req: IncomingMessage, config: ServiceConf
42
42
  */
43
43
  export declare function principalTokenPresentedButUnverified(req: IncomingMessage, config: ServiceConfig): boolean;
44
44
  /**
45
- * 🔴 **`requirePrincipal` 部署上「这次请求没有可用身份」的唯一 401 铸点**(S-305,7.76.2)。
45
+ * 🔴 **`requirePrincipal` 部署上「这次请求没有可用身份」的唯一 401 铸点**([ref],7.76.2)。
46
46
  *
47
47
  * 此前 45 个路由各自手抄同一行 `sendError(res, 401, "auth.principal_required", …)`,于是直连门上
48
48
  * 「JWT 出示了但过期/签不上」与「什么头都没带」在 wire 上**同形**(黑盒实测:plan_review 带过期 JWT
@@ -56,7 +56,7 @@ export declare function principalTokenPresentedButUnverified(req: IncomingMessag
56
56
  */
57
57
  export declare function sendPrincipalRefusal(res: ServerResponse, req: IncomingMessage, config: ServiceConfig): void;
58
58
  /**
59
- * 🔴 **`401 auth.unauthorized` 的唯一铸点**(S-850,7.104.0;test [ref] QA 7a C15)。
59
+ * 🔴 **`401 auth.unauthorized` 的唯一铸点**([ref],7.104.0;test [ref] QA 7a C15)。
60
60
  *
61
61
  * 病:十六处路由(9 个文件)各自手抄同一个 401 —— 码 `auth.unauthorized`、message 就一个词 `unauthorized`。照 sema-up 部署、壳接上
62
62
  * 引擎后,第一句就撞上它,不说要哪份凭据、放哪、去哪拿。
@@ -78,7 +78,7 @@ export declare const UNAUTHORIZED_OPERATOR = "unauthorized \u2014 this endpoint
78
78
  export declare const UNAUTHORIZED_IDENTITY = "unauthorized \u2014 this endpoint acts for a named caller and the request carries no caller identity this deployment verifies: identify the caller the way this deployment does (a registry sign-in token as the Bearer token, a signed principal token on a direct-door deployment, or the principal header set by a trusted front end)";
79
79
  export declare function sendUnauthorized(res: ServerResponse, face: UnauthorizedFace): void;
80
80
  /**
81
- * 🔴 **「这个调用方读得到这一行 run 吗」的唯一谓词**(S-297 抽取;此前只活在 `server.ts runOwnerOk` 的
81
+ * 🔴 **「这个调用方读得到这一行 run 吗」的唯一谓词**([ref] 抽取;此前只活在 `server.ts runOwnerOk` 的
82
82
  * 函数体里,而 `runOwnerOk` 把**判断**与**404 怎么发**焊在一起 —— 于是任何需要同一条判断但不想 404 的
83
83
  * 读面(如 `/mcp` 面板的 `lastLegMcp`:非属主就不投这个键、面板照常 200)只能手抄一份,而手抄那份必然
84
84
  * 漏掉下面这条窄互认臂:`explicitOperatorOk` 顶注已经为同族的病写过「SINGLE mint point,不要再造兄弟」)。
@@ -112,7 +112,7 @@ export interface IdentityWiring {
112
112
  */
113
113
  export declare function wiredIdentitySources(w: IdentityWiring): readonly IdentitySource[];
114
114
  /**
115
- * 🔴 **「这台部署有没有身份边界」的唯一判据**(S-1452;S-1509 改读身份来源)。dev-open = 装配**没接任何身份来源**({@link wiredIdentitySources} 为空:
115
+ * 🔴 **「这台部署有没有身份边界」的唯一判据**([ref];[ref] 改读身份来源)。dev-open = 装配**没接任何身份来源**({@link wiredIdentitySources} 为空:
116
116
  * 没配 service token、没装鉴权桥、没开直连门)、**也没声明**只读 trace token 或 `REQUIRE_PRINCIPAL`:请求里没有任何东西替主体头作保,头是谁都能自报的
117
117
  * **标签**(过滤 / 展示用),不是身份。装了鉴权桥的部署(SSO 单开)带登录令牌的调用方是验过的身份 ⇒ 不是 dev-open(修前只看 token / `REQUIRE_PRINCIPAL`,
118
118
  * 这一形被读成 dev-open,任何人 fleet-wide 读全部会话)。
@@ -151,7 +151,7 @@ export declare function fleetViewOf(req: IncomingMessage, w: IdentityWiring, fac
151
151
  * 面板的上一腿 MCP 投影)。没有身份边界的部署({@link devOpenDeployment})上不钉任何人(与会话列表同读,列表把这只会话列给谁,谁就读得到它);
152
152
  * 有身份边界的部署上:
153
153
  * · **无主的行**经无主臂的唯一判据 `ownerlessRowOpen`(`security.ts`):普通会话照旧对任何调用方开放;委派子代的 placed 行只对 fleet 调用方
154
- * ({@link sessionCallerOf})开放 —— 任何具名主体、没有 service 凭据的无身份调用方都与别人的行同体(调用点答 404)(S-1770)。
154
+ * ({@link sessionCallerOf})开放 —— 任何具名主体、没有 service 凭据的无身份调用方都与别人的行同体(调用点答 404)([ref])。
155
155
  * 代价如实:属主还没定下的子代行连它将来的属主也暂时读不到(由一次性迁移 M23 / 那一行的下一次停驻定下);
156
156
  * · 有主的行就是 run 面那一条谓词({@link runOwnerReadable}),一字不变。
157
157
  * run 面(poll / events / cancel …)不读本谓词 —— 那是 run 资源的门,另一只。
@@ -163,7 +163,7 @@ export declare function sessionOwnerReadable(caller: SessionCaller, cell: Sessio
163
163
  */
164
164
  export type OperatorRoster = Pick<ServiceConfig, "operatorPrincipals" | "operatorSingleUser">;
165
165
  /**
166
- * 🔴 **「谁是 operator」的唯一读法**(S-1050,[ref] ① 裁 A;IMAGE-API-DESIGN.md §P2.4a MUST-FIX 的那一只门)。
166
+ * 🔴 **「谁是 operator」的唯一读法**([ref],[ref] ① 裁 A;IMAGE-API-DESIGN.md §P2.4a MUST-FIX 的那一只门)。
167
167
  * · 名单为空 ⇒ **没人是**(没有任何形把「空名单」读成「人人是」—— 那条读法 `isOperator` 已删);
168
168
  * · 名单非空 ⇒ 验过的主体在名单里才是;
169
169
  * · 单用户形显式声明 `OPERATOR_SINGLE_USER=true` ⇒ 这台部署的**每个调用方**都是(单用户形只有一位用户,能到这台部署的就是他;边界是部署自己的
@@ -175,7 +175,7 @@ export declare function explicitOperatorOk(principal: string | undefined, roster
175
175
  /** 「这台部署**有没有**运维」的唯一读法(名单非空 ∨ 单用户声明在场)—— 能力事实 `operatorLane`、整理阀门的可达性告警、起服提示同读这一只。 */
176
176
  export declare function operatorRosterPresent(roster: OperatorRoster): boolean;
177
177
  /**
178
- * 起服提示(S-1050):单用户形(`REQUIRE_PRINCIPAL` 未开)+ 没有运维名册 + 这台部署有审批底座 ⇒ 一行 warn。这一形在「空名单 = 人人是」那条读法退役之后
178
+ * 起服提示([ref]):单用户形(`REQUIRE_PRINCIPAL` 未开)+ 没有运维名册 + 这台部署有审批底座 ⇒ 一行 warn。这一形在「空名单 = 人人是」那条读法退役之后
179
179
  * 丢的东西就是审批队列的运维视图(跨 scope 列表 / `?owner=` / 无主体调用方的整个队列),补回它只要一行配置 —— 不拒启:升级那一拍打掉一台今天跑得好好的
180
180
  * 单用户机器比一条提示重。多租形不提示(它另有拒启不变量);没有审批底座的形什么都没少。
181
181
  */
@@ -1,4 +1,5 @@
1
1
  import { timingSafeEqual } from "node:crypto";
2
+ import { DEPLOYMENT_SHAPE_PREDICATES } from "../deployment-shape.js";
2
3
  import { PRINCIPAL_TOKEN_HEADER, verifiedPrincipal, ssoVerifiedPrincipal, ownerlessRowOpen, mintPrincipal } from "../security.js";
3
4
  import { sendError } from "./send.js";
4
5
  export function headerStr(v) {
@@ -98,7 +99,7 @@ export function runOwnerReadable(principal, owner, config) {
98
99
  return true;
99
100
  if (principal !== undefined && sameIdentity(principal, owner))
100
101
  return true;
101
- return !config.requirePrincipal && owner === "anon:shell-live" && principal === undefined;
102
+ return !DEPLOYMENT_SHAPE_PREDICATES.principalRequired.holds(config) && owner === "anon:shell-live" && principal === undefined;
102
103
  }
103
104
  export function hasServiceAuth(config) {
104
105
  return Boolean(config.authToken) || Object.keys(config.authTokens ?? {}).length > 0;
@@ -121,7 +122,7 @@ export function wiredIdentitySources(w) {
121
122
  return IDENTITY_SOURCES.filter((k) => identitySourceWired(k, w));
122
123
  }
123
124
  export function devOpenDeployment(w) {
124
- return wiredIdentitySources(w).length === 0 && !w.config.traceToken && !w.config.requirePrincipal;
125
+ return wiredIdentitySources(w).length === 0 && !w.config.traceToken && !DEPLOYMENT_SHAPE_PREDICATES.principalRequired.holds(w.config);
125
126
  }
126
127
  export function actsForDeployment(req, config, principal) {
127
128
  return systemFor(req, config) !== undefined && principal() === undefined;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * S-739 / S-740(车OE,7.102.0):**就绪判的唯一属主** —— 一只谓词 {@link readinessOf},全部读点经它:
2
+ * [ref] / [ref](车OE,7.102.0):**就绪判的唯一属主** —— 一只谓词 {@link readinessOf},全部读点经它:
3
3
  *
4
4
  * ① `GET /readyz`(`dispatch.ts`,凭据门之前,与 `/health` 同位):200 `{ready:true}` / 503 `{ready:false, reasons}` ——
5
5
  * 给**摘流**语义的探针(k8s readinessProbe / LB 健康检查);**重启**语义的探针(Docker HEALTHCHECK、k8s livenessProbe)
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 请求守门族(S-147 切片:`http/server.ts` 4837–5195 + `MAX_BODY` 逐字搬家,正文一字未改)。
2
+ * 请求守门族([ref] 切片:`http/server.ts` 4837–5195 + `MAX_BODY` 逐字搬家,正文一字未改)。
3
3
  * 配额 / 租约 / 用量窗 / 限流 / owner-scope / 体读取 —— 每只守门的判据与它自己的头注原位随行。
4
4
  * ctx 字段 1 只(`deps`):本族对外围的耦合就这一格,它也是这一族的可测性读数。
5
5
  */
@@ -21,7 +21,7 @@ import { type SqlWallSource, type SqlWallsReading } from "../plugins/sql-driver.
21
21
  * 入参是**已判好的墙**(`sql-driver.ts` `sqlWallsOf` —— 事实缺席时的落点只在那里定义,与 blob 帽同一只判官、同一个方向);本函数不读事实、不判缺席,
22
22
  * 墙从哪来(`sources` 里**被拒的那一堵**的出处)原样带进判决(`wallSource`),拒句按它分两形:库报的墙点名库的上限与旋钮,假定的墙(事实还没建立,或事实在场但这一堵读失败、退了文档缺省)只说「库的这个上限没读到、按最保守的墙拒」。
23
23
  *
24
- * 🔴 **包墙腿是同一只规则的提前一跑,不是第二套规则**(S-1746 主会话裁定):包墙是物理连接的事实(会话值,连接建立时从全局拷一份、此后不变),
24
+ * 🔴 **包墙腿是同一只规则的提前一跑,不是第二套规则**([ref] 主会话裁定):包墙是物理连接的事实(会话值,连接建立时从全局拷一份、此后不变),
25
25
  * 终判在将要执行写入的那条连接上 —— 那是库自己(续跑输入那一笔被拒 ⇒ 店的带码拒 ⇒ 同一个 413;会话日志那一笔走它既有的失败面);SQL 快照 blob 则由
26
26
  * `blob-backend.ts` 经 `connectJudged` 在写入连接上判。受理时手里没有那条连接,判官 `sqlWallsOf` 读的 `facts` 是池里**最近一次初始化**的那条连接的读数
27
27
  * (`SqlDriver.facts`:池见过的最新读数,只在有连接初始化时才更新),同一个折算 `packetWallStatementBytes`:拒 ⇒ 413 在任何副作用之前;收 ⇒ 写入那条连接上的判决仍是终判。
@@ -44,7 +44,7 @@ export interface SubmitBodyRefusal {
44
44
  }
45
45
  export declare function refuseSubmitBody(walls: SqlWallsReading, body: unknown): SubmitBodyRefusal | null;
46
46
  /**
47
- * S-866 ③ —— 租约拒绝的应答形({@link leaseRefusalOf} 的产物;`{status, body}` 交回形 + 镜像头用的 `retryAfterSec`)。
47
+ * [ref] ③ —— 租约拒绝的应答形({@link leaseRefusalOf} 的产物;`{status, body}` 交回形 + 镜像头用的 `retryAfterSec`)。
48
48
  * 体经唯一组句器铸(键序 `error, errorCode, …机读位`;冻结门 `FROZEN_RESULT_BODY` 读 `refusalBody({ errorCode, message, … })` 这一形)。
49
49
  */
50
50
  export interface LeaseRefusal {
@@ -53,7 +53,7 @@ export interface LeaseRefusal {
53
53
  readonly retryAfterSec: number;
54
54
  }
55
55
  /**
56
- * S-866 ③ —— 一次被拒的租约准入 → HTTP 应答的**唯一**映射(三只门 {@link createRequestGuards} 里的 `leaseDenied` /
56
+ * [ref] ③ —— 一次被拒的租约准入 → HTTP 应答的**唯一**映射(三只门 {@link createRequestGuards} 里的 `leaseDenied` /
57
57
  * `ownerLeaseDenied` / `ownerFleetLeaseDenied` 同调它;12 个调用点零改)。按拒因穷举(加一臂 = 编译红):
58
58
  * · `budget_exhausted` ⇒ **429 `quota_exhausted`**(字节同 7.105.0 的路由发送形:`retryAfterSec` + 中心 E4 结构化字段逐字透传);
59
59
  * · `lease_unavailable` ⇒ **503 `fleet.lease_unavailable`**(只在 `FLEET_LEASE_FAIL_CLOSED` 生效时出现):体 `{reason, retryAfterSec}`,
@@ -6,6 +6,7 @@ import { refusalBody } from "./refusal-body.js";
6
6
  import { limitFactsUnmeasured } from "../limit-refusal.js";
7
7
  import { gatedPrincipal, explicitOperatorOk, sessionOwnerReadable, sessionCallerOf, sendPrincipalRefusal } from "./principal-gate.js";
8
8
  import { runRowReadable } from "./owner-access.js";
9
+ import { DEPLOYMENT_SHAPE_PREDICATES } from "../deployment-shape.js";
9
10
  import { quotaWindowResetsAt } from "../observability/cost-quota.js";
10
11
  import { escapedStatementBytes, packetWallStatementBytes, rowWallPayloadBytes } from "../plugins/sql-driver.js";
11
12
  const MAX_BODY = 8 * 1024 * 1024;
@@ -186,7 +187,7 @@ export function createRequestGuards(ctx) {
186
187
  }
187
188
  function ownerGate(req, res, readable, notFound) {
188
189
  const principal = gatedPrincipal(req, deps.config);
189
- if (deps.config.requirePrincipal && !principal) {
190
+ if (DEPLOYMENT_SHAPE_PREDICATES.principalRequired.holds(deps.config) && !principal) {
190
191
  sendPrincipalRefusal(res, req, deps.config);
191
192
  return false;
192
193
  }
@@ -1,8 +1,8 @@
1
1
  /**
2
- * **续跑上下文这一次读的结局**(S-577 第二半,7.94.0)—— 属主模块,所有消费腿共用这一只读口。
2
+ * **续跑上下文这一次读的结局**([ref] 第二半,7.94.0)—— 属主模块,所有消费腿共用这一只读口。
3
3
  *
4
4
  * 🔴 **为什么必须有这只铸点**:此前各消费腿各写一句 `.catch(() => null)`(还有一处把异常文案拼上 wire),
5
- * 于是店层在 S-577 里把坏体从「答缺席」改成「响亮拒」之后,那些 `catch` 会把那次拒**原样吞回缺席** ——
5
+ * 于是店层在 [ref] 里把坏体从「答缺席」改成「响亮拒」之后,那些 `catch` 会把那次拒**原样吞回缺席** ——
6
6
  * 机制上「坏体不再与缺席同答」成立,**用户面上不成立**(用户拿到的还是同一个 409)。判据要钉用户实际
7
7
  * 拿到的码,这只铸点就是让那句判据有地方落(test [ref] 的判据订正,当拍采纳)。
8
8
  *
@@ -16,22 +16,21 @@
16
16
  * ⚠️ `not-text`(投影漂 = 我方的码病)**刻意不进这一态**,原样上抛、响亮成 500 —— 不许伪装成
17
17
  * 「数据坏了」,更不许折成缺席(那会让一次代码漂看起来像「这条会话没有上下文」)。
18
18
  *
19
- * 🔴 **按「店的拒绝形」分类,不按「列错误类」**(S-608,7.95.1:这一句此前反了,整整一版)。修前本口
19
+ * 🔴 **按「店的拒绝形」分类,不按「列错误类」**([ref],7.95.1:这一句此前反了,整整一版)。修前本口
20
20
  * 认的是属主谓词 `isJsonColumnBodyProblem`(= 一只 `SqlJsonColumnError`),而 SQL 两孪生的 `refusing()`
21
21
  * 早把列错误**折**成了一只普通 `Error` ⇒ 折后的错落进下面那条「店抖动 ⇒ 当缺席」臂,坏体与缺席在
22
- * 用户面上仍然同答 409 —— 正是 S-577 第二半要修的那个病,只是它当时只在 local 车道上修成了(那一侧
22
+ * 用户面上仍然同答 409 —— 正是 [ref] 第二半要修的那个病,只是它当时只在 local 车道上修成了(那一侧
23
23
  * 恰好没折码,把列错误漏了出来 = 巧合式正确)。两条车道现在同一份拒绝契约,本口只认它。
24
24
  *
25
- * 🔴 **第四态 `unsealable`(S-1907,7.134.0):读出来了,但凭据位上的封签开不开**。店交出的是**落盘形**(凭据位上是封签,`StoredCheckpointCtx`);
25
+ * 🔴 **第四态 `unsealable`([ref],7.134.0):读出来了,但凭据位上的封签开不开**。店交出的是**落盘形**(凭据位上是封签,`StoredCheckpointCtx`);
26
26
  * 本口在任何消费者看到之前经**唯一**开口 `openCheckpointCtx` 开封(规则属主 = `checkpoint-ctx.ts` 末段「凭据位密封」)—— 所以 `ok` 交出的恒是开封形,
27
27
  * 没有哪条腿拿着封签去重建 spec。开不开(没有保管店 / 钥匙不在本副本 / 密文坏或不是本行封的 / 明文 / 认不出的封签)⇒ `unsealable`(`field` + `reason`),
28
28
  * 各续跑入口答 {@link resumeCtxUnsealableAnswer}(409 `conflict.checkpoint_ctx_unsealable`)。**不折成缺席**(出路不同:缺席 = 重提;开不开 = 看 `reason`
29
29
  * —— `key_not_held` 多半是多副本没共享保管目录,运维修好之后同一个决定原样重发即可),**不明文回落、不丢键**。
30
30
  * 开封要知道这一行的会话(封签绑会话)与开口(`ServiceDeps.checkpointCtxSealing`;缺席 = 本副本没有保管店):两件一起交({@link CheckpointCtxOpening})。
31
31
  *
32
- * **两种读法,一只读口**(第二个实参):① 开封形({@link CheckpointCtxOpening})—— 续跑重建 spec 的每一条腿;② {@link KEEP_SEALED}「信封原样留着」——
33
- * 只读**非凭据字段**的读者(今天 = inbox 的展示位 `objective`):不开封、不判凭据位(活凭据不为展示进内存),交回落盘形 `StoredCheckpointCtx`,
34
- * 结局里没有 `unsealable` 这一态(型面就没有;店边界的三态与开封形逐字同一段)。凭据位上的值在这种读法里仍是封签 —— 谁要用它们就必须走读法 ①。
32
+ * **一种读法**(第二个实参 = 开封的两件 {@link CheckpointCtxOpening}):读续跑上下文的只有续跑重建 spec 的那几条腿。7.136.0 起([ref])
33
+ * inbox 的展示位 `objective` 改读 run 行的目标预览,此前为它而设的第二种读法(「信封原样留着」,只读非凭据字段)随唯一的读者一起退役。
35
34
  */
36
35
  import type { CheckpointCtx } from "./route-ctx.js";
37
36
  import { type CheckpointCtxOpener, type CheckpointCtxUnsealableReason, type StoredCheckpointCtx } from "./checkpoint-ctx.js";
@@ -49,27 +48,14 @@ export type ResumeCtxRead = {
49
48
  readonly field: string;
50
49
  readonly reason: CheckpointCtxUnsealableReason;
51
50
  };
52
- /** 读法 ② 的结局:店边界的三态,`ok` 交落盘形(凭据位上仍是封签)。 */
53
- export type SealedResumeCtxRead = {
54
- readonly kind: "ok";
55
- readonly ctx: StoredCheckpointCtx;
56
- } | {
57
- readonly kind: "absent";
58
- } | {
59
- readonly kind: "corrupt";
60
- readonly where: string;
61
- };
62
51
  /** 开封的两件:这一行的会话(= 交给店 `getCtx` 的那一个)与开口(缺席 = 本副本没有保管店)。 */
63
52
  export interface CheckpointCtxOpening {
64
53
  readonly sessionId: string;
65
54
  readonly opener: CheckpointCtxOpener | undefined;
66
55
  }
67
- /** 读法 ② 的词:信封原样留着(只读非凭据字段)。 */
68
- export declare const KEEP_SEALED = "keep_sealed";
69
56
  export declare function readResumeCtx(load: Promise<StoredCheckpointCtx | null>, opening: CheckpointCtxOpening): Promise<ResumeCtxRead>;
70
- export declare function readResumeCtx(load: Promise<StoredCheckpointCtx | null>, opening: typeof KEEP_SEALED): Promise<SealedResumeCtxRead>;
71
57
  /**
72
- * 开不开的对外答复(S-1907)—— 409 `conflict.checkpoint_ctx_unsealable`,机读 `field`(哪一个凭据位,提交体路径;键名不是秘密,值从不进来)+ `reason`
58
+ * 开不开的对外答复([ref])—— 409 `conflict.checkpoint_ctx_unsealable`,机读 `field`(哪一个凭据位,提交体路径;键名不是秘密,值从不进来)+ `reason`
73
59
  * (闭集 `CHECKPOINT_CTX_UNSEALABLE_REASONS`)。句子说「这条任务的续跑上下文里带的凭据本服务开不开」、五种成因与出路(按 `reason` 修好保管目录后原样重发,
74
60
  * 或作为新任务重提、仍停驻的先取消)。拒在任何状态改动之前:卡仍待决、行字节不动、`plan_review` 的一次性 nonce 未烧。
75
61
  * 🔴 形是给冻结门看的(与 {@link resumeCtxCorruptAnswer} 同一条):`status: <三位数>, body: refusalBody({ errorCode: "<码>", message: "<整句双引号字面>"`,中间只许有空白。
@@ -82,7 +68,7 @@ export declare function resumeCtxUnsealableAnswer(read: {
82
68
  body: RefusalBody;
83
69
  };
84
70
  /** 坏体的对外答复 —— 与会话策略面**同码**(`session-policy-wire.ts` 的 `corrupt` ⇒ 500),不铸新词。
85
- * 文案只说「哪一行读不出来 + 该找谁」,不把店层 detail 拼上 wire(内部机件不上 wire,S-376 同律)。 */
71
+ * 文案只说「哪一行读不出来 + 该找谁」,不把店层 detail 拼上 wire(内部机件不上 wire,[ref] 同律)。 */
86
72
  export declare function resumeCtxCorruptAnswer(where: string): {
87
73
  status: number;
88
74
  body: RefusalBody;
@@ -1,10 +1,9 @@
1
1
  import { openCheckpointCtx } from "./checkpoint-ctx.js";
2
2
  import { SqlJsonColumnError, StoreCorruptError } from "../plugins/sql-json-column.js";
3
3
  import { refusalBody } from "./refusal-body.js";
4
- export const KEEP_SEALED = "keep_sealed";
5
4
  export async function readResumeCtx(load, opening) {
6
5
  const read = await readStoredCtx(load);
7
- if (read.kind !== "ok" || opening === KEEP_SEALED)
6
+ if (read.kind !== "ok")
8
7
  return read;
9
8
  const opened = openCheckpointCtx(read.ctx, opening.opener, opening.sessionId);
10
9
  return opened.kind === "ok" ? { kind: "ok", ctx: opened.ctx } : { kind: "unsealable", field: opened.field, reason: opened.reason };
@@ -28,7 +27,7 @@ export function resumeCtxUnsealableAnswer(read) {
28
27
  status: 409,
29
28
  body: refusalBody({
30
29
  errorCode: "conflict.checkpoint_ctx_unsealable",
31
- message: "this task's stored resume context holds credentials from its request (MCP / A2A headers or env values, settings.env, settings.webSearch.apiKey, or http hook headers) that this server cannot unseal — reason says why: no_key_store (this server has no sealed-key store), key_not_held (they were sealed with a key this server does not hold: another replica's, or a replaced sealed-key directory), unopenable (the sealed value is damaged or belongs to another session), plaintext (an older server version stored them unsealed), unrecognized_seal (a seal format this version does not know). Nothing was decided and nothing was resumed. If whoever operates this deployment restores the sealed-key directory that sealed them and restarts this server (it reads its keys only at startup), the same request can be sent again; otherwise submit the work again as a new task, and if this task is still suspended cancel it first (POST /v1/runs/:id/cancel).",
30
+ message: "this task's stored resume context holds credentials from its request (static request headers, the command lines and environment values given to MCP stdio servers and command hooks, settings.env, or settings.webSearch.apiKey) that this server cannot unseal — reason says why: no_key_store (this server has no sealed-key store), key_not_held (they were sealed with a key this server does not hold: another replica's, or a replaced sealed-key directory), unopenable (the sealed value is damaged or belongs to another session), plaintext (an older server version stored them unsealed), unrecognized_seal (a seal format this version does not know). Nothing was decided and nothing was resumed. If whoever operates this deployment restores the sealed-key directory that sealed them and restarts this server (it reads its keys only at startup), the same request can be sent again; otherwise submit the work again as a new task, and if this task is still suspended cancel it first (POST /v1/runs/:id/cancel).",
32
31
  facts: {
33
32
  field: read.field,
34
33
  reason: read.reason,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 续跑腿家族 + 路由 ctx 的装配(S-147 切片:`http/server.ts` 2378–4804 与 1119–1128 逐字搬家,正文一字未改)。
2
+ * 续跑腿家族 + 路由 ctx 的装配([ref] 切片:`http/server.ts` 2378–4804 与 1119–1128 逐字搬家,正文一字未改)。
3
3
  *
4
4
  * 🔴 为什么 `routeCtxBase` 住在这个文件里而不是组合根:`startFreshHostTurn` 把**整只** ctx 交给
5
5
  * `mintAndDriveDurableRun`,而 `ctx.legs` 装的正是本文件这几条腿 —— 两者是一个结。拆开只有两条路:
@@ -8,7 +8,7 @@
8
8
  * 腿是提升的函数声明、ctx 是文件尾的 `const`,谁也不会在工厂执行期读到对方。
9
9
  *
10
10
  * ctx 字段 27 只(registry 6 + helpers 14 + deps/runnerFor/prepareSpec/finalizeTaskResult + 三只配额/租约/用量窗
11
- * 判据;S-947 删 `cancelledViaVerb` 旁表后 28 → 27,与 `test/split-ctx-parity.test.ts` 的读数同)—— 这是**如实披露**的耦合读数(设计稿 §9:把它变小是波 3 的事,本刀不承诺)。型一律从既有型派生
11
+ * 判据;[ref] 删 `cancelledViaVerb` 旁表后 28 → 27,与 `test/split-ctx-parity.test.ts` 的读数同)—— 这是**如实披露**的耦合读数(设计稿 §9:把它变小是波 3 的事,本刀不承诺)。型一律从既有型派生
12
12
  * (`RunRegistry` / `RouteHelpers` / `RouteLegs` / `ReturnType<typeof createRequestGuards>`),不手抄签名 ⇒ 不会漂。
13
13
  */
14
14
  import type { IncomingMessage } from "node:http";
@@ -29,7 +29,7 @@ import { type ResumeRefusalAnswer } from "./checkpoint-ctx.js";
29
29
  */
30
30
  export declare function resumeRefusalDisposition(e: CheckpointError): "cancelled" | "retriable" | "terminal";
31
31
  /**
32
- * 🔴 **引擎拒一次续跑(`CheckpointError`)的 HTTP 答复 —— 唯一组句器**(S-1690 / S-1692,core 7.52.0;五条续跑腿〔`/decide` · `/resume` · `/wake` · `plan_review` ·
32
+ * 🔴 **引擎拒一次续跑(`CheckpointError`)的 HTTP 答复 —— 唯一组句器**([ref] / [ref],core 7.52.0;五条续跑腿〔`/decide` · `/resume` · `/wake` · `plan_review` ·
33
33
  * workflow 决定在宿主会话上起的新一跑〕同经 `driveResumeLeg` 的 catch 臂到这里,SLA 拒扫腿与 PARKED 赎回席经 `resumeCheckpoint` 同得)。
34
34
  *
35
35
  * 规则(一条):**一次拒 = 一个答复形,与「谁发现的」无关**。引擎在认领前 / CAS 前拒的,与本服务在重放存量体之前自己拒的(`resume_blocked_by_policy`,
@@ -3,9 +3,10 @@ import { createHash } from "node:crypto";
3
3
  import { uuidv7, resumeWithVerification, CheckpointError, defaultTaskRegistry, taskNotificationDedupKey, validatePendingSteer, GLOBAL_USAGE_KEY, PAUSE_REGISTRY } from "@sema-agent/core";
4
4
  import { decideParkedAgent, denyWorkflowParkForked, denyWorkflowParksUnreadable, findParkOrigin, heldWorkflowParkDecisions, planWorkflowParkedDecide } from "../parked-decide.js";
5
5
  import { parkDecisionFingerprint } from "../orchestration/workflow-park-decision.js";
6
+ import { headReadOf } from "../session-incarnation.js";
6
7
  const DELIVERY_NOT_RECORDED = "workflow park decide: this delivery no longer holds the host session (its claim was released) — the decision was not recorded and this delivery was not started";
7
- const sessionFaceUnavailable = async (sessionId) => {
8
- throw new Error(`parked decide cannot verify which occupant session ${sessionId} belongs to: this deployment's session store has no sessionFaceOf read (every built-in store has one) — refusing rather than resuming unverified`);
8
+ const headUnavailable = async (sessionId) => {
9
+ throw new Error(`parked decide cannot verify which occupant session ${sessionId} belongs to: this deployment's session store has no head read (headOf; every built-in store has one) — refusing rather than resuming unverified`);
9
10
  };
10
11
  import { HttpError, decodeCheckpointScope, CHECKPOINT_PUBLIC_SCOPE } from "../security.js";
11
12
  import { parkToolCallId, TurnAnchorCapture, HEARTBEAT_MS, markChildrenStoppedByUserOnAbort } from "../runs.js";
@@ -18,7 +19,7 @@ import { emitPendingWorkflowCompletions, taskNotificationInboxEntry, taskNotific
18
19
  import { fleetRunPublisher, fleetRunLabels, fleetRunResiduals, isFleetAgentTerminalNotification } from "../fleet/fleet-bus.js";
19
20
  import { defaultSubagentTailBus } from "../fleet/subagent-tail-bus.js";
20
21
  import { currentApprovalGateToken } from "../approval-gate-currency.js";
21
- import { createApprovalCardEmitter, declaredApprovalFrameFamilies, isApprovalGateKind, parkRowStandingAnswerFacts, resolveApprovalLeg, resolveStreamApprovalGate, standingAnswerDurablyRecordable } from "../tool-approval.js";
22
+ import { createApprovalCardEmitter, declaredApprovalFrameFamilies, parkRowStandingAnswerFacts, resolveApprovalLeg, resolveStreamApprovalGate, standingAnswerDurablyRecordable } from "../tool-approval.js";
22
23
  import { buildCheckpointAnchorHash } from "../approval-ask-audit-store.js";
23
24
  import { APPROVAL_ENDING_CAUSES } from "../approval-deny-reasons.js";
24
25
  import { serviceVersion } from "../service-version.js";
@@ -46,7 +47,7 @@ import { gatedPrincipal, explicitOperatorOk } from "./principal-gate.js";
46
47
  import { buildActiveRunConflict, resumeEntryForGate } from "./active-run-conflict.js";
47
48
  import { commitPlacement, devicePlacementErrorBody } from "./device-placement.js";
48
49
  import { commitSessionInheritEnv } from "./session-inherit-env.js";
49
- import { ASK_USER_QUESTION_TOOL_NAME } from "../approval-content-kind.js";
50
+ import { ASK_USER_QUESTION_TOOL_NAME, isApprovalGateKind } from "../approval-content-kind.js";
50
51
  import { deploymentListAsks } from "../approval.js";
51
52
  import { readResumeCtx, resumeCtxCorruptAnswer, resumeCtxUnsealableAnswer } from "./resume-ctx-read.js";
52
53
  import { buildCheckpointVersionKeys, resumeBlockedByPolicyAnswer, resumeRefusalWithCard, sealCheckpointCtx, storedBodyReplayAnswer, storedBodyReplayLogFields, withPermissionModeRewritten } from "./checkpoint-ctx.js";
@@ -92,6 +93,7 @@ const WORKER_SWAP_REDEEMABLE = {
92
93
  registry_occupied: true,
93
94
  unknown_model_ref: true,
94
95
  not_a_model_ref: true,
96
+ unknown_role_word: true,
95
97
  };
96
98
  function checkpointRowRedeemableElsewhere(reason) {
97
99
  return reason !== undefined && WORKER_SWAP_REDEEMABLE[reason] === true;
@@ -153,6 +155,7 @@ const CHECKPOINT_ERROR_FIELD_ROLE = {
153
155
  answer: "answer",
154
156
  hostDecision: "outcome_cell",
155
157
  approver: "outcome_cell",
158
+ feedback: "outcome_cell",
156
159
  taskConfig: "config",
157
160
  deps: "config",
158
161
  inheritedGate: "config",
@@ -399,7 +402,7 @@ export function createResumeLegs(ctx) {
399
402
  checkpointStore: cs,
400
403
  registry: defaultTaskRegistry,
401
404
  reviveSurface: parkedSurface,
402
- sessionFaceOf: deps.sessionStorage?.sessionFaceOf ? deps.sessionStorage.sessionFaceOf.bind(deps.sessionStorage) : sessionFaceUnavailable,
405
+ headOf: headReadOf(deps.sessionStorage) ?? headUnavailable,
403
406
  ...(deps.parkedKnownAgentTypes ? { knownAgentTypes: deps.parkedKnownAgentTypes } : {}),
404
407
  ...(deps.parkedReviveInheritedGate ? { rebuildInheritedGate: deps.parkedReviveInheritedGate } : {}),
405
408
  ...(deps.toolApproval ? { approverSeatFor: windowZeroSeatOf(deps.toolApproval) } : {}),
@@ -856,9 +859,9 @@ export function createResumeLegs(ctx) {
856
859
  if (deps.userInputLedger && taskId)
857
860
  await deps.userInputLedger.announceUndrained({ sessionId, taskId });
858
861
  const anchorOwner = principal ?? null;
859
- const getLeafId = deps.sessionStorage?.getLeafId?.bind(deps.sessionStorage);
860
- const captureTurnAnchor = deps.resumeAnchorStore && getLeafId
861
- ? async (eventId) => { const leaf = await getLeafId(sessionId); if (leaf)
862
+ const headOf = headReadOf(deps.sessionStorage);
863
+ const captureTurnAnchor = deps.resumeAnchorStore && headOf
864
+ ? async (eventId) => { const leaf = (await headOf(sessionId))?.leafId; if (leaf)
862
865
  await deps.resumeAnchorStore.put(sessionId, eventId, leaf, anchorOwner); }
863
866
  : undefined;
864
867
  const captureUserMessageAnchor = deps.resumeAnchorStore && taskId