@code-yeongyu/senpi 2026.5.20-4 → 2026.5.21

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 (794) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +4 -10
  4. package/dist/cli.js.map +1 -1
  5. package/dist/config.d.ts.map +1 -1
  6. package/dist/config.js +10 -4
  7. package/dist/config.js.map +1 -1
  8. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  9. package/dist/core/agent-session-runtime.js +2 -3
  10. package/dist/core/agent-session-runtime.js.map +1 -1
  11. package/dist/core/http-dispatcher.d.ts +21 -0
  12. package/dist/core/http-dispatcher.d.ts.map +1 -0
  13. package/dist/core/http-dispatcher.js +48 -0
  14. package/dist/core/http-dispatcher.js.map +1 -0
  15. package/dist/core/package-manager.d.ts.map +1 -1
  16. package/dist/core/package-manager.js +2 -1
  17. package/dist/core/package-manager.js.map +1 -1
  18. package/dist/core/settings-manager.d.ts +3 -0
  19. package/dist/core/settings-manager.d.ts.map +1 -1
  20. package/dist/core/settings-manager.js +20 -0
  21. package/dist/core/settings-manager.js.map +1 -1
  22. package/dist/main.d.ts.map +1 -1
  23. package/dist/main.js +2 -0
  24. package/dist/main.js.map +1 -1
  25. package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
  26. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  27. package/dist/modes/interactive/components/settings-selector.js +15 -0
  28. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  29. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  30. package/dist/modes/interactive/interactive-mode.js +10 -1
  31. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  32. package/dist/senpi +4 -10
  33. package/dist/utils/paths.d.ts +1 -0
  34. package/dist/utils/paths.d.ts.map +1 -1
  35. package/dist/utils/paths.js +16 -0
  36. package/dist/utils/paths.js.map +1 -1
  37. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  38. package/examples/extensions/custom-provider-anthropic/package.json +2 -2
  39. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  40. package/examples/extensions/sandbox/package-lock.json +2 -2
  41. package/examples/extensions/sandbox/package.json +2 -2
  42. package/examples/extensions/with-deps/package-lock.json +2 -2
  43. package/examples/extensions/with-deps/package.json +3 -3
  44. package/node_modules/@earendil-works/pi-agent-core/README.md +488 -0
  45. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts +24 -0
  46. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -0
  47. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +610 -0
  48. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -0
  49. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +120 -0
  50. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -0
  51. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +405 -0
  52. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -0
  53. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +92 -0
  54. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -0
  55. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +904 -0
  56. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -0
  57. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts +53 -0
  58. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +1 -0
  59. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +174 -0
  60. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js.map +1 -0
  61. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts +95 -0
  62. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -0
  63. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +533 -0
  64. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -0
  65. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts +25 -0
  66. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts.map +1 -0
  67. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js +131 -0
  68. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js.map +1 -0
  69. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts +51 -0
  70. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts.map +1 -0
  71. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +486 -0
  72. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js.map +1 -0
  73. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts +52 -0
  74. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts.map +1 -0
  75. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js +102 -0
  76. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js.map +1 -0
  77. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts +48 -0
  78. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts.map +1 -0
  79. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js +230 -0
  80. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js.map +1 -0
  81. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts +26 -0
  82. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts.map +1 -0
  83. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +101 -0
  84. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js.map +1 -0
  85. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts +33 -0
  86. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts.map +1 -0
  87. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +231 -0
  88. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js.map +1 -0
  89. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts +18 -0
  90. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts.map +1 -0
  91. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +42 -0
  92. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js.map +1 -0
  93. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts +25 -0
  94. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts.map +1 -0
  95. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +114 -0
  96. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js.map +1 -0
  97. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts +11 -0
  98. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts.map +1 -0
  99. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +39 -0
  100. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js.map +1 -0
  101. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +32 -0
  102. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts.map +1 -0
  103. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +197 -0
  104. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js.map +1 -0
  105. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.d.ts +2 -0
  106. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.d.ts.map +1 -0
  107. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.js +50 -0
  108. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.js.map +1 -0
  109. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts +44 -0
  110. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts.map +1 -0
  111. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js +311 -0
  112. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js.map +1 -0
  113. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.d.ts +3 -0
  114. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.d.ts.map +1 -0
  115. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js +30 -0
  116. package/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js.map +1 -0
  117. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +604 -0
  118. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts.map +1 -0
  119. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +103 -0
  120. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js.map +1 -0
  121. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts +14 -0
  122. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts.map +1 -0
  123. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +126 -0
  124. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js.map +1 -0
  125. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts +70 -0
  126. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts.map +1 -0
  127. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +290 -0
  128. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js.map +1 -0
  129. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +20 -0
  130. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -0
  131. package/node_modules/@earendil-works/pi-agent-core/dist/index.js +25 -0
  132. package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -0
  133. package/node_modules/@earendil-works/pi-agent-core/dist/node.d.ts +3 -0
  134. package/node_modules/@earendil-works/pi-agent-core/dist/node.d.ts.map +1 -0
  135. package/node_modules/@earendil-works/pi-agent-core/dist/node.js +3 -0
  136. package/node_modules/@earendil-works/pi-agent-core/dist/node.js.map +1 -0
  137. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +69 -0
  138. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts.map +1 -0
  139. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +278 -0
  140. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -0
  141. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +394 -0
  142. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -0
  143. package/node_modules/@earendil-works/pi-agent-core/dist/types.js +2 -0
  144. package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -0
  145. package/node_modules/@earendil-works/pi-agent-core/package.json +61 -0
  146. package/node_modules/@earendil-works/pi-ai/README.md +1386 -0
  147. package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts +20 -0
  148. package/node_modules/@earendil-works/pi-ai/dist/api-registry.d.ts.map +1 -0
  149. package/node_modules/@earendil-works/pi-ai/dist/api-registry.js +44 -0
  150. package/node_modules/@earendil-works/pi-ai/dist/api-registry.js.map +1 -0
  151. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.d.ts +5 -0
  152. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.d.ts.map +1 -0
  153. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.js +6 -0
  154. package/node_modules/@earendil-works/pi-ai/dist/bedrock-provider.js.map +1 -0
  155. package/node_modules/@earendil-works/pi-ai/dist/cli.d.ts +3 -0
  156. package/node_modules/@earendil-works/pi-ai/dist/cli.d.ts.map +1 -0
  157. package/node_modules/@earendil-works/pi-ai/dist/cli.js +116 -0
  158. package/node_modules/@earendil-works/pi-ai/dist/cli.js.map +1 -0
  159. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts +18 -0
  160. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts.map +1 -0
  161. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +178 -0
  162. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -0
  163. package/node_modules/@earendil-works/pi-ai/dist/image-models.d.ts +10 -0
  164. package/node_modules/@earendil-works/pi-ai/dist/image-models.d.ts.map +1 -0
  165. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +440 -0
  166. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -0
  167. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +442 -0
  168. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -0
  169. package/node_modules/@earendil-works/pi-ai/dist/image-models.js +23 -0
  170. package/node_modules/@earendil-works/pi-ai/dist/image-models.js.map +1 -0
  171. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts +14 -0
  172. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts.map +1 -0
  173. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js +22 -0
  174. package/node_modules/@earendil-works/pi-ai/dist/images-api-registry.js.map +1 -0
  175. package/node_modules/@earendil-works/pi-ai/dist/images.d.ts +4 -0
  176. package/node_modules/@earendil-works/pi-ai/dist/images.d.ts.map +1 -0
  177. package/node_modules/@earendil-works/pi-ai/dist/images.js +14 -0
  178. package/node_modules/@earendil-works/pi-ai/dist/images.js.map +1 -0
  179. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +33 -0
  180. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -0
  181. package/node_modules/@earendil-works/pi-ai/dist/index.js +21 -0
  182. package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -0
  183. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +37 -0
  184. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -0
  185. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +17658 -0
  186. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -0
  187. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +16510 -0
  188. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -0
  189. package/node_modules/@earendil-works/pi-ai/dist/models.js +114 -0
  190. package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -0
  191. package/node_modules/@earendil-works/pi-ai/dist/oauth.d.ts +2 -0
  192. package/node_modules/@earendil-works/pi-ai/dist/oauth.d.ts.map +1 -0
  193. package/node_modules/@earendil-works/pi-ai/dist/oauth.js +2 -0
  194. package/node_modules/@earendil-works/pi-ai/dist/oauth.js.map +1 -0
  195. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts +38 -0
  196. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -0
  197. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +787 -0
  198. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js.map +1 -0
  199. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts +52 -0
  200. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts.map +1 -0
  201. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +1127 -0
  202. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js.map +1 -0
  203. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts +15 -0
  204. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -0
  205. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +229 -0
  206. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js.map +1 -0
  207. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.d.ts +13 -0
  208. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.d.ts.map +1 -0
  209. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.js +26 -0
  210. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.js.map +1 -0
  211. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts +66 -0
  212. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -0
  213. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +401 -0
  214. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -0
  215. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.d.ts +8 -0
  216. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.d.ts.map +1 -0
  217. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.js +29 -0
  218. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.js.map +1 -0
  219. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.d.ts +73 -0
  220. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.d.ts.map +1 -0
  221. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.js +359 -0
  222. package/node_modules/@earendil-works/pi-ai/dist/providers/google-shared.js.map +1 -0
  223. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts +15 -0
  224. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts.map +1 -0
  225. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js +465 -0
  226. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js.map +1 -0
  227. package/node_modules/@earendil-works/pi-ai/dist/providers/google.d.ts +13 -0
  228. package/node_modules/@earendil-works/pi-ai/dist/providers/google.d.ts.map +1 -0
  229. package/node_modules/@earendil-works/pi-ai/dist/providers/google.js +431 -0
  230. package/node_modules/@earendil-works/pi-ai/dist/providers/google.js.map +1 -0
  231. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.d.ts +3 -0
  232. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.d.ts.map +1 -0
  233. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js +129 -0
  234. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js.map +1 -0
  235. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts +4 -0
  236. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts.map +1 -0
  237. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js +34 -0
  238. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js.map +1 -0
  239. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.d.ts +25 -0
  240. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.d.ts.map +1 -0
  241. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js +542 -0
  242. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js.map +1 -0
  243. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts +30 -0
  244. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -0
  245. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js +1112 -0
  246. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js.map +1 -0
  247. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts +22 -0
  248. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts.map +1 -0
  249. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +977 -0
  250. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js.map +1 -0
  251. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.d.ts +3 -0
  252. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.d.ts.map +1 -0
  253. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.js +10 -0
  254. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.js.map +1 -0
  255. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts +19 -0
  256. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts.map +1 -0
  257. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js +579 -0
  258. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js.map +1 -0
  259. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts +13 -0
  260. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts.map +1 -0
  261. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +651 -0
  262. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js.map +1 -0
  263. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.d.ts +35 -0
  264. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.d.ts.map +1 -0
  265. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.js +254 -0
  266. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.js.map +1 -0
  267. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts +38 -0
  268. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts.map +1 -0
  269. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js +174 -0
  270. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js.map +1 -0
  271. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.d.ts +16 -0
  272. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.d.ts.map +1 -0
  273. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.js +186 -0
  274. package/node_modules/@earendil-works/pi-ai/dist/providers/transform-messages.js.map +1 -0
  275. package/node_modules/@earendil-works/pi-ai/dist/session-resources.d.ts +4 -0
  276. package/node_modules/@earendil-works/pi-ai/dist/session-resources.d.ts.map +1 -0
  277. package/node_modules/@earendil-works/pi-ai/dist/session-resources.js +22 -0
  278. package/node_modules/@earendil-works/pi-ai/dist/session-resources.js.map +1 -0
  279. package/node_modules/@earendil-works/pi-ai/dist/stream.d.ts +8 -0
  280. package/node_modules/@earendil-works/pi-ai/dist/stream.d.ts.map +1 -0
  281. package/node_modules/@earendil-works/pi-ai/dist/stream.js +42 -0
  282. package/node_modules/@earendil-works/pi-ai/dist/stream.js.map +1 -0
  283. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.d.ts +22 -0
  284. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.d.ts.map +1 -0
  285. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.js +161 -0
  286. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.js.map +1 -0
  287. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.d.ts +13 -0
  288. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.d.ts.map +1 -0
  289. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.js +23 -0
  290. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.js.map +1 -0
  291. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.d.ts +21 -0
  292. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.d.ts.map +1 -0
  293. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.js +559 -0
  294. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/gemma4.js.map +1 -0
  295. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.d.ts +21 -0
  296. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.d.ts.map +1 -0
  297. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.js +69 -0
  298. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/hermes.js.map +1 -0
  299. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.d.ts +12 -0
  300. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.d.ts.map +1 -0
  301. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.js +570 -0
  302. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/json-mix.js.map +1 -0
  303. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.d.ts +15 -0
  304. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.d.ts.map +1 -0
  305. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.js +935 -0
  306. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/morph-xml.js.map +1 -0
  307. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.d.ts +14 -0
  308. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.d.ts.map +1 -0
  309. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.js +54 -0
  310. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/xml-tool-tag-scanner.js.map +1 -0
  311. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.d.ts +8 -0
  312. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.d.ts.map +1 -0
  313. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.js +295 -0
  314. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/yaml-xml.js.map +1 -0
  315. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.d.ts +4 -0
  316. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.d.ts.map +1 -0
  317. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.js +336 -0
  318. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/stream-wrapper.js.map +1 -0
  319. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.d.ts +103 -0
  320. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.d.ts.map +1 -0
  321. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.js +2 -0
  322. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.js.map +1 -0
  323. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +543 -0
  324. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -0
  325. package/node_modules/@earendil-works/pi-ai/dist/types.js +2 -0
  326. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -0
  327. package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.d.ts +19 -0
  328. package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.d.ts.map +1 -0
  329. package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.js +25 -0
  330. package/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.js.map +1 -0
  331. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts +21 -0
  332. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts.map +1 -0
  333. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +81 -0
  334. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js.map +1 -0
  335. package/node_modules/@earendil-works/pi-ai/dist/utils/hash.d.ts +3 -0
  336. package/node_modules/@earendil-works/pi-ai/dist/utils/hash.d.ts.map +1 -0
  337. package/node_modules/@earendil-works/pi-ai/dist/utils/hash.js +14 -0
  338. package/node_modules/@earendil-works/pi-ai/dist/utils/hash.js.map +1 -0
  339. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.d.ts +2 -0
  340. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.d.ts.map +1 -0
  341. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.js +8 -0
  342. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.js.map +1 -0
  343. package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.d.ts +16 -0
  344. package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.d.ts.map +1 -0
  345. package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.js +113 -0
  346. package/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.js.map +1 -0
  347. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.d.ts +10 -0
  348. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.d.ts.map +1 -0
  349. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js +97 -0
  350. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js.map +1 -0
  351. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.d.ts +25 -0
  352. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.d.ts.map +1 -0
  353. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.js +335 -0
  354. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.js.map +1 -0
  355. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts +30 -0
  356. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -0
  357. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js +292 -0
  358. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -0
  359. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.d.ts +57 -0
  360. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.d.ts.map +1 -0
  361. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js +121 -0
  362. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js.map +1 -0
  363. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.d.ts +3 -0
  364. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.d.ts.map +1 -0
  365. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.js +105 -0
  366. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.js.map +1 -0
  367. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts +34 -0
  368. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -0
  369. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js +385 -0
  370. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js.map +1 -0
  371. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.d.ts +13 -0
  372. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.d.ts.map +1 -0
  373. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.js +31 -0
  374. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.js.map +1 -0
  375. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.d.ts +57 -0
  376. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.d.ts.map +1 -0
  377. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.js +2 -0
  378. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.js.map +1 -0
  379. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +56 -0
  380. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -0
  381. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +151 -0
  382. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -0
  383. package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.d.ts +22 -0
  384. package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.d.ts.map +1 -0
  385. package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.js +26 -0
  386. package/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.js.map +1 -0
  387. package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.d.ts +5 -0
  388. package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.d.ts.map +1 -0
  389. package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.js +49 -0
  390. package/node_modules/@earendil-works/pi-ai/dist/utils/tool-pair-repair.js.map +1 -0
  391. package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.d.ts +17 -0
  392. package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.d.ts.map +1 -0
  393. package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.js +21 -0
  394. package/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.js.map +1 -0
  395. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts +18 -0
  396. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts.map +1 -0
  397. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.js +281 -0
  398. package/node_modules/@earendil-works/pi-ai/dist/utils/validation.js.map +1 -0
  399. package/node_modules/@earendil-works/pi-ai/package.json +113 -0
  400. package/node_modules/@earendil-works/pi-tui/README.md +779 -0
  401. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +54 -0
  402. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -0
  403. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +632 -0
  404. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -0
  405. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +22 -0
  406. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts.map +1 -0
  407. package/node_modules/@earendil-works/pi-tui/dist/components/box.js +104 -0
  408. package/node_modules/@earendil-works/pi-tui/dist/components/box.js.map +1 -0
  409. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts +22 -0
  410. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts.map +1 -0
  411. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js +35 -0
  412. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js.map +1 -0
  413. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +249 -0
  414. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -0
  415. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +1916 -0
  416. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -0
  417. package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts +28 -0
  418. package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +1 -0
  419. package/node_modules/@earendil-works/pi-tui/dist/components/image.js +89 -0
  420. package/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +1 -0
  421. package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts +37 -0
  422. package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -0
  423. package/node_modules/@earendil-works/pi-tui/dist/components/input.js +426 -0
  424. package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -0
  425. package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +40 -0
  426. package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts.map +1 -0
  427. package/node_modules/@earendil-works/pi-tui/dist/components/loader.js +95 -0
  428. package/node_modules/@earendil-works/pi-tui/dist/components/loader.js.map +1 -0
  429. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +90 -0
  430. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +1 -0
  431. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +634 -0
  432. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +1 -0
  433. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +50 -0
  434. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts.map +1 -0
  435. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +159 -0
  436. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js.map +1 -0
  437. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +50 -0
  438. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +1 -0
  439. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +185 -0
  440. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +1 -0
  441. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts +12 -0
  442. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts.map +1 -0
  443. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js +23 -0
  444. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js.map +1 -0
  445. package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts +19 -0
  446. package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts.map +1 -0
  447. package/node_modules/@earendil-works/pi-tui/dist/components/text.js +89 -0
  448. package/node_modules/@earendil-works/pi-tui/dist/components/text.js.map +1 -0
  449. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts +13 -0
  450. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts.map +1 -0
  451. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js +51 -0
  452. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js.map +1 -0
  453. package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts +39 -0
  454. package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts.map +1 -0
  455. package/node_modules/@earendil-works/pi-tui/dist/editor-component.js +2 -0
  456. package/node_modules/@earendil-works/pi-tui/dist/editor-component.js.map +1 -0
  457. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts +16 -0
  458. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +1 -0
  459. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +110 -0
  460. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +1 -0
  461. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +23 -0
  462. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -0
  463. package/node_modules/@earendil-works/pi-tui/dist/index.js +32 -0
  464. package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -0
  465. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +193 -0
  466. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +1 -0
  467. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +174 -0
  468. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -0
  469. package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts +184 -0
  470. package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts.map +1 -0
  471. package/node_modules/@earendil-works/pi-tui/dist/keys.js +1173 -0
  472. package/node_modules/@earendil-works/pi-tui/dist/keys.js.map +1 -0
  473. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts +28 -0
  474. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts.map +1 -0
  475. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js +44 -0
  476. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js.map +1 -0
  477. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +50 -0
  478. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts.map +1 -0
  479. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +361 -0
  480. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js.map +1 -0
  481. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +90 -0
  482. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -0
  483. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +336 -0
  484. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -0
  485. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +88 -0
  486. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -0
  487. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +329 -0
  488. package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -0
  489. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +231 -0
  490. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -0
  491. package/node_modules/@earendil-works/pi-tui/dist/tui.js +1230 -0
  492. package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -0
  493. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts +17 -0
  494. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts.map +1 -0
  495. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js +25 -0
  496. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js.map +1 -0
  497. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +79 -0
  498. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -0
  499. package/node_modules/@earendil-works/pi-tui/dist/utils.js +1031 -0
  500. package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -0
  501. package/node_modules/@earendil-works/pi-tui/package.json +48 -0
  502. package/node_modules/@smithy/node-http-handler/LICENSE +201 -0
  503. package/node_modules/@smithy/node-http-handler/README.md +9 -0
  504. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +724 -0
  505. package/node_modules/@smithy/node-http-handler/dist-es/constants.js +1 -0
  506. package/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +9 -0
  507. package/node_modules/@smithy/node-http-handler/dist-es/index.js +3 -0
  508. package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +216 -0
  509. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +87 -0
  510. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +32 -0
  511. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +170 -0
  512. package/node_modules/@smithy/node-http-handler/dist-es/readable.mock.js +21 -0
  513. package/node_modules/@smithy/node-http-handler/dist-es/server.mock.js +88 -0
  514. package/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +36 -0
  515. package/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +21 -0
  516. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +22 -0
  517. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +23 -0
  518. package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js +8 -0
  519. package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/index.js +41 -0
  520. package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/readable.mock.js +21 -0
  521. package/node_modules/@smithy/node-http-handler/dist-es/timing.js +4 -0
  522. package/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +56 -0
  523. package/node_modules/@smithy/node-http-handler/dist-types/constants.d.ts +5 -0
  524. package/node_modules/@smithy/node-http-handler/dist-types/get-transformed-headers.d.ts +4 -0
  525. package/node_modules/@smithy/node-http-handler/dist-types/index.d.ts +3 -0
  526. package/node_modules/@smithy/node-http-handler/dist-types/node-http-handler.d.ts +46 -0
  527. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +24 -0
  528. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-pool.d.ts +12 -0
  529. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +63 -0
  530. package/node_modules/@smithy/node-http-handler/dist-types/readable.mock.d.ts +13 -0
  531. package/node_modules/@smithy/node-http-handler/dist-types/server.mock.d.ts +12 -0
  532. package/node_modules/@smithy/node-http-handler/dist-types/set-connection-timeout.d.ts +2 -0
  533. package/node_modules/@smithy/node-http-handler/dist-types/set-request-timeout.d.ts +6 -0
  534. package/node_modules/@smithy/node-http-handler/dist-types/set-socket-keep-alive.d.ts +6 -0
  535. package/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +2 -0
  536. package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/collector.d.ts +5 -0
  537. package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/index.d.ts +6 -0
  538. package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/readable.mock.d.ts +13 -0
  539. package/node_modules/@smithy/node-http-handler/dist-types/timing.d.ts +8 -0
  540. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/constants.d.ts +5 -0
  541. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/get-transformed-headers.d.ts +4 -0
  542. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/index.d.ts +3 -0
  543. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http-handler.d.ts +46 -0
  544. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-manager.d.ts +24 -0
  545. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-pool.d.ts +12 -0
  546. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-handler.d.ts +63 -0
  547. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/readable.mock.d.ts +13 -0
  548. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/server.mock.d.ts +12 -0
  549. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-connection-timeout.d.ts +2 -0
  550. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-request-timeout.d.ts +6 -0
  551. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-keep-alive.d.ts +6 -0
  552. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +2 -0
  553. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/collector.d.ts +5 -0
  554. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/index.d.ts +6 -0
  555. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/readable.mock.d.ts +13 -0
  556. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/timing.d.ts +8 -0
  557. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/write-request-body.d.ts +11 -0
  558. package/node_modules/@smithy/node-http-handler/dist-types/write-request-body.d.ts +11 -0
  559. package/node_modules/@smithy/node-http-handler/package.json +68 -0
  560. package/node_modules/@smithy/types/LICENSE +201 -0
  561. package/node_modules/@smithy/types/README.md +115 -0
  562. package/node_modules/@smithy/types/dist-cjs/index.js +91 -0
  563. package/node_modules/@smithy/types/dist-es/abort-handler.js +1 -0
  564. package/node_modules/@smithy/types/dist-es/abort.js +1 -0
  565. package/node_modules/@smithy/types/dist-es/auth/HttpApiKeyAuth.js +5 -0
  566. package/node_modules/@smithy/types/dist-es/auth/HttpAuthScheme.js +1 -0
  567. package/node_modules/@smithy/types/dist-es/auth/HttpAuthSchemeProvider.js +1 -0
  568. package/node_modules/@smithy/types/dist-es/auth/HttpSigner.js +1 -0
  569. package/node_modules/@smithy/types/dist-es/auth/IdentityProviderConfig.js +1 -0
  570. package/node_modules/@smithy/types/dist-es/auth/auth.js +5 -0
  571. package/node_modules/@smithy/types/dist-es/auth/index.js +6 -0
  572. package/node_modules/@smithy/types/dist-es/blob/blob-payload-input-types.js +1 -0
  573. package/node_modules/@smithy/types/dist-es/checksum.js +1 -0
  574. package/node_modules/@smithy/types/dist-es/client.js +1 -0
  575. package/node_modules/@smithy/types/dist-es/command.js +1 -0
  576. package/node_modules/@smithy/types/dist-es/connection/config.js +1 -0
  577. package/node_modules/@smithy/types/dist-es/connection/index.js +3 -0
  578. package/node_modules/@smithy/types/dist-es/connection/manager.js +1 -0
  579. package/node_modules/@smithy/types/dist-es/connection/pool.js +1 -0
  580. package/node_modules/@smithy/types/dist-es/crypto.js +1 -0
  581. package/node_modules/@smithy/types/dist-es/downlevel-ts3.4/transform/type-transform.js +1 -0
  582. package/node_modules/@smithy/types/dist-es/encode.js +1 -0
  583. package/node_modules/@smithy/types/dist-es/endpoint.js +5 -0
  584. package/node_modules/@smithy/types/dist-es/endpoints/EndpointRuleObject.js +1 -0
  585. package/node_modules/@smithy/types/dist-es/endpoints/ErrorRuleObject.js +1 -0
  586. package/node_modules/@smithy/types/dist-es/endpoints/RuleSetObject.js +1 -0
  587. package/node_modules/@smithy/types/dist-es/endpoints/TreeRuleObject.js +1 -0
  588. package/node_modules/@smithy/types/dist-es/endpoints/index.js +5 -0
  589. package/node_modules/@smithy/types/dist-es/endpoints/shared.js +1 -0
  590. package/node_modules/@smithy/types/dist-es/eventStream.js +1 -0
  591. package/node_modules/@smithy/types/dist-es/extensions/checksum.js +38 -0
  592. package/node_modules/@smithy/types/dist-es/extensions/defaultClientConfiguration.js +7 -0
  593. package/node_modules/@smithy/types/dist-es/extensions/defaultExtensionConfiguration.js +1 -0
  594. package/node_modules/@smithy/types/dist-es/extensions/index.js +3 -0
  595. package/node_modules/@smithy/types/dist-es/extensions/retry.js +1 -0
  596. package/node_modules/@smithy/types/dist-es/externals-check/browser-externals-check.js +1 -0
  597. package/node_modules/@smithy/types/dist-es/feature-ids.js +1 -0
  598. package/node_modules/@smithy/types/dist-es/http/httpHandlerInitialization.js +1 -0
  599. package/node_modules/@smithy/types/dist-es/http.js +5 -0
  600. package/node_modules/@smithy/types/dist-es/identity/apiKeyIdentity.js +1 -0
  601. package/node_modules/@smithy/types/dist-es/identity/awsCredentialIdentity.js +1 -0
  602. package/node_modules/@smithy/types/dist-es/identity/identity.js +1 -0
  603. package/node_modules/@smithy/types/dist-es/identity/index.js +4 -0
  604. package/node_modules/@smithy/types/dist-es/identity/tokenIdentity.js +1 -0
  605. package/node_modules/@smithy/types/dist-es/index.js +42 -0
  606. package/node_modules/@smithy/types/dist-es/logger.js +1 -0
  607. package/node_modules/@smithy/types/dist-es/middleware.js +1 -0
  608. package/node_modules/@smithy/types/dist-es/pagination.js +1 -0
  609. package/node_modules/@smithy/types/dist-es/profile.js +6 -0
  610. package/node_modules/@smithy/types/dist-es/response.js +1 -0
  611. package/node_modules/@smithy/types/dist-es/retry.js +1 -0
  612. package/node_modules/@smithy/types/dist-es/schema/schema-deprecated.js +1 -0
  613. package/node_modules/@smithy/types/dist-es/schema/schema.js +1 -0
  614. package/node_modules/@smithy/types/dist-es/schema/sentinels.js +1 -0
  615. package/node_modules/@smithy/types/dist-es/schema/static-schemas.js +1 -0
  616. package/node_modules/@smithy/types/dist-es/schema/traits.js +1 -0
  617. package/node_modules/@smithy/types/dist-es/serde.js +1 -0
  618. package/node_modules/@smithy/types/dist-es/shapes.js +1 -0
  619. package/node_modules/@smithy/types/dist-es/signature.js +1 -0
  620. package/node_modules/@smithy/types/dist-es/stream.js +1 -0
  621. package/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-common-types.js +1 -0
  622. package/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-payload-input-types.js +1 -0
  623. package/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-payload-output-types.js +1 -0
  624. package/node_modules/@smithy/types/dist-es/transfer.js +6 -0
  625. package/node_modules/@smithy/types/dist-es/transform/client-method-transforms.js +1 -0
  626. package/node_modules/@smithy/types/dist-es/transform/client-payload-blob-type-narrow.js +1 -0
  627. package/node_modules/@smithy/types/dist-es/transform/exact.js +1 -0
  628. package/node_modules/@smithy/types/dist-es/transform/mutable.js +1 -0
  629. package/node_modules/@smithy/types/dist-es/transform/no-undefined.js +1 -0
  630. package/node_modules/@smithy/types/dist-es/transform/type-transform.js +1 -0
  631. package/node_modules/@smithy/types/dist-es/uri.js +1 -0
  632. package/node_modules/@smithy/types/dist-es/util.js +1 -0
  633. package/node_modules/@smithy/types/dist-es/waiter.js +1 -0
  634. package/node_modules/@smithy/types/dist-types/abort-handler.d.ts +7 -0
  635. package/node_modules/@smithy/types/dist-types/abort.d.ts +50 -0
  636. package/node_modules/@smithy/types/dist-types/auth/HttpApiKeyAuth.d.ts +7 -0
  637. package/node_modules/@smithy/types/dist-types/auth/HttpAuthScheme.d.ts +49 -0
  638. package/node_modules/@smithy/types/dist-types/auth/HttpAuthSchemeProvider.d.ts +20 -0
  639. package/node_modules/@smithy/types/dist-types/auth/HttpSigner.d.ts +41 -0
  640. package/node_modules/@smithy/types/dist-types/auth/IdentityProviderConfig.d.ts +14 -0
  641. package/node_modules/@smithy/types/dist-types/auth/auth.d.ts +57 -0
  642. package/node_modules/@smithy/types/dist-types/auth/index.d.ts +6 -0
  643. package/node_modules/@smithy/types/dist-types/blob/blob-payload-input-types.d.ts +40 -0
  644. package/node_modules/@smithy/types/dist-types/checksum.d.ts +63 -0
  645. package/node_modules/@smithy/types/dist-types/client.d.ts +57 -0
  646. package/node_modules/@smithy/types/dist-types/command.d.ts +28 -0
  647. package/node_modules/@smithy/types/dist-types/connection/config.d.ts +10 -0
  648. package/node_modules/@smithy/types/dist-types/connection/index.d.ts +3 -0
  649. package/node_modules/@smithy/types/dist-types/connection/manager.d.ts +34 -0
  650. package/node_modules/@smithy/types/dist-types/connection/pool.d.ts +32 -0
  651. package/node_modules/@smithy/types/dist-types/crypto.d.ts +60 -0
  652. package/node_modules/@smithy/types/dist-types/downlevel-ts3.4/transform/type-transform.d.ts +25 -0
  653. package/node_modules/@smithy/types/dist-types/encode.d.ts +31 -0
  654. package/node_modules/@smithy/types/dist-types/endpoint.d.ts +77 -0
  655. package/node_modules/@smithy/types/dist-types/endpoints/EndpointRuleObject.d.ts +27 -0
  656. package/node_modules/@smithy/types/dist-types/endpoints/ErrorRuleObject.d.ts +10 -0
  657. package/node_modules/@smithy/types/dist-types/endpoints/RuleSetObject.d.ts +28 -0
  658. package/node_modules/@smithy/types/dist-types/endpoints/TreeRuleObject.d.ts +16 -0
  659. package/node_modules/@smithy/types/dist-types/endpoints/index.d.ts +5 -0
  660. package/node_modules/@smithy/types/dist-types/endpoints/shared.d.ts +55 -0
  661. package/node_modules/@smithy/types/dist-types/eventStream.d.ts +137 -0
  662. package/node_modules/@smithy/types/dist-types/extensions/checksum.d.ts +58 -0
  663. package/node_modules/@smithy/types/dist-types/extensions/defaultClientConfiguration.d.ts +33 -0
  664. package/node_modules/@smithy/types/dist-types/extensions/defaultExtensionConfiguration.d.ts +9 -0
  665. package/node_modules/@smithy/types/dist-types/extensions/index.d.ts +4 -0
  666. package/node_modules/@smithy/types/dist-types/extensions/retry.d.ts +18 -0
  667. package/node_modules/@smithy/types/dist-types/externals-check/browser-externals-check.d.ts +35 -0
  668. package/node_modules/@smithy/types/dist-types/feature-ids.d.ts +16 -0
  669. package/node_modules/@smithy/types/dist-types/http/httpHandlerInitialization.d.ts +128 -0
  670. package/node_modules/@smithy/types/dist-types/http.d.ts +112 -0
  671. package/node_modules/@smithy/types/dist-types/identity/apiKeyIdentity.d.ts +14 -0
  672. package/node_modules/@smithy/types/dist-types/identity/awsCredentialIdentity.d.ts +31 -0
  673. package/node_modules/@smithy/types/dist-types/identity/identity.d.ts +15 -0
  674. package/node_modules/@smithy/types/dist-types/identity/index.d.ts +4 -0
  675. package/node_modules/@smithy/types/dist-types/identity/tokenIdentity.d.ts +14 -0
  676. package/node_modules/@smithy/types/dist-types/index.d.ts +42 -0
  677. package/node_modules/@smithy/types/dist-types/logger.d.ts +13 -0
  678. package/node_modules/@smithy/types/dist-types/middleware.d.ts +534 -0
  679. package/node_modules/@smithy/types/dist-types/pagination.d.ts +33 -0
  680. package/node_modules/@smithy/types/dist-types/profile.d.ts +30 -0
  681. package/node_modules/@smithy/types/dist-types/response.d.ts +40 -0
  682. package/node_modules/@smithy/types/dist-types/retry.d.ts +133 -0
  683. package/node_modules/@smithy/types/dist-types/schema/schema-deprecated.d.ts +136 -0
  684. package/node_modules/@smithy/types/dist-types/schema/schema.d.ts +230 -0
  685. package/node_modules/@smithy/types/dist-types/schema/sentinels.d.ts +65 -0
  686. package/node_modules/@smithy/types/dist-types/schema/static-schemas.d.ts +82 -0
  687. package/node_modules/@smithy/types/dist-types/schema/traits.d.ts +46 -0
  688. package/node_modules/@smithy/types/dist-types/serde.d.ts +114 -0
  689. package/node_modules/@smithy/types/dist-types/shapes.d.ts +82 -0
  690. package/node_modules/@smithy/types/dist-types/signature.d.ts +155 -0
  691. package/node_modules/@smithy/types/dist-types/stream.d.ts +22 -0
  692. package/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-common-types.d.ts +32 -0
  693. package/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-payload-input-types.d.ts +60 -0
  694. package/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-payload-output-types.d.ts +51 -0
  695. package/node_modules/@smithy/types/dist-types/transfer.d.ts +41 -0
  696. package/node_modules/@smithy/types/dist-types/transform/client-method-transforms.d.ts +26 -0
  697. package/node_modules/@smithy/types/dist-types/transform/client-payload-blob-type-narrow.d.ts +77 -0
  698. package/node_modules/@smithy/types/dist-types/transform/exact.d.ts +6 -0
  699. package/node_modules/@smithy/types/dist-types/transform/mutable.d.ts +6 -0
  700. package/node_modules/@smithy/types/dist-types/transform/no-undefined.d.ts +68 -0
  701. package/node_modules/@smithy/types/dist-types/transform/type-transform.d.ts +34 -0
  702. package/node_modules/@smithy/types/dist-types/ts3.4/abort-handler.d.ts +7 -0
  703. package/node_modules/@smithy/types/dist-types/ts3.4/abort.d.ts +50 -0
  704. package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpApiKeyAuth.d.ts +7 -0
  705. package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpAuthScheme.d.ts +49 -0
  706. package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpAuthSchemeProvider.d.ts +20 -0
  707. package/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpSigner.d.ts +41 -0
  708. package/node_modules/@smithy/types/dist-types/ts3.4/auth/IdentityProviderConfig.d.ts +14 -0
  709. package/node_modules/@smithy/types/dist-types/ts3.4/auth/auth.d.ts +57 -0
  710. package/node_modules/@smithy/types/dist-types/ts3.4/auth/index.d.ts +6 -0
  711. package/node_modules/@smithy/types/dist-types/ts3.4/blob/blob-payload-input-types.d.ts +40 -0
  712. package/node_modules/@smithy/types/dist-types/ts3.4/checksum.d.ts +63 -0
  713. package/node_modules/@smithy/types/dist-types/ts3.4/client.d.ts +57 -0
  714. package/node_modules/@smithy/types/dist-types/ts3.4/command.d.ts +28 -0
  715. package/node_modules/@smithy/types/dist-types/ts3.4/connection/config.d.ts +10 -0
  716. package/node_modules/@smithy/types/dist-types/ts3.4/connection/index.d.ts +3 -0
  717. package/node_modules/@smithy/types/dist-types/ts3.4/connection/manager.d.ts +34 -0
  718. package/node_modules/@smithy/types/dist-types/ts3.4/connection/pool.d.ts +32 -0
  719. package/node_modules/@smithy/types/dist-types/ts3.4/crypto.d.ts +60 -0
  720. package/node_modules/@smithy/types/dist-types/ts3.4/downlevel-ts3.4/transform/type-transform.d.ts +41 -0
  721. package/node_modules/@smithy/types/dist-types/ts3.4/encode.d.ts +31 -0
  722. package/node_modules/@smithy/types/dist-types/ts3.4/endpoint.d.ts +77 -0
  723. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/EndpointRuleObject.d.ts +27 -0
  724. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/ErrorRuleObject.d.ts +10 -0
  725. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/RuleSetObject.d.ts +28 -0
  726. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/TreeRuleObject.d.ts +16 -0
  727. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/index.d.ts +5 -0
  728. package/node_modules/@smithy/types/dist-types/ts3.4/endpoints/shared.d.ts +55 -0
  729. package/node_modules/@smithy/types/dist-types/ts3.4/eventStream.d.ts +137 -0
  730. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/checksum.d.ts +58 -0
  731. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/defaultClientConfiguration.d.ts +33 -0
  732. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/defaultExtensionConfiguration.d.ts +9 -0
  733. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/index.d.ts +4 -0
  734. package/node_modules/@smithy/types/dist-types/ts3.4/extensions/retry.d.ts +18 -0
  735. package/node_modules/@smithy/types/dist-types/ts3.4/externals-check/browser-externals-check.d.ts +35 -0
  736. package/node_modules/@smithy/types/dist-types/ts3.4/feature-ids.d.ts +16 -0
  737. package/node_modules/@smithy/types/dist-types/ts3.4/http/httpHandlerInitialization.d.ts +128 -0
  738. package/node_modules/@smithy/types/dist-types/ts3.4/http.d.ts +112 -0
  739. package/node_modules/@smithy/types/dist-types/ts3.4/identity/apiKeyIdentity.d.ts +14 -0
  740. package/node_modules/@smithy/types/dist-types/ts3.4/identity/awsCredentialIdentity.d.ts +31 -0
  741. package/node_modules/@smithy/types/dist-types/ts3.4/identity/identity.d.ts +15 -0
  742. package/node_modules/@smithy/types/dist-types/ts3.4/identity/index.d.ts +4 -0
  743. package/node_modules/@smithy/types/dist-types/ts3.4/identity/tokenIdentity.d.ts +14 -0
  744. package/node_modules/@smithy/types/dist-types/ts3.4/index.d.ts +42 -0
  745. package/node_modules/@smithy/types/dist-types/ts3.4/logger.d.ts +13 -0
  746. package/node_modules/@smithy/types/dist-types/ts3.4/middleware.d.ts +534 -0
  747. package/node_modules/@smithy/types/dist-types/ts3.4/pagination.d.ts +33 -0
  748. package/node_modules/@smithy/types/dist-types/ts3.4/profile.d.ts +30 -0
  749. package/node_modules/@smithy/types/dist-types/ts3.4/response.d.ts +40 -0
  750. package/node_modules/@smithy/types/dist-types/ts3.4/retry.d.ts +133 -0
  751. package/node_modules/@smithy/types/dist-types/ts3.4/schema/schema-deprecated.d.ts +142 -0
  752. package/node_modules/@smithy/types/dist-types/ts3.4/schema/schema.d.ts +245 -0
  753. package/node_modules/@smithy/types/dist-types/ts3.4/schema/sentinels.d.ts +65 -0
  754. package/node_modules/@smithy/types/dist-types/ts3.4/schema/static-schemas.d.ts +101 -0
  755. package/node_modules/@smithy/types/dist-types/ts3.4/schema/traits.d.ts +46 -0
  756. package/node_modules/@smithy/types/dist-types/ts3.4/serde.d.ts +114 -0
  757. package/node_modules/@smithy/types/dist-types/ts3.4/shapes.d.ts +82 -0
  758. package/node_modules/@smithy/types/dist-types/ts3.4/signature.d.ts +155 -0
  759. package/node_modules/@smithy/types/dist-types/ts3.4/stream.d.ts +22 -0
  760. package/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-common-types.d.ts +32 -0
  761. package/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-payload-input-types.d.ts +60 -0
  762. package/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-payload-output-types.d.ts +51 -0
  763. package/node_modules/@smithy/types/dist-types/ts3.4/transfer.d.ts +41 -0
  764. package/node_modules/@smithy/types/dist-types/ts3.4/transform/client-method-transforms.d.ts +26 -0
  765. package/node_modules/@smithy/types/dist-types/ts3.4/transform/client-payload-blob-type-narrow.d.ts +81 -0
  766. package/node_modules/@smithy/types/dist-types/ts3.4/transform/exact.d.ts +14 -0
  767. package/node_modules/@smithy/types/dist-types/ts3.4/transform/mutable.d.ts +6 -0
  768. package/node_modules/@smithy/types/dist-types/ts3.4/transform/no-undefined.d.ts +88 -0
  769. package/node_modules/@smithy/types/dist-types/ts3.4/transform/type-transform.d.ts +41 -0
  770. package/node_modules/@smithy/types/dist-types/ts3.4/uri.d.ts +17 -0
  771. package/node_modules/@smithy/types/dist-types/ts3.4/util.d.ts +192 -0
  772. package/node_modules/@smithy/types/dist-types/ts3.4/waiter.d.ts +35 -0
  773. package/node_modules/@smithy/types/dist-types/uri.d.ts +17 -0
  774. package/node_modules/@smithy/types/dist-types/util.d.ts +176 -0
  775. package/node_modules/@smithy/types/dist-types/waiter.d.ts +35 -0
  776. package/node_modules/@smithy/types/package.json +61 -0
  777. package/node_modules/marked/LICENSE.md +44 -0
  778. package/node_modules/marked/README.md +106 -0
  779. package/node_modules/marked/bin/main.js +282 -0
  780. package/node_modules/marked/bin/marked.js +15 -0
  781. package/node_modules/marked/lib/marked.cjs +2211 -0
  782. package/node_modules/marked/lib/marked.cjs.map +7 -0
  783. package/node_modules/marked/lib/marked.d.cts +728 -0
  784. package/node_modules/marked/lib/marked.d.ts +728 -0
  785. package/node_modules/marked/lib/marked.esm.js +2189 -0
  786. package/node_modules/marked/lib/marked.esm.js.map +7 -0
  787. package/node_modules/marked/lib/marked.umd.js +2213 -0
  788. package/node_modules/marked/lib/marked.umd.js.map +7 -0
  789. package/node_modules/marked/man/marked.1 +111 -0
  790. package/node_modules/marked/man/marked.1.md +92 -0
  791. package/node_modules/marked/marked.min.js +69 -0
  792. package/node_modules/marked/package.json +111 -0
  793. package/npm-shrinkwrap.json +1841 -0
  794. package/package.json +49 -31
