@soederpop/luca 0.1.2 → 0.2.1

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 (381) hide show
  1. package/.github/workflows/release.yaml +167 -0
  2. package/CLAUDE.md +2 -0
  3. package/README.md +3 -0
  4. package/assistants/codingAssistant/ABOUT.md +3 -0
  5. package/assistants/codingAssistant/CORE.md +22 -17
  6. package/assistants/codingAssistant/hooks.ts +17 -4
  7. package/assistants/codingAssistant/tools.ts +1 -106
  8. package/assistants/inkbot/ABOUT.md +5 -0
  9. package/assistants/inkbot/CORE.md +71 -0
  10. package/assistants/inkbot/hooks.ts +14 -0
  11. package/assistants/inkbot/tools.ts +47 -0
  12. package/bun.lock +20 -4
  13. package/commands/inkbot.ts +353 -0
  14. package/commands/release.ts +75 -181
  15. package/dist/agi/container.server.d.ts +63 -0
  16. package/dist/agi/container.server.d.ts.map +1 -0
  17. package/dist/agi/endpoints/ask.d.ts +20 -0
  18. package/dist/agi/endpoints/ask.d.ts.map +1 -0
  19. package/dist/agi/endpoints/conversations/[id].d.ts +27 -0
  20. package/dist/agi/endpoints/conversations/[id].d.ts.map +1 -0
  21. package/dist/agi/endpoints/conversations.d.ts +18 -0
  22. package/dist/agi/endpoints/conversations.d.ts.map +1 -0
  23. package/dist/agi/endpoints/experts.d.ts +8 -0
  24. package/dist/agi/endpoints/experts.d.ts.map +1 -0
  25. package/dist/agi/feature.d.ts +9 -0
  26. package/dist/agi/feature.d.ts.map +1 -0
  27. package/dist/agi/features/assistant.d.ts +509 -0
  28. package/dist/agi/features/assistant.d.ts.map +1 -0
  29. package/dist/agi/features/assistants-manager.d.ts +236 -0
  30. package/dist/agi/features/assistants-manager.d.ts.map +1 -0
  31. package/dist/agi/features/autonomous-assistant.d.ts +281 -0
  32. package/dist/agi/features/autonomous-assistant.d.ts.map +1 -0
  33. package/dist/agi/features/browser-use.d.ts +479 -0
  34. package/dist/agi/features/browser-use.d.ts.map +1 -0
  35. package/dist/agi/features/claude-code.d.ts +824 -0
  36. package/dist/agi/features/claude-code.d.ts.map +1 -0
  37. package/dist/agi/features/conversation-history.d.ts +245 -0
  38. package/dist/agi/features/conversation-history.d.ts.map +1 -0
  39. package/dist/agi/features/conversation.d.ts +464 -0
  40. package/dist/agi/features/conversation.d.ts.map +1 -0
  41. package/dist/agi/features/docs-reader.d.ts +72 -0
  42. package/dist/agi/features/docs-reader.d.ts.map +1 -0
  43. package/dist/agi/features/file-tools.d.ts +110 -0
  44. package/dist/agi/features/file-tools.d.ts.map +1 -0
  45. package/dist/agi/features/luca-coder.d.ts +323 -0
  46. package/dist/agi/features/luca-coder.d.ts.map +1 -0
  47. package/dist/agi/features/openai-codex.d.ts +381 -0
  48. package/dist/agi/features/openai-codex.d.ts.map +1 -0
  49. package/dist/agi/features/openapi.d.ts +200 -0
  50. package/dist/agi/features/openapi.d.ts.map +1 -0
  51. package/dist/agi/features/skills-library.d.ts +167 -0
  52. package/dist/agi/features/skills-library.d.ts.map +1 -0
  53. package/dist/agi/index.d.ts +5 -0
  54. package/dist/agi/index.d.ts.map +1 -0
  55. package/dist/agi/lib/interceptor-chain.d.ts +44 -0
  56. package/dist/agi/lib/interceptor-chain.d.ts.map +1 -0
  57. package/dist/agi/lib/token-counter.d.ts +13 -0
  58. package/dist/agi/lib/token-counter.d.ts.map +1 -0
  59. package/dist/bootstrap/generated.d.ts +5 -0
  60. package/dist/bootstrap/generated.d.ts.map +1 -0
  61. package/dist/browser.d.ts +12 -0
  62. package/dist/browser.d.ts.map +1 -0
  63. package/dist/bus.d.ts +29 -0
  64. package/dist/bus.d.ts.map +1 -0
  65. package/dist/cli/build-info.d.ts +4 -0
  66. package/dist/cli/build-info.d.ts.map +1 -0
  67. package/dist/cli/cli.d.ts +3 -0
  68. package/dist/cli/cli.d.ts.map +1 -0
  69. package/dist/client.d.ts +60 -0
  70. package/dist/client.d.ts.map +1 -0
  71. package/dist/clients/civitai/index.d.ts +472 -0
  72. package/dist/clients/civitai/index.d.ts.map +1 -0
  73. package/dist/clients/client-template.d.ts +30 -0
  74. package/dist/clients/client-template.d.ts.map +1 -0
  75. package/dist/clients/comfyui/index.d.ts +281 -0
  76. package/dist/clients/comfyui/index.d.ts.map +1 -0
  77. package/dist/clients/elevenlabs/index.d.ts +197 -0
  78. package/dist/clients/elevenlabs/index.d.ts.map +1 -0
  79. package/dist/clients/graph.d.ts +64 -0
  80. package/dist/clients/graph.d.ts.map +1 -0
  81. package/dist/clients/openai/index.d.ts +247 -0
  82. package/dist/clients/openai/index.d.ts.map +1 -0
  83. package/dist/clients/rest.d.ts +92 -0
  84. package/dist/clients/rest.d.ts.map +1 -0
  85. package/dist/clients/supabase/index.d.ts +176 -0
  86. package/dist/clients/supabase/index.d.ts.map +1 -0
  87. package/dist/clients/websocket.d.ts +127 -0
  88. package/dist/clients/websocket.d.ts.map +1 -0
  89. package/dist/command.d.ts +163 -0
  90. package/dist/command.d.ts.map +1 -0
  91. package/dist/commands/bootstrap.d.ts +20 -0
  92. package/dist/commands/bootstrap.d.ts.map +1 -0
  93. package/dist/commands/chat.d.ts +37 -0
  94. package/dist/commands/chat.d.ts.map +1 -0
  95. package/dist/commands/code.d.ts +28 -0
  96. package/dist/commands/code.d.ts.map +1 -0
  97. package/dist/commands/console.d.ts +22 -0
  98. package/dist/commands/console.d.ts.map +1 -0
  99. package/dist/commands/describe.d.ts +50 -0
  100. package/dist/commands/describe.d.ts.map +1 -0
  101. package/dist/commands/eval.d.ts +23 -0
  102. package/dist/commands/eval.d.ts.map +1 -0
  103. package/dist/commands/help.d.ts +25 -0
  104. package/dist/commands/help.d.ts.map +1 -0
  105. package/dist/commands/index.d.ts +18 -0
  106. package/dist/commands/index.d.ts.map +1 -0
  107. package/dist/commands/introspect.d.ts +24 -0
  108. package/dist/commands/introspect.d.ts.map +1 -0
  109. package/dist/commands/mcp.d.ts +35 -0
  110. package/dist/commands/mcp.d.ts.map +1 -0
  111. package/dist/commands/prompt.d.ts +38 -0
  112. package/dist/commands/prompt.d.ts.map +1 -0
  113. package/dist/commands/run.d.ts +24 -0
  114. package/dist/commands/run.d.ts.map +1 -0
  115. package/dist/commands/sandbox-mcp.d.ts +34 -0
  116. package/dist/commands/sandbox-mcp.d.ts.map +1 -0
  117. package/dist/commands/save-api-docs.d.ts +21 -0
  118. package/dist/commands/save-api-docs.d.ts.map +1 -0
  119. package/dist/commands/scaffold.d.ts +24 -0
  120. package/dist/commands/scaffold.d.ts.map +1 -0
  121. package/dist/commands/select.d.ts +22 -0
  122. package/dist/commands/select.d.ts.map +1 -0
  123. package/dist/commands/serve.d.ts +29 -0
  124. package/dist/commands/serve.d.ts.map +1 -0
  125. package/dist/container-describer.d.ts +144 -0
  126. package/dist/container-describer.d.ts.map +1 -0
  127. package/dist/container.d.ts +451 -0
  128. package/dist/container.d.ts.map +1 -0
  129. package/dist/endpoint.d.ts +113 -0
  130. package/dist/endpoint.d.ts.map +1 -0
  131. package/dist/feature.d.ts +47 -0
  132. package/dist/feature.d.ts.map +1 -0
  133. package/dist/graft.d.ts +29 -0
  134. package/dist/graft.d.ts.map +1 -0
  135. package/dist/hash-object.d.ts +8 -0
  136. package/dist/hash-object.d.ts.map +1 -0
  137. package/dist/helper.d.ts +209 -0
  138. package/dist/helper.d.ts.map +1 -0
  139. package/dist/introspection/generated.node.d.ts +44623 -0
  140. package/dist/introspection/generated.node.d.ts.map +1 -0
  141. package/dist/introspection/generated.web.d.ts +1412 -0
  142. package/dist/introspection/generated.web.d.ts.map +1 -0
  143. package/dist/introspection/index.d.ts +156 -0
  144. package/dist/introspection/index.d.ts.map +1 -0
  145. package/dist/introspection/scan.d.ts +147 -0
  146. package/dist/introspection/scan.d.ts.map +1 -0
  147. package/dist/node/container.d.ts +256 -0
  148. package/dist/node/container.d.ts.map +1 -0
  149. package/dist/node/feature.d.ts +9 -0
  150. package/dist/node/feature.d.ts.map +1 -0
  151. package/dist/node/features/container-link.d.ts +213 -0
  152. package/dist/node/features/container-link.d.ts.map +1 -0
  153. package/dist/node/features/content-db.d.ts +354 -0
  154. package/dist/node/features/content-db.d.ts.map +1 -0
  155. package/dist/node/features/disk-cache.d.ts +236 -0
  156. package/dist/node/features/disk-cache.d.ts.map +1 -0
  157. package/dist/node/features/dns.d.ts +511 -0
  158. package/dist/node/features/dns.d.ts.map +1 -0
  159. package/dist/node/features/docker.d.ts +485 -0
  160. package/dist/node/features/docker.d.ts.map +1 -0
  161. package/dist/node/features/downloader.d.ts +73 -0
  162. package/dist/node/features/downloader.d.ts.map +1 -0
  163. package/dist/node/features/figlet-fonts.d.ts +4 -0
  164. package/dist/node/features/figlet-fonts.d.ts.map +1 -0
  165. package/dist/node/features/file-manager.d.ts +177 -0
  166. package/dist/node/features/file-manager.d.ts.map +1 -0
  167. package/dist/node/features/fs.d.ts +635 -0
  168. package/dist/node/features/fs.d.ts.map +1 -0
  169. package/dist/node/features/git.d.ts +329 -0
  170. package/dist/node/features/git.d.ts.map +1 -0
  171. package/dist/node/features/google-auth.d.ts +200 -0
  172. package/dist/node/features/google-auth.d.ts.map +1 -0
  173. package/dist/node/features/google-calendar.d.ts +194 -0
  174. package/dist/node/features/google-calendar.d.ts.map +1 -0
  175. package/dist/node/features/google-docs.d.ts +138 -0
  176. package/dist/node/features/google-docs.d.ts.map +1 -0
  177. package/dist/node/features/google-drive.d.ts +202 -0
  178. package/dist/node/features/google-drive.d.ts.map +1 -0
  179. package/dist/node/features/google-mail.d.ts +221 -0
  180. package/dist/node/features/google-mail.d.ts.map +1 -0
  181. package/dist/node/features/google-sheets.d.ts +157 -0
  182. package/dist/node/features/google-sheets.d.ts.map +1 -0
  183. package/dist/node/features/grep.d.ts +207 -0
  184. package/dist/node/features/grep.d.ts.map +1 -0
  185. package/dist/node/features/helpers.d.ts +236 -0
  186. package/dist/node/features/helpers.d.ts.map +1 -0
  187. package/dist/node/features/ink.d.ts +332 -0
  188. package/dist/node/features/ink.d.ts.map +1 -0
  189. package/dist/node/features/ipc-socket.d.ts +298 -0
  190. package/dist/node/features/ipc-socket.d.ts.map +1 -0
  191. package/dist/node/features/json-tree.d.ts +140 -0
  192. package/dist/node/features/json-tree.d.ts.map +1 -0
  193. package/dist/node/features/networking.d.ts +373 -0
  194. package/dist/node/features/networking.d.ts.map +1 -0
  195. package/dist/node/features/nlp.d.ts +125 -0
  196. package/dist/node/features/nlp.d.ts.map +1 -0
  197. package/dist/node/features/opener.d.ts +93 -0
  198. package/dist/node/features/opener.d.ts.map +1 -0
  199. package/dist/node/features/os.d.ts +168 -0
  200. package/dist/node/features/os.d.ts.map +1 -0
  201. package/dist/node/features/package-finder.d.ts +419 -0
  202. package/dist/node/features/package-finder.d.ts.map +1 -0
  203. package/dist/node/features/postgres.d.ts +173 -0
  204. package/dist/node/features/postgres.d.ts.map +1 -0
  205. package/dist/node/features/proc.d.ts +285 -0
  206. package/dist/node/features/proc.d.ts.map +1 -0
  207. package/dist/node/features/process-manager.d.ts +427 -0
  208. package/dist/node/features/process-manager.d.ts.map +1 -0
  209. package/dist/node/features/python.d.ts +477 -0
  210. package/dist/node/features/python.d.ts.map +1 -0
  211. package/dist/node/features/redis.d.ts +247 -0
  212. package/dist/node/features/redis.d.ts.map +1 -0
  213. package/dist/node/features/repl.d.ts +84 -0
  214. package/dist/node/features/repl.d.ts.map +1 -0
  215. package/dist/node/features/runpod.d.ts +527 -0
  216. package/dist/node/features/runpod.d.ts.map +1 -0
  217. package/dist/node/features/secure-shell.d.ts +145 -0
  218. package/dist/node/features/secure-shell.d.ts.map +1 -0
  219. package/dist/node/features/semantic-search.d.ts +207 -0
  220. package/dist/node/features/semantic-search.d.ts.map +1 -0
  221. package/dist/node/features/sqlite.d.ts +180 -0
  222. package/dist/node/features/sqlite.d.ts.map +1 -0
  223. package/dist/node/features/telegram.d.ts +173 -0
  224. package/dist/node/features/telegram.d.ts.map +1 -0
  225. package/dist/node/features/transpiler.d.ts +51 -0
  226. package/dist/node/features/transpiler.d.ts.map +1 -0
  227. package/dist/node/features/tts.d.ts +108 -0
  228. package/dist/node/features/tts.d.ts.map +1 -0
  229. package/dist/node/features/ui.d.ts +562 -0
  230. package/dist/node/features/ui.d.ts.map +1 -0
  231. package/dist/node/features/vault.d.ts +90 -0
  232. package/dist/node/features/vault.d.ts.map +1 -0
  233. package/dist/node/features/vm.d.ts +285 -0
  234. package/dist/node/features/vm.d.ts.map +1 -0
  235. package/dist/node/features/yaml-tree.d.ts +118 -0
  236. package/dist/node/features/yaml-tree.d.ts.map +1 -0
  237. package/dist/node/features/yaml.d.ts +127 -0
  238. package/dist/node/features/yaml.d.ts.map +1 -0
  239. package/dist/node.d.ts +67 -0
  240. package/dist/node.d.ts.map +1 -0
  241. package/dist/python/generated.d.ts +2 -0
  242. package/dist/python/generated.d.ts.map +1 -0
  243. package/dist/react/index.d.ts +36 -0
  244. package/dist/react/index.d.ts.map +1 -0
  245. package/dist/registry.d.ts +97 -0
  246. package/dist/registry.d.ts.map +1 -0
  247. package/dist/scaffolds/generated.d.ts +13 -0
  248. package/dist/scaffolds/generated.d.ts.map +1 -0
  249. package/dist/scaffolds/template.d.ts +11 -0
  250. package/dist/scaffolds/template.d.ts.map +1 -0
  251. package/dist/schemas/base.d.ts +254 -0
  252. package/dist/schemas/base.d.ts.map +1 -0
  253. package/dist/selector.d.ts +130 -0
  254. package/dist/selector.d.ts.map +1 -0
  255. package/dist/server.d.ts +89 -0
  256. package/dist/server.d.ts.map +1 -0
  257. package/dist/servers/express.d.ts +104 -0
  258. package/dist/servers/express.d.ts.map +1 -0
  259. package/dist/servers/mcp.d.ts +201 -0
  260. package/dist/servers/mcp.d.ts.map +1 -0
  261. package/dist/servers/socket.d.ts +121 -0
  262. package/dist/servers/socket.d.ts.map +1 -0
  263. package/dist/state.d.ts +24 -0
  264. package/dist/state.d.ts.map +1 -0
  265. package/dist/web/clients/socket.d.ts +37 -0
  266. package/dist/web/clients/socket.d.ts.map +1 -0
  267. package/dist/web/container.d.ts +55 -0
  268. package/dist/web/container.d.ts.map +1 -0
  269. package/dist/web/extension.d.ts +4 -0
  270. package/dist/web/extension.d.ts.map +1 -0
  271. package/dist/web/feature.d.ts +8 -0
  272. package/dist/web/feature.d.ts.map +1 -0
  273. package/dist/web/features/asset-loader.d.ts +35 -0
  274. package/dist/web/features/asset-loader.d.ts.map +1 -0
  275. package/dist/web/features/container-link.d.ts +167 -0
  276. package/dist/web/features/container-link.d.ts.map +1 -0
  277. package/dist/web/features/esbuild.d.ts +51 -0
  278. package/dist/web/features/esbuild.d.ts.map +1 -0
  279. package/dist/web/features/helpers.d.ts +140 -0
  280. package/dist/web/features/helpers.d.ts.map +1 -0
  281. package/dist/web/features/network.d.ts +69 -0
  282. package/dist/web/features/network.d.ts.map +1 -0
  283. package/dist/web/features/speech.d.ts +71 -0
  284. package/dist/web/features/speech.d.ts.map +1 -0
  285. package/dist/web/features/vault.d.ts +62 -0
  286. package/dist/web/features/vault.d.ts.map +1 -0
  287. package/dist/web/features/vm.d.ts +48 -0
  288. package/dist/web/features/vm.d.ts.map +1 -0
  289. package/dist/web/features/voice-recognition.d.ts +96 -0
  290. package/dist/web/features/voice-recognition.d.ts.map +1 -0
  291. package/dist/web/shims/isomorphic-vm.d.ts +22 -0
  292. package/dist/web/shims/isomorphic-vm.d.ts.map +1 -0
  293. package/docs/apis/features/agi/assistant.md +1 -0
  294. package/docs/apis/features/agi/assistants-manager.md +62 -2
  295. package/docs/apis/features/agi/auto-assistant.md +11 -109
  296. package/docs/apis/features/agi/claude-code.md +138 -0
  297. package/docs/apis/features/agi/conversation.md +60 -31
  298. package/docs/apis/features/agi/luca-coder.md +407 -0
  299. package/docs/apis/features/agi/openapi.md +2 -2
  300. package/docs/apis/features/agi/skills-library.md +12 -0
  301. package/docs/apis/features/node/python.md +81 -11
  302. package/docs/apis/features/node/transpiler.md +74 -0
  303. package/docs/apis/features/web/esbuild.md +0 -6
  304. package/docs/apis/servers/mcp.md +2 -2
  305. package/docs/examples/entity.md +124 -0
  306. package/docs/ideas/assistant-factory-pattern.md +142 -0
  307. package/package.json +74 -21
  308. package/src/agi/container.server.ts +10 -0
  309. package/src/agi/feature.ts +13 -0
  310. package/src/agi/features/agent-memory.ts +694 -0
  311. package/src/agi/features/assistant.ts +37 -26
  312. package/src/agi/features/assistants-manager.ts +95 -5
  313. package/src/agi/features/autonomous-assistant.ts +1 -5
  314. package/src/agi/features/browser-use.ts +32 -2
  315. package/src/agi/features/claude-code.ts +165 -1
  316. package/src/agi/features/coding-tools.ts +175 -0
  317. package/src/agi/features/conversation-history.ts +2 -6
  318. package/src/agi/features/conversation.ts +95 -3
  319. package/src/agi/features/docs-reader.ts +2 -1
  320. package/src/agi/features/file-tools.ts +35 -28
  321. package/src/agi/features/luca-coder.ts +1 -5
  322. package/src/agi/features/openai-codex.ts +1 -1
  323. package/src/agi/features/openapi.ts +3 -3
  324. package/src/agi/features/skills-library.ts +111 -13
  325. package/src/agi/lib/interceptor-chain.ts +10 -0
  326. package/src/agi/lib/token-counter.ts +1 -1
  327. package/src/bootstrap/generated.ts +126 -1
  328. package/src/bus.ts +27 -5
  329. package/src/cli/build-info.ts +2 -2
  330. package/src/client.ts +2 -2
  331. package/src/clients/elevenlabs/index.ts +5 -0
  332. package/src/clients/voicebox/index.ts +300 -0
  333. package/src/commands/bootstrap.ts +2 -1
  334. package/src/commands/chat.ts +1 -0
  335. package/src/commands/code.ts +4 -2
  336. package/src/commands/prompt.ts +34 -34
  337. package/src/commands/sandbox-mcp.ts +69 -163
  338. package/src/commands/save-api-docs.ts +10 -8
  339. package/src/commands/select.ts +8 -3
  340. package/src/container-describer.ts +70 -84
  341. package/src/container.ts +93 -3
  342. package/src/endpoint.ts +1 -1
  343. package/src/entity.ts +173 -0
  344. package/src/feature.ts +3 -3
  345. package/src/helper.ts +8 -4
  346. package/src/introspection/generated.agi.ts +3012 -1356
  347. package/src/introspection/generated.node.ts +179 -33
  348. package/src/introspection/generated.web.ts +95 -3
  349. package/src/introspection/scan.ts +1 -1
  350. package/src/node/container.ts +1 -1
  351. package/src/node/features/content-db.ts +57 -30
  352. package/src/node/features/file-manager.ts +10 -9
  353. package/src/node/features/git.ts +5 -5
  354. package/src/node/features/helpers.ts +1 -1
  355. package/src/node/features/json-tree.ts +1 -1
  356. package/src/node/features/os.ts +3 -3
  357. package/src/node/features/package-finder.ts +1 -1
  358. package/src/node/features/process-manager.ts +51 -18
  359. package/src/node/features/python.ts +3 -3
  360. package/src/node/features/redis.ts +1 -1
  361. package/src/node/features/repl.ts +2 -2
  362. package/src/node/features/transpiler.ts +2 -2
  363. package/src/node/features/ui.ts +1 -1
  364. package/src/node/features/vm.ts +3 -3
  365. package/src/node/features/yaml-tree.ts +1 -1
  366. package/src/node.ts +1 -0
  367. package/src/python/generated.ts +1 -1
  368. package/src/scaffolds/generated.ts +1 -1
  369. package/src/selector.ts +74 -4
  370. package/src/server.ts +2 -2
  371. package/src/servers/mcp.ts +6 -6
  372. package/src/web/features/helpers.ts +1 -1
  373. package/src/web/features/network.ts +1 -0
  374. package/test/assistant.test.ts +14 -5
  375. package/test/conversation.test.ts +220 -0
  376. package/test-integration/memory.test.ts +204 -0
  377. package/tsconfig.build.json +12 -0
  378. package/tsconfig.json +1 -1
  379. package/scripts/examples/telegram-ink-ui.ts +0 -302
  380. package/scripts/examples/using-openai-codex.ts +0 -23
  381. package/scripts/examples/vm-loading-esm-modules.ts +0 -16
