@polyester/sdk 0.35.0 → 0.36.0-devnet-20261112202000

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 (281) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/browser-core.js +1 -1
  3. package/dist/catalogs/snapshot-validation.js +5 -0
  4. package/dist/catalogs/snapshot-validation.js.map +1 -1
  5. package/dist/client.d.ts +2 -0
  6. package/dist/client.d.ts.map +1 -1
  7. package/dist/client.js +2 -0
  8. package/dist/client.js.map +1 -1
  9. package/dist/gen/ai/v1/assistant_pb.d.ts +145 -3
  10. package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -1
  11. package/dist/gen/ai/v1/assistant_pb.js +33 -3
  12. package/dist/gen/ai/v1/assistant_pb.js.map +1 -1
  13. package/dist/gen/alerts/v1/price_alerts_pb.d.ts +12 -6
  14. package/dist/gen/alerts/v1/price_alerts_pb.d.ts.map +1 -1
  15. package/dist/gen/alerts/v1/price_alerts_pb.js +3 -1
  16. package/dist/gen/alerts/v1/price_alerts_pb.js.map +1 -1
  17. package/dist/gen/auth/v1/address_book_pb.d.ts +1 -1
  18. package/dist/gen/auth/v1/api_keys_pb.d.ts +1 -1
  19. package/dist/gen/auth/v1/auth_pb.d.ts +1 -1
  20. package/dist/gen/auth/v1/mfa_pb.d.ts +1 -1
  21. package/dist/gen/auth/v1/policies_pb.d.ts +15 -2
  22. package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
  23. package/dist/gen/auth/v1/policies_pb.js +14 -1
  24. package/dist/gen/auth/v1/policies_pb.js.map +1 -1
  25. package/dist/gen/auth/v1/profile_pb.d.ts +1 -1
  26. package/dist/gen/auth/v1/resolve_pb.d.ts +1 -1
  27. package/dist/gen/auth/v1/social_verification_pb.d.ts +1 -1
  28. package/dist/gen/auth/v1/subaccounts_pb.d.ts +15 -2
  29. package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
  30. package/dist/gen/auth/v1/subaccounts_pb.js +15 -2
  31. package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
  32. package/dist/gen/chain/analytics/v1/analytics_read_pb.d.ts +1 -1
  33. package/dist/gen/chain/deposit/v1/deposit_pb.d.ts +1 -1
  34. package/dist/gen/chain/guard/v1/guard_signer_pb.d.ts +1 -1
  35. package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts +1 -1
  36. package/dist/gen/chain/lifecycle/v1/types_pb.d.ts +1 -1
  37. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +1 -1
  38. package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +1 -1
  39. package/dist/gen/chain/zipper/v1/reason_pb.d.ts +1 -1
  40. package/dist/gen/chain/zipper/v1/zipper_pb.d.ts +1 -1
  41. package/dist/gen/changelog/v1/changelog_pb.d.ts +8 -2
  42. package/dist/gen/changelog/v1/changelog_pb.d.ts.map +1 -1
  43. package/dist/gen/changelog/v1/changelog_pb.js +7 -1
  44. package/dist/gen/changelog/v1/changelog_pb.js.map +1 -1
  45. package/dist/gen/checkpoints/v1/checkpoints_pb.d.ts +1 -1
  46. package/dist/gen/claims/v1/claims_pb.d.ts +1 -1
  47. package/dist/gen/fees/v1/fees_pb.d.ts +1 -1
  48. package/dist/gen/index.d.ts +2 -1
  49. package/dist/gen/index.js +22 -21
  50. package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +1 -1
  51. package/dist/gen/marketdata/v1/heatmap_pb.d.ts +1 -1
  52. package/dist/gen/marketdata/v1/marketdata_pb.d.ts +58 -6
  53. package/dist/gen/marketdata/v1/marketdata_pb.d.ts.map +1 -1
  54. package/dist/gen/marketdata/v1/marketdata_pb.js +10 -4
  55. package/dist/gen/marketdata/v1/marketdata_pb.js.map +1 -1
  56. package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts +1 -1
  57. package/dist/gen/notifications/v1/notifications_pb.d.ts +827 -0
  58. package/dist/gen/notifications/v1/notifications_pb.d.ts.map +1 -0
  59. package/dist/gen/notifications/v1/notifications_pb.js +346 -0
  60. package/dist/gen/notifications/v1/notifications_pb.js.map +1 -0
  61. package/dist/gen/orderbook/v1/orderbook_pb.d.ts +1 -1
  62. package/dist/gen/orders/v1/orders_pb.d.ts +248 -20
  63. package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
  64. package/dist/gen/orders/v1/orders_pb.js +188 -66
  65. package/dist/gen/orders/v1/orders_pb.js.map +1 -1
  66. package/dist/gen/orders/v1/orders_read_pb.d.ts +74 -6
  67. package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
  68. package/dist/gen/orders/v1/orders_read_pb.js +40 -5
  69. package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
  70. package/dist/gen/polyester/ratelimit/v1/types_pb.d.ts +1 -1
  71. package/dist/gen/polyester/type/v1/u128_pb.d.ts +1 -1
  72. package/dist/gen/privatews/v1/private_ws_pb.d.ts +1 -1
  73. package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts +1 -1
  74. package/dist/gen/rewards/v1/rewards_pb.d.ts +1 -1
  75. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +1195 -190
  76. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -1
  77. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +317 -7
  78. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
  79. package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +370 -7
  80. package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
  81. package/dist/gen/swap/quickswap/v1/quickswap_pb.js +237 -14
  82. package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
  83. package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts +1 -1
  84. package/dist/gen/swap/v1/swap_pb.d.ts +1 -1
  85. package/dist/gen/system/v1/system_pb.d.ts +1 -1
  86. package/dist/gen/tradews/v1/trade_ws_pb.d.ts +40 -2
  87. package/dist/gen/tradews/v1/trade_ws_pb.d.ts.map +1 -1
  88. package/dist/gen/tradews/v1/trade_ws_pb.js +2 -1
  89. package/dist/gen/tradews/v1/trade_ws_pb.js.map +1 -1
  90. package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +1 -1
  91. package/dist/gen/triggers/v1/triggers_pb.d.ts +527 -14
  92. package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
  93. package/dist/gen/triggers/v1/triggers_pb.js +126 -26
  94. package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
  95. package/dist/gen/vip/v1/vip_pb.d.ts +1 -1
  96. package/dist/index.d.ts +7 -4
  97. package/dist/index.js +1 -1
  98. package/dist/realtime/snapshot-then-stream.js +1 -1
  99. package/dist/server-core.js +3 -3
  100. package/dist/services/accounts/accounts.js +1 -1
  101. package/dist/services/accounts/accounts.schemas.js +1 -1
  102. package/dist/services/address-book/address-book.js +1 -1
  103. package/dist/services/api-keys/api-keys.js +1 -1
  104. package/dist/services/api-keys/api-keys.schemas.js +1 -1
  105. package/dist/services/assistant/assistant-events.schemas.d.ts +63 -45
  106. package/dist/services/assistant/assistant-events.schemas.d.ts.map +1 -1
  107. package/dist/services/assistant/assistant.codecs.d.ts +1 -1
  108. package/dist/services/assistant/assistant.codecs.js +1 -1
  109. package/dist/services/assistant/assistant.codecs.js.map +1 -1
  110. package/dist/services/assistant/assistant.d.ts +18 -3
  111. package/dist/services/assistant/assistant.d.ts.map +1 -1
  112. package/dist/services/assistant/assistant.js +27 -4
  113. package/dist/services/assistant/assistant.js.map +1 -1
  114. package/dist/services/assistant/assistant.schemas.d.ts +14 -2
  115. package/dist/services/assistant/assistant.schemas.d.ts.map +1 -1
  116. package/dist/services/assistant/assistant.schemas.js +16 -2
  117. package/dist/services/assistant/assistant.schemas.js.map +1 -1
  118. package/dist/services/assistant/assistant.types.d.ts +2 -2
  119. package/dist/services/auth/account-signer-auth.js +2 -2
  120. package/dist/services/auth/auth.js +1 -1
  121. package/dist/services/auth/profile/profile.js +2 -2
  122. package/dist/services/auto-withdraw/auto-withdraw.js +1 -1
  123. package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +22 -22
  124. package/dist/services/auto-withdraw/auto-withdraw.schemas.js +1 -1
  125. package/dist/services/balances/balances.js +1 -1
  126. package/dist/services/candles/candles.js +2 -2
  127. package/dist/services/chain-analytics/chain-analytics.js +1 -1
  128. package/dist/services/changelog/changelog.codecs.d.ts +1 -1
  129. package/dist/services/changelog/changelog.codecs.d.ts.map +1 -1
  130. package/dist/services/changelog/changelog.codecs.js +6 -3
  131. package/dist/services/changelog/changelog.codecs.js.map +1 -1
  132. package/dist/services/changelog/changelog.js +1 -1
  133. package/dist/services/changelog/changelog.schemas.d.ts +19 -19
  134. package/dist/services/checkpoints/checkpoints.js +1 -1
  135. package/dist/services/checkpoints/checkpoints.schemas.d.ts +1 -1
  136. package/dist/services/claims/claims.js +1 -1
  137. package/dist/services/claims/claims.schemas.js +1 -1
  138. package/dist/services/deposit/deposit.js +1 -1
  139. package/dist/services/fees/fees.js +1 -1
  140. package/dist/services/guard-signer/guard-signer.js +1 -1
  141. package/dist/services/guard-signer/guard-signer.schemas.js +1 -1
  142. package/dist/services/heatmap/heatmap.js +2 -2
  143. package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
  144. package/dist/services/internal-transfers/internal-transfers.js +1 -1
  145. package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +3 -3
  146. package/dist/services/lifecycle/lifecycle.js +3 -3
  147. package/dist/services/lifecycle/lifecycle.schemas.d.ts +15 -15
  148. package/dist/services/lifecycle/lifecycle.schemas.js +2 -2
  149. package/dist/services/market-data/market-data.js +2 -2
  150. package/dist/services/market-data/market-data.schemas.js +16 -1
  151. package/dist/services/market-data/market-data.schemas.js.map +1 -1
  152. package/dist/services/market-overview/market-overview.js +2 -2
  153. package/dist/services/market-overview/market-overview.schemas.js +1 -1
  154. package/dist/services/notifications/notifications.codecs.d.ts +16 -0
  155. package/dist/services/notifications/notifications.codecs.d.ts.map +1 -0
  156. package/dist/services/notifications/notifications.codecs.js +40 -0
  157. package/dist/services/notifications/notifications.codecs.js.map +1 -0
  158. package/dist/services/notifications/notifications.d.ts +41 -0
  159. package/dist/services/notifications/notifications.d.ts.map +1 -0
  160. package/dist/services/notifications/notifications.js +67 -0
  161. package/dist/services/notifications/notifications.js.map +1 -0
  162. package/dist/services/notifications/notifications.schemas.d.ts +162 -0
  163. package/dist/services/notifications/notifications.schemas.d.ts.map +1 -0
  164. package/dist/services/notifications/notifications.schemas.js +116 -0
  165. package/dist/services/notifications/notifications.schemas.js.map +1 -0
  166. package/dist/services/notifications/notifications.types.d.ts +3 -0
  167. package/dist/services/notifications/service.d.ts +8 -0
  168. package/dist/services/notifications/service.d.ts.map +1 -0
  169. package/dist/services/notifications/service.js +9 -0
  170. package/dist/services/notifications/service.js.map +1 -0
  171. package/dist/services/orderbook/orderbook.js +1 -1
  172. package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
  173. package/dist/services/orders/order-enums.codecs.js +12 -4
  174. package/dist/services/orders/order-enums.codecs.js.map +1 -1
  175. package/dist/services/orders/order-errors.schemas.d.ts +1 -1
  176. package/dist/services/orders/order-errors.schemas.js +1 -1
  177. package/dist/services/orders/orders-batch.schemas.d.ts +2688 -417
  178. package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
  179. package/dist/services/orders/orders-batch.schemas.js +7 -5
  180. package/dist/services/orders/orders-batch.schemas.js.map +1 -1
  181. package/dist/services/orders/orders-input.schemas.d.ts +4827 -1264
  182. package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
  183. package/dist/services/orders/orders-input.schemas.js +105 -33
  184. package/dist/services/orders/orders-input.schemas.js.map +1 -1
  185. package/dist/services/orders/orders-modify.schemas.js +2 -2
  186. package/dist/services/orders/orders-output.schemas.d.ts +44 -26
  187. package/dist/services/orders/orders-output.schemas.d.ts.map +1 -1
  188. package/dist/services/orders/orders-output.schemas.js +9 -1
  189. package/dist/services/orders/orders-output.schemas.js.map +1 -1
  190. package/dist/services/orders/orders-risk.schemas.d.ts +1 -1
  191. package/dist/services/orders/orders-risk.schemas.d.ts.map +1 -1
  192. package/dist/services/orders/orders-risk.schemas.js +4 -4
  193. package/dist/services/orders/orders-risk.schemas.js.map +1 -1
  194. package/dist/services/orders/orders.codecs.js +3 -0
  195. package/dist/services/orders/orders.codecs.js.map +1 -1
  196. package/dist/services/orders/orders.d.ts +3 -1
  197. package/dist/services/orders/orders.d.ts.map +1 -1
  198. package/dist/services/orders/orders.js +7 -14
  199. package/dist/services/orders/orders.js.map +1 -1
  200. package/dist/services/policies/api-key-policies/api-key-policies.js +1 -1
  201. package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -15
  202. package/dist/services/policies/shared.codecs.js +10 -4
  203. package/dist/services/policies/shared.codecs.js.map +1 -1
  204. package/dist/services/policies/shared.d.ts +1 -1
  205. package/dist/services/policies/subaccount-policies/subaccount-policies.js +2 -2
  206. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +3 -3
  207. package/dist/services/price-alerts/price-alerts.codecs.d.ts +1 -1
  208. package/dist/services/price-alerts/price-alerts.codecs.js +3 -3
  209. package/dist/services/price-alerts/price-alerts.codecs.js.map +1 -1
  210. package/dist/services/price-alerts/price-alerts.d.ts +11 -6
  211. package/dist/services/price-alerts/price-alerts.d.ts.map +1 -1
  212. package/dist/services/price-alerts/price-alerts.js +12 -7
  213. package/dist/services/price-alerts/price-alerts.js.map +1 -1
  214. package/dist/services/price-alerts/price-alerts.schemas.d.ts +11 -11
  215. package/dist/services/rate-limits/rate-limits.js +1 -1
  216. package/dist/services/rewards/rewards.js +1 -1
  217. package/dist/services/rewards/rewards.schemas.d.ts +4 -4
  218. package/dist/services/social-verification/social-verification.js +1 -1
  219. package/dist/services/social-verification/social-verification.schemas.js +1 -1
  220. package/dist/services/subaccounts/subaccounts.codecs.js +3 -1
  221. package/dist/services/subaccounts/subaccounts.codecs.js.map +1 -1
  222. package/dist/services/subaccounts/subaccounts.js +3 -3
  223. package/dist/services/subaccounts/subaccounts.schemas.d.ts +7 -7
  224. package/dist/services/system/system.js +1 -1
  225. package/dist/services/trades/trades.js +2 -2
  226. package/dist/services/trades/trades.schemas.d.ts +1 -1
  227. package/dist/services/trading-withdraws/trading-withdraws.js +1 -1
  228. package/dist/services/trading-withdraws/trading-withdraws.schemas.js +1 -1
  229. package/dist/services/trading-withdraws/wallet-message.js +1 -1
  230. package/dist/services/transfers/transfers.js +2 -2
  231. package/dist/services/triggers/trigger-child-order.schemas.js +3 -3
  232. package/dist/services/triggers/trigger-input.schemas.d.ts +272 -42
  233. package/dist/services/triggers/trigger-input.schemas.d.ts.map +1 -1
  234. package/dist/services/triggers/trigger-input.schemas.js +53 -5
  235. package/dist/services/triggers/trigger-input.schemas.js.map +1 -1
  236. package/dist/services/triggers/triggers-output.schemas.d.ts +240 -29
  237. package/dist/services/triggers/triggers-output.schemas.d.ts.map +1 -1
  238. package/dist/services/triggers/triggers-output.schemas.js +49 -2
  239. package/dist/services/triggers/triggers-output.schemas.js.map +1 -1
  240. package/dist/services/triggers/triggers.codecs.js +7 -2
  241. package/dist/services/triggers/triggers.codecs.js.map +1 -1
  242. package/dist/services/triggers/triggers.d.ts +25 -3
  243. package/dist/services/triggers/triggers.d.ts.map +1 -1
  244. package/dist/services/triggers/triggers.js +51 -5
  245. package/dist/services/triggers/triggers.js.map +1 -1
  246. package/dist/services/triggers/triggers.schemas.d.ts +3 -3
  247. package/dist/services/triggers/triggers.types.d.ts +3 -3
  248. package/dist/services/vip/vip.js +1 -1
  249. package/dist/services/vip/vip.schemas.js +1 -1
  250. package/dist/services/zipper/zipper.js +1 -1
  251. package/dist/services/zipper/zipper.schemas.js +1 -1
  252. package/dist/shared/catalog-config.d.ts +6 -0
  253. package/dist/shared/catalog-config.d.ts.map +1 -1
  254. package/dist/shared/catalog-config.js.map +1 -1
  255. package/dist/shared/error-detail.d.ts +6 -2
  256. package/dist/shared/error-detail.d.ts.map +1 -1
  257. package/dist/shared/error-detail.js +1 -0
  258. package/dist/shared/error-detail.js.map +1 -1
  259. package/dist/shared/error-details/alerts.js +1 -1
  260. package/dist/shared/error-details/assistant.js +1 -1
  261. package/dist/shared/error-details/auth.js +1 -1
  262. package/dist/shared/error-details/claims.js +1 -1
  263. package/dist/shared/error-details/internal-transfer.js +1 -1
  264. package/dist/shared/error-details/ledger.js +1 -1
  265. package/dist/shared/error-details/market-overview.js +1 -1
  266. package/dist/shared/error-details/notifications.js +15 -0
  267. package/dist/shared/error-details/notifications.js.map +1 -0
  268. package/dist/shared/error-details/orders.js +1 -1
  269. package/dist/shared/error-details/profile.js +1 -1
  270. package/dist/shared/error-details/rate-limit.js +1 -1
  271. package/dist/shared/error-details/withdraw.js +1 -1
  272. package/dist/shared/rate-limit.schemas.js +1 -1
  273. package/dist/shared/request-id.d.ts +6 -0
  274. package/dist/shared/request-id.d.ts.map +1 -0
  275. package/dist/shared/request-id.js +17 -0
  276. package/dist/shared/request-id.js.map +1 -0
  277. package/dist/utils/cookies.js +1 -1
  278. package/dist/wired-services.d.ts.map +1 -1
  279. package/dist/wired-services.js +19 -17
  280. package/dist/wired-services.js.map +1 -1
  281. package/package.json +1 -1
