@polyester/sdk 0.36.0-devnet-20261118123359 → 0.36.0-devnet-20261118184607

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 (339) hide show
  1. package/CHANGELOG.md +60 -8
  2. package/dist/catalogs/index.d.ts +2 -2
  3. package/dist/catalogs/snapshot-validation.js +10 -1
  4. package/dist/catalogs/snapshot-validation.js.map +1 -1
  5. package/dist/catalogs/zipper-catalog.d.ts +2 -0
  6. package/dist/catalogs/zipper-catalog.d.ts.map +1 -1
  7. package/dist/catalogs/zipper-catalog.js.map +1 -1
  8. package/dist/catalogs/zipper-supply.d.ts +2 -0
  9. package/dist/catalogs/zipper-supply.d.ts.map +1 -1
  10. package/dist/catalogs/zipper-supply.js +7 -5
  11. package/dist/catalogs/zipper-supply.js.map +1 -1
  12. package/dist/client.d.ts +2 -0
  13. package/dist/client.d.ts.map +1 -1
  14. package/dist/client.js +2 -0
  15. package/dist/client.js.map +1 -1
  16. package/dist/gen/ai/v1/assistant_pb.d.ts +679 -13
  17. package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -1
  18. package/dist/gen/ai/v1/assistant_pb.js +355 -97
  19. package/dist/gen/ai/v1/assistant_pb.js.map +1 -1
  20. package/dist/gen/alerts/v1/price_alerts_pb.d.ts +33 -4
  21. package/dist/gen/alerts/v1/price_alerts_pb.d.ts.map +1 -1
  22. package/dist/gen/alerts/v1/price_alerts_pb.js +23 -2
  23. package/dist/gen/alerts/v1/price_alerts_pb.js.map +1 -1
  24. package/dist/gen/auth/v1/activity_pb.d.ts +148 -0
  25. package/dist/gen/auth/v1/activity_pb.d.ts.map +1 -0
  26. package/dist/gen/auth/v1/activity_pb.js +40 -0
  27. package/dist/gen/auth/v1/activity_pb.js.map +1 -0
  28. package/dist/gen/auth/v1/api_keys_pb.d.ts +10 -4
  29. package/dist/gen/auth/v1/api_keys_pb.d.ts.map +1 -1
  30. package/dist/gen/auth/v1/api_keys_pb.js +3 -1
  31. package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
  32. package/dist/gen/auth/v1/auth_pb.d.ts +61 -5
  33. package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
  34. package/dist/gen/auth/v1/auth_pb.js +23 -6
  35. package/dist/gen/auth/v1/auth_pb.js.map +1 -1
  36. package/dist/gen/auth/v1/mfa_pb.d.ts +140 -2
  37. package/dist/gen/auth/v1/mfa_pb.d.ts.map +1 -1
  38. package/dist/gen/auth/v1/mfa_pb.js +80 -8
  39. package/dist/gen/auth/v1/mfa_pb.js.map +1 -1
  40. package/dist/gen/auth/v1/policies_pb.d.ts +18 -3
  41. package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
  42. package/dist/gen/auth/v1/policies_pb.js +18 -3
  43. package/dist/gen/auth/v1/policies_pb.js.map +1 -1
  44. package/dist/gen/auth/v1/social_verification_pb.d.ts +36 -15
  45. package/dist/gen/auth/v1/social_verification_pb.d.ts.map +1 -1
  46. package/dist/gen/auth/v1/social_verification_pb.js +1 -1
  47. package/dist/gen/auth/v1/social_verification_pb.js.map +1 -1
  48. package/dist/gen/auth/v1/subaccounts_pb.d.ts +15 -1
  49. package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
  50. package/dist/gen/auth/v1/subaccounts_pb.js +1 -1
  51. package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
  52. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +6 -2
  53. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts.map +1 -1
  54. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js.map +1 -1
  55. package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +104 -6
  56. package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
  57. package/dist/gen/chain/withdraw/v1/withdraw_pb.js +49 -3
  58. package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
  59. package/dist/gen/chain/zipper/v1/zipper_pb.d.ts +76 -3
  60. package/dist/gen/chain/zipper/v1/zipper_pb.d.ts.map +1 -1
  61. package/dist/gen/chain/zipper/v1/zipper_pb.js +46 -2
  62. package/dist/gen/chain/zipper/v1/zipper_pb.js.map +1 -1
  63. package/dist/gen/index.d.ts +3 -1
  64. package/dist/gen/index.js +4 -2
  65. package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +21 -139
  66. package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts.map +1 -1
  67. package/dist/gen/ledger/read/v1/ledger_read_pb.js +16 -17
  68. package/dist/gen/ledger/read/v1/ledger_read_pb.js.map +1 -1
  69. package/dist/gen/ledger/read/v1/statement_export_pb.d.ts +236 -20
  70. package/dist/gen/ledger/read/v1/statement_export_pb.d.ts.map +1 -1
  71. package/dist/gen/ledger/read/v1/statement_export_pb.js +44 -10
  72. package/dist/gen/ledger/read/v1/statement_export_pb.js.map +1 -1
  73. package/dist/gen/ledger/v1/catalog_pb.d.ts +9 -1
  74. package/dist/gen/ledger/v1/catalog_pb.d.ts.map +1 -1
  75. package/dist/gen/ledger/v1/catalog_pb.js +9 -1
  76. package/dist/gen/ledger/v1/catalog_pb.js.map +1 -1
  77. package/dist/gen/marketdata/v1/asset_info_pb.d.ts +158 -7
  78. package/dist/gen/marketdata/v1/asset_info_pb.d.ts.map +1 -1
  79. package/dist/gen/marketdata/v1/asset_info_pb.js +56 -6
  80. package/dist/gen/marketdata/v1/asset_info_pb.js.map +1 -1
  81. package/dist/gen/notifications/v1/notifications_pb.d.ts +45 -6
  82. package/dist/gen/notifications/v1/notifications_pb.d.ts.map +1 -1
  83. package/dist/gen/notifications/v1/notifications_pb.js +23 -5
  84. package/dist/gen/notifications/v1/notifications_pb.js.map +1 -1
  85. package/dist/gen/orders/v1/orders_pb.d.ts +105 -29
  86. package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
  87. package/dist/gen/orders/v1/orders_pb.js +14 -2
  88. package/dist/gen/orders/v1/orders_pb.js.map +1 -1
  89. package/dist/gen/orders/v1/orders_read_pb.d.ts +50 -20
  90. package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
  91. package/dist/gen/orders/v1/orders_read_pb.js +1 -1
  92. package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
  93. package/dist/gen/polyester/api/options_pb.d.ts +11 -2
  94. package/dist/gen/polyester/api/options_pb.d.ts.map +1 -1
  95. package/dist/gen/polyester/api/options_pb.js +13 -3
  96. package/dist/gen/polyester/api/options_pb.js.map +1 -1
  97. package/dist/gen/privatews/v1/private_ws_pb.d.ts +13 -3
  98. package/dist/gen/privatews/v1/private_ws_pb.d.ts.map +1 -1
  99. package/dist/gen/privatews/v1/private_ws_pb.js.map +1 -1
  100. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +126 -10
  101. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -1
  102. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +14 -6
  103. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
  104. package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.d.ts +665 -0
  105. package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.d.ts.map +1 -0
  106. package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.js +216 -0
  107. package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.js.map +1 -0
  108. package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +166 -52
  109. package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
  110. package/dist/gen/swap/quickswap/v1/quickswap_pb.js +50 -12
  111. package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
  112. package/dist/gen/system/v1/system_pb.d.ts +49 -2
  113. package/dist/gen/system/v1/system_pb.d.ts.map +1 -1
  114. package/dist/gen/system/v1/system_pb.js +18 -6
  115. package/dist/gen/system/v1/system_pb.js.map +1 -1
  116. package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +150 -71
  117. package/dist/gen/transfer/v1/internal_transfer_pb.d.ts.map +1 -1
  118. package/dist/gen/transfer/v1/internal_transfer_pb.js +56 -34
  119. package/dist/gen/transfer/v1/internal_transfer_pb.js.map +1 -1
  120. package/dist/gen/triggers/v1/triggers_pb.d.ts +117 -16
  121. package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
  122. package/dist/gen/triggers/v1/triggers_pb.js +45 -2
  123. package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
  124. package/dist/index.d.ts +13 -9
  125. package/dist/realtime/ready-gated-subscription.js +1 -1
  126. package/dist/realtime/snapshot-then-stream.js +2 -0
  127. package/dist/realtime/snapshot-then-stream.js.map +1 -1
  128. package/dist/services/account-activity/account-activity.d.ts +22 -0
  129. package/dist/services/account-activity/account-activity.d.ts.map +1 -0
  130. package/dist/services/account-activity/account-activity.js +32 -0
  131. package/dist/services/account-activity/account-activity.js.map +1 -0
  132. package/dist/services/account-activity/account-activity.schemas.d.ts +78 -0
  133. package/dist/services/account-activity/account-activity.schemas.d.ts.map +1 -0
  134. package/dist/services/account-activity/account-activity.schemas.js +44 -0
  135. package/dist/services/account-activity/account-activity.schemas.js.map +1 -0
  136. package/dist/services/account-activity/account-activity.types.d.ts +2 -0
  137. package/dist/services/account-activity/service.d.ts +8 -0
  138. package/dist/services/account-activity/service.d.ts.map +1 -0
  139. package/dist/services/account-activity/service.js +9 -0
  140. package/dist/services/account-activity/service.js.map +1 -0
  141. package/dist/services/address-book/address-book.schemas.d.ts +2 -2
  142. package/dist/services/address-book/address-book.schemas.js +2 -2
  143. package/dist/services/api-keys/api-keys.schemas.js +2 -2
  144. package/dist/services/assistant/assistant-events.schemas.d.ts +25 -25
  145. package/dist/services/assistant/assistant.codecs.d.ts +7 -2
  146. package/dist/services/assistant/assistant.codecs.d.ts.map +1 -1
  147. package/dist/services/assistant/assistant.codecs.js +18 -2
  148. package/dist/services/assistant/assistant.codecs.js.map +1 -1
  149. package/dist/services/assistant/assistant.d.ts +29 -2
  150. package/dist/services/assistant/assistant.d.ts.map +1 -1
  151. package/dist/services/assistant/assistant.js +44 -2
  152. package/dist/services/assistant/assistant.js.map +1 -1
  153. package/dist/services/assistant/assistant.schemas.d.ts +111 -6
  154. package/dist/services/assistant/assistant.schemas.d.ts.map +1 -1
  155. package/dist/services/assistant/assistant.schemas.js +74 -6
  156. package/dist/services/assistant/assistant.schemas.js.map +1 -1
  157. package/dist/services/assistant/assistant.types.d.ts +3 -3
  158. package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts +3 -1
  159. package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts.map +1 -1
  160. package/dist/services/auto-withdraw/auto-withdraw.codecs.js.map +1 -1
  161. package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +21 -19
  162. package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts.map +1 -1
  163. package/dist/services/auto-withdraw/auto-withdraw.schemas.js +1 -0
  164. package/dist/services/auto-withdraw/auto-withdraw.schemas.js.map +1 -1
  165. package/dist/services/balances/balances.d.ts +1 -13
  166. package/dist/services/balances/balances.d.ts.map +1 -1
  167. package/dist/services/balances/balances.js +1 -45
  168. package/dist/services/balances/balances.js.map +1 -1
  169. package/dist/services/balances/balances.schemas.d.ts +1 -67
  170. package/dist/services/balances/balances.schemas.d.ts.map +1 -1
  171. package/dist/services/balances/balances.schemas.js +1 -22
  172. package/dist/services/balances/balances.schemas.js.map +1 -1
  173. package/dist/services/balances/balances.types.d.ts +2 -2
  174. package/dist/services/candles/candles.schemas.d.ts +10 -10
  175. package/dist/services/changelog/changelog.schemas.d.ts +38 -38
  176. package/dist/services/claims/claims.schemas.d.ts +2 -2
  177. package/dist/services/dust-conversion/dust-conversion.schemas.d.ts +2 -2
  178. package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
  179. package/dist/services/internal-transfers/internal-transfers.codecs.d.ts +11 -6
  180. package/dist/services/internal-transfers/internal-transfers.codecs.d.ts.map +1 -1
  181. package/dist/services/internal-transfers/internal-transfers.codecs.js +6 -6
  182. package/dist/services/internal-transfers/internal-transfers.codecs.js.map +1 -1
  183. package/dist/services/internal-transfers/internal-transfers.d.ts +17 -10
  184. package/dist/services/internal-transfers/internal-transfers.d.ts.map +1 -1
  185. package/dist/services/internal-transfers/internal-transfers.js +21 -10
  186. package/dist/services/internal-transfers/internal-transfers.js.map +1 -1
  187. package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +43 -31
  188. package/dist/services/internal-transfers/internal-transfers.schemas.d.ts.map +1 -1
  189. package/dist/services/internal-transfers/internal-transfers.schemas.js +23 -12
  190. package/dist/services/internal-transfers/internal-transfers.schemas.js.map +1 -1
  191. package/dist/services/internal-transfers/internal-transfers.types.d.ts +2 -2
  192. package/dist/services/lifecycle/lifecycle.js +1 -1
  193. package/dist/services/lifecycle/lifecycle.js.map +1 -1
  194. package/dist/services/lifecycle/lifecycle.schemas.d.ts +55 -55
  195. package/dist/services/market-data/market-data.codecs.d.ts +8 -0
  196. package/dist/services/market-data/market-data.codecs.d.ts.map +1 -0
  197. package/dist/services/market-data/market-data.codecs.js +7 -1
  198. package/dist/services/market-data/market-data.codecs.js.map +1 -1
  199. package/dist/services/market-data/market-data.d.ts +3 -2
  200. package/dist/services/market-data/market-data.d.ts.map +1 -1
  201. package/dist/services/market-data/market-data.js +3 -2
  202. package/dist/services/market-data/market-data.js.map +1 -1
  203. package/dist/services/market-data/market-data.schemas.d.ts +332 -4
  204. package/dist/services/market-data/market-data.schemas.d.ts.map +1 -1
  205. package/dist/services/market-data/market-data.schemas.js +56 -8
  206. package/dist/services/market-data/market-data.schemas.js.map +1 -1
  207. package/dist/services/market-data/market-data.types.d.ts +3 -2
  208. package/dist/services/notifications/notifications.codecs.d.ts +1 -1
  209. package/dist/services/notifications/notifications.codecs.d.ts.map +1 -1
  210. package/dist/services/notifications/notifications.codecs.js +2 -1
  211. package/dist/services/notifications/notifications.codecs.js.map +1 -1
  212. package/dist/services/notifications/notifications.d.ts +4 -2
  213. package/dist/services/notifications/notifications.d.ts.map +1 -1
  214. package/dist/services/notifications/notifications.js +4 -2
  215. package/dist/services/notifications/notifications.js.map +1 -1
  216. package/dist/services/notifications/notifications.schemas.d.ts +50 -6
  217. package/dist/services/notifications/notifications.schemas.d.ts.map +1 -1
  218. package/dist/services/notifications/notifications.schemas.js +5 -0
  219. package/dist/services/notifications/notifications.schemas.js.map +1 -1
  220. package/dist/services/orderbook/orderbook.js +1 -1
  221. package/dist/services/orders/order-enums.codecs.d.ts +2 -0
  222. package/dist/services/orders/order-errors.schemas.d.ts +49 -4
  223. package/dist/services/orders/order-errors.schemas.d.ts.map +1 -1
  224. package/dist/services/orders/order-errors.schemas.js +13 -3
  225. package/dist/services/orders/order-errors.schemas.js.map +1 -1
  226. package/dist/services/orders/orders-batch.schemas.d.ts +290 -50
  227. package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
  228. package/dist/services/orders/orders-input.schemas.d.ts +55 -8
  229. package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
  230. package/dist/services/orders/orders-input.schemas.js +1 -1
  231. package/dist/services/orders/orders-output.schemas.d.ts +10 -10
  232. package/dist/services/orders/orders.d.ts.map +1 -1
  233. package/dist/services/orders/orders.js +47 -43
  234. package/dist/services/orders/orders.js.map +1 -1
  235. package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -15
  236. package/dist/services/policies/api-key-policies/api-key-policies.schemas.js +1 -1
  237. package/dist/services/policies/shared.codecs.js +12 -6
  238. package/dist/services/policies/shared.codecs.js.map +1 -1
  239. package/dist/services/policies/shared.d.ts +1 -1
  240. package/dist/services/policies/shared.js +1 -1
  241. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +9 -9
  242. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +3 -3
  243. package/dist/services/price-alerts/price-alerts.d.ts +5 -2
  244. package/dist/services/price-alerts/price-alerts.d.ts.map +1 -1
  245. package/dist/services/price-alerts/price-alerts.js +5 -2
  246. package/dist/services/price-alerts/price-alerts.js.map +1 -1
  247. package/dist/services/price-alerts/price-alerts.schemas.js +1 -1
  248. package/dist/services/social-verification/social-verification.schemas.d.ts +9 -0
  249. package/dist/services/social-verification/social-verification.schemas.d.ts.map +1 -1
  250. package/dist/services/social-verification/social-verification.schemas.js +9 -2
  251. package/dist/services/social-verification/social-verification.schemas.js.map +1 -1
  252. package/dist/services/statement-exports/statement-exports.codecs.d.ts +3 -2
  253. package/dist/services/statement-exports/statement-exports.codecs.d.ts.map +1 -1
  254. package/dist/services/statement-exports/statement-exports.codecs.js +2 -1
  255. package/dist/services/statement-exports/statement-exports.codecs.js.map +1 -1
  256. package/dist/services/statement-exports/statement-exports.d.ts +25 -10
  257. package/dist/services/statement-exports/statement-exports.d.ts.map +1 -1
  258. package/dist/services/statement-exports/statement-exports.js +33 -10
  259. package/dist/services/statement-exports/statement-exports.js.map +1 -1
  260. package/dist/services/statement-exports/statement-exports.schemas.d.ts +37 -9
  261. package/dist/services/statement-exports/statement-exports.schemas.d.ts.map +1 -1
  262. package/dist/services/statement-exports/statement-exports.schemas.js +24 -5
  263. package/dist/services/statement-exports/statement-exports.schemas.js.map +1 -1
  264. package/dist/services/statement-exports/statement-exports.types.d.ts +2 -2
  265. package/dist/services/subaccounts/subaccounts.codecs.js +112 -38
  266. package/dist/services/subaccounts/subaccounts.codecs.js.map +1 -1
  267. package/dist/services/subaccounts/subaccounts.js +1 -1
  268. package/dist/services/subaccounts/subaccounts.schemas.d.ts +22 -15
  269. package/dist/services/subaccounts/subaccounts.schemas.d.ts.map +1 -1
  270. package/dist/services/subaccounts/subaccounts.schemas.js +10 -3
  271. package/dist/services/subaccounts/subaccounts.schemas.js.map +1 -1
  272. package/dist/services/system/system.d.ts +12 -1
  273. package/dist/services/system/system.d.ts.map +1 -1
  274. package/dist/services/system/system.js +5 -0
  275. package/dist/services/system/system.js.map +1 -1
  276. package/dist/services/system/system.schemas.d.ts +13 -13
  277. package/dist/services/system/system.types.d.ts +2 -2
  278. package/dist/services/trades/trades.d.ts.map +1 -1
  279. package/dist/services/trades/trades.js +12 -4
  280. package/dist/services/trades/trades.js.map +1 -1
  281. package/dist/services/trades/trades.schemas.d.ts +1 -1
  282. package/dist/services/trading-withdraws/trading-withdraws.codecs.d.ts +8 -0
  283. package/dist/services/trading-withdraws/trading-withdraws.codecs.d.ts.map +1 -0
  284. package/dist/services/trading-withdraws/trading-withdraws.codecs.js +7 -1
  285. package/dist/services/trading-withdraws/trading-withdraws.codecs.js.map +1 -1
  286. package/dist/services/trading-withdraws/trading-withdraws.d.ts +2 -1
  287. package/dist/services/trading-withdraws/trading-withdraws.d.ts.map +1 -1
  288. package/dist/services/trading-withdraws/trading-withdraws.js +2 -1
  289. package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
  290. package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts +15 -0
  291. package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts.map +1 -1
  292. package/dist/services/trading-withdraws/trading-withdraws.schemas.js +16 -2
  293. package/dist/services/trading-withdraws/trading-withdraws.schemas.js.map +1 -1
  294. package/dist/services/trading-withdraws/trading-withdraws.types.d.ts +2 -1
  295. package/dist/services/transfers/transfers.schemas.d.ts +4 -4
  296. package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
  297. package/dist/services/triggers/triggers-output.schemas.d.ts +153 -35
  298. package/dist/services/triggers/triggers-output.schemas.d.ts.map +1 -1
  299. package/dist/services/triggers/triggers-output.schemas.js +13 -3
  300. package/dist/services/triggers/triggers-output.schemas.js.map +1 -1
  301. package/dist/services/triggers/triggers.codecs.d.ts +10 -0
  302. package/dist/services/triggers/triggers.codecs.d.ts.map +1 -0
  303. package/dist/services/triggers/triggers.codecs.js +7 -1
  304. package/dist/services/triggers/triggers.codecs.js.map +1 -1
  305. package/dist/services/triggers/triggers.d.ts +2 -2
  306. package/dist/services/triggers/triggers.d.ts.map +1 -1
  307. package/dist/services/triggers/triggers.js +16 -12
  308. package/dist/services/triggers/triggers.js.map +1 -1
  309. package/dist/services/zipper/zipper.d.ts.map +1 -1
  310. package/dist/services/zipper/zipper.js +13 -7
  311. package/dist/services/zipper/zipper.js.map +1 -1
  312. package/dist/services/zipper/zipper.schemas.d.ts +7 -2
  313. package/dist/services/zipper/zipper.schemas.d.ts.map +1 -1
  314. package/dist/services/zipper/zipper.schemas.js +29 -9
  315. package/dist/services/zipper/zipper.schemas.js.map +1 -1
  316. package/dist/services/zipper/zipper.types.d.ts +2 -2
  317. package/dist/shared/catalog-config.d.ts +16 -2
  318. package/dist/shared/catalog-config.d.ts.map +1 -1
  319. package/dist/shared/catalog-config.js.map +1 -1
  320. package/dist/shared/connect-error-mapping.d.ts.map +1 -1
  321. package/dist/shared/connect-error-mapping.js +7 -2
  322. package/dist/shared/connect-error-mapping.js.map +1 -1
  323. package/dist/shared/decimal-surface.d.ts +6 -0
  324. package/dist/shared/decimal-surface.d.ts.map +1 -1
  325. package/dist/shared/decimal-surface.js +65 -1
  326. package/dist/shared/decimal-surface.js.map +1 -1
  327. package/dist/shared/error-detail.d.ts +10 -0
  328. package/dist/shared/error-detail.d.ts.map +1 -1
  329. package/dist/shared/error-detail.js.map +1 -1
  330. package/dist/shared/error-details/auth.js +6 -0
  331. package/dist/shared/error-details/auth.js.map +1 -1
  332. package/dist/shared/ledger-codes.d.ts +3 -1
  333. package/dist/shared/ledger-codes.d.ts.map +1 -1
  334. package/dist/shared/ledger-codes.js +6 -3
  335. package/dist/shared/ledger-codes.js.map +1 -1
  336. package/dist/wired-services.d.ts.map +1 -1
  337. package/dist/wired-services.js +3 -1
  338. package/dist/wired-services.js.map +1 -1
  339. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"assistant.js","names":["#client","Proto.AssistantService","#scales"],"sources":["../../../src/services/assistant/assistant.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport { formatRunEvent, type AssistantRunEvent } from \"./assistant-events.schemas.js\";\nimport { ApprovalStatusCodec, type AssistantApprovalStatus } from \"./assistant.codecs.js\";\nimport {\n AssistantRunIdInputSchema,\n CompleteAssistantKeysInputSchema,\n DecideAssistantApprovalInputSchema,\n DeleteAssistantMemoryInputSchema,\n formatAssistantKey,\n formatConversation,\n formatMemory,\n formatMessage,\n formatPrepareAssistantKeysResult,\n formatTelegramApprovalLimits,\n ListAssistantConversationsInputSchema,\n ListAssistantMemoriesInputSchema,\n ListAssistantMessagesInputSchema,\n PrepareAssistantKeysInputSchema,\n SendAssistantMessageInputSchema,\n SetTelegramApprovalLimitsInputSchema,\n WatchAssistantRunInputSchema,\n type AssistantKey,\n type AssistantRunIdInput,\n type CompleteAssistantKeysInput,\n ListAssistantKeysInputSchema,\n type ListAssistantKeysInput,\n type DecideAssistantApprovalInput,\n type DeleteAssistantMemoryInput,\n type ListAssistantConversationsInput,\n type ListAssistantConversationsResult,\n type ListAssistantMemoriesInput,\n type ListAssistantMemoriesResult,\n type ListAssistantMessagesInput,\n type ListAssistantMessagesResult,\n type PrepareAssistantKeysInput,\n type PrepareAssistantKeysResult,\n type SendAssistantMessageInput,\n type SetTelegramApprovalLimitsInput,\n type TelegramApprovalLimits,\n type WatchAssistantRunInput,\n} from \"./assistant.schemas.js\";\n\n/**\n * The Polyester trading assistant. `sendMessage` starts a run that answers the message;\n * follow it with `watchRun`. A run continues on the server when nobody watches it. Actions that\n * change the account wait for `decideApproval`. Needs a session login; every conversation, run,\n * approval and memory belongs to the signed-in user. Errors carry\n * `detail: { service: \"assistant\", code }`.\n */\nexport class AssistantService {\n #client: Client<typeof Proto.AssistantService>;\n #scales: SdkScales;\n\n constructor(transports: AuthApiTransports, scales: SdkScales) {\n this.#client = createClient(Proto.AssistantService, transports.authApi);\n this.#scales = scales;\n }\n\n /**\n * Records the message and starts a run that answers it; returns once the run is recorded.\n * Idempotent per `idempotencyKey`: repeat the request unchanged to resolve an unknown\n * outcome. A conversation runs one run at a time (`RUN_ACTIVE`).\n */\n async sendMessage(\n input: SendAssistantMessageInput,\n options?: PolyesterRequestOptions,\n ): Promise<{ runId: string; conversationId: string }> {\n const request = parse(SendAssistantMessageInputSchema, input);\n const response = await this.#client.sendMessage(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n runId: formatId(response.runId),\n conversationId: formatId(response.conversationId),\n };\n }\n\n /**\n * Streams a run's events in `seq` order: the recorded events after `afterSeq`, then new ones\n * as they are recorded. Ends after `run_completed` or `run_failed`; watching an ended run\n * replays it. The server may end the stream early: call again with the last `seq` received\n * as `afterSeq` to continue without gaps or repeats. Abort with `options.signal`.\n */\n async *watchRun(\n input: WatchAssistantRunInput,\n options?: PolyesterRequestOptions,\n ): AsyncGenerator<AssistantRunEvent, void, undefined> {\n const request = parse(WatchAssistantRunInputSchema, input);\n await this.#scales.ready();\n for await (const response of this.#client.watchRun(\n request,\n toConnectCallOptions(options),\n )) {\n if (response.event) yield formatRunEvent(response.event, this.#scales);\n }\n }\n\n /**\n * Asks an active run to stop; it then ends with `run_failed` category `canceled`.\n * Canceling an ended run succeeds and changes nothing.\n */\n async cancelRun(input: AssistantRunIdInput, options?: PolyesterRequestOptions): Promise<void> {\n const request = parse(AssistantRunIdInputSchema, input);\n await this.#client.cancelRun(request, toConnectCallOptions(options));\n }\n\n /**\n * Approves or rejects a pending approval from an `approval_requested` event. An approved\n * action runs exactly as its summary says, at most once. Repeating the same decision returns\n * the recorded status.\n */\n async decideApproval(\n input: DecideAssistantApprovalInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantApprovalStatus | \"unspecified\"> {\n const request = parse(DecideAssistantApprovalInputSchema, input);\n const response = await this.#client.decideApproval(request, toConnectCallOptions(options));\n return enumLabel(ApprovalStatusCodec.protoToOutput, response.status);\n }\n\n /** Lists the caller's conversations, most recently updated first. */\n async listConversations(\n input: ListAssistantConversationsInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantConversationsResult> {\n const request = parse(ListAssistantConversationsInputSchema, input);\n const response = await this.#client.listConversations(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n conversations: response.conversations.map(formatConversation),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /** Lists one conversation's messages, newest first. */\n async listMessages(\n input: ListAssistantMessagesInput,\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantMessagesResult> {\n const request = parse(ListAssistantMessagesInputSchema, input);\n const response = await this.#client.listMessages(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n messages: response.messages.map(formatMessage),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /**\n * Lists what the assistant remembers about the caller, newest first. A `profile` memory\n * applies to every answer; the others are used when relevant.\n */\n async listMemories(\n input: ListAssistantMemoriesInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantMemoriesResult> {\n const request = parse(ListAssistantMemoriesInputSchema, input);\n const response = await this.#client.listMemories(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n memories: response.memories.map(formatMemory),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /** Makes the assistant forget one memory. Deleting a deleted memory succeeds. */\n async deleteMemory(\n input: DeleteAssistantMemoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<void> {\n const request = parse(DeleteAssistantMemoryInputSchema, input);\n await this.#client.deleteMemory(request, toConnectCallOptions(options));\n }\n\n /**\n * Step 1 of giving the assistant keys: the assistant generates one Ed25519 key pair per\n * account and returns the public keys with their registration proofs. Register them with\n * `apiKeys.setAssistantKeys` (with a fresh `stepUpToken`) before `expiresAt`, then call\n * `completeKeys`. The step-up token goes to `setAssistantKeys` only, never to the assistant.\n */\n async prepareKeys(\n input: PrepareAssistantKeysInput,\n options?: PolyesterRequestOptions,\n ): Promise<PrepareAssistantKeysResult> {\n const request = parse(PrepareAssistantKeysInputSchema, input);\n const response = await this.#client.prepareAssistantKeys(\n { accounts: request.accounts.map((account) => removeUndefined(account)) },\n toConnectCallOptions(options),\n );\n return formatPrepareAssistantKeysResult(response);\n }\n\n /**\n * Finishes a key setup once `apiKeys.setAssistantKeys` registered its keys; returns the keys\n * the assistant now holds. Completing a completed setup returns the keys again.\n */\n async completeKeys(\n input: CompleteAssistantKeysInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantKey[]> {\n const request = parse(CompleteAssistantKeysInputSchema, input);\n const response = await this.#client.completeAssistantKeys(\n request,\n toConnectCallOptions(options),\n );\n return response.keys.map(formatAssistantKey);\n }\n\n /**\n * Lists the keys the assistant holds, at most one per account. An account without one has\n * no account tools. Pass `view: \"full\"` for each key's account name as `label`. Revoke them\n * with `apiKeys.deleteAssistantKeys`.\n */\n async listKeys(\n input: ListAssistantKeysInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<AssistantKey[]> {\n const request = parse(ListAssistantKeysInputSchema, input);\n const response = await this.#client.listAssistantKeys(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return response.keys.map(formatAssistantKey);\n }\n\n /**\n * Returns the caller's limits on what they may approve from Telegram, in US dollars of\n * notional value, and the value approved from Telegram in the last 24 hours while a limit\n * was set. Limits apply to placing, swapping, modifying and resuming; canceling, pausing\n * and rejecting are never limited.\n */\n async getTelegramApprovalLimits(\n options?: PolyesterRequestOptions,\n ): Promise<TelegramApprovalLimits & { approvedLast24hUsd: string }> {\n const response = await this.#client.getTelegramApprovalLimits(\n {},\n toConnectCallOptions(options),\n );\n return {\n ...formatTelegramApprovalLimits(response.limits),\n approvedLast24hUsd: response.approvedLast24hUsd,\n };\n }\n\n /**\n * Replaces both Telegram approval limits: a limit left out is turned off. Only a signed-in\n * session sets them; they apply to the next approval from Telegram. Returns the limits as\n * recorded.\n */\n async setTelegramApprovalLimits(\n input: SetTelegramApprovalLimitsInput,\n options?: PolyesterRequestOptions,\n ): Promise<TelegramApprovalLimits> {\n const limits = parse(SetTelegramApprovalLimitsInputSchema, input);\n const response = await this.#client.setTelegramApprovalLimits(\n { limits: removeUndefined(limits) },\n toConnectCallOptions(options),\n );\n return formatTelegramApprovalLimits(response.limits);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4DA,IAAa,mBAAb,MAA8B;CAC1B;CACA;CAEA,YAAY,YAA+B,QAAmB;EAC1D,KAAKA,UAAU,aAAaC,oBAAwB,WAAW,OAAO;EACtE,KAAKC,UAAU;CACnB;;;;;;CAOA,MAAM,YACF,OACA,SACkD;EAClD,MAAM,UAAU,MAAM,iCAAiC,KAAK;EAC5D,MAAM,WAAW,MAAM,KAAKF,QAAQ,YAChC,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO;GACH,OAAO,SAAS,SAAS,KAAK;GAC9B,gBAAgB,SAAS,SAAS,cAAc;EACpD;CACJ;;;;;;;CAQA,OAAO,SACH,OACA,SACkD;EAClD,MAAM,UAAU,MAAM,8BAA8B,KAAK;EACzD,MAAM,KAAKE,QAAQ,MAAM;EACzB,WAAW,MAAM,YAAY,KAAKF,QAAQ,SACtC,SACA,qBAAqB,OAAO,CAChC,GACI,IAAI,SAAS,OAAO,MAAM,eAAe,SAAS,OAAO,KAAKE,OAAO;CAE7E;;;;;CAMA,MAAM,UAAU,OAA4B,SAAkD;EAC1F,MAAM,UAAU,MAAM,2BAA2B,KAAK;EACtD,MAAM,KAAKF,QAAQ,UAAU,SAAS,qBAAqB,OAAO,CAAC;CACvE;;;;;;CAOA,MAAM,eACF,OACA,SACgD;EAChD,MAAM,UAAU,MAAM,oCAAoC,KAAK;EAC/D,MAAM,WAAW,MAAM,KAAKA,QAAQ,eAAe,SAAS,qB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M,kCAAkC,KAAK;EAK7D,QAAO,MAJgB,KAAKA,QAAQ,sBAChC,SACA,qBAAqB,OAAO,CAChC,EAAA,CACgB,KAAK,IAAI,kBAAkB;CAC/C;;;;;;CAOA,MAAM,SACF,QAAgC,CAAC,GACjC,SACuB;EACvB,MAAM,UAAU,MAAM,8BAA8B,KAAK;EAKzD,QAAO,MAJgB,KAAKA,QAAQ,kBAChC,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC,EAAA,CACgB,KAAK,IAAI,kBAAkB;CAC/C;;;;;;;CAQA,MAAM,0BACF,SACgE;EAChE,MAAM,WAAW,MAAM,KAAKA,QAAQ,0BAChC,CAAC,GACD,qBAAqB,OAAO,CAChC;EACA,OAAO;GACH,GAAG,6BAA6B,SAAS,MAAM;GAC/C,oBAAoB,SAAS;EACjC;CACJ;;;;;;CAOA,MAAM,0BACF,OACA,SAC+B;EAC/B,MAAM,SAAS,MAAM,sCAAsC,KAAK;EAChE,MAAM,WAAW,MAAM,KAAKA,QAAQ,0BAChC,EAAE,QAAQ,gBAAgB,MAAM,EAAE,GAClC,qBAAqB,OAAO,CAChC;EACA,OAAO,6BAA6B,SAAS,MAAM;CACvD;AACJ"}
