@sema-agent/server 7.134.0 → 7.135.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 (458) hide show
  1. package/MIGRATION.md +134 -0
  2. package/USAGE.md +98 -30
  3. package/dist/adoption/plan.d.ts +1 -1
  4. package/dist/approval-ask-audit-store.d.ts +24 -24
  5. package/dist/approval-ask-machine.d.ts +2 -2
  6. package/dist/approval-card.d.ts +62 -150
  7. package/dist/approval-card.js +33 -51
  8. package/dist/approval-content-kind.d.ts +22 -5
  9. package/dist/approval-content-kind.js +8 -1
  10. package/dist/approval-deny-reasons.d.ts +1 -1
  11. package/dist/approval-gate-currency.d.ts +22 -3
  12. package/dist/approval-gate-currency.js +44 -18
  13. package/dist/approval-hmac.d.ts +7 -7
  14. package/dist/approval-policy-settlement.d.ts +2 -2
  15. package/dist/approval-reconciler.d.ts +3 -3
  16. package/dist/approval.d.ts +8 -8
  17. package/dist/approval.js +4 -2
  18. package/dist/auth-bridge.d.ts +1 -1
  19. package/dist/auto-mode-face.d.ts +4 -4
  20. package/dist/background-session-reap.d.ts +2 -2
  21. package/dist/bake-runner/main.d.ts +2 -2
  22. package/dist/bake-runner/runner.d.ts +4 -4
  23. package/dist/bench/s1/live-deps.d.ts +1 -1
  24. package/dist/bench/s1/run-firm.d.ts +1 -1
  25. package/dist/boot/coordinators.d.ts +2 -2
  26. package/dist/boot/coordinators.js +2 -2
  27. package/dist/boot/deferred-sandbox-path-env.d.ts +0 -6
  28. package/dist/boot/deferred-sandbox-path-env.js +0 -5
  29. package/dist/boot/engine-lease.d.ts +5 -5
  30. package/dist/boot/execution-env.d.ts +16 -15
  31. package/dist/boot/execution-env.js +19 -21
  32. package/dist/boot/fatal-exit.d.ts +2 -2
  33. package/dist/boot/late-binds.d.ts +1 -1
  34. package/dist/boot/leader.d.ts +1 -1
  35. package/dist/boot/memory-boundary.d.ts +2 -2
  36. package/dist/boot/memory-consolidation.d.ts +15 -15
  37. package/dist/boot/parked-revive-gate.d.ts +3 -3
  38. package/dist/boot/parked-revive-gate.js +3 -2
  39. package/dist/boot/reapers.d.ts +4 -4
  40. package/dist/boot/resolve-spec.d.ts +1 -1
  41. package/dist/boot/resolve-spec.js +28 -24
  42. package/dist/boot/runner-deps.d.ts +11 -11
  43. package/dist/boot/runner-deps.js +3 -2
  44. package/dist/boot/session-faces.d.ts +3 -3
  45. package/dist/boot/session-faces.js +11 -30
  46. package/dist/boot/shutdown.d.ts +5 -5
  47. package/dist/boot/side-query-lane.d.ts +2 -2
  48. package/dist/boot/stage-05-execution-env.js +4 -4
  49. package/dist/boot/stage-06-runners.js +0 -2
  50. package/dist/boot/stores.js +2 -1
  51. package/dist/boot/web-admin.d.ts +17 -17
  52. package/dist/boot/web-admin.js +5 -10
  53. package/dist/boot/workflow-orchestration.js +2 -9
  54. package/dist/brain.d.ts +11 -11
  55. package/dist/budget.d.ts +4 -4
  56. package/dist/capabilities/approvals-push.d.ts +4 -4
  57. package/dist/capabilities/builtin-tools.d.ts +5 -5
  58. package/dist/capabilities/center-plugins.d.ts +5 -5
  59. package/dist/capabilities/center-plugins.js +1 -1
  60. package/dist/capabilities/center-prompts.d.ts +1 -1
  61. package/dist/capabilities/center-wiring.d.ts +1 -1
  62. package/dist/capabilities/composite-members.d.ts +1 -1
  63. package/dist/capabilities/execution-lane.d.ts +5 -5
  64. package/dist/capabilities/execution-lane.js +2 -2
  65. package/dist/capabilities/hands-lane.d.ts +5 -5
  66. package/dist/capabilities/mcp-probe.d.ts +10 -7
  67. package/dist/capabilities/sandbox-file-send.d.ts +1 -18
  68. package/dist/capabilities/sandbox-file-send.js +0 -7
  69. package/dist/capabilities/scenarios.d.ts +28 -10
  70. package/dist/capabilities/scenarios.js +15 -5
  71. package/dist/capabilities/send-user-file-tool.d.ts +1 -1
  72. package/dist/capabilities/skills.d.ts +31 -12
  73. package/dist/capabilities/skills.js +23 -17
  74. package/dist/capabilities/tool-defer.d.ts +1 -1
  75. package/dist/capability-facts.d.ts +26 -25
  76. package/dist/capability-facts.js +14 -16
  77. package/dist/center-config-tier.d.ts +1 -1
  78. package/dist/center-credential.d.ts +4 -4
  79. package/dist/checkpoint-identity.d.ts +5 -0
  80. package/dist/checkpoint-identity.js +14 -0
  81. package/dist/config-catalog.d.ts +12 -12
  82. package/dist/config-invariants.d.ts +4 -4
  83. package/dist/config-invariants.js +3 -2
  84. package/dist/config-lkg.d.ts +1 -1
  85. package/dist/config-provider.d.ts +13 -13
  86. package/dist/config-provider.js +2 -1
  87. package/dist/config-types.d.ts +83 -83
  88. package/dist/config.d.ts +26 -24
  89. package/dist/config.js +12 -10
  90. package/dist/cross-session-settings.d.ts +1 -1
  91. package/dist/delegated-session-owner.d.ts +16 -13
  92. package/dist/delegated-session-owner.js +9 -10
  93. package/dist/deployment-governance.d.ts +16 -16
  94. package/dist/deployment-shape.d.ts +127 -0
  95. package/dist/deployment-shape.js +72 -0
  96. package/dist/device-store.d.ts +1 -1
  97. package/dist/device-ws-hub.d.ts +1 -1
  98. package/dist/egress-redirect.d.ts +1 -1
  99. package/dist/entry-mode-clamp-notice.d.ts +2 -2
  100. package/dist/env-facts.d.ts +10 -9
  101. package/dist/env-facts.js +1 -1
  102. package/dist/env-name-allowlist-knobs.d.ts +5 -5
  103. package/dist/exec-bounds.d.ts +2 -2
  104. package/dist/execution-lane-caps.d.ts +31 -43
  105. package/dist/execution-lane-caps.js +0 -13
  106. package/dist/file-history-capture.d.ts +9 -9
  107. package/dist/file-history-disclosure.d.ts +23 -11
  108. package/dist/file-history-disclosure.js +7 -12
  109. package/dist/fleet/drain-entry.d.ts +2 -2
  110. package/dist/fleet/fleet-bus.d.ts +22 -14
  111. package/dist/fleet/fleet-bus.js +5 -5
  112. package/dist/fleet/fleet-reconciler.d.ts +9 -9
  113. package/dist/fleet/subagent-tail-bus.d.ts +4 -4
  114. package/dist/fleet-client.d.ts +13 -13
  115. package/dist/fleet-lease.d.ts +16 -16
  116. package/dist/governance-http-status.d.ts +2 -2
  117. package/dist/hooks/hook-llm.d.ts +7 -7
  118. package/dist/hooks/hook-runner.d.ts +57 -30
  119. package/dist/hooks/hook-runner.js +36 -18
  120. package/dist/host-decision.d.ts +5 -5
  121. package/dist/host-lsp-manager.d.ts +5 -5
  122. package/dist/hosted-posture.d.ts +23 -13
  123. package/dist/hosted-posture.js +4 -9
  124. package/dist/http/admission.d.ts +2 -2
  125. package/dist/http/admission.js +20 -5
  126. package/dist/http/approval-sweeps.d.ts +1 -1
  127. package/dist/http/approval-sweeps.js +2 -1
  128. package/dist/http/checkpoint-ctx.d.ts +39 -13
  129. package/dist/http/checkpoint-ctx.js +74 -35
  130. package/dist/http/dispatch.d.ts +3 -3
  131. package/dist/http/durable-run-leg.js +4 -3
  132. package/dist/http/idempotency.d.ts +2 -2
  133. package/dist/http/mcp-dial-deadline.d.ts +7 -5
  134. package/dist/http/memory-compliance-failure-reply.d.ts +4 -4
  135. package/dist/http/owner-access.d.ts +4 -6
  136. package/dist/http/owner-access.js +1 -1
  137. package/dist/http/principal-gate.d.ts +7 -7
  138. package/dist/http/principal-gate.js +3 -2
  139. package/dist/http/readiness.d.ts +1 -1
  140. package/dist/http/request-guards.d.ts +4 -4
  141. package/dist/http/request-guards.js +2 -1
  142. package/dist/http/resume-ctx-read.d.ts +7 -7
  143. package/dist/http/resume-ctx-read.js +1 -1
  144. package/dist/http/resume-legs.d.ts +3 -3
  145. package/dist/http/resume-legs.js +11 -8
  146. package/dist/http/route-ctx.d.ts +29 -29
  147. package/dist/http/route-table.d.ts +9 -9
  148. package/dist/http/routes/agents-roster.d.ts +1 -1
  149. package/dist/http/routes/approvals-assistant.d.ts +5 -5
  150. package/dist/http/routes/approvals-assistant.js +55 -15
  151. package/dist/http/routes/background.d.ts +3 -3
  152. package/dist/http/routes/background.js +2 -2
  153. package/dist/http/routes/capabilities.d.ts +1 -1
  154. package/dist/http/routes/capabilities.js +16 -8
  155. package/dist/http/routes/config-catalog.d.ts +1 -1
  156. package/dist/http/routes/devices.d.ts +1 -1
  157. package/dist/http/routes/diagnostics.d.ts +3 -3
  158. package/dist/http/routes/fleet.d.ts +1 -1
  159. package/dist/http/routes/fleet.js +2 -1
  160. package/dist/http/routes/mcp-reconnect.d.ts +4 -4
  161. package/dist/http/routes/mcp-reconnect.js +3 -3
  162. package/dist/http/routes/memory-consolidation.d.ts +1 -1
  163. package/dist/http/routes/notify-wake.d.ts +1 -1
  164. package/dist/http/routes/notify-wake.js +2 -2
  165. package/dist/http/routes/rules.d.ts +1 -1
  166. package/dist/http/routes/runs.js +22 -10
  167. package/dist/http/routes/session-sync.d.ts +1 -1
  168. package/dist/http/routes/session-sync.js +73 -44
  169. package/dist/http/routes/sessions-list.js +1 -1
  170. package/dist/http/routes/sessions.js +30 -44
  171. package/dist/http/routes/tasks.d.ts +1 -1
  172. package/dist/http/routes/trace-usage.d.ts +1 -1
  173. package/dist/http/routes/workflows.d.ts +3 -0
  174. package/dist/http/routes/workflows.js +31 -28
  175. package/dist/http/send.d.ts +5 -5
  176. package/dist/http/server.d.ts +34 -34
  177. package/dist/http/session-inherit-env.d.ts +3 -3
  178. package/dist/http/sse-lifecycle.d.ts +1 -1
  179. package/dist/http/sse-log.d.ts +2 -2
  180. package/dist/http/submit-ctx.js +1 -1
  181. package/dist/http/sync-submit-body.d.ts +1 -1
  182. package/dist/http/verify-rounds.d.ts +1 -1
  183. package/dist/http/wire-types.d.ts +28 -21
  184. package/dist/instruction-source-notice.d.ts +2 -2
  185. package/dist/key-resolver.d.ts +3 -3
  186. package/dist/lane-home-probe.d.ts +1 -1
  187. package/dist/leader/diffout.d.ts +1 -1
  188. package/dist/leader/diffup.d.ts +2 -2
  189. package/dist/leader/endpoint.d.ts +1 -1
  190. package/dist/leader/fanout.d.ts +1 -1
  191. package/dist/leader/leader.d.ts +4 -4
  192. package/dist/leader/merge.d.ts +3 -3
  193. package/dist/leader/repair-wire.d.ts +1 -1
  194. package/dist/leader/wire.d.ts +6 -6
  195. package/dist/list-entry-display.d.ts +1 -1
  196. package/dist/lsp-evict.d.ts +1 -1
  197. package/dist/mcp-assertion-header.d.ts +1 -1
  198. package/dist/memory-layer-legacy-lock.d.ts +1 -1
  199. package/dist/memory-operator-faces.d.ts +1 -1
  200. package/dist/memory-posture.js +4 -2
  201. package/dist/memory-project-layer.d.ts +1 -1
  202. package/dist/memory-scope.d.ts +19 -19
  203. package/dist/memory-store-refusal.d.ts +4 -4
  204. package/dist/model-entry-headers.d.ts +2 -2
  205. package/dist/model-entry-refusal.d.ts +17 -17
  206. package/dist/model-provider.d.ts +10 -10
  207. package/dist/model-reach-scope.d.ts +1 -1
  208. package/dist/model-route-endpoint.d.ts +6 -6
  209. package/dist/model-route-url.d.ts +5 -5
  210. package/dist/model-select.d.ts +15 -6
  211. package/dist/model-select.js +5 -0
  212. package/dist/model-unreachable-notice.d.ts +3 -3
  213. package/dist/namespaced-rule-name.d.ts +15 -5
  214. package/dist/namespaced-rule-name.js +3 -2
  215. package/dist/observability/corrupt-read-seat.d.ts +9 -9
  216. package/dist/observability/cost-taxonomy.d.ts +1 -1
  217. package/dist/observability/err-text.d.ts +1 -1
  218. package/dist/observability/fail-open.d.ts +12 -8
  219. package/dist/observability/fail-open.js +12 -8
  220. package/dist/observability/metrics.d.ts +3 -3
  221. package/dist/observability/run-terminal.d.ts +36 -36
  222. package/dist/observability/secret-env-scrub.d.ts +3 -3
  223. package/dist/observability/tool-trace.d.ts +1 -1
  224. package/dist/operator-ask.d.ts +4 -4
  225. package/dist/orchestration/workflow-agent-session-index.d.ts +3 -3
  226. package/dist/orchestration/workflow-completion-inbox.d.ts +20 -5
  227. package/dist/orchestration/workflow-completion-inbox.js +29 -7
  228. package/dist/orchestration/workflow-notify-journal.d.ts +43 -19
  229. package/dist/orchestration/workflow-notify-journal.js +17 -0
  230. package/dist/outbound-dispatcher.d.ts +4 -4
  231. package/dist/parent-watch.d.ts +4 -4
  232. package/dist/parked-decide.d.ts +16 -15
  233. package/dist/parked-decide.js +5 -4
  234. package/dist/parked-revive-surface.d.ts +7 -7
  235. package/dist/parked-revive-surface.js +2 -3
  236. package/dist/peer-directory.d.ts +3 -3
  237. package/dist/peer-directory.js +1 -1
  238. package/dist/permission-rule-list.d.ts +10 -1
  239. package/dist/permission-rule-list.js +7 -5
  240. package/dist/permission-rule-vocab.d.ts +2 -2
  241. package/dist/plugins/adoption-log-sql.d.ts +1 -1
  242. package/dist/plugins/approval-ask-store-file.d.ts +8 -1
  243. package/dist/plugins/approval-ask-store-file.js +6 -3
  244. package/dist/plugins/approval-ask-store-memory.d.ts +11 -7
  245. package/dist/plugins/approval-ask-store-memory.js +11 -7
  246. package/dist/plugins/approval-ask-store-sql.d.ts +34 -15
  247. package/dist/plugins/approval-ask-store-sql.js +18 -5
  248. package/dist/plugins/approval-exemption-store.d.ts +3 -3
  249. package/dist/plugins/approval-nonce-store.d.ts +3 -3
  250. package/dist/plugins/background-agent-store-sql.d.ts +1 -1
  251. package/dist/plugins/background-shell-support.d.ts +2 -2
  252. package/dist/plugins/blob-backend.d.ts +1 -1
  253. package/dist/plugins/caching-session-store.d.ts +23 -32
  254. package/dist/plugins/caching-session-store.js +5 -17
  255. package/dist/plugins/checkpoint-index-columns.d.ts +81 -0
  256. package/dist/plugins/checkpoint-index-columns.js +62 -0
  257. package/dist/plugins/checkpoint-store-sql.d.ts +44 -66
  258. package/dist/plugins/checkpoint-store-sql.js +55 -102
  259. package/dist/plugins/device-store-sql.d.ts +7 -6
  260. package/dist/plugins/e2b-orphan-reclaim.d.ts +1 -1
  261. package/dist/plugins/ensure-schema-lock-policy.d.ts +1 -1
  262. package/dist/plugins/file-history-store-sql.d.ts +9 -7
  263. package/dist/plugins/file-history-store-sql.js +27 -15
  264. package/dist/plugins/file-run-store.d.ts +8 -8
  265. package/dist/plugins/fork-routing-session-store.d.ts +2 -2
  266. package/dist/plugins/fork-routing-session-store.js +1 -1
  267. package/dist/plugins/host-platform.d.ts +10 -10
  268. package/dist/plugins/image-bake-store-sql.d.ts +1 -1
  269. package/dist/plugins/image-index-sql.d.ts +1 -1
  270. package/dist/plugins/leader-run-store-sql.d.ts +1 -1
  271. package/dist/plugins/local-checkpoint-store.d.ts +10 -10
  272. package/dist/plugins/local-checkpoint-store.js +3 -4
  273. package/dist/plugins/local-session-store.d.ts +34 -38
  274. package/dist/plugins/local-session-store.js +20 -39
  275. package/dist/plugins/local-session-window.d.ts +1 -1
  276. package/dist/plugins/mailbox-store-sql.d.ts +2 -2
  277. package/dist/plugins/memory-engine-pg.d.ts +1 -1
  278. package/dist/plugins/memory-run-store.d.ts +4 -4
  279. package/dist/plugins/memory-sync-store-pg.d.ts +3 -3
  280. package/dist/plugins/one-time-migrations.d.ts +66 -40
  281. package/dist/plugins/one-time-migrations.js +115 -34
  282. package/dist/plugins/outcome-ledger-sql.d.ts +1 -1
  283. package/dist/plugins/park-commit-watch.d.ts +3 -3
  284. package/dist/plugins/permission-rule-store-file.d.ts +5 -5
  285. package/dist/plugins/permission-rule-store-file.js +12 -19
  286. package/dist/plugins/permission-rule-store-sql.d.ts +38 -4
  287. package/dist/plugins/permission-rule-store-sql.js +67 -24
  288. package/dist/plugins/pg-cost-quota.d.ts +1 -1
  289. package/dist/plugins/pg-pool.d.ts +2 -2
  290. package/dist/plugins/pg-pool.js +5 -2
  291. package/dist/plugins/pg-rate-limiter.d.ts +1 -1
  292. package/dist/plugins/pg-session-storage.d.ts +8 -20
  293. package/dist/plugins/pg-session-storage.js +14 -27
  294. package/dist/plugins/remote-env-adb.d.ts +10 -10
  295. package/dist/plugins/remote-env-device.d.ts +10 -9
  296. package/dist/plugins/remote-env-device.js +6 -2
  297. package/dist/plugins/remote-env-e2b.d.ts +3 -3
  298. package/dist/plugins/remote-env-host.d.ts +16 -16
  299. package/dist/plugins/remote-env-k8s.d.ts +8 -8
  300. package/dist/plugins/remote-env-local-docker.d.ts +2 -2
  301. package/dist/plugins/remote-env-ssh.d.ts +4 -4
  302. package/dist/plugins/remote-scratchpad.d.ts +2 -3
  303. package/dist/plugins/remote-scratchpad.js +0 -4
  304. package/dist/plugins/remote-shell.d.ts +6 -6
  305. package/dist/plugins/retention-lane-store-sql.d.ts +4 -4
  306. package/dist/plugins/retention-store-sql.d.ts +4 -4
  307. package/dist/plugins/roster-store-sql.d.ts +1 -1
  308. package/dist/plugins/run-store-sql.d.ts +8 -8
  309. package/dist/plugins/schema-consistency.d.ts +2 -2
  310. package/dist/plugins/schema-ensure-legs.d.ts +3 -3
  311. package/dist/plugins/schema-indexes.d.ts +1 -1
  312. package/dist/plugins/schema-live-columns.d.ts +1 -1
  313. package/dist/plugins/session-event-payload.d.ts +4 -4
  314. package/dist/plugins/session-fork.d.ts +34 -0
  315. package/dist/plugins/session-fork.js +29 -0
  316. package/dist/plugins/session-ownership.js +1 -1
  317. package/dist/plugins/session-placement.d.ts +1 -1
  318. package/dist/plugins/session-policy-store-sql.d.ts +12 -12
  319. package/dist/plugins/session-store.d.ts +2 -2
  320. package/dist/plugins/session-store.js +2 -2
  321. package/dist/plugins/shared-memory-store-sql.d.ts +2 -2
  322. package/dist/plugins/sql-driver.d.ts +8 -8
  323. package/dist/plugins/sql-errors.d.ts +1 -1
  324. package/dist/plugins/sql-json-column.d.ts +21 -21
  325. package/dist/plugins/sql-row-helpers.d.ts +2 -2
  326. package/dist/plugins/store-backend.d.ts +17 -16
  327. package/dist/plugins/store-backend.js +3 -3
  328. package/dist/plugins/store-contracts.d.ts +21 -21
  329. package/dist/plugins/task-attachment-store.d.ts +2 -2
  330. package/dist/plugins/task-list-store-sql.d.ts +1 -1
  331. package/dist/plugins/tidb-pool.d.ts +2 -2
  332. package/dist/plugins/tidb-pool.js +9 -2
  333. package/dist/plugins/tidb-session-store.d.ts +16 -26
  334. package/dist/plugins/tidb-session-store.js +15 -27
  335. package/dist/plugins/tool-result-store-sql.d.ts +1 -1
  336. package/dist/plugins/usage-window-store-sql.d.ts +3 -3
  337. package/dist/plugins/user-input-ledger-file.d.ts +1 -1
  338. package/dist/plugins/user-input-ledger-sql.d.ts +3 -3
  339. package/dist/plugins/web-search.d.ts +19 -5
  340. package/dist/plugins/web-search.js +19 -4
  341. package/dist/{orchestration/workflow-journal-entry.d.ts → plugins/workflow-journal-payload.d.ts} +23 -32
  342. package/dist/plugins/workflow-journal-payload.js +32 -0
  343. package/dist/plugins/workflow-journal-store-sql.d.ts +28 -14
  344. package/dist/plugins/workflow-journal-store-sql.js +34 -15
  345. package/dist/plugins/workflow-run-store-sql.d.ts +4 -4
  346. package/dist/posture-source.d.ts +11 -11
  347. package/dist/principal-jwt.d.ts +6 -6
  348. package/dist/project-identity.d.ts +3 -3
  349. package/dist/project-memory.d.ts +4 -4
  350. package/dist/read-face-posture.d.ts +7 -7
  351. package/dist/request-key-closure.d.ts +1 -1
  352. package/dist/request-key-closure.js +1 -1
  353. package/dist/request-value-closure.d.ts +15 -8
  354. package/dist/request-value-closure.js +2 -0
  355. package/dist/router/route-orchestration.d.ts +11 -16
  356. package/dist/router/route-orchestration.js +2 -12
  357. package/dist/rule-entry-list.d.ts +8 -7
  358. package/dist/rule-entry-list.js +2 -9
  359. package/dist/rules-consent.d.ts +6 -6
  360. package/dist/rules-consent.js +2 -0
  361. package/dist/run-cancel-context.d.ts +5 -5
  362. package/dist/run-local.d.ts +10 -10
  363. package/dist/runs.d.ts +13 -11
  364. package/dist/runs.js +15 -1
  365. package/dist/runtime-caps-resolver.d.ts +6 -6
  366. package/dist/runtime-governance.d.ts +9 -9
  367. package/dist/sandbox-pkg-source.d.ts +9 -31
  368. package/dist/sandbox-pkg-source.js +14 -8
  369. package/dist/sealed-key.d.ts +3 -3
  370. package/dist/security.d.ts +23 -26
  371. package/dist/security.js +12 -9
  372. package/dist/server-secret-env.d.ts +10 -10
  373. package/dist/session-children-retire.d.ts +1 -1
  374. package/dist/session-error-wire.d.ts +7 -7
  375. package/dist/session-incarnation.d.ts +52 -35
  376. package/dist/session-incarnation.js +23 -8
  377. package/dist/session-policy-wire.d.ts +27 -5
  378. package/dist/session-policy-wire.js +15 -1
  379. package/dist/session-records-skipped-notice.d.ts +1 -1
  380. package/dist/session-sync-kernel.d.ts +4 -4
  381. package/dist/session-sync.d.ts +49 -6
  382. package/dist/session-sync.js +52 -10
  383. package/dist/session-titler.d.ts +7 -6
  384. package/dist/session-titler.js +8 -13
  385. package/dist/session-watch.d.ts +3 -3
  386. package/dist/session-watch.js +4 -4
  387. package/dist/sighup-idle.d.ts +2 -2
  388. package/dist/spec-fields.d.ts +4 -4
  389. package/dist/sql-engine-posture.d.ts +3 -3
  390. package/dist/store-posture.d.ts +2 -2
  391. package/dist/stored-request-tool-axes-m19.d.ts +1 -1
  392. package/dist/task-a2a.d.ts +3 -1
  393. package/dist/task-a2a.js +34 -2
  394. package/dist/task-cwd.d.ts +7 -88
  395. package/dist/task-cwd.js +2 -15
  396. package/dist/task-mcp.d.ts +12 -8
  397. package/dist/task-mcp.js +19 -4
  398. package/dist/task-settings.d.ts +30 -18
  399. package/dist/task-settings.js +33 -3
  400. package/dist/task-workflow.d.ts +0 -24
  401. package/dist/task-workflow.js +2 -1
  402. package/dist/terminal.d.ts +5 -5
  403. package/dist/tighten-only-seats.d.ts +7 -6
  404. package/dist/tighten-only-seats.js +1 -1
  405. package/dist/tool-approval.d.ts +143 -197
  406. package/dist/tool-approval.js +13 -28
  407. package/dist/tool-rule-names.d.ts +2 -2
  408. package/dist/trace/core-keyset-guard.d.ts +12 -7
  409. package/dist/trace/engine-notice-wire.d.ts +5 -5
  410. package/dist/trace/engine-notice-wire.js +1 -0
  411. package/dist/trace/exit-seat.d.ts +31 -4
  412. package/dist/trace/exit-seat.js +41 -63
  413. package/dist/trace/ledger-events.d.ts +3 -3
  414. package/dist/trace/ledger-sink.d.ts +1 -1
  415. package/dist/trace/model-segment.d.ts +3 -3
  416. package/dist/trace/project.d.ts +47 -45
  417. package/dist/trace/project.js +33 -1
  418. package/dist/trace/redact.d.ts +44 -30
  419. package/dist/trace/redact.js +191 -89
  420. package/dist/trace/self-minted-wire.d.ts +35 -14
  421. package/dist/trace/self-minted-wire.js +8 -0
  422. package/dist/trace/sema-provenance.d.ts +1 -1
  423. package/dist/trace/task-notification-facets.d.ts +4 -4
  424. package/dist/trace/wire-projection-faces.d.ts +3 -3
  425. package/dist/trace/wire-projection-faces.js +1 -1
  426. package/dist/unattended-permission-mode.d.ts +5 -5
  427. package/dist/url-credential.d.ts +52 -0
  428. package/dist/url-credential.js +49 -0
  429. package/dist/url-refusal.d.ts +6 -2
  430. package/dist/url-refusal.js +8 -1
  431. package/dist/usage-analytics.d.ts +2 -2
  432. package/dist/user-input-ledger.d.ts +23 -23
  433. package/dist/web-admin-client/apply-effective.d.ts +5 -5
  434. package/dist/web-admin-client/apply-effective.js +2 -1
  435. package/dist/web-admin-client/apply-ledger.d.ts +2 -2
  436. package/dist/web-admin-client/center-request.d.ts +2 -2
  437. package/dist/web-admin-client/facade.d.ts +5 -5
  438. package/dist/web-admin-client/facade.js +1 -1
  439. package/dist/web-admin-client/hot-keys-registry.d.ts +2 -2
  440. package/dist/web-admin-client/http-client.d.ts +4 -4
  441. package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
  442. package/dist/web-admin-client/pull-state.d.ts +1 -1
  443. package/dist/web-admin-client/read-face.d.ts +2 -2
  444. package/dist/web-admin-client/read-warnings.d.ts +5 -5
  445. package/dist/web-admin-client/restart-signal.d.ts +6 -6
  446. package/dist/web-admin-client/skills-mcp.d.ts +28 -3
  447. package/dist/web-admin-client/skills-mcp.js +29 -1
  448. package/dist/web-admin-client/types.d.ts +16 -9
  449. package/dist/workspace-space.d.ts +5 -3
  450. package/dist/write-protection.d.ts +2 -2
  451. package/package.json +4 -3
  452. package/scripts/drain-check-local.mjs +2 -1
  453. package/scripts/drain-check.mysql.sql +4 -2
  454. package/scripts/drain-check.pg.sql +4 -2
  455. package/skills/loop.md +1 -1
  456. package/dist/http/run-declared-families.d.ts +0 -16
  457. package/dist/http/run-declared-families.js +0 -12
  458. package/dist/orchestration/workflow-journal-entry.js +0 -27
