@nhtio/adk 1.20260912.0 → 1.20260921.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 (463) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/artifact_methods-Cg0go7Q4.mjs +1 -0
  3. package/artifact_methods-SKgM322C.js +1 -0
  4. package/batteries/artifacts/ecmascript.cjs +1 -1
  5. package/batteries/artifacts/ecmascript.mjs +1 -1
  6. package/batteries/artifacts/toon.cjs +1 -1
  7. package/batteries/artifacts/toon.mjs +1 -1
  8. package/batteries/artifacts/xml.cjs +1 -1
  9. package/batteries/artifacts/xml.mjs +1 -1
  10. package/batteries/artifacts/yaml.cjs +1 -1
  11. package/batteries/artifacts/yaml.mjs +1 -1
  12. package/batteries/artifacts.cjs +4 -4
  13. package/batteries/artifacts.mjs +4 -4
  14. package/batteries/dev-tools/forge.cjs +3 -3
  15. package/batteries/dev-tools/forge.mjs +3 -3
  16. package/batteries/dev-tools.cjs +2 -2
  17. package/batteries/dev-tools.mjs +2 -2
  18. package/batteries/encoding.cjs +7 -7
  19. package/batteries/encoding.mjs +7 -7
  20. package/batteries/generation/gemini/adapter.cjs +1 -1
  21. package/batteries/generation/gemini/adapter.mjs +1 -1
  22. package/batteries/generation/local_diffusion/adapter.cjs +2 -2
  23. package/batteries/generation/local_diffusion/adapter.mjs +2 -2
  24. package/batteries/generation/openai/adapter.cjs +1 -1
  25. package/batteries/generation/openai/adapter.mjs +1 -1
  26. package/batteries/isolation/browser.d.ts +1 -1
  27. package/batteries/isolation/child_process/transport.d.ts +2 -2
  28. package/batteries/isolation/child_process.cjs +4 -4
  29. package/batteries/isolation/child_process.cjs.map +1 -1
  30. package/batteries/isolation/child_process.mjs +4 -4
  31. package/batteries/isolation/child_process.mjs.map +1 -1
  32. package/batteries/isolation/codec.d.ts +2 -2
  33. package/batteries/isolation/crash_policy.d.ts +1 -1
  34. package/batteries/isolation/isolate_function.d.ts +2 -2
  35. package/batteries/isolation/protocol.d.ts +4 -4
  36. package/batteries/isolation/serve.d.ts +2 -2
  37. package/batteries/isolation/types.d.ts +4 -4
  38. package/batteries/isolation.cjs +1 -1
  39. package/batteries/isolation.mjs +1 -1
  40. package/batteries/llm/anthropic_messages/adapter.cjs +6 -6
  41. package/batteries/llm/anthropic_messages/adapter.cjs.map +1 -1
  42. package/batteries/llm/anthropic_messages/adapter.mjs +6 -6
  43. package/batteries/llm/anthropic_messages/adapter.mjs.map +1 -1
  44. package/batteries/llm/anthropic_messages/count_tokens.cjs +1 -1
  45. package/batteries/llm/anthropic_messages/count_tokens.mjs +1 -1
  46. package/batteries/llm/anthropic_messages/helpers.cjs +3 -3
  47. package/batteries/llm/anthropic_messages/helpers.mjs +3 -3
  48. package/batteries/llm/anthropic_messages/types.d.ts +2 -2
  49. package/batteries/llm/anthropic_messages/validation.cjs +3 -3
  50. package/batteries/llm/anthropic_messages/validation.cjs.map +1 -1
  51. package/batteries/llm/anthropic_messages/validation.mjs +3 -3
  52. package/batteries/llm/anthropic_messages/validation.mjs.map +1 -1
  53. package/batteries/llm/anthropic_messages.cjs +2 -2
  54. package/batteries/llm/anthropic_messages.mjs +2 -2
  55. package/batteries/llm/bedrock_converse/adapter.cjs +29 -7
  56. package/batteries/llm/bedrock_converse/adapter.cjs.map +1 -1
  57. package/batteries/llm/bedrock_converse/adapter.mjs +30 -8
  58. package/batteries/llm/bedrock_converse/adapter.mjs.map +1 -1
  59. package/batteries/llm/bedrock_converse/exceptions.cjs +3 -0
  60. package/batteries/llm/bedrock_converse/exceptions.cjs.map +1 -1
  61. package/batteries/llm/bedrock_converse/exceptions.d.ts +6 -0
  62. package/batteries/llm/bedrock_converse/exceptions.mjs +3 -1
  63. package/batteries/llm/bedrock_converse/exceptions.mjs.map +1 -1
  64. package/batteries/llm/bedrock_converse/helpers.cjs +1 -1
  65. package/batteries/llm/bedrock_converse/helpers.mjs +1 -1
  66. package/batteries/llm/bedrock_converse/types.d.ts +6 -2
  67. package/batteries/llm/bedrock_converse/validation.cjs +7 -1
  68. package/batteries/llm/bedrock_converse/validation.cjs.map +1 -1
  69. package/batteries/llm/bedrock_converse/validation.mjs +7 -1
  70. package/batteries/llm/bedrock_converse/validation.mjs.map +1 -1
  71. package/batteries/llm/bedrock_converse.cjs +2 -2
  72. package/batteries/llm/bedrock_converse.mjs +2 -2
  73. package/batteries/llm/claude_code_cli/adapter.cjs +6 -6
  74. package/batteries/llm/claude_code_cli/adapter.cjs.map +1 -1
  75. package/batteries/llm/claude_code_cli/adapter.mjs +6 -6
  76. package/batteries/llm/claude_code_cli/adapter.mjs.map +1 -1
  77. package/batteries/llm/claude_code_cli/helpers.cjs +3 -3
  78. package/batteries/llm/claude_code_cli/helpers.mjs +3 -3
  79. package/batteries/llm/claude_code_cli/types.d.ts +3 -2
  80. package/batteries/llm/claude_code_cli/validation.cjs +3 -3
  81. package/batteries/llm/claude_code_cli/validation.cjs.map +1 -1
  82. package/batteries/llm/claude_code_cli/validation.mjs +3 -3
  83. package/batteries/llm/claude_code_cli/validation.mjs.map +1 -1
  84. package/batteries/llm/claude_code_cli.cjs +1 -1
  85. package/batteries/llm/claude_code_cli.mjs +1 -1
  86. package/batteries/llm/gemini_generate_content/adapter.cjs +29 -7
  87. package/batteries/llm/gemini_generate_content/adapter.cjs.map +1 -1
  88. package/batteries/llm/gemini_generate_content/adapter.mjs +30 -8
  89. package/batteries/llm/gemini_generate_content/adapter.mjs.map +1 -1
  90. package/batteries/llm/gemini_generate_content/exceptions.cjs +3 -0
  91. package/batteries/llm/gemini_generate_content/exceptions.cjs.map +1 -1
  92. package/batteries/llm/gemini_generate_content/exceptions.d.ts +6 -0
  93. package/batteries/llm/gemini_generate_content/exceptions.mjs +3 -1
  94. package/batteries/llm/gemini_generate_content/exceptions.mjs.map +1 -1
  95. package/batteries/llm/gemini_generate_content/helpers.cjs +1 -1
  96. package/batteries/llm/gemini_generate_content/helpers.mjs +1 -1
  97. package/batteries/llm/gemini_generate_content/types.d.ts +7 -3
  98. package/batteries/llm/gemini_generate_content/validation.cjs +11 -2
  99. package/batteries/llm/gemini_generate_content/validation.cjs.map +1 -1
  100. package/batteries/llm/gemini_generate_content/validation.mjs +11 -2
  101. package/batteries/llm/gemini_generate_content/validation.mjs.map +1 -1
  102. package/batteries/llm/gemini_generate_content.cjs +1 -1
  103. package/batteries/llm/gemini_generate_content.mjs +1 -1
  104. package/batteries/llm/litert_lm/adapter.cjs +6 -6
  105. package/batteries/llm/litert_lm/adapter.cjs.map +1 -1
  106. package/batteries/llm/litert_lm/adapter.mjs +6 -6
  107. package/batteries/llm/litert_lm/adapter.mjs.map +1 -1
  108. package/batteries/llm/litert_lm/helpers.cjs +3 -3
  109. package/batteries/llm/litert_lm/helpers.mjs +3 -3
  110. package/batteries/llm/litert_lm/types.d.ts +2 -2
  111. package/batteries/llm/litert_lm/validation.cjs +3 -3
  112. package/batteries/llm/litert_lm/validation.cjs.map +1 -1
  113. package/batteries/llm/litert_lm/validation.mjs +3 -3
  114. package/batteries/llm/litert_lm/validation.mjs.map +1 -1
  115. package/batteries/llm/litert_lm.cjs +1 -1
  116. package/batteries/llm/litert_lm.mjs +1 -1
  117. package/batteries/llm/ollama/adapter.cjs +6 -6
  118. package/batteries/llm/ollama/adapter.cjs.map +1 -1
  119. package/batteries/llm/ollama/adapter.mjs +6 -6
  120. package/batteries/llm/ollama/adapter.mjs.map +1 -1
  121. package/batteries/llm/ollama/helpers.cjs +4 -4
  122. package/batteries/llm/ollama/helpers.mjs +4 -4
  123. package/batteries/llm/ollama/types.d.ts +2 -2
  124. package/batteries/llm/ollama/validation.cjs +3 -3
  125. package/batteries/llm/ollama/validation.cjs.map +1 -1
  126. package/batteries/llm/ollama/validation.mjs +3 -3
  127. package/batteries/llm/ollama/validation.mjs.map +1 -1
  128. package/batteries/llm/ollama.cjs +2 -2
  129. package/batteries/llm/ollama.mjs +2 -2
  130. package/batteries/llm/openai_chat_completions/adapter.cjs +6 -6
  131. package/batteries/llm/openai_chat_completions/adapter.cjs.map +1 -1
  132. package/batteries/llm/openai_chat_completions/adapter.mjs +6 -6
  133. package/batteries/llm/openai_chat_completions/adapter.mjs.map +1 -1
  134. package/batteries/llm/openai_chat_completions/helpers.cjs +4 -4
  135. package/batteries/llm/openai_chat_completions/helpers.mjs +4 -4
  136. package/batteries/llm/openai_chat_completions/types.d.ts +2 -2
  137. package/batteries/llm/openai_chat_completions/validation.cjs +3 -3
  138. package/batteries/llm/openai_chat_completions/validation.cjs.map +1 -1
  139. package/batteries/llm/openai_chat_completions/validation.mjs +3 -3
  140. package/batteries/llm/openai_chat_completions/validation.mjs.map +1 -1
  141. package/batteries/llm/openai_chat_completions.cjs +2 -2
  142. package/batteries/llm/openai_chat_completions.mjs +2 -2
  143. package/batteries/llm/openai_responses/adapter.cjs +6 -6
  144. package/batteries/llm/openai_responses/adapter.cjs.map +1 -1
  145. package/batteries/llm/openai_responses/adapter.mjs +6 -6
  146. package/batteries/llm/openai_responses/adapter.mjs.map +1 -1
  147. package/batteries/llm/openai_responses/helpers.cjs +3 -3
  148. package/batteries/llm/openai_responses/helpers.mjs +3 -3
  149. package/batteries/llm/openai_responses/types.d.ts +2 -2
  150. package/batteries/llm/openai_responses/validation.cjs +3 -3
  151. package/batteries/llm/openai_responses/validation.cjs.map +1 -1
  152. package/batteries/llm/openai_responses/validation.mjs +3 -3
  153. package/batteries/llm/openai_responses/validation.mjs.map +1 -1
  154. package/batteries/llm/openai_responses.cjs +2 -2
  155. package/batteries/llm/openai_responses.mjs +2 -2
  156. package/batteries/llm/transformers_js/adapter.cjs +6 -6
  157. package/batteries/llm/transformers_js/adapter.cjs.map +1 -1
  158. package/batteries/llm/transformers_js/adapter.mjs +6 -6
  159. package/batteries/llm/transformers_js/adapter.mjs.map +1 -1
  160. package/batteries/llm/transformers_js/helpers.cjs +3 -3
  161. package/batteries/llm/transformers_js/helpers.mjs +3 -3
  162. package/batteries/llm/transformers_js/types.d.ts +2 -2
  163. package/batteries/llm/transformers_js/validation.cjs +3 -3
  164. package/batteries/llm/transformers_js/validation.cjs.map +1 -1
  165. package/batteries/llm/transformers_js/validation.mjs +3 -3
  166. package/batteries/llm/transformers_js/validation.mjs.map +1 -1
  167. package/batteries/llm/transformers_js.cjs +1 -1
  168. package/batteries/llm/transformers_js.mjs +1 -1
  169. package/batteries/llm/webllm_chat_completions/adapter.cjs +6 -6
  170. package/batteries/llm/webllm_chat_completions/adapter.cjs.map +1 -1
  171. package/batteries/llm/webllm_chat_completions/adapter.mjs +6 -6
  172. package/batteries/llm/webllm_chat_completions/adapter.mjs.map +1 -1
  173. package/batteries/llm/webllm_chat_completions/helpers.cjs +1 -1
  174. package/batteries/llm/webllm_chat_completions/helpers.mjs +1 -1
  175. package/batteries/llm/webllm_chat_completions/validation.cjs +3 -3
  176. package/batteries/llm/webllm_chat_completions/validation.cjs.map +1 -1
  177. package/batteries/llm/webllm_chat_completions/validation.mjs +3 -3
  178. package/batteries/llm/webllm_chat_completions/validation.mjs.map +1 -1
  179. package/batteries/llm/webllm_chat_completions.cjs +2 -2
  180. package/batteries/llm/webllm_chat_completions.mjs +2 -2
  181. package/batteries/llm.cjs +2 -2
  182. package/batteries/llm.mjs +2 -2
  183. package/batteries/media/builder.d.ts +3 -0
  184. package/batteries/media/contracts.cjs.map +1 -1
  185. package/batteries/media/contracts.d.ts +40 -1
  186. package/batteries/media/contracts.mjs.map +1 -1
  187. package/batteries/media/engines/sharp.cjs +36 -2
  188. package/batteries/media/engines/sharp.cjs.map +1 -1
  189. package/batteries/media/engines/sharp.mjs +36 -2
  190. package/batteries/media/engines/sharp.mjs.map +1 -1
  191. package/batteries/media/forge.cjs +5 -5
  192. package/batteries/media/forge.mjs +5 -5
  193. package/batteries/media/index.d.ts +1 -1
  194. package/batteries/media/lint.cjs +3 -2
  195. package/batteries/media/lint.cjs.map +1 -1
  196. package/batteries/media/lint.mjs +3 -2
  197. package/batteries/media/lint.mjs.map +1 -1
  198. package/batteries/media.cjs +66 -2
  199. package/batteries/media.cjs.map +1 -1
  200. package/batteries/media.mjs +66 -2
  201. package/batteries/media.mjs.map +1 -1
  202. package/batteries/orchestration/conformance.cjs +123 -74
  203. package/batteries/orchestration/conformance.cjs.map +1 -1
  204. package/batteries/orchestration/conformance.d.ts +10 -8
  205. package/batteries/orchestration/conformance.mjs +54 -5
  206. package/batteries/orchestration/conformance.mjs.map +1 -1
  207. package/batteries/orchestration/dispatch_reasoner.cjs +4 -4
  208. package/batteries/orchestration/dispatch_reasoner.mjs +4 -4
  209. package/batteries/orchestration/executor.cjs +2 -2
  210. package/batteries/orchestration/executor.mjs +2 -2
  211. package/batteries/orchestration/forge.cjs +4 -4
  212. package/batteries/orchestration/forge.mjs +4 -4
  213. package/batteries/orchestration/validation.cjs +2 -2
  214. package/batteries/orchestration/validation.mjs +2 -2
  215. package/batteries/orchestration.cjs +4 -4
  216. package/batteries/orchestration.mjs +4 -4
  217. package/batteries/sandbox/contracts/policy_enforcer.d.ts +13 -1
  218. package/batteries/sandbox/js/compartment.d.ts +7 -2
  219. package/batteries/sandbox/js/exceptions.d.ts +4 -0
  220. package/batteries/sandbox/js/runner.d.ts +1 -1
  221. package/batteries/sandbox/js/service.d.ts +1 -1
  222. package/batteries/sandbox/js/ses_contracts.d.ts +4 -3
  223. package/batteries/sandbox/js.cjs +18 -9
  224. package/batteries/sandbox/js.cjs.map +1 -1
  225. package/batteries/sandbox/js.mjs +18 -10
  226. package/batteries/sandbox/js.mjs.map +1 -1
  227. package/batteries/sandbox/manager.d.ts +4 -3
  228. package/batteries/sandbox/node/srt_enforcer.d.ts +1 -1
  229. package/batteries/sandbox/node.cjs +36 -12
  230. package/batteries/sandbox/node.cjs.map +1 -1
  231. package/batteries/sandbox/node.mjs +36 -12
  232. package/batteries/sandbox/node.mjs.map +1 -1
  233. package/batteries/sandbox/tools.cjs +1 -1
  234. package/batteries/sandbox/tools.mjs +1 -1
  235. package/batteries/sandbox/types.d.ts +10 -1
  236. package/batteries/sandbox.cjs +28 -10
  237. package/batteries/sandbox.cjs.map +1 -1
  238. package/batteries/sandbox.mjs +29 -12
  239. package/batteries/sandbox.mjs.map +1 -1
  240. package/batteries/skills.cjs +8 -8
  241. package/batteries/skills.mjs +8 -8
  242. package/batteries/tools/_shared.cjs +1 -1
  243. package/batteries/tools/_shared.mjs +1 -1
  244. package/batteries/tools/color.cjs +2 -2
  245. package/batteries/tools/color.mjs +2 -2
  246. package/batteries/tools/comparison.cjs +2 -2
  247. package/batteries/tools/comparison.mjs +2 -2
  248. package/batteries/tools/data_structure.cjs +2 -2
  249. package/batteries/tools/data_structure.mjs +2 -2
  250. package/batteries/tools/datetime_extended.cjs +2 -2
  251. package/batteries/tools/datetime_extended.mjs +2 -2
  252. package/batteries/tools/datetime_math.cjs +2 -2
  253. package/batteries/tools/datetime_math.mjs +2 -2
  254. package/batteries/tools/encoding.cjs +2 -2
  255. package/batteries/tools/encoding.mjs +2 -2
  256. package/batteries/tools/formatting.cjs +2 -2
  257. package/batteries/tools/formatting.mjs +2 -2
  258. package/batteries/tools/geo_basics.cjs +2 -2
  259. package/batteries/tools/geo_basics.mjs +2 -2
  260. package/batteries/tools/math.cjs +2 -2
  261. package/batteries/tools/math.mjs +2 -2
  262. package/batteries/tools/memory.cjs +4 -4
  263. package/batteries/tools/memory.mjs +4 -4
  264. package/batteries/tools/parsing.cjs +3 -3
  265. package/batteries/tools/parsing.mjs +3 -3
  266. package/batteries/tools/retrievables.cjs +4 -4
  267. package/batteries/tools/retrievables.mjs +4 -4
  268. package/batteries/tools/scrapper.cjs +1 -1
  269. package/batteries/tools/scrapper.mjs +1 -1
  270. package/batteries/tools/searxng.cjs +1 -1
  271. package/batteries/tools/searxng.mjs +1 -1
  272. package/batteries/tools/standing_instructions.cjs +3 -3
  273. package/batteries/tools/standing_instructions.mjs +3 -3
  274. package/batteries/tools/statistics.cjs +3 -3
  275. package/batteries/tools/statistics.mjs +3 -3
  276. package/batteries/tools/string_processing.cjs +2 -2
  277. package/batteries/tools/string_processing.mjs +2 -2
  278. package/batteries/tools/structured_data.cjs +2 -2
  279. package/batteries/tools/structured_data.mjs +2 -2
  280. package/batteries/tools/text_analysis.cjs +3 -3
  281. package/batteries/tools/text_analysis.mjs +3 -3
  282. package/batteries/tools/text_comparison.cjs +2 -2
  283. package/batteries/tools/text_comparison.mjs +2 -2
  284. package/batteries/tools/time.cjs +2 -2
  285. package/batteries/tools/time.mjs +2 -2
  286. package/batteries/tools/unit_conversion.cjs +2 -2
  287. package/batteries/tools/unit_conversion.mjs +2 -2
  288. package/batteries/tools.cjs +2 -2
  289. package/batteries/tools.mjs +2 -2
  290. package/batteries/validation.cjs +4 -4
  291. package/batteries/validation.mjs +4 -4
  292. package/batteries/vector/chroma.cjs +1 -1
  293. package/batteries/vector/chroma.mjs +1 -1
  294. package/batteries/vector/clickhouse.cjs +1 -1
  295. package/batteries/vector/clickhouse.mjs +1 -1
  296. package/batteries/vector/cloudflare.cjs +1 -1
  297. package/batteries/vector/cloudflare.mjs +1 -1
  298. package/batteries/vector/conformance/index.d.ts +11 -16
  299. package/batteries/vector/conformance.cjs +107 -36
  300. package/batteries/vector/conformance.cjs.map +1 -1
  301. package/batteries/vector/conformance.mjs +84 -13
  302. package/batteries/vector/conformance.mjs.map +1 -1
  303. package/batteries/vector/couchbase.cjs +1 -1
  304. package/batteries/vector/couchbase.mjs +1 -1
  305. package/batteries/vector/duckdb.cjs +1 -1
  306. package/batteries/vector/duckdb.mjs +1 -1
  307. package/batteries/vector/elasticsearch.cjs +1 -1
  308. package/batteries/vector/elasticsearch.mjs +1 -1
  309. package/batteries/vector/hnswlib.cjs +1 -1
  310. package/batteries/vector/hnswlib.mjs +1 -1
  311. package/batteries/vector/in_memory.cjs +1 -1
  312. package/batteries/vector/in_memory.mjs +1 -1
  313. package/batteries/vector/lancedb.cjs +1 -1
  314. package/batteries/vector/lancedb.mjs +1 -1
  315. package/batteries/vector/mariadb.cjs +1 -1
  316. package/batteries/vector/mariadb.mjs +1 -1
  317. package/batteries/vector/milvus.cjs +1 -1
  318. package/batteries/vector/milvus.mjs +1 -1
  319. package/batteries/vector/opensearch.cjs +1 -1
  320. package/batteries/vector/opensearch.mjs +1 -1
  321. package/batteries/vector/oracle23ai.cjs +1 -1
  322. package/batteries/vector/oracle23ai.mjs +1 -1
  323. package/batteries/vector/orama.cjs +1 -1
  324. package/batteries/vector/orama.mjs +1 -1
  325. package/batteries/vector/pgvector.cjs +1 -1
  326. package/batteries/vector/pgvector.mjs +1 -1
  327. package/batteries/vector/pinecone.cjs +1 -1
  328. package/batteries/vector/pinecone.mjs +1 -1
  329. package/batteries/vector/qdrant.cjs +1 -1
  330. package/batteries/vector/qdrant.mjs +1 -1
  331. package/batteries/vector/redis.cjs +1 -1
  332. package/batteries/vector/redis.mjs +1 -1
  333. package/batteries/vector/retrievable.cjs +1 -1
  334. package/batteries/vector/retrievable.mjs +1 -1
  335. package/batteries/vector/s3vectors.cjs +1 -1
  336. package/batteries/vector/s3vectors.mjs +1 -1
  337. package/batteries/vector/sqlite_vec.cjs +1 -1
  338. package/batteries/vector/sqlite_vec.mjs +1 -1
  339. package/batteries/vector/typesense.cjs +1 -1
  340. package/batteries/vector/typesense.mjs +1 -1
  341. package/batteries/vector/vespa.cjs +1 -1
  342. package/batteries/vector/vespa.mjs +1 -1
  343. package/batteries/vector/weaviate.cjs +1 -1
  344. package/batteries/vector/weaviate.mjs +1 -1
  345. package/batteries/vector.cjs +1 -1
  346. package/batteries/vector.mjs +1 -1
  347. package/batteries.cjs +8 -8
  348. package/batteries.mjs +8 -8
  349. package/{chat_common-DXWHxn-w.js → chat_common-CBqn22t1.js} +2 -2
  350. package/{chat_common-DXWHxn-w.js.map → chat_common-CBqn22t1.js.map} +1 -1
  351. package/{chat_common-DNLnQBlM.mjs → chat_common-DKw8FDol.mjs} +2 -2
  352. package/{chat_common-DNLnQBlM.mjs.map → chat_common-DKw8FDol.mjs.map} +1 -1
  353. package/{common-Ddtq6naG.js → common-0rLuBEeY.js} +7 -7
  354. package/{common-Ddtq6naG.js.map → common-0rLuBEeY.js.map} +1 -1
  355. package/{common-DB7HRMf1.mjs → common-oI1niK9Z.mjs} +7 -7
  356. package/{common-DB7HRMf1.mjs.map → common-oI1niK9Z.mjs.map} +1 -1
  357. package/common.cjs +7 -7
  358. package/common.mjs +7 -7
  359. package/{dispatch_runner-xsvRLCo7.mjs → dispatch_runner-BZDXUe0G.mjs} +4 -4
  360. package/{dispatch_runner-xsvRLCo7.mjs.map → dispatch_runner-BZDXUe0G.mjs.map} +1 -1
  361. package/{dispatch_runner-DsLbcGwd.js → dispatch_runner-CKhm-scw.js} +4 -4
  362. package/{dispatch_runner-DsLbcGwd.js.map → dispatch_runner-CKhm-scw.js.map} +1 -1
  363. package/dispatch_runner.cjs +1 -1
  364. package/dispatch_runner.mjs +1 -1
  365. package/{ecmascript-BZAoi8W2.mjs → ecmascript-B9Z2C24U.mjs} +3 -3
  366. package/{ecmascript-BZAoi8W2.mjs.map → ecmascript-B9Z2C24U.mjs.map} +1 -1
  367. package/{ecmascript-dj5rP96h.js → ecmascript-DmrNI2Wo.js} +3 -3
  368. package/{ecmascript-dj5rP96h.js.map → ecmascript-DmrNI2Wo.js.map} +1 -1
  369. package/eslint/rules.cjs +1 -1
  370. package/eslint/rules.mjs +1 -1
  371. package/eslint.cjs +2 -2
  372. package/eslint.mjs +2 -2
  373. package/exceptions.cjs +1 -1
  374. package/exceptions.mjs +1 -1
  375. package/forge.cjs +2 -2
  376. package/forge.mjs +2 -2
  377. package/guards.cjs +7 -7
  378. package/guards.mjs +7 -7
  379. package/{helpers-gUUlDRfs.js → helpers-CObtMmAZ.js} +3 -3
  380. package/{helpers-gUUlDRfs.js.map → helpers-CObtMmAZ.js.map} +1 -1
  381. package/{helpers-CtGtJiyo.mjs → helpers-mbn_EsDV.mjs} +3 -3
  382. package/{helpers-CtGtJiyo.mjs.map → helpers-mbn_EsDV.mjs.map} +1 -1
  383. package/index.cjs +12 -12
  384. package/index.mjs +12 -12
  385. package/{isolation-BQCTQYZ_.js → isolation-7Jrcucgc.js} +11 -11
  386. package/isolation-7Jrcucgc.js.map +1 -0
  387. package/{isolation-7xbkc12r.mjs → isolation-CO0NiK8R.mjs} +11 -11
  388. package/isolation-CO0NiK8R.mjs.map +1 -0
  389. package/lib/classes/identity.d.ts +6 -3
  390. package/lib/classes/tokenizable.d.ts +2 -3
  391. package/mcp/adk-docs-corpus.json +2 -2
  392. package/package.json +405 -405
  393. package/{retrievable-DinM3DGL.js → retrievable-BTwjmPnl.js} +3 -3
  394. package/{retrievable-DinM3DGL.js.map → retrievable-BTwjmPnl.js.map} +1 -1
  395. package/{retrievable-gxOs7QaJ.mjs → retrievable-CXTAUuuv.mjs} +3 -3
  396. package/{retrievable-gxOs7QaJ.mjs.map → retrievable-CXTAUuuv.mjs.map} +1 -1
  397. package/{scrapper-C4HlXNKs.js → scrapper-CJexXXK-.js} +4 -4
  398. package/{scrapper-C4HlXNKs.js.map → scrapper-CJexXXK-.js.map} +1 -1
  399. package/{scrapper-COT5I9DB.mjs → scrapper-DiQ5FfDL.mjs} +4 -4
  400. package/{scrapper-COT5I9DB.mjs.map → scrapper-DiQ5FfDL.mjs.map} +1 -1
  401. package/{searxng-CRyUWb5a.mjs → searxng-BFTJ6rTE.mjs} +4 -4
  402. package/{searxng-CRyUWb5a.mjs.map → searxng-BFTJ6rTE.mjs.map} +1 -1
  403. package/{searxng-W9LO7hIU.js → searxng-DzlGZG4V.js} +4 -4
  404. package/{searxng-W9LO7hIU.js.map → searxng-DzlGZG4V.js.map} +1 -1
  405. package/server.json +2 -2
  406. package/skills/adk-assembly/SKILL.md +2 -2
  407. package/{spooled_artifact-CU1m9-te.js → spooled_artifact-BpcesRBv.js} +2 -2
  408. package/{spooled_artifact-CU1m9-te.js.map → spooled_artifact-BpcesRBv.js.map} +1 -1
  409. package/{spooled_artifact-W_0Y0N3U.mjs → spooled_artifact-Bw_7swIp.mjs} +2 -2
  410. package/{spooled_artifact-W_0Y0N3U.mjs.map → spooled_artifact-Bw_7swIp.mjs.map} +1 -1
  411. package/spooled_artifact.cjs +2 -2
  412. package/spooled_artifact.mjs +2 -2
  413. package/{spooled_markdown_artifact-FluUIAAV.mjs → spooled_markdown_artifact-vd6eNtIP.mjs} +3 -3
  414. package/{spooled_markdown_artifact-FluUIAAV.mjs.map → spooled_markdown_artifact-vd6eNtIP.mjs.map} +1 -1
  415. package/{spooled_markdown_artifact-DypwOWk4.js → spooled_markdown_artifact-wJPnE8Ij.js} +3 -3
  416. package/{spooled_markdown_artifact-DypwOWk4.js.map → spooled_markdown_artifact-wJPnE8Ij.js.map} +1 -1
  417. package/{thought-ZHgbMDhV.mjs → thought-CxSaF6Xf.mjs} +48 -7
  418. package/thought-CxSaF6Xf.mjs.map +1 -0
  419. package/{thought-tcs8Ayw5.js → thought-Dg_4UZxg.js} +47 -6
  420. package/thought-Dg_4UZxg.js.map +1 -0
  421. package/{tokenizable-Cc5XKez7.js → tokenizable-BMZuGWRd.js} +7 -1
  422. package/tokenizable-BMZuGWRd.js.map +1 -0
  423. package/{tokenizable-D_lz__Co.mjs → tokenizable-VB4Av8GF.mjs} +7 -1
  424. package/{tokenizable-D_lz__Co.mjs.map → tokenizable-VB4Av8GF.mjs.map} +1 -1
  425. package/{tool_call-T2OHWy4k.mjs → tool_call-Cfaj-6zK.mjs} +3 -3
  426. package/{tool_call-T2OHWy4k.mjs.map → tool_call-Cfaj-6zK.mjs.map} +1 -1
  427. package/{tool_call-CYc1yGp9.js → tool_call-Fs_Uh5wQ.js} +3 -3
  428. package/{tool_call-CYc1yGp9.js.map → tool_call-Fs_Uh5wQ.js.map} +1 -1
  429. package/{tools-DK7SUP6s.mjs → tools-D0MBDh2R.mjs} +6 -6
  430. package/{tools-DK7SUP6s.mjs.map → tools-D0MBDh2R.mjs.map} +1 -1
  431. package/{tools-th9347rw.js → tools-rJvfktHR.js} +6 -6
  432. package/{tools-th9347rw.js.map → tools-rJvfktHR.js.map} +1 -1
  433. package/{toon-C6XIUaSg.mjs → toon-BSTQnHed.mjs} +4 -4
  434. package/{toon-C6XIUaSg.mjs.map → toon-BSTQnHed.mjs.map} +1 -1
  435. package/{toon-C0FZwoup.js → toon-BXPdJRz7.js} +4 -4
  436. package/{toon-C0FZwoup.js.map → toon-BXPdJRz7.js.map} +1 -1
  437. package/{turn_runner-BF5eYyLW.mjs → turn_runner-BHHD6h77.mjs} +4 -4
  438. package/{turn_runner-BF5eYyLW.mjs.map → turn_runner-BHHD6h77.mjs.map} +1 -1
  439. package/{turn_runner-EYHRPt_r.js → turn_runner-DhLI7OTH.js} +4 -4
  440. package/{turn_runner-EYHRPt_r.js.map → turn_runner-DhLI7OTH.js.map} +1 -1
  441. package/turn_runner.cjs +1 -1
  442. package/turn_runner.mjs +1 -1
  443. package/types-D6X_aUIb.mjs.map +1 -1
  444. package/types-DrSosVaM.js.map +1 -1
  445. package/{validate-lzy9nG_E.mjs → validate-Bi7FGjoq.mjs} +13 -1
  446. package/{validate-lzy9nG_E.mjs.map → validate-Bi7FGjoq.mjs.map} +1 -1
  447. package/{validate-CdOS7S2u.js → validate-CkQI-48O.js} +13 -1
  448. package/{validate-CdOS7S2u.js.map → validate-CkQI-48O.js.map} +1 -1
  449. package/{xml-C_FSMBjJ.js → xml-CNmgj5Qq.js} +4 -4
  450. package/{xml-C_FSMBjJ.js.map → xml-CNmgj5Qq.js.map} +1 -1
  451. package/{xml-BpnJipVO.mjs → xml-CYseDztH.mjs} +4 -4
  452. package/{xml-BpnJipVO.mjs.map → xml-CYseDztH.mjs.map} +1 -1
  453. package/{yaml-DAOMzSM3.mjs → yaml-BPBoiOjx.mjs} +4 -4
  454. package/{yaml-DAOMzSM3.mjs.map → yaml-BPBoiOjx.mjs.map} +1 -1
  455. package/{yaml-BKeWsvft.js → yaml-CaoIJyRe.js} +4 -4
  456. package/{yaml-BKeWsvft.js.map → yaml-CaoIJyRe.js.map} +1 -1
  457. package/artifact_methods-BUCRNQrh.js +0 -1
  458. package/artifact_methods-CjCGzlP-.mjs +0 -1
  459. package/isolation-7xbkc12r.mjs.map +0 -1
  460. package/isolation-BQCTQYZ_.js.map +0 -1
  461. package/thought-ZHgbMDhV.mjs.map +0 -1
  462. package/thought-tcs8Ayw5.js.map +0 -1
  463. package/tokenizable-Cc5XKez7.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"child_process.mjs","names":[],"sources":["../../../src/batteries/isolation/child_process/transport.ts"],"sourcesContent":["/**\n * Node `child_process`-backed {@link @nhtio/adk/batteries/isolation!IsolationTransport} — forks (or\n * BYO-spawns) a guest process and wraps its IPC channel in the `PortLike` duck the wire protocol is\n * built over.\n *\n * @remarks\n * This module is NODE-ONLY: it imports `node:child_process` directly (unlike `serve.ts`'s guest-side\n * duck detection, which never imports `node:*` so it stays loadable in a Worker/browser bundle). See\n * this subpath's `index.ts` for why a real process — rather than a `worker_threads` `Worker` — is the\n * right host-side primitive for WP3.\n *\n * Two ways to obtain the child:\n *\n * - `{ modulePath, forkOptions? }` — the common case. Calls node's own `child_process.fork(modulePath,\n * forkOptions)`. Unless the caller's `forkOptions` explicitly sets `serialization`, this pins\n * `serialization: 'advanced'` (V8's structured-clone algorithm over the IPC channel) rather than\n * node's default `'json'`. This matters because `codec.ts` treats `TypedArray`/`ArrayBuffer`/\n * `DataView`/`Date`/`RegExp`/`Map`/`Set` as OPAQUE traversal leaves that ship **raw**, trusting the\n * transport to carry them faithfully — under default JSON serialization a `Float32Array` argument\n * would silently degrade to a plain `{0: ..., 1: ...}` object on arrival (empirically confirmed: a\n * `fork()` with no `serialization` override loses `instanceof Float32Array` across the wire). If a\n * caller forces `forkOptions: { serialization: 'json' }` anyway, tier-0 (`raw`) round-trips are\n * restricted to JSON-safe values for THOSE exotic containers; the codec's auto-escalation to tier-1/2\n * still carries functions/Errors/custom-encodables correctly (just paying the `@nhtio/encoder`\n * encode/decode cost) — only raw-tier TypedArray/Map/Set/Date/RegExp fidelity is at risk, and only\n * when the caller opted out of the default explicitly.\n * - `{ spawn }` — a {@link ChildResolver} BYO-spawner seam for callers who need their own process\n * manager (pooling, custom stdio wiring, sandboxing) or who spawn via a wrapper library instead of\n * `fork()` directly. The resolver must return (or resolve to) an {@link IsolatedChildLike} — see that\n * type's doc for the exact surface this module was empirically verified against, including execa≥9.\n *\n * These two forms are mutually exclusive and validated eagerly (this subpath's own local joi schema —\n * WP1's `validation.ts` is not touched).\n *\n * `terminate()` sends `SIGTERM` (or the caller's configured signal) and does NOT itself wait for exit\n * or run any grace period of its own — `host.ts`'s `dispose()` already sends a `shutdown` envelope and\n * waits `disposeGraceMs` for the guest to exit voluntarily before calling `transport.terminate()`\n * unconditionally; duplicating a grace window here would just double it. An `'exit'` that fires while\n * `terminate()`/`recycle()` is in progress is expected and never reported as a crash; any other exit\n * (including a non-zero code, e.g. `process.exit(7)` in the guest) or an `'error'` event on the child\n * fires {@link @nhtio/adk/batteries/isolation!IsolationTransport.onCrash}. `recycle()` (driven by\n * `host.ts`, not implemented in this module) re-enters this same transport's `connect()`, which forks\n * (or re-invokes the resolver) a brand-new child every time — there is no child reuse across recycles.\n */\n\nimport { fork } from 'node:child_process'\nimport { isError, isInstanceOf } from '@nhtio/adk/guards'\nimport { validator, ValidationError } from '@nhtio/validation'\nimport {\n createIsolatedService,\n E_INVALID_ISOLATION_OPTIONS,\n E_ISOLATION_UNSUPPORTED_ENV,\n} from '@nhtio/adk/batteries/isolation'\nimport type { ForkOptions } from 'node:child_process'\nimport type {\n CrashInfo,\n IsolatedService,\n IsolatedServiceOptions,\n IsolatedServiceSpec,\n IsolationTransport,\n PortLike,\n} from '@nhtio/adk/batteries/isolation'\n\n/**\n * The minimal Node `ChildProcess`-shaped duck this transport drives. Structurally satisfied by BOTH:\n *\n * - the object returned by `node:child_process`'s own `fork()`, and\n * - an `execa`≥9 subprocess spawned with `{ ipc: true }` — empirically verified: execa's\n * `Subprocess<OptionsType>` type is `Omit<ChildProcess, keyof ExecaCustomSubprocess<OptionsType>> &\n * ExecaCustomSubprocess<OptionsType>`, i.e. it keeps the classic Node `ChildProcess` EventEmitter\n * surface (`.send()`, `.on('message'|'exit'|'error', ...)`, `.kill()`, `.connected`) alongside\n * execa's own promise-based `sendMessage()`/`getEachMessage()` API. This transport only ever uses the\n * classic EventEmitter surface, so an execa `{ ipc: true }` subprocess satisfies this duck WITHOUT\n * any adapter.\n *\n * execa's channel, like node's own `fork()`, defaults to JSON-style serialization unless the\n * subprocess is spawned with `serialization: 'advanced'` (execa forwards that option straight to the\n * underlying `child_process.fork()` it uses internally for `ipc: true`) — the same \"pin `advanced` for\n * exotic-value fidelity\" requirement documented on {@link ForkIsolatedOptions} applies whether the\n * child came from this module's own `fork()` call or from a caller-supplied {@link ChildResolver}.\n *\n * @remarks\n * A {@link ChildResolver} must NOT itself attach a `'message'` listener to the child it returns before\n * handing it back to this transport (e.g. for logging). Node buffers a child's `message`/`ipc` events\n * until the FIRST listener is attached, then flushes the whole buffer to that one listener exactly\n * once — a resolver-side listener attached first (even just to log) permanently steals the buffered\n * `ready` envelope from `connect()`'s own listener, which then waits out `readyTimeoutMs` for a `ready`\n * that already came and went. execa's `Subprocess` additionally proxies raw child events through its\n * own internal debounced `message` re-emitter (see execa's `lib/ipc/forward.js`), so this applies to\n * execa subprocesses too — empirically confirmed by instrumenting a resolver with a diagnostic\n * `subprocess.on('message', ...)` and observing the resulting connection hang.\n *\n * A {@link ChildResolver} that returns an execa `{ ipc: true }` subprocess should attach its own\n * no-op `.catch(() => {})` to it before returning. execa's subprocess is ITSELF a promise (via\n * `mergePromise`) that settles REJECTED on a non-zero exit or termination signal — including the\n * ordinary `SIGTERM` this transport's `terminate()` sends on every `dispose()`/`recycle()`. Since this\n * transport only ever drives the classic EventEmitter surface (never awaits/`.then()`s the child\n * itself — see this module's `spawnChild` remarks for why an unguarded `await`/`return` of a thenable\n * child is unsafe in the first place), nothing else ever attaches a rejection handler; without one, a\n * routine `terminate()` reports as an unhandled promise rejection.\n */\nexport interface IsolatedChildLike {\n /** Send a message across the IPC channel. Returns `false` (or void, depending on the implementation)\n * when the channel is closed/backed-up; this transport does not currently act on that return value. */\n send?(msg: unknown): boolean | void\n /** Subscribe to a child lifecycle/IPC event (`'message'`, `'exit'`, `'error'`). Listener param typed\n * `any[]` to structurally match node's own `ChildProcess#on` overload set (whose listener signatures\n * are themselves `(...args: any[]) => void`). */\n on(event: string, fn: (...args: any[]) => void): unknown\n /** Unsubscribe, mirroring `.on`. Optional — some resolvers may return a duck without it; this\n * transport degrades to leaking the listener rather than throwing (the process is short-lived and\n * torn down on `terminate()`/`recycle()` regardless). */\n off?(event: string, fn: (...args: any[]) => void): unknown\n /** Alias some ducks expose instead of/alongside `off`. */\n removeListener?(event: string, fn: (...args: any[]) => void): unknown\n /** Send a termination signal to the child. */\n kill(signal?: NodeJS.Signals | number): boolean | void\n /** Whether the IPC channel is currently open. Read once at connect time for a `send`-before-`connect`\n * sanity check; not polled thereafter. */\n connected?: boolean\n}\n\n/**\n * A BYO-spawner resolver — the seam for callers who need their own process manager (a pool, custom\n * stdio, a sandboxing wrapper, or a library like `execa`) instead of this module's own default\n * `fork()`. Invoked once per `connect()` (including every `recycle()`), i.e. once per guest spawn.\n *\n * @remarks\n * The resolver receives the fully-resolved {@link\n * @nhtio/adk/batteries/isolation!IsolatedServiceSpec} so it can name/label the spawned process (e.g. for\n * logging), but is otherwise free to spawn however it likes — this transport only requires the\n * returned value to satisfy {@link IsolatedChildLike}.\n *\n * A returned execa `{ ipc: true }` subprocess is itself thenable (execa mixes `.then`/`.catch`/\n * `.finally` onto it so it can double as \"the child\" and \"a promise for its exit result\"). This\n * transport's own `spawnChild` internals guard against that value being mistaken for a real `Promise`\n * and adopted (which would silently defer \"spawned\" until the child EXITS) — a resolver author does not\n * need to do anything special here, this is called out purely so the mechanism is documented in one\n * place close to where a resolver returns its child.\n */\nexport type ChildResolver = (ctx: {\n spec: IsolatedServiceSpec\n}) => IsolatedChildLike | Promise<IsolatedChildLike>\n\n/** The `{ modulePath, forkOptions? }` variant of {@link ForkIsolatedOptions} — spawns via this\n * module's own `node:child_process.fork()` call. */\nexport interface ForkIsolatedModuleOptions {\n /** Path to the guest's entry module — passed straight through to `child_process.fork()`. Must be a\n * runnable module (already bundled/transpiled if it isn't plain CommonJS/ESM node can load\n * directly — `fork()` cannot load a `.ts` file itself). */\n modulePath: string | URL\n /** Forwarded to `child_process.fork()`. Unless this sets `serialization` explicitly, this transport\n * pins `serialization: 'advanced'` — see this module's top-level remarks. */\n forkOptions?: ForkOptions\n /** Absent in this variant — mutually exclusive with `modulePath`/`forkOptions`. See {@link\n * ForkIsolatedResolverOptions} for the BYO-spawner variant. */\n spawn?: never\n}\n\n/** The `{ spawn }` variant of {@link ForkIsolatedOptions} — spawns via a caller-supplied {@link\n * ChildResolver} instead of this module's own `fork()`. */\nexport interface ForkIsolatedResolverOptions {\n /** Absent in this variant — mutually exclusive with `spawn`. See {@link ForkIsolatedModuleOptions}. */\n modulePath?: never\n /** Absent in this variant — mutually exclusive with `spawn`. See {@link ForkIsolatedModuleOptions}. */\n forkOptions?: never\n /** BYO-spawner resolver, invoked once per `connect()`/`recycle()`. See {@link ChildResolver}. */\n spawn: ChildResolver\n}\n\n/**\n * Options accepted by {@link forkIsolated}/{@link createChildProcessTransport} — extends `host.ts`'s\n * {@link @nhtio/adk/batteries/isolation!IsolatedServiceOptions} with exactly one of the two mutually\n * exclusive spawn shapes: {@link ForkIsolatedModuleOptions} (the common `fork()`-a-module case) or\n * {@link ForkIsolatedResolverOptions} (BYO spawner). Supplying both `modulePath`/`forkOptions` AND\n * `spawn` (or neither) fails eager validation with {@link\n * @nhtio/adk/batteries/isolation!E_INVALID_ISOLATION_OPTIONS}.\n */\nexport type ForkIsolatedOptions = IsolatedServiceOptions &\n (ForkIsolatedModuleOptions | ForkIsolatedResolverOptions)\n\nconst isValidationError = (value: unknown): value is ValidationError =>\n isError(value) && Array.isArray((value as ValidationError).details)\n\nconst formatValidationDetails = (err: ValidationError): string =>\n err.details.map((d) => d.message).join(' and ')\n\n/** Local (this-subpath-only) validator for the spawn-shape half of {@link ForkIsolatedOptions} — WP1's\n * shared `validation.ts` is not modified; this schema only covers the fields this module adds. */\nconst forkIsolatedSpawnShapeSchema = validator\n .object<{ modulePath?: string | URL; forkOptions?: object; spawn?: unknown }>({\n modulePath: validator\n .alternatives(\n validator.string().min(1),\n validator.custom((v, h) => (isInstanceOf(v, 'URL', URL) ? v : h.error('any.invalid')))\n )\n .optional(),\n forkOptions: validator.object().unknown(true).optional(),\n spawn: validator.function().optional(),\n })\n .unknown(true)\n .xor('modulePath', 'spawn')\n .with('forkOptions', 'modulePath')\n\n/**\n * Validate the spawn-shape half of a {@link ForkIsolatedOptions} bag: exactly one of `modulePath` /\n * `spawn` must be present, and `forkOptions` may only accompany `modulePath`.\n *\n * @throws {@link @nhtio/adk/batteries/isolation!E_INVALID_ISOLATION_OPTIONS} on failure.\n */\nconst validateForkIsolatedOptions = (input: object): void => {\n const { error } = forkIsolatedSpawnShapeSchema.validate(input, {\n abortEarly: false,\n convert: false,\n })\n if (error && isValidationError(error)) {\n throw new E_INVALID_ISOLATION_OPTIONS([formatValidationDetails(error)])\n }\n}\n\n/** Structural check for whether the current process can host a `child_process`-backed transport at\n * all (i.e. we are actually running under node, not e.g. a browser polyfill of parts of this module's\n * imports). Mirrors `serve.ts`'s guest-side duck check, but on the HOST side: node's own `process`\n * global always exposes `.pid`, which a browser/worker `globalThis.process` shim would not. */\nconst isNodeHost = (): boolean =>\n typeof globalThis.process?.pid === 'number' && typeof fork === 'function'\n\n/** Reason string threaded into `onCrash` when the child's `'exit'` fires unexpectedly (i.e. not during\n * `terminate()`/`recycle()`). */\nconst exitReason = (code: number | null, signal: NodeJS.Signals | null): string =>\n signal\n ? `child process exited via signal ${signal}`\n : `child process exited with code ${code ?? 'null'}`\n\n/**\n * Build a real {@link @nhtio/adk/batteries/isolation!IsolationTransport} over a node `child_process`\n * (or BYO-resolved) child. `connect()` spawns a fresh child every call (including every `recycle()` —\n * there is no child reuse); `terminate()` sends `SIGTERM` (or `forkOptions.killSignal`/the resolver's\n * own convention) without waiting for exit or imposing any grace period of its own (`host.ts` already\n * owns that via `disposeGraceMs`).\n *\n * @throws {@link @nhtio/adk/batteries/isolation!E_ISOLATION_UNSUPPORTED_ENV} when called outside node\n * (no `process.pid` / no `child_process.fork`).\n * @throws {@link @nhtio/adk/batteries/isolation!E_INVALID_ISOLATION_OPTIONS} when `options` fails the\n * mutual-exclusivity check documented on {@link ForkIsolatedOptions}.\n */\nexport const createChildProcessTransport = <S extends IsolatedServiceSpec>(\n spec: S,\n options: ForkIsolatedOptions\n): IsolationTransport => {\n if (!isNodeHost()) {\n throw new E_ISOLATION_UNSUPPORTED_ENV([\n 'createChildProcessTransport requires a node host (process.pid / child_process.fork unavailable) — this transport cannot run in a browser/worker environment',\n ])\n }\n validateForkIsolatedOptions(options)\n\n let child: IsolatedChildLike | undefined\n let terminating = false\n const crashListeners = new Set<(info: CrashInfo) => void>()\n let messageListener: ((msg: unknown) => void) | undefined\n let exitListener: ((code: number | null, signal: NodeJS.Signals | null) => void) | undefined\n let errorListener: ((err: Error) => void) | undefined\n\n const detachChildListeners = (): void => {\n if (!child) return\n const off = (event: string, fn: ((...a: never[]) => void) | undefined): void => {\n if (!fn) return\n if (child!.off) child!.off(event, fn as never)\n else if (child!.removeListener) child!.removeListener(event, fn as never)\n }\n off('message', messageListener as never)\n off('exit', exitListener as never)\n off('error', errorListener as never)\n messageListener = undefined\n exitListener = undefined\n errorListener = undefined\n }\n\n // Deliberately NOT an `async function`, and deliberately returns a BOXED `{ child }` wrapper rather\n // than the child itself. A resolver-supplied child (e.g. an execa `{ ipc: true }` subprocess) is\n // ITSELF thenable — execa's `mergePromise` mixes `.then`/`.catch`/`.finally` onto the subprocess\n // object so `execa(...)`'s return value can be both \"the child\" and \"awaited for its exit result\".\n // `return`ing (or `await`ing) that value directly from inside an `async function` triggers the\n // language's thenable-ADOPTION rule: the engine treats the returned/awaited thenable as a real\n // Promise and defers settling until IT resolves — which for an execa subprocess is when the CHILD\n // PROCESS EXITS, not when it spawns. That silently turns \"spawn a child\" into \"wait for the child to\n // exit\", hanging every caller of `connect()` for the child's entire lifetime. Empirically confirmed:\n // an `async spawnChild` doing `return options.spawn({ spec })` hangs even when the resolver itself is\n // a plain (non-async) function — the adoption happens at `spawnChild`'s own `return`, not the\n // resolver's. Boxing the child inside a fresh plain object (which has no `.then` of its own) before\n // it ever crosses a `return`/`await` boundary avoids triggering adoption anywhere in the chain.\n const spawnChild = (): Promise<{ child: IsolatedChildLike }> => {\n if ('spawn' in options && options.spawn) {\n const maybe = options.spawn({ spec })\n // A genuine `Promise` (the resolver itself is async/needs to await setup) must still be awaited;\n // a resolver-returned execa subprocess is thenable-DUCK (see this function's remarks) but is not\n // actually `instanceof Promise`, so this check correctly tells the two apart without adopting the\n // duck.\n return isInstanceOf(maybe, 'Promise', Promise)\n ? maybe.then((resolvedChild) => ({ child: resolvedChild }))\n : Promise.resolve({ child: maybe })\n }\n const forkOptions = options.forkOptions ?? {}\n const resolvedForkOptions: ForkOptions =\n forkOptions.serialization !== undefined\n ? forkOptions\n : { ...forkOptions, serialization: 'advanced' }\n return Promise.resolve({ child: fork(options.modulePath!, resolvedForkOptions) })\n }\n\n const connect = async (): Promise<PortLike> => {\n terminating = false\n const { child: spawned } = await spawnChild()\n child = spawned\n\n const port: PortLike = {\n post: (msg) => {\n spawned.send?.(msg)\n },\n onMessage: (fn) => {\n const listener = (msg: unknown): void => fn(msg)\n messageListener = listener\n spawned.on('message', listener as never)\n return () => {\n if (spawned.off) spawned.off('message', listener as never)\n else if (spawned.removeListener) spawned.removeListener('message', listener as never)\n }\n },\n }\n\n exitListener = (code, signal) => {\n if (terminating) return\n const info: CrashInfo = { reason: exitReason(code, signal), code: code ?? null, signal }\n for (const fn of crashListeners) fn(info)\n }\n errorListener = (err) => {\n if (terminating) return\n const info: CrashInfo = { reason: err.message, code: null, signal: null }\n for (const fn of crashListeners) fn(info)\n }\n spawned.on('exit', exitListener as never)\n spawned.on('error', errorListener as never)\n\n return port\n }\n\n const terminate = (): void => {\n terminating = true\n detachChildListeners()\n if (child) {\n const signal = ('forkOptions' in options && options.forkOptions?.killSignal) || 'SIGTERM'\n child.kill(signal as NodeJS.Signals)\n }\n child = undefined\n }\n\n return {\n connect,\n terminate,\n onCrash: (fn) => {\n crashListeners.add(fn)\n return () => crashListeners.delete(fn)\n },\n }\n}\n\n/**\n * Sugar over {@link createChildProcessTransport} + {@link\n * @nhtio/adk/batteries/isolation!createIsolatedService} — the one-call entry point most callers want:\n * fork a guest module (or BYO-spawn one) and get back a ready-to-use {@link\n * @nhtio/adk/batteries/isolation!IsolatedService}.\n *\n * @throws {@link @nhtio/adk/batteries/isolation!E_ISOLATION_UNSUPPORTED_ENV} when called outside node.\n * @throws {@link @nhtio/adk/batteries/isolation!E_INVALID_ISOLATION_OPTIONS} when `options` fails the\n * mutual-exclusivity check documented on {@link ForkIsolatedOptions}, or when `createIsolatedService`'s\n * own option validation fails.\n */\nexport const forkIsolated = <S extends IsolatedServiceSpec>(\n spec: S,\n options: ForkIsolatedOptions\n): IsolatedService<S> => {\n const transport = createChildProcessTransport(spec, options)\n // `options` also carries this subpath's own spawn-shape fields (`modulePath`/`forkOptions`/`spawn`),\n // which `createIsolatedService` must never see — `host.ts` validates its options bag against WP1's\n // `isolatedServiceOptionsSchema` with `.unknown(false)`, so passing the raw bag through would fail\n // eager validation on fields that schema (correctly) doesn't know about. Strip them here rather than\n // loosen WP1's shared schema.\n const spawnShapeKeys = new Set(['modulePath', 'forkOptions', 'spawn'])\n const hostOptions = Object.fromEntries(\n Object.entries(options).filter(([key]) => !spawnShapeKeys.has(key))\n ) as IsolatedServiceOptions\n return createIsolatedService(spec, transport, hostOptions)\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"child_process.mjs","names":[],"sources":["../../../src/batteries/isolation/child_process/transport.ts"],"sourcesContent":["/**\n * Node `child_process`-backed {@link @nhtio/adk/batteries/isolation!IsolationTransport} — forks (or\n * BYO-spawns) a guest process and wraps its IPC channel in the `PortLike` duck the wire protocol is\n * built over.\n *\n * @remarks\n * This module is NODE-ONLY: it imports `node:child_process` directly (unlike `serve.ts`'s guest-side\n * duck detection, which never imports `node:*` so it stays loadable in a Worker/browser bundle). See\n * this subpath's `index.ts` for why a real process — rather than a `worker_threads` `Worker` — is the\n * right host-side primitive for the Node transport.\n *\n * Two ways to obtain the child:\n *\n * - `{ modulePath, forkOptions? }` — the common case. Calls node's own `child_process.fork(modulePath,\n * forkOptions)`. Unless the caller's `forkOptions` explicitly sets `serialization`, this pins\n * `serialization: 'advanced'` (V8's structured-clone algorithm over the IPC channel) rather than\n * node's default `'json'`. This matters because `codec.ts` treats `TypedArray`/`ArrayBuffer`/\n * `DataView`/`Date`/`RegExp`/`Map`/`Set` as OPAQUE traversal leaves that ship **raw**, trusting the\n * transport to carry them faithfully — under default JSON serialization a `Float32Array` argument\n * would silently degrade to a plain `{0: ..., 1: ...}` object on arrival (empirically confirmed: a\n * `fork()` with no `serialization` override loses `instanceof Float32Array` across the wire). If a\n * caller forces `forkOptions: { serialization: 'json' }` anyway, tier-0 (`raw`) round-trips are\n * restricted to JSON-safe values for THOSE exotic containers; the codec's auto-escalation to tier-1/2\n * still carries functions/Errors/custom-encodables correctly (just paying the `@nhtio/encoder`\n * encode/decode cost) — only raw-tier TypedArray/Map/Set/Date/RegExp fidelity is at risk, and only\n * when the caller opted out of the default explicitly.\n * - `{ spawn }` — a {@link ChildResolver} BYO-spawner seam for callers who need their own process\n * manager (pooling, custom stdio wiring, sandboxing) or who spawn via a wrapper library instead of\n * `fork()` directly. The resolver must return (or resolve to) an {@link IsolatedChildLike} — see that\n * type's doc for the exact surface this module was empirically verified against, including execa≥9.\n *\n * These two forms are mutually exclusive and validated eagerly (this subpath's own local joi schema —\n * the shared `validation.ts` is not touched).\n *\n * `terminate()` sends `SIGTERM` (or the caller's configured signal) and does NOT itself wait for exit\n * or run any grace period of its own — `host.ts`'s `dispose()` already sends a `shutdown` envelope and\n * waits `disposeGraceMs` for the guest to exit voluntarily before calling `transport.terminate()`\n * unconditionally; duplicating a grace window here would just double it. An `'exit'` that fires while\n * `terminate()`/`recycle()` is in progress is expected and never reported as a crash; any other exit\n * (including a non-zero code, e.g. `process.exit(7)` in the guest) or an `'error'` event on the child\n * fires {@link @nhtio/adk/batteries/isolation!IsolationTransport.onCrash}. `recycle()` (driven by\n * `host.ts`, not implemented in this module) re-enters this same transport's `connect()`, which forks\n * (or re-invokes the resolver) a brand-new child every time — there is no child reuse across recycles.\n */\n\nimport { fork } from 'node:child_process'\nimport { isError, isInstanceOf } from '@nhtio/adk/guards'\nimport { validator, ValidationError } from '@nhtio/validation'\nimport {\n createIsolatedService,\n E_INVALID_ISOLATION_OPTIONS,\n E_ISOLATION_UNSUPPORTED_ENV,\n} from '@nhtio/adk/batteries/isolation'\nimport type { ForkOptions } from 'node:child_process'\nimport type {\n CrashInfo,\n IsolatedService,\n IsolatedServiceOptions,\n IsolatedServiceSpec,\n IsolationTransport,\n PortLike,\n} from '@nhtio/adk/batteries/isolation'\n\n/**\n * The minimal Node `ChildProcess`-shaped duck this transport drives. Structurally satisfied by BOTH:\n *\n * - the object returned by `node:child_process`'s own `fork()`, and\n * - an `execa`≥9 subprocess spawned with `{ ipc: true }` — empirically verified: execa's\n * `Subprocess<OptionsType>` type is `Omit<ChildProcess, keyof ExecaCustomSubprocess<OptionsType>> &\n * ExecaCustomSubprocess<OptionsType>`, i.e. it keeps the classic Node `ChildProcess` EventEmitter\n * surface (`.send()`, `.on('message'|'exit'|'error', ...)`, `.kill()`, `.connected`) alongside\n * execa's own promise-based `sendMessage()`/`getEachMessage()` API. This transport only ever uses the\n * classic EventEmitter surface, so an execa `{ ipc: true }` subprocess satisfies this duck WITHOUT\n * any adapter.\n *\n * execa's channel, like node's own `fork()`, defaults to JSON-style serialization unless the\n * subprocess is spawned with `serialization: 'advanced'` (execa forwards that option straight to the\n * underlying `child_process.fork()` it uses internally for `ipc: true`) — the same \"pin `advanced` for\n * exotic-value fidelity\" requirement documented on {@link ForkIsolatedOptions} applies whether the\n * child came from this module's own `fork()` call or from a caller-supplied {@link ChildResolver}.\n *\n * @remarks\n * A {@link ChildResolver} must NOT itself attach a `'message'` listener to the child it returns before\n * handing it back to this transport (e.g. for logging). Node buffers a child's `message`/`ipc` events\n * until the FIRST listener is attached, then flushes the whole buffer to that one listener exactly\n * once — a resolver-side listener attached first (even just to log) permanently steals the buffered\n * `ready` envelope from `connect()`'s own listener, which then waits out `readyTimeoutMs` for a `ready`\n * that already came and went. execa's `Subprocess` additionally proxies raw child events through its\n * own internal debounced `message` re-emitter (see execa's `lib/ipc/forward.js`), so this applies to\n * execa subprocesses too — empirically confirmed by instrumenting a resolver with a diagnostic\n * `subprocess.on('message', ...)` and observing the resulting connection hang.\n *\n * A {@link ChildResolver} that returns an execa `{ ipc: true }` subprocess should attach its own\n * no-op `.catch(() => {})` to it before returning. execa's subprocess is ITSELF a promise (via\n * `mergePromise`) that settles REJECTED on a non-zero exit or termination signal — including the\n * ordinary `SIGTERM` this transport's `terminate()` sends on every `dispose()`/`recycle()`. Since this\n * transport only ever drives the classic EventEmitter surface (never awaits/`.then()`s the child\n * itself — see this module's `spawnChild` remarks for why an unguarded `await`/`return` of a thenable\n * child is unsafe in the first place), nothing else ever attaches a rejection handler; without one, a\n * routine `terminate()` reports as an unhandled promise rejection.\n */\nexport interface IsolatedChildLike {\n /** Send a message across the IPC channel. Returns `false` (or void, depending on the implementation)\n * when the channel is closed/backed-up; this transport does not currently act on that return value. */\n send?(msg: unknown): boolean | void\n /** Subscribe to a child lifecycle/IPC event (`'message'`, `'exit'`, `'error'`). Listener param typed\n * `any[]` to structurally match node's own `ChildProcess#on` overload set (whose listener signatures\n * are themselves `(...args: any[]) => void`). */\n on(event: string, fn: (...args: any[]) => void): unknown\n /** Unsubscribe, mirroring `.on`. Optional — some resolvers may return a duck without it; this\n * transport degrades to leaking the listener rather than throwing (the process is short-lived and\n * torn down on `terminate()`/`recycle()` regardless). */\n off?(event: string, fn: (...args: any[]) => void): unknown\n /** Alias some ducks expose instead of/alongside `off`. */\n removeListener?(event: string, fn: (...args: any[]) => void): unknown\n /** Send a termination signal to the child. */\n kill(signal?: NodeJS.Signals | number): boolean | void\n /** Whether the IPC channel is currently open. Read once at connect time for a `send`-before-`connect`\n * sanity check; not polled thereafter. */\n connected?: boolean\n}\n\n/**\n * A BYO-spawner resolver — the seam for callers who need their own process manager (a pool, custom\n * stdio, a sandboxing wrapper, or a library like `execa`) instead of this module's own default\n * `fork()`. Invoked once per `connect()` (including every `recycle()`), i.e. once per guest spawn.\n *\n * @remarks\n * The resolver receives the fully-resolved {@link\n * @nhtio/adk/batteries/isolation!IsolatedServiceSpec} so it can name/label the spawned process (e.g. for\n * logging), but is otherwise free to spawn however it likes — this transport only requires the\n * returned value to satisfy {@link IsolatedChildLike}.\n *\n * A returned execa `{ ipc: true }` subprocess is itself thenable (execa mixes `.then`/`.catch`/\n * `.finally` onto it so it can double as \"the child\" and \"a promise for its exit result\"). This\n * transport's own `spawnChild` internals guard against that value being mistaken for a real `Promise`\n * and adopted (which would silently defer \"spawned\" until the child EXITS) — a resolver author does not\n * need to do anything special here, this is called out purely so the mechanism is documented in one\n * place close to where a resolver returns its child.\n */\nexport type ChildResolver = (ctx: {\n spec: IsolatedServiceSpec\n}) => IsolatedChildLike | Promise<IsolatedChildLike>\n\n/** The `{ modulePath, forkOptions? }` variant of {@link ForkIsolatedOptions} — spawns via this\n * module's own `node:child_process.fork()` call. */\nexport interface ForkIsolatedModuleOptions {\n /** Path to the guest's entry module — passed straight through to `child_process.fork()`. Must be a\n * runnable module (already bundled/transpiled if it isn't plain CommonJS/ESM node can load\n * directly — `fork()` cannot load a `.ts` file itself). */\n modulePath: string | URL\n /** Forwarded to `child_process.fork()`. Unless this sets `serialization` explicitly, this transport\n * pins `serialization: 'advanced'` — see this module's top-level remarks. */\n forkOptions?: ForkOptions\n /** Absent in this variant — mutually exclusive with `modulePath`/`forkOptions`. See {@link\n * ForkIsolatedResolverOptions} for the BYO-spawner variant. */\n spawn?: never\n}\n\n/** The `{ spawn }` variant of {@link ForkIsolatedOptions} — spawns via a caller-supplied {@link\n * ChildResolver} instead of this module's own `fork()`. */\nexport interface ForkIsolatedResolverOptions {\n /** Absent in this variant — mutually exclusive with `spawn`. See {@link ForkIsolatedModuleOptions}. */\n modulePath?: never\n /** Absent in this variant — mutually exclusive with `spawn`. See {@link ForkIsolatedModuleOptions}. */\n forkOptions?: never\n /** BYO-spawner resolver, invoked once per `connect()`/`recycle()`. See {@link ChildResolver}. */\n spawn: ChildResolver\n}\n\n/**\n * Options accepted by {@link forkIsolated}/{@link createChildProcessTransport} — extends `host.ts`'s\n * {@link @nhtio/adk/batteries/isolation!IsolatedServiceOptions} with exactly one of the two mutually\n * exclusive spawn shapes: {@link ForkIsolatedModuleOptions} (the common `fork()`-a-module case) or\n * {@link ForkIsolatedResolverOptions} (BYO spawner). Supplying both `modulePath`/`forkOptions` AND\n * `spawn` (or neither) fails eager validation with {@link\n * @nhtio/adk/batteries/isolation!E_INVALID_ISOLATION_OPTIONS}.\n */\nexport type ForkIsolatedOptions = IsolatedServiceOptions &\n (ForkIsolatedModuleOptions | ForkIsolatedResolverOptions)\n\nconst isValidationError = (value: unknown): value is ValidationError =>\n isError(value) && Array.isArray((value as ValidationError).details)\n\nconst formatValidationDetails = (err: ValidationError): string =>\n err.details.map((d) => d.message).join(' and ')\n\n/** Local (this-subpath-only) validator for the spawn-shape half of {@link ForkIsolatedOptions} — the\n * shared `validation.ts` is not modified; this schema only covers the fields this module adds. */\nconst forkIsolatedSpawnShapeSchema = validator\n .object<{ modulePath?: string | URL; forkOptions?: object; spawn?: unknown }>({\n modulePath: validator\n .alternatives(\n validator.string().min(1),\n validator.custom((v, h) => (isInstanceOf(v, 'URL', URL) ? v : h.error('any.invalid')))\n )\n .optional(),\n forkOptions: validator.object().unknown(true).optional(),\n spawn: validator.function().optional(),\n })\n .unknown(true)\n .xor('modulePath', 'spawn')\n .with('forkOptions', 'modulePath')\n\n/**\n * Validate the spawn-shape half of a {@link ForkIsolatedOptions} bag: exactly one of `modulePath` /\n * `spawn` must be present, and `forkOptions` may only accompany `modulePath`.\n *\n * @throws {@link @nhtio/adk/batteries/isolation!E_INVALID_ISOLATION_OPTIONS} on failure.\n */\nconst validateForkIsolatedOptions = (input: object): void => {\n const { error } = forkIsolatedSpawnShapeSchema.validate(input, {\n abortEarly: false,\n convert: false,\n })\n if (error && isValidationError(error)) {\n throw new E_INVALID_ISOLATION_OPTIONS([formatValidationDetails(error)])\n }\n}\n\n/** Structural check for whether the current process can host a `child_process`-backed transport at\n * all (i.e. we are actually running under node, not e.g. a browser polyfill of parts of this module's\n * imports). Mirrors `serve.ts`'s guest-side duck check, but on the HOST side: node's own `process`\n * global always exposes `.pid`, which a browser/worker `globalThis.process` shim would not. */\nconst isNodeHost = (): boolean =>\n typeof globalThis.process?.pid === 'number' && typeof fork === 'function'\n\n/** Reason string threaded into `onCrash` when the child's `'exit'` fires unexpectedly (i.e. not during\n * `terminate()`/`recycle()`). */\nconst exitReason = (code: number | null, signal: NodeJS.Signals | null): string =>\n signal\n ? `child process exited via signal ${signal}`\n : `child process exited with code ${code ?? 'null'}`\n\n/**\n * Build a real {@link @nhtio/adk/batteries/isolation!IsolationTransport} over a node `child_process`\n * (or BYO-resolved) child. `connect()` spawns a fresh child every call (including every `recycle()` —\n * there is no child reuse); `terminate()` sends `SIGTERM` (or `forkOptions.killSignal`/the resolver's\n * own convention) without waiting for exit or imposing any grace period of its own (`host.ts` already\n * owns that via `disposeGraceMs`).\n *\n * @throws {@link @nhtio/adk/batteries/isolation!E_ISOLATION_UNSUPPORTED_ENV} when called outside node\n * (no `process.pid` / no `child_process.fork`).\n * @throws {@link @nhtio/adk/batteries/isolation!E_INVALID_ISOLATION_OPTIONS} when `options` fails the\n * mutual-exclusivity check documented on {@link ForkIsolatedOptions}.\n */\nexport const createChildProcessTransport = <S extends IsolatedServiceSpec>(\n spec: S,\n options: ForkIsolatedOptions\n): IsolationTransport => {\n if (!isNodeHost()) {\n throw new E_ISOLATION_UNSUPPORTED_ENV([\n 'createChildProcessTransport requires a node host (process.pid / child_process.fork unavailable) — this transport cannot run in a browser/worker environment',\n ])\n }\n validateForkIsolatedOptions(options)\n\n let child: IsolatedChildLike | undefined\n let terminating = false\n const crashListeners = new Set<(info: CrashInfo) => void>()\n let messageListener: ((msg: unknown) => void) | undefined\n let exitListener: ((code: number | null, signal: NodeJS.Signals | null) => void) | undefined\n let errorListener: ((err: Error) => void) | undefined\n\n const detachChildListeners = (): void => {\n if (!child) return\n const off = (event: string, fn: ((...a: never[]) => void) | undefined): void => {\n if (!fn) return\n if (child!.off) child!.off(event, fn as never)\n else if (child!.removeListener) child!.removeListener(event, fn as never)\n }\n off('message', messageListener as never)\n off('exit', exitListener as never)\n off('error', errorListener as never)\n messageListener = undefined\n exitListener = undefined\n errorListener = undefined\n }\n\n // Deliberately NOT an `async function`, and deliberately returns a BOXED `{ child }` wrapper rather\n // than the child itself. A resolver-supplied child (e.g. an execa `{ ipc: true }` subprocess) is\n // ITSELF thenable — execa's `mergePromise` mixes `.then`/`.catch`/`.finally` onto the subprocess\n // object so `execa(...)`'s return value can be both \"the child\" and \"awaited for its exit result\".\n // `return`ing (or `await`ing) that value directly from inside an `async function` triggers the\n // language's thenable-ADOPTION rule: the engine treats the returned/awaited thenable as a real\n // Promise and defers settling until IT resolves — which for an execa subprocess is when the CHILD\n // PROCESS EXITS, not when it spawns. That silently turns \"spawn a child\" into \"wait for the child to\n // exit\", hanging every caller of `connect()` for the child's entire lifetime. Empirically confirmed:\n // an `async spawnChild` doing `return options.spawn({ spec })` hangs even when the resolver itself is\n // a plain (non-async) function — the adoption happens at `spawnChild`'s own `return`, not the\n // resolver's. Boxing the child inside a fresh plain object (which has no `.then` of its own) before\n // it ever crosses a `return`/`await` boundary avoids triggering adoption anywhere in the chain.\n const spawnChild = (): Promise<{ child: IsolatedChildLike }> => {\n if ('spawn' in options && options.spawn) {\n const maybe = options.spawn({ spec })\n // A genuine `Promise` (the resolver itself is async/needs to await setup) must still be awaited;\n // a resolver-returned execa subprocess is thenable-DUCK (see this function's remarks) but is not\n // actually `instanceof Promise`, so this check correctly tells the two apart without adopting the\n // duck.\n return isInstanceOf(maybe, 'Promise', Promise)\n ? maybe.then((resolvedChild) => ({ child: resolvedChild }))\n : Promise.resolve({ child: maybe })\n }\n const forkOptions = options.forkOptions ?? {}\n const resolvedForkOptions: ForkOptions =\n forkOptions.serialization !== undefined\n ? forkOptions\n : { ...forkOptions, serialization: 'advanced' }\n return Promise.resolve({ child: fork(options.modulePath!, resolvedForkOptions) })\n }\n\n const connect = async (): Promise<PortLike> => {\n terminating = false\n const { child: spawned } = await spawnChild()\n child = spawned\n\n const port: PortLike = {\n post: (msg) => {\n spawned.send?.(msg)\n },\n onMessage: (fn) => {\n const listener = (msg: unknown): void => fn(msg)\n messageListener = listener\n spawned.on('message', listener as never)\n return () => {\n if (spawned.off) spawned.off('message', listener as never)\n else if (spawned.removeListener) spawned.removeListener('message', listener as never)\n }\n },\n }\n\n exitListener = (code, signal) => {\n if (terminating) return\n const info: CrashInfo = { reason: exitReason(code, signal), code: code ?? null, signal }\n for (const fn of crashListeners) fn(info)\n }\n errorListener = (err) => {\n if (terminating) return\n const info: CrashInfo = { reason: err.message, code: null, signal: null }\n for (const fn of crashListeners) fn(info)\n }\n spawned.on('exit', exitListener as never)\n spawned.on('error', errorListener as never)\n\n return port\n }\n\n const terminate = (): void => {\n terminating = true\n detachChildListeners()\n if (child) {\n const signal = ('forkOptions' in options && options.forkOptions?.killSignal) || 'SIGTERM'\n child.kill(signal as NodeJS.Signals)\n }\n child = undefined\n }\n\n return {\n connect,\n terminate,\n onCrash: (fn) => {\n crashListeners.add(fn)\n return () => crashListeners.delete(fn)\n },\n }\n}\n\n/**\n * Sugar over {@link createChildProcessTransport} + {@link\n * @nhtio/adk/batteries/isolation!createIsolatedService} — the one-call entry point most callers want:\n * fork a guest module (or BYO-spawn one) and get back a ready-to-use {@link\n * @nhtio/adk/batteries/isolation!IsolatedService}.\n *\n * @throws {@link @nhtio/adk/batteries/isolation!E_ISOLATION_UNSUPPORTED_ENV} when called outside node.\n * @throws {@link @nhtio/adk/batteries/isolation!E_INVALID_ISOLATION_OPTIONS} when `options` fails the\n * mutual-exclusivity check documented on {@link ForkIsolatedOptions}, or when `createIsolatedService`'s\n * own option validation fails.\n */\nexport const forkIsolated = <S extends IsolatedServiceSpec>(\n spec: S,\n options: ForkIsolatedOptions\n): IsolatedService<S> => {\n const transport = createChildProcessTransport(spec, options)\n // `options` also carries this subpath's own spawn-shape fields (`modulePath`/`forkOptions`/`spawn`),\n // which `createIsolatedService` must never see — `host.ts` validates its options bag against the shared\n // `isolatedServiceOptionsSchema` with `.unknown(false)`, so passing the raw bag through would fail\n // eager validation on fields that schema (correctly) doesn't know about. Strip them here rather than\n // loosen the shared schema.\n const spawnShapeKeys = new Set(['modulePath', 'forkOptions', 'spawn'])\n const hostOptions = Object.fromEntries(\n Object.entries(options).filter(([key]) => !spawnShapeKeys.has(key))\n ) as IsolatedServiceOptions\n return createIsolatedService(spec, transport, hostOptions)\n}\n"],"mappings":"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"}
@@ -51,10 +51,10 @@ export interface EncoderModule {
51
51
  /** Whether the encoder peer is currently available. Used to populate `ready.encoderAvailable`. */
52
52
  export declare const isEncoderAvailable: () => Promise<boolean>;
53
53
  /**
54
- * Mark `value` for transfer (rather than clone) across a `postMessage`-based transport — WP2's browser
54
+ * Mark `value` for transfer (rather than clone) across a `postMessage`-based transport — the Web Worker
55
55
  * transport unwraps this into the message's transfer list. The codec passes marked values through as
56
56
  * `raw` with `transferables` preserved on the {@link WireValue} envelope's `transfer` field. Node
57
- * transports (WP3) ignore the marker entirely (structured-clone/pipe semantics don't have a transfer
57
+ * transports ignore the marker entirely (structured-clone/pipe semantics don't have a transfer
58
58
  * list), so `transfer()` is safe to use in transport-agnostic code that may run over either.
59
59
  */
60
60
  export declare const transfer: <T>(value: T, transferables: unknown[]) => T;
@@ -6,7 +6,7 @@
6
6
  * (`docs/.vitepress/theme/components/agent/gpu_loss_policy.ts`) — a 2-rung ladder specific to WebGPU
7
7
  * device loss — into a domain-neutral N-rung decider any `IsolationTransport` crash can consult. Pure
8
8
  * (no DOM/process access beyond the injected clock), so it is unit-testable in isolation and reusable
9
- * across the Worker (WP2) and child_process (WP3) transports without either depending on the other's
9
+ * across the Web Worker and child_process transports without either depending on the other's
10
10
  * crash semantics.
11
11
  *
12
12
  * This module has zero imports beyond the language itself.
@@ -5,7 +5,7 @@
5
5
  * @remarks
6
6
  * **This is a `new Function`-based eval trust surface. Read this before using it.**
7
7
  *
8
- * Every other seam in this battery (`spawnIsolated`/`serveIsolated`/WP3's node backend) runs a guest
8
+ * Every other seam in this battery (`spawnIsolated`/`serveIsolated`/the Node child_process backend) runs a guest
9
9
  * script the CALLER wrote, deployed, and controls the provenance of. `isolateFunction` is the opposite:
10
10
  * it takes an in-memory function VALUE, serializes it via `fn.toString()` (through
11
11
  * `@nhtio/encoder/function_serializer`'s `FunctionSerializer.dehydrate`), embeds that source text
@@ -34,7 +34,7 @@
34
34
  * false; error: { message: string; name: string; stack?: string } }` — hand-rolled inline in the Blob
35
35
  * source (no `codec.ts` import there either), but shaped compatibly with `protocol.ts`'s `WireValue`/
36
36
  * `WireError` so the HOST side can decode results via the SAME {@link decodeArgument}/`fromWireError`
37
- * helpers WP1 already defines, rather than a third, bespoke decode path.
37
+ * helpers the shared isolation protocol already defines, rather than a third, bespoke decode path.
38
38
  *
39
39
  * `dispose()` terminates the Worker and revokes the Blob URL; every in-flight `invoke()` call, and every
40
40
  * call made afterward, rejects with {@link @nhtio/adk/batteries/isolation!E_ISOLATED_TERMINATED}. An
@@ -8,8 +8,8 @@
8
8
  * `litert_lm_worker.ts` (id-correlated one-shot calls, a persistent stream-sink map fed by unsolicited
9
9
  * events, string-only error crossing) into a reusable, method/stream/event-name-generic core. Both
10
10
  * endpoint classes are PURE over {@link PortLike} — no `Worker`/`postMessage`/`process.send` reference
11
- * anywhere in this module; WP2/WP3 supply concrete `PortLike` adapters, WP1 exercises this file only
12
- * against linked in-memory fake ports (see the unit specs).
11
+ * anywhere in this module; the browser and Node transports supply concrete `PortLike` adapters, while
12
+ * this file is exercised only against linked in-memory fake ports (see the unit specs).
13
13
  *
14
14
  * `HostEndpoint` queues every outbound call/stream-start made before the guest's `ready` envelope
15
15
  * arrives, then flushes the queue in order once it does. `GuestEndpoint` requires no such queueing (it
@@ -19,8 +19,8 @@ import type { PortLike } from "./types";
19
19
  /**
20
20
  * A single argument/result value as it crosses the wire — the codec's (`codec.ts`) output shape. `enc:
21
21
  * 'raw'` ships the value (mostly) untouched; `enc: 'nhtio'` ships an `@nhtio/encoder`-encoded string
22
- * (or a BYO-codec-encoded string). `transfer` is a pass-through marker WP2's browser transport unwraps
23
- * into a `postMessage` transfer list; node transports ignore it.
22
+ * (or a BYO-codec-encoded string). `transfer` is a pass-through marker the browser transport unwraps into a `postMessage` transfer list;
23
+ * Node transports ignore it.
24
24
  */
25
25
  export type WireValue = {
26
26
  enc: 'raw';
@@ -6,8 +6,8 @@
6
6
  * @remarks
7
7
  * `serveIsolatedOverPort` is the environment-neutral primitive: it takes an already-constructed
8
8
  * {@link PortLike}, so it works identically whether that port wraps a Web Worker's global scope, a
9
- * node `process`, or (as in every WP1 unit spec) a linked in-memory fake port. `serveIsolated` is the
10
- * convenience wrapper WP2/WP3 guest entry points call directly: it duck-detects the environment
9
+ * node `process`, or (as in the shared protocol's unit specs) a linked in-memory fake port. `serveIsolated` is the
10
+ * convenience wrapper the browser and Node guest entry points call directly: it duck-detects the environment
11
11
  * (`globalThis.self.postMessage` → Worker; `globalThis.process?.send` → child_process) and builds the
12
12
  * matching `PortLike` itself — WITHOUT importing any `node:*` module (a plain `globalThis.process` duck
13
13
  * check, never `import 'node:...'`), keeping this module loadable in every environment.
@@ -239,8 +239,8 @@ export type IsolatedEventListener<S extends IsolatedServiceSpec, K extends keyof
239
239
  * The minimal message-passing duck the wire protocol (`protocol.ts`) is built over. A `Worker` /
240
240
  * `MessagePort` (`post` = `postMessage`, `onMessage` wraps `addEventListener('message', ...)`) and a
241
241
  * Node `ChildProcess` / `process` (`post` = `.send`, `onMessage` wraps `.on('message', ...)`) both
242
- * satisfy this structurally — WP1 exercises it only against linked in-memory fake ports; WP2/WP3 wire
243
- * it to the real transports.
242
+ * satisfy this structurally — the shared protocol is exercised against linked in-memory fake ports; the
243
+ * browser and Node transports wire it to the real transports.
244
244
  */
245
245
  export interface PortLike {
246
246
  /** Send a message across the port. Fire-and-forget — no delivery confirmation at this layer. */
@@ -258,8 +258,8 @@ export interface CrashInfo {
258
258
  signal?: string | null;
259
259
  }
260
260
  /**
261
- * The environment-specific spawn/lifecycle duck a host-side transport implements — WP2 (Web Worker)
262
- * and WP3 (node child_process) each provide one; `createIsolatedService` (host.ts) drives only this
261
+ * The environment-specific spawn/lifecycle duck a host-side transport implements — the Web Worker
262
+ * and Node child_process transports each provide one; `createIsolatedService` (host.ts) drives only this
263
263
  * interface, never a concrete Worker/ChildProcess type.
264
264
  */
265
265
  export interface IsolationTransport {
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../chunk-Cek0wNdY.js");
3
- const require_isolation = require("../isolation-BQCTQYZ_.js");
3
+ const require_isolation = require("../isolation-7Jrcucgc.js");
4
4
  exports.DEFAULT_CRASH_POLICY_MAX_CRASHES = require_isolation.DEFAULT_CRASH_POLICY_MAX_CRASHES;
5
5
  exports.DEFAULT_CRASH_POLICY_WINDOW_MS = require_isolation.DEFAULT_CRASH_POLICY_WINDOW_MS;
6
6
  exports.E_INVALID_ISOLATION_OPTIONS = require_isolation.E_INVALID_ISOLATION_OPTIONS;
@@ -1,2 +1,2 @@
1
- import { A as event, C as E_INVALID_ISOLATION_OPTIONS, D as E_ISOLATION_READY_TIMEOUT, E as E_ISOLATION_ENCODER_REQUIRED, M as resolveIsolatedServiceSpec, N as stream, O as E_ISOLATION_UNENCODABLE, S as defineIsolatedServiceValidated, T as E_ISOLATED_TERMINATED, _ as transfer, a as createWorkerTransport, b as nextCorrelationId, c as serveIsolated, d as hasIsolationHook, f as DEFAULT_CRASH_POLICY_MAX_CRASHES, g as registerEncodableClasses, h as isEncoderAvailable, i as isolateFunction, j as method, k as E_ISOLATION_UNSUPPORTED_ENV, l as serveIsolatedOverPort, m as createCrashPolicy, n as E_ISOLATE_FUNCTION_REQUIRES_SOURCE_REHYDRATION, o as spawnIsolated, p as DEFAULT_CRASH_POLICY_WINDOW_MS, r as E_ISOLATE_FUNCTION_UNSERIALIZABLE, s as createIsolatedService, t as E_ISOLATE_FUNCTION_ARG_UNSUPPORTED, u as emitIsolationReport, v as GuestEndpoint, w as E_ISOLATED_CRASHED, x as wireErrorToError, y as HostEndpoint } from "../isolation-7xbkc12r.mjs";
1
+ import { A as event, C as E_INVALID_ISOLATION_OPTIONS, D as E_ISOLATION_READY_TIMEOUT, E as E_ISOLATION_ENCODER_REQUIRED, M as resolveIsolatedServiceSpec, N as stream, O as E_ISOLATION_UNENCODABLE, S as defineIsolatedServiceValidated, T as E_ISOLATED_TERMINATED, _ as transfer, a as createWorkerTransport, b as nextCorrelationId, c as serveIsolated, d as hasIsolationHook, f as DEFAULT_CRASH_POLICY_MAX_CRASHES, g as registerEncodableClasses, h as isEncoderAvailable, i as isolateFunction, j as method, k as E_ISOLATION_UNSUPPORTED_ENV, l as serveIsolatedOverPort, m as createCrashPolicy, n as E_ISOLATE_FUNCTION_REQUIRES_SOURCE_REHYDRATION, o as spawnIsolated, p as DEFAULT_CRASH_POLICY_WINDOW_MS, r as E_ISOLATE_FUNCTION_UNSERIALIZABLE, s as createIsolatedService, t as E_ISOLATE_FUNCTION_ARG_UNSUPPORTED, u as emitIsolationReport, v as GuestEndpoint, w as E_ISOLATED_CRASHED, x as wireErrorToError, y as HostEndpoint } from "../isolation-CO0NiK8R.mjs";
2
2
  export { DEFAULT_CRASH_POLICY_MAX_CRASHES, DEFAULT_CRASH_POLICY_WINDOW_MS, E_INVALID_ISOLATION_OPTIONS, E_ISOLATED_CRASHED, E_ISOLATED_TERMINATED, E_ISOLATE_FUNCTION_ARG_UNSUPPORTED, E_ISOLATE_FUNCTION_REQUIRES_SOURCE_REHYDRATION, E_ISOLATE_FUNCTION_UNSERIALIZABLE, E_ISOLATION_ENCODER_REQUIRED, E_ISOLATION_READY_TIMEOUT, E_ISOLATION_UNENCODABLE, E_ISOLATION_UNSUPPORTED_ENV, GuestEndpoint, HostEndpoint, createCrashPolicy, createIsolatedService, createWorkerTransport, defineIsolatedServiceValidated as defineIsolatedService, emitIsolationReport, event, hasIsolationHook, isEncoderAvailable, isolateFunction, method, nextCorrelationId, registerEncodableClasses, resolveIsolatedServiceSpec, serveIsolated, serveIsolatedOverPort, spawnIsolated, stream, transfer, wireErrorToError };
@@ -1,16 +1,16 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("../../../chunk-Cek0wNdY.js");
3
3
  const require_guards = require("../../../guards-05Uq3J4M.js");
4
- const require_tokenizable = require("../../../tokenizable-Cc5XKez7.js");
5
- const require_spooled_artifact = require("../../../spooled_artifact-CU1m9-te.js");
6
- const require_thought = require("../../../thought-tcs8Ayw5.js");
7
- const require_tool_call = require("../../../tool_call-CYc1yGp9.js");
8
- require("../../../common-Ddtq6naG.js");
4
+ const require_tokenizable = require("../../../tokenizable-BMZuGWRd.js");
5
+ const require_spooled_artifact = require("../../../spooled_artifact-BpcesRBv.js");
6
+ const require_thought = require("../../../thought-Dg_4UZxg.js");
7
+ const require_tool_call = require("../../../tool_call-Fs_Uh5wQ.js");
8
+ require("../../../common-0rLuBEeY.js");
9
9
  require("../../../guards.cjs");
10
10
  const require_lib_utils_retry = require("../../../lib/utils/retry.cjs");
11
11
  const require_tool_parsers = require("../../../tool_parsers-csSBFWob.js");
12
12
  const require_batteries_storage_in_memory = require("../../storage/in_memory.cjs");
13
- const require_helpers = require("../../../helpers-gUUlDRfs.js");
13
+ const require_helpers = require("../../../helpers-CObtMmAZ.js");
14
14
  const require_batteries_llm_anthropic_messages_exceptions = require("./exceptions.cjs");
15
15
  const require_batteries_llm_anthropic_messages_validation = require("./validation.cjs");
16
16
  const require_error_translation = require("../../../error_translation-BCa4wxUL.js");