@soederpop/luca 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (369) hide show
  1. package/CLAUDE.md +2 -0
  2. package/assistants/codingAssistant/hooks.ts +3 -0
  3. package/assistants/inkbot/CORE.md +69 -0
  4. package/assistants/inkbot/hooks.ts +14 -0
  5. package/assistants/inkbot/tools.ts +47 -0
  6. package/commands/inkbot.ts +353 -0
  7. package/dist/agi/container.server.d.ts +63 -0
  8. package/dist/agi/container.server.d.ts.map +1 -0
  9. package/dist/agi/endpoints/ask.d.ts +20 -0
  10. package/dist/agi/endpoints/ask.d.ts.map +1 -0
  11. package/dist/agi/endpoints/conversations/[id].d.ts +27 -0
  12. package/dist/agi/endpoints/conversations/[id].d.ts.map +1 -0
  13. package/dist/agi/endpoints/conversations.d.ts +18 -0
  14. package/dist/agi/endpoints/conversations.d.ts.map +1 -0
  15. package/dist/agi/endpoints/experts.d.ts +8 -0
  16. package/dist/agi/endpoints/experts.d.ts.map +1 -0
  17. package/dist/agi/feature.d.ts +9 -0
  18. package/dist/agi/feature.d.ts.map +1 -0
  19. package/dist/agi/features/assistant.d.ts +509 -0
  20. package/dist/agi/features/assistant.d.ts.map +1 -0
  21. package/dist/agi/features/assistants-manager.d.ts +236 -0
  22. package/dist/agi/features/assistants-manager.d.ts.map +1 -0
  23. package/dist/agi/features/autonomous-assistant.d.ts +281 -0
  24. package/dist/agi/features/autonomous-assistant.d.ts.map +1 -0
  25. package/dist/agi/features/browser-use.d.ts +479 -0
  26. package/dist/agi/features/browser-use.d.ts.map +1 -0
  27. package/dist/agi/features/claude-code.d.ts +824 -0
  28. package/dist/agi/features/claude-code.d.ts.map +1 -0
  29. package/dist/agi/features/conversation-history.d.ts +245 -0
  30. package/dist/agi/features/conversation-history.d.ts.map +1 -0
  31. package/dist/agi/features/conversation.d.ts +464 -0
  32. package/dist/agi/features/conversation.d.ts.map +1 -0
  33. package/dist/agi/features/docs-reader.d.ts +72 -0
  34. package/dist/agi/features/docs-reader.d.ts.map +1 -0
  35. package/dist/agi/features/file-tools.d.ts +110 -0
  36. package/dist/agi/features/file-tools.d.ts.map +1 -0
  37. package/dist/agi/features/luca-coder.d.ts +323 -0
  38. package/dist/agi/features/luca-coder.d.ts.map +1 -0
  39. package/dist/agi/features/openai-codex.d.ts +381 -0
  40. package/dist/agi/features/openai-codex.d.ts.map +1 -0
  41. package/dist/agi/features/openapi.d.ts +200 -0
  42. package/dist/agi/features/openapi.d.ts.map +1 -0
  43. package/dist/agi/features/skills-library.d.ts +167 -0
  44. package/dist/agi/features/skills-library.d.ts.map +1 -0
  45. package/dist/agi/index.d.ts +5 -0
  46. package/dist/agi/index.d.ts.map +1 -0
  47. package/dist/agi/lib/interceptor-chain.d.ts +44 -0
  48. package/dist/agi/lib/interceptor-chain.d.ts.map +1 -0
  49. package/dist/agi/lib/token-counter.d.ts +13 -0
  50. package/dist/agi/lib/token-counter.d.ts.map +1 -0
  51. package/dist/bootstrap/generated.d.ts +5 -0
  52. package/dist/bootstrap/generated.d.ts.map +1 -0
  53. package/dist/browser.d.ts +12 -0
  54. package/dist/browser.d.ts.map +1 -0
  55. package/dist/bus.d.ts +29 -0
  56. package/dist/bus.d.ts.map +1 -0
  57. package/dist/cli/build-info.d.ts +4 -0
  58. package/dist/cli/build-info.d.ts.map +1 -0
  59. package/dist/cli/cli.d.ts +3 -0
  60. package/dist/cli/cli.d.ts.map +1 -0
  61. package/dist/client.d.ts +60 -0
  62. package/dist/client.d.ts.map +1 -0
  63. package/dist/clients/civitai/index.d.ts +472 -0
  64. package/dist/clients/civitai/index.d.ts.map +1 -0
  65. package/dist/clients/client-template.d.ts +30 -0
  66. package/dist/clients/client-template.d.ts.map +1 -0
  67. package/dist/clients/comfyui/index.d.ts +281 -0
  68. package/dist/clients/comfyui/index.d.ts.map +1 -0
  69. package/dist/clients/elevenlabs/index.d.ts +197 -0
  70. package/dist/clients/elevenlabs/index.d.ts.map +1 -0
  71. package/dist/clients/graph.d.ts +64 -0
  72. package/dist/clients/graph.d.ts.map +1 -0
  73. package/dist/clients/openai/index.d.ts +247 -0
  74. package/dist/clients/openai/index.d.ts.map +1 -0
  75. package/dist/clients/rest.d.ts +92 -0
  76. package/dist/clients/rest.d.ts.map +1 -0
  77. package/dist/clients/supabase/index.d.ts +176 -0
  78. package/dist/clients/supabase/index.d.ts.map +1 -0
  79. package/dist/clients/websocket.d.ts +127 -0
  80. package/dist/clients/websocket.d.ts.map +1 -0
  81. package/dist/command.d.ts +163 -0
  82. package/dist/command.d.ts.map +1 -0
  83. package/dist/commands/bootstrap.d.ts +20 -0
  84. package/dist/commands/bootstrap.d.ts.map +1 -0
  85. package/dist/commands/chat.d.ts +37 -0
  86. package/dist/commands/chat.d.ts.map +1 -0
  87. package/dist/commands/code.d.ts +28 -0
  88. package/dist/commands/code.d.ts.map +1 -0
  89. package/dist/commands/console.d.ts +22 -0
  90. package/dist/commands/console.d.ts.map +1 -0
  91. package/dist/commands/describe.d.ts +50 -0
  92. package/dist/commands/describe.d.ts.map +1 -0
  93. package/dist/commands/eval.d.ts +23 -0
  94. package/dist/commands/eval.d.ts.map +1 -0
  95. package/dist/commands/help.d.ts +25 -0
  96. package/dist/commands/help.d.ts.map +1 -0
  97. package/dist/commands/index.d.ts +18 -0
  98. package/dist/commands/index.d.ts.map +1 -0
  99. package/dist/commands/introspect.d.ts +24 -0
  100. package/dist/commands/introspect.d.ts.map +1 -0
  101. package/dist/commands/mcp.d.ts +35 -0
  102. package/dist/commands/mcp.d.ts.map +1 -0
  103. package/dist/commands/prompt.d.ts +38 -0
  104. package/dist/commands/prompt.d.ts.map +1 -0
  105. package/dist/commands/run.d.ts +24 -0
  106. package/dist/commands/run.d.ts.map +1 -0
  107. package/dist/commands/sandbox-mcp.d.ts +34 -0
  108. package/dist/commands/sandbox-mcp.d.ts.map +1 -0
  109. package/dist/commands/save-api-docs.d.ts +21 -0
  110. package/dist/commands/save-api-docs.d.ts.map +1 -0
  111. package/dist/commands/scaffold.d.ts +24 -0
  112. package/dist/commands/scaffold.d.ts.map +1 -0
  113. package/dist/commands/select.d.ts +22 -0
  114. package/dist/commands/select.d.ts.map +1 -0
  115. package/dist/commands/serve.d.ts +29 -0
  116. package/dist/commands/serve.d.ts.map +1 -0
  117. package/dist/container-describer.d.ts +144 -0
  118. package/dist/container-describer.d.ts.map +1 -0
  119. package/dist/container.d.ts +451 -0
  120. package/dist/container.d.ts.map +1 -0
  121. package/dist/endpoint.d.ts +113 -0
  122. package/dist/endpoint.d.ts.map +1 -0
  123. package/dist/feature.d.ts +47 -0
  124. package/dist/feature.d.ts.map +1 -0
  125. package/dist/graft.d.ts +29 -0
  126. package/dist/graft.d.ts.map +1 -0
  127. package/dist/hash-object.d.ts +8 -0
  128. package/dist/hash-object.d.ts.map +1 -0
  129. package/dist/helper.d.ts +209 -0
  130. package/dist/helper.d.ts.map +1 -0
  131. package/dist/introspection/generated.node.d.ts +44623 -0
  132. package/dist/introspection/generated.node.d.ts.map +1 -0
  133. package/dist/introspection/generated.web.d.ts +1412 -0
  134. package/dist/introspection/generated.web.d.ts.map +1 -0
  135. package/dist/introspection/index.d.ts +156 -0
  136. package/dist/introspection/index.d.ts.map +1 -0
  137. package/dist/introspection/scan.d.ts +147 -0
  138. package/dist/introspection/scan.d.ts.map +1 -0
  139. package/dist/node/container.d.ts +256 -0
  140. package/dist/node/container.d.ts.map +1 -0
  141. package/dist/node/feature.d.ts +9 -0
  142. package/dist/node/feature.d.ts.map +1 -0
  143. package/dist/node/features/container-link.d.ts +213 -0
  144. package/dist/node/features/container-link.d.ts.map +1 -0
  145. package/dist/node/features/content-db.d.ts +354 -0
  146. package/dist/node/features/content-db.d.ts.map +1 -0
  147. package/dist/node/features/disk-cache.d.ts +236 -0
  148. package/dist/node/features/disk-cache.d.ts.map +1 -0
  149. package/dist/node/features/dns.d.ts +511 -0
  150. package/dist/node/features/dns.d.ts.map +1 -0
  151. package/dist/node/features/docker.d.ts +485 -0
  152. package/dist/node/features/docker.d.ts.map +1 -0
  153. package/dist/node/features/downloader.d.ts +73 -0
  154. package/dist/node/features/downloader.d.ts.map +1 -0
  155. package/dist/node/features/figlet-fonts.d.ts +4 -0
  156. package/dist/node/features/figlet-fonts.d.ts.map +1 -0
  157. package/dist/node/features/file-manager.d.ts +177 -0
  158. package/dist/node/features/file-manager.d.ts.map +1 -0
  159. package/dist/node/features/fs.d.ts +635 -0
  160. package/dist/node/features/fs.d.ts.map +1 -0
  161. package/dist/node/features/git.d.ts +329 -0
  162. package/dist/node/features/git.d.ts.map +1 -0
  163. package/dist/node/features/google-auth.d.ts +200 -0
  164. package/dist/node/features/google-auth.d.ts.map +1 -0
  165. package/dist/node/features/google-calendar.d.ts +194 -0
  166. package/dist/node/features/google-calendar.d.ts.map +1 -0
  167. package/dist/node/features/google-docs.d.ts +138 -0
  168. package/dist/node/features/google-docs.d.ts.map +1 -0
  169. package/dist/node/features/google-drive.d.ts +202 -0
  170. package/dist/node/features/google-drive.d.ts.map +1 -0
  171. package/dist/node/features/google-mail.d.ts +221 -0
  172. package/dist/node/features/google-mail.d.ts.map +1 -0
  173. package/dist/node/features/google-sheets.d.ts +157 -0
  174. package/dist/node/features/google-sheets.d.ts.map +1 -0
  175. package/dist/node/features/grep.d.ts +207 -0
  176. package/dist/node/features/grep.d.ts.map +1 -0
  177. package/dist/node/features/helpers.d.ts +236 -0
  178. package/dist/node/features/helpers.d.ts.map +1 -0
  179. package/dist/node/features/ink.d.ts +332 -0
  180. package/dist/node/features/ink.d.ts.map +1 -0
  181. package/dist/node/features/ipc-socket.d.ts +298 -0
  182. package/dist/node/features/ipc-socket.d.ts.map +1 -0
  183. package/dist/node/features/json-tree.d.ts +140 -0
  184. package/dist/node/features/json-tree.d.ts.map +1 -0
  185. package/dist/node/features/networking.d.ts +373 -0
  186. package/dist/node/features/networking.d.ts.map +1 -0
  187. package/dist/node/features/nlp.d.ts +125 -0
  188. package/dist/node/features/nlp.d.ts.map +1 -0
  189. package/dist/node/features/opener.d.ts +93 -0
  190. package/dist/node/features/opener.d.ts.map +1 -0
  191. package/dist/node/features/os.d.ts +168 -0
  192. package/dist/node/features/os.d.ts.map +1 -0
  193. package/dist/node/features/package-finder.d.ts +419 -0
  194. package/dist/node/features/package-finder.d.ts.map +1 -0
  195. package/dist/node/features/postgres.d.ts +173 -0
  196. package/dist/node/features/postgres.d.ts.map +1 -0
  197. package/dist/node/features/proc.d.ts +285 -0
  198. package/dist/node/features/proc.d.ts.map +1 -0
  199. package/dist/node/features/process-manager.d.ts +427 -0
  200. package/dist/node/features/process-manager.d.ts.map +1 -0
  201. package/dist/node/features/python.d.ts +477 -0
  202. package/dist/node/features/python.d.ts.map +1 -0
  203. package/dist/node/features/redis.d.ts +247 -0
  204. package/dist/node/features/redis.d.ts.map +1 -0
  205. package/dist/node/features/repl.d.ts +84 -0
  206. package/dist/node/features/repl.d.ts.map +1 -0
  207. package/dist/node/features/runpod.d.ts +527 -0
  208. package/dist/node/features/runpod.d.ts.map +1 -0
  209. package/dist/node/features/secure-shell.d.ts +145 -0
  210. package/dist/node/features/secure-shell.d.ts.map +1 -0
  211. package/dist/node/features/semantic-search.d.ts +207 -0
  212. package/dist/node/features/semantic-search.d.ts.map +1 -0
  213. package/dist/node/features/sqlite.d.ts +180 -0
  214. package/dist/node/features/sqlite.d.ts.map +1 -0
  215. package/dist/node/features/telegram.d.ts +173 -0
  216. package/dist/node/features/telegram.d.ts.map +1 -0
  217. package/dist/node/features/transpiler.d.ts +51 -0
  218. package/dist/node/features/transpiler.d.ts.map +1 -0
  219. package/dist/node/features/tts.d.ts +108 -0
  220. package/dist/node/features/tts.d.ts.map +1 -0
  221. package/dist/node/features/ui.d.ts +562 -0
  222. package/dist/node/features/ui.d.ts.map +1 -0
  223. package/dist/node/features/vault.d.ts +90 -0
  224. package/dist/node/features/vault.d.ts.map +1 -0
  225. package/dist/node/features/vm.d.ts +285 -0
  226. package/dist/node/features/vm.d.ts.map +1 -0
  227. package/dist/node/features/yaml-tree.d.ts +118 -0
  228. package/dist/node/features/yaml-tree.d.ts.map +1 -0
  229. package/dist/node/features/yaml.d.ts +127 -0
  230. package/dist/node/features/yaml.d.ts.map +1 -0
  231. package/dist/node.d.ts +67 -0
  232. package/dist/node.d.ts.map +1 -0
  233. package/dist/python/generated.d.ts +2 -0
  234. package/dist/python/generated.d.ts.map +1 -0
  235. package/dist/react/index.d.ts +36 -0
  236. package/dist/react/index.d.ts.map +1 -0
  237. package/dist/registry.d.ts +97 -0
  238. package/dist/registry.d.ts.map +1 -0
  239. package/dist/scaffolds/generated.d.ts +13 -0
  240. package/dist/scaffolds/generated.d.ts.map +1 -0
  241. package/dist/scaffolds/template.d.ts +11 -0
  242. package/dist/scaffolds/template.d.ts.map +1 -0
  243. package/dist/schemas/base.d.ts +254 -0
  244. package/dist/schemas/base.d.ts.map +1 -0
  245. package/dist/selector.d.ts +130 -0
  246. package/dist/selector.d.ts.map +1 -0
  247. package/dist/server.d.ts +89 -0
  248. package/dist/server.d.ts.map +1 -0
  249. package/dist/servers/express.d.ts +104 -0
  250. package/dist/servers/express.d.ts.map +1 -0
  251. package/dist/servers/mcp.d.ts +201 -0
  252. package/dist/servers/mcp.d.ts.map +1 -0
  253. package/dist/servers/socket.d.ts +121 -0
  254. package/dist/servers/socket.d.ts.map +1 -0
  255. package/dist/state.d.ts +24 -0
  256. package/dist/state.d.ts.map +1 -0
  257. package/dist/web/clients/socket.d.ts +37 -0
  258. package/dist/web/clients/socket.d.ts.map +1 -0
  259. package/dist/web/container.d.ts +55 -0
  260. package/dist/web/container.d.ts.map +1 -0
  261. package/dist/web/extension.d.ts +4 -0
  262. package/dist/web/extension.d.ts.map +1 -0
  263. package/dist/web/feature.d.ts +8 -0
  264. package/dist/web/feature.d.ts.map +1 -0
  265. package/dist/web/features/asset-loader.d.ts +35 -0
  266. package/dist/web/features/asset-loader.d.ts.map +1 -0
  267. package/dist/web/features/container-link.d.ts +167 -0
  268. package/dist/web/features/container-link.d.ts.map +1 -0
  269. package/dist/web/features/esbuild.d.ts +51 -0
  270. package/dist/web/features/esbuild.d.ts.map +1 -0
  271. package/dist/web/features/helpers.d.ts +140 -0
  272. package/dist/web/features/helpers.d.ts.map +1 -0
  273. package/dist/web/features/network.d.ts +69 -0
  274. package/dist/web/features/network.d.ts.map +1 -0
  275. package/dist/web/features/speech.d.ts +71 -0
  276. package/dist/web/features/speech.d.ts.map +1 -0
  277. package/dist/web/features/vault.d.ts +62 -0
  278. package/dist/web/features/vault.d.ts.map +1 -0
  279. package/dist/web/features/vm.d.ts +48 -0
  280. package/dist/web/features/vm.d.ts.map +1 -0
  281. package/dist/web/features/voice-recognition.d.ts +96 -0
  282. package/dist/web/features/voice-recognition.d.ts.map +1 -0
  283. package/dist/web/shims/isomorphic-vm.d.ts +22 -0
  284. package/dist/web/shims/isomorphic-vm.d.ts.map +1 -0
  285. package/docs/apis/features/agi/assistant.md +1 -0
  286. package/docs/apis/features/agi/assistants-manager.md +62 -2
  287. package/docs/apis/features/agi/auto-assistant.md +11 -109
  288. package/docs/apis/features/agi/claude-code.md +138 -0
  289. package/docs/apis/features/agi/conversation.md +60 -31
  290. package/docs/apis/features/agi/luca-coder.md +407 -0
  291. package/docs/apis/features/agi/openapi.md +2 -2
  292. package/docs/apis/features/agi/skills-library.md +12 -0
  293. package/docs/apis/features/node/python.md +81 -11
  294. package/docs/apis/features/node/transpiler.md +74 -0
  295. package/docs/apis/features/web/esbuild.md +0 -6
  296. package/docs/apis/servers/mcp.md +2 -2
  297. package/docs/examples/entity.md +124 -0
  298. package/package.json +73 -21
  299. package/scripts/test-assistant-hooks.ts +13 -0
  300. package/src/agi/feature.ts +13 -0
  301. package/src/agi/features/assistant.ts +36 -25
  302. package/src/agi/features/assistants-manager.ts +70 -5
  303. package/src/agi/features/autonomous-assistant.ts +1 -5
  304. package/src/agi/features/browser-use.ts +2 -2
  305. package/src/agi/features/claude-code.ts +165 -1
  306. package/src/agi/features/conversation-history.ts +2 -6
  307. package/src/agi/features/conversation.ts +95 -3
  308. package/src/agi/features/docs-reader.ts +2 -1
  309. package/src/agi/features/file-tools.ts +2 -2
  310. package/src/agi/features/luca-coder.ts +1 -5
  311. package/src/agi/features/openai-codex.ts +1 -1
  312. package/src/agi/features/openapi.ts +3 -3
  313. package/src/agi/features/skills-library.ts +90 -2
  314. package/src/agi/lib/interceptor-chain.ts +10 -0
  315. package/src/agi/lib/token-counter.ts +1 -1
  316. package/src/bootstrap/generated.ts +126 -1
  317. package/src/bus.ts +27 -5
  318. package/src/cli/build-info.ts +2 -2
  319. package/src/client.ts +2 -2
  320. package/src/clients/elevenlabs/index.ts +5 -0
  321. package/src/commands/bootstrap.ts +2 -1
  322. package/src/commands/chat.ts +1 -0
  323. package/src/commands/code.ts +4 -2
  324. package/src/commands/prompt.ts +34 -34
  325. package/src/commands/sandbox-mcp.ts +69 -163
  326. package/src/commands/save-api-docs.ts +10 -8
  327. package/src/commands/select.ts +8 -3
  328. package/src/container-describer.ts +70 -84
  329. package/src/container.ts +93 -3
  330. package/src/endpoint.ts +1 -1
  331. package/src/entity.ts +173 -0
  332. package/src/feature.ts +3 -3
  333. package/src/helper.ts +8 -4
  334. package/src/introspection/generated.agi.ts +1403 -929
  335. package/src/introspection/generated.node.ts +127 -33
  336. package/src/introspection/generated.web.ts +95 -3
  337. package/src/introspection/scan.ts +1 -1
  338. package/src/node/container.ts +1 -1
  339. package/src/node/features/content-db.ts +3 -3
  340. package/src/node/features/file-manager.ts +10 -9
  341. package/src/node/features/git.ts +5 -5
  342. package/src/node/features/helpers.ts +1 -1
  343. package/src/node/features/json-tree.ts +1 -1
  344. package/src/node/features/os.ts +3 -3
  345. package/src/node/features/package-finder.ts +1 -1
  346. package/src/node/features/process-manager.ts +1 -1
  347. package/src/node/features/python.ts +3 -3
  348. package/src/node/features/redis.ts +1 -1
  349. package/src/node/features/repl.ts +2 -2
  350. package/src/node/features/transpiler.ts +34 -9
  351. package/src/node/features/ui.ts +1 -1
  352. package/src/node/features/vm.ts +6 -5
  353. package/src/node/features/yaml-tree.ts +1 -1
  354. package/src/node.ts +1 -0
  355. package/src/python/generated.ts +1 -1
  356. package/src/scaffolds/generated.ts +1 -1
  357. package/src/selector.ts +74 -4
  358. package/src/server.ts +2 -2
  359. package/src/servers/mcp.ts +6 -6
  360. package/src/web/features/helpers.ts +1 -1
  361. package/src/web/features/network.ts +1 -0
  362. package/test/assistant.test.ts +72 -0
  363. package/test/conversation.test.ts +220 -0
  364. package/test/vm-loadmodule.test.ts +213 -0
  365. package/tsconfig.build.json +12 -0
  366. package/tsconfig.json +1 -1
  367. package/scripts/examples/telegram-ink-ui.ts +0 -302
  368. package/scripts/examples/using-openai-codex.ts +0 -23
  369. package/scripts/examples/vm-loading-esm-modules.ts +0 -16
