@portel/photon 1.4.1 → 1.6.0

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 (395) hide show
  1. package/README.md +326 -1177
  2. package/dist/auto-ui/beam.d.ts +14 -0
  3. package/dist/auto-ui/beam.d.ts.map +1 -0
  4. package/dist/auto-ui/beam.js +3057 -0
  5. package/dist/auto-ui/beam.js.map +1 -0
  6. package/dist/auto-ui/bridge/index.d.ts +37 -0
  7. package/dist/auto-ui/bridge/index.d.ts.map +1 -0
  8. package/dist/auto-ui/bridge/index.js +555 -0
  9. package/dist/auto-ui/bridge/index.js.map +1 -0
  10. package/dist/auto-ui/bridge/openai-shim.d.ts +20 -0
  11. package/dist/auto-ui/bridge/openai-shim.d.ts.map +1 -0
  12. package/dist/auto-ui/bridge/openai-shim.js +231 -0
  13. package/dist/auto-ui/bridge/openai-shim.js.map +1 -0
  14. package/dist/auto-ui/bridge/photon-app.d.ts +162 -0
  15. package/dist/auto-ui/bridge/photon-app.d.ts.map +1 -0
  16. package/dist/auto-ui/bridge/photon-app.js +460 -0
  17. package/dist/auto-ui/bridge/photon-app.js.map +1 -0
  18. package/dist/auto-ui/bridge/types.d.ts +128 -0
  19. package/dist/auto-ui/bridge/types.d.ts.map +1 -0
  20. package/dist/auto-ui/bridge/types.js +7 -0
  21. package/dist/auto-ui/bridge/types.js.map +1 -0
  22. package/dist/auto-ui/components/card.d.ts +13 -0
  23. package/dist/auto-ui/components/card.d.ts.map +1 -0
  24. package/dist/auto-ui/components/card.js +64 -0
  25. package/dist/auto-ui/components/card.js.map +1 -0
  26. package/dist/auto-ui/components/form.d.ts +15 -0
  27. package/dist/auto-ui/components/form.d.ts.map +1 -0
  28. package/dist/auto-ui/components/form.js +72 -0
  29. package/dist/auto-ui/components/form.js.map +1 -0
  30. package/dist/auto-ui/components/list.d.ts +13 -0
  31. package/dist/auto-ui/components/list.d.ts.map +1 -0
  32. package/dist/auto-ui/components/list.js +58 -0
  33. package/dist/auto-ui/components/list.js.map +1 -0
  34. package/dist/auto-ui/components/progress.d.ts +18 -0
  35. package/dist/auto-ui/components/progress.d.ts.map +1 -0
  36. package/dist/auto-ui/components/progress.js +125 -0
  37. package/dist/auto-ui/components/progress.js.map +1 -0
  38. package/dist/auto-ui/components/table.d.ts +13 -0
  39. package/dist/auto-ui/components/table.d.ts.map +1 -0
  40. package/dist/auto-ui/components/table.js +82 -0
  41. package/dist/auto-ui/components/table.js.map +1 -0
  42. package/dist/auto-ui/components/tree.d.ts +13 -0
  43. package/dist/auto-ui/components/tree.d.ts.map +1 -0
  44. package/dist/auto-ui/components/tree.js +61 -0
  45. package/dist/auto-ui/components/tree.js.map +1 -0
  46. package/dist/auto-ui/daemon-tools.d.ts +45 -0
  47. package/dist/auto-ui/daemon-tools.d.ts.map +1 -0
  48. package/dist/auto-ui/daemon-tools.js +580 -0
  49. package/dist/auto-ui/daemon-tools.js.map +1 -0
  50. package/dist/auto-ui/design-system/index.d.ts +21 -0
  51. package/dist/auto-ui/design-system/index.d.ts.map +1 -0
  52. package/dist/auto-ui/design-system/index.js +27 -0
  53. package/dist/auto-ui/design-system/index.js.map +1 -0
  54. package/dist/auto-ui/design-system/tokens.d.ts +9 -0
  55. package/dist/auto-ui/design-system/tokens.d.ts.map +1 -0
  56. package/dist/auto-ui/design-system/tokens.js +27 -0
  57. package/dist/auto-ui/design-system/tokens.js.map +1 -0
  58. package/dist/auto-ui/design-system/transaction-ui.d.ts +70 -0
  59. package/dist/auto-ui/design-system/transaction-ui.d.ts.map +1 -0
  60. package/dist/auto-ui/design-system/transaction-ui.js +982 -0
  61. package/dist/auto-ui/design-system/transaction-ui.js.map +1 -0
  62. package/dist/auto-ui/frontend/index.html +84 -0
  63. package/dist/auto-ui/index.d.ts +23 -0
  64. package/dist/auto-ui/index.d.ts.map +1 -0
  65. package/dist/auto-ui/index.js +28 -0
  66. package/dist/auto-ui/index.js.map +1 -0
  67. package/dist/auto-ui/openapi-generator.d.ts +71 -0
  68. package/dist/auto-ui/openapi-generator.d.ts.map +1 -0
  69. package/dist/auto-ui/openapi-generator.js +223 -0
  70. package/dist/auto-ui/openapi-generator.js.map +1 -0
  71. package/dist/auto-ui/photon-bridge.d.ts +159 -0
  72. package/dist/auto-ui/photon-bridge.d.ts.map +1 -0
  73. package/dist/auto-ui/photon-bridge.js +262 -0
  74. package/dist/auto-ui/photon-bridge.js.map +1 -0
  75. package/dist/auto-ui/photon-host.d.ts +113 -0
  76. package/dist/auto-ui/photon-host.d.ts.map +1 -0
  77. package/dist/auto-ui/photon-host.js +284 -0
  78. package/dist/auto-ui/photon-host.js.map +1 -0
  79. package/dist/auto-ui/platform-compat.d.ts +71 -0
  80. package/dist/auto-ui/platform-compat.d.ts.map +1 -0
  81. package/dist/auto-ui/platform-compat.js +628 -0
  82. package/dist/auto-ui/platform-compat.js.map +1 -0
  83. package/dist/auto-ui/playground-html.d.ts +15 -0
  84. package/dist/auto-ui/playground-html.d.ts.map +1 -0
  85. package/dist/auto-ui/playground-html.js +1113 -0
  86. package/dist/auto-ui/playground-html.js.map +1 -0
  87. package/dist/auto-ui/playground-server.d.ts +7 -0
  88. package/dist/auto-ui/playground-server.d.ts.map +1 -0
  89. package/dist/auto-ui/playground-server.js +840 -0
  90. package/dist/auto-ui/playground-server.js.map +1 -0
  91. package/dist/auto-ui/registry.d.ts +13 -0
  92. package/dist/auto-ui/registry.d.ts.map +1 -0
  93. package/dist/auto-ui/registry.js +62 -0
  94. package/dist/auto-ui/registry.js.map +1 -0
  95. package/dist/auto-ui/renderer.d.ts +14 -0
  96. package/dist/auto-ui/renderer.d.ts.map +1 -0
  97. package/dist/auto-ui/renderer.js +88 -0
  98. package/dist/auto-ui/renderer.js.map +1 -0
  99. package/dist/auto-ui/rendering/components.d.ts +29 -0
  100. package/dist/auto-ui/rendering/components.d.ts.map +1 -0
  101. package/dist/auto-ui/rendering/components.js +773 -0
  102. package/dist/auto-ui/rendering/components.js.map +1 -0
  103. package/dist/auto-ui/rendering/field-analyzer.d.ts +48 -0
  104. package/dist/auto-ui/rendering/field-analyzer.d.ts.map +1 -0
  105. package/dist/auto-ui/rendering/field-analyzer.js +270 -0
  106. package/dist/auto-ui/rendering/field-analyzer.js.map +1 -0
  107. package/dist/auto-ui/rendering/field-renderers.d.ts +64 -0
  108. package/dist/auto-ui/rendering/field-renderers.d.ts.map +1 -0
  109. package/dist/auto-ui/rendering/field-renderers.js +317 -0
  110. package/dist/auto-ui/rendering/field-renderers.js.map +1 -0
  111. package/dist/auto-ui/rendering/index.d.ts +28 -0
  112. package/dist/auto-ui/rendering/index.d.ts.map +1 -0
  113. package/dist/auto-ui/rendering/index.js +60 -0
  114. package/dist/auto-ui/rendering/index.js.map +1 -0
  115. package/dist/auto-ui/rendering/layout-selector.d.ts +48 -0
  116. package/dist/auto-ui/rendering/layout-selector.d.ts.map +1 -0
  117. package/dist/auto-ui/rendering/layout-selector.js +352 -0
  118. package/dist/auto-ui/rendering/layout-selector.js.map +1 -0
  119. package/dist/auto-ui/rendering/template-engine.d.ts +41 -0
  120. package/dist/auto-ui/rendering/template-engine.d.ts.map +1 -0
  121. package/dist/auto-ui/rendering/template-engine.js +238 -0
  122. package/dist/auto-ui/rendering/template-engine.js.map +1 -0
  123. package/dist/auto-ui/streamable-http-transport.d.ts +103 -0
  124. package/dist/auto-ui/streamable-http-transport.d.ts.map +1 -0
  125. package/dist/auto-ui/streamable-http-transport.js +1875 -0
  126. package/dist/auto-ui/streamable-http-transport.js.map +1 -0
  127. package/dist/auto-ui/types.d.ts +384 -0
  128. package/dist/auto-ui/types.d.ts.map +1 -0
  129. package/dist/auto-ui/types.js +92 -0
  130. package/dist/auto-ui/types.js.map +1 -0
  131. package/dist/beam.bundle.js +63137 -0
  132. package/dist/beam.bundle.js.map +7 -0
  133. package/dist/claude-code-plugin.d.ts.map +1 -1
  134. package/dist/claude-code-plugin.js +30 -30
  135. package/dist/claude-code-plugin.js.map +1 -1
  136. package/dist/cli/commands/info.d.ts +11 -0
  137. package/dist/cli/commands/info.d.ts.map +1 -0
  138. package/dist/cli/commands/info.js +313 -0
  139. package/dist/cli/commands/info.js.map +1 -0
  140. package/dist/cli/commands/marketplace.d.ts +11 -0
  141. package/dist/cli/commands/marketplace.d.ts.map +1 -0
  142. package/dist/cli/commands/marketplace.js +198 -0
  143. package/dist/cli/commands/marketplace.js.map +1 -0
  144. package/dist/cli/commands/package-app.d.ts +9 -0
  145. package/dist/cli/commands/package-app.d.ts.map +1 -0
  146. package/dist/cli/commands/package-app.js +191 -0
  147. package/dist/cli/commands/package-app.js.map +1 -0
  148. package/dist/cli/commands/package.d.ts +11 -0
  149. package/dist/cli/commands/package.d.ts.map +1 -0
  150. package/dist/cli/commands/package.js +573 -0
  151. package/dist/cli/commands/package.js.map +1 -0
  152. package/dist/cli-alias.d.ts.map +1 -1
  153. package/dist/cli-alias.js +30 -28
  154. package/dist/cli-alias.js.map +1 -1
  155. package/dist/cli-formatter.d.ts +8 -24
  156. package/dist/cli-formatter.d.ts.map +1 -1
  157. package/dist/cli-formatter.js +8 -325
  158. package/dist/cli-formatter.js.map +1 -1
  159. package/dist/cli.d.ts +15 -1
  160. package/dist/cli.d.ts.map +1 -1
  161. package/dist/cli.js +1166 -1131
  162. package/dist/cli.js.map +1 -1
  163. package/dist/daemon/client.d.ts +84 -3
  164. package/dist/daemon/client.d.ts.map +1 -1
  165. package/dist/daemon/client.js +561 -11
  166. package/dist/daemon/client.js.map +1 -1
  167. package/dist/daemon/manager.d.ts +51 -12
  168. package/dist/daemon/manager.d.ts.map +1 -1
  169. package/dist/daemon/manager.js +122 -61
  170. package/dist/daemon/manager.js.map +1 -1
  171. package/dist/daemon/protocol.d.ts +62 -6
  172. package/dist/daemon/protocol.d.ts.map +1 -1
  173. package/dist/daemon/protocol.js +76 -1
  174. package/dist/daemon/protocol.js.map +1 -1
  175. package/dist/daemon/server.d.ts +6 -6
  176. package/dist/daemon/server.js +743 -133
  177. package/dist/daemon/server.js.map +1 -1
  178. package/dist/daemon/session-manager.d.ts +8 -1
  179. package/dist/daemon/session-manager.d.ts.map +1 -1
  180. package/dist/daemon/session-manager.js +32 -9
  181. package/dist/daemon/session-manager.js.map +1 -1
  182. package/dist/deploy/cloudflare.d.ts +12 -0
  183. package/dist/deploy/cloudflare.d.ts.map +1 -0
  184. package/dist/deploy/cloudflare.js +216 -0
  185. package/dist/deploy/cloudflare.js.map +1 -0
  186. package/dist/index.d.ts +1 -0
  187. package/dist/index.d.ts.map +1 -1
  188. package/dist/index.js +3 -0
  189. package/dist/index.js.map +1 -1
  190. package/dist/loader.d.ts +191 -21
  191. package/dist/loader.d.ts.map +1 -1
  192. package/dist/loader.js +1186 -319
  193. package/dist/loader.js.map +1 -1
  194. package/dist/markdown-utils.d.ts +8 -0
  195. package/dist/markdown-utils.d.ts.map +1 -0
  196. package/dist/markdown-utils.js +63 -0
  197. package/dist/markdown-utils.js.map +1 -0
  198. package/dist/marketplace-manager.d.ts +10 -0
  199. package/dist/marketplace-manager.d.ts.map +1 -1
  200. package/dist/marketplace-manager.js +112 -28
  201. package/dist/marketplace-manager.js.map +1 -1
  202. package/dist/mcp-client.d.ts +9 -0
  203. package/dist/mcp-client.d.ts.map +1 -0
  204. package/dist/mcp-client.js +11 -0
  205. package/dist/mcp-client.js.map +1 -0
  206. package/dist/mcp-elicitation.d.ts +32 -0
  207. package/dist/mcp-elicitation.d.ts.map +1 -0
  208. package/dist/mcp-elicitation.js +26 -0
  209. package/dist/mcp-elicitation.js.map +1 -0
  210. package/dist/path-resolver.d.ts +9 -12
  211. package/dist/path-resolver.d.ts.map +1 -1
  212. package/dist/path-resolver.js +13 -43
  213. package/dist/path-resolver.js.map +1 -1
  214. package/dist/photon-cli-runner.d.ts.map +1 -1
  215. package/dist/photon-cli-runner.js +204 -77
  216. package/dist/photon-cli-runner.js.map +1 -1
  217. package/dist/photon-doc-extractor.d.ts +89 -0
  218. package/dist/photon-doc-extractor.d.ts.map +1 -1
  219. package/dist/photon-doc-extractor.js +560 -32
  220. package/dist/photon-doc-extractor.js.map +1 -1
  221. package/dist/photons/maker.photon.d.ts +182 -0
  222. package/dist/photons/maker.photon.d.ts.map +1 -0
  223. package/dist/photons/maker.photon.js +504 -0
  224. package/dist/photons/maker.photon.js.map +1 -0
  225. package/dist/photons/maker.photon.ts +626 -0
  226. package/dist/photons/marketplace.photon.d.ts +110 -0
  227. package/dist/photons/marketplace.photon.d.ts.map +1 -0
  228. package/dist/photons/marketplace.photon.js +260 -0
  229. package/dist/photons/marketplace.photon.js.map +1 -0
  230. package/dist/photons/marketplace.photon.ts +378 -0
  231. package/dist/photons/tunnel.photon.d.ts +80 -0
  232. package/dist/photons/tunnel.photon.d.ts.map +1 -0
  233. package/dist/photons/tunnel.photon.js +269 -0
  234. package/dist/photons/tunnel.photon.js.map +1 -0
  235. package/dist/photons/tunnel.photon.ts +345 -0
  236. package/dist/security-scanner.d.ts.map +1 -1
  237. package/dist/security-scanner.js +18 -15
  238. package/dist/security-scanner.js.map +1 -1
  239. package/dist/serv/auth/jwt.d.ts +89 -0
  240. package/dist/serv/auth/jwt.d.ts.map +1 -0
  241. package/dist/serv/auth/jwt.js +239 -0
  242. package/dist/serv/auth/jwt.js.map +1 -0
  243. package/dist/serv/auth/oauth.d.ts +117 -0
  244. package/dist/serv/auth/oauth.d.ts.map +1 -0
  245. package/dist/serv/auth/oauth.js +395 -0
  246. package/dist/serv/auth/oauth.js.map +1 -0
  247. package/dist/serv/auth/well-known.d.ts +60 -0
  248. package/dist/serv/auth/well-known.d.ts.map +1 -0
  249. package/dist/serv/auth/well-known.js +154 -0
  250. package/dist/serv/auth/well-known.js.map +1 -0
  251. package/dist/serv/db/d1-client.d.ts +65 -0
  252. package/dist/serv/db/d1-client.d.ts.map +1 -0
  253. package/dist/serv/db/d1-client.js +137 -0
  254. package/dist/serv/db/d1-client.js.map +1 -0
  255. package/dist/serv/db/d1-stores.d.ts +62 -0
  256. package/dist/serv/db/d1-stores.d.ts.map +1 -0
  257. package/dist/serv/db/d1-stores.js +307 -0
  258. package/dist/serv/db/d1-stores.js.map +1 -0
  259. package/dist/serv/index.d.ts +114 -0
  260. package/dist/serv/index.d.ts.map +1 -0
  261. package/dist/serv/index.js +172 -0
  262. package/dist/serv/index.js.map +1 -0
  263. package/dist/serv/local.d.ts +118 -0
  264. package/dist/serv/local.d.ts.map +1 -0
  265. package/dist/serv/local.js +392 -0
  266. package/dist/serv/local.js.map +1 -0
  267. package/dist/serv/middleware/auth.d.ts +66 -0
  268. package/dist/serv/middleware/auth.d.ts.map +1 -0
  269. package/dist/serv/middleware/auth.js +178 -0
  270. package/dist/serv/middleware/auth.js.map +1 -0
  271. package/dist/serv/middleware/tenant.d.ts +94 -0
  272. package/dist/serv/middleware/tenant.d.ts.map +1 -0
  273. package/dist/serv/middleware/tenant.js +152 -0
  274. package/dist/serv/middleware/tenant.js.map +1 -0
  275. package/dist/serv/runtime/executor.d.ts +76 -0
  276. package/dist/serv/runtime/executor.d.ts.map +1 -0
  277. package/dist/serv/runtime/executor.js +105 -0
  278. package/dist/serv/runtime/executor.js.map +1 -0
  279. package/dist/serv/runtime/index.d.ts +8 -0
  280. package/dist/serv/runtime/index.d.ts.map +1 -0
  281. package/dist/serv/runtime/index.js +10 -0
  282. package/dist/serv/runtime/index.js.map +1 -0
  283. package/dist/serv/runtime/oauth-context.d.ts +121 -0
  284. package/dist/serv/runtime/oauth-context.d.ts.map +1 -0
  285. package/dist/serv/runtime/oauth-context.js +153 -0
  286. package/dist/serv/runtime/oauth-context.js.map +1 -0
  287. package/dist/serv/session/kv-store.d.ts +54 -0
  288. package/dist/serv/session/kv-store.d.ts.map +1 -0
  289. package/dist/serv/session/kv-store.js +149 -0
  290. package/dist/serv/session/kv-store.js.map +1 -0
  291. package/dist/serv/session/store.d.ts +113 -0
  292. package/dist/serv/session/store.d.ts.map +1 -0
  293. package/dist/serv/session/store.js +284 -0
  294. package/dist/serv/session/store.js.map +1 -0
  295. package/dist/serv/types/index.d.ts +147 -0
  296. package/dist/serv/types/index.d.ts.map +1 -0
  297. package/dist/serv/types/index.js +8 -0
  298. package/dist/serv/types/index.js.map +1 -0
  299. package/dist/serv/vault/token-vault.d.ts +102 -0
  300. package/dist/serv/vault/token-vault.d.ts.map +1 -0
  301. package/dist/serv/vault/token-vault.js +177 -0
  302. package/dist/serv/vault/token-vault.js.map +1 -0
  303. package/dist/server.d.ts +184 -0
  304. package/dist/server.d.ts.map +1 -1
  305. package/dist/server.js +1995 -86
  306. package/dist/server.js.map +1 -1
  307. package/dist/shared/cli-sections.d.ts +6 -0
  308. package/dist/shared/cli-sections.d.ts.map +1 -0
  309. package/dist/shared/cli-sections.js +16 -0
  310. package/dist/shared/cli-sections.js.map +1 -0
  311. package/dist/shared/cli-utils.d.ts +81 -0
  312. package/dist/shared/cli-utils.d.ts.map +1 -0
  313. package/dist/shared/cli-utils.js +174 -0
  314. package/dist/shared/cli-utils.js.map +1 -0
  315. package/dist/shared/config-docs.d.ts +6 -0
  316. package/dist/shared/config-docs.d.ts.map +1 -0
  317. package/dist/shared/config-docs.js +6 -0
  318. package/dist/shared/config-docs.js.map +1 -0
  319. package/dist/shared/error-handler.d.ts +128 -0
  320. package/dist/shared/error-handler.d.ts.map +1 -0
  321. package/dist/shared/error-handler.js +342 -0
  322. package/dist/shared/error-handler.js.map +1 -0
  323. package/dist/shared/logger.d.ts +42 -0
  324. package/dist/shared/logger.d.ts.map +1 -0
  325. package/dist/shared/logger.js +123 -0
  326. package/dist/shared/logger.js.map +1 -0
  327. package/dist/shared/performance.d.ts +65 -0
  328. package/dist/shared/performance.d.ts.map +1 -0
  329. package/dist/shared/performance.js +136 -0
  330. package/dist/shared/performance.js.map +1 -0
  331. package/dist/shared/task-runner.d.ts +2 -0
  332. package/dist/shared/task-runner.d.ts.map +1 -0
  333. package/dist/shared/task-runner.js +16 -0
  334. package/dist/shared/task-runner.js.map +1 -0
  335. package/dist/shared/validation.d.ts +6 -0
  336. package/dist/shared/validation.d.ts.map +1 -0
  337. package/dist/shared/validation.js +6 -0
  338. package/dist/shared/validation.js.map +1 -0
  339. package/dist/shared-utils.d.ts +63 -0
  340. package/dist/shared-utils.d.ts.map +1 -0
  341. package/dist/shared-utils.js +123 -0
  342. package/dist/shared-utils.js.map +1 -0
  343. package/dist/template-manager.d.ts +23 -2
  344. package/dist/template-manager.d.ts.map +1 -1
  345. package/dist/template-manager.js +176 -87
  346. package/dist/template-manager.js.map +1 -1
  347. package/dist/test-client.d.ts.map +1 -1
  348. package/dist/test-client.js +10 -8
  349. package/dist/test-client.js.map +1 -1
  350. package/dist/test-runner.d.ts +52 -0
  351. package/dist/test-runner.d.ts.map +1 -0
  352. package/dist/test-runner.js +785 -0
  353. package/dist/test-runner.js.map +1 -0
  354. package/dist/testing.d.ts +103 -0
  355. package/dist/testing.d.ts.map +1 -0
  356. package/dist/testing.js +163 -0
  357. package/dist/testing.js.map +1 -0
  358. package/dist/version-checker.d.ts.map +1 -1
  359. package/dist/version-checker.js +2 -2
  360. package/dist/version-checker.js.map +1 -1
  361. package/dist/version.d.ts +10 -0
  362. package/dist/version.d.ts.map +1 -0
  363. package/dist/version.js +21 -0
  364. package/dist/version.js.map +1 -0
  365. package/dist/watcher.d.ts +6 -3
  366. package/dist/watcher.d.ts.map +1 -1
  367. package/dist/watcher.js +49 -10
  368. package/dist/watcher.js.map +1 -1
  369. package/package.json +57 -7
  370. package/templates/cloudflare/worker.ts.template +381 -0
  371. package/templates/cloudflare/wrangler.toml.template +9 -0
  372. package/dist/base.d.ts +0 -58
  373. package/dist/base.d.ts.map +0 -1
  374. package/dist/base.js +0 -92
  375. package/dist/base.js.map +0 -1
  376. package/dist/dependency-manager.d.ts +0 -49
  377. package/dist/dependency-manager.d.ts.map +0 -1
  378. package/dist/dependency-manager.js +0 -165
  379. package/dist/dependency-manager.js.map +0 -1
  380. package/dist/registry-manager.d.ts +0 -76
  381. package/dist/registry-manager.d.ts.map +0 -1
  382. package/dist/registry-manager.js +0 -220
  383. package/dist/registry-manager.js.map +0 -1
  384. package/dist/schema-extractor.d.ts +0 -110
  385. package/dist/schema-extractor.d.ts.map +0 -1
  386. package/dist/schema-extractor.js +0 -727
  387. package/dist/schema-extractor.js.map +0 -1
  388. package/dist/test-marketplace-sources.d.ts +0 -5
  389. package/dist/test-marketplace-sources.d.ts.map +0 -1
  390. package/dist/test-marketplace-sources.js +0 -53
  391. package/dist/test-marketplace-sources.js.map +0 -1
  392. package/dist/types.d.ts +0 -109
  393. package/dist/types.d.ts.map +0 -1
  394. package/dist/types.js +0 -12
  395. package/dist/types.js.map +0 -1