@@ -3,7 +3,7 @@ import { PolyesterRequestOptions } from "../../shared/request-options.js";
3
3
  import { SdkScales } from "../../shared/decimal-surface.js";
4
4
  import { AssistantRunEvent } from "./assistant-events.schemas.js";
5
5
  import { AssistantApprovalStatus } from "./assistant.codecs.js";
6
- import { AssistantKey, AssistantRunIdInput, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, SendAssistantMessageInput, WatchAssistantRunInput } from "./assistant.schemas.js";
6
+ import { AssistantKey, AssistantRunIdInput, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, SendAssistantMessageInput, SetTelegramApprovalLimitsInput, TelegramApprovalLimits, WatchAssistantRunInput } from "./assistant.schemas.js";
7
7
  //#region src/services/assistant/assistant.d.ts
8
8
  /**
9
9
  * The Polyester trading assistant. `sendMessage` starts a run that answers the message;
@@ -32,8 +32,8 @@ declare class AssistantService {
32
32
  */
33
33
  watchRun(input: WatchAssistantRunInput, options?: PolyesterRequestOptions): AsyncGenerator<AssistantRunEvent, void, undefined>;
34
34
  /**
35
- * Asks an active run to stop; it then ends with `run_failed` category `cancelled`.
36
- * Cancelling an ended run succeeds and changes nothing.
35
+ * Asks an active run to stop; it then ends with `run_failed` category `canceled`.
36
+ * Canceling an ended run succeeds and changes nothing.
37
37
  */
