@polyester/sdk 0.36.0-devnet-20261112202000 → 0.36.0-devnet-20261114152753
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 +33 -1
- package/dist/catalogs/index.d.ts +2 -2
- package/dist/catalogs/snapshot-validation.js +3 -1
- package/dist/catalogs/snapshot-validation.js.map +1 -1
- package/dist/catalogs/zipper-catalog.d.ts +2 -0
- package/dist/catalogs/zipper-catalog.d.ts.map +1 -1
- package/dist/catalogs/zipper-catalog.js.map +1 -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/auth/v1/policies_pb.d.ts +9 -1
- package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/policies_pb.js +9 -1
- package/dist/gen/auth/v1/policies_pb.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +7 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js +7 -1
- package/dist/gen/auth/v1/subaccounts_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/chain/zipper/v1/zipper_pb.d.ts +47 -2
- package/dist/gen/chain/zipper/v1/zipper_pb.d.ts.map +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.js +36 -2
- package/dist/gen/chain/zipper/v1/zipper_pb.js.map +1 -1
- package/dist/gen/changelog/v1/changelog_pb.d.ts +488 -5
- package/dist/gen/changelog/v1/changelog_pb.d.ts.map +1 -1
- package/dist/gen/changelog/v1/changelog_pb.js +159 -15
- package/dist/gen/changelog/v1/changelog_pb.js.map +1 -1
- package/dist/gen/index.d.ts +2 -1
- package/dist/gen/index.js +2 -1
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +128 -5
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts.map +1 -1
- package/dist/gen/ledger/read/v1/ledger_read_pb.js +17 -3
- 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/marketdata/v1/asset_info_pb.d.ts +178 -0
- package/dist/gen/marketdata/v1/asset_info_pb.d.ts.map +1 -0
- package/dist/gen/marketdata/v1/asset_info_pb.js +45 -0
- package/dist/gen/marketdata/v1/asset_info_pb.js.map +1 -0
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts +12 -0
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts.map +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js +6 -1
- package/dist/gen/marketdata/v1/marketdata_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/swap/quickswap/v1/quickswap_broker_pb.d.ts +12 -0
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +12 -0
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +13 -9
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js +10 -7
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts +2 -2
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.js.map +1 -1
- package/dist/gen/system/v1/system_pb.d.ts +408 -3
- package/dist/gen/system/v1/system_pb.d.ts.map +1 -1
- package/dist/gen/system/v1/system_pb.js +221 -3
- package/dist/gen/system/v1/system_pb.js.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +12 -4
- package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js +6 -4
- package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
- package/dist/index.d.ts +13 -9
- 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 +131 -71
- 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 +10 -1
- package/dist/services/assistant/assistant.codecs.d.ts.map +1 -1
- package/dist/services/assistant/assistant.codecs.js +41 -1
- package/dist/services/assistant/assistant.codecs.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 +19 -19
- package/dist/services/balances/balances.d.ts +12 -1
- package/dist/services/balances/balances.d.ts.map +1 -1
- package/dist/services/balances/balances.js +37 -1
- package/dist/services/balances/balances.js.map +1 -1
- package/dist/services/balances/balances.schemas.d.ts +55 -1
- package/dist/services/balances/balances.schemas.d.ts.map +1 -1
- package/dist/services/balances/balances.schemas.js +22 -1
- package/dist/services/balances/balances.schemas.js.map +1 -1
- package/dist/services/balances/balances.types.d.ts +2 -2
- 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/checkpoints/checkpoints.schemas.d.ts +3 -3
- package/dist/services/claims/claims.schemas.d.ts +2 -2
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- 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 +64 -63
- 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-data/market-data.d.ts +7 -1
- package/dist/services/market-data/market-data.d.ts.map +1 -1
- package/dist/services/market-data/market-data.js +12 -1
- package/dist/services/market-data/market-data.js.map +1 -1
- package/dist/services/market-data/market-data.schemas.d.ts +108 -1
- package/dist/services/market-data/market-data.schemas.d.ts.map +1 -1
- package/dist/services/market-data/market-data.schemas.js +42 -2
- package/dist/services/market-data/market-data.schemas.js.map +1 -1
- package/dist/services/market-data/market-data.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 +91 -2
- 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/orderbook/orderbook.schemas.d.ts +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +2 -2
- package/dist/services/orders/orders-batch.schemas.d.ts +47 -47
- package/dist/services/orders/orders-input.schemas.d.ts +6 -6
- package/dist/services/orders/orders-output.schemas.d.ts +21 -21
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -15
- package/dist/services/policies/shared.codecs.js +6 -3
- package/dist/services/policies/shared.codecs.js.map +1 -1
- package/dist/services/policies/shared.d.ts +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +3 -3
- package/dist/services/price-alerts/price-alerts.schemas.d.ts +10 -10
- package/dist/services/rewards/rewards.schemas.d.ts +4 -4
- package/dist/services/subaccounts/subaccounts.codecs.js +2 -1
- package/dist/services/subaccounts/subaccounts.codecs.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +13 -13
- package/dist/services/system/system.codecs.d.ts +20 -0
- package/dist/services/system/system.codecs.d.ts.map +1 -0
- package/dist/services/system/system.codecs.js +57 -0
- package/dist/services/system/system.codecs.js.map +1 -0
- package/dist/services/system/system.d.ts +7 -0
- package/dist/services/system/system.d.ts.map +1 -1
- package/dist/services/system/system.js +13 -0
- package/dist/services/system/system.js.map +1 -1
- package/dist/services/system/system.schemas.d.ts +234 -0
- package/dist/services/system/system.schemas.d.ts.map +1 -0
- package/dist/services/system/system.schemas.js +78 -0
- package/dist/services/system/system.schemas.js.map +1 -0
- package/dist/services/system/system.types.d.ts +4 -0
- package/dist/services/trades/trades.schemas.d.ts +2 -2
- package/dist/services/triggers/trigger-input.schemas.d.ts +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +47 -47
- 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/services/zipper/zipper.schemas.d.ts +2 -2
- package/dist/services/zipper/zipper.schemas.d.ts.map +1 -1
- package/dist/services/zipper/zipper.schemas.js +9 -2
- package/dist/services/zipper/zipper.schemas.js.map +1 -1
- package/dist/services/zipper/zipper.types.d.ts +2 -2
- package/dist/shared/catalog-config.d.ts +13 -1
- package/dist/shared/catalog-config.d.ts.map +1 -1
- package/dist/shared/catalog-config.js +6 -1
- package/dist/shared/catalog-config.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/dist/shared/rate-limit.schemas.d.ts +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,wBAAwB,kBAAkB;iBA0B7C,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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.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;CACn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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,0B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B;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"}
|
|
@@ -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",
|
|
@@ -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 \"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\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,C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"}
|
|
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"}
|
|
@@ -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" | "fact" | "planning_figure" | "profile";
|
|
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,GAAG;;;;;;;KAU1B,wBAAwB,kBAAkB;iBAEtC,cAAc,GAAG;;;;;;;;;KAYrB,mBAAmB,kBAAkB;iBAEjC,aAAa,GAAG;;;;;;;;KAWpB,kBAAkB,kBAAkB;iBAEhC,mBAAmB,GAAG;;;;;;;;KAW1B,eAAe,kBAAkB;iBAE7B,2BAA2B,GAAG;;;;;;;;;;KAalC,uBAAuB,kBAAkB;iBAErC,iCAAiC,GAAG;;;;;;;;;;;;;;;;KAUxC,6BAA6B,kBAAkB;;KAG/C;EACR,eAAe;EACf;;KAEQ;EAAgC,UAAU;EAAoB;;KAC9D;EAAgC,UAAU;EAAmB;;cAS5D,sCAAoC,EAAA;;;;;;KAOrC,iCAAiC,EAAE,kBACpC;;KAIC;EACR;EACA"}
|
|
@@ -2,7 +2,7 @@ import { formatId } from "../../utils/base58-id.js";
|
|
|
2
2
|
import { tsObjToMs } from "../../utils/time.js";
|
|
3
3
|
import { idInputSchema, optionalSubaccountIdInputSchema } from "../../shared/schemas.js";
|
|
4
4
|
import { enumLabel } from "../../shared/proto-enum-codec.js";
|
|
5
|
-
import { ASSISTANT_APPROVAL_DECISION_VALUES, ApprovalDecisionCodec, AssistantKeyStateCodec, MemoryKindCodec, MessageRoleCodec } from "./assistant.codecs.js";
|
|
5
|
+
import { ASSISTANT_APPROVAL_DECISION_VALUES, ASSISTANT_DISPLAY_SETTING_VALUES, ApprovalDecisionCodec, AssistantKeyStateCodec, DisplaySettingCodec, MemoryKindCodec, MessageRoleCodec } from "./assistant.codecs.js";
|
|
6
6
|
import * as v from "valibot";
|
|
7
7
|
import { bytesToHex } from "@noble/hashes/utils.js";
|
|
8
8
|
//#region src/services/assistant/assistant.schemas.ts
|
|
@@ -23,6 +23,18 @@ const DestinationInputSchema = v.strictObject({
|
|
|
23
23
|
/** What the user does there, at most 200 characters. */
|
|
24
24
|
description: v.optional(v.pipe(v.string(), v.maxLength(200)), "")
|
|
25
25
|
});
|
|
26
|
+
/**
|
|
27
|
+
* The page the user is on, named by its template and title, never by its address: never send the
|
|
28
|
+
* URL, its query or fragment, or any id or symbol taken from the path.
|
|
29
|
+
*/
|
|
30
|
+
const CurrentPageInputSchema = v.strictObject({
|
|
31
|
+
/** The page's `destinations` id, when it is one of them. */
|
|
32
|
+
destinationId: v.optional(v.pipe(v.string(), v.regex(/^[a-z0-9-]{1,64}$/, "destinationId must be 1-64 of a-z, 0-9, -"))),
|
|
33
|
+
/** Route template with bracketed parameters, e.g. `"/account/settings/[section]"`. */
|
|
34
|
+
route: v.pipe(v.string(), v.regex(/^\/[A-Za-z0-9/\-_.[\]]{0,199}$/, "route must start with / and use at most 200 of A-Z, a-z, 0-9, /, -, _, ., [, ]")),
|
|
35
|
+
/** The page's title as the client shows it, 1 to 80 characters; never the user's own data. */
|
|
36
|
+
title: v.pipe(v.string(), v.minLength(1), v.maxLength(80))
|
|
37
|
+
});
|
|
26
38
|
const SendAssistantMessageInputSchema = v.pipe(v.strictObject({
|
|
27
39
|
/** Conversation to continue; omit to start a new one. */
|
|
28
40
|
conversationId: v.optional(idInputSchema("conversationId")),
|
|
@@ -31,12 +43,23 @@ const SendAssistantMessageInputSchema = v.pipe(v.strictObject({
|
|
|
31
43
|
/** Client-chosen key, unique per caller. Repeat the request unchanged to resolve an unknown outcome. */
|
|
32
44
|
idempotencyKey: IdempotencyKeySchema,
|
|
33
45
|
/**
|
|
34
|
-
* Trading account the run reads and acts on. Omit
|
|
35
|
-
*
|
|
46
|
+
* Trading account the run reads and acts on. Omit for the main account: the run then
|
|
47
|
+
* reads it (balances, trading accounts, API keys, price alerts, fees and permissions)
|
|
48
|
+
* but places, changes and cancels nothing, and asks the user to pick a trading account.
|
|
36
49
|
*/
|
|
37
50
|
subaccountId: optionalSubaccountIdInputSchema(),
|
|
38
51
|
/** Places in the client the run may suggest, at most 100, each id once. */
|
|
39
|
-
destinations: v.optional(v.pipe(v.array(DestinationInputSchema), v.maxLength(100, "At most 100 destinations are allowed."), v.check((items) => new Set(items.map((d) => d.id)).size === items.length, "Destination ids must be distinct.")))
|
|
52
|
+
destinations: v.optional(v.pipe(v.array(DestinationInputSchema), v.maxLength(100, "At most 100 destinations are allowed."), v.check((items) => new Set(items.map((d) => d.id)).size === items.length, "Destination ids must be distinct."))),
|
|
53
|
+
/**
|
|
54
|
+
* The page the user is on as they send the message; omit for a client without pages.
|
|
55
|
+
* Covered by `idempotencyKey`: a retry must send the page the first attempt sent.
|
|
56
|
+
*/
|
|
57
|
+
page: v.optional(CurrentPageInputSchema),
|
|
58
|
+
/**
|
|
59
|
+
* Display settings the client offers now and will change when a run's
|
|
60
|
+
* `display_setting_action` asks, each once. Omit for none.
|
|
61
|
+
*/
|
|
62
|
+
displaySettings: v.optional(v.pipe(v.array(v.picklist(ASSISTANT_DISPLAY_SETTING_VALUES)), v.check((items) => new Set(items).size === items.length, "Display settings must be distinct."), v.transform((items) => items.map((item) => DisplaySettingCodec.inputToProto[item]))))
|
|
40
63
|
}));
|
|
41
64
|
const AssistantRunIdInputSchema = v.strictObject({ runId: idInputSchema("runId") });
|
|
42
65
|
const WatchAssistantRunInputSchema = v.pipe(v.strictObject({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.schemas.js","names":[],"sources":["../../../src/services/assistant/assistant.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { bytesToHex } from \"@noble/hashes/utils.js\";\nimport type * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport { idInputSchema, optionalSubaccountIdInputSchema } from \"../../shared/schemas.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { tsObjToMs } from \"../../utils/time.js\";\nimport {\n ASSISTANT_APPROVAL_DECISION_VALUES,\n ApprovalDecisionCodec,\n AssistantKeyStateCodec,\n MemoryKindCodec,\n MessageRoleCodec,\n} from \"./assistant.codecs.js\";\n\nconst IdempotencyKeySchema = v.pipe(v.string(), v.trim(), v.minLength(1));\n\nfunction pageInputEntries(maxLimit: number) {\n return {\n /** Page size; omit for the server default. */\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(maxLimit))),\n /** The previous page's `nextPageToken`. */\n pageToken: v.optional(v.pipe(v.string(), v.trim())),\n };\n}\n\nconst DestinationInputSchema = v.strictObject({\n /** The client's id for the place, e.g. `\"page-subaccounts\"`: lowercase letters, digits and hyphens. */\n id: v.pipe(\n v.string(),\n v.regex(/^[a-z0-9-]{1,64}$/, \"destination id must be 1-64 of a-z, 0-9, -\"),\n ),\n /** Its name as the client shows it, 1 to 80 characters. */\n title: v.pipe(v.string(), v.minLength(1), v.maxLength(80)),\n /** What the user does there, at most 200 characters. */\n description: v.optional(v.pipe(v.string(), v.maxLength(200)), \"\"),\n});\n\nexport const SendAssistantMessageInputSchema = v.pipe(\n v.strictObject({\n /** Conversation to continue; omit to start a new one. */\n conversationId: v.optional(idInputSchema(\"conversationId\")),\n /** Message text, plain text or Markdown, 1 to 16000 characters. */\n text: v.pipe(v.string(), v.minLength(1), v.maxLength(16_000)),\n /** Client-chosen key, unique per caller. Repeat the request unchanged to resolve an unknown outcome. */\n idempotencyKey: IdempotencyKeySchema,\n /**\n * Trading account the run reads and acts on. Omit to answer without account data: the\n * run then has no account tools.\n */\n subaccountId: optionalSubaccountIdInputSchema(),\n /** Places in the client the run may suggest, at most 100, each id once. */\n destinations: v.optional(\n v.pipe(\n v.array(DestinationInputSchema),\n v.maxLength(100, \"At most 100 destinations are allowed.\"),\n v.check(\n (items) => new Set(items.map((d) => d.id)).size === items.length,\n \"Destination ids must be distinct.\",\n ),\n ),\n ),\n }),\n);\n\nexport type SendAssistantMessageInput = v.InferInput<typeof SendAssistantMessageInputSchema>;\n\nexport const AssistantRunIdInputSchema = v.strictObject({ runId: idInputSchema(\"runId\") });\n\nexport type AssistantRunIdInput = v.InferInput<typeof AssistantRunIdInputSchema>;\n\nexport const WatchAssistantRunInputSchema = v.pipe(\n v.strictObject({\n runId: idInputSchema(\"runId\"),\n /** Return events after this seq. 0 (default) replays the run; pass the last seq received to resume. */\n afterSeq: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(Number.MAX_SAFE_INTEGER)),\n 0,\n ),\n }),\n v.transform(({ runId, afterSeq }) => ({ runId, afterSeq: BigInt(afterSeq) })),\n);\n\nexport type WatchAssistantRunInput = v.InferInput<typeof WatchAssistantRunInputSchema>;\n\nexport const DecideAssistantApprovalInputSchema = v.pipe(\n v.strictObject({\n approvalId: idInputSchema(\"approvalId\"),\n decision: v.picklist(ASSISTANT_APPROVAL_DECISION_VALUES),\n }),\n v.transform(({ approvalId, decision }) => ({\n approvalId,\n decision: ApprovalDecisionCodec.inputToProto[decision],\n })),\n);\n\nexport type DecideAssistantApprovalInput = v.InferInput<typeof DecideAssistantApprovalInputSchema>;\n\nexport const ListAssistantConversationsInputSchema = v.strictObject(pageInputEntries(100));\n\nexport type ListAssistantConversationsInput = v.InferInput<\n typeof ListAssistantConversationsInputSchema\n>;\n\nexport const ListAssistantMessagesInputSchema = v.strictObject({\n conversationId: idInputSchema(\"conversationId\"),\n ...pageInputEntries(200),\n});\n\nexport type ListAssistantMessagesInput = v.InferInput<typeof ListAssistantMessagesInputSchema>;\n\nexport const ListAssistantMemoriesInputSchema = v.strictObject(pageInputEntries(200));\n\nexport type ListAssistantMemoriesInput = v.InferInput<typeof ListAssistantMemoriesInputSchema>;\n\nexport const DeleteAssistantMemoryInputSchema = v.strictObject({\n memoryId: idInputSchema(\"memoryId\"),\n});\n\nexport type DeleteAssistantMemoryInput = v.InferInput<typeof DeleteAssistantMemoryInputSchema>;\n\nexport const PrepareAssistantKeysInputSchema = v.pipe(\n v.strictObject({\n /** 1 to 64 accounts, each once. An entry without `subaccountId` is the main account. */\n accounts: v.pipe(\n v.array(v.strictObject({ subaccountId: optionalSubaccountIdInputSchema() })),\n v.minLength(1, \"At least one account is required.\"),\n v.maxLength(64, \"At most 64 accounts are allowed.\"),\n ),\n }),\n v.check(\n ({ accounts }) =>\n new Set(accounts.map((a) => a.subaccountId ?? 0n)).size === accounts.length,\n \"Each account may be named only once.\",\n ),\n);\n\nexport type PrepareAssistantKeysInput = v.InferInput<typeof PrepareAssistantKeysInputSchema>;\n\nexport const CompleteAssistantKeysInputSchema = v.strictObject({\n setupId: idInputSchema(\"setupId\"),\n});\n\nexport type CompleteAssistantKeysInput = v.InferInput<typeof CompleteAssistantKeysInputSchema>;\n\n/* ---------- outputs ---------- */\n\nfunction optionalId(id: bigint | undefined): string | undefined {\n return id ? formatId(id) : undefined;\n}\n\nexport function formatConversation(c: Proto.Conversation) {\n return {\n conversationId: formatId(c.conversationId),\n /** Empty until a title is available. */\n title: c.title,\n createdAt: tsObjToMs(c.createdAt),\n updatedAt: tsObjToMs(c.updatedAt),\n };\n}\n\nexport type AssistantConversation = ReturnType<typeof formatConversation>;\n\nexport function formatMessage(m: Proto.Message) {\n return {\n messageId: formatId(m.messageId),\n role: enumLabel(MessageRoleCodec.protoToOutput, m.role),\n /** Markdown. For an assistant message, its run's final text. */\n text: m.text,\n createdAt: tsObjToMs(m.createdAt),\n /** Replay this run with `watchRun` from `afterSeq: 0` to show its tool activity and views. */\n runId: formatId(m.runId),\n };\n}\n\nexport type AssistantMessage = ReturnType<typeof formatMessage>;\n\nexport function formatMemory(m: Proto.Memory) {\n return {\n memoryId: formatId(m.memoryId),\n text: m.text,\n createdAt: tsObjToMs(m.createdAt),\n /** Omitted when the conversation it was learned in is unknown. */\n conversationId: optionalId(m.conversationId),\n kind: enumLabel(MemoryKindCodec.protoToOutput, m.kind),\n };\n}\n\nexport type AssistantMemory = ReturnType<typeof formatMemory>;\n\nexport function formatAssistantKey(k: Proto.AssistantKey) {\n return {\n /** Omitted for the main account. */\n subaccountId: optionalId(k.subaccountId),\n keyId: k.keyId,\n publicKeyEd25519: k.publicKeyEd25519,\n publicKeyHex: bytesToHex(k.publicKeyEd25519),\n state: enumLabel(AssistantKeyStateCodec.protoToOutput, k.state),\n };\n}\n\nexport type AssistantKey = ReturnType<typeof formatAssistantKey>;\n\nexport function formatPreparedAssistantKey(k: Proto.PreparedAssistantKey) {\n return {\n /** Omitted for the main account. */\n subaccountId: optionalId(k.subaccountId),\n publicKeyEd25519: k.publicKeyEd25519,\n publicKeyHex: bytesToHex(k.publicKeyEd25519),\n /** Pass unchanged to `apiKeys.setAssistantKeys`. */\n registrationProof: k.registrationProof,\n /** Epoch ms; pass unchanged to `apiKeys.setAssistantKeys`. */\n registrationDeadline: tsObjToMs(k.registrationDeadline),\n };\n}\n\nexport type PreparedAssistantKey = ReturnType<typeof formatPreparedAssistantKey>;\n\nexport function formatPrepareAssistantKeysResult(r: Proto.PrepareAssistantKeysResponse) {\n return {\n setupId: formatId(r.setupId),\n /** One key per requested account, in request order. */\n keys: r.keys.map(formatPreparedAssistantKey),\n /** Epoch ms after which the keys can no longer be registered. */\n expiresAt: tsObjToMs(r.expiresAt),\n };\n}\n\nexport type PrepareAssistantKeysResult = ReturnType<typeof formatPrepareAssistantKeysResult>;\n\n/** `nextPageToken` is empty when no more results exist. */\nexport type ListAssistantConversationsResult = {\n conversations: AssistantConversation[];\n nextPageToken: string;\n};\nexport type ListAssistantMessagesResult = { messages: AssistantMessage[]; nextPageToken: string };\nexport type ListAssistantMemoriesResult = { memories: AssistantMemory[]; nextPageToken: string };\n\n/** US dollars as a decimal string with at most 2 decimal places, e.g. `\"5000\"` or `\"250.50\"`. */\nconst UsdLimitInputSchema = v.pipe(\n v.string(),\n v.trim(),\n v.regex(/^\\d+(\\.\\d{1,2})?$/, \"limit must be US dollars with at most 2 decimal places\"),\n);\n\nexport const SetTelegramApprovalLimitsInputSchema = v.strictObject({\n /** Largest notional value of one approval from Telegram. `\"0\"` allows none; omit for no limit. */\n perApprovalUsd: v.optional(UsdLimitInputSchema),\n /** Largest total notional value approved from Telegram in any rolling 24 hours; omit for no limit. */\n dailyUsd: v.optional(UsdLimitInputSchema),\n});\n\nexport type SetTelegramApprovalLimitsInput = v.InferInput<\n typeof SetTelegramApprovalLimitsInputSchema\n>;\n\n/** Limits on what the caller may approve from Telegram, in US dollars; `null` is no limit. */\nexport type TelegramApprovalLimits = {\n perApprovalUsd: string | null;\n dailyUsd: string | null;\n};\n\nexport function formatTelegramApprovalLimits(\n limits: Proto.TelegramApprovalLimits | undefined,\n): TelegramApprovalLimits {\n return {\n perApprovalUsd: limits?.perApprovalUsd ?? null,\n dailyUsd: limits?.dailyUsd ?? null,\n };\n}\n"],"mappings":";;;;;;;;AAeA,MAAM,uBAAuB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,CAAC;AAExE,SAAS,iBAAiB,UAAkB;CACxC,OAAO;;EAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,QAAQ,CAAC,CAAC;;EAEtF,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EA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import * as v from \"valibot\";\nimport { bytesToHex } from \"@noble/hashes/utils.js\";\nimport type * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport { idInputSchema, optionalSubaccountIdInputSchema } from \"../../shared/schemas.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { tsObjToMs } from \"../../utils/time.js\";\nimport {\n ASSISTANT_APPROVAL_DECISION_VALUES,\n ASSISTANT_DISPLAY_SETTING_VALUES,\n ApprovalDecisionCodec,\n AssistantKeyStateCodec,\n DisplaySettingCodec,\n MemoryKindCodec,\n MessageRoleCodec,\n} from \"./assistant.codecs.js\";\n\nconst IdempotencyKeySchema = v.pipe(v.string(), v.trim(), v.minLength(1));\n\nfunction pageInputEntries(maxLimit: number) {\n return {\n /** Page size; omit for the server default. */\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(maxLimit))),\n /** The previous page's `nextPageToken`. */\n pageToken: v.optional(v.pipe(v.string(), v.trim())),\n };\n}\n\nconst DestinationInputSchema = v.strictObject({\n /** The client's id for the place, e.g. `\"page-subaccounts\"`: lowercase letters, digits and hyphens. */\n id: v.pipe(\n v.string(),\n v.regex(/^[a-z0-9-]{1,64}$/, \"destination id must be 1-64 of a-z, 0-9, -\"),\n ),\n /** Its name as the client shows it, 1 to 80 characters. */\n title: v.pipe(v.string(), v.minLength(1), v.maxLength(80)),\n /** What the user does there, at most 200 characters. */\n description: v.optional(v.pipe(v.string(), v.maxLength(200)), \"\"),\n});\n\n/**\n * The page the user is on, named by its template and title, never by its address: never send the\n * URL, its query or fragment, or any id or symbol taken from the path.\n */\nconst CurrentPageInputSchema = v.strictObject({\n /** The page's `destinations` id, when it is one of them. */\n destinationId: v.optional(\n v.pipe(\n v.string(),\n v.regex(/^[a-z0-9-]{1,64}$/, \"destinationId must be 1-64 of a-z, 0-9, -\"),\n ),\n ),\n /** Route template with bracketed parameters, e.g. `\"/account/settings/[section]\"`. */\n route: v.pipe(\n v.string(),\n v.regex(\n /^\\/[A-Za-z0-9/\\-_.[\\]]{0,199}$/,\n \"route must start with / and use at most 200 of A-Z, a-z, 0-9, /, -, _, ., [, ]\",\n ),\n ),\n /** The page's title as the client shows it, 1 to 80 characters; never the user's own data. */\n title: v.pipe(v.string(), v.minLength(1), v.maxLength(80)),\n});\n\nexport const SendAssistantMessageInputSchema = v.pipe(\n v.strictObject({\n /** Conversation to continue; omit to start a new one. */\n conversationId: v.optional(idInputSchema(\"conversationId\")),\n /** Message text, plain text or Markdown, 1 to 16000 characters. */\n text: v.pipe(v.string(), v.minLength(1), v.maxLength(16_000)),\n /** Client-chosen key, unique per caller. Repeat the request unchanged to resolve an unknown outcome. */\n idempotencyKey: IdempotencyKeySchema,\n /**\n * Trading account the run reads and acts on. Omit for the main account: the run then\n * reads it (balances, trading accounts, API keys, price alerts, fees and permissions)\n * but places, changes and cancels nothing, and asks the user to pick a trading account.\n */\n subaccountId: optionalSubaccountIdInputSchema(),\n /** Places in the client the run may suggest, at most 100, each id once. */\n destinations: v.optional(\n v.pipe(\n v.array(DestinationInputSchema),\n v.maxLength(100, \"At most 100 destinations are allowed.\"),\n v.check(\n (items) => new Set(items.map((d) => d.id)).size === items.length,\n \"Destination ids must be distinct.\",\n ),\n ),\n ),\n /**\n * The page the user is on as they send the message; omit for a client without pages.\n * Covered by `idempotencyKey`: a retry must send the page the first attempt sent.\n */\n page: v.optional(CurrentPageInputSchema),\n /**\n * Display settings the client offers now and will change when a run's\n * `display_setting_action` asks, each once. Omit for none.\n */\n displaySettings: v.optional(\n v.pipe(\n v.array(v.picklist(ASSISTANT_DISPLAY_SETTING_VALUES)),\n v.check(\n (items) => new Set(items).size === items.length,\n \"Display settings must be distinct.\",\n ),\n v.transform((items) => items.map((item) => DisplaySettingCodec.inputToProto[item])),\n ),\n ),\n }),\n);\n\nexport type SendAssistantMessageInput = v.InferInput<typeof SendAssistantMessageInputSchema>;\n\nexport const AssistantRunIdInputSchema = v.strictObject({ runId: idInputSchema(\"runId\") });\n\nexport type AssistantRunIdInput = v.InferInput<typeof AssistantRunIdInputSchema>;\n\nexport const WatchAssistantRunInputSchema = v.pipe(\n v.strictObject({\n runId: idInputSchema(\"runId\"),\n /** Return events after this seq. 0 (default) replays the run; pass the last seq received to resume. */\n afterSeq: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(Number.MAX_SAFE_INTEGER)),\n 0,\n ),\n }),\n v.transform(({ runId, afterSeq }) => ({ runId, afterSeq: BigInt(afterSeq) })),\n);\n\nexport type WatchAssistantRunInput = v.InferInput<typeof WatchAssistantRunInputSchema>;\n\nexport const DecideAssistantApprovalInputSchema = v.pipe(\n v.strictObject({\n approvalId: idInputSchema(\"approvalId\"),\n decision: v.picklist(ASSISTANT_APPROVAL_DECISION_VALUES),\n }),\n v.transform(({ approvalId, decision }) => ({\n approvalId,\n decision: ApprovalDecisionCodec.inputToProto[decision],\n })),\n);\n\nexport type DecideAssistantApprovalInput = v.InferInput<typeof DecideAssistantApprovalInputSchema>;\n\nexport const ListAssistantConversationsInputSchema = v.strictObject(pageInputEntries(100));\n\nexport type ListAssistantConversationsInput = v.InferInput<\n typeof ListAssistantConversationsInputSchema\n>;\n\nexport const ListAssistantMessagesInputSchema = v.strictObject({\n conversationId: idInputSchema(\"conversationId\"),\n ...pageInputEntries(200),\n});\n\nexport type ListAssistantMessagesInput = v.InferInput<typeof ListAssistantMessagesInputSchema>;\n\nexport const ListAssistantMemoriesInputSchema = v.strictObject(pageInputEntries(200));\n\nexport type ListAssistantMemoriesInput = v.InferInput<typeof ListAssistantMemoriesInputSchema>;\n\nexport const DeleteAssistantMemoryInputSchema = v.strictObject({\n memoryId: idInputSchema(\"memoryId\"),\n});\n\nexport type DeleteAssistantMemoryInput = v.InferInput<typeof DeleteAssistantMemoryInputSchema>;\n\nexport const PrepareAssistantKeysInputSchema = v.pipe(\n v.strictObject({\n /** 1 to 64 accounts, each once. An entry without `subaccountId` is the main account. */\n accounts: v.pipe(\n v.array(v.strictObject({ subaccountId: optionalSubaccountIdInputSchema() })),\n v.minLength(1, \"At least one account is required.\"),\n v.maxLength(64, \"At most 64 accounts are allowed.\"),\n ),\n }),\n v.check(\n ({ accounts }) =>\n new Set(accounts.map((a) => a.subaccountId ?? 0n)).size === accounts.length,\n \"Each account may be named only once.\",\n ),\n);\n\nexport type PrepareAssistantKeysInput = v.InferInput<typeof PrepareAssistantKeysInputSchema>;\n\nexport const CompleteAssistantKeysInputSchema = v.strictObject({\n setupId: idInputSchema(\"setupId\"),\n});\n\nexport type CompleteAssistantKeysInput = v.InferInput<typeof CompleteAssistantKeysInputSchema>;\n\n/* ---------- outputs ---------- */\n\nfunction optionalId(id: bigint | undefined): string | undefined {\n return id ? formatId(id) : undefined;\n}\n\nexport function formatConversation(c: Proto.Conversation) {\n return {\n conversationId: formatId(c.conversationId),\n /** Empty until a title is available. */\n title: c.title,\n createdAt: tsObjToMs(c.createdAt),\n updatedAt: tsObjToMs(c.updatedAt),\n };\n}\n\nexport type AssistantConversation = ReturnType<typeof formatConversation>;\n\nexport function formatMessage(m: Proto.Message) {\n return {\n messageId: formatId(m.messageId),\n role: enumLabel(MessageRoleCodec.protoToOutput, m.role),\n /** Markdown. For an assistant message, its run's final text. */\n text: m.text,\n createdAt: tsObjToMs(m.createdAt),\n /** Replay this run with `watchRun` from `afterSeq: 0` to show its tool activity and views. */\n runId: formatId(m.runId),\n };\n}\n\nexport type AssistantMessage = ReturnType<typeof formatMessage>;\n\nexport function formatMemory(m: Proto.Memory) {\n return {\n memoryId: formatId(m.memoryId),\n text: m.text,\n createdAt: tsObjToMs(m.createdAt),\n /** Omitted when the conversation it was learned in is unknown. */\n conversationId: optionalId(m.conversationId),\n kind: enumLabel(MemoryKindCodec.protoToOutput, m.kind),\n };\n}\n\nexport type AssistantMemory = ReturnType<typeof formatMemory>;\n\nexport function formatAssistantKey(k: Proto.AssistantKey) {\n return {\n /** Omitted for the main account. */\n subaccountId: optionalId(k.subaccountId),\n keyId: k.keyId,\n publicKeyEd25519: k.publicKeyEd25519,\n publicKeyHex: bytesToHex(k.publicKeyEd25519),\n state: enumLabel(AssistantKeyStateCodec.protoToOutput, k.state),\n };\n}\n\nexport type AssistantKey = ReturnType<typeof formatAssistantKey>;\n\nexport function formatPreparedAssistantKey(k: Proto.PreparedAssistantKey) {\n return {\n /** Omitted for the main account. */\n subaccountId: optionalId(k.subaccountId),\n publicKeyEd25519: k.publicKeyEd25519,\n publicKeyHex: bytesToHex(k.publicKeyEd25519),\n /** Pass unchanged to `apiKeys.setAssistantKeys`. */\n registrationProof: k.registrationProof,\n /** Epoch ms; pass unchanged to `apiKeys.setAssistantKeys`. */\n registrationDeadline: tsObjToMs(k.registrationDeadline),\n };\n}\n\nexport type PreparedAssistantKey = ReturnType<typeof formatPreparedAssistantKey>;\n\nexport function formatPrepareAssistantKeysResult(r: Proto.PrepareAssistantKeysResponse) {\n return {\n setupId: formatId(r.setupId),\n /** One key per requested account, in request order. */\n keys: r.keys.map(formatPreparedAssistantKey),\n /** Epoch ms after which the keys can no longer be registered. */\n expiresAt: tsObjToMs(r.expiresAt),\n };\n}\n\nexport type PrepareAssistantKeysResult = ReturnType<typeof formatPrepareAssistantKeysResult>;\n\n/** `nextPageToken` is empty when no more results exist. */\nexport type ListAssistantConversationsResult = {\n conversations: AssistantConversation[];\n nextPageToken: string;\n};\nexport type ListAssistantMessagesResult = { messages: AssistantMessage[]; nextPageToken: string };\nexport type ListAssistantMemoriesResult = { memories: AssistantMemory[]; nextPageToken: string };\n\n/** US dollars as a decimal string with at most 2 decimal places, e.g. `\"5000\"` or `\"250.50\"`. */\nconst UsdLimitInputSchema = v.pipe(\n v.string(),\n v.trim(),\n v.regex(/^\\d+(\\.\\d{1,2})?$/, \"limit must be US dollars with at most 2 decimal places\"),\n);\n\nexport const SetTelegramApprovalLimitsInputSchema = v.strictObject({\n /** Largest notional value of one approval from Telegram. `\"0\"` allows none; omit for no limit. */\n perApprovalUsd: v.optional(UsdLimitInputSchema),\n /** Largest total notional value approved from Telegram in any rolling 24 hours; omit for no limit. */\n dailyUsd: v.optional(UsdLimitInputSchema),\n});\n\nexport type SetTelegramApprovalLimitsInput = v.InferInput<\n typeof SetTelegramApprovalLimitsInputSchema\n>;\n\n/** Limits on what the caller may approve from Telegram, in US dollars; `null` is no limit. */\nexport type TelegramApprovalLimits = {\n perApprovalUsd: string | null;\n dailyUsd: string | null;\n};\n\nexport function formatTelegramApprovalLimits(\n limits: Proto.TelegramApprovalLimits | undefined,\n): TelegramApprovalLimits {\n return {\n perApprovalUsd: limits?.perApprovalUsd ?? null,\n dailyUsd: limits?.dailyUsd ?? null,\n };\n}\n"],"mappings":";;;;;;;;AAiBA,MAAM,uBAAuB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,CAAC;AAExE,SAAS,iBAAiB,UAAkB;CACxC,OAAO;;EAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,QAAQ,CAAC,CAAC;;EAEtF,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,CAAC;CACtD;AACJ;AAEA,MAAM,yBAAyB,EAAE,aAAa;;CAE1C,IAAI,EAAE,KACF,EAAE,OAAO,GACT,EAAE,MAAM,qBAAqB,4CAA4C,CAC7E;;CAEA,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;;CAEzD,aAAa,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,GAAG,CAAC,GAAG,EAAE;AACpE,CAAC;;;;;AAMD,MAAM,yBAAyB,EAAE,aAAa;;CAE1C,eAAe,EAAE,SACb,EAAE,KACE,EAAE,OAAO,GACT,EAAE,MAAM,qBAAqB,2CAA2C,CAC5E,CACJ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QAAQ,YAAY;CAClC;AACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AssistantApprovalPreview, AssistantOrderPreview, AssistantRunEvent, AssistantView } from "./assistant-events.schemas.js";
|
|
2
|
-
import { AssistantApprovalDecision, AssistantApprovalStatus, AssistantFailureCategory, AssistantKeyState, AssistantMemoryKind, AssistantMessageRole, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy } from "./assistant.codecs.js";
|
|
2
|
+
import { AssistantApprovalDecision, AssistantApprovalStatus, AssistantDisplaySetting, AssistantFailureCategory, AssistantKeyState, AssistantMemoryKind, AssistantMessageRole, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy } from "./assistant.codecs.js";
|
|
3
3
|
import { AssistantConversation, AssistantKey, AssistantMemory, AssistantMessage, AssistantRunIdInput, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SetTelegramApprovalLimitsInput, TelegramApprovalLimits, WatchAssistantRunInput } from "./assistant.schemas.js";
|
|
4
|
-
export type { AssistantApprovalDecision, AssistantApprovalPreview, AssistantApprovalStatus, AssistantConversation, AssistantFailureCategory, AssistantKey, AssistantKeyState, AssistantMemory, AssistantMemoryKind, AssistantMessage, AssistantMessageRole, AssistantOrderPreview, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantRunEvent, AssistantRunIdInput, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy, AssistantView, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SetTelegramApprovalLimitsInput, TelegramApprovalLimits, WatchAssistantRunInput };
|
|
4
|
+
export type { AssistantApprovalDecision, AssistantApprovalPreview, AssistantApprovalStatus, AssistantConversation, AssistantDisplaySetting, AssistantFailureCategory, AssistantKey, AssistantKeyState, AssistantMemory, AssistantMemoryKind, AssistantMessage, AssistantMessageRole, AssistantOrderPreview, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantRunEvent, AssistantRunIdInput, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy, AssistantView, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SetTelegramApprovalLimitsInput, TelegramApprovalLimits, WatchAssistantRunInput };
|