@moureau/pipeflow 0.0.1 → 0.0.3

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 (336) hide show
  1. package/README.md +280 -130
  2. package/dist/cjs/agents/agent.js +1 -1
  3. package/dist/cjs/agents/agent.js.map +3 -3
  4. package/dist/cjs/agents/tools/tools.js +1 -1
  5. package/dist/cjs/agents/tools/tools.js.map +3 -3
  6. package/dist/cjs/client/client.js +2 -0
  7. package/dist/cjs/client/client.js.map +7 -0
  8. package/dist/cjs/client/index.js +2 -0
  9. package/dist/cjs/client/index.js.map +7 -0
  10. package/dist/cjs/client/json.js +2 -0
  11. package/dist/cjs/client/json.js.map +7 -0
  12. package/dist/cjs/client/protocol/websocket.js +2 -0
  13. package/dist/cjs/client/protocol/websocket.js.map +7 -0
  14. package/dist/cjs/client/protocol.js +2 -0
  15. package/dist/cjs/client/protocol.js.map +7 -0
  16. package/dist/cjs/conversations/conversation/conversation.js +1 -1
  17. package/dist/cjs/conversations/conversation/conversation.js.map +3 -3
  18. package/dist/cjs/conversations/conversations.js +1 -1
  19. package/dist/cjs/conversations/conversations.js.map +3 -3
  20. package/dist/cjs/conversations/index.js +1 -1
  21. package/dist/cjs/conversations/index.js.map +3 -3
  22. package/dist/cjs/conversations/orchestration/coordination/coordination.js +10 -0
  23. package/dist/cjs/conversations/orchestration/coordination/coordination.js.map +7 -0
  24. package/dist/cjs/conversations/orchestration/coordination/index.js +2 -0
  25. package/dist/cjs/conversations/orchestration/coordination/index.js.map +7 -0
  26. package/dist/cjs/conversations/orchestration/orchestrator/coordination-runner/coordination-runner.js +4 -0
  27. package/dist/cjs/conversations/orchestration/orchestrator/coordination-runner/coordination-runner.js.map +7 -0
  28. package/dist/cjs/conversations/orchestration/orchestrator/coordination-runner/index.js +2 -0
  29. package/dist/cjs/conversations/orchestration/orchestrator/coordination-runner/index.js.map +7 -0
  30. package/dist/cjs/conversations/orchestration/orchestrator/generation/generation.js +2 -0
  31. package/dist/cjs/conversations/orchestration/orchestrator/generation/generation.js.map +7 -0
  32. package/dist/cjs/conversations/orchestration/orchestrator/generation/index.js +2 -0
  33. package/dist/cjs/conversations/orchestration/orchestrator/generation/index.js.map +7 -0
  34. package/dist/cjs/conversations/orchestration/orchestrator/history/history.js +4 -0
  35. package/dist/cjs/conversations/orchestration/orchestrator/history/history.js.map +7 -0
  36. package/dist/cjs/conversations/orchestration/orchestrator/history/index.js +2 -0
  37. package/dist/cjs/conversations/orchestration/orchestrator/history/index.js.map +7 -0
  38. package/dist/cjs/conversations/orchestration/orchestrator/index.js +1 -1
  39. package/dist/cjs/conversations/orchestration/orchestrator/index.js.map +3 -3
  40. package/dist/cjs/conversations/orchestration/orchestrator/orchestrator.js +1 -2
  41. package/dist/cjs/conversations/orchestration/orchestrator/orchestrator.js.map +3 -3
  42. package/dist/cjs/conversations/orchestration/orchestrator/routing/index.js +2 -0
  43. package/dist/cjs/conversations/orchestration/orchestrator/routing/index.js.map +7 -0
  44. package/dist/cjs/conversations/orchestration/orchestrator/routing/routing.js +23 -0
  45. package/dist/cjs/conversations/orchestration/orchestrator/routing/routing.js.map +7 -0
  46. package/dist/cjs/conversations/orchestration/orchestrator/speech/index.js +2 -0
  47. package/dist/cjs/conversations/orchestration/orchestrator/speech/index.js.map +7 -0
  48. package/dist/cjs/conversations/orchestration/orchestrator/speech/speech.js +2 -0
  49. package/dist/cjs/conversations/orchestration/orchestrator/speech/speech.js.map +7 -0
  50. package/dist/cjs/conversations/orchestration/orchestrator/tools/index.js +2 -0
  51. package/dist/cjs/conversations/orchestration/orchestrator/tools/index.js.map +7 -0
  52. package/dist/cjs/conversations/orchestration/orchestrator/tools/tools.js +2 -0
  53. package/dist/cjs/conversations/orchestration/orchestrator/tools/tools.js.map +7 -0
  54. package/dist/cjs/conversations/orchestration/test-harness.js +2 -0
  55. package/dist/cjs/conversations/orchestration/test-harness.js.map +7 -0
  56. package/dist/cjs/conversations/orchestration/text-chunker/index.js +2 -0
  57. package/dist/cjs/conversations/orchestration/text-chunker/index.js.map +7 -0
  58. package/dist/cjs/conversations/orchestration/text-chunker/text-chunker.js +3 -0
  59. package/dist/cjs/conversations/orchestration/text-chunker/text-chunker.js.map +7 -0
  60. package/dist/cjs/conversations/stream/conversation-stream.js +2 -0
  61. package/dist/cjs/conversations/stream/conversation-stream.js.map +7 -0
  62. package/dist/cjs/conversations/stream/index.js +2 -0
  63. package/dist/cjs/conversations/stream/index.js.map +7 -0
  64. package/dist/cjs/conversations/types.js +1 -1
  65. package/dist/cjs/conversations/types.js.map +2 -2
  66. package/dist/cjs/index.js +1 -1
  67. package/dist/cjs/index.js.map +3 -3
  68. package/dist/cjs/persistence/adapters/sqlite/sqlite.js +18 -14
  69. package/dist/cjs/persistence/adapters/sqlite/sqlite.js.map +3 -3
  70. package/dist/cjs/pipeflow/index.js +2 -0
  71. package/dist/cjs/pipeflow/index.js.map +7 -0
  72. package/dist/cjs/pipeflow/pipeflow.js +2 -0
  73. package/dist/cjs/pipeflow/pipeflow.js.map +7 -0
  74. package/dist/cjs/providers/index.js +1 -1
  75. package/dist/cjs/providers/index.js.map +2 -2
  76. package/dist/cjs/providers/llm/adapters/claude/claude.js +5 -0
  77. package/dist/cjs/providers/llm/adapters/claude/claude.js.map +7 -0
  78. package/dist/cjs/providers/llm/adapters/claude/index.js +2 -0
  79. package/dist/cjs/providers/llm/adapters/claude/index.js.map +7 -0
  80. package/dist/cjs/providers/llm/adapters/deepseek/deepseek.js +1 -1
  81. package/dist/cjs/providers/llm/adapters/deepseek/deepseek.js.map +3 -3
  82. package/dist/cjs/providers/llm/adapters/index.js +1 -1
  83. package/dist/cjs/providers/llm/adapters/index.js.map +3 -3
  84. package/dist/cjs/providers/llm/adapters/openai/index.js +2 -0
  85. package/dist/cjs/providers/llm/adapters/openai/index.js.map +7 -0
  86. package/dist/cjs/providers/llm/adapters/openai/openai.js +2 -0
  87. package/dist/cjs/providers/llm/adapters/openai/openai.js.map +7 -0
  88. package/dist/cjs/providers/llm/adapters/openai-compatible.js +10 -0
  89. package/dist/cjs/providers/llm/adapters/openai-compatible.js.map +7 -0
  90. package/dist/cjs/providers/llm/adapters/openrouter/index.js +2 -0
  91. package/dist/cjs/providers/llm/adapters/openrouter/index.js.map +7 -0
  92. package/dist/cjs/providers/llm/adapters/openrouter/openrouter.js +2 -0
  93. package/dist/cjs/providers/llm/adapters/openrouter/openrouter.js.map +7 -0
  94. package/dist/cjs/providers/llm/index.js +1 -1
  95. package/dist/cjs/providers/llm/index.js.map +3 -3
  96. package/dist/cjs/providers/llm/toolmode/index.js +2 -0
  97. package/dist/cjs/providers/llm/toolmode/index.js.map +7 -0
  98. package/dist/cjs/providers/llm/toolmode/toolmode.js +2 -0
  99. package/dist/cjs/providers/llm/toolmode/toolmode.js.map +7 -0
  100. package/dist/cjs/providers/llm/types.js +1 -1
  101. package/dist/cjs/providers/llm/types.js.map +3 -3
  102. package/dist/cjs/providers/stt/adapters/deepgram/deepgram.js +1 -1
  103. package/dist/cjs/providers/stt/adapters/deepgram/deepgram.js.map +3 -3
  104. package/dist/cjs/providers/stt/adapters/index.js +1 -1
  105. package/dist/cjs/providers/stt/adapters/index.js.map +3 -3
  106. package/dist/cjs/providers/stt/adapters/openrouter/index.js +2 -0
  107. package/dist/cjs/providers/stt/adapters/openrouter/index.js.map +7 -0
  108. package/dist/cjs/providers/stt/adapters/openrouter/openrouter.js +2 -0
  109. package/dist/cjs/providers/stt/adapters/openrouter/openrouter.js.map +7 -0
  110. package/dist/cjs/providers/tts/adapters/index.js +1 -1
  111. package/dist/cjs/providers/tts/adapters/index.js.map +3 -3
  112. package/dist/cjs/providers/tts/adapters/kokoro/kokoro.js +4 -1
  113. package/dist/cjs/providers/tts/adapters/kokoro/kokoro.js.map +3 -3
  114. package/dist/cjs/providers/tts/adapters/openrouter/index.js +2 -0
  115. package/dist/cjs/providers/tts/adapters/openrouter/index.js.map +7 -0
  116. package/dist/cjs/providers/tts/adapters/openrouter/openrouter.js +2 -0
  117. package/dist/cjs/providers/tts/adapters/openrouter/openrouter.js.map +7 -0
  118. package/dist/cjs/transport/streamobject/field-stream/field-stream.js +2 -0
  119. package/dist/cjs/transport/streamobject/field-stream/field-stream.js.map +7 -0
  120. package/dist/cjs/transport/streamobject/field-stream/index.js +2 -0
  121. package/dist/cjs/transport/streamobject/field-stream/index.js.map +7 -0
  122. package/dist/cjs/transport/streamobject/index.js +2 -0
  123. package/dist/cjs/transport/streamobject/index.js.map +7 -0
  124. package/dist/cjs/transport/streamobject/json-adapter/index.js +2 -0
  125. package/dist/cjs/transport/streamobject/json-adapter/index.js.map +7 -0
  126. package/dist/cjs/transport/streamobject/json-adapter/json-adapter.js +4 -0
  127. package/dist/cjs/transport/streamobject/json-adapter/json-adapter.js.map +7 -0
  128. package/dist/cjs/transport/streamobject/reference/index.js +2 -0
  129. package/dist/cjs/transport/streamobject/reference/index.js.map +7 -0
  130. package/dist/cjs/transport/streamobject/reference/reference.js +2 -0
  131. package/dist/cjs/transport/streamobject/reference/reference.js.map +7 -0
  132. package/dist/cjs/transport/streamobject/stream-object/index.js +2 -0
  133. package/dist/cjs/transport/streamobject/stream-object/index.js.map +7 -0
  134. package/dist/cjs/transport/streamobject/stream-object/stream-object.js +2 -0
  135. package/dist/cjs/transport/streamobject/stream-object/stream-object.js.map +7 -0
  136. package/dist/esm/agents/agent.js +1 -1
  137. package/dist/esm/agents/agent.js.map +3 -3
  138. package/dist/esm/agents/tools/tools.js +1 -1
  139. package/dist/esm/agents/tools/tools.js.map +3 -3
  140. package/dist/esm/client/client.js +2 -0
  141. package/dist/esm/client/client.js.map +7 -0
  142. package/dist/esm/client/index.js +2 -0
  143. package/dist/esm/client/index.js.map +7 -0
  144. package/dist/esm/client/json.js +2 -0
  145. package/dist/esm/client/json.js.map +7 -0
  146. package/dist/esm/client/protocol/websocket.js +2 -0
  147. package/dist/esm/client/protocol/websocket.js.map +7 -0
  148. package/dist/esm/client/protocol.js +1 -0
  149. package/dist/esm/client/protocol.js.map +7 -0
  150. package/dist/esm/conversations/conversation/conversation.js +1 -1
  151. package/dist/esm/conversations/conversation/conversation.js.map +3 -3
  152. package/dist/esm/conversations/conversations.js +1 -1
  153. package/dist/esm/conversations/conversations.js.map +3 -3
  154. package/dist/esm/conversations/index.js +1 -1
  155. package/dist/esm/conversations/index.js.map +3 -3
  156. package/dist/esm/conversations/orchestration/coordination/coordination.js +10 -0
  157. package/dist/esm/conversations/orchestration/coordination/coordination.js.map +7 -0
  158. package/dist/esm/conversations/orchestration/coordination/index.js +2 -0
  159. package/dist/esm/conversations/orchestration/coordination/index.js.map +7 -0
  160. package/dist/esm/conversations/orchestration/orchestrator/coordination-runner/coordination-runner.js +4 -0
  161. package/dist/esm/conversations/orchestration/orchestrator/coordination-runner/coordination-runner.js.map +7 -0
  162. package/dist/esm/conversations/orchestration/orchestrator/coordination-runner/index.js +2 -0
  163. package/dist/esm/conversations/orchestration/orchestrator/coordination-runner/index.js.map +7 -0
  164. package/dist/esm/conversations/orchestration/orchestrator/generation/generation.js +2 -0
  165. package/dist/esm/conversations/orchestration/orchestrator/generation/generation.js.map +7 -0
  166. package/dist/esm/conversations/orchestration/orchestrator/generation/index.js +2 -0
  167. package/dist/esm/conversations/orchestration/orchestrator/generation/index.js.map +7 -0
  168. package/dist/esm/conversations/orchestration/orchestrator/history/history.js +4 -0
  169. package/dist/esm/conversations/orchestration/orchestrator/history/history.js.map +7 -0
  170. package/dist/esm/conversations/orchestration/orchestrator/history/index.js +2 -0
  171. package/dist/esm/conversations/orchestration/orchestrator/history/index.js.map +7 -0
  172. package/dist/esm/conversations/orchestration/orchestrator/index.js +1 -1
  173. package/dist/esm/conversations/orchestration/orchestrator/index.js.map +3 -3
  174. package/dist/esm/conversations/orchestration/orchestrator/orchestrator.js +1 -2
  175. package/dist/esm/conversations/orchestration/orchestrator/orchestrator.js.map +3 -3
  176. package/dist/esm/conversations/orchestration/orchestrator/routing/index.js +2 -0
  177. package/dist/esm/conversations/orchestration/orchestrator/routing/index.js.map +7 -0
  178. package/dist/esm/conversations/orchestration/orchestrator/routing/routing.js +23 -0
  179. package/dist/esm/conversations/orchestration/orchestrator/routing/routing.js.map +7 -0
  180. package/dist/esm/conversations/orchestration/orchestrator/speech/index.js +2 -0
  181. package/dist/esm/conversations/orchestration/orchestrator/speech/index.js.map +7 -0
  182. package/dist/esm/conversations/orchestration/orchestrator/speech/speech.js +2 -0
  183. package/dist/esm/conversations/orchestration/orchestrator/speech/speech.js.map +7 -0
  184. package/dist/esm/conversations/orchestration/orchestrator/tools/index.js +2 -0
  185. package/dist/esm/conversations/orchestration/orchestrator/tools/index.js.map +7 -0
  186. package/dist/esm/conversations/orchestration/orchestrator/tools/tools.js +2 -0
  187. package/dist/esm/conversations/orchestration/orchestrator/tools/tools.js.map +7 -0
  188. package/dist/esm/conversations/orchestration/test-harness.js +2 -0
  189. package/dist/esm/conversations/orchestration/test-harness.js.map +7 -0
  190. package/dist/esm/conversations/orchestration/text-chunker/index.js +2 -0
  191. package/dist/esm/conversations/orchestration/text-chunker/index.js.map +7 -0
  192. package/dist/esm/conversations/orchestration/text-chunker/text-chunker.js +3 -0
  193. package/dist/esm/conversations/orchestration/text-chunker/text-chunker.js.map +7 -0
  194. package/dist/esm/conversations/stream/conversation-stream.js +2 -0
  195. package/dist/esm/conversations/stream/conversation-stream.js.map +7 -0
  196. package/dist/esm/conversations/stream/index.js +2 -0
  197. package/dist/esm/conversations/stream/index.js.map +7 -0
  198. package/dist/esm/conversations/types.js +1 -1
  199. package/dist/esm/conversations/types.js.map +2 -2
  200. package/dist/esm/index.js +1 -1
  201. package/dist/esm/index.js.map +3 -3
  202. package/dist/esm/persistence/adapters/sqlite/sqlite.js +18 -14
  203. package/dist/esm/persistence/adapters/sqlite/sqlite.js.map +3 -3
  204. package/dist/esm/pipeflow/index.js +2 -0
  205. package/dist/esm/pipeflow/index.js.map +7 -0
  206. package/dist/esm/pipeflow/pipeflow.js +2 -0
  207. package/dist/esm/pipeflow/pipeflow.js.map +7 -0
  208. package/dist/esm/providers/index.js +1 -1
  209. package/dist/esm/providers/index.js.map +3 -3
  210. package/dist/esm/providers/llm/adapters/claude/claude.js +5 -0
  211. package/dist/esm/providers/llm/adapters/claude/claude.js.map +7 -0
  212. package/dist/esm/providers/llm/adapters/claude/index.js +2 -0
  213. package/dist/esm/providers/llm/adapters/claude/index.js.map +7 -0
  214. package/dist/esm/providers/llm/adapters/deepseek/deepseek.js +1 -1
  215. package/dist/esm/providers/llm/adapters/deepseek/deepseek.js.map +3 -3
  216. package/dist/esm/providers/llm/adapters/index.js +1 -1
  217. package/dist/esm/providers/llm/adapters/index.js.map +3 -3
  218. package/dist/esm/providers/llm/adapters/openai/index.js +2 -0
  219. package/dist/esm/providers/llm/adapters/openai/index.js.map +7 -0
  220. package/dist/esm/providers/llm/adapters/openai/openai.js +2 -0
  221. package/dist/esm/providers/llm/adapters/openai/openai.js.map +7 -0
  222. package/dist/esm/providers/llm/adapters/openai-compatible.js +10 -0
  223. package/dist/esm/providers/llm/adapters/openai-compatible.js.map +7 -0
  224. package/dist/esm/providers/llm/adapters/openrouter/index.js +2 -0
  225. package/dist/esm/providers/llm/adapters/openrouter/index.js.map +7 -0
  226. package/dist/esm/providers/llm/adapters/openrouter/openrouter.js +2 -0
  227. package/dist/esm/providers/llm/adapters/openrouter/openrouter.js.map +7 -0
  228. package/dist/esm/providers/llm/index.js +1 -1
  229. package/dist/esm/providers/llm/index.js.map +3 -3
  230. package/dist/esm/providers/llm/toolmode/index.js +2 -0
  231. package/dist/esm/providers/llm/toolmode/index.js.map +7 -0
  232. package/dist/esm/providers/llm/toolmode/toolmode.js +2 -0
  233. package/dist/esm/providers/llm/toolmode/toolmode.js.map +7 -0
  234. package/dist/esm/providers/llm/types.js +1 -0
  235. package/dist/esm/providers/llm/types.js.map +4 -4
  236. package/dist/esm/providers/stt/adapters/deepgram/deepgram.js +1 -1
  237. package/dist/esm/providers/stt/adapters/deepgram/deepgram.js.map +3 -3
  238. package/dist/esm/providers/stt/adapters/index.js +1 -1
  239. package/dist/esm/providers/stt/adapters/index.js.map +3 -3
  240. package/dist/esm/providers/stt/adapters/openrouter/index.js +2 -0
  241. package/dist/esm/providers/stt/adapters/openrouter/index.js.map +7 -0
  242. package/dist/esm/providers/stt/adapters/openrouter/openrouter.js +2 -0
  243. package/dist/esm/providers/stt/adapters/openrouter/openrouter.js.map +7 -0
  244. package/dist/esm/providers/tts/adapters/index.js +1 -1
  245. package/dist/esm/providers/tts/adapters/index.js.map +3 -3
  246. package/dist/esm/providers/tts/adapters/kokoro/kokoro.js +4 -1
  247. package/dist/esm/providers/tts/adapters/kokoro/kokoro.js.map +3 -3
  248. package/dist/esm/providers/tts/adapters/openrouter/index.js +2 -0
  249. package/dist/esm/providers/tts/adapters/openrouter/index.js.map +7 -0
  250. package/dist/esm/providers/tts/adapters/openrouter/openrouter.js +2 -0
  251. package/dist/esm/providers/tts/adapters/openrouter/openrouter.js.map +7 -0
  252. package/dist/esm/transport/streamobject/field-stream/field-stream.js +2 -0
  253. package/dist/esm/transport/streamobject/field-stream/field-stream.js.map +7 -0
  254. package/dist/esm/transport/streamobject/field-stream/index.js +2 -0
  255. package/dist/esm/transport/streamobject/field-stream/index.js.map +7 -0
  256. package/dist/esm/transport/streamobject/index.js +2 -0
  257. package/dist/esm/transport/streamobject/index.js.map +7 -0
  258. package/dist/esm/transport/streamobject/json-adapter/index.js +2 -0
  259. package/dist/esm/transport/streamobject/json-adapter/index.js.map +7 -0
  260. package/dist/esm/transport/streamobject/json-adapter/json-adapter.js +4 -0
  261. package/dist/esm/transport/streamobject/json-adapter/json-adapter.js.map +7 -0
  262. package/dist/esm/transport/streamobject/reference/index.js +2 -0
  263. package/dist/esm/transport/streamobject/reference/index.js.map +7 -0
  264. package/dist/esm/transport/streamobject/reference/reference.js +2 -0
  265. package/dist/esm/transport/streamobject/reference/reference.js.map +7 -0
  266. package/dist/esm/transport/streamobject/stream-object/index.js +2 -0
  267. package/dist/esm/transport/streamobject/stream-object/index.js.map +7 -0
  268. package/dist/esm/transport/streamobject/stream-object/stream-object.js +2 -0
  269. package/dist/esm/transport/streamobject/stream-object/stream-object.js.map +7 -0
  270. package/dist/types/agents/agent.d.ts +3 -0
  271. package/dist/types/agents/tools/tools.d.ts +28 -6
  272. package/dist/types/client/client.d.ts +186 -0
  273. package/dist/types/client/index.d.ts +31 -0
  274. package/dist/types/client/json.d.ts +13 -0
  275. package/dist/types/client/protocol/websocket.d.ts +56 -0
  276. package/dist/types/client/protocol.d.ts +46 -0
  277. package/dist/types/conversations/conversation/conversation.d.ts +130 -6
  278. package/dist/types/conversations/conversations.d.ts +35 -1
  279. package/dist/types/conversations/index.d.ts +2 -1
  280. package/dist/types/conversations/orchestration/coordination/coordination.d.ts +192 -0
  281. package/dist/types/conversations/orchestration/coordination/index.d.ts +2 -0
  282. package/dist/types/conversations/orchestration/orchestrator/coordination-runner/coordination-runner.d.ts +108 -0
  283. package/dist/types/conversations/orchestration/orchestrator/coordination-runner/index.d.ts +2 -0
  284. package/dist/types/conversations/orchestration/orchestrator/generation/generation.d.ts +60 -0
  285. package/dist/types/conversations/orchestration/orchestrator/generation/index.d.ts +2 -0
  286. package/dist/types/conversations/orchestration/orchestrator/history/history.d.ts +62 -0
  287. package/dist/types/conversations/orchestration/orchestrator/history/index.d.ts +1 -0
  288. package/dist/types/conversations/orchestration/orchestrator/index.d.ts +10 -0
  289. package/dist/types/conversations/orchestration/orchestrator/orchestrator.d.ts +68 -31
  290. package/dist/types/conversations/orchestration/orchestrator/routing/index.d.ts +1 -0
  291. package/dist/types/conversations/orchestration/orchestrator/routing/routing.d.ts +19 -0
  292. package/dist/types/conversations/orchestration/orchestrator/speech/index.d.ts +2 -0
  293. package/dist/types/conversations/orchestration/orchestrator/speech/speech.d.ts +78 -0
  294. package/dist/types/conversations/orchestration/orchestrator/tools/index.d.ts +2 -0
  295. package/dist/types/conversations/orchestration/orchestrator/tools/tools.d.ts +65 -0
  296. package/dist/types/conversations/orchestration/test-harness.d.ts +100 -0
  297. package/dist/types/conversations/orchestration/text-chunker/index.d.ts +1 -0
  298. package/dist/types/conversations/orchestration/text-chunker/text-chunker.d.ts +39 -0
  299. package/dist/types/conversations/stream/conversation-stream.d.ts +42 -0
  300. package/dist/types/conversations/stream/index.d.ts +1 -0
  301. package/dist/types/conversations/types.d.ts +32 -0
  302. package/dist/types/index.d.ts +5 -38
  303. package/dist/types/pipeflow/index.d.ts +2 -0
  304. package/dist/types/pipeflow/pipeflow.d.ts +43 -0
  305. package/dist/types/providers/index.d.ts +1 -1
  306. package/dist/types/providers/llm/adapters/claude/claude.d.ts +45 -0
  307. package/dist/types/providers/llm/adapters/claude/index.d.ts +2 -0
  308. package/dist/types/providers/llm/adapters/deepseek/deepseek.d.ts +23 -2
  309. package/dist/types/providers/llm/adapters/index.d.ts +3 -0
  310. package/dist/types/providers/llm/adapters/openai/index.d.ts +2 -0
  311. package/dist/types/providers/llm/adapters/openai/openai.d.ts +45 -0
  312. package/dist/types/providers/llm/adapters/openai-compatible.d.ts +44 -0
  313. package/dist/types/providers/llm/adapters/openrouter/index.d.ts +2 -0
  314. package/dist/types/providers/llm/adapters/openrouter/openrouter.d.ts +60 -0
  315. package/dist/types/providers/llm/index.d.ts +5 -2
  316. package/dist/types/providers/llm/toolmode/index.d.ts +2 -0
  317. package/dist/types/providers/llm/toolmode/toolmode.d.ts +99 -0
  318. package/dist/types/providers/llm/types.d.ts +65 -0
  319. package/dist/types/providers/stt/adapters/deepgram/deepgram.d.ts +4 -1
  320. package/dist/types/providers/stt/adapters/index.d.ts +1 -0
  321. package/dist/types/providers/stt/adapters/openrouter/index.d.ts +2 -0
  322. package/dist/types/providers/stt/adapters/openrouter/openrouter.d.ts +196 -0
  323. package/dist/types/providers/tts/adapters/index.d.ts +1 -0
  324. package/dist/types/providers/tts/adapters/kokoro/kokoro.d.ts +18 -3
  325. package/dist/types/providers/tts/adapters/openrouter/index.d.ts +2 -0
  326. package/dist/types/providers/tts/adapters/openrouter/openrouter.d.ts +64 -0
  327. package/dist/types/transport/streamobject/field-stream/field-stream.d.ts +85 -0
  328. package/dist/types/transport/streamobject/field-stream/index.d.ts +2 -0
  329. package/dist/types/transport/streamobject/index.d.ts +8 -0
  330. package/dist/types/transport/streamobject/json-adapter/index.d.ts +2 -0
  331. package/dist/types/transport/streamobject/json-adapter/json-adapter.d.ts +65 -0
  332. package/dist/types/transport/streamobject/reference/index.d.ts +2 -0
  333. package/dist/types/transport/streamobject/reference/reference.d.ts +127 -0
  334. package/dist/types/transport/streamobject/stream-object/index.d.ts +2 -0
  335. package/dist/types/transport/streamobject/stream-object/stream-object.d.ts +31 -0
  336. package/package.json +29 -2