38
38
  cancelRun(input: AssistantRunIdInput, options?: PolyesterRequestOptions): Promise<void>;
39
39
  /**
@@ -70,6 +70,21 @@ declare class AssistantService {
70
70
  * no account tools. Revoke them with `apiKeys.deleteAssistantKeys`.
71
71
  */
72
72
  listKeys(options?: PolyesterRequestOptions): Promise<AssistantKey[]>;
73
+ /**
74
+ * Returns the caller's limits on what they may approve from Telegram, in US dollars of
75
+ * notional value, and the value approved from Telegram in the last 24 hours while a limit
76
+ * was set. Limits apply to placing, swapping, modifying and resuming; canceling, pausing
77
+ * and rejecting are never limited.
78
+ */
79
+ getTelegramApprovalLimits(options?: PolyesterRequestOptions): Promise<TelegramApprovalLimits & {
80
+ approvedLast24hUsd: string;
81
+ }>;
82
+ /**
83
+ * Replaces both Telegram approval limits: a limit left out is turned off. Only a signed-in
84
+ * session sets them; they apply to the next approval from Telegram. Returns the limits as
85
+ * recorded.
86
+ */
87
+ setTelegramApprovalLimits(input: SetTelegramApprovalLimitsInput, options?: PolyesterRequestOptions): Promise<TelegramApprovalLimits>;
73
88
  }
74
89
  //#endregion
75
90
  export { AssistantService };
@@ -1 +1 @@
1
- {"version":3,"file":"assistant.d.ts","names":[],"sources":["../../../src/services/assistant/assistant.ts"],"mappings":";;;;;;;;;;;;;;cAsDa;;EAIG,YAAA,YAAY,mBAAmB,QAAQ;;;;;;EAU7C,YACF,OAAO,2BACP,UAAU,0BACX;IAAU;IAAe;;;;;;;;EAkBrB,SACH,OAAO,wBACP,UAAU,0BACX,eAAe;;;;;EAeZ,UAAU,OAAO,qBAAqB,UAAU,0BAA0B;;;;;;EAU1E,eACF,OAAO,8BACP,UAAU,0BACX,QAAQ;;EAOL,kBACF,QAAO,iCACP,UAAU,0BACX,QAAQ;;EAaL,aACF,OAAO,4BACP,UAAU,0BACX,QAAQ;;;;;EAgBL,aACF,QAAO,4BACP,UAAU,0BACX,QAAQ;;EAaL,aACF,OAAO,4BACP,UAAU,0BACX;;;;;;;EAWG,YACF,OAAO,2BACP,UAAU,0BACX,QAAQ;;;;;EAaL,aACF,OAAO,4BACP,UAAU,0BACX,QAAQ;;;;;EAaL,SAAS,UAAU,0BAA0B,QAAQ"}
1
+ {"version":3,"file":"assistant.d.ts","names":[],"sources":["../../../src/services/assistant/assistant.ts"],"mappings":";;;;;;;;;;;;;;cA0Da;;EAIG,YAAA,YAAY,mBAAmB,QAAQ;;;;;;EAU7C,YACF,OAAO,2BACP,UAAU,0BACX;IAAU;IAAe;;;;;;;;EAkBrB,SACH,OAAO,wBACP,UAAU,0BACX,eAAe;;;;;EAeZ,UAAU,OAAO,qBAAqB,UAAU,0BAA0B;;;;;;EAU1E,eACF,OAAO,8BACP,UAAU,0BACX,QAAQ;;EAOL,kBACF,QAAO,iCACP,UAAU,0BACX,QAAQ;;EAaL,aACF,OAAO,4BACP,UAAU,0BACX,QAAQ;;;;;EAgBL,aACF,QAAO,4BACP,UAAU,0BACX,QAAQ;;EAaL,aACF,OAAO,4BACP,UAAU,0BACX;;;;;;;EAWG,YACF,OAAO,2BACP,UAAU,0BACX,QAAQ;;;;;EAaL,aACF,OAAO,4BACP,UAAU,0BACX,QAAQ;;;;;EAaL,SAAS,UAAU,0BAA0B,QAAQ;;;;;;;EAWrD,0BACF,UAAU,0BACX,QAAQ;IAA2B;;;;;;;EAgBhC,0BACF,OAAO,gCACP,UAAU,0BACX,QAAQ"}
@@ -1,12 +1,12 @@
1
+ import { AssistantService as AssistantService$1 } from "../../gen/ai/v1/assistant_pb.js";
1
2
  import { parse } from "../../shared/validation.js";
2
3
  import { removeUndefined } from "../../utils/remove-undefined.js";
3
4
  import { toConnectCallOptions } from "../../shared/request-options.js";
4
5
  import { formatId } from "../../utils/base58-id.js";
5
6
  import { enumLabel } from "../../shared/proto-enum-codec.js";
6
- import { AssistantService as AssistantService$1 } from "../../gen/ai/v1/assistant_pb.js";
7
7
  import { ApprovalStatusCodec } from "./assistant.codecs.js";
8
8
  import { formatRunEvent } from "./assistant-events.schemas.js";
9
- import { AssistantRunIdInputSchema, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInputSchema, ListAssistantMemoriesInputSchema, ListAssistantMessagesInputSchema, PrepareAssistantKeysInputSchema, SendAssistantMessageInputSchema, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult } from "./assistant.schemas.js";
9
+ import { AssistantRunIdInputSchema, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInputSchema, ListAssistantMemoriesInputSchema, ListAssistantMessagesInputSchema, PrepareAssistantKeysInputSchema, SendAssistantMessageInputSchema, SetTelegramApprovalLimitsInputSchema, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult, formatTelegramApprovalLimits } from "./assistant.schemas.js";
10
10
  import { createClient } from "@connectrpc/connect";
11
11
  //#region src/services/assistant/assistant.ts
12
12
  /**
@@ -48,8 +48,8 @@ var AssistantService = class {
48
48
  for await (const response of this.#client.watchRun(request, toConnectCallOptions(options))) if (response.event) yield formatRunEvent(response.event, this.#scales);
49
49
  }
50
50
  /**
51
- * Asks an active run to stop; it then ends with `run_failed` category `cancelled`.
52
- * Cancelling an ended run succeeds and changes nothing.
51
+ * Asks an active run to stop; it then ends with `run_failed` category `canceled`.
52
+ * Canceling an ended run succeeds and changes nothing.
53
53
  */
54
54
  async cancelRun(input, options) {
55
55
  const request = parse(AssistantRunIdInputSchema, input);
@@ -126,6 +126,29 @@ var AssistantService = class {
126
126
  async listKeys(options) {
127
127
  return (await this.#client.listAssistantKeys({}, toConnectCallOptions(options))).keys.map(formatAssistantKey);
128
128
  }
129
+ /**
130
+ * Returns the caller's limits on what they may approve from Telegram, in US dollars of
131
+ * notional value, and the value approved from Telegram in the last 24 hours while a limit
132
+ * was set. Limits apply to placing, swapping, modifying and resuming; canceling, pausing
133
+ * and rejecting are never limited.
134
+ */
135
+ async getTelegramApprovalLimits(options) {
136
+ const response = await this.#client.getTelegramApprovalLimits({}, toConnectCallOptions(options));
137
+ return {
138
+ ...formatTelegramApprovalLimits(response.limits),
139
+ approvedLast24hUsd: response.approvedLast24hUsd
140
+ };
141
+ }
142
+ /**
143
+ * Replaces both Telegram approval limits: a limit left out is turned off. Only a signed-in
144
+ * session sets them; they apply to the next approval from Telegram. Returns the limits as
145
+ * recorded.
146
+ */
147
+ async setTelegramApprovalLimits(input, options) {
148
+ const limits = parse(SetTelegramApprovalLimitsInputSchema, input);
149
+ const response = await this.#client.setTelegramApprovalLimits({ limits: removeUndefined(limits) }, toConnectCallOptions(options));
150
+ return formatTelegramApprovalLimits(response.limits);
151
+ }
129
152
  };
130
153
  //#endregion
131
154
  export { AssistantService };
@@ -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 ListAssistantConversationsInputSchema,\n ListAssistantMemoriesInputSchema,\n ListAssistantMessagesInputSchema,\n PrepareAssistantKeysInputSchema,\n SendAssistantMessageInputSchema,\n WatchAssistantRunInputSchema,\n type AssistantKey,\n type AssistantRunIdInput,\n type CompleteAssistantKeysInput,\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 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 `cancelled`.\n * Cancelling 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. Revoke them with `apiKeys.deleteAssistantKeys`.\n */\n async listKeys(options?: PolyesterRequestOptions): Promise<AssistantKey[]> {\n const response = await this.#client.listAssistantKeys({}, toConnectCallOptions(options));\n return response.keys.map(formatAssistantKey);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsDA,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,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b,MAAM,UAAU,MAAM,kCAAkC,KAAK;EAC7D,MAAM,KAAKA,QAAQ,aAAa,SAAS,qBAAqB,OAAO,CAAC;CAC1E;;;;;;;CAQA,MAAM,YACF,OACA,SACmC;EACnC,MAAM,UAAU,MAAM,iCAAiC,KAAK;EAC5D,MAAM,WAAW,MAAM,KAAKA,QAAQ,qBAChC,EAAE,UAAU,QAAQ,SAAS,KAAK,YAAY,gBAAgB,OAAO,CAAC,EAAE,GACxE,qBAAqB,OAAO,CAChC;EACA,OAAO,iCAAiC,QAAQ;CACpD;;;;;CAMA,MAAM,aACF,OACA,SACuB;EACvB,MAAM,UAAU,MAAM,kCAAkC,KAAK;EAK7D,QAAO,MAJgB,KAAKA,QAAQ,sBAChC,SACA,qBAAqB,OAAO,CAChC,EAAA,CACgB,KAAK,IAAI,kBAAkB;CAC/C;;;;;CAMA,MAAM,SAAS,SAA4D;EAEvE,QAAO,MADgB,KAAKA,QAAQ,kBAAkB,CAAC,GAAG,qBAAqB,OAAO,CAAC,EAAA,CACvE,KAAK,IAAI,kBAAkB;CAC/C;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 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 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. Revoke them with `apiKeys.deleteAssistantKeys`.\n */\n async listKeys(options?: PolyesterRequestOptions): Promise<AssistantKey[]> {\n const response = await this.#client.listAssistantKeys({}, toConnectCallOptions(options));\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":";;;;;;;;;;;;;;;;;;AA0DA,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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,MAAM,WAAW,MAAM,KAAKA,QAAQ,0BAChC,EAAE,QAAQ,gBAAgB,MAAM,EAAE,GAClC,qBAAqB,OAAO,CAChC;EACA,OAAO,6BAA6B,SAAS,MAAM;CACvD;AACJ"}
@@ -126,7 +126,7 @@ declare function formatMemory(m: Memory): {
126
126
  createdAt: number | undefined;
127
127
  /** Omitted when the conversation it was learned in is unknown. */
128
128
  conversationId: string | undefined;
129
- kind: "unspecified" | "fact" | "planning_figure" | "profile";
129
+ kind: "unspecified" | "profile" | "fact" | "planning_figure";
130
130
  };
131
131
  type AssistantMemory = ReturnType<typeof formatMemory>;
132
132
  declare function formatAssistantKey(k: AssistantKey$1): {
@@ -179,6 +179,18 @@ type ListAssistantMemoriesResult = {
179
179
  memories: AssistantMemory[];
180
180
  nextPageToken: string;
181
181
  };
182
+ declare const SetTelegramApprovalLimitsInputSchema: v.StrictObjectSchema<{
183
+ /** Largest notional value of one approval from Telegram. `"0"` allows none; omit for no limit. */
184
+ readonly perApprovalUsd: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.RegexAction<string, "limit must be US dollars with at most 2 decimal places">]>, undefined>;
185
+ /** Largest total notional value approved from Telegram in any rolling 24 hours; omit for no limit. */
186
+ readonly dailyUsd: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.RegexAction<string, "limit must be US dollars with at most 2 decimal places">]>, undefined>;
187
+ }, undefined>;
188
+ type SetTelegramApprovalLimitsInput = v.InferInput<typeof SetTelegramApprovalLimitsInputSchema>;
189
+ /** Limits on what the caller may approve from Telegram, in US dollars; `null` is no limit. */
190
+ type TelegramApprovalLimits = {
191
+ perApprovalUsd: string | null;
192
+ dailyUsd: string | null;
193
+ };
182
194
  //#endregion
183
- export { AssistantConversation, AssistantKey, AssistantMemory, AssistantMessage, AssistantRunIdInput, AssistantRunIdInputSchema, CompleteAssistantKeysInput, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInput, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInput, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInput, ListAssistantConversationsInputSchema, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesInputSchema, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesInputSchema, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysInputSchema, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SendAssistantMessageInputSchema, WatchAssistantRunInput, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult, formatPreparedAssistantKey };
195
+ export { AssistantConversation, AssistantKey, AssistantMemory, AssistantMessage, AssistantRunIdInput, AssistantRunIdInputSchema, CompleteAssistantKeysInput, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInput, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInput, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInput, ListAssistantConversationsInputSchema, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesInputSchema, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesInputSchema, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysInputSchema, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SendAssistantMessageInputSchema, SetTelegramApprovalLimitsInput, SetTelegramApprovalLimitsInputSchema, TelegramApprovalLimits, WatchAssistantRunInput, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult, formatPreparedAssistantKey };
184
196
  //# 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":";;;cAsCa,iCAA+B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BhC,4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E,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;iBAEjC,aAAa,GAAG;;;;;;;;KAWpB,kBAAkB,kBAAkB;iBAEhC,mBAAmB,GAAG;;;;;;;;KAW1B,eAAe,kBAAkB;iBAE7B,2BAA2B,GAAG;;;;;;;;;;KAalC,uBAAuB,kBAAkB;iBAErC,iCAAiC,GAAG;;;;;;;;;;;;;;;;KAUxC,6BAA6B,kBAAkB;;KAG/C;EACR,eAAe;EACf;;KAEQ;EAAgC,UAAU;EAAoB;;KAC9D;EAAgC,UAAU;EAAmB;;cAS5D,sCAAoC,EAAA;;;;;;KAOrC,iCAAiC,EAAE,kBACpC;;KAIC;EACR;EACA"}
@@ -3,8 +3,8 @@ 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
5
  import { ASSISTANT_APPROVAL_DECISION_VALUES, ApprovalDecisionCodec, AssistantKeyStateCodec, MemoryKindCodec, MessageRoleCodec } from "./assistant.codecs.js";
6
- import { bytesToHex } from "@noble/hashes/utils.js";
7
6
  import * as v from "valibot";
7
+ import { bytesToHex } from "@noble/hashes/utils.js";
8
8
  //#region src/services/assistant/assistant.schemas.ts
9
9
  const IdempotencyKeySchema = v.pipe(v.string(), v.trim(), v.minLength(1));
10
10
  function pageInputEntries(maxLimit) {
@@ -129,7 +129,21 @@ function formatPrepareAssistantKeysResult(r) {
129
129
  expiresAt: tsObjToMs(r.expiresAt)
130
130
  };
131
131
  }
132
+ /** US dollars as a decimal string with at most 2 decimal places, e.g. `"5000"` or `"250.50"`. */
133
+ 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"));
134
+ const SetTelegramApprovalLimitsInputSchema = v.strictObject({
135
+ /** Largest notional value of one approval from Telegram. `"0"` allows none; omit for no limit. */
136
+ perApprovalUsd: v.optional(UsdLimitInputSchema),
137
+ /** Largest total notional value approved from Telegram in any rolling 24 hours; omit for no limit. */
138
+ dailyUsd: v.optional(UsdLimitInputSchema)
139
+ });
140
+ function formatTelegramApprovalLimits(limits) {
141
+ return {
142
+ perApprovalUsd: limits?.perApprovalUsd ?? null,
143
+ dailyUsd: limits?.dailyUsd ?? null
144
+ };
145
+ }
132
146
  //#endregion
133
- export { AssistantRunIdInputSchema, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInputSchema, ListAssistantMemoriesInputSchema, ListAssistantMessagesInputSchema, PrepareAssistantKeysInputSchema, SendAssistantMessageInputSchema, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult, formatPreparedAssistantKey };
147
+ export { AssistantRunIdInputSchema, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInputSchema, ListAssistantMemoriesInputSchema, ListAssistantMessagesInputSchema, PrepareAssistantKeysInputSchema, SendAssistantMessageInputSchema, SetTelegramApprovalLimitsInputSchema, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult, formatPreparedAssistantKey, formatTelegramApprovalLimits };
134
148
 
135
149
  //# 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_APPROVAL_DECISION_VALUES,\n ApprovalDecisionCodec,\n AssistantKeyStateCodec,\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\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 to answer without account data: the\n * run then has no account tools.\n */\n subaccountId: optionalSubaccountIdInputSchema(),\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);\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}\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"],"mappings":";;;;;;;;AAeA,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;AAED,MAAa,kCAAkC,EAAE,KAC7C,EAAE,aAAa;;CAEX,gBAAgB,EAAE,SAAS,cAAc,gBAAgB,CAAC;;CAE1D,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,IAAM,CAAC;;CAE5D,gBAAgB;;;;;CAKhB,cAAc,gCAAgC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,WAAW,EAAE,gBAAgB;;EAE3C,mBAAmB,EAAE;;EAErB,sBAAsB,UAAU,EAAE,oBAAoB;CAC1D;AACJ;AAIA,SAAgB,iCAAiC,GAAuC;CACpF,OAAO;EACH,SAAS,SAAS,EAAE,OAAO;;EAE3B,MAAM,EAAE,KAAK,IAAI,0BAA0B;;EAE3C,WAAW,UAAU,EAAE,SAAS;CACpC;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_APPROVAL_DECISION_VALUES,\n ApprovalDecisionCodec,\n AssistantKeyStateCodec,\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\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 to answer without account data: the\n * run then has no account tools.\n */\n subaccountId: optionalSubaccountIdInputSchema(),\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);\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}\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":";;;;;;;;AAeA,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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AgB,QAAQ,kBAAkB;EAC1C,UAAU,QAAQ,YAAY;CAClC;AACJ"}
@@ -1,4 +1,4 @@
1
1
  import { AssistantApprovalPreview, AssistantOrderPreview, AssistantRunEvent, AssistantView } from "./assistant-events.schemas.js";
2
2
  import { AssistantApprovalDecision, AssistantApprovalStatus, AssistantFailureCategory, AssistantKeyState, 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, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, WatchAssistantRunInput } from "./assistant.schemas.js";
4
- export type { AssistantApprovalDecision, AssistantApprovalPreview, AssistantApprovalStatus, AssistantConversation, AssistantFailureCategory, AssistantKey, AssistantKeyState, AssistantMemory, AssistantMemoryKind, AssistantMessage, AssistantMessageRole, AssistantOrderPreview, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantRunEvent, AssistantRunIdInput, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy, AssistantView, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, WatchAssistantRunInput };
3
+ import { AssistantConversation, AssistantKey, AssistantMemory, AssistantMessage, AssistantRunIdInput, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SetTelegramApprovalLimitsInput, TelegramApprovalLimits, WatchAssistantRunInput } from "./assistant.schemas.js";
4
+ export type { AssistantApprovalDecision, AssistantApprovalPreview, AssistantApprovalStatus, AssistantConversation, AssistantFailureCategory, AssistantKey, AssistantKeyState, AssistantMemory, AssistantMemoryKind, AssistantMessage, AssistantMessageRole, AssistantOrderPreview, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantRunEvent, AssistantRunIdInput, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy, AssistantView, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SetTelegramApprovalLimitsInput, TelegramApprovalLimits, WatchAssistantRunInput };
@@ -1,10 +1,10 @@
1
+ import { AuthSessionStore } from "./session.js";
2
+ import { getJwtTimeToExpiry, isJwtValid } from "../../utils/jwt.js";
1
3
  import { AuthenticationError, ConfigurationError } from "../../shared/errors.js";
2
4
  import { toPolyesterError } from "../../shared/connect-error-mapping.js";
3
5
  import { AuthService } from "./auth.js";
4
- import { AuthSessionStore } from "./session.js";
5
6
  import { assertAccountSigner, resolveAccountSigner } from "../../account-signer/types.js";
6
7
  import { EventEmitter } from "../../utils/event-emitter.js";
7
- import { getJwtTimeToExpiry, isJwtValid } from "../../utils/jwt.js";
8
8
  import { createAuthTokenStorageSetOptions } from "./token-storage.js";
9
9
  //#region src/services/auth/account-signer-auth.ts
10
10
  /**
@@ -5,8 +5,8 @@ import { OptionalTimestampMsSchema, PublicIdSchema, TimestampSchema } from "../.
5
5
  import { ProfileService } from "./profile/profile.js";
6
6
  import { MfaSessionInfoSchema } from "../mfa/mfa.schemas.js";
7
7
  import { WalletAddressSchema, WalletChallengeMessageSchema, WalletChallengeUriSchema } from "./wallet-challenge.schemas.js";
8
- import { createClient } from "@connectrpc/connect";
9
8
  import * as v from "valibot";
9
+ import { createClient } from "@connectrpc/connect";
10
10
  //#region src/services/auth/auth.ts
11
11
  const CreateWalletChallengeInputSchema = v.strictObject({
12
12
  smartAccountAddress: WalletAddressSchema,
@@ -1,10 +1,10 @@
1
- import { parse } from "../../../shared/validation.js";
2
1
  import { AccountIdentitySchema, ProfileService as ProfileService$1 } from "../../../gen/auth/v1/profile_pb.js";
2
+ import { parse } from "../../../shared/validation.js";
3
3
  import { removeUndefined } from "../../../utils/remove-undefined.js";
4
4
  import { toConnectCallOptions } from "../../../shared/request-options.js";
5
5
  import { AccountIdentitySchema as AccountIdentitySchema$1, ClaimGeneratedUsernameInputSchema, GeneratedUsernameOfferSchema, ProfileSchema, UpdateProfileInputSchema, UsernameHistoryEntrySchema } from "./profile.schemas.js";
6
- import { createClient } from "@connectrpc/connect";
7
6
  import * as v from "valibot";
7
+ import { createClient } from "@connectrpc/connect";
8
8
  //#region src/services/auth/profile/profile.ts
9
9
  /**
10
10
  * Manages the authenticated account's public profile and realtime identity updates.
@@ -1,10 +1,10 @@
1
+ import { AutoWithdrawService as AutoWithdrawService$1 } from "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
1
2
  import { PolyesterError, RevisionConflictError } from "../../shared/errors.js";
2
3
  import { toPolyesterError } from "../../shared/connect-error-mapping.js";
3
4
  import { parse } from "../../shared/validation.js";
4
5
  import { removeUndefined } from "../../utils/remove-undefined.js";
5
6
  import { toConnectCallOptions } from "../../shared/request-options.js";
6
7
  import { resolveAccountScopedInput } from "../subaccount-resolver.js";
7
- import { AutoWithdrawService as AutoWithdrawService$1 } from "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
8
8
  import { AutoWithdrawPreviewSchema, AutoWithdrawRuleSchema, AutoWithdrawScopedInputSchema, ListAutoWithdrawRunsInputSchema, ListAutoWithdrawRunsResultSchema, SetAutoWithdrawRuleEnabledInputSchema, SetAutoWithdrawRuleInputSchema } from "./auto-withdraw.schemas.js";
9
9
  import { Code, ConnectError, createClient } from "@connectrpc/connect";
10
10
  //#region src/services/auto-withdraw/auto-withdraw.ts
@@ -500,7 +500,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
500
500
  readonly hi: v.BigintSchema<undefined>;
501
501
  readonly lo: v.BigintSchema<undefined>;
502
502
  }, undefined>, undefined>;
503
- readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted">]>;
503
+ readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted">]>;
504
504
  readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
505
505
  readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
506
506
  readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
@@ -524,7 +524,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
524
524
  hi: bigint;
525
525
  lo: bigint;
526
526
  } | undefined;
527
- state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
527
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
528
528
  reason: AutoWithdrawStepReason | null;
529
529
  intentId: string;
530
530
  txHash: string;
@@ -538,7 +538,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
538
538
  txHash: string | null;
539
539
  assetId: number;
540
540
  destinationAddress: string;
541
- state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
541
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
542
542
  reason: AutoWithdrawStepReason | null;
543
543
  }>]>;
544
544
  /**
@@ -559,7 +559,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
559
559
  seconds: bigint;
560
560
  nanos: number;
561
561
  }, number>]>;
562
- readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "planned" | "paying" | "partially_failed" | "skipped">]>;
562
+ readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "planned" | "paying" | "completed" | "partially_failed" | "failed" | "skipped">]>;
563
563
  readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawRunReason | null>]>;
564
564
  readonly steps: v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
565
565
  readonly assetId: v.NumberSchema<undefined>;
@@ -581,7 +581,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
581
581
  readonly hi: v.BigintSchema<undefined>;
582
582
  readonly lo: v.BigintSchema<undefined>;
583
583
  }, undefined>, undefined>;
584
- readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted">]>;
584
+ readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted">]>;
585
585
  readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
586
586
  readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
587
587
  readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
@@ -605,7 +605,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
605
605
  hi: bigint;
606
606
  lo: bigint;
607
607
  } | undefined;
608
- state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
608
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
609
609
  reason: AutoWithdrawStepReason | null;
610
610
  intentId: string;
611
611
  txHash: string;
@@ -619,7 +619,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
619
619
  txHash: string | null;
620
620
  assetId: number;
621
621
  destinationAddress: string;
622
- state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
622
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
623
623
  reason: AutoWithdrawStepReason | null;
624
624
  }>]>, undefined>;
625
625
  readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
@@ -640,7 +640,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
640
640
  runSeq: string;
641
641
  ruleVersion: number;
642
642
  scheduledFor: number;
643
- state: "unspecified" | "failed" | "completed" | "planned" | "paying" | "partially_failed" | "skipped";
643
+ state: "unspecified" | "planned" | "paying" | "completed" | "partially_failed" | "failed" | "skipped";
644
644
  reason: AutoWithdrawRunReason | null;
645
645
  steps: {
646
646
  destinationChainId: number;
@@ -652,7 +652,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
652
652
  txHash: string | null;
653
653
  assetId: number;
654
654
  destinationAddress: string;
655
- state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
655
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
656
656
  reason: AutoWithdrawStepReason | null;
657
657
  }[];
658
658
  createdAt: number;
@@ -662,7 +662,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
662
662
  runSeq: string;
663
663
  ruleVersion: number;
664
664
  scheduledFor: number;
665
- state: "unspecified" | "failed" | "completed" | "planned" | "paying" | "partially_failed" | "skipped";
665
+ state: "unspecified" | "planned" | "paying" | "completed" | "partially_failed" | "failed" | "skipped";
666
666
  reason: AutoWithdrawRunReason | null;
667
667
  steps: {
668
668
  destinationChainId: number;
@@ -674,7 +674,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
674
674
  txHash: string | null;
675
675
  assetId: number;
676
676
  destinationAddress: string;
677
- state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
677
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
678
678
  reason: AutoWithdrawStepReason | null;
679
679
  }[];
680
680
  createdAt: number;
@@ -692,7 +692,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
692
692
  seconds: bigint;
693
693
  nanos: number;
694
694
  }, number>]>;
695
- readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "planned" | "paying" | "partially_failed" | "skipped">]>;
695
+ readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "planned" | "paying" | "completed" | "partially_failed" | "failed" | "skipped">]>;
696
696
  readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawRunReason | null>]>;
697
697
  readonly steps: v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
698
698
  readonly assetId: v.NumberSchema<undefined>;
@@ -714,7 +714,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
714
714
  readonly hi: v.BigintSchema<undefined>;
715
715
  readonly lo: v.BigintSchema<undefined>;
716
716
  }, undefined>, undefined>;
717
- readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted">]>;
717
+ readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted">]>;
718
718
  readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
719
719
  readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
720
720
  readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
@@ -738,7 +738,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
738
738
  hi: bigint;
739
739
  lo: bigint;
740
740
  } | undefined;
741
- state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
741
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
742
742
  reason: AutoWithdrawStepReason | null;
743
743
  intentId: string;
744
744
  txHash: string;
@@ -752,7 +752,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
752
752
  txHash: string | null;
753
753
  assetId: number;
754
754
  destinationAddress: string;
755
- state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
755
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
756
756
  reason: AutoWithdrawStepReason | null;
757
757
  }>]>, undefined>;
758
758
  readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
@@ -773,7 +773,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
773
773
  runSeq: string;
774
774
  ruleVersion: number;
775
775
  scheduledFor: number;
776
- state: "unspecified" | "failed" | "completed" | "planned" | "paying" | "partially_failed" | "skipped";
776
+ state: "unspecified" | "planned" | "paying" | "completed" | "partially_failed" | "failed" | "skipped";
777
777
  reason: AutoWithdrawRunReason | null;
778
778
  steps: {
779
779
  destinationChainId: number;
@@ -785,7 +785,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
785
785
  txHash: string | null;
786
786
  assetId: number;
787
787
  destinationAddress: string;
788
- state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
788
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
789
789
  reason: AutoWithdrawStepReason | null;
790
790
  }[];
791
791
  createdAt: number;
@@ -795,7 +795,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
795
795
  runSeq: string;
796
796
  ruleVersion: number;
797
797
  scheduledFor: number;
798
- state: "unspecified" | "failed" | "completed" | "planned" | "paying" | "partially_failed" | "skipped";
798
+ state: "unspecified" | "planned" | "paying" | "completed" | "partially_failed" | "failed" | "skipped";
799
799
  reason: AutoWithdrawRunReason | null;
800
800
  steps: {
801
801
  destinationChainId: number;
@@ -807,7 +807,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
807
807
  txHash: string | null;
808
808
  assetId: number;
809
809
  destinationAddress: string;
810
- state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
810
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
811
811
  reason: AutoWithdrawStepReason | null;
812
812
  }[];
813
813
  createdAt: number;
@@ -923,7 +923,7 @@ declare const AutoWithdrawPreviewAssetSchema: v.SchemaWithPipe<readonly [v.Objec
923
923
  */
924
924
  type AutoWithdrawPreviewAsset = v.InferOutput<typeof AutoWithdrawPreviewAssetSchema>;
925
925
  declare const AutoWithdrawPreviewSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
926
- readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "paused" | "will_pay" | "rolls_over" | "no_destination" | "no_rule">]>;
926
+ readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "will_pay" | "rolls_over" | "no_destination" | "paused" | "no_rule">]>;
927
927
  readonly nextRunAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
928
928
  readonly seconds: v.BigintSchema<undefined>;
929
929
  readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
@@ -1052,7 +1052,7 @@ declare const AutoWithdrawPreviewSchema: v.SchemaWithPipe<readonly [v.ObjectSche
1052
1052
  nanos: number;
1053
1053
  }, number>]>;
1054
1054
  }, undefined>, v.TransformAction<{
1055
- status: "unspecified" | "paused" | "will_pay" | "rolls_over" | "no_destination" | "no_rule";
1055
+ status: "unspecified" | "will_pay" | "rolls_over" | "no_destination" | "paused" | "no_rule";
1056
1056
  nextRunAt?: number | undefined;
1057
1057
  ruleVersion: number;
1058
1058
  pause?: {
@@ -1088,7 +1088,7 @@ declare const AutoWithdrawPreviewSchema: v.SchemaWithPipe<readonly [v.ObjectSche
1088
1088
  pausedAt: number;
1089
1089
  } | null;
1090
1090
  minUsdValue: string | null;
1091
- status: "unspecified" | "paused" | "will_pay" | "rolls_over" | "no_destination" | "no_rule";
1091
+ status: "unspecified" | "will_pay" | "rolls_over" | "no_destination" | "paused" | "no_rule";
1092
1092
  ruleVersion: number;
1093
1093
  assets: {
1094
1094
  assetId: number;
@@ -1,3 +1,4 @@
1
+ import "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
1
2
  import { ValidationError } from "../../shared/errors.js";
2
3
  import { PROTOBUF_UINT32_MAX } from "../../shared/wire-bounds.js";
3
4
  import { BigIntStringSchema, OptionalTimestampMsSchema, PublicIdOrEmptySchema, TimestampMsSchema, U128Schema } from "../../shared/schemas.js";
@@ -6,7 +7,6 @@ import { decimalInputToScaled, scaledToDecimalOutput } from "../../shared/decima
6
7
  import { PositiveUint32InputSchema } from "../shared.js";
7
8
  import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
8
9
  import { fromU128, toU128 } from "../../utils/u128.js";
9
- import "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
10
10
  import { AUTO_WITHDRAW_WEEKDAY_VALUES, AutoWithdrawCadenceCodec, AutoWithdrawPreviewStatusCodec, AutoWithdrawRunStateCodec, AutoWithdrawStepStateCodec, AutoWithdrawWeekdayCodec } from "./auto-withdraw.codecs.js";
11
11
  import * as v from "valibot";
12
12
  //#region src/services/auto-withdraw/auto-withdraw.schemas.ts
@@ -1,6 +1,6 @@
1
+ import { AssetBalanceSchema, LedgerReadService } from "../../gen/ledger/read/v1/ledger_read_pb.js";
1
2
  import { parse } from "../../shared/validation.js";
2
3
  import { toConnectCallOptions } from "../../shared/request-options.js";
3
- import { AssetBalanceSchema, LedgerReadService } from "../../gen/ledger/read/v1/ledger_read_pb.js";
4
4
  import { resolveAccountScopedInput } from "../subaccount-resolver.js";
5
5
  import { accountScopeToSubaccountId } from "../../shared/account-scope.js";
6
6
  import { BalanceHistoryInputSchema, BalancesListInputSchema, EquityHistoryInputSchema, PortfolioEquityHistoryInputSchema, createBalanceHistoryResponseSchema, createEquityHistoryResponseSchema, createPortfolioEquityHistoryResponseSchema, createPortfolioEquitySnapshotResponseSchema, formatLedgerBalance } from "./balances.schemas.js";