@nhtio/adk 0.1.0-master-f0aa531d

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 (297) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +3 -0
  3. package/batteries/index.d.ts +28 -0
  4. package/batteries/llm/index.d.ts +11 -0
  5. package/batteries/llm/openai_chat_completions/adapter.cjs +916 -0
  6. package/batteries/llm/openai_chat_completions/adapter.cjs.map +1 -0
  7. package/batteries/llm/openai_chat_completions/adapter.d.ts +101 -0
  8. package/batteries/llm/openai_chat_completions/adapter.mjs +914 -0
  9. package/batteries/llm/openai_chat_completions/adapter.mjs.map +1 -0
  10. package/batteries/llm/openai_chat_completions/exceptions.cjs +89 -0
  11. package/batteries/llm/openai_chat_completions/exceptions.cjs.map +1 -0
  12. package/batteries/llm/openai_chat_completions/exceptions.d.ts +97 -0
  13. package/batteries/llm/openai_chat_completions/exceptions.mjs +81 -0
  14. package/batteries/llm/openai_chat_completions/exceptions.mjs.map +1 -0
  15. package/batteries/llm/openai_chat_completions/helpers.cjs +819 -0
  16. package/batteries/llm/openai_chat_completions/helpers.cjs.map +1 -0
  17. package/batteries/llm/openai_chat_completions/helpers.d.ts +233 -0
  18. package/batteries/llm/openai_chat_completions/helpers.mjs +783 -0
  19. package/batteries/llm/openai_chat_completions/helpers.mjs.map +1 -0
  20. package/batteries/llm/openai_chat_completions/index.d.ts +27 -0
  21. package/batteries/llm/openai_chat_completions/types.cjs +1 -0
  22. package/batteries/llm/openai_chat_completions/types.d.ts +524 -0
  23. package/batteries/llm/openai_chat_completions/types.mjs +0 -0
  24. package/batteries/llm/openai_chat_completions/validation.cjs +190 -0
  25. package/batteries/llm/openai_chat_completions/validation.cjs.map +1 -0
  26. package/batteries/llm/openai_chat_completions/validation.d.ts +31 -0
  27. package/batteries/llm/openai_chat_completions/validation.mjs +187 -0
  28. package/batteries/llm/openai_chat_completions/validation.mjs.map +1 -0
  29. package/batteries/llm/openai_chat_completions.cjs +51 -0
  30. package/batteries/llm/openai_chat_completions.mjs +5 -0
  31. package/batteries/llm/webllm_chat_completions/adapter.cjs +658 -0
  32. package/batteries/llm/webllm_chat_completions/adapter.cjs.map +1 -0
  33. package/batteries/llm/webllm_chat_completions/adapter.d.ts +103 -0
  34. package/batteries/llm/webllm_chat_completions/adapter.mjs +656 -0
  35. package/batteries/llm/webllm_chat_completions/adapter.mjs.map +1 -0
  36. package/batteries/llm/webllm_chat_completions/exceptions.cjs +70 -0
  37. package/batteries/llm/webllm_chat_completions/exceptions.cjs.map +1 -0
  38. package/batteries/llm/webllm_chat_completions/exceptions.d.ts +74 -0
  39. package/batteries/llm/webllm_chat_completions/exceptions.mjs +65 -0
  40. package/batteries/llm/webllm_chat_completions/exceptions.mjs.map +1 -0
  41. package/batteries/llm/webllm_chat_completions/helpers.cjs +38 -0
  42. package/batteries/llm/webllm_chat_completions/helpers.d.ts +6 -0
  43. package/batteries/llm/webllm_chat_completions/helpers.mjs +2 -0
  44. package/batteries/llm/webllm_chat_completions/index.d.ts +25 -0
  45. package/batteries/llm/webllm_chat_completions/types.d.ts +31 -0
  46. package/batteries/llm/webllm_chat_completions/validation.cjs +115 -0
  47. package/batteries/llm/webllm_chat_completions/validation.cjs.map +1 -0
  48. package/batteries/llm/webllm_chat_completions/validation.d.ts +8 -0
  49. package/batteries/llm/webllm_chat_completions/validation.mjs +112 -0
  50. package/batteries/llm/webllm_chat_completions/validation.mjs.map +1 -0
  51. package/batteries/llm/webllm_chat_completions.cjs +50 -0
  52. package/batteries/llm/webllm_chat_completions.mjs +6 -0
  53. package/batteries/llm.cjs +63 -0
  54. package/batteries/llm.mjs +10 -0
  55. package/batteries/storage/flydrive/index.d.ts +167 -0
  56. package/batteries/storage/flydrive.cjs +249 -0
  57. package/batteries/storage/flydrive.cjs.map +1 -0
  58. package/batteries/storage/flydrive.mjs +249 -0
  59. package/batteries/storage/flydrive.mjs.map +1 -0
  60. package/batteries/storage/in_memory/index.d.ts +106 -0
  61. package/batteries/storage/in_memory.cjs +121 -0
  62. package/batteries/storage/in_memory.cjs.map +1 -0
  63. package/batteries/storage/in_memory.mjs +119 -0
  64. package/batteries/storage/in_memory.mjs.map +1 -0
  65. package/batteries/storage/index.d.ts +18 -0
  66. package/batteries/storage/opfs/index.d.ts +299 -0
  67. package/batteries/storage/opfs.cjs +368 -0
  68. package/batteries/storage/opfs.cjs.map +1 -0
  69. package/batteries/storage/opfs.mjs +366 -0
  70. package/batteries/storage/opfs.mjs.map +1 -0
  71. package/batteries/storage.cjs +4 -0
  72. package/batteries/storage.mjs +2 -0
  73. package/batteries/tools/color/index.d.ts +37 -0
  74. package/batteries/tools/color.cjs +659 -0
  75. package/batteries/tools/color.cjs.map +1 -0
  76. package/batteries/tools/color.mjs +655 -0
  77. package/batteries/tools/color.mjs.map +1 -0
  78. package/batteries/tools/comparison/index.d.ts +29 -0
  79. package/batteries/tools/comparison.cjs +171 -0
  80. package/batteries/tools/comparison.cjs.map +1 -0
  81. package/batteries/tools/comparison.mjs +168 -0
  82. package/batteries/tools/comparison.mjs.map +1 -0
  83. package/batteries/tools/data_structure/index.d.ts +30 -0
  84. package/batteries/tools/data_structure.cjs +270 -0
  85. package/batteries/tools/data_structure.cjs.map +1 -0
  86. package/batteries/tools/data_structure.mjs +267 -0
  87. package/batteries/tools/data_structure.mjs.map +1 -0
  88. package/batteries/tools/datetime_extended/index.d.ts +51 -0
  89. package/batteries/tools/datetime_extended.cjs +309 -0
  90. package/batteries/tools/datetime_extended.cjs.map +1 -0
  91. package/batteries/tools/datetime_extended.mjs +302 -0
  92. package/batteries/tools/datetime_extended.mjs.map +1 -0
  93. package/batteries/tools/datetime_math/index.d.ts +36 -0
  94. package/batteries/tools/datetime_math.cjs +175 -0
  95. package/batteries/tools/datetime_math.cjs.map +1 -0
  96. package/batteries/tools/datetime_math.mjs +171 -0
  97. package/batteries/tools/datetime_math.mjs.map +1 -0
  98. package/batteries/tools/encoding/index.d.ts +36 -0
  99. package/batteries/tools/encoding.cjs +156 -0
  100. package/batteries/tools/encoding.cjs.map +1 -0
  101. package/batteries/tools/encoding.mjs +152 -0
  102. package/batteries/tools/encoding.mjs.map +1 -0
  103. package/batteries/tools/formatting/index.d.ts +28 -0
  104. package/batteries/tools/formatting.cjs +120 -0
  105. package/batteries/tools/formatting.cjs.map +1 -0
  106. package/batteries/tools/formatting.mjs +117 -0
  107. package/batteries/tools/formatting.mjs.map +1 -0
  108. package/batteries/tools/geo_basics/index.d.ts +33 -0
  109. package/batteries/tools/geo_basics.cjs +136 -0
  110. package/batteries/tools/geo_basics.cjs.map +1 -0
  111. package/batteries/tools/geo_basics.mjs +132 -0
  112. package/batteries/tools/geo_basics.mjs.map +1 -0
  113. package/batteries/tools/index.d.ts +32 -0
  114. package/batteries/tools/math/index.d.ts +37 -0
  115. package/batteries/tools/math.cjs +136 -0
  116. package/batteries/tools/math.cjs.map +1 -0
  117. package/batteries/tools/math.mjs +133 -0
  118. package/batteries/tools/math.mjs.map +1 -0
  119. package/batteries/tools/memory/index.d.ts +73 -0
  120. package/batteries/tools/memory.cjs +193 -0
  121. package/batteries/tools/memory.cjs.map +1 -0
  122. package/batteries/tools/memory.mjs +187 -0
  123. package/batteries/tools/memory.mjs.map +1 -0
  124. package/batteries/tools/parsing/index.d.ts +47 -0
  125. package/batteries/tools/parsing.cjs +191 -0
  126. package/batteries/tools/parsing.cjs.map +1 -0
  127. package/batteries/tools/parsing.mjs +185 -0
  128. package/batteries/tools/parsing.mjs.map +1 -0
  129. package/batteries/tools/retrievables/index.d.ts +81 -0
  130. package/batteries/tools/retrievables.cjs +215 -0
  131. package/batteries/tools/retrievables.cjs.map +1 -0
  132. package/batteries/tools/retrievables.mjs +209 -0
  133. package/batteries/tools/retrievables.mjs.map +1 -0
  134. package/batteries/tools/standing_instructions/index.d.ts +64 -0
  135. package/batteries/tools/standing_instructions.cjs +126 -0
  136. package/batteries/tools/standing_instructions.cjs.map +1 -0
  137. package/batteries/tools/standing_instructions.mjs +121 -0
  138. package/batteries/tools/standing_instructions.mjs.map +1 -0
  139. package/batteries/tools/statistics/index.d.ts +46 -0
  140. package/batteries/tools/statistics.cjs +253 -0
  141. package/batteries/tools/statistics.cjs.map +1 -0
  142. package/batteries/tools/statistics.mjs +248 -0
  143. package/batteries/tools/statistics.mjs.map +1 -0
  144. package/batteries/tools/string_processing/index.d.ts +29 -0
  145. package/batteries/tools/string_processing.cjs +154 -0
  146. package/batteries/tools/string_processing.cjs.map +1 -0
  147. package/batteries/tools/string_processing.mjs +151 -0
  148. package/batteries/tools/string_processing.mjs.map +1 -0
  149. package/batteries/tools/structured_data/index.d.ts +34 -0
  150. package/batteries/tools/structured_data.cjs +189 -0
  151. package/batteries/tools/structured_data.cjs.map +1 -0
  152. package/batteries/tools/structured_data.mjs +185 -0
  153. package/batteries/tools/structured_data.mjs.map +1 -0
  154. package/batteries/tools/text_analysis/index.d.ts +31 -0
  155. package/batteries/tools/text_analysis.cjs +120 -0
  156. package/batteries/tools/text_analysis.cjs.map +1 -0
  157. package/batteries/tools/text_analysis.mjs +117 -0
  158. package/batteries/tools/text_analysis.mjs.map +1 -0
  159. package/batteries/tools/text_comparison/index.d.ts +28 -0
  160. package/batteries/tools/text_comparison.cjs +96 -0
  161. package/batteries/tools/text_comparison.cjs.map +1 -0
  162. package/batteries/tools/text_comparison.mjs +93 -0
  163. package/batteries/tools/text_comparison.mjs.map +1 -0
  164. package/batteries/tools/time/index.d.ts +27 -0
  165. package/batteries/tools/time.cjs +63 -0
  166. package/batteries/tools/time.cjs.map +1 -0
  167. package/batteries/tools/time.mjs +60 -0
  168. package/batteries/tools/time.mjs.map +1 -0
  169. package/batteries/tools/unit_conversion/index.d.ts +19 -0
  170. package/batteries/tools/unit_conversion.cjs +452 -0
  171. package/batteries/tools/unit_conversion.cjs.map +1 -0
  172. package/batteries/tools/unit_conversion.mjs +450 -0
  173. package/batteries/tools/unit_conversion.mjs.map +1 -0
  174. package/batteries/tools.cjs +80 -0
  175. package/batteries/tools.mjs +21 -0
  176. package/batteries.cjs +142 -0
  177. package/batteries.mjs +30 -0
  178. package/chunk-KmRHZBOW.js +35 -0
  179. package/common-DeZaonK1.mjs +208 -0
  180. package/common-DeZaonK1.mjs.map +1 -0
  181. package/common-Od8edUXU.js +232 -0
  182. package/common-Od8edUXU.js.map +1 -0
  183. package/common.cjs +31 -0
  184. package/common.d.ts +108 -0
  185. package/common.mjs +8 -0
  186. package/dispatch_runner-9j6bXHL3.mjs +1609 -0
  187. package/dispatch_runner-9j6bXHL3.mjs.map +1 -0
  188. package/dispatch_runner-CsoH0nld.js +1627 -0
  189. package/dispatch_runner-CsoH0nld.js.map +1 -0
  190. package/dispatch_runner.cjs +3 -0
  191. package/dispatch_runner.d.ts +17 -0
  192. package/dispatch_runner.mjs +2 -0
  193. package/exceptions-D5YrO9Vm.js +280 -0
  194. package/exceptions-D5YrO9Vm.js.map +1 -0
  195. package/exceptions-NrzIHw_R.mjs +244 -0
  196. package/exceptions-NrzIHw_R.mjs.map +1 -0
  197. package/exceptions.cjs +33 -0
  198. package/exceptions.d.ts +52 -0
  199. package/exceptions.mjs +3 -0
  200. package/factories.cjs +4 -0
  201. package/factories.d.ts +39 -0
  202. package/factories.mjs +2 -0
  203. package/forge.cjs +9 -0
  204. package/forge.d.ts +49 -0
  205. package/forge.mjs +5 -0
  206. package/guards.cjs +96 -0
  207. package/guards.cjs.map +1 -0
  208. package/guards.d.ts +83 -0
  209. package/guards.mjs +72 -0
  210. package/guards.mjs.map +1 -0
  211. package/index.cjs +107 -0
  212. package/index.cjs.map +1 -0
  213. package/index.d.ts +18 -0
  214. package/index.mjs +31 -0
  215. package/index.mjs.map +1 -0
  216. package/lib/classes/artifact_tool.d.ts +129 -0
  217. package/lib/classes/base_exception.d.ts +83 -0
  218. package/lib/classes/identity.d.ts +71 -0
  219. package/lib/classes/media.d.ts +326 -0
  220. package/lib/classes/memory.d.ts +72 -0
  221. package/lib/classes/message.d.ts +137 -0
  222. package/lib/classes/registry.d.ts +79 -0
  223. package/lib/classes/retrievable.d.ts +100 -0
  224. package/lib/classes/spooled_artifact.d.ts +296 -0
  225. package/lib/classes/spooled_json_artifact.d.ts +158 -0
  226. package/lib/classes/spooled_markdown_artifact.d.ts +202 -0
  227. package/lib/classes/thought.d.ts +142 -0
  228. package/lib/classes/tokenizable.d.ts +124 -0
  229. package/lib/classes/tool.d.ts +228 -0
  230. package/lib/classes/tool_call.d.ts +190 -0
  231. package/lib/classes/tool_registry.d.ts +159 -0
  232. package/lib/classes/turn_gate.d.ts +109 -0
  233. package/lib/contracts/dispatch_context.d.ts +345 -0
  234. package/lib/contracts/media_reader.d.ts +60 -0
  235. package/lib/contracts/spool_reader.d.ts +80 -0
  236. package/lib/contracts/spooled_artifact_constructor.d.ts +38 -0
  237. package/lib/contracts/turn_runner_config.d.ts +101 -0
  238. package/lib/contracts/turn_runner_context.d.ts +267 -0
  239. package/lib/dispatch_runner.d.ts +98 -0
  240. package/lib/exceptions/runtime.d.ts +370 -0
  241. package/lib/helpers/media_readers.d.ts +39 -0
  242. package/lib/turn_runner.d.ts +144 -0
  243. package/lib/types/dispatch_context.d.ts +233 -0
  244. package/lib/types/dispatch_runner.d.ts +387 -0
  245. package/lib/types/turn_runner.d.ts +322 -0
  246. package/lib/utils/canonical_json.d.ts +18 -0
  247. package/lib/utils/exceptions.d.ts +78 -0
  248. package/lib/utils/guards.d.ts +32 -0
  249. package/lib/utils/validation.d.ts +77 -0
  250. package/package.json +334 -0
  251. package/runtime-BJVkrGQe.js +519 -0
  252. package/runtime-BJVkrGQe.js.map +1 -0
  253. package/runtime-CrEPIFgr.mjs +346 -0
  254. package/runtime-CrEPIFgr.mjs.map +1 -0
  255. package/skills/adk-assembly/SKILL.md +109 -0
  256. package/skills/adk-assembly/references/assembly-contract.md +66 -0
  257. package/skills/adk-assembly/references/executors-tools-pipelines-events.md +113 -0
  258. package/skills/adk-assembly/references/first-integration.md +93 -0
  259. package/skills/adk-assembly/references/storage-and-context.md +102 -0
  260. package/spooled_artifact-C5ZtGxuJ.mjs +544 -0
  261. package/spooled_artifact-C5ZtGxuJ.mjs.map +1 -0
  262. package/spooled_artifact-Cm9Te22K.js +568 -0
  263. package/spooled_artifact-Cm9Te22K.js.map +1 -0
  264. package/spooled_artifact.cjs +7 -0
  265. package/spooled_artifact.d.ts +40 -0
  266. package/spooled_artifact.mjs +3 -0
  267. package/spooled_markdown_artifact-BpUJol0W.mjs +771 -0
  268. package/spooled_markdown_artifact-BpUJol0W.mjs.map +1 -0
  269. package/spooled_markdown_artifact-RRB113sy.js +786 -0
  270. package/spooled_markdown_artifact-RRB113sy.js.map +1 -0
  271. package/thought-CDb457b4.mjs +470 -0
  272. package/thought-CDb457b4.mjs.map +1 -0
  273. package/thought-DuN2PgdO.js +494 -0
  274. package/thought-DuN2PgdO.js.map +1 -0
  275. package/tool-COSeH8I6.js +302 -0
  276. package/tool-COSeH8I6.js.map +1 -0
  277. package/tool-D2WB1EA1.mjs +296 -0
  278. package/tool-D2WB1EA1.mjs.map +1 -0
  279. package/tool_call-BKyyxGaZ.mjs +578 -0
  280. package/tool_call-BKyyxGaZ.mjs.map +1 -0
  281. package/tool_call-DFgzcVcU.js +608 -0
  282. package/tool_call-DFgzcVcU.js.map +1 -0
  283. package/tool_registry-Dkfprsck.js +641 -0
  284. package/tool_registry-Dkfprsck.js.map +1 -0
  285. package/tool_registry-DqLOyGyG.mjs +592 -0
  286. package/tool_registry-DqLOyGyG.mjs.map +1 -0
  287. package/turn_runner-CMm2BHdX.js +615 -0
  288. package/turn_runner-CMm2BHdX.js.map +1 -0
  289. package/turn_runner-y7eyEcJH.mjs +603 -0
  290. package/turn_runner-y7eyEcJH.mjs.map +1 -0
  291. package/turn_runner.cjs +3 -0
  292. package/turn_runner.d.ts +21 -0
  293. package/turn_runner.mjs +2 -0
  294. package/types.cjs +1 -0
  295. package/types.d.ts +56 -0
  296. package/types.mjs +0 -0
  297. package/vite-env.d.ts +23 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.cjs","names":[],"sources":["../../../../src/batteries/llm/webllm_chat_completions/validation.ts"],"sourcesContent":["/**\n * Runtime validation schema and wrapper for WebLLM Chat Completions adapter options.\n *\n * @module @nhtio/adk/batteries/llm/webllm_chat_completions/validation\n */\n\nimport { isError } from '@nhtio/adk/guards'\nimport { validator, ValidationError } from '@nhtio/validation'\nimport { E_INVALID_WEBLLM_CHAT_COMPLETIONS_OPTIONS } from './exceptions'\nimport type { WebLLMChatCompletionsAdapterOptions } from './types'\n\nconst bucketLabelSchema = validator\n .string()\n .valid('standingInstructions', 'memories', 'retrievables', 'timeline')\n\nconst bucketOrderSchema = validator\n .array()\n .items(bucketLabelSchema)\n .unique()\n .default(['standingInstructions', 'memories', 'retrievables', 'timeline'])\n\nconst tokenEncodingSchema = validator\n .alternatives(\n validator\n .string()\n .valid(\n 'gpt2',\n 'r50k_base',\n 'p50k_base',\n 'p50k_edit',\n 'cl100k_base',\n 'o200k_base',\n 'gemini',\n 'llama2',\n 'claude'\n ),\n validator.any().valid(null)\n )\n .default(null)\n\nconst helperSchema = validator.function()\n\nconst helpersSchema = validator\n .object({\n descriptionToChatCompletionsJsonSchema: helperSchema.optional(),\n renderUntrustedContent: helperSchema.optional(),\n renderTrustedContent: helperSchema.optional(),\n renderStandingInstructions: helperSchema.optional(),\n renderMemories: helperSchema.optional(),\n renderRetrievables: helperSchema.optional(),\n renderRetrievableSafetyDirective: helperSchema.optional(),\n renderFirstPartyRetrievables: helperSchema.optional(),\n renderThirdPartyPublicRetrievables: helperSchema.optional(),\n renderThirdPartyPrivateRetrievables: helperSchema.optional(),\n renderTimelineMessage: helperSchema.optional(),\n renderThought: helperSchema.optional(),\n filterThoughts: helperSchema.optional(),\n toolsToChatCompletionsTools: helperSchema.optional(),\n renderChatCompletionsSystemPrompt: helperSchema.optional(),\n renderChatCompletionsToolCallResult: helperSchema.optional(),\n buildChatCompletionsHistory: helperSchema.optional(),\n createChatCompletionsToolCallDeltaAccumulator: helperSchema.optional(),\n })\n .unknown(false)\n\nconst jsonSchemaSchema = validator.object().unknown(true)\n\nconst responseFormatSchema = validator.alternatives(\n validator.object({ type: validator.string().valid('text').required() }).unknown(false),\n validator.object({ type: validator.string().valid('json_object').required() }).unknown(false),\n validator\n .object({\n type: validator.string().valid('json_schema').required(),\n json_schema: validator\n .object({\n name: validator.string().required(),\n schema: jsonSchemaSchema.required(),\n strict: validator.boolean().optional(),\n description: validator.string().optional(),\n })\n .unknown(false)\n .required(),\n })\n .unknown(false)\n)\n\nconst toolChoiceItemSchema = validator.alternatives(\n validator\n .object({\n type: validator.string().valid('function').required(),\n function: validator.object({ name: validator.string().required() }).unknown(false).required(),\n })\n .unknown(false),\n validator\n .object({\n type: validator.string().valid('custom').required(),\n custom: validator.object({ name: validator.string().required() }).unknown(false).required(),\n })\n .unknown(false)\n)\n\nconst toolChoiceSchema = validator.alternatives(\n validator.string().valid('none', 'auto', 'required'),\n toolChoiceItemSchema,\n validator\n .object({\n type: validator.string().valid('allowed_tools').required(),\n allowed_tools: validator\n .object({\n mode: validator.string().valid('auto', 'required').required(),\n tools: validator.array().items(toolChoiceItemSchema).required(),\n })\n .unknown(false)\n .required(),\n })\n .unknown(false)\n)\n\nexport const webLLMChatCompletionsOptionsSchema = validator\n .object<WebLLMChatCompletionsAdapterOptions>({\n engine: validator.object().unknown(true).optional(),\n createEngine: validator.function().optional(),\n onInitProgress: validator.function().optional(),\n isWebGPUAvailable: validator.function().optional(),\n engineConfig: validator.object().unknown(true).optional(),\n chatOptions: validator\n .alternatives(\n validator.object().unknown(true),\n validator.array().items(validator.object().unknown(true))\n )\n .optional(),\n stream: validator.boolean().default(true),\n bucketOrder: bucketOrderSchema,\n contextWindow: validator.number().integer().min(1).optional(),\n selfIdentity: validator.string().min(1).default('assistant'),\n thoughtSurfacing: validator\n .string()\n .valid('all-self', 'latest-self', 'all')\n .default('all-self'),\n tokenEncoding: tokenEncodingSchema,\n replayCompatibility: validator.array().items(validator.string().min(1)).default([]),\n helpers: helpersSchema.optional(),\n strictToolChoice: validator.boolean().default(false),\n // Opt-in: executor self-acks tool-call-free responses only when true.\n // Default false hands turn completion to the implementor (see\n // OpenAIChatCompletionsAdapterOptions.autoAck — inherited here).\n autoAck: validator.boolean().default(false),\n unsupportedMediaPolicy: validator\n .alternatives(\n validator.string().valid('throw', 'fallback-stash', 'synthetic-description'),\n validator\n .object({\n mode: validator.string().valid('fallback-stash').required(),\n stashKeys: validator.array().items(validator.string().min(1)).required(),\n })\n .unknown(false)\n )\n .default('throw'),\n\n model: validator.string().required(),\n frequency_penalty: validator.number().min(-2).max(2).optional(),\n logit_bias: validator.object().pattern(validator.string(), validator.number()).optional(),\n logprobs: validator.boolean().optional(),\n max_tokens: validator.number().integer().min(1).optional(),\n n: validator.number().integer().min(1).optional(),\n presence_penalty: validator.number().min(-2).max(2).optional(),\n response_format: responseFormatSchema.optional(),\n seed: validator.number().integer().optional(),\n stop: validator\n .alternatives(validator.string(), validator.array().items(validator.string()))\n .optional(),\n stream_options: validator.object().unknown(true).optional(),\n temperature: validator.number().min(0).max(2).optional(),\n tool_choice: toolChoiceSchema.optional(),\n top_logprobs: validator.number().integer().min(0).optional(),\n top_p: validator.number().min(0).max(1).optional(),\n user: validator.string().optional(),\n repetition_penalty: validator.number().optional(),\n ignore_eos: validator.boolean().optional(),\n extra_body: validator.object().unknown(true).optional(),\n max_completion_tokens: validator.number().integer().min(1).optional(),\n })\n .unknown(false)\n\nconst isValidationError = (value: unknown): value is ValidationError =>\n isError(value) && Array.isArray((value as ValidationError).details)\n\nconst formatValidationDetails = (err: ValidationError): string =>\n err.details.map((d) => d.message).join(' and ')\n\nexport const validateOptions = (input: unknown): WebLLMChatCompletionsAdapterOptions => {\n const { value, error } = webLLMChatCompletionsOptionsSchema.validate(input, {\n abortEarly: false,\n convert: false,\n })\n if (error) {\n throw new E_INVALID_WEBLLM_CHAT_COMPLETIONS_OPTIONS([formatValidationDetails(error)], {\n cause: error,\n })\n }\n return value as Web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AQ,EAAE,IAAI,CAAC,EAAE,SAAS;CAC3D,OAAO,kBAAA,UAAU,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS;CACjD,MAAM,kBAAA,UAAU,OAAO,EAAE,SAAS;CAClC,oBAAoB,kBAAA,UAAU,OAAO,EAAE,SAAS;CAChD,YAAY,kBAAA,UAAU,QAAQ,EAAE,SAAS;CACzC,YAAY,kBAAA,UAAU,OAAO,EAAE,QAAQ,IAAI,EAAE,SAAS;CACtD,uBAAuB,kBAAA,UAAU,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,SAAS;AACtE,CAAC,EACA,QAAQ,KAAK;AAKhB,IAAM,2BAA2B,QAC/B,IAAI,QAAQ,KAAK,MAAM,EAAE,OAAO,EAAE,KAAK,OAAO;AAEhD,IAAa,mBAAmB,UAAwD;CACtF,MAAM,EAAE,OAAO,UAAU,mCAAmC,SAAS,OAAO;EAC1E,YAAY;EACZ,SAAS;CACX,CAAC;CACD,IAAI,OACF,MAAM,IAAI,yDAAA,0CAA0C,CAAC,wBAAwB,KAAK,CAAC,GAAG,EACpF,OAAO,MACT,CAAC;CAEH,OAAO;AACT"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Runtime validation schema and wrapper for WebLLM Chat Completions adapter options.
3
+ *
4
+ * @module @nhtio/adk/batteries/llm/webllm_chat_completions/validation
5
+ */
6
+ import type { WebLLMChatCompletionsAdapterOptions } from "./types";
7
+ export declare const webLLMChatCompletionsOptionsSchema: import("@nhtio/validation").ObjectSchema<WebLLMChatCompletionsAdapterOptions>;
8
+ export declare const validateOptions: (input: unknown) => WebLLMChatCompletionsAdapterOptions;
@@ -0,0 +1,112 @@
1
+ import "../../../guards.mjs";
2
+ import { E_INVALID_WEBLLM_CHAT_COMPLETIONS_OPTIONS } from "./exceptions.mjs";
3
+ import { validator } from "@nhtio/validation";
4
+ //#region src/batteries/llm/webllm_chat_completions/validation.ts
5
+ var bucketLabelSchema = validator.string().valid("standingInstructions", "memories", "retrievables", "timeline");
6
+ var bucketOrderSchema = validator.array().items(bucketLabelSchema).unique().default([
7
+ "standingInstructions",
8
+ "memories",
9
+ "retrievables",
10
+ "timeline"
11
+ ]);
12
+ var tokenEncodingSchema = validator.alternatives(validator.string().valid("gpt2", "r50k_base", "p50k_base", "p50k_edit", "cl100k_base", "o200k_base", "gemini", "llama2", "claude"), validator.any().valid(null)).default(null);
13
+ var helperSchema = validator.function();
14
+ var helpersSchema = validator.object({
15
+ descriptionToChatCompletionsJsonSchema: helperSchema.optional(),
16
+ renderUntrustedContent: helperSchema.optional(),
17
+ renderTrustedContent: helperSchema.optional(),
18
+ renderStandingInstructions: helperSchema.optional(),
19
+ renderMemories: helperSchema.optional(),
20
+ renderRetrievables: helperSchema.optional(),
21
+ renderRetrievableSafetyDirective: helperSchema.optional(),
22
+ renderFirstPartyRetrievables: helperSchema.optional(),
23
+ renderThirdPartyPublicRetrievables: helperSchema.optional(),
24
+ renderThirdPartyPrivateRetrievables: helperSchema.optional(),
25
+ renderTimelineMessage: helperSchema.optional(),
26
+ renderThought: helperSchema.optional(),
27
+ filterThoughts: helperSchema.optional(),
28
+ toolsToChatCompletionsTools: helperSchema.optional(),
29
+ renderChatCompletionsSystemPrompt: helperSchema.optional(),
30
+ renderChatCompletionsToolCallResult: helperSchema.optional(),
31
+ buildChatCompletionsHistory: helperSchema.optional(),
32
+ createChatCompletionsToolCallDeltaAccumulator: helperSchema.optional()
33
+ }).unknown(false);
34
+ var jsonSchemaSchema = validator.object().unknown(true);
35
+ var responseFormatSchema = validator.alternatives(validator.object({ type: validator.string().valid("text").required() }).unknown(false), validator.object({ type: validator.string().valid("json_object").required() }).unknown(false), validator.object({
36
+ type: validator.string().valid("json_schema").required(),
37
+ json_schema: validator.object({
38
+ name: validator.string().required(),
39
+ schema: jsonSchemaSchema.required(),
40
+ strict: validator.boolean().optional(),
41
+ description: validator.string().optional()
42
+ }).unknown(false).required()
43
+ }).unknown(false));
44
+ var toolChoiceItemSchema = validator.alternatives(validator.object({
45
+ type: validator.string().valid("function").required(),
46
+ function: validator.object({ name: validator.string().required() }).unknown(false).required()
47
+ }).unknown(false), validator.object({
48
+ type: validator.string().valid("custom").required(),
49
+ custom: validator.object({ name: validator.string().required() }).unknown(false).required()
50
+ }).unknown(false));
51
+ var toolChoiceSchema = validator.alternatives(validator.string().valid("none", "auto", "required"), toolChoiceItemSchema, validator.object({
52
+ type: validator.string().valid("allowed_tools").required(),
53
+ allowed_tools: validator.object({
54
+ mode: validator.string().valid("auto", "required").required(),
55
+ tools: validator.array().items(toolChoiceItemSchema).required()
56
+ }).unknown(false).required()
57
+ }).unknown(false));
58
+ var webLLMChatCompletionsOptionsSchema = validator.object({
59
+ engine: validator.object().unknown(true).optional(),
60
+ createEngine: validator.function().optional(),
61
+ onInitProgress: validator.function().optional(),
62
+ isWebGPUAvailable: validator.function().optional(),
63
+ engineConfig: validator.object().unknown(true).optional(),
64
+ chatOptions: validator.alternatives(validator.object().unknown(true), validator.array().items(validator.object().unknown(true))).optional(),
65
+ stream: validator.boolean().default(true),
66
+ bucketOrder: bucketOrderSchema,
67
+ contextWindow: validator.number().integer().min(1).optional(),
68
+ selfIdentity: validator.string().min(1).default("assistant"),
69
+ thoughtSurfacing: validator.string().valid("all-self", "latest-self", "all").default("all-self"),
70
+ tokenEncoding: tokenEncodingSchema,
71
+ replayCompatibility: validator.array().items(validator.string().min(1)).default([]),
72
+ helpers: helpersSchema.optional(),
73
+ strictToolChoice: validator.boolean().default(false),
74
+ autoAck: validator.boolean().default(false),
75
+ unsupportedMediaPolicy: validator.alternatives(validator.string().valid("throw", "fallback-stash", "synthetic-description"), validator.object({
76
+ mode: validator.string().valid("fallback-stash").required(),
77
+ stashKeys: validator.array().items(validator.string().min(1)).required()
78
+ }).unknown(false)).default("throw"),
79
+ model: validator.string().required(),
80
+ frequency_penalty: validator.number().min(-2).max(2).optional(),
81
+ logit_bias: validator.object().pattern(validator.string(), validator.number()).optional(),
82
+ logprobs: validator.boolean().optional(),
83
+ max_tokens: validator.number().integer().min(1).optional(),
84
+ n: validator.number().integer().min(1).optional(),
85
+ presence_penalty: validator.number().min(-2).max(2).optional(),
86
+ response_format: responseFormatSchema.optional(),
87
+ seed: validator.number().integer().optional(),
88
+ stop: validator.alternatives(validator.string(), validator.array().items(validator.string())).optional(),
89
+ stream_options: validator.object().unknown(true).optional(),
90
+ temperature: validator.number().min(0).max(2).optional(),
91
+ tool_choice: toolChoiceSchema.optional(),
92
+ top_logprobs: validator.number().integer().min(0).optional(),
93
+ top_p: validator.number().min(0).max(1).optional(),
94
+ user: validator.string().optional(),
95
+ repetition_penalty: validator.number().optional(),
96
+ ignore_eos: validator.boolean().optional(),
97
+ extra_body: validator.object().unknown(true).optional(),
98
+ max_completion_tokens: validator.number().integer().min(1).optional()
99
+ }).unknown(false);
100
+ var formatValidationDetails = (err) => err.details.map((d) => d.message).join(" and ");
101
+ var validateOptions = (input) => {
102
+ const { value, error } = webLLMChatCompletionsOptionsSchema.validate(input, {
103
+ abortEarly: false,
104
+ convert: false
105
+ });
106
+ if (error) throw new E_INVALID_WEBLLM_CHAT_COMPLETIONS_OPTIONS([formatValidationDetails(error)], { cause: error });
107
+ return value;
108
+ };
109
+ //#endregion
110
+ export { validateOptions, webLLMChatCompletionsOptionsSchema };
111
+
112
+ //# sourceMappingURL=validation.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.mjs","names":[],"sources":["../../../../src/batteries/llm/webllm_chat_completions/validation.ts"],"sourcesContent":["/**\n * Runtime validation schema and wrapper for WebLLM Chat Completions adapter options.\n *\n * @module @nhtio/adk/batteries/llm/webllm_chat_completions/validation\n */\n\nimport { isError } from '@nhtio/adk/guards'\nimport { validator, ValidationError } from '@nhtio/validation'\nimport { E_INVALID_WEBLLM_CHAT_COMPLETIONS_OPTIONS } from './exceptions'\nimport type { WebLLMChatCompletionsAdapterOptions } from './types'\n\nconst bucketLabelSchema = validator\n .string()\n .valid('standingInstructions', 'memories', 'retrievables', 'timeline')\n\nconst bucketOrderSchema = validator\n .array()\n .items(bucketLabelSchema)\n .unique()\n .default(['standingInstructions', 'memories', 'retrievables', 'timeline'])\n\nconst tokenEncodingSchema = validator\n .alternatives(\n validator\n .string()\n .valid(\n 'gpt2',\n 'r50k_base',\n 'p50k_base',\n 'p50k_edit',\n 'cl100k_base',\n 'o200k_base',\n 'gemini',\n 'llama2',\n 'claude'\n ),\n validator.any().valid(null)\n )\n .default(null)\n\nconst helperSchema = validator.function()\n\nconst helpersSchema = validator\n .object({\n descriptionToChatCompletionsJsonSchema: helperSchema.optional(),\n renderUntrustedContent: helperSchema.optional(),\n renderTrustedContent: helperSchema.optional(),\n renderStandingInstructions: helperSchema.optional(),\n renderMemories: helperSchema.optional(),\n renderRetrievables: helperSchema.optional(),\n renderRetrievableSafetyDirective: helperSchema.optional(),\n renderFirstPartyRetrievables: helperSchema.optional(),\n renderThirdPartyPublicRetrievables: helperSchema.optional(),\n renderThirdPartyPrivateRetrievables: helperSchema.optional(),\n renderTimelineMessage: helperSchema.optional(),\n renderThought: helperSchema.optional(),\n filterThoughts: helperSchema.optional(),\n toolsToChatCompletionsTools: helperSchema.optional(),\n renderChatCompletionsSystemPrompt: helperSchema.optional(),\n renderChatCompletionsToolCallResult: helperSchema.optional(),\n buildChatCompletionsHistory: helperSchema.optional(),\n createChatCompletionsToolCallDeltaAccumulator: helperSchema.optional(),\n })\n .unknown(false)\n\nconst jsonSchemaSchema = validator.object().unknown(true)\n\nconst responseFormatSchema = validator.alternatives(\n validator.object({ type: validator.string().valid('text').required() }).unknown(false),\n validator.object({ type: validator.string().valid('json_object').required() }).unknown(false),\n validator\n .object({\n type: validator.string().valid('json_schema').required(),\n json_schema: validator\n .object({\n name: validator.string().required(),\n schema: jsonSchemaSchema.required(),\n strict: validator.boolean().optional(),\n description: validator.string().optional(),\n })\n .unknown(false)\n .required(),\n })\n .unknown(false)\n)\n\nconst toolChoiceItemSchema = validator.alternatives(\n validator\n .object({\n type: validator.string().valid('function').required(),\n function: validator.object({ name: validator.string().required() }).unknown(false).required(),\n })\n .unknown(false),\n validator\n .object({\n type: validator.string().valid('custom').required(),\n custom: validator.object({ name: validator.string().required() }).unknown(false).required(),\n })\n .unknown(false)\n)\n\nconst toolChoiceSchema = validator.alternatives(\n validator.string().valid('none', 'auto', 'required'),\n toolChoiceItemSchema,\n validator\n .object({\n type: validator.string().valid('allowed_tools').required(),\n allowed_tools: validator\n .object({\n mode: validator.string().valid('auto', 'required').required(),\n tools: validator.array().items(toolChoiceItemSchema).required(),\n })\n .unknown(false)\n .required(),\n })\n .unknown(false)\n)\n\nexport const webLLMChatCompletionsOptionsSchema = validator\n .object<WebLLMChatCompletionsAdapterOptions>({\n engine: validator.object().unknown(true).optional(),\n createEngine: validator.function().optional(),\n onInitProgress: validator.function().optional(),\n isWebGPUAvailable: validator.function().optional(),\n engineConfig: validator.object().unknown(true).optional(),\n chatOptions: validator\n .alternatives(\n validator.object().unknown(true),\n validator.array().items(validator.object().unknown(true))\n )\n .optional(),\n stream: validator.boolean().default(true),\n bucketOrder: bucketOrderSchema,\n contextWindow: validator.number().integer().min(1).optional(),\n selfIdentity: validator.string().min(1).default('assistant'),\n thoughtSurfacing: validator\n .string()\n .valid('all-self', 'latest-self', 'all')\n .default('all-self'),\n tokenEncoding: tokenEncodingSchema,\n replayCompatibility: validator.array().items(validator.string().min(1)).default([]),\n helpers: helpersSchema.optional(),\n strictToolChoice: validator.boolean().default(false),\n // Opt-in: executor self-acks tool-call-free responses only when true.\n // Default false hands turn completion to the implementor (see\n // OpenAIChatCompletionsAdapterOptions.autoAck — inherited here).\n autoAck: validator.boolean().default(false),\n unsupportedMediaPolicy: validator\n .alternatives(\n validator.string().valid('throw', 'fallback-stash', 'synthetic-description'),\n validator\n .object({\n mode: validator.string().valid('fallback-stash').required(),\n stashKeys: validator.array().items(validator.string().min(1)).required(),\n })\n .unknown(false)\n )\n .default('throw'),\n\n model: validator.string().required(),\n frequency_penalty: validator.number().min(-2).max(2).optional(),\n logit_bias: validator.object().pattern(validator.string(), validator.number()).optional(),\n logprobs: validator.boolean().optional(),\n max_tokens: validator.number().integer().min(1).optional(),\n n: validator.number().integer().min(1).optional(),\n presence_penalty: validator.number().min(-2).max(2).optional(),\n response_format: responseFormatSchema.optional(),\n seed: validator.number().integer().optional(),\n stop: validator\n .alternatives(validator.string(), validator.array().items(validator.string()))\n .optional(),\n stream_options: validator.object().unknown(true).optional(),\n temperature: validator.number().min(0).max(2).optional(),\n tool_choice: toolChoiceSchema.optional(),\n top_logprobs: validator.number().integer().min(0).optional(),\n top_p: validator.number().min(0).max(1).optional(),\n user: validator.string().optional(),\n repetition_penalty: validator.number().optional(),\n ignore_eos: validator.boolean().optional(),\n extra_body: validator.object().unknown(true).optional(),\n max_completion_tokens: validator.number().integer().min(1).optional(),\n })\n .unknown(false)\n\nconst isValidationError = (value: unknown): value is ValidationError =>\n isError(value) && Array.isArray((value as ValidationError).details)\n\nconst formatValidationDetails = (err: ValidationError): string =>\n err.details.map((d) => d.message).join(' and ')\n\nexport const validateOptions = (input: unknown): WebLLMChatCompletionsAdapterOptions => {\n const { value, error } = webLLMChatCompletionsOptionsSchema.validate(input, {\n abortEarly: false,\n convert: false,\n })\n if (error) {\n throw new E_INVALID_WEBLLM_CHAT_COMPLETIONS_OPTIONS([formatValidationDetails(error)], {\n cause: error,\n })\n }\n return value as WebLLMChatCompletionsAdapterOptions\n}\n\nvoid isValidationError\n"],"mappings":";;;;AAWA,IAAM,oBAAoB,UACvB,OAAO,EACP,MAAM,wBAAwB,YAAY,gBAAgB,UAAU;AAEvE,IAAM,oBAAoB,UACvB,MAAM,EACN,MAAM,iBAAiB,EACvB,OAAO,EACP,QAAQ;CAAC;CAAwB;CAAY;CAAgB;AAAU,CAAC;AAE3E,IAAM,sBAAsB,UACzB,aACC,UACG,OAAO,EACP,MACC,QACA,aACA,aACA,aACA,eACA,cACA,UACA,UACA,QACF,GACF,UAAU,IAAI,EAAE,MAAM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E,QAAQ,EAAE,SAAS;CAC5C,MAAM,UACH,aAAa,UAAU,OAAO,GAAG,UAAU,MAAM,EAAE,MAAM,UAAU,OAAO,CAAC,CAAC,EAC5E,SAAS;CACZ,gBAAgB,UAAU,OAAO,EAAE,QAAQ,IAAI,EAAE,SAAS;CAC1D,aAAa,UAAU,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS;CACvD,aAAa,iBAAiB,SAAS;CACvC,cAAc,UAAU,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,SAAS;CAC3D,OAAO,UAAU,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS;CACjD,MAAM,UAAU,OAAO,EAAE,SAAS;CAClC,oBAAoB,UAAU,OAAO,EAAE,SAAS;CAChD,YAAY,UAAU,QAAQ,EAAE,SAAS;CACzC,YAAY,UAAU,OAAO,EAAE,QAAQ,IAAI,EAAE,SAAS;CACtD,uBAAuB,UAAU,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,SAAS;AACtE,CAAC,EACA,QAAQ,KAAK;AAKhB,IAAM,2BAA2B,QAC/B,IAAI,QAAQ,KAAK,MAAM,EAAE,OAAO,EAAE,KAAK,OAAO;AAEhD,IAAa,mBAAmB,UAAwD;CACtF,MAAM,EAAE,OAAO,UAAU,mCAAmC,SAAS,OAAO;EAC1E,YAAY;EACZ,SAAS;CACX,CAAC;CACD,IAAI,OACF,MAAM,IAAI,0CAA0C,CAAC,wBAAwB,KAAK,CAAC,GAAG,EACpF,OAAO,MACT,CAAC;CAEH,OAAO;AACT"}
@@ -0,0 +1,50 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_batteries_llm_openai_chat_completions_helpers = require("./openai_chat_completions/helpers.cjs");
3
+ const require_batteries_llm_webllm_chat_completions_exceptions = require("./webllm_chat_completions/exceptions.cjs");
4
+ const require_batteries_llm_webllm_chat_completions_validation = require("./webllm_chat_completions/validation.cjs");
5
+ require("./webllm_chat_completions/helpers.cjs");
6
+ const require_batteries_llm_webllm_chat_completions_adapter = require("./webllm_chat_completions/adapter.cjs");
7
+ exports.E_INVALID_WEBLLM_CHAT_COMPLETIONS_OPTIONS = require_batteries_llm_webllm_chat_completions_exceptions.E_INVALID_WEBLLM_CHAT_COMPLETIONS_OPTIONS;
8
+ exports.E_UNSUPPORTED_MEDIA_MODALITY = require_batteries_llm_webllm_chat_completions_exceptions.E_UNSUPPORTED_MEDIA_MODALITY;
9
+ exports.E_WEBLLM_CHAT_COMPLETIONS_CONTEXT_OVERFLOW = require_batteries_llm_webllm_chat_completions_exceptions.E_WEBLLM_CHAT_COMPLETIONS_CONTEXT_OVERFLOW;
10
+ exports.E_WEBLLM_CHAT_COMPLETIONS_INVALID_TOOL_CALL_ARGS = require_batteries_llm_webllm_chat_completions_exceptions.E_WEBLLM_CHAT_COMPLETIONS_INVALID_TOOL_CALL_ARGS;
11
+ exports.E_WEBLLM_CHAT_COMPLETIONS_STREAM_ERROR = require_batteries_llm_webllm_chat_completions_exceptions.E_WEBLLM_CHAT_COMPLETIONS_STREAM_ERROR;
12
+ exports.WebLLMChatCompletionsAdapter = require_batteries_llm_webllm_chat_completions_adapter.WebLLMChatCompletionsAdapter;
13
+ exports.buildChatCompletionsHistory = require_batteries_llm_openai_chat_completions_helpers.buildChatCompletionsHistory;
14
+ exports.createChatCompletionsToolCallDeltaAccumulator = require_batteries_llm_openai_chat_completions_helpers.createChatCompletionsToolCallDeltaAccumulator;
15
+ exports.defaultBuildChatCompletionsHistory = require_batteries_llm_openai_chat_completions_helpers.defaultBuildChatCompletionsHistory;
16
+ exports.defaultCreateChatCompletionsToolCallDeltaAccumulator = require_batteries_llm_openai_chat_completions_helpers.defaultCreateChatCompletionsToolCallDeltaAccumulator;
17
+ exports.defaultDescriptionToChatCompletionsJsonSchema = require_batteries_llm_openai_chat_completions_helpers.defaultDescriptionToChatCompletionsJsonSchema;
18
+ exports.defaultFilterThoughts = require_batteries_llm_openai_chat_completions_helpers.defaultFilterThoughts;
19
+ exports.defaultRenderChatCompletionsSystemPrompt = require_batteries_llm_openai_chat_completions_helpers.defaultRenderChatCompletionsSystemPrompt;
20
+ exports.defaultRenderChatCompletionsToolCallResult = require_batteries_llm_openai_chat_completions_helpers.defaultRenderChatCompletionsToolCallResult;
21
+ exports.defaultRenderFirstPartyRetrievables = require_batteries_llm_openai_chat_completions_helpers.defaultRenderFirstPartyRetrievables;
22
+ exports.defaultRenderMemories = require_batteries_llm_openai_chat_completions_helpers.defaultRenderMemories;
23
+ exports.defaultRenderRetrievableSafetyDirective = require_batteries_llm_openai_chat_completions_helpers.defaultRenderRetrievableSafetyDirective;
24
+ exports.defaultRenderRetrievables = require_batteries_llm_openai_chat_completions_helpers.defaultRenderRetrievables;
25
+ exports.defaultRenderStandingInstructions = require_batteries_llm_openai_chat_completions_helpers.defaultRenderStandingInstructions;
26
+ exports.defaultRenderThirdPartyPrivateRetrievables = require_batteries_llm_openai_chat_completions_helpers.defaultRenderThirdPartyPrivateRetrievables;
27
+ exports.defaultRenderThirdPartyPublicRetrievables = require_batteries_llm_openai_chat_completions_helpers.defaultRenderThirdPartyPublicRetrievables;
28
+ exports.defaultRenderThought = require_batteries_llm_openai_chat_completions_helpers.defaultRenderThought;
29
+ exports.defaultRenderTimelineMessage = require_batteries_llm_openai_chat_completions_helpers.defaultRenderTimelineMessage;
30
+ exports.defaultRenderTrustedContent = require_batteries_llm_openai_chat_completions_helpers.defaultRenderTrustedContent;
31
+ exports.defaultRenderUntrustedContent = require_batteries_llm_openai_chat_completions_helpers.defaultRenderUntrustedContent;
32
+ exports.defaultToolsToChatCompletionsTools = require_batteries_llm_openai_chat_completions_helpers.defaultToolsToChatCompletionsTools;
33
+ exports.descriptionToChatCompletionsJsonSchema = require_batteries_llm_openai_chat_completions_helpers.descriptionToChatCompletionsJsonSchema;
34
+ exports.filterThoughts = require_batteries_llm_openai_chat_completions_helpers.filterThoughts;
35
+ exports.renderChatCompletionsSystemPrompt = require_batteries_llm_openai_chat_completions_helpers.renderChatCompletionsSystemPrompt;
36
+ exports.renderChatCompletionsToolCallResult = require_batteries_llm_openai_chat_completions_helpers.renderChatCompletionsToolCallResult;
37
+ exports.renderFirstPartyRetrievables = require_batteries_llm_openai_chat_completions_helpers.renderFirstPartyRetrievables;
38
+ exports.renderMemories = require_batteries_llm_openai_chat_completions_helpers.renderMemories;
39
+ exports.renderRetrievableSafetyDirective = require_batteries_llm_openai_chat_completions_helpers.renderRetrievableSafetyDirective;
40
+ exports.renderRetrievables = require_batteries_llm_openai_chat_completions_helpers.renderRetrievables;
41
+ exports.renderStandingInstructions = require_batteries_llm_openai_chat_completions_helpers.renderStandingInstructions;
42
+ exports.renderThirdPartyPrivateRetrievables = require_batteries_llm_openai_chat_completions_helpers.renderThirdPartyPrivateRetrievables;
43
+ exports.renderThirdPartyPublicRetrievables = require_batteries_llm_openai_chat_completions_helpers.renderThirdPartyPublicRetrievables;
44
+ exports.renderThought = require_batteries_llm_openai_chat_completions_helpers.renderThought;
45
+ exports.renderTimelineMessage = require_batteries_llm_openai_chat_completions_helpers.renderTimelineMessage;
46
+ exports.renderTrustedContent = require_batteries_llm_openai_chat_completions_helpers.renderTrustedContent;
47
+ exports.renderUntrustedContent = require_batteries_llm_openai_chat_completions_helpers.renderUntrustedContent;
48
+ exports.toolsToChatCompletionsTools = require_batteries_llm_openai_chat_completions_helpers.toolsToChatCompletionsTools;
49
+ exports.validateOptions = require_batteries_llm_webllm_chat_completions_validation.validateOptions;
50
+ exports.webLLMChatCompletionsOptionsSchema = require_batteries_llm_webllm_chat_completions_validation.webLLMChatCompletionsOptionsSchema;
@@ -0,0 +1,6 @@
1
+ import { buildChatCompletionsHistory, createChatCompletionsToolCallDeltaAccumulator, defaultBuildChatCompletionsHistory, defaultCreateChatCompletionsToolCallDeltaAccumulator, defaultDescriptionToChatCompletionsJsonSchema, defaultFilterThoughts, defaultRenderChatCompletionsSystemPrompt, defaultRenderChatCompletionsToolCallResult, defaultRenderFirstPartyRetrievables, defaultRenderMemories, defaultRenderRetrievableSafetyDirective, defaultRenderRetrievables, defaultRenderStandingInstructions, defaultRenderThirdPartyPrivateRetrievables, defaultRenderThirdPartyPublicRetrievables, defaultRenderThought, defaultRenderTimelineMessage, defaultRenderTrustedContent, defaultRenderUntrustedContent, defaultToolsToChatCompletionsTools, descriptionToChatCompletionsJsonSchema, filterThoughts, renderChatCompletionsSystemPrompt, renderChatCompletionsToolCallResult, renderFirstPartyRetrievables, renderMemories, renderRetrievableSafetyDirective, renderRetrievables, renderStandingInstructions, renderThirdPartyPrivateRetrievables, renderThirdPartyPublicRetrievables, renderThought, renderTimelineMessage, renderTrustedContent, renderUntrustedContent, toolsToChatCompletionsTools } from "./openai_chat_completions/helpers.mjs";
2
+ import { E_INVALID_WEBLLM_CHAT_COMPLETIONS_OPTIONS, E_UNSUPPORTED_MEDIA_MODALITY, E_WEBLLM_CHAT_COMPLETIONS_CONTEXT_OVERFLOW, E_WEBLLM_CHAT_COMPLETIONS_INVALID_TOOL_CALL_ARGS, E_WEBLLM_CHAT_COMPLETIONS_STREAM_ERROR } from "./webllm_chat_completions/exceptions.mjs";
3
+ import { validateOptions, webLLMChatCompletionsOptionsSchema } from "./webllm_chat_completions/validation.mjs";
4
+ import "./webllm_chat_completions/helpers.mjs";
5
+ import { WebLLMChatCompletionsAdapter } from "./webllm_chat_completions/adapter.mjs";
6
+ export { E_INVALID_WEBLLM_CHAT_COMPLETIONS_OPTIONS, E_UNSUPPORTED_MEDIA_MODALITY, E_WEBLLM_CHAT_COMPLETIONS_CONTEXT_OVERFLOW, E_WEBLLM_CHAT_COMPLETIONS_INVALID_TOOL_CALL_ARGS, E_WEBLLM_CHAT_COMPLETIONS_STREAM_ERROR, WebLLMChatCompletionsAdapter, buildChatCompletionsHistory, createChatCompletionsToolCallDeltaAccumulator, defaultBuildChatCompletionsHistory, defaultCreateChatCompletionsToolCallDeltaAccumulator, defaultDescriptionToChatCompletionsJsonSchema, defaultFilterThoughts, defaultRenderChatCompletionsSystemPrompt, defaultRenderChatCompletionsToolCallResult, defaultRenderFirstPartyRetrievables, defaultRenderMemories, defaultRenderRetrievableSafetyDirective, defaultRenderRetrievables, defaultRenderStandingInstructions, defaultRenderThirdPartyPrivateRetrievables, defaultRenderThirdPartyPublicRetrievables, defaultRenderThought, defaultRenderTimelineMessage, defaultRenderTrustedContent, defaultRenderUntrustedContent, defaultToolsToChatCompletionsTools, descriptionToChatCompletionsJsonSchema, filterThoughts, renderChatCompletionsSystemPrompt, renderChatCompletionsToolCallResult, renderFirstPartyRetrievables, renderMemories, renderRetrievableSafetyDirective, renderRetrievables, renderStandingInstructions, renderThirdPartyPrivateRetrievables, renderThirdPartyPublicRetrievables, renderThought, renderTimelineMessage, renderTrustedContent, renderUntrustedContent, toolsToChatCompletionsTools, validateOptions, webLLMChatCompletionsOptionsSchema };
@@ -0,0 +1,63 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_batteries_llm_openai_chat_completions_exceptions = require("./llm/openai_chat_completions/exceptions.cjs");
3
+ const require_batteries_llm_openai_chat_completions_validation = require("./llm/openai_chat_completions/validation.cjs");
4
+ const require_batteries_llm_openai_chat_completions_helpers = require("./llm/openai_chat_completions/helpers.cjs");
5
+ const require_batteries_llm_openai_chat_completions_adapter = require("./llm/openai_chat_completions/adapter.cjs");
6
+ require("./llm/openai_chat_completions.cjs");
7
+ const require_batteries_llm_webllm_chat_completions_exceptions = require("./llm/webllm_chat_completions/exceptions.cjs");
8
+ const require_batteries_llm_webllm_chat_completions_validation = require("./llm/webllm_chat_completions/validation.cjs");
9
+ const require_batteries_llm_webllm_chat_completions_adapter = require("./llm/webllm_chat_completions/adapter.cjs");
10
+ require("./llm/webllm_chat_completions.cjs");
11
+ exports.E_INVALID_OPENAI_CHAT_COMPLETIONS_OPTIONS = require_batteries_llm_openai_chat_completions_exceptions.E_INVALID_OPENAI_CHAT_COMPLETIONS_OPTIONS;
12
+ exports.E_INVALID_WEBLLM_CHAT_COMPLETIONS_OPTIONS = require_batteries_llm_webllm_chat_completions_exceptions.E_INVALID_WEBLLM_CHAT_COMPLETIONS_OPTIONS;
13
+ exports.E_OPENAI_CHAT_COMPLETIONS_CONTEXT_OVERFLOW = require_batteries_llm_openai_chat_completions_exceptions.E_OPENAI_CHAT_COMPLETIONS_CONTEXT_OVERFLOW;
14
+ exports.E_OPENAI_CHAT_COMPLETIONS_HTTP_ERROR = require_batteries_llm_openai_chat_completions_exceptions.E_OPENAI_CHAT_COMPLETIONS_HTTP_ERROR;
15
+ exports.E_OPENAI_CHAT_COMPLETIONS_INVALID_TOOL_CALL_ARGS = require_batteries_llm_openai_chat_completions_exceptions.E_OPENAI_CHAT_COMPLETIONS_INVALID_TOOL_CALL_ARGS;
16
+ exports.E_OPENAI_CHAT_COMPLETIONS_REQUEST_TIMEOUT = require_batteries_llm_openai_chat_completions_exceptions.E_OPENAI_CHAT_COMPLETIONS_REQUEST_TIMEOUT;
17
+ exports.E_OPENAI_CHAT_COMPLETIONS_STREAM_ERROR = require_batteries_llm_openai_chat_completions_exceptions.E_OPENAI_CHAT_COMPLETIONS_STREAM_ERROR;
18
+ exports.E_OPENAI_CHAT_COMPLETIONS_STREAM_STALLED = require_batteries_llm_openai_chat_completions_exceptions.E_OPENAI_CHAT_COMPLETIONS_STREAM_STALLED;
19
+ exports.E_WEBLLM_CHAT_COMPLETIONS_CONTEXT_OVERFLOW = require_batteries_llm_webllm_chat_completions_exceptions.E_WEBLLM_CHAT_COMPLETIONS_CONTEXT_OVERFLOW;
20
+ exports.E_WEBLLM_CHAT_COMPLETIONS_INVALID_TOOL_CALL_ARGS = require_batteries_llm_webllm_chat_completions_exceptions.E_WEBLLM_CHAT_COMPLETIONS_INVALID_TOOL_CALL_ARGS;
21
+ exports.E_WEBLLM_CHAT_COMPLETIONS_STREAM_ERROR = require_batteries_llm_webllm_chat_completions_exceptions.E_WEBLLM_CHAT_COMPLETIONS_STREAM_ERROR;
22
+ exports.OpenAIChatCompletionsAdapter = require_batteries_llm_openai_chat_completions_adapter.OpenAIChatCompletionsAdapter;
23
+ exports.WebLLMChatCompletionsAdapter = require_batteries_llm_webllm_chat_completions_adapter.WebLLMChatCompletionsAdapter;
24
+ exports.buildChatCompletionsHistory = require_batteries_llm_openai_chat_completions_helpers.buildChatCompletionsHistory;
25
+ exports.createChatCompletionsToolCallDeltaAccumulator = require_batteries_llm_openai_chat_completions_helpers.createChatCompletionsToolCallDeltaAccumulator;
26
+ exports.defaultBuildChatCompletionsHistory = require_batteries_llm_openai_chat_completions_helpers.defaultBuildChatCompletionsHistory;
27
+ exports.defaultCreateChatCompletionsToolCallDeltaAccumulator = require_batteries_llm_openai_chat_completions_helpers.defaultCreateChatCompletionsToolCallDeltaAccumulator;
28
+ exports.defaultDescriptionToChatCompletionsJsonSchema = require_batteries_llm_openai_chat_completions_helpers.defaultDescriptionToChatCompletionsJsonSchema;
29
+ exports.defaultFilterThoughts = require_batteries_llm_openai_chat_completions_helpers.defaultFilterThoughts;
30
+ exports.defaultRenderChatCompletionsSystemPrompt = require_batteries_llm_openai_chat_completions_helpers.defaultRenderChatCompletionsSystemPrompt;
31
+ exports.defaultRenderChatCompletionsToolCallResult = require_batteries_llm_openai_chat_completions_helpers.defaultRenderChatCompletionsToolCallResult;
32
+ exports.defaultRenderFirstPartyRetrievables = require_batteries_llm_openai_chat_completions_helpers.defaultRenderFirstPartyRetrievables;
33
+ exports.defaultRenderMemories = require_batteries_llm_openai_chat_completions_helpers.defaultRenderMemories;
34
+ exports.defaultRenderRetrievableSafetyDirective = require_batteries_llm_openai_chat_completions_helpers.defaultRenderRetrievableSafetyDirective;
35
+ exports.defaultRenderRetrievables = require_batteries_llm_openai_chat_completions_helpers.defaultRenderRetrievables;
36
+ exports.defaultRenderStandingInstructions = require_batteries_llm_openai_chat_completions_helpers.defaultRenderStandingInstructions;
37
+ exports.defaultRenderThirdPartyPrivateRetrievables = require_batteries_llm_openai_chat_completions_helpers.defaultRenderThirdPartyPrivateRetrievables;
38
+ exports.defaultRenderThirdPartyPublicRetrievables = require_batteries_llm_openai_chat_completions_helpers.defaultRenderThirdPartyPublicRetrievables;
39
+ exports.defaultRenderThought = require_batteries_llm_openai_chat_completions_helpers.defaultRenderThought;
40
+ exports.defaultRenderTimelineMessage = require_batteries_llm_openai_chat_completions_helpers.defaultRenderTimelineMessage;
41
+ exports.defaultRenderTrustedContent = require_batteries_llm_openai_chat_completions_helpers.defaultRenderTrustedContent;
42
+ exports.defaultRenderUntrustedContent = require_batteries_llm_openai_chat_completions_helpers.defaultRenderUntrustedContent;
43
+ exports.defaultToolsToChatCompletionsTools = require_batteries_llm_openai_chat_completions_helpers.defaultToolsToChatCompletionsTools;
44
+ exports.descriptionToChatCompletionsJsonSchema = require_batteries_llm_openai_chat_completions_helpers.descriptionToChatCompletionsJsonSchema;
45
+ exports.filterThoughts = require_batteries_llm_openai_chat_completions_helpers.filterThoughts;
46
+ exports.openAIChatCompletionsOptionsSchema = require_batteries_llm_openai_chat_completions_validation.openAIChatCompletionsOptionsSchema;
47
+ exports.renderChatCompletionsSystemPrompt = require_batteries_llm_openai_chat_completions_helpers.renderChatCompletionsSystemPrompt;
48
+ exports.renderChatCompletionsToolCallResult = require_batteries_llm_openai_chat_completions_helpers.renderChatCompletionsToolCallResult;
49
+ exports.renderFirstPartyRetrievables = require_batteries_llm_openai_chat_completions_helpers.renderFirstPartyRetrievables;
50
+ exports.renderMemories = require_batteries_llm_openai_chat_completions_helpers.renderMemories;
51
+ exports.renderRetrievableSafetyDirective = require_batteries_llm_openai_chat_completions_helpers.renderRetrievableSafetyDirective;
52
+ exports.renderRetrievables = require_batteries_llm_openai_chat_completions_helpers.renderRetrievables;
53
+ exports.renderStandingInstructions = require_batteries_llm_openai_chat_completions_helpers.renderStandingInstructions;
54
+ exports.renderThirdPartyPrivateRetrievables = require_batteries_llm_openai_chat_completions_helpers.renderThirdPartyPrivateRetrievables;
55
+ exports.renderThirdPartyPublicRetrievables = require_batteries_llm_openai_chat_completions_helpers.renderThirdPartyPublicRetrievables;
56
+ exports.renderThought = require_batteries_llm_openai_chat_completions_helpers.renderThought;
57
+ exports.renderTimelineMessage = require_batteries_llm_openai_chat_completions_helpers.renderTimelineMessage;
58
+ exports.renderTrustedContent = require_batteries_llm_openai_chat_completions_helpers.renderTrustedContent;
59
+ exports.renderUntrustedContent = require_batteries_llm_openai_chat_completions_helpers.renderUntrustedContent;
60
+ exports.toolsToChatCompletionsTools = require_batteries_llm_openai_chat_completions_helpers.toolsToChatCompletionsTools;
61
+ exports.validateOptions = require_batteries_llm_openai_chat_completions_validation.validateOptions;
62
+ exports.validateWebLLMChatCompletionsOptions = require_batteries_llm_webllm_chat_completions_validation.validateOptions;
63
+ exports.webLLMChatCompletionsOptionsSchema = require_batteries_llm_webllm_chat_completions_validation.webLLMChatCompletionsOptionsSchema;
@@ -0,0 +1,10 @@
1
+ import { E_INVALID_OPENAI_CHAT_COMPLETIONS_OPTIONS, E_OPENAI_CHAT_COMPLETIONS_CONTEXT_OVERFLOW, E_OPENAI_CHAT_COMPLETIONS_HTTP_ERROR, E_OPENAI_CHAT_COMPLETIONS_INVALID_TOOL_CALL_ARGS, E_OPENAI_CHAT_COMPLETIONS_REQUEST_TIMEOUT, E_OPENAI_CHAT_COMPLETIONS_STREAM_ERROR, E_OPENAI_CHAT_COMPLETIONS_STREAM_STALLED } from "./llm/openai_chat_completions/exceptions.mjs";
2
+ import { openAIChatCompletionsOptionsSchema, validateOptions } from "./llm/openai_chat_completions/validation.mjs";
3
+ import { buildChatCompletionsHistory, createChatCompletionsToolCallDeltaAccumulator, defaultBuildChatCompletionsHistory, defaultCreateChatCompletionsToolCallDeltaAccumulator, defaultDescriptionToChatCompletionsJsonSchema, defaultFilterThoughts, defaultRenderChatCompletionsSystemPrompt, defaultRenderChatCompletionsToolCallResult, defaultRenderFirstPartyRetrievables, defaultRenderMemories, defaultRenderRetrievableSafetyDirective, defaultRenderRetrievables, defaultRenderStandingInstructions, defaultRenderThirdPartyPrivateRetrievables, defaultRenderThirdPartyPublicRetrievables, defaultRenderThought, defaultRenderTimelineMessage, defaultRenderTrustedContent, defaultRenderUntrustedContent, defaultToolsToChatCompletionsTools, descriptionToChatCompletionsJsonSchema, filterThoughts, renderChatCompletionsSystemPrompt, renderChatCompletionsToolCallResult, renderFirstPartyRetrievables, renderMemories, renderRetrievableSafetyDirective, renderRetrievables, renderStandingInstructions, renderThirdPartyPrivateRetrievables, renderThirdPartyPublicRetrievables, renderThought, renderTimelineMessage, renderTrustedContent, renderUntrustedContent, toolsToChatCompletionsTools } from "./llm/openai_chat_completions/helpers.mjs";
4
+ import { OpenAIChatCompletionsAdapter } from "./llm/openai_chat_completions/adapter.mjs";
5
+ import "./llm/openai_chat_completions.mjs";
6
+ import { E_INVALID_WEBLLM_CHAT_COMPLETIONS_OPTIONS, E_WEBLLM_CHAT_COMPLETIONS_CONTEXT_OVERFLOW, E_WEBLLM_CHAT_COMPLETIONS_INVALID_TOOL_CALL_ARGS, E_WEBLLM_CHAT_COMPLETIONS_STREAM_ERROR } from "./llm/webllm_chat_completions/exceptions.mjs";
7
+ import { validateOptions as validateOptions$1, webLLMChatCompletionsOptionsSchema } from "./llm/webllm_chat_completions/validation.mjs";
8
+ import { WebLLMChatCompletionsAdapter } from "./llm/webllm_chat_completions/adapter.mjs";
9
+ import "./llm/webllm_chat_completions.mjs";
10
+ export { E_INVALID_OPENAI_CHAT_COMPLETIONS_OPTIONS, E_INVALID_WEBLLM_CHAT_COMPLETIONS_OPTIONS, E_OPENAI_CHAT_COMPLETIONS_CONTEXT_OVERFLOW, E_OPENAI_CHAT_COMPLETIONS_HTTP_ERROR, E_OPENAI_CHAT_COMPLETIONS_INVALID_TOOL_CALL_ARGS, E_OPENAI_CHAT_COMPLETIONS_REQUEST_TIMEOUT, E_OPENAI_CHAT_COMPLETIONS_STREAM_ERROR, E_OPENAI_CHAT_COMPLETIONS_STREAM_STALLED, E_WEBLLM_CHAT_COMPLETIONS_CONTEXT_OVERFLOW, E_WEBLLM_CHAT_COMPLETIONS_INVALID_TOOL_CALL_ARGS, E_WEBLLM_CHAT_COMPLETIONS_STREAM_ERROR, OpenAIChatCompletionsAdapter, WebLLMChatCompletionsAdapter, buildChatCompletionsHistory, createChatCompletionsToolCallDeltaAccumulator, defaultBuildChatCompletionsHistory, defaultCreateChatCompletionsToolCallDeltaAccumulator, defaultDescriptionToChatCompletionsJsonSchema, defaultFilterThoughts, defaultRenderChatCompletionsSystemPrompt, defaultRenderChatCompletionsToolCallResult, defaultRenderFirstPartyRetrievables, defaultRenderMemories, defaultRenderRetrievableSafetyDirective, defaultRenderRetrievables, defaultRenderStandingInstructions, defaultRenderThirdPartyPrivateRetrievables, defaultRenderThirdPartyPublicRetrievables, defaultRenderThought, defaultRenderTimelineMessage, defaultRenderTrustedContent, defaultRenderUntrustedContent, defaultToolsToChatCompletionsTools, descriptionToChatCompletionsJsonSchema, filterThoughts, openAIChatCompletionsOptionsSchema, renderChatCompletionsSystemPrompt, renderChatCompletionsToolCallResult, renderFirstPartyRetrievables, renderMemories, renderRetrievableSafetyDirective, renderRetrievables, renderStandingInstructions, renderThirdPartyPrivateRetrievables, renderThirdPartyPublicRetrievables, renderThought, renderTimelineMessage, renderTrustedContent, renderUntrustedContent, toolsToChatCompletionsTools, validateOptions, validateOptions$1 as validateWebLLMChatCompletionsOptions, webLLMChatCompletionsOptionsSchema };
@@ -0,0 +1,167 @@
1
+ /**
2
+ * Flydrive-backed spooled artifact storage for Node and server runtimes.
3
+ *
4
+ * @module @nhtio/adk/batteries/storage/flydrive
5
+ *
6
+ * @remarks
7
+ * **Requires Node 24+.** `flydrive` uses the `node:stream` `ReadableStream` web API which is
8
+ * only available from Node 24. This battery does not work in the browser or earlier Node versions.
9
+ *
10
+ * Opt-in storage battery backed by [flydrive](https://flydrive.dev). Provides
11
+ * {@link FlydriveSpoolReader} (a {@link @nhtio/adk!SpoolReader} over a flydrive key) and
12
+ * {@link FlydriveSpoolStore} (a `write(callId, bytes) → reader` persistence layer that wraps an
13
+ * existing `Disk`).
14
+ *
15
+ * The reader has two modes selected at construction time based on the size of the underlying
16
+ * object:
17
+ *
18
+ * - **Eager mode** — when the object's `contentLength` is below `streamThresholdBytes` (default
19
+ * 10 MiB), the reader calls `disk.get(key)` once, splits the content on `\n`, and caches
20
+ * lines + byte count. All subsequent `line() / byteLength() / lineCount()` calls resolve from
21
+ * memory.
22
+ * - **Streaming mode** — when `contentLength` meets or exceeds the threshold, the reader
23
+ * streams the file once via `disk.getStream(key)` to build a line-offset index (`number[]`
24
+ * of byte offsets per line), then serves each `line(i)` request by streaming the byte range
25
+ * `[offsets[i], offsets[i+1])`. Caps RAM at one index + one line buffer regardless of file
26
+ * size.
27
+ *
28
+ * Set `streamThresholdBytes: 0` to force streaming mode; set it to `Infinity` to force eager
29
+ * mode. The default of 10 MiB matches typical tool output sizes — tune it for your workload.
30
+ *
31
+ * The store and reader are pure-flydrive: they don't know about S3, GCS, or filesystem
32
+ * specifically — they delegate to whatever `Disk` you construct.
33
+ */
34
+ import { Disk } from 'flydrive';
35
+ import type { SpoolReader } from "../../../common";
36
+ /**
37
+ * Constructor options for {@link FlydriveSpoolReader}.
38
+ */
39
+ export interface FlydriveSpoolReaderOptions {
40
+ /**
41
+ * Byte-length threshold that switches between eager and streaming modes.
42
+ *
43
+ * @remarks
44
+ * - Below the threshold → eager (whole-file in memory).
45
+ * - At or above the threshold → streaming (line-offset index + per-line streaming reads).
46
+ *
47
+ * Set to `0` to force streaming mode; set to `Number.POSITIVE_INFINITY` to force eager mode.
48
+ *
49
+ * @defaultValue `10 * 1024 * 1024` (10 MiB)
50
+ */
51
+ streamThresholdBytes?: number;
52
+ }
53
+ /**
54
+ * Reads a flydrive-backed file as a {@link @nhtio/adk!SpoolReader}.
55
+ *
56
+ * @remarks
57
+ * Constructor is **not** async — but the first method call awaits a private readiness promise
58
+ * that fetches the object's metadata (and in eager mode, its contents). Subsequent calls reuse
59
+ * the cached state. This keeps construction call sites synchronous while still doing real I/O
60
+ * lazily.
61
+ *
62
+ * Implementations of {@link @nhtio/adk!SpoolReader.line}, {@link @nhtio/adk!SpoolReader.byteLength}, and
63
+ * {@link @nhtio/adk!SpoolReader.lineCount} all return promises. The `SpoolReader` contract supports both
64
+ * sync and async return; consumers of `SpooledArtifact` handle either.
65
+ */
66
+ export declare class FlydriveSpoolReader implements SpoolReader {
67
+ #private;
68
+ constructor(disk: Disk, key: string, opts?: FlydriveSpoolReaderOptions);
69
+ line(index: number): Promise<string | undefined>;
70
+ byteLength(): Promise<number>;
71
+ lineCount(): Promise<number>;
72
+ /**
73
+ * Returns the full underlying content as a single decoded string, byte-faithful to the source.
74
+ *
75
+ * @remarks
76
+ * In **eager mode** the content is already cached at construction-time load and this method is
77
+ * effectively a property access. In **streaming mode** there is no cache: the file is
78
+ * re-streamed and concatenated on every call. Use {@link @nhtio/adk!SpooledArtifact.asString} judiciously
79
+ * on large streaming-mode artifacts.
80
+ */
81
+ readAll(): Promise<string>;
82
+ }
83
+ /**
84
+ * Constructor options for {@link FlydriveSpoolStore}.
85
+ */
86
+ export interface FlydriveSpoolStoreOptions {
87
+ /**
88
+ * Optional key prefix prepended to every `callId`. Useful for namespacing tool-call artifacts
89
+ * inside a shared bucket (e.g. `"tool-calls/"`).
90
+ *
91
+ * @defaultValue `""`
92
+ */
93
+ keyPrefix?: string;
94
+ /**
95
+ * Default `streamThresholdBytes` for readers produced by `write()` and `read()`. Individual
96
+ * calls may override via their own `opts` argument.
97
+ *
98
+ * @defaultValue `10 * 1024 * 1024` (10 MiB)
99
+ */
100
+ streamThresholdBytes?: number;
101
+ }
102
+ /**
103
+ * "Give bytes, get a reader" persistence layer over a flydrive {@link Disk}.
104
+ *
105
+ * @remarks
106
+ * `write(callId, bytes)` calls `disk.put(key, bytes)` where `key = keyPrefix + callId`, then
107
+ * returns a fresh {@link FlydriveSpoolReader} pointed at the same key. `read(callId)` returns
108
+ * a reader without re-writing; `delete(callId)` calls `disk.delete(key)`.
109
+ *
110
+ * The store is stateless — it owns no in-memory cache of writes. Multiple `FlydriveSpoolStore`
111
+ * instances sharing the same disk + key prefix see the same data.
112
+ *
113
+ * @example
114
+ * ```ts
115
+ * import { Disk } from 'flydrive'
116
+ * import { FSDriver } from 'flydrive/drivers/fs'
117
+ * import { FlydriveSpoolStore } from '@nhtio/adk/batteries/storage/flydrive'
118
+ *
119
+ * const disk = new Disk(new FSDriver({ location: './tmp', visibility: 'public' }))
120
+ * const store = new FlydriveSpoolStore(disk)
121
+ *
122
+ * const bytes = await tool.executor(ctx)(args)
123
+ * const reader = await store.write(callId, bytes)
124
+ * const Ctor = tool.artifactConstructor?.() ?? SpooledArtifact
125
+ * const artifact = new Ctor(reader)
126
+ * ```
127
+ */
128
+ export declare class FlydriveSpoolStore {
129
+ #private;
130
+ constructor(disk: Disk, opts?: FlydriveSpoolStoreOptions);
131
+ /**
132
+ * Persists `bytes` under `callId` and returns a reader bound to the stored key.
133
+ *
134
+ * @param callId - Identifier used to retrieve the bytes via {@link FlydriveSpoolStore.read}.
135
+ * @param bytes - The bytes to store, as a `string` or `Uint8Array`.
136
+ * @param opts - Per-call override for `streamThresholdBytes`.
137
+ * @returns A {@link FlydriveSpoolReader} over the stored bytes.
138
+ */
139
+ write(callId: string, bytes: string | Uint8Array, opts?: FlydriveSpoolReaderOptions): Promise<FlydriveSpoolReader>;
140
+ /**
141
+ * Returns a reader over the bytes previously written under `callId`.
142
+ *
143
+ * @remarks
144
+ * Returns `undefined` if the underlying key does not exist. Existence is checked via
145
+ * `disk.exists(key)` before the reader is returned, so callers can rely on a defined return
146
+ * value pointing at a real object.
147
+ *
148
+ * @param callId - Identifier supplied to a prior {@link FlydriveSpoolStore.write} call.
149
+ * @param opts - Per-call override for `streamThresholdBytes`.
150
+ * @returns A {@link FlydriveSpoolReader}, or `undefined` if the key is missing.
151
+ */
152
+ read(callId: string, opts?: FlydriveSpoolReaderOptions): Promise<FlydriveSpoolReader | undefined>;
153
+ /**
154
+ * Removes the entry under `callId`.
155
+ *
156
+ * @param callId - Identifier whose entry should be removed.
157
+ * @returns `true` if the key existed and was removed; `false` if it didn't exist.
158
+ */
159
+ delete(callId: string): Promise<boolean>;
160
+ /**
161
+ * Returns the full disk key for a given `callId` (i.e. `keyPrefix + callId`).
162
+ *
163
+ * @remarks
164
+ * Useful for tests or for callers that want to interact with the underlying disk directly.
165
+ */
166
+ keyFor(callId: string): string;
167
+ }