@@ -0,0 +1,90 @@
1
+ import { z } from 'zod';
2
+ import { Feature } from '../feature.js';
3
+ import { type ContainerContext } from '../../container.js';
4
+ export declare const VaultStateSchema: z.ZodObject<{
5
+ enabled: z.ZodDefault<z.ZodBoolean>;
6
+ secret: z.ZodOptional<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>;
7
+ }, z.core.$loose>;
8
+ export type VaultState = z.infer<typeof VaultStateSchema>;
9
+ export declare const VaultOptionsSchema: z.ZodObject<{
10
+ name: z.ZodOptional<z.ZodString>;
11
+ _cacheKey: z.ZodOptional<z.ZodString>;
12
+ cached: z.ZodOptional<z.ZodBoolean>;
13
+ enable: z.ZodOptional<z.ZodBoolean>;
14
+ secret: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>, z.ZodString]>>;
15
+ }, z.core.$strip>;
16
+ export type VaultOptions = z.infer<typeof VaultOptionsSchema>;
17
+ /**
18
+ * The Vault feature provides encryption and decryption capabilities using AES-256-GCM.
19
+ *
20
+ * This feature allows you to securely encrypt and decrypt sensitive data using
21
+ * industry-standard encryption. It manages secret keys and provides a simple
22
+ * interface for cryptographic operations.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const vault = container.feature('vault')
27
+ *
28
+ * // Encrypt sensitive data
29
+ * const encrypted = vault.encrypt('sensitive information')
30
+ * console.log(encrypted) // Base64 encoded encrypted data
31
+ *
32
+ * // Decrypt the data
33
+ * const decrypted = vault.decrypt(encrypted)
34
+ * console.log(decrypted) // 'sensitive information'
35
+ * ```
36
+ *
37
+ * @extends Feature
38
+ */
39
+ export declare class Vault extends Feature<VaultState, VaultOptions> {
40
+ static shortcut: "features.vault";
41
+ static stateSchema: z.ZodObject<{
42
+ enabled: z.ZodDefault<z.ZodBoolean>;
43
+ secret: z.ZodOptional<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>;
44
+ }, z.core.$loose>;
45
+ static optionsSchema: z.ZodObject<{
46
+ name: z.ZodOptional<z.ZodString>;
47
+ _cacheKey: z.ZodOptional<z.ZodString>;
48
+ cached: z.ZodOptional<z.ZodBoolean>;
49
+ enable: z.ZodOptional<z.ZodBoolean>;
50
+ secret: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>, z.ZodString]>>;
51
+ }, z.core.$strip>;
52
+ constructor(options: VaultOptions, context: ContainerContext);
53
+ /**
54
+ * Gets the secret key as a base64-encoded string.
55
+ *
56
+ * @returns {string | undefined} The secret key encoded as base64, or undefined if no secret is set
57
+ */
58
+ get secretText(): string;
59
+ /**
60
+ * Gets or generates a secret key for encryption operations.
61
+ *
62
+ * @param {object} [options={}] - Options for secret key handling
63
+ * @param {boolean} [options.refresh=false] - Whether to generate a new secret key
64
+ * @param {boolean} [options.set=true] - Whether to store the generated key in state
65
+ * @returns {Buffer} The secret key as a Buffer
66
+ */
67
+ secret({ refresh, set }?: {
68
+ refresh?: boolean | undefined;
69
+ set?: boolean | undefined;
70
+ }): Buffer;
71
+ /**
72
+ * Decrypts an encrypted payload that was created by the encrypt method.
73
+ *
74
+ * @param {string} payload - The encrypted payload to decrypt (base64 encoded with delimiters)
75
+ * @returns {string} The decrypted plaintext
76
+ * @throws {Error} Throws an error if decryption fails or the payload is malformed
77
+ */
78
+ decrypt(payload: string): string;
79
+ /**
80
+ * Encrypts a plaintext string using AES-256-GCM encryption.
81
+ *
82
+ * @param {string} payload - The plaintext string to encrypt
83
+ * @returns {string} The encrypted payload as a base64 encoded string with delimiters
84
+ */
85
+ encrypt(payload: string): string;
86
+ private _encrypt;
87
+ private _decrypt;
88
+ }
89
+ export default Vault;
90
+ //# sourceMappingURL=vault.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vault.d.ts","sourceRoot":"","sources":["../../../src/node/features/vault.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAA;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD,eAAO,MAAM,kBAAkB;;;;;;iBAG7B,CAAA;AACF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,KAAM,SAAQ,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC;IAC1D,OAAgB,QAAQ,EAAG,gBAAgB,CAAS;IACpD,OAAgB,WAAW;;;sBAAmB;IAC9C,OAAgB,aAAa;;;;;;sBAAqB;gBAGtC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,gBAAgB;IAY5D;;;;OAIG;IACH,IAAI,UAAU,WAEb;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAe,EAAE,GAAU,EAAE;;;KAAK,GAAI,MAAM;IAcrD;;;;;;OAMG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM;IAKvB;;;;;OAKG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM;IAUvB,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,QAAQ;CAGjB;AAED,eAAe,KAAK,CAAA"}
@@ -0,0 +1,285 @@
1
+ import { z } from 'zod';
2
+ import vm from 'vm';
3
+ import { Feature } from "../feature.js";
4
+ export declare const VMStateSchema: z.ZodObject<{
5
+ enabled: z.ZodDefault<z.ZodBoolean>;
6
+ }, z.core.$loose>;
7
+ export type VMState = z.infer<typeof VMStateSchema>;
8
+ export declare const VMOptionsSchema: z.ZodObject<{
9
+ name: z.ZodOptional<z.ZodString>;
10
+ _cacheKey: z.ZodOptional<z.ZodString>;
11
+ cached: z.ZodOptional<z.ZodBoolean>;
12
+ enable: z.ZodOptional<z.ZodBoolean>;
13
+ context: z.ZodAny;
14
+ }, z.core.$strip>;
15
+ export type VMOptions = z.infer<typeof VMOptionsSchema>;
16
+ /**
17
+ * The VM feature provides Node.js virtual machine capabilities for executing JavaScript code.
18
+ *
19
+ * This feature wraps Node.js's built-in `vm` module to provide secure code execution
20
+ * in isolated contexts. It's useful for running untrusted code, creating sandboxed
21
+ * environments, or dynamically executing code with controlled access to variables and modules.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const vm = container.feature('vm')
26
+ *
27
+ * // Execute simple code
28
+ * const result = vm.run('1 + 2 + 3')
29
+ * console.log(result) // 6
30
+ *
31
+ * // Execute code with custom context
32
+ * const result2 = vm.run('greeting + " " + name', {
33
+ * greeting: 'Hello',
34
+ * name: 'World'
35
+ * })
36
+ * console.log(result2) // 'Hello World'
37
+ * ```
38
+ *
39
+ * @extends Feature
40
+ */
41
+ export declare class VM<T extends VMState = VMState, K extends VMOptions = VMOptions> extends Feature<T, K> {
42
+ static shortcut: "features.vm";
43
+ static stateSchema: z.ZodObject<{
44
+ enabled: z.ZodDefault<z.ZodBoolean>;
45
+ }, z.core.$loose>;
46
+ static optionsSchema: z.ZodObject<{
47
+ name: z.ZodOptional<z.ZodString>;
48
+ _cacheKey: z.ZodOptional<z.ZodString>;
49
+ cached: z.ZodOptional<z.ZodBoolean>;
50
+ enable: z.ZodOptional<z.ZodBoolean>;
51
+ context: z.ZodAny;
52
+ }, z.core.$strip>;
53
+ /** Map of virtual module IDs to their exports, consulted before Node's native require */
54
+ modules: Map<string, any>;
55
+ /**
56
+ * Register a virtual module that will be available to `require()` inside VM-executed code.
57
+ * Modules registered here take precedence over Node's native resolution.
58
+ *
59
+ * @param id - The module specifier (e.g. `'@soederpop/luca'`, `'zod'`)
60
+ * @param exports - The module's exports object
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * const vm = container.feature('vm')
65
+ * vm.defineModule('@soederpop/luca', { Container, Feature, fs, proc })
66
+ * vm.defineModule('zod', { z })
67
+ *
68
+ * // Now loadModule can resolve these in user code:
69
+ * // import { Container } from '@soederpop/luca' → works
70
+ * ```
71
+ */
72
+ defineModule(id: string, exports: any): void;
73
+ /**
74
+ * Build a require function that resolves from the virtual modules map first,
75
+ * falling back to Node's native `createRequire` for everything else.
76
+ *
77
+ * @param filePath - The file path to scope native require resolution to
78
+ * @returns A require function with `.resolve` preserved from the native require
79
+ */
80
+ createRequireFor(filePath: string): ((id: string) => any) & {
81
+ resolve: RequireResolve;
82
+ };
83
+ /**
84
+ * Creates a new VM script from the provided code.
85
+ *
86
+ * This method compiles JavaScript code into a VM script that can be executed
87
+ * multiple times in different contexts. The script is pre-compiled for better
88
+ * performance when executing the same code repeatedly.
89
+ *
90
+ * @param {string} code - The JavaScript code to compile into a script
91
+ * @param {vm.ScriptOptions} [options] - Options for script compilation
92
+ * @returns {vm.Script} A compiled VM script ready for execution
93
+ *
94
+ * @example
95
+ * ```typescript
96
+ * const script = vm.createScript('Math.max(a, b)')
97
+ *
98
+ * // Execute the script multiple times with different contexts
99
+ * const result1 = script.runInContext(vm.createContext({ a: 5, b: 3 }))
100
+ * const result2 = script.runInContext(vm.createContext({ a: 10, b: 20 }))
101
+ * ```
102
+ */
103
+ createScript(code: string, options?: vm.ScriptOptions): vm.Script;
104
+ /**
105
+ * Check whether an object has already been contextified by `vm.createContext()`.
106
+ *
107
+ * Useful to avoid double-contextifying when you're not sure if the caller
108
+ * passed a plain object or an existing context.
109
+ *
110
+ * @param ctx - The object to check
111
+ * @returns True if the object is a VM context
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * const ctx = vm.createContext({ x: 1 })
116
+ * vm.isContext(ctx) // true
117
+ * vm.isContext({ x: 1 }) // false
118
+ * ```
119
+ */
120
+ isContext(ctx: unknown): ctx is vm.Context;
121
+ /**
122
+ * Create an isolated JavaScript execution context.
123
+ *
124
+ * Combines the container's context with any additional variables provided.
125
+ * If the input is already a VM context, it is returned as-is.
126
+ *
127
+ * @param ctx - Additional context variables to include
128
+ * @returns A VM context ready for script execution
129
+ *
130
+ * @example
131
+ * ```typescript
132
+ * const context = vm.createContext({ user: { name: 'John' } })
133
+ * const result = vm.runSync('user.name', context)
134
+ * ```
135
+ */
136
+ createContext(ctx?: any): vm.Context;
137
+ /**
138
+ * Executes JavaScript code in a controlled environment.
139
+ *
140
+ * This method creates a script from the provided code, sets up an execution context
141
+ * with the specified variables, and runs the code safely. It handles errors gracefully
142
+ * and returns either the result or the error object.
143
+ *
144
+ * @param {string} code - The JavaScript code to execute
145
+ * @param {any} [ctx={}] - Context variables to make available to the executing code
146
+ * @returns {any} The result of the code execution, or an Error object if execution failed
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * // Simple calculation
151
+ * const result = vm.run('2 + 3 * 4')
152
+ * console.log(result) // 14
153
+ *
154
+ * // Using context variables
155
+ * const greeting = vm.run('`Hello ${name}!`', { name: 'Alice' })
156
+ * console.log(greeting) // 'Hello Alice!'
157
+ *
158
+ * // Array operations
159
+ * const sum = vm.run('numbers.reduce((a, b) => a + b, 0)', {
160
+ * numbers: [1, 2, 3, 4, 5]
161
+ * })
162
+ * console.log(sum) // 15
163
+ *
164
+ * // Error handling
165
+ * const error = vm.run('invalidFunction()')
166
+ * if (error instanceof Error) {
167
+ * console.log('Execution failed:', error.message)
168
+ * }
169
+ * ```
170
+ */
171
+ /**
172
+ * Wrap code containing top-level `await` in an async IIFE, injecting
173
+ * `return` before the last expression so the value is not lost.
174
+ *
175
+ * If the code does not contain `await`, or is already wrapped in an
176
+ * async function/arrow, it is returned unchanged.
177
+ */
178
+ wrapTopLevelAwait(code: string): string;
179
+ run<T extends any>(code: string, ctx?: any): Promise<T>;
180
+ /**
181
+ * Execute code and capture all console output as structured JSON.
182
+ *
183
+ * Returns both the execution result and an array of every `console.*` call
184
+ * made during execution, each entry recording the method name and arguments.
185
+ *
186
+ * @param code - The JavaScript code to execute
187
+ * @param ctx - Context variables to make available to the executing code
188
+ * @returns The result, an array of captured console calls, and the context
189
+ *
190
+ * @example
191
+ * ```typescript
192
+ * const { result, console: calls } = await vm.runCaptured('console.log("hi"); console.warn("oh"); 42')
193
+ * // result === 42
194
+ * // calls === [{ method: 'log', args: ['hi'] }, { method: 'warn', args: ['oh'] }]
195
+ * ```
196
+ */
197
+ runCaptured<T extends any>(code: string, ctx?: any): Promise<{
198
+ result: T;
199
+ console: Array<{
200
+ method: string;
201
+ args: any[];
202
+ }>;
203
+ context: vm.Context;
204
+ }>;
205
+ /**
206
+ * Execute JavaScript code synchronously in a controlled environment.
207
+ *
208
+ * @param code - The JavaScript code to execute
209
+ * @param ctx - Context variables to make available to the executing code
210
+ * @returns The result of the code execution
211
+ *
212
+ * @example
213
+ * ```typescript
214
+ * const sum = vm.runSync('a + b', { a: 2, b: 3 })
215
+ * console.log(sum) // 5
216
+ * ```
217
+ */
218
+ runSync<T extends any = any>(code: string, ctx?: any): T;
219
+ /**
220
+ * Execute code asynchronously and return both the result and the execution context.
221
+ *
222
+ * Unlike `run`, this method also returns the context object, allowing you to inspect
223
+ * variables set during execution.
224
+ *
225
+ * @param code - The JavaScript code to execute
226
+ * @param ctx - Context variables to make available to the executing code
227
+ * @returns The execution result and the context object
228
+ *
229
+ * @example
230
+ * ```typescript
231
+ * const { result, context } = await vm.perform('x = 42; x * 2', { x: 0 })
232
+ * console.log(result) // 84
233
+ * console.log(context.x) // 42
234
+ * ```
235
+ */
236
+ perform<T extends any>(code: string, ctx?: any): Promise<{
237
+ result: T;
238
+ context: vm.Context;
239
+ }>;
240
+ /**
241
+ * Executes JavaScript code synchronously and returns both the result and the execution context.
242
+ *
243
+ * Unlike `runSync`, this method also returns the context object, allowing you to inspect
244
+ * variables set during execution (e.g. `module.exports`). This is the synchronous equivalent
245
+ * of `perform()`.
246
+ *
247
+ * @param {string} code - The JavaScript code to execute
248
+ * @param {any} [ctx={}] - Context variables to make available to the executing code
249
+ * @returns {{ result: T, context: vm.Context }} The execution result and the context object
250
+ *
251
+ * @example
252
+ * ```typescript
253
+ * const { result, context } = vm.performSync(code, {
254
+ * exports: {},
255
+ * module: { exports: {} },
256
+ * })
257
+ * const moduleExports = context.module?.exports || context.exports
258
+ * ```
259
+ */
260
+ performSync<T extends any = any>(code: string, ctx?: any): {
261
+ result: T;
262
+ context: vm.Context;
263
+ };
264
+ /**
265
+ * Synchronously loads a JavaScript/TypeScript module from a file path, executing it
266
+ * in an isolated VM context and returning its exports. The module gets `require`,
267
+ * `exports`, and `module` globals automatically, plus any additional context you provide.
268
+ *
269
+ * @param {string} filePath - Absolute path to the module file to load
270
+ * @param {any} [ctx={}] - Additional context variables to inject into the module's execution environment
271
+ * @returns {Record<string, any>} The module's exports (from `module.exports` or `exports`)
272
+ *
273
+ * @example
274
+ * ```typescript
275
+ * const vm = container.feature('vm')
276
+ *
277
+ * // Load a tools module, injecting the container
278
+ * const tools = vm.loadModule('/path/to/tools.ts', { container, me: assistant })
279
+ * // tools.myFunction, tools.schemas, etc.
280
+ * ```
281
+ */
282
+ loadModule(filePath: string, ctx?: any): Record<string, any>;
283
+ }
284
+ export default VM;
285
+ //# sourceMappingURL=vm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vm.d.ts","sourceRoot":"","sources":["../../../src/node/features/vm.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,118 @@
1
+ import { z } from 'zod';
2
+ import { Feature } from "../feature.js";
3
+ import { NodeContainer } from "../container.js";
4
+ /**
5
+ * Zod schema for the YamlTree feature state.
6
+ * Extends FeatureStateSchema and allows any additional string-keyed properties for tree data.
7
+ */
8
+ export declare const YamlTreeStateSchema: z.ZodObject<{
9
+ enabled: z.ZodDefault<z.ZodBoolean>;
10
+ }, z.core.$catchall<z.ZodAny>>;
11
+ export type YamlTreeState = z.infer<typeof YamlTreeStateSchema>;
12
+ /**
13
+ * YamlTree Feature - A powerful YAML file tree loader and processor
14
+ *
15
+ * This feature provides functionality to recursively load YAML files from a directory structure
16
+ * and build a hierarchical tree representation. It automatically processes file paths to create
17
+ * a nested object structure where file paths become object property paths.
18
+ *
19
+ * **Key Features:**
20
+ * - Recursive YAML file discovery in directory trees
21
+ * - Automatic path-to-property mapping using camelCase conversion
22
+ * - Integration with FileManager for efficient file operations
23
+ * - State-based tree storage and retrieval
24
+ * - Support for both .yml and .yaml file extensions
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * const yamlTree = container.feature('yamlTree', { enable: true });
29
+ * await yamlTree.loadTree('config', 'appConfig');
30
+ * const configData = yamlTree.tree.appConfig;
31
+ * ```
32
+ *
33
+ * @template T - The state type, defaults to YamlTreeState
34
+ * @extends {Feature<T>}
35
+ */
36
+ export declare class YamlTree<T extends YamlTreeState = YamlTreeState> extends Feature<T> {
37
+ /** The shortcut path for accessing this feature */
38
+ static shortcut: "features.yamlTree";
39
+ static stateSchema: z.ZodObject<{
40
+ enabled: z.ZodDefault<z.ZodBoolean>;
41
+ }, z.core.$catchall<z.ZodAny>>;
42
+ static optionsSchema: z.ZodObject<{
43
+ name: z.ZodOptional<z.ZodString>;
44
+ _cacheKey: z.ZodOptional<z.ZodString>;
45
+ cached: z.ZodOptional<z.ZodBoolean>;
46
+ enable: z.ZodOptional<z.ZodBoolean>;
47
+ }, z.core.$strip>;
48
+ /**
49
+ * Attaches the YamlTree feature to a NodeContainer instance.
50
+ * Registers the feature and creates an auto-enabled instance.
51
+ *
52
+ * @param container - The NodeContainer to attach to
53
+ * @returns The container for method chaining
54
+ */
55
+ static attach(container: NodeContainer & {
56
+ yamlTree?: YamlTree;
57
+ }): void;
58
+ /**
59
+ * Loads a tree of YAML files from the specified base path and stores them in state.
60
+ *
61
+ * This method recursively scans the provided directory for YAML files (.yml and .yaml),
62
+ * processes their content, and builds a hierarchical object structure. File paths are
63
+ * converted to camelCase property names, and the resulting tree is stored in the feature's state.
64
+ *
65
+ * **Path Processing:**
66
+ * - Removes the base path prefix from file paths
67
+ * - Converts directory/file names to camelCase
68
+ * - Creates nested objects based on directory structure
69
+ * - Removes file extensions (.yml/.yaml)
70
+ *
71
+ * **Example:**
72
+ * ```
73
+ * config/
74
+ * database/
75
+ * production.yml -> tree.config.database.production
76
+ * staging.yml -> tree.config.database.staging
77
+ * api/
78
+ * endpoints.yaml -> tree.config.api.endpoints
79
+ * ```
80
+ *
81
+ * @param basePath - The root directory path to scan for YAML files
82
+ * @param key - The key to store the tree under in state (defaults to first segment of basePath)
83
+ * @returns Promise resolving to the complete tree object
84
+ *
85
+ * @throws {Error} When FileManager fails to start or files cannot be read
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * // Load all YAML files from 'config' directory into state.config
90
+ * await yamlTree.loadTree('config');
91
+ *
92
+ * // Load with custom key
93
+ * await yamlTree.loadTree('app/settings', 'appSettings');
94
+ *
95
+ * // Access the loaded data
96
+ * const dbConfig = yamlTree.tree.config.database.production;
97
+ * ```
98
+ */
99
+ loadTree(basePath: string, key?: string): Promise<Pick<T, Exclude<keyof T, "enabled">>>;
100
+ /**
101
+ * Gets the current tree data, excluding the 'enabled' state property.
102
+ *
103
+ * Returns a clean copy of the tree data without internal state management properties.
104
+ * This provides access to only the YAML tree data that has been loaded.
105
+ *
106
+ * @returns The tree object containing all loaded YAML data, organized by keys
107
+ *
108
+ * @example
109
+ * ```typescript
110
+ * await yamlTree.loadTree('config');
111
+ * const allTrees = yamlTree.tree;
112
+ * // Returns: { config: { database: { ... }, api: { ... } } }
113
+ * ```
114
+ */
115
+ get tree(): Pick<T, Exclude<keyof T, "enabled">>;
116
+ }
117
+ export default YamlTree;
118
+ //# sourceMappingURL=yaml-tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yaml-tree.d.ts","sourceRoot":"","sources":["../../../src/node/features/yaml-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;8BAA+J,CAAA;AAC/L,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE/D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,QAAQ,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;IAE/E,mDAAmD;IACnD,OAAgB,QAAQ,EAAG,mBAAmB,CAAS;IACvD,OAAgB,WAAW;;mCAAsB;IACjD,OAAgB,aAAa;;;;;sBAAuB;IAEpD;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,aAAa,GAAG;QAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;KAAE;IAIhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACG,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAE,MAAgC;IA+BtE;;;;;;;;;;;;;;OAcG;IACH,IAAI,IAAI,yCAEP;CACF;AAED,eAAe,QAAQ,CAAA"}
@@ -0,0 +1,127 @@
1
+ import { Feature } from '../feature.js';
2
+ import { NodeContainer } from '../container.js';
3
+ /**
4
+ * The YAML feature provides utilities for parsing and stringifying YAML data.
5
+ *
6
+ * This feature wraps the js-yaml library to provide convenient methods for
7
+ * converting between YAML strings and JavaScript objects. It's automatically
8
+ * attached to Node containers for easy access.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const yamlFeature = container.feature('yaml')
13
+ *
14
+ * // Parse YAML string to object
15
+ * const config = yamlFeature.parse(`
16
+ * name: MyApp
17
+ * version: 1.0.0
18
+ * settings:
19
+ * debug: true
20
+ * `)
21
+ *
22
+ * // Convert object to YAML string
23
+ * const yamlString = yamlFeature.stringify(config)
24
+ * console.log(yamlString)
25
+ * ```
26
+ *
27
+ * @extends Feature
28
+ */
29
+ export declare class YAML extends Feature {
30
+ static shortcut: "features.yaml";
31
+ static stateSchema: import("zod").ZodObject<{
32
+ enabled: import("zod").ZodDefault<import("zod").ZodBoolean>;
33
+ }, import("zod/v4/core").$loose>;
34
+ static optionsSchema: import("zod").ZodObject<{
35
+ name: import("zod").ZodOptional<import("zod").ZodString>;
36
+ _cacheKey: import("zod").ZodOptional<import("zod").ZodString>;
37
+ cached: import("zod").ZodOptional<import("zod").ZodBoolean>;
38
+ enable: import("zod").ZodOptional<import("zod").ZodBoolean>;
39
+ }, import("zod/v4/core").$strip>;
40
+ /**
41
+ * Automatically attaches the YAML feature to Node containers.
42
+ *
43
+ * This static method ensures the YAML feature is automatically available
44
+ * on Node containers without needing manual registration.
45
+ *
46
+ * @param {NodeContainer} c - The Node container to attach to
47
+ */
48
+ static attach(c: NodeContainer): void;
49
+ /**
50
+ * Converts a JavaScript object to a YAML string.
51
+ *
52
+ * This method serializes JavaScript data structures into YAML format,
53
+ * which is human-readable and commonly used for configuration files.
54
+ *
55
+ * @param {any} data - The data to convert to YAML format
56
+ * @returns {string} The YAML string representation of the data
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * const config = {
61
+ * name: 'MyApp',
62
+ * version: '1.0.0',
63
+ * settings: {
64
+ * debug: true,
65
+ * ports: [3000, 3001]
66
+ * }
67
+ * }
68
+ *
69
+ * const yamlString = yaml.stringify(config)
70
+ * console.log(yamlString)
71
+ * // Output:
72
+ * // name: MyApp
73
+ * // version: 1.0.0
74
+ * // settings:
75
+ * // debug: true
76
+ * // ports:
77
+ * // - 3000
78
+ * // - 3001
79
+ * ```
80
+ */
81
+ stringify(data: any): string;
82
+ /**
83
+ * Parses a YAML string into a JavaScript object.
84
+ *
85
+ * This method deserializes YAML content into JavaScript data structures.
86
+ * It supports all standard YAML features including nested objects, arrays,
87
+ * and various data types.
88
+ *
89
+ * @template T - The expected type of the parsed object
90
+ * @param {string} yamlStr - The YAML string to parse
91
+ * @returns {T} The parsed JavaScript object
92
+ * @throws {Error} Throws an error if the YAML string is malformed
93
+ *
94
+ * @example
95
+ * ```typescript
96
+ * const yamlContent = `
97
+ * name: MyApp
98
+ * version: 1.0.0
99
+ * settings:
100
+ * debug: true
101
+ * ports:
102
+ * - 3000
103
+ * - 3001
104
+ * `
105
+ *
106
+ * // Parse with type inference
107
+ * const config = yaml.parse(yamlContent)
108
+ * console.log(config.name) // 'MyApp'
109
+ *
110
+ * // Parse with explicit typing
111
+ * interface AppConfig {
112
+ * name: string
113
+ * version: string
114
+ * settings: {
115
+ * debug: boolean
116
+ * ports: number[]
117
+ * }
118
+ * }
119
+ *
120
+ * const typedConfig = yaml.parse<AppConfig>(yamlContent)
121
+ * console.log(typedConfig.settings.ports) // [3000, 3001]
122
+ * ```
123
+ */
124
+ parse<T extends object = any>(yamlStr: string): T;
125
+ }
126
+ export default YAML;
127
+ //# sourceMappingURL=yaml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../../../src/node/features/yaml.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,IAAK,SAAQ,OAAO;IAC/B,OAAgB,QAAQ,EAAG,eAAe,CAAS;IACnD,OAAgB,WAAW;;qCAAqB;IAChD,OAAgB,aAAa;;;;;qCAAuB;IAGpD;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,aAAa;IAI9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,SAAS,CAAC,IAAI,EAAE,GAAG,GAAI,MAAM;IAI7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;IACH,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,GAAG,EAAE,OAAO,EAAE,MAAM,GAAI,CAAC;CAGnD;AAED,eAAe,IAAI,CAAA"}