@polyester/sdk 0.35.0 → 0.36.0-devnet-20261112144059
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 +48 -0
- package/dist/catalogs/snapshot-validation.js +5 -0
- package/dist/catalogs/snapshot-validation.js.map +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.d.ts +144 -2
- package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.js +32 -2
- package/dist/gen/ai/v1/assistant_pb.js.map +1 -1
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts +11 -5
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts.map +1 -1
- package/dist/gen/alerts/v1/price_alerts_pb.js +3 -1
- package/dist/gen/alerts/v1/price_alerts_pb.js.map +1 -1
- package/dist/gen/auth/v1/policies_pb.d.ts +14 -1
- package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/policies_pb.js +14 -1
- package/dist/gen/auth/v1/policies_pb.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +14 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js +14 -1
- package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
- package/dist/gen/changelog/v1/changelog_pb.d.ts +7 -1
- package/dist/gen/changelog/v1/changelog_pb.d.ts.map +1 -1
- package/dist/gen/changelog/v1/changelog_pb.js +7 -1
- 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/marketdata/v1/marketdata_pb.d.ts +57 -5
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts.map +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js +10 -4
- package/dist/gen/marketdata/v1/marketdata_pb.js.map +1 -1
- package/dist/gen/notifications/v1/notifications_pb.d.ts +827 -0
- package/dist/gen/notifications/v1/notifications_pb.d.ts.map +1 -0
- package/dist/gen/notifications/v1/notifications_pb.js +346 -0
- package/dist/gen/notifications/v1/notifications_pb.js.map +1 -0
- package/dist/gen/orders/v1/orders_pb.d.ts +247 -19
- package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js +188 -66
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +73 -5
- package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js +40 -5
- package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +1195 -190
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +317 -7
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +369 -6
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js +237 -14
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
- package/dist/gen/tradews/v1/trade_ws_pb.d.ts +39 -1
- package/dist/gen/tradews/v1/trade_ws_pb.d.ts.map +1 -1
- package/dist/gen/tradews/v1/trade_ws_pb.js +2 -1
- package/dist/gen/tradews/v1/trade_ws_pb.js.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +526 -13
- package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js +126 -26
- package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
- package/dist/index.d.ts +7 -4
- package/dist/services/assistant/assistant-events.schemas.d.ts +57 -39
- package/dist/services/assistant/assistant-events.schemas.d.ts.map +1 -1
- package/dist/services/assistant/assistant.d.ts +16 -1
- package/dist/services/assistant/assistant.d.ts.map +1 -1
- package/dist/services/assistant/assistant.js +24 -1
- package/dist/services/assistant/assistant.js.map +1 -1
- package/dist/services/assistant/assistant.schemas.d.ts +13 -1
- package/dist/services/assistant/assistant.schemas.d.ts.map +1 -1
- package/dist/services/assistant/assistant.schemas.js +15 -1
- 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 +22 -22
- package/dist/services/changelog/changelog.codecs.d.ts +1 -1
- package/dist/services/changelog/changelog.codecs.d.ts.map +1 -1
- package/dist/services/changelog/changelog.codecs.js +6 -3
- package/dist/services/changelog/changelog.codecs.js.map +1 -1
- package/dist/services/changelog/changelog.schemas.d.ts +19 -19
- package/dist/services/checkpoints/checkpoints.schemas.d.ts +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +3 -3
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +13 -13
- package/dist/services/market-data/market-data.schemas.js +16 -1
- package/dist/services/market-data/market-data.schemas.js.map +1 -1
- package/dist/services/notifications/notifications.codecs.d.ts +16 -0
- package/dist/services/notifications/notifications.codecs.d.ts.map +1 -0
- package/dist/services/notifications/notifications.codecs.js +40 -0
- package/dist/services/notifications/notifications.codecs.js.map +1 -0
- package/dist/services/notifications/notifications.d.ts +41 -0
- package/dist/services/notifications/notifications.d.ts.map +1 -0
- package/dist/services/notifications/notifications.js +67 -0
- package/dist/services/notifications/notifications.js.map +1 -0
- package/dist/services/notifications/notifications.schemas.d.ts +154 -0
- package/dist/services/notifications/notifications.schemas.d.ts.map +1 -0
- package/dist/services/notifications/notifications.schemas.js +116 -0
- package/dist/services/notifications/notifications.schemas.js.map +1 -0
- package/dist/services/notifications/notifications.types.d.ts +3 -0
- package/dist/services/notifications/service.d.ts +8 -0
- package/dist/services/notifications/service.d.ts.map +1 -0
- package/dist/services/notifications/service.js +9 -0
- package/dist/services/notifications/service.js.map +1 -0
- package/dist/services/orders/order-enums.codecs.js +12 -4
- package/dist/services/orders/order-enums.codecs.js.map +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +2688 -417
- package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-batch.schemas.js +5 -3
- package/dist/services/orders/orders-batch.schemas.js.map +1 -1
- package/dist/services/orders/orders-input.schemas.d.ts +4828 -1265
- package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-input.schemas.js +104 -32
- package/dist/services/orders/orders-input.schemas.js.map +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +40 -22
- package/dist/services/orders/orders-output.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-output.schemas.js +8 -0
- package/dist/services/orders/orders-output.schemas.js.map +1 -1
- package/dist/services/orders/orders-risk.schemas.d.ts +1 -1
- package/dist/services/orders/orders-risk.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-risk.schemas.js +1 -1
- package/dist/services/orders/orders-risk.schemas.js.map +1 -1
- package/dist/services/orders/orders.codecs.js +3 -0
- package/dist/services/orders/orders.codecs.js.map +1 -1
- package/dist/services/orders/orders.d.ts +3 -1
- package/dist/services/orders/orders.d.ts.map +1 -1
- package/dist/services/orders/orders.js +5 -12
- package/dist/services/orders/orders.js.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -15
- package/dist/services/policies/shared.codecs.js +9 -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.d.ts +10 -5
- package/dist/services/price-alerts/price-alerts.d.ts.map +1 -1
- package/dist/services/price-alerts/price-alerts.js +10 -5
- package/dist/services/price-alerts/price-alerts.js.map +1 -1
- package/dist/services/rewards/rewards.schemas.d.ts +4 -4
- package/dist/services/subaccounts/subaccounts.codecs.js +3 -1
- package/dist/services/subaccounts/subaccounts.codecs.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +7 -7
- package/dist/services/trades/trades.schemas.d.ts +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +271 -41
- package/dist/services/triggers/trigger-input.schemas.d.ts.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.js +51 -3
- package/dist/services/triggers/trigger-input.schemas.js.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +235 -24
- package/dist/services/triggers/triggers-output.schemas.d.ts.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.js +49 -2
- package/dist/services/triggers/triggers-output.schemas.js.map +1 -1
- package/dist/services/triggers/triggers.codecs.js +7 -2
- package/dist/services/triggers/triggers.codecs.js.map +1 -1
- package/dist/services/triggers/triggers.d.ts +25 -3
- package/dist/services/triggers/triggers.d.ts.map +1 -1
- package/dist/services/triggers/triggers.js +49 -3
- package/dist/services/triggers/triggers.js.map +1 -1
- package/dist/services/triggers/triggers.schemas.d.ts +3 -3
- package/dist/services/triggers/triggers.types.d.ts +3 -3
- package/dist/services/vip/vip.schemas.d.ts +3 -3
- package/dist/shared/catalog-config.d.ts +6 -0
- package/dist/shared/catalog-config.d.ts.map +1 -1
- package/dist/shared/catalog-config.js.map +1 -1
- package/dist/shared/error-detail.d.ts +6 -2
- package/dist/shared/error-detail.d.ts.map +1 -1
- package/dist/shared/error-detail.js +1 -0
- package/dist/shared/error-detail.js.map +1 -1
- package/dist/shared/error-details/notifications.js +15 -0
- package/dist/shared/error-details/notifications.js.map +1 -0
- package/dist/shared/request-id.d.ts +6 -0
- package/dist/shared/request-id.d.ts.map +1 -0
- package/dist/shared/request-id.js +17 -0
- package/dist/shared/request-id.js.map +1 -0
- package/dist/wired-services.d.ts.map +1 -1
- package/dist/wired-services.js +2 -0
- package/dist/wired-services.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.d.ts","names":[],"sources":["../../../src/services/assistant/assistant.ts"],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"assistant.d.ts","names":[],"sources":["../../../src/services/assistant/assistant.ts"],"mappings":";;;;;;;;;;;;;;cA0Da;;EAIG,YAAA,YAAY,mBAAmB,QAAQ;;;;;;EAU7C,YACF,OAAO,2BACP,UAAU,0BACX;IAAU;IAAe;;;;;;;;EAkBrB,SACH,OAAO,wBACP,UAAU,0BACX,eAAe;;;;;EAeZ,UAAU,OAAO,qBAAqB,UAAU,0BAA0B;;;;;;EAU1E,eACF,OAAO,8BACP,UAAU,0BACX,QAAQ;;EAOL,kBACF,QAAO,iCACP,UAAU,0BACX,QAAQ;;EAaL,aACF,OAAO,4BACP,UAAU,0BACX,QAAQ;;;;;EAgBL,aACF,QAAO,4BACP,UAAU,0BACX,QAAQ;;EAaL,aACF,OAAO,4BACP,UAAU,0BACX;;;;;;;EAWG,YACF,OAAO,2BACP,UAAU,0BACX,QAAQ;;;;;EAaL,aACF,OAAO,4BACP,UAAU,0BACX,QAAQ;;;;;EAaL,SAAS,UAAU,0BAA0B,QAAQ;;;;;;;EAWrD,0BACF,UAAU,0BACX,QAAQ;IAA2B;;;;;;;EAgBhC,0BACF,OAAO,gCACP,UAAU,0BACX,QAAQ"}
|
|
@@ -6,7 +6,7 @@ import { enumLabel } from "../../shared/proto-enum-codec.js";
|
|
|
6
6
|
import { AssistantService as AssistantService$1 } from "../../gen/ai/v1/assistant_pb.js";
|
|
7
7
|
import { ApprovalStatusCodec } from "./assistant.codecs.js";
|
|
8
8
|
import { formatRunEvent } from "./assistant-events.schemas.js";
|
|
9
|
-
import { AssistantRunIdInputSchema, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInputSchema, ListAssistantMemoriesInputSchema, ListAssistantMessagesInputSchema, PrepareAssistantKeysInputSchema, SendAssistantMessageInputSchema, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult } from "./assistant.schemas.js";
|
|
9
|
+
import { AssistantRunIdInputSchema, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInputSchema, ListAssistantMemoriesInputSchema, ListAssistantMessagesInputSchema, PrepareAssistantKeysInputSchema, SendAssistantMessageInputSchema, SetTelegramApprovalLimitsInputSchema, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult, formatTelegramApprovalLimits } from "./assistant.schemas.js";
|
|
10
10
|
import { createClient } from "@connectrpc/connect";
|
|
11
11
|
//#region src/services/assistant/assistant.ts
|
|
12
12
|
/**
|
|
@@ -126,6 +126,29 @@ var AssistantService = class {
|
|
|
126
126
|
async listKeys(options) {
|
|
127
127
|
return (await this.#client.listAssistantKeys({}, toConnectCallOptions(options))).keys.map(formatAssistantKey);
|
|
128
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Returns the caller's limits on what they may approve from Telegram, in US dollars of
|
|
131
|
+
* notional value, and the value approved from Telegram in the last 24 hours while a limit
|
|
132
|
+
* was set. Limits apply to placing, swapping, modifying and resuming; cancelling, pausing
|
|
133
|
+
* and rejecting are never limited.
|
|
134
|
+
*/
|
|
135
|
+
async getTelegramApprovalLimits(options) {
|
|
136
|
+
const response = await this.#client.getTelegramApprovalLimits({}, toConnectCallOptions(options));
|
|
137
|
+
return {
|
|
138
|
+
...formatTelegramApprovalLimits(response.limits),
|
|
139
|
+
approvedLast24hUsd: response.approvedLast24hUsd
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Replaces both Telegram approval limits: a limit left out is turned off. Only a signed-in
|
|
144
|
+
* session sets them; they apply to the next approval from Telegram. Returns the limits as
|
|
145
|
+
* recorded.
|
|
146
|
+
*/
|
|
147
|
+
async setTelegramApprovalLimits(input, options) {
|
|
148
|
+
const limits = parse(SetTelegramApprovalLimitsInputSchema, input);
|
|
149
|
+
const response = await this.#client.setTelegramApprovalLimits({ limits: removeUndefined(limits) }, toConnectCallOptions(options));
|
|
150
|
+
return formatTelegramApprovalLimits(response.limits);
|
|
151
|
+
}
|
|
129
152
|
};
|
|
130
153
|
//#endregion
|
|
131
154
|
export { AssistantService };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.js","names":["#client","Proto.AssistantService","#scales"],"sources":["../../../src/services/assistant/assistant.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport { formatRunEvent, type AssistantRunEvent } from \"./assistant-events.schemas.js\";\nimport { ApprovalStatusCodec, type AssistantApprovalStatus } from \"./assistant.codecs.js\";\nimport {\n AssistantRunIdInputSchema,\n CompleteAssistantKeysInputSchema,\n DecideAssistantApprovalInputSchema,\n DeleteAssistantMemoryInputSchema,\n formatAssistantKey,\n formatConversation,\n formatMemory,\n formatMessage,\n formatPrepareAssistantKeysResult,\n ListAssistantConversationsInputSchema,\n ListAssistantMemoriesInputSchema,\n ListAssistantMessagesInputSchema,\n PrepareAssistantKeysInputSchema,\n SendAssistantMessageInputSchema,\n WatchAssistantRunInputSchema,\n type AssistantKey,\n type AssistantRunIdInput,\n type CompleteAssistantKeysInput,\n type DecideAssistantApprovalInput,\n type DeleteAssistantMemoryInput,\n type ListAssistantConversationsInput,\n type ListAssistantConversationsResult,\n type ListAssistantMemoriesInput,\n type ListAssistantMemoriesResult,\n type ListAssistantMessagesInput,\n type ListAssistantMessagesResult,\n type PrepareAssistantKeysInput,\n type PrepareAssistantKeysResult,\n type SendAssistantMessageInput,\n type WatchAssistantRunInput,\n} from \"./assistant.schemas.js\";\n\n/**\n * The Polyester trading assistant. `sendMessage` starts a run that answers the message;\n * follow it with `watchRun`. A run continues on the server when nobody watches it. Actions that\n * change the account wait for `decideApproval`. Needs a session login; every conversation, run,\n * approval and memory belongs to the signed-in user. Errors carry\n * `detail: { service: \"assistant\", code }`.\n */\nexport class AssistantService {\n #client: Client<typeof Proto.AssistantService>;\n #scales: SdkScales;\n\n constructor(transports: AuthApiTransports, scales: SdkScales) {\n this.#client = createClient(Proto.AssistantService, transports.authApi);\n this.#scales = scales;\n }\n\n /**\n * Records the message and starts a run that answers it; returns once the run is recorded.\n * Idempotent per `idempotencyKey`: repeat the request unchanged to resolve an unknown\n * outcome. A conversation runs one run at a time (`RUN_ACTIVE`).\n */\n async sendMessage(\n input: SendAssistantMessageInput,\n options?: PolyesterRequestOptions,\n ): Promise<{ runId: string; conversationId: string }> {\n const request = parse(SendAssistantMessageInputSchema, input);\n const response = await this.#client.sendMessage(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n runId: formatId(response.runId),\n conversationId: formatId(response.conversationId),\n };\n }\n\n /**\n * Streams a run's events in `seq` order: the recorded events after `afterSeq`, then new ones\n * as they are recorded. Ends after `run_completed` or `run_failed`; watching an ended run\n * replays it. The server may end the stream early: call again with the last `seq` received\n * as `afterSeq` to continue without gaps or repeats. Abort with `options.signal`.\n */\n async *watchRun(\n input: WatchAssistantRunInput,\n options?: PolyesterRequestOptions,\n ): AsyncGenerator<AssistantRunEvent, void, undefined> {\n const request = parse(WatchAssistantRunInputSchema, input);\n await this.#scales.ready();\n for await (const response of this.#client.watchRun(\n request,\n toConnectCallOptions(options),\n )) {\n if (response.event) yield formatRunEvent(response.event, this.#scales);\n }\n }\n\n /**\n * Asks an active run to stop; it then ends with `run_failed` category `cancelled`.\n * Cancelling an ended run succeeds and changes nothing.\n */\n async cancelRun(input: AssistantRunIdInput, options?: PolyesterRequestOptions): Promise<void> {\n const request = parse(AssistantRunIdInputSchema, input);\n await this.#client.cancelRun(request, toConnectCallOptions(options));\n }\n\n /**\n * Approves or rejects a pending approval from an `approval_requested` event. An approved\n * action runs exactly as its summary says, at most once. Repeating the same decision returns\n * the recorded status.\n */\n async decideApproval(\n input: DecideAssistantApprovalInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantApprovalStatus | \"unspecified\"> {\n const request = parse(DecideAssistantApprovalInputSchema, input);\n const response = await this.#client.decideApproval(request, toConnectCallOptions(options));\n return enumLabel(ApprovalStatusCodec.protoToOutput, response.status);\n }\n\n /** Lists the caller's conversations, most recently updated first. */\n async listConversations(\n input: ListAssistantConversationsInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantConversationsResult> {\n const request = parse(ListAssistantConversationsInputSchema, input);\n const response = await this.#client.listConversations(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n conversations: response.conversations.map(formatConversation),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /** Lists one conversation's messages, newest first. */\n async listMessages(\n input: ListAssistantMessagesInput,\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantMessagesResult> {\n const request = parse(ListAssistantMessagesInputSchema, input);\n const response = await this.#client.listMessages(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n messages: response.messages.map(formatMessage),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /**\n * Lists what the assistant remembers about the caller, newest first. A `profile` memory\n * applies to every answer; the others are used when relevant.\n */\n async listMemories(\n input: ListAssistantMemoriesInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantMemoriesResult> {\n const request = parse(ListAssistantMemoriesInputSchema, input);\n const response = await this.#client.listMemories(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n memories: response.memories.map(formatMemory),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /** Makes the assistant forget one memory. Deleting a deleted memory succeeds. */\n async deleteMemory(\n input: DeleteAssistantMemoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<void> {\n const request = parse(DeleteAssistantMemoryInputSchema, input);\n await this.#client.deleteMemory(request, toConnectCallOptions(options));\n }\n\n /**\n * Step 1 of giving the assistant keys: the assistant generates one Ed25519 key pair per\n * account and returns the public keys with their registration proofs. Register them with\n * `apiKeys.setAssistantKeys` (with a fresh `stepUpToken`) before `expiresAt`, then call\n * `completeKeys`. The step-up token goes to `setAssistantKeys` only, never to the assistant.\n */\n async prepareKeys(\n input: PrepareAssistantKeysInput,\n options?: PolyesterRequestOptions,\n ): Promise<PrepareAssistantKeysResult> {\n const request = parse(PrepareAssistantKeysInputSchema, input);\n const response = await this.#client.prepareAssistantKeys(\n { accounts: request.accounts.map((account) => removeUndefined(account)) },\n toConnectCallOptions(options),\n );\n return formatPrepareAssistantKeysResult(response);\n }\n\n /**\n * Finishes a key setup once `apiKeys.setAssistantKeys` registered its keys; returns the keys\n * the assistant now holds. Completing a completed setup returns the keys again.\n */\n async completeKeys(\n input: CompleteAssistantKeysInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantKey[]> {\n const request = parse(CompleteAssistantKeysInputSchema, input);\n const response = await this.#client.completeAssistantKeys(\n request,\n toConnectCallOptions(options),\n );\n return response.keys.map(formatAssistantKey);\n }\n\n /**\n * Lists the keys the assistant holds, at most one per account. An account without one has\n * no account tools. Revoke them with `apiKeys.deleteAssistantKeys`.\n */\n async listKeys(options?: PolyesterRequestOptions): Promise<AssistantKey[]> {\n const response = await this.#client.listAssistantKeys({}, toConnectCallOptions(options));\n return response.keys.map(formatAssistantKey);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsDA,IAAa,mBA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,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"}
|
|
1
|
+
{"version":3,"file":"assistant.js","names":["#client","Proto.AssistantService","#scales"],"sources":["../../../src/services/assistant/assistant.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport { formatRunEvent, type AssistantRunEvent } from \"./assistant-events.schemas.js\";\nimport { ApprovalStatusCodec, type AssistantApprovalStatus } from \"./assistant.codecs.js\";\nimport {\n AssistantRunIdInputSchema,\n CompleteAssistantKeysInputSchema,\n DecideAssistantApprovalInputSchema,\n DeleteAssistantMemoryInputSchema,\n formatAssistantKey,\n formatConversation,\n formatMemory,\n formatMessage,\n formatPrepareAssistantKeysResult,\n formatTelegramApprovalLimits,\n ListAssistantConversationsInputSchema,\n ListAssistantMemoriesInputSchema,\n ListAssistantMessagesInputSchema,\n PrepareAssistantKeysInputSchema,\n SendAssistantMessageInputSchema,\n SetTelegramApprovalLimitsInputSchema,\n WatchAssistantRunInputSchema,\n type AssistantKey,\n type AssistantRunIdInput,\n type CompleteAssistantKeysInput,\n type DecideAssistantApprovalInput,\n type DeleteAssistantMemoryInput,\n type ListAssistantConversationsInput,\n type ListAssistantConversationsResult,\n type ListAssistantMemoriesInput,\n type ListAssistantMemoriesResult,\n type ListAssistantMessagesInput,\n type ListAssistantMessagesResult,\n type PrepareAssistantKeysInput,\n type PrepareAssistantKeysResult,\n type SendAssistantMessageInput,\n type SetTelegramApprovalLimitsInput,\n type TelegramApprovalLimits,\n type WatchAssistantRunInput,\n} from \"./assistant.schemas.js\";\n\n/**\n * The Polyester trading assistant. `sendMessage` starts a run that answers the message;\n * follow it with `watchRun`. A run continues on the server when nobody watches it. Actions that\n * change the account wait for `decideApproval`. Needs a session login; every conversation, run,\n * approval and memory belongs to the signed-in user. Errors carry\n * `detail: { service: \"assistant\", code }`.\n */\nexport class AssistantService {\n #client: Client<typeof Proto.AssistantService>;\n #scales: SdkScales;\n\n constructor(transports: AuthApiTransports, scales: SdkScales) {\n this.#client = createClient(Proto.AssistantService, transports.authApi);\n this.#scales = scales;\n }\n\n /**\n * Records the message and starts a run that answers it; returns once the run is recorded.\n * Idempotent per `idempotencyKey`: repeat the request unchanged to resolve an unknown\n * outcome. A conversation runs one run at a time (`RUN_ACTIVE`).\n */\n async sendMessage(\n input: SendAssistantMessageInput,\n options?: PolyesterRequestOptions,\n ): Promise<{ runId: string; conversationId: string }> {\n const request = parse(SendAssistantMessageInputSchema, input);\n const response = await this.#client.sendMessage(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n runId: formatId(response.runId),\n conversationId: formatId(response.conversationId),\n };\n }\n\n /**\n * Streams a run's events in `seq` order: the recorded events after `afterSeq`, then new ones\n * as they are recorded. Ends after `run_completed` or `run_failed`; watching an ended run\n * replays it. The server may end the stream early: call again with the last `seq` received\n * as `afterSeq` to continue without gaps or repeats. Abort with `options.signal`.\n */\n async *watchRun(\n input: WatchAssistantRunInput,\n options?: PolyesterRequestOptions,\n ): AsyncGenerator<AssistantRunEvent, void, undefined> {\n const request = parse(WatchAssistantRunInputSchema, input);\n await this.#scales.ready();\n for await (const response of this.#client.watchRun(\n request,\n toConnectCallOptions(options),\n )) {\n if (response.event) yield formatRunEvent(response.event, this.#scales);\n }\n }\n\n /**\n * Asks an active run to stop; it then ends with `run_failed` category `cancelled`.\n * Cancelling an ended run succeeds and changes nothing.\n */\n async cancelRun(input: AssistantRunIdInput, options?: PolyesterRequestOptions): Promise<void> {\n const request = parse(AssistantRunIdInputSchema, input);\n await this.#client.cancelRun(request, toConnectCallOptions(options));\n }\n\n /**\n * Approves or rejects a pending approval from an `approval_requested` event. An approved\n * action runs exactly as its summary says, at most once. Repeating the same decision returns\n * the recorded status.\n */\n async decideApproval(\n input: DecideAssistantApprovalInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantApprovalStatus | \"unspecified\"> {\n const request = parse(DecideAssistantApprovalInputSchema, input);\n const response = await this.#client.decideApproval(request, toConnectCallOptions(options));\n return enumLabel(ApprovalStatusCodec.protoToOutput, response.status);\n }\n\n /** Lists the caller's conversations, most recently updated first. */\n async listConversations(\n input: ListAssistantConversationsInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantConversationsResult> {\n const request = parse(ListAssistantConversationsInputSchema, input);\n const response = await this.#client.listConversations(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n conversations: response.conversations.map(formatConversation),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /** Lists one conversation's messages, newest first. */\n async listMessages(\n input: ListAssistantMessagesInput,\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantMessagesResult> {\n const request = parse(ListAssistantMessagesInputSchema, input);\n const response = await this.#client.listMessages(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n messages: response.messages.map(formatMessage),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /**\n * Lists what the assistant remembers about the caller, newest first. A `profile` memory\n * applies to every answer; the others are used when relevant.\n */\n async listMemories(\n input: ListAssistantMemoriesInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantMemoriesResult> {\n const request = parse(ListAssistantMemoriesInputSchema, input);\n const response = await this.#client.listMemories(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n memories: response.memories.map(formatMemory),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /** Makes the assistant forget one memory. Deleting a deleted memory succeeds. */\n async deleteMemory(\n input: DeleteAssistantMemoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<void> {\n const request = parse(DeleteAssistantMemoryInputSchema, input);\n await this.#client.deleteMemory(request, toConnectCallOptions(options));\n }\n\n /**\n * Step 1 of giving the assistant keys: the assistant generates one Ed25519 key pair per\n * account and returns the public keys with their registration proofs. Register them with\n * `apiKeys.setAssistantKeys` (with a fresh `stepUpToken`) before `expiresAt`, then call\n * `completeKeys`. The step-up token goes to `setAssistantKeys` only, never to the assistant.\n */\n async prepareKeys(\n input: PrepareAssistantKeysInput,\n options?: PolyesterRequestOptions,\n ): Promise<PrepareAssistantKeysResult> {\n const request = parse(PrepareAssistantKeysInputSchema, input);\n const response = await this.#client.prepareAssistantKeys(\n { accounts: request.accounts.map((account) => removeUndefined(account)) },\n toConnectCallOptions(options),\n );\n return formatPrepareAssistantKeysResult(response);\n }\n\n /**\n * Finishes a key setup once `apiKeys.setAssistantKeys` registered its keys; returns the keys\n * the assistant now holds. Completing a completed setup returns the keys again.\n */\n async completeKeys(\n input: CompleteAssistantKeysInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantKey[]> {\n const request = parse(CompleteAssistantKeysInputSchema, input);\n const response = await this.#client.completeAssistantKeys(\n request,\n toConnectCallOptions(options),\n );\n return response.keys.map(formatAssistantKey);\n }\n\n /**\n * Lists the keys the assistant holds, at most one per account. An account without one has\n * no account tools. Revoke them with `apiKeys.deleteAssistantKeys`.\n */\n async listKeys(options?: PolyesterRequestOptions): Promise<AssistantKey[]> {\n const response = await this.#client.listAssistantKeys({}, toConnectCallOptions(options));\n return response.keys.map(formatAssistantKey);\n }\n\n /**\n * Returns the caller's limits on what they may approve from Telegram, in US dollars of\n * notional value, and the value approved from Telegram in the last 24 hours while a limit\n * was set. Limits apply to placing, swapping, modifying and resuming; cancelling, pausing\n * and rejecting are never limited.\n */\n async getTelegramApprovalLimits(\n options?: PolyesterRequestOptions,\n ): Promise<TelegramApprovalLimits & { approvedLast24hUsd: string }> {\n const response = await this.#client.getTelegramApprovalLimits(\n {},\n toConnectCallOptions(options),\n );\n return {\n ...formatTelegramApprovalLimits(response.limits),\n approvedLast24hUsd: response.approvedLast24hUsd,\n };\n }\n\n /**\n * Replaces both Telegram approval limits: a limit left out is turned off. Only a signed-in\n * session sets them; they apply to the next approval from Telegram. Returns the limits as\n * recorded.\n */\n async setTelegramApprovalLimits(\n input: SetTelegramApprovalLimitsInput,\n options?: PolyesterRequestOptions,\n ): Promise<TelegramApprovalLimits> {\n const limits = parse(SetTelegramApprovalLimitsInputSchema, input);\n const response = await this.#client.setTelegramApprovalLimits(\n { limits: removeUndefined(limits) },\n toConnectCallOptions(options),\n );\n return formatTelegramApprovalLimits(response.limits);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0DA,IAAa,mBAAb,MAA8B;CAC1B;CACA;CAEA,YAAY,YAA+B,QAAmB;EAC1D,KAAKA,UAAU,aAAaC,oBAAwB,WAAW,OAAO;EACtE,KAAKC,UAAU;CACnB;;;;;;CAOA,MAAM,YACF,OACA,SACkD;EAClD,MAAM,UAAU,MAAM,iCAAiC,KAAK;EAC5D,MAAM,WAAW,MAAM,KAAKF,QAAQ,YAChC,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO;GACH,OAAO,SAAS,SAAS,KAAK;GAC9B,gBAAgB,SAAS,SAAS,cAAc;EACpD;CACJ;;;;;;;CAQA,OAAO,SACH,OACA,SACkD;EAClD,MAAM,UAAU,MAAM,8BAA8B,KAAK;EACzD,MAAM,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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,QAAQ,sBAChC,SACA,qBAAqB,OAAO,CAChC,EAAA,CACgB,KAAK,IAAI,kBAAkB;CAC/C;;;;;CAMA,MAAM,SAAS,SAA4D;EAEvE,QAAO,MADgB,KAAKA,QAAQ,kBAAkB,CAAC,GAAG,qBAAqB,OAAO,CAAC,EAAA,CACvE,KAAK,IAAI,kBAAkB;CAC/C;;;;;;;CAQA,MAAM,0BACF,SACgE;EAChE,MAAM,WAAW,MAAM,KAAKA,QAAQ,0BAChC,CAAC,GACD,qBAAqB,OAAO,CAChC;EACA,OAAO;GACH,GAAG,6BAA6B,SAAS,MAAM;GAC/C,oBAAoB,SAAS;EACjC;CACJ;;;;;;CAOA,MAAM,0BACF,OACA,SAC+B;EAC/B,MAAM,SAAS,MAAM,sCAAsC,KAAK;EAChE,MAAM,WAAW,MAAM,KAAKA,QAAQ,0BAChC,EAAE,QAAQ,gBAAgB,MAAM,EAAE,GAClC,qBAAqB,OAAO,CAChC;EACA,OAAO,6BAA6B,SAAS,MAAM;CACvD;AACJ"}
|
|
@@ -179,6 +179,18 @@ type ListAssistantMemoriesResult = {
|
|
|
179
179
|
memories: AssistantMemory[];
|
|
180
180
|
nextPageToken: string;
|
|
181
181
|
};
|
|
182
|
+
declare const SetTelegramApprovalLimitsInputSchema: v.StrictObjectSchema<{
|
|
183
|
+
/** Largest notional value of one approval from Telegram. `"0"` allows none; omit for no limit. */
|
|
184
|
+
readonly perApprovalUsd: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.RegexAction<string, "limit must be US dollars with at most 2 decimal places">]>, undefined>;
|
|
185
|
+
/** Largest total notional value approved from Telegram in any rolling 24 hours; omit for no limit. */
|
|
186
|
+
readonly dailyUsd: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.RegexAction<string, "limit must be US dollars with at most 2 decimal places">]>, undefined>;
|
|
187
|
+
}, undefined>;
|
|
188
|
+
type SetTelegramApprovalLimitsInput = v.InferInput<typeof SetTelegramApprovalLimitsInputSchema>;
|
|
189
|
+
/** Limits on what the caller may approve from Telegram, in US dollars; `null` is no limit. */
|
|
190
|
+
type TelegramApprovalLimits = {
|
|
191
|
+
perApprovalUsd: string | null;
|
|
192
|
+
dailyUsd: string | null;
|
|
193
|
+
};
|
|
182
194
|
//#endregion
|
|
183
|
-
export { AssistantConversation, AssistantKey, AssistantMemory, AssistantMessage, AssistantRunIdInput, AssistantRunIdInputSchema, CompleteAssistantKeysInput, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInput, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInput, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInput, ListAssistantConversationsInputSchema, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesInputSchema, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesInputSchema, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysInputSchema, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SendAssistantMessageInputSchema, WatchAssistantRunInput, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult, formatPreparedAssistantKey };
|
|
195
|
+
export { AssistantConversation, AssistantKey, AssistantMemory, AssistantMessage, AssistantRunIdInput, AssistantRunIdInputSchema, CompleteAssistantKeysInput, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInput, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInput, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInput, ListAssistantConversationsInputSchema, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesInputSchema, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesInputSchema, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysInputSchema, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SendAssistantMessageInputSchema, SetTelegramApprovalLimitsInput, SetTelegramApprovalLimitsInputSchema, TelegramApprovalLimits, WatchAssistantRunInput, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult, formatPreparedAssistantKey };
|
|
184
196
|
//# sourceMappingURL=assistant.schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.schemas.d.ts","names":[],"sources":["../../../src/services/assistant/assistant.schemas.ts"],"mappings":";;;cAsCa,iCAA+B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BhC,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;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AAkB;;KAG/C;EACR,eAAe;EACf;;KAEQ;EAAgC,UAAU;EAAoB;;KAC9D;EAAgC,UAAU;EAAmB;;cAS5D,sCAAoC,EAAA;;;;;;KAOrC,iCAAiC,EAAE,kBACpC;;KAIC;EACR;EACA"}
|
|
@@ -129,7 +129,21 @@ function formatPrepareAssistantKeysResult(r) {
|
|
|
129
129
|
expiresAt: tsObjToMs(r.expiresAt)
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
+
/** US dollars as a decimal string with at most 2 decimal places, e.g. `"5000"` or `"250.50"`. */
|
|
133
|
+
const UsdLimitInputSchema = v.pipe(v.string(), v.trim(), v.regex(/^\d+(\.\d{1,2})?$/, "limit must be US dollars with at most 2 decimal places"));
|
|
134
|
+
const SetTelegramApprovalLimitsInputSchema = v.strictObject({
|
|
135
|
+
/** Largest notional value of one approval from Telegram. `"0"` allows none; omit for no limit. */
|
|
136
|
+
perApprovalUsd: v.optional(UsdLimitInputSchema),
|
|
137
|
+
/** Largest total notional value approved from Telegram in any rolling 24 hours; omit for no limit. */
|
|
138
|
+
dailyUsd: v.optional(UsdLimitInputSchema)
|
|
139
|
+
});
|
|
140
|
+
function formatTelegramApprovalLimits(limits) {
|
|
141
|
+
return {
|
|
142
|
+
perApprovalUsd: limits?.perApprovalUsd ?? null,
|
|
143
|
+
dailyUsd: limits?.dailyUsd ?? null
|
|
144
|
+
};
|
|
145
|
+
}
|
|
132
146
|
//#endregion
|
|
133
|
-
export { AssistantRunIdInputSchema, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInputSchema, ListAssistantMemoriesInputSchema, ListAssistantMessagesInputSchema, PrepareAssistantKeysInputSchema, SendAssistantMessageInputSchema, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult, formatPreparedAssistantKey };
|
|
147
|
+
export { AssistantRunIdInputSchema, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInputSchema, ListAssistantMemoriesInputSchema, ListAssistantMessagesInputSchema, PrepareAssistantKeysInputSchema, SendAssistantMessageInputSchema, SetTelegramApprovalLimitsInputSchema, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult, formatPreparedAssistantKey, formatTelegramApprovalLimits };
|
|
134
148
|
|
|
135
149
|
//# sourceMappingURL=assistant.schemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.schemas.js","names":[],"sources":["../../../src/services/assistant/assistant.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { bytesToHex } from \"@noble/hashes/utils.js\";\nimport type * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport { idInputSchema, optionalSubaccountIdInputSchema } from \"../../shared/schemas.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { tsObjToMs } from \"../../utils/time.js\";\nimport {\n ASSISTANT_APPROVAL_DECISION_VALUES,\n ApprovalDecisionCodec,\n AssistantKeyStateCodec,\n MemoryKindCodec,\n MessageRoleCodec,\n} from \"./assistant.codecs.js\";\n\nconst IdempotencyKeySchema = v.pipe(v.string(), v.trim(), v.minLength(1));\n\nfunction pageInputEntries(maxLimit: number) {\n return {\n /** Page size; omit for the server default. */\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(maxLimit))),\n /** The previous page's `nextPageToken`. */\n pageToken: v.optional(v.pipe(v.string(), v.trim())),\n };\n}\n\nconst DestinationInputSchema = v.strictObject({\n /** The client's id for the place, e.g. `\"page-subaccounts\"`: lowercase letters, digits and hyphens. */\n id: v.pipe(\n v.string(),\n v.regex(/^[a-z0-9-]{1,64}$/, \"destination id must be 1-64 of a-z, 0-9, -\"),\n ),\n /** Its name as the client shows it, 1 to 80 characters. */\n title: v.pipe(v.string(), v.minLength(1), v.maxLength(80)),\n /** What the user does there, at most 200 characters. */\n description: v.optional(v.pipe(v.string(), v.maxLength(200)), \"\"),\n});\n\nexport const SendAssistantMessageInputSchema = v.pipe(\n v.strictObject({\n /** Conversation to continue; omit to start a new one. */\n conversationId: v.optional(idInputSchema(\"conversationId\")),\n /** Message text, plain text or Markdown, 1 to 16000 characters. */\n text: v.pipe(v.string(), v.minLength(1), v.maxLength(16_000)),\n /** Client-chosen key, unique per caller. Repeat the request unchanged to resolve an unknown outcome. */\n idempotencyKey: IdempotencyKeySchema,\n /**\n * Trading account the run reads and acts on. Omit to answer without account data: the\n * run then has no account tools.\n */\n subaccountId: optionalSubaccountIdInputSchema(),\n /** Places in the client the run may suggest, at most 100, each id once. */\n destinations: v.optional(\n v.pipe(\n v.array(DestinationInputSchema),\n v.maxLength(100, \"At most 100 destinations are allowed.\"),\n v.check(\n (items) => new Set(items.map((d) => d.id)).size === items.length,\n \"Destination ids must be distinct.\",\n ),\n ),\n ),\n }),\n);\n\nexport type SendAssistantMessageInput = v.InferInput<typeof SendAssistantMessageInputSchema>;\n\nexport const AssistantRunIdInputSchema = v.strictObject({ runId: idInputSchema(\"runId\") });\n\nexport type AssistantRunIdInput = v.InferInput<typeof AssistantRunIdInputSchema>;\n\nexport const WatchAssistantRunInputSchema = v.pipe(\n v.strictObject({\n runId: idInputSchema(\"runId\"),\n /** Return events after this seq. 0 (default) replays the run; pass the last seq received to resume. */\n afterSeq: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(Number.MAX_SAFE_INTEGER)),\n 0,\n ),\n }),\n v.transform(({ runId, afterSeq }) => ({ runId, afterSeq: BigInt(afterSeq) })),\n);\n\nexport type WatchAssistantRunInput = v.InferInput<typeof WatchAssistantRunInputSchema>;\n\nexport const DecideAssistantApprovalInputSchema = v.pipe(\n v.strictObject({\n approvalId: idInputSchema(\"approvalId\"),\n decision: v.picklist(ASSISTANT_APPROVAL_DECISION_VALUES),\n }),\n v.transform(({ approvalId, decision }) => ({\n approvalId,\n decision: ApprovalDecisionCodec.inputToProto[decision],\n })),\n);\n\nexport type DecideAssistantApprovalInput = v.InferInput<typeof DecideAssistantApprovalInputSchema>;\n\nexport const ListAssistantConversationsInputSchema = v.strictObject(pageInputEntries(100));\n\nexport type ListAssistantConversationsInput = v.InferInput<\n typeof ListAssistantConversationsInputSchema\n>;\n\nexport const ListAssistantMessagesInputSchema = v.strictObject({\n conversationId: idInputSchema(\"conversationId\"),\n ...pageInputEntries(200),\n});\n\nexport type ListAssistantMessagesInput = v.InferInput<typeof ListAssistantMessagesInputSchema>;\n\nexport const ListAssistantMemoriesInputSchema = v.strictObject(pageInputEntries(200));\n\nexport type ListAssistantMemoriesInput = v.InferInput<typeof ListAssistantMemoriesInputSchema>;\n\nexport const DeleteAssistantMemoryInputSchema = v.strictObject({\n memoryId: idInputSchema(\"memoryId\"),\n});\n\nexport type DeleteAssistantMemoryInput = v.InferInput<typeof DeleteAssistantMemoryInputSchema>;\n\nexport const PrepareAssistantKeysInputSchema = v.pipe(\n v.strictObject({\n /** 1 to 64 accounts, each once. An entry without `subaccountId` is the main account. */\n accounts: v.pipe(\n v.array(v.strictObject({ subaccountId: optionalSubaccountIdInputSchema() })),\n v.minLength(1, \"At least one account is required.\"),\n v.maxLength(64, \"At most 64 accounts are allowed.\"),\n ),\n }),\n v.check(\n ({ accounts }) =>\n new Set(accounts.map((a) => a.subaccountId ?? 0n)).size === accounts.length,\n \"Each account may be named only once.\",\n ),\n);\n\nexport type PrepareAssistantKeysInput = v.InferInput<typeof PrepareAssistantKeysInputSchema>;\n\nexport const CompleteAssistantKeysInputSchema = v.strictObject({\n setupId: idInputSchema(\"setupId\"),\n});\n\nexport type CompleteAssistantKeysInput = v.InferInput<typeof CompleteAssistantKeysInputSchema>;\n\n/* ---------- outputs ---------- */\n\nfunction optionalId(id: bigint | undefined): string | undefined {\n return id ? formatId(id) : undefined;\n}\n\nexport function formatConversation(c: Proto.Conversation) {\n return {\n conversationId: formatId(c.conversationId),\n /** Empty until a title is available. */\n title: c.title,\n createdAt: tsObjToMs(c.createdAt),\n updatedAt: tsObjToMs(c.updatedAt),\n };\n}\n\nexport type AssistantConversation = ReturnType<typeof formatConversation>;\n\nexport function formatMessage(m: Proto.Message) {\n return {\n messageId: formatId(m.messageId),\n role: enumLabel(MessageRoleCodec.protoToOutput, m.role),\n /** Markdown. For an assistant message, its run's final text. */\n text: m.text,\n createdAt: tsObjToMs(m.createdAt),\n /** Replay this run with `watchRun` from `afterSeq: 0` to show its tool activity and views. */\n runId: formatId(m.runId),\n };\n}\n\nexport type AssistantMessage = ReturnType<typeof formatMessage>;\n\nexport function formatMemory(m: Proto.Memory) {\n return {\n memoryId: formatId(m.memoryId),\n text: m.text,\n createdAt: tsObjToMs(m.createdAt),\n /** Omitted when the conversation it was learned in is unknown. */\n conversationId: optionalId(m.conversationId),\n kind: enumLabel(MemoryKindCodec.protoToOutput, m.kind),\n };\n}\n\nexport type AssistantMemory = ReturnType<typeof formatMemory>;\n\nexport function formatAssistantKey(k: Proto.AssistantKey) {\n return {\n /** Omitted for the main account. */\n subaccountId: optionalId(k.subaccountId),\n keyId: k.keyId,\n publicKeyEd25519: k.publicKeyEd25519,\n publicKeyHex: bytesToHex(k.publicKeyEd25519),\n state: enumLabel(AssistantKeyStateCodec.protoToOutput, k.state),\n };\n}\n\nexport type AssistantKey = ReturnType<typeof formatAssistantKey>;\n\nexport function formatPreparedAssistantKey(k: Proto.PreparedAssistantKey) {\n return {\n /** Omitted for the main account. */\n subaccountId: optionalId(k.subaccountId),\n publicKeyEd25519: k.publicKeyEd25519,\n publicKeyHex: bytesToHex(k.publicKeyEd25519),\n /** Pass unchanged to `apiKeys.setAssistantKeys`. */\n registrationProof: k.registrationProof,\n /** Epoch ms; pass unchanged to `apiKeys.setAssistantKeys`. */\n registrationDeadline: tsObjToMs(k.registrationDeadline),\n };\n}\n\nexport type PreparedAssistantKey = ReturnType<typeof formatPreparedAssistantKey>;\n\nexport function formatPrepareAssistantKeysResult(r: Proto.PrepareAssistantKeysResponse) {\n return {\n setupId: formatId(r.setupId),\n /** One key per requested account, in request order. */\n keys: r.keys.map(formatPreparedAssistantKey),\n /** Epoch ms after which the keys can no longer be registered. */\n expiresAt: tsObjToMs(r.expiresAt),\n };\n}\n\nexport type PrepareAssistantKeysResult = ReturnType<typeof formatPrepareAssistantKeysResult>;\n\n/** `nextPageToken` is empty when no more results exist. */\nexport type ListAssistantConversationsResult = {\n conversations: AssistantConversation[];\n nextPageToken: string;\n};\nexport type ListAssistantMessagesResult = { messages: AssistantMessage[]; nextPageToken: string };\nexport type ListAssistantMemoriesResult = { memories: AssistantMemory[]; nextPageToken: string };\n"],"mappings":";;;;;;;;AAeA,MAAM,uBAAuB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,CAAC;AAExE,SAAS,iBAAiB,UAAkB;CACxC,OAAO;;EAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,QAAQ,CAAC,CAAC;;EAEtF,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,CAAC;CACtD;AACJ;AAEA,MAAM,yBAAyB,EAAE,aAAa;;CAE1C,IAAI,EAAE,KACF,EAAE,OAAO,GACT,EAAE,MAAM,qBAAqB,4CAA4C,CAC7E;;CAEA,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;;CAEzD,aAAa,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,GAAG,CAAC,GAAG,EAAE;AACpE,CAAC;AAED,MAAa,kCAAkC,EAAE,KAC7C,EAAE,aAAa;;CAEX,gBAAgB,EAAE,SAAS,cAAc,gBAAgB,CAAC;;CAE1D,MAAM,EAAE,KAAK,E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J;AAIA,SAAgB,2BAA2B,GAA+B;CACtE,OAAO;;EAEH,cAAc,WAAW,EAAE,YAAY;EACvC,kBAAkB,EAAE;EACpB,cAAc,WAAW,EAAE,gBAAgB;;EAE3C,mBAAmB,EAAE;;EAErB,sBAAsB,UAAU,EAAE,oBAAoB;CAC1D;AACJ;AAIA,SAAgB,iCAAiC,GAAuC;CACpF,OAAO;EACH,SAAS,SAAS,EAAE,OAAO;;EAE3B,MAAM,EAAE,KAAK,IAAI,0BAA0B;;EAE3C,WAAW,UAAU,EAAE,SAAS;CACpC;AACJ"}
|
|
1
|
+
{"version":3,"file":"assistant.schemas.js","names":[],"sources":["../../../src/services/assistant/assistant.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { bytesToHex } from \"@noble/hashes/utils.js\";\nimport type * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport { idInputSchema, optionalSubaccountIdInputSchema } from \"../../shared/schemas.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { tsObjToMs } from \"../../utils/time.js\";\nimport {\n ASSISTANT_APPROVAL_DECISION_VALUES,\n ApprovalDecisionCodec,\n AssistantKeyStateCodec,\n MemoryKindCodec,\n MessageRoleCodec,\n} from \"./assistant.codecs.js\";\n\nconst IdempotencyKeySchema = v.pipe(v.string(), v.trim(), v.minLength(1));\n\nfunction pageInputEntries(maxLimit: number) {\n return {\n /** Page size; omit for the server default. */\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(maxLimit))),\n /** The previous page's `nextPageToken`. */\n pageToken: v.optional(v.pipe(v.string(), v.trim())),\n };\n}\n\nconst DestinationInputSchema = v.strictObject({\n /** The client's id for the place, e.g. `\"page-subaccounts\"`: lowercase letters, digits and hyphens. */\n id: v.pipe(\n v.string(),\n v.regex(/^[a-z0-9-]{1,64}$/, \"destination id must be 1-64 of a-z, 0-9, -\"),\n ),\n /** Its name as the client shows it, 1 to 80 characters. */\n title: v.pipe(v.string(), v.minLength(1), v.maxLength(80)),\n /** What the user does there, at most 200 characters. */\n description: v.optional(v.pipe(v.string(), v.maxLength(200)), \"\"),\n});\n\nexport const SendAssistantMessageInputSchema = v.pipe(\n v.strictObject({\n /** Conversation to continue; omit to start a new one. */\n conversationId: v.optional(idInputSchema(\"conversationId\")),\n /** Message text, plain text or Markdown, 1 to 16000 characters. */\n text: v.pipe(v.string(), v.minLength(1), v.maxLength(16_000)),\n /** Client-chosen key, unique per caller. Repeat the request unchanged to resolve an unknown outcome. */\n idempotencyKey: IdempotencyKeySchema,\n /**\n * Trading account the run reads and acts on. Omit to answer without account data: the\n * run then has no account tools.\n */\n subaccountId: optionalSubaccountIdInputSchema(),\n /** Places in the client the run may suggest, at most 100, each id once. */\n destinations: v.optional(\n v.pipe(\n v.array(DestinationInputSchema),\n v.maxLength(100, \"At most 100 destinations are allowed.\"),\n v.check(\n (items) => new Set(items.map((d) => d.id)).size === items.length,\n \"Destination ids must be distinct.\",\n ),\n ),\n ),\n }),\n);\n\nexport type SendAssistantMessageInput = v.InferInput<typeof SendAssistantMessageInputSchema>;\n\nexport const AssistantRunIdInputSchema = v.strictObject({ runId: idInputSchema(\"runId\") });\n\nexport type AssistantRunIdInput = v.InferInput<typeof AssistantRunIdInputSchema>;\n\nexport const WatchAssistantRunInputSchema = v.pipe(\n v.strictObject({\n runId: idInputSchema(\"runId\"),\n /** Return events after this seq. 0 (default) replays the run; pass the last seq received to resume. */\n afterSeq: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(Number.MAX_SAFE_INTEGER)),\n 0,\n ),\n }),\n v.transform(({ runId, afterSeq }) => ({ runId, afterSeq: BigInt(afterSeq) })),\n);\n\nexport type WatchAssistantRunInput = v.InferInput<typeof WatchAssistantRunInputSchema>;\n\nexport const DecideAssistantApprovalInputSchema = v.pipe(\n v.strictObject({\n approvalId: idInputSchema(\"approvalId\"),\n decision: v.picklist(ASSISTANT_APPROVAL_DECISION_VALUES),\n }),\n v.transform(({ approvalId, decision }) => ({\n approvalId,\n decision: ApprovalDecisionCodec.inputToProto[decision],\n })),\n);\n\nexport type DecideAssistantApprovalInput = v.InferInput<typeof DecideAssistantApprovalInputSchema>;\n\nexport const ListAssistantConversationsInputSchema = v.strictObject(pageInputEntries(100));\n\nexport type ListAssistantConversationsInput = v.InferInput<\n typeof ListAssistantConversationsInputSchema\n>;\n\nexport const ListAssistantMessagesInputSchema = v.strictObject({\n conversationId: idInputSchema(\"conversationId\"),\n ...pageInputEntries(200),\n});\n\nexport type ListAssistantMessagesInput = v.InferInput<typeof ListAssistantMessagesInputSchema>;\n\nexport const ListAssistantMemoriesInputSchema = v.strictObject(pageInputEntries(200));\n\nexport type ListAssistantMemoriesInput = v.InferInput<typeof ListAssistantMemoriesInputSchema>;\n\nexport const DeleteAssistantMemoryInputSchema = v.strictObject({\n memoryId: idInputSchema(\"memoryId\"),\n});\n\nexport type DeleteAssistantMemoryInput = v.InferInput<typeof DeleteAssistantMemoryInputSchema>;\n\nexport const PrepareAssistantKeysInputSchema = v.pipe(\n v.strictObject({\n /** 1 to 64 accounts, each once. An entry without `subaccountId` is the main account. */\n accounts: v.pipe(\n v.array(v.strictObject({ subaccountId: optionalSubaccountIdInputSchema() })),\n v.minLength(1, \"At least one account is required.\"),\n v.maxLength(64, \"At most 64 accounts are allowed.\"),\n ),\n }),\n v.check(\n ({ accounts }) =>\n new Set(accounts.map((a) => a.subaccountId ?? 0n)).size === accounts.length,\n \"Each account may be named only once.\",\n ),\n);\n\nexport type PrepareAssistantKeysInput = v.InferInput<typeof PrepareAssistantKeysInputSchema>;\n\nexport const CompleteAssistantKeysInputSchema = v.strictObject({\n setupId: idInputSchema(\"setupId\"),\n});\n\nexport type CompleteAssistantKeysInput = v.InferInput<typeof CompleteAssistantKeysInputSchema>;\n\n/* ---------- outputs ---------- */\n\nfunction optionalId(id: bigint | undefined): string | undefined {\n return id ? formatId(id) : undefined;\n}\n\nexport function formatConversation(c: Proto.Conversation) {\n return {\n conversationId: formatId(c.conversationId),\n /** Empty until a title is available. */\n title: c.title,\n createdAt: tsObjToMs(c.createdAt),\n updatedAt: tsObjToMs(c.updatedAt),\n };\n}\n\nexport type AssistantConversation = ReturnType<typeof formatConversation>;\n\nexport function formatMessage(m: Proto.Message) {\n return {\n messageId: formatId(m.messageId),\n role: enumLabel(MessageRoleCodec.protoToOutput, m.role),\n /** Markdown. For an assistant message, its run's final text. */\n text: m.text,\n createdAt: tsObjToMs(m.createdAt),\n /** Replay this run with `watchRun` from `afterSeq: 0` to show its tool activity and views. */\n runId: formatId(m.runId),\n };\n}\n\nexport type AssistantMessage = ReturnType<typeof formatMessage>;\n\nexport function formatMemory(m: Proto.Memory) {\n return {\n memoryId: formatId(m.memoryId),\n text: m.text,\n createdAt: tsObjToMs(m.createdAt),\n /** Omitted when the conversation it was learned in is unknown. */\n conversationId: optionalId(m.conversationId),\n kind: enumLabel(MemoryKindCodec.protoToOutput, m.kind),\n };\n}\n\nexport type AssistantMemory = ReturnType<typeof formatMemory>;\n\nexport function formatAssistantKey(k: Proto.AssistantKey) {\n return {\n /** Omitted for the main account. */\n subaccountId: optionalId(k.subaccountId),\n keyId: k.keyId,\n publicKeyEd25519: k.publicKeyEd25519,\n publicKeyHex: bytesToHex(k.publicKeyEd25519),\n state: enumLabel(AssistantKeyStateCodec.protoToOutput, k.state),\n };\n}\n\nexport type AssistantKey = ReturnType<typeof formatAssistantKey>;\n\nexport function formatPreparedAssistantKey(k: Proto.PreparedAssistantKey) {\n return {\n /** Omitted for the main account. */\n subaccountId: optionalId(k.subaccountId),\n publicKeyEd25519: k.publicKeyEd25519,\n publicKeyHex: bytesToHex(k.publicKeyEd25519),\n /** Pass unchanged to `apiKeys.setAssistantKeys`. */\n registrationProof: k.registrationProof,\n /** Epoch ms; pass unchanged to `apiKeys.setAssistantKeys`. */\n registrationDeadline: tsObjToMs(k.registrationDeadline),\n };\n}\n\nexport type PreparedAssistantKey = ReturnType<typeof formatPreparedAssistantKey>;\n\nexport function formatPrepareAssistantKeysResult(r: Proto.PrepareAssistantKeysResponse) {\n return {\n setupId: formatId(r.setupId),\n /** One key per requested account, in request order. */\n keys: r.keys.map(formatPreparedAssistantKey),\n /** Epoch ms after which the keys can no longer be registered. */\n expiresAt: tsObjToMs(r.expiresAt),\n };\n}\n\nexport type PrepareAssistantKeysResult = ReturnType<typeof formatPrepareAssistantKeysResult>;\n\n/** `nextPageToken` is empty when no more results exist. */\nexport type ListAssistantConversationsResult = {\n conversations: AssistantConversation[];\n nextPageToken: string;\n};\nexport type ListAssistantMessagesResult = { messages: AssistantMessage[]; nextPageToken: string };\nexport type ListAssistantMemoriesResult = { memories: AssistantMemory[]; nextPageToken: string };\n\n/** US dollars as a decimal string with at most 2 decimal places, e.g. `\"5000\"` or `\"250.50\"`. */\nconst UsdLimitInputSchema = v.pipe(\n v.string(),\n v.trim(),\n v.regex(/^\\d+(\\.\\d{1,2})?$/, \"limit must be US dollars with at most 2 decimal places\"),\n);\n\nexport const SetTelegramApprovalLimitsInputSchema = v.strictObject({\n /** Largest notional value of one approval from Telegram. `\"0\"` allows none; omit for no limit. */\n perApprovalUsd: v.optional(UsdLimitInputSchema),\n /** Largest total notional value approved from Telegram in any rolling 24 hours; omit for no limit. */\n dailyUsd: v.optional(UsdLimitInputSchema),\n});\n\nexport type SetTelegramApprovalLimitsInput = v.InferInput<\n typeof SetTelegramApprovalLimitsInputSchema\n>;\n\n/** Limits on what the caller may approve from Telegram, in US dollars; `null` is no limit. */\nexport type TelegramApprovalLimits = {\n perApprovalUsd: string | null;\n dailyUsd: string | null;\n};\n\nexport function formatTelegramApprovalLimits(\n limits: Proto.TelegramApprovalLimits | undefined,\n): TelegramApprovalLimits {\n return {\n perApprovalUsd: limits?.perApprovalUsd ?? null,\n dailyUsd: limits?.dailyUsd ?? null,\n };\n}\n"],"mappings":";;;;;;;;AAeA,MAAM,uBAAuB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAA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AAE,SAAS,mBAAmB;;CAE9C,UAAU,EAAE,SAAS,mBAAmB;AAC5C,CAAC;AAYD,SAAgB,6BACZ,QACsB;CACtB,OAAO;EACH,gBAAgB,QAAQ,kBAAkB;EAC1C,UAAU,QAAQ,YAAY;CAClC;AACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AssistantApprovalPreview, AssistantOrderPreview, AssistantRunEvent, AssistantView } from "./assistant-events.schemas.js";
|
|
2
2
|
import { AssistantApprovalDecision, AssistantApprovalStatus, AssistantFailureCategory, AssistantKeyState, AssistantMemoryKind, AssistantMessageRole, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy } from "./assistant.codecs.js";
|
|
3
|
-
import { AssistantConversation, AssistantKey, AssistantMemory, AssistantMessage, AssistantRunIdInput, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, WatchAssistantRunInput } from "./assistant.schemas.js";
|
|
4
|
-
export type { AssistantApprovalDecision, AssistantApprovalPreview, AssistantApprovalStatus, AssistantConversation, AssistantFailureCategory, AssistantKey, AssistantKeyState, AssistantMemory, AssistantMemoryKind, AssistantMessage, AssistantMessageRole, AssistantOrderPreview, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantRunEvent, AssistantRunIdInput, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy, AssistantView, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, WatchAssistantRunInput };
|
|
3
|
+
import { AssistantConversation, AssistantKey, AssistantMemory, AssistantMessage, AssistantRunIdInput, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SetTelegramApprovalLimitsInput, TelegramApprovalLimits, WatchAssistantRunInput } from "./assistant.schemas.js";
|
|
4
|
+
export type { AssistantApprovalDecision, AssistantApprovalPreview, AssistantApprovalStatus, AssistantConversation, AssistantFailureCategory, AssistantKey, AssistantKeyState, AssistantMemory, AssistantMemoryKind, AssistantMessage, AssistantMessageRole, AssistantOrderPreview, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantRunEvent, AssistantRunIdInput, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy, AssistantView, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SetTelegramApprovalLimitsInput, TelegramApprovalLimits, WatchAssistantRunInput };
|
|
@@ -500,7 +500,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
500
500
|
readonly hi: v.BigintSchema<undefined>;
|
|
501
501
|
readonly lo: v.BigintSchema<undefined>;
|
|
502
502
|
}, undefined>, undefined>;
|
|
503
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "
|
|
503
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted">]>;
|
|
504
504
|
readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
|
|
505
505
|
readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
506
506
|
readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
@@ -524,7 +524,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
524
524
|
hi: bigint;
|
|
525
525
|
lo: bigint;
|
|
526
526
|
} | undefined;
|
|
527
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
527
|
+
state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
|
|
528
528
|
reason: AutoWithdrawStepReason | null;
|
|
529
529
|
intentId: string;
|
|
530
530
|
txHash: string;
|
|
@@ -538,7 +538,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
538
538
|
txHash: string | null;
|
|
539
539
|
assetId: number;
|
|
540
540
|
destinationAddress: string;
|
|
541
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
541
|
+
state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
|
|
542
542
|
reason: AutoWithdrawStepReason | null;
|
|
543
543
|
}>]>;
|
|
544
544
|
/**
|
|
@@ -559,7 +559,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
559
559
|
seconds: bigint;
|
|
560
560
|
nanos: number;
|
|
561
561
|
}, number>]>;
|
|
562
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "
|
|
562
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "planned" | "paying" | "completed" | "partially_failed" | "skipped">]>;
|
|
563
563
|
readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawRunReason | null>]>;
|
|
564
564
|
readonly steps: v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
565
565
|
readonly assetId: v.NumberSchema<undefined>;
|
|
@@ -581,7 +581,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
581
581
|
readonly hi: v.BigintSchema<undefined>;
|
|
582
582
|
readonly lo: v.BigintSchema<undefined>;
|
|
583
583
|
}, undefined>, undefined>;
|
|
584
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "
|
|
584
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted">]>;
|
|
585
585
|
readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
|
|
586
586
|
readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
587
587
|
readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
@@ -605,7 +605,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
605
605
|
hi: bigint;
|
|
606
606
|
lo: bigint;
|
|
607
607
|
} | undefined;
|
|
608
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
608
|
+
state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
|
|
609
609
|
reason: AutoWithdrawStepReason | null;
|
|
610
610
|
intentId: string;
|
|
611
611
|
txHash: string;
|
|
@@ -619,7 +619,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
619
619
|
txHash: string | null;
|
|
620
620
|
assetId: number;
|
|
621
621
|
destinationAddress: string;
|
|
622
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
622
|
+
state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
|
|
623
623
|
reason: AutoWithdrawStepReason | null;
|
|
624
624
|
}>]>, undefined>;
|
|
625
625
|
readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -640,7 +640,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
640
640
|
runSeq: string;
|
|
641
641
|
ruleVersion: number;
|
|
642
642
|
scheduledFor: number;
|
|
643
|
-
state: "unspecified" | "failed" | "
|
|
643
|
+
state: "unspecified" | "failed" | "planned" | "paying" | "completed" | "partially_failed" | "skipped";
|
|
644
644
|
reason: AutoWithdrawRunReason | null;
|
|
645
645
|
steps: {
|
|
646
646
|
destinationChainId: number;
|
|
@@ -652,7 +652,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
652
652
|
txHash: string | null;
|
|
653
653
|
assetId: number;
|
|
654
654
|
destinationAddress: string;
|
|
655
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
655
|
+
state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
|
|
656
656
|
reason: AutoWithdrawStepReason | null;
|
|
657
657
|
}[];
|
|
658
658
|
createdAt: number;
|
|
@@ -662,7 +662,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
662
662
|
runSeq: string;
|
|
663
663
|
ruleVersion: number;
|
|
664
664
|
scheduledFor: number;
|
|
665
|
-
state: "unspecified" | "failed" | "
|
|
665
|
+
state: "unspecified" | "failed" | "planned" | "paying" | "completed" | "partially_failed" | "skipped";
|
|
666
666
|
reason: AutoWithdrawRunReason | null;
|
|
667
667
|
steps: {
|
|
668
668
|
destinationChainId: number;
|
|
@@ -674,7 +674,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
674
674
|
txHash: string | null;
|
|
675
675
|
assetId: number;
|
|
676
676
|
destinationAddress: string;
|
|
677
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
677
|
+
state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
|
|
678
678
|
reason: AutoWithdrawStepReason | null;
|
|
679
679
|
}[];
|
|
680
680
|
createdAt: number;
|
|
@@ -692,7 +692,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
692
692
|
seconds: bigint;
|
|
693
693
|
nanos: number;
|
|
694
694
|
}, number>]>;
|
|
695
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "
|
|
695
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "planned" | "paying" | "completed" | "partially_failed" | "skipped">]>;
|
|
696
696
|
readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawRunReason | null>]>;
|
|
697
697
|
readonly steps: v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
698
698
|
readonly assetId: v.NumberSchema<undefined>;
|
|
@@ -714,7 +714,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
714
714
|
readonly hi: v.BigintSchema<undefined>;
|
|
715
715
|
readonly lo: v.BigintSchema<undefined>;
|
|
716
716
|
}, undefined>, undefined>;
|
|
717
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "
|
|
717
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted">]>;
|
|
718
718
|
readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
|
|
719
719
|
readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
720
720
|
readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
@@ -738,7 +738,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
738
738
|
hi: bigint;
|
|
739
739
|
lo: bigint;
|
|
740
740
|
} | undefined;
|
|
741
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
741
|
+
state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
|
|
742
742
|
reason: AutoWithdrawStepReason | null;
|
|
743
743
|
intentId: string;
|
|
744
744
|
txHash: string;
|
|
@@ -752,7 +752,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
752
752
|
txHash: string | null;
|
|
753
753
|
assetId: number;
|
|
754
754
|
destinationAddress: string;
|
|
755
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
755
|
+
state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
|
|
756
756
|
reason: AutoWithdrawStepReason | null;
|
|
757
757
|
}>]>, undefined>;
|
|
758
758
|
readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -773,7 +773,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
773
773
|
runSeq: string;
|
|
774
774
|
ruleVersion: number;
|
|
775
775
|
scheduledFor: number;
|
|
776
|
-
state: "unspecified" | "failed" | "
|
|
776
|
+
state: "unspecified" | "failed" | "planned" | "paying" | "completed" | "partially_failed" | "skipped";
|
|
777
777
|
reason: AutoWithdrawRunReason | null;
|
|
778
778
|
steps: {
|
|
779
779
|
destinationChainId: number;
|
|
@@ -785,7 +785,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
785
785
|
txHash: string | null;
|
|
786
786
|
assetId: number;
|
|
787
787
|
destinationAddress: string;
|
|
788
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
788
|
+
state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
|
|
789
789
|
reason: AutoWithdrawStepReason | null;
|
|
790
790
|
}[];
|
|
791
791
|
createdAt: number;
|
|
@@ -795,7 +795,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
795
795
|
runSeq: string;
|
|
796
796
|
ruleVersion: number;
|
|
797
797
|
scheduledFor: number;
|
|
798
|
-
state: "unspecified" | "failed" | "
|
|
798
|
+
state: "unspecified" | "failed" | "planned" | "paying" | "completed" | "partially_failed" | "skipped";
|
|
799
799
|
reason: AutoWithdrawRunReason | null;
|
|
800
800
|
steps: {
|
|
801
801
|
destinationChainId: number;
|
|
@@ -807,7 +807,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
807
807
|
txHash: string | null;
|
|
808
808
|
assetId: number;
|
|
809
809
|
destinationAddress: string;
|
|
810
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
810
|
+
state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
|
|
811
811
|
reason: AutoWithdrawStepReason | null;
|
|
812
812
|
}[];
|
|
813
813
|
createdAt: number;
|
|
@@ -923,7 +923,7 @@ declare const AutoWithdrawPreviewAssetSchema: v.SchemaWithPipe<readonly [v.Objec
|
|
|
923
923
|
*/
|
|
924
924
|
type AutoWithdrawPreviewAsset = v.InferOutput<typeof AutoWithdrawPreviewAssetSchema>;
|
|
925
925
|
declare const AutoWithdrawPreviewSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
926
|
-
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
926
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "will_pay" | "rolls_over" | "no_destination" | "paused" | "no_rule">]>;
|
|
927
927
|
readonly nextRunAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
928
928
|
readonly seconds: v.BigintSchema<undefined>;
|
|
929
929
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -1052,7 +1052,7 @@ declare const AutoWithdrawPreviewSchema: v.SchemaWithPipe<readonly [v.ObjectSche
|
|
|
1052
1052
|
nanos: number;
|
|
1053
1053
|
}, number>]>;
|
|
1054
1054
|
}, undefined>, v.TransformAction<{
|
|
1055
|
-
status: "unspecified" | "
|
|
1055
|
+
status: "unspecified" | "will_pay" | "rolls_over" | "no_destination" | "paused" | "no_rule";
|
|
1056
1056
|
nextRunAt?: number | undefined;
|
|
1057
1057
|
ruleVersion: number;
|
|
1058
1058
|
pause?: {
|
|
@@ -1088,7 +1088,7 @@ declare const AutoWithdrawPreviewSchema: v.SchemaWithPipe<readonly [v.ObjectSche
|
|
|
1088
1088
|
pausedAt: number;
|
|
1089
1089
|
} | null;
|
|
1090
1090
|
minUsdValue: string | null;
|
|
1091
|
-
status: "unspecified" | "
|
|
1091
|
+
status: "unspecified" | "will_pay" | "rolls_over" | "no_destination" | "paused" | "no_rule";
|
|
1092
1092
|
ruleVersion: number;
|
|
1093
1093
|
assets: {
|
|
1094
1094
|
assetId: number;
|
|
@@ -4,7 +4,7 @@ declare const CHANGELOG_CHANGE_CATEGORY_VALUES: readonly ["breaking_change", "ne
|
|
|
4
4
|
type ChangelogChangeCategory = (typeof CHANGELOG_CHANGE_CATEGORY_VALUES)[number];
|
|
5
5
|
declare const CHANGELOG_AUDIENCE_VALUES: readonly ["all_users", "traders", "market_makers", "developers"];
|
|
6
6
|
type ChangelogAudience = (typeof CHANGELOG_AUDIENCE_VALUES)[number];
|
|
7
|
-
declare const CHANGELOG_SURFACE_VALUES: readonly ["trading", "funding", "accounts", "api", "explorer", "documentation", "platform", "market_data", "quickswap", "rewards"];
|
|
7
|
+
declare const CHANGELOG_SURFACE_VALUES: readonly ["trading", "funding", "accounts", "api", "explorer", "documentation", "platform", "market_data", "quickswap", "rewards", "assistant"];
|
|
8
8
|
type ChangelogSurface = (typeof CHANGELOG_SURFACE_VALUES)[number];
|
|
9
9
|
declare const CHANGELOG_SORT_VALUES: readonly ["asc", "desc"];
|
|
10
10
|
type ChangelogSort = (typeof CHANGELOG_SORT_VALUES)[number];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changelog.codecs.d.ts","names":[],"sources":["../../../src/services/changelog/changelog.codecs.ts"],"mappings":";;cAGa;KAMD,kCAAkC;cAEjC;KAMD,4BAA4B;cAE3B;
|
|
1
|
+
{"version":3,"file":"changelog.codecs.d.ts","names":[],"sources":["../../../src/services/changelog/changelog.codecs.ts"],"mappings":";;cAGa;KAMD,kCAAkC;cAEjC;KAMD,4BAA4B;cAE3B;KAaD,2BAA2B;cAE1B;KACD,wBAAwB"}
|
|
@@ -22,7 +22,8 @@ const CHANGELOG_SURFACE_VALUES = [
|
|
|
22
22
|
"platform",
|
|
23
23
|
"market_data",
|
|
24
24
|
"quickswap",
|
|
25
|
-
"rewards"
|
|
25
|
+
"rewards",
|
|
26
|
+
"assistant"
|
|
26
27
|
];
|
|
27
28
|
const CHANGELOG_SORT_VALUES = ["asc", "desc"];
|
|
28
29
|
const ChangelogChangeCategoryCodec = {
|
|
@@ -66,7 +67,8 @@ const ChangelogSurfaceCodec = {
|
|
|
66
67
|
platform: 7,
|
|
67
68
|
market_data: 8,
|
|
68
69
|
quickswap: 9,
|
|
69
|
-
rewards: 10
|
|
70
|
+
rewards: 10,
|
|
71
|
+
assistant: 11
|
|
70
72
|
},
|
|
71
73
|
protoToOutput: {
|
|
72
74
|
[0]: "unspecified",
|
|
@@ -79,7 +81,8 @@ const ChangelogSurfaceCodec = {
|
|
|
79
81
|
[7]: "platform",
|
|
80
82
|
[8]: "market_data",
|
|
81
83
|
[9]: "quickswap",
|
|
82
|
-
[10]: "rewards"
|
|
84
|
+
[10]: "rewards",
|
|
85
|
+
[11]: "assistant"
|
|
83
86
|
}
|
|
84
87
|
};
|
|
85
88
|
const ChangelogSortCodec = { inputToProto: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changelog.codecs.js","names":[],"sources":["../../../src/services/changelog/changelog.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/changelog/v1/changelog_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const CHANGELOG_CHANGE_CATEGORY_VALUES = [\n \"breaking_change\",\n \"new_feature\",\n \"improvement\",\n \"bug_fix\",\n] as const;\nexport type ChangelogChangeCategory = (typeof CHANGELOG_CHANGE_CATEGORY_VALUES)[number];\n\nexport const CHANGELOG_AUDIENCE_VALUES = [\n \"all_users\",\n \"traders\",\n \"market_makers\",\n \"developers\",\n] as const;\nexport type ChangelogAudience = (typeof CHANGELOG_AUDIENCE_VALUES)[number];\n\nexport const CHANGELOG_SURFACE_VALUES = [\n \"trading\",\n \"funding\",\n \"accounts\",\n \"api\",\n \"explorer\",\n \"documentation\",\n \"platform\",\n \"market_data\",\n \"quickswap\",\n \"rewards\",\n] as const;\nexport type ChangelogSurface = (typeof CHANGELOG_SURFACE_VALUES)[number];\n\nexport const CHANGELOG_SORT_VALUES = [\"asc\", \"desc\"] as const;\nexport type ChangelogSort = (typeof CHANGELOG_SORT_VALUES)[number];\n\nexport const ChangelogChangeCategoryCodec = {\n inputToProto: {\n breaking_change: Proto.ChangeCategory.BREAKING_CHANGE,\n new_feature: Proto.ChangeCategory.NEW_FEATURE,\n improvement: Proto.ChangeCategory.IMPROVEMENT,\n bug_fix: Proto.ChangeCategory.BUG_FIX,\n } satisfies InputToProto<ChangelogChangeCategory, Proto.ChangeCategory>,\n protoToOutput: {\n [Proto.ChangeCategory.CATEGORY_UNSPECIFIED]: \"unspecified\",\n [Proto.ChangeCategory.BREAKING_CHANGE]: \"breaking_change\",\n [Proto.ChangeCategory.NEW_FEATURE]: \"new_feature\",\n [Proto.ChangeCategory.IMPROVEMENT]: \"improvement\",\n [Proto.ChangeCategory.BUG_FIX]: \"bug_fix\",\n } satisfies ProtoToOutput<Proto.ChangeCategory, ChangelogChangeCategory>,\n} as const;\n\nexport const ChangelogAudienceCodec = {\n inputToProto: {\n all_users: Proto.Audience.ALL_USERS,\n traders: Proto.Audience.TRADERS,\n market_makers: Proto.Audience.MARKET_MAKERS,\n developers: Proto.Audience.DEVELOPERS,\n } satisfies InputToProto<ChangelogAudience, Proto.Audience>,\n protoToOutput: {\n [Proto.Audience.AUDIENCE_UNSPECIFIED]: \"unspecified\",\n [Proto.Audience.ALL_USERS]: \"all_users\",\n [Proto.Audience.TRADERS]: \"traders\",\n [Proto.Audience.MARKET_MAKERS]: \"market_makers\",\n [Proto.Audience.DEVELOPERS]: \"developers\",\n } satisfies ProtoToOutput<Proto.Audience, ChangelogAudience>,\n} as const;\n\nexport const ChangelogSurfaceCodec = {\n inputToProto: {\n trading: Proto.Surface.TRADING,\n funding: Proto.Surface.FUNDING,\n accounts: Proto.Surface.ACCOUNTS,\n api: Proto.Surface.API,\n explorer: Proto.Surface.EXPLORER,\n documentation: Proto.Surface.DOCUMENTATION,\n platform: Proto.Surface.PLATFORM,\n market_data: Proto.Surface.MARKET_DATA,\n quickswap: Proto.Surface.QUICKSWAP,\n rewards: Proto.Surface.REWARDS,\n } satisfies InputToProto<ChangelogSurface, Proto.Surface>,\n protoToOutput: {\n [Proto.Surface.SURFACE_UNSPECIFIED]: \"unspecified\",\n [Proto.Surface.TRADING]: \"trading\",\n [Proto.Surface.FUNDING]: \"funding\",\n [Proto.Surface.ACCOUNTS]: \"accounts\",\n [Proto.Surface.API]: \"api\",\n [Proto.Surface.EXPLORER]: \"explorer\",\n [Proto.Surface.DOCUMENTATION]: \"documentation\",\n [Proto.Surface.PLATFORM]: \"platform\",\n [Proto.Surface.MARKET_DATA]: \"market_data\",\n [Proto.Surface.QUICKSWAP]: \"quickswap\",\n [Proto.Surface.REWARDS]: \"rewards\",\n } satisfies ProtoToOutput<Proto.Surface, ChangelogSurface>,\n} as const;\n\nexport const ChangelogSortCodec = {\n inputToProto: {\n asc: Proto.SortDirection.SORT_ASC,\n desc: Proto.SortDirection.SORT_DESC,\n } satisfies InputToProto<ChangelogSort, Proto.SortDirection>,\n} as const;\n"],"mappings":";;AAGA,MAAa,mCAAmC;CAC5C;CACA;CACA;CACA;AACJ;AAGA,MAAa,4BAA4B;CACrC;CACA;CACA;CACA;AACJ;AAGA,MAAa,2BAA2B;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAGA,MAAa,wBAAwB,CAAC,OAAO,MAAM;AAGnD,MAAa,+BAA+B;CACxC,cAAc;EACV,iBAAA;EACA,aAAA;EACA,aAAA;EACA,SAAA;CACJ;CACA,eAAe;GACkC,IAAA;GACL,IAAA;GACJ,IAAA;GACA,IAAA;GACJ,IAAA;CACpC;AACJ;AAEA,MAAa,yBAAyB;CAClC,cAAc;EACV,WAAA;EACA,SAAA;EACA,eAAA;EACA,YAAA;CACJ;CACA,eAAe;GAC4B,IAAA;GACX,IAAA;GACF,IAAA;GACM,IAAA;GACH,IAAA;CACjC;AACJ;AAEA,MAAa,wBAAwB;CACjC,cAAc;EACV,SAAA;EACA,SAAA;EACA,UAAA;EACA,KAAA;EACA,UAAA;EACA,eAAA;EACA,UAAA;EACA,aAAA;EACA,WAAA;EACA,SAAA;CACJ;CACA,eAAe;GAC0B,IAAA;GACZ,IAAA;GACA,IAAA;GACC,IAAA;GACL,IAAA;GACK,IAAA;GACK,IAAA;GACL,IAAA;GACG,IAAA;GACF,IAAA;GACF,KAAA;
|
|
1
|
+
{"version":3,"file":"changelog.codecs.js","names":[],"sources":["../../../src/services/changelog/changelog.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/changelog/v1/changelog_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const CHANGELOG_CHANGE_CATEGORY_VALUES = [\n \"breaking_change\",\n \"new_feature\",\n \"improvement\",\n \"bug_fix\",\n] as const;\nexport type ChangelogChangeCategory = (typeof CHANGELOG_CHANGE_CATEGORY_VALUES)[number];\n\nexport const CHANGELOG_AUDIENCE_VALUES = [\n \"all_users\",\n \"traders\",\n \"market_makers\",\n \"developers\",\n] as const;\nexport type ChangelogAudience = (typeof CHANGELOG_AUDIENCE_VALUES)[number];\n\nexport const CHANGELOG_SURFACE_VALUES = [\n \"trading\",\n \"funding\",\n \"accounts\",\n \"api\",\n \"explorer\",\n \"documentation\",\n \"platform\",\n \"market_data\",\n \"quickswap\",\n \"rewards\",\n \"assistant\",\n] as const;\nexport type ChangelogSurface = (typeof CHANGELOG_SURFACE_VALUES)[number];\n\nexport const CHANGELOG_SORT_VALUES = [\"asc\", \"desc\"] as const;\nexport type ChangelogSort = (typeof CHANGELOG_SORT_VALUES)[number];\n\nexport const ChangelogChangeCategoryCodec = {\n inputToProto: {\n breaking_change: Proto.ChangeCategory.BREAKING_CHANGE,\n new_feature: Proto.ChangeCategory.NEW_FEATURE,\n improvement: Proto.ChangeCategory.IMPROVEMENT,\n bug_fix: Proto.ChangeCategory.BUG_FIX,\n } satisfies InputToProto<ChangelogChangeCategory, Proto.ChangeCategory>,\n protoToOutput: {\n [Proto.ChangeCategory.CATEGORY_UNSPECIFIED]: \"unspecified\",\n [Proto.ChangeCategory.BREAKING_CHANGE]: \"breaking_change\",\n [Proto.ChangeCategory.NEW_FEATURE]: \"new_feature\",\n [Proto.ChangeCategory.IMPROVEMENT]: \"improvement\",\n [Proto.ChangeCategory.BUG_FIX]: \"bug_fix\",\n } satisfies ProtoToOutput<Proto.ChangeCategory, ChangelogChangeCategory>,\n} as const;\n\nexport const ChangelogAudienceCodec = {\n inputToProto: {\n all_users: Proto.Audience.ALL_USERS,\n traders: Proto.Audience.TRADERS,\n market_makers: Proto.Audience.MARKET_MAKERS,\n developers: Proto.Audience.DEVELOPERS,\n } satisfies InputToProto<ChangelogAudience, Proto.Audience>,\n protoToOutput: {\n [Proto.Audience.AUDIENCE_UNSPECIFIED]: \"unspecified\",\n [Proto.Audience.ALL_USERS]: \"all_users\",\n [Proto.Audience.TRADERS]: \"traders\",\n [Proto.Audience.MARKET_MAKERS]: \"market_makers\",\n [Proto.Audience.DEVELOPERS]: \"developers\",\n } satisfies ProtoToOutput<Proto.Audience, ChangelogAudience>,\n} as const;\n\nexport const ChangelogSurfaceCodec = {\n inputToProto: {\n trading: Proto.Surface.TRADING,\n funding: Proto.Surface.FUNDING,\n accounts: Proto.Surface.ACCOUNTS,\n api: Proto.Surface.API,\n explorer: Proto.Surface.EXPLORER,\n documentation: Proto.Surface.DOCUMENTATION,\n platform: Proto.Surface.PLATFORM,\n market_data: Proto.Surface.MARKET_DATA,\n quickswap: Proto.Surface.QUICKSWAP,\n rewards: Proto.Surface.REWARDS,\n assistant: Proto.Surface.ASSISTANT,\n } satisfies InputToProto<ChangelogSurface, Proto.Surface>,\n protoToOutput: {\n [Proto.Surface.SURFACE_UNSPECIFIED]: \"unspecified\",\n [Proto.Surface.TRADING]: \"trading\",\n [Proto.Surface.FUNDING]: \"funding\",\n [Proto.Surface.ACCOUNTS]: \"accounts\",\n [Proto.Surface.API]: \"api\",\n [Proto.Surface.EXPLORER]: \"explorer\",\n [Proto.Surface.DOCUMENTATION]: \"documentation\",\n [Proto.Surface.PLATFORM]: \"platform\",\n [Proto.Surface.MARKET_DATA]: \"market_data\",\n [Proto.Surface.QUICKSWAP]: \"quickswap\",\n [Proto.Surface.REWARDS]: \"rewards\",\n [Proto.Surface.ASSISTANT]: \"assistant\",\n } satisfies ProtoToOutput<Proto.Surface, ChangelogSurface>,\n} as const;\n\nexport const ChangelogSortCodec = {\n inputToProto: {\n asc: Proto.SortDirection.SORT_ASC,\n desc: Proto.SortDirection.SORT_DESC,\n } satisfies InputToProto<ChangelogSort, Proto.SortDirection>,\n} as const;\n"],"mappings":";;AAGA,MAAa,mCAAmC;CAC5C;CACA;CACA;CACA;AACJ;AAGA,MAAa,4BAA4B;CACrC;CACA;CACA;CACA;AACJ;AAGA,MAAa,2BAA2B;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAGA,MAAa,wBAAwB,CAAC,OAAO,MAAM;AAGnD,MAAa,+BAA+B;CACxC,cAAc;EACV,iBAAA;EACA,aAAA;EACA,aAAA;EACA,SAAA;CACJ;CACA,eAAe;GACkC,IAAA;GACL,IAAA;GACJ,IAAA;GACA,IAAA;GACJ,IAAA;CACpC;AACJ;AAEA,MAAa,yBAAyB;CAClC,cAAc;EACV,WAAA;EACA,SAAA;EACA,eAAA;EACA,YAAA;CACJ;CACA,eAAe;GAC4B,IAAA;GACX,IAAA;GACF,IAAA;GACM,IAAA;GACH,IAAA;CACjC;AACJ;AAEA,MAAa,wBAAwB;CACjC,cAAc;EACV,SAAA;EACA,SAAA;EACA,UAAA;EACA,KAAA;EACA,UAAA;EACA,eAAA;EACA,UAAA;EACA,aAAA;EACA,WAAA;EACA,SAAA;EACA,WAAA;CACJ;CACA,eAAe;GAC0B,IAAA;GACZ,IAAA;GACA,IAAA;GACC,IAAA;GACL,IAAA;GACK,IAAA;GACK,IAAA;GACL,IAAA;GACG,IAAA;GACF,IAAA;GACF,KAAA;GACE,KAAA;CAC/B;AACJ;AAEA,MAAa,qBAAqB,EAC9B,cAAc;CACV,KAAA;CACA,MAAA;AACJ,EACJ"}
|