@@ -2,7 +2,7 @@ import { type WebFetchConfig, type BackgroundAgentStore, type CheckpointStore, t
2
2
  import type { Logger } from "../observability/logger.js";
3
3
  import { type SubagentExtraToolSet } from "./builtin-tools.js";
4
4
  import { type RepoReadClient } from "./repo-tools.js";
5
- import { type LoadedSkill } from "./skills.js";
5
+ import { type LoadedSkill, type ScenarioSkillEntry } from "./skills.js";
6
6
  import { type ScenarioHands } from "./hands-lane.js";
7
7
  import type { DelegationRootWitness } from "../delegated-session-owner.js";
8
8
  /**
@@ -28,7 +28,7 @@ export interface ScenarioBundle {
28
28
  */
29
29
  hands: ScenarioHands;
30
30
  /**
31
- * S-1376:本场景从 roster 里**真卸载**的工具名(`TaskSpec.excludeTools`:per-scenario 的 roster 移除,schema 不进 `tools[]`;不是策略 deny)。缺席 = 不卸。
31
+ * [ref]:本场景从 roster 里**真卸载**的工具名(`TaskSpec.excludeTools`:per-scenario 的 roster 移除,schema 不进 `tools[]`;不是策略 deny)。缺席 = 不卸。
32
32
  * 经 {@link buildExcludeToolsSeat} 与调用方自己的 `excludeTools` 取并后写进 `TaskSpec`(HTTP 腿与 run-local 腿同一只写点)—— 场景只能多卸,调用方也只能多卸。
33
33
  * 与 `hands` 正交:`hands: "none"` 是整只手不挂(scan / code-review),本键是挂手之后卸掉其中一部分(cowork 卸编码类工具、留文件读)。
34
34
  */
@@ -83,7 +83,7 @@ export interface ScenarioContext {
83
83
  */
84
84
  sessionId?: string;
85
85
  /**
86
- * S-1770 / S-1808:**委派树根的见证**(停驻挂点的属主来源)—— 根会话 id + 调用方判断那一刻读到的根行住客(`delegated-session-owner.ts` 的 `DelegationRootWitness`)。
86
+ * [ref] / [ref]:**委派树根的见证**(停驻挂点的属主来源)—— 根会话 id + 调用方判断那一刻读到的根行住客(`delegated-session-owner.ts` 的 `DelegationRootWitness`)。
87
87
  * 由**每一个**接了停驻挂点的取用方显式交出(一条读法,没有回落):请求腿 = 本请求经鉴权解析的会话与受理时那一读(`boot/resolve-spec.ts`);`/decide` 赎回面 = 行上的
88
88
  * `rootSessionId` 与赎回腿 claim 前后两读的那一位住客(`parked-revive-surface.ts`,交不交座都交)。它**只**喂停驻挂点,不挂任何会话级设施(那是 {@link sessionId} 的事,
89
89
  * 判据是「这只 bundle 是不是在那只会话上取用的」,与属主来源是两个独立判据)。缺席 = 没有根可交(boot 期探针、run-local、行上没有根)⇒ 律给哨兵。
@@ -104,7 +104,7 @@ export interface ScenarioDeps {
104
104
  * could exfil via an arbitrary public URL; the SSRF floor only blocks internal). Single-user TOC keeps WebFetch. */
105
105
  requirePrincipal?: boolean;
106
106
  /**
107
- * S-1652:这台部署的执行车道**有没有手**(`laneWiresExecutionEnv`;`REMOTE_EXEC` 未设 = `in-process` = 没有)。场景详情读面据它与场景自己的 `hands` 表态一起答
107
+ * [ref]:这台部署的执行车道**有没有手**(`laneWiresExecutionEnv`;`REMOTE_EXEC` 未设 = `in-process` = 没有)。场景详情读面据它与场景自己的 `hands` 表态一起答
108
108
  * 「这个场景的 run 有没有工作区」({@link runHasWorkspace}),进而给出附件可受理供给集。**缺席按没有手读**(宁少说不多说:不广告一个会撞 400 的 `path`)。
109
109
  */
110
110
  handsLane?: boolean;
@@ -123,7 +123,7 @@ export interface ScenarioDeps {
123
123
  * execute-time late-bound via ctx.taskId → TaskEnvRegistry, so ONE spec serves every spawn) cannot ride the
124
124
  * ASSEMBLY-time static `subagent.tools` pool; core evaluates the factory at each spawn and merges its product into the
125
125
  * pool, then it goes through core's `resolveToolSubset` whitelist like any other tool (agent-def allowTools/denyTools
126
- * still govern — no extra gate needed on our side). A SET, not a bare factory (core 7.46.0 #1432): its `tools` are both
126
+ * still govern — no extra gate needed on our side). A SET, not a bare factory (core 7.46.0 [ref]): its `tools` are both
127
127
  * what a spawn can be handed and the roster the delegation tool declares (`extraToolNames`), so the factory cannot hand
128
128
  * out a tool the roster does not name. Absent ⇒ the delegation tool injects `Now` alone.
129
129
  */
@@ -152,7 +152,7 @@ export interface ScenarioDeps {
152
152
  */
153
153
  checkpointStore?: CheckpointStore;
154
154
  /**
155
- * S-1770:比 core 挂点多一个参数 —— `root` = **委派树根的见证,由取用这只 bundle 的调用方交出**({@link ScenarioContext.delegationRoot};缺席 = 没有根可交)。
155
+ * [ref]:比 core 挂点多一个参数 —— `root` = **委派树根的见证,由取用这只 bundle 的调用方交出**({@link ScenarioContext.delegationRoot};缺席 = 没有根可交)。
156
156
  * core 的挂点只给子代 id,停驻写下 / 定夺的宿主行属主却要按委派继承律取委派树根的属主;场景工厂把见证绑进交给 core 的那只闭包,同一棵树里任何深度的后台子代
157
157
  * 停驻都经它(子代沿用父的委派工具实例)。
158
158
  */
@@ -217,12 +217,18 @@ export interface ScenarioDetail {
217
217
  /** 机读原因键;仅 `available:false` 时在场(缺席=没有理由)。消费方按键分支,禁匹配英文文案。 */
218
218
  unavailableReason?: ScenarioUnavailableReason;
219
219
  /**
220
- * S-1652:**这个场景在本部署上受理的附件供给**(顶层能力位 `userAttachments.supplies` 的子集,保持席位序;键恒在场,不是 `null`)。
220
+ * [ref]:**这个场景在本部署上受理的附件供给**(顶层能力位 `userAttachments.supplies` 的子集,保持席位序;键恒在场,不是 `null`)。
221
221
  * 顶层能力位说的是引擎席位**能承载**的三种供给(常量);`path` 读的是这一 run 的工作区,只有「场景挂手 ∧ 部署的执行车道有手」的 run 才有
222
222
  * (判官 {@link runHasWorkspace}),其余整条 `path` 条目由引擎 prepare 拒 `config.user_attachment_invalid` —— 宿主发之前读这一格,不靠撞 400。
223
223
  * `content_text` / `content_image` 与工作区无关,恒在。
224
224
  */
225
225
  attachmentSupplies: UserAttachmentSupplyWord[];
226
+ /**
227
+ * [ref]:**这个场景交进每一个 run 的部署技能**(本部署技能目录 + 配置源交来的;不含请求体自带的 `skills`)—— 名字 / 描述 / 来处,不带正文。
228
+ * 与工厂交进 `TaskSpec` 的那一份是**同一只过滤**(技能范围 + `skills.ts` 的 `skillsInScope`)的两个投影:同一组、同一个序。名字就是 `userInvokedSkills` 点名用的串。
229
+ * 键恒在场;没有技能 ⇒ `[]`。
230
+ */
231
+ skills: ScenarioSkillEntry[];
226
232
  }
227
233
  /** 引擎附件席位的供给词(`USER_ATTACHMENT_SEAT.supplies` 的成员;取型,不手抄)。 */
228
234
  export type UserAttachmentSupplyWord = (typeof USER_ATTACHMENT_SEAT)["supplies"][number];
@@ -249,14 +255,26 @@ export declare const BUILTIN_SCENARIO_HANDS: {
249
255
  readonly scan: "none";
250
256
  readonly cowork: "full";
251
257
  };
258
+ /**
259
+ * [ref]:内建场景的**技能范围**(技能 `scenarios` 标签按哪个名字匹配)—— **全仓唯一声明处**:各场景工厂交进 `TaskSpec` 的技能与场景卡上的技能清单都按这张表取范围,
260
+ * 再过同一只过滤(`skills.ts` 的 `skillsInScope`),两边因此恒为同一组技能。按 {@link BuiltinScenarioName} 键控 ⇒ 加 / 删一个内建场景而这里没跟 = 编译红。
261
+ * `code` 的范围是 `default`:它与 default 共用一只工厂(工具 / 技能面恒等由构造保证),打了 `scenarios: code` 的技能不进 code 的 run。center 场景的范围是它自己的名字。
262
+ */
263
+ export declare const BUILTIN_SCENARIO_SKILL_SCOPE: {
264
+ readonly code: "default";
265
+ readonly default: "default";
266
+ readonly "code-review": "code-review";
267
+ readonly scan: "scan";
268
+ readonly cowork: "cowork";
269
+ };
252
270
  /**
253
271
  * `branded` = 这台部署是不是品牌部署 —— 部署座挂品牌行读的同一只判官(`brand-identity.ts` `isBrandedDeployment`)交进来;没有默认值:每个调用点说出这件事实。
254
272
  * 品牌部署上,品牌行 `when.binding` 那张表里的场景(`BRAND_IDENTITY_SCENARIOS`)的 `promptSummary` 点名 Sema 产品身份 —— 读面说的就是模型收到的。
255
273
  */
256
- export declare function builtinScenarioDetails(scenarios: Record<string, Scenario>, deps: Pick<ScenarioDeps, "repoClient" | "handsLane">, branded: boolean): Record<string, ScenarioDetail>;
274
+ export declare function builtinScenarioDetails(scenarios: Record<string, Scenario>, deps: Pick<ScenarioDeps, "repoClient" | "handsLane" | "skills">, branded: boolean): Record<string, ScenarioDetail>;
257
275
  /** center 条目详情(有效性判定与 centerScenarios 完全同款:无效条目既不进 overlay 也不进详情——
258
276
  * 保证约定①「详情显示的来源=运行实际用的定义」永不错位)。 */
259
- export declare function centerScenarioDetails(specs: CenterScenarioSpec[] | undefined, builtinNames: string[], deps: Pick<ScenarioDeps, "repoClient" | "handsLane">): Record<string, ScenarioDetail>;
277
+ export declare function centerScenarioDetails(specs: CenterScenarioSpec[] | undefined, builtinNames: string[], deps: Pick<ScenarioDeps, "repoClient" | "handsLane" | "skills">): Record<string, ScenarioDetail>;
260
278
  export interface CenterScenarioSpec {
261
279
  name: string;
262
280
  toolset: string;
@@ -300,7 +318,7 @@ export declare function centerScenarios(deps: ScenarioDeps, specs: CenterScenari
300
318
  * Personalization seam: merge the caller's own skills AFTER the scenario's, with
301
319
  * SCENARIO-WINS on a name clash — the scenario / center skills own the name (they are the deployment's baseline
302
320
  * wording, not an enforcement face: permissions / write gates / hooks do not ride on skills, and a caller may
303
- * unload the whole set with `disableSkills`, S-946); user content never shadows them. Duplicate names within the user list keep the first. Clashes are logged for audit
321
+ * unload the whole set with `disableSkills`, [ref]); user content never shadows them. Duplicate names within the user list keep the first. Clashes are logged for audit
304
322
  * (silent drops would make "my skill didn't fire" undebuggable). Input is already shape/size-validated
305
323
  * by the HTTP layer (validateUserSkills); this stays pure merge policy.
306
324
  */
@@ -4,7 +4,7 @@ import { createSubagentExtraTools, extraToolsErrorFields, nowTool } from "./buil
4
4
  import { parseRepo, repoToolsFor } from "./repo-tools.js";
5
5
  import { NOW_TOOL_NAME, REPO_PULL_DIFF_TOOL_NAME, REPO_READ_FILE_TOOL_NAME, REPO_TREE_TOOL_NAME } from "./host-tool-names.js";
6
6
  import { createWebSearchBackend, judgeRequestWebSearch } from "../plugins/web-search.js";
7
- import { skillsForScenario } from "./skills.js";
7
+ import { scenarioSkillEntries, skillsForScenario } from "./skills.js";
8
8
  import { OFFICE_EXCLUDED_TOOL_NAMES, runHasWorkspace } from "./hands-lane.js";
9
9
  import { BRAND_IDENTITY_SCENARIOS } from "./brand-identity.js";
10
10
  export function buildPromptSeats(scenarioName, prompt, callerSystemPrompt) {
@@ -69,7 +69,7 @@ export function buildScenarios(deps) {
69
69
  }).filter((t) => t.name !== WEB_FETCH_TOOL_NAME || deps.requirePrincipal !== true),
70
70
  ],
71
71
  hands: BUILTIN_SCENARIO_HANDS.default,
72
- skills: skillsForScenario(deps.skills, "default"),
72
+ skills: skillsForScenario(deps.skills, BUILTIN_SCENARIO_SKILL_SCOPE.default),
73
73
  };
74
74
  };