@@ -8,10 +8,13 @@
8
8
  import * as net from 'net';
9
9
  import * as crypto from 'crypto';
10
10
  import * as readline from 'readline';
11
- import { getSocketPath } from './manager.js';
11
+ import { getGlobalSocketPath, restartGlobalDaemon } from './manager.js';
12
+ import { createLogger } from '../shared/logger.js';
13
+ import { getErrorMessage } from '../shared/error-handler.js';
12
14
  // Generate session ID for this process
13
15
  // This ensures all commands from the same terminal session share the same photon instance
14
16
  const SESSION_ID = process.env.PHOTON_SESSION_ID || `cli-${process.pid}-${crypto.randomBytes(4).toString('hex')}`;
17
+ const logger = createLogger({ component: 'daemon-client', minimal: true });
15
18
  /**
16
19
  * Prompt user for input using readline
17
20
  */
@@ -21,9 +24,7 @@ async function promptUser(message, defaultValue) {
21
24
  input: process.stdin,
22
25
  output: process.stdout,
23
26
  });
24
- const prompt = defaultValue
25
- ? `${message} [${defaultValue}]: `
26
- : `${message}: `;
27
+ const prompt = defaultValue ? `${message} [${defaultValue}]: ` : `${message}: `;
27
28
  rl.question(prompt, (answer) => {
28
29
  rl.close();
29
30
  resolve(answer || defaultValue || null);
@@ -31,11 +32,37 @@ async function promptUser(message, defaultValue) {
31
32
  });
32
33
  }
