@waiaas/daemon 2.0.0-rc.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 (480) hide show
  1. package/dist/api/error-hints.d.ts +15 -0
  2. package/dist/api/error-hints.d.ts.map +1 -0
  3. package/dist/api/error-hints.js +71 -0
  4. package/dist/api/error-hints.js.map +1 -0
  5. package/dist/api/index.d.ts +11 -0
  6. package/dist/api/index.d.ts.map +1 -0
  7. package/dist/api/index.js +14 -0
  8. package/dist/api/index.js.map +1 -0
  9. package/dist/api/middleware/address-validation.d.ts +38 -0
  10. package/dist/api/middleware/address-validation.d.ts.map +1 -0
  11. package/dist/api/middleware/address-validation.js +134 -0
  12. package/dist/api/middleware/address-validation.js.map +1 -0
  13. package/dist/api/middleware/csp.d.ts +17 -0
  14. package/dist/api/middleware/csp.d.ts.map +1 -0
  15. package/dist/api/middleware/csp.js +31 -0
  16. package/dist/api/middleware/csp.js.map +1 -0
  17. package/dist/api/middleware/error-handler.d.ts +16 -0
  18. package/dist/api/middleware/error-handler.d.ts.map +1 -0
  19. package/dist/api/middleware/error-handler.js +46 -0
  20. package/dist/api/middleware/error-handler.js.map +1 -0
  21. package/dist/api/middleware/host-guard.d.ts +11 -0
  22. package/dist/api/middleware/host-guard.d.ts.map +1 -0
  23. package/dist/api/middleware/host-guard.js +25 -0
  24. package/dist/api/middleware/host-guard.js.map +1 -0
  25. package/dist/api/middleware/index.d.ts +13 -0
  26. package/dist/api/middleware/index.d.ts.map +1 -0
  27. package/dist/api/middleware/index.js +13 -0
  28. package/dist/api/middleware/index.js.map +1 -0
  29. package/dist/api/middleware/kill-switch-guard.d.ts +19 -0
  30. package/dist/api/middleware/kill-switch-guard.d.ts.map +1 -0
  31. package/dist/api/middleware/kill-switch-guard.js +49 -0
  32. package/dist/api/middleware/kill-switch-guard.js.map +1 -0
  33. package/dist/api/middleware/master-auth.d.ts +15 -0
  34. package/dist/api/middleware/master-auth.d.ts.map +1 -0
  35. package/dist/api/middleware/master-auth.js +35 -0
  36. package/dist/api/middleware/master-auth.js.map +1 -0
  37. package/dist/api/middleware/owner-auth.d.ts +30 -0
  38. package/dist/api/middleware/owner-auth.d.ts.map +1 -0
  39. package/dist/api/middleware/owner-auth.js +133 -0
  40. package/dist/api/middleware/owner-auth.js.map +1 -0
  41. package/dist/api/middleware/request-id.d.ts +10 -0
  42. package/dist/api/middleware/request-id.d.ts.map +1 -0
  43. package/dist/api/middleware/request-id.js +18 -0
  44. package/dist/api/middleware/request-id.js.map +1 -0
  45. package/dist/api/middleware/request-logger.d.ts +9 -0
  46. package/dist/api/middleware/request-logger.d.ts.map +1 -0
  47. package/dist/api/middleware/request-logger.js +18 -0
  48. package/dist/api/middleware/request-logger.js.map +1 -0
  49. package/dist/api/middleware/session-auth.d.ts +21 -0
  50. package/dist/api/middleware/session-auth.d.ts.map +1 -0
  51. package/dist/api/middleware/session-auth.js +51 -0
  52. package/dist/api/middleware/session-auth.js.map +1 -0
  53. package/dist/api/middleware/siwe-verify.d.ts +31 -0
  54. package/dist/api/middleware/siwe-verify.d.ts.map +1 -0
  55. package/dist/api/middleware/siwe-verify.js +55 -0
  56. package/dist/api/middleware/siwe-verify.js.map +1 -0
  57. package/dist/api/routes/actions.d.ts +56 -0
  58. package/dist/api/routes/actions.d.ts.map +1 -0
  59. package/dist/api/routes/actions.js +291 -0
  60. package/dist/api/routes/actions.js.map +1 -0
  61. package/dist/api/routes/admin.d.ts +99 -0
  62. package/dist/api/routes/admin.d.ts.map +1 -0
  63. package/dist/api/routes/admin.js +1304 -0
  64. package/dist/api/routes/admin.js.map +1 -0
  65. package/dist/api/routes/display-currency-helper.d.ts +26 -0
  66. package/dist/api/routes/display-currency-helper.d.ts.map +1 -0
  67. package/dist/api/routes/display-currency-helper.js +47 -0
  68. package/dist/api/routes/display-currency-helper.js.map +1 -0
  69. package/dist/api/routes/health.d.ts +14 -0
  70. package/dist/api/routes/health.d.ts.map +1 -0
  71. package/dist/api/routes/health.js +47 -0
  72. package/dist/api/routes/health.js.map +1 -0
  73. package/dist/api/routes/index.d.ts +15 -0
  74. package/dist/api/routes/index.d.ts.map +1 -0
  75. package/dist/api/routes/index.js +15 -0
  76. package/dist/api/routes/index.js.map +1 -0
  77. package/dist/api/routes/mcp.d.ts +30 -0
  78. package/dist/api/routes/mcp.d.ts.map +1 -0
  79. package/dist/api/routes/mcp.js +156 -0
  80. package/dist/api/routes/mcp.js.map +1 -0
  81. package/dist/api/routes/nonce.d.ts +20 -0
  82. package/dist/api/routes/nonce.d.ts.map +1 -0
  83. package/dist/api/routes/nonce.js +48 -0
  84. package/dist/api/routes/nonce.js.map +1 -0
  85. package/dist/api/routes/openapi-schemas.d.ts +2281 -0
  86. package/dist/api/routes/openapi-schemas.d.ts.map +1 -0
  87. package/dist/api/routes/openapi-schemas.js +770 -0
  88. package/dist/api/routes/openapi-schemas.js.map +1 -0
  89. package/dist/api/routes/policies.d.ts +29 -0
  90. package/dist/api/routes/policies.d.ts.map +1 -0
  91. package/dist/api/routes/policies.js +332 -0
  92. package/dist/api/routes/policies.js.map +1 -0
  93. package/dist/api/routes/sessions.d.ts +35 -0
  94. package/dist/api/routes/sessions.d.ts.map +1 -0
  95. package/dist/api/routes/sessions.js +347 -0
  96. package/dist/api/routes/sessions.js.map +1 -0
  97. package/dist/api/routes/skills.d.ts +9 -0
  98. package/dist/api/routes/skills.d.ts.map +1 -0
  99. package/dist/api/routes/skills.js +59 -0
  100. package/dist/api/routes/skills.js.map +1 -0
  101. package/dist/api/routes/tokens.d.ts +25 -0
  102. package/dist/api/routes/tokens.d.ts.map +1 -0
  103. package/dist/api/routes/tokens.js +161 -0
  104. package/dist/api/routes/tokens.js.map +1 -0
  105. package/dist/api/routes/transactions.d.ts +68 -0
  106. package/dist/api/routes/transactions.d.ts.map +1 -0
  107. package/dist/api/routes/transactions.js +576 -0
  108. package/dist/api/routes/transactions.js.map +1 -0
  109. package/dist/api/routes/utils.d.ts +9 -0
  110. package/dist/api/routes/utils.d.ts.map +1 -0
  111. package/dist/api/routes/utils.js +52 -0
  112. package/dist/api/routes/utils.js.map +1 -0
  113. package/dist/api/routes/wallet.d.ts +36 -0
  114. package/dist/api/routes/wallet.d.ts.map +1 -0
  115. package/dist/api/routes/wallet.js +358 -0
  116. package/dist/api/routes/wallet.js.map +1 -0
  117. package/dist/api/routes/wallets.d.ts +43 -0
  118. package/dist/api/routes/wallets.d.ts.map +1 -0
  119. package/dist/api/routes/wallets.js +630 -0
  120. package/dist/api/routes/wallets.js.map +1 -0
  121. package/dist/api/routes/wc.d.ts +46 -0
  122. package/dist/api/routes/wc.d.ts.map +1 -0
  123. package/dist/api/routes/wc.js +354 -0
  124. package/dist/api/routes/wc.js.map +1 -0
  125. package/dist/api/routes/x402.d.ts +61 -0
  126. package/dist/api/routes/x402.d.ts.map +1 -0
  127. package/dist/api/routes/x402.js +493 -0
  128. package/dist/api/routes/x402.js.map +1 -0
  129. package/dist/api/server.d.ts +81 -0
  130. package/dist/api/server.d.ts.map +1 -0
  131. package/dist/api/server.js +406 -0
  132. package/dist/api/server.js.map +1 -0
  133. package/dist/index.d.ts +35 -0
  134. package/dist/index.d.ts.map +1 -0
  135. package/dist/index.js +43 -0
  136. package/dist/index.js.map +1 -0
  137. package/dist/infrastructure/action/action-provider-registry.d.ts +77 -0
  138. package/dist/infrastructure/action/action-provider-registry.d.ts.map +1 -0
  139. package/dist/infrastructure/action/action-provider-registry.js +239 -0
  140. package/dist/infrastructure/action/action-provider-registry.js.map +1 -0
  141. package/dist/infrastructure/action/api-key-store.d.ts +60 -0
  142. package/dist/infrastructure/action/api-key-store.d.ts.map +1 -0
  143. package/dist/infrastructure/action/api-key-store.js +130 -0
  144. package/dist/infrastructure/action/api-key-store.js.map +1 -0
  145. package/dist/infrastructure/action/index.d.ts +10 -0
  146. package/dist/infrastructure/action/index.d.ts.map +1 -0
  147. package/dist/infrastructure/action/index.js +9 -0
  148. package/dist/infrastructure/action/index.js.map +1 -0
  149. package/dist/infrastructure/adapter-pool.d.ts +50 -0
  150. package/dist/infrastructure/adapter-pool.d.ts.map +1 -0
  151. package/dist/infrastructure/adapter-pool.js +110 -0
  152. package/dist/infrastructure/adapter-pool.js.map +1 -0
  153. package/dist/infrastructure/backup/backup-service.d.ts +53 -0
  154. package/dist/infrastructure/backup/backup-service.d.ts.map +1 -0
  155. package/dist/infrastructure/backup/backup-service.js +158 -0
  156. package/dist/infrastructure/backup/backup-service.js.map +1 -0
  157. package/dist/infrastructure/backup/index.d.ts +2 -0
  158. package/dist/infrastructure/backup/index.d.ts.map +1 -0
  159. package/dist/infrastructure/backup/index.js +2 -0
  160. package/dist/infrastructure/backup/index.js.map +1 -0
  161. package/dist/infrastructure/config/index.d.ts +8 -0
  162. package/dist/infrastructure/config/index.d.ts.map +1 -0
  163. package/dist/infrastructure/config/index.js +7 -0
  164. package/dist/infrastructure/config/index.js.map +1 -0
  165. package/dist/infrastructure/config/loader.d.ts +555 -0
  166. package/dist/infrastructure/config/loader.d.ts.map +1 -0
  167. package/dist/infrastructure/config/loader.js +311 -0
  168. package/dist/infrastructure/config/loader.js.map +1 -0
  169. package/dist/infrastructure/database/checks.d.ts +19 -0
  170. package/dist/infrastructure/database/checks.d.ts.map +1 -0
  171. package/dist/infrastructure/database/checks.js +27 -0
  172. package/dist/infrastructure/database/checks.js.map +1 -0
  173. package/dist/infrastructure/database/compatibility.d.ts +36 -0
  174. package/dist/infrastructure/database/compatibility.d.ts.map +1 -0
  175. package/dist/infrastructure/database/compatibility.js +75 -0
  176. package/dist/infrastructure/database/compatibility.js.map +1 -0
  177. package/dist/infrastructure/database/connection.d.ts +36 -0
  178. package/dist/infrastructure/database/connection.d.ts.map +1 -0
  179. package/dist/infrastructure/database/connection.js +47 -0
  180. package/dist/infrastructure/database/connection.js.map +1 -0
  181. package/dist/infrastructure/database/id.d.ts +17 -0
  182. package/dist/infrastructure/database/id.d.ts.map +1 -0
  183. package/dist/infrastructure/database/id.js +20 -0
  184. package/dist/infrastructure/database/id.js.map +1 -0
  185. package/dist/infrastructure/database/index.d.ts +15 -0
  186. package/dist/infrastructure/database/index.d.ts.map +1 -0
  187. package/dist/infrastructure/database/index.js +12 -0
  188. package/dist/infrastructure/database/index.js.map +1 -0
  189. package/dist/infrastructure/database/migrate.d.ts +76 -0
  190. package/dist/infrastructure/database/migrate.d.ts.map +1 -0
  191. package/dist/infrastructure/database/migrate.js +1214 -0
  192. package/dist/infrastructure/database/migrate.js.map +1 -0
  193. package/dist/infrastructure/database/schema.d.ts +2352 -0
  194. package/dist/infrastructure/database/schema.d.ts.map +1 -0
  195. package/dist/infrastructure/database/schema.js +288 -0
  196. package/dist/infrastructure/database/schema.js.map +1 -0
  197. package/dist/infrastructure/jwt/index.d.ts +2 -0
  198. package/dist/infrastructure/jwt/index.d.ts.map +1 -0
  199. package/dist/infrastructure/jwt/index.js +2 -0
  200. package/dist/infrastructure/jwt/index.js.map +1 -0
  201. package/dist/infrastructure/jwt/jwt-secret-manager.d.ts +58 -0
  202. package/dist/infrastructure/jwt/jwt-secret-manager.d.ts.map +1 -0
  203. package/dist/infrastructure/jwt/jwt-secret-manager.js +222 -0
  204. package/dist/infrastructure/jwt/jwt-secret-manager.js.map +1 -0
  205. package/dist/infrastructure/keystore/crypto.d.ts +62 -0
  206. package/dist/infrastructure/keystore/crypto.d.ts.map +1 -0
  207. package/dist/infrastructure/keystore/crypto.js +89 -0
  208. package/dist/infrastructure/keystore/crypto.js.map +1 -0
  209. package/dist/infrastructure/keystore/index.d.ts +4 -0
  210. package/dist/infrastructure/keystore/index.d.ts.map +1 -0
  211. package/dist/infrastructure/keystore/index.js +5 -0
  212. package/dist/infrastructure/keystore/index.js.map +1 -0
  213. package/dist/infrastructure/keystore/keystore.d.ts +115 -0
  214. package/dist/infrastructure/keystore/keystore.d.ts.map +1 -0
  215. package/dist/infrastructure/keystore/keystore.js +327 -0
  216. package/dist/infrastructure/keystore/keystore.js.map +1 -0
  217. package/dist/infrastructure/keystore/memory.d.ts +45 -0
  218. package/dist/infrastructure/keystore/memory.d.ts.map +1 -0
  219. package/dist/infrastructure/keystore/memory.js +105 -0
  220. package/dist/infrastructure/keystore/memory.js.map +1 -0
  221. package/dist/infrastructure/oracle/coingecko-forex.d.ts +35 -0
  222. package/dist/infrastructure/oracle/coingecko-forex.d.ts.map +1 -0
  223. package/dist/infrastructure/oracle/coingecko-forex.js +69 -0
  224. package/dist/infrastructure/oracle/coingecko-forex.js.map +1 -0
  225. package/dist/infrastructure/oracle/coingecko-oracle.d.ts +73 -0
  226. package/dist/infrastructure/oracle/coingecko-oracle.d.ts.map +1 -0
  227. package/dist/infrastructure/oracle/coingecko-oracle.js +199 -0
  228. package/dist/infrastructure/oracle/coingecko-oracle.js.map +1 -0
  229. package/dist/infrastructure/oracle/coingecko-platform-ids.d.ts +32 -0
  230. package/dist/infrastructure/oracle/coingecko-platform-ids.d.ts.map +1 -0
  231. package/dist/infrastructure/oracle/coingecko-platform-ids.js +30 -0
  232. package/dist/infrastructure/oracle/coingecko-platform-ids.js.map +1 -0
  233. package/dist/infrastructure/oracle/forex-currencies.d.ts +36 -0
  234. package/dist/infrastructure/oracle/forex-currencies.d.ts.map +1 -0
  235. package/dist/infrastructure/oracle/forex-currencies.js +71 -0
  236. package/dist/infrastructure/oracle/forex-currencies.js.map +1 -0
  237. package/dist/infrastructure/oracle/forex-rate-service.d.ts +51 -0
  238. package/dist/infrastructure/oracle/forex-rate-service.d.ts.map +1 -0
  239. package/dist/infrastructure/oracle/forex-rate-service.js +149 -0
  240. package/dist/infrastructure/oracle/forex-rate-service.js.map +1 -0
  241. package/dist/infrastructure/oracle/index.d.ts +18 -0
  242. package/dist/infrastructure/oracle/index.d.ts.map +1 -0
  243. package/dist/infrastructure/oracle/index.js +19 -0
  244. package/dist/infrastructure/oracle/index.js.map +1 -0
  245. package/dist/infrastructure/oracle/oracle-chain.d.ts +101 -0
  246. package/dist/infrastructure/oracle/oracle-chain.d.ts.map +1 -0
  247. package/dist/infrastructure/oracle/oracle-chain.js +163 -0
  248. package/dist/infrastructure/oracle/oracle-chain.js.map +1 -0
  249. package/dist/infrastructure/oracle/oracle-errors.d.ts +42 -0
  250. package/dist/infrastructure/oracle/oracle-errors.d.ts.map +1 -0
  251. package/dist/infrastructure/oracle/oracle-errors.js +53 -0
  252. package/dist/infrastructure/oracle/oracle-errors.js.map +1 -0
  253. package/dist/infrastructure/oracle/price-age.d.ts +38 -0
  254. package/dist/infrastructure/oracle/price-age.d.ts.map +1 -0
  255. package/dist/infrastructure/oracle/price-age.js +44 -0
  256. package/dist/infrastructure/oracle/price-age.js.map +1 -0
  257. package/dist/infrastructure/oracle/price-cache.d.ts +99 -0
  258. package/dist/infrastructure/oracle/price-cache.d.ts.map +1 -0
  259. package/dist/infrastructure/oracle/price-cache.js +173 -0
  260. package/dist/infrastructure/oracle/price-cache.js.map +1 -0
  261. package/dist/infrastructure/oracle/pyth-feed-ids.d.ts +31 -0
  262. package/dist/infrastructure/oracle/pyth-feed-ids.d.ts.map +1 -0
  263. package/dist/infrastructure/oracle/pyth-feed-ids.js +44 -0
  264. package/dist/infrastructure/oracle/pyth-feed-ids.js.map +1 -0
  265. package/dist/infrastructure/oracle/pyth-oracle.d.ts +69 -0
  266. package/dist/infrastructure/oracle/pyth-oracle.d.ts.map +1 -0
  267. package/dist/infrastructure/oracle/pyth-oracle.js +149 -0
  268. package/dist/infrastructure/oracle/pyth-oracle.js.map +1 -0
  269. package/dist/infrastructure/settings/hot-reload.d.ts +71 -0
  270. package/dist/infrastructure/settings/hot-reload.d.ts.map +1 -0
  271. package/dist/infrastructure/settings/hot-reload.js +315 -0
  272. package/dist/infrastructure/settings/hot-reload.js.map +1 -0
  273. package/dist/infrastructure/settings/index.d.ts +13 -0
  274. package/dist/infrastructure/settings/index.d.ts.map +1 -0
  275. package/dist/infrastructure/settings/index.js +10 -0
  276. package/dist/infrastructure/settings/index.js.map +1 -0
  277. package/dist/infrastructure/settings/setting-keys.d.ts +28 -0
  278. package/dist/infrastructure/settings/setting-keys.d.ts.map +1 -0
  279. package/dist/infrastructure/settings/setting-keys.js +105 -0
  280. package/dist/infrastructure/settings/setting-keys.js.map +1 -0
  281. package/dist/infrastructure/settings/settings-crypto.d.ts +39 -0
  282. package/dist/infrastructure/settings/settings-crypto.d.ts.map +1 -0
  283. package/dist/infrastructure/settings/settings-crypto.js +73 -0
  284. package/dist/infrastructure/settings/settings-crypto.js.map +1 -0
  285. package/dist/infrastructure/settings/settings-service.d.ts +82 -0
  286. package/dist/infrastructure/settings/settings-service.d.ts.map +1 -0
  287. package/dist/infrastructure/settings/settings-service.js +267 -0
  288. package/dist/infrastructure/settings/settings-service.js.map +1 -0
  289. package/dist/infrastructure/telegram/index.d.ts +6 -0
  290. package/dist/infrastructure/telegram/index.d.ts.map +1 -0
  291. package/dist/infrastructure/telegram/index.js +5 -0
  292. package/dist/infrastructure/telegram/index.js.map +1 -0
  293. package/dist/infrastructure/telegram/telegram-api.d.ts +35 -0
  294. package/dist/infrastructure/telegram/telegram-api.d.ts.map +1 -0
  295. package/dist/infrastructure/telegram/telegram-api.js +82 -0
  296. package/dist/infrastructure/telegram/telegram-api.js.map +1 -0
  297. package/dist/infrastructure/telegram/telegram-auth.d.ts +57 -0
  298. package/dist/infrastructure/telegram/telegram-auth.d.ts.map +1 -0
  299. package/dist/infrastructure/telegram/telegram-auth.js +88 -0
  300. package/dist/infrastructure/telegram/telegram-auth.js.map +1 -0
  301. package/dist/infrastructure/telegram/telegram-bot-service.d.ts +95 -0
  302. package/dist/infrastructure/telegram/telegram-bot-service.d.ts.map +1 -0
  303. package/dist/infrastructure/telegram/telegram-bot-service.js +564 -0
  304. package/dist/infrastructure/telegram/telegram-bot-service.js.map +1 -0
  305. package/dist/infrastructure/telegram/telegram-keyboard.d.ts +27 -0
  306. package/dist/infrastructure/telegram/telegram-keyboard.d.ts.map +1 -0
  307. package/dist/infrastructure/telegram/telegram-keyboard.js +52 -0
  308. package/dist/infrastructure/telegram/telegram-keyboard.js.map +1 -0
  309. package/dist/infrastructure/telegram/telegram-types.d.ts +43 -0
  310. package/dist/infrastructure/telegram/telegram-types.d.ts.map +1 -0
  311. package/dist/infrastructure/telegram/telegram-types.js +8 -0
  312. package/dist/infrastructure/telegram/telegram-types.js.map +1 -0
  313. package/dist/infrastructure/token-registry/builtin-tokens.d.ts +39 -0
  314. package/dist/infrastructure/token-registry/builtin-tokens.d.ts.map +1 -0
  315. package/dist/infrastructure/token-registry/builtin-tokens.js +135 -0
  316. package/dist/infrastructure/token-registry/builtin-tokens.js.map +1 -0
  317. package/dist/infrastructure/token-registry/index.d.ts +8 -0
  318. package/dist/infrastructure/token-registry/index.d.ts.map +1 -0
  319. package/dist/infrastructure/token-registry/index.js +8 -0
  320. package/dist/infrastructure/token-registry/index.js.map +1 -0
  321. package/dist/infrastructure/token-registry/token-registry-service.d.ts +49 -0
  322. package/dist/infrastructure/token-registry/token-registry-service.d.ts.map +1 -0
  323. package/dist/infrastructure/token-registry/token-registry-service.js +93 -0
  324. package/dist/infrastructure/token-registry/token-registry-service.js.map +1 -0
  325. package/dist/infrastructure/version/index.d.ts +5 -0
  326. package/dist/infrastructure/version/index.d.ts.map +1 -0
  327. package/dist/infrastructure/version/index.js +5 -0
  328. package/dist/infrastructure/version/index.js.map +1 -0
  329. package/dist/infrastructure/version/version-check-service.d.ts +35 -0
  330. package/dist/infrastructure/version/version-check-service.d.ts.map +1 -0
  331. package/dist/infrastructure/version/version-check-service.js +92 -0
  332. package/dist/infrastructure/version/version-check-service.js.map +1 -0
  333. package/dist/lifecycle/daemon.d.ts +103 -0
  334. package/dist/lifecycle/daemon.d.ts.map +1 -0
  335. package/dist/lifecycle/daemon.js +934 -0
  336. package/dist/lifecycle/daemon.js.map +1 -0
  337. package/dist/lifecycle/index.d.ts +9 -0
  338. package/dist/lifecycle/index.d.ts.map +1 -0
  339. package/dist/lifecycle/index.js +9 -0
  340. package/dist/lifecycle/index.js.map +1 -0
  341. package/dist/lifecycle/signal-handler.d.ts +18 -0
  342. package/dist/lifecycle/signal-handler.d.ts.map +1 -0
  343. package/dist/lifecycle/signal-handler.js +37 -0
  344. package/dist/lifecycle/signal-handler.js.map +1 -0
  345. package/dist/lifecycle/workers.d.ts +46 -0
  346. package/dist/lifecycle/workers.d.ts.map +1 -0
  347. package/dist/lifecycle/workers.js +101 -0
  348. package/dist/lifecycle/workers.js.map +1 -0
  349. package/dist/notifications/channels/discord.d.ts +10 -0
  350. package/dist/notifications/channels/discord.d.ts.map +1 -0
  351. package/dist/notifications/channels/discord.js +54 -0
  352. package/dist/notifications/channels/discord.js.map +1 -0
  353. package/dist/notifications/channels/ntfy.d.ts +13 -0
  354. package/dist/notifications/channels/ntfy.d.ts.map +1 -0
  355. package/dist/notifications/channels/ntfy.js +58 -0
  356. package/dist/notifications/channels/ntfy.js.map +1 -0
  357. package/dist/notifications/channels/slack.d.ts +10 -0
  358. package/dist/notifications/channels/slack.d.ts.map +1 -0
  359. package/dist/notifications/channels/slack.js +55 -0
  360. package/dist/notifications/channels/slack.js.map +1 -0
  361. package/dist/notifications/channels/telegram.d.ts +10 -0
  362. package/dist/notifications/channels/telegram.d.ts.map +1 -0
  363. package/dist/notifications/channels/telegram.js +40 -0
  364. package/dist/notifications/channels/telegram.js.map +1 -0
  365. package/dist/notifications/index.d.ts +9 -0
  366. package/dist/notifications/index.d.ts.map +1 -0
  367. package/dist/notifications/index.js +7 -0
  368. package/dist/notifications/index.js.map +1 -0
  369. package/dist/notifications/notification-service.d.ts +75 -0
  370. package/dist/notifications/notification-service.d.ts.map +1 -0
  371. package/dist/notifications/notification-service.js +213 -0
  372. package/dist/notifications/notification-service.js.map +1 -0
  373. package/dist/notifications/templates/message-templates.d.ts +12 -0
  374. package/dist/notifications/templates/message-templates.d.ts.map +1 -0
  375. package/dist/notifications/templates/message-templates.js +22 -0
  376. package/dist/notifications/templates/message-templates.js.map +1 -0
  377. package/dist/pipeline/database-policy-engine.d.ts +286 -0
  378. package/dist/pipeline/database-policy-engine.d.ts.map +1 -0
  379. package/dist/pipeline/database-policy-engine.js +992 -0
  380. package/dist/pipeline/database-policy-engine.js.map +1 -0
  381. package/dist/pipeline/default-policy-engine.d.ts +26 -0
  382. package/dist/pipeline/default-policy-engine.d.ts.map +1 -0
  383. package/dist/pipeline/default-policy-engine.js +25 -0
  384. package/dist/pipeline/default-policy-engine.js.map +1 -0
  385. package/dist/pipeline/index.d.ts +9 -0
  386. package/dist/pipeline/index.d.ts.map +1 -0
  387. package/dist/pipeline/index.js +9 -0
  388. package/dist/pipeline/index.js.map +1 -0
  389. package/dist/pipeline/network-resolver.d.ts +22 -0
  390. package/dist/pipeline/network-resolver.d.ts.map +1 -0
  391. package/dist/pipeline/network-resolver.js +32 -0
  392. package/dist/pipeline/network-resolver.js.map +1 -0
  393. package/dist/pipeline/pipeline.d.ts +72 -0
  394. package/dist/pipeline/pipeline.d.ts.map +1 -0
  395. package/dist/pipeline/pipeline.js +87 -0
  396. package/dist/pipeline/pipeline.js.map +1 -0
  397. package/dist/pipeline/resolve-effective-amount-usd.d.ts +41 -0
  398. package/dist/pipeline/resolve-effective-amount-usd.d.ts.map +1 -0
  399. package/dist/pipeline/resolve-effective-amount-usd.js +208 -0
  400. package/dist/pipeline/resolve-effective-amount-usd.js.map +1 -0
  401. package/dist/pipeline/sign-only.d.ts +99 -0
  402. package/dist/pipeline/sign-only.d.ts.map +1 -0
  403. package/dist/pipeline/sign-only.js +267 -0
  404. package/dist/pipeline/sign-only.js.map +1 -0
  405. package/dist/pipeline/sleep.d.ts +6 -0
  406. package/dist/pipeline/sleep.d.ts.map +1 -0
  407. package/dist/pipeline/sleep.js +8 -0
  408. package/dist/pipeline/sleep.js.map +1 -0
  409. package/dist/pipeline/stages.d.ts +82 -0
  410. package/dist/pipeline/stages.d.ts.map +1 -0
  411. package/dist/pipeline/stages.js +784 -0
  412. package/dist/pipeline/stages.js.map +1 -0
  413. package/dist/services/autostop-rules.d.ts +79 -0
  414. package/dist/services/autostop-rules.d.ts.map +1 -0
  415. package/dist/services/autostop-rules.js +174 -0
  416. package/dist/services/autostop-rules.js.map +1 -0
  417. package/dist/services/autostop-service.d.ts +82 -0
  418. package/dist/services/autostop-service.d.ts.map +1 -0
  419. package/dist/services/autostop-service.js +223 -0
  420. package/dist/services/autostop-service.js.map +1 -0
  421. package/dist/services/kill-switch-service.d.ts +118 -0
  422. package/dist/services/kill-switch-service.d.ts.map +1 -0
  423. package/dist/services/kill-switch-service.js +291 -0
  424. package/dist/services/kill-switch-service.js.map +1 -0
  425. package/dist/services/monitoring/balance-monitor-service.d.ts +65 -0
  426. package/dist/services/monitoring/balance-monitor-service.d.ts.map +1 -0
  427. package/dist/services/monitoring/balance-monitor-service.js +207 -0
  428. package/dist/services/monitoring/balance-monitor-service.js.map +1 -0
  429. package/dist/services/wc-session-service.d.ts +123 -0
  430. package/dist/services/wc-session-service.d.ts.map +1 -0
  431. package/dist/services/wc-session-service.js +363 -0
  432. package/dist/services/wc-session-service.js.map +1 -0
  433. package/dist/services/wc-signing-bridge.d.ts +60 -0
  434. package/dist/services/wc-signing-bridge.d.ts.map +1 -0
  435. package/dist/services/wc-signing-bridge.js +334 -0
  436. package/dist/services/wc-signing-bridge.js.map +1 -0
  437. package/dist/services/wc-storage.d.ts +32 -0
  438. package/dist/services/wc-storage.d.ts.map +1 -0
  439. package/dist/services/wc-storage.js +64 -0
  440. package/dist/services/wc-storage.js.map +1 -0
  441. package/dist/services/x402/payment-signer.d.ts +88 -0
  442. package/dist/services/x402/payment-signer.d.ts.map +1 -0
  443. package/dist/services/x402/payment-signer.js +311 -0
  444. package/dist/services/x402/payment-signer.js.map +1 -0
  445. package/dist/services/x402/ssrf-guard.d.ts +27 -0
  446. package/dist/services/x402/ssrf-guard.d.ts.map +1 -0
  447. package/dist/services/x402/ssrf-guard.js +236 -0
  448. package/dist/services/x402/ssrf-guard.js.map +1 -0
  449. package/dist/services/x402/x402-domain-policy.d.ts +50 -0
  450. package/dist/services/x402/x402-domain-policy.d.ts.map +1 -0
  451. package/dist/services/x402/x402-domain-policy.js +78 -0
  452. package/dist/services/x402/x402-domain-policy.js.map +1 -0
  453. package/dist/services/x402/x402-handler.d.ts +71 -0
  454. package/dist/services/x402/x402-handler.d.ts.map +1 -0
  455. package/dist/services/x402/x402-handler.js +195 -0
  456. package/dist/services/x402/x402-handler.js.map +1 -0
  457. package/dist/services/x402/x402-usd-resolver.d.ts +26 -0
  458. package/dist/services/x402/x402-usd-resolver.d.ts.map +1 -0
  459. package/dist/services/x402/x402-usd-resolver.js +79 -0
  460. package/dist/services/x402/x402-usd-resolver.js.map +1 -0
  461. package/dist/workflow/approval-workflow.d.ts +103 -0
  462. package/dist/workflow/approval-workflow.d.ts.map +1 -0
  463. package/dist/workflow/approval-workflow.js +202 -0
  464. package/dist/workflow/approval-workflow.js.map +1 -0
  465. package/dist/workflow/delay-queue.d.ts +78 -0
  466. package/dist/workflow/delay-queue.d.ts.map +1 -0
  467. package/dist/workflow/delay-queue.js +174 -0
  468. package/dist/workflow/delay-queue.js.map +1 -0
  469. package/dist/workflow/index.d.ts +11 -0
  470. package/dist/workflow/index.d.ts.map +1 -0
  471. package/dist/workflow/index.js +9 -0
  472. package/dist/workflow/index.js.map +1 -0
  473. package/dist/workflow/owner-state.d.ts +97 -0
  474. package/dist/workflow/owner-state.d.ts.map +1 -0
  475. package/dist/workflow/owner-state.js +168 -0
  476. package/dist/workflow/owner-state.js.map +1 -0
  477. package/package.json +71 -0
  478. package/public/admin/assets/index-BPoUSH8W.css +1 -0
  479. package/public/admin/assets/index-CDi1qoXB.js +1 -0
  480. package/public/admin/index.html +13 -0
