@alva-ai/toolkit 0.26.0 → 0.27.0

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/dist/index.d.cts CHANGED
@@ -1681,8 +1681,8 @@ declare class NotificationsResource {
1681
1681
  constructor(client: AlvaClient);
1682
1682
  /**
1683
1683
  * List the caller's notification history for one feed
1684
- * `(username, name)`. Authorization is alfs read on
1685
- * `/alva/home/<username>/feeds/<name>`.
1684
+ * `(username, name)`. Authorization uses the backend's canonical Feed read
1685
+ * decision (owner, public, bundled paid access, Plan, or Access Group).
1686
1686
  */
1687
1687
  listFeed(params: NotificationListParams): Promise<FeedNotificationListResponse>;
1688
1688
  }
@@ -2106,6 +2106,43 @@ declare class SchedulesResource {
2106
2106
  private graphql;
2107
2107
  }
2108
2108
 
2109
+ interface TradingPairCandidate {
2110
+ /** Underlying ticker returned by the market catalog. */
2111
+ symbol: string;
2112
+ /** Complete canonical identity used by OHLCV, Altra, and orders. */
2113
+ tradingPair: string;
2114
+ market: string;
2115
+ instrumentType: string;
2116
+ underlyingType?: string;
2117
+ quote: string;
2118
+ type?: string;
2119
+ description?: string;
2120
+ feeRate?: number;
2121
+ symbolIconUrl?: string;
2122
+ }
2123
+ interface TradingPairSearchParams {
2124
+ symbol: string;
2125
+ market?: string;
2126
+ instrumentType?: string;
2127
+ underlyingType?: string;
2128
+ quote?: string;
2129
+ limit?: number;
2130
+ }
2131
+ interface TradingPairSearchResponse {
2132
+ query: string;
2133
+ candidates: TradingPairCandidate[];
2134
+ truncated?: boolean;
2135
+ }
2136
+ type TradingPairResolveFilters = Omit<TradingPairSearchParams, 'symbol' | 'limit'>;
2137
+ declare class TradingPairsResource {
2138
+ private client;
2139
+ constructor(client: AlvaClient);
2140
+ search(params: TradingPairSearchParams): Promise<TradingPairSearchResponse>;
2141
+ resolve(params: ({
2142
+ pair: string;
2143
+ } & TradingPairResolveFilters) | Omit<TradingPairSearchParams, 'limit'>): Promise<TradingPairCandidate>;
2144
+ }
2145
+
2109
2146
  interface RequestOptions {
2110
2147
  query?: Record<string, unknown>;
2111
2148
  body?: unknown;
@@ -2172,6 +2209,7 @@ declare class AlvaClient {
2172
2209
  private _credits?;
2173
2210
  private _markets?;
2174
2211
  private _schedules?;
2212
+ private _tradingPairs?;
2175
2213
  constructor(config: AlvaClientConfig);
2176
2214
  get fs(): FsResource;
2177
2215
  get run(): RunResource;
@@ -2201,6 +2239,7 @@ declare class AlvaClient {
2201
2239
  get functions(): FunctionsResource;
2202
2240
  get credits(): CreditsResource;
2203
2241
  get markets(): MarketsResource;
2242
+ get tradingPairs(): TradingPairsResource;
2204
2243
  get schedules(): SchedulesResource;
2205
2244
  _requireAuth(): void;
2206
2245
  _request(method: string, path: string, options?: RequestOptions): Promise<unknown>;
@@ -2356,4 +2395,4 @@ declare const installPlaybookRuntime: (targetWindow?: Window) => void;
2356
2395
  /** SDK version, injected at build time from package.json. */
2357
2396
  declare const VERSION: string;
2358
2397
 
2359
- export { type AgentSchedule, type AgentScheduleBounds, type AgentScheduleFailureCode, type AgentScheduleRule, type AgentScheduleStatus, AlertsResource, AlvaClient, type AlvaClientConfig, AlvaError, type AutomationAlertDelivery, type AutomationAlertDeliveryGetRequest, AutomationAlertDeliveryResource, type AutomationAlertDeliveryUpdateRequest, type AutomationAlertDeliveryUpdateResponse, type AutomationEmailDelivery, AutomationResource, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupHistoryParams, type ChannelGroupHistoryResponse, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, CliUsageError, type CompanyEarningsCatalog, type CompanyEarningsContentStatus, type CompanyEarningsContext, type CompanyEarningsEvent, type CompanyEarningsParams, type CompanyEarningsPeriod, type CompanyEarningsRelease, type CompanyEarningsSession, type CompanyEarningsStatus, type CompanyEarningsTranscript, type CompanyEarningsTranscriptEntry, type CompanyEarningsTranscriptSection, type CompanyFiscalQuarter, type CompanyNarrative, type CompanyNarrativeChangeLogEntry, type CompanyNarrativeContext, type CompanyNarrativeHistory, type CompanyNarrativeSnapshot, type CompanyPostEarningsSummary, type CompanyPreEarningsAnalysis, type CreateAllowanceParams, type CreateAllowanceResponse, type CreditAllowance, type CreditWallet, type CreditWalletItem, type CreditWalletItemConnection, type CreditWalletItemEdge, type CreditWalletItemsParams, type CreditWalletItemsResponse, type CreditWalletPageInfo, type DeleteFunctionParams, type FeedDeleteRequest, type FeedDeleteResponse, type FeedListItem, type FeedListParams, type FeedListResponse, type FeedListStatus, type FeedStatusUpdateRequest, type FeedStatusUpdateResponse, type FollowPlaybookResponse, type FsChmodParams, type FsCopyParams, type FsEntry, type FsGrantParams, type FsMkdirParams, type FsRawWriteParams, type FsReadParams, type FsReaddirParams, type FsReaddirResponse, type FsReadlinkParams, type FsRemoveParams, type FsRenameParams, type FsRevokeParams, type FsStat, type FsSymlinkParams, type FsWriteParams, type FsWriteResponse, type GetAllowanceParams, type GroupChatMessage, type InvokeFunctionParams, type InvokeFunctionResponse, type ListAllowancesResponse, type ListFunctionsParams, type ListFunctionsResponse, type ManageAgentScheduleParams, MarketsResource, type NotificationPreference, type NotificationPreferenceKey, type NotificationPreferenceUpdateParams, type NotificationPreferenceUpdateResponse, type NotificationPreferencesResponse, PBSV_UPDATE_MESSAGE, type PlaybookFollowParams, type PlaybookFunction, type PlaybookSkillFile, type PlaybookSkillFileMeta, type PlaybookSkillMeta, type PlaybookSkillSummary, type PlaybookSkillTagEntry, type PutAgentScheduleParams, type RegisterFunctionParams, type RegisterFunctionResponse, type RevokeAllowanceParams, type RevokeAllowanceResponse, SUBSCRIBE_MANAGE_MESSAGE, SUBSCRIBE_PROPOSE_MESSAGE, SUBSCRIBE_RESULT_MESSAGE, SchedulesResource, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, type SubmitFeedbackRequest, type SubmitFeedbackResponse, type SubscribeApi, type SubscribeBatchParams, type SubscribeBatchResponse, type SubscribeProposalInput, type SubscribeProposalResult, type TrendingPlaybookItem, type TrendingPlaybooksDir, type TrendingPlaybooksParams, type TrendingPlaybooksResponse, type TrendingPlaybooksSort, UDF_AUTH_REQUIRED_MESSAGE, UDF_CONSENT_REQUEST_MESSAGE, UDF_CONSENT_RESPONSE_MESSAGE, type UdfApi, UdfAuthRequiredError, type UdfButtonEventDetail, type UdfButtonOptions, UdfConsentDeniedError, UdfConsentRequiredError, UdfConsentTimeoutError, type UdfDescriptor, UdfError, UdfExecutionError, UdfFunctionDisabledError, UdfFunctionNotFoundError, UdfInsufficientCredits, type UdfInvokeResponse, UdfPidMismatchError, UdfRateLimitedError, UdfTokenExpiredError, UdfTokenInvalidError, UdfTransportError, type UnfollowPlaybookResponse, type UnsubscribeBatchParams, type UnsubscribeBatchResponse, VERSION, getViewerToken, installPlaybookRuntime, mapUdfErrorResponse, playbookIdFromToken, subscribe, udf };
2398
+ export { type AgentSchedule, type AgentScheduleBounds, type AgentScheduleFailureCode, type AgentScheduleRule, type AgentScheduleStatus, AlertsResource, AlvaClient, type AlvaClientConfig, AlvaError, type AutomationAlertDelivery, type AutomationAlertDeliveryGetRequest, AutomationAlertDeliveryResource, type AutomationAlertDeliveryUpdateRequest, type AutomationAlertDeliveryUpdateResponse, type AutomationEmailDelivery, AutomationResource, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupHistoryParams, type ChannelGroupHistoryResponse, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, CliUsageError, type CompanyEarningsCatalog, type CompanyEarningsContentStatus, type CompanyEarningsContext, type CompanyEarningsEvent, type CompanyEarningsParams, type CompanyEarningsPeriod, type CompanyEarningsRelease, type CompanyEarningsSession, type CompanyEarningsStatus, type CompanyEarningsTranscript, type CompanyEarningsTranscriptEntry, type CompanyEarningsTranscriptSection, type CompanyFiscalQuarter, type CompanyNarrative, type CompanyNarrativeChangeLogEntry, type CompanyNarrativeContext, type CompanyNarrativeHistory, type CompanyNarrativeSnapshot, type CompanyPostEarningsSummary, type CompanyPreEarningsAnalysis, type CreateAllowanceParams, type CreateAllowanceResponse, type CreditAllowance, type CreditWallet, type CreditWalletItem, type CreditWalletItemConnection, type CreditWalletItemEdge, type CreditWalletItemsParams, type CreditWalletItemsResponse, type CreditWalletPageInfo, type DeleteFunctionParams, type FeedDeleteRequest, type FeedDeleteResponse, type FeedListItem, type FeedListParams, type FeedListResponse, type FeedListStatus, type FeedStatusUpdateRequest, type FeedStatusUpdateResponse, type FollowPlaybookResponse, type FsChmodParams, type FsCopyParams, type FsEntry, type FsGrantParams, type FsMkdirParams, type FsRawWriteParams, type FsReadParams, type FsReaddirParams, type FsReaddirResponse, type FsReadlinkParams, type FsRemoveParams, type FsRenameParams, type FsRevokeParams, type FsStat, type FsSymlinkParams, type FsWriteParams, type FsWriteResponse, type GetAllowanceParams, type GroupChatMessage, type InvokeFunctionParams, type InvokeFunctionResponse, type ListAllowancesResponse, type ListFunctionsParams, type ListFunctionsResponse, type ManageAgentScheduleParams, MarketsResource, type NotificationPreference, type NotificationPreferenceKey, type NotificationPreferenceUpdateParams, type NotificationPreferenceUpdateResponse, type NotificationPreferencesResponse, PBSV_UPDATE_MESSAGE, type PlaybookFollowParams, type PlaybookFunction, type PlaybookSkillFile, type PlaybookSkillFileMeta, type PlaybookSkillMeta, type PlaybookSkillSummary, type PlaybookSkillTagEntry, type PutAgentScheduleParams, type RegisterFunctionParams, type RegisterFunctionResponse, type RevokeAllowanceParams, type RevokeAllowanceResponse, SUBSCRIBE_MANAGE_MESSAGE, SUBSCRIBE_PROPOSE_MESSAGE, SUBSCRIBE_RESULT_MESSAGE, SchedulesResource, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, type SubmitFeedbackRequest, type SubmitFeedbackResponse, type SubscribeApi, type SubscribeBatchParams, type SubscribeBatchResponse, type SubscribeProposalInput, type SubscribeProposalResult, type TradingPairCandidate, type TradingPairSearchParams, type TradingPairSearchResponse, TradingPairsResource, type TrendingPlaybookItem, type TrendingPlaybooksDir, type TrendingPlaybooksParams, type TrendingPlaybooksResponse, type TrendingPlaybooksSort, UDF_AUTH_REQUIRED_MESSAGE, UDF_CONSENT_REQUEST_MESSAGE, UDF_CONSENT_RESPONSE_MESSAGE, type UdfApi, UdfAuthRequiredError, type UdfButtonEventDetail, type UdfButtonOptions, UdfConsentDeniedError, UdfConsentRequiredError, UdfConsentTimeoutError, type UdfDescriptor, UdfError, UdfExecutionError, UdfFunctionDisabledError, UdfFunctionNotFoundError, UdfInsufficientCredits, type UdfInvokeResponse, UdfPidMismatchError, UdfRateLimitedError, UdfTokenExpiredError, UdfTokenInvalidError, UdfTransportError, type UnfollowPlaybookResponse, type UnsubscribeBatchParams, type UnsubscribeBatchResponse, VERSION, getViewerToken, installPlaybookRuntime, mapUdfErrorResponse, playbookIdFromToken, subscribe, udf };
package/dist/index.d.ts CHANGED
@@ -1681,8 +1681,8 @@ declare class NotificationsResource {
1681
1681
  constructor(client: AlvaClient);
1682
1682
  /**
1683
1683
  * List the caller's notification history for one feed
1684
- * `(username, name)`. Authorization is alfs read on
1685
- * `/alva/home/<username>/feeds/<name>`.
1684
+ * `(username, name)`. Authorization uses the backend's canonical Feed read
1685
+ * decision (owner, public, bundled paid access, Plan, or Access Group).
1686
1686
  */
1687
1687
  listFeed(params: NotificationListParams): Promise<FeedNotificationListResponse>;
1688
1688
  }
@@ -2106,6 +2106,43 @@ declare class SchedulesResource {
2106
2106
  private graphql;
2107
2107
  }
2108
2108
 
2109
+ interface TradingPairCandidate {
2110
+ /** Underlying ticker returned by the market catalog. */
2111
+ symbol: string;
2112
+ /** Complete canonical identity used by OHLCV, Altra, and orders. */
2113
+ tradingPair: string;
2114
+ market: string;
2115
+ instrumentType: string;
2116
+ underlyingType?: string;
2117
+ quote: string;
2118
+ type?: string;
2119
+ description?: string;
2120
+ feeRate?: number;
2121
+ symbolIconUrl?: string;
2122
+ }
2123
+ interface TradingPairSearchParams {
2124
+ symbol: string;
2125
+ market?: string;
2126
+ instrumentType?: string;
2127
+ underlyingType?: string;
2128
+ quote?: string;
2129
+ limit?: number;
2130
+ }
2131
+ interface TradingPairSearchResponse {
2132
+ query: string;
2133
+ candidates: TradingPairCandidate[];
2134
+ truncated?: boolean;
2135
+ }
2136
+ type TradingPairResolveFilters = Omit<TradingPairSearchParams, 'symbol' | 'limit'>;
2137
+ declare class TradingPairsResource {
2138
+ private client;
2139
+ constructor(client: AlvaClient);
2140
+ search(params: TradingPairSearchParams): Promise<TradingPairSearchResponse>;
2141
+ resolve(params: ({
2142
+ pair: string;
2143
+ } & TradingPairResolveFilters) | Omit<TradingPairSearchParams, 'limit'>): Promise<TradingPairCandidate>;
2144
+ }
2145
+
2109
2146
  interface RequestOptions {
2110
2147
  query?: Record<string, unknown>;
2111
2148
  body?: unknown;
@@ -2172,6 +2209,7 @@ declare class AlvaClient {
2172
2209
  private _credits?;
2173
2210
  private _markets?;
2174
2211
  private _schedules?;
2212
+ private _tradingPairs?;
2175
2213
  constructor(config: AlvaClientConfig);
2176
2214
  get fs(): FsResource;
2177
2215
  get run(): RunResource;
@@ -2201,6 +2239,7 @@ declare class AlvaClient {
2201
2239
  get functions(): FunctionsResource;
2202
2240
  get credits(): CreditsResource;
2203
2241
  get markets(): MarketsResource;
2242
+ get tradingPairs(): TradingPairsResource;
2204
2243
  get schedules(): SchedulesResource;
2205
2244
  _requireAuth(): void;
2206
2245
  _request(method: string, path: string, options?: RequestOptions): Promise<unknown>;
@@ -2356,4 +2395,4 @@ declare const installPlaybookRuntime: (targetWindow?: Window) => void;
2356
2395
  /** SDK version, injected at build time from package.json. */
2357
2396
  declare const VERSION: string;
2358
2397
 
2359
- export { type AgentSchedule, type AgentScheduleBounds, type AgentScheduleFailureCode, type AgentScheduleRule, type AgentScheduleStatus, AlertsResource, AlvaClient, type AlvaClientConfig, AlvaError, type AutomationAlertDelivery, type AutomationAlertDeliveryGetRequest, AutomationAlertDeliveryResource, type AutomationAlertDeliveryUpdateRequest, type AutomationAlertDeliveryUpdateResponse, type AutomationEmailDelivery, AutomationResource, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupHistoryParams, type ChannelGroupHistoryResponse, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, CliUsageError, type CompanyEarningsCatalog, type CompanyEarningsContentStatus, type CompanyEarningsContext, type CompanyEarningsEvent, type CompanyEarningsParams, type CompanyEarningsPeriod, type CompanyEarningsRelease, type CompanyEarningsSession, type CompanyEarningsStatus, type CompanyEarningsTranscript, type CompanyEarningsTranscriptEntry, type CompanyEarningsTranscriptSection, type CompanyFiscalQuarter, type CompanyNarrative, type CompanyNarrativeChangeLogEntry, type CompanyNarrativeContext, type CompanyNarrativeHistory, type CompanyNarrativeSnapshot, type CompanyPostEarningsSummary, type CompanyPreEarningsAnalysis, type CreateAllowanceParams, type CreateAllowanceResponse, type CreditAllowance, type CreditWallet, type CreditWalletItem, type CreditWalletItemConnection, type CreditWalletItemEdge, type CreditWalletItemsParams, type CreditWalletItemsResponse, type CreditWalletPageInfo, type DeleteFunctionParams, type FeedDeleteRequest, type FeedDeleteResponse, type FeedListItem, type FeedListParams, type FeedListResponse, type FeedListStatus, type FeedStatusUpdateRequest, type FeedStatusUpdateResponse, type FollowPlaybookResponse, type FsChmodParams, type FsCopyParams, type FsEntry, type FsGrantParams, type FsMkdirParams, type FsRawWriteParams, type FsReadParams, type FsReaddirParams, type FsReaddirResponse, type FsReadlinkParams, type FsRemoveParams, type FsRenameParams, type FsRevokeParams, type FsStat, type FsSymlinkParams, type FsWriteParams, type FsWriteResponse, type GetAllowanceParams, type GroupChatMessage, type InvokeFunctionParams, type InvokeFunctionResponse, type ListAllowancesResponse, type ListFunctionsParams, type ListFunctionsResponse, type ManageAgentScheduleParams, MarketsResource, type NotificationPreference, type NotificationPreferenceKey, type NotificationPreferenceUpdateParams, type NotificationPreferenceUpdateResponse, type NotificationPreferencesResponse, PBSV_UPDATE_MESSAGE, type PlaybookFollowParams, type PlaybookFunction, type PlaybookSkillFile, type PlaybookSkillFileMeta, type PlaybookSkillMeta, type PlaybookSkillSummary, type PlaybookSkillTagEntry, type PutAgentScheduleParams, type RegisterFunctionParams, type RegisterFunctionResponse, type RevokeAllowanceParams, type RevokeAllowanceResponse, SUBSCRIBE_MANAGE_MESSAGE, SUBSCRIBE_PROPOSE_MESSAGE, SUBSCRIBE_RESULT_MESSAGE, SchedulesResource, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, type SubmitFeedbackRequest, type SubmitFeedbackResponse, type SubscribeApi, type SubscribeBatchParams, type SubscribeBatchResponse, type SubscribeProposalInput, type SubscribeProposalResult, type TrendingPlaybookItem, type TrendingPlaybooksDir, type TrendingPlaybooksParams, type TrendingPlaybooksResponse, type TrendingPlaybooksSort, UDF_AUTH_REQUIRED_MESSAGE, UDF_CONSENT_REQUEST_MESSAGE, UDF_CONSENT_RESPONSE_MESSAGE, type UdfApi, UdfAuthRequiredError, type UdfButtonEventDetail, type UdfButtonOptions, UdfConsentDeniedError, UdfConsentRequiredError, UdfConsentTimeoutError, type UdfDescriptor, UdfError, UdfExecutionError, UdfFunctionDisabledError, UdfFunctionNotFoundError, UdfInsufficientCredits, type UdfInvokeResponse, UdfPidMismatchError, UdfRateLimitedError, UdfTokenExpiredError, UdfTokenInvalidError, UdfTransportError, type UnfollowPlaybookResponse, type UnsubscribeBatchParams, type UnsubscribeBatchResponse, VERSION, getViewerToken, installPlaybookRuntime, mapUdfErrorResponse, playbookIdFromToken, subscribe, udf };
2398
+ export { type AgentSchedule, type AgentScheduleBounds, type AgentScheduleFailureCode, type AgentScheduleRule, type AgentScheduleStatus, AlertsResource, AlvaClient, type AlvaClientConfig, AlvaError, type AutomationAlertDelivery, type AutomationAlertDeliveryGetRequest, AutomationAlertDeliveryResource, type AutomationAlertDeliveryUpdateRequest, type AutomationAlertDeliveryUpdateResponse, type AutomationEmailDelivery, AutomationResource, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupHistoryParams, type ChannelGroupHistoryResponse, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, CliUsageError, type CompanyEarningsCatalog, type CompanyEarningsContentStatus, type CompanyEarningsContext, type CompanyEarningsEvent, type CompanyEarningsParams, type CompanyEarningsPeriod, type CompanyEarningsRelease, type CompanyEarningsSession, type CompanyEarningsStatus, type CompanyEarningsTranscript, type CompanyEarningsTranscriptEntry, type CompanyEarningsTranscriptSection, type CompanyFiscalQuarter, type CompanyNarrative, type CompanyNarrativeChangeLogEntry, type CompanyNarrativeContext, type CompanyNarrativeHistory, type CompanyNarrativeSnapshot, type CompanyPostEarningsSummary, type CompanyPreEarningsAnalysis, type CreateAllowanceParams, type CreateAllowanceResponse, type CreditAllowance, type CreditWallet, type CreditWalletItem, type CreditWalletItemConnection, type CreditWalletItemEdge, type CreditWalletItemsParams, type CreditWalletItemsResponse, type CreditWalletPageInfo, type DeleteFunctionParams, type FeedDeleteRequest, type FeedDeleteResponse, type FeedListItem, type FeedListParams, type FeedListResponse, type FeedListStatus, type FeedStatusUpdateRequest, type FeedStatusUpdateResponse, type FollowPlaybookResponse, type FsChmodParams, type FsCopyParams, type FsEntry, type FsGrantParams, type FsMkdirParams, type FsRawWriteParams, type FsReadParams, type FsReaddirParams, type FsReaddirResponse, type FsReadlinkParams, type FsRemoveParams, type FsRenameParams, type FsRevokeParams, type FsStat, type FsSymlinkParams, type FsWriteParams, type FsWriteResponse, type GetAllowanceParams, type GroupChatMessage, type InvokeFunctionParams, type InvokeFunctionResponse, type ListAllowancesResponse, type ListFunctionsParams, type ListFunctionsResponse, type ManageAgentScheduleParams, MarketsResource, type NotificationPreference, type NotificationPreferenceKey, type NotificationPreferenceUpdateParams, type NotificationPreferenceUpdateResponse, type NotificationPreferencesResponse, PBSV_UPDATE_MESSAGE, type PlaybookFollowParams, type PlaybookFunction, type PlaybookSkillFile, type PlaybookSkillFileMeta, type PlaybookSkillMeta, type PlaybookSkillSummary, type PlaybookSkillTagEntry, type PutAgentScheduleParams, type RegisterFunctionParams, type RegisterFunctionResponse, type RevokeAllowanceParams, type RevokeAllowanceResponse, SUBSCRIBE_MANAGE_MESSAGE, SUBSCRIBE_PROPOSE_MESSAGE, SUBSCRIBE_RESULT_MESSAGE, SchedulesResource, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, type SubmitFeedbackRequest, type SubmitFeedbackResponse, type SubscribeApi, type SubscribeBatchParams, type SubscribeBatchResponse, type SubscribeProposalInput, type SubscribeProposalResult, type TradingPairCandidate, type TradingPairSearchParams, type TradingPairSearchResponse, TradingPairsResource, type TrendingPlaybookItem, type TrendingPlaybooksDir, type TrendingPlaybooksParams, type TrendingPlaybooksResponse, type TrendingPlaybooksSort, UDF_AUTH_REQUIRED_MESSAGE, UDF_CONSENT_REQUEST_MESSAGE, UDF_CONSENT_RESPONSE_MESSAGE, type UdfApi, UdfAuthRequiredError, type UdfButtonEventDetail, type UdfButtonOptions, UdfConsentDeniedError, UdfConsentRequiredError, UdfConsentTimeoutError, type UdfDescriptor, UdfError, UdfExecutionError, UdfFunctionDisabledError, UdfFunctionNotFoundError, UdfInsufficientCredits, type UdfInvokeResponse, UdfPidMismatchError, UdfRateLimitedError, UdfTokenExpiredError, UdfTokenInvalidError, UdfTransportError, type UnfollowPlaybookResponse, type UnsubscribeBatchParams, type UnsubscribeBatchResponse, VERSION, getViewerToken, installPlaybookRuntime, mapUdfErrorResponse, playbookIdFromToken, subscribe, udf };
package/dist/index.js CHANGED
@@ -2225,8 +2225,8 @@ var NotificationsResource = class {
2225
2225
  client;
2226
2226
  /**
2227
2227
  * List the caller's notification history for one feed
2228
- * `(username, name)`. Authorization is alfs read on
2229
- * `/alva/home/<username>/feeds/<name>`.
2228
+ * `(username, name)`. Authorization uses the backend's canonical Feed read
2229
+ * decision (owner, public, bundled paid access, Plan, or Access Group).
2230
2230
  */
2231
2231
  async listFeed(params) {
2232
2232
  this.client._requireAuth();
@@ -3488,14 +3488,199 @@ function scheduleEmptyResponse() {
3488
3488
  );
3489
3489
  }
3490
3490
 
3491
+ // src/resources/tradingPairs.ts
3492
+ function isRecord(value) {
3493
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3494
+ }
3495
+ function stringValue(value) {
3496
+ return typeof value === "string" && value.trim() !== "" ? value : void 0;
3497
+ }
3498
+ function numberValue(value) {
3499
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
3500
+ }
3501
+ function upper(value) {
3502
+ return value === void 0 ? void 0 : value.trim().toUpperCase();
3503
+ }
3504
+ function pairParts(pair) {
3505
+ return pair.split("_");
3506
+ }
3507
+ function inferInstrumentType(rawType, tradingPair) {
3508
+ const type = rawType?.toLowerCase();
3509
+ if (type?.includes("spot")) return "spot";
3510
+ if (type?.includes("perp")) return "perp";
3511
+ if (type?.includes("option")) return "option";
3512
+ return pairParts(tradingPair)[1]?.toLowerCase() ?? "";
3513
+ }
3514
+ function inferUnderlyingType(rawType) {
3515
+ if (rawType === void 0) return void 0;
3516
+ const prefix = rawType.split("-")[0]?.trim().toLowerCase();
3517
+ return prefix && prefix !== rawType.toLowerCase() ? prefix : void 0;
3518
+ }
3519
+ function normalizeCandidate(raw, outerSymbol) {
3520
+ const tradingPair = stringValue(raw.trading_pair) ?? stringValue(raw.tradingPair) ?? stringValue(raw.symbol);
3521
+ if (tradingPair === void 0) return void 0;
3522
+ const type = stringValue(raw.type);
3523
+ const parts = pairParts(tradingPair);
3524
+ const symbol = stringValue(raw.base) ?? outerSymbol ?? (parts.length >= 4 ? parts.slice(2, -1).join("_") : parts.length === 3 ? parts[2] : tradingPair);
3525
+ const market = stringValue(raw.market) ?? stringValue(raw.exchange) ?? parts[0] ?? "";
3526
+ const quote = stringValue(raw.quote) ?? parts[parts.length - 1] ?? "";
3527
+ const instrumentType = stringValue(raw.instrument_type) ?? stringValue(raw.instrumentType) ?? inferInstrumentType(type, tradingPair);
3528
+ const underlyingType = stringValue(raw.underlying_type) ?? stringValue(raw.underlyingType) ?? inferUnderlyingType(type);
3529
+ return {
3530
+ symbol,
3531
+ tradingPair,
3532
+ market,
3533
+ instrumentType,
3534
+ ...underlyingType === void 0 ? {} : { underlyingType },
3535
+ quote,
3536
+ ...type === void 0 ? {} : { type },
3537
+ ...stringValue(raw.description) === void 0 ? {} : { description: stringValue(raw.description) },
3538
+ ...numberValue(raw.fee_rate) === void 0 ? numberValue(raw.feeRate) === void 0 ? {} : { feeRate: numberValue(raw.feeRate) } : { feeRate: numberValue(raw.fee_rate) },
3539
+ ...stringValue(raw.symbol_icon_url) === void 0 ? stringValue(raw.symbolIconUrl) === void 0 ? {} : { symbolIconUrl: stringValue(raw.symbolIconUrl) } : { symbolIconUrl: stringValue(raw.symbol_icon_url) }
3540
+ };
3541
+ }
3542
+ function flattenResponse(value) {
3543
+ if (!isRecord(value)) return [];
3544
+ const flat = value.trading_pairs;
3545
+ if (Array.isArray(flat)) {
3546
+ return flat.flatMap(
3547
+ (item) => isRecord(item) ? [normalizeCandidate(item)].filter(
3548
+ (candidate) => candidate !== void 0
3549
+ ) : []
3550
+ );
3551
+ }
3552
+ const data = value.data;
3553
+ if (!Array.isArray(data)) return [];
3554
+ const candidates = [];
3555
+ for (const symbolGroup of data) {
3556
+ if (!isRecord(symbolGroup)) continue;
3557
+ const symbol = stringValue(symbolGroup.symbol);
3558
+ const groups = symbolGroup.trading_pairs;
3559
+ if (!Array.isArray(groups)) continue;
3560
+ for (const group of groups) {
3561
+ if (!isRecord(group) || !Array.isArray(group.pairs)) continue;
3562
+ for (const pair of group.pairs) {
3563
+ if (!isRecord(pair)) continue;
3564
+ const candidate = normalizeCandidate(
3565
+ {
3566
+ ...pair,
3567
+ instrument_type: pair.instrument_type ?? group.instrument_type
3568
+ },
3569
+ symbol
3570
+ );
3571
+ if (candidate !== void 0) candidates.push(candidate);
3572
+ }
3573
+ }
3574
+ }
3575
+ return candidates;
3576
+ }
3577
+ function matchesQuery(candidate, query) {
3578
+ const expected = query.trim();
3579
+ if (candidate.tradingPair === expected) return true;
3580
+ return upper(candidate.symbol) === upper(expected);
3581
+ }
3582
+ function matchesFilter(value, expected) {
3583
+ return expected === void 0 || upper(value) === upper(expected);
3584
+ }
3585
+ function dedupe(candidates) {
3586
+ const seen = /* @__PURE__ */ new Set();
3587
+ return candidates.filter((candidate) => {
3588
+ if (seen.has(candidate.tradingPair)) return false;
3589
+ seen.add(candidate.tradingPair);
3590
+ return true;
3591
+ });
3592
+ }
3593
+ function resolveFilters(params) {
3594
+ const record = isRecord(params) ? params : {};
3595
+ return {
3596
+ market: typeof record.market === "string" ? record.market : void 0,
3597
+ instrumentType: typeof record.instrumentType === "string" ? record.instrumentType : void 0,
3598
+ underlyingType: typeof record.underlyingType === "string" ? record.underlyingType : void 0,
3599
+ quote: typeof record.quote === "string" ? record.quote : void 0
3600
+ };
3601
+ }
3602
+ function pairSearchParams(pair, params) {
3603
+ const parts = pair.split("_");
3604
+ const market = parts[0];
3605
+ const instrumentType = parts[1];
3606
+ const symbol = parts.length >= 4 ? parts.slice(2, -1).join("_") : parts.length === 3 ? parts[2] : void 0;
3607
+ const quote = parts.at(-1);
3608
+ if (!market || !instrumentType || !symbol || !quote) {
3609
+ return { symbol: pair, ...params };
3610
+ }
3611
+ return {
3612
+ symbol,
3613
+ market: params.market ?? market,
3614
+ instrumentType: params.instrumentType ?? instrumentType,
3615
+ underlyingType: params.underlyingType,
3616
+ quote: params.quote ?? quote
3617
+ };
3618
+ }
3619
+ var TradingPairsResource = class {
3620
+ constructor(client) {
3621
+ this.client = client;
3622
+ }
3623
+ client;
3624
+ async search(params) {
3625
+ this.client._requireAuth();
3626
+ const rawSymbol = isRecord(params) ? params.symbol : void 0;
3627
+ const query = typeof rawSymbol === "string" ? rawSymbol.trim() : "";
3628
+ if (!query)
3629
+ throw new AlvaError("INVALID_ARGUMENT", "symbol is required", 400);
3630
+ const response = await this.client._request(
3631
+ "GET",
3632
+ "/api/v1/trading-pairs/search",
3633
+ { query: { q: query, strict: true } }
3634
+ );
3635
+ const candidates = dedupe(flattenResponse(response)).filter((candidate) => matchesQuery(candidate, query)).filter((candidate) => matchesFilter(candidate.market, params.market)).filter(
3636
+ (candidate) => matchesFilter(candidate.instrumentType, params.instrumentType)
3637
+ ).filter(
3638
+ (candidate) => matchesFilter(candidate.underlyingType, params.underlyingType)
3639
+ ).filter((candidate) => matchesFilter(candidate.quote, params.quote));
3640
+ const limit = params.limit;
3641
+ if (limit !== void 0 && candidates.length > limit) {
3642
+ return { query, candidates: candidates.slice(0, limit), truncated: true };
3643
+ }
3644
+ return { query, candidates };
3645
+ }
3646
+ async resolve(params) {
3647
+ const record = isRecord(params) ? params : {};
3648
+ const pair = typeof record.pair === "string" ? record.pair.trim() : void 0;
3649
+ const filters = resolveFilters(params);
3650
+ const searchParams = pair === void 0 ? {
3651
+ symbol: typeof record.symbol === "string" ? record.symbol : "",
3652
+ ...filters
3653
+ } : pairSearchParams(pair, filters);
3654
+ const result = await this.search(searchParams);
3655
+ const candidates = pair === void 0 ? result.candidates : result.candidates.filter(
3656
+ (candidate) => candidate.tradingPair === pair
3657
+ );
3658
+ if (candidates.length !== 1) {
3659
+ const detailLimit = 50;
3660
+ throw new AlvaError(
3661
+ candidates.length === 0 ? "TRADING_PAIR_NOT_FOUND" : "TRADING_PAIR_NOT_UNIQUE",
3662
+ candidates.length === 0 ? `no canonical trading pair matched "${pair ?? searchParams.symbol}"` : `multiple canonical trading pairs matched "${searchParams.symbol}"`,
3663
+ candidates.length === 0 ? 404 : 409,
3664
+ {
3665
+ query: pair ?? searchParams.symbol,
3666
+ candidateCount: candidates.length,
3667
+ candidates: candidates.slice(0, detailLimit),
3668
+ ...candidates.length > detailLimit ? { truncated: true } : {}
3669
+ }
3670
+ );
3671
+ }
3672
+ return candidates[0];
3673
+ }
3674
+ };
3675
+
3491
3676
  // src/client.ts
3492
3677
  var DEFAULT_BASE_URL = "https://api-llm.prd.alva.ai";
3493
3678
  var DEFAULT_ARRAYS_BASE_URL = "https://data-tools.prd.space.id";
3494
- function isRecord(value) {
3679
+ function isRecord2(value) {
3495
3680
  return typeof value === "object" && value !== null;
3496
3681
  }
3497
3682
  function stringField(value, field) {
3498
- if (!isRecord(value)) return void 0;
3683
+ if (!isRecord2(value)) return void 0;
3499
3684
  const fieldValue = value[field];
3500
3685
  return typeof fieldValue === "string" && fieldValue ? fieldValue : void 0;
3501
3686
  }
@@ -3509,7 +3694,7 @@ function describeCause(cause) {
3509
3694
  if (cause.message) details.message = cause.message;
3510
3695
  const code = stringField(cause, "code");
3511
3696
  if (code) details.code = code;
3512
- } else if (isRecord(cause)) {
3697
+ } else if (isRecord2(cause)) {
3513
3698
  const code = stringField(cause, "code");
3514
3699
  const name = stringField(cause, "name");
3515
3700
  const message = stringField(cause, "message");
@@ -3537,7 +3722,7 @@ function describeFetchFailure(err) {
3537
3722
  details.message = String(err);
3538
3723
  }
3539
3724
  const { message: causeMessage, details: causeDetails } = describeCause(
3540
- isRecord(err) ? err.cause : void 0
3725
+ isRecord2(err) ? err.cause : void 0
3541
3726
  );
3542
3727
  if (causeDetails) {
3543
3728
  details.cause = causeDetails;
@@ -3597,6 +3782,7 @@ var AlvaClient = class {
3597
3782
  _credits;
3598
3783
  _markets;
3599
3784
  _schedules;
3785
+ _tradingPairs;
3600
3786
  constructor(config) {
3601
3787
  this.baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
3602
3788
  this.arraysBaseUrl = config.arraysBaseUrl ?? DEFAULT_ARRAYS_BASE_URL;
@@ -3694,6 +3880,9 @@ var AlvaClient = class {
3694
3880
  get markets() {
3695
3881
  return this._markets ??= new MarketsResource(this);
3696
3882
  }
3883
+ get tradingPairs() {
3884
+ return this._tradingPairs ??= new TradingPairsResource(this);
3885
+ }
3697
3886
  get schedules() {
3698
3887
  return this._schedules ??= new SchedulesResource(this);
3699
3888
  }
@@ -4310,7 +4499,7 @@ var installPlaybookRuntime = (targetWindow) => {
4310
4499
  };
4311
4500
 
4312
4501
  // src/index.ts
4313
- var VERSION = true ? "0.26.0" : "dev";
4502
+ var VERSION = true ? "0.27.0" : "dev";
4314
4503
  export {
4315
4504
  AlertsResource,
4316
4505
  AlvaClient,
@@ -4324,6 +4513,7 @@ export {
4324
4513
  SUBSCRIBE_PROPOSE_MESSAGE,
4325
4514
  SUBSCRIBE_RESULT_MESSAGE,
4326
4515
  SchedulesResource,
4516
+ TradingPairsResource,
4327
4517
  UDF_AUTH_REQUIRED_MESSAGE,
4328
4518
  UDF_CONSENT_REQUEST_MESSAGE,
4329
4519
  UDF_CONSENT_RESPONSE_MESSAGE,