@@ -0,0 +1 @@
1
+ {"version":3,"file":"morph-xml.js","sourceRoot":"","sources":["../../../src/tool-call-middleware/protocols/morph-xml.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjH,MAAM,MAAM,GAAG,KAAK,CAAC;AAErB;;;GAGG;AACH,MAAM,UAAU,+BAA+B,CAAC,KAAa,EAAU;IACtE,MAAM,SAAS,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAEjD,MAAM,MAAM,GAAG;kEACkD,CAAC;IAElE,MAAM,WAAW,GAAG,CAAC,6CAA6C,EAAE,S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\"../../utils/validation.ts\";\nimport type { ParsedToolCall, ParserOptions, StreamParser, StreamParserEvent } from \"../types.ts\";\nimport { findEarliestXmlToolTag, findSelfClosingToolTag, getSafeXmlTextLength } from \"./xml-tool-tag-scanner.ts\";\n\nconst INDENT = \" \";\n\n/**\n * Formats tools as an XML-style system prompt for MorphXml protocol.\n * Ported from ai-sdk-tool-call-middleware morph-xml-prompt.ts\n */\nexport function morphXmlFormatToolsSystemPrompt(tools: Tool[]): string {\n\tconst toolsText = renderToolsForXmlPrompt(tools);\n\n\tconst header = `# Tools\nYou may call one or more functions to assist with the user query.`;\n\n\tconst definitions = [\"You have access to the following functions:\", \"<tools>\", toolsText, \"</tools>\"].join(\"\\n\");\n\n\tconst rules = `<rules>\n- Use exactly one XML element whose tag name is the function name.\n- Put each parameter as a child element.\n- Values must follow the schema exactly (numbers, arrays, objects, enums -> copy as-is).\n- For array parameters, wrap each element in an <item> tag inside the parameter tag.\n- For array<object> parameters, every <item> must contain the object's fields as child tags.\n- Never repeat the array parameter tag to represent multiple entries.\n- Do not add or remove functions or parameters.\n- Each required parameter must appear once.\n- Output nothing before or after the function call.\n- It is also possible to call multiple types of functions in one turn or to call a single function multiple times.\n</rules>`;\n\n\tconst examples = `For each function call, output the function name and parameter in the following format:\n<example_function_name>\n <example_parameter_1>value_1</example_parameter_1>\n <example_parameter_2>This is the value for the second parameter\nthat can span\nmultiple lines</example_parameter_2>\n</example_function_name>`;\n\n\tconst arrayExample = `Array example:\n<example_array_tool>\n <items>\n <item>first</item>\n <item>second</item>\n </items>\n</example_array_tool>\n\nArray<object> example:\n<example_todo_tool>\n <todos>\n <item>\n <content>Inspect parser edge cases</content>\n <status>in_progress</status>\n <priority>high</priority>\n </item>\n <item>\n <content>Add regression tests</content>\n <status>pending</status>\n <priority>medium</priority>\n </item>\n </todos>\n</example_todo_tool>`;\n\n\treturn [header, definitions, rules, examples, arrayExample]\n\t\t.filter((section) => section.trim().length > 0)\n\t\t.join(\"\\n\\n\");\n}\n\nfunction renderToolsForXmlPrompt(tools: Tool[]): string {\n\tif (!tools.length) {\n\t\treturn \"none\";\n\t}\n\n\treturn tools.map(renderToolForXmlPrompt).join(\"\\n\\n\");\n}\n\nfunction renderToolForXmlPrompt(tool: Tool): string {\n\tconst lines: string[] = [`name: ${tool.name}`];\n\n\tif (tool.description) {\n\t\tlines.push(`description: ${tool.description}`);\n\t}\n\n\tlines.push(\"parameters:\");\n\tconst normalizedSchema = normalizeSchema(tool.parameters as Record<string, unknown>);\n\tlines.push(...renderParametersSummary(normalizedSchema, 1));\n\tlines.push(`schema: ${stringifySchema(normalizedSchema)}`);\n\n\treturn lines.join(\"\\n\");\n}\n\nfunction normalizeSchema(\n\tschema: Record<string, unknown> | boolean | string | undefined,\n): Record<string, unknown> | boolean | undefined {\n\tif (typeof schema === \"string\") {\n\t\ttry {\n\t\t\treturn JSON.parse(schema) as Record<string, unknown>;\n\t\t} catch {\n\t\t\treturn { type: \"string\", const: schema };\n\t\t}\n\t}\n\n\treturn schema;\n}\n\nfunction renderParametersSummary(schema: Record<string, unknown> | boolean | undefined, indentLevel: number): string[] {\n\tconst indent = INDENT.repeat(indentLevel);\n\n\tif (schema === undefined || schema === null) {\n\t\treturn [`${indent}(none)`];\n\t}\n\n\tif (schema === true) {\n\t\treturn [`${indent}(any)`];\n\t}\n\n\tif (schema === false) {\n\t\treturn [`${indent}(no valid parameters)`];\n\t}\n\n\tif (typeof schema !== \"object\") {\n\t\treturn [`${indent}- value (${String(schema)})`];\n\t}\n\n\tconst schemaObj = schema as Record<string, unknown>;\n\tconst schemaType = schemaObj.type;\n\tconst schemaTypeArray: string[] = [];\n\n\tif (Array.isArray(schemaType)) {\n\t\tschemaTypeArray.push(...schemaType);\n\t} else if (typeof schemaType === \"string\") {\n\t\tschemaTypeArray.push(schemaType);\n\t}\n\n\tconst isObjectLike = schemaTypeArray.includes(\"object\") || !!schemaObj.properties;\n\n\tif (isObjectLike) {\n\t\tconst properties = (schemaObj.properties ?? {}) as Record<string, Record<string, unknown> | boolean>;\n\t\tconst requiredSet = new Set(Array.isArray(schemaObj.required) ? schemaObj.required : []);\n\t\tconst propertyNames = Object.keys(properties).sort();\n\n\t\tif (propertyNames.length === 0) {\n\t\t\treturn [`${indent}(no named parameters)`];\n\t\t}\n\n\t\tconst lines: string[] = [];\n\t\tfor (const propName of propertyNames) {\n\t\t\tconst propSchema = properties[propName];\n\t\t\tlines.push(\n\t\t\t\trenderPropertySummaryLine({\n\t\t\t\t\tindent,\n\t\t\t\t\tpropName,\n\t\t\t\t\tpropSchema,\n\t\t\t\t\trequired: requiredSet.has(propName),\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\treturn lines.length ? lines : [`${indent}(no parameters)`];\n\t}\n\n\treturn [`${indent}- value (${summarizeType(schemaObj)})`];\n}\n\nfunction renderPropertySummaryLine({\n\tindent,\n\tpropName,\n\tpropSchema,\n\trequired,\n}: {\n\tindent: string;\n\tpropName: string;\n\tpropSchema: Record<string, unknown> | boolean | undefined;\n\trequired: boolean;\n}): string {\n\tconst typeLabel = summarizeType(propSchema);\n\tconst requiredLabel = required ? \"required\" : \"optional\";\n\tconst extras = collectPropertyExtras(propSchema);\n\tconst extraText = extras.length ? ` - ${extras.join(\"; \")}` : \"\";\n\n\treturn `${indent}- ${propName} (${typeLabel}, ${requiredLabel})${extraText}`;\n}\n\nfunction collectPropertyExtras(propSchema: Record<string, unknown> | boolean | undefined): string[] {\n\tif (!propSchema || typeof propSchema !== \"object\") {\n\t\treturn [];\n\t}\n\n\tconst extras: string[] = [];\n\tconst schema = propSchema as Record<string, unknown>;\n\n\tif (schema.enum && Array.isArray(schema.enum)) {\n\t\textras.push(`enum: ${formatValue(schema.enum)}`);\n\t}\n\n\tif (schema.default !== undefined) {\n\t\textras.push(`default: ${formatValue(schema.default)}`);\n\t}\n\n\tif (typeof schema.description === \"string\") {\n\t\textras.push(schema.description);\n\t}\n\n\treturn extras;\n}\n\nfunction summarizeType(schema: Record<string, unknown> | boolean | undefined): string {\n\tif (schema === undefined || schema === null) {\n\t\treturn \"unknown\";\n\t}\n\n\tif (schema === true) {\n\t\treturn \"any\";\n\t}\n\n\tif (schema === false) {\n\t\treturn \"never\";\n\t}\n\n\tif (typeof schema !== \"object\") {\n\t\treturn String(schema);\n\t}\n\n\tconst schemaType = schema.type;\n\tlet baseType = \"\";\n\n\tif (Array.isArray(schemaType) && schemaType.length) {\n\t\tbaseType = schemaType.join(\" | \");\n\t} else if (typeof schemaType === \"string\") {\n\t\tbaseType = schemaType;\n\t} else if (schema.enum && Array.isArray(schema.enum)) {\n\t\tconst inferred: string[] = Array.from(new Set(schema.enum.map((value: unknown) => typeof value)));\n\t\tif (inferred.length === 1 && inferred[0]) {\n\t\t\tbaseType = inferred[0];\n\t\t}\n\t} else if (schema.const !== undefined) {\n\t\tbaseType = typeof schema.const;\n\t}\n\n\tif (!baseType) {\n\t\tbaseType = \"any\";\n\t}\n\n\tif (baseType === \"array\" && schema.items) {\n\t\tconst itemType = Array.isArray(schema.items)\n\t\t\t? schema.items.map((item: Record<string, unknown> | boolean) => summarizeType(item)).join(\" | \")\n\t\t\t: summarizeType(schema.items as Record<string, unknown>);\n\t\treturn `array<${itemType}>`;\n\t}\n\n\tif (baseType === \"string\" && typeof schema.format === \"string\") {\n\t\treturn `string (${schema.format})`;\n\t}\n\n\treturn baseType;\n}\n\nfunction formatValue(value: unknown): string {\n\tif (typeof value === \"string\") {\n\t\treturn JSON.stringify(value);\n\t}\n\n\tif (typeof value === \"number\" || typeof value === \"boolean\") {\n\t\treturn String(value);\n\t}\n\n\tif (value === null) {\n\t\treturn \"null\";\n\t}\n\n\tif (Array.isArray(value)) {\n\t\treturn `[${value.map(formatValue).join(\", \")}]`;\n\t}\n\n\treturn JSON.stringify(value);\n}\n\nfunction stringifySchema(schema: Record<string, unknown> | boolean | undefined): string {\n\tif (schema === undefined) {\n\t\treturn \"null\";\n\t}\n\n\treturn JSON.stringify(stripSchemaKeys(schema));\n}\n\nfunction stripSchemaKeys(value: unknown): unknown {\n\tif (Array.isArray(value)) {\n\t\treturn value.map((entry) => stripSchemaKeys(entry));\n\t}\n\n\tif (value && typeof value === \"object\") {\n\t\tconst record = value as Record<string, unknown>;\n\t\tconst cleaned: Record<string, unknown> = {};\n\n\t\tfor (const [key, entry] of Object.entries(record)) {\n\t\t\tif (key === \"$schema\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcleaned[key] = stripSchemaKeys(entry);\n\t\t}\n\n\t\treturn cleaned;\n\t}\n\n\treturn value;\n}\n\nexport function morphXmlFormatToolResponse(toolName: string, _toolCallId: string, content: TextContent[]): string {\n\tconst combinedText = content\n\t\t.filter((c): c is TextContent => c.type === \"text\")\n\t\t.map((c) => c.text)\n\t\t.join(\"\\n\");\n\n\tlet resultValue: unknown = combinedText;\n\ttry {\n\t\tresultValue = JSON.parse(combinedText);\n\t} catch {}\n\n\tconst resultLines = formatXmlNode(\"result\", resultValue, 1);\n\n\treturn [\n\t\t\"<tool_response>\",\n\t\t` <tool_name>${escapeXml(toolName)}</tool_name>`,\n\t\t...resultLines,\n\t\t\"</tool_response>\",\n\t].join(\"\\n\");\n}\n\n/**\n * Formats a tool call as XML for MorphXml protocol.\n */\nexport function morphXmlFormatToolCall(name: string, args: Record<string, unknown>): string {\n\tconst lines = formatXmlNode(name, args, 0);\n\treturn lines.join(\"\\n\");\n}\n\ntype JsonSchema = Record<string, unknown> | boolean | undefined;\n\ntype XmlNode = {\n\tname: string;\n\tchildren: XmlNode[];\n\tparts: Array<{ type: \"text\"; value: string } | { type: \"child\"; value: XmlNode }>;\n\ttextSegments: string[];\n};\n\ntype StreamToolState = {\n\tid: string;\n\tindex: number;\n\tlastArgumentsSnapshot: string | null;\n\tname: string;\n\tschema: JsonSchema;\n\tstarted: boolean;\n\ttool: Tool | undefined;\n};\n\nfunction shouldEmitRawToolCallTextOnError(options?: ParserOptions): boolean {\n\treturn options?.emitRawToolCallTextOnError === true;\n}\n\nfunction getSchemaTypesFromValue(schema: JsonSchema): string[] {\n\tif (!schema || typeof schema !== \"object\" || Array.isArray(schema)) {\n\t\treturn [];\n\t}\n\n\tconst typeValue = schema.type;\n\tif (typeof typeValue === \"string\") {\n\t\treturn [typeValue];\n\t}\n\tif (Array.isArray(typeValue)) {\n\t\treturn typeValue.filter((entry): entry is string => typeof entry === \"string\");\n\t}\n\treturn [];\n}\n\nfunction isStructurallyCompatibleWithSchema(value: unknown, schema: JsonSchema): boolean {\n\tif (schema === undefined || schema === true) {\n\t\treturn true;\n\t}\n\tif (schema === false) {\n\t\treturn false;\n\t}\n\tif (typeof schema !== \"object\" || Array.isArray(schema) || schema === null) {\n\t\treturn true;\n\t}\n\n\tconst schemaTypes = getSchemaTypesFromValue(schema);\n\tif (value === null) {\n\t\treturn schemaTypes.length === 0 || schemaTypes.includes(\"null\");\n\t}\n\n\tif (Array.isArray(value)) {\n\t\tif (schemaTypes.length > 0 && !schemaTypes.includes(\"array\")) {\n\t\t\treturn false;\n\t\t}\n\t\tconst itemSchema = getArrayItemSchema(schema);\n\t\treturn value.every((item) => isStructurallyCompatibleWithSchema(item, itemSchema));\n\t}\n\n\tif (typeof value === \"object\") {\n\t\tif (schemaTypes.length > 0 && !schemaTypes.includes(\"object\")) {\n\t\t\treturn false;\n\t\t}\n\t\tconst record = value as Record<string, unknown>;\n\t\treturn Object.entries(record).every(([key, entryValue]) =>\n\t\t\tisStructurallyCompatibleWithSchema(entryValue, getPropertySchema(schema, key)),\n\t\t);\n\t}\n\n\tif (typeof value === \"string\") {\n\t\treturn schemaTypes.length === 0 || schemaTypes.includes(\"string\");\n\t}\n\tif (typeof value === \"number\") {\n\t\treturn schemaTypes.length === 0 || schemaTypes.includes(\"number\") || schemaTypes.includes(\"integer\");\n\t}\n\tif (typeof value === \"boolean\") {\n\t\treturn schemaTypes.length === 0 || schemaTypes.includes(\"boolean\");\n\t}\n\n\treturn true;\n}\n\nfunction validateMorphXmlArguments(tool: Tool | undefined, argumentsRecord: Record<string, unknown>): boolean {\n\tif (!tool) {\n\t\treturn true;\n\t}\n\n\ttry {\n\t\tvalidateToolArguments(tool, {\n\t\t\ttype: \"toolCall\",\n\t\t\tid: \"morph-xml-validation\",\n\t\t\tname: tool.name,\n\t\t\targuments: argumentsRecord,\n\t\t});\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction parseAndValidateMorphXmlArguments(\n\ttool: Tool | undefined,\n\ttoolBody: string,\n\tschema: JsonSchema,\n): Record<string, unknown> | null {\n\tlet parsedArguments: Record<string, unknown>;\n\ttry {\n\t\tparsedArguments = parseMorphXmlArguments(toolBody, schema);\n\t} catch {\n\t\treturn null;\n\t}\n\tif (!isStructurallyCompatibleWithSchema(parsedArguments, schema)) {\n\t\treturn null;\n\t}\n\tif (!validateMorphXmlArguments(tool, parsedArguments)) {\n\t\treturn null;\n\t}\n\treturn parsedArguments;\n}\n\nfunction parseMorphXmlPartialArgumentsSafely(toolBody: string, schema: JsonSchema): Record<string, unknown> | null {\n\ttry {\n\t\treturn parseMorphXmlPartialArguments(toolBody, schema);\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function parseMorphXmlGeneratedText(text: string, tools: Tool[], options?: ParserOptions): ParsedToolCall[] {\n\tif (tools.length === 0 || text.length === 0) {\n\t\treturn [];\n\t}\n\n\tconst toolSchemaMap = createToolSchemaMap(tools);\n\tconst toolMap = new Map(tools.map((tool) => [tool.name, tool]));\n\tconst parsedToolCalls: ParsedToolCall[] = [];\n\n\tfor (const tool of tools) {\n\t\tlet selfClosingMatch = findSelfClosingToolTag(text, tool.name, 0);\n\t\twhile (selfClosingMatch) {\n\t\t\tconst parsedArguments = parseAndValidateMorphXmlArguments(tool, \"\", toolSchemaMap.get(tool.name));\n\t\t\tif (!parsedArguments) {\n\t\t\t\toptions?.onError?.(\"Could not process XML tool call.\", {\n\t\t\t\t\ttoolCall: selfClosingMatch.tag,\n\t\t\t\t});\n\t\t\t\tselfClosingMatch = findSelfClosingToolTag(\n\t\t\t\t\ttext,\n\t\t\t\t\ttool.name,\n\t\t\t\t\tselfClosingMatch.index + selfClosingMatch.length,\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tparsedToolCalls.push({\n\t\t\t\tname: tool.name,\n\t\t\t\targuments: parsedArguments,\n\t\t\t});\n\t\t\tselfClosingMatch = findSelfClosingToolTag(text, tool.name, selfClosingMatch.index + selfClosingMatch.length);\n\t\t}\n\n\t\tconst toolCallPattern = new RegExp(\n\t\t\t`<\\\\s*${escapeRegExp(tool.name)}\\\\s*>([\\\\s\\\\S]*?)<\\\\/\\\\s*${escapeRegExp(tool.name)}\\\\s*>`,\n\t\t\t\"g\",\n\t\t);\n\t\tfor (const match of text.matchAll(toolCallPattern)) {\n\t\t\tconst toolBody = match[1] ?? \"\";\n\t\t\tconst parsedArguments = parseAndValidateMorphXmlArguments(\n\t\t\t\ttoolMap.get(tool.name),\n\t\t\t\ttoolBody,\n\t\t\t\ttoolSchemaMap.get(tool.name),\n\t\t\t);\n\t\t\tif (!parsedArguments) {\n\t\t\t\toptions?.onError?.(\"Could not process XML tool call.\", {\n\t\t\t\t\ttoolCall: match[0],\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tparsedToolCalls.push({\n\t\t\t\tname: tool.name,\n\t\t\t\targuments: parsedArguments,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn parsedToolCalls;\n}\n\nexport function createMorphXmlStreamParser(tools: Tool[], options?: ParserOptions): StreamParser {\n\tconst toolSchemaMap = createToolSchemaMap(tools);\n\tconst toolNames = tools.map((tool) => tool.name);\n\tconst toolMap = new Map(tools.map((tool) => [tool.name, tool]));\n\n\tlet buffer = \"\";\n\tlet nextToolCallIndex = 0;\n\tlet currentToolState: StreamToolState | null = null;\n\n\tfunction emitArgumentsSnapshot(\n\t\tevents: StreamParserEvent[],\n\t\ttoolState: StreamToolState,\n\t\targumentsRecord: Record<string, unknown>,\n\t): void {\n\t\tif (!isStructurallyCompatibleWithSchema(argumentsRecord, toolState.schema)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst argumentsSnapshot = JSON.stringify(argumentsRecord);\n\t\tif (argumentsSnapshot === toolState.lastArgumentsSnapshot || argumentsSnapshot === \"{}\") {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!toolState.started) {\n\t\t\tevents.push({\n\t\t\t\ttype: \"toolcall_start\",\n\t\t\t\tindex: toolState.index,\n\t\t\t\tname: toolState.name,\n\t\t\t\tid: toolState.id,\n\t\t\t});\n\t\t\ttoolState.started = true;\n\t\t}\n\n\t\ttoolState.lastArgumentsSnapshot = argumentsSnapshot;\n\t\tevents.push({\n\t\t\ttype: \"toolcall_delta\",\n\t\t\tindex: toolState.index,\n\t\t\targumentsDelta: argumentsSnapshot,\n\t\t});\n\t}\n\n\tfunction processBuffer(): StreamParserEvent[] {\n\t\tconst events: StreamParserEvent[] = [];\n\n\t\twhile (buffer.length > 0) {\n\t\t\tif (currentToolState) {\n\t\t\t\tconst closingTagPattern = new RegExp(`</\\\\s*${escapeRegExp(currentToolState.name)}\\\\s*>`);\n\t\t\t\tconst closingTagMatch = closingTagPattern.exec(buffer);\n\n\t\t\t\tif (!closingTagMatch || closingTagMatch.index === undefined) {\n\t\t\t\t\tconst partialArguments = parseMorphXmlPartialArgumentsSafely(buffer, currentToolState.schema);\n\t\t\t\t\tif (partialArguments) {\n\t\t\t\t\t\temitArgumentsSnapshot(events, currentToolState, partialArguments);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tconst toolBody = buffer.slice(0, closingTagMatch.index);\n\t\t\t\tconst partialArguments = parseMorphXmlPartialArgumentsSafely(toolBody, currentToolState.schema);\n\t\t\t\tif (partialArguments) {\n\t\t\t\t\temitArgumentsSnapshot(events, currentToolState, partialArguments);\n\t\t\t\t}\n\n\t\t\t\tconst parsedArguments = parseAndValidateMorphXmlArguments(\n\t\t\t\t\tcurrentToolState.tool,\n\t\t\t\t\ttoolBody,\n\t\t\t\t\tcurrentToolState.schema,\n\t\t\t\t);\n\t\t\t\tconst originalCallText = `<${currentToolState.name}>${toolBody}${closingTagMatch[0]}`;\n\t\t\t\tbuffer = buffer.slice(closingTagMatch.index + closingTagMatch[0].length);\n\t\t\t\tif (!parsedArguments) {\n\t\t\t\t\toptions?.onError?.(\"Could not process streaming XML tool call.\", {\n\t\t\t\t\t\ttoolCall: originalCallText,\n\t\t\t\t\t});\n\t\t\t\t\tif (!currentToolState.started && shouldEmitRawToolCallTextOnError(options)) {\n\t\t\t\t\t\tevents.push({ type: \"text\", text: originalCallText });\n\t\t\t\t\t}\n\t\t\t\t\tcurrentToolState = null;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (!currentToolState.started) {\n\t\t\t\t\tevents.push({\n\t\t\t\t\t\ttype: \"toolcall_start\",\n\t\t\t\t\t\tindex: currentToolState.index,\n\t\t\t\t\t\tname: currentToolState.name,\n\t\t\t\t\t\tid: currentToolState.id,\n\t\t\t\t\t});\n\t\t\t\t\tcurrentToolState.started = true;\n\t\t\t\t\temitArgumentsSnapshot(events, currentToolState, parsedArguments);\n\t\t\t\t}\n\t\t\t\tevents.push({\n\t\t\t\t\ttype: \"toolcall_end\",\n\t\t\t\t\tindex: currentToolState.index,\n\t\t\t\t\tname: currentToolState.name,\n\t\t\t\t\tid: currentToolState.id,\n\t\t\t\t\targuments: parsedArguments,\n\t\t\t\t});\n\t\t\t\tcurrentToolState = null;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst openingTag = findEarliestXmlToolTag(buffer, toolNames);\n\t\t\tif (!openingTag) {\n\t\t\t\tconst textLength = getSafeXmlTextLength(buffer, toolNames);\n\t\t\t\tif (textLength === 0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tevents.push({ type: \"text\", text: buffer.slice(0, textLength) });\n\t\t\t\tbuffer = buffer.slice(textLength);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (openingTag.index > 0) {\n\t\t\t\tevents.push({ type: \"text\", text: buffer.slice(0, openingTag.index) });\n\t\t\t}\n\n\t\t\tbuffer = buffer.slice(openingTag.index + openingTag.tag.length);\n\t\t\tif (openingTag.selfClosing) {\n\t\t\t\tconst tool = toolMap.get(openingTag.name);\n\t\t\t\tconst schema = toolSchemaMap.get(openingTag.name);\n\t\t\t\tconst parsedArguments = parseAndValidateMorphXmlArguments(tool, \"\", schema);\n\t\t\t\tif (!parsedArguments) {\n\t\t\t\t\toptions?.onError?.(\"Could not process XML tool call.\", {\n\t\t\t\t\t\ttoolCall: openingTag.tag,\n\t\t\t\t\t});\n\t\t\t\t\tif (shouldEmitRawToolCallTextOnError(options)) {\n\t\t\t\t\t\tevents.push({ type: \"text\", text: openingTag.tag });\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst id = globalThis.crypto.randomUUID();\n\t\t\t\tconst index = nextToolCallIndex;\n\t\t\t\tnextToolCallIndex += 1;\n\t\t\t\tevents.push({\n\t\t\t\t\ttype: \"toolcall_start\",\n\t\t\t\t\tindex,\n\t\t\t\t\tname: openingTag.name,\n\t\t\t\t\tid,\n\t\t\t\t});\n\t\t\t\tevents.push({\n\t\t\t\t\ttype: \"toolcall_end\",\n\t\t\t\t\tindex,\n\t\t\t\t\tname: openingTag.name,\n\t\t\t\t\tid,\n\t\t\t\t\targuments: parsedArguments,\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcurrentToolState = {\n\t\t\t\tid: globalThis.crypto.randomUUID(),\n\t\t\t\tindex: nextToolCallIndex,\n\t\t\t\tlastArgumentsSnapshot: null,\n\t\t\t\tname: openingTag.name,\n\t\t\t\tschema: toolSchemaMap.get(openingTag.name),\n\t\t\t\tstarted: false,\n\t\t\t\ttool: toolMap.get(openingTag.name),\n\t\t\t};\n\t\t\tnextToolCallIndex += 1;\n\t\t}\n\n\t\treturn events;\n\t}\n\n\treturn {\n\t\tfeed(textDelta: string): StreamParserEvent[] {\n\t\t\tif (textDelta.length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tbuffer += textDelta;\n\t\t\treturn processBuffer();\n\t\t},\n\n\t\tfinish(): StreamParserEvent[] {\n\t\t\tconst events = processBuffer();\n\n\t\t\tif (!currentToolState && buffer.length > 0) {\n\t\t\t\tevents.push({ type: \"text\", text: buffer });\n\t\t\t\tbuffer = \"\";\n\t\t\t}\n\n\t\t\tif (currentToolState) {\n\t\t\t\tconst parsedArguments = parseAndValidateMorphXmlArguments(\n\t\t\t\t\tcurrentToolState.tool,\n\t\t\t\t\tbuffer,\n\t\t\t\t\tcurrentToolState.schema,\n\t\t\t\t);\n\t\t\t\tif (parsedArguments) {\n\t\t\t\t\tif (!currentToolState.started) {\n\t\t\t\t\t\tevents.push({\n\t\t\t\t\t\t\ttype: \"toolcall_start\",\n\t\t\t\t\t\t\tindex: currentToolState.index,\n\t\t\t\t\t\t\tname: currentToolState.name,\n\t\t\t\t\t\t\tid: currentToolState.id,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcurrentToolState.started = true;\n\t\t\t\t\t}\n\t\t\t\t\tif (currentToolState.lastArgumentsSnapshot !== JSON.stringify(parsedArguments)) {\n\t\t\t\t\t\temitArgumentsSnapshot(events, currentToolState, parsedArguments);\n\t\t\t\t\t}\n\t\t\t\t\tevents.push({\n\t\t\t\t\t\ttype: \"toolcall_end\",\n\t\t\t\t\t\tindex: currentToolState.index,\n\t\t\t\t\t\tname: currentToolState.name,\n\t\t\t\t\t\tid: currentToolState.id,\n\t\t\t\t\t\targuments: parsedArguments,\n\t\t\t\t\t});\n\t\t\t\t} else if (currentToolState.lastArgumentsSnapshot) {\n\t\t\t\t\tconst recoveredArguments = JSON.parse(currentToolState.lastArgumentsSnapshot) as Record<string, unknown>;\n\t\t\t\t\tif (!currentToolState.started) {\n\t\t\t\t\t\tevents.push({\n\t\t\t\t\t\t\ttype: \"toolcall_start\",\n\t\t\t\t\t\t\tindex: currentToolState.index,\n\t\t\t\t\t\t\tname: currentToolState.name,\n\t\t\t\t\t\t\tid: currentToolState.id,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcurrentToolState.started = true;\n\t\t\t\t\t}\n\t\t\t\t\tevents.push({\n\t\t\t\t\t\ttype: \"toolcall_end\",\n\t\t\t\t\t\tindex: currentToolState.index,\n\t\t\t\t\t\tname: currentToolState.name,\n\t\t\t\t\t\tid: currentToolState.id,\n\t\t\t\t\t\targuments: recoveredArguments,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tconst rawToolCall = `<${currentToolState.name}>${buffer}`;\n\t\t\t\t\toptions?.onError?.(\"Could not complete streaming XML tool call at finish.\", {\n\t\t\t\t\t\ttoolCall: rawToolCall,\n\t\t\t\t\t});\n\t\t\t\t\tif (shouldEmitRawToolCallTextOnError(options)) {\n\t\t\t\t\t\tevents.push({ type: \"text\", text: rawToolCall });\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbuffer = \"\";\n\t\t\t\tcurrentToolState = null;\n\t\t\t}\n\n\t\t\treturn events;\n\t\t},\n\t};\n}\n\nfunction formatXmlNode(tagName: string, value: unknown, depth: number): string[] {\n\tconst indent = INDENT.repeat(depth);\n\n\tif (value === null || value === undefined) {\n\t\treturn [`${indent}<${tagName}></${tagName}>`];\n\t}\n\n\tif (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") {\n\t\tconst escapedValue = typeof value === \"string\" ? escapeXml(value) : String(value);\n\t\treturn [`${indent}<${tagName}>${escapedValue}</${tagName}>`];\n\t}\n\n\tif (Array.isArray(value)) {\n\t\tif (value.length === 0) {\n\t\t\treturn [`${indent}<${tagName}></${tagName}>`];\n\t\t}\n\t\tconst lines = [`${indent}<${tagName}>`];\n\t\tfor (const item of value) {\n\t\t\tlines.push(...formatXmlNode(\"item\", item, depth + 1));\n\t\t}\n\t\tlines.push(`${indent}</${tagName}>`);\n\t\treturn lines;\n\t}\n\n\tconst entries = Object.entries(value as Record<string, unknown>);\n\tif (entries.length === 0) {\n\t\treturn [`${indent}<${tagName}></${tagName}>`];\n\t}\n\n\tconst lines = [`${indent}<${tagName}>`];\n\tfor (const [key, entryValue] of entries) {\n\t\tlines.push(...formatXmlNode(key, entryValue, depth + 1));\n\t}\n\tlines.push(`${indent}</${tagName}>`);\n\treturn lines;\n}\n\nfunction createToolSchemaMap(tools: Tool[]): Map<string, JsonSchema> {\n\treturn new Map(tools.map((tool) => [tool.name, normalizeSchema(tool.parameters as Record<string, unknown>)]));\n}\n\nfunction parseMorphXmlArguments(toolBody: string, schema: JsonSchema): Record<string, unknown> {\n\tconst parsedRoot = parseXmlRoot(`<root>${toolBody}</root>`);\n\tif (!parsedRoot) {\n\t\treturn {};\n\t}\n\n\treturn convertChildrenToObject(parsedRoot.children, schema);\n}\n\nfunction parseMorphXmlPartialArguments(toolBody: string, schema: JsonSchema): Record<string, unknown> {\n\tconst partialArguments: Record<string, unknown> = {};\n\tconst normalizedSchema = normalizeSchema(schema);\n\tlet position = 0;\n\n\twhile (position < toolBody.length) {\n\t\tconst nextTagIndex = toolBody.indexOf(\"<\", position);\n\t\tif (nextTagIndex === -1) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (toolBody.slice(position, nextTagIndex).trim().length > 0) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst openingTag = parseOpeningTag(toolBody, nextTagIndex);\n\t\tif (!openingTag) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst propertySchema = getPropertySchema(normalizedSchema, openingTag.name);\n\t\tconst closingTag = `</${openingTag.name}>`;\n\t\tconst closingTagIndex = toolBody.indexOf(closingTag, openingTag.endIndex);\n\n\t\tif (closingTagIndex === -1) {\n\t\t\tconst partialValueText = toolBody.slice(openingTag.endIndex);\n\t\t\tif (partialValueText.includes(\"<\")) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tpartialArguments[openingTag.name] = coercePartialXmlValue(partialValueText, propertySchema);\n\t\t\tbreak;\n\t\t}\n\n\t\tconst completeNode = parseXmlRoot(toolBody.slice(nextTagIndex, closingTagIndex + closingTag.length));\n\t\tif (!completeNode) {\n\t\t\tbreak;\n\t\t}\n\n\t\tpartialArguments[openingTag.name] = convertXmlNodeValue(completeNode, propertySchema);\n\t\tposition = closingTagIndex + closingTag.length;\n\t}\n\n\treturn partialArguments;\n}\n\nfunction parseXmlRoot(xml: string): XmlNode | null {\n\tconst tagPattern = /<\\s*(\\/)?\\s*([A-Za-z_][\\w.-]*)\\s*(\\/)?\\s*>/g;\n\tconst stack: XmlNode[] = [];\n\tlet rootNode: XmlNode | null = null;\n\tlet lastIndex = 0;\n\n\tfor (const match of xml.matchAll(tagPattern)) {\n\t\tconst fullMatch = match[0];\n\t\tconst matchIndex = match.index;\n\t\tconst isClosingTag = match[1] === \"/\";\n\t\tconst tagName = match[2];\n\t\tconst isSelfClosing = match[3] === \"/\";\n\n\t\tif (matchIndex === undefined || !fullMatch || !tagName) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst textContent = xml.slice(lastIndex, matchIndex);\n\t\tif (stack.length > 0 && textContent.length > 0) {\n\t\t\tstack[stack.length - 1]?.textSegments.push(textContent);\n\t\t\tstack[stack.length - 1]?.parts.push({ type: \"text\", value: textContent });\n\t\t} else if (stack.length === 0 && textContent.trim().length > 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (isClosingTag) {\n\t\t\tconst completedNode = stack.pop();\n\t\t\tif (!completedNode || completedNode.name !== tagName) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tif (stack.length > 0) {\n\t\t\t\tstack[stack.length - 1]?.children.push(completedNode);\n\t\t\t\tstack[stack.length - 1]?.parts.push({ type: \"child\", value: completedNode });\n\t\t\t} else if (!rootNode) {\n\t\t\t\trootNode = completedNode;\n\t\t\t} else {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t} else {\n\t\t\tconst node: XmlNode = {\n\t\t\t\tname: tagName,\n\t\t\t\tchildren: [],\n\t\t\t\tparts: [],\n\t\t\t\ttextSegments: [],\n\t\t\t};\n\n\t\t\tif (isSelfClosing) {\n\t\t\t\tif (stack.length > 0) {\n\t\t\t\t\tstack[stack.length - 1]?.children.push(node);\n\t\t\t\t\tstack[stack.length - 1]?.parts.push({ type: \"child\", value: node });\n\t\t\t\t} else if (!rootNode) {\n\t\t\t\t\trootNode = node;\n\t\t\t\t} else {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tstack.push(node);\n\t\t\t}\n\t\t}\n\n\t\tlastIndex = matchIndex + fullMatch.length;\n\t}\n\n\tif (stack.length > 0) {\n\t\treturn null;\n\t}\n\n\tif (lastIndex < xml.length && xml.slice(lastIndex).trim().length > 0) {\n\t\treturn null;\n\t}\n\n\treturn rootNode;\n}\n\nfunction serializeXmlNode(node: XmlNode): string {\n\tconst innerContent = node.parts\n\t\t.map((part) => (part.type === \"text\" ? part.value : serializeXmlNode(part.value)))\n\t\t.join(\"\");\n\treturn `<${node.name}>${innerContent}</${node.name}>`;\n}\n\nfunction convertChildrenToObject(children: XmlNode[], schema: JsonSchema): Record<string, unknown> {\n\tconst objectValue: Record<string, unknown> = {};\n\n\tfor (const child of children) {\n\t\tconst propertySchema = getPropertySchema(schema, child.name);\n\t\tconst propertyValue = convertXmlNodeValue(child, propertySchema);\n\t\tconst existingValue = objectValue[child.name];\n\n\t\tif (existingValue === undefined) {\n\t\t\tobjectValue[child.name] = propertyValue;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (Array.isArray(existingValue)) {\n\t\t\texistingValue.push(propertyValue);\n\t\t\tcontinue;\n\t\t}\n\n\t\tobjectValue[child.name] = [existingValue, propertyValue];\n\t}\n\n\treturn objectValue;\n}\n\nfunction convertXmlNodeValue(node: XmlNode, schema: JsonSchema): unknown {\n\tconst normalizedSchema = normalizeSchema(schema);\n\tconst schemaTypes = getSchemaTypes(normalizedSchema);\n\n\tif (node.children.length === 0) {\n\t\treturn coerceXmlValue(node.textSegments.join(\"\"), normalizedSchema);\n\t}\n\n\tif (schemaTypes.includes(\"string\")) {\n\t\treturn node.parts\n\t\t\t.map((part) => (part.type === \"text\" ? unescapeXml(part.value) : serializeXmlNode(part.value)))\n\t\t\t.join(\"\");\n\t}\n\n\tif (shouldTreatAsArray(node, normalizedSchema)) {\n\t\tif (node.children.some((child) => child.name !== \"item\")) {\n\t\t\tthrow new Error(\"Array-valued XML nodes must wrap entries in <item> tags\");\n\t\t}\n\t\tconst itemSchema = getArrayItemSchema(normalizedSchema);\n\t\tconst itemNodes = node.children.filter((child) => child.name === \"item\");\n\t\treturn itemNodes.map((child) => convertXmlNodeValue(child, itemSchema));\n\t}\n\n\treturn convertChildrenToObject(node.children, normalizedSchema);\n}\n\nfunction shouldTreatAsArray(node: XmlNode, schema: JsonSchema): boolean {\n\tconst types = getSchemaTypes(schema);\n\tif (types.includes(\"array\")) {\n\t\treturn true;\n\t}\n\n\treturn node.children.every((child) => child.name === \"item\");\n}\n\nfunction getArrayItemSchema(schema: JsonSchema): JsonSchema {\n\tif (!schema || typeof schema !== \"object\") {\n\t\treturn undefined;\n\t}\n\n\tconst items = schema.items;\n\tif (items && !Array.isArray(items) && typeof items === \"object\") {\n\t\treturn items as Record<string, unknown>;\n\t}\n\n\treturn undefined;\n}\n\nfunction getPropertySchema(schema: JsonSchema, propertyName: string): JsonSchema {\n\tif (!schema || typeof schema !== \"object\") {\n\t\treturn undefined;\n\t}\n\n\tconst properties = schema.properties;\n\tif (properties && typeof properties === \"object\" && !Array.isArray(properties)) {\n\t\tconst propertySchema = (properties as Record<string, unknown>)[propertyName];\n\t\tif (propertySchema === undefined || typeof propertySchema === \"boolean\" || typeof propertySchema === \"object\") {\n\t\t\treturn propertySchema as JsonSchema;\n\t\t}\n\t}\n\n\tfor (const unionKey of [\"anyOf\", \"oneOf\", \"allOf\"]) {\n\t\tconst unionSchemas = schema[unionKey];\n\t\tif (!Array.isArray(unionSchemas)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const unionSchema of unionSchemas) {\n\t\t\tif (typeof unionSchema !== \"object\" || unionSchema === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst nestedPropertySchema = getPropertySchema(unionSchema as Record<string, unknown>, propertyName);\n\t\t\tif (nestedPropertySchema !== undefined) {\n\t\t\t\treturn nestedPropertySchema;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nfunction getSchemaTypes(schema: JsonSchema): string[] {\n\tif (!schema || typeof schema !== \"object\") {\n\t\treturn [];\n\t}\n\n\tconst schemaType = schema.type;\n\tif (typeof schemaType === \"string\") {\n\t\treturn [schemaType];\n\t}\n\n\tif (Array.isArray(schemaType)) {\n\t\treturn schemaType.filter((value): value is string => typeof value === \"string\");\n\t}\n\n\treturn [];\n}\n\nfunction coerceXmlValue(rawValue: string, schema: JsonSchema): unknown {\n\tconst decodedValue = unescapeXml(rawValue);\n\tconst trimmedValue = decodedValue.trim();\n\tconst types = getSchemaTypes(schema);\n\n\tif (types.includes(\"integer\") && /^-?\\d+$/.test(trimmedValue)) {\n\t\treturn Number.parseInt(trimmedValue, 10);\n\t}\n\n\tif (types.includes(\"number\") && /^-?(?:\\d+|\\d*\\.\\d+)$/.test(trimmedValue)) {\n\t\treturn Number(trimmedValue);\n\t}\n\n\tif (types.includes(\"boolean\")) {\n\t\tif (trimmedValue === \"true\") {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (trimmedValue === \"false\") {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tif (types.includes(\"null\") && trimmedValue === \"null\") {\n\t\treturn null;\n\t}\n\n\tif ((types.includes(\"array\") || types.includes(\"object\")) && trimmedValue.length > 0) {\n\t\ttry {\n\t\t\treturn JSON.parse(trimmedValue);\n\t\t} catch {}\n\t}\n\n\treturn decodedValue;\n}\n\nfunction coercePartialXmlValue(rawValue: string, schema: JsonSchema): unknown {\n\tconst types = getSchemaTypes(schema);\n\tif (types.includes(\"integer\") || types.includes(\"number\")) {\n\t\tconst trimmedValue = unescapeXml(rawValue).trim();\n\t\tif (trimmedValue.length > 0 && /^-?(?:\\d+|\\d*\\.\\d+)$/.test(trimmedValue)) {\n\t\t\treturn types.includes(\"integer\") ? Number.parseInt(trimmedValue, 10) : Number(trimmedValue);\n\t\t}\n\t}\n\n\treturn unescapeXml(rawValue);\n}\n\nfunction parseOpeningTag(text: string, startIndex: number): { endIndex: number; name: string } | null {\n\tconst tagPattern = /<\\s*([A-Za-z_][\\w.-]*)\\s*>/y;\n\ttagPattern.lastIndex = startIndex;\n\tconst match = tagPattern.exec(text);\n\tconst tagName = match?.[1];\n\tif (!match || !tagName) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\tendIndex: match.index + match[0].length,\n\t\tname: tagName,\n\t};\n}\n\nfunction escapeXml(text: string): string {\n\treturn text\n\t\t.replace(/&/g, \"&amp;\")\n\t\t.replace(/</g, \"&lt;\")\n\t\t.replace(/>/g, \"&gt;\")\n\t\t.replace(/\"/g, \"&quot;\")\n\t\t.replace(/'/g, \"&apos;\");\n}\n\nfunction unescapeXml(text: string): string {\n\treturn text\n\t\t.replace(/&lt;/g, \"<\")\n\t\t.replace(/&gt;/g, \">\")\n\t\t.replace(/&quot;/g, '\"')\n\t\t.replace(/&apos;/g, \"'\")\n\t\t.replace(/&amp;/g, \"&\");\n}\n\nfunction escapeRegExp(text: string): string {\n\treturn text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n"]}
@@ -0,0 +1,14 @@
1
+ export type XmlToolTagMatch = {
2
+ index: number;
3
+ name: string;
4
+ tag: string;
5
+ selfClosing: boolean;
6
+ };
7
+ export declare function findSelfClosingToolTag(text: string, toolName: string, fromIndex: number): {
8
+ index: number;
9
+ length: number;
10
+ tag: string;
11
+ } | null;
12
+ export declare function findEarliestXmlToolTag(text: string, toolNames: string[]): XmlToolTagMatch | null;
13
+ export declare function getSafeXmlTextLength(text: string, toolNames: string[]): number;
14
+ //# sourceMappingURL=xml-tool-tag-scanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml-tool-tag-scanner.d.ts","sourceRoot":"","sources":["../../../src/tool-call-middleware/protocols/xml-tool-tag-scanner.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,OAAO,CAAC;CACrB,CAAC;AAMF,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GACf;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAQvD;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,eAAe,GAAG,IAAI,CAqBhG;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAuB9E","sourcesContent":["export type XmlToolTagMatch = {\n\tindex: number;\n\tname: string;\n\ttag: string;\n\tselfClosing: boolean;\n};\n\nfunction escapeRegExp(text: string): string {\n\treturn text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nexport function findSelfClosingToolTag(\n\ttext: string,\n\ttoolName: string,\n\tfromIndex: number,\n): { index: number; length: number; tag: string } | null {\n\tconst pattern = new RegExp(`<\\\\s*${escapeRegExp(toolName)}\\\\s*\\\\/\\\\s*>`, \"g\");\n\tpattern.lastIndex = fromIndex;\n\tconst match = pattern.exec(text);\n\tif (!match || match.index === undefined) {\n\t\treturn null;\n\t}\n\treturn { index: match.index, length: match[0].length, tag: match[0] };\n}\n\nexport function findEarliestXmlToolTag(text: string, toolNames: string[]): XmlToolTagMatch | null {\n\tlet earliestTag: XmlToolTagMatch | null = null;\n\n\tfor (const toolName of toolNames) {\n\t\tconst tagPattern = new RegExp(`<\\\\s*${escapeRegExp(toolName)}\\\\s*(\\\\/)?\\\\s*>`);\n\t\tconst match = tagPattern.exec(text);\n\t\tif (!match || match.index === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!earliestTag || match.index < earliestTag.index) {\n\t\t\tearliestTag = {\n\t\t\t\tindex: match.index,\n\t\t\t\tname: toolName,\n\t\t\t\ttag: match[0],\n\t\t\t\tselfClosing: match[1] === \"/\",\n\t\t\t};\n\t\t}\n\t}\n\n\treturn earliestTag;\n}\n\nexport function getSafeXmlTextLength(text: string, toolNames: string[]): number {\n\tconst lastTagIndex = text.lastIndexOf(\"<\");\n\tif (lastTagIndex === -1) {\n\t\treturn text.length;\n\t}\n\n\tconst trailingCandidate = text.slice(lastTagIndex);\n\tconst hasPotentialToolStart = toolNames.some((toolName) => {\n\t\tconst candidates = [\n\t\t\t`<${toolName}>`,\n\t\t\t`<${toolName}/>`,\n\t\t\t`< ${toolName}>`,\n\t\t\t`< ${toolName}/>`,\n\t\t\t`<${toolName} />`,\n\t\t\t`< ${toolName} />`,\n\t\t];\n\t\treturn candidates.some((candidate) => candidate.startsWith(trailingCandidate));\n\t});\n\tif (!hasPotentialToolStart) {\n\t\treturn text.length;\n\t}\n\n\treturn lastTagIndex;\n}\n"]}
@@ -0,0 +1,54 @@
1
+ function escapeRegExp(text) {
2
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3
+ }
4
+ export function findSelfClosingToolTag(text, toolName, fromIndex) {
5
+ const pattern = new RegExp(`<\\s*${escapeRegExp(toolName)}\\s*\\/\\s*>`, "g");
6
+ pattern.lastIndex = fromIndex;
7
+ const match = pattern.exec(text);
8
+ if (!match || match.index === undefined) {
9
+ return null;
10
+ }
11
+ return { index: match.index, length: match[0].length, tag: match[0] };
12
+ }
13
+ export function findEarliestXmlToolTag(text, toolNames) {
14
+ let earliestTag = null;
15
+ for (const toolName of toolNames) {
16
+ const tagPattern = new RegExp(`<\\s*${escapeRegExp(toolName)}\\s*(\\/)?\\s*>`);
17
+ const match = tagPattern.exec(text);
18
+ if (!match || match.index === undefined) {
19
+ continue;
20
+ }
21
+ if (!earliestTag || match.index < earliestTag.index) {
22
+ earliestTag = {
23
+ index: match.index,
24
+ name: toolName,
25
+ tag: match[0],
26
+ selfClosing: match[1] === "/",
27
+ };
28
+ }
29
+ }
30
+ return earliestTag;
31
+ }
32
+ export function getSafeXmlTextLength(text, toolNames) {
33
+ const lastTagIndex = text.lastIndexOf("<");
34
+ if (lastTagIndex === -1) {
35
+ return text.length;
36
+ }
37
+ const trailingCandidate = text.slice(lastTagIndex);
38
+ const hasPotentialToolStart = toolNames.some((toolName) => {
39
+ const candidates = [
40
+ `<${toolName}>`,
41
+ `<${toolName}/>`,
42
+ `< ${toolName}>`,
43
+ `< ${toolName}/>`,
44
+ `<${toolName} />`,
45
+ `< ${toolName} />`,
46
+ ];
47
+ return candidates.some((candidate) => candidate.startsWith(trailingCandidate));
48
+ });
49
+ if (!hasPotentialToolStart) {
50
+ return text.length;
51
+ }
52
+ return lastTagIndex;
53
+ }
54
+ //# sourceMappingURL=xml-tool-tag-scanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml-tool-tag-scanner.js","sourceRoot":"","sources":["../../../src/tool-call-middleware/protocols/xml-tool-tag-scanner.ts"],"names":[],"mappings":"AAOA,SAAS,YAAY,CAAC,IAAY,EAAU;IAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AAAA,CACnD;AAED,MAAM,UAAU,sBAAsB,CACrC,IAAY,EACZ,QAAgB,EAChB,SAAiB,EACuC;IACxD,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,QAAQ,YAAY,CAAC,QAAQ,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;IAC9E,OAAO,CAAC,SAAS,GAA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KAAK,CAAC,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACnD,MAAM,qBAAqB,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;QAC1D,MAAM,UAAU,GAAG;YAClB,IAAI,QAAQ,GAAG;YACf,IAAI,QAAQ,IAAI;YAChB,KAAK,QAAQ,GAAG;YAChB,KAAK,QAAQ,IAAI;YACjB,IAAI,QAAQ,KAAK;YACjB,KAAK,QAAQ,KAAK;SAClB,CAAC;QACF,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAAA,CAC/E,CAAC,CAAC;IACH,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,OAAO,YAAY,CAAC;AAAA,CACpB","sourcesContent":["export type XmlToolTagMatch = {\n\tindex: number;\n\tname: string;\n\ttag: string;\n\tselfClosing: boolean;\n};\n\nfunction escapeRegExp(text: string): string {\n\treturn text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nexport function findSelfClosingToolTag(\n\ttext: string,\n\ttoolName: string,\n\tfromIndex: number,\n): { index: number; length: number; tag: string } | null {\n\tconst pattern = new RegExp(`<\\\\s*${escapeRegExp(toolName)}\\\\s*\\\\/\\\\s*>`, \"g\");\n\tpattern.lastIndex = fromIndex;\n\tconst match = pattern.exec(text);\n\tif (!match || match.index === undefined) {\n\t\treturn null;\n\t}\n\treturn { index: match.index, length: match[0].length, tag: match[0] };\n}\n\nexport function findEarliestXmlToolTag(text: string, toolNames: string[]): XmlToolTagMatch | null {\n\tlet earliestTag: XmlToolTagMatch | null = null;\n\n\tfor (const toolName of toolNames) {\n\t\tconst tagPattern = new RegExp(`<\\\\s*${escapeRegExp(toolName)}\\\\s*(\\\\/)?\\\\s*>`);\n\t\tconst match = tagPattern.exec(text);\n\t\tif (!match || match.index === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!earliestTag || match.index < earliestTag.index) {\n\t\t\tearliestTag = {\n\t\t\t\tindex: match.index,\n\t\t\t\tname: toolName,\n\t\t\t\ttag: match[0],\n\t\t\t\tselfClosing: match[1] === \"/\",\n\t\t\t};\n\t\t}\n\t}\n\n\treturn earliestTag;\n}\n\nexport function getSafeXmlTextLength(text: string, toolNames: string[]): number {\n\tconst lastTagIndex = text.lastIndexOf(\"<\");\n\tif (lastTagIndex === -1) {\n\t\treturn text.length;\n\t}\n\n\tconst trailingCandidate = text.slice(lastTagIndex);\n\tconst hasPotentialToolStart = toolNames.some((toolName) => {\n\t\tconst candidates = [\n\t\t\t`<${toolName}>`,\n\t\t\t`<${toolName}/>`,\n\t\t\t`< ${toolName}>`,\n\t\t\t`< ${toolName}/>`,\n\t\t\t`<${toolName} />`,\n\t\t\t`< ${toolName} />`,\n\t\t];\n\t\treturn candidates.some((candidate) => candidate.startsWith(trailingCandidate));\n\t});\n\tif (!hasPotentialToolStart) {\n\t\treturn text.length;\n\t}\n\n\treturn lastTagIndex;\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import type { TextContent, Tool } from "../../types.ts";
2
+ import type { ParsedToolCall, ParserOptions, StreamParser } from "../types.ts";
3
+ export declare function yamlXmlFormatToolsSystemPrompt(tools: Tool[]): string;
4
+ export declare function yamlXmlFormatToolCall(name: string, args: Record<string, unknown>): string;
5
+ export declare function yamlXmlFormatToolResponse(toolName: string, _toolCallId: string, content: TextContent[]): string;
6
+ export declare function parseYamlXmlGeneratedText(text: string, tools: Tool[], options?: ParserOptions): ParsedToolCall[];
7
+ export declare function createYamlXmlStreamParser(tools: Tool[], options?: ParserOptions): StreamParser;
8
+ //# sourceMappingURL=yaml-xml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yaml-xml.d.ts","sourceRoot":"","sources":["../../../src/tool-call-middleware/protocols/yaml-xml.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAuDlG,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,CA8BpE;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAGzF;AAED,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,CAa/G;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,cAAc,EAAE,CAqDhH;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,YAAY,CA8K9F","sourcesContent":["import YAML from \"yaml\";\nimport type { TextContent, Tool } from \"../../types.ts\";\nimport type { ParsedToolCall, ParserOptions, StreamParser, StreamParserEvent } from \"../types.ts\";\nimport { findEarliestXmlToolTag, getSafeXmlTextLength } from \"./xml-tool-tag-scanner.ts\";\n\nfunction escapeRegExp(text: string): string {\n\treturn text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nfunction normalizeYamlContent(yamlContent: string): string {\n\tconst trimmedLeadingNewline = yamlContent.startsWith(\"\\n\") ? yamlContent.slice(1) : yamlContent;\n\tconst lines = trimmedLeadingNewline.split(\"\\n\");\n\tconst nonEmptyLines = lines.filter((line) => line.trim().length > 0);\n\tif (nonEmptyLines.length === 0) {\n\t\treturn \"\";\n\t}\n\n\tconst minIndent = Math.min(\n\t\t...nonEmptyLines.map((line) => {\n\t\t\tconst match = line.match(/^(\\s*)/);\n\t\t\treturn match?.[1].length ?? 0;\n\t\t}),\n\t);\n\treturn minIndent > 0 ? lines.map((line) => line.slice(minIndent)).join(\"\\n\") : trimmedLeadingNewline;\n}\n\nfunction parseYamlMapping(yamlContent: string): Record<string, unknown> | null {\n\tconst normalized = normalizeYamlContent(yamlContent);\n\tif (normalized.trim().length === 0) {\n\t\treturn {};\n\t}\n\n\ttry {\n\t\tconst parsed = YAML.parse(normalized) as unknown;\n\t\tif (parsed === null) {\n\t\t\treturn {};\n\t\t}\n\t\tif (typeof parsed !== \"object\" || Array.isArray(parsed)) {\n\t\t\treturn null;\n\t\t}\n\t\treturn parsed as Record<string, unknown>;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction findClosingTagEnd(text: string, contentStart: number, toolName: string): number {\n\tconst closingPattern = new RegExp(`</\\\\s*${escapeRegExp(toolName)}\\\\s*>`, \"g\");\n\tclosingPattern.lastIndex = contentStart;\n\tconst match = closingPattern.exec(text);\n\treturn match?.index === undefined ? -1 : match.index + match[0].length;\n}\n\nfunction shouldEmitRawToolCallTextOnError(options?: ParserOptions): boolean {\n\treturn options?.emitRawToolCallTextOnError === true;\n}\n\nexport function yamlXmlFormatToolsSystemPrompt(tools: Tool[]): string {\n\tif (tools.length === 0) {\n\t\treturn \"\";\n\t}\n\n\tconst toolsRendered = JSON.stringify(\n\t\ttools.map((tool) => ({\n\t\t\tname: tool.name,\n\t\t\tdescription: tool.description,\n\t\t\tparameters: tool.parameters,\n\t\t})),\n\t);\n\n\treturn `# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>${toolsRendered}</tools>\n\n# Format\n\nUse exactly one XML element whose tag name is the function name.\nInside the XML element, specify parameters using YAML syntax (key: value pairs).\n\n# Example\n<get_weather>\ncity: Seoul\nunit: celsius\n</get_weather>`;\n}\n\nexport function yamlXmlFormatToolCall(name: string, args: Record<string, unknown>): string {\n\tconst yamlBody = YAML.stringify(args).trimEnd();\n\treturn `<${name}>\\n${yamlBody.length > 0 ? yamlBody : \"null\"}\\n</${name}>`;\n}\n\nexport function yamlXmlFormatToolResponse(toolName: string, _toolCallId: string, content: TextContent[]): string {\n\tconst textContent = content\n\t\t.filter((entry): entry is TextContent => entry.type === \"text\")\n\t\t.map((entry) => entry.text)\n\t\t.join(\"\\n\");\n\n\treturn [\n\t\t`<tool_response>`,\n\t\t`tool_name: ${toolName}`,\n\t\t`result: |-`,\n\t\t...textContent.split(\"\\n\").map((line) => ` ${line}`),\n\t\t`</tool_response>`,\n\t].join(\"\\n\");\n}\n\nexport function parseYamlXmlGeneratedText(text: string, tools: Tool[], options?: ParserOptions): ParsedToolCall[] {\n\tif (tools.length === 0 || text.length === 0) {\n\t\treturn [];\n\t}\n\n\tconst parsedToolCalls: ParsedToolCall[] = [];\n\tconst toolNames = tools.map((tool) => tool.name);\n\tlet cursor = 0;\n\n\twhile (cursor < text.length) {\n\t\tconst openingTag = findEarliestXmlToolTag(text.slice(cursor), toolNames);\n\t\tif (!openingTag) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst absoluteIndex = cursor + openingTag.index;\n\t\tif (openingTag.selfClosing) {\n\t\t\tparsedToolCalls.push({ name: openingTag.name, arguments: {} });\n\t\t\tcursor = absoluteIndex + openingTag.tag.length;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst contentStart = absoluteIndex + openingTag.tag.length;\n\t\tconst closingTagEnd = findClosingTagEnd(text, contentStart, openingTag.name);\n\t\tif (closingTagEnd === -1) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst closingTagText = text.slice(contentStart, closingTagEnd);\n\t\tconst closingTagMatch = new RegExp(`</\\\\s*${escapeRegExp(openingTag.name)}\\\\s*>`).exec(closingTagText);\n\t\tconst closingTagIndex = closingTagMatch?.index;\n\t\tif (closingTagIndex === undefined) {\n\t\t\tcursor = closingTagEnd;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst yamlContent = closingTagText.slice(0, closingTagIndex);\n\t\tconst parsedArguments = parseYamlMapping(yamlContent);\n\t\tif (parsedArguments !== null) {\n\t\t\tparsedToolCalls.push({\n\t\t\t\tname: openingTag.name,\n\t\t\t\targuments: parsedArguments,\n\t\t\t});\n\t\t} else {\n\t\t\toptions?.onError?.(\"Could not process YAML XML tool call, keeping original text.\", {\n\t\t\t\ttoolCall: text.slice(absoluteIndex, closingTagEnd),\n\t\t\t});\n\t\t}\n\n\t\tcursor = closingTagEnd;\n\t}\n\n\treturn parsedToolCalls;\n}\n\nexport function createYamlXmlStreamParser(tools: Tool[], options?: ParserOptions): StreamParser {\n\tconst toolNames = tools.map((tool) => tool.name);\n\tlet buffer = \"\";\n\tlet currentToolState: {\n\t\tid: string;\n\t\tindex: number;\n\t\tname: string;\n\t\tlastArgumentsSnapshot: string | null;\n\t} | null = null;\n\tlet nextToolCallIndex = 0;\n\n\tfunction emitSnapshot(events: StreamParserEvent[], yamlContent: string): void {\n\t\tif (!currentToolState) {\n\t\t\treturn;\n\t\t}\n\t\tconst parsedArguments = parseYamlMapping(yamlContent);\n\t\tif (parsedArguments === null) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst snapshot = JSON.stringify(parsedArguments);\n\t\tif (snapshot === \"{}\" || snapshot === currentToolState.lastArgumentsSnapshot) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (currentToolState.lastArgumentsSnapshot === null) {\n\t\t\tevents.push({\n\t\t\t\ttype: \"toolcall_start\",\n\t\t\t\tindex: currentToolState.index,\n\t\t\t\tname: currentToolState.name,\n\t\t\t\tid: currentToolState.id,\n\t\t\t});\n\t\t}\n\n\t\tcurrentToolState.lastArgumentsSnapshot = snapshot;\n\t\tevents.push({\n\t\t\ttype: \"toolcall_delta\",\n\t\t\tindex: currentToolState.index,\n\t\t\targumentsDelta: snapshot,\n\t\t});\n\t}\n\n\tfunction processBuffer(): StreamParserEvent[] {\n\t\tconst events: StreamParserEvent[] = [];\n\n\t\twhile (buffer.length > 0) {\n\t\t\tif (currentToolState) {\n\t\t\t\tconst closingTagRegex = new RegExp(`</\\\\s*${escapeRegExp(currentToolState.name)}\\\\s*>`);\n\t\t\t\tconst closingTagMatch = closingTagRegex.exec(buffer);\n\t\t\t\tif (!closingTagMatch || closingTagMatch.index === undefined) {\n\t\t\t\t\temitSnapshot(events, buffer);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tconst yamlContent = buffer.slice(0, closingTagMatch.index);\n\t\t\t\tconst originalCallText = `<${currentToolState.name}>${yamlContent}${closingTagMatch[0]}`;\n\t\t\t\tconst parsedArguments = parseYamlMapping(yamlContent);\n\t\t\t\tbuffer = buffer.slice(closingTagMatch.index + closingTagMatch[0].length);\n\t\t\t\tif (parsedArguments === null) {\n\t\t\t\t\toptions?.onError?.(\"Could not process YAML XML tool call, keeping original text.\", {\n\t\t\t\t\t\ttoolCall: originalCallText,\n\t\t\t\t\t});\n\t\t\t\t\tif (shouldEmitRawToolCallTextOnError(options)) {\n\t\t\t\t\t\tevents.push({ type: \"text\", text: originalCallText });\n\t\t\t\t\t}\n\t\t\t\t\tcurrentToolState = null;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\temitSnapshot(events, yamlContent);\n\t\t\t\tif (currentToolState.lastArgumentsSnapshot === null) {\n\t\t\t\t\tevents.push({\n\t\t\t\t\t\ttype: \"toolcall_start\",\n\t\t\t\t\t\tindex: currentToolState.index,\n\t\t\t\t\t\tname: currentToolState.name,\n\t\t\t\t\t\tid: currentToolState.id,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tevents.push({\n\t\t\t\t\ttype: \"toolcall_end\",\n\t\t\t\t\tindex: currentToolState.index,\n\t\t\t\t\tname: currentToolState.name,\n\t\t\t\t\tid: currentToolState.id,\n\t\t\t\t\targuments: parsedArguments,\n\t\t\t\t});\n\t\t\t\tcurrentToolState = null;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst openingTag = findEarliestXmlToolTag(buffer, toolNames);\n\t\t\tif (!openingTag) {\n\t\t\t\tconst textLength = getSafeXmlTextLength(buffer, toolNames);\n\t\t\t\tif (textLength === 0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tevents.push({ type: \"text\", text: buffer.slice(0, textLength) });\n\t\t\t\tbuffer = buffer.slice(textLength);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (openingTag.index > 0) {\n\t\t\t\tevents.push({ type: \"text\", text: buffer.slice(0, openingTag.index) });\n\t\t\t}\n\n\t\t\tbuffer = buffer.slice(openingTag.index + openingTag.tag.length);\n\t\t\tif (openingTag.selfClosing) {\n\t\t\t\tconst id = `yaml-xml-tool-${nextToolCallIndex}`;\n\t\t\t\tconst index = nextToolCallIndex;\n\t\t\t\tnextToolCallIndex += 1;\n\t\t\t\tevents.push({ type: \"toolcall_start\", index, name: openingTag.name, id });\n\t\t\t\tevents.push({ type: \"toolcall_end\", index, name: openingTag.name, id, arguments: {} });\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tcurrentToolState = {\n\t\t\t\tid: `yaml-xml-tool-${nextToolCallIndex}`,\n\t\t\t\tindex: nextToolCallIndex,\n\t\t\t\tname: openingTag.name,\n\t\t\t\tlastArgumentsSnapshot: null,\n\t\t\t};\n\t\t\tnextToolCallIndex += 1;\n\t\t}\n\n\t\treturn events;\n\t}\n\n\treturn {\n\t\tfeed(textDelta: string): StreamParserEvent[] {\n\t\t\tif (textDelta.length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tbuffer += textDelta;\n\t\t\treturn processBuffer();\n\t\t},\n\t\tfinish(): StreamParserEvent[] {\n\t\t\tconst events = processBuffer();\n\t\t\tif (!currentToolState && buffer.length > 0) {\n\t\t\t\tevents.push({ type: \"text\", text: buffer });\n\t\t\t\tbuffer = \"\";\n\t\t\t}\n\t\t\tif (currentToolState && buffer.length > 0) {\n\t\t\t\tconst parsedArguments = parseYamlMapping(buffer);\n\t\t\t\tif (parsedArguments !== null) {\n\t\t\t\t\temitSnapshot(events, buffer);\n\t\t\t\t\tif (currentToolState.lastArgumentsSnapshot === null) {\n\t\t\t\t\t\tevents.push({\n\t\t\t\t\t\t\ttype: \"toolcall_start\",\n\t\t\t\t\t\t\tindex: currentToolState.index,\n\t\t\t\t\t\t\tname: currentToolState.name,\n\t\t\t\t\t\t\tid: currentToolState.id,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tevents.push({\n\t\t\t\t\t\ttype: \"toolcall_end\",\n\t\t\t\t\t\tindex: currentToolState.index,\n\t\t\t\t\t\tname: currentToolState.name,\n\t\t\t\t\t\tid: currentToolState.id,\n\t\t\t\t\t\targuments: parsedArguments,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tconst rawToolCall = `<${currentToolState.name}>${buffer}`;\n\t\t\t\t\toptions?.onError?.(\"Could not complete streaming YAML XML tool call at finish.\", {\n\t\t\t\t\t\ttoolCall: rawToolCall,\n\t\t\t\t\t});\n\t\t\t\t\tif (shouldEmitRawToolCallTextOnError(options)) {\n\t\t\t\t\t\tevents.push({ type: \"text\", text: rawToolCall });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbuffer = \"\";\n\t\t\t\tcurrentToolState = null;\n\t\t\t}\n\t\t\treturn events;\n\t\t},\n\t};\n}\n"]}
@@ -0,0 +1,295 @@
1
+ import YAML from "yaml";
2
+ import { findEarliestXmlToolTag, getSafeXmlTextLength } from "./xml-tool-tag-scanner.js";
3
+ function escapeRegExp(text) {
4
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5
+ }
6
+ function normalizeYamlContent(yamlContent) {
7
+ const trimmedLeadingNewline = yamlContent.startsWith("\n") ? yamlContent.slice(1) : yamlContent;
8
+ const lines = trimmedLeadingNewline.split("\n");
9
+ const nonEmptyLines = lines.filter((line) => line.trim().length > 0);
10
+ if (nonEmptyLines.length === 0) {
11
+ return "";
12
+ }
13
+ const minIndent = Math.min(...nonEmptyLines.map((line) => {
14
+ const match = line.match(/^(\s*)/);
15
+ return match?.[1].length ?? 0;
16
+ }));
17
+ return minIndent > 0 ? lines.map((line) => line.slice(minIndent)).join("\n") : trimmedLeadingNewline;
18
+ }
19
+ function parseYamlMapping(yamlContent) {
20
+ const normalized = normalizeYamlContent(yamlContent);
21
+ if (normalized.trim().length === 0) {
22
+ return {};
23
+ }
24
+ try {
25
+ const parsed = YAML.parse(normalized);
26
+ if (parsed === null) {
27
+ return {};
28
+ }
29
+ if (typeof parsed !== "object" || Array.isArray(parsed)) {
30
+ return null;
31
+ }
32
+ return parsed;
33
+ }
34
+ catch {
35
+ return null;
36
+ }
37
+ }
38
+ function findClosingTagEnd(text, contentStart, toolName) {
39
+ const closingPattern = new RegExp(`</\\s*${escapeRegExp(toolName)}\\s*>`, "g");
40
+ closingPattern.lastIndex = contentStart;
41
+ const match = closingPattern.exec(text);
42
+ return match?.index === undefined ? -1 : match.index + match[0].length;
43
+ }
44
+ function shouldEmitRawToolCallTextOnError(options) {
45
+ return options?.emitRawToolCallTextOnError === true;
46
+ }
47
+ export function yamlXmlFormatToolsSystemPrompt(tools) {
48
+ if (tools.length === 0) {
49
+ return "";
50
+ }
51
+ const toolsRendered = JSON.stringify(tools.map((tool) => ({
52
+ name: tool.name,
53
+ description: tool.description,
54
+ parameters: tool.parameters,
55
+ })));
56
+ return `# Tools
57
+
58
+ You may call one or more functions to assist with the user query.
59
+
60
+ You are provided with function signatures within <tools></tools> XML tags:
61
+ <tools>${toolsRendered}</tools>
62
+
63
+ # Format
64
+
65
+ Use exactly one XML element whose tag name is the function name.
66
+ Inside the XML element, specify parameters using YAML syntax (key: value pairs).
67
+
68
+ # Example
69
+ <get_weather>
70
+ city: Seoul
71
+ unit: celsius
72
+ </get_weather>`;
73
+ }
74
+ export function yamlXmlFormatToolCall(name, args) {
75
+ const yamlBody = YAML.stringify(args).trimEnd();
76
+ return `<${name}>\n${yamlBody.length > 0 ? yamlBody : "null"}\n</${name}>`;
77
+ }
78
+ export function yamlXmlFormatToolResponse(toolName, _toolCallId, content) {
79
+ const textContent = content
80
+ .filter((entry) => entry.type === "text")
81
+ .map((entry) => entry.text)
82
+ .join("\n");
83
+ return [
84
+ `<tool_response>`,
85
+ `tool_name: ${toolName}`,
86
+ `result: |-`,
87
+ ...textContent.split("\n").map((line) => ` ${line}`),
88
+ `</tool_response>`,
89
+ ].join("\n");
90
+ }
91
+ export function parseYamlXmlGeneratedText(text, tools, options) {
92
+ if (tools.length === 0 || text.length === 0) {
93
+ return [];
94
+ }
95
+ const parsedToolCalls = [];
96
+ const toolNames = tools.map((tool) => tool.name);
97
+ let cursor = 0;
98
+ while (cursor < text.length) {
99
+ const openingTag = findEarliestXmlToolTag(text.slice(cursor), toolNames);
100
+ if (!openingTag) {
101
+ break;
102
+ }
103
+ const absoluteIndex = cursor + openingTag.index;
104
+ if (openingTag.selfClosing) {
105
+ parsedToolCalls.push({ name: openingTag.name, arguments: {} });
106
+ cursor = absoluteIndex + openingTag.tag.length;
107
+ continue;
108
+ }
109
+ const contentStart = absoluteIndex + openingTag.tag.length;
110
+ const closingTagEnd = findClosingTagEnd(text, contentStart, openingTag.name);
111
+ if (closingTagEnd === -1) {
112
+ break;
113
+ }
114
+ const closingTagText = text.slice(contentStart, closingTagEnd);
115
+ const closingTagMatch = new RegExp(`</\\s*${escapeRegExp(openingTag.name)}\\s*>`).exec(closingTagText);
116
+ const closingTagIndex = closingTagMatch?.index;
117
+ if (closingTagIndex === undefined) {
118
+ cursor = closingTagEnd;
119
+ continue;
120
+ }
121
+ const yamlContent = closingTagText.slice(0, closingTagIndex);
122
+ const parsedArguments = parseYamlMapping(yamlContent);
123
+ if (parsedArguments !== null) {
124
+ parsedToolCalls.push({
125
+ name: openingTag.name,
126
+ arguments: parsedArguments,
127
+ });
128
+ }
129
+ else {
130
+ options?.onError?.("Could not process YAML XML tool call, keeping original text.", {
131
+ toolCall: text.slice(absoluteIndex, closingTagEnd),
132
+ });
133
+ }
134
+ cursor = closingTagEnd;
135
+ }
136
+ return parsedToolCalls;
137
+ }
138
+ export function createYamlXmlStreamParser(tools, options) {
139
+ const toolNames = tools.map((tool) => tool.name);
140
+ let buffer = "";
141
+ let currentToolState = null;
142
+ let nextToolCallIndex = 0;
143
+ function emitSnapshot(events, yamlContent) {
144
+ if (!currentToolState) {
145
+ return;
146
+ }
147
+ const parsedArguments = parseYamlMapping(yamlContent);
148
+ if (parsedArguments === null) {
149
+ return;
150
+ }
151
+ const snapshot = JSON.stringify(parsedArguments);
152
+ if (snapshot === "{}" || snapshot === currentToolState.lastArgumentsSnapshot) {
153
+ return;
154
+ }
155
+ if (currentToolState.lastArgumentsSnapshot === null) {
156
+ events.push({
157
+ type: "toolcall_start",
158
+ index: currentToolState.index,
159
+ name: currentToolState.name,
160
+ id: currentToolState.id,
161
+ });
162
+ }
163
+ currentToolState.lastArgumentsSnapshot = snapshot;
164
+ events.push({
165
+ type: "toolcall_delta",
166
+ index: currentToolState.index,
167
+ argumentsDelta: snapshot,
168
+ });
169
+ }
170
+ function processBuffer() {
171
+ const events = [];
172
+ while (buffer.length > 0) {
173
+ if (currentToolState) {
174
+ const closingTagRegex = new RegExp(`</\\s*${escapeRegExp(currentToolState.name)}\\s*>`);
175
+ const closingTagMatch = closingTagRegex.exec(buffer);
176
+ if (!closingTagMatch || closingTagMatch.index === undefined) {
177
+ emitSnapshot(events, buffer);
178
+ break;
179
+ }
180
+ const yamlContent = buffer.slice(0, closingTagMatch.index);
181
+ const originalCallText = `<${currentToolState.name}>${yamlContent}${closingTagMatch[0]}`;
182
+ const parsedArguments = parseYamlMapping(yamlContent);
183
+ buffer = buffer.slice(closingTagMatch.index + closingTagMatch[0].length);
184
+ if (parsedArguments === null) {
185
+ options?.onError?.("Could not process YAML XML tool call, keeping original text.", {
186
+ toolCall: originalCallText,
187
+ });
188
+ if (shouldEmitRawToolCallTextOnError(options)) {
189
+ events.push({ type: "text", text: originalCallText });
190
+ }
191
+ currentToolState = null;
192
+ continue;
193
+ }
194
+ emitSnapshot(events, yamlContent);
195
+ if (currentToolState.lastArgumentsSnapshot === null) {
196
+ events.push({
197
+ type: "toolcall_start",
198
+ index: currentToolState.index,
199
+ name: currentToolState.name,
200
+ id: currentToolState.id,
201
+ });
202
+ }
203
+ events.push({
204
+ type: "toolcall_end",
205
+ index: currentToolState.index,
206
+ name: currentToolState.name,
207
+ id: currentToolState.id,
208
+ arguments: parsedArguments,
209
+ });
210
+ currentToolState = null;
211
+ continue;
212
+ }
213
+ const openingTag = findEarliestXmlToolTag(buffer, toolNames);
214
+ if (!openingTag) {
215
+ const textLength = getSafeXmlTextLength(buffer, toolNames);
216
+ if (textLength === 0) {
217
+ break;
218
+ }
219
+ events.push({ type: "text", text: buffer.slice(0, textLength) });
220
+ buffer = buffer.slice(textLength);
221
+ continue;
222
+ }
223
+ if (openingTag.index > 0) {
224
+ events.push({ type: "text", text: buffer.slice(0, openingTag.index) });
225
+ }
226
+ buffer = buffer.slice(openingTag.index + openingTag.tag.length);
227
+ if (openingTag.selfClosing) {
228
+ const id = `yaml-xml-tool-${nextToolCallIndex}`;
229
+ const index = nextToolCallIndex;
230
+ nextToolCallIndex += 1;
231
+ events.push({ type: "toolcall_start", index, name: openingTag.name, id });
232
+ events.push({ type: "toolcall_end", index, name: openingTag.name, id, arguments: {} });
233
+ continue;
234
+ }
235
+ currentToolState = {
236
+ id: `yaml-xml-tool-${nextToolCallIndex}`,
237
+ index: nextToolCallIndex,
238
+ name: openingTag.name,
239
+ lastArgumentsSnapshot: null,
240
+ };
241
+ nextToolCallIndex += 1;
242
+ }
243
+ return events;
244
+ }
245
+ return {
246
+ feed(textDelta) {
247
+ if (textDelta.length === 0) {
248
+ return [];
249
+ }
250
+ buffer += textDelta;
251
+ return processBuffer();
252
+ },
253
+ finish() {
254
+ const events = processBuffer();
255
+ if (!currentToolState && buffer.length > 0) {
256
+ events.push({ type: "text", text: buffer });
257
+ buffer = "";
258
+ }
259
+ if (currentToolState && buffer.length > 0) {
260
+ const parsedArguments = parseYamlMapping(buffer);
261
+ if (parsedArguments !== null) {
262
+ emitSnapshot(events, buffer);
263
+ if (currentToolState.lastArgumentsSnapshot === null) {
264
+ events.push({
265
+ type: "toolcall_start",
266
+ index: currentToolState.index,
267
+ name: currentToolState.name,
268
+ id: currentToolState.id,
269
+ });
270
+ }
271
+ events.push({
272
+ type: "toolcall_end",
273
+ index: currentToolState.index,
274
+ name: currentToolState.name,
275
+ id: currentToolState.id,
276
+ arguments: parsedArguments,
277
+ });
278
+ }
279
+ else {
280
+ const rawToolCall = `<${currentToolState.name}>${buffer}`;
281
+ options?.onError?.("Could not complete streaming YAML XML tool call at finish.", {
282
+ toolCall: rawToolCall,
283
+ });
284
+ if (shouldEmitRawToolCallTextOnError(options)) {
285
+ events.push({ type: "text", text: rawToolCall });
286
+ }
287
+ }
288
+ buffer = "";
289
+ currentToolState = null;
290
+ }
291
+ return events;
292
+ },
293
+ };
294
+ }
295
+ //# sourceMappingURL=yaml-xml.js.map