@alva-ai/toolkit 0.16.1-beta.0 → 0.16.1-beta.2
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/browser.global.js +2 -2
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.d.ts +92 -96
- package/dist/cli.js +299 -193
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +50 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +93 -97
- package/dist/index.d.ts +93 -97
- package/dist/index.js +50 -46
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.d.ts
CHANGED
|
@@ -15,9 +15,14 @@ interface AlvaClientConfig {
|
|
|
15
15
|
interface UserProfile {
|
|
16
16
|
id: string;
|
|
17
17
|
username: string;
|
|
18
|
-
subscription_tier: 'free' | 'pro';
|
|
19
|
-
telegram_username: string
|
|
20
|
-
|
|
18
|
+
subscription_tier: 'free' | 'pro' | 'max';
|
|
19
|
+
telegram_username: string;
|
|
20
|
+
discord_username: string;
|
|
21
|
+
slack_username: string;
|
|
22
|
+
whatsapp_username: string;
|
|
23
|
+
imessage_username: string;
|
|
24
|
+
active_channel: string;
|
|
25
|
+
toolkit_min_version: string;
|
|
21
26
|
/** Caller's alfs home directory, e.g. `/alva/home/<username>`. */
|
|
22
27
|
home_path: string;
|
|
23
28
|
}
|
|
@@ -88,12 +93,16 @@ interface FsWriteParams {
|
|
|
88
93
|
path: string;
|
|
89
94
|
data: string;
|
|
90
95
|
mkdir_parents?: boolean;
|
|
96
|
+
/** Append to the existing file instead of overwriting it. */
|
|
97
|
+
append?: boolean;
|
|
91
98
|
}
|
|
92
99
|
interface FsRawWriteParams {
|
|
93
100
|
path: string;
|
|
94
101
|
/** Raw file content: string, ArrayBuffer, Uint8Array, Blob, etc. */
|
|
95
102
|
body: BodyInit;
|
|
96
103
|
mkdir_parents?: boolean;
|
|
104
|
+
/** Append to the existing file instead of overwriting it. */
|
|
105
|
+
append?: boolean;
|
|
97
106
|
}
|
|
98
107
|
interface FsWriteResponse {
|
|
99
108
|
bytes_written: number;
|
|
@@ -194,13 +203,14 @@ interface CronjobCreateRequest {
|
|
|
194
203
|
* A string: SA ids are snowflake int64s that overflow JS number precision.
|
|
195
204
|
*/
|
|
196
205
|
run_as_user_id?: string;
|
|
206
|
+
/** Inclusive RFC3339 lower bound. Omitted means start now (server clock). */
|
|
207
|
+
start_at?: string;
|
|
197
208
|
/**
|
|
198
|
-
*
|
|
199
|
-
* self-terminates the cronjob before running (backend#1799). Omitted ⇒ no
|
|
200
|
-
* expiry. The `alva loop create` sugar sets this to now + (expires_in ?? 7d);
|
|
201
|
-
* feeds and other crons leave it unset.
|
|
209
|
+
* Exclusive RFC3339 upper bound. A run is admitted only while now < end_at.
|
|
202
210
|
*/
|
|
203
211
|
end_at?: string;
|
|
212
|
+
/** Maximum number of admitted runs. */
|
|
213
|
+
max_runs?: number;
|
|
204
214
|
}
|
|
205
215
|
interface Cronjob {
|
|
206
216
|
id: number;
|
|
@@ -217,11 +227,17 @@ interface Cronjob {
|
|
|
217
227
|
* A string: snowflake int64 ids overflow JS number precision.
|
|
218
228
|
*/
|
|
219
229
|
run_as_user_id: string;
|
|
230
|
+
/** Inclusive eligibility lower bound, resolved by the server on create. */
|
|
231
|
+
start_at?: string | null;
|
|
220
232
|
/**
|
|
221
233
|
* Lifetime ceiling (RFC3339), or null/omitted when the cronjob has no expiry.
|
|
222
234
|
* Set by `alva loop create`; unset for feeds and other crons.
|
|
223
235
|
*/
|
|
224
236
|
end_at?: string | null;
|
|
237
|
+
/** Maximum admitted runs, or null when unbounded by count. */
|
|
238
|
+
max_runs?: number | null;
|
|
239
|
+
/** Number of runs admitted so far. */
|
|
240
|
+
run_count: number;
|
|
225
241
|
created_at: string;
|
|
226
242
|
updated_at: string;
|
|
227
243
|
}
|
|
@@ -282,6 +298,22 @@ interface CronjobRunsListResponse {
|
|
|
282
298
|
stats?: CronjobRunStats;
|
|
283
299
|
next_cursor?: number;
|
|
284
300
|
}
|
|
301
|
+
interface CronjobRunStatusParams {
|
|
302
|
+
cronjob_id: number;
|
|
303
|
+
workflow_run_id: string;
|
|
304
|
+
}
|
|
305
|
+
interface CronjobRunStatusResponse {
|
|
306
|
+
workflow_run_id: string;
|
|
307
|
+
/**
|
|
308
|
+
* PENDING means no cronjob_runs row exists yet. It is not falsifiable:
|
|
309
|
+
* a mistyped workflow_run_id, a workflow_run_id from another cronjob, or
|
|
310
|
+
* a workflow that failed before persistence can remain PENDING forever.
|
|
311
|
+
* DISPATCHED and RUNNING mean an in-flight row exists. Pollers must stop
|
|
312
|
+
* on their own deadline if the run never reaches a terminal state.
|
|
313
|
+
*/
|
|
314
|
+
state: 'PENDING' | 'DISPATCHED' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'SKIPPED' | 'UNSPECIFIED' | string;
|
|
315
|
+
run?: CronjobRun;
|
|
316
|
+
}
|
|
285
317
|
interface CronjobRunLogsResponse {
|
|
286
318
|
logs: string;
|
|
287
319
|
}
|
|
@@ -289,8 +321,9 @@ interface CronjobTriggerResponse {
|
|
|
289
321
|
/**
|
|
290
322
|
* Hatchet workflow run id at enqueue. Async — the persisted
|
|
291
323
|
* `cronjob_runs` row appears only after the worker finishes the run.
|
|
292
|
-
* Callers verify completion by polling
|
|
293
|
-
*
|
|
324
|
+
* Callers verify completion by polling
|
|
325
|
+
* `deploy.getRunStatus({cronjob_id, workflow_run_id})` with their own
|
|
326
|
+
* timeout/deadline.
|
|
294
327
|
*/
|
|
295
328
|
workflow_run_id: string;
|
|
296
329
|
}
|
|
@@ -705,17 +738,7 @@ interface NotificationEvent {
|
|
|
705
738
|
created_at: number;
|
|
706
739
|
message?: string;
|
|
707
740
|
error_msg?: string;
|
|
708
|
-
|
|
709
|
-
playbook_id?: string;
|
|
710
|
-
/** Present when notification is feed-scoped. */
|
|
711
|
-
feed_id?: string;
|
|
712
|
-
}
|
|
713
|
-
interface PlaybookNotificationListResponse {
|
|
714
|
-
items: NotificationEvent[];
|
|
715
|
-
/** Empty when there is no next page. */
|
|
716
|
-
next_cursor: string;
|
|
717
|
-
/** Canonical alfs path: `/alva/home/<username>/playbooks/<name>`. */
|
|
718
|
-
playbook_path: string;
|
|
741
|
+
feed_id: string;
|
|
719
742
|
}
|
|
720
743
|
interface FeedNotificationListResponse {
|
|
721
744
|
items: NotificationEvent[];
|
|
@@ -757,13 +780,8 @@ interface SubmitFeedbackResponse {
|
|
|
757
780
|
notion_page_id: string;
|
|
758
781
|
notion_url: string;
|
|
759
782
|
}
|
|
760
|
-
/**
|
|
761
|
-
|
|
762
|
-
* `PLAYBOOK` is the only target supported today; `FEED` is reserved for
|
|
763
|
-
* a future phase where users can subscribe to a feed independent of any
|
|
764
|
-
* playbook that consumes it.
|
|
765
|
-
*/
|
|
766
|
-
type PushTargetType = 'PLAYBOOK' | 'FEED' | 'UNSPECIFIED';
|
|
783
|
+
/** Personal alert subscriptions are keyed only to feeds. */
|
|
784
|
+
type PushTargetType = 'FEED';
|
|
767
785
|
interface PushTarget {
|
|
768
786
|
type: PushTargetType;
|
|
769
787
|
/** Numeric id encoded as a string (matches the rest of the SDK). */
|
|
@@ -783,29 +801,13 @@ interface PushSubscription {
|
|
|
783
801
|
/** Playbooks whose latest release currently references this feed. */
|
|
784
802
|
used_by?: PushSubscriptionUsedBy[];
|
|
785
803
|
used_by_total?: number;
|
|
804
|
+
/** Row-shape discriminator. */
|
|
805
|
+
kind?: 'FEED_ALERT';
|
|
786
806
|
/**
|
|
787
|
-
*
|
|
788
|
-
*
|
|
789
|
-
* FEED_ALERT = a single feed's alert.
|
|
790
|
-
*/
|
|
791
|
-
kind?: 'PLAYBOOK_ALERTS' | 'FEED_ALERT' | 'UNSPECIFIED' | string;
|
|
792
|
-
/**
|
|
793
|
-
* Whether the caller also FOLLOWS the target playbook — the social
|
|
794
|
-
* relation, distinct from this alert row. Always false for FEED targets.
|
|
795
|
-
*/
|
|
796
|
-
following?: boolean;
|
|
797
|
-
/**
|
|
798
|
-
* Target lifecycle: TARGET_DELETED marks a ghost row (the playbook/feed
|
|
799
|
-
* was deleted) — clear it with unsubscribeBatch by target id.
|
|
807
|
+
* Target lifecycle. TARGET_DELETED marks a feed row whose target was
|
|
808
|
+
* deleted; clear it with unsubscribeBatch by target id.
|
|
800
809
|
*/
|
|
801
810
|
target_status?: 'ACTIVE' | 'TARGET_DELETED' | 'PAUSED' | 'UNSPECIFIED' | string;
|
|
802
|
-
/** Playbook identity, present for PLAYBOOK targets on list responses. */
|
|
803
|
-
playbook?: PushSubscriptionPlaybookInfo;
|
|
804
|
-
}
|
|
805
|
-
interface PushSubscriptionPlaybookInfo {
|
|
806
|
-
owner_username: string;
|
|
807
|
-
name: string;
|
|
808
|
-
display_name: string;
|
|
809
811
|
}
|
|
810
812
|
interface PushSubscriptionUsedBy {
|
|
811
813
|
playbook_id: string;
|
|
@@ -814,7 +816,7 @@ interface PushSubscriptionUsedBy {
|
|
|
814
816
|
display_name: string;
|
|
815
817
|
owner_avatar_url: string;
|
|
816
818
|
}
|
|
817
|
-
interface
|
|
819
|
+
interface PlaybookFollowParams {
|
|
818
820
|
username: string;
|
|
819
821
|
name: string;
|
|
820
822
|
}
|
|
@@ -858,14 +860,21 @@ interface FollowsListResponse {
|
|
|
858
860
|
next_cursor?: string;
|
|
859
861
|
}
|
|
860
862
|
interface UnsubscribeBatchParams {
|
|
861
|
-
/**
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
863
|
+
/** Feed target ids (strings — snowflake ids exceed JS safe integers). */
|
|
864
|
+
feedIds: string[];
|
|
865
|
+
}
|
|
866
|
+
interface SubscribeBatchParams {
|
|
867
|
+
/** Feed target ids (strings — snowflake ids exceed JS safe integers). */
|
|
868
|
+
feedIds: string[];
|
|
869
|
+
/** Delivery channel id. Omit for the user's agent/home channel. */
|
|
870
|
+
channelId?: string;
|
|
871
|
+
}
|
|
872
|
+
interface SubscribeBatchResponse {
|
|
873
|
+
subscriptions: PushSubscription[];
|
|
865
874
|
}
|
|
866
875
|
interface UnsubscribeBatchResult {
|
|
867
876
|
id: string;
|
|
868
|
-
kind: '
|
|
877
|
+
kind: 'FEED';
|
|
869
878
|
ok: boolean;
|
|
870
879
|
status: 'UNSUBSCRIBED' | 'INVALID_ID' | string;
|
|
871
880
|
}
|
|
@@ -880,14 +889,16 @@ interface PlaybookFollow {
|
|
|
880
889
|
created_at_ms: number;
|
|
881
890
|
updated_at_ms: number;
|
|
882
891
|
}
|
|
883
|
-
interface
|
|
884
|
-
/** The follow row created
|
|
892
|
+
interface FollowPlaybookResponse {
|
|
893
|
+
/** The social follow row created or confirmed by this operation. */
|
|
885
894
|
follow: PlaybookFollow;
|
|
886
|
-
/** Feed ids whose alert this subscribe enabled (push-enabled automations). */
|
|
887
|
-
subscribed_feed_ids: string[];
|
|
888
895
|
/** Canonical alfs path: `/alva/home/<username>/playbooks/<name>`. */
|
|
889
896
|
playbook_path: string;
|
|
890
897
|
}
|
|
898
|
+
interface UnfollowPlaybookResponse {
|
|
899
|
+
ok: true;
|
|
900
|
+
unfollowed: boolean;
|
|
901
|
+
}
|
|
891
902
|
interface SubscribeFeedResponse {
|
|
892
903
|
subscription: PushSubscription;
|
|
893
904
|
/** Canonical alfs path: `/alva/home/<username>/feeds/<name>`. */
|
|
@@ -896,9 +907,9 @@ interface SubscribeFeedResponse {
|
|
|
896
907
|
interface UnsubscribeResponse {
|
|
897
908
|
ok: true;
|
|
898
909
|
}
|
|
899
|
-
type ChannelGroupSubscriptionTargetType = 'feed'
|
|
910
|
+
type ChannelGroupSubscriptionTargetType = 'feed';
|
|
900
911
|
interface ChannelGroupSubscriptionTarget {
|
|
901
|
-
type: ChannelGroupSubscriptionTargetType
|
|
912
|
+
type: ChannelGroupSubscriptionTargetType;
|
|
902
913
|
id: number;
|
|
903
914
|
}
|
|
904
915
|
interface ChannelGroupSubscription {
|
|
@@ -923,7 +934,7 @@ interface ChannelGroupSubscriptionSessionParams {
|
|
|
923
934
|
session_id: number | string;
|
|
924
935
|
}
|
|
925
936
|
interface ChannelGroupSubscriptionMutationParams extends ChannelGroupSubscriptionSessionParams {
|
|
926
|
-
target_type:
|
|
937
|
+
target_type: 'feed';
|
|
927
938
|
target_id: number | string;
|
|
928
939
|
}
|
|
929
940
|
interface ChannelGroupSubscriptionContextResponse {
|
|
@@ -1045,9 +1056,10 @@ declare class DeployResource {
|
|
|
1045
1056
|
/**
|
|
1046
1057
|
* Fire the cronjob workflow once, immediately, bypassing the schedule.
|
|
1047
1058
|
* Async — returns the Hatchet workflow run id at enqueue. The
|
|
1048
|
-
* `cronjob_runs` row
|
|
1049
|
-
* callers verify completion by polling
|
|
1050
|
-
*
|
|
1059
|
+
* `cronjob_runs` row can appear as DISPATCHED/RUNNING before it reaches a
|
|
1060
|
+
* terminal status; callers verify completion by polling
|
|
1061
|
+
* `getRunStatus({cronjob_id, workflow_run_id})` with their own
|
|
1062
|
+
* timeout/deadline.
|
|
1051
1063
|
*
|
|
1052
1064
|
* Surfaces backend status as HTTP errors (handled by AlvaClient):
|
|
1053
1065
|
* - 404 not found / cross-user
|
|
@@ -1058,6 +1070,7 @@ declare class DeployResource {
|
|
|
1058
1070
|
id: number;
|
|
1059
1071
|
}): Promise<CronjobTriggerResponse>;
|
|
1060
1072
|
listRuns(params: CronjobRunsListParams): Promise<CronjobRunsListResponse>;
|
|
1073
|
+
getRunStatus(params: CronjobRunStatusParams): Promise<CronjobRunStatusResponse>;
|
|
1061
1074
|
getRunLogs(params: {
|
|
1062
1075
|
cronjob_id: number;
|
|
1063
1076
|
run_id: number;
|
|
@@ -1510,13 +1523,6 @@ declare class ArraysJwtResource {
|
|
|
1510
1523
|
declare class NotificationsResource {
|
|
1511
1524
|
private client;
|
|
1512
1525
|
constructor(client: AlvaClient);
|
|
1513
|
-
/**
|
|
1514
|
-
* List the caller's notification history for one playbook
|
|
1515
|
-
* `(username, name)`. Returns `NOT_FOUND` when the playbook is
|
|
1516
|
-
* private or does not exist (the two cases are deliberately
|
|
1517
|
-
* indistinguishable to prevent namespace enumeration).
|
|
1518
|
-
*/
|
|
1519
|
-
listPlaybook(params: NotificationListParams): Promise<PlaybookNotificationListResponse>;
|
|
1520
1526
|
/**
|
|
1521
1527
|
* List the caller's notification history for one feed
|
|
1522
1528
|
* `(username, name)`. Authorization is alfs read on
|
|
@@ -1540,7 +1546,7 @@ declare class NotificationPreferencesResource {
|
|
|
1540
1546
|
}
|
|
1541
1547
|
|
|
1542
1548
|
/**
|
|
1543
|
-
*
|
|
1549
|
+
* Playbook follows and FEED alert subscriptions.
|
|
1544
1550
|
*
|
|
1545
1551
|
* Three DISTINCT concepts share the word "subscribe" in the product; this
|
|
1546
1552
|
* resource touches the first two and never the third:
|
|
@@ -1551,33 +1557,26 @@ declare class NotificationPreferencesResource {
|
|
|
1551
1557
|
* - **purchase** — paid playbook access / the SaaS plan. NOT this resource.
|
|
1552
1558
|
*
|
|
1553
1559
|
* Operations:
|
|
1554
|
-
* - `
|
|
1555
|
-
* personal push for every push-enabled automation of its latest release,
|
|
1556
|
-
* in one call. `unsubscribePlaybook` reverses both (unfollow + disable
|
|
1557
|
-
* the playbook-level alert) and reports exactly what it changed.
|
|
1560
|
+
* - `followPlaybook` / `unfollowPlaybook` change only the social follow.
|
|
1558
1561
|
* - `subscribeFeed` / `unsubscribeFeed` toggle personal push for ONE feed
|
|
1559
1562
|
* (a single automation's alert) without touching the playbook follow.
|
|
1560
|
-
* - `unsubscribeBatch`
|
|
1561
|
-
* and the only way to clear ghost rows whose target was deleted
|
|
1562
|
-
* (name-addressed unsubscribe 404s on deleted playbooks).
|
|
1563
|
+
* - `subscribeBatch` / `unsubscribeBatch` toggle FEED alerts by target id.
|
|
1563
1564
|
*
|
|
1564
|
-
* Backed by alva-gateway REST under `/api/v1/
|
|
1565
|
+
* Backed by alva-gateway REST under `/api/v1/follows/...` and
|
|
1566
|
+
* `/api/v1/subscriptions/...`.
|
|
1565
1567
|
*/
|
|
1566
1568
|
declare class SubscriptionsResource {
|
|
1567
1569
|
private client;
|
|
1568
1570
|
constructor(client: AlvaClient);
|
|
1569
1571
|
/**
|
|
1570
|
-
*
|
|
1571
|
-
*
|
|
1572
|
-
* able to read the playbook — public passes; paid requires an active unlock;
|
|
1573
|
-
* private requires owner/admin.
|
|
1572
|
+
* Follow a playbook `(username, name)`. Alerts are independent and require
|
|
1573
|
+
* explicit FEED subscriptions. Idempotent.
|
|
1574
1574
|
*/
|
|
1575
|
-
|
|
1575
|
+
followPlaybook(params: PlaybookFollowParams): Promise<FollowPlaybookResponse>;
|
|
1576
1576
|
/**
|
|
1577
|
-
*
|
|
1578
|
-
* all of its push alerts for the caller. Idempotent.
|
|
1577
|
+
* Unfollow a playbook `(username, name)` without changing FEED alerts.
|
|
1579
1578
|
*/
|
|
1580
|
-
|
|
1579
|
+
unfollowPlaybook(params: PlaybookFollowParams): Promise<UnfollowPlaybookResponse>;
|
|
1581
1580
|
/**
|
|
1582
1581
|
* Subscribe to one feed `(username, name)` — enable personal push for that
|
|
1583
1582
|
* single automation's alerts, regardless of which playbook(s) consume it.
|
|
@@ -1600,12 +1599,11 @@ declare class SubscriptionsResource {
|
|
|
1600
1599
|
* deleted playbooks are filtered server-side. Cursor-paginated.
|
|
1601
1600
|
*/
|
|
1602
1601
|
follows(params?: FollowsListParams): Promise<FollowsListResponse>;
|
|
1602
|
+
/** Atomically enable alerts for FEED target ids (max 100). */
|
|
1603
|
+
subscribeBatch(params: SubscribeBatchParams): Promise<SubscribeBatchResponse>;
|
|
1603
1604
|
/**
|
|
1604
|
-
* Disable alerts for many
|
|
1605
|
-
*
|
|
1606
|
-
* for ghost rows (deleted targets) because no name resolution happens —
|
|
1607
|
-
* the per-id results report `INVALID_ID` for malformed entries while
|
|
1608
|
-
* valid ones proceed. Safe to re-run: already-gone rows are no-ops.
|
|
1605
|
+
* Disable alerts for many FEED targets by id in one idempotent call (max
|
|
1606
|
+
* 100 ids). The per-id results report `INVALID_ID` for malformed entries.
|
|
1609
1607
|
*/
|
|
1610
1608
|
unsubscribeBatch(params: UnsubscribeBatchParams): Promise<UnsubscribeBatchResponse>;
|
|
1611
1609
|
}
|
|
@@ -1621,11 +1619,9 @@ declare class AlertsResource {
|
|
|
1621
1619
|
follows(params?: FollowsListParams): Promise<FollowsListResponse>;
|
|
1622
1620
|
enableAutomation(params: PushSubscriptionFeedParams): Promise<SubscribeFeedResponse>;
|
|
1623
1621
|
disableAutomation(params: PushSubscriptionFeedParams): Promise<UnsubscribeResponse>;
|
|
1624
|
-
|
|
1625
|
-
disablePlaybook(params: PushSubscriptionPlaybookParams): Promise<UnsubscribeResponse>;
|
|
1622
|
+
enableBatch(params: SubscribeBatchParams): Promise<SubscribeBatchResponse>;
|
|
1626
1623
|
disableBatch(params: UnsubscribeBatchParams): Promise<UnsubscribeBatchResponse>;
|
|
1627
1624
|
historyAutomation(params: NotificationListParams): Promise<FeedNotificationListResponse>;
|
|
1628
|
-
historyPlaybook(params: NotificationListParams): Promise<PlaybookNotificationListResponse>;
|
|
1629
1625
|
preferences(): Promise<NotificationPreferencesResponse>;
|
|
1630
1626
|
updatePreference(params: NotificationPreferenceUpdateParams): Promise<NotificationPreferenceUpdateResponse>;
|
|
1631
1627
|
}
|
|
@@ -1634,7 +1630,7 @@ declare class AlertsResource {
|
|
|
1634
1630
|
* Group push subscriptions for an external channel session.
|
|
1635
1631
|
*
|
|
1636
1632
|
* These APIs subscribe the Telegram/Discord group attached to `session_id`
|
|
1637
|
-
* to public feed
|
|
1633
|
+
* to public feed push events. Mutations are idempotent no-ops unless
|
|
1638
1634
|
* the authenticated caller is that group's Alva admin.
|
|
1639
1635
|
*/
|
|
1640
1636
|
declare class ChannelGroupSubscriptionsResource {
|