@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
@@ -1,387 +0,0 @@
1
- // preparer-appserver.test.ts —— [R4] D7 全量语义测试:常驻 HOME 锚定不变量 /
2
- // allProviders 引导 / 凭据内容 hash 刷新 / 目录锁(O_EXCL 互斥、pid 活即持有、心跳
3
- // 不参与否决、双接管者竞争闭环、派生后缀)/ pidfile 孤儿自愈三重判据(D6③)。
4
- // 进程形态用真实短命 node 子进程(活 pid / 死 pid / 命令行形态匹配全真实验证,
5
- // macOS 本机 ps 可用——CI 同构)。
6
- // 文件名系 appserver-home.ts 自 preparer.ts 拆分前遗留——被测对象(import 面)为
7
- // appserver-home.ts,与 preparer.ts 现行 spawn 池语义无关。
8
-
9
- import { spawn, type ChildProcess } from "node:child_process";
10
- import * as fs from "node:fs";
11
- import * as os from "node:os";
12
- import * as path from "node:path";
13
-
14
- import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
15
-
16
- import { resolveJournalPath, resolvePoolDir } from "../../../paths.ts";
17
- import {
18
- ZCODE_APPSERVER_LOCKFILE_NAME,
19
- ZCODE_APPSERVER_PIDFILE_NAME,
20
- ZCODE_APPSERVER_POOL_KEY,
21
- ZCODE_POOL_CONFIG_SUFFIX,
22
- ZCODE_POOL_DB_RELATIVE_PATH,
23
- } from "../constants.ts";
24
- import {
25
- acquireAppServerHome,
26
- acquireAppServerHomeLock,
27
- bootstrapAppServerConfig,
28
- hashPoolConfigProviders,
29
- hashProviderRegistry,
30
- isPidAlive,
31
- isLockHeldByUs,
32
- probePidLstart,
33
- reapOrphanAppServer,
34
- writeAppServerPidFile,
35
- } from "../appserver-home.ts";
36
-
37
- const PROVIDER_A = "prov-a";
38
- const PROVIDER_B = "prov-b";
39
-
40
- let tmpRoot: string;
41
- let dataDir: string;
42
- let v2Path: string;
43
- /** 每用例启动的活子进程(afterAll 统一收割防泄漏)。 */
44
- const liveChildren: ChildProcess[] = [];
45
-
46
- function writeJson(p: string, v: unknown): void {
47
- fs.mkdirSync(path.dirname(p), { recursive: true });
48
- fs.writeFileSync(p, JSON.stringify(v, null, 2));
49
- }
50
-
51
- function baseV2(): Record<string, unknown> {
52
- return {
53
- provider: {
54
- [PROVIDER_A]: { options: { apiKey: "key-a", baseURL: "https://a.example" }, models: { m1: {} } },
55
- [PROVIDER_B]: { options: { apiKey: "key-b" }, models: { m2: {} } },
56
- "no-key": { options: {}, models: { m3: {} } },
57
- },
58
- };
59
- }
60
-
61
- /** 活着的真实子进程(挂 30s——pid 活性/锁判定用)。 */
62
- function liveChild(): ChildProcess {
63
- const child = spawn(process.execPath, ["-e", "setTimeout(() => {}, 30000)"], { stdio: "ignore" });
64
- liveChildren.push(child);
65
- return child;
66
- }
67
-
68
- /** 命令行含 app-server 形态的活子进程(三重判据全过分支用)。 */
69
- function appServerLikeChild(): ChildProcess {
70
- const child = spawn(
71
- process.execPath,
72
- ["-e", "/*app-server*/ setTimeout(() => {}, 30000)"],
73
- { stdio: "ignore" },
74
- );
75
- liveChildren.push(child);
76
- return child;
77
- }
78
-
79
- /** 已退出的子进程 pid(等退出完成——死 pid 判定用)。 */
80
- async function deadPid(): Promise<number> {
81
- const child = spawn(process.execPath, ["-e", "process.exit(0)"], { stdio: "ignore" });
82
- const code = await new Promise<number | null>((resolve) => {
83
- child.once("exit", (c) => resolve(c));
84
- child.once("error", () => resolve(-1));
85
- });
86
- expect(code).toBe(0);
87
- return child.pid ?? -1;
88
- }
89
-
90
- function writeLock(dir: string, pid: number, opts: { mtime?: Date } = {}): string {
91
- fs.mkdirSync(dir, { recursive: true });
92
- const lockPath = path.join(dir, ZCODE_APPSERVER_LOCKFILE_NAME);
93
- fs.writeFileSync(lockPath, JSON.stringify({ pid, acquiredAt: Date.now() }));
94
- if (opts.mtime !== undefined) fs.utimesSync(lockPath, opts.mtime, opts.mtime);
95
- return lockPath;
96
- }
97
-
98
- function readJson(p: string): Record<string, unknown> {
99
- return JSON.parse(fs.readFileSync(p, "utf8")) as Record<string, unknown>;
100
- }
101
-
102
- beforeEach(() => {
103
- tmpRoot = fs.mkdtempSync(path.join(os.tmpdir(), "zcode-prep-appserver-"));
104
- dataDir = path.join(tmpRoot, "data");
105
- v2Path = path.join(tmpRoot, "v2.json");
106
- writeJson(v2Path, baseV2());
107
- });
108
-
109
- afterEach(() => {
110
- for (const child of liveChildren.splice(0)) {
111
- try {
112
- child.kill("SIGKILL");
113
- } catch {
114
- // 已退出——无妨
115
- }
116
- }
117
- fs.rmSync(tmpRoot, { recursive: true, force: true });
118
- });
119
-
120
- // ============================================================
121
- // 锚定不变量与 allProviders 引导(D7①)
122
- // ============================================================
123
-
124
- describe("常驻 HOME 锚定不变量 + allProviders 引导", () => {
125
- it("poolDir == HOME == db 所在目录:HOME=resolvePoolDir(...,'home-appserver'),dbPath 相对锚 HOME,journal 同落该池", async () => {
126
- const home = await acquireAppServerHome({ engineDataDir: dataDir, modelRef: `${PROVIDER_A}/m1`, sources: { v2ConfigPath: v2Path } });
127
- expect(home.poolKey).toBe(ZCODE_APPSERVER_POOL_KEY);
128
- const poolDir = resolvePoolDir(dataDir, "zcode", ZCODE_APPSERVER_POOL_KEY);
129
- expect(home.homeDir).toBe(poolDir);
130
- // db 锚定:dbPath 相对路径 join 池目录后即 SQLite 落点
131
- expect(path.join(home.homeDir, ZCODE_POOL_DB_RELATIVE_PATH)).toBe(
132
- path.join(poolDir, ".zcode", "cli", "db", "db.sqlite"),
133
- );
134
- // journal 同池(record id 文件名——任务间无冲突)
135
- expect(resolveJournalPath(dataDir, "zcode", home.poolKey, "bg-1")).toBe(
136
- path.join(poolDir, "journal-bg-1.jsonl"),
137
- );
138
- // 锁文件落 HOME 内
139
- expect(home.lockPath).toBe(path.join(poolDir, ZCODE_APPSERVER_LOCKFILE_NAME));
140
- expect(fs.existsSync(home.lockPath)).toBe(true);
141
- });
142
-
143
- it("config 写入全部带 apiKey 的 provider(无 apiKey 条目不写);无 plugins 块;model.main 落任务模型", async () => {
144
- const home = await acquireAppServerHome({ engineDataDir: dataDir, modelRef: `${PROVIDER_B}/m2`, sources: { v2ConfigPath: v2Path } });
145
- expect(home.wroteConfig).toBe(true);
146
- expect(home.providerIds.sort()).toEqual([PROVIDER_A, PROVIDER_B]);
147
- const configPath = path.join(home.homeDir, ...ZCODE_POOL_CONFIG_SUFFIX);
148
- const written = readJson(configPath);
149
- const provider = written["provider"] as Record<string, unknown>;
150
- expect(Object.keys(provider).sort()).toEqual([PROVIDER_A, PROVIDER_B]);
151
- expect(written["model"]).toEqual({ main: `${PROVIDER_B}/m2` });
152
- expect("plugins" in written).toBe(false);
153
- });
154
-
155
- it("二次获取(同内容源)不重写 config(内容 hash 命中——mtime 免重写的常驻形态等价物)", async () => {
156
- const first = await acquireAppServerHome({ engineDataDir: dataDir, modelRef: `${PROVIDER_A}/m1`, sources: { v2ConfigPath: v2Path } });
157
- // 换模型(model.main 变化)+ 内容不变:hash 只覆盖 provider 段——不重写
158
- fs.utimesSync(v2Path, new Date(), new Date());
159
- const configPath = path.join(first.homeDir, ...ZCODE_POOL_CONFIG_SUFFIX);
160
- const before = fs.statSync(configPath).mtimeMs;
161
- await new Promise((r) => setTimeout(r, 10));
162
- const second = await bootstrapAppServerConfig({ homeDir: first.homeDir, modelRef: `${PROVIDER_B}/m2`, sources: { v2ConfigPath: v2Path } });
163
- expect(second.wroteConfig).toBe(false);
164
- expect(fs.statSync(configPath).mtimeMs).toBe(before);
165
- });
166
-
167
- it("凭据变更(provider 内容变化)→ 内容 hash 不一致 → 重写", async () => {
168
- const first = await acquireAppServerHome({ engineDataDir: dataDir, modelRef: `${PROVIDER_A}/m1`, sources: { v2ConfigPath: v2Path } });
169
- const configPath = path.join(first.homeDir, ...ZCODE_POOL_CONFIG_SUFFIX);
170
- // hash 单点:池内现状 hash === 引导 hash
171
- expect(hashPoolConfigProviders(configPath)).toBe(first.providerHash);
172
- // 变更 apiKey
173
- const mutated = baseV2() as { provider: Record<string, { options: { apiKey: string } }> };
174
- mutated.provider[PROVIDER_A]!.options.apiKey = "key-a-v2";
175
- writeJson(v2Path, mutated);
176
- const second = await bootstrapAppServerConfig({ homeDir: first.homeDir, modelRef: `${PROVIDER_A}/m1`, sources: { v2ConfigPath: v2Path } });
177
- expect(second.wroteConfig).toBe(true);
178
- expect(hashPoolConfigProviders(configPath)).toBe(second.providerHash);
179
- const written = readJson(configPath)["provider"] as Record<string, { options: { apiKey: string } }>;
180
- expect(written[PROVIDER_A]!.options.apiKey).toBe("key-a-v2");
181
- });
182
-
183
- it("池内 config 损坏 → hash 判 undefined → 恒重写(torn write 防线)", async () => {
184
- const first = await acquireAppServerHome({ engineDataDir: dataDir, modelRef: `${PROVIDER_A}/m1`, sources: { v2ConfigPath: v2Path } });
185
- const configPath = path.join(first.homeDir, ...ZCODE_POOL_CONFIG_SUFFIX);
186
- fs.writeFileSync(configPath, "{torn", "utf8");
187
- expect(hashPoolConfigProviders(configPath)).toBeUndefined();
188
- const second = await bootstrapAppServerConfig({ homeDir: first.homeDir, modelRef: `${PROVIDER_A}/m1`, sources: { v2ConfigPath: v2Path } });
189
- expect(second.wroteConfig).toBe(true);
190
- });
191
-
192
- it("provider 全无 apiKey → 引导报 engine_credential_missing", async () => {
193
- writeJson(v2Path, { provider: { [PROVIDER_A]: { options: {} } } });
194
- await expect(
195
- acquireAppServerHome({ engineDataDir: dataDir, modelRef: `${PROVIDER_A}/m1`, sources: { v2ConfigPath: v2Path } }),
196
- ).rejects.toThrow(/engine_credential_missing/);
197
- });
198
-
199
- it("hashProviderRegistry:provider 键序变化不产生假差异;内容变化必差异", () => {
200
- const a = new Map([[PROVIDER_A, { options: { apiKey: "k" } }], [PROVIDER_B, { options: { apiKey: "k2" } }]]);
201
- const reordered = new Map([[PROVIDER_B, { options: { apiKey: "k2" } }], [PROVIDER_A, { options: { apiKey: "k" } }]]);
202
- expect(hashProviderRegistry(a)).toBe(hashProviderRegistry(reordered));
203
- const changed = new Map([[PROVIDER_A, { options: { apiKey: "k" } }], [PROVIDER_B, { options: { apiKey: "k3" } }]]);
204
- expect(hashProviderRegistry(a)).not.toBe(hashProviderRegistry(changed));
205
- });
206
- });
207
-
208
- // ============================================================
209
- // 目录锁(D7 所有权隔离)
210
- // ============================================================
211
-
212
- describe("目录锁(O_EXCL / pid 活即持有 / 接管 / 派生)", () => {
213
- it("空目录 → O_EXCL 建锁获得固定名 HOME,lockfile.pid=本进程", () => {
214
- const lock = acquireAppServerHomeLock(dataDir);
215
- expect(lock.poolKey).toBe(ZCODE_APPSERVER_POOL_KEY);
216
- expect(lock.tookOver).toBe(false);
217
- expect(readJson(lock.lockPath)).toMatchObject({ pid: process.pid });
218
- expect(isLockHeldByUs(lock.lockPath)).toBe(true);
219
- });
220
-
221
- it("锁被活宿主持有 → 派生 home-appserver-2,不碰他人锁/pidfile", () => {
222
- const holder = liveChild();
223
- const base = resolvePoolDir(dataDir, "zcode", ZCODE_APPSERVER_POOL_KEY);
224
- writeLock(base, holder.pid!);
225
- // 他人 pidfile(D6③ 时序:活宿主持有时派生方不触碰)
226
- const pidfile = path.join(base, ZCODE_APPSERVER_PIDFILE_NAME);
227
- fs.writeFileSync(pidfile, JSON.stringify({ pid: holder.pid, lstart: "whatever" }));
228
-
229
- const lock = acquireAppServerHomeLock(dataDir);
230
- expect(lock.poolKey).toBe(`${ZCODE_APPSERVER_POOL_KEY}-2`);
231
- expect(lock.homeDir).not.toBe(base);
232
- // 他人锁原样(pid 未被改写)
233
- expect(readJson(path.join(base, ZCODE_APPSERVER_LOCKFILE_NAME))).toMatchObject({ pid: holder.pid });
234
- // 他人 pidfile 原样
235
- expect(fs.existsSync(pidfile)).toBe(true);
236
- });
237
-
238
- it("pid 活即持有:心跳 mtime 过期不参与否决(古老 mtime 仍判活 → 派生)", () => {
239
- const holder = liveChild();
240
- const base = resolvePoolDir(dataDir, "zcode", ZCODE_APPSERVER_POOL_KEY);
241
- const ancient = new Date(Date.now() - 3 * 60 * 60 * 1000);
242
- writeLock(base, holder.pid!, { mtime: ancient });
243
- const lock = acquireAppServerHomeLock(dataDir);
244
- expect(lock.poolKey).toBe(`${ZCODE_APPSERVER_POOL_KEY}-2`); // 未被偷锁
245
- });
246
-
247
- it("持锁宿主已死 → 接管:删旧锁 + O_EXCL 重建(lockfile.pid=本进程,HOME 用固定名)", async () => {
248
- const dead = await deadPid();
249
- expect(isPidAlive(dead)).toBe(false);
250
- const base = resolvePoolDir(dataDir, "zcode", ZCODE_APPSERVER_POOL_KEY);
251
- writeLock(base, dead);
252
- const lock = acquireAppServerHomeLock(dataDir);
253
- expect(lock.poolKey).toBe(ZCODE_APPSERVER_POOL_KEY); // 接管固定名 HOME
254
- expect(lock.tookOver).toBe(true);
255
- expect(readJson(lock.lockPath)).toMatchObject({ pid: process.pid });
256
- });
257
-
258
- it("双接管者竞争闭环:接管 unlink 后他方先行建锁(活 pid)→ 本方 O_EXCL 失败重走循环 → 派生", async () => {
259
- const dead = await deadPid();
260
- const base = resolvePoolDir(dataDir, "zcode", ZCODE_APPSERVER_POOL_KEY);
261
- writeLock(base, dead);
262
- const rival = liveChild();
263
- const lock = acquireAppServerHomeLock(dataDir, {
264
- hooks: {
265
- // 竞争窗口注入:本方删旧锁后、O_EXCL 前,他方抢先以活 pid 建锁
266
- afterTakeoverUnlink: (lockPath) => {
267
- fs.writeFileSync(lockPath, JSON.stringify({ pid: rival.pid, acquiredAt: Date.now() }));
268
- },
269
- },
270
- });
271
- // 本方 O_EXCL 失败 → 重读锁 → 活 pid(rival)→ 派生 -2;且 rival 的锁未被覆盖
272
- expect(lock.poolKey).toBe(`${ZCODE_APPSERVER_POOL_KEY}-2`);
273
- expect(readJson(path.join(base, ZCODE_APPSERVER_LOCKFILE_NAME))).toMatchObject({ pid: rival.pid });
274
- });
275
-
276
- it("锁文件损坏(非 JSON)→ 按无主接管重建", () => {
277
- const base = resolvePoolDir(dataDir, "zcode", ZCODE_APPSERVER_POOL_KEY);
278
- fs.mkdirSync(base, { recursive: true });
279
- fs.writeFileSync(path.join(base, ZCODE_APPSERVER_LOCKFILE_NAME), "not json");
280
- const lock = acquireAppServerHomeLock(dataDir);
281
- expect(lock.poolKey).toBe(ZCODE_APPSERVER_POOL_KEY);
282
- expect(lock.tookOver).toBe(true);
283
- });
284
-
285
- it("acquireAppServerHome 组合:接管路径触发 pidfile 孤儿回收,非接管路径不触发", async () => {
286
- // 非接管(空目录):orphanReap 恒 not-applicable
287
- const fresh = await acquireAppServerHome({ engineDataDir: dataDir, modelRef: `${PROVIDER_A}/m1`, sources: { v2ConfigPath: v2Path } });
288
- expect(fresh.orphanReap).toBe("not-applicable");
289
- // 接管(死宿主锁 + 无 pidfile):回收执行(no-pidfile 分支)
290
- const dead = await deadPid();
291
- writeLock(resolvePoolDir(dataDir, "zcode", ZCODE_APPSERVER_POOL_KEY), dead);
292
- // 锁被本进程测试进程重新持有前需先释放(acquire 会接管同目录——直接再跑组合入口)
293
- const took = await acquireAppServerHome({ engineDataDir: dataDir, modelRef: `${PROVIDER_A}/m1`, sources: { v2ConfigPath: v2Path } });
294
- expect(took.tookOver).toBe(true);
295
- expect(["no-pidfile", "pid-dead", "criteria-mismatch", "reaped"]).toContain(took.orphanReap);
296
- });
297
- });
298
-
299
- // ============================================================
300
- // pidfile 孤儿自愈三重判据(D6③)
301
- // ============================================================
302
-
303
- describe("pidfile 孤儿自愈(三重判据)", () => {
304
- it("三判据全过(pid 活 + lstart 一致 + 命令行含 app-server)→ 回收(SIGTERM)+ pidfile 清理", async () => {
305
- const homeDir = resolvePoolDir(dataDir, "zcode", ZCODE_APPSERVER_POOL_KEY);
306
- fs.mkdirSync(homeDir, { recursive: true });
307
- const orphan = appServerLikeChild();
308
- await writeAppServerPidFile(homeDir, orphan.pid!);
309
- const status = await reapOrphanAppServer(homeDir, { graceMs: 500 });
310
- expect(status).toBe("reaped");
311
- expect(fs.existsSync(path.join(homeDir, ZCODE_APPSERVER_PIDFILE_NAME))).toBe(false);
312
- // 回收生效:进程在 grace 内死亡(SIGTERM 对 node 默认终止)
313
- await vi.waitFor(() => expect(isPidAlive(orphan.pid!)).toBe(false), { timeout: 3_000 });
314
- });
315
-
316
- it("时间戳不一致(pid 活但 lstart 不符——pid 复用形态)→ 不杀,清陈旧 pidfile", async () => {
317
- const homeDir = resolvePoolDir(dataDir, "zcode", ZCODE_APPSERVER_POOL_KEY);
318
- fs.mkdirSync(homeDir, { recursive: true });
319
- const victim = appServerLikeChild();
320
- fs.writeFileSync(
321
- path.join(homeDir, ZCODE_APPSERVER_PIDFILE_NAME),
322
- JSON.stringify({ pid: victim.pid, lstart: "Mon Jan 1 00:00:00 2020", startedAt: 1 }),
323
- );
324
- const status = await reapOrphanAppServer(homeDir);
325
- expect(status).toBe("criteria-mismatch");
326
- expect(isPidAlive(victim.pid!)).toBe(true); // 不误杀
327
- expect(fs.existsSync(path.join(homeDir, ZCODE_APPSERVER_PIDFILE_NAME))).toBe(false);
328
- });
329
-
330
- it("命令行不匹配 app-server 形态(wrapper 假阴性)→ 不杀,清陈旧 pidfile", async () => {
331
- const homeDir = resolvePoolDir(dataDir, "zcode", ZCODE_APPSERVER_POOL_KEY);
332
- fs.mkdirSync(homeDir, { recursive: true });
333
- const victim = liveChild(); // 普通 node -e setTimeout——无 app-server 字样
334
- const lstart = await probePidLstart(victim.pid!);
335
- expect(lstart).toBeDefined();
336
- fs.writeFileSync(
337
- path.join(homeDir, ZCODE_APPSERVER_PIDFILE_NAME),
338
- JSON.stringify({ pid: victim.pid, lstart, startedAt: Date.now() }),
339
- );
340
- const status = await reapOrphanAppServer(homeDir);
341
- expect(status).toBe("criteria-mismatch");
342
- expect(isPidAlive(victim.pid!)).toBe(true);
343
- });
344
-
345
- it("pid 已死(宿主崩溃残留)→ 不杀任何进程,清陈旧 pidfile", async () => {
346
- const homeDir = resolvePoolDir(dataDir, "zcode", ZCODE_APPSERVER_POOL_KEY);
347
- fs.mkdirSync(homeDir, { recursive: true });
348
- const dead = await deadPid();
349
- fs.writeFileSync(
350
- path.join(homeDir, ZCODE_APPSERVER_PIDFILE_NAME),
351
- JSON.stringify({ pid: dead, lstart: "x", startedAt: 1 }),
352
- );
353
- expect(await reapOrphanAppServer(homeDir)).toBe("pid-dead");
354
- expect(fs.existsSync(path.join(homeDir, ZCODE_APPSERVER_PIDFILE_NAME))).toBe(false);
355
- });
356
-
357
- it("无 pidfile → no-op", async () => {
358
- const homeDir = resolvePoolDir(dataDir, "zcode", ZCODE_APPSERVER_POOL_KEY);
359
- fs.mkdirSync(homeDir, { recursive: true });
360
- expect(await reapOrphanAppServer(homeDir)).toBe("no-pidfile");
361
- });
362
-
363
- it("writeAppServerPidFile 记录真实 ps lstart(三重判据数据源自洽)", async () => {
364
- const homeDir = resolvePoolDir(dataDir, "zcode", ZCODE_APPSERVER_POOL_KEY);
365
- fs.mkdirSync(homeDir, { recursive: true });
366
- const child = appServerLikeChild();
367
- await writeAppServerPidFile(homeDir, child.pid!);
368
- const pidfile = readJson(path.join(homeDir, ZCODE_APPSERVER_PIDFILE_NAME));
369
- expect(pidfile["pid"]).toBe(child.pid);
370
- const recorded = pidfile["lstart"];
371
- expect(typeof recorded).toBe("string");
372
- expect(recorded).toBe(await probePidLstart(child.pid!));
373
- });
374
- });
375
-
376
- // ============================================================
377
- // pid 活性探测边界
378
- // ============================================================
379
-
380
- describe("isPidAlive 边界", () => {
381
- it("非法 pid / pid 0 / 负值 → 恒死", () => {
382
- expect(isPidAlive(0)).toBe(false);
383
- expect(isPidAlive(-1)).toBe(false);
384
- expect(isPidAlive(Number.NaN)).toBe(false);
385
- expect(isPidAlive(1.5)).toBe(false);
386
- });
387
- });