@polyester/sdk 0.35.0-devnet-20261111140253 → 0.35.0-devnet-20261112024759
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 +12 -2
- package/dist/client.d.ts +6 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +6 -0
- package/dist/client.js.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.d.ts +2 -2
- package/dist/gen/ai/v1/assistant_pb.js +2 -2
- package/dist/gen/index.d.ts +11 -11
- package/dist/gen/index.js +9 -9
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/services/accounts/accounts.d.ts +1 -1
- package/dist/services/accounts/accounts.js +1 -1
- package/dist/services/accounts/accounts.js.map +1 -1
- package/dist/services/address-book/address-book.schemas.d.ts +2 -2
- package/dist/services/api-keys/api-keys.d.ts +18 -3
- package/dist/services/api-keys/api-keys.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.js +27 -3
- package/dist/services/api-keys/api-keys.js.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.d.ts +112 -1
- package/dist/services/api-keys/api-keys.schemas.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.js +26 -2
- package/dist/services/api-keys/api-keys.schemas.js.map +1 -1
- package/dist/services/api-keys/api-keys.types.d.ts +2 -2
- package/dist/services/api-keys/index.d.ts +2 -2
- package/dist/services/assistant/assistant-events.schemas.d.ts +4646 -0
- package/dist/services/assistant/assistant-events.schemas.d.ts.map +1 -0
- package/dist/services/assistant/assistant-events.schemas.js +485 -0
- package/dist/services/assistant/assistant-events.schemas.js.map +1 -0
- package/dist/services/assistant/assistant.codecs.d.ts +24 -0
- package/dist/services/assistant/assistant.codecs.d.ts.map +1 -0
- package/dist/services/assistant/assistant.codecs.js +88 -0
- package/dist/services/assistant/assistant.codecs.js.map +1 -0
- package/dist/services/assistant/assistant.d.ts +76 -0
- package/dist/services/assistant/assistant.d.ts.map +1 -0
- package/dist/services/assistant/assistant.js +133 -0
- package/dist/services/assistant/assistant.js.map +1 -0
- package/dist/services/assistant/assistant.schemas.d.ts +184 -0
- package/dist/services/assistant/assistant.schemas.d.ts.map +1 -0
- package/dist/services/assistant/assistant.schemas.js +135 -0
- package/dist/services/assistant/assistant.schemas.js.map +1 -0
- package/dist/services/assistant/assistant.types.d.ts +4 -0
- package/dist/services/assistant/service.d.ts +8 -0
- package/dist/services/assistant/service.d.ts.map +1 -0
- package/dist/services/assistant/service.js +9 -0
- package/dist/services/assistant/service.js.map +1 -0
- package/dist/services/auth/profile/profile.d.ts +2 -2
- package/dist/services/auth/profile/profile.js +2 -2
- package/dist/services/auth/profile/profile.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +19 -19
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js +1 -1
- package/dist/services/balances/balances.js +1 -1
- package/dist/services/candles/candles.js +1 -1
- package/dist/services/candles/candles.schemas.js +5 -2
- package/dist/services/candles/candles.schemas.js.map +1 -1
- package/dist/services/changelog/changelog.schemas.d.ts +17 -17
- package/dist/services/checkpoints/checkpoints.d.ts +2 -2
- package/dist/services/checkpoints/checkpoints.js +2 -2
- package/dist/services/checkpoints/checkpoints.js.map +1 -1
- package/dist/services/checkpoints/checkpoints.schemas.d.ts +2 -2
- package/dist/services/deposit/deposit.d.ts +2 -2
- package/dist/services/deposit/deposit.js +2 -2
- package/dist/services/deposit/deposit.js.map +1 -1
- package/dist/services/guard-signer/guard-signer.d.ts +1 -1
- package/dist/services/guard-signer/guard-signer.js +1 -1
- package/dist/services/guard-signer/guard-signer.js.map +1 -1
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +3 -3
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +54 -54
- package/dist/services/market-data/market-data.js +1 -1
- package/dist/services/market-overview/market-overview.schemas.d.ts +1 -1
- package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +32 -32
- package/dist/services/orders/orders-input.schemas.d.ts +4 -4
- package/dist/services/orders/orders-input.schemas.js +1 -1
- package/dist/services/orders/orders-modify.schemas.js +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +25 -25
- package/dist/services/orders/orders-output.schemas.js +3 -3
- package/dist/services/orders/orders-risk.schemas.js +1 -1
- package/dist/services/orders/orders.codecs.js +1 -1
- package/dist/services/orders/orders.js +3 -3
- package/dist/services/policies/api-key-policies/api-key-policies.d.ts +2 -2
- package/dist/services/policies/api-key-policies/api-key-policies.js +2 -2
- package/dist/services/policies/api-key-policies/api-key-policies.js.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.d.ts +2 -2
- package/dist/services/policies/subaccount-policies/subaccount-policies.js +2 -2
- package/dist/services/policies/subaccount-policies/subaccount-policies.js.map +1 -1
- package/dist/services/price-alerts/price-alerts.codecs.d.ts +20 -0
- package/dist/services/price-alerts/price-alerts.codecs.d.ts.map +1 -0
- package/dist/services/price-alerts/price-alerts.codecs.js +66 -0
- package/dist/services/price-alerts/price-alerts.codecs.js.map +1 -0
- package/dist/services/price-alerts/price-alerts.d.ts +38 -0
- package/dist/services/price-alerts/price-alerts.d.ts.map +1 -0
- package/dist/services/price-alerts/price-alerts.js +60 -0
- package/dist/services/price-alerts/price-alerts.js.map +1 -0
- package/dist/services/price-alerts/price-alerts.schemas.d.ts +309 -0
- package/dist/services/price-alerts/price-alerts.schemas.d.ts.map +1 -0
- package/dist/services/price-alerts/price-alerts.schemas.js +130 -0
- package/dist/services/price-alerts/price-alerts.schemas.js.map +1 -0
- package/dist/services/price-alerts/price-alerts.types.d.ts +3 -0
- package/dist/services/price-alerts/service.d.ts +8 -0
- package/dist/services/price-alerts/service.d.ts.map +1 -0
- package/dist/services/price-alerts/service.js +9 -0
- package/dist/services/price-alerts/service.js.map +1 -0
- package/dist/services/rewards/rewards.schemas.d.ts +4 -4
- package/dist/services/social-verification/social-verification.d.ts +1 -1
- package/dist/services/social-verification/social-verification.js +1 -1
- package/dist/services/social-verification/social-verification.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.d.ts +6 -6
- package/dist/services/subaccounts/subaccounts.js +6 -6
- package/dist/services/subaccounts/subaccounts.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +21 -21
- package/dist/services/system/service.d.ts +8 -0
- package/dist/services/system/service.d.ts.map +1 -0
- package/dist/services/system/service.js +9 -0
- package/dist/services/system/service.js.map +1 -0
- package/dist/services/system/system.d.ts +25 -0
- package/dist/services/system/system.d.ts.map +1 -0
- package/dist/services/system/system.js +24 -0
- package/dist/services/system/system.js.map +1 -0
- package/dist/services/trades/trades.js +1 -1
- package/dist/services/trades/trades.schemas.d.ts +2 -2
- package/dist/services/trades/trades.schemas.js +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.d.ts +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.js +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
- package/dist/services/triggers/trigger-child-order.schemas.js +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +1 -1
- package/dist/services/triggers/trigger-input.schemas.js +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +63 -63
- package/dist/services/triggers/triggers.codecs.js +1 -1
- package/dist/services/triggers/triggers.js +2 -2
- package/dist/services/vip/vip.d.ts +1 -1
- package/dist/services/vip/vip.js +1 -1
- package/dist/services/vip/vip.js.map +1 -1
- package/dist/shared/connect-error-mapping.d.ts.map +1 -1
- package/dist/shared/connect-error-mapping.js +1 -0
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/error-detail.d.ts +18 -10
- package/dist/shared/error-detail.d.ts.map +1 -1
- package/dist/shared/error-detail.js +2 -0
- package/dist/shared/error-detail.js.map +1 -1
- package/dist/shared/error-details/alerts.js +15 -0
- package/dist/shared/error-details/alerts.js.map +1 -0
- package/dist/shared/error-details/assistant.js +15 -0
- package/dist/shared/error-details/assistant.js.map +1 -0
- package/dist/wired-services.d.ts.map +1 -1
- package/dist/wired-services.js +11 -5
- package/dist/wired-services.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import "../../gen/ai/v1/assistant_pb.js";
|
|
2
|
+
//#region src/services/assistant/assistant.codecs.ts
|
|
3
|
+
const ASSISTANT_APPROVAL_DECISION_VALUES = ["approve", "reject"];
|
|
4
|
+
const MessageRoleCodec = { protoToOutput: {
|
|
5
|
+
[0]: "unspecified",
|
|
6
|
+
[1]: "user",
|
|
7
|
+
[2]: "assistant"
|
|
8
|
+
} };
|
|
9
|
+
const FailureCategoryCodec = { protoToOutput: {
|
|
10
|
+
[0]: "unspecified",
|
|
11
|
+
[1]: "cancelled",
|
|
12
|
+
[2]: "budget_exceeded",
|
|
13
|
+
[3]: "permission_denied",
|
|
14
|
+
[4]: "model_unavailable",
|
|
15
|
+
[5]: "unexpected_error"
|
|
16
|
+
} };
|
|
17
|
+
const ApprovalDecisionCodec = { inputToProto: {
|
|
18
|
+
approve: 1,
|
|
19
|
+
reject: 2
|
|
20
|
+
} };
|
|
21
|
+
const ApprovalStatusCodec = { protoToOutput: {
|
|
22
|
+
[0]: "unspecified",
|
|
23
|
+
[1]: "pending",
|
|
24
|
+
[2]: "approved",
|
|
25
|
+
[3]: "rejected",
|
|
26
|
+
[4]: "expired"
|
|
27
|
+
} };
|
|
28
|
+
const MemoryKindCodec = { protoToOutput: {
|
|
29
|
+
[0]: "unspecified",
|
|
30
|
+
[1]: "fact",
|
|
31
|
+
[2]: "planning_figure",
|
|
32
|
+
[3]: "profile"
|
|
33
|
+
} };
|
|
34
|
+
const AssistantKeyStateCodec = { protoToOutput: {
|
|
35
|
+
[0]: "unspecified",
|
|
36
|
+
[1]: "active",
|
|
37
|
+
[2]: "disabled"
|
|
38
|
+
} };
|
|
39
|
+
const ReferencePriceSourceCodec = { protoToOutput: {
|
|
40
|
+
[0]: "unspecified",
|
|
41
|
+
[1]: "best_bid",
|
|
42
|
+
[2]: "best_ask",
|
|
43
|
+
[3]: "last_price",
|
|
44
|
+
[4]: "index_price"
|
|
45
|
+
} };
|
|
46
|
+
const TriggerDirectionCodec = { protoToOutput: {
|
|
47
|
+
[0]: "unspecified",
|
|
48
|
+
[1]: "at_or_above",
|
|
49
|
+
[2]: "at_or_below"
|
|
50
|
+
} };
|
|
51
|
+
const OrderPriceFieldCodec = { protoToOutput: {
|
|
52
|
+
[0]: "unspecified",
|
|
53
|
+
[1]: "limit_price",
|
|
54
|
+
[2]: "trigger_price",
|
|
55
|
+
[3]: "activation_price",
|
|
56
|
+
[4]: "ladder_low_price",
|
|
57
|
+
[5]: "ladder_high_price",
|
|
58
|
+
[6]: "take_profit_trigger_price",
|
|
59
|
+
[7]: "take_profit_limit_price",
|
|
60
|
+
[8]: "stop_loss_trigger_price",
|
|
61
|
+
[9]: "stop_loss_limit_price",
|
|
62
|
+
[10]: "trailing_stop_activation_price",
|
|
63
|
+
[11]: "trailing_stop_limit_price"
|
|
64
|
+
} };
|
|
65
|
+
const PriceOffsetDirectionCodec = { protoToOutput: {
|
|
66
|
+
[0]: "unspecified",
|
|
67
|
+
[1]: "above",
|
|
68
|
+
[2]: "below"
|
|
69
|
+
} };
|
|
70
|
+
const PriceRoundingCodec = { protoToOutput: {
|
|
71
|
+
[0]: "unspecified",
|
|
72
|
+
[1]: "down",
|
|
73
|
+
[2]: "up"
|
|
74
|
+
} };
|
|
75
|
+
const UnfilledSlicePolicyCodec = { protoToOutput: {
|
|
76
|
+
[0]: "unspecified",
|
|
77
|
+
[1]: "cancel_before_next"
|
|
78
|
+
} };
|
|
79
|
+
const TriggerChangeActionCodec = { protoToOutput: {
|
|
80
|
+
[0]: "unspecified",
|
|
81
|
+
[1]: "modify",
|
|
82
|
+
[2]: "pause",
|
|
83
|
+
[3]: "resume"
|
|
84
|
+
} };
|
|
85
|
+
//#endregion
|
|
86
|
+
export { ASSISTANT_APPROVAL_DECISION_VALUES, ApprovalDecisionCodec, ApprovalStatusCodec, AssistantKeyStateCodec, FailureCategoryCodec, MemoryKindCodec, MessageRoleCodec, OrderPriceFieldCodec, PriceOffsetDirectionCodec, PriceRoundingCodec, ReferencePriceSourceCodec, TriggerChangeActionCodec, TriggerDirectionCodec, UnfilledSlicePolicyCodec };
|
|
87
|
+
|
|
88
|
+
//# sourceMappingURL=assistant.codecs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant.codecs.js","names":[],"sources":["../../../src/services/assistant/assistant.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const ASSISTANT_MESSAGE_ROLE_VALUES = [\"user\", \"assistant\"] as const;\nexport type AssistantMessageRole = (typeof ASSISTANT_MESSAGE_ROLE_VALUES)[number];\n\nexport const ASSISTANT_FAILURE_CATEGORY_VALUES = [\n \"cancelled\",\n \"budget_exceeded\",\n \"permission_denied\",\n \"model_unavailable\",\n \"unexpected_error\",\n] as const;\nexport type AssistantFailureCategory = (typeof ASSISTANT_FAILURE_CATEGORY_VALUES)[number];\n\nexport const ASSISTANT_APPROVAL_DECISION_VALUES = [\"approve\", \"reject\"] as const;\nexport type AssistantApprovalDecision = (typeof ASSISTANT_APPROVAL_DECISION_VALUES)[number];\n\nexport const ASSISTANT_APPROVAL_STATUS_VALUES = [\n \"pending\",\n \"approved\",\n \"rejected\",\n \"expired\",\n] as const;\nexport type AssistantApprovalStatus = (typeof ASSISTANT_APPROVAL_STATUS_VALUES)[number];\n\nexport const ASSISTANT_MEMORY_KIND_VALUES = [\"fact\", \"planning_figure\", \"profile\"] as const;\nexport type AssistantMemoryKind = (typeof ASSISTANT_MEMORY_KIND_VALUES)[number];\n\nexport const ASSISTANT_KEY_STATE_VALUES = [\"active\", \"disabled\"] as const;\nexport type AssistantKeyState = (typeof ASSISTANT_KEY_STATE_VALUES)[number];\n\nexport type AssistantReferencePriceSource = \"best_bid\" | \"best_ask\" | \"last_price\" | \"index_price\";\nexport type AssistantTriggerDirection = \"at_or_above\" | \"at_or_below\";\nexport type AssistantOrderPriceField =\n | \"limit_price\"\n | \"trigger_price\"\n | \"activation_price\"\n | \"ladder_low_price\"\n | \"ladder_high_price\"\n | \"take_profit_trigger_price\"\n | \"take_profit_limit_price\"\n | \"stop_loss_trigger_price\"\n | \"stop_loss_limit_price\"\n | \"trailing_stop_activation_price\"\n | \"trailing_stop_limit_price\";\nexport type AssistantPriceOffsetDirection = \"above\" | \"below\";\nexport type AssistantPriceRounding = \"down\" | \"up\";\nexport type AssistantUnfilledSlicePolicy = \"cancel_before_next\";\nexport type AssistantTriggerChangeAction = \"modify\" | \"pause\" | \"resume\";\n\nexport const MessageRoleCodec = {\n protoToOutput: {\n [Proto.MessageRole.ROLE_UNSPECIFIED]: \"unspecified\",\n [Proto.MessageRole.USER]: \"user\",\n [Proto.MessageRole.ASSISTANT]: \"assistant\",\n } satisfies ProtoToOutput<Proto.MessageRole, AssistantMessageRole>,\n} as const;\n\nexport const FailureCategoryCodec = {\n protoToOutput: {\n [Proto.FailureCategory.FAILURE_UNSPECIFIED]: \"unspecified\",\n [Proto.FailureCategory.CANCELLED]: \"cancelled\",\n [Proto.FailureCategory.BUDGET_EXCEEDED]: \"budget_exceeded\",\n [Proto.FailureCategory.PERMISSION_DENIED]: \"permission_denied\",\n [Proto.FailureCategory.MODEL_UNAVAILABLE]: \"model_unavailable\",\n [Proto.FailureCategory.UNEXPECTED_ERROR]: \"unexpected_error\",\n } satisfies ProtoToOutput<Proto.FailureCategory, AssistantFailureCategory>,\n} as const;\n\nexport const ApprovalDecisionCodec = {\n inputToProto: {\n approve: Proto.ApprovalDecision.APPROVE,\n reject: Proto.ApprovalDecision.REJECT,\n } satisfies InputToProto<AssistantApprovalDecision, Proto.ApprovalDecision>,\n} as const;\n\nexport const ApprovalStatusCodec = {\n protoToOutput: {\n [Proto.ApprovalStatus.APPROVAL_UNSPECIFIED]: \"unspecified\",\n [Proto.ApprovalStatus.PENDING]: \"pending\",\n [Proto.ApprovalStatus.APPROVED]: \"approved\",\n [Proto.ApprovalStatus.REJECTED]: \"rejected\",\n [Proto.ApprovalStatus.EXPIRED]: \"expired\",\n } satisfies ProtoToOutput<Proto.ApprovalStatus, AssistantApprovalStatus>,\n} as const;\n\nexport const MemoryKindCodec = {\n protoToOutput: {\n [Proto.MemoryKind.KIND_UNSPECIFIED]: \"unspecified\",\n [Proto.MemoryKind.FACT]: \"fact\",\n [Proto.MemoryKind.PLANNING_FIGURE]: \"planning_figure\",\n [Proto.MemoryKind.PROFILE]: \"profile\",\n } satisfies ProtoToOutput<Proto.MemoryKind, AssistantMemoryKind>,\n} as const;\n\nexport const AssistantKeyStateCodec = {\n protoToOutput: {\n [Proto.AssistantKeyState.KEY_STATE_UNSPECIFIED]: \"unspecified\",\n [Proto.AssistantKeyState.ACTIVE]: \"active\",\n [Proto.AssistantKeyState.DISABLED]: \"disabled\",\n } satisfies ProtoToOutput<Proto.AssistantKeyState, AssistantKeyState>,\n} as const;\n\nexport const ReferencePriceSourceCodec = {\n protoToOutput: {\n [Proto.ReferencePriceSource.PRICE_SOURCE_UNSPECIFIED]: \"unspecified\",\n [Proto.ReferencePriceSource.BEST_BID]: \"best_bid\",\n [Proto.ReferencePriceSource.BEST_ASK]: \"best_ask\",\n [Proto.ReferencePriceSource.LAST_PRICE]: \"last_price\",\n [Proto.ReferencePriceSource.INDEX_PRICE]: \"index_price\",\n } satisfies ProtoToOutput<Proto.ReferencePriceSource, AssistantReferencePriceSource>,\n} as const;\n\nexport const TriggerDirectionCodec = {\n protoToOutput: {\n [Proto.TriggerDirection.DIRECTION_UNSPECIFIED]: \"unspecified\",\n [Proto.TriggerDirection.AT_OR_ABOVE]: \"at_or_above\",\n [Proto.TriggerDirection.AT_OR_BELOW]: \"at_or_below\",\n } satisfies ProtoToOutput<Proto.TriggerDirection, AssistantTriggerDirection>,\n} as const;\n\nexport const OrderPriceFieldCodec = {\n protoToOutput: {\n [Proto.OrderPriceField.PRICE_FIELD_UNSPECIFIED]: \"unspecified\",\n [Proto.OrderPriceField.LIMIT_PRICE]: \"limit_price\",\n [Proto.OrderPriceField.TRIGGER_PRICE]: \"trigger_price\",\n [Proto.OrderPriceField.ACTIVATION_PRICE]: \"activation_price\",\n [Proto.OrderPriceField.LADDER_LOW_PRICE]: \"ladder_low_price\",\n [Proto.OrderPriceField.LADDER_HIGH_PRICE]: \"ladder_high_price\",\n [Proto.OrderPriceField.TAKE_PROFIT_TRIGGER_PRICE]: \"take_profit_trigger_price\",\n [Proto.OrderPriceField.TAKE_PROFIT_LIMIT_PRICE]: \"take_profit_limit_price\",\n [Proto.OrderPriceField.STOP_LOSS_TRIGGER_PRICE]: \"stop_loss_trigger_price\",\n [Proto.OrderPriceField.STOP_LOSS_LIMIT_PRICE]: \"stop_loss_limit_price\",\n [Proto.OrderPriceField.TRAILING_STOP_ACTIVATION_PRICE]: \"trailing_stop_activation_price\",\n [Proto.OrderPriceField.TRAILING_STOP_LIMIT_PRICE]: \"trailing_stop_limit_price\",\n } satisfies ProtoToOutput<Proto.OrderPriceField, AssistantOrderPriceField>,\n} as const;\n\nexport const PriceOffsetDirectionCodec = {\n protoToOutput: {\n [Proto.PriceOffsetDirection.OFFSET_DIRECTION_UNSPECIFIED]: \"unspecified\",\n [Proto.PriceOffsetDirection.ABOVE]: \"above\",\n [Proto.PriceOffsetDirection.BELOW]: \"below\",\n } satisfies ProtoToOutput<Proto.PriceOffsetDirection, AssistantPriceOffsetDirection>,\n} as const;\n\nexport const PriceRoundingCodec = {\n protoToOutput: {\n [Proto.PriceRounding.ROUNDING_UNSPECIFIED]: \"unspecified\",\n [Proto.PriceRounding.DOWN]: \"down\",\n [Proto.PriceRounding.UP]: \"up\",\n } satisfies ProtoToOutput<Proto.PriceRounding, AssistantPriceRounding>,\n} as const;\n\nexport const UnfilledSlicePolicyCodec = {\n protoToOutput: {\n [Proto.UnfilledSlicePolicy.UNFILLED_SLICE_UNSPECIFIED]: \"unspecified\",\n [Proto.UnfilledSlicePolicy.CANCEL_BEFORE_NEXT]: \"cancel_before_next\",\n } satisfies ProtoToOutput<Proto.UnfilledSlicePolicy, AssistantUnfilledSlicePolicy>,\n} as const;\n\nexport const TriggerChangeActionCodec = {\n protoToOutput: {\n [Proto.TriggerChangeAction.TRIGGER_CHANGE_UNSPECIFIED]: \"unspecified\",\n [Proto.TriggerChangeAction.MODIFY]: \"modify\",\n [Proto.TriggerChangeAction.PAUSE]: \"pause\",\n [Proto.TriggerChangeAction.RESUME]: \"resume\",\n } satisfies ProtoToOutput<Proto.TriggerChangeAction, AssistantTriggerChangeAction>,\n} as const;\n"],"mappings":";;AAeA,MAAa,qCAAqC,CAAC,WAAW,QAAQ;AAoCtE,MAAa,mBAAmB,EAC5B,eAAe;EAC2B,IAAA;EACZ,IAAA;EACK,IAAA;AACnC,EACJ;AAEA,MAAa,uBAAuB,EAChC,eAAe;EACkC,IAAA;EACV,IAAA;EACM,IAAA;EACE,IAAA;EACA,IAAA;EACD,IAAA;AAC9C,EACJ;AAEA,MAAa,wBAAwB,EACjC,cAAc;CACV,SAAA;CACA,QAAA;AACJ,EACJ;AAEA,MAAa,sBAAsB,EAC/B,eAAe;EACkC,IAAA;EACb,IAAA;EACC,IAAA;EACA,IAAA;EACD,IAAA;AACpC,EACJ;AAEA,MAAa,kBAAkB,EAC3B,eAAe;EAC0B,IAAA;EACZ,IAAA;EACW,IAAA;EACR,IAAA;AAChC,EACJ;AAEA,MAAa,yBAAyB,EAClC,eAAe;EACsC,IAAA;EACf,IAAA;EACE,IAAA;AACxC,EACJ;AAEA,MAAa,4BAA4B,EACrC,eAAe;EAC4C,IAAA;EAChB,IAAA;EACA,IAAA;EACE,IAAA;EACC,IAAA;AAC9C,EACJ;AAEA,MAAa,wBAAwB,EACjC,eAAe;EACqC,IAAA;EACV,IAAA;EACA,IAAA;AAC1C,EACJ;AAEA,MAAa,uBAAuB,EAChC,eAAe;EACsC,IAAA;EACZ,IAAA;EACE,IAAA;EACG,IAAA;EACA,IAAA;EACC,IAAA;EACQ,IAAA;EACF,IAAA;EACA,IAAA;EACF,IAAA;EACS,KAAA;EACL,KAAA;AACvD,EACJ;AAEA,MAAa,4BAA4B,EACrC,eAAe;EACgD,IAAA;EACvB,IAAA;EACA,IAAA;AACxC,EACJ;AAEA,MAAa,qBAAqB,EAC9B,eAAe;EACiC,IAAA;EAChB,IAAA;EACF,IAAA;AAC9B,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC6C,IAAA;EACR,IAAA;AACpD,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC6C,IAAA;EACpB,IAAA;EACD,IAAA;EACC,IAAA;AACxC,EACJ"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { AuthApiTransports } from "../../shared/transports.js";
|
|
2
|
+
import { PolyesterRequestOptions } from "../../shared/request-options.js";
|
|
3
|
+
import { SdkScales } from "../../shared/decimal-surface.js";
|
|
4
|
+
import { AssistantRunEvent } from "./assistant-events.schemas.js";
|
|
5
|
+
import { AssistantApprovalStatus } from "./assistant.codecs.js";
|
|
6
|
+
import { AssistantKey, AssistantRunIdInput, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, SendAssistantMessageInput, WatchAssistantRunInput } from "./assistant.schemas.js";
|
|
7
|
+
//#region src/services/assistant/assistant.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* The Polyester trading assistant. `sendMessage` starts a run that answers the message;
|
|
10
|
+
* follow it with `watchRun`. A run continues on the server when nobody watches it. Actions that
|
|
11
|
+
* change the account wait for `decideApproval`. Needs a session login; every conversation, run,
|
|
12
|
+
* approval and memory belongs to the signed-in user. Errors carry
|
|
13
|
+
* `detail: { service: "assistant", code }`.
|
|
14
|
+
*/
|
|
15
|
+
declare class AssistantService {
|
|
16
|
+
#private;
|
|
17
|
+
constructor(transports: AuthApiTransports, scales: SdkScales);
|
|
18
|
+
/**
|
|
19
|
+
* Records the message and starts a run that answers it; returns once the run is recorded.
|
|
20
|
+
* Idempotent per `idempotencyKey`: repeat the request unchanged to resolve an unknown
|
|
21
|
+
* outcome. A conversation runs one run at a time (`RUN_ACTIVE`).
|
|
22
|
+
*/
|
|
23
|
+
sendMessage(input: SendAssistantMessageInput, options?: PolyesterRequestOptions): Promise<{
|
|
24
|
+
runId: string;
|
|
25
|
+
conversationId: string;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Streams a run's events in `seq` order: the recorded events after `afterSeq`, then new ones
|
|
29
|
+
* as they are recorded. Ends after `run_completed` or `run_failed`; watching an ended run
|
|
30
|
+
* replays it. The server may end the stream early: call again with the last `seq` received
|
|
31
|
+
* as `afterSeq` to continue without gaps or repeats. Abort with `options.signal`.
|
|
32
|
+
*/
|
|
33
|
+
watchRun(input: WatchAssistantRunInput, options?: PolyesterRequestOptions): AsyncGenerator<AssistantRunEvent, void, undefined>;
|
|
34
|
+
/**
|
|
35
|
+
* Asks an active run to stop; it then ends with `run_failed` category `cancelled`.
|
|
36
|
+
* Cancelling an ended run succeeds and changes nothing.
|
|
37
|
+
*/
|
|
38
|
+
cancelRun(input: AssistantRunIdInput, options?: PolyesterRequestOptions): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Approves or rejects a pending approval from an `approval_requested` event. An approved
|
|
41
|
+
* action runs exactly as its summary says, at most once. Repeating the same decision returns
|
|
42
|
+
* the recorded status.
|
|
43
|
+
*/
|
|
44
|
+
decideApproval(input: DecideAssistantApprovalInput, options?: PolyesterRequestOptions): Promise<AssistantApprovalStatus | "unspecified">;
|
|
45
|
+
/** Lists the caller's conversations, most recently updated first. */
|
|
46
|
+
listConversations(input?: ListAssistantConversationsInput, options?: PolyesterRequestOptions): Promise<ListAssistantConversationsResult>;
|
|
47
|
+
/** Lists one conversation's messages, newest first. */
|
|
48
|
+
listMessages(input: ListAssistantMessagesInput, options?: PolyesterRequestOptions): Promise<ListAssistantMessagesResult>;
|
|
49
|
+
/**
|
|
50
|
+
* Lists what the assistant remembers about the caller, newest first. A `profile` memory
|
|
51
|
+
* applies to every answer; the others are used when relevant.
|
|
52
|
+
*/
|
|
53
|
+
listMemories(input?: ListAssistantMemoriesInput, options?: PolyesterRequestOptions): Promise<ListAssistantMemoriesResult>;
|
|
54
|
+
/** Makes the assistant forget one memory. Deleting a deleted memory succeeds. */
|
|
55
|
+
deleteMemory(input: DeleteAssistantMemoryInput, options?: PolyesterRequestOptions): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Step 1 of giving the assistant keys: the assistant generates one Ed25519 key pair per
|
|
58
|
+
* account and returns the public keys with their registration proofs. Register them with
|
|
59
|
+
* `apiKeys.setAssistantKeys` (with a fresh `stepUpToken`) before `expiresAt`, then call
|
|
60
|
+
* `completeKeys`. The step-up token goes to `setAssistantKeys` only, never to the assistant.
|
|
61
|
+
*/
|
|
62
|
+
prepareKeys(input: PrepareAssistantKeysInput, options?: PolyesterRequestOptions): Promise<PrepareAssistantKeysResult>;
|
|
63
|
+
/**
|
|
64
|
+
* Finishes a key setup once `apiKeys.setAssistantKeys` registered its keys; returns the keys
|
|
65
|
+
* the assistant now holds. Completing a completed setup returns the keys again.
|
|
66
|
+
*/
|
|
67
|
+
completeKeys(input: CompleteAssistantKeysInput, options?: PolyesterRequestOptions): Promise<AssistantKey[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Lists the keys the assistant holds, at most one per account. An account without one has
|
|
70
|
+
* no account tools. Revoke them with `apiKeys.deleteAssistantKeys`.
|
|
71
|
+
*/
|
|
72
|
+
listKeys(options?: PolyesterRequestOptions): Promise<AssistantKey[]>;
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { AssistantService };
|
|
76
|
+
//# sourceMappingURL=assistant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant.d.ts","names":[],"sources":["../../../src/services/assistant/assistant.ts"],"mappings":";;;;;;;;;;;;;;cAsDa;;EAIG,YAAA,YAAY,mBAAmB,QAAQ;;;;;;EAU7C,YACF,OAAO,2BACP,UAAU,0BACX;IAAU;IAAe;;;;;;;;EAkBrB,SACH,OAAO,wBACP,UAAU,0BACX,eAAe;;;;;EAeZ,UAAU,OAAO,qBAAqB,UAAU,0BAA0B;;;;;;EAU1E,eACF,OAAO,8BACP,UAAU,0BACX,QAAQ;;EAOL,kBACF,QAAO,iCACP,UAAU,0BACX,QAAQ;;EAaL,aACF,OAAO,4BACP,UAAU,0BACX,QAAQ;;;;;EAgBL,aACF,QAAO,4BACP,UAAU,0BACX,QAAQ;;EAaL,aACF,OAAO,4BACP,UAAU,0BACX;;;;;;;EAWG,YACF,OAAO,2BACP,UAAU,0BACX,QAAQ;;;;;EAaL,aACF,OAAO,4BACP,UAAU,0BACX,QAAQ;;;;;EAaL,SAAS,UAAU,0BAA0B,QAAQ"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { parse } from "../../shared/validation.js";
|
|
2
|
+
import { removeUndefined } from "../../utils/remove-undefined.js";
|
|
3
|
+
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
4
|
+
import { formatId } from "../../utils/base58-id.js";
|
|
5
|
+
import { enumLabel } from "../../shared/proto-enum-codec.js";
|
|
6
|
+
import { AssistantService as AssistantService$1 } from "../../gen/ai/v1/assistant_pb.js";
|
|
7
|
+
import { ApprovalStatusCodec } from "./assistant.codecs.js";
|
|
8
|
+
import { formatRunEvent } from "./assistant-events.schemas.js";
|
|
9
|
+
import { AssistantRunIdInputSchema, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInputSchema, ListAssistantMemoriesInputSchema, ListAssistantMessagesInputSchema, PrepareAssistantKeysInputSchema, SendAssistantMessageInputSchema, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult } from "./assistant.schemas.js";
|
|
10
|
+
import { createClient } from "@connectrpc/connect";
|
|
11
|
+
//#region src/services/assistant/assistant.ts
|
|
12
|
+
/**
|
|
13
|
+
* The Polyester trading assistant. `sendMessage` starts a run that answers the message;
|
|
14
|
+
* follow it with `watchRun`. A run continues on the server when nobody watches it. Actions that
|
|
15
|
+
* change the account wait for `decideApproval`. Needs a session login; every conversation, run,
|
|
16
|
+
* approval and memory belongs to the signed-in user. Errors carry
|
|
17
|
+
* `detail: { service: "assistant", code }`.
|
|
18
|
+
*/
|
|
19
|
+
var AssistantService = class {
|
|
20
|
+
#client;
|
|
21
|
+
#scales;
|
|
22
|
+
constructor(transports, scales) {
|
|
23
|
+
this.#client = createClient(AssistantService$1, transports.authApi);
|
|
24
|
+
this.#scales = scales;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Records the message and starts a run that answers it; returns once the run is recorded.
|
|
28
|
+
* Idempotent per `idempotencyKey`: repeat the request unchanged to resolve an unknown
|
|
29
|
+
* outcome. A conversation runs one run at a time (`RUN_ACTIVE`).
|
|
30
|
+
*/
|
|
31
|
+
async sendMessage(input, options) {
|
|
32
|
+
const request = parse(SendAssistantMessageInputSchema, input);
|
|
33
|
+
const response = await this.#client.sendMessage(removeUndefined(request), toConnectCallOptions(options));
|
|
34
|
+
return {
|
|
35
|
+
runId: formatId(response.runId),
|
|
36
|
+
conversationId: formatId(response.conversationId)
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Streams a run's events in `seq` order: the recorded events after `afterSeq`, then new ones
|
|
41
|
+
* as they are recorded. Ends after `run_completed` or `run_failed`; watching an ended run
|
|
42
|
+
* replays it. The server may end the stream early: call again with the last `seq` received
|
|
43
|
+
* as `afterSeq` to continue without gaps or repeats. Abort with `options.signal`.
|
|
44
|
+
*/
|
|
45
|
+
async *watchRun(input, options) {
|
|
46
|
+
const request = parse(WatchAssistantRunInputSchema, input);
|
|
47
|
+
await this.#scales.ready();
|
|
48
|
+
for await (const response of this.#client.watchRun(request, toConnectCallOptions(options))) if (response.event) yield formatRunEvent(response.event, this.#scales);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Asks an active run to stop; it then ends with `run_failed` category `cancelled`.
|
|
52
|
+
* Cancelling an ended run succeeds and changes nothing.
|
|
53
|
+
*/
|
|
54
|
+
async cancelRun(input, options) {
|
|
55
|
+
const request = parse(AssistantRunIdInputSchema, input);
|
|
56
|
+
await this.#client.cancelRun(request, toConnectCallOptions(options));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Approves or rejects a pending approval from an `approval_requested` event. An approved
|
|
60
|
+
* action runs exactly as its summary says, at most once. Repeating the same decision returns
|
|
61
|
+
* the recorded status.
|
|
62
|
+
*/
|
|
63
|
+
async decideApproval(input, options) {
|
|
64
|
+
const request = parse(DecideAssistantApprovalInputSchema, input);
|
|
65
|
+
const response = await this.#client.decideApproval(request, toConnectCallOptions(options));
|
|
66
|
+
return enumLabel(ApprovalStatusCodec.protoToOutput, response.status);
|
|
67
|
+
}
|
|
68
|
+
/** Lists the caller's conversations, most recently updated first. */
|
|
69
|
+
async listConversations(input = {}, options) {
|
|
70
|
+
const request = parse(ListAssistantConversationsInputSchema, input);
|
|
71
|
+
const response = await this.#client.listConversations(removeUndefined(request), toConnectCallOptions(options));
|
|
72
|
+
return {
|
|
73
|
+
conversations: response.conversations.map(formatConversation),
|
|
74
|
+
nextPageToken: response.nextPageToken
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** Lists one conversation's messages, newest first. */
|
|
78
|
+
async listMessages(input, options) {
|
|
79
|
+
const request = parse(ListAssistantMessagesInputSchema, input);
|
|
80
|
+
const response = await this.#client.listMessages(removeUndefined(request), toConnectCallOptions(options));
|
|
81
|
+
return {
|
|
82
|
+
messages: response.messages.map(formatMessage),
|
|
83
|
+
nextPageToken: response.nextPageToken
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Lists what the assistant remembers about the caller, newest first. A `profile` memory
|
|
88
|
+
* applies to every answer; the others are used when relevant.
|
|
89
|
+
*/
|
|
90
|
+
async listMemories(input = {}, options) {
|
|
91
|
+
const request = parse(ListAssistantMemoriesInputSchema, input);
|
|
92
|
+
const response = await this.#client.listMemories(removeUndefined(request), toConnectCallOptions(options));
|
|
93
|
+
return {
|
|
94
|
+
memories: response.memories.map(formatMemory),
|
|
95
|
+
nextPageToken: response.nextPageToken
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/** Makes the assistant forget one memory. Deleting a deleted memory succeeds. */
|
|
99
|
+
async deleteMemory(input, options) {
|
|
100
|
+
const request = parse(DeleteAssistantMemoryInputSchema, input);
|
|
101
|
+
await this.#client.deleteMemory(request, toConnectCallOptions(options));
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Step 1 of giving the assistant keys: the assistant generates one Ed25519 key pair per
|
|
105
|
+
* account and returns the public keys with their registration proofs. Register them with
|
|
106
|
+
* `apiKeys.setAssistantKeys` (with a fresh `stepUpToken`) before `expiresAt`, then call
|
|
107
|
+
* `completeKeys`. The step-up token goes to `setAssistantKeys` only, never to the assistant.
|
|
108
|
+
*/
|
|
109
|
+
async prepareKeys(input, options) {
|
|
110
|
+
const request = parse(PrepareAssistantKeysInputSchema, input);
|
|
111
|
+
const response = await this.#client.prepareAssistantKeys({ accounts: request.accounts.map((account) => removeUndefined(account)) }, toConnectCallOptions(options));
|
|
112
|
+
return formatPrepareAssistantKeysResult(response);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Finishes a key setup once `apiKeys.setAssistantKeys` registered its keys; returns the keys
|
|
116
|
+
* the assistant now holds. Completing a completed setup returns the keys again.
|
|
117
|
+
*/
|
|
118
|
+
async completeKeys(input, options) {
|
|
119
|
+
const request = parse(CompleteAssistantKeysInputSchema, input);
|
|
120
|
+
return (await this.#client.completeAssistantKeys(request, toConnectCallOptions(options))).keys.map(formatAssistantKey);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Lists the keys the assistant holds, at most one per account. An account without one has
|
|
124
|
+
* no account tools. Revoke them with `apiKeys.deleteAssistantKeys`.
|
|
125
|
+
*/
|
|
126
|
+
async listKeys(options) {
|
|
127
|
+
return (await this.#client.listAssistantKeys({}, toConnectCallOptions(options))).keys.map(formatAssistantKey);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
//#endregion
|
|
131
|
+
export { AssistantService };
|
|
132
|
+
|
|
133
|
+
//# sourceMappingURL=assistant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant.js","names":["#client","Proto.AssistantService","#scales"],"sources":["../../../src/services/assistant/assistant.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport { formatRunEvent, type AssistantRunEvent } from \"./assistant-events.schemas.js\";\nimport { ApprovalStatusCodec, type AssistantApprovalStatus } from \"./assistant.codecs.js\";\nimport {\n AssistantRunIdInputSchema,\n CompleteAssistantKeysInputSchema,\n DecideAssistantApprovalInputSchema,\n DeleteAssistantMemoryInputSchema,\n formatAssistantKey,\n formatConversation,\n formatMemory,\n formatMessage,\n formatPrepareAssistantKeysResult,\n ListAssistantConversationsInputSchema,\n ListAssistantMemoriesInputSchema,\n ListAssistantMessagesInputSchema,\n PrepareAssistantKeysInputSchema,\n SendAssistantMessageInputSchema,\n WatchAssistantRunInputSchema,\n type AssistantKey,\n type AssistantRunIdInput,\n type CompleteAssistantKeysInput,\n type DecideAssistantApprovalInput,\n type DeleteAssistantMemoryInput,\n type ListAssistantConversationsInput,\n type ListAssistantConversationsResult,\n type ListAssistantMemoriesInput,\n type ListAssistantMemoriesResult,\n type ListAssistantMessagesInput,\n type ListAssistantMessagesResult,\n type PrepareAssistantKeysInput,\n type PrepareAssistantKeysResult,\n type SendAssistantMessageInput,\n type WatchAssistantRunInput,\n} from \"./assistant.schemas.js\";\n\n/**\n * The Polyester trading assistant. `sendMessage` starts a run that answers the message;\n * follow it with `watchRun`. A run continues on the server when nobody watches it. Actions that\n * change the account wait for `decideApproval`. Needs a session login; every conversation, run,\n * approval and memory belongs to the signed-in user. Errors carry\n * `detail: { service: \"assistant\", code }`.\n */\nexport class AssistantService {\n #client: Client<typeof Proto.AssistantService>;\n #scales: SdkScales;\n\n constructor(transports: AuthApiTransports, scales: SdkScales) {\n this.#client = createClient(Proto.AssistantService, transports.authApi);\n this.#scales = scales;\n }\n\n /**\n * Records the message and starts a run that answers it; returns once the run is recorded.\n * Idempotent per `idempotencyKey`: repeat the request unchanged to resolve an unknown\n * outcome. A conversation runs one run at a time (`RUN_ACTIVE`).\n */\n async sendMessage(\n input: SendAssistantMessageInput,\n options?: PolyesterRequestOptions,\n ): Promise<{ runId: string; conversationId: string }> {\n const request = parse(SendAssistantMessageInputSchema, input);\n const response = await this.#client.sendMessage(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n runId: formatId(response.runId),\n conversationId: formatId(response.conversationId),\n };\n }\n\n /**\n * Streams a run's events in `seq` order: the recorded events after `afterSeq`, then new ones\n * as they are recorded. Ends after `run_completed` or `run_failed`; watching an ended run\n * replays it. The server may end the stream early: call again with the last `seq` received\n * as `afterSeq` to continue without gaps or repeats. Abort with `options.signal`.\n */\n async *watchRun(\n input: WatchAssistantRunInput,\n options?: PolyesterRequestOptions,\n ): AsyncGenerator<AssistantRunEvent, void, undefined> {\n const request = parse(WatchAssistantRunInputSchema, input);\n await this.#scales.ready();\n for await (const response of this.#client.watchRun(\n request,\n toConnectCallOptions(options),\n )) {\n if (response.event) yield formatRunEvent(response.event, this.#scales);\n }\n }\n\n /**\n * Asks an active run to stop; it then ends with `run_failed` category `cancelled`.\n * Cancelling an ended run succeeds and changes nothing.\n */\n async cancelRun(input: AssistantRunIdInput, options?: PolyesterRequestOptions): Promise<void> {\n const request = parse(AssistantRunIdInputSchema, input);\n await this.#client.cancelRun(request, toConnectCallOptions(options));\n }\n\n /**\n * Approves or rejects a pending approval from an `approval_requested` event. An approved\n * action runs exactly as its summary says, at most once. Repeating the same decision returns\n * the recorded status.\n */\n async decideApproval(\n input: DecideAssistantApprovalInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantApprovalStatus | \"unspecified\"> {\n const request = parse(DecideAssistantApprovalInputSchema, input);\n const response = await this.#client.decideApproval(request, toConnectCallOptions(options));\n return enumLabel(ApprovalStatusCodec.protoToOutput, response.status);\n }\n\n /** Lists the caller's conversations, most recently updated first. */\n async listConversations(\n input: ListAssistantConversationsInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantConversationsResult> {\n const request = parse(ListAssistantConversationsInputSchema, input);\n const response = await this.#client.listConversations(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n conversations: response.conversations.map(formatConversation),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /** Lists one conversation's messages, newest first. */\n async listMessages(\n input: ListAssistantMessagesInput,\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantMessagesResult> {\n const request = parse(ListAssistantMessagesInputSchema, input);\n const response = await this.#client.listMessages(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n messages: response.messages.map(formatMessage),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /**\n * Lists what the assistant remembers about the caller, newest first. A `profile` memory\n * applies to every answer; the others are used when relevant.\n */\n async listMemories(\n input: ListAssistantMemoriesInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantMemoriesResult> {\n const request = parse(ListAssistantMemoriesInputSchema, input);\n const response = await this.#client.listMemories(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n memories: response.memories.map(formatMemory),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /** Makes the assistant forget one memory. Deleting a deleted memory succeeds. */\n async deleteMemory(\n input: DeleteAssistantMemoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<void> {\n const request = parse(DeleteAssistantMemoryInputSchema, input);\n await this.#client.deleteMemory(request, toConnectCallOptions(options));\n }\n\n /**\n * Step 1 of giving the assistant keys: the assistant generates one Ed25519 key pair per\n * account and returns the public keys with their registration proofs. Register them with\n * `apiKeys.setAssistantKeys` (with a fresh `stepUpToken`) before `expiresAt`, then call\n * `completeKeys`. The step-up token goes to `setAssistantKeys` only, never to the assistant.\n */\n async prepareKeys(\n input: PrepareAssistantKeysInput,\n options?: PolyesterRequestOptions,\n ): Promise<PrepareAssistantKeysResult> {\n const request = parse(PrepareAssistantKeysInputSchema, input);\n const response = await this.#client.prepareAssistantKeys(\n { accounts: request.accounts.map((account) => removeUndefined(account)) },\n toConnectCallOptions(options),\n );\n return formatPrepareAssistantKeysResult(response);\n }\n\n /**\n * Finishes a key setup once `apiKeys.setAssistantKeys` registered its keys; returns the keys\n * the assistant now holds. Completing a completed setup returns the keys again.\n */\n async completeKeys(\n input: CompleteAssistantKeysInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantKey[]> {\n const request = parse(CompleteAssistantKeysInputSchema, input);\n const response = await this.#client.completeAssistantKeys(\n request,\n toConnectCallOptions(options),\n );\n return response.keys.map(formatAssistantKey);\n }\n\n /**\n * Lists the keys the assistant holds, at most one per account. An account without one has\n * no account tools. Revoke them with `apiKeys.deleteAssistantKeys`.\n */\n async listKeys(options?: PolyesterRequestOptions): Promise<AssistantKey[]> {\n const response = await this.#client.listAssistantKeys({}, toConnectCallOptions(options));\n return response.keys.map(formatAssistantKey);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsDA,IAAa,mBAAb,MAA8B;CAC1B;CACA;CAEA,YAAY,YAA+B,QAAmB;EAC1D,KAAKA,UAAU,aAAaC,oBAAwB,WAAW,OAAO;EACtE,KAAKC,UAAU;CACnB;;;;;;CAOA,MAAM,YACF,OACA,SACkD;EAClD,MAAM,UAAU,MAAM,iCAAiC,KAAK;EAC5D,MAAM,WAAW,MAAM,KAAKF,QAAQ,YAChC,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO;GACH,OAAO,SAAS,SAAS,KAAK;GAC9B,gBAAgB,SAAS,SAAS,cAAc;EACpD;CACJ;;;;;;;CAQA,OAAO,SACH,OACA,SACkD;EAClD,MAAM,UAAU,MAAM,8BAA8B,KAAK;EACzD,MAAM,KAAKE,QAAQ,MAAM;EACzB,WAAW,MAAM,YAAY,KAAKF,QAAQ,SACtC,SACA,qBAAqB,OAAO,CAChC,GACI,IAAI,SAAS,OAAO,MAAM,eAAe,SAAS,OAAO,KAAKE,OAAO;CAE7E;;;;;CAMA,MAAM,UAAU,OAA4B,SAAkD;EAC1F,MAAM,UAAU,MAAM,2BAA2B,KAAK;EACtD,MAAM,KAAKF,QAAQ,UAAU,SAAS,qBAAqB,OAAO,CAAC;CACvE;;;;;;CAOA,MAAM,eACF,OACA,SACgD;EAChD,MAAM,UAAU,MAAM,oCAAoC,KAAK;EAC/D,MAAM,WAAW,MAAM,KAAKA,QAAQ,eAAe,SAAS,qBAAqB,OAAO,CAAC;EACzF,OAAO,UAAU,oBAAoB,eAAe,SAAS,MAAM;CACvE;;CAGA,MAAM,kBACF,QAAyC,CAAC,GAC1C,SACyC;EACzC,MAAM,UAAU,MAAM,uCAAuC,KAAK;EAClE,MAAM,WAAW,MAAM,KAAKA,QAAQ,kBAChC,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO;GACH,eAAe,SAAS,cAAc,IAAI,kBAAkB;GAC5D,eAAe,SAAS;EAC5B;CACJ;;CAGA,MAAM,aACF,OACA,SACoC;EACpC,MAAM,UAAU,MAAM,kCAAkC,KAAK;EAC7D,MAAM,WAAW,MAAM,KAAKA,QAAQ,aAChC,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO;GACH,UAAU,SAAS,SAAS,IAAI,aAAa;GAC7C,eAAe,SAAS;EAC5B;CACJ;;;;;CAMA,MAAM,aACF,QAAoC,CAAC,GACrC,SACoC;EACpC,MAAM,UAAU,MAAM,kCAAkC,KAAK;EAC7D,MAAM,WAAW,MAAM,KAAKA,QAAQ,aAChC,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO;GACH,UAAU,SAAS,SAAS,IAAI,YAAY;GAC5C,eAAe,SAAS;EAC5B;CACJ;;CAGA,MAAM,aACF,OACA,SACa;EACb,MAAM,UAAU,MAAM,kCAAkC,KAAK;EAC7D,MAAM,KAAKA,QAAQ,aAAa,SAAS,qBAAqB,OAAO,CAAC;CAC1E;;;;;;;CAQA,MAAM,YACF,OACA,SACmC;EACnC,MAAM,UAAU,MAAM,iCAAiC,KAAK;EAC5D,MAAM,WAAW,MAAM,KAAKA,QAAQ,qBAChC,EAAE,UAAU,QAAQ,SAAS,KAAK,YAAY,gBAAgB,OAAO,CAAC,EAAE,GACxE,qBAAqB,OAAO,CAChC;EACA,OAAO,iCAAiC,QAAQ;CACpD;;;;;CAMA,MAAM,aACF,OACA,SACuB;EACvB,MAAM,UAAU,MAAM,kCAAkC,KAAK;EAK7D,QAAO,MAJgB,KAAKA,QAAQ,sBAChC,SACA,qBAAqB,OAAO,CAChC,EAAA,CACgB,KAAK,IAAI,kBAAkB;CAC/C;;;;;CAMA,MAAM,SAAS,SAA4D;EAEvE,QAAO,MADgB,KAAKA,QAAQ,kBAAkB,CAAC,GAAG,qBAAqB,OAAO,CAAC,EAAA,CACvE,KAAK,IAAI,kBAAkB;CAC/C;AACJ"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { ApprovalDecision, AssistantKey as AssistantKey$1, Conversation, Memory, Message, PrepareAssistantKeysResponse, PreparedAssistantKey as PreparedAssistantKey$1 } from "../../gen/ai/v1/assistant_pb.js";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
//#region src/services/assistant/assistant.schemas.d.ts
|
|
4
|
+
declare const SendAssistantMessageInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
5
|
+
/** Conversation to continue; omit to start a new one. */
|
|
6
|
+
readonly conversationId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>, undefined>;
|
|
7
|
+
/** Message text, plain text or Markdown, 1 to 16000 characters. */
|
|
8
|
+
readonly text: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 16000, undefined>]>;
|
|
9
|
+
/** Client-chosen key, unique per caller. Repeat the request unchanged to resolve an unknown outcome. */
|
|
10
|
+
readonly idempotencyKey: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
11
|
+
/**
|
|
12
|
+
* Trading account the run reads and acts on. Omit to answer without account data: the
|
|
13
|
+
* run then has no account tools.
|
|
14
|
+
*/
|
|
15
|
+
readonly subaccountId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
|
|
16
|
+
/** Places in the client the run may suggest, at most 100, each id once. */
|
|
17
|
+
readonly destinations: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StrictObjectSchema<{
|
|
18
|
+
/** The client's id for the place, e.g. `"page-subaccounts"`: lowercase letters, digits and hyphens. */
|
|
19
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "destination id must be 1-64 of a-z, 0-9, -">]>;
|
|
20
|
+
/** Its name as the client shows it, 1 to 80 characters. */
|
|
21
|
+
readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
|
|
22
|
+
/** What the user does there, at most 200 characters. */
|
|
23
|
+
readonly description: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 200, undefined>]>, "">;
|
|
24
|
+
}, undefined>, undefined>, v.MaxLengthAction<{
|
|
25
|
+
id: string;
|
|
26
|
+
title: string;
|
|
27
|
+
description: string;
|
|
28
|
+
}[], 100, "At most 100 destinations are allowed.">, v.CheckAction<{
|
|
29
|
+
id: string;
|
|
30
|
+
title: string;
|
|
31
|
+
description: string;
|
|
32
|
+
}[], "Destination ids must be distinct.">]>, undefined>;
|
|
33
|
+
}, undefined>]>;
|
|
34
|
+
type SendAssistantMessageInput = v.InferInput<typeof SendAssistantMessageInputSchema>;
|
|
35
|
+
declare const AssistantRunIdInputSchema: v.StrictObjectSchema<{
|
|
36
|
+
readonly runId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
|
|
37
|
+
}, undefined>;
|
|
38
|
+
type AssistantRunIdInput = v.InferInput<typeof AssistantRunIdInputSchema>;
|
|
39
|
+
declare const WatchAssistantRunInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
40
|
+
readonly runId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
|
|
41
|
+
/** Return events after this seq. 0 (default) replays the run; pass the last seq received to resume. */
|
|
42
|
+
readonly afterSeq: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>, 0>;
|
|
43
|
+
}, undefined>, v.TransformAction<{
|
|
44
|
+
runId: bigint;
|
|
45
|
+
afterSeq: number;
|
|
46
|
+
}, {
|
|
47
|
+
runId: bigint;
|
|
48
|
+
afterSeq: bigint;
|
|
49
|
+
}>]>;
|
|
50
|
+
type WatchAssistantRunInput = v.InferInput<typeof WatchAssistantRunInputSchema>;
|
|
51
|
+
declare const DecideAssistantApprovalInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
52
|
+
readonly approvalId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
|
|
53
|
+
readonly decision: v.PicklistSchema<readonly ["approve", "reject"], undefined>;
|
|
54
|
+
}, undefined>, v.TransformAction<{
|
|
55
|
+
approvalId: bigint;
|
|
56
|
+
decision: "approve" | "reject";
|
|
57
|
+
}, {
|
|
58
|
+
approvalId: bigint;
|
|
59
|
+
decision: ApprovalDecision.APPROVE | ApprovalDecision.REJECT;
|
|
60
|
+
}>]>;
|
|
61
|
+
type DecideAssistantApprovalInput = v.InferInput<typeof DecideAssistantApprovalInputSchema>;
|
|
62
|
+
declare const ListAssistantConversationsInputSchema: v.StrictObjectSchema<{
|
|
63
|
+
/** Page size; omit for the server default. */
|
|
64
|
+
limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, number, undefined>]>, undefined>;
|
|
65
|
+
/** The previous page's `nextPageToken`. */
|
|
66
|
+
pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>;
|
|
67
|
+
}, undefined>;
|
|
68
|
+
type ListAssistantConversationsInput = v.InferInput<typeof ListAssistantConversationsInputSchema>;
|
|
69
|
+
declare const ListAssistantMessagesInputSchema: v.StrictObjectSchema<{
|
|
70
|
+
readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, number, undefined>]>, undefined>;
|
|
71
|
+
readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>;
|
|
72
|
+
readonly conversationId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
|
|
73
|
+
}, undefined>;
|
|
74
|
+
type ListAssistantMessagesInput = v.InferInput<typeof ListAssistantMessagesInputSchema>;
|
|
75
|
+
declare const ListAssistantMemoriesInputSchema: v.StrictObjectSchema<{
|
|
76
|
+
/** Page size; omit for the server default. */
|
|
77
|
+
limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, number, undefined>]>, undefined>;
|
|
78
|
+
/** The previous page's `nextPageToken`. */
|
|
79
|
+
pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>;
|
|
80
|
+
}, undefined>;
|
|
81
|
+
type ListAssistantMemoriesInput = v.InferInput<typeof ListAssistantMemoriesInputSchema>;
|
|
82
|
+
declare const DeleteAssistantMemoryInputSchema: v.StrictObjectSchema<{
|
|
83
|
+
readonly memoryId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
|
|
84
|
+
}, undefined>;
|
|
85
|
+
type DeleteAssistantMemoryInput = v.InferInput<typeof DeleteAssistantMemoryInputSchema>;
|
|
86
|
+
declare const PrepareAssistantKeysInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
87
|
+
/** 1 to 64 accounts, each once. An entry without `subaccountId` is the main account. */
|
|
88
|
+
readonly accounts: v.SchemaWithPipe<readonly [v.ArraySchema<v.StrictObjectSchema<{
|
|
89
|
+
readonly subaccountId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
|
|
90
|
+
}, undefined>, undefined>, v.MinLengthAction<{
|
|
91
|
+
subaccountId?: bigint | undefined;
|
|
92
|
+
}[], 1, "At least one account is required.">, v.MaxLengthAction<{
|
|
93
|
+
subaccountId?: bigint | undefined;
|
|
94
|
+
}[], 64, "At most 64 accounts are allowed.">]>;
|
|
95
|
+
}, undefined>, v.CheckAction<{
|
|
96
|
+
accounts: {
|
|
97
|
+
subaccountId?: bigint | undefined;
|
|
98
|
+
}[];
|
|
99
|
+
}, "Each account may be named only once.">]>;
|
|
100
|
+
type PrepareAssistantKeysInput = v.InferInput<typeof PrepareAssistantKeysInputSchema>;
|
|
101
|
+
declare const CompleteAssistantKeysInputSchema: v.StrictObjectSchema<{
|
|
102
|
+
readonly setupId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
|
|
103
|
+
}, undefined>;
|
|
104
|
+
type CompleteAssistantKeysInput = v.InferInput<typeof CompleteAssistantKeysInputSchema>;
|
|
105
|
+
declare function formatConversation(c: Conversation): {
|
|
106
|
+
conversationId: string;
|
|
107
|
+
/** Empty until a title is available. */
|
|
108
|
+
title: string;
|
|
109
|
+
createdAt: number | undefined;
|
|
110
|
+
updatedAt: number | undefined;
|
|
111
|
+
};
|
|
112
|
+
type AssistantConversation = ReturnType<typeof formatConversation>;
|
|
113
|
+
declare function formatMessage(m: Message): {
|
|
114
|
+
messageId: string;
|
|
115
|
+
role: "unspecified" | "assistant" | "user";
|
|
116
|
+
/** Markdown. For an assistant message, its run's final text. */
|
|
117
|
+
text: string;
|
|
118
|
+
createdAt: number | undefined;
|
|
119
|
+
/** Replay this run with `watchRun` from `afterSeq: 0` to show its tool activity and views. */
|
|
120
|
+
runId: string;
|
|
121
|
+
};
|
|
122
|
+
type AssistantMessage = ReturnType<typeof formatMessage>;
|
|
123
|
+
declare function formatMemory(m: Memory): {
|
|
124
|
+
memoryId: string;
|
|
125
|
+
text: string;
|
|
126
|
+
createdAt: number | undefined;
|
|
127
|
+
/** Omitted when the conversation it was learned in is unknown. */
|
|
128
|
+
conversationId: string | undefined;
|
|
129
|
+
kind: "unspecified" | "profile" | "fact" | "planning_figure";
|
|
130
|
+
};
|
|
131
|
+
type AssistantMemory = ReturnType<typeof formatMemory>;
|
|
132
|
+
declare function formatAssistantKey(k: AssistantKey$1): {
|
|
133
|
+
/** Omitted for the main account. */
|
|
134
|
+
subaccountId: string | undefined;
|
|
135
|
+
keyId: string;
|
|
136
|
+
publicKeyEd25519: Uint8Array<ArrayBufferLike>;
|
|
137
|
+
publicKeyHex: string;
|
|
138
|
+
state: "unspecified" | "active" | "disabled";
|
|
139
|
+
};
|
|
140
|
+
type AssistantKey = ReturnType<typeof formatAssistantKey>;
|
|
141
|
+
declare function formatPreparedAssistantKey(k: PreparedAssistantKey$1): {
|
|
142
|
+
/** Omitted for the main account. */
|
|
143
|
+
subaccountId: string | undefined;
|
|
144
|
+
publicKeyEd25519: Uint8Array<ArrayBufferLike>;
|
|
145
|
+
publicKeyHex: string;
|
|
146
|
+
/** Pass unchanged to `apiKeys.setAssistantKeys`. */
|
|
147
|
+
registrationProof: Uint8Array<ArrayBufferLike>;
|
|
148
|
+
/** Epoch ms; pass unchanged to `apiKeys.setAssistantKeys`. */
|
|
149
|
+
registrationDeadline: number | undefined;
|
|
150
|
+
};
|
|
151
|
+
type PreparedAssistantKey = ReturnType<typeof formatPreparedAssistantKey>;
|
|
152
|
+
declare function formatPrepareAssistantKeysResult(r: PrepareAssistantKeysResponse): {
|
|
153
|
+
setupId: string;
|
|
154
|
+
/** One key per requested account, in request order. */
|
|
155
|
+
keys: {
|
|
156
|
+
/** Omitted for the main account. */
|
|
157
|
+
subaccountId: string | undefined;
|
|
158
|
+
publicKeyEd25519: Uint8Array<ArrayBufferLike>;
|
|
159
|
+
publicKeyHex: string;
|
|
160
|
+
/** Pass unchanged to `apiKeys.setAssistantKeys`. */
|
|
161
|
+
registrationProof: Uint8Array<ArrayBufferLike>;
|
|
162
|
+
/** Epoch ms; pass unchanged to `apiKeys.setAssistantKeys`. */
|
|
163
|
+
registrationDeadline: number | undefined;
|
|
164
|
+
}[];
|
|
165
|
+
/** Epoch ms after which the keys can no longer be registered. */
|
|
166
|
+
expiresAt: number | undefined;
|
|
167
|
+
};
|
|
168
|
+
type PrepareAssistantKeysResult = ReturnType<typeof formatPrepareAssistantKeysResult>;
|
|
169
|
+
/** `nextPageToken` is empty when no more results exist. */
|
|
170
|
+
type ListAssistantConversationsResult = {
|
|
171
|
+
conversations: AssistantConversation[];
|
|
172
|
+
nextPageToken: string;
|
|
173
|
+
};
|
|
174
|
+
type ListAssistantMessagesResult = {
|
|
175
|
+
messages: AssistantMessage[];
|
|
176
|
+
nextPageToken: string;
|
|
177
|
+
};
|
|
178
|
+
type ListAssistantMemoriesResult = {
|
|
179
|
+
memories: AssistantMemory[];
|
|
180
|
+
nextPageToken: string;
|
|
181
|
+
};
|
|
182
|
+
//#endregion
|
|
183
|
+
export { AssistantConversation, AssistantKey, AssistantMemory, AssistantMessage, AssistantRunIdInput, AssistantRunIdInputSchema, CompleteAssistantKeysInput, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInput, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInput, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInput, ListAssistantConversationsInputSchema, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesInputSchema, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesInputSchema, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysInputSchema, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SendAssistantMessageInputSchema, WatchAssistantRunInput, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult, formatPreparedAssistantKey };
|
|
184
|
+
//# sourceMappingURL=assistant.schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant.schemas.d.ts","names":[],"sources":["../../../src/services/assistant/assistant.schemas.ts"],"mappings":";;;cAsCa,iCAA+B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BhC,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"}
|