1
+ {"version":3,"file":"assistant.js","names":["#client","Proto.AssistantService","#scales"],"sources":["../../../src/services/assistant/assistant.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport { formatRunEvent, type AssistantRunEvent } from \"./assistant-events.schemas.js\";\nimport { ApprovalStatusCodec, type AssistantApprovalStatus } from \"./assistant.codecs.js\";\nimport {\n AssistantRunIdInputSchema,\n CompleteAssistantKeysInputSchema,\n DecideAssistantApprovalInputSchema,\n DeleteAssistantMemoryInputSchema,\n formatAssistantKey,\n formatAssistantUsage,\n formatConversation,\n formatMemory,\n formatMessage,\n formatModelKey,\n formatPrepareAssistantKeysResult,\n formatTelegramApprovalLimits,\n GetAssistantMessageImageInputSchema,\n ListAssistantConversationsInputSchema,\n ListAssistantMemoriesInputSchema,\n ListAssistantMessagesInputSchema,\n PrepareAssistantKeysInputSchema,\n SendAssistantMessageInputSchema,\n SetAssistantModelKeyInputSchema,\n SetTelegramApprovalLimitsInputSchema,\n WatchAssistantRunInputSchema,\n type AssistantKey,\n type AssistantModelKey,\n type AssistantUsage,\n type GetAssistantMessageImageInput,\n type AssistantRunIdInput,\n type CompleteAssistantKeysInput,\n ListAssistantKeysInputSchema,\n type ListAssistantKeysInput,\n type DecideAssistantApprovalInput,\n type DeleteAssistantMemoryInput,\n type ListAssistantConversationsInput,\n type ListAssistantConversationsResult,\n type ListAssistantMemoriesInput,\n type ListAssistantMemoriesResult,\n type ListAssistantMessagesInput,\n type ListAssistantMessagesResult,\n type PrepareAssistantKeysInput,\n type PrepareAssistantKeysResult,\n type SendAssistantMessageInput,\n type SetAssistantModelKeyInput,\n type SetTelegramApprovalLimitsInput,\n type TelegramApprovalLimits,\n type WatchAssistantRunInput,\n} from \"./assistant.schemas.js\";\n\n/**\n * The Polyester trading assistant. `sendMessage` starts a run that answers the message;\n * follow it with `watchRun`. A run continues on the server when nobody watches it. Actions that\n * change the account wait for `decideApproval`. Needs a session login; every conversation, run,\n * approval and memory belongs to the signed-in user. Errors carry\n * `detail: { service: \"assistant\", code }`.\n */\nexport class AssistantService {\n #client: Client<typeof Proto.AssistantService>;\n #scales: SdkScales;\n\n constructor(transports: AuthApiTransports, scales: SdkScales) {\n this.#client = createClient(Proto.AssistantService, transports.authApi);\n this.#scales = scales;\n }\n\n /**\n * Records the message and starts a run that answers it; returns once the run is recorded.\n * Idempotent per `idempotencyKey`: repeat the request unchanged to resolve an unknown\n * outcome. A conversation runs one run at a time (`RUN_ACTIVE`). With\n * `expectedLatestRunId`, a conversation that moved on fails with `CONVERSATION_ADVANCED`,\n * a final answer: do not retry it.\n */\n async sendMessage(\n input: SendAssistantMessageInput,\n options?: PolyesterRequestOptions,\n ): Promise<{ runId: string; conversationId: string }> {\n const request = parse(SendAssistantMessageInputSchema, input);\n const response = await this.#client.sendMessage(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n runId: formatId(response.runId),\n conversationId: formatId(response.conversationId),\n };\n }\n\n /**\n * Streams a run's events in `seq` order: the recorded events after `afterSeq`, then new ones\n * as they are recorded. Ends after `run_completed` or `run_failed`; watching an ended run\n * replays it. The server may end the stream early: call again with the last `seq` received\n * as `afterSeq` to continue without gaps or repeats. Abort with `options.signal`.\n */\n async *watchRun(\n input: WatchAssistantRunInput,\n options?: PolyesterRequestOptions,\n ): AsyncGenerator<AssistantRunEvent, void, undefined> {\n const request = parse(WatchAssistantRunInputSchema, input);\n await this.#scales.ready();\n for await (const response of this.#client.watchRun(\n request,\n toConnectCallOptions(options),\n )) {\n if (response.event) yield formatRunEvent(response.event, this.#scales);\n }\n }\n\n /**\n * Asks an active run to stop; it then ends with `run_failed` category `canceled`.\n * Canceling an ended run succeeds and changes nothing.\n */\n async cancelRun(input: AssistantRunIdInput, options?: PolyesterRequestOptions): Promise<void> {\n const request = parse(AssistantRunIdInputSchema, input);\n await this.#client.cancelRun(request, toConnectCallOptions(options));\n }\n\n /**\n * Approves or rejects a pending approval from an `approval_requested` event. An approved\n * action runs exactly as its summary says, at most once. Repeating the same decision returns\n * the recorded status.\n */\n async decideApproval(\n input: DecideAssistantApprovalInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantApprovalStatus | \"unspecified\"> {\n const request = parse(DecideAssistantApprovalInputSchema, input);\n const response = await this.#client.decideApproval(request, toConnectCallOptions(options));\n return enumLabel(ApprovalStatusCodec.protoToOutput, response.status);\n }\n\n /** Returns one image of the caller's messages, from `AssistantMessage.images`. */\n async getMessageImage(\n input: GetAssistantMessageImageInput,\n options?: PolyesterRequestOptions,\n ): Promise<{ data: Uint8Array; mimeType: string }> {\n const request = parse(GetAssistantMessageImageInputSchema, input);\n const { data, mimeType } = await this.#client.getMessageImage(\n request,\n toConnectCallOptions(options),\n );\n return { data, mimeType };\n }\n\n /** Lists the caller's conversations, most recently updated first. */\n async listConversations(\n input: ListAssistantConversationsInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantConversationsResult> {\n const request = parse(ListAssistantConversationsInputSchema, input);\n const response = await this.#client.listConversations(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n conversations: response.conversations.map(formatConversation),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /** Lists one conversation's messages, newest first. */\n async listMessages(\n input: ListAssistantMessagesInput,\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantMessagesResult> {\n const request = parse(ListAssistantMessagesInputSchema, input);\n const response = await this.#client.listMessages(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n messages: response.messages.map(formatMessage),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /**\n * Lists what the assistant remembers about the caller, newest first. A `profile` memory\n * applies to every answer; the others are used when relevant.\n */\n async listMemories(\n input: ListAssistantMemoriesInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantMemoriesResult> {\n const request = parse(ListAssistantMemoriesInputSchema, input);\n const response = await this.#client.listMemories(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n memories: response.memories.map(formatMemory),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /** Makes the assistant forget one memory. Deleting a deleted memory succeeds. */\n async deleteMemory(\n input: DeleteAssistantMemoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<void> {\n const request = parse(DeleteAssistantMemoryInputSchema, input);\n await this.#client.deleteMemory(request, toConnectCallOptions(options));\n }\n\n /**\n * Step 1 of giving the assistant keys: the assistant generates one Ed25519 key pair per\n * account and returns the public keys with their registration proofs. Register them with\n * `apiKeys.setAssistantKeys` (with a fresh `stepUpToken`) before `expiresAt`, then call\n * `completeKeys`. The step-up token goes to `setAssistantKeys` only, never to the assistant.\n */\n async prepareKeys(\n input: PrepareAssistantKeysInput,\n options?: PolyesterRequestOptions,\n ): Promise<PrepareAssistantKeysResult> {\n const request = parse(PrepareAssistantKeysInputSchema, input);\n const response = await this.#client.prepareAssistantKeys(\n { accounts: request.accounts.map((account) => removeUndefined(account)) },\n toConnectCallOptions(options),\n );\n return formatPrepareAssistantKeysResult(response);\n }\n\n /**\n * Finishes a key setup once `apiKeys.setAssistantKeys` registered its keys; returns the keys\n * the assistant now holds. Completing a completed setup returns the keys again.\n */\n async completeKeys(\n input: CompleteAssistantKeysInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantKey[]> {\n const request = parse(CompleteAssistantKeysInputSchema, input);\n const response = await this.#client.completeAssistantKeys(\n request,\n toConnectCallOptions(options),\n );\n return response.keys.map(formatAssistantKey);\n }\n\n /**\n * Lists the keys the assistant holds, at most one per account. An account without one has\n * no account tools. Pass `view: \"full\"` for each key's account name as `label`. Revoke them\n * with `apiKeys.deleteAssistantKeys`.\n */\n async listKeys(\n input: ListAssistantKeysInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<AssistantKey[]> {\n const request = parse(ListAssistantKeysInputSchema, input);\n const response = await this.#client.listAssistantKeys(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return response.keys.map(formatAssistantKey);\n }\n\n /**\n * Saves the caller's own OpenAI API key, replacing any earlier one, once OpenAI accepts it\n * (else `MODEL_KEY_REJECTED`, `MODEL_KEY_NO_QUOTA` or `MODEL_KEY_MODEL_UNAVAILABLE`, and\n * nothing is saved). Messages sent after it use the key instead of credits; a run whose key\n * OpenAI refuses fails with `model_key_refused`. Only a signed-in session sets it.\n */\n async setModelKey(\n input: SetAssistantModelKeyInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantModelKey> {\n const request = parse(SetAssistantModelKeyInputSchema, input);\n const response = await this.#client.setModelKey(request, toConnectCallOptions(options));\n return formatModelKey(response.key);\n }\n\n /** Returns the caller's own OpenAI API key's status, or `null` when they have none. */\n async getModelKey(options?: PolyesterRequestOptions): Promise<AssistantModelKey | null> {\n const response = await this.#client.getModelKey({}, toConnectCallOptions(options));\n return response.key ? formatModelKey(response.key) : null;\n }\n\n /**\n * Deletes the caller's own OpenAI API key; later messages use credits again. Runs already\n * started on it never switch. Deleting when there is no key succeeds.\n */\n async deleteModelKey(options?: PolyesterRequestOptions): Promise<void> {\n await this.#client.deleteModelKey({}, toConnectCallOptions(options));\n }\n\n /**\n * Returns the caller's assistant credits today: the VIP tier's free daily credits, how many\n * are used and left, when they reset, what pays for the next messages, and the next tier's\n * free credits. With none left on `credits`, runs fail with `daily_limit_reached`.\n */\n async getUsage(options?: PolyesterRequestOptions): Promise<AssistantUsage> {\n return formatAssistantUsage(await this.#client.getUsage({}, toConnectCallOptions(options)));\n }\n\n /**\n * Returns the caller's limits on what they may approve from Telegram, in US dollars of\n * notional value, and the value approved from Telegram in the last 24 hours while a limit\n * was set. Limits apply to placing, swapping, modifying and resuming; canceling, pausing\n * and rejecting are never limited.\n */\n async getTelegramApprovalLimits(\n options?: PolyesterRequestOptions,\n ): Promise<TelegramApprovalLimits & { approvedLast24hUsd: string }> {\n const response = await this.#client.getTelegramApprovalLimits(\n {},\n toConnectCallOptions(options),\n );\n return {\n ...formatTelegramApprovalLimits(response.limits),\n approvedLast24hUsd: response.approvedLast24hUsd,\n };\n }\n\n /**\n * Replaces both Telegram approval limits: a limit left out is turned off. Only a signed-in\n * session sets them; they apply to the next approval from Telegram. Returns the limits as\n * recorded.\n */\n async setTelegramApprovalLimits(\n input: SetTelegramApprovalLimitsInput,\n options?: PolyesterRequestOptions,\n ): Promise<TelegramApprovalLimits> {\n const limits = parse(SetTelegramApprovalLimitsInputSchema, input);\n const response = await this.#client.setTelegramApprovalLimits(\n { limits: removeUndefined(limits) },\n toConnectCallOptions(options),\n );\n return formatTelegramApprovalLimits(response.limits);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoEA,IAAa,mBAAb,MAA8B;CAC1B;CACA;CAEA,YAAY,YAA+B,QAAmB;EAC1D,KAAKA,UAAU,aAAaC,oBAAwB,WAAW,OAAO;EACtE,KAAKC,UAAU;CACnB;;;;;;;;CASA,MAAM,YACF,OACA,SACkD;EAClD,MAAM,UAAU,MAAM,iCAAiC,KAAK;EAC5D,MAAM,WAAW,MAAM,KAAKF,QAAQ,YAChC,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO;GACH,OAAO,SAAS,SAAS,KAAK;GAC9B,gBAAgB,SAAS,SAAS,cAAc;EACpD;CACJ;;;;;;;CAQA,OAAO,SACH,OACA,SACkD;EAClD,MAAM,UAAU,MAAM,8BAA8B,KAAK;EACzD,MAAM,KAAKE,QAAQ,MAAM;EACzB,WAAW,MAAM,YAAY,KAAKF,QAAQ,SACtC,SACA,qBAAqB,OAAO,CAChC,GACI,IAAI,SAAS,OAAO,MAAM,eAAe,SAAS,OAAO,KAAKE,OAAO;CAE7E;;;;;CAMA,MAAM,UAAU,OAA4B,SAAkD;EAC1F,MAAM,UAAU,MAAM,2BAA2B,KAAK;EACtD,MAAM,KAAKF,QAAQ,UAAU,SAAS,qBAAqB,OAAO,CAAC;CACvE;;;;;;CAOA,MAAM,eACF,OACA,SACgD;EAChD,MAAM,UAAU,MAAM,oCAAoC,KAAK;EAC/D,MAAM,WAAW,MAAM,KAAKA,QAAQ,eAAe,SAAS,qBAAqB,OAAO,CAAC;EACzF,OAAO,UAAU,oBAAoB,eAAe,SAAS,MAAM;CACvE;;CAGA,MAAM,gBACF,OACA,SAC+C;EAC/C,MAAM,UAAU,MAAM,qCAAqC,KAAK;EAChE,MAAM,EAAE,MAAM,aAAa,MAAM,KAAKA,QAAQ,gBAC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AE,GAClC,qBAAqB,OAAO,CAChC;EACA,OAAO,6BAA6B,SAAS,MAAM;CACvD;AACJ"}
@@ -1,11 +1,30 @@
1
- import { AccountSelection, ApprovalDecision, AssistantKey as AssistantKey$1, AssistantKeyView, Conversation, DisplaySetting, Memory, Message, PrepareAssistantKeysResponse, PreparedAssistantKey as PreparedAssistantKey$1 } from "../../gen/ai/v1/assistant_pb.js";
1
+ import { AccountSelection, ApprovalDecision, AssistantKey as AssistantKey$1, AssistantKeyView, Conversation, DisplaySetting, GetUsageResponse, Memory, Message, MessageImage, ModelKey, PrepareAssistantKeysResponse, PreparedAssistantKey as PreparedAssistantKey$1 } from "../../gen/ai/v1/assistant_pb.js";
2
2
  import * as v from "valibot";
3
3
  //#region src/services/assistant/assistant.schemas.d.ts
4
4
  declare const SendAssistantMessageInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
5
5
  /** Conversation to continue; omit to start a new one. */
6
6
  readonly conversationId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>, undefined>;
7
- /** Message text, plain text or Markdown, 1 to 16000 characters. */
8
- readonly text: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 16000, undefined>]>;
7
+ /**
8
+ * Message text, plain text or Markdown, at most 16000 characters. Required unless
9
+ * `images` are attached; with images, it is the question about them.
10
+ */
11
+ readonly text: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 16000, undefined>]>, undefined>;
12
+ /**
13
+ * Images the message shows the assistant, such as a screenshot, in the order the user
14
+ * attached them: PNG, JPEG or WebP, at most 4, each at most 10 MiB. Covered by
15
+ * `idempotencyKey`.
16
+ */
17
+ readonly images: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
18
+ readonly data: v.InstanceSchema<Uint8ArrayConstructor, undefined>;
19
+ /** `"image/png"`, `"image/jpeg"` or `"image/webp"`, matching `data`. */
20
+ readonly mimeType: v.StringSchema<undefined>;
21
+ }, undefined>, undefined>, undefined>;
22
+ /**
23
+ * Send only while this run is still the conversation's latest, e.g. the run of the
24
+ * answer a follow-up button sits under; otherwise nothing is recorded and the call fails
25
+ * with `CONVERSATION_ADVANCED`. Needs `conversationId`. Covered by `idempotencyKey`.
26
+ */
27
+ readonly expectedLatestRunId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>, undefined>;
9
28
  /** Client-chosen key, unique per caller. Repeat the request unchanged to resolve an unknown outcome. */
