@polyester/sdk 0.36.0-devnet-20261112144059 → 0.36.0-devnet-20261113022813
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.
- package/CHANGELOG.md +23 -1
- package/dist/gen/ai/v1/assistant_pb.d.ts +211 -9
- package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.js +163 -73
- package/dist/gen/ai/v1/assistant_pb.js.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.d.ts +62 -5
- package/dist/gen/auth/v1/api_keys_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.js +50 -2
- package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts +10 -2
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts.map +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js.map +1 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.d.ts +10 -5
- package/dist/gen/chain/lifecycle/v1/types_pb.d.ts.map +1 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.js +10 -5
- package/dist/gen/chain/lifecycle/v1/types_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +6 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js.map +1 -1
- package/dist/gen/chain/zipper/v1/reason_pb.d.ts +6 -2
- package/dist/gen/chain/zipper/v1/reason_pb.d.ts.map +1 -1
- package/dist/gen/chain/zipper/v1/reason_pb.js.map +1 -1
- package/dist/gen/changelog/v1/changelog_pb.d.ts +482 -2
- package/dist/gen/changelog/v1/changelog_pb.d.ts.map +1 -1
- package/dist/gen/changelog/v1/changelog_pb.js +157 -14
- package/dist/gen/changelog/v1/changelog_pb.js.map +1 -1
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +3 -3
- package/dist/gen/ledger/read/v1/ledger_read_pb.js +1 -1
- package/dist/gen/ledger/read/v1/ledger_read_pb.js.map +1 -1
- package/dist/gen/ledger/v1/catalog_pb.d.ts +11 -4
- package/dist/gen/ledger/v1/catalog_pb.d.ts.map +1 -1
- package/dist/gen/ledger/v1/catalog_pb.js +11 -4
- package/dist/gen/ledger/v1/catalog_pb.js.map +1 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts +3 -2
- package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts.map +1 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.js.map +1 -1
- package/dist/gen/notifications/v1/notifications_pb.d.ts +154 -3
- package/dist/gen/notifications/v1/notifications_pb.d.ts.map +1 -1
- package/dist/gen/notifications/v1/notifications_pb.js +102 -15
- package/dist/gen/notifications/v1/notifications_pb.js.map +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.d.ts +18 -10
- package/dist/gen/orderbook/v1/orderbook_pb.d.ts.map +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_pb.d.ts +12 -1
- package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js +12 -1
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +6 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +6 -0
- package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/services/api-keys/api-keys.codecs.d.ts +14 -0
- package/dist/services/api-keys/api-keys.codecs.d.ts.map +1 -0
- package/dist/services/api-keys/api-keys.codecs.js +13 -1
- package/dist/services/api-keys/api-keys.codecs.js.map +1 -1
- package/dist/services/api-keys/api-keys.d.ts +2 -2
- package/dist/services/api-keys/api-keys.js +2 -2
- package/dist/services/api-keys/api-keys.js.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.d.ts +46 -12
- package/dist/services/api-keys/api-keys.schemas.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.js +10 -4
- package/dist/services/api-keys/api-keys.schemas.js.map +1 -1
- package/dist/services/api-keys/api-keys.types.d.ts +2 -1
- package/dist/services/assistant/assistant-events.schemas.d.ts +88 -57
- package/dist/services/assistant/assistant-events.schemas.d.ts.map +1 -1
- package/dist/services/assistant/assistant-events.schemas.js +20 -2
- package/dist/services/assistant/assistant-events.schemas.js.map +1 -1
- package/dist/services/assistant/assistant.codecs.d.ts +11 -2
- package/dist/services/assistant/assistant.codecs.d.ts.map +1 -1
- package/dist/services/assistant/assistant.codecs.js +42 -2
- package/dist/services/assistant/assistant.codecs.js.map +1 -1
- package/dist/services/assistant/assistant.d.ts +3 -3
- package/dist/services/assistant/assistant.js +3 -3
- package/dist/services/assistant/assistant.js.map +1 -1
- package/dist/services/assistant/assistant.schemas.d.ts +22 -4
- package/dist/services/assistant/assistant.schemas.d.ts.map +1 -1
- package/dist/services/assistant/assistant.schemas.js +27 -4
- package/dist/services/assistant/assistant.schemas.js.map +1 -1
- package/dist/services/assistant/assistant.types.d.ts +2 -2
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +13 -13
- package/dist/services/changelog/changelog.codecs.d.ts +10 -1
- package/dist/services/changelog/changelog.codecs.d.ts.map +1 -1
- package/dist/services/changelog/changelog.codecs.js +13 -1
- package/dist/services/changelog/changelog.codecs.js.map +1 -1
- package/dist/services/changelog/changelog.d.ts +14 -1
- package/dist/services/changelog/changelog.d.ts.map +1 -1
- package/dist/services/changelog/changelog.js +22 -1
- package/dist/services/changelog/changelog.js.map +1 -1
- package/dist/services/changelog/changelog.schemas.d.ts +445 -19
- package/dist/services/changelog/changelog.schemas.d.ts.map +1 -1
- package/dist/services/changelog/changelog.schemas.js +94 -5
- package/dist/services/changelog/changelog.schemas.js.map +1 -1
- package/dist/services/changelog/changelog.types.d.ts +3 -3
- package/dist/services/claims/claims.schemas.d.ts +2 -2
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +3 -3
- package/dist/services/lifecycle/lifecycle.codecs.d.ts +8 -1
- package/dist/services/lifecycle/lifecycle.codecs.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.codecs.js +62 -1
- package/dist/services/lifecycle/lifecycle.codecs.js.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +89 -88
- package/dist/services/lifecycle/lifecycle.schemas.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.js +2 -2
- package/dist/services/lifecycle/lifecycle.schemas.js.map +1 -1
- package/dist/services/lifecycle/lifecycle.types.d.ts +2 -2
- package/dist/services/market-overview/market-overview.d.ts +1 -1
- package/dist/services/market-overview/market-overview.js +1 -1
- package/dist/services/market-overview/market-overview.js.map +1 -1
- package/dist/services/notifications/notifications.codecs.d.ts +8 -2
- package/dist/services/notifications/notifications.codecs.d.ts.map +1 -1
- package/dist/services/notifications/notifications.codecs.js +14 -2
- package/dist/services/notifications/notifications.codecs.js.map +1 -1
- package/dist/services/notifications/notifications.schemas.d.ts +100 -3
- package/dist/services/notifications/notifications.schemas.d.ts.map +1 -1
- package/dist/services/notifications/notifications.schemas.js +25 -1
- package/dist/services/notifications/notifications.schemas.js.map +1 -1
- package/dist/services/notifications/notifications.types.d.ts +2 -2
- package/dist/services/orderbook/orderbook.d.ts +2 -2
- package/dist/services/orderbook/orderbook.js +17 -12
- package/dist/services/orderbook/orderbook.js.map +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +27 -27
- package/dist/services/orders/orders-input.schemas.d.ts +4 -4
- package/dist/services/orders/orders-output.schemas.d.ts +14 -14
- package/dist/services/price-alerts/price-alerts.codecs.d.ts +1 -1
- package/dist/services/price-alerts/price-alerts.codecs.js +3 -3
- package/dist/services/price-alerts/price-alerts.codecs.js.map +1 -1
- package/dist/services/price-alerts/price-alerts.d.ts +2 -2
- package/dist/services/price-alerts/price-alerts.js +2 -2
- package/dist/services/price-alerts/price-alerts.js.map +1 -1
- package/dist/services/price-alerts/price-alerts.schemas.d.ts +11 -11
- package/dist/services/rewards/rewards.schemas.d.ts +4 -4
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +11 -11
- package/dist/services/trades/trades.schemas.d.ts +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
- package/dist/services/triggers/triggers-output.schemas.d.ts +33 -33
- package/dist/services/triggers/triggers.d.ts +1 -1
- package/dist/services/triggers/triggers.js +1 -1
- package/dist/services/triggers/triggers.js.map +1 -1
- package/dist/shared/ledger-codes.d.ts +5 -3
- package/dist/shared/ledger-codes.d.ts.map +1 -1
- package/dist/shared/ledger-codes.js.map +1 -1
- 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":";;;;;;;
|
|
1
|
+
{"version":3,"file":"assistant-events.schemas.d.ts","names":[],"sources":["../../../src/services/assistant/assistant-events.schemas.ts"],"mappings":";;;;;;;iBAwLS,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkBnB,wB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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, FailureCategoryCodec, MemoryKindCodec, OrderPriceFieldCodec, PriceOffsetDirectionCodec, PriceRoundingCodec, ReferencePriceSourceCodec, TriggerChangeActionCodec, TriggerDirectionCodec, UnfilledSlicePolicyCodec } from "./assistant.codecs.js";
|
|
15
|
+
import { ApprovalStatusCodec, DisplaySettingCodec, FailureCategoryCodec, MemoryKindCodec, OrderPriceFieldCodec, PriceOffsetDirectionCodec, PriceRoundingCodec, ReferencePriceSourceCodec, 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);
|
|
@@ -406,7 +406,13 @@ function formatEvent(e, scales) {
|
|
|
406
406
|
ok: e.value.ok,
|
|
407
407
|
errorMessage: e.value.errorMessage
|
|
408
408
|
};
|
|
409
|
-
case "memoriesRecalled":
|
|
409
|
+
case "memoriesRecalled":
|
|
410
|
+
/**
|
|
411
|
+
* For a `recall_memories` call, the relevant memories; for a `memory_updates` call,
|
|
412
|
+
* the memories saved or changed in the user's other conversations since this one's
|
|
413
|
+
* previous answer. Key on the tool call's `name`.
|
|
414
|
+
*/
|
|
415
|
+
return {
|
|
410
416
|
type: "memories_recalled",
|
|
411
417
|
toolCallId: e.value.toolCallId,
|
|
412
418
|
memories: e.value.memories.map((m) => ({
|
|
@@ -420,6 +426,18 @@ function formatEvent(e, scales) {
|
|
|
420
426
|
toolCallId: e.value.toolCallId,
|
|
421
427
|
destinationIds: e.value.destinationIds
|
|
422
428
|
};
|
|
429
|
+
case "displaySettingAction":
|
|
430
|
+
/**
|
|
431
|
+
* Apply `value` to `setting` once, only in a run you sent and follow, never on replay,
|
|
432
|
+
* and offer an undo. No `value` means show the setting's choices and change nothing
|
|
433
|
+
* until the user picks. Ignore a setting or value the client no longer accepts.
|
|
434
|
+
*/
|
|
435
|
+
return {
|
|
436
|
+
type: "display_setting_action",
|
|
437
|
+
toolCallId: e.value.toolCallId,
|
|
438
|
+
setting: enumLabel(DisplaySettingCodec.protoToOutput, e.value.setting),
|
|
439
|
+
value: e.value.value
|
|
440
|
+
};
|
|
423
441
|
case "skillLoaded": return {
|
|
424
442
|
type: "skill_loaded",
|
|
425
443
|
name: e.value.name
|
|
@@ -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 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 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 \"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":";;;;;;;;;;;;;;;;AA2CA,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;CACE,IAAI,EAAE,SAAS,YAAY,OAAO;EAAE,MAAM;EAAqB,UAAU,EAA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B,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 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;CACE,IAAI,EAAE,SAAS,YAAY,OAAO;EAAE,MAAM;EAAqB,UAAU,EAAE;CAAM;CACjF,IAAI,EAAE,SAAS,eAAe,OAAO;E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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"}
|
|
@@ -2,7 +2,7 @@ import "../../gen/ai/v1/assistant_pb.js";
|
|
|
2
2
|
//#region src/services/assistant/assistant.codecs.d.ts
|
|
3
3
|
declare const ASSISTANT_MESSAGE_ROLE_VALUES: readonly ["user", "assistant"];
|
|
4
4
|
type AssistantMessageRole = (typeof ASSISTANT_MESSAGE_ROLE_VALUES)[number];
|
|
5
|
-
declare const ASSISTANT_FAILURE_CATEGORY_VALUES: readonly ["
|
|
5
|
+
declare const ASSISTANT_FAILURE_CATEGORY_VALUES: readonly ["canceled", "budget_exceeded", "permission_denied", "model_unavailable", "unexpected_error"];
|
|
6
6
|
type AssistantFailureCategory = (typeof ASSISTANT_FAILURE_CATEGORY_VALUES)[number];
|
|
7
7
|
declare const ASSISTANT_APPROVAL_DECISION_VALUES: readonly ["approve", "reject"];
|
|
8
8
|
type AssistantApprovalDecision = (typeof ASSISTANT_APPROVAL_DECISION_VALUES)[number];
|
|
@@ -12,6 +12,15 @@ declare const ASSISTANT_MEMORY_KIND_VALUES: readonly ["fact", "planning_figure",
|
|
|
12
12
|
type AssistantMemoryKind = (typeof ASSISTANT_MEMORY_KIND_VALUES)[number];
|
|
13
13
|
declare const ASSISTANT_KEY_STATE_VALUES: readonly ["active", "disabled"];
|
|
14
14
|
type AssistantKeyState = (typeof ASSISTANT_KEY_STATE_VALUES)[number];
|
|
15
|
+
/**
|
|
16
|
+
* Display preferences a client lets the assistant change: `appearance` (`light`, `dark`,
|
|
17
|
+
* `system`), `language` (`en`, `fr`, `zh-CN`), `currency` (a fiat code such as `EUR`),
|
|
18
|
+
* `date_format` (a pattern such as `yyyy-MM-dd`), `time_format` (`12h`, `24h`), `number_format`
|
|
19
|
+
* (`US`, `EU`, `SPACE`, `CH`, `IN`, `NONE`), `week_start` (`0` Sunday to `6` Saturday) and
|
|
20
|
+
* `sounds` (`on`, `off`).
|
|
21
|
+
*/
|
|
22
|
+
declare const ASSISTANT_DISPLAY_SETTING_VALUES: readonly ["appearance", "language", "currency", "date_format", "time_format", "number_format", "week_start", "sounds"];
|
|
23
|
+
type AssistantDisplaySetting = (typeof ASSISTANT_DISPLAY_SETTING_VALUES)[number];
|
|
15
24
|
type AssistantReferencePriceSource = "best_bid" | "best_ask" | "last_price" | "index_price";
|
|
16
25
|
type AssistantTriggerDirection = "at_or_above" | "at_or_below";
|
|
17
26
|
type AssistantOrderPriceField = "limit_price" | "trigger_price" | "activation_price" | "ladder_low_price" | "ladder_high_price" | "take_profit_trigger_price" | "take_profit_limit_price" | "stop_loss_trigger_price" | "stop_loss_limit_price" | "trailing_stop_activation_price" | "trailing_stop_limit_price";
|
|
@@ -20,5 +29,5 @@ type AssistantPriceRounding = "down" | "up";
|
|
|
20
29
|
type AssistantUnfilledSlicePolicy = "cancel_before_next";
|
|
21
30
|
type AssistantTriggerChangeAction = "modify" | "pause" | "resume";
|
|
22
31
|
//#endregion
|
|
23
|
-
export { ASSISTANT_APPROVAL_DECISION_VALUES, ASSISTANT_APPROVAL_STATUS_VALUES, ASSISTANT_FAILURE_CATEGORY_VALUES, ASSISTANT_KEY_STATE_VALUES, ASSISTANT_MEMORY_KIND_VALUES, ASSISTANT_MESSAGE_ROLE_VALUES, AssistantApprovalDecision, AssistantApprovalStatus, AssistantFailureCategory, AssistantKeyState, AssistantMemoryKind, AssistantMessageRole, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy };
|
|
32
|
+
export { ASSISTANT_APPROVAL_DECISION_VALUES, ASSISTANT_APPROVAL_STATUS_VALUES, ASSISTANT_DISPLAY_SETTING_VALUES, ASSISTANT_FAILURE_CATEGORY_VALUES, ASSISTANT_KEY_STATE_VALUES, ASSISTANT_MEMORY_KIND_VALUES, ASSISTANT_MESSAGE_ROLE_VALUES, AssistantApprovalDecision, AssistantApprovalStatus, AssistantDisplaySetting, AssistantFailureCategory, AssistantKeyState, AssistantMemoryKind, AssistantMessageRole, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy };
|
|
24
33
|
//# sourceMappingURL=assistant.codecs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.codecs.d.ts","names":[],"sources":["../../../src/services/assistant/assistant.codecs.ts"],"mappings":";;cAGa;KACD,+BAA+B;cAE9B;KAOD,mCAAmC;cAElC;KACD,oCAAoC;cAEnC;KAMD,kCAAkC;cAEjC;KACD,8BAA8B;cAE7B;KACD,4BAA4B;
|
|
1
|
+
{"version":3,"file":"assistant.codecs.d.ts","names":[],"sources":["../../../src/services/assistant/assistant.codecs.ts"],"mappings":";;cAGa;KACD,+BAA+B;cAE9B;KAOD,mCAAmC;cAElC;KACD,oCAAoC;cAEnC;KAMD,kCAAkC;cAEjC;KACD,8BAA8B;cAE7B;KACD,4BAA4B;;;;;;;;cAS3B;KAUD,kCAAkC;KA0BlC;KACA;KACA;KAYA;KACA;KACA;KACA"}
|
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
import "../../gen/ai/v1/assistant_pb.js";
|
|
2
2
|
//#region src/services/assistant/assistant.codecs.ts
|
|
3
3
|
const ASSISTANT_APPROVAL_DECISION_VALUES = ["approve", "reject"];
|
|
4
|
+
/**
|
|
5
|
+
* Display preferences a client lets the assistant change: `appearance` (`light`, `dark`,
|
|
6
|
+
* `system`), `language` (`en`, `fr`, `zh-CN`), `currency` (a fiat code such as `EUR`),
|
|
7
|
+
* `date_format` (a pattern such as `yyyy-MM-dd`), `time_format` (`12h`, `24h`), `number_format`
|
|
8
|
+
* (`US`, `EU`, `SPACE`, `CH`, `IN`, `NONE`), `week_start` (`0` Sunday to `6` Saturday) and
|
|
9
|
+
* `sounds` (`on`, `off`).
|
|
10
|
+
*/
|
|
11
|
+
const ASSISTANT_DISPLAY_SETTING_VALUES = [
|
|
12
|
+
"appearance",
|
|
13
|
+
"language",
|
|
14
|
+
"currency",
|
|
15
|
+
"date_format",
|
|
16
|
+
"time_format",
|
|
17
|
+
"number_format",
|
|
18
|
+
"week_start",
|
|
19
|
+
"sounds"
|
|
20
|
+
];
|
|
21
|
+
const DisplaySettingCodec = {
|
|
22
|
+
inputToProto: {
|
|
23
|
+
appearance: 1,
|
|
24
|
+
language: 2,
|
|
25
|
+
currency: 3,
|
|
26
|
+
date_format: 4,
|
|
27
|
+
time_format: 5,
|
|
28
|
+
number_format: 6,
|
|
29
|
+
week_start: 7,
|
|
30
|
+
sounds: 8
|
|
31
|
+
},
|
|
32
|
+
protoToOutput: {
|
|
33
|
+
[0]: "unspecified",
|
|
34
|
+
[1]: "appearance",
|
|
35
|
+
[2]: "language",
|
|
36
|
+
[3]: "currency",
|
|
37
|
+
[4]: "date_format",
|
|
38
|
+
[5]: "time_format",
|
|
39
|
+
[6]: "number_format",
|
|
40
|
+
[7]: "week_start",
|
|
41
|
+
[8]: "sounds"
|
|
42
|
+
}
|
|
43
|
+
};
|
|
4
44
|
const MessageRoleCodec = { protoToOutput: {
|
|
5
45
|
[0]: "unspecified",
|
|
6
46
|
[1]: "user",
|
|
@@ -8,7 +48,7 @@ const MessageRoleCodec = { protoToOutput: {
|
|
|
8
48
|
} };
|
|
9
49
|
const FailureCategoryCodec = { protoToOutput: {
|
|
10
50
|
[0]: "unspecified",
|
|
11
|
-
[1]: "
|
|
51
|
+
[1]: "canceled",
|
|
12
52
|
[2]: "budget_exceeded",
|
|
13
53
|
[3]: "permission_denied",
|
|
14
54
|
[4]: "model_unavailable",
|
|
@@ -83,6 +123,6 @@ const TriggerChangeActionCodec = { protoToOutput: {
|
|
|
83
123
|
[3]: "resume"
|
|
84
124
|
} };
|
|
85
125
|
//#endregion
|
|
86
|
-
export { ASSISTANT_APPROVAL_DECISION_VALUES, ApprovalDecisionCodec, ApprovalStatusCodec, AssistantKeyStateCodec, FailureCategoryCodec, MemoryKindCodec, MessageRoleCodec, OrderPriceFieldCodec, PriceOffsetDirectionCodec, PriceRoundingCodec, ReferencePriceSourceCodec, TriggerChangeActionCodec, TriggerDirectionCodec, UnfilledSlicePolicyCodec };
|
|
126
|
+
export { ASSISTANT_APPROVAL_DECISION_VALUES, ASSISTANT_DISPLAY_SETTING_VALUES, ApprovalDecisionCodec, ApprovalStatusCodec, AssistantKeyStateCodec, DisplaySettingCodec, FailureCategoryCodec, MemoryKindCodec, MessageRoleCodec, OrderPriceFieldCodec, PriceOffsetDirectionCodec, PriceRoundingCodec, ReferencePriceSourceCodec, TriggerChangeActionCodec, TriggerDirectionCodec, UnfilledSlicePolicyCodec };
|
|
87
127
|
|
|
88
128
|
//# 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 \"cancelled\",\n \"budget_exceeded\",\n \"permission_denied\",\n \"model_unavailable\",\n \"unexpected_error\",\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\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]: \"cancelled\",\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 } satisfies ProtoToOutput<Proto.FailureCategory, AssistantFailureCategory>,\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":";;AAeA,MAAa,qCAAqC,CAAC,WAAW,QAAQ;AAoCtE,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;AAC9C,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"}
|
|
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] 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 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 } satisfies ProtoToOutput<Proto.FailureCategory, AssistantFailureCategory>,\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":";;AAeA,MAAa,qCAAqC,CAAC,WAAW,QAAQ;;;;;;;;AAwBtE,MAAa,mCAAmC;CAC5C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAGA,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;AAC9C,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"}
|
|
@@ -32,8 +32,8 @@ declare class AssistantService {
|
|
|
32
32
|
*/
|
|
33
33
|
watchRun(input: WatchAssistantRunInput, options?: PolyesterRequestOptions): AsyncGenerator<AssistantRunEvent, void, undefined>;
|
|
34
34
|
/**
|
|
35
|
-
* Asks an active run to stop; it then ends with `run_failed` category `
|
|
36
|
-
*
|
|
35
|
+
* Asks an active run to stop; it then ends with `run_failed` category `canceled`.
|
|
36
|
+
* Canceling an ended run succeeds and changes nothing.
|
|
37
37
|
*/
|
|
38
38
|
cancelRun(input: AssistantRunIdInput, options?: PolyesterRequestOptions): Promise<void>;
|
|
39
39
|
/**
|
|
@@ -73,7 +73,7 @@ declare class AssistantService {
|
|
|
73
73
|
/**
|
|
74
74
|
* Returns the caller's limits on what they may approve from Telegram, in US dollars of
|
|
75
75
|
* notional value, and the value approved from Telegram in the last 24 hours while a limit
|
|
76
|
-
* was set. Limits apply to placing, swapping, modifying and resuming;
|
|
76
|
+
* was set. Limits apply to placing, swapping, modifying and resuming; canceling, pausing
|
|
77
77
|
* and rejecting are never limited.
|
|
78
78
|
*/
|
|
79
79
|
getTelegramApprovalLimits(options?: PolyesterRequestOptions): Promise<TelegramApprovalLimits & {
|
|
@@ -48,8 +48,8 @@ var AssistantService = class {
|
|
|
48
48
|
for await (const response of this.#client.watchRun(request, toConnectCallOptions(options))) if (response.event) yield formatRunEvent(response.event, this.#scales);
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
* Asks an active run to stop; it then ends with `run_failed` category `
|
|
52
|
-
*
|
|
51
|
+
* Asks an active run to stop; it then ends with `run_failed` category `canceled`.
|
|
52
|
+
* Canceling an ended run succeeds and changes nothing.
|
|
53
53
|
*/
|
|
54
54
|
async cancelRun(input, options) {
|
|
55
55
|
const request = parse(AssistantRunIdInputSchema, input);
|
|
@@ -129,7 +129,7 @@ var AssistantService = class {
|
|
|
129
129
|
/**
|
|
130
130
|
* Returns the caller's limits on what they may approve from Telegram, in US dollars of
|
|
131
131
|
* notional value, and the value approved from Telegram in the last 24 hours while a limit
|
|
132
|
-
* was set. Limits apply to placing, swapping, modifying and resuming;
|
|
132
|
+
* was set. Limits apply to placing, swapping, modifying and resuming; canceling, pausing
|
|
133
133
|
* and rejecting are never limited.
|
|
134
134
|
*/
|
|
135
135
|
async getTelegramApprovalLimits(options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.js","names":["#client","Proto.AssistantService","#scales"],"sources":["../../../src/services/assistant/assistant.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport { formatRunEvent, type AssistantRunEvent } from \"./assistant-events.schemas.js\";\nimport { ApprovalStatusCodec, type AssistantApprovalStatus } from \"./assistant.codecs.js\";\nimport {\n AssistantRunIdInputSchema,\n CompleteAssistantKeysInputSchema,\n DecideAssistantApprovalInputSchema,\n DeleteAssistantMemoryInputSchema,\n formatAssistantKey,\n formatConversation,\n formatMemory,\n formatMessage,\n formatPrepareAssistantKeysResult,\n formatTelegramApprovalLimits,\n ListAssistantConversationsInputSchema,\n ListAssistantMemoriesInputSchema,\n ListAssistantMessagesInputSchema,\n PrepareAssistantKeysInputSchema,\n SendAssistantMessageInputSchema,\n SetTelegramApprovalLimitsInputSchema,\n WatchAssistantRunInputSchema,\n type AssistantKey,\n type AssistantRunIdInput,\n type CompleteAssistantKeysInput,\n type DecideAssistantApprovalInput,\n type DeleteAssistantMemoryInput,\n type ListAssistantConversationsInput,\n type ListAssistantConversationsResult,\n type ListAssistantMemoriesInput,\n type ListAssistantMemoriesResult,\n type ListAssistantMessagesInput,\n type ListAssistantMessagesResult,\n type PrepareAssistantKeysInput,\n type PrepareAssistantKeysResult,\n type SendAssistantMessageInput,\n type SetTelegramApprovalLimitsInput,\n type TelegramApprovalLimits,\n type WatchAssistantRunInput,\n} from \"./assistant.schemas.js\";\n\n/**\n * The Polyester trading assistant. `sendMessage` starts a run that answers the message;\n * follow it with `watchRun`. A run continues on the server when nobody watches it. Actions that\n * change the account wait for `decideApproval`. Needs a session login; every conversation, run,\n * approval and memory belongs to the signed-in user. Errors carry\n * `detail: { service: \"assistant\", code }`.\n */\nexport class AssistantService {\n #client: Client<typeof Proto.AssistantService>;\n #scales: SdkScales;\n\n constructor(transports: AuthApiTransports, scales: SdkScales) {\n this.#client = createClient(Proto.AssistantService, transports.authApi);\n this.#scales = scales;\n }\n\n /**\n * Records the message and starts a run that answers it; returns once the run is recorded.\n * Idempotent per `idempotencyKey`: repeat the request unchanged to resolve an unknown\n * outcome. A conversation runs one run at a time (`RUN_ACTIVE`).\n */\n async sendMessage(\n input: SendAssistantMessageInput,\n options?: PolyesterRequestOptions,\n ): Promise<{ runId: string; conversationId: string }> {\n const request = parse(SendAssistantMessageInputSchema, input);\n const response = await this.#client.sendMessage(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n runId: formatId(response.runId),\n conversationId: formatId(response.conversationId),\n };\n }\n\n /**\n * Streams a run's events in `seq` order: the recorded events after `afterSeq`, then new ones\n * as they are recorded. Ends after `run_completed` or `run_failed`; watching an ended run\n * replays it. The server may end the stream early: call again with the last `seq` received\n * as `afterSeq` to continue without gaps or repeats. Abort with `options.signal`.\n */\n async *watchRun(\n input: WatchAssistantRunInput,\n options?: PolyesterRequestOptions,\n ): AsyncGenerator<AssistantRunEvent, void, undefined> {\n const request = parse(WatchAssistantRunInputSchema, input);\n await this.#scales.ready();\n for await (const response of this.#client.watchRun(\n request,\n toConnectCallOptions(options),\n )) {\n if (response.event) yield formatRunEvent(response.event, this.#scales);\n }\n }\n\n /**\n * Asks an active run to stop; it then ends with `run_failed` category `cancelled`.\n * Cancelling an ended run succeeds and changes nothing.\n */\n async cancelRun(input: AssistantRunIdInput, options?: PolyesterRequestOptions): Promise<void> {\n const request = parse(AssistantRunIdInputSchema, input);\n await this.#client.cancelRun(request, toConnectCallOptions(options));\n }\n\n /**\n * Approves or rejects a pending approval from an `approval_requested` event. An approved\n * action runs exactly as its summary says, at most once. Repeating the same decision returns\n * the recorded status.\n */\n async decideApproval(\n input: DecideAssistantApprovalInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantApprovalStatus | \"unspecified\"> {\n const request = parse(DecideAssistantApprovalInputSchema, input);\n const response = await this.#client.decideApproval(request, toConnectCallOptions(options));\n return enumLabel(ApprovalStatusCodec.protoToOutput, response.status);\n }\n\n /** Lists the caller's conversations, most recently updated first. */\n async listConversations(\n input: ListAssistantConversationsInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantConversationsResult> {\n const request = parse(ListAssistantConversationsInputSchema, input);\n const response = await this.#client.listConversations(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n conversations: response.conversations.map(formatConversation),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /** Lists one conversation's messages, newest first. */\n async listMessages(\n input: ListAssistantMessagesInput,\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantMessagesResult> {\n const request = parse(ListAssistantMessagesInputSchema, input);\n const response = await this.#client.listMessages(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n messages: response.messages.map(formatMessage),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /**\n * Lists what the assistant remembers about the caller, newest first. A `profile` memory\n * applies to every answer; the others are used when relevant.\n */\n async listMemories(\n input: ListAssistantMemoriesInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantMemoriesResult> {\n const request = parse(ListAssistantMemoriesInputSchema, input);\n const response = await this.#client.listMemories(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n memories: response.memories.map(formatMemory),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /** Makes the assistant forget one memory. Deleting a deleted memory succeeds. */\n async deleteMemory(\n input: DeleteAssistantMemoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<void> {\n const request = parse(DeleteAssistantMemoryInputSchema, input);\n await this.#client.deleteMemory(request, toConnectCallOptions(options));\n }\n\n /**\n * Step 1 of giving the assistant keys: the assistant generates one Ed25519 key pair per\n * account and returns the public keys with their registration proofs. Register them with\n * `apiKeys.setAssistantKeys` (with a fresh `stepUpToken`) before `expiresAt`, then call\n * `completeKeys`. The step-up token goes to `setAssistantKeys` only, never to the assistant.\n */\n async prepareKeys(\n input: PrepareAssistantKeysInput,\n options?: PolyesterRequestOptions,\n ): Promise<PrepareAssistantKeysResult> {\n const request = parse(PrepareAssistantKeysInputSchema, input);\n const response = await this.#client.prepareAssistantKeys(\n { accounts: request.accounts.map((account) => removeUndefined(account)) },\n toConnectCallOptions(options),\n );\n return formatPrepareAssistantKeysResult(response);\n }\n\n /**\n * Finishes a key setup once `apiKeys.setAssistantKeys` registered its keys; returns the keys\n * the assistant now holds. Completing a completed setup returns the keys again.\n */\n async completeKeys(\n input: CompleteAssistantKeysInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantKey[]> {\n const request = parse(CompleteAssistantKeysInputSchema, input);\n const response = await this.#client.completeAssistantKeys(\n request,\n toConnectCallOptions(options),\n );\n return response.keys.map(formatAssistantKey);\n }\n\n /**\n * Lists the keys the assistant holds, at most one per account. An account without one has\n * no account tools. Revoke them with `apiKeys.deleteAssistantKeys`.\n */\n async listKeys(options?: PolyesterRequestOptions): Promise<AssistantKey[]> {\n const response = await this.#client.listAssistantKeys({}, toConnectCallOptions(options));\n return response.keys.map(formatAssistantKey);\n }\n\n /**\n * Returns the caller's limits on what they may approve from Telegram, in US dollars of\n * notional value, and the value approved from Telegram in the last 24 hours while a limit\n * was set. Limits apply to placing, swapping, modifying and resuming; cancelling, pausing\n * and rejecting are never limited.\n */\n async getTelegramApprovalLimits(\n options?: PolyesterRequestOptions,\n ): Promise<TelegramApprovalLimits & { approvedLast24hUsd: string }> {\n const response = await this.#client.getTelegramApprovalLimits(\n {},\n toConnectCallOptions(options),\n );\n return {\n ...formatTelegramApprovalLimits(response.limits),\n approvedLast24hUsd: response.approvedLast24hUsd,\n };\n }\n\n /**\n * Replaces both Telegram approval limits: a limit left out is turned off. Only a signed-in\n * session sets them; they apply to the next approval from Telegram. Returns the limits as\n * recorded.\n */\n async setTelegramApprovalLimits(\n input: SetTelegramApprovalLimitsInput,\n options?: PolyesterRequestOptions,\n ): Promise<TelegramApprovalLimits> {\n const limits = parse(SetTelegramApprovalLimitsInputSchema, input);\n const response = await this.#client.setTelegramApprovalLimits(\n { limits: removeUndefined(limits) },\n toConnectCallOptions(options),\n );\n return formatTelegramAp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AAM,0BACF,SACgE;EAChE,MAAM,WAAW,MAAM,KAAKA,QAAQ,0BAChC,CAAC,GACD,qBAAqB,OAAO,CAChC;EACA,OAAO;GACH,GAAG,6BAA6B,SAAS,MAAM;GAC/C,oBAAoB,SAAS;EACjC;CACJ;;;;;;CAOA,MAAM,0BACF,OACA,SAC+B;EAC/B,MAAM,SAAS,MAAM,sCAAsC,KAAK;EAChE,MAAM,WAAW,MAAM,KAAKA,QAAQ,0BAChC,EAAE,QAAQ,gBAAgB,MAAM,EAAE,GAClC,qBAAqB,OAAO,CAChC;EACA,OAAO,6BAA6B,SAAS,MAAM;CACvD;AACJ"}
|
|
1
|
+
{"version":3,"file":"assistant.js","names":["#client","Proto.AssistantService","#scales"],"sources":["../../../src/services/assistant/assistant.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport { formatRunEvent, type AssistantRunEvent } from \"./assistant-events.schemas.js\";\nimport { ApprovalStatusCodec, type AssistantApprovalStatus } from \"./assistant.codecs.js\";\nimport {\n AssistantRunIdInputSchema,\n CompleteAssistantKeysInputSchema,\n DecideAssistantApprovalInputSchema,\n DeleteAssistantMemoryInputSchema,\n formatAssistantKey,\n formatConversation,\n formatMemory,\n formatMessage,\n formatPrepareAssistantKeysResult,\n formatTelegramApprovalLimits,\n ListAssistantConversationsInputSchema,\n ListAssistantMemoriesInputSchema,\n ListAssistantMessagesInputSchema,\n PrepareAssistantKeysInputSchema,\n SendAssistantMessageInputSchema,\n SetTelegramApprovalLimitsInputSchema,\n WatchAssistantRunInputSchema,\n type AssistantKey,\n type AssistantRunIdInput,\n type CompleteAssistantKeysInput,\n type DecideAssistantApprovalInput,\n type DeleteAssistantMemoryInput,\n type ListAssistantConversationsInput,\n type ListAssistantConversationsResult,\n type ListAssistantMemoriesInput,\n type ListAssistantMemoriesResult,\n type ListAssistantMessagesInput,\n type ListAssistantMessagesResult,\n type PrepareAssistantKeysInput,\n type PrepareAssistantKeysResult,\n type SendAssistantMessageInput,\n type SetTelegramApprovalLimitsInput,\n type TelegramApprovalLimits,\n type WatchAssistantRunInput,\n} from \"./assistant.schemas.js\";\n\n/**\n * The Polyester trading assistant. `sendMessage` starts a run that answers the message;\n * follow it with `watchRun`. A run continues on the server when nobody watches it. Actions that\n * change the account wait for `decideApproval`. Needs a session login; every conversation, run,\n * approval and memory belongs to the signed-in user. Errors carry\n * `detail: { service: \"assistant\", code }`.\n */\nexport class AssistantService {\n #client: Client<typeof Proto.AssistantService>;\n #scales: SdkScales;\n\n constructor(transports: AuthApiTransports, scales: SdkScales) {\n this.#client = createClient(Proto.AssistantService, transports.authApi);\n this.#scales = scales;\n }\n\n /**\n * Records the message and starts a run that answers it; returns once the run is recorded.\n * Idempotent per `idempotencyKey`: repeat the request unchanged to resolve an unknown\n * outcome. A conversation runs one run at a time (`RUN_ACTIVE`).\n */\n async sendMessage(\n input: SendAssistantMessageInput,\n options?: PolyesterRequestOptions,\n ): Promise<{ runId: string; conversationId: string }> {\n const request = parse(SendAssistantMessageInputSchema, input);\n const response = await this.#client.sendMessage(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n runId: formatId(response.runId),\n conversationId: formatId(response.conversationId),\n };\n }\n\n /**\n * Streams a run's events in `seq` order: the recorded events after `afterSeq`, then new ones\n * as they are recorded. Ends after `run_completed` or `run_failed`; watching an ended run\n * replays it. The server may end the stream early: call again with the last `seq` received\n * as `afterSeq` to continue without gaps or repeats. Abort with `options.signal`.\n */\n async *watchRun(\n input: WatchAssistantRunInput,\n options?: PolyesterRequestOptions,\n ): AsyncGenerator<AssistantRunEvent, void, undefined> {\n const request = parse(WatchAssistantRunInputSchema, input);\n await this.#scales.ready();\n for await (const response of this.#client.watchRun(\n request,\n toConnectCallOptions(options),\n )) {\n if (response.event) yield formatRunEvent(response.event, this.#scales);\n }\n }\n\n /**\n * Asks an active run to stop; it then ends with `run_failed` category `canceled`.\n * Canceling an ended run succeeds and changes nothing.\n */\n async cancelRun(input: AssistantRunIdInput, options?: PolyesterRequestOptions): Promise<void> {\n const request = parse(AssistantRunIdInputSchema, input);\n await this.#client.cancelRun(request, toConnectCallOptions(options));\n }\n\n /**\n * Approves or rejects a pending approval from an `approval_requested` event. An approved\n * action runs exactly as its summary says, at most once. Repeating the same decision returns\n * the recorded status.\n */\n async decideApproval(\n input: DecideAssistantApprovalInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantApprovalStatus | \"unspecified\"> {\n const request = parse(DecideAssistantApprovalInputSchema, input);\n const response = await this.#client.decideApproval(request, toConnectCallOptions(options));\n return enumLabel(ApprovalStatusCodec.protoToOutput, response.status);\n }\n\n /** Lists the caller's conversations, most recently updated first. */\n async listConversations(\n input: ListAssistantConversationsInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantConversationsResult> {\n const request = parse(ListAssistantConversationsInputSchema, input);\n const response = await this.#client.listConversations(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n conversations: response.conversations.map(formatConversation),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /** Lists one conversation's messages, newest first. */\n async listMessages(\n input: ListAssistantMessagesInput,\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantMessagesResult> {\n const request = parse(ListAssistantMessagesInputSchema, input);\n const response = await this.#client.listMessages(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n messages: response.messages.map(formatMessage),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /**\n * Lists what the assistant remembers about the caller, newest first. A `profile` memory\n * applies to every answer; the others are used when relevant.\n */\n async listMemories(\n input: ListAssistantMemoriesInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantMemoriesResult> {\n const request = parse(ListAssistantMemoriesInputSchema, input);\n const response = await this.#client.listMemories(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n memories: response.memories.map(formatMemory),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /** Makes the assistant forget one memory. Deleting a deleted memory succeeds. */\n async deleteMemory(\n input: DeleteAssistantMemoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<void> {\n const request = parse(DeleteAssistantMemoryInputSchema, input);\n await this.#client.deleteMemory(request, toConnectCallOptions(options));\n }\n\n /**\n * Step 1 of giving the assistant keys: the assistant generates one Ed25519 key pair per\n * account and returns the public keys with their registration proofs. Register them with\n * `apiKeys.setAssistantKeys` (with a fresh `stepUpToken`) before `expiresAt`, then call\n * `completeKeys`. The step-up token goes to `setAssistantKeys` only, never to the assistant.\n */\n async prepareKeys(\n input: PrepareAssistantKeysInput,\n options?: PolyesterRequestOptions,\n ): Promise<PrepareAssistantKeysResult> {\n const request = parse(PrepareAssistantKeysInputSchema, input);\n const response = await this.#client.prepareAssistantKeys(\n { accounts: request.accounts.map((account) => removeUndefined(account)) },\n toConnectCallOptions(options),\n );\n return formatPrepareAssistantKeysResult(response);\n }\n\n /**\n * Finishes a key setup once `apiKeys.setAssistantKeys` registered its keys; returns the keys\n * the assistant now holds. Completing a completed setup returns the keys again.\n */\n async completeKeys(\n input: CompleteAssistantKeysInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantKey[]> {\n const request = parse(CompleteAssistantKeysInputSchema, input);\n const response = await this.#client.completeAssistantKeys(\n request,\n toConnectCallOptions(options),\n );\n return response.keys.map(formatAssistantKey);\n }\n\n /**\n * Lists the keys the assistant holds, at most one per account. An account without one has\n * no account tools. Revoke them with `apiKeys.deleteAssistantKeys`.\n */\n async listKeys(options?: PolyesterRequestOptions): Promise<AssistantKey[]> {\n const response = await this.#client.listAssistantKeys({}, toConnectCallOptions(options));\n return response.keys.map(formatAssistantKey);\n }\n\n /**\n * Returns the caller's limits on what they may approve from Telegram, in US dollars of\n * notional value, and the value approved from Telegram in the last 24 hours while a limit\n * was set. Limits apply to placing, swapping, modifying and resuming; canceling, pausing\n * and rejecting are never limited.\n */\n async getTelegramApprovalLimits(\n options?: PolyesterRequestOptions,\n ): Promise<TelegramApprovalLimits & { approvedLast24hUsd: string }> {\n const response = await this.#client.getTelegramApprovalLimits(\n {},\n toConnectCallOptions(options),\n );\n return {\n ...formatTelegramApprovalLimits(response.limits),\n approvedLast24hUsd: response.approvedLast24hUsd,\n };\n }\n\n /**\n * Replaces both Telegram approval limits: a limit left out is turned off. Only a signed-in\n * session sets them; they apply to the next approval from Telegram. Returns the limits as\n * recorded.\n */\n async setTelegramApprovalLimits(\n input: SetTelegramApprovalLimitsInput,\n options?: PolyesterRequestOptions,\n ): Promise<TelegramApprovalLimits> {\n const limits = parse(SetTelegramApprovalLimitsInputSchema, input);\n const response = await this.#client.setTelegramApprovalLimits(\n { limits: removeUndefined(limits) },\n toConnectCallOptions(options),\n );\n return formatTelegramApprovalLimits(response.limits);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0DA,IAAa,mBAAb,MAA8B;CAC1B;CACA;CAEA,YAAY,YAA+B,QAAmB;EAC1D,KAAKA,UAAU,aAAaC,oBAAwB,WAAW,OAAO;EACtE,KAAKC,UAAU;CACnB;;;;;;CAOA,MAAM,YACF,OACA,SACkD;EAClD,MAAM,UAAU,MAAM,iCAAiC,KAAK;EAC5D,MAAM,WAAW,MAAM,KAAKF,QAAQ,YAChC,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO;GACH,OAAO,SAAS,SAAS,KAAK;GAC9B,gBAAgB,SAAS,SAAS,cAAc;EACpD;CACJ;;;;;;;CAQA,OAAO,SACH,OACA,SACkD;EAClD,MAAM,UAAU,MAAM,8BAA8B,KAAK;EACzD,MAAM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AGA,MAAM,aACF,OACA,SACa;EACb,MAAM,UAAU,MAAM,kCAAkC,KAAK;EAC7D,MAAM,KAAKA,QAAQ,aAAa,SAAS,qBAAqB,OAAO,CAAC;CAC1E;;;;;;;CAQA,MAAM,YACF,OACA,SACmC;EACnC,MAAM,UAAU,MAAM,iCAAiC,KAAK;EAC5D,MAAM,WAAW,MAAM,KAAKA,QAAQ,qBAChC,EAAE,UAAU,QAAQ,SAAS,KAAK,YAAY,gBAAgB,OAAO,CAAC,EAAE,GACxE,qBAAqB,OAAO,CAChC;EACA,OAAO,iCAAiC,QAAQ;CACpD;;;;;CAMA,MAAM,aACF,OACA,SACuB;EACvB,MAAM,UAAU,MAAM,kCAAkC,KAAK;EAK7D,QAAO,MAJgB,KAAKA,QAAQ,sBAChC,SACA,qBAAqB,OAAO,CAChC,EAAA,CACgB,KAAK,IAAI,kBAAkB;CAC/C;;;;;CAMA,MAAM,SAAS,SAA4D;EAEvE,QAAO,MADgB,KAAKA,QAAQ,kBAAkB,CAAC,GAAG,qBAAqB,OAAO,CAAC,EAAA,CACvE,KAAK,IAAI,kBAAkB;CAC/C;;;;;;;CAQA,MAAM,0BACF,SACgE;EAChE,MAAM,WAAW,MAAM,KAAKA,QAAQ,0BAChC,CAAC,GACD,qBAAqB,OAAO,CAChC;EACA,OAAO;GACH,GAAG,6BAA6B,SAAS,MAAM;GAC/C,oBAAoB,SAAS;EACjC;CACJ;;;;;;CAOA,MAAM,0BACF,OACA,SAC+B;EAC/B,MAAM,SAAS,MAAM,sCAAsC,KAAK;EAChE,MAAM,WAAW,MAAM,KAAKA,QAAQ,0BAChC,EAAE,QAAQ,gBAAgB,MAAM,EAAE,GAClC,qBAAqB,OAAO,CAChC;EACA,OAAO,6BAA6B,SAAS,MAAM;CACvD;AACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApprovalDecision, AssistantKey as AssistantKey$1, Conversation, Memory, Message, PrepareAssistantKeysResponse, PreparedAssistantKey as PreparedAssistantKey$1 } from "../../gen/ai/v1/assistant_pb.js";
|
|
1
|
+
import { ApprovalDecision, AssistantKey as AssistantKey$1, Conversation, DisplaySetting, Memory, Message, PrepareAssistantKeysResponse, PreparedAssistantKey as PreparedAssistantKey$1 } from "../../gen/ai/v1/assistant_pb.js";
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
//#region src/services/assistant/assistant.schemas.d.ts
|
|
4
4
|
declare const SendAssistantMessageInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
@@ -9,8 +9,9 @@ declare const SendAssistantMessageInputSchema: v.SchemaWithPipe<readonly [v.Stri
|
|
|
9
9
|
/** Client-chosen key, unique per caller. Repeat the request unchanged to resolve an unknown outcome. */
|
|
10
10
|
readonly idempotencyKey: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
11
11
|
/**
|
|
12
|
-
* Trading account the run reads and acts on. Omit
|
|
13
|
-
*
|
|
12
|
+
* Trading account the run reads and acts on. Omit for the main account: the run then
|
|
13
|
+
* reads it (balances, trading accounts, API keys, price alerts, fees and permissions)
|
|
14
|
+
* but places, changes and cancels nothing, and asks the user to pick a trading account.
|
|
14
15
|
*/
|
|
15
16
|
readonly subaccountId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
|
|
16
17
|
/** Places in the client the run may suggest, at most 100, each id once. */
|
|
@@ -30,6 +31,23 @@ declare const SendAssistantMessageInputSchema: v.SchemaWithPipe<readonly [v.Stri
|
|
|
30
31
|
title: string;
|
|
31
32
|
description: string;
|
|
32
33
|
}[], "Destination ids must be distinct.">]>, undefined>;
|
|
34
|
+
/**
|
|
35
|
+
* The page the user is on as they send the message; omit for a client without pages.
|
|
36
|
+
* Covered by `idempotencyKey`: a retry must send the page the first attempt sent.
|
|
37
|
+
*/
|
|
38
|
+
readonly page: v.OptionalSchema<v.StrictObjectSchema<{
|
|
39
|
+
/** The page's `destinations` id, when it is one of them. */
|
|
40
|
+
readonly destinationId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "destinationId must be 1-64 of a-z, 0-9, -">]>, undefined>;
|
|
41
|
+
/** Route template with bracketed parameters, e.g. `"/account/settings/[section]"`. */
|
|
42
|
+
readonly route: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "route must start with / and use at most 200 of A-Z, a-z, 0-9, /, -, _, ., [, ]">]>;
|
|
43
|
+
/** The page's title as the client shows it, 1 to 80 characters; never the user's own data. */
|
|
44
|
+
readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
|
|
45
|
+
}, undefined>, undefined>;
|
|
46
|
+
/**
|
|
47
|
+
* Display settings the client offers now and will change when a run's
|
|
48
|
+
* `display_setting_action` asks, each once. Omit for none.
|
|
49
|
+
*/
|
|
50
|
+
readonly displaySettings: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["appearance", "language", "currency", "date_format", "time_format", "number_format", "week_start", "sounds"], undefined>, undefined>, v.CheckAction<("appearance" | "language" | "currency" | "date_format" | "time_format" | "number_format" | "week_start" | "sounds")[], "Display settings must be distinct.">, v.TransformAction<("appearance" | "language" | "currency" | "date_format" | "time_format" | "number_format" | "week_start" | "sounds")[], (DisplaySetting.APPEARANCE | DisplaySetting.LANGUAGE | DisplaySetting.CURRENCY | DisplaySetting.DATE_FORMAT | DisplaySetting.TIME_FORMAT | DisplaySetting.NUMBER_FORMAT | DisplaySetting.WEEK_START | DisplaySetting.SOUNDS)[]>]>, undefined>;
|
|
33
51
|
}, undefined>]>;
|
|
34
52
|
type SendAssistantMessageInput = v.InferInput<typeof SendAssistantMessageInputSchema>;
|
|
35
53
|
declare const AssistantRunIdInputSchema: v.StrictObjectSchema<{
|
|
@@ -126,7 +144,7 @@ declare function formatMemory(m: Memory): {
|
|
|
126
144
|
createdAt: number | undefined;
|
|
127
145
|
/** Omitted when the conversation it was learned in is unknown. */
|
|
128
146
|
conversationId: string | undefined;
|
|
129
|
-
kind: "unspecified" | "
|
|
147
|
+
kind: "unspecified" | "profile" | "fact" | "planning_figure";
|
|
130
148
|
};
|
|
131
149
|
type AssistantMemory = ReturnType<typeof formatMemory>;
|
|
132
150
|
declare function formatAssistantKey(k: AssistantKey$1): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.schemas.d.ts","names":[],"sources":["../../../src/services/assistant/assistant.schemas.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"assistant.schemas.d.ts","names":[],"sources":["../../../src/services/assistant/assistant.schemas.ts"],"mappings":";;;cAgEa,iCAA+B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+ChC,4BAA4B,EAAE,kBAAkB;cAE/C,2BAAyB,EAAA;;;KAE1B,sBAAsB,EAAE,kBAAkB;cAEzC,8BAA4B,EAAA,yBAAA,EAAA;;;;;;;;;;;KAY7B,yBAAyB,EAAE,kBAAkB;cAE5C,oCAAkC,EAAA,yBAAA,EAAA;;;;;;;;;;KAWnC,+BAA+B,EAAE,kBAAkB;cAElD,uCAAqC,EAAA;;;;;;KAEtC,kCAAkC,EAAE,kBACrC;cAGE,kCAAgC,EAAA;;;;;KAKjC,6BAA6B,EAAE,kBAAkB;cAEhD,kCAAgC,EAAA;;;;;;KAEjC,6BAA6B,EAAE,kBAAkB;cAEhD,kCAAgC,EAAA;;;KAIjC,6BAA6B,EAAE,kBAAkB;cAEhD,iCAA+B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;KAgBhC,4BAA4B,EAAE,kBAAkB;cAE/C,kCAAgC,EAAA;;;KAIjC,6BAA6B,EAAE,kBAAkB;iBAQ7C,mBAAmB,G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