@zhushanwen/subagent-core 0.4.0 → 0.6.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 (309) hide show
  1. package/dist/{chunk-4KN4TTG7.js → chunk-43ONBFZX.js} +1 -1
  2. package/dist/{chunk-X7SZ5HLQ.js → chunk-V3VHZ2VX.js} +20 -27
  3. package/dist/execution/engine/engines/zcode/constants.cjs +29 -41
  4. package/dist/execution/engine/engines/zcode/constants.d.cts +65 -53
  5. package/dist/execution/engine/engines/zcode/constants.d.ts +65 -53
  6. package/dist/execution/engine/engines/zcode/constants.js +17 -27
  7. package/dist/execution/engine/engines/zcode/reader.d.cts +2 -1
  8. package/dist/execution/engine/engines/zcode/reader.d.ts +2 -1
  9. package/dist/execution/engine/engines/zcode/reader.js +2 -2
  10. package/dist/index.cjs +17100 -14082
  11. package/dist/index.d.cts +5336 -4033
  12. package/dist/index.d.ts +5336 -4033
  13. package/dist/index.js +17020 -14055
  14. package/dist/{types-DpUO16pj.d.cts → types-C3fE3R9x.d.cts} +280 -112
  15. package/dist/{types-DpUO16pj.d.ts → types-C3fE3R9x.d.ts} +280 -112
  16. package/dist.bundle/index.cjs +34933 -0
  17. package/package.json +3 -3
  18. package/src/__tests__/agent-opts-resolver-schema-prompt.test.ts +0 -1
  19. package/src/__tests__/append-system-prompt-assembly.test.ts +8 -7
  20. package/src/__tests__/fr4-get-state-handshake.test.ts +2 -2
  21. package/src/__tests__/m2-append-content-probe.test.ts +0 -1
  22. package/src/__tests__/manifest-store.test.ts +10 -9
  23. package/src/__tests__/record-store-cache.test.ts +0 -2
  24. package/src/__tests__/record-store-index.test.ts +1 -2
  25. package/src/__tests__/review-fix-loop-script.test.ts +4 -2
  26. package/src/__tests__/review-fix-loop-utils.test.ts +10 -10
  27. package/src/__tests__/robustness-low-batch1.test.ts +6 -5
  28. package/src/__tests__/robustness-medium-batch1.test.ts +2 -2
  29. package/src/__tests__/robustness-medium-batch2.test.ts +17 -6
  30. package/src/__tests__/robustness-medium-batch4.test.ts +2 -2
  31. package/src/__tests__/session-runner.test.ts +1 -1
  32. package/src/core/__tests__/host-services.test.ts +2 -2
  33. package/src/core/__tests__/logger.test.ts +1 -1
  34. package/src/core/error-message.ts +9 -0
  35. package/src/core/host-services.ts +21 -5
  36. package/src/core/notify-ports.ts +18 -5
  37. package/src/execution/__tests__/agent-profile.test.ts +4 -4
  38. package/src/execution/__tests__/agent-registry.test.ts +370 -0
  39. package/src/execution/__tests__/agent-result-mapper.test.ts +18 -2
  40. package/src/execution/__tests__/agents-assembly.test.ts +2 -2
  41. package/src/execution/__tests__/alive-store.test.ts +1 -1
  42. package/src/execution/__tests__/ask-user-transit-e2e.test.ts +6 -6
  43. package/src/execution/__tests__/chat-engine-routing.test.ts +68 -33
  44. package/src/execution/__tests__/chatmode-first-round-closure-spawn.test.ts +4 -4
  45. package/src/execution/__tests__/cold-resurrect.test.ts +283 -0
  46. package/src/execution/__tests__/collect-budget.test.ts +291 -0
  47. package/src/execution/__tests__/collect-coordinator-service.test.ts +327 -0
  48. package/src/execution/__tests__/collect-coordinator.test.ts +371 -0
  49. package/src/execution/__tests__/collect-mixed-dispatch.test.ts +262 -0
  50. package/src/execution/__tests__/config-collect-sync.test.ts +120 -0
  51. package/src/execution/__tests__/config.test.ts +1 -1
  52. package/src/execution/__tests__/delivery-methods.test.ts +75 -62
  53. package/src/execution/__tests__/descendant-sweep-guards.test.ts +220 -0
  54. package/src/execution/__tests__/descendant-sweep.test.ts +6 -6
  55. package/src/execution/__tests__/dialog-queue.test.ts +2 -2
  56. package/src/execution/__tests__/engine-model-validation.test.ts +741 -0
  57. package/src/execution/__tests__/epipe-fallback.test.ts +29 -24
  58. package/src/execution/__tests__/execute-and-await-worktree.test.ts +21 -91
  59. package/src/execution/__tests__/execute-nesting.test.ts +34 -188
  60. package/src/execution/__tests__/execution-record.test.ts +217 -60
  61. package/src/execution/__tests__/execution-runtime-face.test.ts +5 -5
  62. package/src/execution/__tests__/explicit-agent-ref-guard.test.ts +4 -4
  63. package/src/execution/__tests__/finalize-record.test.ts +173 -17
  64. package/src/execution/__tests__/finalized-marker.test.ts +1 -1
  65. package/src/execution/__tests__/gc-timer.test.ts +56 -3
  66. package/src/execution/__tests__/get-record-for-action-restart.test.ts +12 -12
  67. package/src/execution/__tests__/get-state-handshake.test.ts +1 -1
  68. package/src/execution/__tests__/helpers/mock-extension-api.ts +1 -1
  69. package/src/execution/__tests__/helpers/session-runner-mocks.ts +113 -0
  70. package/src/execution/__tests__/helpers/spawn-mock.ts +150 -3
  71. package/src/execution/__tests__/helpers/subagent-service-mocks.ts +137 -0
  72. package/src/execution/__tests__/keep-alive-no-progress.test.ts +50 -148
  73. package/src/execution/__tests__/kill-all-escalation.test.ts +2 -2
  74. package/src/execution/__tests__/lifecycle-predicates.test.ts +1 -2
  75. package/src/execution/__tests__/manifest-parentid.test.ts +4 -4
  76. package/src/execution/__tests__/manifest-store-tmp-recovery.test.ts +1 -1
  77. package/src/execution/__tests__/max-turns-to-watchdog-ms.test.ts +1 -1
  78. package/src/execution/__tests__/model-resolver.test.ts +2 -2
  79. package/src/execution/__tests__/nested-visibility-env-propagation.test.ts +23 -121
  80. package/src/execution/__tests__/nested-visibility.test.ts +2 -0
  81. package/src/execution/__tests__/notify-batch.test.ts +500 -0
  82. package/src/execution/__tests__/notify-ledger.test.ts +1000 -18
  83. package/src/execution/__tests__/output-collector.test.ts +117 -6
  84. package/src/execution/__tests__/pi-invocation.test.ts +36 -4
  85. package/src/execution/__tests__/record-entry-collect.test.ts +102 -0
  86. package/src/execution/__tests__/record-store.test.ts +10 -9
  87. package/src/execution/__tests__/records-cwd-isolation.test.ts +2 -2
  88. package/src/execution/__tests__/recursive-visibility-baseline.test.ts +29 -132
  89. package/src/execution/__tests__/recursive-visibility-env.test.ts +55 -179
  90. package/src/execution/__tests__/relay-env.test.ts +12 -1
  91. package/src/execution/__tests__/rpc-mode.test.ts +2 -2
  92. package/src/execution/__tests__/run-and-finalize-anchoring.test.ts +387 -0
  93. package/src/execution/__tests__/run-and-finalize-chatmode.test.ts +15 -9
  94. package/src/execution/__tests__/run-spawn-chatmode-settled.test.ts +4 -4
  95. package/src/execution/__tests__/run-spawn-edges.test.ts +17 -15
  96. package/src/execution/__tests__/run-spawn-integration.test.ts +2 -2
  97. package/src/execution/__tests__/run-spawn-resume.test.ts +2 -2
  98. package/src/execution/__tests__/run-spawn-rpc-mode.test.ts +2 -2
  99. package/src/execution/__tests__/run-spawn-stdout-callback-throw.test.ts +4 -4
  100. package/src/execution/__tests__/service-kill-escalation.test.ts +7 -5
  101. package/src/execution/__tests__/session-context-resolver.test.ts +0 -2
  102. package/src/execution/__tests__/session-file-gc.test.ts +36 -1
  103. package/src/execution/__tests__/session-pending.test.ts +257 -14
  104. package/src/execution/__tests__/session-reconstructor.test.ts +366 -15
  105. package/src/execution/__tests__/session-runner-branch-cache-lru.test.ts +1 -1
  106. package/src/execution/__tests__/session-runner-close-prune.test.ts +2 -2
  107. package/src/execution/__tests__/session-runner-dispatch.test.ts +489 -0
  108. package/src/execution/__tests__/session-runner-epipe.test.ts +3 -3
  109. package/src/execution/__tests__/session-runner-heartbeat-idle-fallback.test.ts +5 -4
  110. package/src/execution/__tests__/session-runner-lifecycle-helpers.test.ts +290 -0
  111. package/src/execution/__tests__/session-runner-schema-env.test.ts +7 -5
  112. package/src/execution/__tests__/settled-watchdog.test.ts +282 -47
  113. package/src/execution/__tests__/spawn-args.test.ts +11 -10
  114. package/src/execution/__tests__/spawn-event-adapter-rpc.test.ts +26 -23
  115. package/src/execution/__tests__/spawn-event-adapter.test.ts +3 -3
  116. package/src/execution/__tests__/spawn-worktree-guidance.test.ts +5 -4
  117. package/src/execution/__tests__/spawned-children.test.ts +2 -1
  118. package/src/execution/__tests__/start-collect-guard.test.ts +255 -0
  119. package/src/execution/__tests__/start-sync-model-guard.test.ts +5 -5
  120. package/src/execution/__tests__/stdin-writer.test.ts +6 -4
  121. package/src/execution/__tests__/stream-sink-retirement.test.ts +6 -6
  122. package/src/execution/__tests__/subagent-actions-core.test.ts +48 -22
  123. package/src/execution/__tests__/subagent-service-message-close.test.ts +29 -26
  124. package/src/execution/__tests__/subagent-service-multiproc-guard.test.ts +21 -8
  125. package/src/execution/__tests__/subagent-service-notify-gate.test.ts +27 -22
  126. package/src/execution/__tests__/subagent-service-parent-guard.test.ts +30 -29
  127. package/src/execution/__tests__/subagent-service-recovery-bounds.test.ts +45 -20
  128. package/src/execution/__tests__/subagent-service.test.ts +37 -30
  129. package/src/execution/__tests__/subprocess-agent-runner-routing.test.ts +88 -12
  130. package/src/execution/__tests__/subprocess-agent-runner-timeout.test.ts +75 -0
  131. package/src/execution/__tests__/subprocess-agent-runner.test.ts +22 -20
  132. package/src/execution/__tests__/sync-collect-recovery.test.ts +1117 -0
  133. package/src/execution/__tests__/temp-prompt.test.ts +1 -1
  134. package/src/execution/__tests__/timeout-integration.test.ts +6 -5
  135. package/src/execution/__tests__/tombstone-store.test.ts +1 -1
  136. package/src/execution/__tests__/turn-limiter-semantics.test.ts +1 -1
  137. package/src/execution/__tests__/turn-limiter.test.ts +1 -1
  138. package/src/execution/__tests__/ui-request-handler-factory.test.ts +12 -6
  139. package/src/execution/__tests__/ui-request-handler.test.ts +4 -3
  140. package/src/execution/__tests__/ui-request-queue.test.ts +142 -2
  141. package/src/execution/__tests__/worktree-git-ops.test.ts +1 -1
  142. package/src/execution/__tests__/worktree-manager.test.ts +14 -5
  143. package/src/execution/__tests__/worktree-pid-registration.integration.test.ts +4 -3
  144. package/src/execution/__tests__/worktree-reconcile-aging.test.ts +2 -2
  145. package/src/execution/__tests__/worktree-reconcile.integration.test.ts +1 -1
  146. package/src/execution/__tests__/worktree-registry.test.ts +1 -1
  147. package/src/execution/agent-registry.ts +74 -30
  148. package/src/execution/agent-result-mapper.ts +3 -0
  149. package/src/execution/cold-resurrect.ts +199 -0
  150. package/src/execution/collect-coordinator.ts +200 -0
  151. package/src/execution/config.ts +77 -5
  152. package/src/execution/engine/__tests__/common/capability-gate.test.ts +91 -0
  153. package/src/execution/engine/__tests__/common/data-dir.test.ts +1 -1
  154. package/src/execution/engine/__tests__/common/event-journal.test.ts +1 -1
  155. package/src/execution/engine/__tests__/common/journal-wiring.test.ts +84 -0
  156. package/src/execution/engine/__tests__/common/kill-chain.test.ts +34 -7
  157. package/src/execution/engine/__tests__/common/persona-router.test.ts +4 -5
  158. package/src/execution/engine/__tests__/common/pool-manager.test.ts +213 -53
  159. package/src/execution/engine/__tests__/common/session-view-service-zcode-dbpath.test.ts +149 -0
  160. package/src/execution/engine/__tests__/common/session-view-service.test.ts +499 -0
  161. package/src/execution/engine/__tests__/conformance/contract.abort.test.ts +22 -112
  162. package/src/execution/engine/__tests__/conformance/contract.agent-events.test.ts +15 -28
  163. package/src/execution/engine/__tests__/conformance/contract.read-degradation.test.ts +1 -1
  164. package/src/execution/engine/__tests__/conformance/engine-conformance.live.test.ts +12 -12
  165. package/src/execution/engine/__tests__/conformance/golden-replay.pi.test.ts +2 -2
  166. package/src/execution/engine/__tests__/conformance/golden-replay.zcode.test.ts +21 -82
  167. package/src/execution/engine/__tests__/conformance/zcode-appserver-harness.ts +4 -7
  168. package/src/execution/engine/__tests__/engine-discovery.test.ts +15 -3
  169. package/src/execution/engine/__tests__/model-prompt.test.ts +15 -3
  170. package/src/execution/engine/__tests__/registry.test.ts +4 -2
  171. package/src/execution/engine/__tests__/routing.test.ts +115 -6
  172. package/src/execution/engine/common/capability-gate.ts +92 -0
  173. package/src/execution/engine/common/journal-wiring.ts +97 -0
  174. package/src/execution/engine/common/kill-chain.ts +42 -10
  175. package/src/execution/engine/common/nesting-guard.ts +66 -0
  176. package/src/execution/engine/common/persona-router.ts +18 -8
  177. package/src/execution/engine/common/pool-manager.ts +332 -78
  178. package/src/execution/engine/common/session-view-service.ts +506 -0
  179. package/src/execution/engine/common/session-view-types.ts +125 -0
  180. package/src/execution/engine/engines/pi/__tests__/pi-engine.test.ts +174 -28
  181. package/src/execution/engine/engines/pi/__tests__/spawn-opts-direct.test.ts +257 -0
  182. package/src/execution/{argv-mirror.ts → engine/engines/pi/argv-mirror.ts} +43 -21
  183. package/src/execution/{get-state-handshake.ts → engine/engines/pi/get-state-handshake.ts} +1 -1
  184. package/src/execution/{output-collector.ts → engine/engines/pi/output-collector.ts} +108 -19
  185. package/src/execution/engine/engines/pi/pi-engine.ts +434 -38
  186. package/src/execution/{pi-invocation.ts → engine/engines/pi/pi-invocation.ts} +2 -2
  187. package/src/execution/engine/engines/pi/reader.ts +11 -0
  188. package/src/execution/engine/engines/pi/registration.ts +4 -2
  189. package/src/execution/{session-runner.ts → engine/engines/pi/session-runner.ts} +617 -412
  190. package/src/execution/{spawn-event-adapter.ts → engine/engines/pi/spawn-event-adapter.ts} +75 -34
  191. package/src/execution/{stdin-writer.ts → engine/engines/pi/stdin-writer.ts} +10 -9
  192. package/src/execution/{temp-prompt.ts → engine/engines/pi/temp-prompt.ts} +2 -2
  193. package/src/execution/{turn-limiter.ts → engine/engines/pi/turn-limiter.ts} +1 -1
  194. package/src/execution/engine/engines/zcode/__tests__/__fixtures__/fake-appserver.mjs +54 -27
  195. package/src/execution/engine/engines/zcode/__tests__/appserver-launcher.test.ts +321 -0
  196. package/src/execution/engine/engines/zcode/__tests__/connection.test.ts +13 -12
  197. package/src/execution/engine/engines/zcode/__tests__/parser.test.ts +7 -210
  198. package/src/execution/engine/engines/zcode/__tests__/preparer.test.ts +6 -110
  199. package/src/execution/engine/engines/zcode/__tests__/session-channel-dispose-harvest.test.ts +247 -0
  200. package/src/execution/engine/engines/zcode/__tests__/session-channel-turn-timers.test.ts +451 -0
  201. package/src/execution/engine/engines/zcode/__tests__/session-channel.test.ts +20 -8
  202. package/src/execution/engine/engines/zcode/__tests__/zcode-engine-appserver.test.ts +77 -110
  203. package/src/execution/engine/engines/zcode/__tests__/zcode-engine-degrade.test.ts +26 -320
  204. package/src/execution/engine/engines/zcode/__tests__/zcode-engine-dispose.test.ts +210 -0
  205. package/src/execution/engine/engines/zcode/__tests__/zcode-engine-retry.test.ts +353 -0
  206. package/src/execution/engine/engines/zcode/__tests__/zcode-engine-status.test.ts +282 -0
  207. package/src/execution/engine/engines/zcode/__tests__/zcode-engine-timeout.test.ts +372 -0
  208. package/src/execution/engine/engines/zcode/__tests__/zcode-engine.live.test.ts +48 -148
  209. package/src/execution/engine/engines/zcode/appserver-launcher.ts +167 -0
  210. package/src/execution/engine/engines/zcode/connection.ts +24 -11
  211. package/src/execution/engine/engines/zcode/constants.ts +75 -71
  212. package/src/execution/engine/engines/zcode/golden-sample.ts +8 -46
  213. package/src/execution/engine/engines/zcode/parser.ts +12 -346
  214. package/src/execution/engine/engines/zcode/preparer.ts +12 -143
  215. package/src/execution/engine/engines/zcode/session-channel.ts +351 -39
  216. package/src/execution/engine/engines/zcode/zcode-engine.ts +665 -760
  217. package/src/execution/engine/host-task-spec.ts +32 -36
  218. package/src/execution/engine/model-validation.ts +177 -0
  219. package/src/execution/engine/port.ts +24 -6
  220. package/src/execution/engine/routing.ts +75 -1
  221. package/src/execution/engine/types.ts +30 -103
  222. package/src/execution/execution-record.ts +229 -144
  223. package/src/execution/finalize-record.ts +141 -99
  224. package/src/execution/idle-gc.ts +28 -0
  225. package/src/execution/lifecycle-predicates.ts +1 -1
  226. package/src/execution/notifier.ts +234 -25
  227. package/src/execution/notify-host.ts +232 -0
  228. package/src/execution/record-entry.ts +16 -0
  229. package/src/execution/record-store.ts +280 -103
  230. package/src/execution/round-settlement.ts +93 -0
  231. package/src/execution/session-file-gc.ts +96 -62
  232. package/src/execution/session-reconstructor.ts +256 -143
  233. package/src/execution/sessions-index.ts +117 -47
  234. package/src/execution/settled-watchdog.ts +264 -52
  235. package/src/execution/subagent-actions-core.ts +84 -28
  236. package/src/execution/subagent-service.ts +1225 -964
  237. package/src/execution/subprocess-agent-runner.ts +144 -97
  238. package/src/execution/sync-rebuild.ts +87 -0
  239. package/src/execution/types.ts +72 -0
  240. package/src/execution/ui-request-handler-factory.ts +102 -74
  241. package/src/execution/ui-request-queue.ts +50 -19
  242. package/src/index.ts +442 -316
  243. package/src/orchestration/__tests__/agent-call-catch-fallback.test.ts +1 -1
  244. package/src/orchestration/__tests__/agent-call-stream.test.ts +2 -2
  245. package/src/orchestration/__tests__/args-validator.test.ts +14 -0
  246. package/src/orchestration/__tests__/config-loader.test.ts +1 -1
  247. package/src/orchestration/__tests__/error-recovery-rebuild-failure.test.ts +1 -1
  248. package/src/orchestration/__tests__/error-recovery-terminal-hardening.test.ts +11 -9
  249. package/src/orchestration/__tests__/execute-agent-call.test.ts +151 -11
  250. package/src/orchestration/__tests__/file-run-store-prune.test.ts +1 -1
  251. package/src/orchestration/__tests__/file-run-store-throttle.test.ts +1 -1
  252. package/src/orchestration/__tests__/file-run-store.test.ts +7 -6
  253. package/src/orchestration/__tests__/launcher-nested-workflow.test.ts +2 -2
  254. package/src/orchestration/__tests__/lifecycle-abort-broadcast-signal.test.ts +1 -1
  255. package/src/orchestration/__tests__/lifecycle-runid-injection.test.ts +3 -3
  256. package/src/orchestration/__tests__/lifecycle.test.ts +7 -5
  257. package/src/orchestration/__tests__/non-cloneable-return-e2e.test.ts +1 -1
  258. package/src/orchestration/__tests__/review-fix-loop-scriptpath-failfast.test.ts +1 -1
  259. package/src/orchestration/__tests__/run-snapshot.test.ts +8 -5
  260. package/src/orchestration/__tests__/script-generate.test.ts +5 -5
  261. package/src/orchestration/__tests__/script-lint.test.ts +17 -0
  262. package/src/orchestration/__tests__/skill-discovery.test.ts +2 -2
  263. package/src/orchestration/__tests__/test-mocks.ts +2 -0
  264. package/src/orchestration/__tests__/worker-exit-without-result.test.ts +7 -6
  265. package/src/orchestration/__tests__/worker-message-pump-finalize-run.test.ts +229 -0
  266. package/src/orchestration/__tests__/{error-recovery-handlers.test.ts → worker-message-pump-handlers.test.ts} +27 -19
  267. package/src/orchestration/__tests__/{error-recovery-postmessage-defense.test.ts → worker-message-pump-postmessage-defense.test.ts} +8 -8
  268. package/src/orchestration/__tests__/{error-recovery-serialize-failed-result.test.ts → worker-message-pump-serialize-failed-result.test.ts} +2 -2
  269. package/src/orchestration/__tests__/{error-recovery-workflow-call.test.ts → worker-message-pump-workflow-call.test.ts} +1 -1
  270. package/src/orchestration/__tests__/worker-pending-timeout-abort.test.ts +1 -1
  271. package/src/orchestration/__tests__/worker-script-builder.test.ts +1 -1
  272. package/src/orchestration/__tests__/workflow-files.test.ts +10 -10
  273. package/src/orchestration/__tests__/workflow-nesting-e2e.test.ts +1 -1
  274. package/src/orchestration/__tests__/workflow-script-registry-impl.test.ts +1 -1
  275. package/src/orchestration/agent-opts-resolver.ts +1 -1
  276. package/src/orchestration/args-validator.ts +53 -31
  277. package/src/orchestration/execute-agent-call.ts +19 -73
  278. package/src/orchestration/launcher.ts +128 -81
  279. package/src/orchestration/lifecycle.ts +43 -45
  280. package/src/orchestration/models/ports.ts +4 -4
  281. package/src/orchestration/models/run-runtime.ts +2 -2
  282. package/src/orchestration/models/trace.ts +1 -1
  283. package/src/orchestration/models/types.ts +111 -22
  284. package/src/orchestration/models/workflow-run.ts +1 -1
  285. package/src/orchestration/script-lint.ts +91 -58
  286. package/src/orchestration/{error-recovery.ts → worker-message-pump.ts} +157 -150
  287. package/src/shared/__tests__/atomic-write.test.ts +1 -1
  288. package/src/shared/__tests__/meta-parser.test.ts +151 -0
  289. package/src/shared/__tests__/resource-discovery-host-roots.test.ts +5 -5
  290. package/src/shared/__tests__/resource-discovery.test.ts +258 -215
  291. package/src/shared/atomic-write.ts +12 -9
  292. package/src/shared/meta-parser.ts +158 -84
  293. package/src/shared/model-ref.ts +15 -2
  294. package/src/shared/resource-discovery.ts +9 -183
  295. package/src/shared/schema-jsonify.ts +1 -1
  296. package/workflows/review-fix-loop-utils.cjs +151 -89
  297. package/workflows/review-fix-loop-utils.d.cts +287 -0
  298. package/src/execution/__tests__/execute-options-mapper.test.ts +0 -200
  299. package/src/execution/engine/engines/pi/__tests__/task-spec-mapper.test.ts +0 -164
  300. package/src/execution/engine/engines/pi/task-spec-mapper.ts +0 -100
  301. package/src/execution/engine/engines/zcode/__tests__/__fixtures__/zcode-golden-spawn.json +0 -39
  302. package/src/execution/engine/engines/zcode/__tests__/launcher.test.ts +0 -150
  303. package/src/execution/engine/engines/zcode/__tests__/preparer-appserver.test.ts +0 -387
  304. package/src/execution/engine/engines/zcode/__tests__/zcode-engine.test.ts +0 -710
  305. package/src/execution/engine/engines/zcode/appserver-home.ts +0 -442
  306. package/src/execution/engine/engines/zcode/appserver-probe.ts +0 -141
  307. package/src/execution/engine/engines/zcode/launcher.ts +0 -161
  308. package/src/execution/execute-options-mapper.ts +0 -115
  309. package/src/shared/__tests__/resource-discovery-manifest-cache.test.ts +0 -288
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @zhushanwen/subagent-core — 公共 API barrel(D5 定稿)
2
+ * @zhushanwen/subagent-core — 公共 API barrel(D5 定稿 + post-convergence B-2 扩面)
3
3
  *