@@ -0,0 +1,78 @@
1
+ import type { Conversation } from "../../../conversation/conversation.js";
2
+ import type { TTS } from "../../../../providers/tts/types.js";
3
+ export interface SpeechPipelineOptions {
4
+ /** TTS provider; omitted for text-only conversations. */
5
+ tts?: TTS;
6
+ conversation: Conversation;
7
+ /**
8
+ * True while the generation that produced the speech is still current.
9
+ * The captured generation epoch is passed back in, so an interrupt (epoch
10
+ * bump) or a stop drops queued and in-flight synthesis.
11
+ */
12
+ isCurrent(epoch: number): boolean;
13
+ /**
14
+ * How many synthesis requests may be in flight at once. Sentences are
15
+ * started as soon as a slot is free — the next one synthesizes while the
16
+ * current one is still streaming — so playback never waits for the whole
17
+ * reply, but a burst of many sentences can't flood the provider (free TTS
18
+ * variants rate-limit concurrent requests). Default 2.
19
+ */
20
+ maxConcurrentRequests?: number;
21
+ }
22
+ /**
23
+ * Turns the LLM delta stream into speakable audio: expose the text stream
24
+ * semantically (`text-delta`), buffer sentences through the `TextChunker`,
25
+ * and synthesize each chunk through the TTS provider on a serial chain.
26
+ *
27
+ * Owns the chunker, the speech epoch (bumped by `stop()`), the synthesis
28
+ * chain, and the audio sequence — the orchestrator only decides *when*
29
+ * speech is current.
30
+ */
31
+ export declare class SpeechPipeline {
32
+ private readonly tts;
33
+ private readonly conversation;
34
+ private readonly isCurrent;
35
+ private readonly maxConcurrent;
36
+ private readonly chunker;
37
+ private speechEpoch;
38
+ private chain;
39
+ private audioSequence;
40
+ /** Flushed sentences still waiting for a synthesis slot. */
41
+ private readonly queue;
42
+ /** Synthesis requests started but not yet fully delivered. */
43
+ private inFlight;
44
+ constructor(options: SpeechPipelineOptions);
45
+ /**
46
+ * Stream an LLM delta to the application and the TTS pipeline. Empty
47
+ * deltas (reasoning-only frames) are skipped so they never reach the
48
+ * text-delta event or the chunker.
49
+ */
50
+ feed(delta: string, epoch: number): void;
51
+ /** Speak any remaining buffered text as a final chunk. */
52
+ flush(epoch: number): void;
53
+ /**
54
+ * Queue a sentence for synthesis, starting it if a slot is free. The text
55
+ * order is preserved end to end: requests start in flush order, and delivery
56
+ * below is serialized through `chain`, so sentence N never overtakes N-1.
57
+ */
58
+ speak(sentence: string, epoch: number): void;
59
+ /**
60
+ * Start synthesis for queued sentences up to the concurrency bound. A
61
+ * sentence's request is fired as soon as a slot is free — while the previous
62
+ * sentence is still streaming/playing — so the first piece is ready first
63
+ * and later pieces overlap it, without ever flooding the provider with one
64
+ * request per sentence of a long reply.
65
+ */
66
+ private startNext;
67
+ /**
68
+ * Stop the current TTS playback and drop buffered text without cancelling
69
+ * the generation (barge-in, interrupt, stop).
70
+ */
71
+ stop(): void;
72
+ /**
73
+ * Resolve when every queued and in-flight sentence has been synthesized and
74
+ * delivered. Unlike the delivery chain alone, this also waits for sentences
75
+ * still waiting on a synthesis slot.
76
+ */
77
+ waitForIdle(): Promise<void>;
78
+ }
@@ -0,0 +1,2 @@
1
+ export { ToolCallManager } from "./tools.js";
2
+ export type { ResolvedToolCall } from "./tools.js";
@@ -0,0 +1,65 @@
1
+ import type { Conversation } from "../../../conversation/conversation.js";
2
+ import type { LLMToolCall } from "../../../../providers/llm/types.js";
3
+ import type { ToolCallResult } from "../../../types.js";
4
+ import type { Tool } from "../../../../agents/tools/tools.js";
5
+ export interface ResolvedToolCall {
6
+ id: string;
7
+ name: string;
8
+ result?: unknown;
9
+ error?: string;
10
+ }
11
+ export interface ToolCallManagerOptions {
12
+ /**
13
+ * The tools the framework can execute on the agent's behalf, keyed by
14
+ * name. Built from the orchestrated agents' tool registries.
15
+ */
16
+ tools?: ReadonlyMap<string, Tool<never, unknown>>;
17
+ /**
18
+ * Execute tool calls automatically (default `true`), feeding each tool's
19
+ * result — or a caught error — back into the model loop. Set `false` to
20
+ * keep the application-managed contract: listen for `tool-call`, execute
21
+ * the tool in your own backend, and report back with
22
+ * `resolveToolCall()`. `tool-call` events are still emitted for
23
+ * visibility in either mode.
24
+ */
25
+ autoExecute?: boolean;
26
+ }
27
+ /**
28
+ * Resolves the tool calls a generation issues. By default it runs the
29
+ * matching tool itself (the conversation agents' tools auto-execute, exactly
30
+ * like `Agent.run()`); with `autoExecute: false` it hands the calls to the
31
+ * application and resolves them once the application reports back (or a
32
+ * timeout fires). Stale results — timed out, already resolved, or superseded
33
+ * by an interrupt — are dropped.
34
+ */
35
+ export declare class ToolCallManager {
36
+ private readonly conversation;
37
+ private readonly timeoutMs;
38
+ private readonly tools;
39
+ private readonly autoExecute;
40
+ private readonly waiters;
41
+ constructor(conversation: Conversation, timeoutMs: number, options?: ToolCallManagerOptions);
42
+ /**
43
+ * Resolve a batch of tool calls. In auto-execute mode each call's tool
44
+ * runs on the agent's behalf (errors caught and returned to the model);
45
+ * otherwise the application resolves them. Either way the calls are
46
+ * emitted as `tool-call` events and resolved in call order, with either a
47
+ * result or an error string.
48
+ */
49
+ resolveCalls(calls: LLMToolCall[]): Promise<ResolvedToolCall[]>;
50
+ /** Resolve a waiter from a `tool-call-result` event; stale results drop. */
51
+ handleResult(result: ToolCallResult): void;
52
+ /** Force-resolve every pending call (interrupt, stop). */
53
+ cancelAll(reason: string): void;
54
+ /**
55
+ * Execute one tool call and resolve it with the tool's result (or a
56
+ * caught error). If the application already resolved the call in its
57
+ * `tool-call` handler — the app-managed path — the tool is not run twice.
58
+ */
59
+ private runToolAndResolve;
60
+ /** Resolve through the conversation only while the call is still pending. */
61
+ private resolveIfPending;
62
+ private isPending;
63
+ private parseArguments;
64
+ private wait;
65
+ }
@@ -0,0 +1,100 @@
1
+ import { Tool } from "../../agents/tools/tools.js";
2
+ import { Conversation } from "../conversation/conversation.js";
3
+ import { MemoryPersistence } from "../../persistence/adapters/memory/memory.js";
4
+ import { Orchestrator } from "./orchestrator/orchestrator.js";
5
+ import type { HistoryWindow } from "./orchestrator/history/history.js";
6
+ import type { LLM, LLMEvent, LLMRequest } from "../../providers/llm/types.js";
7
+ import type { STT, STTOptions, STTSession } from "../../providers/stt/types.js";
8
+ import type { TTS, TTSRequest } from "../../providers/tts/types.js";
9
+ export type LLMScript = (request: LLMRequest, signal: AbortSignal) => AsyncIterable<LLMEvent>;
10
+ export declare class FakeLLM implements LLM {
11
+ private readonly script;
12
+ readonly requests: LLMRequest[];
13
+ readonly stopCalls: number[];
14
+ private readonly controllers;
15
+ constructor(script: LLMScript);
16
+ stream(request: LLMRequest): AsyncGenerator<LLMEvent>;
17
+ stop(): void;
18
+ }
19
+ export declare class FakeSTT implements STT {
20
+ readonly sessions: FakeSTTSession[];
21
+ readonly startOptions: STTOptions[];
22
+ start(options?: STTOptions): FakeSTTSession;
23
+ cancel(): void;
24
+ }
25
+ export type FakeSessionEvent = "partial" | "final" | "error";
26
+ export declare class FakeSTTSession implements STTSession {
27
+ readonly written: Uint8Array[];
28
+ ended: number;
29
+ private readonly listeners;
30
+ write(audio: Uint8Array): void;
31
+ end(): Promise<void>;
32
+ on(event: "partial", listener: (transcript: string) => void): void;
33
+ on(event: "final", listener: (transcript: string) => void): void;
34
+ on(event: "error", listener: (error: Error) => void): void;
35
+ emitPartial(text: string): void;
36
+ emitFinal(text: string): void;
37
+ emitError(error: Error): void;
38
+ }
39
+ export declare class FakeTTS implements TTS {
40
+ private readonly chunksFor;
41
+ readonly requests: TTSRequest[];
42
+ private readonly controllers;
43
+ constructor(chunksFor: (text: string) => Uint8Array[]);
44
+ stream(request: TTSRequest): AsyncGenerator<Uint8Array>;
45
+ stop(): void;
46
+ }
47
+ /**
48
+ * A TTS that streams one chunk at a time with a delay, so audio is still
49
+ * mid-flight when an interrupt arrives.
50
+ */
51
+ export declare class SlowTTS implements TTS {
52
+ private readonly chunksFor;
53
+ private readonly delayMs;
54
+ readonly requests: TTSRequest[];
55
+ private readonly controllers;
56
+ constructor(chunksFor: (text: string) => Uint8Array[], delayMs?: number);
57
+ stream(request: TTSRequest): AsyncGenerator<Uint8Array>;
58
+ stop(): void;
59
+ }
60
+ export type TtsHarness = FakeTTS | SlowTTS;
61
+ export interface Harness {
62
+ conversation: Conversation;
63
+ orchestrator: Orchestrator;
64
+ llm: FakeLLM;
65
+ stt: FakeSTT;
66
+ tts: TtsHarness;
67
+ persistence: MemoryPersistence;
68
+ }
69
+ export declare function setup(options: {
70
+ script: LLMScript;
71
+ ttsChunks?: (text: string) => Uint8Array[];
72
+ tts?: TtsHarness;
73
+ tools?: Tool<never, unknown>[];
74
+ toolTimeoutMs?: number;
75
+ context?: string;
76
+ /** Inject a real LLM (e.g. an adapter over a mocked fetch) instead of a scripted fake. */
77
+ llm?: LLM;
78
+ /** Override the conversation-history window (default 5 turns / 4k chars). */
79
+ historyWindow?: HistoryWindow | false;
80
+ /** Auto-execute the agent's tools (default true); see OrchestratorOptions. */
81
+ autoExecuteTools?: boolean;
82
+ }): Promise<Harness>;
83
+ export declare function waitFor(condition: () => boolean, timeoutMs?: number): Promise<void>;
84
+ export declare function speak(harness: Harness, userId: string, text: string): Promise<void>;
85
+ export declare function respond(text: string): LLMScript;
86
+ export type RosterHarness = Harness & {
87
+ llms: Map<string, FakeLLM>;
88
+ };
89
+ export declare function setupRoster(options: {
90
+ coordinatorScript: LLMScript;
91
+ scripts: Record<string, LLMScript>;
92
+ tools?: Record<string, Tool<never, unknown>[]>;
93
+ coordinations?: Record<string, {
94
+ prompt: string;
95
+ llm: FakeLLM;
96
+ }>;
97
+ maxCoordinationSteps?: number;
98
+ /** Auto-execute the agents' tools (default true); see OrchestratorOptions. */
99
+ autoExecuteTools?: boolean;
100
+ }): Promise<RosterHarness>;
@@ -0,0 +1 @@
1
+ export * from './text-chunker.js';
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Streaming text segmenter for speech.
3
+ *
4
+ * Turns an incremental LLM token stream into speakable chunks with a boundary
5
+ * hierarchy, so TTS never waits indefinitely for punctuation:
6
+ *
7
+ * 1. **Strong boundary** — `. ! ? \n` flush immediately (sentence end).
8
+ * 2. **Soft boundary** — once the buffer is long enough, split at the last
9
+ * `, ; :` that yields a chunk of at least `minSoftLength` characters.
10
+ * 3. **Hard cap** — at `maxLength` the buffer flushes regardless of
11
+ * punctuation.
12
+ *
13
+ * The heuristics are intentionally internal and benchmark-driven rather than
14
+ * configurable through the public API.
15
+ */
16
+ export interface TextChunkerOptions {
17
+ /** Buffer length at which a soft boundary becomes eligible. Default 80. */
18
+ targetLength?: number;
19
+ /** Hard cap before an unconditional flush. Default 140. */
20
+ maxLength?: number;
21
+ /** Smallest chunk a soft boundary may produce. Default 40. */
22
+ minSoftLength?: number;
23
+ }
24
+ export declare class TextChunker {
25
+ private readonly targetLength;
26
+ private readonly maxLength;
27
+ private readonly minSoftLength;
28
+ private buffer;
29
+ constructor(options?: TextChunkerOptions);
30
+ /** Feed tokens; returns zero or more complete chunks to synthesize. */
31
+ push(delta: string): string[];
32
+ /** Flush any remaining buffered text as a final chunk (or null). */
33
+ flush(): string | null;
34
+ /** Drop the buffer (interrupt, stop). */
35
+ clear(): void;
36
+ private takeNext;
37
+ /** Cut the buffer through index `i` (inclusive) and return the text. */
38
+ private takeThrough;
39
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * ConversationStream — the conversation's semantic reply stream.
3
+ *
4
+ * Turns a Conversation's event stream (LLM text fragments + generation
5
+ * completion) into FieldStream completion events: consumers act on partial
6
+ * reply text without waiting for the reply to finish.
7
+ *
8
+ * const replies = new ConversationStream(conversation);
9
+ * replies.whenItem("text", (fragment, i) => render(fragment));
10
+ * replies.when("agent", (agent) => showSpeaker(agent));
11
+ * replies.whenObjectDone((reply) => finalize(reply));
12
+ * replies.cancel(); // aborts the current generation (interrupts the LLM)
13
+ *
14
+ * One semantic object per top-level generation (agent or coordination
15
+ * reply). The `text` field is an ordered sequence of completed text
16
+ * fragments — semantically "the next fragment of the reply arrived", not
17
+ * "whatever happened to be inside a provider SSE packet". Fragment sizes are
18
+ * an implementation detail of the producer and may be coalesced later.
19
+ *
20
+ * Lifecycle per reply:
21
+ *
22
+ * first fragment ──▶ STREAMING ──generation-complete──▶ DONE
23
+ * ├──cancel()/interrupt──▶ CANCELLED
24
+ * └──provider error──────▶ FAILED
25
+ *
26
+ * Each boundary fires at most once; no completion event fires after a
27
+ * terminal state. Interruptions and errors leave already-delivered fragments
28
+ * as valid partial state. Delegated sub-generation results do not terminate
29
+ * the top-level reply — only the top-level generation's completion does.
30
+ */
31
+ import { FieldStream } from "../../transport/streamobject/field-stream/field-stream.js";
32
+ import type { Conversation } from "../conversation/conversation.js";
33
+ export declare class ConversationStream extends FieldStream {
34
+ private readonly unsubscribers;
35
+ private active;
36
+ constructor(conversation: Conversation);
37
+ /** Stop listening to the conversation. */
38
+ dispose(): void;
39
+ private onDelta;
40
+ private completeReply;
41
+ private abortReply;
42
+ }
@@ -0,0 +1 @@
1
+ export { ConversationStream } from "./conversation-stream.js";
@@ -24,6 +24,29 @@ export interface Turn {
24
24
  endedAt: number;
25
25
  }
