@alva-ai/toolkit 0.8.0 → 0.9.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
@@ -1,8 +1,12 @@
1
1
  interface AlvaClientConfig {
2
2
  viewer_token?: string;
3
+ pbsvToken?: string;
3
4
  apiKey?: string;
4
5
  baseUrl?: string;
5
6
  arraysBaseUrl?: string;
7
+ gaClientId?: string;
8
+ gaSessionId?: string;
9
+ utmParams?: string;
6
10
  }
7
11
  interface UserProfile {
8
12
  id: string;
@@ -105,6 +109,11 @@ interface RunRequest {
105
109
  entry_path?: string;
106
110
  working_dir?: string;
107
111
  args?: Record<string, unknown>;
112
+ /**
113
+ * Override the server's default V8 heap limit, in MB. Valid range is
114
+ * 1–2048. Omitted means the server uses its default heap (256 MB).
115
+ */
116
+ max_heap_size_mb?: number;
108
117
  }
109
118
  interface RunResponse {
110
119
  result: string;
@@ -473,6 +482,21 @@ interface FeedNotificationListResponse {
473
482
  /** Canonical alfs path: `/alva/home/<username>/feeds/<name>`. */
474
483
  feed_path: string;
475
484
  }
485
+ type NotificationPreferenceKey = 'session_completed';
486
+ interface NotificationPreference {
487
+ key: NotificationPreferenceKey;
488
+ enabled: boolean;
489
+ }
490
+ interface NotificationPreferencesResponse {
491
+ settings: NotificationPreference[];
492
+ }
493
+ interface NotificationPreferenceUpdateParams {
494
+ key: NotificationPreferenceKey;
495
+ enabled: boolean;
496
+ }
497
+ interface NotificationPreferenceUpdateResponse {
498
+ setting: NotificationPreference;
499
+ }
476
500
  /**
477
501
  * Identifies the asset a personal push subscription is keyed to.
478
502
  * `PLAYBOOK` is the only target supported today; `FEED` is reserved for
@@ -685,6 +709,65 @@ declare class FeedResource {
685
709
  delete(params: FeedDeleteRequest): Promise<FeedDeleteResponse>;
686
710
  }
687
711
 
712
+ type TrendingPlaybooksSort = 'FOLLOWS' | 'RECENT';
713
+ type TrendingPlaybooksDir = 'FORWARD' | 'BACKWARD';
714
+ interface TrendingPlaybooksParams {
715
+ /** Opaque cursor returned on a previous item. Alias of `current`. */
716
+ cursor?: string;
717
+ /** GraphQL-compatible cursor field name. Alias of `cursor`. */
718
+ current?: string;
719
+ /** Page size, default 50, max 100 server-side. */
720
+ limit?: number;
721
+ /** Only FORWARD is supported by the gateway today. */
722
+ dir?: TrendingPlaybooksDir;
723
+ /** FOLLOWS = most followed, RECENT = newest first. */
724
+ sort?: TrendingPlaybooksSort;
725
+ /** Optional AND-filter tags. */
726
+ tags?: string[];
727
+ /** Optional weighted search across playbook and creator fields. */
728
+ keyword?: string;
729
+ }
730
+ interface TrendingPlaybookItem {
731
+ /** Numeric playbook id encoded as a string. */
732
+ id: string;
733
+ /** Stable "owner/name" handle, useful for follow-up tool calls. */
734
+ ref: string;
735
+ /** Owner username. */
736
+ username: string;
737
+ /** URL-safe playbook name. */
738
+ name: string;
739
+ display_name: string;
740
+ description: string;
741
+ tags: string[];
742
+ follow_count: number;
743
+ /** Relative web path for opening or citing the playbook. */
744
+ url_path: string;
745
+ /** README ALFS path when available. */
746
+ readme?: string;
747
+ /** Cursor to pass as `cursor` / `current` for pagination. */
748
+ cursor: string;
749
+ }
750
+ interface TrendingPlaybooksResponse {
751
+ playbooks: TrendingPlaybookItem[];
752
+ has_next: boolean;
753
+ }
754
+ /**
755
+ * Public playbook discovery. Backed by alva-gateway REST and mirrors the
756
+ * GraphQL `trendingPlaybooks(cursor, sort, tags, keyword)` query.
757
+ */
758
+ declare class PlaybooksResource {
759
+ private client;
760
+ constructor(client: AlvaClient);
761
+ /**
762
+ * List trending / searchable playbooks. Auth is optional: when the client
763
+ * has an API key it is forwarded, otherwise this uses the public surface.
764
+ *
765
+ * The gateway returns a frontend-oriented preview payload; this SDK projects
766
+ * it into a smaller, agent-friendly shape.
767
+ */
768
+ trending(params?: TrendingPlaybooksParams): Promise<TrendingPlaybooksResponse>;
769
+ }
770
+
688
771
  declare class SecretsResource {
689
772
  private client;
690
773
  constructor(client: AlvaClient);
@@ -902,6 +985,20 @@ declare class NotificationsResource {
902
985
  listFeed(params: NotificationListParams): Promise<FeedNotificationListResponse>;
903
986
  }
904
987
 
988
+ declare class NotificationPreferencesResource {
989
+ private client;
990
+ constructor(client: AlvaClient);
991
+ /**
992
+ * List the caller's notification preference settings. Server defaults
993
+ * are included even when the caller has not explicitly stored a setting.
994
+ */
995
+ list(): Promise<NotificationPreferencesResponse>;
996
+ /**
997
+ * Enable or disable one notification preference.
998
+ */
999
+ update(params: NotificationPreferenceUpdateParams): Promise<NotificationPreferenceUpdateResponse>;
1000
+ }
1001
+
905
1002
  /**
906
1003
  * Personal push subscriptions — opt the caller in or out of personal
907
1004
  * DM/web push for a target. Independent of social follow:
@@ -980,12 +1077,17 @@ declare class AlvaClient {
980
1077
  readonly baseUrl: string;
981
1078
  readonly arraysBaseUrl: string;
982
1079
  readonly viewer_token?: string;
1080
+ readonly pbsvToken?: string;
983
1081
  readonly apiKey?: string;
1082
+ readonly gaClientId?: string;
1083
+ readonly gaSessionId?: string;
1084
+ readonly utmParams?: string;
984
1085
  private _fs?;
985
1086
  private _run?;
986
1087
  private _deploy?;
987
1088
  private _release?;
988
1089
  private _feed?;
1090
+ private _playbooks?;
989
1091
  private _secrets?;
990
1092
  private _sdk?;
991
1093
  private _dataSkills?;
@@ -997,6 +1099,7 @@ declare class AlvaClient {
997
1099
  private _trading?;
998
1100
  private _arraysJwt?;
999
1101
  private _notifications?;
1102
+ private _notificationPreferences?;
1000
1103
  private _pushSubscriptions?;
1001
1104
  private _channelGroupSubscriptions?;
1002
1105
  constructor(config: AlvaClientConfig);
@@ -1005,6 +1108,7 @@ declare class AlvaClient {
1005
1108
  get deploy(): DeployResource;
1006
1109
  get release(): ReleaseResource;
1007
1110
  get feed(): FeedResource;
1111
+ get playbooks(): PlaybooksResource;
1008
1112
  get secrets(): SecretsResource;
1009
1113
  get sdk(): SdkDocsResource;
1010
1114
  get dataSkills(): DataSkillsResource;
@@ -1016,6 +1120,7 @@ declare class AlvaClient {
1016
1120
  get trading(): TradingResource;
1017
1121
  get arraysJwt(): ArraysJwtResource;
1018
1122
  get notifications(): NotificationsResource;
1123
+ get notificationPreferences(): NotificationPreferencesResource;
1019
1124
  get pushSubscriptions(): PushSubscriptionsResource;
1020
1125
  get channelGroupSubscriptions(): ChannelGroupSubscriptionsResource;
1021
1126
  _requireAuth(): void;
@@ -1028,7 +1133,110 @@ declare class AlvaError extends Error {
1028
1133
  constructor(code: string, message: string, status: number);
1029
1134
  }
1030
1135
 
1136
+ type UdfErrorCode = 'PBSV_EXPIRED' | 'PBSV_INVALID' | 'PBSV_PID_MISMATCH' | 'CONSENT_REQUIRED' | 'INSUFFICIENT_CREDITS' | 'FUNCTION_NOT_FOUND' | 'FUNCTION_DISABLED' | 'RESOURCE_EXHAUSTED' | 'EXECUTION_FAILED' | 'UNAUTHENTICATED' | 'PERMISSION_DENIED' | 'INTERNAL';
1137
+ type UdfErrorBody = {
1138
+ error?: {
1139
+ code?: UdfErrorCode | string;
1140
+ message?: string;
1141
+ metadata?: Record<string, unknown>;
1142
+ };
1143
+ details?: {
1144
+ metadata?: Record<string, unknown>;
1145
+ };
1146
+ };
1147
+ type UdfDescriptor = {
1148
+ name: string;
1149
+ params_schema: unknown | null;
1150
+ };
1151
+ type UdfButtonOptions = {
1152
+ functionName: string;
1153
+ params?: unknown;
1154
+ label?: string;
1155
+ loadingLabel?: string;
1156
+ disabledLabel?: string;
1157
+ };
1158
+ type UdfButtonEventDetail<TResult = unknown> = {
1159
+ functionName: string;
1160
+ result?: TResult;
1161
+ error?: unknown;
1162
+ };
1163
+ type UdfApi = {
1164
+ call: <TResult = unknown>(functionName: string, params: unknown) => Promise<TResult>;
1165
+ list: () => Promise<UdfDescriptor[]>;
1166
+ getViewerToken: () => string | null;
1167
+ renderButton: (target: HTMLElement | string, options: UdfButtonOptions) => HTMLButtonElement;
1168
+ UdfError: typeof UdfError;
1169
+ UdfAuthRequiredError: typeof UdfAuthRequiredError;
1170
+ UdfTokenExpiredError: typeof UdfTokenExpiredError;
1171
+ UdfTokenInvalidError: typeof UdfTokenInvalidError;
1172
+ UdfPidMismatchError: typeof UdfPidMismatchError;
1173
+ UdfConsentRequiredError: typeof UdfConsentRequiredError;
1174
+ UdfConsentDeniedError: typeof UdfConsentDeniedError;
1175
+ UdfConsentTimeoutError: typeof UdfConsentTimeoutError;
1176
+ UdfInsufficientCredits: typeof UdfInsufficientCredits;
1177
+ UdfFunctionNotFoundError: typeof UdfFunctionNotFoundError;
1178
+ UdfFunctionDisabledError: typeof UdfFunctionDisabledError;
1179
+ UdfRateLimitedError: typeof UdfRateLimitedError;
1180
+ UdfExecutionError: typeof UdfExecutionError;
1181
+ UdfTransportError: typeof UdfTransportError;
1182
+ };
1183
+ declare global {
1184
+ interface Window {
1185
+ alva?: {
1186
+ udf?: UdfApi;
1187
+ [key: string]: unknown;
1188
+ };
1189
+ }
1190
+ }
1191
+ declare class UdfError extends Error {
1192
+ readonly code: string;
1193
+ readonly metadata: Record<string, unknown>;
1194
+ readonly status?: number;
1195
+ constructor(message: string, { code, metadata, status, }: {
1196
+ code: string;
1197
+ metadata?: Record<string, unknown>;
1198
+ status?: number;
1199
+ });
1200
+ }
1201
+ declare class UdfAuthRequiredError extends UdfError {
1202
+ constructor();
1203
+ }
1204
+ declare class UdfTokenExpiredError extends UdfError {
1205
+ }
1206
+ declare class UdfTokenInvalidError extends UdfError {
1207
+ }
1208
+ declare class UdfPidMismatchError extends UdfError {
1209
+ }
1210
+ declare class UdfConsentRequiredError extends UdfError {
1211
+ }
1212
+ declare class UdfConsentDeniedError extends UdfError {
1213
+ constructor();
1214
+ }
1215
+ declare class UdfConsentTimeoutError extends UdfError {
1216
+ constructor();
1217
+ }
1218
+ declare class UdfInsufficientCredits extends UdfError {
1219
+ }
1220
+ declare class UdfFunctionNotFoundError extends UdfError {
1221
+ }
1222
+ declare class UdfFunctionDisabledError extends UdfError {
1223
+ }
1224
+ declare class UdfRateLimitedError extends UdfError {
1225
+ }
1226
+ declare class UdfExecutionError extends UdfError {
1227
+ }
1228
+ declare class UdfTransportError extends UdfError {
1229
+ }
1230
+ declare const PBSV_UPDATE_MESSAGE = "alva:pbsv:update";
1231
+ declare const UDF_CONSENT_REQUEST_MESSAGE = "alva:udf:consent-request";
1232
+ declare const UDF_CONSENT_RESPONSE_MESSAGE = "alva:udf:consent-response";
1233
+ declare const playbookIdFromToken: (token: string | null) => string | null;
1234
+ declare const getViewerToken: () => string | null;
1235
+ declare const mapUdfErrorResponse: (body: UdfErrorBody, status?: number) => UdfError;
1236
+ declare const udf: UdfApi;
1237
+ declare const installPlaybookRuntime: (targetWindow?: Window) => void;
1238
+
1031
1239
  /** SDK version, injected at build time from package.json. */
1032
1240
  declare const VERSION: string;
1033
1241
 
1034
- export { AlvaClient, type AlvaClientConfig, AlvaError, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, type FeedDeleteRequest, type FeedDeleteResponse, 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 SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, VERSION };
1242
+ export { AlvaClient, type AlvaClientConfig, AlvaError, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, type FeedDeleteRequest, type FeedDeleteResponse, 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 NotificationPreference, type NotificationPreferenceKey, type NotificationPreferenceUpdateParams, type NotificationPreferenceUpdateResponse, type NotificationPreferencesResponse, PBSV_UPDATE_MESSAGE, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, type TrendingPlaybookItem, type TrendingPlaybooksDir, type TrendingPlaybooksParams, type TrendingPlaybooksResponse, type TrendingPlaybooksSort, 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, UdfPidMismatchError, UdfRateLimitedError, UdfTokenExpiredError, UdfTokenInvalidError, UdfTransportError, VERSION, getViewerToken, installPlaybookRuntime, mapUdfErrorResponse, playbookIdFromToken, udf };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,12 @@
1
1
  interface AlvaClientConfig {
2
2
  viewer_token?: string;
3
+ pbsvToken?: string;
3
4
  apiKey?: string;
4
5
  baseUrl?: string;
5
6
  arraysBaseUrl?: string;
7
+ gaClientId?: string;
8
+ gaSessionId?: string;
9
+ utmParams?: string;
6
10
  }
7
11
  interface UserProfile {
8
12
  id: string;
@@ -105,6 +109,11 @@ interface RunRequest {
105
109
  entry_path?: string;
106
110
  working_dir?: string;
107
111
  args?: Record<string, unknown>;
112
+ /**
113
+ * Override the server's default V8 heap limit, in MB. Valid range is
114
+ * 1–2048. Omitted means the server uses its default heap (256 MB).
115
+ */
116
+ max_heap_size_mb?: number;
108
117
  }
109
118
  interface RunResponse {
110
119
  result: string;
@@ -473,6 +482,21 @@ interface FeedNotificationListResponse {
473
482
  /** Canonical alfs path: `/alva/home/<username>/feeds/<name>`. */
474
483
  feed_path: string;
475
484
  }
485
+ type NotificationPreferenceKey = 'session_completed';
486
+ interface NotificationPreference {
487
+ key: NotificationPreferenceKey;
488
+ enabled: boolean;
489
+ }
490
+ interface NotificationPreferencesResponse {
491
+ settings: NotificationPreference[];
492
+ }
493
+ interface NotificationPreferenceUpdateParams {
494
+ key: NotificationPreferenceKey;
495
+ enabled: boolean;
496
+ }
497
+ interface NotificationPreferenceUpdateResponse {
498
+ setting: NotificationPreference;
499
+ }
476
500
  /**
477
501
  * Identifies the asset a personal push subscription is keyed to.
478
502
  * `PLAYBOOK` is the only target supported today; `FEED` is reserved for
@@ -685,6 +709,65 @@ declare class FeedResource {
685
709
  delete(params: FeedDeleteRequest): Promise<FeedDeleteResponse>;
686
710
  }
687
711
 
712
+ type TrendingPlaybooksSort = 'FOLLOWS' | 'RECENT';
713
+ type TrendingPlaybooksDir = 'FORWARD' | 'BACKWARD';
714
+ interface TrendingPlaybooksParams {
715
+ /** Opaque cursor returned on a previous item. Alias of `current`. */
716
+ cursor?: string;
717
+ /** GraphQL-compatible cursor field name. Alias of `cursor`. */
718
+ current?: string;
719
+ /** Page size, default 50, max 100 server-side. */
720
+ limit?: number;
721
+ /** Only FORWARD is supported by the gateway today. */
722
+ dir?: TrendingPlaybooksDir;
723
+ /** FOLLOWS = most followed, RECENT = newest first. */
724
+ sort?: TrendingPlaybooksSort;
725
+ /** Optional AND-filter tags. */
726
+ tags?: string[];
727
+ /** Optional weighted search across playbook and creator fields. */
728
+ keyword?: string;
729
+ }
730
+ interface TrendingPlaybookItem {
731
+ /** Numeric playbook id encoded as a string. */
732
+ id: string;
733
+ /** Stable "owner/name" handle, useful for follow-up tool calls. */
734
+ ref: string;
735
+ /** Owner username. */
736
+ username: string;
737
+ /** URL-safe playbook name. */
738
+ name: string;
739
+ display_name: string;
740
+ description: string;
741
+ tags: string[];
742
+ follow_count: number;
743
+ /** Relative web path for opening or citing the playbook. */
744
+ url_path: string;
745
+ /** README ALFS path when available. */
746
+ readme?: string;
747
+ /** Cursor to pass as `cursor` / `current` for pagination. */
748
+ cursor: string;
749
+ }
750
+ interface TrendingPlaybooksResponse {
751
+ playbooks: TrendingPlaybookItem[];
752
+ has_next: boolean;
753
+ }
754
+ /**
755
+ * Public playbook discovery. Backed by alva-gateway REST and mirrors the
756
+ * GraphQL `trendingPlaybooks(cursor, sort, tags, keyword)` query.
757
+ */
758
+ declare class PlaybooksResource {
759
+ private client;
760
+ constructor(client: AlvaClient);
761
+ /**
762
+ * List trending / searchable playbooks. Auth is optional: when the client
763
+ * has an API key it is forwarded, otherwise this uses the public surface.
764
+ *
765
+ * The gateway returns a frontend-oriented preview payload; this SDK projects
766
+ * it into a smaller, agent-friendly shape.
767
+ */
768
+ trending(params?: TrendingPlaybooksParams): Promise<TrendingPlaybooksResponse>;
769
+ }
770
+
688
771
  declare class SecretsResource {
689
772
  private client;
690
773
  constructor(client: AlvaClient);
@@ -902,6 +985,20 @@ declare class NotificationsResource {
902
985
  listFeed(params: NotificationListParams): Promise<FeedNotificationListResponse>;
903
986
  }
904
987
 
988
+ declare class NotificationPreferencesResource {
989
+ private client;
990
+ constructor(client: AlvaClient);
991
+ /**
992
+ * List the caller's notification preference settings. Server defaults
993
+ * are included even when the caller has not explicitly stored a setting.
994
+ */
995
+ list(): Promise<NotificationPreferencesResponse>;
996
+ /**
997
+ * Enable or disable one notification preference.
998
+ */
999
+ update(params: NotificationPreferenceUpdateParams): Promise<NotificationPreferenceUpdateResponse>;
1000
+ }
1001
+
905
1002
  /**
906
1003
  * Personal push subscriptions — opt the caller in or out of personal
907
1004
  * DM/web push for a target. Independent of social follow:
@@ -980,12 +1077,17 @@ declare class AlvaClient {
980
1077
  readonly baseUrl: string;
981
1078
  readonly arraysBaseUrl: string;
982
1079
  readonly viewer_token?: string;
1080
+ readonly pbsvToken?: string;
983
1081
  readonly apiKey?: string;
1082
+ readonly gaClientId?: string;
1083
+ readonly gaSessionId?: string;
1084
+ readonly utmParams?: string;
984
1085
  private _fs?;
985
1086
  private _run?;
986
1087
  private _deploy?;
987
1088
  private _release?;
988
1089
  private _feed?;
1090
+ private _playbooks?;
989
1091
  private _secrets?;
990
1092
  private _sdk?;
991
1093
  private _dataSkills?;
@@ -997,6 +1099,7 @@ declare class AlvaClient {
997
1099
  private _trading?;
998
1100
  private _arraysJwt?;
999
1101
  private _notifications?;
1102
+ private _notificationPreferences?;
1000
1103
  private _pushSubscriptions?;
1001
1104
  private _channelGroupSubscriptions?;
1002
1105
  constructor(config: AlvaClientConfig);
@@ -1005,6 +1108,7 @@ declare class AlvaClient {
1005
1108
  get deploy(): DeployResource;
1006
1109
  get release(): ReleaseResource;
1007
1110
  get feed(): FeedResource;
1111
+ get playbooks(): PlaybooksResource;
1008
1112
  get secrets(): SecretsResource;
1009
1113
  get sdk(): SdkDocsResource;
1010
1114
  get dataSkills(): DataSkillsResource;
@@ -1016,6 +1120,7 @@ declare class AlvaClient {
1016
1120
  get trading(): TradingResource;
1017
1121
  get arraysJwt(): ArraysJwtResource;
1018
1122
  get notifications(): NotificationsResource;
1123
+ get notificationPreferences(): NotificationPreferencesResource;
1019
1124
  get pushSubscriptions(): PushSubscriptionsResource;
1020
1125
  get channelGroupSubscriptions(): ChannelGroupSubscriptionsResource;
1021
1126
  _requireAuth(): void;
@@ -1028,7 +1133,110 @@ declare class AlvaError extends Error {
1028
1133
  constructor(code: string, message: string, status: number);
1029
1134
  }
1030
1135
 
1136
+ type UdfErrorCode = 'PBSV_EXPIRED' | 'PBSV_INVALID' | 'PBSV_PID_MISMATCH' | 'CONSENT_REQUIRED' | 'INSUFFICIENT_CREDITS' | 'FUNCTION_NOT_FOUND' | 'FUNCTION_DISABLED' | 'RESOURCE_EXHAUSTED' | 'EXECUTION_FAILED' | 'UNAUTHENTICATED' | 'PERMISSION_DENIED' | 'INTERNAL';
1137
+ type UdfErrorBody = {
1138
+ error?: {
1139
+ code?: UdfErrorCode | string;
1140
+ message?: string;
1141
+ metadata?: Record<string, unknown>;
1142
+ };
1143
+ details?: {
1144
+ metadata?: Record<string, unknown>;
1145
+ };
1146
+ };
1147
+ type UdfDescriptor = {
1148
+ name: string;
1149
+ params_schema: unknown | null;
1150
+ };
1151
+ type UdfButtonOptions = {
1152
+ functionName: string;
1153
+ params?: unknown;
1154
+ label?: string;
1155
+ loadingLabel?: string;
1156
+ disabledLabel?: string;
1157
+ };
1158
+ type UdfButtonEventDetail<TResult = unknown> = {
1159
+ functionName: string;
1160
+ result?: TResult;
1161
+ error?: unknown;
1162
+ };
1163
+ type UdfApi = {
1164
+ call: <TResult = unknown>(functionName: string, params: unknown) => Promise<TResult>;
1165
+ list: () => Promise<UdfDescriptor[]>;
1166
+ getViewerToken: () => string | null;
1167
+ renderButton: (target: HTMLElement | string, options: UdfButtonOptions) => HTMLButtonElement;
1168
+ UdfError: typeof UdfError;
1169
+ UdfAuthRequiredError: typeof UdfAuthRequiredError;
1170
+ UdfTokenExpiredError: typeof UdfTokenExpiredError;
1171
+ UdfTokenInvalidError: typeof UdfTokenInvalidError;
1172
+ UdfPidMismatchError: typeof UdfPidMismatchError;
1173
+ UdfConsentRequiredError: typeof UdfConsentRequiredError;
1174
+ UdfConsentDeniedError: typeof UdfConsentDeniedError;
1175
+ UdfConsentTimeoutError: typeof UdfConsentTimeoutError;
1176
+ UdfInsufficientCredits: typeof UdfInsufficientCredits;
1177
+ UdfFunctionNotFoundError: typeof UdfFunctionNotFoundError;
1178
+ UdfFunctionDisabledError: typeof UdfFunctionDisabledError;
1179
+ UdfRateLimitedError: typeof UdfRateLimitedError;
1180
+ UdfExecutionError: typeof UdfExecutionError;
1181
+ UdfTransportError: typeof UdfTransportError;
1182
+ };
1183
+ declare global {
1184
+ interface Window {
1185
+ alva?: {
1186
+ udf?: UdfApi;
1187
+ [key: string]: unknown;
1188
+ };
1189
+ }
1190
+ }
1191
+ declare class UdfError extends Error {
1192
+ readonly code: string;
1193
+ readonly metadata: Record<string, unknown>;
1194
+ readonly status?: number;
1195
+ constructor(message: string, { code, metadata, status, }: {
1196
+ code: string;
1197
+ metadata?: Record<string, unknown>;
1198
+ status?: number;
1199
+ });
1200
+ }
1201
+ declare class UdfAuthRequiredError extends UdfError {
1202
+ constructor();
1203
+ }
1204
+ declare class UdfTokenExpiredError extends UdfError {
1205
+ }
1206
+ declare class UdfTokenInvalidError extends UdfError {
1207
+ }
1208
+ declare class UdfPidMismatchError extends UdfError {
1209
+ }
1210
+ declare class UdfConsentRequiredError extends UdfError {
1211
+ }
1212
+ declare class UdfConsentDeniedError extends UdfError {
1213
+ constructor();
1214
+ }
1215
+ declare class UdfConsentTimeoutError extends UdfError {
1216
+ constructor();
1217
+ }
1218
+ declare class UdfInsufficientCredits extends UdfError {
1219
+ }
1220
+ declare class UdfFunctionNotFoundError extends UdfError {
1221
+ }
1222
+ declare class UdfFunctionDisabledError extends UdfError {
1223
+ }
1224
+ declare class UdfRateLimitedError extends UdfError {
1225
+ }
1226
+ declare class UdfExecutionError extends UdfError {
1227
+ }
1228
+ declare class UdfTransportError extends UdfError {
1229
+ }
1230
+ declare const PBSV_UPDATE_MESSAGE = "alva:pbsv:update";
1231
+ declare const UDF_CONSENT_REQUEST_MESSAGE = "alva:udf:consent-request";
1232
+ declare const UDF_CONSENT_RESPONSE_MESSAGE = "alva:udf:consent-response";
1233
+ declare const playbookIdFromToken: (token: string | null) => string | null;
1234
+ declare const getViewerToken: () => string | null;
1235
+ declare const mapUdfErrorResponse: (body: UdfErrorBody, status?: number) => UdfError;
1236
+ declare const udf: UdfApi;
1237
+ declare const installPlaybookRuntime: (targetWindow?: Window) => void;
1238
+
1031
1239
  /** SDK version, injected at build time from package.json. */
1032
1240
  declare const VERSION: string;
1033
1241
 
1034
- export { AlvaClient, type AlvaClientConfig, AlvaError, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, type FeedDeleteRequest, type FeedDeleteResponse, 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 SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, VERSION };
1242
+ export { AlvaClient, type AlvaClientConfig, AlvaError, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, type FeedDeleteRequest, type FeedDeleteResponse, 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 NotificationPreference, type NotificationPreferenceKey, type NotificationPreferenceUpdateParams, type NotificationPreferenceUpdateResponse, type NotificationPreferencesResponse, PBSV_UPDATE_MESSAGE, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, type TrendingPlaybookItem, type TrendingPlaybooksDir, type TrendingPlaybooksParams, type TrendingPlaybooksResponse, type TrendingPlaybooksSort, 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, UdfPidMismatchError, UdfRateLimitedError, UdfTokenExpiredError, UdfTokenInvalidError, UdfTransportError, VERSION, getViewerToken, installPlaybookRuntime, mapUdfErrorResponse, playbookIdFromToken, udf };