4
4
  * 公共 API 面 = 本文件导出 + package.json exports 的语义子入口
5
5
  * (./engines/zcode/reader、./engines/zcode/constants、./engine/paths、./relay-env)
@@ -7,25 +7,34 @@
7
7
  * 新增导出走 minor,本文件刻意不使用 `export *`,逐名列出以使 diff 可审。
8
8
  * 内部实现细节(error-recovery / execute-agent-call / worker-script-builder 等
9
9
  * engine 编排件)不经 barrel 导出;host-surface 扩面(zsw 回接 U0,2026-08-30)
10
- * 后 port 的 Infra 实现与宿主组装件已列入公共面,仓内壳侧深路径消费
11
- * (`./*` -> src 通配)不受本文件约束。
10
+ * 后 port 的 Infra 实现与宿主组装件已列入公共面。
11
+ *
12
+ * 扩面判定标准(post-convergence D3):壳非测试代码实际消费 ≥1 处即进 barrel——
13
+ * 契约面 = 壳的实际消费面,core 内部移动/重命名文件不再是对壳的隐性 breaking。
14
+ * 未进 barrel 的内部实现细节仍不经此导出;`./*` -> src 开发态通配已随 u-2a/u-2b
15
+ * 从 package.json 删除,深路径归一由消费侧单元(u-2b/u-2c)收口,barrel 是公共
16
+ * 消费终点。
12
17
  *