@@ -0,0 +1,451 @@
1
+ import { Bus } from './bus';
2
+ import { SetStateValue, State } from './state';
3
+ import { AvailableFeatures, Feature, FeaturesRegistry } from './feature';
4
+ import { Helper } from './helper';
5
+ import { uniq, keyBy, uniqBy, groupBy, debounce, throttle, mapValues, mapKeys, pick, get, set, omit, kebabCase, camelCase, upperFirst, lowerFirst } from 'lodash-es';
6
+ import { pluralize, singularize } from 'inflect';
7
+ import { z } from 'zod';
8
+ import { ContainerStateSchema } from './schemas/base';
9
+ import { type ContainerIntrospection, type IntrospectionSection } from './introspection/index';
10
+ import { ContainerDescriber } from './container-describer';
11
+ export { z };
12
+ export type { AvailableFeatures };
13
+ export type AvailableInstanceTypes<T> = {
14
+ [K in keyof T]: T[K] extends new (...args: any) => any ? InstanceType<T[K]> : never;
15
+ };
16
+ /**
17
+ * You'll want to use module augmentation to add your own options to the ContainerArgv interface
18
+ */
19
+ export interface ContainerArgv {
20
+ _?: string[];
21
+ }
22
+ export type ContainerState = z.infer<typeof ContainerStateSchema>;
23
+ export interface Plugin<T> {
24
+ attach?: (container: Container<any> & T, options?: any) => any;
25
+ }
26
+ export type Extension<T> = 'string' | keyof AvailableFeatures | Plugin<T> | {
27
+ attach: (container: Container<any>, options?: any) => T;
28
+ };
29
+ export interface ContainerUtils {
30
+ /** Generate a v4 UUID */
31
+ uuid: () => string;
32
+ /** Deterministic hash of any object */
33
+ hashObject: (obj: any) => string;
34
+ /** String case conversion and inflection utilities */
35
+ stringUtils: {
36
+ kebabCase: typeof kebabCase;
37
+ camelCase: typeof camelCase;
38
+ upperFirst: typeof upperFirst;
39
+ lowerFirst: typeof lowerFirst;
40
+ pluralize: typeof pluralize;
41
+ singularize: typeof singularize;
42
+ };
43
+ /** Lodash utility subset */
44
+ lodash: {
45
+ uniq: typeof uniq;
46
+ keyBy: typeof keyBy;
47
+ uniqBy: typeof uniqBy;
48
+ groupBy: typeof groupBy;
49
+ debounce: typeof debounce;
50
+ throttle: typeof throttle;
51
+ mapValues: typeof mapValues;
52
+ mapKeys: typeof mapKeys;
53
+ pick: typeof pick;
54
+ get: typeof get;
55
+ set: typeof set;
56
+ omit: typeof omit;
57
+ };
58
+ }
59
+ export interface ContainerContext<T extends AvailableFeatures = any> {
60
+ container: Container<T>;
61
+ }
62
+ /**
63
+ * The Container is the core runtime object in Luca. It is a singleton per process that acts as an
64
+ * event bus, state machine, and dependency injector. It holds registries of helpers (features, clients,
65
+ * servers, commands, endpoints) and provides factory methods to create instances from them.
66
+ *
67
+ * All helper instances share the container's context, enabling them to communicate and coordinate.
68
+ * The container detects its runtime environment (Node, Bun, browser, Electron) and can load
69
+ * platform-specific feature implementations accordingly.
70
+ *
71
+ * Use `container.feature('name')` to create feature instances, `container.use(Plugin)` to extend
72
+ * the container with new capabilities, and `container.on('event', handler)` to react to lifecycle events.
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * // Create a feature instance (cached — same args return same instance)
77
+ * const fs = container.feature('fs')
78
+ * const content = fs.readFile('README.md')
79
+ * ```
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * // Listen for state changes
84
+ * container.on('stateChange', (state) => console.log('State changed:', state))
85
+ * container.setState({ started: true })
86
+ * ```
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * // Extend with a plugin
91
+ * container.use(MyClient) // calls MyClient.attach(container)
92
+ * container.use('contentDb') // enable a feature by name
93
+ * ```
94
+ */
95
+ export declare class Container<Features extends AvailableFeatures = AvailableFeatures, ContainerState extends ContainerState = ContainerState> {
96
+ static stateSchema: z.ZodObject<{
97
+ started: z.ZodDefault<z.ZodBoolean>;
98
+ enabledFeatures: z.ZodArray<z.ZodString>;
99
+ registries: z.ZodArray<z.ZodString>;
100
+ factories: z.ZodArray<z.ZodString>;
101
+ }, z.core.$strip>;
102
+ readonly uuid: string;
103
+ private readonly _events;
104
+ private readonly _state;
105
+ /**
106
+ * You can use module augmentation to define the starting interface for your container
107
+ * whether it is process.argv, process.env, or some combination thereof
108
+ */
109
+ readonly options: ContainerArgv;
110
+ constructor(options: ContainerArgv);
111
+ /**
112
+ * Creates a new subcontainer instance of the same concrete Container subclass.
113
+ * The new instance is constructed with the same options as this container,
114
+ * shallow-merged with any overrides you provide. This preserves the runtime
115
+ * container type (e.g. NodeContainer, AGIContainer, etc.).
116
+ *
117
+ * @param options - Options to override for the new container instance
118
+ * @returns A new container instance of the same subclass
119
+ *
120
+ * @example
121
+ * ```ts
122
+ * const child = container.subcontainer({ cwd: '/tmp/workspace' })
123
+ * child.cwd // '/tmp/workspace'
124
+ * ```
125
+ */
126
+ subcontainer<This extends Container<any, any>>(this: This, options: ConstructorParameters<This['constructor']>[0]): This;
127
+ z: typeof z;
128
+ /** The observable state object for this container instance. */
129
+ get state(): State<ContainerState>;
130
+ /** Returns the list of shortcut IDs for all currently enabled features. */
131
+ get enabledFeatureIds(): string[];
132
+ /** Returns a map of enabled feature shortcut IDs to their instances. */
133
+ get enabledFeatures(): Partial<AvailableInstanceTypes<Features>>;
134
+ /**
135
+ * Common utilities available on every container. Provides UUID generation, object hashing,
136
+ * string case conversion, and lodash helpers — no imports needed.
137
+ *
138
+ * - `utils.uuid()` — generate a v4 UUID
139
+ * - `utils.hashObject(obj)` — deterministic hash of any object
140
+ * - `utils.stringUtils` — `{ kebabCase, camelCase, upperFirst, lowerFirst, pluralize, singularize }`
141
+ * - `utils.lodash` — `{ uniq, keyBy, uniqBy, groupBy, debounce, throttle, mapValues, mapKeys, pick, get, set, omit }`
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * const id = container.utils.uuid()
146
+ * const hash = container.utils.hashObject({ foo: 'bar' })
147
+ * const name = container.utils.stringUtils.camelCase('my-feature')
148
+ * const unique = container.utils.lodash.uniq([1, 2, 2, 3])
149
+ * ```
150
+ */
151
+ get utils(): ContainerUtils;
152
+ private _describer?;
153
+ /**
154
+ * Lazy-initialized ContainerDescriber for introspecting registries, helpers, and members.
155
+ * @internal
156
+ */
157
+ get describer(): ContainerDescriber;
158
+ addContext<K extends keyof ContainerContext>(key: K, value: ContainerContext[K]): this;
159
+ addContext(context: Partial<ContainerContext>): this;
160
+ /**
161
+ * The Container's context is an object that contains the enabled features, the container itself, and any additional context that has been added to the container.
162
+ *
163
+ * All helper instances that are created by the container will have access to the shared context.
164
+ */
165
+ get context(): ContainerContext<Features> & Partial<AvailableInstanceTypes<AvailableFeatures>>;
166
+ /**
167
+ * The current state of the container.
168
+ *
169
+ * This is a snapshot of the container's state at the time this method is called.
170
+ *
171
+ * @returns The current state of the container.
172
+ */
173
+ get currentState(): ContainerState;
174
+ /**
175
+ * Sets the state of the container. Accepts a partial state object to merge, or a function
176
+ * that receives the current state and returns the new state.
177
+ *
178
+ * @param newState - A partial state object to merge, or a function `(current) => newState`
179
+ * @returns The container instance (for chaining)
180
+ *
181
+ * @example
182
+ * ```ts
183
+ * container.setState({ started: true })
184
+ * container.setState((prev) => ({ ...prev, started: true }))
185
+ * ```
186
+ */
187
+ setState(newState: SetStateValue<ContainerState>): this;
188
+ get Feature(): typeof Feature;
189
+ get Helper(): typeof Helper;
190
+ get State(): typeof State;
191
+ /**
192
+ * The features registry. Use it to check what features are available, look up feature classes,
193
+ * or check if a feature is registered.
194
+ *
195
+ * @example
196
+ * ```ts
197
+ * container.features.available // ['fs', 'git', 'grep', ...]
198
+ * container.features.has('fs') // true
199
+ * container.features.lookup('fs') // FS class
200
+ * ```
201
+ */
202
+ get features(): FeaturesRegistry;
203
+ /**
204
+ * Create a new standalone event bus instance. Useful when you need a scoped event channel
205
+ * that is independent of the container's own event bus.
206
+ *
207
+ * @returns A new Bus instance
208
+ *
209
+ * @example
210
+ * ```ts
211
+ * const myBus = container.bus()
212
+ * myBus.on('data', (payload) => console.log(payload))
213
+ * myBus.emit('data', { count: 42 })
214
+ * ```
215
+ */
216
+ bus(): Bus;
217
+ /**
218
+ * Create a new standalone observable State object. Useful when you need reactive state
219
+ * that is independent of the container's own state.
220
+ *
221
+ * @param initialState - The initial state object (defaults to empty)
222
+ * @returns A new State instance
223
+ *
224
+ * @example
225
+ * ```ts
226
+ * const myState = container.newState({ count: 0, loading: false })
227
+ * myState.observe(() => console.log('Changed:', myState.current))
228
+ * myState.set('count', 1)
229
+ * ```
230
+ */
231
+ newState<T extends object = any>(initialState?: T): State<T>;
232
+ /**
233
+ * Parse helper options through the helper's static options schema so defaults are materialized.
234
+ * @internal
235
+ */
236
+ normalizeHelperOptions(BaseClass: any, options: any, fallbackName?: string): any;
237
+ /** @internal */
238
+ buildHelperCacheKey(type: string, id: string, options: any, omitOptionKeys?: string[]): string;
239
+ /** @internal */
240
+ createHelperInstance({ cache, type, id, BaseClass, options, fallbackName, omitOptionKeys, context, }: {
241
+ cache: Map<string, any>;
242
+ type: string;
243
+ id: string;
244
+ BaseClass: any;
245
+ options?: any;
246
+ fallbackName?: string;
247
+ omitOptionKeys?: string[];
248
+ context?: any;
249
+ }): any;
250
+ /**
251
+ * Creates a new instance of a feature.
252
+ *
253
+ * If you pass the same arguments, it will return the same instance as last time you created that.
254
+ *
255
+ * If you need the ability to create fresh instances, it is up to you how you define your options to support that.
256
+ *
257
+ * @param id - The id of the feature to create.
258
+ * @param options - The options to pass to the feature constructor.
259
+ * @returns The new feature instance.
260
+ */
261
+ feature<T extends keyof Features>(id: T, options?: ConstructorParameters<Features[T]>[0]): InstanceType<Features[T]>;
262
+ /**
263
+ * Start the container. Emits the 'started' event and sets `state.started` to true.
264
+ * Plugins and features can listen for this event to perform initialization.
265
+ *
266
+ * @returns The container instance
267
+ *
268
+ * @example
269
+ * ```ts
270
+ * container.on('started', () => console.log('Ready'))
271
+ * await container.start()
272
+ * ```
273
+ */
274
+ start(): Promise<this>;
275
+ /**
276
+ * ENVIRONMENT DETECTION METHODS
277
+ *
278
+ * One of the ideas of the container is that it can detect what kind of environment it is running in and
279
+ * e.g. perhaps load different versions of features to provide the same API with different implementations.
280
+ *
281
+ */
282
+ /**
283
+ * Returns true if the container is running in a browser.
284
+ */
285
+ get isBrowser(): boolean;
286
+ /**
287
+ * Returns true if the container is running in Bun.
288
+ */
289
+ get isBun(): boolean;
290
+ /**
291
+ * Returns true if the container is running in Node.
292
+ */
293
+ get isNode(): boolean;
294
+ /**
295
+ * Returns true if the container is running in Electron.
296
+ */
297
+ get isElectron(): boolean;
298
+ /**
299
+ * Returns true if the container is running in development mode.
300
+ */
301
+ get isDevelopment(): boolean;
302
+ /**
303
+ * Returns true if the container is running in production mode.
304
+ */
305
+ get isProduction(): boolean;
306
+ /**
307
+ * Returns true if the container is running in a CI environment.
308
+ */
309
+ get isCI(): boolean;
310
+ /**
311
+ * Emit an event on the container's event bus.
312
+ *
313
+ * @param event - The event name
314
+ * @param args - Arguments to pass to listeners
315
+ * @returns The container instance (for chaining)
316
+ *
317
+ * @example
318
+ * ```ts
319
+ * container.emit('taskCompleted', { id: 'abc', result: 42 })
320
+ * ```
321
+ */
322
+ emit(event: string, ...args: any[]): this;
323
+ /**
324
+ * Subscribe to an event on the container's event bus.
325
+ *
326
+ * @param event - The event name
327
+ * @param listener - The callback function
328
+ * @returns The container instance (for chaining)
329
+ *
330
+ * @example
331
+ * ```ts
332
+ * container.on('featureEnabled', (id, feature) => {
333
+ * console.log(`Feature ${id} enabled`)
334
+ * })
335
+ * ```
336
+ */
337
+ on(event: string, listener: (...args: any[]) => void): this;
338
+ /**
339
+ * Unsubscribe a listener from an event on the container's event bus.
340
+ *
341
+ * @param event - The event name
342
+ * @param listener - The listener to remove
343
+ * @returns The container instance (for chaining)
344
+ */
345
+ off(event: string, listener?: (...args: any[]) => void): this;
346
+ /**
347
+ * Subscribe to an event on the container's event bus, but only fire once.
348
+ *
349
+ * @param event - The event name
350
+ * @param listener - The callback function (invoked at most once)
351
+ * @returns The container instance (for chaining)
352
+ */
353
+ once(event: string, listener: (...args: any[]) => void): this;
354
+ /**
355
+ * Returns a promise that resolves the next time the given event is emitted.
356
+ * Useful for awaiting one-time lifecycle transitions.
357
+ *
358
+ * @param event - The event name to wait for
359
+ * @returns A promise that resolves with the event arguments
360
+ *
361
+ * @example
362
+ * ```ts
363
+ * await container.waitFor('started')
364
+ * console.log('Container is ready')
365
+ * ```
366
+ */
367
+ waitFor(event: string): Promise<any>;
368
+ /**
369
+ * Register a helper type (registry + factory pair) on this container.
370
+ * Called automatically by Helper.attach() methods (e.g. Client.attach, Server.attach).
371
+ * @internal
372
+ */
373
+ registerHelperType(registryName: string, factoryName: string): this;
374
+ /** Returns the names of all attached registries (e.g. ["features", "clients", "servers"]). */
375
+ get registryNames(): string[];
376
+ /** Returns the names of all available factory methods (e.g. ["feature", "client", "server"]). */
377
+ get factoryNames(): string[];
378
+ /**
379
+ * Returns a full introspection object for this container, merging build-time AST data
380
+ * (JSDoc descriptions, methods, getters) with runtime data (registries, factories, state, environment).
381
+ *
382
+ * @returns The complete introspection data as a structured object
383
+ *
384
+ * @example
385
+ * ```ts
386
+ * const info = container.introspect()
387
+ * console.log(info.methods) // all public methods with descriptions
388
+ * console.log(info.getters) // all getters with return types
389
+ * console.log(info.registries) // features, clients, servers, etc.
390
+ * ```
391
+ */
392
+ introspect(): ContainerIntrospection;
393
+ /**
394
+ * Returns a human-readable markdown representation of this container's introspection data.
395
+ * Useful in REPLs, AI agent contexts, or documentation generation. Pass a section name
396
+ * to render only that section (e.g. 'methods', 'getters', 'events', 'state').
397
+ *
398
+ * @param sectionOrDepth - A section name to render, or heading depth number
399
+ * @param startHeadingDepth - Starting markdown heading depth (default 1)
400
+ * @returns Markdown-formatted introspection text
401
+ *
402
+ * @example
403
+ * ```ts
404
+ * console.log(container.introspectAsText()) // full description
405
+ * console.log(container.introspectAsText('methods')) // just methods
406
+ * ```
407
+ */
408
+ introspectAsText(sectionOrDepth?: IntrospectionSection | number, startHeadingDepth?: number): string;
409
+ /** Returns JSON introspection data. */
410
+ introspectAsJSON(): ContainerIntrospection;
411
+ /**
412
+ * Returns the container's introspection data formatted as a TypeScript interface declaration.
413
+ * Includes the container's own methods, getters, factories, and registered helper types.
414
+ *
415
+ * @example
416
+ * ```ts
417
+ * console.log(container.introspectAsType())
418
+ * // interface NodeContainer {
419
+ * // feature<T>(id: string, options?: object): T;
420
+ * // readonly uuid: string;
421
+ * // ...
422
+ * // }
423
+ * ```
424
+ */
425
+ introspectAsType(): string;
426
+ /** Make a property non-enumerable, which is nice for inspecting it in the REPL */
427
+ _hide(...propNames: string[]): this;
428
+ /** Sleep for the specified number of milliseconds. Useful for scripting and sequencing. */
429
+ sleep(ms?: number): Promise<this>;
430
+ _plugins: (() => void)[];
431
+ /**
432
+ * Apply a plugin or enable a feature by string name. Plugins are classes with a static `attach(container)` method
433
+ * that extend the container with new registries, factories, or capabilities.
434
+ *
435
+ * @param plugin - A feature name string, or a class/object with a static attach method
436
+ * @param options - Options to pass to the plugin's attach method
437
+ * @returns The container instance (with the plugin's type merged in)
438
+ *
439
+ * @example
440
+ * ```ts
441
+ * // Enable a feature by name
442
+ * container.use('contentDb')
443
+ *
444
+ * // Attach a plugin class (e.g. Client, Server, or custom)
445
+ * container.use(Client) // registers the clients registry + client() factory
446
+ * container.use(Server) // registers the servers registry + server() factory
447
+ * ```
448
+ */
449
+ use<T = {}>(plugin: Extension<T>, options?: any): this & T;
450
+ }
451
+ //# sourceMappingURL=container.d.ts.map
@@ -0,0 +1 @@
1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C,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,IAAI;IAK7D;;;;;;OAMG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,IAAI;IAK7D;;;;;;;;;;;;MAYE;IACI,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAK1C;;;;OAIG;IACH,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAQ5D,8FAA8F;IAC9F,IAAI,aAAa,IAAI,MAAM,EAAE,CAE5B;IAED,iGAAiG;IACjG,IAAI,YAAY,IAAI,MAAM,EAAE,CAE3B;IAED;;;;;;;;;;;;;OAaG;IACH,UAAU,IAAI,sBAAsB;IA8DpC;;;;;;;;;;;;;;OAcG;IACH,gBAAgB,CAAC,cAAc,CAAC,EAAE,oBAAoB,GAAG,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM;IAepG,uCAAuC;IACvC,gBAAgB,IAAI,sBAAsB;IAI1C;;;;;;;;;;;;;OAaG;IACH,gBAAgB,IAAI,MAAM;IAK1B,kFAAkF;IAClF,KAAK,CAAC,GAAG,SAAS,EAAE,MAAM,EAAE;IAQ5B,2FAA2F;IACrF,KAAK,CAAC,EAAE,GAAE,MAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAK7C,QAAQ,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,CAAK;IAE7B;;;;;;;;;;;;;;;;;OAiBG;IACH,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,GAAE,GAAQ,GAAI,IAAI,GAAG,CAAC;CAkBhE"}
@@ -0,0 +1,113 @@
1
+ import { Helper } from './helper.js';
2
+ import type { Container } from './container.js';
3
+ import { Registry } from './registry.js';
4
+ import { z } from 'zod';
5
+ import { EndpointStateSchema, EndpointOptionsSchema } from './schemas/base.js';
6
+ export interface AvailableEndpoints {
7
+ }
8
+ export type EndpointState = z.infer<typeof EndpointStateSchema>;
9
+ export type EndpointOptions = z.infer<typeof EndpointOptionsSchema>;
10
+ export type EndpointHandler = (parameters: Record<string, any>, context: EndpointContext) => Promise<any> | any;
11
+ export type EndpointContext = {
12
+ container: Container<any>;
13
+ request: any;
14
+ response: any;
15
+ query: Record<string, any>;
16
+ body: Record<string, any>;
17
+ params: Record<string, any>;
18
+ };
19
+ export interface EndpointRateLimit {
20
+ /** Maximum requests allowed per window */
21
+ maxRequests: number;
22
+ /** Window size in seconds (default: 1) */
23
+ windowSeconds?: number;
24
+ }
25
+ export interface EndpointModule {
26
+ path: string;
27
+ get?: EndpointHandler;
28
+ post?: EndpointHandler;
29
+ put?: EndpointHandler;
30
+ patch?: EndpointHandler;
31
+ delete?: EndpointHandler;
32
+ getSchema?: z.ZodType;
33
+ postSchema?: z.ZodType;
34
+ putSchema?: z.ZodType;
35
+ patchSchema?: z.ZodType;
36
+ deleteSchema?: z.ZodType;
37
+ /** Rate limit applied to all methods on this endpoint */
38
+ rateLimit?: EndpointRateLimit;
39
+ /** Per-method rate limits (overrides the endpoint-level rateLimit) */
40
+ getRateLimit?: EndpointRateLimit;
41
+ postRateLimit?: EndpointRateLimit;
42
+ putRateLimit?: EndpointRateLimit;
43
+ patchRateLimit?: EndpointRateLimit;
44
+ deleteRateLimit?: EndpointRateLimit;
45
+ description?: string;
46
+ tags?: string[];
47
+ }
48
+ /**
49
+ * Sliding-window rate limiter keyed by IP address.
50
+ * Tracks timestamps of requests and prunes entries older than the window.
51
+ */
52
+ declare class RateLimiter {
53
+ private _windows;
54
+ /** Returns true if the request is allowed, false if rate-limited. */
55
+ allow(key: string, maxRequests: number, windowMs: number): boolean;
56
+ /** Clear all tracking state */
57
+ reset(): void;
58
+ }
59
+ export type EndpointFactory = <T extends keyof AvailableEndpoints>(key: T, options?: ConstructorParameters<AvailableEndpoints[T]>[0]) => NonNullable<InstanceType<AvailableEndpoints[T]>>;
60
+ export interface EndpointsInterface {
61
+ endpoints: EndpointsRegistry;
62
+ endpoint: EndpointFactory;
63
+ }
64
+ export declare class Endpoint<T extends EndpointState = EndpointState, K extends EndpointOptions = EndpointOptions> extends Helper<T, K> {
65
+ static shortcut: string;
66
+ static description: string;
67
+ static stateSchema: z.ZodObject<{
68
+ mounted: z.ZodDefault<z.ZodBoolean>;
69
+ path: z.ZodDefault<z.ZodString>;
70
+ methods: z.ZodDefault<z.ZodArray<z.ZodString>>;
71
+ requestCount: z.ZodDefault<z.ZodNumber>;
72
+ }, z.core.$loose>;
73
+ static optionsSchema: z.ZodObject<{
74
+ name: z.ZodOptional<z.ZodString>;
75
+ _cacheKey: z.ZodOptional<z.ZodString>;
76
+ path: z.ZodString;
77
+ filePath: z.ZodOptional<z.ZodString>;
78
+ }, z.core.$strip>;
79
+ static eventsSchema: z.ZodObject<{
80
+ stateChange: z.ZodTuple<[z.ZodAny], null>;
81
+ loaded: z.ZodTuple<[z.ZodAny], null>;
82
+ mounted: z.ZodTuple<[z.ZodString], null>;
83
+ request: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodAny], null>;
84
+ error: z.ZodTuple<[z.ZodAny], null>;
85
+ }, z.core.$strip>;
86
+ private _module;
87
+ private _rateLimiter;
88
+ static attach(container: Container & EndpointsInterface): any;
89
+ get initialState(): T;
90
+ get path(): string;
91
+ get module(): EndpointModule | null;
92
+ get methods(): string[];
93
+ get isMounted(): boolean;
94
+ load(mod?: EndpointModule): Promise<this>;
95
+ reload(): Promise<this>;
96
+ handler(method: string): EndpointHandler | undefined;
97
+ schema(method: string): z.ZodType | undefined;
98
+ /** Returns the rate limit config for a given method, or undefined if none. */
99
+ rateLimitFor(method: string): EndpointRateLimit | undefined;
100
+ /** Access the rate limiter instance (useful for testing or manual resets) */
101
+ get rateLimiter(): RateLimiter;
102
+ mount(app: any): this;
103
+ toOpenAPIPathItem(): Record<string, any>;
104
+ }
105
+ export declare function warnUnknownExports(mod: Record<string, any>, filePath: string): void;
106
+ export declare class EndpointsRegistry extends Registry<Endpoint<any>> {
107
+ scope: string;
108
+ baseClass: typeof Endpoint;
109
+ }
110
+ export declare const endpoints: EndpointsRegistry;
111
+ export declare const helperCache: Map<any, any>;
112
+ export default Endpoint;
113
+ //# sourceMappingURL=endpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../src/endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,gBAAgB,CAAA;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAwB,MAAM,mBAAmB,CAAA;AAEpG,MAAM,WAAW,kBAAkB;CAAG;AAEtC,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnE,MAAM,MAAM,eAAe,GAAG,CAC5B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC/B,OAAO,EAAE,eAAe,KACrB,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;AAEvB,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,CAAA;IACzB,OAAO,EAAE,GAAG,CAAA;IACZ,QAAQ,EAAE,GAAG,CAAA;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACzB,M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AM,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IAK3D,6EAA6E;IAC7E,IAAI,WAAW,IAAI,WAAW,CAE7B;IAED,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI;IAmErB,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAoDzC;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAKnF;AAED,qBAAa,iBAAkB,SAAQ,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACnD,KAAK,SAAc;IACnB,SAAS,kBAAW;CAC9B;AAED,eAAO,MAAM,SAAS,mBAA0B,CAAA;AAEhD,eAAO,MAAM,WAAW,eAAY,CAAA;AAEpC,eAAe,QAAQ,CAAA"}
@@ -0,0 +1,47 @@
1
+ import { Helper } from './helper.js';
2
+ import { Registry } from './registry.js';
3
+ import type { ContainerContext } from './container.js';
4
+ import type { YAML } from './node/features/yaml.js';
5
+ import { z } from 'zod';
6
+ import { FeatureStateSchema, FeatureOptionsSchema } from './schemas/base.js';
7
+ /**
8
+ * Use module augmentation to register features, the same way you would register
9
+ * them at runtime. This will help developers get autocomplete etc.
10
+ */
11
+ export interface AvailableFeatures {
12
+ yaml: typeof YAML;
13
+ }
14
+ export type FeatureOptions = z.infer<typeof FeatureOptionsSchema>;
15
+ export type FeatureState = z.infer<typeof FeatureStateSchema>;
16
+ export declare abstract class Feature<T extends FeatureState = FeatureState, K extends FeatureOptions = FeatureOptions> extends Helper<T, K> {
17
+ static stateSchema: z.ZodObject<{
18
+ enabled: z.ZodDefault<z.ZodBoolean>;
19
+ }, z.core.$loose>;
20
+ static optionsSchema: z.ZodObject<{
21
+ name: z.ZodOptional<z.ZodString>;
22
+ _cacheKey: z.ZodOptional<z.ZodString>;
23
+ cached: z.ZodOptional<z.ZodBoolean>;
24
+ enable: z.ZodOptional<z.ZodBoolean>;
25
+ }, z.core.$strip>;
26
+ static eventsSchema: z.ZodObject<{
27
+ stateChange: z.ZodTuple<[z.ZodAny], null>;
28
+ enabled: z.ZodTuple<[], null>;
29
+ }, z.core.$strip>;
30
+ /** Self-register a Feature subclass from a static initialization block. */
31
+ static register: (SubClass: typeof Feature, id?: string) => typeof Feature;
32
+ get shortcut(): string;
33
+ get isEnabled(): T["enabled"] | undefined;
34
+ constructor(options: K, context: ContainerContext);
35
+ /**
36
+ * For features where there only needs to be a single instance, you
37
+ * can use this method to attach the feature to the container.
38
+ */
39
+ protected attachToContainer(): void;
40
+ enable(options?: any): Promise<this>;
41
+ }
42
+ export declare class FeaturesRegistry extends Registry<Feature<any, any>> {
43
+ scope: string;
44
+ baseClass: any;
45
+ }
46
+ export declare const features: FeaturesRegistry;
47
+ //# sourceMappingURL=feature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../src/feature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAuB,MAAM,mBAAmB,CAAA;AAEjG;;;EAGE;AACF,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,OAAO,IAAI,CAAA;CACpB;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AACjE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAE7D,8BAAsB,OAAO,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,EAAE,CAAC,SAAS,cAAc,GAAG,cAAc,CAAE,SAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;IAChI,OAAgB,WAAW;;sBAAqB;IAChD,OAAgB,aAAa;;;;;sBAAuB;IACpD,OAAgB,YAAY;;;sBAAsB;IAElD,2EAA2E;IAC3E,MAAM,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,OAAO,EAAE,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,OAAO,CAAA;IAE1E,IAAI,QAAQ,IACqC,MAAM,CACtD;IAED,IAAI,SAAS,6BAEZ;gBAEW,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,gBAAgB;IAcjD;;;MAGE;IACF,SAAS,CAAC,iBAAiB;IAQrB,MAAM,CAAC,OAAO,GAAE,GAAQ,GAAI,OAAO,CAAC,IAAI,CAAC;CASlD;AAED,qBAAa,gBAAiB,SAAQ,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACpD,KAAK,SAAa;IAClB,SAAS,EAAc,GAAG,CAAA;CACtC;AAED,eAAO,MAAM,QAAQ,kBAAyB,CAAA"}
@@ -0,0 +1,29 @@
1
+ import { Helper } from './helper.js';
2
+ export type GraftScope = 'features' | 'clients' | 'servers' | 'commands' | 'endpoints' | 'selectors';
3
+ /**
4
+ * Returns true when the candidate is a class (constructor function) whose
5
+ * prototype chain includes BaseClass. Handles cross-module-boundary cases
6
+ * by checking both reference equality and class name.
7
+ */
8
+ export declare function isNativeHelperClass(candidate: unknown, BaseClass: typeof Helper | any): boolean;
9
+ /**
10
+ * Synthesize a Helper subclass from plain module exports.
11
+ *
12
+ * Given a set of exports from a module file and a Helper base class, produces a
13
+ * fully-formed subclass ready for registration in the appropriate registry.
14
+ *
15
+ * Static export mappings:
16
+ * description → static description
17
+ * stateSchema → static stateSchema
18
+ * optionsSchema → static optionsSchema (also aliased from `args`)
19
+ * eventsSchema → static eventsSchema
20
+ * envVars → static envVars
21
+ * argsSchema → static argsSchema (Command scope; also aliased from `args`)
22
+ * positionals → static positionals (Command scope; stored for CLI dispatch mapping)
23
+ * getters → Object.defineProperty(proto, key, { get }) per key
24
+ * run → override run() for Command scope (receives named args + context)
25
+ * handler → legacy: wired through parseArgs() for backward compat
26
+ * [fn exports] → prototype methods (all other function-valued named exports)
27
+ */
28
+ export declare function graftModule<T extends typeof Helper>(BaseClass: T, moduleExports: Record<string, any>, id: string, scope: GraftScope): T;
29
+ //# sourceMappingURL=graft.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graft.d.ts","sourceRoot":"","sources":["../src/graft.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGpC,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,WAAW,CAAA;AAiBpG;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,MAAM,GAAG,GAAG,GAAG,OAAO,CAY/F;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,OAAO,MAAM,EAClD,SAAS,EAAE,CAAC,EACZ,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAClC,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,UAAU,GACf,CAAC,CAsGH"}