33
34
  /**
34
- * Send command to daemon and wait for response
35
- * Handles bidirectional prompts - if daemon requests input, uses readline
35
+ * Check if an error indicates the daemon is unreachable (crashed or not started)
36
36
  */
37
- export async function sendCommand(photonName, method, args) {
38
- const socketPath = getSocketPath(photonName);
37
+ function isDaemonConnectionError(error) {
38
+ const msg = error instanceof Error ? error.message : String(error);
39
+ return msg.includes('ENOENT') || msg.includes('ECONNREFUSED') || msg.includes('Connection error');
40
+ }
41
+ /**
42
+ * Send command to daemon with auto-restart on connection failure.
43
+ * If the daemon is unreachable, restarts it and retries once.
44
+ */
45
+ export async function sendCommand(photonName, method, args, options) {
46
+ const maxRetries = options?.maxRetries ?? 1;
47
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
48
+ try {
49
+ return await sendCommandDirect(photonName, method, args);
50
+ }
51
+ catch (error) {
52
+ if (isDaemonConnectionError(error) && attempt < maxRetries) {
53
+ logger.info('Daemon unreachable, auto-restarting...');
54
+ await restartGlobalDaemon();
55
+ continue;
56
+ }
57
+ throw error;
58
+ }
59
+ }
60
+ }
61
+ /**
62
+ * Send command directly to daemon (no retry logic)
63
+ */
64
+ async function sendCommandDirect(photonName, method, args) {
65
+ const socketPath = getGlobalSocketPath();
39
66
  const requestId = `req_${Date.now()}_${Math.random()}`;
40
67
  return new Promise((resolve, reject) => {
41
68
  const client = net.createConnection(socketPath);
@@ -51,6 +78,7 @@ export async function sendCommand(photonName, method, args) {
51
78
  const request = {
52
79
  type: 'command',
53
80
  id: requestId,
81
+ photonName,
54
82
  sessionId: SESSION_ID,
55
83
  clientType: 'cli',
56
84
  method,
@@ -107,14 +135,14 @@ export async function sendCommand(photonName, method, args) {
107
135
  }
108
136
  }
109
137
  catch (error) {
110
- console.error(`[daemon-client] Error parsing response: ${error.message}`);
138
+ logger.warn('Failed to parse daemon response', { error: getErrorMessage(error) });
111
139
  }
112
140
  }
113
141
  });
114
142
  client.on('error', (error) => {
115
143
  clearTimeout(timeout);
116
144
  client.destroy();
117
- reject(new Error(`Connection error: ${error.message}`));
145
+ reject(new Error(`Connection error: ${getErrorMessage(error)}`));
118
146
  });
119
147
  client.on('end', () => {
120
148
  clearTimeout(timeout);
@@ -125,11 +153,480 @@ export async function sendCommand(photonName, method, args) {
125
153
  });
126
154
  });