13
18
  * 设计权威源:docs/design/subagent-core-package-extraction.md §3.3 D5;
19
+ * docs/design/subagent-post-convergence-architecture.md §3.2 B-2 / §3.6 D3/D8/D9;
20
+ * docs/design/subagent-core-sink-design.md(sink 下沉收口扩面,2026-08-31);
14
21
  * 宿主接入示例见包 README(§3.4 core_host_not_configured 恢复指引的落点)。
15
22
  */
16
23
 
17
24
  // 0.4.0 = 首个公开发布的收敛收口面(0.3.0 为 2026-08-30 裁决的跳号占位,永不单独
18
25
  // 发布;+ minor changeset 收口面落本号);与 package.json version 的一致性由
19
26
  // src/__tests__/smoke.test.ts 动态守护,改版本须两处同步。
20
- export const CORE_PACKAGE_VERSION = "0.4.0";
27
+ export const CORE_PACKAGE_VERSION = "0.6.0";
21
28
 
22
29
  // ── 宿主端口接线面(core/)────────────────────────────────────
23
30
  // HostServices:dataRoot / log / discoveryRoots 端口 + configureCore 注入;
24
31
  // 未 configureCore 即消费 dataRoot 抛 core_host_not_configured(§3.4 错误规格,
25
32
  // 恢复指引指向 README 接入示例)。DEFAULT_DATA_ROOT 显式导出供宿主选用——