75
75
  return {
@@ -77,6 +77,7 @@ export function buildScenarios(deps) {
77
77
  code: (req, principal, ctx) => ({
78
78
  ...defaultScenario(req, principal, ctx),
79
79
  hands: BUILTIN_SCENARIO_HANDS.code,
80
+ skills: skillsForScenario(deps.skills, BUILTIN_SCENARIO_SKILL_SCOPE.code),
80
81
  prompt: { role: "code" },
81
82
  }),
82
83
  "code-review": (req) => codeReview(deps, req),
@@ -88,13 +89,13 @@ export function buildScenarios(deps) {
88
89
  return {
89
90
  tools: [...repoToolsFor(repoClient, parseRepo(req.repo)), nowTool()],
90
91
  hands: BUILTIN_SCENARIO_HANDS.scan,
91
- skills: skillsForScenario(deps.skills, "scan"),
92
+ skills: skillsForScenario(deps.skills, BUILTIN_SCENARIO_SKILL_SCOPE.scan),
92
93
  };
93
94
  },
94
95
  cowork: (req, principal, ctx) => ({
95
96
  ...defaultScenario(req, principal, ctx),
96
97
  hands: BUILTIN_SCENARIO_HANDS.cowork,
97
- skills: skillsForScenario(deps.skills, "cowork"),
98
+ skills: skillsForScenario(deps.skills, BUILTIN_SCENARIO_SKILL_SCOPE.cowork),
98
99
  excludeTools: OFFICE_EXCLUDED_TOOL_NAMES,
99
100
  prompt: { role: "cowork" },
100
101
  }),
@@ -124,6 +125,13 @@ export const BUILTIN_SCENARIO_HANDS = {
124
125
  scan: "none",
125
126
  cowork: "full",
126
127
  };
128
+ export const BUILTIN_SCENARIO_SKILL_SCOPE = {
129
+ code: "default",
130
+ default: "default",
131
+ "code-review": "code-review",
132
+ scan: "scan",
133
+ cowork: "cowork",
134
+ };
127
135
  export function builtinScenarioDetails(scenarios, deps, branded) {
128
136
  const probe = (name, req, principal, fallback) => {
129
137
  try {
@@ -138,6 +146,7 @@ export function builtinScenarioDetails(scenarios, deps, branded) {
138
146
  name, source: "builtin", builtin: true, summary, toolset, tools, promptSummary, enabled: true,
139
147
  ...availabilityFields(deps, toolset),
140
148
  attachmentSupplies: attachmentSuppliesFor(BUILTIN_SCENARIO_HANDS[name], deps.handsLane === true),
149
+ skills: scenarioSkillEntries(deps.skills, BUILTIN_SCENARIO_SKILL_SCOPE[name]),
141
150
  });
142
151
  const brandedScenario = (name) => branded && BRAND_IDENTITY_SCENARIOS.includes(name);
143
152
  const details = {
@@ -170,6 +179,7 @@ export function centerScenarioDetails(specs, builtinNames, deps) {
170
179
  enabled: true,
171
180
  ...availabilityFields(deps, spec.toolset),
172
181
  attachmentSupplies: attachmentSuppliesFor(toolset.hands, deps.handsLane === true),
182
+ skills: scenarioSkillEntries(deps.skills, spec.name),
173
183
  };
174
184
  }
175
185
  return out;
@@ -244,7 +254,7 @@ function codeReview(deps, req) {
244
254
  }
245
255
  const coords = parseRepo(req.repo);
246
256
  const repoTools = repoToolsFor(repoClient, coords);
247
- const skills = skillsForScenario(deps.skills, "code-review");
257
+ const skills = skillsForScenario(deps.skills, BUILTIN_SCENARIO_SKILL_SCOPE["code-review"]);
248
258
  const hands = BUILTIN_SCENARIO_HANDS["code-review"];
249
259
  return { tools: [...repoTools, nowTool()], hands, skills, prompt: { roleText: REVIEWER_ROLE_TEXT } };
250
260
  }
@@ -53,7 +53,7 @@ export declare function sendUserFileTool(deps: {
53
53
  * posture (their denyTools sets predate this tool, so core's resolveToolSubset would let it through). `ctx.agentType`
54
54
  * carries the spawned definition's name (core subagent.js); membership in core's builtin catalog ⇒ inject nothing.
55
55
  *
56
- * 🔴 S-1058(7.116.0):修前这里还有一道 **F1 部署策略预判** —— 部署审批面(`APPROVAL_DENY` / `REQUIRE` / `NEVER_AUTO`)点名 SendUserFile 就一只都
56
+ * 🔴 [ref](7.116.0):修前这里还有一道 **F1 部署策略预判** —— 部署审批面(`APPROVAL_DENY` / `REQUIRE` / `NEVER_AUTO`)点名 SendUserFile 就一只都
57
57
  * 不注入,前提是「subRunner 不带策略、core 的子代不继承父的 toolPolicy」(core 1.287 时的事实)。core 自 7.40.1 起顶层 run 解析后的调用方策略
58
58
  * (`spec.toolPolicy ?? deps.toolPolicy`)与它冻结的审批席经继承链(`InheritedGate.parentConstraints`)判子代的注入工具:deny ⇒ 零执行;ask ⇒ 顶层
59
59
  * 审批席被问一次;无审批席 ⇒ 拒(core 7.41.0 钉)。本仓在真实装配上亲跑十格(spec / deps 两槽 × deny / ask 允 / ask 拒 / 无审批席 / 耐久车道无活席,
@@ -36,8 +36,16 @@ export interface LoadedSkill {
36
36
  spec: SkillSpec;
37
37
  /** Scenarios this skill applies to; empty = global (every scenario). */
38
38
  scenarios: string[];
39
+ /**
40
+ * [ref] —— 这只技能的**来处**,由铸它的那条装载腿写下(唯一写点;之后谁都不改写,只投影):`factory` = 本部署的技能目录(`SKILLS_DIR`,{@link loadDeploymentSkills});
41
+ * `center` = 本部署的配置源交来的(中心 / 本地 `config.d` 的技能清单 `applySkillsManifest`,或配置声明的插件 `applyCenterPlugins`)。配置源按名盖掉出厂同名技能 ⇒ 盖上来的那只是 `center`。
42
+ * 场景卡的技能清单原样投这一位(`GET /v1/capabilities/scenarios/:name` 的 `skills[].source`)。
43
+ */
44
+ source: SkillSource;
39
45
  }
40
- /** 加载 lane 的信任级。缺席(受控 lane:烤制进镜像的 skills 目录)= 维持既有语义,symlink 照跟
46
+ /** 技能来处的闭集(见 {@link LoadedSkill.source})。 */
47
+ export type SkillSource = "factory" | "center";
48
+ /** 加载 lane 的事实:来处(`source`,必填)与信任级。`confineTo` 缺席(受控 lane:烤制进镜像的 skills 目录)= 维持既有语义,symlink 照跟
41
49
  * ——那个便利是有意的(`foo.md -> 共享文件`)。`confineTo` 在场(**不可信 lane**:第三方 git checkout,
42
50
  * 见 center-plugins 的 plugin 装载)= 每个被读条目 realpath 后必须仍在该根之内,逃逸即抛。
43
51
  * 🔴 为什么信任级必须是**参数**而不是注释里的假设:本函数的头注原写着「skills dir 全受控」,而
@@ -45,12 +53,13 @@ export interface LoadedSkill {
45
53
  * 于是 checkout 里某个 skill 条目(`任意 .md -> /宿主/任意文件`)会被读进 spec.files 进入提示词。resolvePluginSkillsRoot
46
54
  * 只 realpath 守了 skills **根**,根下逐条目没守。 */
47
55
  export interface LoadSkillsOptions {
56
+ /** [ref]:这条装载腿铸出的技能的来处({@link LoadedSkill.source})—— **必填**:装载器自己判断不了它读的是哪一种目录,由调用的那条腿说出这件事实。 */
57
+ source: SkillSource;
48
58
  /** 不可信 lane 的约束根(通常=clone root)。缺席=受控 lane,不做逐条目约束。 */
49
59
  confineTo?: string;
50
60
  /**
51
- * S-377 —— 「**工具跑的那台机器**的盘就是本进程这台盘吗」。真 ⇒ 目录形态技能带上自己的目录
52
- * (`SkillSpec.baseDir`);假/缺席 ⇒ **不带**。判据的单一属主 = `task-cwd.ts` 的
53
- * {@link import("../task-cwd.js").toolsRunOnThisHost}(调用方按它算,别在这里第二次判 lane)。
61
+ * [ref] —— 「**工具跑的那台机器**的盘就是本进程这台盘吗」。真 ⇒ 目录形态技能带上自己的目录
62
+ * (`SkillSpec.baseDir`);假/缺席 ⇒ **不带**。判据的单一属主 = 部署形表行 `toolsOnThisHost`(`deployment-shape.ts`;调用方按它算,别在这里第二次判 lane)。
54
63
  *
55
64
  * 🔴 **缺席 = 不带**,是**故意的 fail-closed 方向**:带了一条工具那边不存在的路径,伤是「模型按它去
56
65
  * 读、扑空,顺带看到本机目录布局」;不带的伤只是少一条线索(附件本来就随 invoke 全文内联投递,
@@ -64,13 +73,13 @@ export interface LoadSkillsOptions {
64
73
  * `/a/root` 前缀。目标不存在 ⇒ realpath 抛 ENOENT,同样是拒绝(悬空链接不该被读)。
65
74
  * `label` = 错误文本里的对象名(center-plugins 用它约束 manifest 本体,报错不该指成 skill entry)。 */
66
75
  export declare function assertConfined(p: string, rootReal: string, label?: string): void;
67
- export declare function loadSkills(dir: string, opts?: LoadSkillsOptions): LoadedSkill[];
76
+ export declare function loadSkills(dir: string, opts: LoadSkillsOptions): LoadedSkill[];
68
77
  /**
69
- * S-602 —— **出厂技能**的装载腿(`SKILLS_DIR` 自扫)。stage-07 与 run-local 两处装配点**都调这一只**:改前两处
70
- * 各写一遍 `loadSkills(config.skillsDir, { toolsShareThisFilesystem: toolsRunOnThisHost(config) })`,测试只能
78
+ * [ref] —— **出厂技能**的装载腿(`SKILLS_DIR` 自扫)。stage-07 与 run-local 两处装配点**都调这一只**:改前两处
79
+ * 各写一遍 `loadSkills(config.skillsDir, { toolsShareThisFilesystem: <车道判据>(config) })`,测试只能
71
80
  * 直传布尔去证 `loadSkills`(`baked-skills.test.ts`),证不到「config → 装配腿 → baseDir」这一段;收成一只
72
- * 之后,联合格从 config 走到 `baseDir`(`test/capabilities-http.test.ts` S-602 段)证的就是两处装配点本人。
73
- * 判据属主不变:`task-cwd.ts` 的 {@link toolsRunOnThisHost}(S-602 起 in-process ⇒ 假 ⇒ 目录形技能不带 `baseDir`)。
81
+ * 之后,联合格从 config 走到 `baseDir`(`test/capabilities-http.test.ts` [ref] 段)证的就是两处装配点本人。
82
+ * 判据属主:部署形表行 `toolsOnThisHost`([ref];[ref] 起 in-process ⇒ 假 ⇒ 目录形技能不带 `baseDir`)。
74
83
  */
75
84
  export declare function loadDeploymentSkills(config: {
76
85
  readonly skillsDir: string;
@@ -78,9 +87,19 @@ export declare function loadDeploymentSkills(config: {
78
87
  readonly provider: RemoteExecProvider;
79
88
  } | undefined;
80
89
  }, logger?: Logger): LoadedSkill[];
81
- /** Skills applicable to a scenario: those tagged with it, plus untagged (global) ones.
82
- * [ref]:alias 窗撤销,单键查询——退役旧名标签不再命中(迁移面在 7.44 发车帖/MIGRATION 记载)。 */
83
- export declare function skillsForScenario(loaded: LoadedSkill[], scenario: string): SkillSpec[];
90
+ /** 一个技能范围交进 `TaskSpec` 的技能(场景工厂的 `skills`)。范围从哪来见 `scenarios.ts` 的 `BUILTIN_SCENARIO_SKILL_SCOPE`(center 场景 = 它自己的名字)。 */
91
+ export declare function skillsForScenario(loaded: readonly LoadedSkill[], scope: string): SkillSpec[];
92
+ /**
93
+ * [ref] —— 场景卡技能清单的一条(`GET /v1/capabilities/scenarios/:name` 的 `skills[]`):名字 / 描述 / 来处,**不带正文**,也不带技能上的两只工具清单
94
+ * (`allowedTools` / `disallowedTools`)。名字就是提交体 `userInvokedSkills` 点名时用的那个串。
95
+ */
96
+ export interface ScenarioSkillEntry {
97
+ readonly name: string;
98
+ readonly description: string;
99
+ readonly source: SkillSource;
100
+ }
101
+ /** 一个技能范围的卡上清单 —— 与 {@link skillsForScenario} 同一只过滤、同一个序,只是投影不同。 */
102
+ export declare function scenarioSkillEntries(loaded: readonly LoadedSkill[], scope: string): ScenarioSkillEntry[];
84
103
  /** {@link parseFrontmatter} 的三种读数(闭集):`absent` = 第一行不是围栏,没有 frontmatter(正当的全局技能)· `block` = 围栏收好了的块 · `unclosed` = 第一行是围栏而块没收好(读不了 —— 调用方拒载)。 */
85
104
  export type FrontmatterRead = {
86
105
  readonly kind: "absent";
@@ -1,6 +1,6 @@
1
1
  import { readdirSync, readFileSync, realpathSync, statSync } from "node:fs";
2
2
  import { join, resolve, sep } from "node:path";
3
- import { toolsRunOnThisHost } from "../task-cwd.js";
3
+ import { DEPLOYMENT_SHAPE_PREDICATES } from "../deployment-shape.js";
4
4
  import { createLogger } from "../observability/logger.js";
5
5
  export function assertConfined(p, rootReal, label = "skill entry") {
6
6
  let real;
@@ -15,7 +15,7 @@ export function assertConfined(p, rootReal, label = "skill entry") {
15
15
  }
16
16
  }
17
17
  export function loadSkills(dir, opts) {
18
- const logger = opts?.logger ?? createLogger("warn");
18
+ const logger = opts.logger ?? createLogger("warn");
19
19
  let entries;
20
20
  try {
21
21
  entries = readdirSync(dir, { withFileTypes: true });
@@ -25,15 +25,15 @@ export function loadSkills(dir, opts) {
25
25
  }
26
26
  const out = [];
27
27
  const seen = new Map();
28
- const push = (skill, source) => {
28
+ const push = (skill, file) => {
29
29
  const prior = seen.get(skill.spec.name);
30
30
  if (prior !== undefined) {
31
- throw new Error(`duplicate skill name "${skill.spec.name}": ${prior} vs ${source}`);
31
+ throw new Error(`duplicate skill name "${skill.spec.name}": ${prior} vs ${file}`);
32
32
  }
33
- seen.set(skill.spec.name, source);
33
+ seen.set(skill.spec.name, file);
34
34
  out.push(skill);
35
35
  };
36
- const confineRoot = opts?.confineTo !== undefined ? realpathSync(opts.confineTo) : undefined;
36
+ const confineRoot = opts.confineTo !== undefined ? realpathSync(opts.confineTo) : undefined;
37
37
  const isFileLike = (entry, p) => entry.isFile() || (entry.isSymbolicLink() && statSync(p).isFile());
38
38
  const isDirLike = (entry, p) => entry.isDirectory() || (entry.isSymbolicLink() && statSync(p).isDirectory());
39
39
  for (const entry of entries.slice().sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0))) {
@@ -43,10 +43,10 @@ export function loadSkills(dir, opts) {
43
43
  if (confineRoot !== undefined)
44
44
  assertConfined(join(dir, entry.name), confineRoot);
45
45
  const raw = readFileSync(join(dir, entry.name), "utf8");
46
- const source = join(dir, entry.name);
47
- const parsed = parseSkill(raw, entry.name.replace(/\.md$/, ""), source, logger);
46
+ const file = join(dir, entry.name);
47
+ const parsed = parseSkill(raw, entry.name.replace(/\.md$/, ""), file, opts.source, logger);
48
48
  if (parsed !== undefined)
49
- push(parsed, source);
49
+ push(parsed, file);
50
50
  }
51
51
  else if (isDirLike(entry, join(dir, entry.name))) {
52
52
  const skillDir = join(dir, entry.name);
@@ -61,13 +61,13 @@ export function loadSkills(dir, opts) {
61
61
  }
62
62
  if (confineRoot !== undefined)
63
63
  assertConfined(join(skillDir, "SKILL.md"), confineRoot);
64
- const skill = parseSkill(raw, entry.name, join(skillDir, "SKILL.md"), logger);
64
+ const skill = parseSkill(raw, entry.name, join(skillDir, "SKILL.md"), opts.source, logger);
65
65
  if (skill === undefined)
66
66
  continue;
67
67
  const files = collectAttachments(skillDir, "", confineRoot);
68
68
  if (files.length > 0)
69
69
  skill.spec.files = files;
70
- if (opts?.toolsShareThisFilesystem === true)
70
+ if (opts.toolsShareThisFilesystem === true)
71
71
  skill.spec.baseDir = resolve(skillDir);
72
72
  push(skill, join(skillDir, "SKILL.md"));
73
73
  }
@@ -75,7 +75,7 @@ export function loadSkills(dir, opts) {
75
75
  return out;
76
76
  }
77
77
  export function loadDeploymentSkills(config, logger) {
78
- return loadSkills(config.skillsDir, { toolsShareThisFilesystem: toolsRunOnThisHost(config), ...(logger !== undefined ? { logger } : {}) });
78
+ return loadSkills(config.skillsDir, { source: "factory", toolsShareThisFilesystem: DEPLOYMENT_SHAPE_PREDICATES.toolsOnThisHost.holds(config), ...(logger !== undefined ? { logger } : {}) });
79
79
  }
80
80
  function collectAttachments(skillDir, rel, confineRoot) {
81
81
  const files = [];
@@ -100,12 +100,12 @@ function collectAttachments(skillDir, rel, confineRoot) {
100
100
  }
101
101
  return files;
102
102
  }
103
- function parseSkill(raw, fallbackName, source, logger) {
103
+ function parseSkill(raw, fallbackName, file, origin, logger) {
104
104
  const fm = parseFrontmatter(raw);
105
105
  if (fm.kind === "unclosed") {
106
106
  logger.warn("skill_refused", {
107
107
  skill: fallbackName,
108
- source,
108
+ source: file,
109
109
  reason: "frontmatter_unclosed",
110
110
  note: "the file opens a frontmatter fence (`---`) that is never closed, so its `scenarios` restriction cannot be read — this skill is NOT loaded (it is not demoted to a global skill); close the fence or remove the opening line",
111
111
  });
@@ -119,10 +119,16 @@ function parseSkill(raw, fallbackName, source, logger) {
119
119
  .split(",")
120
120
  .map((s) => s.trim())
121
121
  .filter(Boolean);
122
- return { spec: { name, description, content: body.trim() }, scenarios };
122
+ return { spec: { name, description, content: body.trim() }, scenarios, source: origin };
123
123
  }
124
- export function skillsForScenario(loaded, scenario) {
125
- return loaded.filter((k) => k.scenarios.length === 0 || k.scenarios.includes(scenario)).map((k) => k.spec);
124
+ function skillsInScope(loaded, scope) {
125
+ return loaded.filter((k) => k.scenarios.length === 0 || k.scenarios.includes(scope));
126
+ }
127
+ export function skillsForScenario(loaded, scope) {
128
+ return skillsInScope(loaded, scope).map((k) => k.spec);
129
+ }
130
+ export function scenarioSkillEntries(loaded, scope) {
131
+ return skillsInScope(loaded, scope).map((k) => ({ name: k.spec.name, description: k.spec.description, source: k.source }));
126
132
  }
127
133
  const FRONTMATTER_OPENS_RE = /^---[ \t]*\r?(?:\n|$)/;
128
134
  const FRONTMATTER_BLOCK_RE = /^---[ \t]*\r?\n(?:---[ \t]*\r?(?:\n|$)|([\s\S]*?)\r?\n---[ \t]*\r?(?:\n|$))([\s\S]*)$/;
@@ -19,7 +19,7 @@
19
19
  * 🔴 该判断在 core 5.40.0 / 7.15.0 上**逐字仍成立**(亲验):两次收窄动的都是「候选集是谁」,而
20
20
  * Agent / Task 四件是 **caller spec 工具**,收窄后照样在候选池里 —— 不开 auto 的理由没有被消解。
21
21
  * 我方**从不接线**这个座:全树零 `RunnerDeps.deferMode` 赋值(web-admin 曾有同形近名 `deferModelPlane`,
22
- * 与本轴无关,已于 S-668 波 0 退役)。机器钉见 test/tool-defer.test.ts 的 [ref] 件⑤ 格 —— 这条「零接线」正是本仓
22
+ * 与本轴无关,已于 [ref] 波 0 退役)。机器钉见 test/tool-defer.test.ts 的 [ref] 件⑤ 格 —— 这条「零接线」正是本仓
23
23
  * 在两个 core 世代之间行为逐字不变的**全部**依据,所以它值一根钉而不只是一句注。
24
24
  * - per-tool `ToolSpec.defer:true` 是本 helper 施加的那一位。**7.15.0 起它是一次「进候选集」的声明,
25
25
  * 不再是「一定占位」的保证** —— 长尾集单独一只(下面实测 ≈842 字符)远在阈值之下,于是这根旋钮在
@@ -31,14 +31,13 @@ export declare const CAPABILITY_FACT_WHY: {
31
31
  readonly subagent_registry_absent: "the sub-agent steer registry is not wired";
32
32
  readonly subagent_output_face_absent: "the background sub-agent output face is not wired";
33
33
  readonly task_handle_faces_absent: "the background task-handle output/stop faces are not wired";
34
- readonly session_owner_face_absent: "the session store has no ownership face (sessionStorage.ownerOf)";
34
+ readonly session_head_face_absent: "the session store has no by-id head read (sessionStorage.headOf — owner, occupant and leaf of a session row in one read)";
35
35
  readonly checkpoint_store_absent: "no durable checkpoint store is wired (DURABLE_APPROVAL)";
36
36
  readonly session_audit_absent: "no session audit view is wired (needs a durable session store)";
37
37
  readonly session_watch_absent: "the session watch registry is not wired";
38
- readonly session_leaf_face_absent: "the session store has no leaf-read face (sessionStorage.getLeafId)";
39
38
  readonly session_lister_absent: "no session enumerator is wired (session store or run store listSessions)";
40
39
  readonly session_fork_face_absent: "the session store has no fork face";
41
- readonly session_row_faces_absent: "the session store has no session-row faces (sessionFaceOf / sessionSummaryOf / patchSessionMeta)";
40
+ readonly session_row_faces_absent: "the session store has no session-row faces (headOf / sessionSummaryOf / patchSessionMeta)";
42
41
  readonly session_purge_absent: "no session purge coordinator is wired";
43
42
  readonly session_policy_store_absent: "no session policy store is wired";
44
43
  readonly store_backend_absent: "no store backend is wired (DB_BACKEND=memory, multi-tenant bare boot, or half-configured SQL)";
@@ -121,48 +120,50 @@ export declare function taskHandles(d: Pick<Deps, "runStore" | "taskHandleOutput
121
120
  output: Store<"taskHandleOutput">;
122
121
  stop: Store<"taskHandleStop">;
123
122
  }>;
124
- type OwnedSessionStore = WithMethods<OwnerAwareSessionStore, "ownerOf">;
125
- /** 会话属主面在场(入站 owner 门的地基;缺它,带会话的门一律 fail-closed)。 */
126
- export declare function sessionOwnership(d: Pick<Deps, "sessionStorage">): Fact<"session_owner_face_absent", {
127
- sessionStorage: OwnedSessionStore;
123
+ /** 会话店按 id 读一行的唯一读口在场(core `headOf`:属主 / 住客 / 叶子一次读;「有没有」与 `session-incarnation.ts` 的 `headReadOf` 同判)。 */
124
+ type HeadReadingSessionStore = WithMethods<OwnerAwareSessionStore, "headOf">;
125
+ /** 会话属主面在场(入站 owner 门的地基;缺它,带会话的门一律 fail-closed)。属主 = `headOf(id)?.owner`。 */
126
+ export declare function sessionOwnership(d: Pick<Deps, "sessionStorage">): Fact<"session_head_face_absent", {
127
+ sessionStorage: HeadReadingSessionStore;
128
128
  }>;
129
- export declare function mcpReconnect(d: Pick<Deps, "runStore" | "sessionStorage">): Fact<"run_store_absent" | "session_owner_face_absent", {
129
+ export declare function mcpReconnect(d: Pick<Deps, "runStore" | "sessionStorage">): Fact<"run_store_absent" | "session_head_face_absent", {
130
130
  runStore: Store<"runStore">;
131
- sessionStorage: OwnedSessionStore;
131
+ sessionStorage: HeadReadingSessionStore;
132
132
  }>;
133
133
  export declare function sessionAuditView(d: Pick<Deps, "sessionAudit">): Fact<"session_audit_absent", {
134
134
  sessionAudit: Store<"sessionAudit">;
135
135
  }>;
136
- export declare function sessionEventStream(d: Pick<Deps, "sessionWatch" | "sessionStorage">): Fact<"session_watch_absent" | "session_leaf_face_absent" | "session_owner_face_absent", {
136
+ /** 会话 SSE(watch 注册表 ∧ 头读:属主门与叶子都是 `headOf` 的投影)。 */
137
+ export declare function sessionEventStream(d: Pick<Deps, "sessionWatch" | "sessionStorage">): Fact<"session_watch_absent" | "session_head_face_absent", {
137
138
  watch: Store<"sessionWatch">;
138
- sessionStorage: WithMethods<OwnerAwareSessionStore, "ownerOf" | "getLeafId">;
139
+ sessionStorage: HeadReadingSessionStore;
139
140
  }>;
140
141
  type SessionLister = NonNullable<OwnerAwareSessionStore["listSessions"]>;
141
142
  /** 会话枚举面:session 店的 `listSessions`,否则老形 run 店聚合。见证 = 已绑好宿主的那一只。 */
142
143
  export declare function sessionList(d: Pick<Deps, "sessionStorage" | "runStore">): Fact<"session_lister_absent", {
143
144
  lister: SessionLister;
144
145
  }>;
145
- export declare function sessionFork(d: Pick<Deps, "sessionStorage">): Fact<"session_fork_face_absent" | "session_owner_face_absent", {
146
- sessionStorage: WithMethods<OwnerAwareSessionStore, "ownerOf" | "fork">;
146
+ export declare function sessionFork(d: Pick<Deps, "sessionStorage">): Fact<"session_fork_face_absent" | "session_head_face_absent", {
147
+ sessionStorage: WithMethods<OwnerAwareSessionStore, "headOf" | "fork">;
147
148
  }>;
148
- /** 会话行可写位(`PATCH /v1/sessions/:id`):会话店的会话面(属主 + 化身一次读 —— 门判属主、写与读回按化身条件)∧ 行写口(写后按同一住客读回)。
149
- * 三只 durable 店(SQL 双生 / local)都带;内存 dev 店没有 ⇒ 501。
149
+ /** 会话行可写位(`PATCH /v1/sessions/:id`):会话店的头读(属主 + 化身一次读 —— 门判属主、写与读回按化身条件)∧ 行写口(写后按同一住客读回)。
150
+ * 三只 durable 店(SQL 双生 / local)都带;内存 dev 店没有行写口 ⇒ 501。
150
151
  * 本面**没有**独立能力位(契约附录 B.2c 登记):老 worker 对这一动词答 405,本事实为假的部署答 501。 */
151
152
  export declare function sessionPatch(d: Pick<Deps, "sessionStorage">): Fact<"session_row_faces_absent", {
152
- sessionStorage: WithMethods<OwnerAwareSessionStore, "sessionFaceOf" | "patchSessionMeta">;
153
+ sessionStorage: WithMethods<OwnerAwareSessionStore, "headOf" | "patchSessionMeta">;
153
154
  }>;
154
- export declare function sessionDelete(d: Pick<Deps, "purgeSession" | "sessionStorage">): Fact<"session_purge_absent" | "session_owner_face_absent", {
155
+ export declare function sessionDelete(d: Pick<Deps, "purgeSession" | "sessionStorage">): Fact<"session_purge_absent" | "session_head_face_absent", {
155
156
  purge: Store<"purgeSession">;
156
- sessionStorage: OwnedSessionStore;
157
+ sessionStorage: HeadReadingSessionStore;
157
158
  }>;
158
- export declare function sessionPolicy(d: Pick<Deps, "sessionPolicyStore" | "sessionStorage">): Fact<"session_policy_store_absent" | "session_owner_face_absent", {
159
+ export declare function sessionPolicy(d: Pick<Deps, "sessionPolicyStore" | "sessionStorage">): Fact<"session_policy_store_absent" | "session_head_face_absent", {
159
160
  policyStore: Store<"sessionPolicyStore">;
160
- sessionStorage: OwnedSessionStore;
161
+ sessionStorage: HeadReadingSessionStore;
161
162
  }>;
162
- type SyncSessionStore = WithMethods<OwnerAwareSessionStore, "exportEntries" | "exportEntriesStream" | "beginImportStaging" | "sessionFaceOf" | "sessionSummaryOf" | "patchSessionMeta">;
163
+ type SyncSessionStore = WithMethods<OwnerAwareSessionStore, "exportEntries" | "exportEntriesStream" | "beginImportStaging" | "headOf" | "sessionSummaryOf" | "patchSessionMeta">;
163
164
  type SessionSyncWhy = "store_backend_absent" | "file_history_store_absent" | "session_export_absent" | "session_import_staging_absent" | "session_row_faces_absent" | "policy_purge_absent";
164
165
  /** 会话对等同步的**对话半族**(manifest / entries / plan / import 两相):后端 ∧ 文件历史店 ∧ 导出两面 ∧ staged 导入面 ∧
165
- * 会话行三口(门读会话面 —— 属主 + 化身一次读,属主判门、化身给 identical 短路腿;manifest 带 `title` / `pinned`;导入经唯一写口按导入落定的
166
+ * 会话行三口(门读头 `headOf` —— 属主 + 化身一次读,属主判门、化身给 identical 短路腿;manifest 带 `title` / `pinned`;导入经唯一写口按导入落定的
166
167
  * 那一位住客重放它们)∧ policy 店能清(overwrite-dst 的 commit 要擦目的端旧 policy 行)。
167
168
  * 文件历史的 blob 搬运是另一只事实。 */
168
169
  export declare function sessionSync(d: Pick<Deps, "backend" | "sessionStorage" | "fileHistoryStore" | "sessionPolicyStore">): Fact<SessionSyncWhy, {
@@ -205,7 +206,7 @@ export declare function streamApproval(d: Pick<Deps, "toolApproval" | "config" |
205
206
  * 读根授权(「Yes, and add directory」)这台部署**受理不受理** —— `GET /v1/capabilities` 的 `approvalReadRootGrant` 位,与
206
207
  * `POST /v1/tool-approvals/:id/respond` 对应答体 `readRootGrant` 的受理门**读同一只**(位说不受理而口照收,就是「位说 X、行为不是 X」)。
207
208
  *
208
- * 判据 = 单用户 host 车道姿态 {@link cwdHonored}(与调用方 `cwd` / 附加目录同一条信任边界):授权把一个**宿主目录**加进本 run 的读目录,
209
+ * 判据 = 部署形表行 `callerOwnsWorkerDisk`(手在本 worker 盘上 ∧ 单主;与调用方附加目录同一条信任边界):授权把一个**宿主目录**加进本 run 的读目录,
209
210
  * 只有「这台机器一个可信主人」的姿态才有这个授权的语义;多租户与云上 / 容器车道的读面另有归宿(沙箱内的读面档位见 `READ_FACE`)。
210
211
  * 消费方的选项可见条件是**合取**:卡上有 `readRootCandidate`(逐卡位,引擎铸)∧ 本位为真。位缺席 = 老 server(不受理)。
211
212
  * 没有别的端点按本位判可用与否 —— 它只管应答体里的这一键。
@@ -220,7 +221,7 @@ export declare function readRootGrant(d: Pick<Deps, "config">): Fact<"read_root_
220
221
  * · 活卡协调器缺席 ⇒ `[]`(没有审批卡可呈)。
221
222
  * 对 why 闭集穷举:`streamApproval` 的拒因多一个 ⇒ 这里编译红,逼着给新拒因定族。三条执行腿选族读的是同一只判据的 `active`,
222
223
  * 与本映射的「在场 ⇒ 呈卡族」是同一条规则(真腿对拍钉在 `test/stream-approval-on-e2e.test.ts`)。没有端点按它拒:它是消费方分派帧族的读点,`streamApproval` 的词义不变。
223
- * S-1914:它也是壳**声明**的依据 —— 一条 run 只在 `settings.approvalFrameFamilies` 含本位那一个族时有活审批通道(三条腿判的是同一只映射
224
+ * [ref]:它也是壳**声明**的依据 —— 一条 run 只在 `settings.approvalFrameFamilies` 含本位那一个族时有活审批通道(三条腿判的是同一只映射
224
225
  * `presentedApprovalFrameFamily`);不含 ⇒ 这条腿不呈卡,问当场交无人值守政策口。本位的值不因声明而变。
225
226
  */
226
227
  export declare function approvalFrameFamilies(stream: ReturnType<typeof streamApproval>): readonly ApprovalFrameFamily[];
@@ -341,7 +342,7 @@ export declare function workflowsJournal(d: Pick<Deps, "workflowRunStore" | "wor
341
342
  * `workspace-space.ts`;`persist` 缺省 `space`,`off` = 每轮新建)。**唯一读法**:能力位 `workspaceSync` 投影它的见证,k8s 适配器工厂(`boot/execution-env.ts`)把同一份
342
343
  * 见证交给适配器(适配器自己不再解析策略)。`persist: "off"` 仍是 available(存储在、没开 —— 缺省或运维显式 off)—— 与缺席不同义。
343
344
  *
344
- * **为何只读配置仍恒真**:`space` 的空间按会话住客分区、按 run 店的一行提交 —— 住客只有一只按 id 读(会话店的 `incarnationOf`,
345
+ * **为何只读配置仍恒真**:`space` 的空间按会话住客分区、按 run 店的一行提交 —— 住客只有一只按 id 读(会话店的 `headOf`,
345
346
  * 会话行上的那一格),行住在存储后端里。缺一的组合在起服时就被拒(`boot/execution-env.ts` 的 `assertWorkspaceSpaceReadable`,装配第 5 段,
346
347
  * 读的正是本事实的见证)⇒ 凡是起得来、报 `space` 的部署都读得出住客、写得下行,本事实不需要运行期依赖(再加一位 = 同一前提两处判)。
347
348
  * 剩下的「这条 run 读不到住客」是逐 run 的读失败(适配器的 `unavailable` 臂,响亮一行),不是部署形。
@@ -1,24 +1,24 @@
1
1
  import { buildOperatorRosterWayOut, operatorRosterPresent } from "./http/principal-gate.js";
2
2
  import { mcpInjectionHonored } from "./task-mcp.js";
3
- import { cwdHonored } from "./task-cwd.js";
3
+ import { DEPLOYMENT_SHAPE_PREDICATES } from "./deployment-shape.js";
4
4
  import { presentedApprovalFrameFamily, resolveStreamApprovalGate } from "./tool-approval.js";
5
5
  import { selfOrchestrationDenial } from "./task-workflow.js";
6
6
  import { centerEntitlementSourceWired } from "./runtime-caps-resolver.js";
7
7
  import { overwriteWipeIncapable } from "./session-sync.js";
8
8
  import { WORKSPACE_PERSIST_DEFAULT, WORKSPACE_SNAPSHOT_KEEP_DEFAULT, workspaceSnapshotTimeoutOf } from "./workspace-space.js";
9
+ import { headReadOf } from "./session-incarnation.js";
9
10
  export const CAPABILITY_FACT_WHY = {
10
11
  run_store_absent: "no durable run store is wired (DB_BACKEND=mysql|pg|local)",
11
12
  subagent_registry_absent: "the sub-agent steer registry is not wired",
12
13
  subagent_output_face_absent: "the background sub-agent output face is not wired",
13
14
  task_handle_faces_absent: "the background task-handle output/stop faces are not wired",
14
- session_owner_face_absent: "the session store has no ownership face (sessionStorage.ownerOf)",
15
+ session_head_face_absent: "the session store has no by-id head read (sessionStorage.headOf — owner, occupant and leaf of a session row in one read)",
15
16
  checkpoint_store_absent: "no durable checkpoint store is wired (DURABLE_APPROVAL)",
16
17
  session_audit_absent: "no session audit view is wired (needs a durable session store)",
17
18
  session_watch_absent: "the session watch registry is not wired",
18
- session_leaf_face_absent: "the session store has no leaf-read face (sessionStorage.getLeafId)",
19
19
  session_lister_absent: "no session enumerator is wired (session store or run store listSessions)",
20
20
  session_fork_face_absent: "the session store has no fork face",
21
- session_row_faces_absent: "the session store has no session-row faces (sessionFaceOf / sessionSummaryOf / patchSessionMeta)",
21
+ session_row_faces_absent: "the session store has no session-row faces (headOf / sessionSummaryOf / patchSessionMeta)",
22
22
  session_purge_absent: "no session purge coordinator is wired",
23
23
  session_policy_store_absent: "no session policy store is wired",
24
24
  store_backend_absent: "no store backend is wired (DB_BACKEND=memory, multi-tenant bare boot, or half-configured SQL)",
@@ -96,7 +96,7 @@ export function taskHandles(d) {
96
96
  }
97
97
  export function sessionOwnership(d) {
98
98
  const s = d.sessionStorage;
99
- return s?.ownerOf !== undefined ? yes({ sessionStorage: s }) : no("session_owner_face_absent");
99
+ return headReadOf(s) !== undefined ? yes({ sessionStorage: s }) : no("session_head_face_absent");
100
100
  }
101
101
  export function mcpReconnect(d) {
102
102
  const runs = durableRuns(d);
@@ -113,12 +113,10 @@ export function sessionAuditView(d) {
113
113
  export function sessionEventStream(d) {
114
114
  if (d.sessionWatch === undefined)
115
115
  return no("session_watch_absent");
116
- const s = d.sessionStorage;
117
- if (s?.getLeafId === undefined)
118
- return no("session_leaf_face_absent");
119
- if (s.ownerOf === undefined)
120
- return no("session_owner_face_absent");
121
- return yes({ watch: d.sessionWatch, sessionStorage: s });
116
+ const owned = sessionOwnership(d);
117
+ if (!owned.available)
118
+ return owned;
119
+ return yes({ watch: d.sessionWatch, sessionStorage: owned.sessionStorage });
122
120
  }
123
121
  export function sessionList(d) {
124
122
  const lister = d.sessionStorage?.listSessions?.bind(d.sessionStorage) ?? d.runStore?.listSessions?.bind(d.runStore);
@@ -128,13 +126,13 @@ export function sessionFork(d) {
128
126
  const s = d.sessionStorage;
129
127
  if (s?.fork === undefined)
130
128
  return no("session_fork_face_absent");
131
- if (s.ownerOf === undefined)
132
- return no("session_owner_face_absent");
129
+ if (headReadOf(s) === undefined)
130
+ return no("session_head_face_absent");
133
131
  return yes({ sessionStorage: s });
134
132
  }
135
133
  export function sessionPatch(d) {
136
134
  const s = d.sessionStorage;
137
- if (s?.sessionFaceOf === undefined || s.patchSessionMeta === undefined)
135
+ if (headReadOf(s) === undefined || s?.patchSessionMeta === undefined)
138
136
  return no("session_row_faces_absent");
139
137
  return yes({ sessionStorage: s });
140
138
  }
@@ -164,7 +162,7 @@ export function sessionSync(d) {
164
162
  return no("session_export_absent");
165
163
  if (s.beginImportStaging === undefined)
166
164
  return no("session_import_staging_absent");
167
- if (s.sessionFaceOf === undefined || s.sessionSummaryOf === undefined || s.patchSessionMeta === undefined)
165
+ if (headReadOf(s) === undefined || s.sessionSummaryOf === undefined || s.patchSessionMeta === undefined)
168
166
  return no("session_row_faces_absent");
169
167
  if (overwriteWipeIncapable(d.sessionPolicyStore))
170
168
  return no("policy_purge_absent");
@@ -216,7 +214,7 @@ export function streamApproval(d) {
216
214
  }
217
215
  }
218
216
  export function readRootGrant(d) {
219
- return cwdHonored(d.config) ? YES : no("read_root_grant_posture_refused");
217
+ return DEPLOYMENT_SHAPE_PREDICATES.callerOwnsWorkerDisk.holds(d.config) ? YES : no("read_root_grant_posture_refused");
220
218
  }
221
219
  export function approvalFrameFamilies(stream) {
222
220
  if (stream.available)
@@ -1,5 +1,5 @@
1
1
  /**
2
- * S-667 —— **中心配置档位的唯一属主**:「在用的中心配置是谁的」+「换人之后降到了无中心配置档没有」+ 两态通告。
2
+ * [ref] —— **中心配置档位的唯一属主**:「在用的中心配置是谁的」+「换人之后降到了无中心配置档没有」+ 两态通告。
3
3
  *
4
4
  * ## 律
5
5
  * 凭证身份(凭据文件里的主体,`center-credential.ts` 的 `identity`)变化的那一刻,server 自己: