@polyester/sdk 0.36.0-devnet-20261119184734 → 0.36.0-devnet-20261120015159

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 (199) hide show
  1. package/CHANGELOG.md +18 -2
  2. package/dist/client.d.ts +2 -0
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +2 -0
  5. package/dist/client.js.map +1 -1
  6. package/dist/gen/ai/v1/assistant_pb.d.ts +55 -3
  7. package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -1
  8. package/dist/gen/ai/v1/assistant_pb.js +8 -1
  9. package/dist/gen/ai/v1/assistant_pb.js.map +1 -1
  10. package/dist/gen/auth/v1/account_scope_pb.d.ts +40 -0
  11. package/dist/gen/auth/v1/account_scope_pb.d.ts.map +1 -0
  12. package/dist/gen/auth/v1/account_scope_pb.js +46 -0
  13. package/dist/gen/auth/v1/account_scope_pb.js.map +1 -0
  14. package/dist/gen/auth/v1/address_book_pb.d.ts +3 -31
  15. package/dist/gen/auth/v1/address_book_pb.d.ts.map +1 -1
  16. package/dist/gen/auth/v1/address_book_pb.js +8 -38
  17. package/dist/gen/auth/v1/address_book_pb.js.map +1 -1
  18. package/dist/gen/auth/v1/auth_pb.d.ts +15 -14
  19. package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
  20. package/dist/gen/auth/v1/auth_pb.js +16 -15
  21. package/dist/gen/auth/v1/auth_pb.js.map +1 -1
  22. package/dist/gen/auth/v1/connected_apps_pb.d.ts +59 -58
  23. package/dist/gen/auth/v1/connected_apps_pb.d.ts.map +1 -1
  24. package/dist/gen/auth/v1/connected_apps_pb.js +38 -37
  25. package/dist/gen/auth/v1/connected_apps_pb.js.map +1 -1
  26. package/dist/gen/auth/v1/policies_pb.d.ts +27 -1
  27. package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
  28. package/dist/gen/auth/v1/policies_pb.js +27 -1
  29. package/dist/gen/auth/v1/policies_pb.js.map +1 -1
  30. package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +228 -2
  31. package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
  32. package/dist/gen/chain/withdraw/v1/withdraw_pb.js +32 -8
  33. package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
  34. package/dist/gen/changelog/v1/changelog_pb.d.ts +16 -4
  35. package/dist/gen/changelog/v1/changelog_pb.d.ts.map +1 -1
  36. package/dist/gen/changelog/v1/changelog_pb.js.map +1 -1
  37. package/dist/gen/index.d.ts +7 -5
  38. package/dist/gen/index.js +7 -5
  39. package/dist/gen/marketdata/v1/marketdata_pb.d.ts +288 -2
  40. package/dist/gen/marketdata/v1/marketdata_pb.d.ts.map +1 -1
  41. package/dist/gen/marketdata/v1/marketdata_pb.js +115 -2
  42. package/dist/gen/marketdata/v1/marketdata_pb.js.map +1 -1
  43. package/dist/gen/orders/v1/orders_pb.d.ts +78 -25
  44. package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
  45. package/dist/gen/orders/v1/orders_pb.js +36 -7
  46. package/dist/gen/orders/v1/orders_pb.js.map +1 -1
  47. package/dist/gen/orders/v1/orders_read_pb.d.ts +35 -1
  48. package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
  49. package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
  50. package/dist/gen/strategies/v1/strategies_pb.d.ts +2928 -0
  51. package/dist/gen/strategies/v1/strategies_pb.d.ts.map +1 -0
  52. package/dist/gen/strategies/v1/strategies_pb.js +818 -0
  53. package/dist/gen/strategies/v1/strategies_pb.js.map +1 -0
  54. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +38 -17
  55. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -1
  56. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +4 -1
  57. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
  58. package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.d.ts +312 -132
  59. package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.d.ts.map +1 -1
  60. package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.js +31 -26
  61. package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.js.map +1 -1
  62. package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +28 -13
  63. package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
  64. package/dist/gen/swap/quickswap/v1/quickswap_pb.js +2 -2
  65. package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
  66. package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts +109 -2
  67. package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts.map +1 -1
  68. package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.js +23 -3
  69. package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.js.map +1 -1
  70. package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +3 -2
  71. package/dist/gen/transfer/v1/internal_transfer_pb.d.ts.map +1 -1
  72. package/dist/gen/transfer/v1/internal_transfer_pb.js.map +1 -1
  73. package/dist/gen/triggers/v1/triggers_pb.d.ts +61 -11
  74. package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
  75. package/dist/gen/triggers/v1/triggers_pb.js +4 -2
  76. package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
  77. package/dist/index.d.ts +9 -6
  78. package/dist/services/account-activity/account-activity.schemas.d.ts +6 -6
  79. package/dist/services/address-book/address-book.codecs.js +1 -0
  80. package/dist/services/address-book/address-book.codecs.js.map +1 -1
  81. package/dist/services/address-book/address-book.js +1 -1
  82. package/dist/services/api-keys/api-keys.js +1 -1
  83. package/dist/services/assistant/assistant-events.schemas.d.ts +141 -43
  84. package/dist/services/assistant/assistant-events.schemas.d.ts.map +1 -1
  85. package/dist/services/assistant/assistant-events.schemas.js +15 -5
  86. package/dist/services/assistant/assistant-events.schemas.js.map +1 -1
  87. package/dist/services/assistant/assistant.codecs.d.ts +5 -2
  88. package/dist/services/assistant/assistant.codecs.d.ts.map +1 -1
  89. package/dist/services/assistant/assistant.codecs.js +10 -2
  90. package/dist/services/assistant/assistant.codecs.js.map +1 -1
  91. package/dist/services/assistant/assistant.schemas.d.ts +2 -2
  92. package/dist/services/auth/auth.js +1 -1
  93. package/dist/services/auth/auth.js.map +1 -1
  94. package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +16 -16
  95. package/dist/services/balances/balances.js +1 -1
  96. package/dist/services/balances/balances.schemas.d.ts +3 -3
  97. package/dist/services/candles/candles.schemas.d.ts +10 -10
  98. package/dist/services/changelog/changelog.schemas.d.ts +38 -38
  99. package/dist/services/checkpoints/checkpoints.schemas.d.ts +1 -1
  100. package/dist/services/claims/claims.schemas.d.ts +2 -2
  101. package/dist/services/connected-apps/connected-apps.d.ts +4 -4
  102. package/dist/services/connected-apps/connected-apps.d.ts.map +1 -1
  103. package/dist/services/connected-apps/connected-apps.js +13 -13
  104. package/dist/services/connected-apps/connected-apps.js.map +1 -1
  105. package/dist/services/connected-apps/connected-apps.schemas.d.ts +7 -7
  106. package/dist/services/connected-apps/connected-apps.schemas.d.ts.map +1 -1
  107. package/dist/services/connected-apps/connected-apps.schemas.js +10 -10
  108. package/dist/services/connected-apps/connected-apps.schemas.js.map +1 -1
  109. package/dist/services/connected-apps/connected-apps.types.d.ts +2 -2
  110. package/dist/services/dust-conversion/dust-conversion.schemas.d.ts +8 -8
  111. package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
  112. package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +6 -6
  113. package/dist/services/lifecycle/lifecycle.schemas.d.ts +94 -94
  114. package/dist/services/market-data/market-data.codecs.d.ts +9 -1
  115. package/dist/services/market-data/market-data.codecs.d.ts.map +1 -1
  116. package/dist/services/market-data/market-data.codecs.js +14 -1
  117. package/dist/services/market-data/market-data.codecs.js.map +1 -1
  118. package/dist/services/market-data/market-data.d.ts +9 -1
  119. package/dist/services/market-data/market-data.d.ts.map +1 -1
  120. package/dist/services/market-data/market-data.js +14 -1
  121. package/dist/services/market-data/market-data.js.map +1 -1
  122. package/dist/services/market-data/market-data.schemas.d.ts +40 -2
  123. package/dist/services/market-data/market-data.schemas.d.ts.map +1 -1
  124. package/dist/services/market-data/market-data.schemas.js +43 -8
  125. package/dist/services/market-data/market-data.schemas.js.map +1 -1
  126. package/dist/services/market-data/market-data.types.d.ts +3 -3
  127. package/dist/services/notifications/notifications.schemas.d.ts +4 -4
  128. package/dist/services/orderbook/orderbook.d.ts.map +1 -1
  129. package/dist/services/orderbook/orderbook.js +5 -19
  130. package/dist/services/orderbook/orderbook.js.map +1 -1
  131. package/dist/services/orders/order-errors.schemas.d.ts +6 -6
  132. package/dist/services/orders/orders-batch.schemas.d.ts +72 -72
  133. package/dist/services/orders/orders-input.schemas.d.ts +10 -10
  134. package/dist/services/orders/orders-output.schemas.d.ts +16 -16
  135. package/dist/services/orders/orders-output.schemas.d.ts.map +1 -1
  136. package/dist/services/orders/orders-output.schemas.js +1 -1
  137. package/dist/services/orders/orders-output.schemas.js.map +1 -1
  138. package/dist/services/orders/orders.d.ts +5 -0
  139. package/dist/services/orders/orders.d.ts.map +1 -1
  140. package/dist/services/orders/orders.js +5 -0
  141. package/dist/services/orders/orders.js.map +1 -1
  142. package/dist/services/policies/api-key-policies/api-key-policies.js +1 -1
  143. package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -15
  144. package/dist/services/policies/shared.codecs.js +13 -4
  145. package/dist/services/policies/shared.codecs.js.map +1 -1
  146. package/dist/services/policies/shared.d.ts +1 -1
  147. package/dist/services/policies/subaccount-policies/subaccount-policies.js +1 -1
  148. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +3 -3
  149. package/dist/services/rewards/rewards.schemas.d.ts +4 -4
  150. package/dist/services/statement-exports/statement-exports.schemas.d.ts +6 -6
  151. package/dist/services/strategies/service.d.ts +8 -0
  152. package/dist/services/strategies/service.d.ts.map +1 -0
  153. package/dist/services/strategies/service.js +9 -0
  154. package/dist/services/strategies/service.js.map +1 -0
  155. package/dist/services/strategies/strategies.codecs.d.ts +15 -0
  156. package/dist/services/strategies/strategies.codecs.d.ts.map +1 -0
  157. package/dist/services/strategies/strategies.codecs.js +50 -0
  158. package/dist/services/strategies/strategies.codecs.js.map +1 -0
  159. package/dist/services/strategies/strategies.d.ts +75 -0
  160. package/dist/services/strategies/strategies.d.ts.map +1 -0
  161. package/dist/services/strategies/strategies.js +135 -0
  162. package/dist/services/strategies/strategies.js.map +1 -0
  163. package/dist/services/strategies/strategies.schemas.d.ts +568 -0
  164. package/dist/services/strategies/strategies.schemas.d.ts.map +1 -0
  165. package/dist/services/strategies/strategies.schemas.js +408 -0
  166. package/dist/services/strategies/strategies.schemas.js.map +1 -0
  167. package/dist/services/strategies/strategies.types.d.ts +3 -0
  168. package/dist/services/subaccounts/subaccounts.js +2 -2
  169. package/dist/services/subaccounts/subaccounts.schemas.d.ts +8 -8
  170. package/dist/services/system/system.schemas.d.ts +13 -13
  171. package/dist/services/trades/trades.schemas.d.ts +1 -1
  172. package/dist/services/trading-withdraws/trading-withdraws.d.ts +29 -2
  173. package/dist/services/trading-withdraws/trading-withdraws.d.ts.map +1 -1
  174. package/dist/services/trading-withdraws/trading-withdraws.js +74 -11
  175. package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
  176. package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts +85 -1
  177. package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts.map +1 -1
  178. package/dist/services/trading-withdraws/trading-withdraws.schemas.js +56 -1
  179. package/dist/services/trading-withdraws/trading-withdraws.schemas.js.map +1 -1
  180. package/dist/services/trading-withdraws/trading-withdraws.types.d.ts +3 -3
  181. package/dist/services/trading-withdraws/wallet-message.js +29 -1
  182. package/dist/services/trading-withdraws/wallet-message.js.map +1 -1
  183. package/dist/services/transfers/transfers.js +1 -1
  184. package/dist/services/transfers/transfers.schemas.d.ts +1 -1
  185. package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
  186. package/dist/services/triggers/triggers-output.schemas.d.ts +44 -44
  187. package/dist/shared/connect-error-mapping.d.ts.map +1 -1
  188. package/dist/shared/connect-error-mapping.js +5 -0
  189. package/dist/shared/connect-error-mapping.js.map +1 -1
  190. package/dist/shared/error-detail.d.ts +25 -2
  191. package/dist/shared/error-detail.d.ts.map +1 -1
  192. package/dist/shared/error-detail.js +1 -0
  193. package/dist/shared/error-detail.js.map +1 -1
  194. package/dist/shared/error-details/strategies.js +36 -0
  195. package/dist/shared/error-details/strategies.js.map +1 -0
  196. package/dist/wired-services.d.ts.map +1 -1
  197. package/dist/wired-services.js +6 -4
  198. package/dist/wired-services.js.map +1 -1
  199. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"assistant-events.schemas.d.ts","names":[],"sources":["../../../src/services/assistant/assistant-events.schemas.ts"],"mappings":";;;;;;;iBAwLS,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkBnB,wBAAwB,kBAAkB;iBA0B7C,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAUlD,oBAAoB,kBAAkB"}
@@ -12,7 +12,7 @@ import { PriceAlertSchema } from "../price-alerts/price-alerts.schemas.js";
12
12
  import { LedgerTransferSchema } from "../transfers/transfers.schemas.js";
13
13
  import { TriggerStatusCodec, TriggerTypeCodec } from "../triggers/triggers.codecs.js";
14
14
  import { createTriggerSchema } from "../triggers/triggers-output.schemas.js";
15
- import { ApprovalStatusCodec, DisplaySettingCodec, FailureCategoryCodec, MemoryKindCodec, OrderPriceFieldCodec, PriceOffsetDirectionCodec, PriceRoundingCodec, ReferencePriceSourceCodec, TriggerChangeActionCodec, TriggerDirectionCodec, UnfilledSlicePolicyCodec } from "./assistant.codecs.js";
15
+ import { ApprovalStatusCodec, DisplaySettingCodec, FailureCategoryCodec, MemoryKindCodec, OrderPriceFieldCodec, PriceOffsetDirectionCodec, PriceRoundingCodec, ReferencePriceSourceCodec, SubagentFundingCodec, TriggerChangeActionCodec, TriggerDirectionCodec, UnfilledSlicePolicyCodec } from "./assistant.codecs.js";
16
16
  //#region src/services/assistant/assistant-events.schemas.ts
17
17
  const side = (value) => enumLabel(OrderSideCodec.protoToOutput, value);
18
18
  const tif = (value) => enumLabel(TimeInForceCodec.protoToOutput, value);
@@ -397,14 +397,18 @@ function formatEvent(e, scales) {
397
397
  type: "tool_started",
398
398
  toolCallId: e.value.toolCallId,
399
399
  name: e.value.name,
400
- input: e.value.input ?? {}
400
+ input: e.value.input ?? {},
401
+ /** Set for a subagent's own calls, as in its `subagent_started` event. */
402
+ subagentId: e.value.subagentId
401
403
  };
402
404
  case "toolFinished": return {
403
405
  type: "tool_finished",
404
406
  toolCallId: e.value.toolCallId,
405
407
  name: e.value.name,
406
408
  ok: e.value.ok,
407
- errorMessage: e.value.errorMessage
409
+ errorMessage: e.value.errorMessage,
410
+ /** Set for a subagent's own calls, as in its `subagent_started` event. */
411
+ subagentId: e.value.subagentId
408
412
  };
409
413
  case "memoriesRecalled":
410
414
  /**
@@ -445,14 +449,20 @@ function formatEvent(e, scales) {
445
449
  case "subagentStarted": return {
446
450
  type: "subagent_started",
447
451
  subagentId: e.value.subagentId,
448
- name: e.value.name
452
+ name: e.value.name,
453
+ /** What pays for its work; `"unspecified"` means show no funding. */
454
+ funding: enumLabel(SubagentFundingCodec.protoToOutput, e.value.funding),
455
+ /** The most credits it may use, even when sponsored or on the own key; null when not said. */
456
+ creditCap: e.value.creditCap ? Number(e.value.creditCap) : null
449
457
  };
450
458
  case "subagentFinished": return {
451
459
  type: "subagent_finished",
452
460
  subagentId: e.value.subagentId,
453
461
  name: e.value.name,
454
462
  ok: e.value.ok,
455
- summary: e.value.summary
463
+ summary: e.value.summary,
464
+ /** Website page where the user deploys the bot it proposed; omitted when it proposed none. */
465
+ deployUrl: e.value.deployUrl
456
466
  };
457
467
  case "approvalRequested": return {
458
468
  type: "approval_requested",
@@ -1 +1 @@
1
- {"version":3,"file":"assistant-events.schemas.js","names":[],"sources":["../../../src/services/assistant/assistant-events.schemas.ts"],"sourcesContent":["import type * 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 { parse } from \"../../shared/validation.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { tsObjToMs } from \"../../utils/time.js\";\nimport {\n createBalanceHistoryResponseSchema,\n createEquityHistoryResponseSchema,\n formatLedgerBalance,\n} from \"../balances/balances.schemas.js\";\nimport { TimeframeCodec } from \"../candles/candles.codecs.js\";\nimport { createCandleRowSchema } from \"../candles/candles.schemas.js\";\nimport { DepositAddressSchema } from \"../deposit/deposit.schemas.js\";\nimport {\n OrderSideCodec,\n TimeInForceCodec,\n TriggerPriceSourceCodec,\n} from \"../orders/order-enums.codecs.js\";\nimport { formatOrder } from \"../orders/orders-output.schemas.js\";\nimport { PriceAlertSchema } from \"../price-alerts/price-alerts.schemas.js\";\nimport { LedgerTransferSchema } from \"../transfers/transfers.schemas.js\";\nimport { TriggerStatusCodec, TriggerTypeCodec } from \"../triggers/triggers.codecs.js\";\nimport { createTriggerSchema } from \"../triggers/triggers-output.schemas.js\";\nimport {\n ApprovalStatusCodec,\n DisplaySettingCodec,\n FailureCategoryCodec,\n MemoryKindCodec,\n OrderPriceFieldCodec,\n PriceOffsetDirectionCodec,\n PriceRoundingCodec,\n ReferencePriceSourceCodec,\n TriggerChangeActionCodec,\n TriggerDirectionCodec,\n UnfilledSlicePolicyCodec,\n} from \"./assistant.codecs.js\";\n\n/*\n * Run events are formatted straight from the decoded protobuf messages, like `formatOrder`.\n * Every oneof becomes a `type`-tagged union; a case this build does not know becomes\n * `{ type: \"unspecified\" }`, which the proto contract says to skip.\n */\n\nconst side = (value: number) => enumLabel(OrderSideCodec.protoToOutput, value);\nconst tif = (value: number) => enumLabel(TimeInForceCodec.protoToOutput, value);\nconst watchedPrice = (value: number) => enumLabel(TriggerPriceSourceCodec.protoToOutput, value);\nconst direction = (value: number) => enumLabel(TriggerDirectionCodec.protoToOutput, value);\n\nfunction formatUsage(u: Proto.Usage | undefined) {\n return {\n inputTokens: Number(u?.inputTokens ?? 0n),\n outputTokens: Number(u?.outputTokens ?? 0n),\n /** Subset of `inputTokens` served from the prompt cache. */\n cachedInputTokens: Number(u?.cachedInputTokens ?? 0n),\n };\n}\n\nfunction formatReferencePrice(p: Proto.ReferencePrice) {\n return {\n price: p.price,\n source: enumLabel(ReferencePriceSourceCodec.protoToOutput, p.source),\n observedAt: tsObjToMs(p.observedAt),\n };\n}\n\nfunction formatRelativePrice(p: Proto.RelativePrice) {\n return {\n field: enumLabel(OrderPriceFieldCodec.protoToOutput, p.field),\n /** The resolved absolute price the order carries. */\n price: p.price,\n direction: enumLabel(PriceOffsetDirectionCodec.protoToOutput, p.direction),\n offsetBps: p.offsetBps,\n reference:\n p.reference.case === \"market\"\n ? { type: \"market\" as const, ...formatReferencePrice(p.reference.value) }\n : p.reference.case === \"limitPrice\"\n ? { type: \"limit_price\" as const, price: p.reference.value }\n : { type: \"unspecified\" as const },\n rounding: enumLabel(PriceRoundingCodec.protoToOutput, p.rounding),\n tickSize: p.tickSize,\n };\n}\n\nfunction formatTrailingDistance(\n d:\n | Proto.AttachedTrailingStop[\"trailingDistance\"]\n | Proto.TrailingStopPreview[\"trailingDistance\"],\n) {\n if (d.case === \"distance\") return { kind: \"distance\" as const, distance: d.value };\n if (d.case === \"distanceBps\") return { kind: \"bps\" as const, bps: d.value };\n return { kind: \"unspecified\" as const };\n}\n\nfunction formatAttachedExits(a: Proto.AttachedExits | undefined) {\n if (!a) return undefined;\n const exit = (e: Proto.AttachedExit | undefined) =>\n e && { triggerPrice: e.triggerPrice, limitPrice: e.limitPrice };\n return {\n takeProfit: exit(a.takeProfit),\n stopLoss: exit(a.stopLoss),\n trailingStop: a.trailingStop && {\n trailingDistance: formatTrailingDistance(a.trailingStop.trailingDistance),\n activationPrice: a.trailingStop.activationPrice,\n limitPrice: a.trailingStop.limitPrice,\n },\n oco: a.oco,\n };\n}\n\nfunction formatStopPreview(s: Proto.StopOrderPreview) {\n return {\n triggerPrice: s.triggerPrice,\n triggerPriceSource: watchedPrice(s.triggerPriceSource),\n direction: direction(s.direction),\n limitPrice: s.limitPrice,\n timeInForce: tif(s.timeInForce),\n postOnly: s.postOnly,\n maxSlippageBps: s.maxSlippageBps,\n fundsReserved: s.fundsReserved,\n };\n}\n\nfunction formatOrderKind(k: Proto.OrderPreview[\"kind\"]) {\n switch (k.case) {\n case \"market\":\n return {\n type: \"market\" as const,\n maxSlippageBps: k.value.maxSlippageBps,\n attached: formatAttachedExits(k.value.attached),\n };\n case \"limit\":\n return {\n type: \"limit\" as const,\n price: k.value.price,\n timeInForce: tif(k.value.timeInForce),\n expireAt: tsObjToMs(k.value.expireAt),\n postOnly: k.value.postOnly,\n attached: formatAttachedExits(k.value.attached),\n };\n case \"stopLoss\":\n return { type: \"stop_loss\" as const, ...formatStopPreview(k.value) };\n case \"takeProfit\":\n return { type: \"take_profit\" as const, ...formatStopPreview(k.value) };\n case \"trailingStop\":\n return {\n type: \"trailing_stop\" as const,\n trailingDistance: formatTrailingDistance(k.value.trailingDistance),\n activationPrice: k.value.activationPrice,\n triggerPriceSource: watchedPrice(k.value.triggerPriceSource),\n limitPrice: k.value.limitPrice,\n maxSlippageBps: k.value.maxSlippageBps,\n fundsReserved: k.value.fundsReserved,\n };\n case \"twap\":\n return {\n type: \"twap\" as const,\n durationMs: Number(k.value.durationMs),\n sliceIntervalMs: Number(k.value.sliceIntervalMs),\n sliceCount: k.value.sliceCount,\n sliceQuantity: k.value.sliceQuantity,\n limitPrice: k.value.limitPrice,\n maxSlippageBps: k.value.maxSlippageBps,\n unfilledSlicePolicy: enumLabel(\n UnfilledSlicePolicyCodec.protoToOutput,\n k.value.unfilledSlicePolicy,\n ),\n firstSliceImmediate: k.value.firstSliceImmediate,\n };\n case \"ladder\":\n return {\n type: \"ladder\" as const,\n lowPrice: k.value.lowPrice,\n highPrice: k.value.highPrice,\n levels: k.value.levels.map((l) => ({ price: l.price, quantity: l.quantity })),\n postOnly: k.value.postOnly,\n timeInForce: tif(k.value.timeInForce),\n allLevelsAtOnce: k.value.allLevelsAtOnce,\n };\n default:\n return { type: \"unspecified\" as const };\n }\n}\n\nfunction formatOrderPreview(o: Proto.OrderPreview) {\n return {\n symbolId: o.symbolId,\n symbol: o.symbol,\n baseAsset: o.baseAsset,\n quoteAsset: o.quoteAsset,\n side: side(o.side),\n quantity: o.quantity,\n quoteAmount: o.quoteAmount,\n estimatedValue: o.estimatedValue,\n reservedAmount: o.reservedAmount,\n referencePrice: o.referencePrice && formatReferencePrice(o.referencePrice),\n /** The order type and its own values; `type: \"unspecified\"` means show the summary only. */\n order: formatOrderKind(o.kind),\n relativePrices: o.relativePrices.map(formatRelativePrice),\n };\n}\n\nexport type AssistantOrderPreview = ReturnType<typeof formatOrderPreview>;\n\nfunction formatTriggerSettings(s: Proto.TriggerSettings | undefined) {\n if (!s) return undefined;\n const d = s.trailingDistance;\n const m = s.maxSlippage;\n return {\n status: enumLabel(TriggerStatusCodec.protoToOutput, s.status),\n triggerPrice: s.triggerPrice,\n trailingDistance:\n d.case === \"trailingDistancePrice\"\n ? { kind: \"distance\" as const, distance: d.value }\n : d.case === \"trailingDistanceBps\"\n ? { kind: \"bps\" as const, bps: d.value }\n : undefined,\n activationPrice: s.activationPrice,\n maxSlippage:\n m.case === \"maxSlippageBps\"\n ? { kind: \"bps\" as const, bps: m.value }\n : m.case === \"maxSlippagePrice\"\n ? { kind: \"slippage\" as const, slippage: m.value }\n : undefined,\n limitPrice: s.limitPrice,\n };\n}\n\nfunction formatApprovalPreview(p: Proto.ApprovalRequested[\"preview\"]) {\n switch (p.case) {\n case \"orderPreview\":\n return { type: \"order\" as const, ...formatOrderPreview(p.value) };\n case \"placeOrders\":\n return {\n type: \"place_orders\" as const,\n orders: p.value.orders.map(formatOrderPreview),\n totalValues: p.value.totalValues.map((t) => ({\n quoteAsset: t.quoteAsset,\n value: t.value,\n })),\n };\n case \"cancelOrders\":\n return {\n type: \"cancel_orders\" as const,\n orders: p.value.orders.map((o) => ({\n orderId: formatId(o.orderId),\n symbol: o.symbol,\n side: side(o.side),\n price: o.price,\n quantity: o.quantity,\n filledQuantity: o.filledQuantity,\n })),\n cancelAll: p.value.cancelAll,\n symbols: p.value.symbols,\n side: side(p.value.side),\n liveTriggersKept: p.value.liveTriggersKept,\n liveTriggersKeptLowerBound: p.value.liveTriggersKeptLowerBound,\n };\n case \"orderChange\":\n return {\n type: \"order_change\" as const,\n symbolId: p.value.symbolId,\n symbol: p.value.symbol,\n baseAsset: p.value.baseAsset,\n quoteAsset: p.value.quoteAsset,\n orders: p.value.orders.map((o) => ({\n orderId: formatId(o.orderId),\n side: side(o.side),\n price: o.price,\n newPrice: o.newPrice,\n quantity: o.quantity,\n newQuantity: o.newQuantity,\n filledQuantity: o.filledQuantity,\n replaced: o.replaced,\n })),\n };\n case \"triggerChange\": {\n const t = p.value;\n return {\n type: \"trigger_change\" as const,\n triggerId: formatId(t.triggerId),\n symbolId: t.symbolId,\n symbol: t.symbol,\n baseAsset: t.baseAsset,\n quoteAsset: t.quoteAsset,\n triggerType: enumLabel(TriggerTypeCodec.protoToOutput, t.type),\n side: side(t.side),\n quantity: t.quantity,\n action: enumLabel(TriggerChangeActionCodec.protoToOutput, t.action),\n before: formatTriggerSettings(t.before),\n after: formatTriggerSettings(t.after),\n referencePrice: t.referencePrice && formatReferencePrice(t.referencePrice),\n direction: direction(t.direction),\n reserveIncrease:\n t.reserveChange.case === \"reserveIncrease\" ? t.reserveChange.value : undefined,\n reserveRelease:\n t.reserveChange.case === \"reserveRelease\" ? t.reserveChange.value : undefined,\n firesOnResume: t.firesOnResume,\n };\n }\n case \"cancelTrigger\": {\n const t = p.value;\n return {\n type: \"cancel_trigger\" as const,\n triggerId: formatId(t.triggerId),\n symbolId: t.symbolId,\n symbol: t.symbol,\n triggerType: enumLabel(TriggerTypeCodec.protoToOutput, t.type),\n side: side(t.side),\n quantity: t.quantity,\n triggerPrice: t.triggerPrice,\n filledQuantity: t.filledQuantity,\n slicesDone: t.slicesDone,\n sliceCount: t.sliceCount,\n levelsFilled: t.levelsFilled,\n levelCount: t.levelCount,\n cancelsOpenOrders: t.cancelsOpenOrders,\n };\n }\n case \"swap\": {\n const s = p.value;\n return {\n type: \"swap\" as const,\n sourceAsset: s.sourceAsset,\n destinationAsset: s.destinationAsset,\n amount: s.amount,\n expectedAmountOut: s.expectedAmountOut,\n minAmountOut: s.minAmountOut,\n maxSlippageBps: s.maxSlippageBps,\n legs: s.legs.map((l) => ({\n symbol: l.symbol,\n side: side(l.side),\n averagePrice: l.averagePrice,\n priceImpactBps: l.priceImpactBps,\n takerFeeRatePercent: l.takerFeeRatePercent,\n fee: l.fee,\n feeAsset: l.feeAsset,\n })),\n quotedAt: tsObjToMs(s.quotedAt),\n /** Approving after this executes nothing. */\n expiresAt: tsObjToMs(s.expiresAt),\n };\n }\n default:\n return { type: \"unspecified\" as const };\n }\n}\n\nexport type AssistantApprovalPreview = ReturnType<typeof formatApprovalPreview>;\n\nfunction formatViewKind(k: Proto.View[\"kind\"], scales: SdkScales) {\n switch (k.case) {\n case \"ordersTable\":\n return {\n type: \"orders_table\" as const,\n orders: k.value.orders.map((o) => formatOrder(scales, o)),\n truncated: k.value.truncated,\n accountId: formatId(k.value.accountId),\n };\n case \"triggersTable\": {\n const schema = createTriggerSchema(scales);\n return {\n type: \"triggers_table\" as const,\n /** subaccountId, feeAsset, selfTradePreventionMode, updatedTs, armedTs and version are not set. */\n triggers: k.value.triggers.map((t) => parse(schema, t)),\n truncated: k.value.truncated,\n accountId: formatId(k.value.accountId),\n };\n }\n case \"balancesTable\":\n return {\n type: \"balances_table\" as const,\n balances: k.value.balances.map(formatLedgerBalance),\n accountId: formatId(k.value.accountId),\n };\n case \"priceChart\": {\n const schema = createCandleRowSchema(scales);\n return {\n type: \"price_chart\" as const,\n symbolId: k.value.symbolId,\n timeframe: enumLabel(TimeframeCodec.protoToOutput, k.value.timeframe),\n candles: k.value.candles.map((c) => parse(schema, c)),\n };\n }\n case \"markdownTable\":\n return {\n type: \"markdown_table\" as const,\n columns: k.value.columns,\n /** A row may have fewer cells than columns; missing cells are empty. */\n rows: k.value.rows.map((r) => r.cells),\n truncated: k.value.truncated,\n };\n case \"priceAlert\":\n return { type: \"price_alert\" as const, alert: parse(PriceAlertSchema, k.value) };\n case \"depositAddress\":\n return {\n type: \"deposit_address\" as const,\n depositAddress: k.value.depositAddress\n ? parse(DepositAddressSchema, k.value.depositAddress)\n : undefined,\n assetId: k.value.assetId,\n accountId: formatId(k.value.accountId),\n };\n case \"balanceHistoryChart\":\n return {\n type: \"balance_history_chart\" as const,\n history: k.value.history\n ? parse(createBalanceHistoryResponseSchema(), k.value.history)\n : undefined,\n accountId: formatId(k.value.accountId),\n };\n case \"equityHistoryChart\":\n return {\n type: \"equity_history_chart\" as const,\n history: k.value.history\n ? parse(createEquityHistoryResponseSchema(scales), k.value.history)\n : undefined,\n accountId: formatId(k.value.accountId),\n };\n case \"transfersTable\":\n return {\n type: \"transfers_table\" as const,\n transfers: k.value.transfers.map((t) => parse(LedgerTransferSchema, t)),\n truncated: k.value.truncated,\n accountId: formatId(k.value.accountId),\n };\n default:\n return { type: \"unspecified\" as const };\n }\n}\n\nfunction formatView(view: Proto.View, scales: SdkScales) {\n try {\n return formatViewKind(view.kind, scales);\n } catch {\n // ponytail: a view this client cannot format (e.g. a market missing from its catalog)\n // is skipped like an unknown view instead of ending the whole run stream.\n return { type: \"unspecified\" as const };\n }\n}\n\nexport type AssistantView = ReturnType<typeof formatView>;\n\nfunction formatEvent(e: Proto.RunEvent[\"event\"], scales: SdkScales) {\n switch (e.case) {\n case \"textDelta\":\n return { type: \"text_delta\" as const, text: e.value.text };\n case \"discardPartial\":\n /** Drop the text of every `text_delta` with `seq >= fromSeq` received before this event. */\n return { type: \"discard_partial\" as const, fromSeq: Number(e.value.fromSeq) };\n case \"toolStarted\":\n return {\n type: \"tool_started\" as const,\n toolCallId: e.value.toolCallId,\n name: e.value.name,\n input: e.value.input ?? {},\n };\n case \"toolFinished\":\n return {\n type: \"tool_finished\" as const,\n toolCallId: e.value.toolCallId,\n name: e.value.name,\n ok: e.value.ok,\n errorMessage: e.value.errorMessage,\n };\n case \"memoriesRecalled\":\n /**\n * For a `recall_memories` call, the relevant memories; for a `memory_updates` call,\n * the memories saved or changed in the user's other conversations since this one's\n * previous answer. Key on the tool call's `name`.\n */\n return {\n type: \"memories_recalled\" as const,\n toolCallId: e.value.toolCallId,\n memories: e.value.memories.map((m) => ({\n memoryId: formatId(m.memoryId),\n text: m.text,\n kind: enumLabel(MemoryKindCodec.protoToOutput, m.kind),\n })),\n };\n case \"destinationsSuggested\":\n return {\n type: \"destinations_suggested\" as const,\n toolCallId: e.value.toolCallId,\n destinationIds: e.value.destinationIds,\n };\n case \"displaySettingAction\":\n /**\n * Apply `value` to `setting` once, only in a run you sent and follow, never on replay,\n * and offer an undo. No `value` means show the setting's choices and change nothing\n * until the user picks. Ignore a setting or value the client no longer accepts.\n */\n return {\n type: \"display_setting_action\" as const,\n toolCallId: e.value.toolCallId,\n setting: enumLabel(DisplaySettingCodec.protoToOutput, e.value.setting),\n value: e.value.value,\n };\n case \"skillLoaded\":\n return { type: \"skill_loaded\" as const, name: e.value.name };\n case \"subagentStarted\":\n return {\n type: \"subagent_started\" as const,\n subagentId: e.value.subagentId,\n name: e.value.name,\n };\n case \"subagentFinished\":\n return {\n type: \"subagent_finished\" as const,\n subagentId: e.value.subagentId,\n name: e.value.name,\n ok: e.value.ok,\n summary: e.value.summary,\n };\n case \"approvalRequested\":\n return {\n type: \"approval_requested\" as const,\n approvalId: formatId(e.value.approvalId),\n summary: e.value.summary,\n expiresAt: tsObjToMs(e.value.expiresAt),\n parameters: e.value.parameters.map((p) => ({ label: p.label, value: p.value })),\n accountId: formatId(e.value.accountId),\n /** The action as typed values; `type: \"unspecified\"` means show the summary only. */\n preview: formatApprovalPreview(e.value.preview),\n };\n case \"approvalResolved\":\n return {\n type: \"approval_resolved\" as const,\n approvalId: formatId(e.value.approvalId),\n status: enumLabel(ApprovalStatusCodec.protoToOutput, e.value.status),\n };\n case \"view\":\n return { type: \"view\" as const, view: formatView(e.value, scales) };\n case \"runCompleted\":\n return { type: \"run_completed\" as const, usage: formatUsage(e.value.usage) };\n case \"runFailed\":\n return {\n type: \"run_failed\" as const,\n category: enumLabel(FailureCategoryCodec.protoToOutput, e.value.category),\n message: e.value.message,\n usage: formatUsage(e.value.usage),\n };\n default:\n return { type: \"unspecified\" as const };\n }\n}\n\nexport function formatRunEvent(event: Proto.RunEvent, scales: SdkScales) {\n return {\n /** Position in the run, from 1. Pass the last one received as `afterSeq` to resume. */\n seq: Number(event.seq),\n createdAt: tsObjToMs(event.createdAt),\n ...formatEvent(event.event, scales),\n };\n}\n\n/** One run event. `type: \"unspecified\"` is an event this SDK build does not know: skip it. */\nexport type AssistantRunEvent = ReturnType<typeof formatRunEvent>;\n"],"mappings":";;;;;;;;;;;;;;;;AA4CA,MAAM,QAAQ,UAAkB,UAAU,eAAe,eAAe,KAAK;AAC7E,MAAM,OAAO,UAAkB,UAAU,iBAAiB,eAAe,KAAK;AAC9E,MAAM,gBAAgB,UAAkB,UAAU,wBAAwB,eAAe,KAAK;AAC9F,MAAM,aAAa,UAAkB,UAAU,sBAAsB,eAAe,KAAK;AAEzF,SAAS,YAAY,GAA4B;CAC7C,OAAO;EACH,aAAa,OAAO,GAAG,eAAe,EAAE;EACxC,cAAc,OAAO,GAAG,gBAAgB,EAAE;;EAE1C,mBAAmB,OAAO,GAAG,qBAAqB,EAAE;CACxD;AACJ;AAEA,SAAS,qBAAqB,GAAyB;CACnD,OAAO;EACH,OAAO,EAAE;EACT,QAAQ,UAAU,0BAA0B,eAAe,EAAE,MAAM;EACnE,YAAY,UAAU,EAAE,UAAU;CACtC;AACJ;AAEA,SAAS,oBAAoB,GAAwB;CACjD,OAAO;EACH,OAAO,UAAU,qBAAqB,eAAe,EAAE,KAAK;;EAE5D,OAAO,EAAE;EACT,WAAW,UAAU,0BAA0B,eAAe,EAAE,SAAS;EACzE,WAAW,EAAE;EACb,WACI,EAAE,UAAU,SAAS,WACf;GAAE,MAAM;GAAmB,GAAG,qBAAqB,EAAE,UAAU,KAAK;EAAE,IACtE,EAAE,UAAU,SAAS,eACnB;GAAE,MAAM;GAAwB,OAAO,EAAE,UAAU;EAAM,IACzD,EAAE,MAAM,cAAuB;EAC3C,UAAU,UAAU,mBAAmB,eAAe,EAAE,QAAQ;EAChE,UAAU,EAAE;CAChB;AACJ;AAEA,SAAS,uBACL,GAGF;C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UAAU;GACvC,SAAS,EAAE,MAAM;GACjB,WAAW,UAAU,EAAE,MAAM,SAAS;GACtC,YAAY,EAAE,MAAM,WAAW,KAAK,OAAO;IAAE,OAAO,EAAE;IAAO,OAAO,EAAE;GAAM,EAAE;GAC9E,WAAW,SAAS,EAAE,MAAM,SAAS;;GAErC,SAAS,sBAAsB,EAAE,MAAM,OAAO;EAClD;EACJ,KAAK,oBACD,OAAO;GACH,MAAM;GACN,YAAY,SAAS,EAAE,MAAM,UAAU;GACvC,QAAQ,UAAU,oBAAoB,eAAe,EAAE,MAAM,MAAM;EACvE;EACJ,KAAK,QACD,OAAO;GAAE,MAAM;GAAiB,MAAM,WAAW,EAAE,OAAO,MAAM;EAAE;EACtE,KAAK,gBACD,OAAO;GAAE,MAAM;GAA0B,OAAO,YAAY,EAAE,MAAM,KAAK;EAAE;EAC/E,KAAK,aACD,OAAO;GACH,MAAM;GACN,UAAU,UAAU,qBAAqB,eAAe,EAAE,MAAM,QAAQ;GACxE,SAAS,EAAE,MAAM;GACjB,OAAO,YAAY,EAAE,MAAM,KAAK;EACpC;EACJ,SACI,OAAO,EAAE,MAAM,cAAuB;CAC9C;AACJ;AAEA,SAAgB,eAAe,OAAuB,QAAmB;CACrE,OAAO;;EAEH,KAAK,OAAO,MAAM,GAAG;EACrB,WAAW,UAAU,MAAM,SAAS;EACpC,GAAG,YAAY,MAAM,OAAO,MAAM;CACtC;AACJ"}
1
+ {"version":3,"file":"assistant-events.schemas.js","names":[],"sources":["../../../src/services/assistant/assistant-events.schemas.ts"],"sourcesContent":["import type * 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 { parse } from \"../../shared/validation.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { tsObjToMs } from \"../../utils/time.js\";\nimport {\n createBalanceHistoryResponseSchema,\n createEquityHistoryResponseSchema,\n formatLedgerBalance,\n} from \"../balances/balances.schemas.js\";\nimport { TimeframeCodec } from \"../candles/candles.codecs.js\";\nimport { createCandleRowSchema } from \"../candles/candles.schemas.js\";\nimport { DepositAddressSchema } from \"../deposit/deposit.schemas.js\";\nimport {\n OrderSideCodec,\n TimeInForceCodec,\n TriggerPriceSourceCodec,\n} from \"../orders/order-enums.codecs.js\";\nimport { formatOrder } from \"../orders/orders-output.schemas.js\";\nimport { PriceAlertSchema } from \"../price-alerts/price-alerts.schemas.js\";\nimport { LedgerTransferSchema } from \"../transfers/transfers.schemas.js\";\nimport { TriggerStatusCodec, TriggerTypeCodec } from \"../triggers/triggers.codecs.js\";\nimport { createTriggerSchema } from \"../triggers/triggers-output.schemas.js\";\nimport {\n ApprovalStatusCodec,\n DisplaySettingCodec,\n FailureCategoryCodec,\n MemoryKindCodec,\n OrderPriceFieldCodec,\n PriceOffsetDirectionCodec,\n PriceRoundingCodec,\n ReferencePriceSourceCodec,\n SubagentFundingCodec,\n TriggerChangeActionCodec,\n TriggerDirectionCodec,\n UnfilledSlicePolicyCodec,\n} from \"./assistant.codecs.js\";\n\n/*\n * Run events are formatted straight from the decoded protobuf messages, like `formatOrder`.\n * Every oneof becomes a `type`-tagged union; a case this build does not know becomes\n * `{ type: \"unspecified\" }`, which the proto contract says to skip.\n */\n\nconst side = (value: number) => enumLabel(OrderSideCodec.protoToOutput, value);\nconst tif = (value: number) => enumLabel(TimeInForceCodec.protoToOutput, value);\nconst watchedPrice = (value: number) => enumLabel(TriggerPriceSourceCodec.protoToOutput, value);\nconst direction = (value: number) => enumLabel(TriggerDirectionCodec.protoToOutput, value);\n\nfunction formatUsage(u: Proto.Usage | undefined) {\n return {\n inputTokens: Number(u?.inputTokens ?? 0n),\n outputTokens: Number(u?.outputTokens ?? 0n),\n /** Subset of `inputTokens` served from the prompt cache. */\n cachedInputTokens: Number(u?.cachedInputTokens ?? 0n),\n };\n}\n\nfunction formatReferencePrice(p: Proto.ReferencePrice) {\n return {\n price: p.price,\n source: enumLabel(ReferencePriceSourceCodec.protoToOutput, p.source),\n observedAt: tsObjToMs(p.observedAt),\n };\n}\n\nfunction formatRelativePrice(p: Proto.RelativePrice) {\n return {\n field: enumLabel(OrderPriceFieldCodec.protoToOutput, p.field),\n /** The resolved absolute price the order carries. */\n price: p.price,\n direction: enumLabel(PriceOffsetDirectionCodec.protoToOutput, p.direction),\n offsetBps: p.offsetBps,\n reference:\n p.reference.case === \"market\"\n ? { type: \"market\" as const, ...formatReferencePrice(p.reference.value) }\n : p.reference.case === \"limitPrice\"\n ? { type: \"limit_price\" as const, price: p.reference.value }\n : { type: \"unspecified\" as const },\n rounding: enumLabel(PriceRoundingCodec.protoToOutput, p.rounding),\n tickSize: p.tickSize,\n };\n}\n\nfunction formatTrailingDistance(\n d:\n | Proto.AttachedTrailingStop[\"trailingDistance\"]\n | Proto.TrailingStopPreview[\"trailingDistance\"],\n) {\n if (d.case === \"distance\") return { kind: \"distance\" as const, distance: d.value };\n if (d.case === \"distanceBps\") return { kind: \"bps\" as const, bps: d.value };\n return { kind: \"unspecified\" as const };\n}\n\nfunction formatAttachedExits(a: Proto.AttachedExits | undefined) {\n if (!a) return undefined;\n const exit = (e: Proto.AttachedExit | undefined) =>\n e && { triggerPrice: e.triggerPrice, limitPrice: e.limitPrice };\n return {\n takeProfit: exit(a.takeProfit),\n stopLoss: exit(a.stopLoss),\n trailingStop: a.trailingStop && {\n trailingDistance: formatTrailingDistance(a.trailingStop.trailingDistance),\n activationPrice: a.trailingStop.activationPrice,\n limitPrice: a.trailingStop.limitPrice,\n },\n oco: a.oco,\n };\n}\n\nfunction formatStopPreview(s: Proto.StopOrderPreview) {\n return {\n triggerPrice: s.triggerPrice,\n triggerPriceSource: watchedPrice(s.triggerPriceSource),\n direction: direction(s.direction),\n limitPrice: s.limitPrice,\n timeInForce: tif(s.timeInForce),\n postOnly: s.postOnly,\n maxSlippageBps: s.maxSlippageBps,\n fundsReserved: s.fundsReserved,\n };\n}\n\nfunction formatOrderKind(k: Proto.OrderPreview[\"kind\"]) {\n switch (k.case) {\n case \"market\":\n return {\n type: \"market\" as const,\n maxSlippageBps: k.value.maxSlippageBps,\n attached: formatAttachedExits(k.value.attached),\n };\n case \"limit\":\n return {\n type: \"limit\" as const,\n price: k.value.price,\n timeInForce: tif(k.value.timeInForce),\n expireAt: tsObjToMs(k.value.expireAt),\n postOnly: k.value.postOnly,\n attached: formatAttachedExits(k.value.attached),\n };\n case \"stopLoss\":\n return { type: \"stop_loss\" as const, ...formatStopPreview(k.value) };\n case \"takeProfit\":\n return { type: \"take_profit\" as const, ...formatStopPreview(k.value) };\n case \"trailingStop\":\n return {\n type: \"trailing_stop\" as const,\n trailingDistance: formatTrailingDistance(k.value.trailingDistance),\n activationPrice: k.value.activationPrice,\n triggerPriceSource: watchedPrice(k.value.triggerPriceSource),\n limitPrice: k.value.limitPrice,\n maxSlippageBps: k.value.maxSlippageBps,\n fundsReserved: k.value.fundsReserved,\n };\n case \"twap\":\n return {\n type: \"twap\" as const,\n durationMs: Number(k.value.durationMs),\n sliceIntervalMs: Number(k.value.sliceIntervalMs),\n sliceCount: k.value.sliceCount,\n sliceQuantity: k.value.sliceQuantity,\n limitPrice: k.value.limitPrice,\n maxSlippageBps: k.value.maxSlippageBps,\n unfilledSlicePolicy: enumLabel(\n UnfilledSlicePolicyCodec.protoToOutput,\n k.value.unfilledSlicePolicy,\n ),\n firstSliceImmediate: k.value.firstSliceImmediate,\n };\n case \"ladder\":\n return {\n type: \"ladder\" as const,\n lowPrice: k.value.lowPrice,\n highPrice: k.value.highPrice,\n levels: k.value.levels.map((l) => ({ price: l.price, quantity: l.quantity })),\n postOnly: k.value.postOnly,\n timeInForce: tif(k.value.timeInForce),\n allLevelsAtOnce: k.value.allLevelsAtOnce,\n };\n default:\n return { type: \"unspecified\" as const };\n }\n}\n\nfunction formatOrderPreview(o: Proto.OrderPreview) {\n return {\n symbolId: o.symbolId,\n symbol: o.symbol,\n baseAsset: o.baseAsset,\n quoteAsset: o.quoteAsset,\n side: side(o.side),\n quantity: o.quantity,\n quoteAmount: o.quoteAmount,\n estimatedValue: o.estimatedValue,\n reservedAmount: o.reservedAmount,\n referencePrice: o.referencePrice && formatReferencePrice(o.referencePrice),\n /** The order type and its own values; `type: \"unspecified\"` means show the summary only. */\n order: formatOrderKind(o.kind),\n relativePrices: o.relativePrices.map(formatRelativePrice),\n };\n}\n\nexport type AssistantOrderPreview = ReturnType<typeof formatOrderPreview>;\n\nfunction formatTriggerSettings(s: Proto.TriggerSettings | undefined) {\n if (!s) return undefined;\n const d = s.trailingDistance;\n const m = s.maxSlippage;\n return {\n status: enumLabel(TriggerStatusCodec.protoToOutput, s.status),\n triggerPrice: s.triggerPrice,\n trailingDistance:\n d.case === \"trailingDistancePrice\"\n ? { kind: \"distance\" as const, distance: d.value }\n : d.case === \"trailingDistanceBps\"\n ? { kind: \"bps\" as const, bps: d.value }\n : undefined,\n activationPrice: s.activationPrice,\n maxSlippage:\n m.case === \"maxSlippageBps\"\n ? { kind: \"bps\" as const, bps: m.value }\n : m.case === \"maxSlippagePrice\"\n ? { kind: \"slippage\" as const, slippage: m.value }\n : undefined,\n limitPrice: s.limitPrice,\n };\n}\n\nfunction formatApprovalPreview(p: Proto.ApprovalRequested[\"preview\"]) {\n switch (p.case) {\n case \"orderPreview\":\n return { type: \"order\" as const, ...formatOrderPreview(p.value) };\n case \"placeOrders\":\n return {\n type: \"place_orders\" as const,\n orders: p.value.orders.map(formatOrderPreview),\n totalValues: p.value.totalValues.map((t) => ({\n quoteAsset: t.quoteAsset,\n value: t.value,\n })),\n };\n case \"cancelOrders\":\n return {\n type: \"cancel_orders\" as const,\n orders: p.value.orders.map((o) => ({\n orderId: formatId(o.orderId),\n symbol: o.symbol,\n side: side(o.side),\n price: o.price,\n quantity: o.quantity,\n filledQuantity: o.filledQuantity,\n })),\n cancelAll: p.value.cancelAll,\n symbols: p.value.symbols,\n side: side(p.value.side),\n liveTriggersKept: p.value.liveTriggersKept,\n liveTriggersKeptLowerBound: p.value.liveTriggersKeptLowerBound,\n };\n case \"orderChange\":\n return {\n type: \"order_change\" as const,\n symbolId: p.value.symbolId,\n symbol: p.value.symbol,\n baseAsset: p.value.baseAsset,\n quoteAsset: p.value.quoteAsset,\n orders: p.value.orders.map((o) => ({\n orderId: formatId(o.orderId),\n side: side(o.side),\n price: o.price,\n newPrice: o.newPrice,\n quantity: o.quantity,\n newQuantity: o.newQuantity,\n filledQuantity: o.filledQuantity,\n replaced: o.replaced,\n })),\n };\n case \"triggerChange\": {\n const t = p.value;\n return {\n type: \"trigger_change\" as const,\n triggerId: formatId(t.triggerId),\n symbolId: t.symbolId,\n symbol: t.symbol,\n baseAsset: t.baseAsset,\n quoteAsset: t.quoteAsset,\n triggerType: enumLabel(TriggerTypeCodec.protoToOutput, t.type),\n side: side(t.side),\n quantity: t.quantity,\n action: enumLabel(TriggerChangeActionCodec.protoToOutput, t.action),\n before: formatTriggerSettings(t.before),\n after: formatTriggerSettings(t.after),\n referencePrice: t.referencePrice && formatReferencePrice(t.referencePrice),\n direction: direction(t.direction),\n reserveIncrease:\n t.reserveChange.case === \"reserveIncrease\" ? t.reserveChange.value : undefined,\n reserveRelease:\n t.reserveChange.case === \"reserveRelease\" ? t.reserveChange.value : undefined,\n firesOnResume: t.firesOnResume,\n };\n }\n case \"cancelTrigger\": {\n const t = p.value;\n return {\n type: \"cancel_trigger\" as const,\n triggerId: formatId(t.triggerId),\n symbolId: t.symbolId,\n symbol: t.symbol,\n triggerType: enumLabel(TriggerTypeCodec.protoToOutput, t.type),\n side: side(t.side),\n quantity: t.quantity,\n triggerPrice: t.triggerPrice,\n filledQuantity: t.filledQuantity,\n slicesDone: t.slicesDone,\n sliceCount: t.sliceCount,\n levelsFilled: t.levelsFilled,\n levelCount: t.levelCount,\n cancelsOpenOrders: t.cancelsOpenOrders,\n };\n }\n case \"swap\": {\n const s = p.value;\n return {\n type: \"swap\" as const,\n sourceAsset: s.sourceAsset,\n destinationAsset: s.destinationAsset,\n amount: s.amount,\n expectedAmountOut: s.expectedAmountOut,\n minAmountOut: s.minAmountOut,\n maxSlippageBps: s.maxSlippageBps,\n legs: s.legs.map((l) => ({\n symbol: l.symbol,\n side: side(l.side),\n averagePrice: l.averagePrice,\n priceImpactBps: l.priceImpactBps,\n takerFeeRatePercent: l.takerFeeRatePercent,\n fee: l.fee,\n feeAsset: l.feeAsset,\n })),\n quotedAt: tsObjToMs(s.quotedAt),\n /** Approving after this executes nothing. */\n expiresAt: tsObjToMs(s.expiresAt),\n };\n }\n default:\n return { type: \"unspecified\" as const };\n }\n}\n\nexport type AssistantApprovalPreview = ReturnType<typeof formatApprovalPreview>;\n\nfunction formatViewKind(k: Proto.View[\"kind\"], scales: SdkScales) {\n switch (k.case) {\n case \"ordersTable\":\n return {\n type: \"orders_table\" as const,\n orders: k.value.orders.map((o) => formatOrder(scales, o)),\n truncated: k.value.truncated,\n accountId: formatId(k.value.accountId),\n };\n case \"triggersTable\": {\n const schema = createTriggerSchema(scales);\n return {\n type: \"triggers_table\" as const,\n /** subaccountId, feeAsset, selfTradePreventionMode, updatedTs, armedTs and version are not set. */\n triggers: k.value.triggers.map((t) => parse(schema, t)),\n truncated: k.value.truncated,\n accountId: formatId(k.value.accountId),\n };\n }\n case \"balancesTable\":\n return {\n type: \"balances_table\" as const,\n balances: k.value.balances.map(formatLedgerBalance),\n accountId: formatId(k.value.accountId),\n };\n case \"priceChart\": {\n const schema = createCandleRowSchema(scales);\n return {\n type: \"price_chart\" as const,\n symbolId: k.value.symbolId,\n timeframe: enumLabel(TimeframeCodec.protoToOutput, k.value.timeframe),\n candles: k.value.candles.map((c) => parse(schema, c)),\n };\n }\n case \"markdownTable\":\n return {\n type: \"markdown_table\" as const,\n columns: k.value.columns,\n /** A row may have fewer cells than columns; missing cells are empty. */\n rows: k.value.rows.map((r) => r.cells),\n truncated: k.value.truncated,\n };\n case \"priceAlert\":\n return { type: \"price_alert\" as const, alert: parse(PriceAlertSchema, k.value) };\n case \"depositAddress\":\n return {\n type: \"deposit_address\" as const,\n depositAddress: k.value.depositAddress\n ? parse(DepositAddressSchema, k.value.depositAddress)\n : undefined,\n assetId: k.value.assetId,\n accountId: formatId(k.value.accountId),\n };\n case \"balanceHistoryChart\":\n return {\n type: \"balance_history_chart\" as const,\n history: k.value.history\n ? parse(createBalanceHistoryResponseSchema(), k.value.history)\n : undefined,\n accountId: formatId(k.value.accountId),\n };\n case \"equityHistoryChart\":\n return {\n type: \"equity_history_chart\" as const,\n history: k.value.history\n ? parse(createEquityHistoryResponseSchema(scales), k.value.history)\n : undefined,\n accountId: formatId(k.value.accountId),\n };\n case \"transfersTable\":\n return {\n type: \"transfers_table\" as const,\n transfers: k.value.transfers.map((t) => parse(LedgerTransferSchema, t)),\n truncated: k.value.truncated,\n accountId: formatId(k.value.accountId),\n };\n default:\n return { type: \"unspecified\" as const };\n }\n}\n\nfunction formatView(view: Proto.View, scales: SdkScales) {\n try {\n return formatViewKind(view.kind, scales);\n } catch {\n // ponytail: a view this client cannot format (e.g. a market missing from its catalog)\n // is skipped like an unknown view instead of ending the whole run stream.\n return { type: \"unspecified\" as const };\n }\n}\n\nexport type AssistantView = ReturnType<typeof formatView>;\n\nfunction formatEvent(e: Proto.RunEvent[\"event\"], scales: SdkScales) {\n switch (e.case) {\n case \"textDelta\":\n return { type: \"text_delta\" as const, text: e.value.text };\n case \"discardPartial\":\n /** Drop the text of every `text_delta` with `seq >= fromSeq` received before this event. */\n return { type: \"discard_partial\" as const, fromSeq: Number(e.value.fromSeq) };\n case \"toolStarted\":\n return {\n type: \"tool_started\" as const,\n toolCallId: e.value.toolCallId,\n name: e.value.name,\n input: e.value.input ?? {},\n /** Set for a subagent's own calls, as in its `subagent_started` event. */\n subagentId: e.value.subagentId,\n };\n case \"toolFinished\":\n return {\n type: \"tool_finished\" as const,\n toolCallId: e.value.toolCallId,\n name: e.value.name,\n ok: e.value.ok,\n errorMessage: e.value.errorMessage,\n /** Set for a subagent's own calls, as in its `subagent_started` event. */\n subagentId: e.value.subagentId,\n };\n case \"memoriesRecalled\":\n /**\n * For a `recall_memories` call, the relevant memories; for a `memory_updates` call,\n * the memories saved or changed in the user's other conversations since this one's\n * previous answer. Key on the tool call's `name`.\n */\n return {\n type: \"memories_recalled\" as const,\n toolCallId: e.value.toolCallId,\n memories: e.value.memories.map((m) => ({\n memoryId: formatId(m.memoryId),\n text: m.text,\n kind: enumLabel(MemoryKindCodec.protoToOutput, m.kind),\n })),\n };\n case \"destinationsSuggested\":\n return {\n type: \"destinations_suggested\" as const,\n toolCallId: e.value.toolCallId,\n destinationIds: e.value.destinationIds,\n };\n case \"displaySettingAction\":\n /**\n * Apply `value` to `setting` once, only in a run you sent and follow, never on replay,\n * and offer an undo. No `value` means show the setting's choices and change nothing\n * until the user picks. Ignore a setting or value the client no longer accepts.\n */\n return {\n type: \"display_setting_action\" as const,\n toolCallId: e.value.toolCallId,\n setting: enumLabel(DisplaySettingCodec.protoToOutput, e.value.setting),\n value: e.value.value,\n };\n case \"skillLoaded\":\n return { type: \"skill_loaded\" as const, name: e.value.name };\n case \"subagentStarted\":\n return {\n type: \"subagent_started\" as const,\n subagentId: e.value.subagentId,\n name: e.value.name,\n /** What pays for its work; `\"unspecified\"` means show no funding. */\n funding: enumLabel(SubagentFundingCodec.protoToOutput, e.value.funding),\n /** The most credits it may use, even when sponsored or on the own key; null when not said. */\n creditCap: e.value.creditCap ? Number(e.value.creditCap) : null,\n };\n case \"subagentFinished\":\n return {\n type: \"subagent_finished\" as const,\n subagentId: e.value.subagentId,\n name: e.value.name,\n ok: e.value.ok,\n summary: e.value.summary,\n /** Website page where the user deploys the bot it proposed; omitted when it proposed none. */\n deployUrl: e.value.deployUrl,\n };\n case \"approvalRequested\":\n return {\n type: \"approval_requested\" as const,\n approvalId: formatId(e.value.approvalId),\n summary: e.value.summary,\n expiresAt: tsObjToMs(e.value.expiresAt),\n parameters: e.value.parameters.map((p) => ({ label: p.label, value: p.value })),\n accountId: formatId(e.value.accountId),\n /** The action as typed values; `type: \"unspecified\"` means show the summary only. */\n preview: formatApprovalPreview(e.value.preview),\n };\n case \"approvalResolved\":\n return {\n type: \"approval_resolved\" as const,\n approvalId: formatId(e.value.approvalId),\n status: enumLabel(ApprovalStatusCodec.protoToOutput, e.value.status),\n };\n case \"view\":\n return { type: \"view\" as const, view: formatView(e.value, scales) };\n case \"runCompleted\":\n return { type: \"run_completed\" as const, usage: formatUsage(e.value.usage) };\n case \"runFailed\":\n return {\n type: \"run_failed\" as const,\n category: enumLabel(FailureCategoryCodec.protoToOutput, e.value.category),\n message: e.value.message,\n usage: formatUsage(e.value.usage),\n };\n default:\n return { type: \"unspecified\" as const };\n }\n}\n\nexport function formatRunEvent(event: Proto.RunEvent, scales: SdkScales) {\n return {\n /** Position in the run, from 1. Pass the last one received as `afterSeq` to resume. */\n seq: Number(event.seq),\n createdAt: tsObjToMs(event.createdAt),\n ...formatEvent(event.event, scales),\n };\n}\n\n/** One run event. `type: \"unspecified\"` is an event this SDK build does not know: skip it. */\nexport type AssistantRunEvent = ReturnType<typeof formatRunEvent>;\n"],"mappings":";;;;;;;;;;;;;;;;AA6CA,MAAM,QAAQ,UAAkB,UAAU,eAAe,eAAe,KAAK;AAC7E,MAAM,OAAO,UAAkB,UAAU,iBAAiB,eAAe,KAAK;AAC9E,MAAM,gBAAgB,UAAkB,UAAU,wBAAwB,eAAe,KAAK;AAC9F,MAAM,aAAa,UAAkB,UAAU,sBAAsB,eAAe,KAAK;AAEzF,SAAS,YAAY,GAA4B;CAC7C,OAAO;EACH,aAAa,OAAO,GAAG,eAAe,EAAE;EACxC,cAAc,OAAO,GAAG,gBAAgB,EAAE;;EAE1C,mBAAmB,OAAO,GAAG,qBAAqB,EAAE;CACxD;AACJ;AAEA,SAAS,qBAAqB,GAAyB;CACnD,OAAO;EACH,OAAO,EAAE;EACT,QAAQ,UAAU,0BAA0B,eAAe,EAAE,MAAM;EACnE,YAAY,UAAU,EAAE,UAAU;CACtC;AACJ;AAEA,SAAS,oBAAoB,GA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Q;GACxE,SAAS,EAAE,MAAM;GACjB,OAAO,YAAY,EAAE,MAAM,KAAK;EACpC;EACJ,SACI,OAAO,EAAE,MAAM,cAAuB;CAC9C;AACJ;AAEA,SAAgB,eAAe,OAAuB,QAAmB;CACrE,OAAO;;EAEH,KAAK,OAAO,MAAM,GAAG;EACrB,WAAW,UAAU,MAAM,SAAS;EACpC,GAAG,YAAY,MAAM,OAAO,MAAM;CACtC;AACJ"}
@@ -23,8 +23,11 @@ declare const ASSISTANT_DISPLAY_SETTING_VALUES: readonly ["appearance", "languag
23
23
  type AssistantDisplaySetting = (typeof ASSISTANT_DISPLAY_SETTING_VALUES)[number];
24
24
  declare const ASSISTANT_MODEL_KEY_CHECK_VALUES: readonly ["valid", "rejected", "no_quota", "model_unavailable"];
25
25
  type AssistantModelKeyCheck = (typeof ASSISTANT_MODEL_KEY_CHECK_VALUES)[number];
26
- declare const ASSISTANT_FUNDING_MODE_VALUES: readonly ["credits", "own_key"];
27
- /** What pays for the caller's next messages: free daily `credits`, or their `own_key`. */
26
+ declare const ASSISTANT_FUNDING_MODE_VALUES: readonly ["credits", "own_key", "sponsored"];
27
+ /**
28
+ * What pays: free daily `credits`, the caller's `own_key`, or `sponsored` (Polyester pays; only a
29
+ * subagent's work, never a message).
30
+ */
28
31
  type AssistantFundingMode = (typeof ASSISTANT_FUNDING_MODE_VALUES)[number];
29
32
  declare const ASSISTANT_ACCOUNT_SELECTION_VALUES: readonly ["none"];
30
33
  /** `"none"`: the run reads no account and answers about the markets and Polyester only. */
@@ -1 +1 @@
1
- {"version":3,"file":"assistant.codecs.d.ts","names":[],"sources":["../../../src/services/assistant/assistant.codecs.ts"],"mappings":";;cAGa;KACD,+BAA+B;cAE9B;KAUD,mCAAmC;cAElC;KACD,oCAAoC;cAEnC;KAMD,kCAAkC;cAEjC;KACD,8BAA8B;cAE7B;KACD,4BAA4B;;;;;;;;cAS3B;KAUD,kCAAkC;cAEjC;KAMD,iCAAiC;cAEhC;;KAED,+BAA+B;cAE9B;;KAED,oCAAoC;cAQnC;;KAED,2BAA2B;KAgC3B;KACA;KACA;KAYA;KACA;KACA;KACA"}
1
+ {"version":3,"file":"assistant.codecs.d.ts","names":[],"sources":["../../../src/services/assistant/assistant.codecs.ts"],"mappings":";;cAGa;KACD,+BAA+B;cAE9B;KAUD,mCAAmC;cAElC;KACD,oCAAoC;cAEnC;KAMD,kCAAkC;cAEjC;KACD,8BAA8B;cAE7B;KACD,4BAA4B;;;;;;;;cAS3B;KAUD,kCAAkC;cAEjC;KAMD,iCAAiC;cAEhC;;;;;KAKD,+BAA+B;cAE9B;;KAED,oCAAoC;cAQnC;;KAED,2BAA2B;KAgC3B;KACA;KACA;KAYA;KACA;KACA;KACA"}
@@ -72,7 +72,15 @@ const ModelKeyCheckCodec = { protoToOutput: {
72
72
  const FundingModeCodec = { protoToOutput: {
73
73
  [0]: "credits",
74
74
  [1]: "credits",
75
- [2]: "own_key"
75
+ [2]: "own_key",
76
+ [3]: "sponsored"
77
+ } };
78
+ /** A subagent's funding: `"unspecified"` when the server did not say or sent a mode this build does not know. */
79
+ const SubagentFundingCodec = { protoToOutput: {
80
+ [0]: "unspecified",
81
+ [1]: "credits",
82
+ [2]: "own_key",
83
+ [3]: "sponsored"
76
84
  } };
77
85
  const ApprovalDecisionCodec = { inputToProto: {
78
86
  approve: 1,
@@ -143,6 +151,6 @@ const TriggerChangeActionCodec = { protoToOutput: {
143
151
  [3]: "resume"
144
152
  } };
145
153
  //#endregion
146
- export { ASSISTANT_ACCOUNT_SELECTION_VALUES, ASSISTANT_APPROVAL_DECISION_VALUES, ASSISTANT_DISPLAY_SETTING_VALUES, ASSISTANT_KEY_VIEW_VALUES, AccountSelectionCodec, ApprovalDecisionCodec, ApprovalStatusCodec, AssistantKeyStateCodec, AssistantKeyViewCodec, DisplaySettingCodec, FailureCategoryCodec, FundingModeCodec, MemoryKindCodec, MessageRoleCodec, ModelKeyCheckCodec, OrderPriceFieldCodec, PriceOffsetDirectionCodec, PriceRoundingCodec, ReferencePriceSourceCodec, TriggerChangeActionCodec, TriggerDirectionCodec, UnfilledSlicePolicyCodec };
154
+ export { ASSISTANT_ACCOUNT_SELECTION_VALUES, ASSISTANT_APPROVAL_DECISION_VALUES, ASSISTANT_DISPLAY_SETTING_VALUES, ASSISTANT_KEY_VIEW_VALUES, AccountSelectionCodec, ApprovalDecisionCodec, ApprovalStatusCodec, AssistantKeyStateCodec, AssistantKeyViewCodec, DisplaySettingCodec, FailureCategoryCodec, FundingModeCodec, MemoryKindCodec, MessageRoleCodec, ModelKeyCheckCodec, OrderPriceFieldCodec, PriceOffsetDirectionCodec, PriceRoundingCodec, ReferencePriceSourceCodec, SubagentFundingCodec, TriggerChangeActionCodec, TriggerDirectionCodec, UnfilledSlicePolicyCodec };
147
155
 
148
156
  //# sourceMappingURL=assistant.codecs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"assistant.codecs.js","names":[],"sources":["../../../src/services/assistant/assistant.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const ASSISTANT_MESSAGE_ROLE_VALUES = [\"user\", \"assistant\"] as const;\nexport type AssistantMessageRole = (typeof ASSISTANT_MESSAGE_ROLE_VALUES)[number];\n\nexport const ASSISTANT_FAILURE_CATEGORY_VALUES = [\n \"canceled\",\n \"budget_exceeded\",\n \"permission_denied\",\n \"model_unavailable\",\n \"unexpected_error\",\n \"model_key_refused\",\n \"daily_limit_reached\",\n \"assistant_paused\",\n] as const;\nexport type AssistantFailureCategory = (typeof ASSISTANT_FAILURE_CATEGORY_VALUES)[number];\n\nexport const ASSISTANT_APPROVAL_DECISION_VALUES = [\"approve\", \"reject\"] as const;\nexport type AssistantApprovalDecision = (typeof ASSISTANT_APPROVAL_DECISION_VALUES)[number];\n\nexport const ASSISTANT_APPROVAL_STATUS_VALUES = [\n \"pending\",\n \"approved\",\n \"rejected\",\n \"expired\",\n] as const;\nexport type AssistantApprovalStatus = (typeof ASSISTANT_APPROVAL_STATUS_VALUES)[number];\n\nexport const ASSISTANT_MEMORY_KIND_VALUES = [\"fact\", \"planning_figure\", \"profile\"] as const;\nexport type AssistantMemoryKind = (typeof ASSISTANT_MEMORY_KIND_VALUES)[number];\n\nexport const ASSISTANT_KEY_STATE_VALUES = [\"active\", \"disabled\"] as const;\nexport type AssistantKeyState = (typeof ASSISTANT_KEY_STATE_VALUES)[number];\n\n/**\n * Display preferences a client lets the assistant change: `appearance` (`light`, `dark`,\n * `system`), `language` (`en`, `fr`, `zh-CN`), `currency` (a fiat code such as `EUR`),\n * `date_format` (a pattern such as `yyyy-MM-dd`), `time_format` (`12h`, `24h`), `number_format`\n * (`US`, `EU`, `SPACE`, `CH`, `IN`, `NONE`), `week_start` (`0` Sunday to `6` Saturday) and\n * `sounds` (`on`, `off`).\n */\nexport const ASSISTANT_DISPLAY_SETTING_VALUES = [\n \"appearance\",\n \"language\",\n \"currency\",\n \"date_format\",\n \"time_format\",\n \"number_format\",\n \"week_start\",\n \"sounds\",\n] as const;\nexport type AssistantDisplaySetting = (typeof ASSISTANT_DISPLAY_SETTING_VALUES)[number];\n\nexport const ASSISTANT_MODEL_KEY_CHECK_VALUES = [\n \"valid\",\n \"rejected\",\n \"no_quota\",\n \"model_unavailable\",\n] as const;\nexport type AssistantModelKeyCheck = (typeof ASSISTANT_MODEL_KEY_CHECK_VALUES)[number];\n\nexport const ASSISTANT_FUNDING_MODE_VALUES = [\"credits\", \"own_key\"] as const;\n/** What pays for the caller's next messages: free daily `credits`, or their `own_key`. */\nexport type AssistantFundingMode = (typeof ASSISTANT_FUNDING_MODE_VALUES)[number];\n\nexport const ASSISTANT_ACCOUNT_SELECTION_VALUES = [\"none\"] as const;\n/** `\"none\"`: the run reads no account and answers about the markets and Polyester only. */\nexport type AssistantAccountSelection = (typeof ASSISTANT_ACCOUNT_SELECTION_VALUES)[number];\n\nexport const AccountSelectionCodec = {\n inputToProto: {\n none: Proto.AccountSelection.NONE,\n } satisfies InputToProto<AssistantAccountSelection, Proto.AccountSelection>,\n} as const;\n\nexport const ASSISTANT_KEY_VIEW_VALUES = [\"full\"] as const;\n/** `\"full\"` adds each key's account name (`label`). */\nexport type AssistantKeyView = (typeof ASSISTANT_KEY_VIEW_VALUES)[number];\n\nexport const AssistantKeyViewCodec = {\n inputToProto: {\n full: Proto.AssistantKeyView.FULL,\n } satisfies InputToProto<AssistantKeyView, Proto.AssistantKeyView>,\n} as const;\n\nexport const DisplaySettingCodec = {\n inputToProto: {\n appearance: Proto.DisplaySetting.APPEARANCE,\n language: Proto.DisplaySetting.LANGUAGE,\n currency: Proto.DisplaySetting.CURRENCY,\n date_format: Proto.DisplaySetting.DATE_FORMAT,\n time_format: Proto.DisplaySetting.TIME_FORMAT,\n number_format: Proto.DisplaySetting.NUMBER_FORMAT,\n week_start: Proto.DisplaySetting.WEEK_START,\n sounds: Proto.DisplaySetting.SOUNDS,\n } satisfies InputToProto<AssistantDisplaySetting, Proto.DisplaySetting>,\n protoToOutput: {\n [Proto.DisplaySetting.SETTING_UNSPECIFIED]: \"unspecified\",\n [Proto.DisplaySetting.APPEARANCE]: \"appearance\",\n [Proto.DisplaySetting.LANGUAGE]: \"language\",\n [Proto.DisplaySetting.CURRENCY]: \"currency\",\n [Proto.DisplaySetting.DATE_FORMAT]: \"date_format\",\n [Proto.DisplaySetting.TIME_FORMAT]: \"time_format\",\n [Proto.DisplaySetting.NUMBER_FORMAT]: \"number_format\",\n [Proto.DisplaySetting.WEEK_START]: \"week_start\",\n [Proto.DisplaySetting.SOUNDS]: \"sounds\",\n } satisfies ProtoToOutput<Proto.DisplaySetting, AssistantDisplaySetting>,\n} as const;\n\nexport type AssistantReferencePriceSource = \"best_bid\" | \"best_ask\" | \"last_price\" | \"index_price\";\nexport type AssistantTriggerDirection = \"at_or_above\" | \"at_or_below\";\nexport type AssistantOrderPriceField =\n | \"limit_price\"\n | \"trigger_price\"\n | \"activation_price\"\n | \"ladder_low_price\"\n | \"ladder_high_price\"\n | \"take_profit_trigger_price\"\n | \"take_profit_limit_price\"\n | \"stop_loss_trigger_price\"\n | \"stop_loss_limit_price\"\n | \"trailing_stop_activation_price\"\n | \"trailing_stop_limit_price\";\nexport type AssistantPriceOffsetDirection = \"above\" | \"below\";\nexport type AssistantPriceRounding = \"down\" | \"up\";\nexport type AssistantUnfilledSlicePolicy = \"cancel_before_next\";\nexport type AssistantTriggerChangeAction = \"modify\" | \"pause\" | \"resume\";\n\nexport const MessageRoleCodec = {\n protoToOutput: {\n [Proto.MessageRole.ROLE_UNSPECIFIED]: \"unspecified\",\n [Proto.MessageRole.USER]: \"user\",\n [Proto.MessageRole.ASSISTANT]: \"assistant\",\n } satisfies ProtoToOutput<Proto.MessageRole, AssistantMessageRole>,\n} as const;\n\nexport const FailureCategoryCodec = {\n protoToOutput: {\n [Proto.FailureCategory.FAILURE_UNSPECIFIED]: \"unspecified\",\n [Proto.FailureCategory.CANCELLED]: \"canceled\",\n [Proto.FailureCategory.BUDGET_EXCEEDED]: \"budget_exceeded\",\n [Proto.FailureCategory.PERMISSION_DENIED]: \"permission_denied\",\n [Proto.FailureCategory.MODEL_UNAVAILABLE]: \"model_unavailable\",\n [Proto.FailureCategory.UNEXPECTED_ERROR]: \"unexpected_error\",\n [Proto.FailureCategory.MODEL_KEY_REFUSED]: \"model_key_refused\",\n [Proto.FailureCategory.DAILY_LIMIT_REACHED]: \"daily_limit_reached\",\n [Proto.FailureCategory.ASSISTANT_PAUSED]: \"assistant_paused\",\n } satisfies ProtoToOutput<Proto.FailureCategory, AssistantFailureCategory>,\n} as const;\n\nexport const ModelKeyCheckCodec = {\n protoToOutput: {\n [Proto.ModelKeyCheck.KEY_CHECK_UNSPECIFIED]: \"unspecified\",\n [Proto.ModelKeyCheck.KEY_VALID]: \"valid\",\n [Proto.ModelKeyCheck.KEY_REJECTED]: \"rejected\",\n [Proto.ModelKeyCheck.KEY_NO_QUOTA]: \"no_quota\",\n [Proto.ModelKeyCheck.KEY_MODEL_UNAVAILABLE]: \"model_unavailable\",\n } satisfies ProtoToOutput<Proto.ModelKeyCheck, AssistantModelKeyCheck>,\n} as const;\n\n/** The contract says to read a mode this build does not know as `credits`. */\nexport const FundingModeCodec = {\n protoToOutput: {\n [Proto.FundingMode.FUNDING_UNSPECIFIED]: \"credits\",\n [Proto.FundingMode.CREDITS]: \"credits\",\n [Proto.FundingMode.OWN_KEY]: \"own_key\",\n } satisfies ProtoToOutput<Proto.FundingMode, AssistantFundingMode>,\n} as const;\n\nexport const ApprovalDecisionCodec = {\n inputToProto: {\n approve: Proto.ApprovalDecision.APPROVE,\n reject: Proto.ApprovalDecision.REJECT,\n } satisfies InputToProto<AssistantApprovalDecision, Proto.ApprovalDecision>,\n} as const;\n\nexport const ApprovalStatusCodec = {\n protoToOutput: {\n [Proto.ApprovalStatus.APPROVAL_UNSPECIFIED]: \"unspecified\",\n [Proto.ApprovalStatus.PENDING]: \"pending\",\n [Proto.ApprovalStatus.APPROVED]: \"approved\",\n [Proto.ApprovalStatus.REJECTED]: \"rejected\",\n [Proto.ApprovalStatus.EXPIRED]: \"expired\",\n } satisfies ProtoToOutput<Proto.ApprovalStatus, AssistantApprovalStatus>,\n} as const;\n\nexport const MemoryKindCodec = {\n protoToOutput: {\n [Proto.MemoryKind.KIND_UNSPECIFIED]: \"unspecified\",\n [Proto.MemoryKind.FACT]: \"fact\",\n [Proto.MemoryKind.PLANNING_FIGURE]: \"planning_figure\",\n [Proto.MemoryKind.PROFILE]: \"profile\",\n } satisfies ProtoToOutput<Proto.MemoryKind, AssistantMemoryKind>,\n} as const;\n\nexport const AssistantKeyStateCodec = {\n protoToOutput: {\n [Proto.AssistantKeyState.KEY_STATE_UNSPECIFIED]: \"unspecified\",\n [Proto.AssistantKeyState.ACTIVE]: \"active\",\n [Proto.AssistantKeyState.DISABLED]: \"disabled\",\n } satisfies ProtoToOutput<Proto.AssistantKeyState, AssistantKeyState>,\n} as const;\n\nexport const ReferencePriceSourceCodec = {\n protoToOutput: {\n [Proto.ReferencePriceSource.PRICE_SOURCE_UNSPECIFIED]: \"unspecified\",\n [Proto.ReferencePriceSource.BEST_BID]: \"best_bid\",\n [Proto.ReferencePriceSource.BEST_ASK]: \"best_ask\",\n [Proto.ReferencePriceSource.LAST_PRICE]: \"last_price\",\n [Proto.ReferencePriceSource.INDEX_PRICE]: \"index_price\",\n } satisfies ProtoToOutput<Proto.ReferencePriceSource, AssistantReferencePriceSource>,\n} as const;\n\nexport const TriggerDirectionCodec = {\n protoToOutput: {\n [Proto.TriggerDirection.DIRECTION_UNSPECIFIED]: \"unspecified\",\n [Proto.TriggerDirection.AT_OR_ABOVE]: \"at_or_above\",\n [Proto.TriggerDirection.AT_OR_BELOW]: \"at_or_below\",\n } satisfies ProtoToOutput<Proto.TriggerDirection, AssistantTriggerDirection>,\n} as const;\n\nexport const OrderPriceFieldCodec = {\n protoToOutput: {\n [Proto.OrderPriceField.PRICE_FIELD_UNSPECIFIED]: \"unspecified\",\n [Proto.OrderPriceField.LIMIT_PRICE]: \"limit_price\",\n [Proto.OrderPriceField.TRIGGER_PRICE]: \"trigger_price\",\n [Proto.OrderPriceField.ACTIVATION_PRICE]: \"activation_price\",\n [Proto.OrderPriceField.LADDER_LOW_PRICE]: \"ladder_low_price\",\n [Proto.OrderPriceField.LADDER_HIGH_PRICE]: \"ladder_high_price\",\n [Proto.OrderPriceField.TAKE_PROFIT_TRIGGER_PRICE]: \"take_profit_trigger_price\",\n [Proto.OrderPriceField.TAKE_PROFIT_LIMIT_PRICE]: \"take_profit_limit_price\",\n [Proto.OrderPriceField.STOP_LOSS_TRIGGER_PRICE]: \"stop_loss_trigger_price\",\n [Proto.OrderPriceField.STOP_LOSS_LIMIT_PRICE]: \"stop_loss_limit_price\",\n [Proto.OrderPriceField.TRAILING_STOP_ACTIVATION_PRICE]: \"trailing_stop_activation_price\",\n [Proto.OrderPriceField.TRAILING_STOP_LIMIT_PRICE]: \"trailing_stop_limit_price\",\n } satisfies ProtoToOutput<Proto.OrderPriceField, AssistantOrderPriceField>,\n} as const;\n\nexport const PriceOffsetDirectionCodec = {\n protoToOutput: {\n [Proto.PriceOffsetDirection.OFFSET_DIRECTION_UNSPECIFIED]: \"unspecified\",\n [Proto.PriceOffsetDirection.ABOVE]: \"above\",\n [Proto.PriceOffsetDirection.BELOW]: \"below\",\n } satisfies ProtoToOutput<Proto.PriceOffsetDirection, AssistantPriceOffsetDirection>,\n} as const;\n\nexport const PriceRoundingCodec = {\n protoToOutput: {\n [Proto.PriceRounding.ROUNDING_UNSPECIFIED]: \"unspecified\",\n [Proto.PriceRounding.DOWN]: \"down\",\n [Proto.PriceRounding.UP]: \"up\",\n } satisfies ProtoToOutput<Proto.PriceRounding, AssistantPriceRounding>,\n} as const;\n\nexport const UnfilledSlicePolicyCodec = {\n protoToOutput: {\n [Proto.UnfilledSlicePolicy.UNFILLED_SLICE_UNSPECIFIED]: \"unspecified\",\n [Proto.UnfilledSlicePolicy.CANCEL_BEFORE_NEXT]: \"cancel_before_next\",\n } satisfies ProtoToOutput<Proto.UnfilledSlicePolicy, AssistantUnfilledSlicePolicy>,\n} as const;\n\nexport const TriggerChangeActionCodec = {\n protoToOutput: {\n [Proto.TriggerChangeAction.TRIGGER_CHANGE_UNSPECIFIED]: \"unspecified\",\n [Proto.TriggerChangeAction.MODIFY]: \"modify\",\n [Proto.TriggerChangeAction.PAUSE]: \"pause\",\n [Proto.TriggerChangeAction.RESUME]: \"resume\",\n } satisfies ProtoToOutput<Proto.TriggerChangeAction, AssistantTriggerChangeAction>,\n} as const;\n"],"mappings":";;AAkBA,MAAa,qCAAqC,CAAC,WAAW,QAAQ;;;;;;;;AAwBtE,MAAa,mCAAmC;CAC5C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAeA,MAAa,qCAAqC,CAAC,MAAM;AAIzD,MAAa,wBAAwB,EACjC,cAAc,EACV,MAAA,EACJ,EACJ;AAEA,MAAa,4BAA4B,CAAC,MAAM;A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EACJ;AAEA,MAAa,uBAAuB,EAChC,eAAe;EACsC,IAAA;EACZ,IAAA;EACE,IAAA;EACG,IAAA;EACA,IAAA;EACC,IAAA;EACQ,IAAA;EACF,IAAA;EACA,IAAA;EACF,IAAA;EACS,KAAA;EACL,KAAA;AACvD,EACJ;AAEA,MAAa,4BAA4B,EACrC,eAAe;EACgD,IAAA;EACvB,IAAA;EACA,IAAA;AACxC,EACJ;AAEA,MAAa,qBAAqB,EAC9B,eAAe;EACiC,IAAA;EAChB,IAAA;EACF,IAAA;AAC9B,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC6C,IAAA;EACR,IAAA;AACpD,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC6C,IAAA;EACpB,IAAA;EACD,IAAA;EACC,IAAA;AACxC,EACJ"}
1
+ {"version":3,"file":"assistant.codecs.js","names":[],"sources":["../../../src/services/assistant/assistant.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const ASSISTANT_MESSAGE_ROLE_VALUES = [\"user\", \"assistant\"] as const;\nexport type AssistantMessageRole = (typeof ASSISTANT_MESSAGE_ROLE_VALUES)[number];\n\nexport const ASSISTANT_FAILURE_CATEGORY_VALUES = [\n \"canceled\",\n \"budget_exceeded\",\n \"permission_denied\",\n \"model_unavailable\",\n \"unexpected_error\",\n \"model_key_refused\",\n \"daily_limit_reached\",\n \"assistant_paused\",\n] as const;\nexport type AssistantFailureCategory = (typeof ASSISTANT_FAILURE_CATEGORY_VALUES)[number];\n\nexport const ASSISTANT_APPROVAL_DECISION_VALUES = [\"approve\", \"reject\"] as const;\nexport type AssistantApprovalDecision = (typeof ASSISTANT_APPROVAL_DECISION_VALUES)[number];\n\nexport const ASSISTANT_APPROVAL_STATUS_VALUES = [\n \"pending\",\n \"approved\",\n \"rejected\",\n \"expired\",\n] as const;\nexport type AssistantApprovalStatus = (typeof ASSISTANT_APPROVAL_STATUS_VALUES)[number];\n\nexport const ASSISTANT_MEMORY_KIND_VALUES = [\"fact\", \"planning_figure\", \"profile\"] as const;\nexport type AssistantMemoryKind = (typeof ASSISTANT_MEMORY_KIND_VALUES)[number];\n\nexport const ASSISTANT_KEY_STATE_VALUES = [\"active\", \"disabled\"] as const;\nexport type AssistantKeyState = (typeof ASSISTANT_KEY_STATE_VALUES)[number];\n\n/**\n * Display preferences a client lets the assistant change: `appearance` (`light`, `dark`,\n * `system`), `language` (`en`, `fr`, `zh-CN`), `currency` (a fiat code such as `EUR`),\n * `date_format` (a pattern such as `yyyy-MM-dd`), `time_format` (`12h`, `24h`), `number_format`\n * (`US`, `EU`, `SPACE`, `CH`, `IN`, `NONE`), `week_start` (`0` Sunday to `6` Saturday) and\n * `sounds` (`on`, `off`).\n */\nexport const ASSISTANT_DISPLAY_SETTING_VALUES = [\n \"appearance\",\n \"language\",\n \"currency\",\n \"date_format\",\n \"time_format\",\n \"number_format\",\n \"week_start\",\n \"sounds\",\n] as const;\nexport type AssistantDisplaySetting = (typeof ASSISTANT_DISPLAY_SETTING_VALUES)[number];\n\nexport const ASSISTANT_MODEL_KEY_CHECK_VALUES = [\n \"valid\",\n \"rejected\",\n \"no_quota\",\n \"model_unavailable\",\n] as const;\nexport type AssistantModelKeyCheck = (typeof ASSISTANT_MODEL_KEY_CHECK_VALUES)[number];\n\nexport const ASSISTANT_FUNDING_MODE_VALUES = [\"credits\", \"own_key\", \"sponsored\"] as const;\n/**\n * What pays: free daily `credits`, the caller's `own_key`, or `sponsored` (Polyester pays; only a\n * subagent's work, never a message).\n */\nexport type AssistantFundingMode = (typeof ASSISTANT_FUNDING_MODE_VALUES)[number];\n\nexport const ASSISTANT_ACCOUNT_SELECTION_VALUES = [\"none\"] as const;\n/** `\"none\"`: the run reads no account and answers about the markets and Polyester only. */\nexport type AssistantAccountSelection = (typeof ASSISTANT_ACCOUNT_SELECTION_VALUES)[number];\n\nexport const AccountSelectionCodec = {\n inputToProto: {\n none: Proto.AccountSelection.NONE,\n } satisfies InputToProto<AssistantAccountSelection, Proto.AccountSelection>,\n} as const;\n\nexport const ASSISTANT_KEY_VIEW_VALUES = [\"full\"] as const;\n/** `\"full\"` adds each key's account name (`label`). */\nexport type AssistantKeyView = (typeof ASSISTANT_KEY_VIEW_VALUES)[number];\n\nexport const AssistantKeyViewCodec = {\n inputToProto: {\n full: Proto.AssistantKeyView.FULL,\n } satisfies InputToProto<AssistantKeyView, Proto.AssistantKeyView>,\n} as const;\n\nexport const DisplaySettingCodec = {\n inputToProto: {\n appearance: Proto.DisplaySetting.APPEARANCE,\n language: Proto.DisplaySetting.LANGUAGE,\n currency: Proto.DisplaySetting.CURRENCY,\n date_format: Proto.DisplaySetting.DATE_FORMAT,\n time_format: Proto.DisplaySetting.TIME_FORMAT,\n number_format: Proto.DisplaySetting.NUMBER_FORMAT,\n week_start: Proto.DisplaySetting.WEEK_START,\n sounds: Proto.DisplaySetting.SOUNDS,\n } satisfies InputToProto<AssistantDisplaySetting, Proto.DisplaySetting>,\n protoToOutput: {\n [Proto.DisplaySetting.SETTING_UNSPECIFIED]: \"unspecified\",\n [Proto.DisplaySetting.APPEARANCE]: \"appearance\",\n [Proto.DisplaySetting.LANGUAGE]: \"language\",\n [Proto.DisplaySetting.CURRENCY]: \"currency\",\n [Proto.DisplaySetting.DATE_FORMAT]: \"date_format\",\n [Proto.DisplaySetting.TIME_FORMAT]: \"time_format\",\n [Proto.DisplaySetting.NUMBER_FORMAT]: \"number_format\",\n [Proto.DisplaySetting.WEEK_START]: \"week_start\",\n [Proto.DisplaySetting.SOUNDS]: \"sounds\",\n } satisfies ProtoToOutput<Proto.DisplaySetting, AssistantDisplaySetting>,\n} as const;\n\nexport type AssistantReferencePriceSource = \"best_bid\" | \"best_ask\" | \"last_price\" | \"index_price\";\nexport type AssistantTriggerDirection = \"at_or_above\" | \"at_or_below\";\nexport type AssistantOrderPriceField =\n | \"limit_price\"\n | \"trigger_price\"\n | \"activation_price\"\n | \"ladder_low_price\"\n | \"ladder_high_price\"\n | \"take_profit_trigger_price\"\n | \"take_profit_limit_price\"\n | \"stop_loss_trigger_price\"\n | \"stop_loss_limit_price\"\n | \"trailing_stop_activation_price\"\n | \"trailing_stop_limit_price\";\nexport type AssistantPriceOffsetDirection = \"above\" | \"below\";\nexport type AssistantPriceRounding = \"down\" | \"up\";\nexport type AssistantUnfilledSlicePolicy = \"cancel_before_next\";\nexport type AssistantTriggerChangeAction = \"modify\" | \"pause\" | \"resume\";\n\nexport const MessageRoleCodec = {\n protoToOutput: {\n [Proto.MessageRole.ROLE_UNSPECIFIED]: \"unspecified\",\n [Proto.MessageRole.USER]: \"user\",\n [Proto.MessageRole.ASSISTANT]: \"assistant\",\n } satisfies ProtoToOutput<Proto.MessageRole, AssistantMessageRole>,\n} as const;\n\nexport const FailureCategoryCodec = {\n protoToOutput: {\n [Proto.FailureCategory.FAILURE_UNSPECIFIED]: \"unspecified\",\n [Proto.FailureCategory.CANCELLED]: \"canceled\",\n [Proto.FailureCategory.BUDGET_EXCEEDED]: \"budget_exceeded\",\n [Proto.FailureCategory.PERMISSION_DENIED]: \"permission_denied\",\n [Proto.FailureCategory.MODEL_UNAVAILABLE]: \"model_unavailable\",\n [Proto.FailureCategory.UNEXPECTED_ERROR]: \"unexpected_error\",\n [Proto.FailureCategory.MODEL_KEY_REFUSED]: \"model_key_refused\",\n [Proto.FailureCategory.DAILY_LIMIT_REACHED]: \"daily_limit_reached\",\n [Proto.FailureCategory.ASSISTANT_PAUSED]: \"assistant_paused\",\n } satisfies ProtoToOutput<Proto.FailureCategory, AssistantFailureCategory>,\n} as const;\n\nexport const ModelKeyCheckCodec = {\n protoToOutput: {\n [Proto.ModelKeyCheck.KEY_CHECK_UNSPECIFIED]: \"unspecified\",\n [Proto.ModelKeyCheck.KEY_VALID]: \"valid\",\n [Proto.ModelKeyCheck.KEY_REJECTED]: \"rejected\",\n [Proto.ModelKeyCheck.KEY_NO_QUOTA]: \"no_quota\",\n [Proto.ModelKeyCheck.KEY_MODEL_UNAVAILABLE]: \"model_unavailable\",\n } satisfies ProtoToOutput<Proto.ModelKeyCheck, AssistantModelKeyCheck>,\n} as const;\n\n/** The contract says to read a mode this build does not know as `credits`. */\nexport const FundingModeCodec = {\n protoToOutput: {\n [Proto.FundingMode.FUNDING_UNSPECIFIED]: \"credits\",\n [Proto.FundingMode.CREDITS]: \"credits\",\n [Proto.FundingMode.OWN_KEY]: \"own_key\",\n [Proto.FundingMode.SPONSORED]: \"sponsored\",\n } satisfies ProtoToOutput<Proto.FundingMode, AssistantFundingMode>,\n} as const;\n\n/** A subagent's funding: `\"unspecified\"` when the server did not say or sent a mode this build does not know. */\nexport const SubagentFundingCodec = {\n protoToOutput: {\n [Proto.FundingMode.FUNDING_UNSPECIFIED]: \"unspecified\",\n [Proto.FundingMode.CREDITS]: \"credits\",\n [Proto.FundingMode.OWN_KEY]: \"own_key\",\n [Proto.FundingMode.SPONSORED]: \"sponsored\",\n } satisfies ProtoToOutput<Proto.FundingMode, AssistantFundingMode>,\n} as const;\n\nexport const ApprovalDecisionCodec = {\n inputToProto: {\n approve: Proto.ApprovalDecision.APPROVE,\n reject: Proto.ApprovalDecision.REJECT,\n } satisfies InputToProto<AssistantApprovalDecision, Proto.ApprovalDecision>,\n} as const;\n\nexport const ApprovalStatusCodec = {\n protoToOutput: {\n [Proto.ApprovalStatus.APPROVAL_UNSPECIFIED]: \"unspecified\",\n [Proto.ApprovalStatus.PENDING]: \"pending\",\n [Proto.ApprovalStatus.APPROVED]: \"approved\",\n [Proto.ApprovalStatus.REJECTED]: \"rejected\",\n [Proto.ApprovalStatus.EXPIRED]: \"expired\",\n } satisfies ProtoToOutput<Proto.ApprovalStatus, AssistantApprovalStatus>,\n} as const;\n\nexport const MemoryKindCodec = {\n protoToOutput: {\n [Proto.MemoryKind.KIND_UNSPECIFIED]: \"unspecified\",\n [Proto.MemoryKind.FACT]: \"fact\",\n [Proto.MemoryKind.PLANNING_FIGURE]: \"planning_figure\",\n [Proto.MemoryKind.PROFILE]: \"profile\",\n } satisfies ProtoToOutput<Proto.MemoryKind, AssistantMemoryKind>,\n} as const;\n\nexport const AssistantKeyStateCodec = {\n protoToOutput: {\n [Proto.AssistantKeyState.KEY_STATE_UNSPECIFIED]: \"unspecified\",\n [Proto.AssistantKeyState.ACTIVE]: \"active\",\n [Proto.AssistantKeyState.DISABLED]: \"disabled\",\n } satisfies ProtoToOutput<Proto.AssistantKeyState, AssistantKeyState>,\n} as const;\n\nexport const ReferencePriceSourceCodec = {\n protoToOutput: {\n [Proto.ReferencePriceSource.PRICE_SOURCE_UNSPECIFIED]: \"unspecified\",\n [Proto.ReferencePriceSource.BEST_BID]: \"best_bid\",\n [Proto.ReferencePriceSource.BEST_ASK]: \"best_ask\",\n [Proto.ReferencePriceSource.LAST_PRICE]: \"last_price\",\n [Proto.ReferencePriceSource.INDEX_PRICE]: \"index_price\",\n } satisfies ProtoToOutput<Proto.ReferencePriceSource, AssistantReferencePriceSource>,\n} as const;\n\nexport const TriggerDirectionCodec = {\n protoToOutput: {\n [Proto.TriggerDirection.DIRECTION_UNSPECIFIED]: \"unspecified\",\n [Proto.TriggerDirection.AT_OR_ABOVE]: \"at_or_above\",\n [Proto.TriggerDirection.AT_OR_BELOW]: \"at_or_below\",\n } satisfies ProtoToOutput<Proto.TriggerDirection, AssistantTriggerDirection>,\n} as const;\n\nexport const OrderPriceFieldCodec = {\n protoToOutput: {\n [Proto.OrderPriceField.PRICE_FIELD_UNSPECIFIED]: \"unspecified\",\n [Proto.OrderPriceField.LIMIT_PRICE]: \"limit_price\",\n [Proto.OrderPriceField.TRIGGER_PRICE]: \"trigger_price\",\n [Proto.OrderPriceField.ACTIVATION_PRICE]: \"activation_price\",\n [Proto.OrderPriceField.LADDER_LOW_PRICE]: \"ladder_low_price\",\n [Proto.OrderPriceField.LADDER_HIGH_PRICE]: \"ladder_high_price\",\n [Proto.OrderPriceField.TAKE_PROFIT_TRIGGER_PRICE]: \"take_profit_trigger_price\",\n [Proto.OrderPriceField.TAKE_PROFIT_LIMIT_PRICE]: \"take_profit_limit_price\",\n [Proto.OrderPriceField.STOP_LOSS_TRIGGER_PRICE]: \"stop_loss_trigger_price\",\n [Proto.OrderPriceField.STOP_LOSS_LIMIT_PRICE]: \"stop_loss_limit_price\",\n [Proto.OrderPriceField.TRAILING_STOP_ACTIVATION_PRICE]: \"trailing_stop_activation_price\",\n [Proto.OrderPriceField.TRAILING_STOP_LIMIT_PRICE]: \"trailing_stop_limit_price\",\n } satisfies ProtoToOutput<Proto.OrderPriceField, AssistantOrderPriceField>,\n} as const;\n\nexport const PriceOffsetDirectionCodec = {\n protoToOutput: {\n [Proto.PriceOffsetDirection.OFFSET_DIRECTION_UNSPECIFIED]: \"unspecified\",\n [Proto.PriceOffsetDirection.ABOVE]: \"above\",\n [Proto.PriceOffsetDirection.BELOW]: \"below\",\n } satisfies ProtoToOutput<Proto.PriceOffsetDirection, AssistantPriceOffsetDirection>,\n} as const;\n\nexport const PriceRoundingCodec = {\n protoToOutput: {\n [Proto.PriceRounding.ROUNDING_UNSPECIFIED]: \"unspecified\",\n [Proto.PriceRounding.DOWN]: \"down\",\n [Proto.PriceRounding.UP]: \"up\",\n } satisfies ProtoToOutput<Proto.PriceRounding, AssistantPriceRounding>,\n} as const;\n\nexport const UnfilledSlicePolicyCodec = {\n protoToOutput: {\n [Proto.UnfilledSlicePolicy.UNFILLED_SLICE_UNSPECIFIED]: \"unspecified\",\n [Proto.UnfilledSlicePolicy.CANCEL_BEFORE_NEXT]: \"cancel_before_next\",\n } satisfies ProtoToOutput<Proto.UnfilledSlicePolicy, AssistantUnfilledSlicePolicy>,\n} as const;\n\nexport const TriggerChangeActionCodec = {\n protoToOutput: {\n [Proto.TriggerChangeAction.TRIGGER_CHANGE_UNSPECIFIED]: \"unspecified\",\n [Proto.TriggerChangeAction.MODIFY]: \"modify\",\n [Proto.TriggerChangeAction.PAUSE]: \"pause\",\n [Proto.TriggerChangeAction.RESUME]: \"resume\",\n } satisfies ProtoToOutput<Proto.TriggerChangeAction, AssistantTriggerChangeAction>,\n} as const;\n"],"mappings":";;AAkBA,MAAa,qCAAqC,CAAC,WAAW,QAAQ;;;;;;;;AAwBtE,MAAa,mCAAmC;CAC5C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAkBA,MAAa,qCAAqC,CAAC,MAAM;AAIzD,MAAa,wBAAwB,EACjC,cAAc,EACV,MAAA,EACJ,EACJ;AAEA,MAAa,4BAA4B,CAAC,MAAM;AAIhD,MAAa,wBAAwB,EACjC,cAAc,EACV,MAAA,EACJ,EACJ;AAEA,MAAa,sBAAsB;CAC/B,cAAc;EACV,YAAA;EACA,UAAA;EACA,UAAA;EACA,aAAA;EACA,aAAA;EACA,eAAA;EACA,YAAA;EACA,QAAA;CACJ;CACA,eAAe;GACiC,IAAA;GACT,IAAA;GACF,IAAA;GACA,IAAA;GACG,IAAA;GACA,IAAA;GACE,IAAA;GACH,IAAA;GACJ,IAAA;CACnC;AACJ;AAqBA,MAAa,mBAAmB,EAC5B,eAAe;EAC2B,IAAA;EACZ,IAAA;EACK,IAAA;AACnC,EACJ;AAEA,MAAa,uBAAuB,EAChC,eAAe;EACkC,IAAA;EACV,IAAA;EACM,IAAA;EACE,IAAA;EACA,IAAA;EACD,IAAA;EACC,IAAA;EACE,IAAA;EACH,IAAA;AAC9C,EACJ;AAEA,MAAa,qBAAqB,EAC9B,eAAe;EACkC,IAAA;EACZ,IAAA;EACG,IAAA;EACA,IAAA;EACS,IAAA;AACjD,EACJ;;AAGA,MAAa,mBAAmB,EAC5B,eAAe;EAC8B,IAAA;EACZ,IAAA;EACA,IAAA;EACE,IAAA;AACnC,EACJ;;AAGA,MAAa,uBAAuB,EAChC,eAAe;EAC8B,IAAA;EACZ,IAAA;EACA,IAAA;EACE,IAAA;AACnC,EACJ;AAEA,MAAa,wBAAwB,EACjC,cAAc;CACV,SAAA;CACA,QAAA;AACJ,EACJ;AAEA,MAAa,sBAAsB,EAC/B,eAAe;EACkC,IAAA;EACb,IAAA;EACC,IAAA;EACA,IAAA;EACD,IAAA;AACpC,EACJ;AAEA,MAAa,kBAAkB,EAC3B,eAAe;EAC0B,IAAA;EACZ,IAAA;EACW,IAAA;EACR,IAAA;AAChC,EACJ;AAEA,MAAa,yBAAyB,EAClC,eAAe;EACsC,IAAA;EACf,IAAA;EACE,IAAA;AACxC,EACJ;AAEA,MAAa,4BAA4B,EACrC,eAAe;EAC4C,IAAA;EAChB,IAAA;EACA,IAAA;EACE,IAAA;EACC,IAAA;AAC9C,EACJ;AAEA,MAAa,wBAAwB,EACjC,eAAe;EACqC,IAAA;EACV,IAAA;EACA,IAAA;AAC1C,EACJ;AAEA,MAAa,uBAAuB,EAChC,eAAe;EACsC,IAAA;EACZ,IAAA;EACE,IAAA;EACG,IAAA;EACA,IAAA;EACC,IAAA;EACQ,IAAA;EACF,IAAA;EACA,IAAA;EACF,IAAA;EACS,KAAA;EACL,KAAA;AACvD,EACJ;AAEA,MAAa,4BAA4B,EACrC,eAAe;EACgD,IAAA;EACvB,IAAA;EACA,IAAA;AACxC,EACJ;AAEA,MAAa,qBAAqB,EAC9B,eAAe;EACiC,IAAA;EAChB,IAAA;EACF,IAAA;AAC9B,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC6C,IAAA;EACR,IAAA;AACpD,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC6C,IAAA;EACpB,IAAA;EACD,IAAA;EACC,IAAA;AACxC,EACJ"}
@@ -302,14 +302,14 @@ declare function formatModelKey(k: ModelKey | undefined): {
302
302
  suffix: string;
303
303
  addedAt: number | undefined;
304
304
  /** The last check with OpenAI: on save, when OpenAI refused it in a run, and on recovery. */
305
- lastCheck: "unspecified" | "rejected" | "model_unavailable" | "valid" | "no_quota";
305
+ lastCheck: "unspecified" | "rejected" | "valid" | "model_unavailable" | "no_quota";
306
306
  checkedAt: number | undefined;
307
307
  };
308
308
  type AssistantModelKey = ReturnType<typeof formatModelKey>;
309
309
  /** Credits are the main account's, shared by every subaccount. */
310
310
  declare function formatAssistantUsage(r: GetUsageResponse): {
311
311
  /** With `"own_key"`, messages use no credits. */
312
- fundingMode: "credits" | "own_key";
312
+ fundingMode: "credits" | "own_key" | "sponsored";
313
313
  /** Omitted when the tier could not be read; VIP 0's free credits then apply. */
314
314
  vipTier: number | undefined;
315
315
  /** Today's free credits. */
@@ -1,4 +1,4 @@
1
- import "../../gen/auth/v1/address_book_pb.js";
1
+ import "../../gen/auth/v1/account_scope_pb.js";
2
2
  import { AuthService as AuthService$1 } from "../../gen/auth/v1/auth_pb.js";
3
3
  import { parse } from "../../shared/validation.js";
4
4
  import { toConnectCallOptions } from "../../shared/request-options.js";
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","names":["#publicClient","Proto.AuthService","#authClient"],"sources":["../../../src/services/auth/auth.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/auth_pb.js\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { ProfileService } from \"./profile/profile.js\";\nimport { enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport { AccountScopeType } from \"../../gen/auth/v1/address_book_pb.js\";\nimport {\n OptionalPublicIdSchema,\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n} from \"../../shared/schemas.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { MfaSessionInfoSchema } from \"../mfa/mfa.schemas.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\n\nimport {\n WalletAddressSchema,\n WalletChallengeUriSchema,\n WalletChallengeMessageSchema,\n} from \"./wallet-challenge.schemas.js\";\n\nexport const CreateWalletChallengeInputSchema = v.strictObject({\n smartAccountAddress: WalletAddressSchema,\n signerAddress: WalletAddressSchema,\n uri: WalletChallengeUriSchema,\n});\nexport type CreateWalletChallengeInput = v.InferInput<typeof CreateWalletChallengeInputSchema>;\n\n/** An EIP-191 EOA signature: 65 hexadecimal bytes, with an optional 0x prefix. */\nconst LoginEoaSignatureSchema = v.pipe(\n v.string(),\n v.regex(\n /^(?:0x)?[0-9a-fA-F]{130}$/,\n \"Login signature must be a 65-byte hexadecimal EOA signature.\",\n ),\n);\n\nexport const LoginWithWalletInputSchema = v.strictObject({\n smartAccountAddress: WalletAddressSchema,\n message: WalletChallengeMessageSchema,\n signature: LoginEoaSignatureSchema,\n userAgent: v.optional(v.string(), \"\"),\n ip: v.optional(v.string(), \"\"),\n walletProvider: v.optional(v.string(), \"\"),\n});\n\nexport type LoginWithWalletInput = v.InferInput<typeof LoginWithWalletInputSchema>;\n\n// Inlined rather than imported from address-book, so a session-verifying core stays core + auth.\nconst API_KEY_SCOPE_LABELS = {\n [AccountScopeType.SCOPE_UNSPECIFIED]: \"unspecified\",\n [AccountScopeType.SCOPE_ROOT]: \"root\",\n [AccountScopeType.SCOPE_SUBACCOUNT]: \"subaccount\",\n} as const;\n\nconst MeSchema = v.object({\n accountId: PublicIdSchema,\n apiKeyId: v.optional(v.string()),\n username: v.string(),\n /** Root smart-account EVM address (lowercase 0x hex); empty when not set, which a new account can briefly be. */\n rootSmartAccountAddress: v.optional(v.string(), \"\"),\n session: v.optional(MfaSessionInfoSchema),\n /** Scope of the API key that signed the request: `root`, `subaccount`, or `unspecified` for a session. */\n apiKeyScope: v.optional(enumLabelSchema(API_KEY_SCOPE_LABELS), 0),\n /** Sub-account a `subaccount` key is bound to; its private channels and account reads name this ID. */\n subaccountId: OptionalPublicIdSchema,\n});\n\nexport type Me = v.InferOutput<typeof MeSchema>;\n\nconst LoginWithWalletResponseSchema = v.object({\n accessToken: v.string(),\n expiresAt: v.optional(TimestampSchema),\n accountId: PublicIdSchema,\n username: v.string(),\n session: v.optional(MfaSessionInfoSchema),\n});\n\nexport type LoginWithWalletResponse = v.InferOutput<typeof LoginWithWalletResponseSchema>;\n\nconst WalletChallengeSchema = v.object({\n message: WalletChallengeMessageSchema,\n expiresAt: OptionalTimestampMsSchema,\n});\n\nexport type WalletChallenge = v.InferOutput<typeof WalletChallengeSchema>;\n\n/**\n * Handles wallet-based authentication, caller introspection, and authenticated profile operations.\n */\nexport class AuthService {\n #publicClient: Client<typeof Proto.AuthService>;\n #authClient: Client<typeof Proto.AuthService>;\n profile: ProfileService;\n\n constructor(transports: AuthAndPublicApiTransports, realtime: PolyesterRealtime) {\n this.#publicClient = createClient(Proto.AuthService, transports.publicApi);\n this.#authClient = createClient(Proto.AuthService, transports.authApi);\n this.profile = new ProfileService(transports, realtime);\n }\n\n /**\n * Returns the authenticated caller's account context, including account ID, optional API key ID, username, root smart-account address, and session assurance details from the presented token or API key.\n */\n async me(options?: PolyesterRequestOptions): Promise<Me> {\n const res = await this.#authClient.me({}, toConnectCallOptions(options));\n return parse(MeSchema, res);\n }\n\n /**\n * Records explicit consent to the current terms for the caller's root account.\n * Call only after the user consents. Requires an interactive JWT session;\n * API keys are not allowed. Repeated acceptance succeeds without changing\n * the first acceptance time. No MFA is required.\n */\n async acceptTerms(options?: PolyesterMutationOptions): Promise<void> {\n await this.#authClient.acceptTerms({}, toConnectCallOptions(options));\n }\n\n /**\n * Requests a server-issued SIWE login message. Sign its exact UTF-8 bytes with\n * personal_sign; do not hash or reconstruct it. Expiry is epoch milliseconds.\n * The backend sets SIWE Chain ID to Ethereum mainnet (1) and binds the\n * Polyester chain in Resources. Do not send a chain ID or rewrite either binding.\n * Wallet adapters must select Ethereum mainnet before signing if required by the wallet.\n * Subaccount creation uses `subaccounts.createChallenge` instead.\n */\n async createWalletChallenge(\n input: CreateWalletChallengeInput,\n options?: PolyesterRequestOptions,\n ): Promise<WalletChallenge> {\n const validated = parse(CreateWalletChallengeInputSchema, input);\n return parse(\n WalletChallengeSchema,\n await this.#publicClient.createWalletChallenge(\n { ...validated, purpose: Proto.WalletChallengePurpose.LOGIN },\n toConnectCallOptions(options),\n ),\n );\n }\n\n /**\n * Exchanges a signed SIWE message for an authenticated session token, account identity, and the token's session assurance details.\n */\n protected async loginWithWallet(\n input: LoginWithWalletInput,\n options?: PolyesterMutationOptions,\n ): Promise<LoginWithWalletResponse> {\n const validatedInput = parse(LoginWithWalletInputSchema, input);\n const res = await this.#publicClient.loginWithWallet(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(LoginWithWalletResponseSchema, res);\n }\n}\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAa,mCAAmC,EAAE,aAAa;CAC3D,qBAAqB;CACrB,eAAe;CACf,KAAK;AACT,CAAC;;AAID,MAAM,0BAA0B,EAAE,KAC9B,EAAE,OAAO,GACT,EAAE,MACE,6BACA,8DACJ,CACJ;AAEA,MAAa,6BAA6B,EAAE,aAAa;CACrD,qBAAqB;CACrB,SAAS;CACT,WAAW;CACX,WAAW,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACpC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC7B,gBAAgB,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;AAC7C,CAAC;AAWD,MAAM,WAAW,EAAE,OAAO;CACtB,WAAW;CACX,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,UAAU,EAAE,OAAO;;CAEnB,yBAAyB,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAClD,SAAS,EAAE,SAAS,oBAAoB;;CAExC,aAAa,EAAE,SAAS,gBAAgB;GAbF,IAAA;GACP,IAAA;GACM,IAAA;CAWG,CAAoB,GAAG,CAAC;;CAEhE,cAAc;AAClB,CAAC;AAID,MAAM,gCAAgC,EAAE,OAAO;CAC3C,aAAa,EAAE,OAAO;CACtB,WAAW,EAAE,SAAS,eAAe;CACrC,WAAW;CACX,UAAU,EAAE,OAAO;CACnB,SAAS,EAAE,SAAS,oBAAoB;AAC5C,CAAC;AAID,MAAM,wBAAwB,EAAE,OAAO;CACnC,SAAS;CACT,WAAW;AACf,CAAC;;;;AAOD,IAAa,cAAb,MAAyB;CACrB;CACA;CACA;CAEA,YAAY,YAAwC,UAA6B;EAC7E,KAAKA,gBAAgB,aAAaC,eAAmB,WAAW,SAAS;EACzE,KAAKC,cAAc,aAAaD,eAAmB,WAAW,OAAO;EACrE,KAAK,UAAU,IAAI,eAAe,YAAY,QAAQ;CAC1D;;;;CAKA,MAAM,GAAG,SAAgD;EACrD,MAAM,MAAM,MAAM,KAAKC,YAAY,GAAG,CAAC,GAAG,qBAAqB,OAAO,CAAC;EACvE,OAAO,MAAM,UAAU,GAAG;CAC9B;;;;;;;CAQA,MAAM,YAAY,SAAmD;EACjE,MAAM,KAAKA,YAAY,YAAY,CAAC,GAAG,qBAAqB,OAAO,CAAC;CACxE;;;;;;;;;CAUA,MAAM,sBACF,OACA,SACwB;EACxB,MAAM,YAAY,MAAM,kCAAkC,KAAK;EAC/D,OAAO,MACH,uBACA,MAAM,KAAKF,cAAc,sBACrB;GAAE,GAAG;GAAW,SAAA;EAA4C,GAC5D,qBAAqB,OAAO,CAChC,CACJ;CACJ;;;;CAKA,MAAgB,gBACZ,OACA,SACgC;EAChC,MAAM,iBAAiB,MAAM,4BAA4B,KAAK;EAC9D,MAAM,MAAM,MAAM,KAAKA,cAAc,gBACjC,gBACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,+BAA+B,GAAG;CACnD;AACJ"}
1
+ {"version":3,"file":"auth.js","names":["#publicClient","Proto.AuthService","#authClient"],"sources":["../../../src/services/auth/auth.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/auth_pb.js\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { ProfileService } from \"./profile/profile.js\";\nimport { enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport { AccountScopeType } from \"../../gen/auth/v1/account_scope_pb.js\";\nimport {\n OptionalPublicIdSchema,\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n} from \"../../shared/schemas.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { MfaSessionInfoSchema } from \"../mfa/mfa.schemas.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\n\nimport {\n WalletAddressSchema,\n WalletChallengeUriSchema,\n WalletChallengeMessageSchema,\n} from \"./wallet-challenge.schemas.js\";\n\nexport const CreateWalletChallengeInputSchema = v.strictObject({\n smartAccountAddress: WalletAddressSchema,\n signerAddress: WalletAddressSchema,\n uri: WalletChallengeUriSchema,\n});\nexport type CreateWalletChallengeInput = v.InferInput<typeof CreateWalletChallengeInputSchema>;\n\n/** An EIP-191 EOA signature: 65 hexadecimal bytes, with an optional 0x prefix. */\nconst LoginEoaSignatureSchema = v.pipe(\n v.string(),\n v.regex(\n /^(?:0x)?[0-9a-fA-F]{130}$/,\n \"Login signature must be a 65-byte hexadecimal EOA signature.\",\n ),\n);\n\nexport const LoginWithWalletInputSchema = v.strictObject({\n smartAccountAddress: WalletAddressSchema,\n message: WalletChallengeMessageSchema,\n signature: LoginEoaSignatureSchema,\n userAgent: v.optional(v.string(), \"\"),\n ip: v.optional(v.string(), \"\"),\n walletProvider: v.optional(v.string(), \"\"),\n});\n\nexport type LoginWithWalletInput = v.InferInput<typeof LoginWithWalletInputSchema>;\n\n// Inlined rather than imported from address-book, so a session-verifying core stays core + auth.\nconst API_KEY_SCOPE_LABELS = {\n [AccountScopeType.SCOPE_UNSPECIFIED]: \"unspecified\",\n [AccountScopeType.SCOPE_ROOT]: \"root\",\n [AccountScopeType.SCOPE_SUBACCOUNT]: \"subaccount\",\n} as const;\n\nconst MeSchema = v.object({\n accountId: PublicIdSchema,\n apiKeyId: v.optional(v.string()),\n username: v.string(),\n /** Root smart-account EVM address (lowercase 0x hex); empty when not set, which a new account can briefly be. */\n rootSmartAccountAddress: v.optional(v.string(), \"\"),\n session: v.optional(MfaSessionInfoSchema),\n /** Scope of the API key that signed the request: `root`, `subaccount`, or `unspecified` for a session. */\n apiKeyScope: v.optional(enumLabelSchema(API_KEY_SCOPE_LABELS), 0),\n /** Sub-account a `subaccount` key is bound to; its private channels and account reads name this ID. */\n subaccountId: OptionalPublicIdSchema,\n});\n\nexport type Me = v.InferOutput<typeof MeSchema>;\n\nconst LoginWithWalletResponseSchema = v.object({\n accessToken: v.string(),\n expiresAt: v.optional(TimestampSchema),\n accountId: PublicIdSchema,\n username: v.string(),\n session: v.optional(MfaSessionInfoSchema),\n});\n\nexport type LoginWithWalletResponse = v.InferOutput<typeof LoginWithWalletResponseSchema>;\n\nconst WalletChallengeSchema = v.object({\n message: WalletChallengeMessageSchema,\n expiresAt: OptionalTimestampMsSchema,\n});\n\nexport type WalletChallenge = v.InferOutput<typeof WalletChallengeSchema>;\n\n/**\n * Handles wallet-based authentication, caller introspection, and authenticated profile operations.\n */\nexport class AuthService {\n #publicClient: Client<typeof Proto.AuthService>;\n #authClient: Client<typeof Proto.AuthService>;\n profile: ProfileService;\n\n constructor(transports: AuthAndPublicApiTransports, realtime: PolyesterRealtime) {\n this.#publicClient = createClient(Proto.AuthService, transports.publicApi);\n this.#authClient = createClient(Proto.AuthService, transports.authApi);\n this.profile = new ProfileService(transports, realtime);\n }\n\n /**\n * Returns the authenticated caller's account context, including account ID, optional API key ID, username, root smart-account address, and session assurance details from the presented token or API key.\n */\n async me(options?: PolyesterRequestOptions): Promise<Me> {\n const res = await this.#authClient.me({}, toConnectCallOptions(options));\n return parse(MeSchema, res);\n }\n\n /**\n * Records explicit consent to the current terms for the caller's root account.\n * Call only after the user consents. Requires an interactive JWT session;\n * API keys are not allowed. Repeated acceptance succeeds without changing\n * the first acceptance time. No MFA is required.\n */\n async acceptTerms(options?: PolyesterMutationOptions): Promise<void> {\n await this.#authClient.acceptTerms({}, toConnectCallOptions(options));\n }\n\n /**\n * Requests a server-issued SIWE login message. Sign its exact UTF-8 bytes with\n * personal_sign; do not hash or reconstruct it. Expiry is epoch milliseconds.\n * The backend sets SIWE Chain ID to Ethereum mainnet (1) and binds the\n * Polyester chain in Resources. Do not send a chain ID or rewrite either binding.\n * Wallet adapters must select Ethereum mainnet before signing if required by the wallet.\n * Subaccount creation uses `subaccounts.createChallenge` instead.\n */\n async createWalletChallenge(\n input: CreateWalletChallengeInput,\n options?: PolyesterRequestOptions,\n ): Promise<WalletChallenge> {\n const validated = parse(CreateWalletChallengeInputSchema, input);\n return parse(\n WalletChallengeSchema,\n await this.#publicClient.createWalletChallenge(\n { ...validated, purpose: Proto.WalletChallengePurpose.LOGIN },\n toConnectCallOptions(options),\n ),\n );\n }\n\n /**\n * Exchanges a signed SIWE message for an authenticated session token, account identity, and the token's session assurance details.\n */\n protected async loginWithWallet(\n input: LoginWithWalletInput,\n options?: PolyesterMutationOptions,\n ): Promise<LoginWithWalletResponse> {\n const validatedInput = parse(LoginWithWalletInputSchema, input);\n const res = await this.#publicClient.loginWithWallet(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(LoginWithWalletResponseSchema, res);\n }\n}\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAa,mCAAmC,EAAE,aAAa;CAC3D,qBAAqB;CACrB,eAAe;CACf,KAAK;AACT,CAAC;;AAID,MAAM,0BAA0B,EAAE,KAC9B,EAAE,OAAO,GACT,EAAE,MACE,6BACA,8DACJ,CACJ;AAEA,MAAa,6BAA6B,EAAE,aAAa;CACrD,qBAAqB;CACrB,SAAS;CACT,WAAW;CACX,WAAW,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACpC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC7B,gBAAgB,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;AAC7C,CAAC;AAWD,MAAM,WAAW,EAAE,OAAO;CACtB,WAAW;CACX,UAAU,EAAE,SAAS,EAAE,OAAO,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KA,cAAc,gBACjC,gBACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,+BAA+B,GAAG;CACnD;AACJ"}
@@ -502,7 +502,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
502
502
  readonly hi: v.BigintSchema<undefined>;
503
503
  readonly lo: v.BigintSchema<undefined>;
504
504
  }, undefined>, undefined>;
505
- readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "pending" | "failed" | "completed" | "skipped" | "submitting" | "submitted">]>;
505
+ readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted">]>;
506
506
  readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
507
507
  readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
508
508
  readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
@@ -526,7 +526,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
526
526
  hi: bigint;
527
527
  lo: bigint;
528
528
  } | undefined;
529
- state: "unspecified" | "pending" | "failed" | "completed" | "skipped" | "submitting" | "submitted";
529
+ state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
530
530
  reason: AutoWithdrawStepReason | null;
531
531
  intentId: string;
532
532
  txHash: string;
@@ -540,7 +540,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
540
540
  txHash: string | null;
541
541
  assetId: number;
542
542
  destinationAddress: string;
543
- state: "unspecified" | "pending" | "failed" | "completed" | "skipped" | "submitting" | "submitted";
543
+ state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
544
544
  reason: AutoWithdrawStepReason | null;
545
545
  }>]>;
546
546
  /**
@@ -583,7 +583,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
583
583
  readonly hi: v.BigintSchema<undefined>;
584
584
  readonly lo: v.BigintSchema<undefined>;
585
585
  }, undefined>, undefined>;
586
- readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "pending" | "failed" | "completed" | "skipped" | "submitting" | "submitted">]>;
586
+ readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted">]>;
587
587
  readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
588
588
  readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
589
589
  readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
@@ -607,7 +607,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
607
607
  hi: bigint;
608
608
  lo: bigint;
609
609
  } | undefined;
610
- state: "unspecified" | "pending" | "failed" | "completed" | "skipped" | "submitting" | "submitted";
610
+ state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
611
611
  reason: AutoWithdrawStepReason | null;
612
612
  intentId: string;
613
613
  txHash: string;
@@ -621,7 +621,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
621
621
  txHash: string | null;
622
622
  assetId: number;
623
623
  destinationAddress: string;
624
- state: "unspecified" | "pending" | "failed" | "completed" | "skipped" | "submitting" | "submitted";
624
+ state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
625
625
  reason: AutoWithdrawStepReason | null;
626
626
  }>]>, undefined>;
627
627
  readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
@@ -654,7 +654,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
654
654
  txHash: string | null;
655
655
  assetId: number;
656
656
  destinationAddress: string;
657
- state: "unspecified" | "pending" | "failed" | "completed" | "skipped" | "submitting" | "submitted";
657
+ state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
658
658
  reason: AutoWithdrawStepReason | null;
659
659
  }[];
660
660
  createdAt: number;
@@ -676,7 +676,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
676
676
  txHash: string | null;
677
677
  assetId: number;
678
678
  destinationAddress: string;
679
- state: "unspecified" | "pending" | "failed" | "completed" | "skipped" | "submitting" | "submitted";
679
+ state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
680
680
  reason: AutoWithdrawStepReason | null;
681
681
  }[];
682
682
  createdAt: number;
@@ -716,7 +716,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
716
716
  readonly hi: v.BigintSchema<undefined>;
717
717
  readonly lo: v.BigintSchema<undefined>;
718
718
  }, undefined>, undefined>;
719
- readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "pending" | "failed" | "completed" | "skipped" | "submitting" | "submitted">]>;
719
+ readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted">]>;
720
720
  readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
721
721
  readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
722
722
  readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
@@ -740,7 +740,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
740
740
  hi: bigint;
741
741
  lo: bigint;
742
742
  } | undefined;
743
- state: "unspecified" | "pending" | "failed" | "completed" | "skipped" | "submitting" | "submitted";
743
+ state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
744
744
  reason: AutoWithdrawStepReason | null;
745
745
  intentId: string;
746
746
  txHash: string;
@@ -754,7 +754,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
754
754
  txHash: string | null;
755
755
  assetId: number;
756
756
  destinationAddress: string;
757
- state: "unspecified" | "pending" | "failed" | "completed" | "skipped" | "submitting" | "submitted";
757
+ state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
758
758
  reason: AutoWithdrawStepReason | null;
759
759
  }>]>, undefined>;
760
760
  readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
@@ -787,7 +787,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
787
787
  txHash: string | null;
788
788
  assetId: number;
789
789
  destinationAddress: string;
790
- state: "unspecified" | "pending" | "failed" | "completed" | "skipped" | "submitting" | "submitted";
790
+ state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
791
791
  reason: AutoWithdrawStepReason | null;
792
792
  }[];
793
793
  createdAt: number;
@@ -809,7 +809,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
809
809
  txHash: string | null;
810
810
  assetId: number;
811
811
  destinationAddress: string;
812
- state: "unspecified" | "pending" | "failed" | "completed" | "skipped" | "submitting" | "submitted";
812
+ state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
813
813
  reason: AutoWithdrawStepReason | null;
814
814
  }[];
815
815
  createdAt: number;
@@ -925,7 +925,7 @@ declare const AutoWithdrawPreviewAssetSchema: v.SchemaWithPipe<readonly [v.Objec
925
925
  */
926
926
  type AutoWithdrawPreviewAsset = v.InferOutput<typeof AutoWithdrawPreviewAssetSchema>;
927
927
  declare const AutoWithdrawPreviewSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
928
- readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "will_pay" | "rolls_over" | "no_destination" | "paused" | "no_rule">]>;
928
+ readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "paused" | "will_pay" | "rolls_over" | "no_destination" | "no_rule">]>;
929
929
  readonly nextRunAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
930
930
  readonly seconds: v.BigintSchema<undefined>;
931
931
  readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
@@ -1054,7 +1054,7 @@ declare const AutoWithdrawPreviewSchema: v.SchemaWithPipe<readonly [v.ObjectSche
1054
1054
  nanos: number;
1055
1055
  }, number>]>;
1056
1056
  }, undefined>, v.TransformAction<{
1057
- status: "unspecified" | "will_pay" | "rolls_over" | "no_destination" | "paused" | "no_rule";
1057
+ status: "unspecified" | "paused" | "will_pay" | "rolls_over" | "no_destination" | "no_rule";
1058
1058
  nextRunAt?: number | undefined;
1059
1059
  ruleVersion: number;
1060
1060
  pause?: {
@@ -1090,7 +1090,7 @@ declare const AutoWithdrawPreviewSchema: v.SchemaWithPipe<readonly [v.ObjectSche
1090
1090
  pausedAt: number;
1091
1091
  } | null;
1092
1092
  minUsdValue: string | null;
1093
- status: "unspecified" | "will_pay" | "rolls_over" | "no_destination" | "paused" | "no_rule";
1093
+ status: "unspecified" | "paused" | "will_pay" | "rolls_over" | "no_destination" | "no_rule";
1094
1094
  ruleVersion: number;
1095
1095
  assets: {
1096
1096
  assetId: number;
@@ -1,6 +1,6 @@
1
- import { AssetBalanceSchema, LedgerReadService } from "../../gen/ledger/read/v1/ledger_read_pb.js";
2
1
  import { parse } from "../../shared/validation.js";
3
2
  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";