127
155
  }
156
+ /**
157
+ * Subscribe to a channel on a daemon
158
+ * Returns an unsubscribe function
159
+ */
160
+ export async function subscribeChannel(photonName, channel, handler, options) {
161
+ const socketPath = getGlobalSocketPath();
162
+ const subscribeId = `sub_${Date.now()}_${Math.random().toString(36).slice(2)}`;
163
+ return new Promise((resolve, reject) => {
164
+ const client = net.createConnection(socketPath);
165
+ let subscribed = false;
166
+ let buffer = '';
167
+ client.on('connect', () => {
168
+ // Send subscribe request
169
+ const request = {
170
+ type: 'subscribe',
171
+ id: subscribeId,
172
+ photonName,
173
+ channel,
174
+ clientType: 'beam',
175
+ lastEventId: options?.lastEventId,
176
+ };
177
+ client.write(JSON.stringify(request) + '\n');
178
+ });
179
+ client.on('data', (chunk) => {
180
+ buffer += chunk.toString();
181
+ // Process complete JSON messages (newline-delimited)
182
+ const lines = buffer.split('\n');
183
+ buffer = lines.pop() || '';
184
+ for (const line of lines) {
185
+ if (!line.trim())
186
+ continue;
187
+ try {
188
+ const response = JSON.parse(line);
189
+ // Handle subscription confirmation
190
+ if (response.id === subscribeId && response.type === 'result') {
191
+ subscribed = true;
192
+ // Return unsubscribe function
193
+ resolve(() => {
194
+ if (!client.destroyed) {
195
+ const unsubRequest = {
196
+ type: 'unsubscribe',
197
+ id: `unsub_${Date.now()}`,
198
+ photonName,
199
+ channel,
200
+ };
201
+ client.write(JSON.stringify(unsubRequest) + '\n');
202
+ client.end();
203
+ }
204
+ });
205
+ }
206
+ // Handle refresh-needed signal (lastEventId too old)
207
+ if (response.type === 'refresh_needed') {
208
+ if (options?.onRefreshNeeded) {
209
+ options.onRefreshNeeded();
210
+ }
211
+ }
212
+ // Handle channel messages (supports wildcard subscriptions)
213
+ if (response.type === 'channel_message' && response.channel) {
214
+ const isMatch = channel.endsWith(':*')
215
+ ? response.channel.startsWith(channel.slice(0, -1)) // "kanban:*" matches "kanban:anything"
216
+ : response.channel === channel; // exact match
217
+ if (isMatch) {
218
+ handler(response.message, response.eventId);
219
+ }
220
+ }
221
+ // Handle errors
222
+ if (response.type === 'error' && response.id === subscribeId) {
223
+ reject(new Error(response.error || 'Subscription failed'));
224
+ }
225
+ }
226
+ catch {
227
+ // Ignore parse errors for partial messages
228
+ }
229
+ }
230
+ });
231
+ client.on('error', (error) => {
232
+ if (!subscribed) {
233
+ reject(new Error(`Connection error: ${getErrorMessage(error)}`));
234
+ }
235
+ });
236
+ client.on('end', () => {
237
+ if (!subscribed) {
238
+ reject(new Error('Connection closed before subscription confirmed'));
239
+ }
240
+ });
241
+ });
242
+ }
243
+ /**
244
+ * Publish a message to a channel on a daemon
245
+ */
246
+ export async function publishToChannel(photonName, channel, message) {
247
+ const socketPath = getGlobalSocketPath();
248
+ const requestId = `pub_${Date.now()}_${Math.random().toString(36).slice(2)}`;
249
+ return new Promise((resolve, reject) => {
250
+ const client = net.createConnection(socketPath);
251
+ const timeout = setTimeout(() => {
252
+ client.destroy();
253
+ reject(new Error('Publish timeout'));
254
+ }, 5000);
255
+ client.on('connect', () => {
256
+ const request = {
257
+ type: 'publish',
258
+ id: requestId,
259
+ photonName,
260
+ channel,
261
+ message,
262
+ };
263
+ client.write(JSON.stringify(request) + '\n');
264
+ });
265
+ client.on('data', (chunk) => {
266
+ try {
267
+ const response = JSON.parse(chunk.toString().trim());
268
+ if (response.id === requestId) {
269
+ clearTimeout(timeout);
270
+ client.destroy();
271
+ if (response.type === 'result') {
272
+ resolve();
273
+ }
274
+ else {
275
+ reject(new Error(response.error || 'Publish failed'));
276
+ }
277
+ }
278
+ }
279
+ catch {
280
+ // Ignore parse errors
281
+ }
282
+ });
283
+ client.on('error', (error) => {
284
+ clearTimeout(timeout);
285
+ client.destroy();
286
+ reject(new Error(`Connection error: ${getErrorMessage(error)}`));
287
+ });
288
+ });
289
+ }
290
+ /**
291
+ * Acquire a distributed lock
292
+ * Returns true if lock acquired, false if already held
293
+ */
294
+ export async function acquireLock(photonName, lockName, timeout) {
295
+ const socketPath = getGlobalSocketPath();
296
+ const requestId = `lock_${Date.now()}_${Math.random().toString(36).slice(2)}`;
297
+ return new Promise((resolve, reject) => {
298
+ const client = net.createConnection(socketPath);
299
+ const requestTimeout = setTimeout(() => {
300
+ client.destroy();
301
+ reject(new Error('Lock request timeout'));
302
+ }, 10000);
303
+ client.on('connect', () => {
304
+ const request = {
305
+ type: 'lock',
306
+ id: requestId,
307
+ photonName,
308
+ sessionId: SESSION_ID,
309
+ lockName,
310
+ lockTimeout: timeout,
311
+ };
312
+ client.write(JSON.stringify(request) + '\n');
313
+ });
314
+ client.on('data', (chunk) => {
315
+ try {
316
+ const response = JSON.parse(chunk.toString().trim());
317
+ if (response.id === requestId) {
318
+ clearTimeout(requestTimeout);
319
+ client.destroy();
320
+ if (response.type === 'result') {
321
+ resolve(response.data.acquired);
322
+ }
323
+ else {
324
+ reject(new Error(response.error || 'Lock failed'));
325
+ }
326
+ }
327
+ }
328
+ catch {
329
+ // Ignore parse errors
330
+ }
331
+ });
332
+ client.on('error', (error) => {
333
+ clearTimeout(requestTimeout);
334
+ client.destroy();
335
+ reject(new Error(`Connection error: ${getErrorMessage(error)}`));
336
+ });
337
+ });
338
+ }
339
+ /**
340
+ * Release a distributed lock
341
+ * Returns true if lock released, false if not held by this session
342
+ */
343
+ export async function releaseLock(photonName, lockName) {
344
+ const socketPath = getGlobalSocketPath();
345
+ const requestId = `unlock_${Date.now()}_${Math.random().toString(36).slice(2)}`;
346
+ return new Promise((resolve, reject) => {
347
+ const client = net.createConnection(socketPath);
348
+ const timeout = setTimeout(() => {
349
+ client.destroy();
350
+ reject(new Error('Unlock request timeout'));
351
+ }, 5000);
352
+ client.on('connect', () => {
353
+ const request = {
354
+ type: 'unlock',
355
+ id: requestId,
356
+ photonName,
357
+ sessionId: SESSION_ID,
358
+ lockName,
359
+ };
360
+ client.write(JSON.stringify(request) + '\n');
361
+ });
362
+ client.on('data', (chunk) => {
363
+ try {
364
+ const response = JSON.parse(chunk.toString().trim());
365
+ if (response.id === requestId) {
366
+ clearTimeout(timeout);
367
+ client.destroy();
368
+ if (response.type === 'result') {
369
+ resolve(response.data.released);
370
+ }
371
+ else {
372
+ reject(new Error(response.error || 'Unlock failed'));
373
+ }
374
+ }
375
+ }
376
+ catch {
377
+ // Ignore parse errors
378
+ }
379
+ });
380
+ client.on('error', (error) => {
381
+ clearTimeout(timeout);
382
+ client.destroy();
383
+ reject(new Error(`Connection error: ${getErrorMessage(error)}`));
384
+ });
385
+ });
386
+ }
387
+ /**
388
+ * List all active locks
389
+ */
390
+ export async function listLocks(photonName) {
391
+ const socketPath = getGlobalSocketPath();
392
+ const requestId = `listlocks_${Date.now()}_${Math.random().toString(36).slice(2)}`;
393
+ return new Promise((resolve, reject) => {
394
+ const client = net.createConnection(socketPath);
395
+ const timeout = setTimeout(() => {
396
+ client.destroy();
397
+ reject(new Error('List locks request timeout'));
398
+ }, 5000);
399
+ client.on('connect', () => {
400
+ const request = {
401
+ type: 'list_locks',
402
+ id: requestId,
403
+ photonName,
404
+ };
405
+ client.write(JSON.stringify(request) + '\n');
406
+ });
407
+ client.on('data', (chunk) => {
408
+ try {
409
+ const response = JSON.parse(chunk.toString().trim());
410
+ if (response.id === requestId) {
411
+ clearTimeout(timeout);
412
+ client.destroy();
413
+ if (response.type === 'result') {
414
+ resolve(response.data.locks || []);
415
+ }
416
+ else {
417
+ reject(new Error(response.error || 'List locks failed'));
418
+ }
419
+ }
420
+ }
421
+ catch {
422
+ // Ignore parse errors
423
+ }
424
+ });
425
+ client.on('error', (error) => {
426
+ clearTimeout(timeout);
427
+ client.destroy();
428
+ reject(new Error(`Connection error: ${getErrorMessage(error)}`));
429
+ });
430
+ });
431
+ }
432
+ /**
433
+ * Schedule a recurring job
434
+ */
435
+ export async function scheduleJob(photonName, jobId, method, cron, args) {
436
+ const socketPath = getGlobalSocketPath();
437
+ const requestId = `schedule_${Date.now()}_${Math.random().toString(36).slice(2)}`;
438
+ return new Promise((resolve, reject) => {
439
+ const client = net.createConnection(socketPath);
440
+ const timeout = setTimeout(() => {
441
+ client.destroy();
442
+ reject(new Error('Schedule request timeout'));
443
+ }, 5000);
444
+ client.on('connect', () => {
445
+ const request = {
446
+ type: 'schedule',
447
+ id: requestId,
448
+ photonName,
449
+ sessionId: SESSION_ID,
450
+ jobId,
451
+ method,
452
+ cron,
453
+ args,
454
+ };
455
+ client.write(JSON.stringify(request) + '\n');
456
+ });
457
+ client.on('data', (chunk) => {
458
+ try {
459
+ const response = JSON.parse(chunk.toString().trim());
460
+ if (response.id === requestId) {
461
+ clearTimeout(timeout);
462
+ client.destroy();
463
+ if (response.type === 'result') {
464
+ resolve(response.data);
465
+ }
466
+ else {
467
+ reject(new Error(response.error || 'Schedule failed'));
468
+ }
469
+ }
470
+ }
471
+ catch {
472
+ // Ignore parse errors
473
+ }
474
+ });
475
+ client.on('error', (error) => {
476
+ clearTimeout(timeout);
477
+ client.destroy();
478
+ reject(new Error(`Connection error: ${getErrorMessage(error)}`));
479
+ });
480
+ });
481
+ }
482
+ /**
483
+ * Unschedule a job
484
+ */
485
+ export async function unscheduleJob(photonName, jobId) {
486
+ const socketPath = getGlobalSocketPath();
487
+ const requestId = `unschedule_${Date.now()}_${Math.random().toString(36).slice(2)}`;
488
+ return new Promise((resolve, reject) => {
489
+ const client = net.createConnection(socketPath);
490
+ const timeout = setTimeout(() => {
491
+ client.destroy();
492
+ reject(new Error('Unschedule request timeout'));
493
+ }, 5000);
494
+ client.on('connect', () => {
495
+ const request = {
496
+ type: 'unschedule',
497
+ id: requestId,
498
+ photonName,
499
+ jobId,
500
+ };
501
+ client.write(JSON.stringify(request) + '\n');
502
+ });
503
+ client.on('data', (chunk) => {
504
+ try {
505
+ const response = JSON.parse(chunk.toString().trim());
506
+ if (response.id === requestId) {
507
+ clearTimeout(timeout);
508
+ client.destroy();
509
+ if (response.type === 'result') {
510
+ resolve(response.data.unscheduled);
511
+ }
512
+ else {
513
+ reject(new Error(response.error || 'Unschedule failed'));
514
+ }
515
+ }
516
+ }
517
+ catch {
518
+ // Ignore parse errors
519
+ }
520
+ });
521
+ client.on('error', (error) => {
522
+ clearTimeout(timeout);
523
+ client.destroy();
524
+ reject(new Error(`Connection error: ${getErrorMessage(error)}`));
525
+ });
526
+ });
527
+ }
528
+ /**
529
+ * List all scheduled jobs
530
+ */
531
+ export async function listJobs(photonName) {
532
+ const socketPath = getGlobalSocketPath();
533
+ const requestId = `listjobs_${Date.now()}_${Math.random().toString(36).slice(2)}`;
534
+ return new Promise((resolve, reject) => {
535
+ const client = net.createConnection(socketPath);
536
+ const timeout = setTimeout(() => {
537
+ client.destroy();
538
+ reject(new Error('List jobs request timeout'));
539
+ }, 5000);
540
+ client.on('connect', () => {
541
+ const request = {
542
+ type: 'list_jobs',
543
+ id: requestId,
544
+ photonName,
545
+ };
546
+ client.write(JSON.stringify(request) + '\n');
547
+ });
548
+ client.on('data', (chunk) => {
549
+ try {
550
+ const response = JSON.parse(chunk.toString().trim());
551
+ if (response.id === requestId) {
552
+ clearTimeout(timeout);
553
+ client.destroy();
554
+ if (response.type === 'result') {
555
+ resolve(response.data.jobs || []);
556
+ }
557
+ else {
558
+ reject(new Error(response.error || 'List jobs failed'));
559
+ }
560
+ }
561
+ }
562
+ catch {
563
+ // Ignore parse errors
564
+ }
565
+ });
566
+ client.on('error', (error) => {
567
+ clearTimeout(timeout);
568
+ client.destroy();
569
+ reject(new Error(`Connection error: ${getErrorMessage(error)}`));
570
+ });
571
+ });
572
+ }
573
+ /**
574
+ * Reload the daemon's photon code without losing state
575
+ * Called by dev server after hot-reload to sync daemon
576
+ */
577
+ export async function reloadDaemon(photonName, photonPath) {
578
+ const socketPath = getGlobalSocketPath();
579
+ const requestId = `reload_${Date.now()}_${Math.random().toString(36).slice(2)}`;
580
+ return new Promise((resolve, reject) => {
581
+ const client = net.createConnection(socketPath);
582
+ const timeout = setTimeout(() => {
583
+ client.destroy();
584
+ reject(new Error('Reload request timeout'));
585
+ }, 30000); // 30 second timeout for reload
586
+ client.on('connect', () => {
587
+ const request = {
588
+ type: 'reload',
589
+ id: requestId,
590
+ photonName,
591
+ photonPath,
592
+ };
593
+ client.write(JSON.stringify(request) + '\n');
594
+ });
595
+ client.on('data', (chunk) => {
596
+ try {
597
+ const response = JSON.parse(chunk.toString().trim());
598
+ if (response.id === requestId) {
599
+ clearTimeout(timeout);
600
+ client.destroy();
601
+ if (response.type === 'result') {
602
+ const data = response.data;
603
+ resolve({
604
+ success: response.success ?? true,
605
+ error: data?.error,
606
+ sessionsUpdated: data?.sessionsUpdated,
607
+ });
608
+ }
609
+ else {
610
+ resolve({ success: false, error: response.error || 'Reload failed' });
611
+ }
612
+ }
613
+ }
614
+ catch {
615
+ // Ignore parse errors
616
+ }
617
+ });
618
+ client.on('error', (error) => {
619
+ clearTimeout(timeout);
620
+ client.destroy();
621
+ reject(new Error(`Connection error: ${getErrorMessage(error)}`));
622
+ });
623
+ });
624
+ }
128
625
  /**
129
626
  * Ping daemon to check if it's responsive
130
627
  */