10
29
  readonly idempotencyKey: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
11
30
  /**
@@ -56,7 +75,12 @@ declare const SendAssistantMessageInputSchema: v.SchemaWithPipe<readonly [v.Stri
56
75
  readonly displaySettings: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["appearance", "language", "currency", "date_format", "time_format", "number_format", "week_start", "sounds"], undefined>, undefined>, v.CheckAction<("appearance" | "language" | "currency" | "date_format" | "time_format" | "number_format" | "week_start" | "sounds")[], "Display settings must be distinct.">, v.TransformAction<("appearance" | "language" | "currency" | "date_format" | "time_format" | "number_format" | "week_start" | "sounds")[], (DisplaySetting.APPEARANCE | DisplaySetting.LANGUAGE | DisplaySetting.CURRENCY | DisplaySetting.DATE_FORMAT | DisplaySetting.TIME_FORMAT | DisplaySetting.NUMBER_FORMAT | DisplaySetting.WEEK_START | DisplaySetting.SOUNDS)[]>]>, undefined>;
57
76
  }, undefined>, v.CheckAction<{
58
77
  conversationId?: bigint | undefined;
59
- text: string;
78
+ text?: string | undefined;
79
+ images?: {
80
+ data: Uint8Array<ArrayBuffer>;
81
+ mimeType: string;
82
+ }[] | undefined;
83
+ expectedLatestRunId?: bigint | undefined;
60
84
  idempotencyKey: string;
61
85
  subaccountId?: bigint | undefined;
62
86
  accountSelection?: AccountSelection.NONE | undefined;
@@ -71,7 +95,29 @@ declare const SendAssistantMessageInputSchema: v.SchemaWithPipe<readonly [v.Stri
71
95
  title: string;
72
96
  } | undefined;
73
97
  displaySettings?: (DisplaySetting.APPEARANCE | DisplaySetting.LANGUAGE | DisplaySetting.CURRENCY | DisplaySetting.DATE_FORMAT | DisplaySetting.TIME_FORMAT | DisplaySetting.NUMBER_FORMAT | DisplaySetting.WEEK_START | DisplaySetting.SOUNDS)[] | undefined;
74
- }, "Omit subaccountId when accountSelection is \"none\".">]>;
98
+ }, "Omit subaccountId when accountSelection is \"none\".">, v.CheckAction<{
99
+ conversationId?: bigint | undefined;
100
+ text?: string | undefined;
101
+ images?: {
102
+ data: Uint8Array<ArrayBuffer>;
103
+ mimeType: string;
104
+ }[] | undefined;
105
+ expectedLatestRunId?: bigint | undefined;
106
+ idempotencyKey: string;
107
+ subaccountId?: bigint | undefined;
108
+ accountSelection?: AccountSelection.NONE | undefined;
109
+ destinations?: {
110
+ id: string;
111
+ title: string;
112
+ description: string;
113
+ }[] | undefined;
114
+ page?: {
115
+ destinationId?: string | undefined;
116
+ route: string;
117
+ title: string;
118
+ } | undefined;
119
+ displaySettings?: (DisplaySetting.APPEARANCE | DisplaySetting.LANGUAGE | DisplaySetting.CURRENCY | DisplaySetting.DATE_FORMAT | DisplaySetting.TIME_FORMAT | DisplaySetting.NUMBER_FORMAT | DisplaySetting.WEEK_START | DisplaySetting.SOUNDS)[] | undefined;
120
+ }, "A message needs text, images or both.">]>;
75
121
  type SendAssistantMessageInput = v.InferInput<typeof SendAssistantMessageInputSchema>;
76
122
  declare const AssistantRunIdInputSchema: v.StrictObjectSchema<{
77
123
  readonly runId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
@@ -139,6 +185,15 @@ declare const PrepareAssistantKeysInputSchema: v.SchemaWithPipe<readonly [v.Stri
139
185
  }[];
140
186
  }, "Each account may be named only once.">]>;
141
187
  type PrepareAssistantKeysInput = v.InferInput<typeof PrepareAssistantKeysInputSchema>;
188
+ declare const GetAssistantMessageImageInputSchema: v.StrictObjectSchema<{
189
+ readonly imageId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
190
+ }, undefined>;
191
+ type GetAssistantMessageImageInput = v.InferInput<typeof GetAssistantMessageImageInputSchema>;
192
+ declare const SetAssistantModelKeyInputSchema: v.StrictObjectSchema<{
193
+ /** An OpenAI secret API key (`sk-...`). Never logged or returned. */
194
+ readonly apiKey: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
195
+ }, undefined>;
196
+ type SetAssistantModelKeyInput = v.InferInput<typeof SetAssistantModelKeyInputSchema>;
142
197
  declare const CompleteAssistantKeysInputSchema: v.StrictObjectSchema<{
143
198
  readonly setupId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
144
199
  }, undefined>;