26
- // 消除「缺省静默漂目录」。
33
+ // 消除「缺省静默漂目录」。getHostServices:core 内统一取用点,宿主 injector
34
+ // 消费(resource-list-injector)。
27
35
  export {
28
36
  configureCore,
37
+ getHostServices,
29
38
  DEFAULT_DATA_ROOT,
30
39
  type DiscoveryRoot,
31
40
  type HostServices,
@@ -54,13 +63,11 @@ export type {
54
63
  export type {
55
64
  AgentEvent,
56
65
  AgentOutcome,
57
- AgentTaskSpec,
58
66
  EngineCapabilities,
59
67
  EngineHandle,
60
68
  EngineHandleData,
61
69
  InteractAction,
62
70
  InteractResult,
63
- PersonaSpec,
64
71
  ProbeReport,
65
72
  ReplayedTurn,
66
73
  SessionView,
@@ -82,107 +89,373 @@ export {
82
89
  type EngineRoutingSource,
83
90
  } from "./execution/engine/routing.ts";
84
91
 
85
- // ── 资源发现面(shared/resource-discovery,W2③)──────────────
86
- // discoverResources:agent .md / workflow .js 的多源统一发现(ADR-031)——多源扫描
87
- // + stem last-writer-wins 合并 + realpath 去重。宿主(zsw 回接)经 ScanConfig.hostRoots
88
- // 注入发现根(source 标签即 ResourceSource 槽位键,含 project-host 项目级槽);
89
- // 深路径消费在 npm/vendored 发布形态不可达(exports 无深路径通配),故出 barrel。
90
- export { discoverResources } from "./shared/resource-discovery.ts";
91
- export type {
92
- DiscoveredResource,
93
- ResourceKind,
94
- ResourceSource,
95
- ScanConfig,
96
- } from "./shared/resource-discovery.ts";
97
- // 发现链辅助(C5b):discoverResources 之外被发现消费方逐文件消费的三个原语——
98
- // findWorkspaceRoot(project 源根定位)、getCachedParsed/getCachedFileContent
99
- // (mtime 缓存读取)。发现链消费方(pi-sw injector 等宿主接线)逐条解析
100
- // DiscoveredResource 的 frontmatter/meta 需要它们,深路径在 npm/vendored 发布
101
- // 形态不可达,故随发现面出 barrel。
92
+ // ── 引擎注册 / 发现与进程面(execution/engine)────────────────
93
+ // 组合根 index.ts 接线消费(registerXxx 引擎注册、syncEnginesFile engines 文件
94
+ // 同步、killAllSpawnedChildren session 派生进程兜底清理)。
95
+ export { syncEnginesFile } from "./execution/engine/engine-discovery.ts";
96
+ export { registerPiEngine } from "./execution/engine/engines/pi/registration.ts";
97
+ export { killAllSpawnedChildren } from "./execution/engine/engines/pi/session-runner.ts";
98
+ export { registerZcodeEngine } from "./execution/engine/engines/zcode/registration.ts";
99
+
100
+ // pi session-runner 内核件(merge 裁决:dev 侧旧深路径 execution/session-runner.ts
101
+ // 终态已不存在,符号随 u-2a 迁移至 engine/engines/pi/session-runner.ts):
102
+ // maxTurnsToWatchdogMs 为 maxTurns→watchdog 毫秒换算(U3/U4 / D7,floor 语义
103
+ // 文档化——两宿主预算一致性 S2 的函数级锚点);killRecordChildWithEscalation 为
104
+ // record 子进程升级回收(session 派生进程清理的细粒度入口)。
102
105
  export {
103
- findWorkspaceRoot,
104
- getCachedFileContent,
105
- getCachedParsed,
106
- } from "./shared/resource-discovery.ts";
107
- // parseResourceMeta:.md frontmatter / workflow @pi-meta 的统一 meta 解析
108
- // (fail-safe null)——发现链消费方从 DiscoveredResource 提取 name/description
109
- // 的解析入口,与上面发现链辅助同属一个消费面,深路径同样不可达。
110
- export { parseResourceMeta } from "./shared/meta-parser.ts";
106
+ killRecordChildWithEscalation,
107
+ maxTurnsToWatchdogMs,
108
+ } from "./execution/engine/engines/pi/session-runner.ts";
109
+
110
+ // zcode 引擎注册面:registerZcodeEngine 'zcode' 引擎登记进 registry(组合根
111
+ // 职责,幂等,上方已导出);createZcodeEngine DI 工厂(测试/宿主注入 deps)。
112
+ // ZcodeEngineDeps 经 registration.ts 的 re-export 导出(避免与 zcode-engine.ts 双源)。
113
+ export { createZcodeEngine } from "./execution/engine/engines/zcode/registration.ts";
114
+ export type { ZcodeEngineDeps } from "./execution/engine/engines/zcode/registration.ts";
111
115
 
112
- // ── 注入渲染面(shared/injection-render + shared/xml-injection,W3)──
113
- // 三段 XML(<available_subagents>/<available_workflows>/<available_provider_models>)
114
- // format 纯函数 + Entry 接口从 pi-sw 插件层下沉(D-3):ModelEntry 并集口径
115
- // (除 id/name 外全字段 optional,红线 5 守卫不抛不渲垃圾)、分段条目预算
116
- // (码点序排 + 截尾 + 宿主注入兜底指引;models 段无预算永不截,红线 7)、
117
- // guide 文案宿主注入(core 不内嵌平台文案)。summarizeDescription 随
118
- // WorkflowEntry 链导出(zsw 侧同口径消费)。escapeXml/renderXmlSection 渲染
119
- // 原语随面出 barrel——深路径消费在 npm/vendored 发布形态不可达。
116
+ // ZcodeTaskShapeError:zcode 任务形状错误类(instanceof 分流用)——
117
+ // execution-runtime-face.test.ts:29 消费,barrel 保留导出(engines 域 A1 裁决)。
118
+ export { ZcodeTaskShapeError } from "./execution/engine/engines/zcode/zcode-engine.ts";
119
+
120
+ // 引擎注册表原语 + 引擎感知提示面:engine-awareness injector 消费。
120
121
  export {
121
- formatAgentList,
122
- formatModelList,
123
- formatWorkflowList,
124
- sortByCodepoint,
125
- summarizeDescription,
126
- } from "./shared/injection-render.ts";
122
+ DEFAULT_ENGINE_ID,
123
+ normalizeEngineId,
124
+ } from "./execution/engine/registry.ts";
125
+ export {
126
+ buildEngineModelsPromptAppend,
127
+ buildSubagentEngineSection,
128
+ } from "./execution/engine/model-prompt.ts";
129
+
130
+ // session-view 归一符号(post-convergence D3):runtime 读取侧 2 处深路径
131
+ // (subagent-extractor / subagent-engine-history)归一 barrel 的前置——不新增
132
+ // 子入口(D9:每条子入口 bundle 多一份 host-services 副本)。
133
+ export { parseEngineHandle } from "./execution/engine/common/session-view-types.ts";
134
+ export { readSubagentHistoryMessages } from "./execution/engine/common/session-view-service.ts";
135
+
136
+ // ── 执行域(execution/)──────────────────────────────────────
137
+ // types.ts 领域类型族:record / 响应 / 列表项等 subagent 域公共契约(壳消费最高频面,
138
+ // tool 面 / interface 渲染层 / bg-notify 共同消费)。CLOSED_REASONS / DEFAULT_AGENT_NAME
139
+ // 为值常量,ResurrectDeniedError 为错误类(值 + 类型双形态)。
140
+ export {
141
+ CLOSED_REASONS,
142
+ DEFAULT_AGENT_NAME,
143
+ ResurrectDeniedError,
144
+ } from "./execution/types.ts";
127
145
  export type {
128
- AgentEntry,
129
- ListFormatOptions,
130
- ModelEntry,
131
- ModelListFormatOptions,
132
- ModelReasoningInfo,
133
- WorkflowEntry,
134
- } from "./shared/injection-render.ts";
135
- export { escapeXml, renderXmlSection } from "./shared/xml-injection.ts";
146
+ AgentEventLogEntry,
147
+ BgResponse,
148
+ CancelResponse,
149
+ CloseResponse,
150
+ ClosedReason,
151
+ DisplayItem,
152
+ ExecutionMode,
153
+ ExecutionOutcome,
154
+ ExecutionRecord,
155
+ ExecutionStatus,
156
+ ExternalState,
157
+ ForkFromResponse,
158
+ ListResponse,
159
+ MessageResponse,
160
+ SubagentListItem,
161
+ SubagentRecord,
162
+ SubagentToolResult,
163
+ } from "./execution/types.ts";
164
+
165
+ // execution-record 投影函数族:record → 渲染态投影(outcome / elapsed / tool calls /
166
+ // live progress),interface 渲染层唯一消费入口。
167
+ export {
168
+ computeElapsedSeconds,
169
+ countAllToolCalls,
170
+ deriveOutcome,
171
+ getAllToolCalls,
172
+ projectLiveProgress,
173
+ projectOutcome,
174
+ } from "./execution/execution-record.ts";
175
+
176
+ // SubagentService 聚合面 + 进程单例访问器(post-convergence D8):访问器经
177
+ // globalThis[Symbol.for] slot 防 jiti 多实例分裂,/resume /fork 复用既有实例
178
+ // (SR-3/SR-4 语义)。createSubagentService / SubagentServiceInit 为构造依赖参数
179
+ // 注入形态(modelService 等,无全局查找,@experimental U10 / D6)。
180
+ export {
181
+ SubagentService,
182
+ getSubagentService,
183
+ setSubagentService,
184
+ createSubagentService,
185
+ type SubagentServiceInit,
186
+ } from "./execution/subagent-service.ts";
187
+ // notifyGateAllowsDelivery:closedReason → 投递许可判定(通知门)——
188
+ // 投递内核与壳侧 notify 链的共同语义锚点(execution 生产域消费,A2a)。
189
+ export { notifyGateAllowsDelivery } from "./execution/subagent-service.ts";
190
+
191
+ // ModelConfigService 聚合面 + 单例访问器四件中的 model 侧两件(D8);
192
+ // ModelConfigServiceInit 为 SubagentServiceInit.modelService 的构造依赖
193
+ // (MF-4:jsdoc 示例 `new ModelConfigService({cwd, agentDir})` 可构造)。
194
+ export {
195
+ ModelConfigService,
196
+ getModelConfigService,
197
+ setModelConfigService,
198
+ type ModelConfigServiceInit,
199
+ } from "./execution/model-config-service.ts";
200
+
201
+ // notify ledger:宿主通知账本端口(bind / getBound)——组合根装配 + workflow 域消费。
202
+ export {
203
+ bindNotifyLedgerHost,
204
+ getBoundNotifyLedger,
205
+ type NotifyLedgerHost,
206
+ } from "./execution/notify-ledger.ts";
207
+
208
+ // identity 重建常量与类型:session_start identity custom entry 的写入侧契约。
209
+ export {
210
+ IDENTITY_CUSTOM_TYPE,
211
+ type SubagentIdentityData,
212
+ } from "./execution/session-reconstructor.ts";
213
+
214
+ // 执行域外围件(组合根 / interface 层直接消费的独立单点件)。
215
+ export { bestEffort } from "./execution/best-effort.ts";
216
+ // channel-registry 类型闭包(UiChannelRegistry / ChannelHandler)随值符号进 barrel
217
+ // (u-2b 主 agent 裁决 2026-09-03):壳 index.ts 跨扩展 re-export surface 的非测试
218
+ // 生产消费,满足 D3 判定标准;type-only,零运行时面变化。
219
+ export {
220
+ getOrCreateChannelRegistry,
221
+ type UiChannelRegistry,
222
+ type ChannelHandler,
223
+ } from "./execution/channel-registry-access.ts";
224
+ export { DialogGlobalQueue } from "./execution/dialog-queue.ts";
225
+ export {
226
+ readGlobalConfig,
227
+ type GlobalConfigReadResult,
228
+ } from "./execution/config.ts";
229
+ export { isResumable } from "./execution/lifecycle-predicates.ts";
230
+ export { maybeCleanupExpiredSessionFiles } from "./execution/session-file-gc.ts";
231
+ export { createUiRequestHandlerForMode } from "./execution/ui-request-handler-factory.ts";
232
+ export { WorktreeManager } from "./execution/worktree-manager.ts";
233
+ export { SubprocessAgentRunner } from "./execution/subprocess-agent-runner.ts";
234
+
235
+ // record 存储面:RecordStore 类 + 索引文件名常量(bench 扫描基准消费);
236
+ // ChangeListener / RecordStorePi / StatusFilter 为状态查询面的类型闭包
237
+ //(@experimental U10 / D6:lookupRecordAnyState 全态查询等签名直接引用)。
238
+ export {
239
+ RecordStore,
240
+ type ChangeListener,
241
+ type RecordStorePi,
242
+ type StatusFilter,
243
+ } from "./execution/record-store.ts";
244
+ export { INDEX_FILENAME } from "./execution/sessions-index.ts";
245
+
246
+ // record 落盘 entry 契约:custom entry 写入侧(@experimental U10 / D6)。
247
+ export {
248
+ SUBAGENT_RECORD_CUSTOM_TYPE,
249
+ toSubagentRecordEntry,
250
+ type SubagentRecordEntryData,
251
+ } from "./execution/record-entry.ts";
252
+
253
+ // agent-registry 执行消费面:loadByPath 直接加载(@experimental U10 / D6)+
254
+ // parseAgentProfile 宽容解析(无 frontmatter 不拒、name 缺省 stem、返回 body 与
255
+ // 执行字段全量)——执行消费面单点;与严格注入投影(parseResourceMeta)双轨分离
256
+ // 的执行侧统一入口(U2 / D3)。
257
+ export { AgentRegistry } from "./execution/agent-registry.ts";
258
+ export {
259
+ parseAgentProfile,
260
+ type AgentProfile,
261
+ } from "./execution/agent-registry.ts";
262
+
263
+ // 错误类型族(error-recovery.ts 计划路径实测不存在,实测散布于下列源文件):
264
+ // resurrect/fork-depth/dirty-worktree 为动作层守卫抛出点(types.ts),
265
+ // GitRunError 见 worktree 内核组裁决,ZcodeTaskShapeError 见引擎注册面。
266
+ export {
267
+ DirtyWorktreeError,
268
+ ForkDepthExceededError,
269
+ } from "./execution/types.ts";
270
+
271
+ // 动作层领域内核(@experimental U10 / D6):六 handler 的校验/守卫链/归属判定/
272
+ // 终态映射,产出领域对象,宿主 adapter 负责包装渲染。
273
+ export {
274
+ BG_MESSAGE,
275
+ cancelHandler,
276
+ closeHandler,
277
+ DEFAULT_LIST_LIMIT,
278
+ endedMessageGuard,
279
+ FORK_FROM_DEFAULT_PROMPT,
280
+ forkFromHandler,
281
+ listHandler,
282
+ mapExternalState,
283
+ MAX_LIST_LIMIT,
284
+ messageHandler,
285
+ NOTIFY_CONTRACT,
286
+ recordToListItem,
287
+ startHandler,
288
+ wrapForkFromPrompt,
289
+ type CancelHandlerInput,
290
+ type CancelHandlerResult,
291
+ type CloseHandlerInput,
292
+ type CloseHandlerResult,
293
+ type ForkFromHandlerInput,
294
+ type ForkFromHandlerResult,
295
+ type ListHandlerInput,
296
+ type ListHandlerResult,
297
+ type MessageHandlerInput,
298
+ type MessageHandlerResult,
299
+ type StartHandlerInput,
300
+ type StartHandlerResult,
301
+ } from "./execution/subagent-actions-core.ts";
302
+
303
+ // 进程活性探针(watchdog/孤儿判定共用,agent-ref 契约原语组 U1)。
304
+ export { isProcessAlive } from "./execution/alive-store.ts";
305
+
306
+ // 并发池工厂(U3/U4 / D7):queuePolicy 缺省 priority 保 pi 行为,zsw 消费
307
+ // strict-fifo——策略差异显式化而非双实现。
308
+ export {
309
+ createConcurrencyPool,
310
+ type ConcurrencyPool,
311
+ type CreateConcurrencyPoolOptions,
312
+ type QueuePolicy,
313
+ } from "./execution/concurrency-pool.ts";
314
+
315
+ // 模型引用切分原语(U1 契约面批件):provider/model 引用切分与缺省值(两宿主
316
+ // maxTurns/model 换算同源);实现体内聚 zcode preparer/constants 不挪文件,
317
+ // barrel re-export(§5.3)。
318
+ export {
319
+ DEFAULT_PROVIDER_ID,
320
+ hasApiKey,
321
+ splitZcodeModelRef,
322
+ } from "./execution/engine/engines/zcode/preparer.ts";
323
+ export { ZCODE_FALLBACK_DEFAULT_MODEL } from "./execution/engine/engines/zcode/constants.ts";
324
+
325
+ // ── worktree git 内核(U5 / D5)───────────────────────────────
326
+ // git 语义纯函数单源:保真读(gitRun)、SafeId 校验、dirty 谓词、
327
+ // collectWorktreePatch(统一 add+diff 基线机制,返回结构即 patchIncomplete
328
+ // 留痕载体)、三步容错清理、listWorktreePorcelain(原始输出供宿主 realpath
329
+ // 对账)。锚点缺失/损坏与 add 失败两条降级路径 warn + 留痕(⛔3)。
330
+ //
331
+ // GitRunError 同名双类裁决(u-core-exec-export 交接):worktree-manager.ts 与
332
+ // worktree-git-ops.ts 各有一个 GitRunError(文案同但类独立)——barrel 只导出
333
+ // 本组 worktree-git-ops 版(git 语义新单源);worktree-manager 版不进 barrel,
334
+ // 将来 manager 收缩到 git-ops 内核时随之消除。
335
+ export {
336
+ assertSafeId,
337
+ cleanupWorktree,
338
+ collectWorktreePatch,
339
+ GitRunError,
340
+ gitRun,
341
+ isSafeId,
342
+ isTreeDirty,
343
+ listWorktreePorcelain,
344
+ SAFE_ID_RE,
345
+ type CleanupWorktreeOptions,
346
+ type CollectWorktreePatchOptions,
347
+ type ListWorktreePorcelainOptions,
348
+ type PatchBaselineAnchor,
349
+ type WorktreePatchResult,
350
+ } from "./execution/worktree-git-ops.ts";
351
+
352
+ // 组装层(U2 装配):discoverAgents 发现→宽容解析→去重→码点序(workflow 侧
353
+ // discoverWorkflows 对称面,第三宿主「列 agents」入口)。
354
+ export { discoverAgents } from "./execution/agents-assembly.ts";
136
355
 
