@alva-ai/toolkit 0.11.2-beta.0 → 0.11.3-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/README.md +23 -0
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.js +583 -59
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +279 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +134 -1
- package/dist/index.d.ts +134 -1
- package/dist/index.js +276 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -13,6 +13,7 @@ interface UserProfile {
|
|
|
13
13
|
username: string;
|
|
14
14
|
subscription_tier: 'free' | 'pro';
|
|
15
15
|
telegram_username: string | null;
|
|
16
|
+
slack_username: string | null;
|
|
16
17
|
/** Caller's alfs home directory, e.g. `/alva/home/<username>`. */
|
|
17
18
|
home_path: string;
|
|
18
19
|
}
|
|
@@ -228,6 +229,16 @@ interface FeedDeleteRequest {
|
|
|
228
229
|
/** Numeric feed id to delete. */
|
|
229
230
|
id: number;
|
|
230
231
|
}
|
|
232
|
+
interface FeedStatusUpdateRequest {
|
|
233
|
+
/** Numeric feed id to stop/resume. */
|
|
234
|
+
id: number;
|
|
235
|
+
}
|
|
236
|
+
interface FeedStatusUpdateResponse {
|
|
237
|
+
/** Echoed feed id (string form, matching gateway response). */
|
|
238
|
+
id: string;
|
|
239
|
+
/** Feed runtime status after the update. */
|
|
240
|
+
status: 'ACTIVE' | 'PAUSED' | 'UNSPECIFIED' | string;
|
|
241
|
+
}
|
|
231
242
|
interface FeedDeleteResponse {
|
|
232
243
|
/** Echoed feed id (string form, matching gateway response). */
|
|
233
244
|
id: string;
|
|
@@ -803,6 +814,19 @@ declare class ReleaseResource {
|
|
|
803
814
|
declare class FeedResource {
|
|
804
815
|
private client;
|
|
805
816
|
constructor(client: AlvaClient);
|
|
817
|
+
/**
|
|
818
|
+
* Stop a feed's producer cronjob. This pauses future scheduled runs while
|
|
819
|
+
* preserving the feed and its existing data.
|
|
820
|
+
*
|
|
821
|
+
* Auth: caller must own the feed (uid match), enforced by the backend.
|
|
822
|
+
*/
|
|
823
|
+
stop(params: FeedStatusUpdateRequest): Promise<FeedStatusUpdateResponse>;
|
|
824
|
+
/**
|
|
825
|
+
* Resume a stopped feed's producer cronjob.
|
|
826
|
+
*
|
|
827
|
+
* Auth: caller must own the feed (uid match), enforced by the backend.
|
|
828
|
+
*/
|
|
829
|
+
resume(params: FeedStatusUpdateRequest): Promise<FeedStatusUpdateResponse>;
|
|
806
830
|
/**
|
|
807
831
|
* Soft-delete a feed and all its active majors. Cascades:
|
|
808
832
|
* - all active feed_majors are soft-deleted in the same transaction
|
|
@@ -1206,6 +1230,95 @@ declare class FeedbackResource {
|
|
|
1206
1230
|
submit(params: SubmitFeedbackRequest): Promise<SubmitFeedbackResponse>;
|
|
1207
1231
|
}
|
|
1208
1232
|
|
|
1233
|
+
interface PlaybookFunction {
|
|
1234
|
+
id: string | number;
|
|
1235
|
+
playbook_id: string | number;
|
|
1236
|
+
function_name: string;
|
|
1237
|
+
entry_script_path: string;
|
|
1238
|
+
created_at?: string;
|
|
1239
|
+
updated_at?: string;
|
|
1240
|
+
disabled?: boolean;
|
|
1241
|
+
params_schema?: string;
|
|
1242
|
+
allow_charges?: boolean;
|
|
1243
|
+
}
|
|
1244
|
+
interface RegisterFunctionParams {
|
|
1245
|
+
playbook_id: number;
|
|
1246
|
+
function_name: string;
|
|
1247
|
+
entry_script_path: string;
|
|
1248
|
+
params_schema?: string;
|
|
1249
|
+
allow_charges?: boolean;
|
|
1250
|
+
}
|
|
1251
|
+
interface RegisterFunctionResponse {
|
|
1252
|
+
function?: PlaybookFunction;
|
|
1253
|
+
}
|
|
1254
|
+
interface ListFunctionsParams {
|
|
1255
|
+
playbook_id: number;
|
|
1256
|
+
}
|
|
1257
|
+
interface ListFunctionsResponse {
|
|
1258
|
+
functions: PlaybookFunction[];
|
|
1259
|
+
}
|
|
1260
|
+
interface DeleteFunctionParams {
|
|
1261
|
+
playbook_id: number;
|
|
1262
|
+
function_name: string;
|
|
1263
|
+
}
|
|
1264
|
+
interface InvokeFunctionParams {
|
|
1265
|
+
playbook_id: number;
|
|
1266
|
+
function_name: string;
|
|
1267
|
+
parameters?: unknown;
|
|
1268
|
+
}
|
|
1269
|
+
interface InvokeFunctionResponse<TResult = unknown> {
|
|
1270
|
+
result: TResult;
|
|
1271
|
+
logs: string;
|
|
1272
|
+
credits_used_total: number;
|
|
1273
|
+
credits_charged_owner: number;
|
|
1274
|
+
credits_charged_consumer: number;
|
|
1275
|
+
}
|
|
1276
|
+
interface CreditAllowance {
|
|
1277
|
+
id: string | number;
|
|
1278
|
+
consumer_uid: string | number;
|
|
1279
|
+
playbook_id: string | number;
|
|
1280
|
+
amount: number;
|
|
1281
|
+
used: number;
|
|
1282
|
+
remaining: number;
|
|
1283
|
+
created_at_ms?: number;
|
|
1284
|
+
updated_at_ms?: number;
|
|
1285
|
+
}
|
|
1286
|
+
interface GetAllowanceParams {
|
|
1287
|
+
playbook_id: number;
|
|
1288
|
+
}
|
|
1289
|
+
interface ListAllowancesResponse {
|
|
1290
|
+
allowances: CreditAllowance[];
|
|
1291
|
+
}
|
|
1292
|
+
interface CreateAllowanceParams {
|
|
1293
|
+
playbook_id: number;
|
|
1294
|
+
amount: number;
|
|
1295
|
+
}
|
|
1296
|
+
interface CreateAllowanceResponse {
|
|
1297
|
+
allowance: CreditAllowance;
|
|
1298
|
+
}
|
|
1299
|
+
interface RevokeAllowanceParams {
|
|
1300
|
+
playbook_id: number;
|
|
1301
|
+
}
|
|
1302
|
+
interface RevokeAllowanceResponse {
|
|
1303
|
+
ok: boolean;
|
|
1304
|
+
}
|
|
1305
|
+
/**
|
|
1306
|
+
* Playbook function management. These functions are registered by a playbook
|
|
1307
|
+
* creator and invoked by released playbook UI through the browser UDF runtime.
|
|
1308
|
+
*/
|
|
1309
|
+
declare class FunctionsResource {
|
|
1310
|
+
private client;
|
|
1311
|
+
constructor(client: AlvaClient);
|
|
1312
|
+
register(params: RegisterFunctionParams): Promise<RegisterFunctionResponse>;
|
|
1313
|
+
list(params: ListFunctionsParams): Promise<ListFunctionsResponse>;
|
|
1314
|
+
delete(params: DeleteFunctionParams): Promise<void>;
|
|
1315
|
+
invoke<TResult = unknown>(params: InvokeFunctionParams): Promise<InvokeFunctionResponse<TResult>>;
|
|
1316
|
+
getAllowance(params: GetAllowanceParams): Promise<CreditAllowance | null>;
|
|
1317
|
+
listAllowances(): Promise<ListAllowancesResponse>;
|
|
1318
|
+
createAllowance(params: CreateAllowanceParams): Promise<CreateAllowanceResponse>;
|
|
1319
|
+
revokeAllowance(params: RevokeAllowanceParams): Promise<RevokeAllowanceResponse>;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1209
1322
|
interface RequestOptions {
|
|
1210
1323
|
query?: Record<string, unknown>;
|
|
1211
1324
|
body?: unknown;
|
|
@@ -1249,6 +1362,7 @@ declare class AlvaClient {
|
|
|
1249
1362
|
private _subscriptions?;
|
|
1250
1363
|
private _channelGroupSubscriptions?;
|
|
1251
1364
|
private _feedback?;
|
|
1365
|
+
private _functions?;
|
|
1252
1366
|
constructor(config: AlvaClientConfig);
|
|
1253
1367
|
get fs(): FsResource;
|
|
1254
1368
|
get run(): RunResource;
|
|
@@ -1272,6 +1386,7 @@ declare class AlvaClient {
|
|
|
1272
1386
|
get subscriptions(): SubscriptionsResource;
|
|
1273
1387
|
get channelGroupSubscriptions(): ChannelGroupSubscriptionsResource;
|
|
1274
1388
|
get feedback(): FeedbackResource;
|
|
1389
|
+
get functions(): FunctionsResource;
|
|
1275
1390
|
_requireAuth(): void;
|
|
1276
1391
|
_request(method: string, path: string, options?: RequestOptions): Promise<unknown>;
|
|
1277
1392
|
}
|
|
@@ -1293,6 +1408,20 @@ type UdfErrorBody = {
|
|
|
1293
1408
|
metadata?: Record<string, unknown>;
|
|
1294
1409
|
};
|
|
1295
1410
|
};
|
|
1411
|
+
type SubscribeProposalResult = 'subscribed' | 'declined' | 'timeout' | 'error';
|
|
1412
|
+
type SubscribeProposalInput = {
|
|
1413
|
+
feedOwner: string;
|
|
1414
|
+
feedName: string;
|
|
1415
|
+
};
|
|
1416
|
+
type SubscribeApi = {
|
|
1417
|
+
/**
|
|
1418
|
+
* Ask the parent (main site) to offer the viewer a subscription to a feed.
|
|
1419
|
+
* The iframe CANNOT subscribe directly — it only proposes; the trusted
|
|
1420
|
+
* parent shows a confirm prompt and, on user confirmation, subscribes with
|
|
1421
|
+
* the viewer's own session. Resolves with the outcome.
|
|
1422
|
+
*/
|
|
1423
|
+
propose: (input: SubscribeProposalInput) => Promise<SubscribeProposalResult>;
|
|
1424
|
+
};
|
|
1296
1425
|
type UdfDescriptor = {
|
|
1297
1426
|
name: string;
|
|
1298
1427
|
params_schema: unknown | null;
|
|
@@ -1341,6 +1470,7 @@ declare global {
|
|
|
1341
1470
|
interface Window {
|
|
1342
1471
|
alva?: {
|
|
1343
1472
|
udf?: UdfApi;
|
|
1473
|
+
subscribe?: SubscribeApi;
|
|
1344
1474
|
[key: string]: unknown;
|
|
1345
1475
|
};
|
|
1346
1476
|
}
|
|
@@ -1388,13 +1518,16 @@ declare const PBSV_UPDATE_MESSAGE = "alva:pbsv:update";
|
|
|
1388
1518
|
declare const UDF_CONSENT_REQUEST_MESSAGE = "alva:udf:consent-request";
|
|
1389
1519
|
declare const UDF_CONSENT_RESPONSE_MESSAGE = "alva:udf:consent-response";
|
|
1390
1520
|
declare const UDF_AUTH_REQUIRED_MESSAGE = "alva:udf:auth-required";
|
|
1521
|
+
declare const SUBSCRIBE_PROPOSE_MESSAGE = "alva:subscribe:propose";
|
|
1522
|
+
declare const SUBSCRIBE_RESULT_MESSAGE = "alva:subscribe:result";
|
|
1391
1523
|
declare const playbookIdFromToken: (token: string | null) => string | null;
|
|
1392
1524
|
declare const getViewerToken: () => string | null;
|
|
1393
1525
|
declare const mapUdfErrorResponse: (body: UdfErrorBody, status?: number) => UdfError;
|
|
1526
|
+
declare const subscribe: SubscribeApi;
|
|
1394
1527
|
declare const udf: UdfApi;
|
|
1395
1528
|
declare const installPlaybookRuntime: (targetWindow?: Window) => void;
|
|
1396
1529
|
|
|
1397
1530
|
/** SDK version, injected at build time from package.json. */
|
|
1398
1531
|
declare const VERSION: string;
|
|
1399
1532
|
|
|
1400
|
-
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 PlaybookSkillFile, type PlaybookSkillFileMeta, type PlaybookSkillMeta, type PlaybookSkillSummary, type PlaybookSkillTagEntry, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, type SubmitFeedbackRequest, type SubmitFeedbackResponse, 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, VERSION, getViewerToken, installPlaybookRuntime, mapUdfErrorResponse, playbookIdFromToken, udf };
|
|
1533
|
+
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 CreateAllowanceParams, type CreateAllowanceResponse, type CreditAllowance, type DeleteFunctionParams, type FeedDeleteRequest, type FeedDeleteResponse, type FeedStatusUpdateRequest, type FeedStatusUpdateResponse, 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 InvokeFunctionParams, type InvokeFunctionResponse, type ListAllowancesResponse, type ListFunctionsParams, type ListFunctionsResponse, type NotificationPreference, type NotificationPreferenceKey, type NotificationPreferenceUpdateParams, type NotificationPreferenceUpdateResponse, type NotificationPreferencesResponse, PBSV_UPDATE_MESSAGE, type PlaybookFunction, type PlaybookSkillFile, type PlaybookSkillFileMeta, type PlaybookSkillMeta, type PlaybookSkillSummary, type PlaybookSkillTagEntry, type RegisterFunctionParams, type RegisterFunctionResponse, type RevokeAllowanceParams, type RevokeAllowanceResponse, SUBSCRIBE_PROPOSE_MESSAGE, SUBSCRIBE_RESULT_MESSAGE, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, type SubmitFeedbackRequest, type SubmitFeedbackResponse, type SubscribeApi, 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, VERSION, getViewerToken, installPlaybookRuntime, mapUdfErrorResponse, playbookIdFromToken, subscribe, udf };
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ interface UserProfile {
|
|
|
13
13
|
username: string;
|
|
14
14
|
subscription_tier: 'free' | 'pro';
|
|
15
15
|
telegram_username: string | null;
|
|
16
|
+
slack_username: string | null;
|
|
16
17
|
/** Caller's alfs home directory, e.g. `/alva/home/<username>`. */
|
|
17
18
|
home_path: string;
|
|
18
19
|
}
|
|
@@ -228,6 +229,16 @@ interface FeedDeleteRequest {
|
|
|
228
229
|
/** Numeric feed id to delete. */
|
|
229
230
|
id: number;
|
|
230
231
|
}
|
|
232
|
+
interface FeedStatusUpdateRequest {
|
|
233
|
+
/** Numeric feed id to stop/resume. */
|
|
234
|
+
id: number;
|
|
235
|
+
}
|
|
236
|
+
interface FeedStatusUpdateResponse {
|
|
237
|
+
/** Echoed feed id (string form, matching gateway response). */
|
|
238
|
+
id: string;
|
|
239
|
+
/** Feed runtime status after the update. */
|
|
240
|
+
status: 'ACTIVE' | 'PAUSED' | 'UNSPECIFIED' | string;
|
|
241
|
+
}
|
|
231
242
|
interface FeedDeleteResponse {
|
|
232
243
|
/** Echoed feed id (string form, matching gateway response). */
|
|
233
244
|
id: string;
|
|
@@ -803,6 +814,19 @@ declare class ReleaseResource {
|
|
|
803
814
|
declare class FeedResource {
|
|
804
815
|
private client;
|
|
805
816
|
constructor(client: AlvaClient);
|
|
817
|
+
/**
|
|
818
|
+
* Stop a feed's producer cronjob. This pauses future scheduled runs while
|
|
819
|
+
* preserving the feed and its existing data.
|
|
820
|
+
*
|
|
821
|
+
* Auth: caller must own the feed (uid match), enforced by the backend.
|
|
822
|
+
*/
|
|
823
|
+
stop(params: FeedStatusUpdateRequest): Promise<FeedStatusUpdateResponse>;
|
|
824
|
+
/**
|
|
825
|
+
* Resume a stopped feed's producer cronjob.
|
|
826
|
+
*
|
|
827
|
+
* Auth: caller must own the feed (uid match), enforced by the backend.
|
|
828
|
+
*/
|
|
829
|
+
resume(params: FeedStatusUpdateRequest): Promise<FeedStatusUpdateResponse>;
|
|
806
830
|
/**
|
|
807
831
|
* Soft-delete a feed and all its active majors. Cascades:
|
|
808
832
|
* - all active feed_majors are soft-deleted in the same transaction
|
|
@@ -1206,6 +1230,95 @@ declare class FeedbackResource {
|
|
|
1206
1230
|
submit(params: SubmitFeedbackRequest): Promise<SubmitFeedbackResponse>;
|
|
1207
1231
|
}
|
|
1208
1232
|
|
|
1233
|
+
interface PlaybookFunction {
|
|
1234
|
+
id: string | number;
|
|
1235
|
+
playbook_id: string | number;
|
|
1236
|
+
function_name: string;
|
|
1237
|
+
entry_script_path: string;
|
|
1238
|
+
created_at?: string;
|
|
1239
|
+
updated_at?: string;
|
|
1240
|
+
disabled?: boolean;
|
|
1241
|
+
params_schema?: string;
|
|
1242
|
+
allow_charges?: boolean;
|
|
1243
|
+
}
|
|
1244
|
+
interface RegisterFunctionParams {
|
|
1245
|
+
playbook_id: number;
|
|
1246
|
+
function_name: string;
|
|
1247
|
+
entry_script_path: string;
|
|
1248
|
+
params_schema?: string;
|
|
1249
|
+
allow_charges?: boolean;
|
|
1250
|
+
}
|
|
1251
|
+
interface RegisterFunctionResponse {
|
|
1252
|
+
function?: PlaybookFunction;
|
|
1253
|
+
}
|
|
1254
|
+
interface ListFunctionsParams {
|
|
1255
|
+
playbook_id: number;
|
|
1256
|
+
}
|
|
1257
|
+
interface ListFunctionsResponse {
|
|
1258
|
+
functions: PlaybookFunction[];
|
|
1259
|
+
}
|
|
1260
|
+
interface DeleteFunctionParams {
|
|
1261
|
+
playbook_id: number;
|
|
1262
|
+
function_name: string;
|
|
1263
|
+
}
|
|
1264
|
+
interface InvokeFunctionParams {
|
|
1265
|
+
playbook_id: number;
|
|
1266
|
+
function_name: string;
|
|
1267
|
+
parameters?: unknown;
|
|
1268
|
+
}
|
|
1269
|
+
interface InvokeFunctionResponse<TResult = unknown> {
|
|
1270
|
+
result: TResult;
|
|
1271
|
+
logs: string;
|
|
1272
|
+
credits_used_total: number;
|
|
1273
|
+
credits_charged_owner: number;
|
|
1274
|
+
credits_charged_consumer: number;
|
|
1275
|
+
}
|
|
1276
|
+
interface CreditAllowance {
|
|
1277
|
+
id: string | number;
|
|
1278
|
+
consumer_uid: string | number;
|
|
1279
|
+
playbook_id: string | number;
|
|
1280
|
+
amount: number;
|
|
1281
|
+
used: number;
|
|
1282
|
+
remaining: number;
|
|
1283
|
+
created_at_ms?: number;
|
|
1284
|
+
updated_at_ms?: number;
|
|
1285
|
+
}
|
|
1286
|
+
interface GetAllowanceParams {
|
|
1287
|
+
playbook_id: number;
|
|
1288
|
+
}
|
|
1289
|
+
interface ListAllowancesResponse {
|
|
1290
|
+
allowances: CreditAllowance[];
|
|
1291
|
+
}
|
|
1292
|
+
interface CreateAllowanceParams {
|
|
1293
|
+
playbook_id: number;
|
|
1294
|
+
amount: number;
|
|
1295
|
+
}
|
|
1296
|
+
interface CreateAllowanceResponse {
|
|
1297
|
+
allowance: CreditAllowance;
|
|
1298
|
+
}
|
|
1299
|
+
interface RevokeAllowanceParams {
|
|
1300
|
+
playbook_id: number;
|
|
1301
|
+
}
|
|
1302
|
+
interface RevokeAllowanceResponse {
|
|
1303
|
+
ok: boolean;
|
|
1304
|
+
}
|
|
1305
|
+
/**
|
|
1306
|
+
* Playbook function management. These functions are registered by a playbook
|
|
1307
|
+
* creator and invoked by released playbook UI through the browser UDF runtime.
|
|
1308
|
+
*/
|
|
1309
|
+
declare class FunctionsResource {
|
|
1310
|
+
private client;
|
|
1311
|
+
constructor(client: AlvaClient);
|
|
1312
|
+
register(params: RegisterFunctionParams): Promise<RegisterFunctionResponse>;
|
|
1313
|
+
list(params: ListFunctionsParams): Promise<ListFunctionsResponse>;
|
|
1314
|
+
delete(params: DeleteFunctionParams): Promise<void>;
|
|
1315
|
+
invoke<TResult = unknown>(params: InvokeFunctionParams): Promise<InvokeFunctionResponse<TResult>>;
|
|
1316
|
+
getAllowance(params: GetAllowanceParams): Promise<CreditAllowance | null>;
|
|
1317
|
+
listAllowances(): Promise<ListAllowancesResponse>;
|
|
1318
|
+
createAllowance(params: CreateAllowanceParams): Promise<CreateAllowanceResponse>;
|
|
1319
|
+
revokeAllowance(params: RevokeAllowanceParams): Promise<RevokeAllowanceResponse>;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1209
1322
|
interface RequestOptions {
|
|
1210
1323
|
query?: Record<string, unknown>;
|
|
1211
1324
|
body?: unknown;
|
|
@@ -1249,6 +1362,7 @@ declare class AlvaClient {
|
|
|
1249
1362
|
private _subscriptions?;
|
|
1250
1363
|
private _channelGroupSubscriptions?;
|
|
1251
1364
|
private _feedback?;
|
|
1365
|
+
private _functions?;
|
|
1252
1366
|
constructor(config: AlvaClientConfig);
|
|
1253
1367
|
get fs(): FsResource;
|
|
1254
1368
|
get run(): RunResource;
|
|
@@ -1272,6 +1386,7 @@ declare class AlvaClient {
|
|
|
1272
1386
|
get subscriptions(): SubscriptionsResource;
|
|
1273
1387
|
get channelGroupSubscriptions(): ChannelGroupSubscriptionsResource;
|
|
1274
1388
|
get feedback(): FeedbackResource;
|
|
1389
|
+
get functions(): FunctionsResource;
|
|
1275
1390
|
_requireAuth(): void;
|
|
1276
1391
|
_request(method: string, path: string, options?: RequestOptions): Promise<unknown>;
|
|
1277
1392
|
}
|
|
@@ -1293,6 +1408,20 @@ type UdfErrorBody = {
|
|
|
1293
1408
|
metadata?: Record<string, unknown>;
|
|
1294
1409
|
};
|
|
1295
1410
|
};
|
|
1411
|
+
type SubscribeProposalResult = 'subscribed' | 'declined' | 'timeout' | 'error';
|
|
1412
|
+
type SubscribeProposalInput = {
|
|
1413
|
+
feedOwner: string;
|
|
1414
|
+
feedName: string;
|
|
1415
|
+
};
|
|
1416
|
+
type SubscribeApi = {
|
|
1417
|
+
/**
|
|
1418
|
+
* Ask the parent (main site) to offer the viewer a subscription to a feed.
|
|
1419
|
+
* The iframe CANNOT subscribe directly — it only proposes; the trusted
|
|
1420
|
+
* parent shows a confirm prompt and, on user confirmation, subscribes with
|
|
1421
|
+
* the viewer's own session. Resolves with the outcome.
|
|
1422
|
+
*/
|
|
1423
|
+
propose: (input: SubscribeProposalInput) => Promise<SubscribeProposalResult>;
|
|
1424
|
+
};
|
|
1296
1425
|
type UdfDescriptor = {
|
|
1297
1426
|
name: string;
|
|
1298
1427
|
params_schema: unknown | null;
|
|
@@ -1341,6 +1470,7 @@ declare global {
|
|
|
1341
1470
|
interface Window {
|
|
1342
1471
|
alva?: {
|
|
1343
1472
|
udf?: UdfApi;
|
|
1473
|
+
subscribe?: SubscribeApi;
|
|
1344
1474
|
[key: string]: unknown;
|
|
1345
1475
|
};
|
|
1346
1476
|
}
|
|
@@ -1388,13 +1518,16 @@ declare const PBSV_UPDATE_MESSAGE = "alva:pbsv:update";
|
|
|
1388
1518
|
declare const UDF_CONSENT_REQUEST_MESSAGE = "alva:udf:consent-request";
|
|
1389
1519
|
declare const UDF_CONSENT_RESPONSE_MESSAGE = "alva:udf:consent-response";
|
|
1390
1520
|
declare const UDF_AUTH_REQUIRED_MESSAGE = "alva:udf:auth-required";
|
|
1521
|
+
declare const SUBSCRIBE_PROPOSE_MESSAGE = "alva:subscribe:propose";
|
|
1522
|
+
declare const SUBSCRIBE_RESULT_MESSAGE = "alva:subscribe:result";
|
|
1391
1523
|
declare const playbookIdFromToken: (token: string | null) => string | null;
|
|
1392
1524
|
declare const getViewerToken: () => string | null;
|
|
1393
1525
|
declare const mapUdfErrorResponse: (body: UdfErrorBody, status?: number) => UdfError;
|
|
1526
|
+
declare const subscribe: SubscribeApi;
|
|
1394
1527
|
declare const udf: UdfApi;
|
|
1395
1528
|
declare const installPlaybookRuntime: (targetWindow?: Window) => void;
|
|
1396
1529
|
|
|
1397
1530
|
/** SDK version, injected at build time from package.json. */
|
|
1398
1531
|
declare const VERSION: string;
|
|
1399
1532
|
|
|
1400
|
-
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 PlaybookSkillFile, type PlaybookSkillFileMeta, type PlaybookSkillMeta, type PlaybookSkillSummary, type PlaybookSkillTagEntry, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, type SubmitFeedbackRequest, type SubmitFeedbackResponse, 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, VERSION, getViewerToken, installPlaybookRuntime, mapUdfErrorResponse, playbookIdFromToken, udf };
|
|
1533
|
+
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 CreateAllowanceParams, type CreateAllowanceResponse, type CreditAllowance, type DeleteFunctionParams, type FeedDeleteRequest, type FeedDeleteResponse, type FeedStatusUpdateRequest, type FeedStatusUpdateResponse, 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 InvokeFunctionParams, type InvokeFunctionResponse, type ListAllowancesResponse, type ListFunctionsParams, type ListFunctionsResponse, type NotificationPreference, type NotificationPreferenceKey, type NotificationPreferenceUpdateParams, type NotificationPreferenceUpdateResponse, type NotificationPreferencesResponse, PBSV_UPDATE_MESSAGE, type PlaybookFunction, type PlaybookSkillFile, type PlaybookSkillFileMeta, type PlaybookSkillMeta, type PlaybookSkillSummary, type PlaybookSkillTagEntry, type RegisterFunctionParams, type RegisterFunctionResponse, type RevokeAllowanceParams, type RevokeAllowanceResponse, SUBSCRIBE_PROPOSE_MESSAGE, SUBSCRIBE_RESULT_MESSAGE, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, type SubmitFeedbackRequest, type SubmitFeedbackResponse, type SubscribeApi, 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, VERSION, getViewerToken, installPlaybookRuntime, mapUdfErrorResponse, playbookIdFromToken, subscribe, udf };
|