131
628
  export async function pingDaemon(photonName) {
132
- const socketPath = getSocketPath(photonName);
629
+ const socketPath = getGlobalSocketPath();
133
630
  const requestId = `ping_${Date.now()}`;
134
631
  return new Promise((resolve) => {
135
632
  const client = net.createConnection(socketPath);
@@ -141,6 +638,7 @@ export async function pingDaemon(photonName) {
141
638
  const request = {
142
639
  type: 'ping',
143
640
  id: requestId,
641
+ photonName,
144
642
  };
145
643
  client.write(JSON.stringify(request) + '\n');
146
644
  });
@@ -169,4 +667,56 @@ export async function pingDaemon(photonName) {
169
667
  });
170
668
  });
171
669
  }
670
+ /**
671
+ * Get events since a specific eventId for a channel
672
+ * Used for explicit replay when client has missed events
673
+ */
674
+ export async function getEventsSince(photonName, channel, lastEventId) {
675
+ const socketPath = getGlobalSocketPath();
676
+ const requestId = `getevents_${Date.now()}_${Math.random().toString(36).slice(2)}`;
677
+ return new Promise((resolve, reject) => {
678
+ const client = net.createConnection(socketPath);
679
+ const timeout = setTimeout(() => {
680
+ client.destroy();
681
+ reject(new Error('Get events request timeout'));
682
+ }, 5000);
683
+ client.on('connect', () => {
684
+ const request = {
685
+ type: 'get_events_since',
686
+ id: requestId,
687
+ photonName,
688
+ channel,
689
+ lastEventId,
690
+ };
691
+ client.write(JSON.stringify(request) + '\n');
692
+ });
693
+ client.on('data', (chunk) => {
694
+ try {
695
+ const response = JSON.parse(chunk.toString().trim());
696
+ if (response.id === requestId) {
697
+ clearTimeout(timeout);
698
+ client.destroy();
699
+ if (response.type === 'result') {
700
+ const data = response.data;
701
+ resolve({
702
+ events: data.events || [],
703
+ refreshNeeded: data.refreshNeeded || false,
704
+ });
705
+ }
706
+ else {
707
+ reject(new Error(response.error || 'Get events failed'));
708
+ }
709
+ }
710
+ }
711
+ catch {
712
+ // Ignore parse errors
713
+ }
714
+ });
715
+ client.on('error', (error) => {
716
+ clearTimeout(timeout);
717
+ client.destroy();
718
+ reject(new Error(`Connection error: ${getErrorMessage(error)}`));
719
+ });
720
+ });
721
+ }
172
722
  //# sourceMappingURL=client.js.map