@bolt-foundry/gambit-core 0.5.3-dev

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 (711) hide show
  1. package/esm/_dnt.polyfills.d.ts +12 -0
  2. package/esm/_dnt.polyfills.d.ts.map +1 -0
  3. package/esm/_dnt.polyfills.js +15 -0
  4. package/esm/_dnt.shims.d.ts +6 -0
  5. package/esm/_dnt.shims.d.ts.map +1 -0
  6. package/esm/_dnt.shims.js +61 -0
  7. package/esm/deps/jsr.io/@std/collections/1.1.3/_utils.d.ts +6 -0
  8. package/esm/deps/jsr.io/@std/collections/1.1.3/_utils.d.ts.map +1 -0
  9. package/esm/deps/jsr.io/@std/collections/1.1.3/_utils.js +18 -0
  10. package/esm/deps/jsr.io/@std/collections/1.1.3/deep_merge.d.ts +322 -0
  11. package/esm/deps/jsr.io/@std/collections/1.1.3/deep_merge.d.ts.map +1 -0
  12. package/esm/deps/jsr.io/@std/collections/1.1.3/deep_merge.js +95 -0
  13. package/esm/deps/jsr.io/@std/front-matter/1.0.9/_formats.d.ts +11 -0
  14. package/esm/deps/jsr.io/@std/front-matter/1.0.9/_formats.d.ts.map +1 -0
  15. package/esm/deps/jsr.io/@std/front-matter/1.0.9/_formats.js +28 -0
  16. package/esm/deps/jsr.io/@std/front-matter/1.0.9/_shared.d.ts +5 -0
  17. package/esm/deps/jsr.io/@std/front-matter/1.0.9/_shared.d.ts.map +1 -0
  18. package/esm/deps/jsr.io/@std/front-matter/1.0.9/_shared.js +8 -0
  19. package/esm/deps/jsr.io/@std/front-matter/1.0.9/any.d.ts +32 -0
  20. package/esm/deps/jsr.io/@std/front-matter/1.0.9/any.d.ts.map +1 -0
  21. package/esm/deps/jsr.io/@std/front-matter/1.0.9/any.js +48 -0
  22. package/esm/deps/jsr.io/@std/front-matter/1.0.9/json.d.ts +30 -0
  23. package/esm/deps/jsr.io/@std/front-matter/1.0.9/json.d.ts.map +1 -0
  24. package/esm/deps/jsr.io/@std/front-matter/1.0.9/json.js +35 -0
  25. package/esm/deps/jsr.io/@std/front-matter/1.0.9/toml.d.ts +30 -0
  26. package/esm/deps/jsr.io/@std/front-matter/1.0.9/toml.d.ts.map +1 -0
  27. package/esm/deps/jsr.io/@std/front-matter/1.0.9/toml.js +36 -0
  28. package/esm/deps/jsr.io/@std/front-matter/1.0.9/types.d.ts +7 -0
  29. package/esm/deps/jsr.io/@std/front-matter/1.0.9/types.d.ts.map +1 -0
  30. package/esm/deps/jsr.io/@std/front-matter/1.0.9/types.js +3 -0
  31. package/esm/deps/jsr.io/@std/front-matter/1.0.9/yaml.d.ts +33 -0
  32. package/esm/deps/jsr.io/@std/front-matter/1.0.9/yaml.d.ts.map +1 -0
  33. package/esm/deps/jsr.io/@std/front-matter/1.0.9/yaml.js +39 -0
  34. package/esm/deps/jsr.io/@std/internal/1.0.12/_os.d.ts +2 -0
  35. package/esm/deps/jsr.io/@std/internal/1.0.12/_os.d.ts.map +1 -0
  36. package/esm/deps/jsr.io/@std/internal/1.0.12/_os.js +12 -0
  37. package/esm/deps/jsr.io/@std/internal/1.0.12/os.d.ts +3 -0
  38. package/esm/deps/jsr.io/@std/internal/1.0.12/os.d.ts.map +1 -0
  39. package/esm/deps/jsr.io/@std/internal/1.0.12/os.js +5 -0
  40. package/esm/deps/jsr.io/@std/path/1.1.4/_common/assert_path.d.ts +2 -0
  41. package/esm/deps/jsr.io/@std/path/1.1.4/_common/assert_path.d.ts.map +1 -0
  42. package/esm/deps/jsr.io/@std/path/1.1.4/_common/assert_path.js +7 -0
  43. package/esm/deps/jsr.io/@std/path/1.1.4/_common/basename.d.ts +4 -0
  44. package/esm/deps/jsr.io/@std/path/1.1.4/_common/basename.d.ts.map +1 -0
  45. package/esm/deps/jsr.io/@std/path/1.1.4/_common/basename.js +40 -0
  46. package/esm/deps/jsr.io/@std/path/1.1.4/_common/common.d.ts +2 -0
  47. package/esm/deps/jsr.io/@std/path/1.1.4/_common/common.d.ts.map +1 -0
  48. package/esm/deps/jsr.io/@std/path/1.1.4/_common/common.js +23 -0
  49. package/esm/deps/jsr.io/@std/path/1.1.4/_common/constants.d.ts +40 -0
  50. package/esm/deps/jsr.io/@std/path/1.1.4/_common/constants.d.ts.map +1 -0
  51. package/esm/deps/jsr.io/@std/path/1.1.4/_common/constants.js +46 -0
  52. package/esm/deps/jsr.io/@std/path/1.1.4/_common/dirname.d.ts +2 -0
  53. package/esm/deps/jsr.io/@std/path/1.1.4/_common/dirname.d.ts.map +1 -0
  54. package/esm/deps/jsr.io/@std/path/1.1.4/_common/dirname.js +8 -0
  55. package/esm/deps/jsr.io/@std/path/1.1.4/_common/format.d.ts +4 -0
  56. package/esm/deps/jsr.io/@std/path/1.1.4/_common/format.d.ts.map +1 -0
  57. package/esm/deps/jsr.io/@std/path/1.1.4/_common/format.js +19 -0
  58. package/esm/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.d.ts +2 -0
  59. package/esm/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.d.ts.map +1 -0
  60. package/esm/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.js +9 -0
  61. package/esm/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.d.ts +35 -0
  62. package/esm/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.d.ts.map +1 -0
  63. package/esm/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.js +235 -0
  64. package/esm/deps/jsr.io/@std/path/1.1.4/_common/normalize.d.ts +2 -0
  65. package/esm/deps/jsr.io/@std/path/1.1.4/_common/normalize.d.ts.map +1 -0
  66. package/esm/deps/jsr.io/@std/path/1.1.4/_common/normalize.js +8 -0
  67. package/esm/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.d.ts +2 -0
  68. package/esm/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.d.ts.map +1 -0
  69. package/esm/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.js +77 -0
  70. package/esm/deps/jsr.io/@std/path/1.1.4/_common/relative.d.ts +2 -0
  71. package/esm/deps/jsr.io/@std/path/1.1.4/_common/relative.d.ts.map +1 -0
  72. package/esm/deps/jsr.io/@std/path/1.1.4/_common/relative.js +9 -0
  73. package/esm/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.d.ts +2 -0
  74. package/esm/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.d.ts.map +1 -0
  75. package/esm/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.js +19 -0
  76. package/esm/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.d.ts +2 -0
  77. package/esm/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.d.ts.map +1 -0
  78. package/esm/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.js +15 -0
  79. package/esm/deps/jsr.io/@std/path/1.1.4/basename.d.ts +27 -0
  80. package/esm/deps/jsr.io/@std/path/1.1.4/basename.d.ts.map +1 -0
  81. package/esm/deps/jsr.io/@std/path/1.1.4/basename.js +35 -0
  82. package/esm/deps/jsr.io/@std/path/1.1.4/common.d.ts +28 -0
  83. package/esm/deps/jsr.io/@std/path/1.1.4/common.d.ts.map +1 -0
  84. package/esm/deps/jsr.io/@std/path/1.1.4/common.js +33 -0
  85. package/esm/deps/jsr.io/@std/path/1.1.4/constants.d.ts +15 -0
  86. package/esm/deps/jsr.io/@std/path/1.1.4/constants.d.ts.map +1 -0
  87. package/esm/deps/jsr.io/@std/path/1.1.4/constants.js +17 -0
  88. package/esm/deps/jsr.io/@std/path/1.1.4/dirname.d.ts +22 -0
  89. package/esm/deps/jsr.io/@std/path/1.1.4/dirname.d.ts.map +1 -0
  90. package/esm/deps/jsr.io/@std/path/1.1.4/dirname.js +28 -0
  91. package/esm/deps/jsr.io/@std/path/1.1.4/extname.d.ts +22 -0
  92. package/esm/deps/jsr.io/@std/path/1.1.4/extname.d.ts.map +1 -0
  93. package/esm/deps/jsr.io/@std/path/1.1.4/extname.js +28 -0
  94. package/esm/deps/jsr.io/@std/path/1.1.4/format.d.ts +22 -0
  95. package/esm/deps/jsr.io/@std/path/1.1.4/format.d.ts.map +1 -0
  96. package/esm/deps/jsr.io/@std/path/1.1.4/format.js +27 -0
  97. package/esm/deps/jsr.io/@std/path/1.1.4/from_file_url.d.ts +22 -0
  98. package/esm/deps/jsr.io/@std/path/1.1.4/from_file_url.d.ts.map +1 -0
  99. package/esm/deps/jsr.io/@std/path/1.1.4/from_file_url.js +28 -0
  100. package/esm/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.d.ts +77 -0
  101. package/esm/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.d.ts.map +1 -0
  102. package/esm/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.js +83 -0
  103. package/esm/deps/jsr.io/@std/path/1.1.4/is_absolute.d.ts +22 -0
  104. package/esm/deps/jsr.io/@std/path/1.1.4/is_absolute.d.ts.map +1 -0
  105. package/esm/deps/jsr.io/@std/path/1.1.4/is_absolute.js +28 -0
  106. package/esm/deps/jsr.io/@std/path/1.1.4/is_glob.d.ts +17 -0
  107. package/esm/deps/jsr.io/@std/path/1.1.4/is_glob.d.ts.map +1 -0
  108. package/esm/deps/jsr.io/@std/path/1.1.4/is_glob.js +42 -0
  109. package/esm/deps/jsr.io/@std/path/1.1.4/join.d.ts +23 -0
  110. package/esm/deps/jsr.io/@std/path/1.1.4/join.d.ts.map +1 -0
  111. package/esm/deps/jsr.io/@std/path/1.1.4/join.js +29 -0
  112. package/esm/deps/jsr.io/@std/path/1.1.4/join_globs.d.ts +28 -0
  113. package/esm/deps/jsr.io/@std/path/1.1.4/join_globs.d.ts.map +1 -0
  114. package/esm/deps/jsr.io/@std/path/1.1.4/join_globs.js +34 -0
  115. package/esm/deps/jsr.io/@std/path/1.1.4/mod.d.ts +213 -0
  116. package/esm/deps/jsr.io/@std/path/1.1.4/mod.d.ts.map +1 -0
  117. package/esm/deps/jsr.io/@std/path/1.1.4/mod.js +216 -0
  118. package/esm/deps/jsr.io/@std/path/1.1.4/normalize.d.ts +26 -0
  119. package/esm/deps/jsr.io/@std/path/1.1.4/normalize.d.ts.map +1 -0
  120. package/esm/deps/jsr.io/@std/path/1.1.4/normalize.js +32 -0
  121. package/esm/deps/jsr.io/@std/path/1.1.4/normalize_glob.d.ts +29 -0
  122. package/esm/deps/jsr.io/@std/path/1.1.4/normalize_glob.d.ts.map +1 -0
  123. package/esm/deps/jsr.io/@std/path/1.1.4/normalize_glob.js +35 -0
  124. package/esm/deps/jsr.io/@std/path/1.1.4/parse.d.ts +35 -0
  125. package/esm/deps/jsr.io/@std/path/1.1.4/parse.d.ts.map +1 -0
  126. package/esm/deps/jsr.io/@std/path/1.1.4/parse.js +39 -0
  127. package/esm/deps/jsr.io/@std/path/1.1.4/posix/_util.d.ts +2 -0
  128. package/esm/deps/jsr.io/@std/path/1.1.4/posix/_util.d.ts.map +1 -0
  129. package/esm/deps/jsr.io/@std/path/1.1.4/posix/_util.js +8 -0
  130. package/esm/deps/jsr.io/@std/path/1.1.4/posix/basename.d.ts +39 -0
  131. package/esm/deps/jsr.io/@std/path/1.1.4/posix/basename.d.ts.map +1 -0
  132. package/esm/deps/jsr.io/@std/path/1.1.4/posix/basename.js +52 -0
  133. package/esm/deps/jsr.io/@std/path/1.1.4/posix/constants.d.ts +13 -0
  134. package/esm/deps/jsr.io/@std/path/1.1.4/posix/constants.d.ts.map +1 -0
  135. package/esm/deps/jsr.io/@std/path/1.1.4/posix/constants.js +14 -0
  136. package/esm/deps/jsr.io/@std/path/1.1.4/posix/dirname.d.ts +30 -0
  137. package/esm/deps/jsr.io/@std/path/1.1.4/posix/dirname.d.ts.map +1 -0
  138. package/esm/deps/jsr.io/@std/path/1.1.4/posix/dirname.js +64 -0
  139. package/esm/deps/jsr.io/@std/path/1.1.4/posix/extname.d.ts +37 -0
  140. package/esm/deps/jsr.io/@std/path/1.1.4/posix/extname.d.ts.map +1 -0
  141. package/esm/deps/jsr.io/@std/path/1.1.4/posix/extname.js +93 -0
  142. package/esm/deps/jsr.io/@std/path/1.1.4/posix/format.d.ts +24 -0
  143. package/esm/deps/jsr.io/@std/path/1.1.4/posix/format.d.ts.map +1 -0
  144. package/esm/deps/jsr.io/@std/path/1.1.4/posix/format.js +28 -0
  145. package/esm/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.d.ts +16 -0
  146. package/esm/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.d.ts.map +1 -0
  147. package/esm/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.js +21 -0
  148. package/esm/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.d.ts +72 -0
  149. package/esm/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.d.ts.map +1 -0
  150. package/esm/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.js +82 -0
  151. package/esm/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.d.ts +17 -0
  152. package/esm/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.d.ts.map +1 -0
  153. package/esm/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.js +23 -0
  154. package/esm/deps/jsr.io/@std/path/1.1.4/posix/join.d.ts +31 -0
  155. package/esm/deps/jsr.io/@std/path/1.1.4/posix/join.d.ts.map +1 -0
  156. package/esm/deps/jsr.io/@std/path/1.1.4/posix/join.js +45 -0
  157. package/esm/deps/jsr.io/@std/path/1.1.4/posix/join_globs.d.ts +20 -0
  158. package/esm/deps/jsr.io/@std/path/1.1.4/posix/join_globs.d.ts.map +1 -0
  159. package/esm/deps/jsr.io/@std/path/1.1.4/posix/join_globs.js +40 -0
  160. package/esm/deps/jsr.io/@std/path/1.1.4/posix/normalize.d.ts +37 -0
  161. package/esm/deps/jsr.io/@std/path/1.1.4/posix/normalize.d.ts.map +1 -0
  162. package/esm/deps/jsr.io/@std/path/1.1.4/posix/normalize.js +58 -0
  163. package/esm/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.d.ts +20 -0
  164. package/esm/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.d.ts.map +1 -0
  165. package/esm/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.js +32 -0
  166. package/esm/deps/jsr.io/@std/path/1.1.4/posix/parse.d.ts +25 -0
  167. package/esm/deps/jsr.io/@std/path/1.1.4/posix/parse.d.ts.map +1 -0
  168. package/esm/deps/jsr.io/@std/path/1.1.4/posix/parse.js +115 -0
  169. package/esm/deps/jsr.io/@std/path/1.1.4/posix/relative.d.ts +20 -0
  170. package/esm/deps/jsr.io/@std/path/1.1.4/posix/relative.d.ts.map +1 -0
  171. package/esm/deps/jsr.io/@std/path/1.1.4/posix/relative.js +106 -0
  172. package/esm/deps/jsr.io/@std/path/1.1.4/posix/resolve.d.ts +17 -0
  173. package/esm/deps/jsr.io/@std/path/1.1.4/posix/resolve.d.ts.map +1 -0
  174. package/esm/deps/jsr.io/@std/path/1.1.4/posix/resolve.js +59 -0
  175. package/esm/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.d.ts +17 -0
  176. package/esm/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.d.ts.map +1 -0
  177. package/esm/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.js +27 -0
  178. package/esm/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.d.ts +16 -0
  179. package/esm/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.d.ts.map +1 -0
  180. package/esm/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.js +20 -0
  181. package/esm/deps/jsr.io/@std/path/1.1.4/relative.d.ts +24 -0
  182. package/esm/deps/jsr.io/@std/path/1.1.4/relative.d.ts.map +1 -0
  183. package/esm/deps/jsr.io/@std/path/1.1.4/relative.js +30 -0
  184. package/esm/deps/jsr.io/@std/path/1.1.4/resolve.d.ts +22 -0
  185. package/esm/deps/jsr.io/@std/path/1.1.4/resolve.d.ts.map +1 -0
  186. package/esm/deps/jsr.io/@std/path/1.1.4/resolve.js +30 -0
  187. package/esm/deps/jsr.io/@std/path/1.1.4/to_file_url.d.ts +22 -0
  188. package/esm/deps/jsr.io/@std/path/1.1.4/to_file_url.d.ts.map +1 -0
  189. package/esm/deps/jsr.io/@std/path/1.1.4/to_file_url.js +28 -0
  190. package/esm/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.d.ts +21 -0
  191. package/esm/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.d.ts.map +1 -0
  192. package/esm/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.js +29 -0
  193. package/esm/deps/jsr.io/@std/path/1.1.4/types.d.ts +38 -0
  194. package/esm/deps/jsr.io/@std/path/1.1.4/types.d.ts.map +1 -0
  195. package/esm/deps/jsr.io/@std/path/1.1.4/types.js +3 -0
  196. package/esm/deps/jsr.io/@std/path/1.1.4/windows/_util.d.ts +4 -0
  197. package/esm/deps/jsr.io/@std/path/1.1.4/windows/_util.d.ts.map +1 -0
  198. package/esm/deps/jsr.io/@std/path/1.1.4/windows/_util.js +15 -0
  199. package/esm/deps/jsr.io/@std/path/1.1.4/windows/basename.d.ts +22 -0
  200. package/esm/deps/jsr.io/@std/path/1.1.4/windows/basename.d.ts.map +1 -0
  201. package/esm/deps/jsr.io/@std/path/1.1.4/windows/basename.js +47 -0
  202. package/esm/deps/jsr.io/@std/path/1.1.4/windows/constants.d.ts +13 -0
  203. package/esm/deps/jsr.io/@std/path/1.1.4/windows/constants.d.ts.map +1 -0
  204. package/esm/deps/jsr.io/@std/path/1.1.4/windows/constants.js +14 -0
  205. package/esm/deps/jsr.io/@std/path/1.1.4/windows/dirname.d.ts +17 -0
  206. package/esm/deps/jsr.io/@std/path/1.1.4/windows/dirname.d.ts.map +1 -0
  207. package/esm/deps/jsr.io/@std/path/1.1.4/windows/dirname.js +113 -0
  208. package/esm/deps/jsr.io/@std/path/1.1.4/windows/extname.d.ts +17 -0
  209. package/esm/deps/jsr.io/@std/path/1.1.4/windows/extname.d.ts.map +1 -0
  210. package/esm/deps/jsr.io/@std/path/1.1.4/windows/extname.js +82 -0
  211. package/esm/deps/jsr.io/@std/path/1.1.4/windows/format.d.ts +24 -0
  212. package/esm/deps/jsr.io/@std/path/1.1.4/windows/format.d.ts.map +1 -0
  213. package/esm/deps/jsr.io/@std/path/1.1.4/windows/format.js +28 -0
  214. package/esm/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.d.ts +18 -0
  215. package/esm/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.d.ts.map +1 -0
  216. package/esm/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.js +30 -0
  217. package/esm/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.d.ts +71 -0
  218. package/esm/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.d.ts.map +1 -0
  219. package/esm/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.js +82 -0
  220. package/esm/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.d.ts +17 -0
  221. package/esm/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.d.ts.map +1 -0
  222. package/esm/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.js +38 -0
  223. package/esm/deps/jsr.io/@std/path/1.1.4/windows/join.d.ts +18 -0
  224. package/esm/deps/jsr.io/@std/path/1.1.4/windows/join.d.ts.map +1 -0
  225. package/esm/deps/jsr.io/@std/path/1.1.4/windows/join.js +77 -0
  226. package/esm/deps/jsr.io/@std/path/1.1.4/windows/join_globs.d.ts +21 -0
  227. package/esm/deps/jsr.io/@std/path/1.1.4/windows/join_globs.d.ts.map +1 -0
  228. package/esm/deps/jsr.io/@std/path/1.1.4/windows/join_globs.js +41 -0
  229. package/esm/deps/jsr.io/@std/path/1.1.4/windows/normalize.d.ts +19 -0
  230. package/esm/deps/jsr.io/@std/path/1.1.4/windows/normalize.d.ts.map +1 -0
  231. package/esm/deps/jsr.io/@std/path/1.1.4/windows/normalize.js +135 -0
  232. package/esm/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.d.ts +20 -0
  233. package/esm/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.d.ts.map +1 -0
  234. package/esm/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.js +32 -0
  235. package/esm/deps/jsr.io/@std/path/1.1.4/windows/parse.d.ts +25 -0
  236. package/esm/deps/jsr.io/@std/path/1.1.4/windows/parse.d.ts.map +1 -0
  237. package/esm/deps/jsr.io/@std/path/1.1.4/windows/parse.js +176 -0
  238. package/esm/deps/jsr.io/@std/path/1.1.4/windows/relative.d.ts +23 -0
  239. package/esm/deps/jsr.io/@std/path/1.1.4/windows/relative.d.ts.map +1 -0
  240. package/esm/deps/jsr.io/@std/path/1.1.4/windows/relative.js +131 -0
  241. package/esm/deps/jsr.io/@std/path/1.1.4/windows/resolve.d.ts +17 -0
  242. package/esm/deps/jsr.io/@std/path/1.1.4/windows/resolve.d.ts.map +1 -0
  243. package/esm/deps/jsr.io/@std/path/1.1.4/windows/resolve.js +154 -0
  244. package/esm/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.d.ts +17 -0
  245. package/esm/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.d.ts.map +1 -0
  246. package/esm/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.js +34 -0
  247. package/esm/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.d.ts +17 -0
  248. package/esm/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.d.ts.map +1 -0
  249. package/esm/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.js +49 -0
  250. package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts +93 -0
  251. package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts.map +1 -0
  252. package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.js +753 -0
  253. package/esm/deps/jsr.io/@std/toml/1.0.11/parse.d.ts +21 -0
  254. package/esm/deps/jsr.io/@std/toml/1.0.11/parse.d.ts.map +1 -0
  255. package/esm/deps/jsr.io/@std/toml/1.0.11/parse.js +25 -0
  256. package/esm/deps/jsr.io/@std/yaml/1.0.10/_chars.d.ts +33 -0
  257. package/esm/deps/jsr.io/@std/yaml/1.0.10/_chars.d.ts.map +1 -0
  258. package/esm/deps/jsr.io/@std/yaml/1.0.10/_chars.js +48 -0
  259. package/esm/deps/jsr.io/@std/yaml/1.0.10/_loader_state.d.ts +66 -0
  260. package/esm/deps/jsr.io/@std/yaml/1.0.10/_loader_state.d.ts.map +1 -0
  261. package/esm/deps/jsr.io/@std/yaml/1.0.10/_loader_state.js +1427 -0
  262. package/esm/deps/jsr.io/@std/yaml/1.0.10/_schema.d.ts +44 -0
  263. package/esm/deps/jsr.io/@std/yaml/1.0.10/_schema.d.ts.map +1 -0
  264. package/esm/deps/jsr.io/@std/yaml/1.0.10/_schema.js +117 -0
  265. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/binary.d.ts +3 -0
  266. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/binary.d.ts.map +1 -0
  267. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/binary.js +103 -0
  268. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/bool.d.ts +3 -0
  269. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/bool.d.ts.map +1 -0
  270. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/bool.js +32 -0
  271. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/float.d.ts +3 -0
  272. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/float.d.ts.map +1 -0
  273. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/float.js +96 -0
  274. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/int.d.ts +3 -0
  275. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/int.d.ts.map +1 -0
  276. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/int.js +159 -0
  277. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/map.d.ts +3 -0
  278. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/map.d.ts.map +1 -0
  279. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/map.js +14 -0
  280. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/merge.d.ts +3 -0
  281. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/merge.d.ts.map +1 -0
  282. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/merge.js +10 -0
  283. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/nil.d.ts +3 -0
  284. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/nil.d.ts.map +1 -0
  285. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/nil.js +22 -0
  286. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/omap.d.ts +3 -0
  287. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/omap.d.ts.map +1 -0
  288. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/omap.js +29 -0
  289. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/pairs.d.ts +3 -0
  290. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/pairs.d.ts.map +1 -0
  291. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/pairs.js +19 -0
  292. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/regexp.d.ts +3 -0
  293. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/regexp.d.ts.map +1 -0
  294. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/regexp.js +30 -0
  295. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/seq.d.ts +3 -0
  296. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/seq.d.ts.map +1 -0
  297. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/seq.js +10 -0
  298. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/set.d.ts +3 -0
  299. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/set.d.ts.map +1 -0
  300. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/set.js +14 -0
  301. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/str.d.ts +3 -0
  302. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/str.d.ts.map +1 -0
  303. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/str.js +9 -0
  304. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/timestamp.d.ts +3 -0
  305. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/timestamp.d.ts.map +1 -0
  306. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/timestamp.js +81 -0
  307. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/undefined.d.ts +3 -0
  308. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/undefined.d.ts.map +1 -0
  309. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type/undefined.js +20 -0
  310. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type.d.ts +32 -0
  311. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type.d.ts.map +1 -0
  312. package/esm/deps/jsr.io/@std/yaml/1.0.10/_type.js +6 -0
  313. package/esm/deps/jsr.io/@std/yaml/1.0.10/_utils.d.ts +4 -0
  314. package/esm/deps/jsr.io/@std/yaml/1.0.10/_utils.d.ts.map +1 -0
  315. package/esm/deps/jsr.io/@std/yaml/1.0.10/_utils.js +13 -0
  316. package/esm/deps/jsr.io/@std/yaml/1.0.10/parse.d.ts +76 -0
  317. package/esm/deps/jsr.io/@std/yaml/1.0.10/parse.d.ts.map +1 -0
  318. package/esm/deps/jsr.io/@std/yaml/1.0.10/parse.js +93 -0
  319. package/esm/mod.d.ts +51 -0
  320. package/esm/mod.d.ts.map +1 -0
  321. package/esm/mod.js +20 -0
  322. package/esm/package.json +3 -0
  323. package/esm/src/constants.d.ts +15 -0
  324. package/esm/src/constants.d.ts.map +1 -0
  325. package/esm/src/constants.js +20 -0
  326. package/esm/src/definitions.d.ts +11 -0
  327. package/esm/src/definitions.d.ts.map +1 -0
  328. package/esm/src/definitions.js +14 -0
  329. package/esm/src/loader.d.ts +4 -0
  330. package/esm/src/loader.d.ts.map +1 -0
  331. package/esm/src/loader.js +179 -0
  332. package/esm/src/markdown.d.ts +5 -0
  333. package/esm/src/markdown.d.ts.map +1 -0
  334. package/esm/src/markdown.js +307 -0
  335. package/esm/src/openai_compat.d.ts +63 -0
  336. package/esm/src/openai_compat.d.ts.map +1 -0
  337. package/esm/src/openai_compat.js +272 -0
  338. package/esm/src/providers/openrouter.d.ts +8 -0
  339. package/esm/src/providers/openrouter.d.ts.map +1 -0
  340. package/esm/src/providers/openrouter.js +168 -0
  341. package/esm/src/render.d.ts +51 -0
  342. package/esm/src/render.d.ts.map +1 -0
  343. package/esm/src/render.js +188 -0
  344. package/esm/src/runtime.d.ts +35 -0
  345. package/esm/src/runtime.d.ts.map +1 -0
  346. package/esm/src/runtime.js +1368 -0
  347. package/esm/src/schema.d.ts +8 -0
  348. package/esm/src/schema.d.ts.map +1 -0
  349. package/esm/src/schema.js +45 -0
  350. package/esm/src/state.d.ts +34 -0
  351. package/esm/src/state.d.ts.map +1 -0
  352. package/esm/src/state.js +22 -0
  353. package/esm/src/types.d.ts +318 -0
  354. package/esm/src/types.d.ts.map +1 -0
  355. package/esm/src/types.js +1 -0
  356. package/package.json +32 -0
  357. package/script/_dnt.polyfills.d.ts +12 -0
  358. package/script/_dnt.polyfills.d.ts.map +1 -0
  359. package/script/_dnt.polyfills.js +16 -0
  360. package/script/_dnt.shims.d.ts +6 -0
  361. package/script/_dnt.shims.d.ts.map +1 -0
  362. package/script/_dnt.shims.js +65 -0
  363. package/script/deps/jsr.io/@std/collections/1.1.3/_utils.d.ts +6 -0
  364. package/script/deps/jsr.io/@std/collections/1.1.3/_utils.d.ts.map +1 -0
  365. package/script/deps/jsr.io/@std/collections/1.1.3/_utils.js +21 -0
  366. package/script/deps/jsr.io/@std/collections/1.1.3/deep_merge.d.ts +322 -0
  367. package/script/deps/jsr.io/@std/collections/1.1.3/deep_merge.d.ts.map +1 -0
  368. package/script/deps/jsr.io/@std/collections/1.1.3/deep_merge.js +98 -0
  369. package/script/deps/jsr.io/@std/front-matter/1.0.9/_formats.d.ts +11 -0
  370. package/script/deps/jsr.io/@std/front-matter/1.0.9/_formats.d.ts.map +1 -0
  371. package/script/deps/jsr.io/@std/front-matter/1.0.9/_formats.js +31 -0
  372. package/script/deps/jsr.io/@std/front-matter/1.0.9/_shared.d.ts +5 -0
  373. package/script/deps/jsr.io/@std/front-matter/1.0.9/_shared.d.ts.map +1 -0
  374. package/script/deps/jsr.io/@std/front-matter/1.0.9/_shared.js +11 -0
  375. package/script/deps/jsr.io/@std/front-matter/1.0.9/any.d.ts +32 -0
  376. package/script/deps/jsr.io/@std/front-matter/1.0.9/any.d.ts.map +1 -0
  377. package/script/deps/jsr.io/@std/front-matter/1.0.9/any.js +51 -0
  378. package/script/deps/jsr.io/@std/front-matter/1.0.9/json.d.ts +30 -0
  379. package/script/deps/jsr.io/@std/front-matter/1.0.9/json.d.ts.map +1 -0
  380. package/script/deps/jsr.io/@std/front-matter/1.0.9/json.js +38 -0
  381. package/script/deps/jsr.io/@std/front-matter/1.0.9/toml.d.ts +30 -0
  382. package/script/deps/jsr.io/@std/front-matter/1.0.9/toml.d.ts.map +1 -0
  383. package/script/deps/jsr.io/@std/front-matter/1.0.9/toml.js +39 -0
  384. package/script/deps/jsr.io/@std/front-matter/1.0.9/types.d.ts +7 -0
  385. package/script/deps/jsr.io/@std/front-matter/1.0.9/types.d.ts.map +1 -0
  386. package/script/deps/jsr.io/@std/front-matter/1.0.9/types.js +4 -0
  387. package/script/deps/jsr.io/@std/front-matter/1.0.9/yaml.d.ts +33 -0
  388. package/script/deps/jsr.io/@std/front-matter/1.0.9/yaml.d.ts.map +1 -0
  389. package/script/deps/jsr.io/@std/front-matter/1.0.9/yaml.js +42 -0
  390. package/script/deps/jsr.io/@std/internal/1.0.12/_os.d.ts +2 -0
  391. package/script/deps/jsr.io/@std/internal/1.0.12/_os.d.ts.map +1 -0
  392. package/script/deps/jsr.io/@std/internal/1.0.12/_os.js +38 -0
  393. package/script/deps/jsr.io/@std/internal/1.0.12/os.d.ts +3 -0
  394. package/script/deps/jsr.io/@std/internal/1.0.12/os.d.ts.map +1 -0
  395. package/script/deps/jsr.io/@std/internal/1.0.12/os.js +8 -0
  396. package/script/deps/jsr.io/@std/path/1.1.4/_common/assert_path.d.ts +2 -0
  397. package/script/deps/jsr.io/@std/path/1.1.4/_common/assert_path.d.ts.map +1 -0
  398. package/script/deps/jsr.io/@std/path/1.1.4/_common/assert_path.js +10 -0
  399. package/script/deps/jsr.io/@std/path/1.1.4/_common/basename.d.ts +4 -0
  400. package/script/deps/jsr.io/@std/path/1.1.4/_common/basename.d.ts.map +1 -0
  401. package/script/deps/jsr.io/@std/path/1.1.4/_common/basename.js +45 -0
  402. package/script/deps/jsr.io/@std/path/1.1.4/_common/common.d.ts +2 -0
  403. package/script/deps/jsr.io/@std/path/1.1.4/_common/common.d.ts.map +1 -0
  404. package/script/deps/jsr.io/@std/path/1.1.4/_common/common.js +26 -0
  405. package/script/deps/jsr.io/@std/path/1.1.4/_common/constants.d.ts +40 -0
  406. package/script/deps/jsr.io/@std/path/1.1.4/_common/constants.d.ts.map +1 -0
  407. package/script/deps/jsr.io/@std/path/1.1.4/_common/constants.js +49 -0
  408. package/script/deps/jsr.io/@std/path/1.1.4/_common/dirname.d.ts +2 -0
  409. package/script/deps/jsr.io/@std/path/1.1.4/_common/dirname.d.ts.map +1 -0
  410. package/script/deps/jsr.io/@std/path/1.1.4/_common/dirname.js +11 -0
  411. package/script/deps/jsr.io/@std/path/1.1.4/_common/format.d.ts +4 -0
  412. package/script/deps/jsr.io/@std/path/1.1.4/_common/format.d.ts.map +1 -0
  413. package/script/deps/jsr.io/@std/path/1.1.4/_common/format.js +23 -0
  414. package/script/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.d.ts +2 -0
  415. package/script/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.d.ts.map +1 -0
  416. package/script/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.js +12 -0
  417. package/script/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.d.ts +35 -0
  418. package/script/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.d.ts.map +1 -0
  419. package/script/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.js +238 -0
  420. package/script/deps/jsr.io/@std/path/1.1.4/_common/normalize.d.ts +2 -0
  421. package/script/deps/jsr.io/@std/path/1.1.4/_common/normalize.d.ts.map +1 -0
  422. package/script/deps/jsr.io/@std/path/1.1.4/_common/normalize.js +11 -0
  423. package/script/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.d.ts +2 -0
  424. package/script/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.d.ts.map +1 -0
  425. package/script/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.js +80 -0
  426. package/script/deps/jsr.io/@std/path/1.1.4/_common/relative.d.ts +2 -0
  427. package/script/deps/jsr.io/@std/path/1.1.4/_common/relative.d.ts.map +1 -0
  428. package/script/deps/jsr.io/@std/path/1.1.4/_common/relative.js +12 -0
  429. package/script/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.d.ts +2 -0
  430. package/script/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.d.ts.map +1 -0
  431. package/script/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.js +22 -0
  432. package/script/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.d.ts +2 -0
  433. package/script/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.d.ts.map +1 -0
  434. package/script/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.js +18 -0
  435. package/script/deps/jsr.io/@std/path/1.1.4/basename.d.ts +27 -0
  436. package/script/deps/jsr.io/@std/path/1.1.4/basename.d.ts.map +1 -0
  437. package/script/deps/jsr.io/@std/path/1.1.4/basename.js +38 -0
  438. package/script/deps/jsr.io/@std/path/1.1.4/common.d.ts +28 -0
  439. package/script/deps/jsr.io/@std/path/1.1.4/common.d.ts.map +1 -0
  440. package/script/deps/jsr.io/@std/path/1.1.4/common.js +36 -0
  441. package/script/deps/jsr.io/@std/path/1.1.4/constants.d.ts +15 -0
  442. package/script/deps/jsr.io/@std/path/1.1.4/constants.d.ts.map +1 -0
  443. package/script/deps/jsr.io/@std/path/1.1.4/constants.js +20 -0
  444. package/script/deps/jsr.io/@std/path/1.1.4/dirname.d.ts +22 -0
  445. package/script/deps/jsr.io/@std/path/1.1.4/dirname.d.ts.map +1 -0
  446. package/script/deps/jsr.io/@std/path/1.1.4/dirname.js +31 -0
  447. package/script/deps/jsr.io/@std/path/1.1.4/extname.d.ts +22 -0
  448. package/script/deps/jsr.io/@std/path/1.1.4/extname.d.ts.map +1 -0
  449. package/script/deps/jsr.io/@std/path/1.1.4/extname.js +31 -0
  450. package/script/deps/jsr.io/@std/path/1.1.4/format.d.ts +22 -0
  451. package/script/deps/jsr.io/@std/path/1.1.4/format.d.ts.map +1 -0
  452. package/script/deps/jsr.io/@std/path/1.1.4/format.js +30 -0
  453. package/script/deps/jsr.io/@std/path/1.1.4/from_file_url.d.ts +22 -0
  454. package/script/deps/jsr.io/@std/path/1.1.4/from_file_url.d.ts.map +1 -0
  455. package/script/deps/jsr.io/@std/path/1.1.4/from_file_url.js +31 -0
  456. package/script/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.d.ts +77 -0
  457. package/script/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.d.ts.map +1 -0
  458. package/script/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.js +86 -0
  459. package/script/deps/jsr.io/@std/path/1.1.4/is_absolute.d.ts +22 -0
  460. package/script/deps/jsr.io/@std/path/1.1.4/is_absolute.d.ts.map +1 -0
  461. package/script/deps/jsr.io/@std/path/1.1.4/is_absolute.js +31 -0
  462. package/script/deps/jsr.io/@std/path/1.1.4/is_glob.d.ts +17 -0
  463. package/script/deps/jsr.io/@std/path/1.1.4/is_glob.d.ts.map +1 -0
  464. package/script/deps/jsr.io/@std/path/1.1.4/is_glob.js +45 -0
  465. package/script/deps/jsr.io/@std/path/1.1.4/join.d.ts +23 -0
  466. package/script/deps/jsr.io/@std/path/1.1.4/join.d.ts.map +1 -0
  467. package/script/deps/jsr.io/@std/path/1.1.4/join.js +32 -0
  468. package/script/deps/jsr.io/@std/path/1.1.4/join_globs.d.ts +28 -0
  469. package/script/deps/jsr.io/@std/path/1.1.4/join_globs.d.ts.map +1 -0
  470. package/script/deps/jsr.io/@std/path/1.1.4/join_globs.js +37 -0
  471. package/script/deps/jsr.io/@std/path/1.1.4/mod.d.ts +213 -0
  472. package/script/deps/jsr.io/@std/path/1.1.4/mod.d.ts.map +1 -0
  473. package/script/deps/jsr.io/@std/path/1.1.4/mod.js +232 -0
  474. package/script/deps/jsr.io/@std/path/1.1.4/normalize.d.ts +26 -0
  475. package/script/deps/jsr.io/@std/path/1.1.4/normalize.d.ts.map +1 -0
  476. package/script/deps/jsr.io/@std/path/1.1.4/normalize.js +35 -0
  477. package/script/deps/jsr.io/@std/path/1.1.4/normalize_glob.d.ts +29 -0
  478. package/script/deps/jsr.io/@std/path/1.1.4/normalize_glob.d.ts.map +1 -0
  479. package/script/deps/jsr.io/@std/path/1.1.4/normalize_glob.js +38 -0
  480. package/script/deps/jsr.io/@std/path/1.1.4/parse.d.ts +35 -0
  481. package/script/deps/jsr.io/@std/path/1.1.4/parse.d.ts.map +1 -0
  482. package/script/deps/jsr.io/@std/path/1.1.4/parse.js +42 -0
  483. package/script/deps/jsr.io/@std/path/1.1.4/posix/_util.d.ts +2 -0
  484. package/script/deps/jsr.io/@std/path/1.1.4/posix/_util.d.ts.map +1 -0
  485. package/script/deps/jsr.io/@std/path/1.1.4/posix/_util.js +11 -0
  486. package/script/deps/jsr.io/@std/path/1.1.4/posix/basename.d.ts +39 -0
  487. package/script/deps/jsr.io/@std/path/1.1.4/posix/basename.d.ts.map +1 -0
  488. package/script/deps/jsr.io/@std/path/1.1.4/posix/basename.js +55 -0
  489. package/script/deps/jsr.io/@std/path/1.1.4/posix/constants.d.ts +13 -0
  490. package/script/deps/jsr.io/@std/path/1.1.4/posix/constants.d.ts.map +1 -0
  491. package/script/deps/jsr.io/@std/path/1.1.4/posix/constants.js +17 -0
  492. package/script/deps/jsr.io/@std/path/1.1.4/posix/dirname.d.ts +30 -0
  493. package/script/deps/jsr.io/@std/path/1.1.4/posix/dirname.d.ts.map +1 -0
  494. package/script/deps/jsr.io/@std/path/1.1.4/posix/dirname.js +67 -0
  495. package/script/deps/jsr.io/@std/path/1.1.4/posix/extname.d.ts +37 -0
  496. package/script/deps/jsr.io/@std/path/1.1.4/posix/extname.d.ts.map +1 -0
  497. package/script/deps/jsr.io/@std/path/1.1.4/posix/extname.js +96 -0
  498. package/script/deps/jsr.io/@std/path/1.1.4/posix/format.d.ts +24 -0
  499. package/script/deps/jsr.io/@std/path/1.1.4/posix/format.d.ts.map +1 -0
  500. package/script/deps/jsr.io/@std/path/1.1.4/posix/format.js +31 -0
  501. package/script/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.d.ts +16 -0
  502. package/script/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.d.ts.map +1 -0
  503. package/script/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.js +24 -0
  504. package/script/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.d.ts +72 -0
  505. package/script/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.d.ts.map +1 -0
  506. package/script/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.js +85 -0
  507. package/script/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.d.ts +17 -0
  508. package/script/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.d.ts.map +1 -0
  509. package/script/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.js +26 -0
  510. package/script/deps/jsr.io/@std/path/1.1.4/posix/join.d.ts +31 -0
  511. package/script/deps/jsr.io/@std/path/1.1.4/posix/join.d.ts.map +1 -0
  512. package/script/deps/jsr.io/@std/path/1.1.4/posix/join.js +48 -0
  513. package/script/deps/jsr.io/@std/path/1.1.4/posix/join_globs.d.ts +20 -0
  514. package/script/deps/jsr.io/@std/path/1.1.4/posix/join_globs.d.ts.map +1 -0
  515. package/script/deps/jsr.io/@std/path/1.1.4/posix/join_globs.js +43 -0
  516. package/script/deps/jsr.io/@std/path/1.1.4/posix/normalize.d.ts +37 -0
  517. package/script/deps/jsr.io/@std/path/1.1.4/posix/normalize.d.ts.map +1 -0
  518. package/script/deps/jsr.io/@std/path/1.1.4/posix/normalize.js +61 -0
  519. package/script/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.d.ts +20 -0
  520. package/script/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.d.ts.map +1 -0
  521. package/script/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.js +35 -0
  522. package/script/deps/jsr.io/@std/path/1.1.4/posix/parse.d.ts +25 -0
  523. package/script/deps/jsr.io/@std/path/1.1.4/posix/parse.d.ts.map +1 -0
  524. package/script/deps/jsr.io/@std/path/1.1.4/posix/parse.js +118 -0
  525. package/script/deps/jsr.io/@std/path/1.1.4/posix/relative.d.ts +20 -0
  526. package/script/deps/jsr.io/@std/path/1.1.4/posix/relative.d.ts.map +1 -0
  527. package/script/deps/jsr.io/@std/path/1.1.4/posix/relative.js +109 -0
  528. package/script/deps/jsr.io/@std/path/1.1.4/posix/resolve.d.ts +17 -0
  529. package/script/deps/jsr.io/@std/path/1.1.4/posix/resolve.d.ts.map +1 -0
  530. package/script/deps/jsr.io/@std/path/1.1.4/posix/resolve.js +85 -0
  531. package/script/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.d.ts +17 -0
  532. package/script/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.d.ts.map +1 -0
  533. package/script/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.js +30 -0
  534. package/script/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.d.ts +16 -0
  535. package/script/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.d.ts.map +1 -0
  536. package/script/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.js +23 -0
  537. package/script/deps/jsr.io/@std/path/1.1.4/relative.d.ts +24 -0
  538. package/script/deps/jsr.io/@std/path/1.1.4/relative.d.ts.map +1 -0
  539. package/script/deps/jsr.io/@std/path/1.1.4/relative.js +33 -0
  540. package/script/deps/jsr.io/@std/path/1.1.4/resolve.d.ts +22 -0
  541. package/script/deps/jsr.io/@std/path/1.1.4/resolve.d.ts.map +1 -0
  542. package/script/deps/jsr.io/@std/path/1.1.4/resolve.js +33 -0
  543. package/script/deps/jsr.io/@std/path/1.1.4/to_file_url.d.ts +22 -0
  544. package/script/deps/jsr.io/@std/path/1.1.4/to_file_url.d.ts.map +1 -0
  545. package/script/deps/jsr.io/@std/path/1.1.4/to_file_url.js +31 -0
  546. package/script/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.d.ts +21 -0
  547. package/script/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.d.ts.map +1 -0
  548. package/script/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.js +32 -0
  549. package/script/deps/jsr.io/@std/path/1.1.4/types.d.ts +38 -0
  550. package/script/deps/jsr.io/@std/path/1.1.4/types.d.ts.map +1 -0
  551. package/script/deps/jsr.io/@std/path/1.1.4/types.js +4 -0
  552. package/script/deps/jsr.io/@std/path/1.1.4/windows/_util.d.ts +4 -0
  553. package/script/deps/jsr.io/@std/path/1.1.4/windows/_util.d.ts.map +1 -0
  554. package/script/deps/jsr.io/@std/path/1.1.4/windows/_util.js +20 -0
  555. package/script/deps/jsr.io/@std/path/1.1.4/windows/basename.d.ts +22 -0
  556. package/script/deps/jsr.io/@std/path/1.1.4/windows/basename.d.ts.map +1 -0
  557. package/script/deps/jsr.io/@std/path/1.1.4/windows/basename.js +50 -0
  558. package/script/deps/jsr.io/@std/path/1.1.4/windows/constants.d.ts +13 -0
  559. package/script/deps/jsr.io/@std/path/1.1.4/windows/constants.d.ts.map +1 -0
  560. package/script/deps/jsr.io/@std/path/1.1.4/windows/constants.js +17 -0
  561. package/script/deps/jsr.io/@std/path/1.1.4/windows/dirname.d.ts +17 -0
  562. package/script/deps/jsr.io/@std/path/1.1.4/windows/dirname.d.ts.map +1 -0
  563. package/script/deps/jsr.io/@std/path/1.1.4/windows/dirname.js +116 -0
  564. package/script/deps/jsr.io/@std/path/1.1.4/windows/extname.d.ts +17 -0
  565. package/script/deps/jsr.io/@std/path/1.1.4/windows/extname.d.ts.map +1 -0
  566. package/script/deps/jsr.io/@std/path/1.1.4/windows/extname.js +85 -0
  567. package/script/deps/jsr.io/@std/path/1.1.4/windows/format.d.ts +24 -0
  568. package/script/deps/jsr.io/@std/path/1.1.4/windows/format.d.ts.map +1 -0
  569. package/script/deps/jsr.io/@std/path/1.1.4/windows/format.js +31 -0
  570. package/script/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.d.ts +18 -0
  571. package/script/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.d.ts.map +1 -0
  572. package/script/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.js +33 -0
  573. package/script/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.d.ts +71 -0
  574. package/script/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.d.ts.map +1 -0
  575. package/script/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.js +85 -0
  576. package/script/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.d.ts +17 -0
  577. package/script/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.d.ts.map +1 -0
  578. package/script/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.js +41 -0
  579. package/script/deps/jsr.io/@std/path/1.1.4/windows/join.d.ts +18 -0
  580. package/script/deps/jsr.io/@std/path/1.1.4/windows/join.d.ts.map +1 -0
  581. package/script/deps/jsr.io/@std/path/1.1.4/windows/join.js +80 -0
  582. package/script/deps/jsr.io/@std/path/1.1.4/windows/join_globs.d.ts +21 -0
  583. package/script/deps/jsr.io/@std/path/1.1.4/windows/join_globs.d.ts.map +1 -0
  584. package/script/deps/jsr.io/@std/path/1.1.4/windows/join_globs.js +44 -0
  585. package/script/deps/jsr.io/@std/path/1.1.4/windows/normalize.d.ts +19 -0
  586. package/script/deps/jsr.io/@std/path/1.1.4/windows/normalize.d.ts.map +1 -0
  587. package/script/deps/jsr.io/@std/path/1.1.4/windows/normalize.js +138 -0
  588. package/script/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.d.ts +20 -0
  589. package/script/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.d.ts.map +1 -0
  590. package/script/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.js +35 -0
  591. package/script/deps/jsr.io/@std/path/1.1.4/windows/parse.d.ts +25 -0
  592. package/script/deps/jsr.io/@std/path/1.1.4/windows/parse.d.ts.map +1 -0
  593. package/script/deps/jsr.io/@std/path/1.1.4/windows/parse.js +179 -0
  594. package/script/deps/jsr.io/@std/path/1.1.4/windows/relative.d.ts +23 -0
  595. package/script/deps/jsr.io/@std/path/1.1.4/windows/relative.d.ts.map +1 -0
  596. package/script/deps/jsr.io/@std/path/1.1.4/windows/relative.js +134 -0
  597. package/script/deps/jsr.io/@std/path/1.1.4/windows/resolve.d.ts +17 -0
  598. package/script/deps/jsr.io/@std/path/1.1.4/windows/resolve.d.ts.map +1 -0
  599. package/script/deps/jsr.io/@std/path/1.1.4/windows/resolve.js +180 -0
  600. package/script/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.d.ts +17 -0
  601. package/script/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.d.ts.map +1 -0
  602. package/script/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.js +37 -0
  603. package/script/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.d.ts +17 -0
  604. package/script/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.d.ts.map +1 -0
  605. package/script/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.js +52 -0
  606. package/script/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts +93 -0
  607. package/script/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts.map +1 -0
  608. package/script/deps/jsr.io/@std/toml/1.0.11/_parser.js +781 -0
  609. package/script/deps/jsr.io/@std/toml/1.0.11/parse.d.ts +21 -0
  610. package/script/deps/jsr.io/@std/toml/1.0.11/parse.d.ts.map +1 -0
  611. package/script/deps/jsr.io/@std/toml/1.0.11/parse.js +28 -0
  612. package/script/deps/jsr.io/@std/yaml/1.0.10/_chars.d.ts +33 -0
  613. package/script/deps/jsr.io/@std/yaml/1.0.10/_chars.d.ts.map +1 -0
  614. package/script/deps/jsr.io/@std/yaml/1.0.10/_chars.js +55 -0
  615. package/script/deps/jsr.io/@std/yaml/1.0.10/_loader_state.d.ts +66 -0
  616. package/script/deps/jsr.io/@std/yaml/1.0.10/_loader_state.d.ts.map +1 -0
  617. package/script/deps/jsr.io/@std/yaml/1.0.10/_loader_state.js +1431 -0
  618. package/script/deps/jsr.io/@std/yaml/1.0.10/_schema.d.ts +44 -0
  619. package/script/deps/jsr.io/@std/yaml/1.0.10/_schema.d.ts.map +1 -0
  620. package/script/deps/jsr.io/@std/yaml/1.0.10/_schema.js +121 -0
  621. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/binary.d.ts +3 -0
  622. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/binary.d.ts.map +1 -0
  623. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/binary.js +106 -0
  624. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/bool.d.ts +3 -0
  625. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/bool.d.ts.map +1 -0
  626. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/bool.js +35 -0
  627. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/float.d.ts +3 -0
  628. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/float.d.ts.map +1 -0
  629. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/float.js +99 -0
  630. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/int.d.ts +3 -0
  631. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/int.d.ts.map +1 -0
  632. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/int.js +162 -0
  633. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/map.d.ts +3 -0
  634. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/map.d.ts.map +1 -0
  635. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/map.js +17 -0
  636. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/merge.d.ts +3 -0
  637. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/merge.d.ts.map +1 -0
  638. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/merge.js +13 -0
  639. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/nil.d.ts +3 -0
  640. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/nil.d.ts.map +1 -0
  641. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/nil.js +25 -0
  642. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/omap.d.ts +3 -0
  643. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/omap.d.ts.map +1 -0
  644. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/omap.js +32 -0
  645. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/pairs.d.ts +3 -0
  646. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/pairs.d.ts.map +1 -0
  647. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/pairs.js +22 -0
  648. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/regexp.d.ts +3 -0
  649. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/regexp.d.ts.map +1 -0
  650. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/regexp.js +33 -0
  651. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/seq.d.ts +3 -0
  652. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/seq.d.ts.map +1 -0
  653. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/seq.js +13 -0
  654. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/set.d.ts +3 -0
  655. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/set.d.ts.map +1 -0
  656. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/set.js +17 -0
  657. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/str.d.ts +3 -0
  658. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/str.d.ts.map +1 -0
  659. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/str.js +12 -0
  660. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/timestamp.d.ts +3 -0
  661. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/timestamp.d.ts.map +1 -0
  662. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/timestamp.js +84 -0
  663. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/undefined.d.ts +3 -0
  664. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/undefined.d.ts.map +1 -0
  665. package/script/deps/jsr.io/@std/yaml/1.0.10/_type/undefined.js +23 -0
  666. package/script/deps/jsr.io/@std/yaml/1.0.10/_type.d.ts +32 -0
  667. package/script/deps/jsr.io/@std/yaml/1.0.10/_type.d.ts.map +1 -0
  668. package/script/deps/jsr.io/@std/yaml/1.0.10/_type.js +7 -0
  669. package/script/deps/jsr.io/@std/yaml/1.0.10/_utils.d.ts +4 -0
  670. package/script/deps/jsr.io/@std/yaml/1.0.10/_utils.d.ts.map +1 -0
  671. package/script/deps/jsr.io/@std/yaml/1.0.10/_utils.js +18 -0
  672. package/script/deps/jsr.io/@std/yaml/1.0.10/parse.d.ts +76 -0
  673. package/script/deps/jsr.io/@std/yaml/1.0.10/parse.d.ts.map +1 -0
  674. package/script/deps/jsr.io/@std/yaml/1.0.10/parse.js +97 -0
  675. package/script/mod.d.ts +51 -0
  676. package/script/mod.d.ts.map +1 -0
  677. package/script/mod.js +30 -0
  678. package/script/package.json +3 -0
  679. package/script/src/constants.d.ts +15 -0
  680. package/script/src/constants.d.ts.map +1 -0
  681. package/script/src/constants.js +23 -0
  682. package/script/src/definitions.d.ts +11 -0
  683. package/script/src/definitions.d.ts.map +1 -0
  684. package/script/src/definitions.js +20 -0
  685. package/script/src/loader.d.ts +4 -0
  686. package/script/src/loader.d.ts.map +1 -0
  687. package/script/src/loader.js +206 -0
  688. package/script/src/markdown.d.ts +5 -0
  689. package/script/src/markdown.d.ts.map +1 -0
  690. package/script/src/markdown.js +335 -0
  691. package/script/src/openai_compat.d.ts +63 -0
  692. package/script/src/openai_compat.d.ts.map +1 -0
  693. package/script/src/openai_compat.js +276 -0
  694. package/script/src/providers/openrouter.d.ts +8 -0
  695. package/script/src/providers/openrouter.d.ts.map +1 -0
  696. package/script/src/providers/openrouter.js +197 -0
  697. package/script/src/render.d.ts +51 -0
  698. package/script/src/render.d.ts.map +1 -0
  699. package/script/src/render.js +192 -0
  700. package/script/src/runtime.d.ts +35 -0
  701. package/script/src/runtime.d.ts.map +1 -0
  702. package/script/src/runtime.js +1395 -0
  703. package/script/src/schema.d.ts +8 -0
  704. package/script/src/schema.d.ts.map +1 -0
  705. package/script/src/schema.js +51 -0
  706. package/script/src/state.d.ts +34 -0
  707. package/script/src/state.d.ts.map +1 -0
  708. package/script/src/state.js +49 -0
  709. package/script/src/types.d.ts +318 -0
  710. package/script/src/types.d.ts.map +1 -0
  711. package/script/src/types.js +2 -0