@@ -159,7 +214,27 @@ declare function formatMessage(m: Message): {
159
214
  createdAt: number | undefined;
160
215
  /** Replay this run with `watchRun` from `afterSeq: 0` to show its tool activity and views. */
161
216
  runId: string;
217
+ /** A user message's images, in the order sent; read each with `getMessageImage`. */
218
+ images: {
219
+ imageId: string;
220
+ /** `"image/png"`, `"image/jpeg"` or `"image/webp"`. */
221
+ mimeType: string;
222
+ /** Pixels; an image over 2000 pixels on a side is stored scaled down to fit. */
223
+ width: number;
224
+ height: number;
225
+ sizeBytes: number;
226
+ }[];
227
+ };
228
+ declare function formatMessageImage(i: MessageImage): {
229
+ imageId: string;
230
+ /** `"image/png"`, `"image/jpeg"` or `"image/webp"`. */
231
+ mimeType: string;
232
+ /** Pixels; an image over 2000 pixels on a side is stored scaled down to fit. */
233
+ width: number;
234
+ height: number;
235
+ sizeBytes: number;
162
236
  };
237
+ type AssistantMessageImage = ReturnType<typeof formatMessageImage>;
163
238
  type AssistantMessage = ReturnType<typeof formatMessage>;
164
239
  declare function formatMemory(m: Memory): {
165
240
  memoryId: string;
@@ -221,6 +296,36 @@ declare function formatPrepareAssistantKeysResult(r: PrepareAssistantKeysRespons
221
296
  expiresAt: number | undefined;
222
297
  };
223
298
  type PrepareAssistantKeysResult = ReturnType<typeof formatPrepareAssistantKeysResult>;
299
+ /** The caller's own OpenAI API key as the assistant shows it; the key itself is never returned. */
300
+ declare function formatModelKey(k: ModelKey | undefined): {
301
+ /** The key's last four characters, e.g. `"x7Qa"`. */
302
+ suffix: string;
303
+ addedAt: number | undefined;
304
+ /** The last check with OpenAI: on save, when OpenAI refused it in a run, and on recovery. */
305
+ lastCheck: "unspecified" | "rejected" | "valid" | "no_quota" | "model_unavailable";
306
+ checkedAt: number | undefined;
307
+ };
308
+ type AssistantModelKey = ReturnType<typeof formatModelKey>;
309
+ /** Credits are the main account's, shared by every subaccount. */
310
+ declare function formatAssistantUsage(r: GetUsageResponse): {
311
+ /** With `"own_key"`, messages use no credits. */
312
+ fundingMode: "credits" | "own_key";
313
+ /** Omitted when the tier could not be read; VIP 0's free credits then apply. */
314
+ vipTier: number | undefined;
315
+ /** Today's free credits. */
316
+ freeCredits: number;
317
+ /** Rounded down; may exceed `freeCredits`, as an answer started with credits left finishes. */
318
+ freeCreditsUsed: number;
319
+ freeCreditsLeft: number;
320
+ /** Epoch ms of the next 00:00 UTC; unused credits do not carry over. */
321
+ resetsAt: number | undefined;
322
+ /** The next VIP tier's daily free credits; omitted at the top tier or an unknown tier. */
323
+ nextTier: {
324
+ vipTier: number;
325
+ dailyFreeCredits: number;
326
+ } | undefined;
327
+ };
328
+ type AssistantUsage = ReturnType<typeof formatAssistantUsage>;
224
329
  /** `nextPageToken` is empty when no more results exist. */
225
330
  type ListAssistantConversationsResult = {
226
331
  conversations: AssistantConversation[];
@@ -247,5 +352,5 @@ type TelegramApprovalLimits = {
247
352
  dailyUsd: string | null;
248
353
  };
249
354
  //#endregion
250
- export { AssistantConversation, AssistantKey, AssistantMemory, AssistantMessage, AssistantRunIdInput, AssistantRunIdInputSchema, CompleteAssistantKeysInput, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInput, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInput, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInput, ListAssistantConversationsInputSchema, ListAssistantConversationsResult, ListAssistantKeysInput, ListAssistantKeysInputSchema, ListAssistantMemoriesInput, ListAssistantMemoriesInputSchema, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesInputSchema, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysInputSchema, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SendAssistantMessageInputSchema, SetTelegramApprovalLimitsInput, SetTelegramApprovalLimitsInputSchema, TelegramApprovalLimits, WatchAssistantRunInput, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult, formatPreparedAssistantKey };
355
+ export { AssistantConversation, AssistantKey, AssistantMemory, AssistantMessage, AssistantMessageImage, AssistantModelKey, AssistantRunIdInput, AssistantRunIdInputSchema, AssistantUsage, CompleteAssistantKeysInput, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInput, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInput, DeleteAssistantMemoryInputSchema, GetAssistantMessageImageInput, GetAssistantMessageImageInputSchema, ListAssistantConversationsInput, ListAssistantConversationsInputSchema, ListAssistantConversationsResult, ListAssistantKeysInput, ListAssistantKeysInputSchema, ListAssistantMemoriesInput, ListAssistantMemoriesInputSchema, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesInputSchema, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysInputSchema, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SendAssistantMessageInputSchema, SetAssistantModelKeyInput, SetAssistantModelKeyInputSchema, SetTelegramApprovalLimitsInput, SetTelegramApprovalLimitsInputSchema, TelegramApprovalLimits, WatchAssistantRunInput, WatchAssistantRunInputSchema, formatAssistantKey, formatAssistantUsage, formatConversation, formatMemory, formatMessage, formatMessageImage, formatModelKey, formatPrepareAssistantKeysResult, formatPreparedAssistantKey };
251
356
  //# sourceMappingURL=assistant.schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assistant.schemas.d.ts","names":[],"sources":["../../../src/services/assistant/assistant.schemas.ts"],"mappings":";;;cAoEa,iCAA+B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4DhC,4BAA4B,EAAE,kBAAkB;cAE/C,2BAAyB,EAAA;;;KAE1B,sBAAsB,EAAE,kBAAkB;cAEzC,8BAA4B,EAAA,yBAAA,EAAA;;;;;;;;;;;KAY7B,yBAAyB,EAAE,kBAAkB;cAE5C,oCAAkC,EAAA,yBAAA,EAAA;;;;;;;;;;KAWnC,+BAA+B,EAAE,kBAAkB;cAElD,uCAAqC,EAAA;;;;;;KAEtC,kCAAkC,EAAE,kBACrC;cAGE,kCAAgC,EAAA;;;;;KAKjC,6BAA6B,EAAE,kBAAkB;cAEhD,kCAAgC,EAAA;;;;;;KAEjC,6BAA6B,EAAE,kBAAkB;cAEhD,kCAAgC,EAAA;;;KAIjC,6BAA6B,EAAE,kBAAkB;cAEhD,iCAA+B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;KAgBhC,4BAA4B,EAAE,kBAAkB;cAE/C,kCAAgC,EAAA;;;KAIjC,6BAA6B,EAAE,kBAAkB;iBAQ7C,mBAAmB,GAAG;;;;;;;KAU1B,wBAAwB,kBAAkB;iBAEtC,cAAc,GAAG;;;;;;;;;KAYrB,mBAAmB,kBAAkB;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KAgBhC,4BAA4B,EAAE,kBAAkB;cAE/C,qCAAmC,EAAA;;;KAIpC,gCAAgC,EAAE,kBACnC;cAGE,iCAA+B,EAAA;;;;KAKhC,4BAA4B,EAAE,kBAAkB;cAE/C,kCAAgC,EAAA;;;KAIjC,6BAA6B,EAAE,kBAAkB;iBAQ7C,mBAAmB,GAAG;;;;;;;KAU1B,wBAAwB,kBAAkB;iBAEtC,cAAc,GAAG;;;;;;;;;;;;;;;;;;;iBAcjB,mBAAmB,GAAG;;;;;;;;;KAY1B,wBAAwB,kBAAkB;KAE1C,mBAAmB,kBAAkB;iBAEjC,aAAa,GAAG;;;;;;;;KAWpB,kBAAkB,kBAAkB;iBAEhC,mBAAmB,GAAG;;;;;;;;;;;;;cAgBzB,8BAA4B,EAAA,yBAAA,EAAA;;;;;;;;KAU7B,yBAAyB,EAAE,kBAAkB;KAE7C,eAAe,kBAAkB;iBAE7B,2BAA2B,GAAG;;;;;;;;;;KAalC,uBAAuB,kBAAkB;iBAErC,iCAAiC,GAAG;;;;;;;;;;;;;;;;KAUxC,6BAA6B,kBAAkB;;iBAG3C,eAAe,GAAG;;;;;;;;KAWtB,oBAAoB,kBAAkB;;iBAGlC,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;KAqB5B,iBAAiB,kBAAkB;;KAGnC;EACR,eAAe;EACf;;KAEQ;EAAgC,UAAU;EAAoB;;KAC9D;EAAgC,UAAU;EAAmB;;cAS5D,sCAAoC,EAAA;;;;;;KAOrC,iCAAiC,EAAE,kBACpC;;KAIC;EACR;EACA"}
@@ -2,7 +2,7 @@ import { formatId } from "../../utils/base58-id.js";
2
2
  import { tsObjToMs } from "../../utils/time.js";
3
3
  import { idInputSchema, optionalSubaccountIdInputSchema } from "../../shared/schemas.js";
4
4
  import { enumLabel } from "../../shared/proto-enum-codec.js";
5
- import { ASSISTANT_ACCOUNT_SELECTION_VALUES, ASSISTANT_APPROVAL_DECISION_VALUES, ASSISTANT_DISPLAY_SETTING_VALUES, ASSISTANT_KEY_VIEW_VALUES, AccountSelectionCodec, ApprovalDecisionCodec, AssistantKeyStateCodec, AssistantKeyViewCodec, DisplaySettingCodec, MemoryKindCodec, MessageRoleCodec } from "./assistant.codecs.js";
5
+ import { ASSISTANT_ACCOUNT_SELECTION_VALUES, ASSISTANT_APPROVAL_DECISION_VALUES, ASSISTANT_DISPLAY_SETTING_VALUES, ASSISTANT_KEY_VIEW_VALUES, AccountSelectionCodec, ApprovalDecisionCodec, AssistantKeyStateCodec, AssistantKeyViewCodec, DisplaySettingCodec, FundingModeCodec, MemoryKindCodec, MessageRoleCodec, ModelKeyCheckCodec } from "./assistant.codecs.js";
6
6
  import { bytesToHex } from "@noble/hashes/utils.js";
7
7
  import * as v from "valibot";
8
8
  //#region src/services/assistant/assistant.schemas.ts
@@ -38,8 +38,27 @@ const CurrentPageInputSchema = v.strictObject({
38
38
  const SendAssistantMessageInputSchema = v.pipe(v.strictObject({
39
39
  /** Conversation to continue; omit to start a new one. */
40
40
  conversationId: v.optional(idInputSchema("conversationId")),
41
- /** Message text, plain text or Markdown, 1 to 16000 characters. */
42
- text: v.pipe(v.string(), v.minLength(1), v.maxLength(16e3)),
41
+ /**
42
+ * Message text, plain text or Markdown, at most 16000 characters. Required unless
43
+ * `images` are attached; with images, it is the question about them.
44
+ */
45
+ text: v.optional(v.pipe(v.string(), v.maxLength(16e3))),
46
+ /**
47
+ * Images the message shows the assistant, such as a screenshot, in the order the user
48
+ * attached them: PNG, JPEG or WebP, at most 4, each at most 10 MiB. Covered by
49
+ * `idempotencyKey`.
50
+ */
51
+ images: v.optional(v.array(v.strictObject({
52
+ data: v.instance(Uint8Array),
53
+ /** `"image/png"`, `"image/jpeg"` or `"image/webp"`, matching `data`. */
54
+ mimeType: v.string()
55
+ }))),
56
+ /**
57
+ * Send only while this run is still the conversation's latest, e.g. the run of the
58
+ * answer a follow-up button sits under; otherwise nothing is recorded and the call fails
59
+ * with `CONVERSATION_ADVANCED`. Needs `conversationId`. Covered by `idempotencyKey`.
60
+ */
61
+ expectedLatestRunId: v.optional(idInputSchema("expectedLatestRunId")),
43
62
  /** Client-chosen key, unique per caller. Repeat the request unchanged to resolve an unknown outcome. */
44
63
  idempotencyKey: IdempotencyKeySchema,
45
64
  /**
@@ -66,7 +85,7 @@ const SendAssistantMessageInputSchema = v.pipe(v.strictObject({
66
85
  * `display_setting_action` asks, each once. Omit for none.
67
86
  */
68
87
  displaySettings: v.optional(v.pipe(v.array(v.picklist(ASSISTANT_DISPLAY_SETTING_VALUES)), v.check((items) => new Set(items).size === items.length, "Display settings must be distinct."), v.transform((items) => items.map((item) => DisplaySettingCodec.inputToProto[item]))))
69
- }), v.check((input) => input.accountSelection === void 0 || input.subaccountId === void 0, "Omit subaccountId when accountSelection is \"none\"."));
88
+ }), v.check((input) => input.accountSelection === void 0 || input.subaccountId === void 0, "Omit subaccountId when accountSelection is \"none\"."), v.check((input) => Boolean(input.text || input.images?.length), "A message needs text, images or both."));
70
89
  const AssistantRunIdInputSchema = v.strictObject({ runId: idInputSchema("runId") });
71
90
  const WatchAssistantRunInputSchema = v.pipe(v.strictObject({
72
91
  runId: idInputSchema("runId"),
@@ -93,6 +112,10 @@ const DeleteAssistantMemoryInputSchema = v.strictObject({ memoryId: idInputSchem
93
112
  const PrepareAssistantKeysInputSchema = v.pipe(v.strictObject({
94
113
  /** 1 to 64 accounts, each once. An entry without `subaccountId` is the main account. */
95
114
  accounts: v.pipe(v.array(v.strictObject({ subaccountId: optionalSubaccountIdInputSchema() })), v.minLength(1, "At least one account is required."), v.maxLength(64, "At most 64 accounts are allowed.")) }), v.check(({ accounts }) => new Set(accounts.map((a) => a.subaccountId ?? 0n)).size === accounts.length, "Each account may be named only once."));
115
+ const GetAssistantMessageImageInputSchema = v.strictObject({ imageId: idInputSchema("imageId") });
116
+ const SetAssistantModelKeyInputSchema = v.strictObject({
117
+ /** An OpenAI secret API key (`sk-...`). Never logged or returned. */
118
+ apiKey: v.pipe(v.string(), v.minLength(1)) });
96
119
  const CompleteAssistantKeysInputSchema = v.strictObject({ setupId: idInputSchema("setupId") });
97
120
  function optionalId(id) {
98
121
  return id ? formatId(id) : void 0;
@@ -114,7 +137,20 @@ function formatMessage(m) {
114
137
  text: m.text,
115
138
  createdAt: tsObjToMs(m.createdAt),
116
139
  /** Replay this run with `watchRun` from `afterSeq: 0` to show its tool activity and views. */
117
- runId: formatId(m.runId)
140
+ runId: formatId(m.runId),
141
+ /** A user message's images, in the order sent; read each with `getMessageImage`. */
142
+ images: m.images.map(formatMessageImage)
143
+ };
144
+ }
145
+ function formatMessageImage(i) {
146
+ return {
147
+ imageId: formatId(i.imageId),
148
+ /** `"image/png"`, `"image/jpeg"` or `"image/webp"`. */
149
+ mimeType: i.mimeType,
150
+ /** Pixels; an image over 2000 pixels on a side is stored scaled down to fit. */
151
+ width: i.width,
152
+ height: i.height,
153
+ sizeBytes: i.sizeBytes
118
154
  };
119
155
  }
120
156
  function formatMemory(m) {
@@ -166,6 +202,38 @@ function formatPrepareAssistantKeysResult(r) {
166
202
  expiresAt: tsObjToMs(r.expiresAt)
167
203
  };
168
204
  }
205
+ /** The caller's own OpenAI API key as the assistant shows it; the key itself is never returned. */
206
+ function formatModelKey(k) {
207
+ return {
208
+ /** The key's last four characters, e.g. `"x7Qa"`. */
209
+ suffix: k?.suffix ?? "",
210
+ addedAt: tsObjToMs(k?.addedAt),
211
+ /** The last check with OpenAI: on save, when OpenAI refused it in a run, and on recovery. */
212
+ lastCheck: enumLabel(ModelKeyCheckCodec.protoToOutput, k?.lastCheck ?? 0),
213
+ checkedAt: tsObjToMs(k?.checkedAt)
214
+ };
215
+ }
216
+ /** Credits are the main account's, shared by every subaccount. */
217
+ function formatAssistantUsage(r) {
218
+ return {
219
+ /** With `"own_key"`, messages use no credits. */
220
+ fundingMode: FundingModeCodec.protoToOutput[r.fundingMode] ?? "credits",
221
+ /** Omitted when the tier could not be read; VIP 0's free credits then apply. */
222
+ vipTier: r.vipTier,
223
+ /** Today's free credits. */
224
+ freeCredits: Number(r.freeCredits),
225
+ /** Rounded down; may exceed `freeCredits`, as an answer started with credits left finishes. */
226
+ freeCreditsUsed: Number(r.freeCreditsUsed),
227
+ freeCreditsLeft: Number(r.freeCreditsLeft),
228
+ /** Epoch ms of the next 00:00 UTC; unused credits do not carry over. */
229
+ resetsAt: tsObjToMs(r.resetsAt),
230
+ /** The next VIP tier's daily free credits; omitted at the top tier or an unknown tier. */
231
+ nextTier: r.nextTier && {
232
+ vipTier: r.nextTier.vipTier,
233
+ dailyFreeCredits: Number(r.nextTier.dailyFreeCredits)
234
+ }
235
+ };
236
+ }
169
237
  /** US dollars as a decimal string with at most 2 decimal places, e.g. `"5000"` or `"250.50"`. */
170
238
  const UsdLimitInputSchema = v.pipe(v.string(), v.trim(), v.regex(/^\d+(\.\d{1,2})?$/, "limit must be US dollars with at most 2 decimal places"));
171
239
  const SetTelegramApprovalLimitsInputSchema = v.strictObject({
@@ -181,6 +249,6 @@ function formatTelegramApprovalLimits(limits) {
181
249
  };
182
250
  }
183
251
  //#endregion
184
- export { AssistantRunIdInputSchema, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInputSchema, ListAssistantKeysInputSchema, ListAssistantMemoriesInputSchema, ListAssistantMessagesInputSchema, PrepareAssistantKeysInputSchema, SendAssistantMessageInputSchema, SetTelegramApprovalLimitsInputSchema, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult, formatPreparedAssistantKey, formatTelegramApprovalLimits };
252
+ export { AssistantRunIdInputSchema, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInputSchema, GetAssistantMessageImageInputSchema, ListAssistantConversationsInputSchema, ListAssistantKeysInputSchema, ListAssistantMemoriesInputSchema, ListAssistantMessagesInputSchema, PrepareAssistantKeysInputSchema, SendAssistantMessageInputSchema, SetAssistantModelKeyInputSchema, SetTelegramApprovalLimitsInputSchema, WatchAssistantRunInputSchema, formatAssistantKey, formatAssistantUsage, formatConversation, formatMemory, formatMessage, formatMessageImage, formatModelKey, formatPrepareAssistantKeysResult, formatPreparedAssistantKey, formatTelegramApprovalLimits };
185
253
 
186
254
  //# sourceMappingURL=assistant.schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"assistant.schemas.js","names":[],"sources":["../../../src/services/assistant/assistant.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { bytesToHex } from \"@noble/hashes/utils.js\";\nimport type * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport { idInputSchema, optionalSubaccountIdInputSchema } from \"../../shared/schemas.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { tsObjToMs } from \"../../utils/time.js\";\nimport {\n ASSISTANT_ACCOUNT_SELECTION_VALUES,\n ASSISTANT_KEY_VIEW_VALUES,\n AccountSelectionCodec,\n AssistantKeyViewCodec,\n ASSISTANT_APPROVAL_DECISION_VALUES,\n ASSISTANT_DISPLAY_SETTING_VALUES,\n ApprovalDecisionCodec,\n AssistantKeyStateCodec,\n DisplaySettingCodec,\n MemoryKindCodec,\n MessageRoleCodec,\n} from \"./assistant.codecs.js\";\n\nconst IdempotencyKeySchema = v.pipe(v.string(), v.trim(), v.minLength(1));\n\nfunction pageInputEntries(maxLimit: number) {\n return {\n /** Page size; omit for the server default. */\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(maxLimit))),\n /** The previous page's `nextPageToken`. */\n pageToken: v.optional(v.pipe(v.string(), v.trim())),\n };\n}\n\nconst DestinationInputSchema = v.strictObject({\n /** The client's id for the place, e.g. `\"page-subaccounts\"`: lowercase letters, digits and hyphens. */\n id: v.pipe(\n v.string(),\n v.regex(/^[a-z0-9-]{1,64}$/, \"destination id must be 1-64 of a-z, 0-9, -\"),\n ),\n /** Its name as the client shows it, 1 to 80 characters. */\n title: v.pipe(v.string(), v.minLength(1), v.maxLength(80)),\n /** What the user does there, at most 200 characters. */\n description: v.optional(v.pipe(v.string(), v.maxLength(200)), \"\"),\n});\n\n/**\n * The page the user is on, named by its template and title, never by its address: never send the\n * URL, its query or fragment, or any id or symbol taken from the path.\n */\nconst CurrentPageInputSchema = v.strictObject({\n /** The page's `destinations` id, when it is one of them. */\n destinationId: v.optional(\n v.pipe(\n v.string(),\n v.regex(/^[a-z0-9-]{1,64}$/, \"destinationId must be 1-64 of a-z, 0-9, -\"),\n ),\n ),\n /** Route template with bracketed parameters, e.g. `\"/account/settings/[section]\"`. */\n route: v.pipe(\n v.string(),\n v.regex(\n /^\\/[A-Za-z0-9/\\-_.[\\]]{0,199}$/,\n \"route must start with / and use at most 200 of A-Z, a-z, 0-9, /, -, _, ., [, ]\",\n ),\n ),\n /** The page's title as the client shows it, 1 to 80 characters; never the user's own data. */\n title: v.pipe(v.string(), v.minLength(1), v.maxLength(80)),\n});\n\nexport const SendAssistantMessageInputSchema = v.pipe(\n v.strictObject({\n /** Conversation to continue; omit to start a new one. */\n conversationId: v.optional(idInputSchema(\"conversationId\")),\n /** Message text, plain text or Markdown, 1 to 16000 characters. */\n text: v.pipe(v.string(), v.minLength(1), v.maxLength(16_000)),\n /** Client-chosen key, unique per caller. Repeat the request unchanged to resolve an unknown outcome. */\n idempotencyKey: IdempotencyKeySchema,\n /**\n * Trading account the run reads and acts on. Omit for the main account: the run then\n * reads it (balances, trading accounts, API keys, price alerts, fees and permissions)\n * but places, changes and cancels nothing, and asks the user to pick a trading account.\n */\n subaccountId: optionalSubaccountIdInputSchema(),\n /**\n * `\"none\"` for a run that reads no account, such as when the user has given the\n * assistant access to no account; `subaccountId` must then be omitted. Omit to read the\n * `subaccountId` account or the main account. Covered by `idempotencyKey`.\n */\n accountSelection: v.pipe(\n v.optional(v.picklist(ASSISTANT_ACCOUNT_SELECTION_VALUES)),\n v.transform((value) => (value ? AccountSelectionCodec.inputToProto[value] : undefined)),\n ),\n /** Places in the client the run may suggest, at most 100, each id once. */\n destinations: v.optional(\n v.pipe(\n v.array(DestinationInputSchema),\n v.maxLength(100, \"At most 100 destinations are allowed.\"),\n v.check(\n (items) => new Set(items.map((d) => d.id)).size === items.length,\n \"Destination ids must be distinct.\",\n ),\n ),\n ),\n /**\n * The page the user is on as they send the message; omit for a client without pages.\n * Covered by `idempotencyKey`: a retry must send the page the first attempt sent.\n */\n page: v.optional(CurrentPageInputSchema),\n /**\n * Display settings the client offers now and will change when a run's\n * `display_setting_action` asks, each once. Omit for none.\n */\n displaySettings: v.optional(\n v.pipe(\n v.array(v.picklist(ASSISTANT_DISPLAY_SETTING_VALUES)),\n v.check(\n (items) => new Set(items).size === items.length,\n \"Display settings must be distinct.\",\n ),\n v.transform((items) => items.map((item) => DisplaySettingCodec.inputToProto[item])),\n ),\n ),\n }),\n v.check(\n (input) => input.accountSelection === undefined || input.subaccountId === undefined,\n 'Omit subaccountId when accountSelection is \"none\".',\n ),\n);\n\nexport type SendAssistantMessageInput = v.InferInput<typeof SendAssistantMessageInputSchema>;\n\nexport const AssistantRunIdInputSchema = v.strictObject({ runId: idInputSchema(\"runId\") });\n\nexport type AssistantRunIdInput = v.InferInput<typeof AssistantRunIdInputSchema>;\n\nexport const WatchAssistantRunInputSchema = v.pipe(\n v.strictObject({\n runId: idInputSchema(\"runId\"),\n /** Return events after this seq. 0 (default) replays the run; pass the last seq received to resume. */\n afterSeq: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(Number.MAX_SAFE_INTEGER)),\n 0,\n ),\n }),\n v.transform(({ runId, afterSeq }) => ({ runId, afterSeq: BigInt(afterSeq) })),\n);\n\nexport type WatchAssistantRunInput = v.InferInput<typeof WatchAssistantRunInputSchema>;\n\nexport const DecideAssistantApprovalInputSchema = v.pipe(\n v.strictObject({\n approvalId: idInputSchema(\"approvalId\"),\n decision: v.picklist(ASSISTANT_APPROVAL_DECISION_VALUES),\n }),\n v.transform(({ approvalId, decision }) => ({\n approvalId,\n decision: ApprovalDecisionCodec.inputToProto[decision],\n })),\n);\n\nexport type DecideAssistantApprovalInput = v.InferInput<typeof DecideAssistantApprovalInputSchema>;\n\nexport const ListAssistantConversationsInputSchema = v.strictObject(pageInputEntries(100));\n\nexport type ListAssistantConversationsInput = v.InferInput<\n typeof ListAssistantConversationsInputSchema\n>;\n\nexport const ListAssistantMessagesInputSchema = v.strictObject({\n conversationId: idInputSchema(\"conversationId\"),\n ...pageInputEntries(200),\n});\n\nexport type ListAssistantMessagesInput = v.InferInput<typeof ListAssistantMessagesInputSchema>;\n\nexport const ListAssistantMemoriesInputSchema = v.strictObject(pageInputEntries(200));\n\nexport type ListAssistantMemoriesInput = v.InferInput<typeof ListAssistantMemoriesInputSchema>;\n\nexport const DeleteAssistantMemoryInputSchema = v.strictObject({\n memoryId: idInputSchema(\"memoryId\"),\n});\n\nexport type DeleteAssistantMemoryInput = v.InferInput<typeof DeleteAssistantMemoryInputSchema>;\n\nexport const PrepareAssistantKeysInputSchema = v.pipe(\n v.strictObject({\n /** 1 to 64 accounts, each once. An entry without `subaccountId` is the main account. */\n accounts: v.pipe(\n v.array(v.strictObject({ subaccountId: optionalSubaccountIdInputSchema() })),\n v.minLength(1, \"At least one account is required.\"),\n v.maxLength(64, \"At most 64 accounts are allowed.\"),\n ),\n }),\n v.check(\n ({ accounts }) =>\n new Set(accounts.map((a) => a.subaccountId ?? 0n)).size === accounts.length,\n \"Each account may be named only once.\",\n ),\n);\n\nexport type PrepareAssistantKeysInput = v.InferInput<typeof PrepareAssistantKeysInputSchema>;\n\nexport const CompleteAssistantKeysInputSchema = v.strictObject({\n setupId: idInputSchema(\"setupId\"),\n});\n\nexport type CompleteAssistantKeysInput = v.InferInput<typeof CompleteAssistantKeysInputSchema>;\n\n/* ---------- outputs ---------- */\n\nfunction optionalId(id: bigint | undefined): string | undefined {\n return id ? formatId(id) : undefined;\n}\n\nexport function formatConversation(c: Proto.Conversation) {\n return {\n conversationId: formatId(c.conversationId),\n /** Empty until a title is available. */\n title: c.title,\n createdAt: tsObjToMs(c.createdAt),\n updatedAt: tsObjToMs(c.updatedAt),\n };\n}\n\nexport type AssistantConversation = ReturnType<typeof formatConversation>;\n\nexport function formatMessage(m: Proto.Message) {\n return {\n messageId: formatId(m.messageId),\n role: enumLabel(MessageRoleCodec.protoToOutput, m.role),\n /** Markdown. For an assistant message, its run's final text. */\n text: m.text,\n createdAt: tsObjToMs(m.createdAt),\n /** Replay this run with `watchRun` from `afterSeq: 0` to show its tool activity and views. */\n runId: formatId(m.runId),\n };\n}\n\nexport type AssistantMessage = ReturnType<typeof formatMessage>;\n\nexport function formatMemory(m: Proto.Memory) {\n return {\n memoryId: formatId(m.memoryId),\n text: m.text,\n createdAt: tsObjToMs(m.createdAt),\n /** Omitted when the conversation it was learned in is unknown. */\n conversationId: optionalId(m.conversationId),\n kind: enumLabel(MemoryKindCodec.protoToOutput, m.kind),\n };\n}\n\nexport type AssistantMemory = ReturnType<typeof formatMemory>;\n\nexport function formatAssistantKey(k: Proto.AssistantKey) {\n return {\n /** Omitted for the main account. */\n subaccountId: optionalId(k.subaccountId),\n keyId: k.keyId,\n publicKeyEd25519: k.publicKeyEd25519,\n publicKeyHex: bytesToHex(k.publicKeyEd25519),\n state: enumLabel(AssistantKeyStateCodec.protoToOutput, k.state),\n /**\n * The subaccount's name; only from `listKeys({ view: \"full\" })`. Empty for the main\n * account, an unnamed subaccount, or a name that could not be read.\n */\n label: k.label,\n };\n}\n\nexport const ListAssistantKeysInputSchema = v.pipe(\n v.strictObject({\n /** `\"full\"` adds each key's account name as `label`. */\n view: v.optional(v.picklist(ASSISTANT_KEY_VIEW_VALUES)),\n }),\n v.transform(({ view }) => ({\n view: view ? AssistantKeyViewCodec.inputToProto[view] : undefined,\n })),\n);\n\nexport type ListAssistantKeysInput = v.InferInput<typeof ListAssistantKeysInputSchema>;\n\nexport type AssistantKey = ReturnType<typeof formatAssistantKey>;\n\nexport function formatPreparedAssistantKey(k: Proto.PreparedAssistantKey) {\n return {\n /** Omitted for the main account. */\n subaccountId: optionalId(k.subaccountId),\n publicKeyEd25519: k.publicKeyEd25519,\n publicKeyHex: bytesToHex(k.publicKeyEd25519),\n /** Pass unchanged to `apiKeys.setAssistantKeys`. */\n registrationProof: k.registrationProof,\n /** Epoch ms; pass unchanged to `apiKeys.setAssistantKeys`. */\n registrationDeadline: tsObjToMs(k.registrationDeadline),\n };\n}\n\nexport type PreparedAssistantKey = ReturnType<typeof formatPreparedAssistantKey>;\n\nexport function formatPrepareAssistantKeysResult(r: Proto.PrepareAssistantKeysResponse) {\n return {\n setupId: formatId(r.setupId),\n /** One key per requested account, in request order. */\n keys: r.keys.map(formatPreparedAssistantKey),\n /** Epoch ms after which the keys can no longer be registered. */\n expiresAt: tsObjToMs(r.expiresAt),\n };\n}\n\nexport type PrepareAssistantKeysResult = ReturnType<typeof formatPrepareAssistantKeysResult>;\n\n/** `nextPageToken` is empty when no more results exist. */\nexport type ListAssistantConversationsResult = {\n conversations: AssistantConversation[];\n nextPageToken: string;\n};\nexport type ListAssistantMessagesResult = { messages: AssistantMessage[]; nextPageToken: string };\nexport type ListAssistantMemoriesResult = { memories: AssistantMemory[]; nextPageToken: string };\n\n/** US dollars as a decimal string with at most 2 decimal places, e.g. `\"5000\"` or `\"250.50\"`. */\nconst UsdLimitInputSchema = v.pipe(\n v.string(),\n v.trim(),\n v.regex(/^\\d+(\\.\\d{1,2})?$/, \"limit must be US dollars with at most 2 decimal places\"),\n);\n\nexport const SetTelegramApprovalLimitsInputSchema = v.strictObject({\n /** Largest notional value of one approval from Telegram. `\"0\"` allows none; omit for no limit. */\n perApprovalUsd: v.optional(UsdLimitInputSchema),\n /** Largest total notional value approved from Telegram in any rolling 24 hours; omit for no limit. */\n dailyUsd: v.optional(UsdLimitInputSchema),\n});\n\nexport type SetTelegramApprovalLimitsInput = v.InferInput<\n typeof SetTelegramApprovalLimitsInputSchema\n>;\n\n/** Limits on what the caller may approve from Telegram, in US dollars; `null` is no limit. */\nexport type TelegramApprovalLimits = {\n perApprovalUsd: string | null;\n dailyUsd: string | null;\n};\n\nexport function formatTelegramApprovalLimits(\n limits: Proto.TelegramApprovalLimits | undefined,\n): TelegramApprovalLimits {\n return {\n perApprovalUsd: limits?.perApprovalUsd ?? null,\n dailyUsd: limits?.dailyUsd ?? null,\n };\n}\n"],"mappings":";;;;;;;;AAqBA,MAAM,uBAAuB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,CAAC;AAExE,SAAS,iBAAiB,UAAkB;CACxC,OAAO;;EAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,QAAQ,CAAC,CAAC;;EAEtF,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,CAAC;CACtD;AACJ;AAEA,MAAM,yBAAyB,EAAE,aAAa;;CAE1C,IAAI,EAAE,KACF,EAAE,OAAO,GACT,EAAE,MAAM,qBAAqB,4CAA4C,CAC7E;;CAEA,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;;CAEzD,aAAa,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,GAAG,CAAC,GAAG,EAAE;AACpE,CAAC;;;;;AAMD,MAAM,yBAAyB,EAAE,aAAa;;CAE1C,eAAe,EAAE,SACb,EAAE,KACE,EAAE,OAAO,GACT,EAAE,MAAM,qBAAqB,2CAA2C,CAC5E,CACJ;;CAEA,OAAO,EAAE,KACL,EAAE,OAAO,GACT,EAAE,MACE,kCACA,gFACJ,CACJ;;CAEA,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;AAC7D,CAAC;AAED,MAAa,kCAAkC,EAAE,KAC7C,EAAE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GACP,EAAE,MAAM,qBAAqB,wDAAwD,CACzF;AAEA,MAAa,uCAAuC,EAAE,aAAa;;CAE/D,gBAAgB,EAAE,SAAS,mBAAmB;;CAE9C,UAAU,EAAE,SAAS,mBAAmB;AAC5C,CAAC;AAYD,SAAgB,6BACZ,QACsB;CACtB,OAAO;EACH,gBAAgB,QAAQ,kBAAkB;EAC1C,UAAU,QAAQ,YAAY;CAClC;AACJ"}
1
+ {"version":3,"file":"assistant.schemas.js","names":[],"sources":["../../../src/services/assistant/assistant.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { bytesToHex } from \"@noble/hashes/utils.js\";\nimport type * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport { idInputSchema, optionalSubaccountIdInputSchema } from \"../../shared/schemas.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { tsObjToMs } from \"../../utils/time.js\";\nimport {\n ASSISTANT_ACCOUNT_SELECTION_VALUES,\n ASSISTANT_KEY_VIEW_VALUES,\n AccountSelectionCodec,\n AssistantKeyViewCodec,\n ASSISTANT_APPROVAL_DECISION_VALUES,\n ASSISTANT_DISPLAY_SETTING_VALUES,\n ApprovalDecisionCodec,\n AssistantKeyStateCodec,\n DisplaySettingCodec,\n FundingModeCodec,\n MemoryKindCodec,\n MessageRoleCodec,\n ModelKeyCheckCodec,\n} from \"./assistant.codecs.js\";\n\nconst IdempotencyKeySchema = v.pipe(v.string(), v.trim(), v.minLength(1));\n\nfunction pageInputEntries(maxLimit: number) {\n return {\n /** Page size; omit for the server default. */\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(maxLimit))),\n /** The previous page's `nextPageToken`. */\n pageToken: v.optional(v.pipe(v.string(), v.trim())),\n };\n}\n\nconst DestinationInputSchema = v.strictObject({\n /** The client's id for the place, e.g. `\"page-subaccounts\"`: lowercase letters, digits and hyphens. */\n id: v.pipe(\n v.string(),\n v.regex(/^[a-z0-9-]{1,64}$/, \"destination id must be 1-64 of a-z, 0-9, -\"),\n ),\n /** Its name as the client shows it, 1 to 80 characters. */\n title: v.pipe(v.string(), v.minLength(1), v.maxLength(80)),\n /** What the user does there, at most 200 characters. */\n description: v.optional(v.pipe(v.string(), v.maxLength(200)), \"\"),\n});\n\n/**\n * The page the user is on, named by its template and title, never by its address: never send the\n * URL, its query or fragment, or any id or symbol taken from the path.\n */\nconst CurrentPageInputSchema = v.strictObject({\n /** The page's `destinations` id, when it is one of them. */\n destinationId: v.optional(\n v.pipe(\n v.string(),\n v.regex(/^[a-z0-9-]{1,64}$/, \"destinationId must be 1-64 of a-z, 0-9, -\"),\n ),\n ),\n /** Route template with bracketed parameters, e.g. `\"/account/settings/[section]\"`. */\n route: v.pipe(\n v.string(),\n v.regex(\n /^\\/[A-Za-z0-9/\\-_.[\\]]{0,199}$/,\n \"route must start with / and use at most 200 of A-Z, a-z, 0-9, /, -, _, ., [, ]\",\n ),\n ),\n /** The page's title as the client shows it, 1 to 80 characters; never the user's own data. */\n title: v.pipe(v.string(), v.minLength(1), v.maxLength(80)),\n});\n\nexport const SendAssistantMessageInputSchema = v.pipe(\n v.strictObject({\n /** Conversation to continue; omit to start a new one. */\n conversationId: v.optional(idInputSchema(\"conversationId\")),\n /**\n * Message text, plain text or Markdown, at most 16000 characters. Required unless\n * `images` are attached; with images, it is the question about them.\n */\n text: v.optional(v.pipe(v.string(), v.maxLength(16_000))),\n /**\n * Images the message shows the assistant, such as a screenshot, in the order the user\n * attached them: PNG, JPEG or WebP, at most 4, each at most 10 MiB. Covered by\n * `idempotencyKey`.\n */\n images: v.optional(\n v.array(\n v.strictObject({\n data: v.instance(Uint8Array),\n /** `\"image/png\"`, `\"image/jpeg\"` or `\"image/webp\"`, matching `data`. */\n mimeType: v.string(),\n }),\n ),\n ),\n /**\n * Send only while this run is still the conversation's latest, e.g. the run of the\n * answer a follow-up button sits under; otherwise nothing is recorded and the call fails\n * with `CONVERSATION_ADVANCED`. Needs `conversationId`. Covered by `idempotencyKey`.\n */\n expectedLatestRunId: v.optional(idInputSchema(\"expectedLatestRunId\")),\n /** Client-chosen key, unique per caller. Repeat the request unchanged to resolve an unknown outcome. */\n idempotencyKey: IdempotencyKeySchema,\n /**\n * Trading account the run reads and acts on. Omit for the main account: the run then\n * reads it (balances, trading accounts, API keys, price alerts, fees and permissions)\n * but places, changes and cancels nothing, and asks the user to pick a trading account.\n */\n subaccountId: optionalSubaccountIdInputSchema(),\n /**\n * `\"none\"` for a run that reads no account, such as when the user has given the\n * assistant access to no account; `subaccountId` must then be omitted. Omit to read the\n * `subaccountId` account or the main account. Covered by `idempotencyKey`.\n */\n accountSelection: v.pipe(\n v.optional(v.picklist(ASSISTANT_ACCOUNT_SELECTION_VALUES)),\n v.transform((value) => (value ? AccountSelectionCodec.inputToProto[value] : undefined)),\n ),\n /** Places in the client the run may suggest, at most 100, each id once. */\n destinations: v.optional(\n v.pipe(\n v.array(DestinationInputSchema),\n v.maxLength(100, \"At most 100 destinations are allowed.\"),\n v.check(\n (items) => new Set(items.map((d) => d.id)).size === items.length,\n \"Destination ids must be distinct.\",\n ),\n ),\n ),\n /**\n * The page the user is on as they send the message; omit for a client without pages.\n * Covered by `idempotencyKey`: a retry must send the page the first attempt sent.\n */\n page: v.optional(CurrentPageInputSchema),\n /**\n * Display settings the client offers now and will change when a run's\n * `display_setting_action` asks, each once. Omit for none.\n */\n displaySettings: v.optional(\n v.pipe(\n v.array(v.picklist(ASSISTANT_DISPLAY_SETTING_VALUES)),\n v.check(\n (items) => new Set(items).size === items.length,\n \"Display settings must be distinct.\",\n ),\n v.transform((items) => items.map((item) => DisplaySettingCodec.inputToProto[item])),\n ),\n ),\n }),\n v.check(\n (input) => input.accountSelection === undefined || input.subaccountId === undefined,\n 'Omit subaccountId when accountSelection is \"none\".',\n ),\n v.check(\n (input) => Boolean(input.text || input.images?.length),\n \"A message needs text, images or both.\",\n ),\n);\n\nexport type SendAssistantMessageInput = v.InferInput<typeof SendAssistantMessageInputSchema>;\n\nexport const AssistantRunIdInputSchema = v.strictObject({ runId: idInputSchema(\"runId\") });\n\nexport type AssistantRunIdInput = v.InferInput<typeof AssistantRunIdInputSchema>;\n\nexport const WatchAssistantRunInputSchema = v.pipe(\n v.strictObject({\n runId: idInputSchema(\"runId\"),\n /** Return events after this seq. 0 (default) replays the run; pass the last seq received to resume. */\n afterSeq: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(Number.MAX_SAFE_INTEGER)),\n 0,\n ),\n }),\n v.transform(({ runId, afterSeq }) => ({ runId, afterSeq: BigInt(afterSeq) })),\n);\n\nexport type WatchAssistantRunInput = v.InferInput<typeof WatchAssistantRunInputSchema>;\n\nexport const DecideAssistantApprovalInputSchema = v.pipe(\n v.strictObject({\n approvalId: idInputSchema(\"approvalId\"),\n decision: v.picklist(ASSISTANT_APPROVAL_DECISION_VALUES),\n }),\n v.transform(({ approvalId, decision }) => ({\n approvalId,\n decision: ApprovalDecisionCodec.inputToProto[decision],\n })),\n);\n\nexport type DecideAssistantApprovalInput = v.InferInput<typeof DecideAssistantApprovalInputSchema>;\n\nexport const ListAssistantConversationsInputSchema = v.strictObject(pageInputEntries(100));\n\nexport type ListAssistantConversationsInput = v.InferInput<\n typeof ListAssistantConversationsInputSchema\n>;\n\nexport const ListAssistantMessagesInputSchema = v.strictObject({\n conversationId: idInputSchema(\"conversationId\"),\n ...pageInputEntries(200),\n});\n\nexport type ListAssistantMessagesInput = v.InferInput<typeof ListAssistantMessagesInputSchema>;\n\nexport const ListAssistantMemoriesInputSchema = v.strictObject(pageInputEntries(200));\n\nexport type ListAssistantMemoriesInput = v.InferInput<typeof ListAssistantMemoriesInputSchema>;\n\nexport const DeleteAssistantMemoryInputSchema = v.strictObject({\n memoryId: idInputSchema(\"memoryId\"),\n});\n\nexport type DeleteAssistantMemoryInput = v.InferInput<typeof DeleteAssistantMemoryInputSchema>;\n\nexport const PrepareAssistantKeysInputSchema = v.pipe(\n v.strictObject({\n /** 1 to 64 accounts, each once. An entry without `subaccountId` is the main account. */\n accounts: v.pipe(\n v.array(v.strictObject({ subaccountId: optionalSubaccountIdInputSchema() })),\n v.minLength(1, \"At least one account is required.\"),\n v.maxLength(64, \"At most 64 accounts are allowed.\"),\n ),\n }),\n v.check(\n ({ accounts }) =>\n new Set(accounts.map((a) => a.subaccountId ?? 0n)).size === accounts.length,\n \"Each account may be named only once.\",\n ),\n);\n\nexport type PrepareAssistantKeysInput = v.InferInput<typeof PrepareAssistantKeysInputSchema>;\n\nexport const GetAssistantMessageImageInputSchema = v.strictObject({\n imageId: idInputSchema(\"imageId\"),\n});\n\nexport type GetAssistantMessageImageInput = v.InferInput<\n typeof GetAssistantMessageImageInputSchema\n>;\n\nexport const SetAssistantModelKeyInputSchema = v.strictObject({\n /** An OpenAI secret API key (`sk-...`). Never logged or returned. */\n apiKey: v.pipe(v.string(), v.minLength(1)),\n});\n\nexport type SetAssistantModelKeyInput = v.InferInput<typeof SetAssistantModelKeyInputSchema>;\n\nexport const CompleteAssistantKeysInputSchema = v.strictObject({\n setupId: idInputSchema(\"setupId\"),\n});\n\nexport type CompleteAssistantKeysInput = v.InferInput<typeof CompleteAssistantKeysInputSchema>;\n\n/* ---------- outputs ---------- */\n\nfunction optionalId(id: bigint | undefined): string | undefined {\n return id ? formatId(id) : undefined;\n}\n\nexport function formatConversation(c: Proto.Conversation) {\n return {\n conversationId: formatId(c.conversationId),\n /** Empty until a title is available. */\n title: c.title,\n createdAt: tsObjToMs(c.createdAt),\n updatedAt: tsObjToMs(c.updatedAt),\n };\n}\n\nexport type AssistantConversation = ReturnType<typeof formatConversation>;\n\nexport function formatMessage(m: Proto.Message) {\n return {\n messageId: formatId(m.messageId),\n role: enumLabel(MessageRoleCodec.protoToOutput, m.role),\n /** Markdown. For an assistant message, its run's final text. */\n text: m.text,\n createdAt: tsObjToMs(m.createdAt),\n /** Replay this run with `watchRun` from `afterSeq: 0` to show its tool activity and views. */\n runId: formatId(m.runId),\n /** A user message's images, in the order sent; read each with `getMessageImage`. */\n images: m.images.map(formatMessageImage),\n };\n}\n\nexport function formatMessageImage(i: Proto.MessageImage) {\n return {\n imageId: formatId(i.imageId),\n /** `\"image/png\"`, `\"image/jpeg\"` or `\"image/webp\"`. */\n mimeType: i.mimeType,\n /** Pixels; an image over 2000 pixels on a side is stored scaled down to fit. */\n width: i.width,\n height: i.height,\n sizeBytes: i.sizeBytes,\n };\n}\n\nexport type AssistantMessageImage = ReturnType<typeof formatMessageImage>;\n\nexport type AssistantMessage = ReturnType<typeof formatMessage>;\n\nexport function formatMemory(m: Proto.Memory) {\n return {\n memoryId: formatId(m.memoryId),\n text: m.text,\n createdAt: tsObjToMs(m.createdAt),\n /** Omitted when the conversation it was learned in is unknown. */\n conversationId: optionalId(m.conversationId),\n kind: enumLabel(MemoryKindCodec.protoToOutput, m.kind),\n };\n}\n\nexport type AssistantMemory = ReturnType<typeof formatMemory>;\n\nexport function formatAssistantKey(k: Proto.AssistantKey) {\n return {\n /** Omitted for the main account. */\n subaccountId: optionalId(k.subaccountId),\n keyId: k.keyId,\n publicKeyEd25519: k.publicKeyEd25519,\n publicKeyHex: bytesToHex(k.publicKeyEd25519),\n state: enumLabel(AssistantKeyStateCodec.protoToOutput, k.state),\n /**\n * The subaccount's name; only from `listKeys({ view: \"full\" })`. Empty for the main\n * account, an unnamed subaccount, or a name that could not be read.\n */\n label: k.label,\n };\n}\n\nexport const ListAssistantKeysInputSchema = v.pipe(\n v.strictObject({\n /** `\"full\"` adds each key's account name as `label`. */\n view: v.optional(v.picklist(ASSISTANT_KEY_VIEW_VALUES)),\n }),\n v.transform(({ view }) => ({\n view: view ? AssistantKeyViewCodec.inputToProto[view] : undefined,\n })),\n);\n\nexport type ListAssistantKeysInput = v.InferInput<typeof ListAssistantKeysInputSchema>;\n\nexport type AssistantKey = ReturnType<typeof formatAssistantKey>;\n\nexport function formatPreparedAssistantKey(k: Proto.PreparedAssistantKey) {\n return {\n /** Omitted for the main account. */\n subaccountId: optionalId(k.subaccountId),\n publicKeyEd25519: k.publicKeyEd25519,\n publicKeyHex: bytesToHex(k.publicKeyEd25519),\n /** Pass unchanged to `apiKeys.setAssistantKeys`. */\n registrationProof: k.registrationProof,\n /** Epoch ms; pass unchanged to `apiKeys.setAssistantKeys`. */\n registrationDeadline: tsObjToMs(k.registrationDeadline),\n };\n}\n\nexport type PreparedAssistantKey = ReturnType<typeof formatPreparedAssistantKey>;\n\nexport function formatPrepareAssistantKeysResult(r: Proto.PrepareAssistantKeysResponse) {\n return {\n setupId: formatId(r.setupId),\n /** One key per requested account, in request order. */\n keys: r.keys.map(formatPreparedAssistantKey),\n /** Epoch ms after which the keys can no longer be registered. */\n expiresAt: tsObjToMs(r.expiresAt),\n };\n}\n\nexport type PrepareAssistantKeysResult = ReturnType<typeof formatPrepareAssistantKeysResult>;\n\n/** The caller's own OpenAI API key as the assistant shows it; the key itself is never returned. */\nexport function formatModelKey(k: Proto.ModelKey | undefined) {\n return {\n /** The key's last four characters, e.g. `\"x7Qa\"`. */\n suffix: k?.suffix ?? \"\",\n addedAt: tsObjToMs(k?.addedAt),\n /** The last check with OpenAI: on save, when OpenAI refused it in a run, and on recovery. */\n lastCheck: enumLabel(ModelKeyCheckCodec.protoToOutput, k?.lastCheck ?? 0),\n checkedAt: tsObjToMs(k?.checkedAt),\n };\n}\n\nexport type AssistantModelKey = ReturnType<typeof formatModelKey>;\n\n/** Credits are the main account's, shared by every subaccount. */\nexport function formatAssistantUsage(r: Proto.GetUsageResponse) {\n return {\n /** With `\"own_key\"`, messages use no credits. */\n fundingMode: FundingModeCodec.protoToOutput[r.fundingMode] ?? \"credits\",\n /** Omitted when the tier could not be read; VIP 0's free credits then apply. */\n vipTier: r.vipTier,\n /** Today's free credits. */\n freeCredits: Number(r.freeCredits),\n /** Rounded down; may exceed `freeCredits`, as an answer started with credits left finishes. */\n freeCreditsUsed: Number(r.freeCreditsUsed),\n freeCreditsLeft: Number(r.freeCreditsLeft),\n /** Epoch ms of the next 00:00 UTC; unused credits do not carry over. */\n resetsAt: tsObjToMs(r.resetsAt),\n /** The next VIP tier's daily free credits; omitted at the top tier or an unknown tier. */\n nextTier: r.nextTier && {\n vipTier: r.nextTier.vipTier,\n dailyFreeCredits: Number(r.nextTier.dailyFreeCredits),\n },\n };\n}\n\nexport type AssistantUsage = ReturnType<typeof formatAssistantUsage>;\n\n/** `nextPageToken` is empty when no more results exist. */\nexport type ListAssistantConversationsResult = {\n conversations: AssistantConversation[];\n nextPageToken: string;\n};\nexport type ListAssistantMessagesResult = { messages: AssistantMessage[]; nextPageToken: string };\nexport type ListAssistantMemoriesResult = { memories: AssistantMemory[]; nextPageToken: string };\n\n/** US dollars as a decimal string with at most 2 decimal places, e.g. `\"5000\"` or `\"250.50\"`. */\nconst UsdLimitInputSchema = v.pipe(\n v.string(),\n v.trim(),\n v.regex(/^\\d+(\\.\\d{1,2})?$/, \"limit must be US dollars with at most 2 decimal places\"),\n);\n\nexport const SetTelegramApprovalLimitsInputSchema = v.strictObject({\n /** Largest notional value of one approval from Telegram. `\"0\"` allows none; omit for no limit. */\n perApprovalUsd: v.optional(UsdLimitInputSchema),\n /** Largest total notional value approved from Telegram in any rolling 24 hours; omit for no limit. */\n dailyUsd: v.optional(UsdLimitInputSchema),\n});\n\nexport type SetTelegramApprovalLimitsInput = v.InferInput<\n typeof SetTelegramApprovalLimitsInputSchema\n>;\n\n/** Limits on what the caller may approve from Telegram, in US dollars; `null` is no limit. */\nexport type TelegramApprovalLimits = {\n perApprovalUsd: string | null;\n dailyUsd: string | null;\n};\n\nexport function formatTelegramApprovalLimits(\n limits: Proto.TelegramApprovalLimits | undefined,\n): TelegramApprovalLimits {\n return {\n perApprovalUsd: limits?.perApprovalUsd ?? null,\n dailyUsd: limits?.dailyUsd ?? null,\n };\n}\n"],"mappings":";;;;;;;;AAuBA,MAAM,uBAAuB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,CAA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AssistantAccountSelection, AssistantApprovalDecision, AssistantApprovalStatus, AssistantDisplaySetting, AssistantFailureCategory, AssistantKeyState, AssistantKeyView, AssistantMemoryKind, AssistantMessageRole, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy } from "./assistant.codecs.js";
3
- import { AssistantConversation, AssistantKey, AssistantMemory, AssistantMessage, AssistantRunIdInput, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantKeysInput, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SetTelegramApprovalLimitsInput, TelegramApprovalLimits, WatchAssistantRunInput } from "./assistant.schemas.js";
4
- export type { AssistantAccountSelection, AssistantApprovalDecision, AssistantApprovalPreview, AssistantApprovalStatus, AssistantConversation, AssistantDisplaySetting, AssistantFailureCategory, AssistantKey, AssistantKeyState, AssistantKeyView, AssistantMemory, AssistantMemoryKind, AssistantMessage, AssistantMessageRole, AssistantOrderPreview, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantRunEvent, AssistantRunIdInput, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy, AssistantView, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantKeysInput, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SetTelegramApprovalLimitsInput, TelegramApprovalLimits, WatchAssistantRunInput };
2
+ import { AssistantAccountSelection, AssistantApprovalDecision, AssistantApprovalStatus, AssistantDisplaySetting, AssistantFailureCategory, AssistantFundingMode, AssistantKeyState, AssistantKeyView, AssistantMemoryKind, AssistantMessageRole, AssistantModelKeyCheck, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy } from "./assistant.codecs.js";
3
+ import { AssistantConversation, AssistantKey, AssistantMemory, AssistantMessage, AssistantMessageImage, AssistantModelKey, AssistantRunIdInput, AssistantUsage, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, GetAssistantMessageImageInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantKeysInput, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SetAssistantModelKeyInput, SetTelegramApprovalLimitsInput, TelegramApprovalLimits, WatchAssistantRunInput } from "./assistant.schemas.js";
4
+ export type { AssistantAccountSelection, AssistantApprovalDecision, AssistantApprovalPreview, AssistantApprovalStatus, AssistantConversation, AssistantDisplaySetting, AssistantFailureCategory, AssistantFundingMode, AssistantKey, AssistantKeyState, AssistantKeyView, AssistantMemory, AssistantMemoryKind, AssistantMessage, AssistantMessageImage, AssistantMessageRole, AssistantModelKey, AssistantModelKeyCheck, AssistantOrderPreview, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantRunEvent, AssistantRunIdInput, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy, AssistantUsage, AssistantView, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, GetAssistantMessageImageInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantKeysInput, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SetAssistantModelKeyInput, SetTelegramApprovalLimitsInput, TelegramApprovalLimits, WatchAssistantRunInput };
@@ -17,7 +17,9 @@ type AutoWithdrawRunReason = "nothing_to_pay" | "price_unavailable" | "rule_supe
17
17
  /** Why a step was skipped or failed. Unknown future reasons pass through as strings. */
18
18
  type AutoWithdrawStepReason = "below_minimum" | "price_unavailable" | "rule_superseded" | "destination_not_whitelisted" | "destination_cooling_down" |
19
19
  /** Withdrawals of the asset to the destination network are suspended; the funds stay for a later run. */
20
- "route_suspended" | "authority_revoked" | "gateway_capacity_insufficient" | "withdrawal_released" | "withdrawal_failed" | (string & {});
20
+ "route_suspended" |
21
+ /** The destination route's Zipper `supplyStatus` is `missing` or `stale`; the funds stay for a later run. */
22
+ "supply_unavailable" | "authority_revoked" | "gateway_capacity_insufficient" | "withdrawal_released" | "withdrawal_failed" | (string & {});
21
23
  /**
22
24
  * Why part or all of an asset's balance would stay on the account in a previewed run. Unknown
23
25
  * future reasons pass through as strings.
@@ -1 +1 @@
1
- {"version":3,"file":"auto-withdraw.codecs.d.ts","names":[],"sources":["../../../src/services/auto-withdraw/auto-withdraw.codecs.ts"],"mappings":";;cAGa;KAOD,8BAA8B;cAE7B;KASD,8BAA8B;cAE7B;KAQD,+BAA+B;cAE9B;KAQD,gCAAgC;cAE/B;KAOD,oCAAoC;;KAsEpC;;KAOA;;KAOA;;;;;;;KAkBA"}
1
+ {"version":3,"file":"auto-withdraw.codecs.d.ts","names":[],"sources":["../../../src/services/auto-withdraw/auto-withdraw.codecs.ts"],"mappings":";;cAGa;KAOD,8BAA8B;cAE7B;KASD,8BAA8B;cAE7B;KAQD,+BAA+B;cAE9B;KAQD,gCAAgC;cAE/B;KAOD,oCAAoC;;KAsEpC;;KAOA;;KAOA;;;;;;;;;KAoBA"}
@@ -1 +1 @@
1
- {"version":3,"file":"auto-withdraw.codecs.js","names":[],"sources":["../../../src/services/auto-withdraw/auto-withdraw.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/chain/withdraw/v1/auto_withdraw_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const AUTO_WITHDRAW_CADENCE_VALUES = [\n \"hourly\",\n \"daily\",\n \"weekly\",\n \"biweekly\",\n \"monthly\",\n] as const;\nexport type AutoWithdrawCadence = (typeof AUTO_WITHDRAW_CADENCE_VALUES)[number];\n\nexport const AUTO_WITHDRAW_WEEKDAY_VALUES = [\n \"monday\",\n \"tuesday\",\n \"wednesday\",\n \"thursday\",\n \"friday\",\n \"saturday\",\n \"sunday\",\n] as const;\nexport type AutoWithdrawWeekday = (typeof AUTO_WITHDRAW_WEEKDAY_VALUES)[number];\n\nexport const AUTO_WITHDRAW_RUN_STATE_VALUES = [\n \"planned\",\n \"paying\",\n \"completed\",\n \"partially_failed\",\n \"failed\",\n \"skipped\",\n] as const;\nexport type AutoWithdrawRunState = (typeof AUTO_WITHDRAW_RUN_STATE_VALUES)[number];\n\nexport const AUTO_WITHDRAW_STEP_STATE_VALUES = [\n \"pending\",\n \"submitting\",\n \"submitted\",\n \"completed\",\n \"failed\",\n \"skipped\",\n] as const;\nexport type AutoWithdrawStepState = (typeof AUTO_WITHDRAW_STEP_STATE_VALUES)[number];\n\nexport const AUTO_WITHDRAW_PREVIEW_STATUS_VALUES = [\n \"will_pay\",\n \"rolls_over\",\n \"no_destination\",\n \"paused\",\n \"no_rule\",\n] as const;\nexport type AutoWithdrawPreviewStatus = (typeof AUTO_WITHDRAW_PREVIEW_STATUS_VALUES)[number];\n\nexport const AutoWithdrawCadenceCodec = {\n inputToProto: {\n hourly: Proto.AutoWithdrawCadence.HOURLY,\n daily: Proto.AutoWithdrawCadence.DAILY,\n weekly: Proto.AutoWithdrawCadence.WEEKLY,\n biweekly: Proto.AutoWithdrawCadence.BIWEEKLY,\n monthly: Proto.AutoWithdrawCadence.MONTHLY,\n } satisfies InputToProto<AutoWithdrawCadence, Proto.AutoWithdrawCadence>,\n} as const;\n\nexport const AutoWithdrawWeekdayCodec = {\n inputToProto: {\n monday: Proto.AutoWithdrawWeekday.MONDAY,\n tuesday: Proto.AutoWithdrawWeekday.TUESDAY,\n wednesday: Proto.AutoWithdrawWeekday.WEDNESDAY,\n thursday: Proto.AutoWithdrawWeekday.THURSDAY,\n friday: Proto.AutoWithdrawWeekday.FRIDAY,\n saturday: Proto.AutoWithdrawWeekday.SATURDAY,\n sunday: Proto.AutoWithdrawWeekday.SUNDAY,\n } satisfies InputToProto<AutoWithdrawWeekday, Proto.AutoWithdrawWeekday>,\n protoToOutput: {\n [Proto.AutoWithdrawWeekday.WEEKDAY_UNSPECIFIED]: \"unspecified\",\n [Proto.AutoWithdrawWeekday.MONDAY]: \"monday\",\n [Proto.AutoWithdrawWeekday.TUESDAY]: \"tuesday\",\n [Proto.AutoWithdrawWeekday.WEDNESDAY]: \"wednesday\",\n [Proto.AutoWithdrawWeekday.THURSDAY]: \"thursday\",\n [Proto.AutoWithdrawWeekday.FRIDAY]: \"friday\",\n [Proto.AutoWithdrawWeekday.SATURDAY]: \"saturday\",\n [Proto.AutoWithdrawWeekday.SUNDAY]: \"sunday\",\n } satisfies ProtoToOutput<Proto.AutoWithdrawWeekday, AutoWithdrawWeekday>,\n} as const;\n\nexport const AutoWithdrawRunStateCodec = {\n protoToOutput: {\n [Proto.AutoWithdrawRunState.RUN_STATE_UNSPECIFIED]: \"unspecified\",\n [Proto.AutoWithdrawRunState.RUN_PLANNED]: \"planned\",\n [Proto.AutoWithdrawRunState.RUN_PAYING]: \"paying\",\n [Proto.AutoWithdrawRunState.RUN_COMPLETED]: \"completed\",\n [Proto.AutoWithdrawRunState.RUN_PARTIALLY_FAILED]: \"partially_failed\",\n [Proto.AutoWithdrawRunState.RUN_FAILED]: \"failed\",\n [Proto.AutoWithdrawRunState.RUN_SKIPPED]: \"skipped\",\n } satisfies ProtoToOutput<Proto.AutoWithdrawRunState, AutoWithdrawRunState>,\n} as const;\n\nexport const AutoWithdrawStepStateCodec = {\n protoToOutput: {\n [Proto.AutoWithdrawStepState.STEP_STATE_UNSPECIFIED]: \"unspecified\",\n [Proto.AutoWithdrawStepState.STEP_PENDING]: \"pending\",\n [Proto.AutoWithdrawStepState.STEP_SUBMITTING]: \"submitting\",\n [Proto.AutoWithdrawStepState.STEP_SUBMITTED]: \"submitted\",\n [Proto.AutoWithdrawStepState.STEP_COMPLETED]: \"completed\",\n [Proto.AutoWithdrawStepState.STEP_FAILED]: \"failed\",\n [Proto.AutoWithdrawStepState.STEP_SKIPPED]: \"skipped\",\n } satisfies ProtoToOutput<Proto.AutoWithdrawStepState, AutoWithdrawStepState>,\n} as const;\n\nexport const AutoWithdrawPreviewStatusCodec = {\n protoToOutput: {\n [Proto.AutoWithdrawPreviewStatus.PREVIEW_STATUS_UNSPECIFIED]: \"unspecified\",\n [Proto.AutoWithdrawPreviewStatus.WILL_PAY]: \"will_pay\",\n [Proto.AutoWithdrawPreviewStatus.ROLLS_OVER]: \"rolls_over\",\n [Proto.AutoWithdrawPreviewStatus.NO_DESTINATION]: \"no_destination\",\n [Proto.AutoWithdrawPreviewStatus.PAUSED]: \"paused\",\n [Proto.AutoWithdrawPreviewStatus.NO_RULE]: \"no_rule\",\n } satisfies ProtoToOutput<Proto.AutoWithdrawPreviewStatus, AutoWithdrawPreviewStatus>,\n} as const;\n\n/** Why a rule paused itself. Unknown future reasons pass through as strings. */\nexport type AutoWithdrawPauseReason =\n | \"destination_not_whitelisted\"\n | \"destination_invalid\"\n | \"authority_revoked\"\n | (string & {});\n\n/** Why a run was skipped. Unknown future reasons pass through as strings. */\nexport type AutoWithdrawRunReason =\n | \"nothing_to_pay\"\n | \"price_unavailable\"\n | \"rule_superseded\"\n | (string & {});\n\n/** Why a step was skipped or failed. Unknown future reasons pass through as strings. */\nexport type AutoWithdrawStepReason =\n | \"below_minimum\"\n | \"price_unavailable\"\n | \"rule_superseded\"\n | \"destination_not_whitelisted\"\n | \"destination_cooling_down\"\n /** Withdrawals of the asset to the destination network are suspended; the funds stay for a later run. */\n | \"route_suspended\"\n | \"authority_revoked\"\n | \"gateway_capacity_insufficient\"\n | \"withdrawal_released\"\n | \"withdrawal_failed\"\n | (string & {});\n\n/**\n * Why part or all of an asset's balance would stay on the account in a previewed run. Unknown\n * future reasons pass through as strings.\n */\nexport type AutoWithdrawHoldReason =\n | \"below_minimum\"\n | \"price_unavailable\"\n | \"no_destination\"\n | \"destination_cooling_down\"\n | \"above_max\"\n | \"dust\"\n | (string & {});\n"],"mappings":";;AAYA,MAAa,+BAA+B;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAgCA,MAAa,2BAA2B,EACpC,cAAc;CACV,QAAA;CACA,OAAA;CACA,QAAA;CACA,UAAA;CACA,SAAA;AACJ,EACJ;AAEA,MAAa,2BAA2B;CACpC,cAAc;EACV,QAAA;EACA,SAAA;EACA,WAAA;EACA,UAAA;EACA,QAAA;EACA,UAAA;EACA,QAAA;CACJ;CACA,eAAe;GACsC,IAAA;GACb,IAAA;GACC,IAAA;GACE,IAAA;GACD,IAAA;GACF,IAAA;GACE,IAAA;GACF,IAAA;CACxC;AACJ;AAEA,MAAa,4BAA4B,EACrC,eAAe;EACyC,IAAA;EACV,IAAA;EACD,IAAA;EACG,IAAA;EACO,IAAA;EACV,IAAA;EACC,IAAA;AAC9C,EACJ;AAEA,MAAa,6BAA6B,EACtC,eAAe;EAC2C,IAAA;EACV,IAAA;EACG,IAAA;EACD,IAAA;EACA,IAAA;EACH,IAAA;EACC,IAAA;AAChD,EACJ;AAEA,MAAa,iCAAiC,EAC1C,eAAe;EACmD,IAAA;EAClB,IAAA;EACE,IAAA;EACI,IAAA;EACR,IAAA;EACC,IAAA;AAC/C,EACJ"}
1
+ {"version":3,"file":"auto-withdraw.codecs.js","names":[],"sources":["../../../src/services/auto-withdraw/auto-withdraw.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/chain/withdraw/v1/auto_withdraw_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const AUTO_WITHDRAW_CADENCE_VALUES = [\n \"hourly\",\n \"daily\",\n \"weekly\",\n \"biweekly\",\n \"monthly\",\n] as const;\nexport type AutoWithdrawCadence = (typeof AUTO_WITHDRAW_CADENCE_VALUES)[number];\n\nexport const AUTO_WITHDRAW_WEEKDAY_VALUES = [\n \"monday\",\n \"tuesday\",\n \"wednesday\",\n \"thursday\",\n \"friday\",\n \"saturday\",\n \"sunday\",\n] as const;\nexport type AutoWithdrawWeekday = (typeof AUTO_WITHDRAW_WEEKDAY_VALUES)[number];\n\nexport const AUTO_WITHDRAW_RUN_STATE_VALUES = [\n \"planned\",\n \"paying\",\n \"completed\",\n \"partially_failed\",\n \"failed\",\n \"skipped\",\n] as const;\nexport type AutoWithdrawRunState = (typeof AUTO_WITHDRAW_RUN_STATE_VALUES)[number];\n\nexport const AUTO_WITHDRAW_STEP_STATE_VALUES = [\n \"pending\",\n \"submitting\",\n \"submitted\",\n \"completed\",\n \"failed\",\n \"skipped\",\n] as const;\nexport type AutoWithdrawStepState = (typeof AUTO_WITHDRAW_STEP_STATE_VALUES)[number];\n\nexport const AUTO_WITHDRAW_PREVIEW_STATUS_VALUES = [\n \"will_pay\",\n \"rolls_over\",\n \"no_destination\",\n \"paused\",\n \"no_rule\",\n] as const;\nexport type AutoWithdrawPreviewStatus = (typeof AUTO_WITHDRAW_PREVIEW_STATUS_VALUES)[number];\n\nexport const AutoWithdrawCadenceCodec = {\n inputToProto: {\n hourly: Proto.AutoWithdrawCadence.HOURLY,\n daily: Proto.AutoWithdrawCadence.DAILY,\n weekly: Proto.AutoWithdrawCadence.WEEKLY,\n biweekly: Proto.AutoWithdrawCadence.BIWEEKLY,\n monthly: Proto.AutoWithdrawCadence.MONTHLY,\n } satisfies InputToProto<AutoWithdrawCadence, Proto.AutoWithdrawCadence>,\n} as const;\n\nexport const AutoWithdrawWeekdayCodec = {\n inputToProto: {\n monday: Proto.AutoWithdrawWeekday.MONDAY,\n tuesday: Proto.AutoWithdrawWeekday.TUESDAY,\n wednesday: Proto.AutoWithdrawWeekday.WEDNESDAY,\n thursday: Proto.AutoWithdrawWeekday.THURSDAY,\n friday: Proto.AutoWithdrawWeekday.FRIDAY,\n saturday: Proto.AutoWithdrawWeekday.SATURDAY,\n sunday: Proto.AutoWithdrawWeekday.SUNDAY,\n } satisfies InputToProto<AutoWithdrawWeekday, Proto.AutoWithdrawWeekday>,\n protoToOutput: {\n [Proto.AutoWithdrawWeekday.WEEKDAY_UNSPECIFIED]: \"unspecified\",\n [Proto.AutoWithdrawWeekday.MONDAY]: \"monday\",\n [Proto.AutoWithdrawWeekday.TUESDAY]: \"tuesday\",\n [Proto.AutoWithdrawWeekday.WEDNESDAY]: \"wednesday\",\n [Proto.AutoWithdrawWeekday.THURSDAY]: \"thursday\",\n [Proto.AutoWithdrawWeekday.FRIDAY]: \"friday\",\n [Proto.AutoWithdrawWeekday.SATURDAY]: \"saturday\",\n [Proto.AutoWithdrawWeekday.SUNDAY]: \"sunday\",\n } satisfies ProtoToOutput<Proto.AutoWithdrawWeekday, AutoWithdrawWeekday>,\n} as const;\n\nexport const AutoWithdrawRunStateCodec = {\n protoToOutput: {\n [Proto.AutoWithdrawRunState.RUN_STATE_UNSPECIFIED]: \"unspecified\",\n [Proto.AutoWithdrawRunState.RUN_PLANNED]: \"planned\",\n [Proto.AutoWithdrawRunState.RUN_PAYING]: \"paying\",\n [Proto.AutoWithdrawRunState.RUN_COMPLETED]: \"completed\",\n [Proto.AutoWithdrawRunState.RUN_PARTIALLY_FAILED]: \"partially_failed\",\n [Proto.AutoWithdrawRunState.RUN_FAILED]: \"failed\",\n [Proto.AutoWithdrawRunState.RUN_SKIPPED]: \"skipped\",\n } satisfies ProtoToOutput<Proto.AutoWithdrawRunState, AutoWithdrawRunState>,\n} as const;\n\nexport const AutoWithdrawStepStateCodec = {\n protoToOutput: {\n [Proto.AutoWithdrawStepState.STEP_STATE_UNSPECIFIED]: \"unspecified\",\n [Proto.AutoWithdrawStepState.STEP_PENDING]: \"pending\",\n [Proto.AutoWithdrawStepState.STEP_SUBMITTING]: \"submitting\",\n [Proto.AutoWithdrawStepState.STEP_SUBMITTED]: \"submitted\",\n [Proto.AutoWithdrawStepState.STEP_COMPLETED]: \"completed\",\n [Proto.AutoWithdrawStepState.STEP_FAILED]: \"failed\",\n [Proto.AutoWithdrawStepState.STEP_SKIPPED]: \"skipped\",\n } satisfies ProtoToOutput<Proto.AutoWithdrawStepState, AutoWithdrawStepState>,\n} as const;\n\nexport const AutoWithdrawPreviewStatusCodec = {\n protoToOutput: {\n [Proto.AutoWithdrawPreviewStatus.PREVIEW_STATUS_UNSPECIFIED]: \"unspecified\",\n [Proto.AutoWithdrawPreviewStatus.WILL_PAY]: \"will_pay\",\n [Proto.AutoWithdrawPreviewStatus.ROLLS_OVER]: \"rolls_over\",\n [Proto.AutoWithdrawPreviewStatus.NO_DESTINATION]: \"no_destination\",\n [Proto.AutoWithdrawPreviewStatus.PAUSED]: \"paused\",\n [Proto.AutoWithdrawPreviewStatus.NO_RULE]: \"no_rule\",\n } satisfies ProtoToOutput<Proto.AutoWithdrawPreviewStatus, AutoWithdrawPreviewStatus>,\n} as const;\n\n/** Why a rule paused itself. Unknown future reasons pass through as strings. */\nexport type AutoWithdrawPauseReason =\n | \"destination_not_whitelisted\"\n | \"destination_invalid\"\n | \"authority_revoked\"\n | (string & {});\n\n/** Why a run was skipped. Unknown future reasons pass through as strings. */\nexport type AutoWithdrawRunReason =\n | \"nothing_to_pay\"\n | \"price_unavailable\"\n | \"rule_superseded\"\n | (string & {});\n\n/** Why a step was skipped or failed. Unknown future reasons pass through as strings. */\nexport type AutoWithdrawStepReason =\n | \"below_minimum\"\n | \"price_unavailable\"\n | \"rule_superseded\"\n | \"destination_not_whitelisted\"\n | \"destination_cooling_down\"\n /** Withdrawals of the asset to the destination network are suspended; the funds stay for a later run. */\n | \"route_suspended\"\n /** The destination route's Zipper `supplyStatus` is `missing` or `stale`; the funds stay for a later run. */\n | \"supply_unavailable\"\n | \"authority_revoked\"\n | \"gateway_capacity_insufficient\"\n | \"withdrawal_released\"\n | \"withdrawal_failed\"\n | (string & {});\n\n/**\n * Why part or all of an asset's balance would stay on the account in a previewed run. Unknown\n * future reasons pass through as strings.\n */\nexport type AutoWithdrawHoldReason =\n | \"below_minimum\"\n | \"price_unavailable\"\n | \"no_destination\"\n | \"destination_cooling_down\"\n | \"above_max\"\n | \"dust\"\n | (string & {});\n"],"mappings":";;AAYA,MAAa,+BAA+B;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAgCA,MAAa,2BAA2B,EACpC,cAAc;CACV,QAAA;CACA,OAAA;CACA,QAAA;CACA,UAAA;CACA,SAAA;AACJ,EACJ;AAEA,MAAa,2BAA2B;CACpC,cAAc;EACV,QAAA;EACA,SAAA;EACA,WAAA;EACA,UAAA;EACA,QAAA;EACA,UAAA;EACA,QAAA;CACJ;CACA,eAAe;GACsC,IAAA;GACb,IAAA;GACC,IAAA;GACE,IAAA;GACD,IAAA;GACF,IAAA;GACE,IAAA;GACF,IAAA;CACxC;AACJ;AAEA,MAAa,4BAA4B,EACrC,eAAe;EACyC,IAAA;EACV,IAAA;EACD,IAAA;EACG,IAAA;EACO,IAAA;EACV,IAAA;EACC,IAAA;AAC9C,EACJ;AAEA,MAAa,6BAA6B,EACtC,eAAe;EAC2C,IAAA;EACV,IAAA;EACG,IAAA;EACD,IAAA;EACA,IAAA;EACH,IAAA;EACC,IAAA;AAChD,EACJ;AAEA,MAAa,iCAAiC,EAC1C,eAAe;EACmD,IAAA;EAClB,IAAA;EACE,IAAA;EACI,IAAA;EACR,IAAA;EACC,IAAA;AAC/C,EACJ"}