@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
@@ -1,5 +1,33 @@
1
1
  import { classifySyncRelationship } from "./session-sync-kernel.js";
2
2
  import { loosenReasons, normalizeRules } from "@sema-agent/core";
3
+ import { headReadOf } from "./session-incarnation.js";
4
+ import { judgeSessionRulesWrite } from "@sema-agent/core";
5
+ export class FileHistoryUnreadableError extends Error {
6
+ sessionId;
7
+ failure;
8
+ code = "state.file_history_unreadable";
9
+ constructor(sessionId, failure) {
10
+ super(`file history of session ${sessionId} cannot be read whole (${failure.code}): ${failure.message}`);
11
+ this.sessionId = sessionId;
12
+ this.failure = failure;
13
+ this.name = "FileHistoryUnreadableError";
14
+ }
15
+ }
16
+ export async function exportedFileHistory(store, sessionId) {
17
+ if (typeof store.exportHistory !== "function")
18
+ return null;
19
+ const exported = await store.exportHistory(sessionId);
20
+ if (!exported.ok)
21
+ throw new FileHistoryUnreadableError(sessionId, exported.error);
22
+ return exported.history;
23
+ }
24
+ export function syncBlobFacesOf(store) {
25
+ return store.syncBlobFaces === true && typeof store.putBlob === "function" && typeof store.getBlob === "function" ? store : undefined;
26
+ }
27
+ export function blobGetterOf(store) {
28
+ const faces = syncBlobFacesOf(store);
29
+ return faces ? (hash) => faces.getBlob(hash) : async () => undefined;
30
+ }
3
31
  export function fileHistoryImportFace(fs) {
4
32
  const candidate = fs?.importHistory;
5
33
  if (typeof candidate !== "function")
@@ -11,10 +39,21 @@ export async function replayFileHistory(store, scope, envelope, srcGetBlob, opts
11
39
  if (face === undefined) {
12
40
  return { ok: false, error: { code: "unsupported_format", message: "this deployment's file-history store has no importHistory seam" } };
13
41
  }
14
- let r = await face.importHistory(scope, envelope, srcGetBlob);
42
+ const attempt = async () => {
43
+ let missing;
44
+ const observed = async (hash) => {
45
+ const bytes = await srcGetBlob(hash);
46
+ if (bytes === undefined && missing === undefined)
47
+ missing = hash;
48
+ return bytes;
49
+ };
50
+ const r = await face.importHistory(scope, envelope, observed);
51
+ return r.ok || missing === undefined ? r : { ok: false, error: r.error, missingBlob: missing };
52
+ };
53
+ let r = await attempt();
15
54
  if (!r.ok && r.error.code === "conflict" && opts.allowReplace && typeof store.deleteBySession === "function") {
16
55
  await store.deleteBySession(scope);
17
- r = await face.importHistory(scope, envelope, srcGetBlob);
56
+ r = await attempt();
18
57
  }
19
58
  return r;
20
59
  }
@@ -29,10 +68,10 @@ export async function exportSessionManifest(sessionId, srcBackend, historyStore)
29
68
  const entryIds = await listEntryIds(sessionId);
30
69
  if (entryIds === null)
31
70
  return null;
32
- const getLeafId = session.getLeafId?.bind(session);
33
- const leafId = getLeafId ? await getLeafId(sessionId) : null;
71
+ const headOf = headReadOf(session);
72
+ const leafId = headOf ? ((await headOf(sessionId))?.leafId ?? null) : null;
34
73
  const fs = historyStore;
35
- const fileHistory = typeof fs.exportHistory === "function" ? await fs.exportHistory(sessionId) : null;
74
+ const fileHistory = await exportedFileHistory(fs, sessionId);
36
75
  const policyStore = srcBackend.sessionPolicy();
37
76
  const policy = typeof policyStore.listBySession === "function"
38
77
  ? await policyStore.listBySession(sessionId)
@@ -43,8 +82,7 @@ export async function exportSessionManifest(sessionId, srcBackend, historyStore)
43
82
  if (summaryOf === undefined)
44
83
  throw new Error("exportSessionManifest: the session store has no row read face (sessionSummaryOf) — the sessionSync fact should have refused this deployment");
45
84
  const row = await summaryOf(sessionId);
46
- const getBlobFn = fs.getBlob?.bind(fs);
47
- const getBlob = getBlobFn ? (hash) => getBlobFn(hash) : async () => undefined;
85
+ const getBlob = blobGetterOf(fs);
48
86
  return {
49
87
  manifest: { sessionId, entryIds, entryCount: entryIds.length, leafId, fileHistory, policy, anchors, ...(row !== undefined ? { title: row.title, pinned: row.pinned } : {}) },
50
88
  getBlob,
@@ -57,18 +95,25 @@ export async function planSync(sessionId, srcBackend, dstBackend) {
57
95
  const dstEntries = (await ownerAware(dstBackend).exportEntries?.(sessionId)) ?? null;
58
96
  return classifySyncRelationship(srcEntries, dstEntries);
59
97
  }
60
- export function sameRulesContent(stored, incoming) {
98
+ export function sameRulesContent(stored, incoming, operator) {
61
99
  if (stored === null)
62
100
  return false;
63
101
  const norm = (r) => JSON.stringify(normalizeRules(r));
64
102
  if (norm(stored) !== norm(incoming))
65
103
  return false;
66
- return loosenReasons(stored, incoming).length === 0 && loosenReasons(incoming, stored).length === 0;
104
+ if (loosenReasons(stored, incoming).length !== 0 || loosenReasons(incoming, stored).length !== 0)
105
+ return false;
106
+ return operatorPartUnmoved(stored, incoming, operator);
107
+ }
108
+ function operatorPartUnmoved(stored, incoming, operator) {
109
+ const next = judgeSessionRulesWrite(stored, incoming, { operator });
110
+ const partOf = (row) => JSON.stringify(normalizeRules(row.operatorRules ?? row));
111
+ return partOf(next) === partOf(stored);
67
112
  }
68
113
  export async function replayPolicyRecords(store, sessionId, records, operatorOk) {
69
114
  for (const rec of records) {
70
115
  const cur = await store.getRules(sessionId, rec.principal);
71
- if (sameRulesContent(cur, rec.rules))
116
+ if (sameRulesContent(cur, rec.rules, operatorOk))
72
117
  continue;
73
118
  await store.putRules(sessionId, rec.principal, rec.rules, { operator: operatorOk });
74
119
  }
@@ -27,10 +27,6 @@
27
27
  import type { HookLlmFailureCode } from "./hooks/hook-runner.js";
28
28
  import { type SessionTitledFrame } from "./session-titled-frame.js";
29
29
  export interface SessionTitlerDeps {
30
- /** Secret scrub applied to the RAW llm text before sanitize/persist (workflow audit 2026-07-13: the
31
- * objective may carry a pasted secret and the model can echo it into the title — titles are persisted,
32
- * listed over HTTP, and logged, all outside the trace redact pipeline; wire src/trace/redact.ts here). */
33
- redact?: (text: string) => string;
34
30
  /** Write-once store leg (SQL twins / local sidecar). Resolves false when a title already existed. */
35
31
  setTitleIfNull(sessionId: string, title: string): Promise<boolean>;
36
32
  /** Cheap pre-LLM probe: "titled" = skip (a restart/evicted-seen/another replica
@@ -68,8 +64,13 @@ export interface SessionTitler {
68
64
  * 已有标题 / 竞态输了 / 模型失败 / 空标题 / 这个会话已有一次在飞的调用,都不调。回调同步执行、**不许抛**;抛了也不影响已落行的标题(见下 `frame_failed`)。 */
69
65
  maybeTitle(sessionId: string, objective: string, model?: string, onTitled?: (frame: SessionTitledFrame) => void): void;
70
66
  }
71
- export declare const TITLE_MAX_CHARS = 80;
72
- /** Single line, control chars stripped, hard cap; surrounding quotes (a common LLM tic) trimmed. */
67
+ /** 标题的显示预算(码元,含截断记号)—— 界的属主是出口座的 `session-title` 行,这里读它;落在 `title` 列宽 `SESSION_TITLE_MAX_CHARS`(session-row.ts)之内。 */
68
+ export declare const TITLE_MAX_CHARS: number;
69
+ /**
70
+ * 模型回的标题 → 落行的标题:**经出口座的 `session-title` 行**([ref])—— 脱敏(按单行出门形读:被控制字符拆开、被换行拆开的令牌都读过)→ 渲染 →
71
+ * 单行化(换行折成空格、剥控制与双向字符、去首尾空白与首尾引号)→ 按记号边界截到 {@link TITLE_MAX_CHARS} 码元(含 `…`)。
72
+ * 此前是「可选注入的脱敏 → 剥 → 截」三步各在一处:没注入就不脱;剥在脱之后,BEL 拆开的令牌两半在剥时拼回整枚;截在脱之后,界切进记号留半枚。
73
+ */
73
74
  export declare function sanitizeTitle(raw: string): string;
74
75
  export declare function buildTitlePrompt(objective: string): string;
75
76
  export declare function createSessionTitler(deps: SessionTitlerDeps): SessionTitler;
@@ -1,13 +1,11 @@
1
- import { stripControlAndBidi } from "@sema-agent/settings-schema";
2
1
  import { recordFailOpen } from "./observability/fail-open.js";
3
- import { redactSecrets } from "./trace/redact.js";
2
+ import { seatMaxChars, seatText } from "./trace/exit-seat.js";
4
3
  import { userAuthoredText } from "./user-authored-text.js";
5
4
  import { buildSessionTitledFrame } from "./session-titled-frame.js";
6
- export const TITLE_MAX_CHARS = 80;
5
+ export const TITLE_MAX_CHARS = seatMaxChars("session-title");
7
6
  const OBJECTIVE_SNIPPET_CHARS = 600;
8
7
  const LLM_TIMEOUT_MS = 15_000;
9
8
  const NO_ROW_RETRY_MS = 20_000;
10
- const FAIL_CAUSE_KEY_CHARS = 80;
11
9
  const SEEN_CAP = 10_000;
12
10
  function failOpenTagFor(code) {
13
11
  switch (code) {
@@ -30,9 +28,7 @@ function failOpenTagFor(code) {
30
28
  }
31
29
  }
32
30
  export function sanitizeTitle(raw) {
33
- const oneLine = stripControlAndBidi(raw.replace(/[\r\n]+/g, " ")).trim();
34
- const unquoted = oneLine.replace(/^["'「『]+/, "").replace(/["'」』]+$/, "").trim();
35
- return unquoted.length > TITLE_MAX_CHARS ? `${unquoted.slice(0, TITLE_MAX_CHARS - 1)}…` : unquoted;
31
+ return seatText("session-title", raw);
36
32
  }
37
33
  export function buildTitlePrompt(objective) {
38
34
  const text = userAuthoredText(objective);
@@ -46,11 +42,10 @@ export function buildTitlePrompt(objective) {
46
42
  }
47
43
  export function createSessionTitler(deps) {
48
44
  const seen = new Set();
49
- const redactedError = (error) => redactSecrets(error);
50
45
  const logFailure = (sessionId, error, code) => {
51
- const safe = redactedError(error);
52
- deps.logger?.debug?.("session_title_failed", { sessionId, error: safe.slice(0, 200) });
53
- recordFailOpen(failOpenTagFor(code), safe.slice(0, FAIL_CAUSE_KEY_CHARS));
46
+ const safe = seatText("operator-log-text", error);
47
+ deps.logger?.debug?.("session_title_failed", { sessionId, error: safe });
48
+ recordFailOpen(failOpenTagFor(code), safe);
54
49
  };
55
50
  const probeOrContinue = async (sessionId, continueWord) => deps
56
51
  .probeTitle(sessionId)
@@ -90,7 +85,7 @@ export function createSessionTitler(deps) {
90
85
  logFailure(sessionId, r.error, r.code);
91
86
  return;
92
87
  }
93
- const title = sanitizeTitle(deps.redact ? deps.redact(r.text) : r.text);
88
+ const title = sanitizeTitle(r.text);
94
89
  if (!title) {
95
90
  deps.metrics?.inc("session_title_total", { outcome: "empty" });
96
91
  return;
@@ -112,7 +107,7 @@ export function createSessionTitler(deps) {
112
107
  }
113
108
  catch (e) {
114
109
  deps.metrics?.inc("session_title_total", { outcome: "frame_failed" });
115
- deps.logger?.warn?.("session_titled_frame_failed", { sessionId, error: redactedError(String(e)).slice(0, 200) });
110
+ deps.logger?.warn?.("session_titled_frame_failed", { sessionId, error: seatText("operator-log-text", String(e)) });
116
111
  }
117
112
  }
118
113
  })().catch((e) => {
@@ -16,7 +16,7 @@
16
16
  * - **冷启动 warm**:新条目 lastChangeAt=0(没观测到变化就不算热)——首拍一次 hotMs 快确认后即落
17
17
  * warm 拍距,直到真观测到跳变才进热窗(codex:重连风暴下 256 会话×200ms=对存储的自造尖峰)。
18
18
  *
19
- * Deliberately backend-agnostic (tidb|pg|local all go through getLeafId — the seamless-local-cloud
19
+ * Deliberately backend-agnostic (tidb|pg|local all go through the session store's one by-id read `headOf` — the seamless-local-cloud
20
20
  * invariant): no PG LISTEN/NOTIFY specialization, no shared bus. Latest-wins semantics: subscribers
21
21
  * converge on the newest leafId; intermediate hops may be dropped (content still comes from tail faces).
22
22
  */
@@ -38,7 +38,7 @@ export declare class SessionWatchRegistry {
38
38
  /** 五轮复审:owner 与 leaf **同拍原子读**——探针每拍先核 owner(被删=undefined/换主=≠条目 owner
39
39
  * ⇒ dropSession 断全部订阅者),匹配才应用 leaf。跨副本 reclaim 的披露窗从 25s 心跳收紧到
40
40
  * ≤一个探针拍(hot 200ms/warm 2s),且旧流在新主推进**之前**先死(owner 检查先于 leaf 应用)。 */
41
- private readonly getHead;
41
+ private readonly readHead;
42
42
  private readonly entries;
43
43
  private readonly hotMs;
44
44
  private readonly warmMs;
@@ -48,7 +48,7 @@ export declare class SessionWatchRegistry {
48
48
  /** 五轮复审:owner 与 leaf **同拍原子读**——探针每拍先核 owner(被删=undefined/换主=≠条目 owner
49
49
  * ⇒ dropSession 断全部订阅者),匹配才应用 leaf。跨副本 reclaim 的披露窗从 25s 心跳收紧到
50
50
  * ≤一个探针拍(hot 200ms/warm 2s),且旧流在新主推进**之前**先死(owner 检查先于 leaf 应用)。 */
51
- getHead: (sessionId: string) => Promise<{
51
+ readHead: (sessionId: string) => Promise<{
52
52
  leafId: string | null | undefined;
53
53
  owner: string | null | undefined;
54
54
  }>, opts?: SessionWatchOptions);
@@ -5,14 +5,14 @@ export function posIntEnv(raw, fallback, max = 3_600_000) {
5
5
  return Number.isInteger(n) && n > 0 && n <= max ? n : fallback;
6
6
  }
7
7
  export class SessionWatchRegistry {
8
- getHead;
8
+ readHead;
9
9
  entries = new Map();
10
10
  hotMs;
11
11
  warmMs;
12
12
  hotWindowMs;
13
13
  maxWatched;
14
- constructor(getHead, opts) {
15
- this.getHead = getHead;
14
+ constructor(readHead, opts) {
15
+ this.readHead = readHead;
16
16
  this.hotMs = opts?.hotMs ?? 200;
17
17
  this.warmMs = opts?.warmMs ?? 2000;
18
18
  this.hotWindowMs = opts?.hotWindowMs ?? 60_000;
@@ -109,7 +109,7 @@ export class SessionWatchRegistry {
109
109
  e.urgent = false;
110
110
  const revAtStart = e.rev;
111
111
  try {
112
- const head = await this.getHead(sessionId);
112
+ const head = await this.readHead(sessionId);
113
113
  if (this.entries.get(sessionId) !== e)
114
114
  return;
115
115
  if (head.owner === undefined || head.owner !== e.owner) {
@@ -9,14 +9,14 @@
9
9
  *
10
10
  * 诚实边界:idle-but-live 的 peer(两 turn 之间静默超过窗口)会碰到引擎已退→壳 dead-respawn 1-2s 自愈
11
11
  * (伤害面从 mid-turn 斩降级为冷启动)。
12
- * S-1281:附着(打开着的 SSE 流)是判据的第二格 `attached` —— 只读订阅自此不进 inflight(排空不该等一个看着的壳),而一个只挂着订阅流的
12
+ * [ref]:附着(打开着的 SSE 流)是判据的第二格 `attached` —— 只读订阅自此不进 inflight(排空不该等一个看着的壳),而一个只挂着订阅流的
13
13
  * peer 壳(cli 附着形:`GET /v1/approvals/stream` 常开)仍然是「有人在用」,靠这一格不被当成孤儿。修前这一形是订阅流被算进 inflight
14
14
  * 时顺带挡住的;拆开之后两件事各有一格,规则不变:inflight = 0 ∧ attached = 0 ∧ 活性静默满窗才关。
15
15
  */
16
16
  export interface SighupIdleDeps {
17
17
  /** This replica's in-flight legs (drainState.inflight). */
18
18
  inflight: () => number;
19
- /** S-1281:打开着的 SSE 流条数(drainState.attachedStreams,附着租约同一只 getter)。> 0 ⇒ 有壳挂着,同 inflight 一样重置窗口。
19
+ /** [ref]:打开着的 SSE 流条数(drainState.attachedStreams,附着租约同一只 getter)。> 0 ⇒ 有壳挂着,同 inflight 一样重置窗口。
20
20
  * 缺席 ⇒ 视为 0(单测 / 嵌入形)。 */
21
21
  attached?: () => number;
22
22
  /** MONOTONIC-clock ms of the last non-probe HTTP request (drainState.lastActivityAt). Covers what inflight
@@ -44,9 +44,9 @@ export declare function normalizeResumeAtMode(v: unknown, resumeAtResolved: bool
44
44
  * **技能**条数帽不是同一轴:技能清单由引擎按预算渲染(超了裁描述),agent 定义没有那个预算面。 */
45
45
  export declare const MAX_TASK_AGENTS = 32;
46
46
  /**
47
- * core 7.41.0 #1303 —— 技能的两只清单 `allowedTools` / `disallowedTools`(`dist/core/agent-definition.d.ts`:本次 run 的 allow 规则来源 /
47
+ * core 7.41.0 [ref] —— 技能的两只清单 `allowedTools` / `disallowedTools`(`dist/core/agent-definition.d.ts`:本次 run 的 allow 规则来源 /
48
48
  * deny 规则来源,不是围栏)的**形**谓词。两道技能门(顶层 `body.skills[]` 的 `validateUserSkills`、`agents[].skills[]` 的
49
- * {@link SKILL_FIELD_SHAPES})**同一只**:一边判一边不判 = 同一个键两种话(S-377 baseDir 吃过的亏)。
49
+ * {@link SKILL_FIELD_SHAPES})**同一只**:一边判一边不判 = 同一个键两种话([ref] baseDir 吃过的亏)。
50
50
  *
51
51
  * 本谓词只判「字符串数组」(core 7.42.0 起与请求的 `settings.permissions.allow`、运维的 `APPROVAL_GRANT` **同一只**:`rule-entry-list.ts` 的
52
52
  * `ruleEntryListShapeOk`):引擎直接 `for (const entry of list)` —— 一个裸字符串 `"Bash"` 会被逐字符迭代成 `B` / `a` / `s` / `h` 四条
@@ -80,7 +80,7 @@ export interface TaskAgentsRefusal {
80
80
  /** [ref] 单条 agent 定义的形状裁决:null=合法;否则一句可 400 的英文错误(不带索引,调用方自己加)。
81
81
  * 白名单外键 fail-loud —— 与 resilience/limits 的「容忍未知键」相反:agents 是能力定义,静默丢字段 =
82
82
  * 定义被悄悄削(一个丢掉的 isolation 就是放宽),比 400 更危险,故整条拒。`allowTools` / `denyTools` 本门只判形与条数(`toolList`),
83
- * **名字归引擎一只判**(core 7.49.0 #1623 / #1433 第二步起与根 run 的 `allowTools` / `excludeTools` 是同一只选择器,开跑前,三来源同判):core 7.51.0 #1736 起
83
+ * **名字归引擎一只判**(core 7.49.0 [ref] / [ref] 第二步起与根 run 的 `allowTools` / `excludeTools` 是同一只选择器,开跑前,三来源同判):core 7.51.0 [ref] 起
84
84
  * 没有任何工具答应的名字(无人挂的名、大小写孪生 / 退役名 `bash` / `BASH`)**引擎不拒 run** —— 条目原样保留、经 onError(config)告知一次(带该写的拼法);
85
85
  * 其中**写错现名的**(`denyTools:["BASH"]` 想禁的照用 = 静默放行;`allowTools:["BASH"]` 想放的什么也没放 = 静默收窄)由 `resolveSpec` 前置拒:**限制侧**(`denyTools`)四类全拒(近似名 · 退役名 · 文法读不出 · `*`),
86
86
  * **放行侧**(`allowTools`)只拒近似名 —— 放行侧的内容形 / 没有后继的退役名 / 文法读不出照 7.130.0 受理、交引擎既有通告(有后继的退役名〔`bash` · `Task`〕与文法读不出的放行条目引擎在子代 prepare 整 run 拒 `config.agent.unknown_tool`,根 `allowTools` 拒 `config.tool_face_control`,同步腿两码同为 400〔`runs.ts` `PREPARE_REFUSAL_HTTP_STATUS`〕;`rule-entry-list.ts` `inertToolListEntryOf`:近似名提交 400 `config.agent.unknown_tool` 点名现名、续跑按方向分流;
@@ -150,7 +150,7 @@ export declare function retainBackgroundProcessesFromBody(raw: unknown, requireP
150
150
  * undefined(不挂键=core 缺省,byte-compat)。HTTP 门另有 fail-loud 400(提交面邻居姿势)。 */
151
151
  export declare function toolNameListFromBody(raw: unknown): string[] | undefined;
152
152
  /**
153
- * S-1448(core 7.49.0 #1623 / [ref])—— body.allowTools → `TaskSpec.allowTools`:引擎的**可用性选择器**,原样透传。
153
+ * [ref](core 7.49.0 [ref] / [ref])—— body.allowTools → `TaskSpec.allowTools`:引擎的**可用性选择器**,原样透传。
154
154
  *
155
155
  * 一条规则:这一 run 能用哪些工具由引擎一只运算答(`universe ∩ ceiling ∩ allow − deny`,prepare 对真实挂载的一切算一次)。
156
156
  * 本仓**零读法** —— 不算补集、不逐项过滤(`[]` = 什么都不给,是合法值,不折成缺席;非串条目与未知名由引擎在 prepare 拒,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * S-131 —— SQL **引擎姿态**的运维读面(单一推导点,同 `memory-posture.ts` 的形制)。
2
+ * [ref] —— SQL **引擎姿态**的运维读面(单一推导点,同 `memory-posture.ts` 的形制)。
3
3
  *
4
4
  * ## 病
5
5
  *
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * `sql-driver.ts` 的连接初始化在**每条池连接**上钉死这两件事并**回读复核**(`@contract txn.read-semantics`)。
13
13
  * 本模块把那份读数拿出来,一次推导两个读面:operator 面(`GET /v1/diagnostics/wiring` 的 `sqlEngine` 段,
14
- * 全量)与消费端面(`GET /v1/capabilities` 的 `store.sql` 位(7.106.0 起;此前顶层 `sql`,S-866 ①),窄投影)。两面同源 —— 「诊断页说悲观、能力位说
14
+ * 全量)与消费端面(`GET /v1/capabilities` 的 `store.sql` 位(7.106.0 起;此前顶层 `sql`,[ref] ①),窄投影)。两面同源 —— 「诊断页说悲观、能力位说
15
15
  * 乐观」在结构上不可能。
16
16
  *
17
17
  * ## 两条诚实纪律(与 memory-posture 同源)
@@ -52,7 +52,7 @@ export type SqlEngineSeatIssue = "required" | "bad_shape";
52
52
  * 都是 fail-closed:墙门只认这一席,席坏了或漏了,代价是每份超出库墙的体照样受理或每次提交 500,不是起服时一句话。
53
53
  */
54
54
  export declare function sqlEngineSeatIssue(backend: Pick<StoreBackend, "mysqlPool" | "pgPool"> | undefined, sqlEngine: unknown): SqlEngineSeatIssue | undefined;
55
- /** 消费端窄投影(`GET /v1/capabilities` 的 `store.sql` 位;7.106.0 前是顶层 `sql`,S-866 ①)。`null` = 驱动此刻给不出事实 ⇒ `store.sql` 缺席。 */
55
+ /** 消费端窄投影(`GET /v1/capabilities` 的 `store.sql` 位;7.106.0 前是顶层 `sql`,[ref] ①)。`null` = 驱动此刻给不出事实 ⇒ `store.sql` 缺席。 */
56
56
  export interface SqlEngineCapability {
57
57
  engine: SqlEngineFacts["engine"];
58
58
  isolation: string;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * S-866 ①(设计稿 v1.1 §2①)—— 「这台副本**真的在持久化吗**」的单一推导点:caps `store`、`/health.storeDegraded` / `durable:false`、
2
+ * [ref] ①(设计稿 v1.1 §2①)—— 「这台副本**真的在持久化吗**」的单一推导点:caps `store`、`/health.storeDegraded` / `durable:false`、
3
3
  * gauge `store_backend_degraded` 三面读**同一只装配值**({@link StorePosture},`boot/stores.ts` 铸一次)。
4
4
  *
5
5
  * ## 病
@@ -53,7 +53,7 @@ export interface StoreCapability {
53
53
  readonly durable: boolean;
54
54
  readonly degradedReason?: StoreDegradedReason;
55
55
  /** 7.105.0 及以前的顶层 `sql` 对象,原样搬入(`{engine, isolation, txnMode}`)。present-iff `backend ∈ {mysql, pg}` ∧ 驱动此刻给得出
56
- * 回读复核过的事实 —— 最近一次连接初始化被拒(S-137 ④)时驱动交 `null`,本键随之缺席(此前是顶层 `sql:null`)。 */
56
+ * 回读复核过的事实 —— 最近一次连接初始化被拒([ref] ④)时驱动交 `null`,本键随之缺席(此前是顶层 `sql:null`)。 */
57
57
  readonly sql?: SqlEngineCapability;
58
58
  }
59
59
  /** 装配值 → caps 投影(纯函数)。 */
@@ -9,7 +9,7 @@
9
9
  * ⇒ 永远批不过去。持久数据面不能「翻红」,所以给它一次性迁移:窗开着时,续跑重放腿把判官判不过的那一格按升级前的读法重读一次,产物**再交同一只判官**
10
10
  * (不过 ⇒ 原臂:整条不进);真挂上的这类 server 由请求腿说一行运维 warn `mcp_tool_axes_read_as_before_upgrade`。窗关之后回到今天的读法,删码零行为变化。
11
11
  *
12
- * ## A2A 一面(同一种病,同一只重读座;core 7.53.0 #1835 提货批)
12
+ * ## A2A 一面(同一种病,同一只重读座;core 7.53.0 [ref] 提货批)
13
13
  * core 7.53.0 起 A2A 请求腿的 `toolAxes` 读者也是引擎的判官(`readToolAxes(…, "a2a")`)。7.131.x 的 A2A 请求腿读者对每只 skill 的记录只挑三个轴、**多余成员静默忽略**、
14
14
  * 照挂 ⇒ 存量体里带多余成员的那条对端,续跑重放时整条不进,停驻在它某只 skill 审批上的任务同样永远批不过去。同一只重读座覆盖它,律只有一句:**重读复现那一面升级前
15
15
  * 的读法,一个成员都不多救** —— A2A 那一面交 {@link readA2aToolAxesAsServer7131M19}(7.131.x 的读者逐字:未知成员忽略;已知轴写坏 —— `effect` / `irreversibility` 出词表、
@@ -1,100 +1,73 @@
1
- /**
2
- * [DESIGN-269 车1 §2.2/§2.3 — A2A client seam] — project a caller's per-request A2A peers
3
- * (`TaskRequest.a2aPeers`) into the engine, so a `sema` run can talk to the agents the USER declares,
4
- * not only the ones the deployment's web-admin declares. Point-for-point mirror of `task-mcp.ts`
5
- * (the MCP seam), because the trust question is the same question — and deliberately NOT a copy where
6
- * the two protocols differ (see 「A2A 比 MCP 窄」 below).
7
- *
8
- * 🔒 SECURITY — an A2A peer is a remote **AGENT**, not a data source: it acts on its own side. core ruled
9
- * (2026-08-03, `A2aServerSpec` doc) that every skill such a peer advertises mounts with `egress: true` +
10
- * `effect: "write"`, i.e.接入即引入对外写通道 — it registers the approval gate, is never auto-allowed on a
11
- * no-policy deployment, and its replies reach the model inside an untrusted-data fence. The trust boundary
12
- * is therefore the SAME one the MCP seam draws, for the same reason:
13
- * - SINGLE-USER deployment (`requirePrincipal !== false`… i.e. `!== true`): the requester IS the
14
- * super-admin of their own worker, so the peers they name are their own choice (CC-parity), on EVERY
15
- * execution lane — an A2A call is a plain outbound HTTPS request made by the worker, so the lane where
16
- * the agent's TOOL CALLS run is irrelevant (exactly the fact that decoupled the MCP gate from the lane).
17
- * - MULTI-TENANT deployment (`requirePrincipal === true`): a tenant must NOT make the SHARED worker POST
18
- * to a body-chosen URL (SSRF) carrying body-chosen headers, nor mount write-capable tools from an agent
19
- * the operator never vetted. Gate CLOSED → body peers ignored; the fleet gets peers only through center
20
- * config (`config.a2aPeers`).
21
- * When the gate is closed a sent `a2aPeers` is IGNORED — and SAID (`a2a_injection_ignored` + the
22
- * `capabilities.a2aInjection` advertisement), never silently swallowed.
23
- *
24
- * ⚠️ **A2A 的轴比 MCP 窄,这不是简化而是协议事实**:A2A has no per-skill annotation vocabulary, so there is
25
- * no server-hint leg to fold — `toolAxes` (the CALLER's own judgement) is the ONLY thing that can move an axis
26
- * off the fail-closed default. core says as much on `A2aToolAxis`: `irreversibility:"never"` / `egress:false`
27
- * 「appears ONLY via an explicit caller override」, enforcement ignores the loosening (tighten-only) and the
28
- * ask's risk-axes REPORT face consumes it. So this module carries the caller's overrides through verbatim —
29
- * they are a judgement, not silence — while knowing that core will not let them widen enforcement.
30
- *
31
- * ⚠️ **两票判据的词表在 core 5.36 尚未到货**(分单件 C-1/C-2,core 已认领排 5.37 后首个 A2A 窗):
32
- * `LockedKey` 是 `"mcp"|"toolPolicy"|"compliancePosture"|"retentionPolicy"`,`ComplianceCapability` 是
33
- * `"mcp_servers"|"workflows"|"web_fetch"|"org_memory_mount"` —— 两张表里都还没有 A2A 的位。本模块因此按
34
- * **字符串**判(server config 的 `lockedConfigKeys` 本就是 server 自己的声明面,不经 core 闭集型),
35
- * 判据一到货就换 core 真源、钉子逐字不用改。
36
- * 🔴 **今天这两票在 env 通道上还打不响**,而这是刻意如实记下的、不是被忽略的缺口:`LOCKED_CONFIG_KEYS`
37
- * 经 core 的 `resolveLockedKeys` 校验(未知键拒启)、`COMPLIANCE_ADDITIONAL_DENIES` 经 `COMPLIANCE_CAPABILITIES`
38
- * 校验(同拒),所以运维今天**写不进** `a2a` / `a2a_peers`。而且合规那一票还有第二层:即便有人跳过 boot 期
39
- * 校验把 `a2a_peers` 塞进档位,`resolveComplianceDenies` 对闭集外的词是**抛**(亲测 core 5.36),于是这条
40
- * 请求腿的失败方向是**响亮**(500)而不是安静放行 —— 方向正确,故本模块不加任何兜底。两票的代码先在场是
41
- * 纵深:core 词表到货那一拍这条腿自己就活了,不需要有人记得回来补;反过来(等词表到了再写判据)才是
42
- * 「广告了却拦不住」的那一类缺口。钉在 `test/task-a2a.test.ts`(含到货后该怎么改那一格的原地说明)。
43
- */
44
- import { type A2aServerSpec, type CompliancePosture } from "@sema-agent/core";
1
+ import type { A2aServerSpec } from "@sema-agent/core";
2
+ import { type DeclarationRefusal } from "./request-declaration-refusal.js";
45
3
  import type { StoredToolAxesRereadM19 } from "./stored-request-tool-axes-m19.js";
4
+ import { type PrincipalAxisInput } from "./deployment-shape.js";
46
5
  /** Bound on caller-supplied peers (anti-DoS; a real declaration names a handful of agents). */
47
6
  export declare const MAX_REQUEST_A2A_PEERS = 32;
48
- /** The deployment-facing shape this module reads. `lockedConfigKeys` is deliberately `readonly string[]`
49
- * and not core's `LockedKey[]`: the `a2a` member does not exist in core's union yet (see module header),
50
- * and a predicate that cannot even NAME the key it guards is a predicate that silently guards nothing. */
51
- export interface A2aGateConfig {
52
- requirePrincipal?: boolean;
53
- lockedConfigKeys?: readonly string[];
54
- compliancePosture?: CompliancePosture;
7
+ /**
8
+ * 一条**没有被挂上**的请求腿对端的事实 —— 运维 warn `a2a_injection_dropped` 的 `dropped` 条目(`validateRequestA2a` 的 `dropped` 同形)。与 MCP 面 {@link McpInjectionDrop}(`mcp_injection_dropped`)
9
+ * **同形同键名**:`reason` · `field`,只有名字键各座自己的(MCP `server` ↔ A2A `peer`;键集两向钉在下面的 `_GuardDropKeys*` 上,任一边改名 ⇒ 编译红)。
10
+ * · `peer`:申报名(调用方文本,限长 128,读不出 ⇒ `<malformed>`;撞帽的尾项是一条合并标签 `(+N over cap of 32)`);
11
+ * · `reason`:**判官表**({@link A2A_PEER_KEY_JUDGES})对这一键的原因句 —— 与同一份体上新提交门 400 拒句里的那一句逐字同一句(同一只组句器 `declarationIssueFacts`,不回显值),**只有一臂例外**:
12
+ * 一次性迁移 M19 的重读入参克隆不了(访问器成员 / BigInt / Proxy / 环 / 非纯数据)⇒ 句子带前缀 `declaration not cloneable (<because>) — the one-time migration re-reads the stored declaration as plain JSON data and this one is not; `,**其后**才是判官对原声明的那一句(新提交门不铸这一臂,所以 400 拒句里没有这个前缀);
13
+ * 条目不是对象 = 列表级骨架的头一句(`declarationEntryNotObject`);撞帽 = 撞帽铸点的头一句(`declarationOverCapFacts`,受理口撞帽拒句以同一句开头)。**`reason` 只有一种内容 = 句子**,本座不自铸原因词,
14
+ * 机读词(`over_cap`)留在 400 拒体的 `facts`、不进日志的 `reason`;
15
+ * · `field`:体内坐标 `a2aPeers[i].<键路径>`(条目不是对象 ⇒ `a2aPeers[i]`;撞帽 ⇒ `a2aPeers`),与受理口拒体 `field` 同一个坐标系。
16
+ * 与 MCP 面的差只有两处,都是各自协议的事实:MCP 的 `reason` 是引擎词表的闭集词(`malformed_entry` …),A2A 引擎没有这张词表,`reason` 恒是句子(判官的答案 / 撞帽句);MCP 的 `field` 是条目内键路径,
17
+ * A2A 的是体内绝对坐标(它的拒体 `field` 本就如此)。
18
+ */
19
+ export interface A2aInjectionDrop {
20
+ readonly peer: string;
21
+ readonly reason: string;
22
+ readonly field: string;
55
23
  }
24
+ /** The deployment-facing shape this module reads: the principal axis only (the single-user gate). */
25
+ export type A2aGateConfig = PrincipalAxisInput;
56
26
  /**
57
- * Does THIS deployment honor caller-supplied per-request A2A peers? Three vetoes, ALL of them here (this
58
- * predicate is the single owner — the capability bit and the request leg both read it, so there is exactly
59
- * one place where the answer can be wrong):
60
- * ① the deployment locks the `a2a` key — a locked deployment that advertised `a2aInjection:true` would
61
- * hand every consumer an affordance whose every use 400s (`config.locked_key`); "says yes ⟺ route
62
- * works" breaks on the spot. Same conjunction, same reason, as `mcpInjectionHonored`'s lock veto;
63
- * ② the compliance posture denies `a2a_peers` — advertised-but-refused again;
64
- * ③ multi-tenant (`requirePrincipal === true`) — a tenant cannot point the shared worker at an agent.
65
- *
66
- * ⚠️ **`resolveComplianceDenies` is deliberately NOT wrapped in try/catch** (same ruling as the MCP twin):
67
- * it is fail-loud on a posture outside the closed set, and the posture has already been validated twice
68
- * before reaching here (config parse + boot assembly). If it ever throws here, someone bypassed both doors
69
- * and the LOUD direction (route 500) is the correct one — swallowing it into a boolean would let a
70
- * deployment with a broken posture keep advertising the capability (仓规:安全轴禁静默兜底).
27
+ * Does THIS deployment honor caller-supplied per-request A2A peers? One veto — multi-tenant (deployment-shape row `multiTenant`): a tenant cannot
28
+ * point the shared worker at an agent. The capability bit and the request leg both read this predicate, so there is exactly one place where the answer can be wrong.
71
29
  */
72
30
  export declare function a2aInjectionHonored(config: A2aGateConfig): boolean;
31
+ /**
32
+ * 请求体 `a2aPeers[i]` 的**键闭集**(判序 = 本数组序:名 → 对端地址 → 它的 agent card 地址 → 凭据头 → 身份头 → 技能收窄 → 轴覆写)。两向钉在 core 的 `A2aServerSpec` 上:
33
+ * 型上多一个键而表没跟 ⇒ 编译红(新键会被词表外的键门 400 掉 —— wire 上的静默回归);表里写一个型上没有的词 ⇒ 也红。于是这张表是从 core 的型**派生**出来的数据,而不是谁记得去同步的清单。
34
+ */
35
+ export declare const A2A_PEER_ENTRY_KEYS: readonly ["name", "url", "cardUrl", "headers", "principalHeader", "allowSkills", "toolAxes"];
36
+ /**
37
+ * **请求入口的一次读**(`boot/resolve-spec.ts` 在腿首铸一份,受理门与读器——续跑重放腿只有读器——都吃这一份):`body.a2aPeers` 若是数组,返回同形数组
38
+ * (每个对象条目换成它的 {@link PeerSnapshot};非对象条目原样;长度保真 —— 界外的条数仍是受理门撞帽拒与读器丢弃留声的依据,只快照界内的条目);不是数组(缺席 / `null` / 别的形)原样返回。
39
+ * 为什么在入口铸而不是各调用点各铸:快照按调用点铸,受理口一份、读器一份,嵌入方递来的 getter 对象在两次读之间变形(第一次给干净 URL、第二次给带凭据 URL;`headers` 成员第一次
40
+ * `Bearer accepted`、第二次 `Bearer changed`)就让门判第一份、读器挂第二份 —— 门独有的凭据一问被绕过、鉴权头被换掉。入口铸一次、往下传,「门判的就是读器挂的」才字面成立;
41
+ * 快照是纯数据到叶子(见 {@link PeerSnapshot}),后续任何读者都不再触碰源对象。
42
+ */
43
+ export declare function snapshotRequestA2a(raw: unknown, options: {
44
+ readonly reread: boolean;
45
+ }): unknown;
73
46
  /** 读这条对端的是哪条腿:`fresh` = 新提交;`resume` = 续跑重放升级前存下的请求体(`boot/resolve-spec.ts` 的 `opts.leg` 分流,同一个读法)。 */
74
47
  type A2aRequestLeg = "fresh" | "resume";
75
48
  /**
76
49
  * Shape-check the raw `body.a2aPeers`. `null` → a non-array (caller error; the route may 400). Otherwise the
77
- * valid subset + the names of dropped (malformed/over-cap) entries.
50
+ * valid subset + the dropped (malformed/over-cap) entries as {@link A2aInjectionDrop} facts (peer name · reason · body coordinate).
78
51
  */
79
52
  export declare function validateRequestA2a(raw: unknown): {
80
53
  ok: A2aServerSpec[];
81
- dropped: string[];
54
+ dropped: A2aInjectionDrop[];
82
55
  } | null;
83
56
  /**
84
- * DESIGN-269 §2.4 —— **同步**拒面:部署锁了 `a2a` 而请求仍带 `a2aPeers` ⇒ 400 `config.locked_key`
85
- * (逐字沿用 `assertRequestMcpUnlocked` 的裁定,连错误码都同一个 —— 消费端判的是「某个键被行政锁住了」,
86
- * 不是「哪个键」;码分裂只会让 SDK 多写一条等价分支)。
87
- *
88
- * 判据是「请求**占位**」而不是「请求的值合不合法」:锁是两态的,占了就整拒,不静默丢(静默丢正是把
89
- * 判决变成探针的那一形)。键缺席 / 显式 `null` 都不是占位;**空数组是占位**(调用方确实写了这个键)。
90
- *
91
- * ⚠️ **不看车道**:多租户腿本来就会忽略 body peers(`a2aInjectionHonored` 关),但锁在场时「忽略」是
92
- * 错的失败方向 —— operator 声明了「本部署不收任务自带 A2A peer」,那就该说出来。
57
+ * 请求体 `a2aPeers`「这份声明能不能原样用」的回答者(与 MCP 的 `requestMcpDeclarationRefusal` 同一副骨架、同一个拒形):
58
+ * ① **列表**:在场却不是数组 / 超过 {@link MAX_REQUEST_A2A_PEERS} 条(撞帽机读位一组键)/ 某一条不是对象 ⇒ `400 request.field_invalid`;
59
+ * ② **键名**:条目上词表外的键 ⇒ `400 request.body_shape` + `unknownKeys`;
60
+ * ③ **键值**:逐键问判官表 {@link A2A_PEER_KEY_JUDGES} ⇒ `400 request.field_invalid`,拒句点名 `a2aPeers[i].<键路径>`、peer 名与该键判官的原因句;`url` / `cardUrl` 带凭据时拒体另带机读 `field` / `reason`。
61
+ * 整份拒而不是挂前 32 条 / 丢掉读不出的那条 / 整只忽略:一份被悄悄截短、少了几条或整只没生效的声明,在发送方那里读起来是「生效了」(修前:这些形全部 200 + 运维 warn;其中 `allowSkills`
62
+ * 写成 `allowSkill` 的对端照样挂上远端卡声明的全部技能 —— 收窄意图坏形时退化成放行)。同时这份体整份落盘,界内每一条的 `url` / `cardUrl` 都被判官看过 —— 超过界的列表整份拒,所以扫描有界。
93
63
  *
94
- * ⚠️ 参数类型是 `ReadonlySet<string>`:core 的 `LockedKey` 尚无 `a2a` 成员(见模块头),而
95
- * `ReadonlySet<LockedKey>` 结构上可当 `ReadonlySet<string>` 传入,所以调用点无需任何转换。
64
+ * 纯值域、与租户车道无关(多租户腿整只 `a2aPeers` 本会被忽略,告诉调用方「这样写不行」只多不少)。
65
+ * 只在 fresh 门上判(`boot/resolve-spec.ts` 在 MCP 条目门旁):重放存量 body 的腿不问它 —— 拒会砖死升级前停驻的任务(本仓 `opts.leg` 先例),走宽容读器({@link resolveRequestA2a}:坏条目不挂 +
66
+ * `a2a_injection_dropped` 留声)。A2A serve 腿(`routes/a2a-serve.ts`)铸的体只有 `objective` / `taskId` / `sessionId` / `scenario` 四键,到不了这一座。
96
67
  */
97
- export declare function assertRequestA2aUnlocked(bodyA2a: unknown, lockedKeys: ReadonlySet<string>): void;
68
+ export declare function requestA2aDeclarationRefusal(list: unknown): DeclarationRefusal | undefined;
69
+ /** fresh 提交腿的 `a2aPeers` 门:{@link requestA2aDeclarationRefusal} 有答案 ⇒ 同步 400(码 / 句 / `unknownKeys` / 机读位原样)。 */
70
+ export declare function assertRequestA2aEntries(bodyA2a: unknown): void;
98
71
  /**
99
72
  * Merge GATED per-request peers OVER the deployment baseline (center/config). The baseline WINS on a name
100
73
  * clash — a caller can ADD a peer but can never SHADOW a configured one. This is load-bearing on THIS lane