137
356
  // ── workflow 编排入口(orchestration)────────────────────────
138
357
  // runWorkflow / abortRun:run 生命周期 free functions(D-12)——orchestration 的
139
- // 最小宿主入口。以下 host-surface 扩面(zsw 回接 U0)出 Barrel:宿主壳组装
140
- // LifecycleDeps 需要亲手构造三个 port 实现与消费细粒度编排函数,深路径消费
358
+ // 最小宿主入口。更细粒度编排(terminateRunningRuns / evictDoneRunsBeyondCap /
359
+ // scheduleTimeBudget / 上限常量)为组合根实际消费面,随 B-2 扩面进 barrel
360
+ // (D3 判定标准首次执行)。host-surface 扩面(zsw 回接 U0)同出 barrel:宿主壳
361
+ // 组装 LifecycleDeps 需要亲手构造三个 port 实现与消费细粒度编排函数,深路径消费
141
362
  // 在 npm 形态不可达(发布面无 `./*` 通配)——宿主触点证据即 zsw 回接设计 D2。
142
363
  export { abortRun, runWorkflow } from "./orchestration/lifecycle.ts";
143
- export type { RunSpec } from "./orchestration/models/run-spec.ts";
144
- export type { LifecycleDeps } from "./orchestration/models/ports.ts";
145
-
146
- // lifecycle 细粒度编排:session 切换/关闭批量终止、done run 内存淘汰(窗口常量
147
- // MAX_RETAINED_DONE_RUNS)、run 级墙钟预算计时器(宿主 rebuildRuntime 重排用)。
148
364
  export {
365
+ terminateRunningRuns,
149
366
  evictDoneRunsBeyondCap,
150
- MAX_RETAINED_DONE_RUNS,
151
367
  scheduleTimeBudget,
152
- terminateRunningRuns,
368
+ MAX_RETAINED_DONE_RUNS,
153
369
  } from "./orchestration/lifecycle.ts";