@@ -0,0 +1,406 @@
1
+ /**
2
+ * Hono API server factory: createApp(deps) returns a configured Hono instance.
3
+ *
4
+ * Middleware registration order:
5
+ * 1. requestId
6
+ * 2. hostGuard
7
+ * 3. killSwitchGuard
8
+ * 4. requestLogger
9
+ *
10
+ * Auth middleware (route-level, registered on app before sub-routers):
11
+ * - masterAuth: /v1/wallets, /v1/policies, /v1/sessions, /v1/sessions/:id (admin operations, skips /renew)
12
+ * - sessionAuth: /v1/sessions/:id/renew, /v1/wallet/*, /v1/transactions/*
13
+ * - /health remains public (no auth required)
14
+ *
15
+ * Error handler is registered via app.onError.
16
+ *
17
+ * The returned app instance is NOT started -- starting is DaemonLifecycle's job.
18
+ *
19
+ * @see docs/29-api-framework-design.md
20
+ * @see docs/52-auth-redesign.md
21
+ */
22
+ import { createRequire } from 'node:module';
23
+ import { fileURLToPath } from 'node:url';
24
+ import { dirname, join } from 'node:path';
25
+ import { OpenAPIHono } from '@hono/zod-openapi';
26
+ import { serveStatic } from '@hono/node-server/serve-static';
27
+ const require = createRequire(import.meta.url);
28
+ const { version: DAEMON_VERSION } = require('../../package.json');
29
+ // Compute absolute path to admin static files (from dist/api/server.js -> ../../public/admin)
30
+ const __filename = fileURLToPath(import.meta.url);
31
+ const __dirname = dirname(__filename);
32
+ const ADMIN_STATIC_ROOT = join(__dirname, '..', '..', 'public', 'admin');
33
+ import { requestId, hostGuard, createKillSwitchGuard, requestLogger, errorHandler, createSessionAuth, createMasterAuth, createOwnerAuth, cspMiddleware, } from './middleware/index.js';
34
+ import { createHealthRoute } from './routes/health.js';
35
+ import { walletCrudRoutes } from './routes/wallets.js';
36
+ import { sessionRoutes } from './routes/sessions.js';
37
+ import { walletRoutes } from './routes/wallet.js';
38
+ import { transactionRoutes } from './routes/transactions.js';
39
+ import { policyRoutes } from './routes/policies.js';
40
+ import { nonceRoutes } from './routes/nonce.js';
41
+ import { utilsRoutes } from './routes/utils.js';
42
+ import { skillsRoutes } from './routes/skills.js';
43
+ import { adminRoutes } from './routes/admin.js';
44
+ import { tokenRegistryRoutes } from './routes/tokens.js';
45
+ import { mcpTokenRoutes } from './routes/mcp.js';
46
+ import { WAIaaSError } from '@waiaas/core';
47
+ import { TokenRegistryService } from '../infrastructure/token-registry/index.js';
48
+ import { actionRoutes } from './routes/actions.js';
49
+ import { x402Routes } from './routes/x402.js';
50
+ import { wcRoutes, wcSessionRoutes } from './routes/wc.js';
51
+ import { DatabasePolicyEngine } from '../pipeline/database-policy-engine.js';
52
+ /**
53
+ * Create a Hono app instance with all middleware and routes configured.
54
+ *
55
+ * @param deps - Optional dependencies (extensible for future use)
56
+ * @returns Configured OpenAPIHono instance (not started)
57
+ */
58
+ export function createApp(deps = {}) {
59
+ const app = new OpenAPIHono();
60
+ // Register global middleware in order
61
+ app.use('*', requestId);
62
+ app.use('*', hostGuard);
63
+ // killSwitchGuard: prefer KillSwitchService if available, else use callback
64
+ const killSwitchStateGetter = deps.killSwitchService
65
+ ? () => deps.killSwitchService.getState().state
66
+ : (deps.getKillSwitchState ?? (() => 'ACTIVE'));
67
+ app.use('*', createKillSwitchGuard(killSwitchStateGetter));
68
+ app.use('*', requestLogger);
69
+ // Register error handler
70
+ app.onError(errorHandler);
71
+ // Register route-level auth middleware on the app (before sub-routers)
72
+ if (deps.masterPasswordHash !== undefined) {
73
+ const masterAuth = createMasterAuth({ masterPasswordHash: deps.masterPasswordHash });
74
+ app.use('/v1/wallets', masterAuth);
75
+ app.use('/v1/policies', masterAuth);
76
+ app.use('/v1/policies/:id', masterAuth);
77
+ // masterAuth on /v1/sessions (POST create, GET list)
78
+ app.use('/v1/sessions', masterAuth);
79
+ // masterAuth on /v1/sessions/:id for DELETE -- skip /renew sub-path (sessionAuth handles it)
80
+ app.use('/v1/sessions/:id', async (c, next) => {
81
+ if (c.req.path.endsWith('/renew')) {
82
+ await next();
83
+ return;
84
+ }
85
+ return masterAuth(c, next);
86
+ });
87
+ }
88
+ // masterAuth for GET /v1/wallets/:id (wallet detail) -- skip sub-paths with own auth
89
+ if (deps.masterPasswordHash !== undefined) {
90
+ const masterAuthForWalletDetail = createMasterAuth({ masterPasswordHash: deps.masterPasswordHash });
91
+ app.use('/v1/wallets/:id', async (c, next) => {
92
+ // Skip sub-paths that have their own masterAuth registered below
93
+ if (c.req.path.includes('/owner') || c.req.path.includes('/default-network') || c.req.path.includes('/networks') || c.req.path.includes('/wc/')) {
94
+ await next();
95
+ return;
96
+ }
97
+ return masterAuthForWalletDetail(c, next);
98
+ });
99
+ }
100
+ // masterAuth for PUT /v1/wallets/:id/owner
101
+ if (deps.masterPasswordHash !== undefined) {
102
+ const masterAuthForOwner = createMasterAuth({ masterPasswordHash: deps.masterPasswordHash });
103
+ app.use('/v1/wallets/:id/owner', masterAuthForOwner);
104
+ app.use('/v1/wallets/:id/default-network', masterAuthForOwner);
105
+ app.use('/v1/wallets/:id/networks', masterAuthForOwner);
106
+ }
107
+ // masterAuth for WalletConnect routes
108
+ if (deps.masterPasswordHash !== undefined) {
109
+ const masterAuthForWc = createMasterAuth({ masterPasswordHash: deps.masterPasswordHash });
110
+ app.use('/v1/wallets/:id/wc/*', masterAuthForWc);
111
+ }
112
+ if (deps.jwtSecretManager && deps.db) {
113
+ const sessionAuth = createSessionAuth({ jwtSecretManager: deps.jwtSecretManager, db: deps.db });
114
+ // sessionAuth for session renewal (uses own token)
115
+ app.use('/v1/sessions/:id/renew', sessionAuth);
116
+ app.use('/v1/wallet/*', sessionAuth);
117
+ // sessionAuth for GET /v1/transactions (exact path -- wildcard won't match base)
118
+ app.use('/v1/transactions', sessionAuth);
119
+ app.use('/v1/transactions/*', sessionAuth);
120
+ app.use('/v1/utils/*', sessionAuth);
121
+ app.use('/v1/actions/*', sessionAuth);
122
+ app.use('/v1/x402/*', sessionAuth);
123
+ }
124
+ // ownerAuth for approve and reject routes (requires DB for agent lookup)
125
+ if (deps.db) {
126
+ const ownerAuth = createOwnerAuth({ db: deps.db });
127
+ app.use('/v1/transactions/:id/approve', ownerAuth);
128
+ app.use('/v1/transactions/:id/reject', ownerAuth);
129
+ app.use('/v1/wallets/:id/owner/verify', ownerAuth);
130
+ }
131
+ // masterAuth for admin routes (except GET /admin/kill-switch which is public)
132
+ if (deps.masterPasswordHash !== undefined) {
133
+ const masterAuthForAdmin = createMasterAuth({ masterPasswordHash: deps.masterPasswordHash });
134
+ app.use('/v1/admin/status', masterAuthForAdmin);
135
+ app.use('/v1/admin/kill-switch', async (c, next) => {
136
+ // POST requires masterAuth, GET is public
137
+ if (c.req.method === 'POST') {
138
+ return masterAuthForAdmin(c, next);
139
+ }
140
+ await next();
141
+ });
142
+ app.use('/v1/admin/recover', masterAuthForAdmin);
143
+ app.use('/v1/admin/shutdown', masterAuthForAdmin);
144
+ app.use('/v1/admin/rotate-secret', masterAuthForAdmin);
145
+ app.use('/v1/admin/notifications/*', masterAuthForAdmin);
146
+ app.use('/v1/admin/settings', masterAuthForAdmin);
147
+ app.use('/v1/admin/settings/*', masterAuthForAdmin);
148
+ app.use('/v1/admin/api-keys', masterAuthForAdmin);
149
+ app.use('/v1/admin/api-keys/*', masterAuthForAdmin);
150
+ app.use('/v1/admin/forex/*', masterAuthForAdmin);
151
+ app.use('/v1/admin/kill-switch/escalate', masterAuthForAdmin);
152
+ app.use('/v1/tokens', masterAuthForAdmin);
153
+ app.use('/v1/mcp/tokens', masterAuthForAdmin);
154
+ app.use('/v1/admin/wallets/*', masterAuthForAdmin);
155
+ app.use('/v1/admin/telegram-users', masterAuthForAdmin);
156
+ app.use('/v1/admin/telegram-users/*', masterAuthForAdmin);
157
+ }
158
+ // ownerAuth for POST /v1/owner/kill-switch
159
+ if (deps.db) {
160
+ const ownerAuthForKillSwitch = createOwnerAuth({ db: deps.db });
161
+ app.use('/v1/owner/kill-switch', ownerAuthForKillSwitch);
162
+ }
163
+ // Register routes
164
+ app.route('/health', createHealthRoute({ versionCheckService: deps.versionCheckService ?? null }));
165
+ // Register nonce route (public, no auth required)
166
+ app.route('/v1', nonceRoutes());
167
+ // Register skills route (public, no auth required -- AI agent skill references)
168
+ app.route('/v1', skillsRoutes());
169
+ // Register utils routes (sessionAuth required -- stateless utilities)
170
+ app.route('/v1', utilsRoutes());
171
+ // Register wallet CRUD routes when deps are available
172
+ if (deps.db && deps.sqlite && deps.keyStore && deps.masterPassword !== undefined && deps.config) {
173
+ app.route('/v1', walletCrudRoutes({
174
+ db: deps.db,
175
+ sqlite: deps.sqlite,
176
+ keyStore: deps.keyStore,
177
+ masterPassword: deps.masterPassword,
178
+ config: deps.config,
179
+ adapterPool: deps.adapterPool ?? undefined,
180
+ notificationService: deps.notificationService,
181
+ eventBus: deps.eventBus,
182
+ }));
183
+ }
184
+ // Register session routes when deps are available (masterAuth + JWT)
185
+ if (deps.db && deps.jwtSecretManager && deps.config) {
186
+ app.route('/v1', sessionRoutes({
187
+ db: deps.db,
188
+ jwtSecretManager: deps.jwtSecretManager,
189
+ config: deps.config,
190
+ notificationService: deps.notificationService,
191
+ eventBus: deps.eventBus,
192
+ }));
193
+ }
194
+ // Register policy routes when DB is available (masterAuth covers /v1/policies)
195
+ if (deps.db) {
196
+ app.route('/v1', policyRoutes({ db: deps.db }));
197
+ }
198
+ // Create shared TokenRegistryService for walletRoutes and tokenRegistryRoutes
199
+ const tokenRegistryService = deps.db ? new TokenRegistryService(deps.db) : null;
200
+ if (deps.db) {
201
+ app.route('/v1', walletRoutes({
202
+ db: deps.db,
203
+ adapterPool: deps.adapterPool ?? null,
204
+ config: deps.config ?? null,
205
+ tokenRegistryService,
206
+ forexRateService: deps.forexRateService,
207
+ settingsService: deps.settingsService,
208
+ }));
209
+ }
210
+ // Register transaction routes when all pipeline deps are available
211
+ if (deps.db &&
212
+ deps.keyStore &&
213
+ deps.masterPassword !== undefined &&
214
+ deps.adapterPool &&
215
+ deps.policyEngine &&
216
+ deps.config) {
217
+ app.route('/v1', transactionRoutes({
218
+ db: deps.db,
219
+ adapterPool: deps.adapterPool,
220
+ config: deps.config,
221
+ keyStore: deps.keyStore,
222
+ policyEngine: deps.policyEngine,
223
+ masterPassword: deps.masterPassword,
224
+ approvalWorkflow: deps.approvalWorkflow,
225
+ delayQueue: deps.delayQueue,
226
+ ownerLifecycle: deps.ownerLifecycle,
227
+ sqlite: deps.sqlite,
228
+ notificationService: deps.notificationService,
229
+ priceOracle: deps.priceOracle,
230
+ settingsService: deps.settingsService,
231
+ forexRateService: deps.forexRateService,
232
+ eventBus: deps.eventBus,
233
+ wcSigningBridge: deps.wcSigningBridge,
234
+ }));
235
+ }
236
+ // Register action routes when registry + pipeline deps are available
237
+ if (deps.actionProviderRegistry &&
238
+ deps.apiKeyStore &&
239
+ deps.db &&
240
+ deps.keyStore &&
241
+ deps.masterPassword !== undefined &&
242
+ deps.adapterPool &&
243
+ deps.policyEngine &&
244
+ deps.config) {
245
+ app.route('/v1', actionRoutes({
246
+ registry: deps.actionProviderRegistry,
247
+ apiKeyStore: deps.apiKeyStore,
248
+ db: deps.db,
249
+ adapterPool: deps.adapterPool,
250
+ config: deps.config,
251
+ keyStore: deps.keyStore,
252
+ policyEngine: deps.policyEngine,
253
+ masterPassword: deps.masterPassword,
254
+ approvalWorkflow: deps.approvalWorkflow,
255
+ delayQueue: deps.delayQueue,
256
+ ownerLifecycle: deps.ownerLifecycle,
257
+ sqlite: deps.sqlite,
258
+ notificationService: deps.notificationService,
259
+ priceOracle: deps.priceOracle,
260
+ settingsService: deps.settingsService,
261
+ }));
262
+ }
263
+ // Register x402 routes when pipeline deps + config are available
264
+ if (deps.db &&
265
+ deps.sqlite &&
266
+ deps.keyStore &&
267
+ deps.masterPassword !== undefined &&
268
+ deps.policyEngine &&
269
+ deps.policyEngine instanceof DatabasePolicyEngine &&
270
+ deps.config) {
271
+ app.route('/v1', x402Routes({
272
+ db: deps.db,
273
+ sqlite: deps.sqlite,
274
+ keyStore: deps.keyStore,
275
+ policyEngine: deps.policyEngine,
276
+ masterPassword: deps.masterPassword,
277
+ config: deps.config,
278
+ notificationService: deps.notificationService,
279
+ priceOracle: deps.priceOracle,
280
+ adapterPool: deps.adapterPool ?? null,
281
+ settingsService: deps.settingsService,
282
+ eventBus: deps.eventBus,
283
+ }));
284
+ }
285
+ // Register admin routes when DB is available
286
+ if (deps.db) {
287
+ // Kill switch state holder: wraps getKillSwitchState callback with enriched state
288
+ const killSwitchHolder = {
289
+ state: 'ACTIVE',
290
+ activatedAt: null,
291
+ activatedBy: null,
292
+ };
293
+ // Sync initial state from KillSwitchService or callback
294
+ if (deps.killSwitchService) {
295
+ const ksInfo = deps.killSwitchService.getState();
296
+ killSwitchHolder.state = ksInfo.state;
297
+ killSwitchHolder.activatedAt = ksInfo.activatedAt;
298
+ killSwitchHolder.activatedBy = ksInfo.activatedBy;
299
+ }
300
+ else if (deps.getKillSwitchState) {
301
+ killSwitchHolder.state = deps.getKillSwitchState();
302
+ }
303
+ app.route('/v1', adminRoutes({
304
+ db: deps.db,
305
+ jwtSecretManager: deps.jwtSecretManager,
306
+ getKillSwitchState: () => killSwitchHolder,
307
+ setKillSwitchState: (state, activatedBy) => {
308
+ killSwitchHolder.state = state;
309
+ if (state === 'SUSPENDED' || state === 'LOCKED') {
310
+ killSwitchHolder.activatedAt = Math.floor(Date.now() / 1000);
311
+ killSwitchHolder.activatedBy = activatedBy ?? null;
312
+ }
313
+ else {
314
+ killSwitchHolder.activatedAt = null;
315
+ killSwitchHolder.activatedBy = null;
316
+ }
317
+ },
318
+ killSwitchService: deps.killSwitchService,
319
+ requestShutdown: deps.requestShutdown,
320
+ startTime: deps.startTime ?? Math.floor(Date.now() / 1000),
321
+ version: DAEMON_VERSION,
322
+ adminTimeout: deps.config?.daemon?.admin_timeout ?? 900,
323
+ notificationService: deps.notificationService,
324
+ notificationConfig: deps.config?.notifications,
325
+ settingsService: deps.settingsService,
326
+ onSettingsChanged: deps.onSettingsChanged,
327
+ adapterPool: deps.adapterPool ?? null,
328
+ daemonConfig: deps.config,
329
+ priceOracle: deps.priceOracle,
330
+ apiKeyStore: deps.apiKeyStore,
331
+ actionProviderRegistry: deps.actionProviderRegistry,
332
+ forexRateService: deps.forexRateService,
333
+ sqlite: deps.sqlite,
334
+ }));
335
+ // Register owner kill-switch route (ownerAuth protected)
336
+ if (deps.killSwitchService) {
337
+ const ownerKsRouter = new OpenAPIHono();
338
+ const ownerKillSwitchService = deps.killSwitchService;
339
+ ownerKsRouter.post('/owner/kill-switch', async (c) => {
340
+ const ownerAddress = c.get('ownerAddress');
341
+ const result = ownerKillSwitchService.activateWithCascade(ownerAddress ?? 'owner');
342
+ if (!result.success) {
343
+ throw new WAIaaSError('KILL_SWITCH_ACTIVE', {
344
+ message: result.error ?? 'Kill switch is already active',
345
+ });
346
+ }
347
+ const state = ownerKillSwitchService.getState();
348
+ return c.json({
349
+ state: 'SUSPENDED',
350
+ activatedAt: state.activatedAt ?? Math.floor(Date.now() / 1000),
351
+ }, 200);
352
+ });
353
+ app.route('/v1', ownerKsRouter);
354
+ }
355
+ }
356
+ // Register token registry routes when DB is available
357
+ if (deps.db && tokenRegistryService) {
358
+ app.route('/v1', tokenRegistryRoutes({ tokenRegistryService }));
359
+ }
360
+ // Register MCP token provisioning routes when deps are available
361
+ if (deps.db && deps.jwtSecretManager && deps.config && deps.dataDir) {
362
+ app.route('/v1', mcpTokenRoutes({
363
+ db: deps.db,
364
+ jwtSecretManager: deps.jwtSecretManager,
365
+ config: deps.config,
366
+ dataDir: deps.dataDir,
367
+ notificationService: deps.notificationService,
368
+ }));
369
+ }
370
+ // Register WalletConnect routes (always, with mutable WcServiceRef).
371
+ // Handlers throw WC_NOT_CONFIGURED (503) when service is unavailable.
372
+ // The ref pattern allows hot-reload to swap the underlying WcSessionService.
373
+ if (deps.db) {
374
+ const wcServiceRef = deps.wcServiceRef ?? { current: null };
375
+ app.route('/v1', wcRoutes({ db: deps.db, wcServiceRef }));
376
+ app.route('/v1', wcSessionRoutes({ db: deps.db, wcServiceRef }));
377
+ }
378
+ // Register OpenAPI spec endpoint (GET /doc)
379
+ app.doc('/doc', {
380
+ openapi: '3.0.0',
381
+ info: {
382
+ title: 'WAIaaS API',
383
+ version: DAEMON_VERSION,
384
+ description: 'AI Agent Wallet-as-a-Service REST API',
385
+ },
386
+ });
387
+ // Register Admin UI static serving (conditional on config)
388
+ if (deps.config?.daemon?.admin_ui !== false) {
389
+ // CSP headers for admin paths
390
+ app.use('/admin/*', cspMiddleware);
391
+ // Serve static files from public/admin/ using absolute path
392
+ app.use('/admin/*', serveStatic({
393
+ root: ADMIN_STATIC_ROOT,
394
+ rewriteRequestPath: (path) => path.replace(/^\/admin/, ''),
395
+ }));
396
+ // SPA fallback: any /admin/* path that didn't match a static file -> index.html
397
+ app.get('/admin/*', serveStatic({
398
+ root: ADMIN_STATIC_ROOT,
399
+ path: 'index.html',
400
+ }));
401
+ // Redirect /admin to /admin/ for consistency
402
+ app.get('/admin', (c) => c.redirect('/admin/'));
403
+ }
404
+ return app;
405
+ }
406
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/api/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAwB,CAAC;AAEzF,8FAA8F;AAC9F,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACtC,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAKzE,OAAO,EACL,SAAS,EACT,SAAS,EACT,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf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ions, transactions, policies, pendingApprovals, auditLog, keyValueStore, generateId, } from './infrastructure/database/index.js';
2
+ export type { DatabaseConnection } from './infrastructure/database/index.js';
3
+ export { deriveKey, encrypt, decrypt, KDF_PARAMS, allocateGuarded, writeToGuarded, zeroAndRelease, isAvailable, LocalKeyStore, } from './infrastructure/keystore/index.js';
4
+ export type { EncryptedData } from './infrastructure/keystore/index.js';
5
+ export type { KeystoreFileV1 } from './infrastructure/keystore/index.js';
6
+ export { loadConfig, DaemonConfigSchema, detectNestedSections, applyEnvOverrides, parseEnvValue, } from './infrastructure/config/index.js';
7
+ export type { DaemonConfig } from './infrastructure/config/index.js';
8
+ export { DaemonLifecycle, withTimeout } from './lifecycle/index.js';
9
+ export { registerSignalHandlers } from './lifecycle/index.js';
10
+ export { BackgroundWorkers } from './lifecycle/index.js';
11
+ export { createApp } from './api/index.js';
12
+ export type { CreateAppDeps } from './api/index.js';
13
+ export { walletCrudRoutes, walletRoutes, transactionRoutes } from './api/routes/index.js';
14
+ export type { WalletCrudRouteDeps } from './api/routes/wallets.js';
15
+ export type { WalletRouteDeps } from './api/routes/wallet.js';
16
+ export type { TransactionRouteDeps } from './api/routes/transactions.js';
17
+ export { JwtSecretManager } from './infrastructure/jwt/index.js';
18
+ export type { JwtPayload } from './infrastructure/jwt/index.js';
19
+ export { BackupService } from './infrastructure/backup/index.js';
20
+ export { TransactionPipeline, DefaultPolicyEngine } from './pipeline/index.js';
21
+ export { DatabasePolicyEngine } from './pipeline/database-policy-engine.js';
22
+ export type { PipelineDeps, PipelineContext } from './pipeline/index.js';
23
+ import { DaemonLifecycle } from './lifecycle/index.js';
24
+ /**
25
+ * Start the WAIaaS daemon.
26
+ *
27
+ * Convenience wrapper that creates a DaemonLifecycle, registers signal handlers,
28
+ * and starts the daemon with the given data directory and master password.
29
+ *
30
+ * @param dataDir - Path to the WAIaaS data directory (contains config.toml, data/, keystore/)
31
+ * @param masterPassword - Master password for keystore encryption
32
+ * @returns The DaemonLifecycle instance (for testing or programmatic shutdown)
33
+ */
34
+ export declare function startDaemon(dataDir: string, masterPassword: string): Promise<DaemonLifecycle>;
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,UAAU,GACX,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAG7E,OAAO,EACL,SAAS,EACT,OAAO,EACP,OAAO,EACP,UAAU,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,WAAW,EACX,aAAa,GACd,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACxE,YAAY,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGzE,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,GACd,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAGrE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1F,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAGzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,YAAY,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAGjE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAMzE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,eAAe,CAAC,CAK1B"}
package/dist/index.js ADDED
@@ -0,0 +1,43 @@
1
+ // @waiaas/daemon - daemon infrastructure
2
+ // Database module
3
+ export { createDatabase, closeDatabase, pushSchema, wallets, sessions, transactions, policies, pendingApprovals, auditLog, keyValueStore, generateId, } from './infrastructure/database/index.js';
4
+ // Keystore module
5
+ export { deriveKey, encrypt, decrypt, KDF_PARAMS, allocateGuarded, writeToGuarded, zeroAndRelease, isAvailable, LocalKeyStore, } from './infrastructure/keystore/index.js';
6
+ // Config module
7
+ export { loadConfig, DaemonConfigSchema, detectNestedSections, applyEnvOverrides, parseEnvValue, } from './infrastructure/config/index.js';
8
+ // Lifecycle module
9
+ export { DaemonLifecycle, withTimeout } from './lifecycle/index.js';
10
+ export { registerSignalHandlers } from './lifecycle/index.js';
11
+ export { BackgroundWorkers } from './lifecycle/index.js';
12
+ // API module
13
+ export { createApp } from './api/index.js';
14
+ export { walletCrudRoutes, walletRoutes, transactionRoutes } from './api/routes/index.js';
15
+ // JWT module
16
+ export { JwtSecretManager } from './infrastructure/jwt/index.js';
17
+ // Backup module
18
+ export { BackupService } from './infrastructure/backup/index.js';
19
+ // Pipeline module
20
+ export { TransactionPipeline, DefaultPolicyEngine } from './pipeline/index.js';
21
+ export { DatabasePolicyEngine } from './pipeline/database-policy-engine.js';
22
+ // ---------------------------------------------------------------------------
23
+ // Convenience: top-level startDaemon()
24
+ // ---------------------------------------------------------------------------
25
+ import { DaemonLifecycle } from './lifecycle/index.js';
26
+ import { registerSignalHandlers } from './lifecycle/index.js';
27
+ /**
28
+ * Start the WAIaaS daemon.
29
+ *
30
+ * Convenience wrapper that creates a DaemonLifecycle, registers signal handlers,
31
+ * and starts the daemon with the given data directory and master password.
32
+ *
33
+ * @param dataDir - Path to the WAIaaS data directory (contains config.toml, data/, keystore/)
34
+ * @param masterPassword - Master password for keystore encryption
35
+ * @returns The DaemonLifecycle instance (for testing or programmatic shutdown)
36
+ */
37
+ export async function startDaemon(dataDir, masterPassword) {
38
+ const daemon = new DaemonLifecycle();
39
+ registerSignalHandlers(daemon);
40
+ await daemon.start(dataDir, masterPassword);
41
+ return daemon;
42
+ }
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AAEzC,kBAAkB;AAClB,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,UAAU,GACX,MAAM,oCAAoC,CAAC;AAG5C,kBAAkB;AAClB,OAAO,EACL,SAAS,EACT,OAAO,EACP,OAAO,EACP,UAAU,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,WAAW,EACX,aAAa,GACd,MAAM,oCAAoC,CAAC;AAI5C,gBAAgB;AAChB,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,GACd,MAAM,kCAAkC,CAAC;AAG1C,mBAAmB;AACnB,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,aAAa;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAK1F,aAAa;AACb,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,gBAAgB;AAChB,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,kBAAkB;AAClB,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAG5E,8EAA8E;AAC9E,uCAAuC;AACvC,8EAA8E;AAE9E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAe,EACf,cAAsB;IAEtB,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;IACrC,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC/B,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAC5C,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,77 @@
1
+ import { type IActionProvider, type ActionDefinition, type ActionContext, type ContractCallRequest, type ActionProviderMetadata } from '@waiaas/core';
2
+ /**
3
+ * ActionProviderRegistry manages provider registration, action lookup,
4
+ * and resolve() execution with schema validation.
5
+ */
6
+ export declare class ActionProviderRegistry {
7
+ private readonly providers;
8
+ private readonly actions;
9
+ /**
10
+ * Register an IActionProvider implementation.
11
+ * Validates metadata and action definitions with Zod schemas.
12
+ * Checks inputSchema duck typing (parse/safeParse functions).
13
+ * @throws WAIaaSError('ACTION_NAME_CONFLICT') if provider name is already registered.
14
+ */
15
+ register(provider: IActionProvider): void;
16
+ /**
17
+ * Unregister a provider and all its actions.
18
+ * @returns true if the provider was found and removed, false otherwise.
19
+ */
20
+ unregister(providerName: string): boolean;
21
+ /**
22
+ * Get a registered provider by name.
23
+ */
24
+ getProvider(name: string): IActionProvider | undefined;
25
+ /**
26
+ * Get an action entry by key (providerName/actionName).
27
+ */
28
+ getAction(key: string): {
29
+ provider: IActionProvider;
30
+ action: ActionDefinition;
31
+ } | undefined;
32
+ /**
33
+ * List metadata for all registered providers.
34
+ */
35
+ listProviders(): ActionProviderMetadata[];
36
+ /**
37
+ * List actions, optionally filtered by provider name.
38
+ */
39
+ listActions(providerName?: string): {
40
+ providerName: string;
41
+ action: ActionDefinition;
42
+ }[];
43
+ /**
44
+ * Get actions from providers with mcpExpose=true.
45
+ */
46
+ getMcpExposedActions(): {
47
+ provider: IActionProvider;
48
+ action: ActionDefinition;
49
+ }[];
50
+ /**
51
+ * Execute an action's resolve() with full validation pipeline:
52
+ * 1. Lookup action by key
53
+ * 2. Validate input params via action.inputSchema.parse()
54
+ * 3. Call provider.resolve()
55
+ * 4. Re-validate result via ContractCallRequestSchema.parse()
56
+ *
57
+ * @throws WAIaaSError('ACTION_NOT_FOUND') if action key not found
58
+ * @throws WAIaaSError('ACTION_VALIDATION_FAILED') if input validation fails
59
+ * @throws WAIaaSError('ACTION_RETURN_INVALID') if resolve() return value is invalid
60
+ */
61
+ executeResolve(actionKey: string, params: Record<string, unknown>, context: ActionContext): Promise<ContractCallRequest>;
62
+ /**
63
+ * Load ESM plugins from a directory. Each subdirectory is a plugin.
64
+ * Individual plugin failures are logged and skipped (fail-open).
65
+ *
66
+ * @returns Object with loaded/failed plugin names.
67
+ */
68
+ loadPlugins(actionsDir: string): Promise<{
69
+ loaded: string[];
70
+ failed: string[];
71
+ }>;
72
+ /**
73
+ * Load a single ESM plugin from a directory.
74
+ */
75
+ private loadSinglePlugin;
76
+ }
77
+ //# sourceMappingURL=action-provider-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-provider-registry.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/action/action-provider-registry.ts"],"names":[],"mappings":"AAeA,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC5B,MAAM,cAAc,CAAC;AAEtB;;;GAGG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsC;IAChE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAGpB;IAEJ;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAmCzC;;;OAGG;IACH,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAazC;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAItD;;OAEG;IACH,SAAS,CACP,GAAG,EAAE,MAAM,GACV;QAAE,QAAQ,EAAE,eAAe,CAAC;QAAC,MAAM,EAAE,gBAAgB,CAAA;KAAE,GAAG,SAAS;IAItE;;OAEG;IACH,aAAa,IAAI,sBAAsB,EAAE;IAIzC;;OAEG;IACH,WAAW,CACT,YAAY,CAAC,EAAE,MAAM,GACpB;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,gBAAgB,CAAA;KAAE,EAAE;IAUvD;;OAEG;IACH,oBAAoB,IAAI;QACtB,QAAQ,EAAE,eAAe,CAAC;QAC1B,MAAM,EAAE,gBAAgB,CAAC;KAC1B,EAAE;IAUH;;;;;;;;;;OAUG;IACG,cAAc,CAClB,SAAS,EAAE,MAAM,EACjB,MA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