@alva-ai/toolkit 0.25.1 → 0.25.2-beta.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
@@ -2043,6 +2043,69 @@ declare class MarketsResource {
2043
2043
  private graphql;
2044
2044
  }
2045
2045
 
2046
+ type AgentScheduleStatus = 'active' | 'paused' | 'completed' | 'failed';
2047
+ type AgentScheduleFailureCode = 'target_invalid' | 'delivery_exhausted' | 'payload_conflict';
2048
+ type AgentScheduleRule = {
2049
+ kind: 'at';
2050
+ timestamp: string;
2051
+ } | {
2052
+ kind: 'every';
2053
+ interval: string;
2054
+ } | {
2055
+ kind: 'cron';
2056
+ expression: string;
2057
+ timezone: string;
2058
+ };
2059
+ interface AgentScheduleBounds {
2060
+ startsAt?: string;
2061
+ until?: string;
2062
+ maxOccurrences?: number;
2063
+ }
2064
+ interface AgentSchedule {
2065
+ name: string;
2066
+ rule: AgentScheduleRule;
2067
+ bounds: AgentScheduleBounds;
2068
+ text: string;
2069
+ status: AgentScheduleStatus;
2070
+ failure?: {
2071
+ code: AgentScheduleFailureCode;
2072
+ at?: string;
2073
+ };
2074
+ occurrencesUsed: number;
2075
+ nextFireAt?: string;
2076
+ createdAt: string;
2077
+ updatedAt: string;
2078
+ }
2079
+ interface PutAgentScheduleParams {
2080
+ channelId: string | number;
2081
+ name: string;
2082
+ rule: AgentScheduleRule | {
2083
+ kind: 'after';
2084
+ duration: string;
2085
+ };
2086
+ bounds?: AgentScheduleBounds;
2087
+ text: string;
2088
+ }
2089
+ interface ManageAgentScheduleParams {
2090
+ channelId: string | number;
2091
+ name: string;
2092
+ }
2093
+ declare class SchedulesResource {
2094
+ private client;
2095
+ constructor(client: AlvaClient);
2096
+ list(params: {
2097
+ channelId: string | number;
2098
+ }): Promise<AgentSchedule[]>;
2099
+ put(params: PutAgentScheduleParams): Promise<AgentSchedule>;
2100
+ pause(params: ManageAgentScheduleParams): Promise<AgentSchedule>;
2101
+ resume(params: ManageAgentScheduleParams): Promise<AgentSchedule>;
2102
+ delete(params: ManageAgentScheduleParams): Promise<void>;
2103
+ /** Resolve the authenticated viewer's unique Agent Channel for CLI defaults. */
2104
+ agentChannelId(): Promise<string>;
2105
+ private manage;
2106
+ private graphql;
2107
+ }
2108
+
2046
2109
  interface RequestOptions {
2047
2110
  query?: Record<string, unknown>;
2048
2111
  body?: unknown;
@@ -2108,6 +2171,7 @@ declare class AlvaClient {
2108
2171
  private _functions?;
2109
2172
  private _credits?;
2110
2173
  private _markets?;
2174
+ private _schedules?;
2111
2175
  constructor(config: AlvaClientConfig);
2112
2176
  get fs(): FsResource;
2113
2177
  get run(): RunResource;
@@ -2137,6 +2201,7 @@ declare class AlvaClient {
2137
2201
  get functions(): FunctionsResource;
2138
2202
  get credits(): CreditsResource;
2139
2203
  get markets(): MarketsResource;
2204
+ get schedules(): SchedulesResource;
2140
2205
  _requireAuth(): void;
2141
2206
  _request(method: string, path: string, options?: RequestOptions): Promise<unknown>;
2142
2207
  }
@@ -2291,4 +2356,4 @@ declare const installPlaybookRuntime: (targetWindow?: Window) => void;
2291
2356
  /** SDK version, injected at build time from package.json. */
2292
2357
  declare const VERSION: string;
2293
2358
 
2294
- export { 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, 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 RegisterFunctionParams, type RegisterFunctionResponse, type RevokeAllowanceParams, type RevokeAllowanceResponse, SUBSCRIBE_MANAGE_MESSAGE, SUBSCRIBE_PROPOSE_MESSAGE, SUBSCRIBE_RESULT_MESSAGE, 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -2043,6 +2043,69 @@ declare class MarketsResource {
2043
2043
  private graphql;
2044
2044
  }
2045
2045
 
2046
+ type AgentScheduleStatus = 'active' | 'paused' | 'completed' | 'failed';
2047
+ type AgentScheduleFailureCode = 'target_invalid' | 'delivery_exhausted' | 'payload_conflict';
2048
+ type AgentScheduleRule = {
2049
+ kind: 'at';
2050
+ timestamp: string;
2051
+ } | {
2052
+ kind: 'every';
2053
+ interval: string;
2054
+ } | {
2055
+ kind: 'cron';
2056
+ expression: string;
2057
+ timezone: string;
2058
+ };
2059
+ interface AgentScheduleBounds {
2060
+ startsAt?: string;
2061
+ until?: string;
2062
+ maxOccurrences?: number;
2063
+ }
2064
+ interface AgentSchedule {
2065
+ name: string;
2066
+ rule: AgentScheduleRule;
2067
+ bounds: AgentScheduleBounds;
2068
+ text: string;
2069
+ status: AgentScheduleStatus;
2070
+ failure?: {
2071
+ code: AgentScheduleFailureCode;
2072
+ at?: string;
2073
+ };
2074
+ occurrencesUsed: number;
2075
+ nextFireAt?: string;
2076
+ createdAt: string;
2077
+ updatedAt: string;
2078
+ }
2079
+ interface PutAgentScheduleParams {
2080
+ channelId: string | number;
2081
+ name: string;
2082
+ rule: AgentScheduleRule | {
2083
+ kind: 'after';
2084
+ duration: string;
2085
+ };
2086
+ bounds?: AgentScheduleBounds;
2087
+ text: string;
2088
+ }
2089
+ interface ManageAgentScheduleParams {
2090
+ channelId: string | number;
2091
+ name: string;
2092
+ }
2093
+ declare class SchedulesResource {
2094
+ private client;
2095
+ constructor(client: AlvaClient);
2096
+ list(params: {
2097
+ channelId: string | number;
2098
+ }): Promise<AgentSchedule[]>;
2099
+ put(params: PutAgentScheduleParams): Promise<AgentSchedule>;
2100
+ pause(params: ManageAgentScheduleParams): Promise<AgentSchedule>;
2101
+ resume(params: ManageAgentScheduleParams): Promise<AgentSchedule>;
2102
+ delete(params: ManageAgentScheduleParams): Promise<void>;
2103
+ /** Resolve the authenticated viewer's unique Agent Channel for CLI defaults. */
2104
+ agentChannelId(): Promise<string>;
2105
+ private manage;
2106
+ private graphql;
2107
+ }
2108
+
2046
2109
  interface RequestOptions {
2047
2110
  query?: Record<string, unknown>;
2048
2111
  body?: unknown;
@@ -2108,6 +2171,7 @@ declare class AlvaClient {
2108
2171
  private _functions?;
2109
2172
  private _credits?;
2110
2173
  private _markets?;
2174
+ private _schedules?;
2111
2175
  constructor(config: AlvaClientConfig);
2112
2176
  get fs(): FsResource;
2113
2177
  get run(): RunResource;
@@ -2137,6 +2201,7 @@ declare class AlvaClient {
2137
2201
  get functions(): FunctionsResource;
2138
2202
  get credits(): CreditsResource;
2139
2203
  get markets(): MarketsResource;
2204
+ get schedules(): SchedulesResource;
2140
2205
  _requireAuth(): void;
2141
2206
  _request(method: string, path: string, options?: RequestOptions): Promise<unknown>;
2142
2207
  }
@@ -2291,4 +2356,4 @@ declare const installPlaybookRuntime: (targetWindow?: Window) => void;
2291
2356
  /** SDK version, injected at build time from package.json. */
2292
2357
  declare const VERSION: string;
2293
2358
 
2294
- export { 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, 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 RegisterFunctionParams, type RegisterFunctionResponse, type RevokeAllowanceParams, type RevokeAllowanceResponse, SUBSCRIBE_MANAGE_MESSAGE, SUBSCRIBE_PROPOSE_MESSAGE, SUBSCRIBE_RESULT_MESSAGE, 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 };
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 };
package/dist/index.js CHANGED
@@ -3115,6 +3115,379 @@ var MarketsResource = class {
3115
3115
  }
3116
3116
  };
3117
3117
 
3118
+ // src/resources/schedules.ts
3119
+ var SCHEDULE_FIELDS = `
3120
+ id
3121
+ channel { id }
3122
+ name
3123
+ rule { kind atMs everyIntervalSeconds cronExpression cronTimezone }
3124
+ bounds { startsAtMs untilMs maxOccurrences }
3125
+ message { text }
3126
+ status
3127
+ failureCode
3128
+ failureAtMs
3129
+ occurrencesUsed
3130
+ nextFireAtMs
3131
+ createdAtMs
3132
+ updatedAtMs
3133
+ `;
3134
+ var LIST_SCHEDULES = `
3135
+ query ToolkitListAgentSchedules($channelId: ID!, $after: String) {
3136
+ viewer { channel(id: $channelId) {
3137
+ schedules(input: { first: 64, after: $after }) {
3138
+ edges { node { ${SCHEDULE_FIELDS} } }
3139
+ pageInfo { hasNextPage endCursor }
3140
+ }
3141
+ } }
3142
+ }`.trim();
3143
+ var UPDATE_SCHEDULE = `
3144
+ mutation ToolkitUpdateAgentSchedule($input: UpdateChannelScheduleInput!) {
3145
+ updateChannelSchedule(input: $input) {
3146
+ schedule { ${SCHEDULE_FIELDS} }
3147
+ deleted
3148
+ }
3149
+ }`.trim();
3150
+ var AGENT_CHANNEL = `
3151
+ query ToolkitAgentChannel {
3152
+ viewer { channels { id kind } }
3153
+ }`.trim();
3154
+ var SCHEDULE_NAME = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
3155
+ var RFC3339 = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(Z|[+-](\d{2}):(\d{2}))$/i;
3156
+ var ISO_DURATION = /^P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/;
3157
+ var GRAPHQL_STATUS_BY_CODE = {
3158
+ INVALID_ARGUMENT: 400,
3159
+ UNAUTHENTICATED: 401,
3160
+ PERMISSION_DENIED: 403,
3161
+ NOT_FOUND: 404,
3162
+ ALREADY_EXISTS: 409,
3163
+ ABORTED: 409,
3164
+ FAILED_PRECONDITION: 412,
3165
+ RESOURCE_EXHAUSTED: 429,
3166
+ INTERNAL: 500,
3167
+ UNKNOWN: 500,
3168
+ DATA_LOSS: 500,
3169
+ UNAVAILABLE: 503,
3170
+ DEADLINE_EXCEEDED: 504
3171
+ };
3172
+ var SchedulesResource = class {
3173
+ constructor(client) {
3174
+ this.client = client;
3175
+ }
3176
+ client;
3177
+ async list(params) {
3178
+ this.client._requireAuth();
3179
+ const id = channelID(params.channelId);
3180
+ const schedules = [];
3181
+ let after = null;
3182
+ const seenCursors = /* @__PURE__ */ new Set();
3183
+ for (; ; ) {
3184
+ const data = await this.graphql(
3185
+ LIST_SCHEDULES,
3186
+ { channelId: id, after }
3187
+ );
3188
+ const connection = data.viewer?.channel?.schedules;
3189
+ if (!connection?.edges) throw scheduleNotFound();
3190
+ for (const edge of connection.edges) {
3191
+ if (!edge?.node) throw scheduleEmptyResponse();
3192
+ schedules.push(fromWireSchedule(edge.node));
3193
+ }
3194
+ if (connection.pageInfo?.hasNextPage !== true) return schedules;
3195
+ const next = connection.pageInfo.endCursor;
3196
+ if (!next || seenCursors.has(next)) throw scheduleEmptyResponse();
3197
+ seenCursors.add(next);
3198
+ after = next;
3199
+ }
3200
+ }
3201
+ async put(params) {
3202
+ this.client._requireAuth();
3203
+ const input = {
3204
+ channelId: channelID(params.channelId),
3205
+ name: requireName(params.name),
3206
+ definition: {
3207
+ ...ruleInput(params.rule, params.bounds),
3208
+ message: { text: requireText(params.text) }
3209
+ }
3210
+ };
3211
+ const data = await this.graphql(UPDATE_SCHEDULE, { input });
3212
+ const schedule = data.updateChannelSchedule?.schedule;
3213
+ if (!schedule) throw scheduleEmptyResponse();
3214
+ return fromWireSchedule(schedule);
3215
+ }
3216
+ pause(params) {
3217
+ return this.manage("PAUSED", params);
3218
+ }
3219
+ resume(params) {
3220
+ return this.manage("ACTIVE", params);
3221
+ }
3222
+ async delete(params) {
3223
+ this.client._requireAuth();
3224
+ const data = await this.graphql(UPDATE_SCHEDULE, {
3225
+ input: { ...managementInput(params), lifecycle: "REMOVED" }
3226
+ });
3227
+ if (data.updateChannelSchedule?.deleted !== true)
3228
+ throw scheduleEmptyResponse();
3229
+ }
3230
+ /** Resolve the authenticated viewer's unique Agent Channel for CLI defaults. */
3231
+ async agentChannelId() {
3232
+ this.client._requireAuth();
3233
+ const data = await this.graphql(AGENT_CHANNEL);
3234
+ const id = data.viewer?.channels?.find(
3235
+ (channel) => channel.kind === "AGENT"
3236
+ )?.id;
3237
+ if (!id) throw scheduleNotFound();
3238
+ return id;
3239
+ }
3240
+ async manage(lifecycle, params) {
3241
+ this.client._requireAuth();
3242
+ const data = await this.graphql(UPDATE_SCHEDULE, {
3243
+ input: { ...managementInput(params), lifecycle }
3244
+ });
3245
+ const schedule = data.updateChannelSchedule?.schedule;
3246
+ if (!schedule) throw scheduleEmptyResponse();
3247
+ return fromWireSchedule(schedule);
3248
+ }
3249
+ async graphql(query, variables) {
3250
+ const response = await this.client._request("POST", "/query", {
3251
+ body: variables === void 0 ? { query } : { query, variables }
3252
+ });
3253
+ if (response.errors?.length) {
3254
+ const codes = response.errors.map((error) => error.extensions?.code);
3255
+ const distinctCodes = new Set(codes);
3256
+ const canonicalCode = distinctCodes.size === 1 && typeof codes[0] === "string" ? codes[0] : void 0;
3257
+ const canonicalStatus = canonicalCode ? GRAPHQL_STATUS_BY_CODE[canonicalCode] : void 0;
3258
+ const errorCode = canonicalCode !== void 0 && canonicalStatus !== void 0 ? canonicalCode : "GRAPHQL_ERROR";
3259
+ throw new AlvaError(
3260
+ errorCode,
3261
+ response.errors.map((error) => error.message).filter((message) => typeof message === "string").join("; ") || "GraphQL request failed",
3262
+ canonicalStatus ?? 502,
3263
+ { errors: response.errors }
3264
+ );
3265
+ }
3266
+ if (!response.data) throw scheduleEmptyResponse();
3267
+ return response.data;
3268
+ }
3269
+ };
3270
+ function ruleInput(rule, bounds) {
3271
+ const convertedBounds = boundsInput(bounds);
3272
+ switch (rule.kind) {
3273
+ case "after":
3274
+ if (convertedBounds)
3275
+ throw invalid("after does not accept recurring bounds");
3276
+ const requestedAt = Date.now() + durationMilliseconds(rule.duration, 1);
3277
+ const atMs = Math.ceil(requestedAt / 1e3) * 1e3;
3278
+ if (!Number.isSafeInteger(atMs) || Number.isNaN(new Date(atMs).getTime()))
3279
+ throw invalid("after is out of range");
3280
+ return {
3281
+ rule: {
3282
+ kind: "AT",
3283
+ atMs
3284
+ }
3285
+ };
3286
+ case "at":
3287
+ if (convertedBounds) throw invalid("at does not accept recurring bounds");
3288
+ return {
3289
+ rule: { kind: "AT", atMs: timestampMilliseconds(rule.timestamp) }
3290
+ };
3291
+ case "every":
3292
+ return {
3293
+ rule: {
3294
+ kind: "EVERY",
3295
+ everyIntervalSeconds: durationSeconds(rule.interval)
3296
+ },
3297
+ ...convertedBounds ? { bounds: convertedBounds } : {}
3298
+ };
3299
+ case "cron":
3300
+ if (!rule.expression.trim() || !rule.timezone.trim()) {
3301
+ throw invalid("cron expression and timezone are required");
3302
+ }
3303
+ return {
3304
+ rule: {
3305
+ kind: "CRON",
3306
+ cronExpression: rule.expression,
3307
+ cronTimezone: rule.timezone
3308
+ },
3309
+ ...convertedBounds ? { bounds: convertedBounds } : {}
3310
+ };
3311
+ }
3312
+ }
3313
+ function boundsInput(bounds) {
3314
+ if (!bounds) return void 0;
3315
+ const result = {};
3316
+ if (bounds.startsAt !== void 0)
3317
+ result.startsAtMs = timestampMilliseconds(bounds.startsAt);
3318
+ if (bounds.until !== void 0)
3319
+ result.untilMs = timestampMilliseconds(bounds.until);
3320
+ if (bounds.maxOccurrences !== void 0) {
3321
+ if (!Number.isSafeInteger(bounds.maxOccurrences) || bounds.maxOccurrences <= 0) {
3322
+ throw invalid("maxOccurrences must be a positive safe integer");
3323
+ }
3324
+ result.maxOccurrences = bounds.maxOccurrences;
3325
+ }
3326
+ return Object.keys(result).length > 0 ? result : void 0;
3327
+ }
3328
+ function fromWireSchedule(schedule) {
3329
+ const statuses = {
3330
+ ACTIVE: "active",
3331
+ PAUSED: "paused",
3332
+ COMPLETED: "completed",
3333
+ FAILED: "failed"
3334
+ };
3335
+ const status = statuses[schedule.status];
3336
+ if (!status) throw scheduleEmptyResponse();
3337
+ const bounds = schedule.bounds ?? {};
3338
+ const message = schedule.message ?? {};
3339
+ const result = {
3340
+ name: schedule.name,
3341
+ rule: fromWireRule(schedule.rule),
3342
+ bounds: {
3343
+ ...bounds.startsAtMs != null ? { startsAt: timestampString(bounds.startsAtMs, true) } : {},
3344
+ ...bounds.untilMs != null ? { until: timestampString(bounds.untilMs, true) } : {},
3345
+ ...bounds.maxOccurrences != null ? {
3346
+ maxOccurrences: safeInteger(
3347
+ bounds.maxOccurrences,
3348
+ "maxOccurrences"
3349
+ )
3350
+ } : {}
3351
+ },
3352
+ text: message.text ?? "",
3353
+ status,
3354
+ occurrencesUsed: safeInteger(schedule.occurrencesUsed, "occurrencesUsed"),
3355
+ ...schedule.nextFireAtMs != null ? { nextFireAt: timestampString(schedule.nextFireAtMs, true) } : {},
3356
+ createdAt: timestampString(schedule.createdAtMs),
3357
+ updatedAt: timestampString(schedule.updatedAtMs)
3358
+ };
3359
+ if (status === "failed") {
3360
+ if (!schedule.failureCode) throw scheduleEmptyResponse();
3361
+ const failureCodes = {
3362
+ TARGET_INVALID: "target_invalid",
3363
+ DELIVERY_EXHAUSTED: "delivery_exhausted",
3364
+ PAYLOAD_CONFLICT: "payload_conflict"
3365
+ };
3366
+ const code = failureCodes[schedule.failureCode];
3367
+ if (!code) throw scheduleEmptyResponse();
3368
+ result.failure = {
3369
+ code,
3370
+ ...schedule.failureAtMs != null ? { at: timestampString(schedule.failureAtMs) } : {}
3371
+ };
3372
+ }
3373
+ return result;
3374
+ }
3375
+ function fromWireRule(rule) {
3376
+ switch (rule.kind) {
3377
+ case "AT":
3378
+ if (rule.atMs == null) throw scheduleEmptyResponse();
3379
+ return { kind: "at", timestamp: timestampString(rule.atMs, true) };
3380
+ case "EVERY":
3381
+ if (rule.everyIntervalSeconds == null) throw scheduleEmptyResponse();
3382
+ return {
3383
+ kind: "every",
3384
+ interval: `PT${safeInteger(rule.everyIntervalSeconds, "interval")}S`
3385
+ };
3386
+ case "CRON":
3387
+ if (!rule.cronExpression || !rule.cronTimezone)
3388
+ throw scheduleEmptyResponse();
3389
+ return {
3390
+ kind: "cron",
3391
+ expression: rule.cronExpression,
3392
+ timezone: rule.cronTimezone
3393
+ };
3394
+ }
3395
+ throw scheduleEmptyResponse();
3396
+ }
3397
+ function managementInput(params) {
3398
+ return {
3399
+ channelId: channelID(params.channelId),
3400
+ name: requireName(params.name)
3401
+ };
3402
+ }
3403
+ function channelID(value) {
3404
+ if (typeof value === "number" && (!Number.isSafeInteger(value) || value <= 0)) {
3405
+ throw invalid(
3406
+ "numeric channelId must be a positive safe integer; use a decimal string for larger IDs"
3407
+ );
3408
+ }
3409
+ const rendered = String(value);
3410
+ if (!/^[1-9]\d*$/.test(rendered))
3411
+ throw invalid("channelId must be a positive integer");
3412
+ return rendered;
3413
+ }
3414
+ function requireName(value) {
3415
+ if (!SCHEDULE_NAME.test(value))
3416
+ throw invalid(
3417
+ "name must be 1-63 lowercase alphanumeric characters or hyphens"
3418
+ );
3419
+ return value;
3420
+ }
3421
+ function requireText(value) {
3422
+ const size = utf8Size(value);
3423
+ if (size === void 0 || !value.trim() || size > 16 * 1024)
3424
+ throw invalid("text must be 1..16384 UTF-8 bytes");
3425
+ return value;
3426
+ }
3427
+ function durationSeconds(value) {
3428
+ const milliseconds = durationMilliseconds(value, 60);
3429
+ if (milliseconds % 1e3 !== 0)
3430
+ throw invalid("duration must resolve to whole seconds");
3431
+ return milliseconds / 1e3;
3432
+ }
3433
+ function durationMilliseconds(value, minimumSeconds) {
3434
+ const match = ISO_DURATION.exec(value);
3435
+ if (!match || match.slice(1, 5).every((part) => part === void 0) || value.includes("T") && match.slice(2, 5).every((part) => part === void 0)) {
3436
+ throw invalid("duration must be a positive ISO 8601 day/time duration");
3437
+ }
3438
+ const [days, hours, minutes, seconds] = match.slice(1, 5).map((part) => BigInt(part ?? "0"));
3439
+ const totalSeconds = ((days * 24n + hours) * 60n + minutes) * 60n + seconds;
3440
+ if (totalSeconds < BigInt(minimumSeconds)) {
3441
+ throw invalid(`duration must be at least ${minimumSeconds} whole seconds`);
3442
+ }
3443
+ const result = Number(totalSeconds * 1000n);
3444
+ if (!Number.isSafeInteger(result)) throw invalid("duration is out of range");
3445
+ return result;
3446
+ }
3447
+ function timestampMilliseconds(value) {
3448
+ const match = RFC3339.exec(value);
3449
+ if (!match) throw invalid("timestamp must be RFC3339 with a timezone");
3450
+ const [year, month, day, hour, minute, second] = match.slice(1, 7).map(Number);
3451
+ const offsetHour = Number(match[8] ?? 0);
3452
+ const offsetMinute = Number(match[9] ?? 0);
3453
+ const daysInMonth = new Date(Date.UTC(year, month, 0)).getUTCDate();
3454
+ const result = Date.parse(value);
3455
+ if (!Number.isFinite(result) || year < 1 || year > 9999 || month < 1 || month > 12 || day < 1 || day > daysInMonth || hour > 23 || minute > 59 || second > 59 || offsetHour > 23 || offsetMinute > 59) {
3456
+ throw invalid("timestamp must be RFC3339 with a timezone");
3457
+ }
3458
+ return result;
3459
+ }
3460
+ function timestampString(value, semantic = false) {
3461
+ if (!Number.isSafeInteger(value)) throw scheduleEmptyResponse();
3462
+ if (semantic && value % 1e3 !== 0) throw scheduleEmptyResponse();
3463
+ const timestamp = new Date(value);
3464
+ if (Number.isNaN(timestamp.getTime())) throw scheduleEmptyResponse();
3465
+ return timestamp.toISOString();
3466
+ }
3467
+ function safeInteger(value, field) {
3468
+ const result = Number(value);
3469
+ if (!Number.isSafeInteger(result) || result < 0)
3470
+ throw invalid(`${field} exceeds JavaScript safe integer range`);
3471
+ return result;
3472
+ }
3473
+ function invalid(message) {
3474
+ return new AlvaError("INVALID_ARGUMENT", message, 400);
3475
+ }
3476
+ function utf8Size(value) {
3477
+ const bytes = new TextEncoder().encode(value);
3478
+ return new TextDecoder("utf-8", { fatal: true }).decode(bytes) === value ? bytes.byteLength : void 0;
3479
+ }
3480
+ function scheduleNotFound() {
3481
+ return new AlvaError("NOT_FOUND", "channel schedule target not found", 404);
3482
+ }
3483
+ function scheduleEmptyResponse() {
3484
+ return new AlvaError(
3485
+ "GRAPHQL_EMPTY_RESPONSE",
3486
+ "GraphQL response did not include a valid schedule",
3487
+ 502
3488
+ );
3489
+ }
3490
+
3118
3491
  // src/client.ts
3119
3492
  var DEFAULT_BASE_URL = "https://api-llm.prd.alva.ai";
3120
3493
  var DEFAULT_ARRAYS_BASE_URL = "https://data-tools.prd.space.id";
@@ -3223,6 +3596,7 @@ var AlvaClient = class {
3223
3596
  _functions;
3224
3597
  _credits;
3225
3598
  _markets;
3599
+ _schedules;
3226
3600
  constructor(config) {
3227
3601
  this.baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
3228
3602
  this.arraysBaseUrl = config.arraysBaseUrl ?? DEFAULT_ARRAYS_BASE_URL;
@@ -3320,6 +3694,9 @@ var AlvaClient = class {
3320
3694
  get markets() {
3321
3695
  return this._markets ??= new MarketsResource(this);
3322
3696
  }
3697
+ get schedules() {
3698
+ return this._schedules ??= new SchedulesResource(this);
3699
+ }
3323
3700
  _requireAuth() {
3324
3701
  if (!this.pbsvToken && !this.viewer_token && !this.apiKey) {
3325
3702
  throw new AlvaError(
@@ -3933,7 +4310,7 @@ var installPlaybookRuntime = (targetWindow) => {
3933
4310
  };
3934
4311
 
3935
4312
  // src/index.ts
3936
- var VERSION = true ? "0.25.1" : "dev";
4313
+ var VERSION = true ? "0.25.2-beta.0" : "dev";
3937
4314
  export {
3938
4315
  AlertsResource,
3939
4316
  AlvaClient,
@@ -3946,6 +4323,7 @@ export {
3946
4323
  SUBSCRIBE_MANAGE_MESSAGE,
3947
4324
  SUBSCRIBE_PROPOSE_MESSAGE,
3948
4325
  SUBSCRIBE_RESULT_MESSAGE,
4326
+ SchedulesResource,
3949
4327
  UDF_AUTH_REQUIRED_MESSAGE,
3950
4328
  UDF_CONSENT_REQUEST_MESSAGE,
3951
4329
  UDF_CONSENT_RESPONSE_MESSAGE,