154
370
 
155
- // launcher 层:runAndWait(阻塞至 done)与 executeNestedWorkflow(嵌套 workflow(),
156
- // 宿主 onWorkflowCall 注入的实现体)——宿主 tool/action 面的直接消费入口。
157
- export { executeNestedWorkflow, runAndWait } from "./orchestration/launcher.ts";
158
- export type { LauncherDeps, WorkflowRunResult } from "./orchestration/launcher.ts";
159
-
160
- // WorkerHost port 的 Infra 实现(worker_threads 启动 worker 脚本)——宿主组装
161
- // LifecycleDeps.workerHost 的默认实现;WorkerHandlers 是 start 的回调 bag 类型。
162
- export { WorkerHostImpl } from "./orchestration/worker-host.ts";
371
+ // recoverCrashedRuns:崩溃恢复四步装配(宿主事件经 hooks 外置,U7 生命周期 / D8)。
372
+ export {
373
+ recoverCrashedRuns,
374
+ type RecoverCrashedRunsHooks,
375
+ type RecoverCrashedRunsResult,
376
+ } from "./orchestration/lifecycle.ts";
163
377
 
164
- // 脚本注册表 Infra 实现(config-loader 之上的 WorkflowScript 实体工厂)——
165
- // launcher registry 依赖的默认实现。
378
+ // launcher 层:runAndWait / executeNestedWorkflow(workflow 域嵌套编排入口)
379
+ // + deps / 结果类型。
380
+ export {
381
+ runAndWait,
382
+ executeNestedWorkflow,
383
+ type LauncherDeps,
384
+ type WorkflowRunResult,
385
+ } from "./orchestration/launcher.ts";
386
+
387
+ // worker-message-pump 内核件(execution 生产域消费,A2a):finalizeRun run 终态
388
+ // 收口 + FinalizeRunOptions 契约、closeOutInFlightCalls 在飞 call 批量清算、
389
+ // makeSerializeFailedResult 序列化失败结果构造、postBudgetUpdate 预算播报、
390
+ // resetRebuildFailureInjectionForTest 重建失败注入复位(测试面)。
391
+ export {
392
+ finalizeRun,
393
+ closeOutInFlightCalls,
394
+ makeSerializeFailedResult,
395
+ postBudgetUpdate,
396
+ resetRebuildFailureInjectionForTest,
397
+ type FinalizeRunOptions,
398
+ } from "./orchestration/worker-message-pump.ts";
399
+
400
+ // workflow 领域模型族:run / call / trace / budget / 状态与规格(壳 store 与
401
+ // interface 渲染层共同消费)。
402
+ export type { RunSpec } from "./orchestration/models/run-spec.ts";
403
+ export type { LifecycleDeps } from "./orchestration/models/ports.ts";
404
+ export type { RunStore } from "./orchestration/models/ports.ts";
405
+ // RunStore / AgentRunner / WorkerHost port 契约类型:宿主自写 Infra 实现(如 zsw
406
+ // 的 RunnerPort 桥接)需要契约面;WorkerHandlers 已随 WorkerHost 注释。
407
+ export type {
408
+ AgentRunner,
409
+ WorkerHandlers,
410
+ WorkerHost,
411
+ } from "./orchestration/models/ports.ts";
412
+ export type { RunState } from "./orchestration/models/run-state.ts";
413
+ export { Trace } from "./orchestration/models/trace.ts";
414
+ export { AgentCall } from "./orchestration/models/agent-call.ts";
415
+ export { Budget } from "./orchestration/models/budget.ts";
416
+ export { WorkflowRun, type WorkflowRunMeta } from "./orchestration/models/workflow-run.ts";
417
+ export type {
418
+ AgentCallOpts,
419
+ AgentResult,
420
+ DoneReason,
421
+ ExecutionTraceNode,
422
+ RunStatus,
423
+ ToolCallEntry,
424
+ WorkerLogEntry,
425
+ } from "./orchestration/models/types.ts";
426
+ // SLUG_MAX_LENGTH 单源(merge 收敛完成):唯一定义在 orchestration/models/types.ts;
427
+ // 原 execution/execute-options-mapper.ts 重复定义已删(改 import 消费,深路径消费者
428
+ // subagent-actions-core 同步切到 models/types 单源)。
429
+ export { SLUG_MAX_LENGTH } from "./orchestration/models/types.ts";
430
+
431
+ // workflow 脚本资产面:registry 契约 + 实现 / 脚本 lint / 文件落盘(save / delete)
432
+ // + skill 路径缓存清理——组合根装配与 workflow 工具面消费。
433
+ export type { WorkflowScriptRegistry } from "./orchestration/models/workflow-script-registry.ts";
166
434
  export { WorkflowScriptRegistryImpl } from "./orchestration/workflow-script-registry-impl.ts";
167
-
435
+ // WorkflowScript 实体与按路径加载工厂(第三宿主零复刻脚本加载,G3/S5)。
436
+ export {
437
+ loadWorkflowScriptByPath,
438
+ WorkflowScript,
439
+ } from "./orchestration/workflow-script-registry-impl.ts";
168
440
  // lintScript:workflow 脚本静态检查(执行前 fail-fast,宿主 list/validate 面消费)。
169
441
  export { lintScript } from "./orchestration/script-lint.ts";
170
442
  export type { LintFinding, LintResult } from "./orchestration/script-lint.ts";
443
+ export { saveWorkflow, deleteWorkflow } from "./orchestration/workflow-files.ts";
444
+ export { clearSkillPathCache } from "./orchestration/skill-discovery.ts";
445
+ export { WorkerHostImpl } from "./orchestration/worker-host.ts";
171
446
 
172
447
  // ── workflow 创作闭环面(orchestration/script-generate + workflow-files,W4)──
173
448
  // generateWorkflowScript:generate 校验管线(五道闸 + @pi-meta round-trip + tmp
174
449
  // 写盘)从 pi-sw 插件层下沉(D-6)——纯函数返回结构化结果(不 throw,pi 的
175
450
  // isError 契约转换由宿主负责),报错文案逐字对齐 pi 现版(CA2 前提)。
176
- // saveWorkflow/deleteWorkflow 首次出 barrel:宿主(zsw)generate→save→delete
177
- // 创作闭环的完整入口;目录经 WorkflowDirOptions 注入(缺省 pi 布局
178
- // DEFAULT_WORKFLOW_TMP_DIR / DEFAULT_WORKFLOW_SAVED_DIR,向后兼容——pi 现深路径
179
- // 调用形态行为不变,改接在 C5)。
451
+ // saveWorkflow/deleteWorkflow(上方已导出)+ 目录经 WorkflowDirOptions 注入
452
+ // (缺省 pi 布局 DEFAULT_WORKFLOW_TMP_DIR / DEFAULT_WORKFLOW_SAVED_DIR,向后兼容
453
+ // ——pi 现深路径调用形态行为不变,改接在 C5)。
180
454
  export { generateWorkflowScript } from "./orchestration/script-generate.ts";
181
455
  export type {
182
456
  GenerateWorkflowScriptOptions,
183
457
  GenerateWorkflowScriptResult,
184
458
  } from "./orchestration/script-generate.ts";
185
- export { deleteWorkflow, saveWorkflow } from "./orchestration/workflow-files.ts";
186
459
  export type { WorkflowDirOptions } from "./orchestration/workflow-files.ts";
187
460
  // 缺省目录常量随面导出:宿主显式注入 pi 缺省布局时引用常量,避免字面硬编码回流。