26
26
  export type GenerationStatus = "streaming" | "completed" | "cancelled";
27
+ /**
28
+ * Latency instrumentation for a generation. Times are epoch milliseconds;
29
+ * only `startedAt` is always present. The chain distinguishes each hop:
30
+ *
31
+ * ```text
32
+ * turn → first LLM token → first TTS text (buffering flush)
33
+ * → TTS requested → TTS first audio → audio delivered → completed
34
+ * ```
35
+ */
36
+ export interface GenerationTiming {
37
+ startedAt: number;
38
+ /** First LLM delta of this generation (first-token latency). */
39
+ firstTokenAt?: number;
40
+ /** First sentence flushed to TTS (text buffering latency). */
41
+ firstTtsTextAt?: number;
42
+ /** First TTS stream request issued (queue latency). */
43
+ firstTtsRequestAt?: number;
44
+ /** First audio chunk produced by the TTS provider (provider latency). */
45
+ firstTtsAudioAt?: number;
46
+ /** First TTS audio chunk delivered to the application (transport latency). */
47
+ firstAudioAt?: number;
48
+ completedAt?: number;
49
+ }
27
50
  export interface Generation {
28
51
  id: string;
29
52
  conversationId: ConversationId;
@@ -32,6 +55,15 @@ export interface Generation {
32
55
  status: GenerationStatus;
33
56
  startedAt: number;
34
57
  endedAt?: number;
58
+ /**
59
+ * "sub" marks a task dispatched to another agent by the coordinator.
60
+ * Regular agent replies omit this field.
61
+ */
62
+ kind?: "sub";
63
+ /** For sub-generations: the id of the coordinator generation that dispatched them. */
64
+ parentGenerationId?: string;
65
+ /** Latency instrumentation, recorded as the generation streams. */
66
+ timing?: GenerationTiming;
35
67
  }
36
68
  export interface ToolCall {
37
69
  id: string;
@@ -1,44 +1,11 @@
1
- import { Agent, type AgentOptions } from "./agents/agent.js";
2
- import { Conversations } from "./conversations/conversations.js";
3
- import type { Persistence } from "./persistence/persistence.js";
4
- import type { LLM } from "./providers/llm/types.js";
5
- import type { STT } from "./providers/stt/types.js";
6
- import type { TTS } from "./providers/tts/types.js";
7
- export interface PipeflowOptions {
8
- llm?: LLM;
9
- stt?: STT;
10
- tts?: TTS;
11
- persistence?: Persistence;
12
- }
13
- /**
14
- * The Pipeflow entry point.
15
- *
16
- * ```ts
17
- * const pipeflow = new Pipeflow({ llm });
18
- * const agent = pipeflow.agent({ name: "Jarvis", context: "..." });
19
- * const conversation = await pipeflow.conversations.create({ agents: [agent] });
20
- * ```
21
- */
22
- export declare class Pipeflow {
23
- readonly llm: LLM | undefined;
24
- readonly stt: STT | undefined;
25
- readonly tts: TTS | undefined;
26
- readonly conversations: Conversations;
27
- constructor(options?: PipeflowOptions);
28
- /**
29
- * Create an agent. Agents inherit the Pipeflow instance's LLM provider so
30
- * `agent.run()` works out of the box.
31
- */
32
- agent(options: Omit<AgentOptions, "llm"> & {
33
- llm?: LLM;
34
- }): Agent;
35
- }
36
- export { Agent };
1
+ export { Pipeflow } from "./pipeflow.js";
2
+ export type { PipeflowOptions } from "./pipeflow.js";
3
+ export { Agent } from "./agents/agent.js";
37
4
  export type { AgentOptions, AgentRunRequest, AgentRunResult, ExecutedToolCall, } from "./agents/agent.js";
38
5
  export { Tool, Tool as PipeflowTool } from "./agents/tools/tools.js";
39
6
  export type { ToolOptions } from "./agents/tools/tools.js";
40
- export { Conversation, Conversations, Orchestrator, Transcription, TranscriptEntry, } from "./conversations/index.js";
41
- export type { AudioChunk, ConversationEvents, ConversationId, ConversationOptions, ConversationState, ConversationStatus, CreateConversationOptions, Generation, GenerationStatus, OrchestratorOptions, Participant, ParticipantInput, ToolCall, ToolCallResult, TranscriptEntryInput, TranscriptSpeakerKind, Turn, TurnId, UserId, } from "./conversations/index.js";
7
+ export { Conversation, Conversations, Transcription, TranscriptEntry, } from "./conversations/index.js";
8
+ export type { AudioChunk, ConversationEvents, ConversationId, ConversationOptions, ConversationState, ConversationStatus, CreateConversationOptions, Generation, GenerationStatus, Participant, ParticipantInput, ToolCall, ToolCallResult, TranscriptEntryInput, TranscriptSpeakerKind, Turn, TurnId, UserId, } from "./conversations/index.js";
42
9
  export type { LLM, LLMMessage } from "./providers/llm/types.js";
43
10
  export type { STT } from "./providers/stt/types.js";
44
11
  export type { TTS } from "./providers/tts/types.js";
@@ -0,0 +1,2 @@
1
+ export { Pipeflow } from "./pipeflow.js";
2
+ export type { PipeflowOptions } from "./pipeflow.js";
@@ -0,0 +1,43 @@
1
+ import { Agent, type AgentOptions } from "../agents/agent.js";
2
+ import { Conversations } from "../conversations/conversations.js";
3
+ import type { Persistence } from "../persistence/persistence.js";
4
+ import type { LLM } from "../providers/llm/types.js";
5
+ import type { STT } from "../providers/stt/types.js";
6
+ import type { TTS } from "../providers/tts/types.js";
7
+ export interface PipeflowOptions {
8
+ llm?: LLM;
9
+ stt?: STT;
10
+ tts?: TTS;
11
+ persistence?: Persistence;
12
+ /**
13
+ * Default for created conversations: auto-execute the agents' tools
14
+ * (default `true`), feeding each tool's result back into the model loop.
15
+ * Set `false` to resolve tool calls from your own backend via
16
+ * `resolveToolCall()`. Override per conversation in
17
+ * `pipeflow.conversations.create()`.
18
+ */
19
+ autoExecuteTools?: boolean;
20
+ }
21
+ /**
22
+ * The Pipeflow entry point.
23
+ *
24
+ * ```ts
25
+ * const pipeflow = new Pipeflow({ llm });
26
+ * const agent = pipeflow.agent({ name: "Jarvis", context: "..." });
27
+ * const conversation = await pipeflow.conversations.create({ agents: [agent] });
28
+ * ```
29
+ */
30
+ export declare class Pipeflow {
31
+ readonly llm: LLM | undefined;
32
+ readonly stt: STT | undefined;
33
+ readonly tts: TTS | undefined;
34
+ readonly conversations: Conversations;
35
+ constructor(options?: PipeflowOptions);
36
+ /**
37
+ * Create an agent. Agents inherit the Pipeflow instance's LLM provider so
38
+ * `agent.run()` works out of the box.
39
+ */
40
+ agent(options: Omit<AgentOptions, "llm"> & {
41
+ llm?: LLM;
42
+ }): Agent;
43
+ }
@@ -1,6 +1,6 @@
1
1
  export type { LLM, LLMEvent, LLMMessage, LLMRole, LLMToolCall, LLMToolDefinition, LLMRequest } from "./llm/index.js";
2
2
  export type { STT, STTOptions, STTSession } from "./stt/index.js";
3
3
  export type { TTS, TTSRequest } from "./tts/index.js";
4
- export { complete, streamText, DeepSeekLLM } from "./llm/index.js";
4
+ export { complete, streamText, DeepSeekLLM, OpenRouterLLM } from "./llm/index.js";
5
5
  export { DeepgramSTT } from "./stt/index.js";
6
6
  export { KokoroTTS } from "./tts/index.js";
@@ -0,0 +1,45 @@
1
+ import type { LLM, LLMEvent, LLMRequest, LLMStreamTimingCallback, LLMUsageCallback } from "../../types.js";
2
+ import type { FetchLike } from "../../../shared.js";
3
+ export interface ClaudeOptions {
4
+ apiKey: string;
5
+ /** Defaults to `claude-sonnet-4-5`. */
6
+ model?: string;
7
+ /** Defaults to `https://api.anthropic.com/v1`. */
8
+ baseUrl?: string;
9
+ /** Injectable fetch implementation, mainly for tests. */
10
+ fetch?: FetchLike;
11
+ /** Provider-timeline hook: request-start / headers / first-chunk. */
12
+ onTiming?: LLMStreamTimingCallback;
13
+ /**
14
+ * Abort a stream that delivers no data for this long (default 8000ms) —
15
+ * protects against provider connections that go silent after the model
16
+ * already produced its output. Raise it for providers with slow TTFT.
17
+ */
18
+ idleTimeoutMs?: number;
19
+ /** Called with the provider-reported token usage (when included). */
20
+ onUsage?: LLMUsageCallback;
21
+ }
22
+ /**
23
+ * Claude LLM adapter (Anthropic Messages API over SSE).
24
+ *
25
+ * The wire format differs from the OpenAI-compatible adapters: tools are
26
+ * `input_schema` blocks, tool calls arrive as `tool_use` content blocks with
27
+ * `input_json_delta` fragments (reassembled here into `tool_call` events),
28
+ * tool results are `tool_result` blocks inside user messages, and `max_tokens`
29
+ * is required. There is no `response_format`, so `toolMode` is not supported —
30
+ * tool calling is always native.
31
+ */
32
+ export declare class ClaudeLLM implements LLM {
33
+ private readonly apiKey;
34
+ private readonly model;
35
+ private readonly baseUrl;
36
+ private readonly fetchImpl;
37
+ private readonly onTiming;
38
+ private readonly idleTimeoutMs;
39
+ private readonly onUsage;
40
+ private readonly streams;
41
+ constructor(options: ClaudeOptions);
42
+ /** Cancel every in-flight stream (parallel sub-generations included). */
43
+ stop(): void;
44
+ stream(request: LLMRequest): AsyncGenerator<LLMEvent>;
45
+ }
@@ -0,0 +1,2 @@
1
+ export { ClaudeLLM } from "./claude.js";
2
+ export type { ClaudeOptions } from "./claude.js";
@@ -1,4 +1,4 @@
1
- import type { LLM, LLMEvent, LLMRequest } from "../../types.js";
1
+ import type { LLM, LLMEvent, LLMRequest, LLMStreamTimingCallback, LLMUsageCallback, ToolMode } from "../../types.js";
2
2
  import type { FetchLike } from "../../../shared.js";
3
3
  export interface DeepSeekOptions {
4
4
  apiKey: string;
@@ -8,6 +8,22 @@ export interface DeepSeekOptions {
8
8
  baseUrl?: string;
9
9
  /** Injectable fetch implementation, mainly for tests. */
10
10
  fetch?: FetchLike;
11
+ /** Provider-timeline hook: request-start / headers / first-chunk. */
12
+ onTiming?: LLMStreamTimingCallback;
13
+ /**
14
+ * Abort a stream that delivers no data for this long (default 8000ms) —
15
+ * protects against provider connections that go silent after the model
16
+ * already produced its output. Raise it for providers with slow TTFT.
17
+ */
18
+ idleTimeoutMs?: number;
19
+ /** Called with the provider-reported token usage (when included). */
20
+ onUsage?: LLMUsageCallback;
21
+ /**
22
+ * Default tool encoding for requests that don't set `toolMode` (the
23
+ * request's `toolMode` wins). For models whose endpoints lack native tool
24
+ * calling.
25
+ */
26
+ toolMode?: ToolMode;
11
27
  }
12
28
  /**
13
29
  * DeepSeek LLM adapter (OpenAI-compatible chat completions over SSE).
@@ -17,8 +33,13 @@ export declare class DeepSeekLLM implements LLM {
17
33
  private readonly model;
18
34
  private readonly baseUrl;
19
35
  private readonly fetchImpl;
20
- private abort;
36
+ private readonly onTiming;
37
+ private readonly idleTimeoutMs;
38
+ private readonly onUsage;
39
+ private readonly toolMode;
40
+ private readonly streams;
21
41
  constructor(options: DeepSeekOptions);
42
+ /** Cancel every in-flight stream (parallel sub-generations included). */
22
43
  stop(): void;
23
44
  stream(request: LLMRequest): AsyncGenerator<LLMEvent>;
24
45
  }
@@ -1 +1,4 @@
1
1
  export { DeepSeekLLM } from "./deepseek/deepseek.js";
2
+ export { OpenRouterLLM } from "./openrouter/openrouter.js";
3
+ export { OpenAILLM } from "./openai/openai.js";
4
+ export { ClaudeLLM } from "./claude/claude.js";
@@ -0,0 +1,2 @@
1
+ export { OpenAILLM } from "./openai.js";
2
+ export type { OpenAIOptions } from "./openai.js";
@@ -0,0 +1,45 @@
1
+ import type { LLM, LLMEvent, LLMRequest, LLMStreamTimingCallback, LLMUsageCallback, ToolMode } from "../../types.js";
2
+ import type { FetchLike } from "../../../shared.js";
3
+ export interface OpenAIOptions {
4
+ apiKey: string;
5
+ /** Defaults to `gpt-4o-mini`. */
6
+ model?: string;
7
+ /** Defaults to `https://api.openai.com/v1`. */
8
+ baseUrl?: string;
9
+ /** Injectable fetch implementation, mainly for tests. */
10
+ fetch?: FetchLike;
11
+ /** Provider-timeline hook: request-start / headers / first-chunk. */
12
+ onTiming?: LLMStreamTimingCallback;
13
+ /**
14
+ * Abort a stream that delivers no data for this long (default 8000ms) —
15
+ * protects against provider connections that go silent after the model
16
+ * already produced its output. Raise it for providers with slow TTFT.
17
+ */
18
+ idleTimeoutMs?: number;
19
+ /** Called with the provider-reported token usage (when included). */
20
+ onUsage?: LLMUsageCallback;
21
+ /**
22
+ * Default tool encoding for requests that don't set `toolMode` (the
23
+ * request's `toolMode` wins). For models whose endpoints lack native tool
24
+ * calling.
25
+ */
26
+ toolMode?: ToolMode;
27
+ }
28
+ /**
29
+ * OpenAI LLM adapter (OpenAI-compatible chat completions over SSE).
30
+ */
31
+ export declare class OpenAILLM implements LLM {
32
+ private readonly apiKey;
33
+ private readonly model;
34
+ private readonly baseUrl;
35
+ private readonly fetchImpl;
36
+ private readonly onTiming;
37
+ private readonly idleTimeoutMs;
38
+ private readonly onUsage;
39
+ private readonly toolMode;
40
+ private readonly streams;
41
+ constructor(options: OpenAIOptions);
42
+ /** Cancel every in-flight stream (parallel sub-generations included). */
43
+ stop(): void;
44
+ stream(request: LLMRequest): AsyncGenerator<LLMEvent>;
45
+ }