@@ -0,0 +1,1395 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.isGambitEndSignal = isGambitEndSignal;
27
+ exports.runDeck = runDeck;
28
+ const path = __importStar(require("../deps/jsr.io/@std/path/1.1.4/mod.js"));
29
+ const constants_js_1 = require("./constants.js");
30
+ const loader_js_1 = require("./loader.js");
31
+ const schema_js_1 = require("./schema.js");
32
+ function isGambitEndSignal(value) {
33
+ return Boolean(value &&
34
+ typeof value === "object" &&
35
+ value.__gambitEnd === true);
36
+ }
37
+ const logger = console;
38
+ function randomId(prefix) {
39
+ const suffix = crypto.randomUUID().replace(/-/g, "").slice(0, 24);
40
+ // Keep IDs short enough for OpenAI/OpenRouter tool_call id limits (~40 chars).
41
+ return `${prefix}-${suffix}`;
42
+ }
43
+ async function runDeck(opts) {
44
+ const guardrails = {
45
+ ...constants_js_1.DEFAULT_GUARDRAILS,
46
+ ...opts.guardrails,
47
+ };
48
+ const depth = opts.depth ?? 0;
49
+ const inferredRoot = opts.isRoot ??
50
+ (!opts.parentActionCallId && depth === 0);
51
+ if (depth >= guardrails.maxDepth) {
52
+ throw new Error(`Max depth ${guardrails.maxDepth} exceeded`);
53
+ }
54
+ const runId = opts.runId ?? opts.state?.runId ?? randomId("run");
55
+ const deck = await (0, loader_js_1.loadDeck)(opts.path);
56
+ const deckGuardrails = deck.guardrails ?? {};
57
+ const effectiveGuardrails = {
58
+ ...guardrails,
59
+ ...deckGuardrails,
60
+ };
61
+ const isRoot = Boolean(inferredRoot);
62
+ ensureSchemaPresence(deck, isRoot);
63
+ const resolvedInput = resolveInput({
64
+ deck,
65
+ input: opts.input,
66
+ state: opts.state,
67
+ isRoot,
68
+ initialUserMessage: opts.initialUserMessage,
69
+ });
70
+ const validatedInput = validateInput(deck, resolvedInput, isRoot, opts.allowRootStringInput ?? false);
71
+ const shouldEmitRun = opts.depth === undefined || opts.depth === 0;
72
+ if (shouldEmitRun) {
73
+ opts.trace?.({
74
+ type: "run.start",
75
+ runId,
76
+ deckPath: deck.path,
77
+ input: validatedInput,
78
+ initialUserMessage: opts
79
+ .initialUserMessage,
80
+ });
81
+ }
82
+ try {
83
+ if (deck.modelParams?.model || deck.modelParams?.temperature !== undefined) {
84
+ return await runLlmDeck({
85
+ deck,
86
+ guardrails: effectiveGuardrails,
87
+ depth,
88
+ runId,
89
+ parentActionCallId: opts.parentActionCallId,
90
+ modelProvider: opts.modelProvider,
91
+ input: validatedInput,
92
+ inputProvided: opts.inputProvided ?? true,
93
+ initialUserMessage: opts.initialUserMessage,
94
+ defaultModel: opts.defaultModel,
95
+ modelOverride: opts.modelOverride,
96
+ trace: opts.trace,
97
+ stream: opts.stream,
98
+ state: opts.state,
99
+ onStateUpdate: opts.onStateUpdate,
100
+ onStreamText: opts.onStreamText,
101
+ });
102
+ }
103
+ if (!deck.executor) {
104
+ throw new Error(`Deck ${deck.path} has no model and no executor (add run or execute to the deck definition)`);
105
+ }
106
+ return await runComputeDeck({
107
+ deck,
108
+ guardrails: effectiveGuardrails,
109
+ depth,
110
+ runId,
111
+ parentActionCallId: opts.parentActionCallId,
112
+ modelProvider: opts.modelProvider,
113
+ input: validatedInput,
114
+ defaultModel: opts.defaultModel,
115
+ modelOverride: opts.modelOverride,
116
+ trace: opts.trace,
117
+ stream: opts.stream,
118
+ onStreamText: opts.onStreamText,
119
+ });
120
+ }
121
+ finally {
122
+ if (shouldEmitRun) {
123
+ opts.trace?.({ type: "run.end", runId });
124
+ }
125
+ }
126
+ }
127
+ function toProviderParams(params) {
128
+ if (!params)
129
+ return undefined;
130
+ const { model: _model, temperature, top_p, frequency_penalty, presence_penalty, max_tokens, } = params;
131
+ const out = {};
132
+ if (temperature !== undefined)
133
+ out.temperature = temperature;
134
+ if (top_p !== undefined)
135
+ out.top_p = top_p;
136
+ if (frequency_penalty !== undefined) {
137
+ out.frequency_penalty = frequency_penalty;
138
+ }
139
+ if (presence_penalty !== undefined)
140
+ out.presence_penalty = presence_penalty;
141
+ if (max_tokens !== undefined)
142
+ out.max_tokens = max_tokens;
143
+ return Object.keys(out).length ? out : undefined;
144
+ }
145
+ function ensureSchemaPresence(deck, isRoot) {
146
+ if (!isRoot) {
147
+ if (!deck.inputSchema || !deck.outputSchema) {
148
+ throw new Error(`Deck ${deck.path} must declare inputSchema and outputSchema (non-root)`);
149
+ }
150
+ (0, schema_js_1.assertZodSchema)(deck.inputSchema, "inputSchema");
151
+ (0, schema_js_1.assertZodSchema)(deck.outputSchema, "outputSchema");
152
+ }
153
+ }
154
+ function resolveInput(args) {
155
+ if (args.input !== undefined)
156
+ return args.input;
157
+ if (!args.isRoot)
158
+ return args.input;
159
+ const persisted = extractInitInput(args.state);
160
+ if (persisted !== undefined)
161
+ return persisted;
162
+ if (args.initialUserMessage !== undefined) {
163
+ const schema = args.deck.inputSchema;
164
+ if (schema?.safeParse) {
165
+ const candidates = [undefined, {}, ""];
166
+ for (const candidate of candidates) {
167
+ try {
168
+ const result = schema.safeParse(candidate);
169
+ if (result?.success)
170
+ return candidate;
171
+ }
172
+ catch {
173
+ // ignore and try next candidate
174
+ }
175
+ }
176
+ }
177
+ return "";
178
+ }
179
+ return args.input;
180
+ }
181
+ function extractInitInput(state) {
182
+ if (!state?.messages)
183
+ return undefined;
184
+ for (let i = state.messages.length - 1; i >= 0; i--) {
185
+ const msg = state.messages[i];
186
+ if (msg.role === "tool" && msg.name === constants_js_1.GAMBIT_TOOL_INIT) {
187
+ const content = msg.content;
188
+ if (typeof content !== "string")
189
+ return undefined;
190
+ try {
191
+ return JSON.parse(content);
192
+ }
193
+ catch {
194
+ return content;
195
+ }
196
+ }
197
+ }
198
+ return undefined;
199
+ }
200
+ function validateInput(deck, input, isRoot, allowRootStringInput) {
201
+ if (deck.inputSchema) {
202
+ if (isRoot && typeof input === "string" && allowRootStringInput) {
203
+ try {
204
+ return (0, schema_js_1.validateWithSchema)(deck.inputSchema, input);
205
+ }
206
+ catch {
207
+ return input;
208
+ }
209
+ }
210
+ return (0, schema_js_1.validateWithSchema)(deck.inputSchema, input);
211
+ }
212
+ if (isRoot) {
213
+ if (input === undefined)
214
+ return "";
215
+ if (typeof input === "string")
216
+ return input;
217
+ return input;
218
+ }
219
+ throw new Error(`Deck ${deck.path} requires inputSchema (non-root)`);
220
+ }
221
+ function validateOutput(deck, output, isRoot) {
222
+ if (deck.outputSchema) {
223
+ return (0, schema_js_1.validateWithSchema)(deck.outputSchema, output);
224
+ }
225
+ if (isRoot) {
226
+ if (typeof output === "string")
227
+ return output;
228
+ return JSON.stringify(output);
229
+ }
230
+ throw new Error(`Deck ${deck.path} requires outputSchema (non-root)`);
231
+ }
232
+ async function runComputeDeck(ctx) {
233
+ const { deck, runId } = ctx;
234
+ const actionCallId = randomId("action");
235
+ const execContext = {
236
+ runId,
237
+ actionCallId,
238
+ parentActionCallId: ctx.parentActionCallId,
239
+ depth: ctx.depth,
240
+ input: ctx.input,
241
+ label: deck.label,
242
+ log: (entry) => {
243
+ if (!ctx.trace)
244
+ return;
245
+ const raw = typeof entry === "string" ? { message: entry } : entry;
246
+ if (!raw)
247
+ return;
248
+ const message = typeof raw.message === "string"
249
+ ? raw.message
250
+ : raw.message !== undefined
251
+ ? String(raw.message)
252
+ : typeof entry === "string"
253
+ ? entry
254
+ : "";
255
+ const title = typeof raw.title === "string" ? raw.title : undefined;
256
+ const body = raw.body ?? raw.message ?? message;
257
+ ctx.trace({
258
+ type: "log",
259
+ runId,
260
+ deckPath: deck.path,
261
+ actionCallId,
262
+ parentActionCallId: ctx.parentActionCallId,
263
+ level: raw.level ?? "info",
264
+ title: title ?? (message || undefined),
265
+ message,
266
+ body,
267
+ meta: raw.meta,
268
+ });
269
+ },
270
+ spawnAndWait: async (opts) => {
271
+ const childPath = path.isAbsolute(opts.path)
272
+ ? opts.path
273
+ : path.resolve(path.dirname(deck.path), opts.path);
274
+ return await runDeck({
275
+ path: childPath,
276
+ input: opts.input,
277
+ modelProvider: ctx.modelProvider,
278
+ isRoot: false,
279
+ guardrails: ctx.guardrails,
280
+ depth: ctx.depth + 1,
281
+ parentActionCallId: actionCallId,
282
+ runId,
283
+ defaultModel: ctx.defaultModel,
284
+ modelOverride: ctx.modelOverride,
285
+ trace: ctx.trace,
286
+ stream: ctx.stream,
287
+ state: ctx.state,
288
+ onStateUpdate: ctx.onStateUpdate,
289
+ onStreamText: ctx.onStreamText,
290
+ initialUserMessage: undefined,
291
+ inputProvided: true,
292
+ });
293
+ },
294
+ fail: (opts) => {
295
+ throw new Error(opts.message);
296
+ },
297
+ return: (payload) => Promise.resolve(payload),
298
+ };
299
+ const raw = await deck.executor(execContext);
300
+ return validateOutput(deck, raw, ctx.depth === 0);
301
+ }
302
+ async function runLlmDeck(ctx) {
303
+ const { deck, guardrails, depth, modelProvider, input, runId, inputProvided, initialUserMessage, } = ctx;
304
+ const actionCallId = randomId("action");
305
+ const start = performance.now();
306
+ const respondEnabled = Boolean(deck.respond);
307
+ const systemPrompt = buildSystemPrompt(deck);
308
+ const refToolCallId = randomId("call");
309
+ const messages = ctx.state?.messages
310
+ ? ctx.state.messages.map(sanitizeMessage)
311
+ : [];
312
+ const resumed = messages.length > 0;
313
+ const sendInit = Boolean(inputProvided) && input !== undefined && !resumed;
314
+ const idleController = createIdleController({
315
+ cfg: deck.handlers?.onIdle,
316
+ deck,
317
+ guardrails,
318
+ depth,
319
+ runId,
320
+ parentActionCallId: ctx.parentActionCallId,
321
+ modelProvider,
322
+ defaultModel: ctx.defaultModel,
323
+ modelOverride: ctx.modelOverride,
324
+ trace: ctx.trace,
325
+ stream: ctx.stream,
326
+ onStreamText: ctx.onStreamText,
327
+ pushMessages: (msgs) => messages.push(...msgs.map(sanitizeMessage)),
328
+ });
329
+ let streamingBuffer = "";
330
+ let streamingCommitted = false;
331
+ const wrappedOnStreamText = (chunk) => {
332
+ if (!chunk)
333
+ return;
334
+ idleController.touch();
335
+ streamingBuffer += chunk;
336
+ ctx.onStreamText?.(chunk);
337
+ };
338
+ if (!resumed) {
339
+ messages.push(sanitizeMessage({ role: "system", content: systemPrompt }));
340
+ if (sendInit) {
341
+ ctx.trace?.({
342
+ type: "tool.call",
343
+ runId,
344
+ actionCallId: refToolCallId,
345
+ name: constants_js_1.GAMBIT_TOOL_INIT,
346
+ args: {},
347
+ parentActionCallId: actionCallId,
348
+ });
349
+ messages.push(sanitizeMessage({
350
+ role: "assistant",
351
+ content: null,
352
+ tool_calls: [{
353
+ id: refToolCallId,
354
+ type: "function",
355
+ function: {
356
+ name: constants_js_1.GAMBIT_TOOL_INIT,
357
+ arguments: "{}",
358
+ },
359
+ }],
360
+ }), sanitizeMessage({
361
+ role: "tool",
362
+ name: constants_js_1.GAMBIT_TOOL_INIT,
363
+ tool_call_id: refToolCallId,
364
+ content: JSON.stringify(input),
365
+ }));
366
+ ctx.trace?.({
367
+ type: "tool.result",
368
+ runId,
369
+ actionCallId: refToolCallId,
370
+ name: constants_js_1.GAMBIT_TOOL_INIT,
371
+ result: input,
372
+ parentActionCallId: actionCallId,
373
+ });
374
+ }
375
+ }
376
+ if (initialUserMessage !== undefined) {
377
+ const userMessage = sanitizeMessage({
378
+ role: "user",
379
+ content: formatInputForUser(initialUserMessage),
380
+ });
381
+ messages.push(userMessage);
382
+ ctx.trace?.({
383
+ type: "message.user",
384
+ runId,
385
+ actionCallId,
386
+ deckPath: deck.path,
387
+ message: userMessage,
388
+ parentActionCallId: ctx.parentActionCallId,
389
+ });
390
+ }
391
+ idleController.touch();
392
+ const tools = await buildToolDefs(deck);
393
+ ctx.trace?.({
394
+ type: "deck.start",
395
+ runId,
396
+ deckPath: deck.path,
397
+ actionCallId,
398
+ parentActionCallId: ctx.parentActionCallId,
399
+ });
400
+ let passes = 0;
401
+ try {
402
+ while (passes < guardrails.maxPasses) {
403
+ passes++;
404
+ if (performance.now() - start > guardrails.timeoutMs) {
405
+ throw new Error("Timeout exceeded");
406
+ }
407
+ streamingBuffer = "";
408
+ streamingCommitted = false;
409
+ const model = ctx.modelOverride ??
410
+ deck.modelParams?.model ??
411
+ ctx.defaultModel ??
412
+ (() => {
413
+ throw new Error(`No model configured for deck ${deck.path} and no --model provided`);
414
+ })();
415
+ const stateMessages = ctx.state?.messages?.length;
416
+ ctx.trace?.({
417
+ type: "model.call",
418
+ runId,
419
+ actionCallId,
420
+ deckPath: deck.path,
421
+ model,
422
+ stream: ctx.stream,
423
+ messageCount: messages.length,
424
+ toolCount: tools.length,
425
+ messages: messages.map(sanitizeMessage),
426
+ tools,
427
+ stateMessages,
428
+ parentActionCallId: ctx.parentActionCallId,
429
+ });
430
+ const result = await modelProvider.chat({
431
+ model,
432
+ messages,
433
+ tools,
434
+ stream: ctx.stream,
435
+ state: ctx.state,
436
+ params: toProviderParams(deck.modelParams),
437
+ onStreamText: (ctx.onStreamText || deck.handlers?.onIdle)
438
+ ? wrappedOnStreamText
439
+ : undefined,
440
+ });
441
+ idleController.touch();
442
+ const message = result.message;
443
+ ctx.trace?.({
444
+ type: "model.result",
445
+ runId,
446
+ actionCallId,
447
+ deckPath: deck.path,
448
+ model,
449
+ finishReason: result.finishReason,
450
+ message: sanitizeMessage(message),
451
+ toolCalls: result.toolCalls,
452
+ stateMessages: result.updatedState?.messages?.length,
453
+ parentActionCallId: ctx.parentActionCallId,
454
+ });
455
+ const computeState = (updated) => {
456
+ const base = updated ??
457
+ { runId, messages: messages.map(sanitizeMessage) };
458
+ const mergedMessages = base.messages && base.messages.length > 0
459
+ ? base.messages.map(sanitizeMessage)
460
+ : messages.map(sanitizeMessage);
461
+ const priorRefs = updated?.messageRefs ?? ctx.state?.messageRefs ?? [];
462
+ const messageRefs = mergedMessages.map((m, idx) => priorRefs[idx] ?? { id: randomId("msg"), role: m.role });
463
+ const feedback = updated?.feedback ?? ctx.state?.feedback;
464
+ const traces = updated?.traces ?? ctx.state?.traces;
465
+ return {
466
+ ...base,
467
+ runId,
468
+ messages: mergedMessages,
469
+ messageRefs,
470
+ feedback,
471
+ traces,
472
+ };
473
+ };
474
+ if (result.toolCalls && result.toolCalls.length > 0) {
475
+ let responded = false;
476
+ let respondValue;
477
+ let endSignal;
478
+ const appendedMessages = [];
479
+ if (!streamingCommitted && streamingBuffer) {
480
+ messages.push(sanitizeMessage({ role: "assistant", content: streamingBuffer }));
481
+ streamingCommitted = true;
482
+ }
483
+ for (const call of result.toolCalls) {
484
+ if (respondEnabled && call.name === constants_js_1.GAMBIT_TOOL_RESPOND) {
485
+ const status = typeof call.args?.status === "number"
486
+ ? call.args.status
487
+ : undefined;
488
+ const message = typeof call.args?.message === "string"
489
+ ? call.args.message
490
+ : undefined;
491
+ const code = typeof call.args?.code === "string"
492
+ ? call.args.code
493
+ : undefined;
494
+ const meta = (call.args?.meta &&
495
+ typeof call.args.meta === "object" &&
496
+ call.args.meta !== null)
497
+ ? call.args.meta
498
+ : undefined;
499
+ const rawPayload = call.args?.payload ?? call.args;
500
+ const validatedPayload = validateOutput(deck, rawPayload, depth === 0);
501
+ const respondEnvelope = {
502
+ payload: validatedPayload,
503
+ };
504
+ if (status !== undefined)
505
+ respondEnvelope.status = status;
506
+ if (message !== undefined)
507
+ respondEnvelope.message = message;
508
+ if (code !== undefined)
509
+ respondEnvelope.code = code;
510
+ if (meta !== undefined)
511
+ respondEnvelope.meta = meta;
512
+ ctx.trace?.({
513
+ type: "tool.call",
514
+ runId,
515
+ actionCallId: call.id,
516
+ name: call.name,
517
+ args: call.args,
518
+ parentActionCallId: actionCallId,
519
+ });
520
+ const toolContent = JSON.stringify(call.args ?? {});
521
+ appendedMessages.push({
522
+ role: "assistant",
523
+ content: null,
524
+ tool_calls: [{
525
+ id: call.id,
526
+ type: "function",
527
+ function: {
528
+ name: call.name,
529
+ arguments: JSON.stringify(call.args ?? {}),
530
+ },
531
+ }],
532
+ });
533
+ appendedMessages.push({
534
+ role: "tool",
535
+ tool_call_id: call.id,
536
+ name: call.name,
537
+ content: toolContent,
538
+ });
539
+ respondValue = respondEnvelope;
540
+ responded = true;
541
+ ctx.trace?.({
542
+ type: "tool.result",
543
+ runId,
544
+ actionCallId: call.id,
545
+ name: call.name,
546
+ result: respondEnvelope,
547
+ parentActionCallId: actionCallId,
548
+ });
549
+ continue;
550
+ }
551
+ if (deck.allowEnd && call.name === constants_js_1.GAMBIT_TOOL_END) {
552
+ const status = typeof call.args?.status === "number"
553
+ ? call.args.status
554
+ : undefined;
555
+ const messageText = typeof call.args?.message === "string"
556
+ ? call.args.message
557
+ : undefined;
558
+ const code = typeof call.args?.code === "string"
559
+ ? call.args.code
560
+ : undefined;
561
+ const meta = (call.args?.meta &&
562
+ typeof call.args.meta === "object" &&
563
+ call.args.meta !== null)
564
+ ? call.args.meta
565
+ : undefined;
566
+ const payload = call.args?.payload;
567
+ ctx.trace?.({
568
+ type: "tool.call",
569
+ runId,
570
+ actionCallId: call.id,
571
+ name: call.name,
572
+ args: call.args,
573
+ parentActionCallId: actionCallId,
574
+ });
575
+ const toolContent = JSON.stringify(call.args ?? {});
576
+ appendedMessages.push({
577
+ role: "assistant",
578
+ content: null,
579
+ tool_calls: [{
580
+ id: call.id,
581
+ type: "function",
582
+ function: {
583
+ name: call.name,
584
+ arguments: JSON.stringify(call.args ?? {}),
585
+ },
586
+ }],
587
+ });
588
+ appendedMessages.push({
589
+ role: "tool",
590
+ tool_call_id: call.id,
591
+ name: call.name,
592
+ content: toolContent,
593
+ });
594
+ const signal = { __gambitEnd: true };
595
+ if (status !== undefined)
596
+ signal.status = status;
597
+ if (messageText !== undefined)
598
+ signal.message = messageText;
599
+ if (code !== undefined)
600
+ signal.code = code;
601
+ if (meta !== undefined)
602
+ signal.meta = meta;
603
+ if (payload !== undefined)
604
+ signal.payload = payload;
605
+ endSignal = signal;
606
+ ctx.trace?.({
607
+ type: "tool.result",
608
+ runId,
609
+ actionCallId: call.id,
610
+ name: call.name,
611
+ result: signal,
612
+ parentActionCallId: actionCallId,
613
+ });
614
+ continue;
615
+ }
616
+ ctx.trace?.({
617
+ type: "action.start",
618
+ runId,
619
+ actionCallId: call.id,
620
+ name: call.name,
621
+ path: call.name,
622
+ parentActionCallId: actionCallId,
623
+ });
624
+ ctx.trace?.({
625
+ type: "tool.call",
626
+ runId,
627
+ actionCallId: call.id,
628
+ name: call.name,
629
+ args: call.args,
630
+ parentActionCallId: actionCallId,
631
+ });
632
+ const toolResult = await handleToolCall(call, {
633
+ parentDeck: deck,
634
+ modelProvider,
635
+ guardrails,
636
+ depth,
637
+ runId,
638
+ parentActionCallId: actionCallId,
639
+ defaultModel: ctx.defaultModel,
640
+ modelOverride: ctx.modelOverride,
641
+ trace: ctx.trace,
642
+ onStreamText: (ctx.onStreamText || deck.handlers?.onIdle)
643
+ ? wrappedOnStreamText
644
+ : undefined,
645
+ runStartedAt: start,
646
+ inputProvided: true,
647
+ idle: idleController,
648
+ });
649
+ ctx.trace?.({
650
+ type: "tool.result",
651
+ runId,
652
+ actionCallId: call.id,
653
+ name: call.name,
654
+ result: toolResult.toolContent,
655
+ parentActionCallId: actionCallId,
656
+ });
657
+ appendedMessages.push({
658
+ role: "assistant",
659
+ content: null,
660
+ tool_calls: [{
661
+ id: call.id,
662
+ type: "function",
663
+ function: {
664
+ name: call.name,
665
+ arguments: JSON.stringify(call.args),
666
+ },
667
+ }],
668
+ });
669
+ appendedMessages.push({
670
+ role: "tool",
671
+ tool_call_id: call.id,
672
+ name: call.name,
673
+ content: toolResult.toolContent,
674
+ });
675
+ if (toolResult.extraMessages?.length) {
676
+ appendedMessages.push(...toolResult.extraMessages);
677
+ }
678
+ ctx.trace?.({
679
+ type: "action.end",
680
+ runId,
681
+ actionCallId: call.id,
682
+ name: call.name,
683
+ path: call.name,
684
+ parentActionCallId: actionCallId,
685
+ });
686
+ }
687
+ if (appendedMessages.length) {
688
+ messages.push(...appendedMessages.map(sanitizeMessage));
689
+ idleController.touch();
690
+ }
691
+ if (ctx.onStateUpdate) {
692
+ const state = computeState(result.updatedState);
693
+ ctx.onStateUpdate(state);
694
+ }
695
+ if (endSignal) {
696
+ ctx.trace?.({
697
+ type: "deck.end",
698
+ runId,
699
+ deckPath: deck.path,
700
+ actionCallId,
701
+ parentActionCallId: ctx.parentActionCallId,
702
+ });
703
+ return endSignal;
704
+ }
705
+ if (responded) {
706
+ ctx.trace?.({
707
+ type: "deck.end",
708
+ runId,
709
+ deckPath: deck.path,
710
+ actionCallId,
711
+ parentActionCallId: ctx.parentActionCallId,
712
+ });
713
+ return respondValue;
714
+ }
715
+ continue;
716
+ }
717
+ if (result.finishReason === "tool_calls") {
718
+ throw new Error("Model requested tool_calls but provided none");
719
+ }
720
+ if (result.finishReason === "length" &&
721
+ (message.content === null || message.content === undefined)) {
722
+ throw new Error("Model stopped early (length) with no content");
723
+ }
724
+ if (message.content !== null && message.content !== undefined) {
725
+ messages.push(sanitizeMessage(message));
726
+ if (ctx.onStateUpdate) {
727
+ const state = computeState(result.updatedState);
728
+ ctx.onStateUpdate(state);
729
+ }
730
+ if (ctx.parentActionCallId !== undefined &&
731
+ (!result.toolCalls || result.toolCalls.length === 0)) {
732
+ ctx.trace?.({
733
+ type: "monolog",
734
+ runId,
735
+ deckPath: deck.path,
736
+ actionCallId,
737
+ parentActionCallId: ctx.parentActionCallId,
738
+ content: message
739
+ .content,
740
+ });
741
+ }
742
+ if (!respondEnabled) {
743
+ const validated = validateOutput(deck, message.content, depth === 0);
744
+ ctx.trace?.({
745
+ type: "deck.end",
746
+ runId,
747
+ deckPath: deck.path,
748
+ actionCallId,
749
+ parentActionCallId: ctx.parentActionCallId,
750
+ });
751
+ return validated;
752
+ }
753
+ }
754
+ if (respondEnabled && result.finishReason === "stop") {
755
+ continue;
756
+ }
757
+ if (passes >= guardrails.maxPasses) {
758
+ throw new Error("Max passes exceeded without completing");
759
+ }
760
+ }
761
+ }
762
+ finally {
763
+ idleController.stop();
764
+ }
765
+ throw new Error("Model did not complete within guardrails");
766
+ }
767
+ async function handleToolCall(call, ctx) {
768
+ const action = ctx.parentDeck.actionDecks.find((a) => a.name === call.name);
769
+ const source = {
770
+ deckPath: ctx.parentDeck.path,
771
+ actionName: action?.name ?? call.name,
772
+ };
773
+ if (!action) {
774
+ return {
775
+ toolContent: JSON.stringify({
776
+ runId: ctx.runId,
777
+ actionCallId: call.id,
778
+ parentActionCallId: ctx.parentActionCallId,
779
+ source,
780
+ status: 404,
781
+ message: "unknown action",
782
+ }),
783
+ };
784
+ }
785
+ const baseComplete = (payload) => JSON.stringify({
786
+ runId: ctx.runId,
787
+ actionCallId: call.id,
788
+ parentActionCallId: ctx.parentActionCallId,
789
+ source,
790
+ status: payload.status,
791
+ payload: payload.payload,
792
+ message: payload.message,
793
+ code: payload.code,
794
+ meta: payload.meta,
795
+ });
796
+ const extraMessages = [];
797
+ const started = performance.now();
798
+ const busyCfg = ctx.parentDeck.handlers?.onBusy ??
799
+ ctx.parentDeck.handlers?.onInterval;
800
+ const busyDelay = busyCfg?.delayMs ?? constants_js_1.DEFAULT_STATUS_DELAY_MS;
801
+ const busyRepeat = busyCfg?.repeatMs;
802
+ let busyTimer;
803
+ let busyFired = false;
804
+ let busyStopped = false;
805
+ let nextBusyAt = busyCfg?.path ? performance.now() + busyDelay : 0;
806
+ ctx.idle?.pause();
807
+ const childPromise = (async () => {
808
+ try {
809
+ const result = await runDeck({
810
+ path: action.path,
811
+ input: call.args,
812
+ modelProvider: ctx.modelProvider,
813
+ isRoot: false,
814
+ guardrails: ctx.guardrails,
815
+ depth: ctx.depth + 1,
816
+ parentActionCallId: call.id,
817
+ runId: ctx.runId,
818
+ defaultModel: ctx.defaultModel,
819
+ modelOverride: ctx.modelOverride,
820
+ trace: ctx.trace,
821
+ stream: ctx.stream,
822
+ onStreamText: ctx.onStreamText,
823
+ initialUserMessage: undefined,
824
+ });
825
+ return { ok: true, result };
826
+ }
827
+ catch (err) {
828
+ return { ok: false, error: err };
829
+ }
830
+ finally {
831
+ // Keep busy timers alive until the caller explicitly stops them
832
+ }
833
+ })();
834
+ const triggerBusy = async (elapsed) => {
835
+ if (busyStopped)
836
+ return;
837
+ busyFired = true;
838
+ try {
839
+ const envelope = await runBusyHandler({
840
+ parentDeck: ctx.parentDeck,
841
+ action,
842
+ call,
843
+ runId: ctx.runId,
844
+ parentActionCallId: ctx.parentActionCallId,
845
+ handlerPath: busyCfg.path,
846
+ modelProvider: ctx.modelProvider,
847
+ guardrails: ctx.guardrails,
848
+ depth: ctx.depth,
849
+ defaultModel: ctx.defaultModel,
850
+ modelOverride: ctx.modelOverride,
851
+ elapsedMs: elapsed,
852
+ trace: ctx.trace,
853
+ stream: ctx.stream,
854
+ onStreamText: ctx.onStreamText,
855
+ initialUserMessage: undefined,
856
+ });
857
+ if (envelope.length) {
858
+ extraMessages.push(...envelope.map(sanitizeMessage));
859
+ }
860
+ ctx.idle?.touch();
861
+ }
862
+ catch {
863
+ // ignore handler errors
864
+ }
865
+ };
866
+ const scheduleNextBusy = () => {
867
+ if (!busyCfg?.path || busyStopped)
868
+ return;
869
+ const now = performance.now();
870
+ const delay = Math.max(0, nextBusyAt - now);
871
+ busyTimer = setTimeout(async () => {
872
+ if (busyStopped)
873
+ return;
874
+ const elapsed = performance.now() - started;
875
+ await triggerBusy(elapsed);
876
+ if (busyRepeat && busyRepeat > 0) {
877
+ nextBusyAt += busyRepeat;
878
+ scheduleNextBusy();
879
+ }
880
+ }, delay);
881
+ };
882
+ if (busyCfg?.path) {
883
+ scheduleNextBusy();
884
+ }
885
+ const stopBusy = () => {
886
+ busyStopped = true;
887
+ if (busyTimer !== undefined) {
888
+ clearTimeout(busyTimer);
889
+ }
890
+ };
891
+ const childResult = await childPromise;
892
+ ctx.idle?.resume();
893
+ if (!childResult.ok) {
894
+ const handled = await maybeHandleError({
895
+ err: childResult.error,
896
+ call,
897
+ ctx,
898
+ action,
899
+ });
900
+ if (handled) {
901
+ if (handled.extraMessages) {
902
+ extraMessages.push(...handled.extraMessages);
903
+ }
904
+ stopBusy();
905
+ ctx.idle?.touch();
906
+ const content = handled.toolContent;
907
+ return { toolContent: content, extraMessages };
908
+ }
909
+ stopBusy();
910
+ throw childResult.error;
911
+ }
912
+ const normalized = normalizeChildResult(childResult.result);
913
+ const toolContent = baseComplete(normalized);
914
+ if (busyCfg?.path) {
915
+ const elapsedFromAction = performance.now() - started;
916
+ if (!busyFired && elapsedFromAction >= busyDelay) {
917
+ try {
918
+ const envelope = await runBusyHandler({
919
+ parentDeck: ctx.parentDeck,
920
+ action,
921
+ call,
922
+ runId: ctx.runId,
923
+ parentActionCallId: ctx.parentActionCallId,
924
+ handlerPath: busyCfg.path,
925
+ modelProvider: ctx.modelProvider,
926
+ guardrails: ctx.guardrails,
927
+ depth: ctx.depth,
928
+ defaultModel: ctx.defaultModel,
929
+ modelOverride: ctx.modelOverride,
930
+ elapsedMs: elapsedFromAction,
931
+ trace: ctx.trace,
932
+ stream: ctx.stream,
933
+ onStreamText: ctx.onStreamText,
934
+ initialUserMessage: undefined,
935
+ });
936
+ if (envelope.length) {
937
+ extraMessages.push(...envelope.map(sanitizeMessage));
938
+ }
939
+ ctx.idle?.touch();
940
+ }
941
+ catch {
942
+ // ignore handler errors
943
+ }
944
+ }
945
+ }
946
+ const completeEventId = randomId("event");
947
+ extraMessages.push({
948
+ role: "assistant",
949
+ content: null,
950
+ tool_calls: [{
951
+ id: completeEventId,
952
+ type: "function",
953
+ function: {
954
+ name: constants_js_1.GAMBIT_TOOL_COMPLETE,
955
+ arguments: toolContent,
956
+ },
957
+ }],
958
+ }, {
959
+ role: "tool",
960
+ tool_call_id: completeEventId,
961
+ name: constants_js_1.GAMBIT_TOOL_COMPLETE,
962
+ content: toolContent,
963
+ });
964
+ stopBusy();
965
+ ctx.idle?.touch();
966
+ return { toolContent, extraMessages };
967
+ }
968
+ function normalizeChildResult(result) {
969
+ if (result && typeof result === "object") {
970
+ const rec = result;
971
+ const status = typeof rec.status === "number" ? rec.status : undefined;
972
+ const message = typeof rec.message === "string" ? rec.message : undefined;
973
+ const code = typeof rec.code === "string" ? rec.code : undefined;
974
+ const meta = (rec.meta && typeof rec.meta === "object")
975
+ ? rec.meta
976
+ : undefined;
977
+ const payload = rec.payload ?? result;
978
+ return { status, payload, message, code, meta };
979
+ }
980
+ return { payload: result };
981
+ }
982
+ async function runBusyHandler(args) {
983
+ try {
984
+ const input = {
985
+ kind: "busy",
986
+ label: args.action.label ?? args.parentDeck.label,
987
+ source: { deckPath: args.parentDeck.path, actionName: args.action.name },
988
+ trigger: {
989
+ reason: "timeout",
990
+ elapsedMs: Math.floor(args.elapsedMs),
991
+ },
992
+ childInput: args.call.args,
993
+ };
994
+ const handlerOutput = await runDeck({
995
+ path: args.handlerPath,
996
+ input,
997
+ modelProvider: args.modelProvider,
998
+ isRoot: false,
999
+ guardrails: args.guardrails,
1000
+ depth: args.depth + 1,
1001
+ parentActionCallId: args.call.id,
1002
+ runId: args.runId,
1003
+ defaultModel: args.defaultModel,
1004
+ modelOverride: args.modelOverride,
1005
+ trace: args.trace,
1006
+ stream: args.stream,
1007
+ onStreamText: args.onStreamText,
1008
+ initialUserMessage: args.initialUserMessage,
1009
+ inputProvided: true,
1010
+ });
1011
+ const elapsedMs = Math.floor(args.elapsedMs);
1012
+ let message;
1013
+ if (typeof handlerOutput === "string") {
1014
+ message = handlerOutput;
1015
+ }
1016
+ else if (handlerOutput && typeof handlerOutput === "object") {
1017
+ if (typeof handlerOutput.message === "string") {
1018
+ message = handlerOutput.message;
1019
+ }
1020
+ else {
1021
+ message = JSON.stringify(handlerOutput);
1022
+ }
1023
+ }
1024
+ if (!message)
1025
+ return [];
1026
+ if (args.onStreamText) {
1027
+ args.onStreamText(`${message}\n`);
1028
+ }
1029
+ else {
1030
+ logger.log(message);
1031
+ }
1032
+ return [{
1033
+ role: "assistant",
1034
+ content: `${message} (elapsed ${elapsedMs}ms)`,
1035
+ }];
1036
+ }
1037
+ catch {
1038
+ return [];
1039
+ }
1040
+ }
1041
+ function createIdleController(args) {
1042
+ if (!args.cfg?.path) {
1043
+ return {
1044
+ touch: () => { },
1045
+ pause: () => { },
1046
+ resume: () => { },
1047
+ stop: () => { },
1048
+ };
1049
+ }
1050
+ const delayMs = args.cfg.delayMs ?? constants_js_1.DEFAULT_STATUS_DELAY_MS;
1051
+ const repeatMs = args.cfg.repeatMs;
1052
+ let timer;
1053
+ let paused = false;
1054
+ let stopped = false;
1055
+ let lastTouched = performance.now();
1056
+ const clear = () => {
1057
+ if (timer !== undefined)
1058
+ clearTimeout(timer);
1059
+ timer = undefined;
1060
+ };
1061
+ const schedule = () => {
1062
+ if (stopped || paused)
1063
+ return;
1064
+ clear();
1065
+ const now = performance.now();
1066
+ const remaining = Math.max(0, delayMs - (now - lastTouched));
1067
+ timer = setTimeout(async () => {
1068
+ if (stopped || paused)
1069
+ return;
1070
+ const elapsed = performance.now() - lastTouched;
1071
+ try {
1072
+ const envelope = await runIdleHandler({
1073
+ deck: args.deck,
1074
+ handlerPath: args.cfg.path,
1075
+ runId: args.runId,
1076
+ parentActionCallId: args.parentActionCallId,
1077
+ modelProvider: args.modelProvider,
1078
+ guardrails: args.guardrails,
1079
+ depth: args.depth,
1080
+ defaultModel: args.defaultModel,
1081
+ modelOverride: args.modelOverride,
1082
+ elapsedMs: elapsed,
1083
+ trace: args.trace,
1084
+ stream: args.stream,
1085
+ onStreamText: args.onStreamText,
1086
+ });
1087
+ if (envelope.length)
1088
+ args.pushMessages(envelope.map(sanitizeMessage));
1089
+ }
1090
+ catch {
1091
+ // ignore idle handler errors
1092
+ }
1093
+ if (repeatMs && repeatMs > 0) {
1094
+ lastTouched = performance.now();
1095
+ schedule();
1096
+ }
1097
+ }, remaining);
1098
+ };
1099
+ const touch = () => {
1100
+ if (stopped)
1101
+ return;
1102
+ lastTouched = performance.now();
1103
+ schedule();
1104
+ };
1105
+ const pause = () => {
1106
+ paused = true;
1107
+ clear();
1108
+ };
1109
+ const resume = () => {
1110
+ if (stopped)
1111
+ return;
1112
+ if (!paused)
1113
+ return;
1114
+ paused = false;
1115
+ schedule();
1116
+ };
1117
+ const stop = () => {
1118
+ stopped = true;
1119
+ clear();
1120
+ };
1121
+ return { touch, pause, resume, stop };
1122
+ }
1123
+ async function runIdleHandler(args) {
1124
+ try {
1125
+ const input = {
1126
+ kind: "idle",
1127
+ label: args.deck.label,
1128
+ source: { deckPath: args.deck.path },
1129
+ trigger: {
1130
+ reason: "idle_timeout",
1131
+ elapsedMs: Math.floor(args.elapsedMs),
1132
+ },
1133
+ };
1134
+ const handlerOutput = await runDeck({
1135
+ path: args.handlerPath,
1136
+ input,
1137
+ modelProvider: args.modelProvider,
1138
+ isRoot: false,
1139
+ guardrails: args.guardrails,
1140
+ depth: args.depth + 1,
1141
+ parentActionCallId: args.parentActionCallId,
1142
+ runId: args.runId,
1143
+ defaultModel: args.defaultModel,
1144
+ modelOverride: args.modelOverride,
1145
+ trace: args.trace,
1146
+ stream: args.stream,
1147
+ onStreamText: args.onStreamText,
1148
+ initialUserMessage: undefined,
1149
+ inputProvided: true,
1150
+ });
1151
+ const elapsedMs = Math.floor(args.elapsedMs);
1152
+ let message;
1153
+ if (typeof handlerOutput === "string") {
1154
+ message = handlerOutput;
1155
+ }
1156
+ else if (handlerOutput && typeof handlerOutput === "object") {
1157
+ if (typeof handlerOutput.message === "string") {
1158
+ message = handlerOutput.message;
1159
+ }
1160
+ else {
1161
+ message = JSON.stringify(handlerOutput);
1162
+ }
1163
+ }
1164
+ if (!message)
1165
+ return [];
1166
+ if (args.onStreamText) {
1167
+ args.onStreamText(`${message}\n`);
1168
+ }
1169
+ else {
1170
+ logger.log(message);
1171
+ }
1172
+ return [{
1173
+ role: "assistant",
1174
+ content: `${message} (idle for ${elapsedMs}ms)`,
1175
+ }];
1176
+ }
1177
+ catch {
1178
+ return [];
1179
+ }
1180
+ }
1181
+ async function maybeHandleError(args) {
1182
+ const handlerPath = args.ctx.parentDeck.handlers?.onError?.path;
1183
+ if (!handlerPath)
1184
+ return undefined;
1185
+ const message = args.err instanceof Error
1186
+ ? args.err.message
1187
+ : String(args.err);
1188
+ const envelopeInput = {
1189
+ kind: "error",
1190
+ label: args.action.label ?? args.ctx.parentDeck.label,
1191
+ source: {
1192
+ deckPath: args.ctx.parentDeck.path,
1193
+ actionName: args.action.name,
1194
+ },
1195
+ error: { message },
1196
+ childInput: args.call.args,
1197
+ };
1198
+ try {
1199
+ const handlerOutput = await runDeck({
1200
+ path: handlerPath,
1201
+ input: envelopeInput,
1202
+ modelProvider: args.ctx.modelProvider,
1203
+ isRoot: false,
1204
+ guardrails: args.ctx.guardrails,
1205
+ depth: args.ctx.depth + 1,
1206
+ parentActionCallId: args.call.id,
1207
+ runId: args.ctx.runId,
1208
+ defaultModel: args.ctx.defaultModel,
1209
+ modelOverride: args.ctx.modelOverride,
1210
+ trace: args.ctx.trace,
1211
+ stream: args.ctx.stream,
1212
+ onStreamText: args.ctx.onStreamText,
1213
+ initialUserMessage: undefined,
1214
+ inputProvided: true,
1215
+ });
1216
+ const parsed = typeof handlerOutput === "object" && handlerOutput !== null
1217
+ ? handlerOutput
1218
+ : undefined;
1219
+ const status = typeof parsed?.status === "number" ? parsed.status : 500;
1220
+ const code = typeof parsed?.code === "string" ? parsed.code : undefined;
1221
+ const messageOverride = typeof parsed?.message === "string"
1222
+ ? parsed.message
1223
+ : undefined;
1224
+ const meta = (parsed?.meta && typeof parsed.meta === "object")
1225
+ ? parsed.meta
1226
+ : undefined;
1227
+ const payload = parsed?.payload ?? handlerOutput;
1228
+ const content = JSON.stringify({
1229
+ runId: args.ctx.runId,
1230
+ actionCallId: args.call.id,
1231
+ parentActionCallId: args.ctx.parentActionCallId,
1232
+ source: {
1233
+ deckPath: args.ctx.parentDeck.path,
1234
+ actionName: args.action.name,
1235
+ },
1236
+ status,
1237
+ payload,
1238
+ message: messageOverride ?? message,
1239
+ code,
1240
+ meta,
1241
+ });
1242
+ const callId = randomId("event");
1243
+ const extraMessages = [
1244
+ {
1245
+ role: "assistant",
1246
+ content: null,
1247
+ tool_calls: [{
1248
+ id: callId,
1249
+ type: "function",
1250
+ function: {
1251
+ name: constants_js_1.GAMBIT_TOOL_COMPLETE,
1252
+ arguments: content,
1253
+ },
1254
+ }],
1255
+ },
1256
+ {
1257
+ role: "tool",
1258
+ tool_call_id: callId,
1259
+ name: constants_js_1.GAMBIT_TOOL_COMPLETE,
1260
+ content,
1261
+ },
1262
+ ];
1263
+ return { toolContent: content, extraMessages };
1264
+ }
1265
+ catch {
1266
+ // Fallback when the handler itself fails: still return a structured error envelope
1267
+ // so the assistant can continue gracefully.
1268
+ const status = 500;
1269
+ const messageOverride = `Handled error: ${message}`;
1270
+ const code = "HANDLER_FALLBACK";
1271
+ const content = JSON.stringify({
1272
+ runId: args.ctx.runId,
1273
+ actionCallId: args.call.id,
1274
+ parentActionCallId: args.ctx.parentActionCallId,
1275
+ source: {
1276
+ deckPath: args.ctx.parentDeck.path,
1277
+ actionName: args.action.name,
1278
+ },
1279
+ status,
1280
+ payload: envelopeInput,
1281
+ message: messageOverride,
1282
+ code,
1283
+ meta: { handlerFailed: true },
1284
+ });
1285
+ const callId = randomId("event");
1286
+ const extraMessages = [
1287
+ {
1288
+ role: "assistant",
1289
+ content: null,
1290
+ tool_calls: [{
1291
+ id: callId,
1292
+ type: "function",
1293
+ function: {
1294
+ name: constants_js_1.GAMBIT_TOOL_COMPLETE,
1295
+ arguments: content,
1296
+ },
1297
+ }],
1298
+ },
1299
+ {
1300
+ role: "tool",
1301
+ tool_call_id: callId,
1302
+ name: constants_js_1.GAMBIT_TOOL_COMPLETE,
1303
+ content,
1304
+ },
1305
+ ];
1306
+ return { toolContent: content, extraMessages };
1307
+ }
1308
+ }
1309
+ function buildSystemPrompt(deck) {
1310
+ const parts = [];
1311
+ const prompt = deck.body ?? deck.prompt;
1312
+ if (prompt)
1313
+ parts.push(prompt.trim());
1314
+ if (!deck.inlineEmbeds) {
1315
+ for (const card of deck.cards) {
1316
+ if (card.body)
1317
+ parts.push(card.body.trim());
1318
+ }
1319
+ }
1320
+ return parts.join("\n\n").trim();
1321
+ }
1322
+ function formatInputForUser(input) {
1323
+ if (typeof input === "string")
1324
+ return input;
1325
+ try {
1326
+ return JSON.stringify(input, null, 2);
1327
+ }
1328
+ catch {
1329
+ return String(input);
1330
+ }
1331
+ }
1332
+ function sanitizeMessage(msg) {
1333
+ const toolCalls = msg.tool_calls && msg.tool_calls.length > 0
1334
+ ? msg.tool_calls
1335
+ : undefined;
1336
+ return { ...msg, tool_calls: toolCalls };
1337
+ }
1338
+ async function buildToolDefs(deck) {
1339
+ const defs = [];
1340
+ if (deck.allowEnd) {
1341
+ defs.push({
1342
+ type: "function",
1343
+ function: {
1344
+ name: constants_js_1.GAMBIT_TOOL_END,
1345
+ description: "End the current run once all goals are complete.",
1346
+ parameters: {
1347
+ type: "object",
1348
+ properties: {
1349
+ status: { type: "number" },
1350
+ payload: {},
1351
+ message: { type: "string" },
1352
+ code: { type: "string" },
1353
+ meta: { type: "object" },
1354
+ },
1355
+ additionalProperties: true,
1356
+ },
1357
+ },
1358
+ });
1359
+ }
1360
+ if (deck.respond) {
1361
+ defs.push({
1362
+ type: "function",
1363
+ function: {
1364
+ name: constants_js_1.GAMBIT_TOOL_RESPOND,
1365
+ description: "Finish the current deck with a structured response.",
1366
+ parameters: {
1367
+ type: "object",
1368
+ properties: {
1369
+ status: { type: "number" },
1370
+ payload: {},
1371
+ message: { type: "string" },
1372
+ code: { type: "string" },
1373
+ meta: { type: "object" },
1374
+ },
1375
+ additionalProperties: true,
1376
+ },
1377
+ },
1378
+ });
1379
+ }
1380
+ for (const action of deck.actionDecks) {
1381
+ const child = await (0, loader_js_1.loadDeck)(action.path, deck.path);
1382
+ ensureSchemaPresence(child, false);
1383
+ const schema = child.inputSchema;
1384
+ const params = (0, schema_js_1.toJsonSchema)(schema);
1385
+ defs.push({
1386
+ type: "function",
1387
+ function: {
1388
+ name: action.name,
1389
+ description: action.description,
1390
+ parameters: params,
1391
+ },
1392
+ });
1393
+ }
1394
+ return defs;
1395
+ }