188
461
  export {
@@ -209,61 +482,92 @@ export type {
209
482
  // FileRunStore:RunStore port 的宿主无关文件实现(D2 设计件)——落盘
210
483
  // <dataRoot>/workflow-state/<runId>.jsonl,zsw 等无 pi session 设施的宿主装配
211
484
  // LifecycleDeps.store 用;pi 壳继续用 session 锚定的 JsonlRunStore。
212
- export { FileRunStore } from "./orchestration/file-run-store.ts";
485
+ // DEFAULT_* 两常量:壳 jsonl-run-store.ts 生产消费(D3 判定进 barrel),
486
+ // u-2c 删 ./* 通配后深路径仅测试侧 vitest alias 可解析,生产消费必须走 barrel。
487
+ export {
488
+ DEFAULT_SAVE_MIN_INTERVAL_MS,
489
+ DEFAULT_STATE_MAX_RUNS,
490
+ FileRunStore,
491
+ } from "./orchestration/file-run-store.ts";
213
492
 
214
- // RunStore / AgentRunner / WorkerHost port 契约类型:宿主自写 Infra 实现
215
- // (如 zsw RunnerPort 桥接)需要契约面;WorkerHandlers 已随 WorkerHost 注释。
216
- export type {
217
- AgentRunner,
218
- RunStore,
219
- WorkerHandlers,
220
- WorkerHost,
221
- } from "./orchestration/models/ports.ts";
493
+ // ── 快照 codec(U8 / D4)──────────────────────────────────────
494
+ // WorkflowRun 落盘快照的单一投影:版本常量沿用 pi "wf-run-v2"(存量逐字节
495
+ // 可读)、live 字段 strip、更高版本跳过(宿主侧 warn 可见性自决)。
496
+ export {
497
+ fromRunSnapshot,
498
+ SNAPSHOT_VERSION,
499
+ toRunSnapshot,
500
+ type RunSnapshot,
501
+ } from "./orchestration/run-snapshot.ts";
222
502
 
223
- // ── zcode 引擎注册面(execution/engine)──────────────────────
224
- // registerZcodeEngine:把 'zcode' 引擎登记进 registry(组合根职责,幂等);
225
- // createZcodeEngine:DI 工厂(测试/宿主注入 deps)。ZcodeEngineDeps 经
226
- // registration.ts 的 re-export 导出(避免与 zcode-engine.ts 双源)。
503
+ // run 投影(U7 / D8):isScriptRunning / runSummary 以 core WorkflowRun 为准的
504
+ // 投影(runSummary 双投影分叉收口)。
227
505
  export {
228
- createZcodeEngine,
229
- registerZcodeEngine,
230
- } from "./execution/engine/engines/zcode/registration.ts";
231
- export type { ZcodeEngineDeps } from "./execution/engine/engines/zcode/registration.ts";
506
+ isScriptRunning,
507
+ runSummary,
508
+ type WorkflowRunSummary,
509
+ } from "./orchestration/workflow-run-summary.ts";
232
510
 
233
- // killAllSpawnedChildren:session 关闭时批量回收 agent 子进程(宿主 shutdown
234
- // 钩子消费;子进程注册表在 session-runner 模块内)。
235
- export { killAllSpawnedChildren } from "./execution/session-runner.ts";
511
+ // ── schema 助手(U9 / D9)─────────────────────────────────────
512
+ // workflow 资产 @pi-meta parameters 的 schema→已知键集、平铺参数检测与
513
+ // 归一化(pi tool-workflow 消费面下沉;宿主白名单退役入口)。
514
+ export {
515
+ argKeysFromMeta,
516
+ findFlattenedArgKeys,
517
+ normalizeArgsByMeta,
518
+ type ArgKeySet,
519
+ type ArgMetaOptions,
520
+ type ArgMetaWarning,
521
+ type NormalizedArgs,
522
+ } from "./orchestration/args-meta.ts";
236
523
 
237
- // ═══════════════════════════════════════════════════════════════════
238
- // sink 下沉收口扩面(docs/design/subagent-core-sink-design.md,2026-08-31)
239
- //
240
- // D2 裁决:本分隔线以下全部为纯新增导出——上方既有导出符号与路径零变更
241
- //(pi 24 处深路径 import 与 zsw vendor sha256 manifest 双不受波及)。
242
- // 按域分组逐名列出(不使用 `export *`,沿用本文件既有纪律使 diff 可审)。
243
- //
244
- // semver 分档:运行时面一组标注 @experimental(一个 minor 周期内允许签名
245
- // 微调,D6);其余各组为常规 semver 稳定面。
246
- // ═══════════════════════════════════════════════════════════════════
524
+ // ── 共享原语(shared/)───────────────────────────────────────
525
+ // agent 展示名归一(渲染层 7 处消费的 SSOT)+ meta 解析 / XML 注入 / 资源发现 /
526
+ // thinking 档位序(THINKING_ORDER 定义源 shared/model-ref,model-resolver 为转发)。
527
+ export { displayAgentName } from "./shared/agent-ref.ts";
528
+ export {
529
+ parseResourceMeta,
530
+ parseResourceMetaDetailed,
531
+ } from "./shared/meta-parser.ts";
532
+ export { THINKING_ORDER } from "./shared/model-ref.ts";
533
+ // 定时器上限(壳 tool-workflow.ts OR-1 消费,D3 判定进 barrel)
534
+ export { MAX_TIMER_DELAY_MS } from "./shared/timer-delay.ts";
535
+ // 资源发现面(W2③):discoverResources——agent .md / workflow .js 的多源统一发现
536
+ // (ADR-031)——多源扫描 + stem last-writer-wins 合并 + realpath 去重。宿主(zsw
537
+ // 回接)经 ScanConfig.hostRoots 注入发现根(source 标签即 ResourceSource 槽位键,
538
+ // 含 project-host 项目级槽);深路径消费在 npm/vendored 发布形态不可达(exports 无
539
+ // 深路径通配),故出 barrel。发现链辅助(C5b):findWorkspaceRoot(project 源根
540
+ // 定位)、getCachedParsed/getCachedFileContent(mtime 缓存读取)——发现链消费方
541
+ // (pi-sw injector 等宿主接线)逐条解析 DiscoveredResource 的 frontmatter/meta
542
+ // 需要它们,深路径同样不可达。
543
+ export {
544
+ discoverResources,
545
+ findWorkspaceRoot,
546
+ getCachedFileContent,
547
+ getCachedParsed,
548
+ } from "./shared/resource-discovery.ts";
549
+ export type {
550
+ DiscoveredResource,
551
+ ResourceKind,
552
+ ResourceSource,
553
+ ScanConfig,
554
+ } from "./shared/resource-discovery.ts";
555
+ export { escapeXml, renderXmlSection } from "./shared/xml-injection.ts";
247
556
 
248
557
  // ── agent-ref 面(契约原语,U1)────────────────────────────────
249
558
  // agent 引用规范化(normalizeRef 含 `..` 段拒绝——G4 声明的唯一行为收紧,
250
- // ⛔2 样本集验证)+ 引用扩展名常量 + 显示名投影 + 报错文案工厂 +
251
- // slug 长度上限 + 进程活性探针(watchdog/孤儿判定共用)。
559
+ // ⛔2 样本集验证)+ 引用扩展名常量 + 报错文案工厂。
252
560
  export {
253
561
  AGENT_REF_EXT,
254
- displayAgentName,
255
562
  invalidAgentRefMessage,
256
563
  normalizeRef,
257
564
  type InvalidAgentRefMessageOptions,
258
565
  WORKFLOW_REF_EXT,
259
566
  } from "./shared/agent-ref.ts";
260
- export { SLUG_MAX_LENGTH } from "./execution/execute-options-mapper.ts";
261
- export { isProcessAlive } from "./execution/alive-store.ts";
262
567
 
263
568
  // ── workflow 契约面(U1)──────────────────────────────────────
264
- // workflow 引用规范化(名/路径二分 + 保留字裁决,knownNames 宿主注入——
265
- // 内置 workflow 名不 core 硬编码)+ WorkflowScript 实体与按路径加载工厂
266
- //(第三宿主零复刻脚本加载,G3/S5)。
569
+ // workflow 引用规范化(名/路径二分 + 保留字裁决,knownNames 宿主注入——内置
570
+ // workflow 名不 core 硬编码)。
267
571
  export {
268
572
  normalizeWorkflowRef,
269
573
  WORKFLOW_REF_RESERVED_NAMES,
@@ -271,169 +575,35 @@ export {
271
575
  type NormalizedWorkflowRef,
272
576
  type WorkflowRefInvalidReason,
273
577
  } from "./shared/agent-ref.ts";
274
- export {
275
- loadWorkflowScriptByPath,
276
- WorkflowScript,
277
- } from "./orchestration/workflow-script-registry-impl.ts";
278
-
279
- // ── 执行预算原语(U3/U4 / D7)─────────────────────────────────
280
- // maxTurns→watchdog 毫秒换算(floor 语义文档化——两宿主预算一致性 S2 的函数级
281
- // 锚点)+ 并发池工厂(queuePolicy 缺省 priority 保 pi 行为,zsw 消费 strict-fifo
282
- // ——策略差异显式化而非双实现)。
283
- export { maxTurnsToWatchdogMs } from "./execution/session-runner.ts";
284
- export {
285
- createConcurrencyPool,
286
- type ConcurrencyPool,
287
- type CreateConcurrencyPoolOptions,
288
- type QueuePolicy,
289
- } from "./execution/concurrency-pool.ts";
290
578
 
291
- // ── 模型引用切分原语(U1 契约面批件)─────────────────────────
292
- // provider/model 引用切分与缺省值(两宿主 maxTurns/model 换算同源);
293
- // 实现体内聚 zcode preparer/constants 不挪文件,barrel re-export(§5.3)。
294
- export {
295
- DEFAULT_PROVIDER_ID,
296
- hasApiKey,
297
- splitZcodeModelRef,
298
- } from "./execution/engine/engines/zcode/preparer.ts";
299
- export { ZCODE_FALLBACK_DEFAULT_MODEL } from "./execution/engine/engines/zcode/constants.ts";
300
-
301
- // ── worktree git 内核(U5 / D5)───────────────────────────────
302
- // git 语义纯函数单源:保真读(gitRun)、SafeId 校验、dirty 谓词、
303
- // collectWorktreePatch(统一 add+diff 基线机制,返回结构即 patchIncomplete
304
- // 留痕载体)、三步容错清理、listWorktreePorcelain(原始输出供宿主 realpath
305
- // 对账)。锚点缺失/损坏与 add 失败两条降级路径 warn + 留痕(⛔3)。
306
- //
307
- // GitRunError 同名双类裁决(u-core-exec-export 交接):worktree-manager.ts 与
308
- // worktree-git-ops.ts 各有一个 GitRunError(文案同但类独立)——barrel 只导出
309
- // 本组 worktree-git-ops 版(git 语义新单源);worktree-manager 版不进 barrel,
310
- // 将来 manager 收缩到 git-ops 内核时随之消除。
311
- export {
312
- assertSafeId,
313
- cleanupWorktree,
314
- collectWorktreePatch,
315
- GitRunError,
316
- gitRun,
317
- isSafeId,
318
- isTreeDirty,
319
- listWorktreePorcelain,
320
- SAFE_ID_RE,
321
- type CleanupWorktreeOptions,
322
- type CollectWorktreePatchOptions,
323
- type ListWorktreePorcelainOptions,
324
- type PatchBaselineAnchor,
325
- type WorktreePatchResult,
326
- } from "./execution/worktree-git-ops.ts";
327
-
328
- // ── 运行时面(@experimental,U10 / D6)────────────────────────
329
- // SubagentService 构造依赖参数注入(modelService 等,无全局查找)+
330
- // record 状态查询面(RecordStore 按状态枚举/按 id;lookupRecordAnyState
331
- // 全态查询)+ record 落盘 entry 契约 + agent-registry 执行消费面
332
- //(loadByPath 直接加载)+ 动作层领域内核(六 handler 的校验/守卫链/
333
- // 归属判定/终态映射,产出领域对象,宿主 adapter 负责包装渲染)+
334
- // 错误类型族(instanceof 分流用)。
335
- //
336
- // @experimental:本组全部导出在一个 minor 周期内允许签名微调,稳定后转
337
- // 常规 semver 承诺(D6 语义,各源文件符号注释同款声明)。
338
- //
339
- // SubagentServiceSessionInit 刻意不出 barrel:pi session_start 注入专属
340
- //(引用未导出的 PiLike 签面),第三宿主不经该流程。
341
- //
342
- // ModelConfigService:SubagentServiceInit.modelService 的构造依赖(MF-4:jsdoc
343
- // 示例 `new ModelConfigService({cwd, agentDir})` 的类此前不在导出面——第三宿主
344
- // 按文档用法不可构造)。getModelConfigService 同为 SubagentService 类 jsdoc
345
- // session_start 示例的引用符号,随之可达;setModelConfigService 是 pi 壳
346
- // session_start 专属的进程单例写入点,第三宿主参数注入构造不需要,刻意不出 barrel。
347
- export {
348
- getModelConfigService,
349
- ModelConfigService,
350
- type ModelConfigServiceInit,
351
- } from "./execution/model-config-service.ts";
352
- export {
353
- createSubagentService,
354
- SubagentService,
355
- type SubagentServiceInit,
356
- } from "./execution/subagent-service.ts";
357
- export {
358
- RecordStore,
359
- type ChangeListener,
360
- type RecordStorePi,
361
- type StatusFilter,
362
- } from "./execution/record-store.ts";
363
- export {
364
- SUBAGENT_RECORD_CUSTOM_TYPE,
365
- toSubagentRecordEntry,
366
- type SubagentRecordEntryData,
367
- } from "./execution/record-entry.ts";
368
- export { AgentRegistry } from "./execution/agent-registry.ts";
369
- // 错误类型族(error-recovery.ts 计划路径实测不存在,实测散布于下列源文件):
370
- // resurrect/fork-depth/dirty-worktree 为动作层守卫抛出点(types.ts),
371
- // GitRunError 见 worktree 内核组裁决。
372
- export {
373
- DirtyWorktreeError,
374
- ForkDepthExceededError,
375
- ResurrectDeniedError,
376
- } from "./execution/types.ts";
579
+ // ── 注入渲染面(shared/injection-render,W3)───────────────────
580
+ // 三段 XML(<available_subagents>/<available_workflows>/<available_provider_models>)
581
+ // format 纯函数 + Entry 接口从 pi-sw 插件层下沉(D-3):ModelEntry 并集口径
582
+ // (除 id/name 外全字段 optional,红线 5 守卫不抛不渲垃圾)、分段条目预算
583
+ // (码点序排 + 截尾 + 宿主注入兜底指引;models 段无预算永不截,红线 7)、
584
+ // guide 文案宿主注入(core 不内嵌平台文案)。summarizeDescription 随
585
+ // WorkflowEntry 链导出(zsw 侧同口径消费)。
377
586
  export {
378
- BG_MESSAGE,
379
- cancelHandler,
380
- closeHandler,
381
- DEFAULT_LIST_LIMIT,
382
- endedMessageGuard,
383
- FORK_FROM_DEFAULT_PROMPT,
384
- forkFromHandler,
385
- listHandler,
386
- mapExternalState,
387
- MAX_LIST_LIMIT,
388
- messageHandler,
389
- NOTIFY_CONTRACT,
390
- recordToListItem,
391
- startHandler,
392
- wrapForkFromPrompt,
393
- type CancelHandlerInput,
394
- type CancelHandlerResult,
395
- type CloseHandlerInput,
396
- type CloseHandlerResult,
397
- type ForkFromHandlerInput,
398
- type ForkFromHandlerResult,
399
- type ListHandlerInput,
400
- type ListHandlerResult,
401
- type MessageHandlerInput,
402
- type MessageHandlerResult,
403
- type StartHandlerInput,
404
- type StartHandlerResult,
405
- } from "./execution/subagent-actions-core.ts";
406
- // 运行时面类型闭包(先例同 ModelInfo/SubagentStream:签名直接引用的具名类型
407
- // 显式导出,免宿主深路径兜圈;二阶成员类型不强制——结构化类型下实例可用)。
587
+ formatAgentList,
588
+ formatModelList,
589
+ formatWorkflowList,
590
+ sortByCodepoint,
591
+ summarizeDescription,
592
+ } from "./shared/injection-render.ts";
408
593
  export type {
409
- BgResponse,
410
- CancelResponse,
411
- CloseResponse,
412
- ExecutionRecord,
413
- ExecutionStatus,
414
- ExternalState,
415
- ForkFromResponse,
416
- ListResponse,
417
- MessageResponse,
418
- SubagentListItem,
419
- SubagentRecord,
420
- } from "./execution/types.ts";
421
-
422
- // ── 快照 codec(U8 / D4)──────────────────────────────────────
423
- // WorkflowRun ↔ 落盘快照的单一投影:版本常量沿用 pi "wf-run-v2"(存量逐字节
424
- // 可读)、live 字段 strip、更高版本跳过(宿主侧 warn 可见性自决)。
425
- export {
426
- fromRunSnapshot,
427
- SNAPSHOT_VERSION,
428
- toRunSnapshot,
429
- type RunSnapshot,
430
- } from "./orchestration/run-snapshot.ts";
594
+ AgentEntry,
595
+ ListFormatOptions,
596
+ ModelEntry,
597
+ ModelListFormatOptions,
598
+ ModelReasoningInfo,
599
+ WorkflowEntry,
600
+ } from "./shared/injection-render.ts";
431
601
 
432
602
  // ── 原语(U6a)────────────────────────────────────────────────
433
603
  // atomic-write:tmp+rename 原子写单一实现(统一 tmp 命名 `.tmp.<pid>.<seq>-<rand>`、
434
604
  // 失败清理、崩溃残留扫描/清理入口)——core 内部全部写点已收敛于此(U6b);
435
605
  // sync/async 两档耐久语义见模块头。bounded-serialize:预算内 JSON 序列化
436
- //(自 pi-sw helpers 平移,输出逐字节一致)。
606
+ // (自 pi-sw helpers 平移,输出逐字节一致)。
437
607
  export {
438
608
  atomicTmpPathFor,
439
609
  cleanupStaleTmpFiles,
@@ -448,47 +618,3 @@ export {
448
618
  type CleanupStaleTmpResult,
449
619
  } from "./shared/atomic-write.ts";
450
620
  export { boundedPrettySerialize } from "./shared/bounded-serialize.ts";
451
-
452
- // ── 组装层(U2 装配 + U7 生命周期 / D8)───────────────────────
453
- // discoverAgents:发现→宽容解析→去重→码点序(workflow 侧 discoverWorkflows
454
- // 对称面,第三宿主「列 agents」入口);recoverCrashedRuns:崩溃恢复四步装配
455
- //(宿主事件经 hooks 外置);runSummary/isScriptRunning:以 core WorkflowRun
456
- // 为准的投影(runSummary 双投影分叉收口);WorkflowRun 聚合根随闭包出 barrel。
457
- export { discoverAgents } from "./execution/agents-assembly.ts";
458
- export {
459
- recoverCrashedRuns,
460
- type RecoverCrashedRunsHooks,
461
- type RecoverCrashedRunsResult,
462
- } from "./orchestration/lifecycle.ts";
463
- export {
464
- isScriptRunning,
465
- runSummary,
466
- type WorkflowRunSummary,
467
- } from "./orchestration/workflow-run-summary.ts";
468
- export {
469
- WorkflowRun,
470
- type WorkflowRunMeta,
471
- } from "./orchestration/models/workflow-run.ts";
472
- export type { DoneReason, RunStatus } from "./orchestration/models/types.ts";
473
-
474
- // ── schema 助手(U9 / D9)─────────────────────────────────────
475
- // workflow 资产 @pi-meta parameters 的 schema→已知键集、平铺参数检测与
476
- // 归一化(pi tool-workflow 消费面下沉;宿主白名单退役入口)。
477
- export {
478
- argKeysFromMeta,
479
- findFlattenedArgKeys,
480
- normalizeArgsByMeta,
481
- type ArgKeySet,
482
- type ArgMetaOptions,
483
- type ArgMetaWarning,
484
- type NormalizedArgs,
485
- } from "./orchestration/args-meta.ts";
486
-
487
- // ── 解析面(U2 / D3)──────────────────────────────────────────
488
- // parseAgentProfile:宽容解析(无 frontmatter 不拒、name 缺省 stem、返回
489
- // body 与执行字段全量)——执行消费面单点;与严格注入投影(parseResourceMeta)
490
- // 双轨分离的执行侧统一入口。
491
- export {
492
- parseAgentProfile,
493
- type AgentProfile,
494
- } from "./execution/agent-registry.ts";