@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/index.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 | null;
20
- slack_username: string | null;
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
- * Lifetime ceiling (RFC3339 timestamp). Once now >= end_at the runner
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 `deploy.listRuns({cronjob_id})`
293
- * and matching `runs[].workflow_run_id` against this value.
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
- /** Present when notification is playbook-scoped. */
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
- * Identifies the asset a personal push subscription is keyed to.
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
- * Row-shape discriminator: PLAYBOOK_ALERTS = a playbook-level wildcard
788
- * (alerts for every push-enabled automation of the playbook);
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 PushSubscriptionPlaybookParams {
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
- /** Playbook target ids (strings — snowflake ids exceed JS safe integers). */
862
- playbookIds?: string[];
863
- /** Feed target ids (strings). */
864
- feedIds?: string[];
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: 'PLAYBOOK' | 'FEED' | string;
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 SubscribePlaybookResponse {
884
- /** The follow row created (or confirmed) by the cascade subscribe. */
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' | 'playbook';
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: ChannelGroupSubscriptionTargetType;
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 appears only after the worker finishes the run;
1049
- * callers verify completion by polling `listRuns({cronjob_id})` and
1050
- * matching `runs[].workflow_run_id` against the returned id.
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
- * Subscriptions — subscribe the caller to playbooks and feeds.
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
- * - `subscribePlaybook` is a CASCADE: it follows the playbook AND enables
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` disables alerts by TARGET ID — bulk, idempotent,
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/subscriptions/...`.
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
- * Subscribe to a playbook `(username, name)`: follow it and enable alerts
1571
- * on all its push-enabled automations. Idempotent. Auth: the caller must be
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
- subscribePlaybook(params: PushSubscriptionPlaybookParams): Promise<SubscribePlaybookResponse>;
1575
+ followPlaybook(params: PlaybookFollowParams): Promise<FollowPlaybookResponse>;
1576
1576
  /**
1577
- * Unsubscribe from a playbook `(username, name)`: unfollow it and disable
1578
- * all of its push alerts for the caller. Idempotent.
1577
+ * Unfollow a playbook `(username, name)` without changing FEED alerts.
1579
1578
  */
1580
- unsubscribePlaybook(params: PushSubscriptionPlaybookParams): Promise<UnsubscribeResponse>;
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 playbook/feed targets BY TARGET ID in one
1605
- * idempotent call (max 100 ids). Ids are strings (snowflake-safe). Works
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
- enablePlaybook(params: PushSubscriptionPlaybookParams): Promise<SubscribePlaybookResponse>;
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/playbook push events. Mutations are idempotent no-ops unless
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 {
@@ -2002,4 +1998,4 @@ declare const installPlaybookRuntime: (targetWindow?: Window) => void;
2002
1998
  /** SDK version, injected at build time from package.json. */
2003
1999
  declare const VERSION: string;
2004
2000
 
2005
- export { AlertsResource, AlvaClient, type AlvaClientConfig, AlvaError, 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 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 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 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 };
2001
+ export { AlertsResource, AlvaClient, type AlvaClientConfig, AlvaError, 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 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 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_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 };
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ var CliUsageError = class extends Error {
21
21
  };
22
22
 
23
23
  // src/resources/fs.ts
24
+ var WRITE_FLAG_APPEND = 1 << 0;
24
25
  function isValidUtf8(bytes) {
25
26
  let i = 0;
26
27
  while (i < bytes.length) {
@@ -88,7 +89,8 @@ var FsResource = class {
88
89
  body: {
89
90
  path: params.path,
90
91
  data: params.data,
91
- mkdir_parents: params.mkdir_parents
92
+ mkdir_parents: params.mkdir_parents,
93
+ ...params.append ? { flags: WRITE_FLAG_APPEND } : {}
92
94
  }
93
95
  });
94
96
  }
@@ -98,7 +100,8 @@ var FsResource = class {
98
100
  return this.client._request("POST", "/api/v1/fs/write", {
99
101
  query: {
100
102
  path: params.path,
101
- mkdir_parents: params.mkdir_parents
103
+ mkdir_parents: params.mkdir_parents,
104
+ ...params.append ? { flags: WRITE_FLAG_APPEND } : {}
102
105
  },
103
106
  rawBody: params.body
104
107
  });
@@ -220,7 +223,9 @@ var DeployResource = class {
220
223
  push_notify: params.push_notify,
221
224
  max_heap_size_mb: params.max_heap_size_mb,
222
225
  run_as_user_id: params.run_as_user_id,
223
- end_at: params.end_at
226
+ start_at: params.start_at,
227
+ end_at: params.end_at,
228
+ max_runs: params.max_runs
224
229
  }
225
230
  });
226
231
  }
@@ -265,9 +270,10 @@ var DeployResource = class {
265
270
  /**
266
271
  * Fire the cronjob workflow once, immediately, bypassing the schedule.
267
272
  * Async — returns the Hatchet workflow run id at enqueue. The
268
- * `cronjob_runs` row appears only after the worker finishes the run;
269
- * callers verify completion by polling `listRuns({cronjob_id})` and
270
- * matching `runs[].workflow_run_id` against the returned id.
273
+ * `cronjob_runs` row can appear as DISPATCHED/RUNNING before it reaches a
274
+ * terminal status; callers verify completion by polling
275
+ * `getRunStatus({cronjob_id, workflow_run_id})` with their own
276
+ * timeout/deadline.
271
277
  *
272
278
  * Surfaces backend status as HTTP errors (handled by AlvaClient):
273
279
  * - 404 not found / cross-user
@@ -291,6 +297,13 @@ var DeployResource = class {
291
297
  }
292
298
  );
293
299
  }
300
+ async getRunStatus(params) {
301
+ this.client._requireAuth();
302
+ return this.client._request(
303
+ "GET",
304
+ `/api/v1/deploy/cronjob/${params.cronjob_id}/runs/by-workflow/${encodeURIComponent(params.workflow_run_id)}`
305
+ );
306
+ }
294
307
  async getRunLogs(params) {
295
308
  this.client._requireAuth();
296
309
  return this.client._request(
@@ -2326,19 +2339,6 @@ var NotificationsResource = class {
2326
2339
  this.client = client;
2327
2340
  }
2328
2341
  client;
2329
- /**
2330
- * List the caller's notification history for one playbook
2331
- * `(username, name)`. Returns `NOT_FOUND` when the playbook is
2332
- * private or does not exist (the two cases are deliberately
2333
- * indistinguishable to prevent namespace enumeration).
2334
- */
2335
- async listPlaybook(params) {
2336
- this.client._requireAuth();
2337
- const path = `/api/v1/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}/notifications`;
2338
- return this.client._request("GET", path, {
2339
- query: buildQuery(params)
2340
- });
2341
- }
2342
2342
  /**
2343
2343
  * List the caller's notification history for one feed
2344
2344
  * `(username, name)`. Authorization is alfs read on
@@ -2405,27 +2405,27 @@ var SubscriptionsResource = class {
2405
2405
  }
2406
2406
  client;
2407
2407
  /**
2408
- * Subscribe to a playbook `(username, name)`: follow it and enable alerts
2409
- * on all its push-enabled automations. Idempotent. Auth: the caller must be
2410
- * able to read the playbook — public passes; paid requires an active unlock;
2411
- * private requires owner/admin.
2408
+ * Follow a playbook `(username, name)`. Alerts are independent and require
2409
+ * explicit FEED subscriptions. Idempotent.
2412
2410
  */
2413
- async subscribePlaybook(params) {
2411
+ async followPlaybook(params) {
2414
2412
  this.client._requireAuth();
2415
- const path = `/api/v1/subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
2413
+ const path = `/api/v1/follows/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
2416
2414
  return this.client._request(
2417
2415
  "POST",
2418
2416
  path
2419
2417
  );
2420
2418
  }
2421
2419
  /**
2422
- * Unsubscribe from a playbook `(username, name)`: unfollow it and disable
2423
- * all of its push alerts for the caller. Idempotent.
2420
+ * Unfollow a playbook `(username, name)` without changing FEED alerts.
2424
2421
  */
2425
- async unsubscribePlaybook(params) {
2422
+ async unfollowPlaybook(params) {
2426
2423
  this.client._requireAuth();
2427
- const path = `/api/v1/subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
2428
- return this.client._request("DELETE", path);
2424
+ const path = `/api/v1/follows/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
2425
+ return this.client._request(
2426
+ "DELETE",
2427
+ path
2428
+ );
2429
2429
  }
2430
2430
  /**
2431
2431
  * Subscribe to one feed `(username, name)` — enable personal push for that
@@ -2477,12 +2477,23 @@ var SubscriptionsResource = class {
2477
2477
  query
2478
2478
  });
2479
2479
  }
2480
+ /** Atomically enable alerts for FEED target ids (max 100). */
2481
+ async subscribeBatch(params) {
2482
+ this.client._requireAuth();
2483
+ return this.client._request(
2484
+ "POST",
2485
+ "/api/v1/subscriptions/subscribe-batch",
2486
+ {
2487
+ body: {
2488
+ feed_ids: params.feedIds,
2489
+ channel_id: params.channelId
2490
+ }
2491
+ }
2492
+ );
2493
+ }
2480
2494
  /**
2481
- * Disable alerts for many playbook/feed targets BY TARGET ID in one
2482
- * idempotent call (max 100 ids). Ids are strings (snowflake-safe). Works
2483
- * for ghost rows (deleted targets) because no name resolution happens —
2484
- * the per-id results report `INVALID_ID` for malformed entries while
2485
- * valid ones proceed. Safe to re-run: already-gone rows are no-ops.
2495
+ * Disable alerts for many FEED targets by id in one idempotent call (max
2496
+ * 100 ids). The per-id results report `INVALID_ID` for malformed entries.
2486
2497
  */
2487
2498
  async unsubscribeBatch(params) {
2488
2499
  this.client._requireAuth();
@@ -2491,8 +2502,7 @@ var SubscriptionsResource = class {
2491
2502
  "/api/v1/subscriptions/unsubscribe-batch",
2492
2503
  {
2493
2504
  body: {
2494
- playbook_ids: params.playbookIds ?? [],
2495
- feed_ids: params.feedIds ?? []
2505
+ feed_ids: params.feedIds
2496
2506
  }
2497
2507
  }
2498
2508
  );
@@ -2517,11 +2527,8 @@ var AlertsResource = class {
2517
2527
  disableAutomation(params) {
2518
2528
  return this.client.subscriptions.unsubscribeFeed(params);
2519
2529
  }
2520
- enablePlaybook(params) {
2521
- return this.client.subscriptions.subscribePlaybook(params);
2522
- }
2523
- disablePlaybook(params) {
2524
- return this.client.subscriptions.unsubscribePlaybook(params);
2530
+ enableBatch(params) {
2531
+ return this.client.subscriptions.subscribeBatch(params);
2525
2532
  }
2526
2533
  disableBatch(params) {
2527
2534
  return this.client.subscriptions.unsubscribeBatch(params);
@@ -2529,9 +2536,6 @@ var AlertsResource = class {
2529
2536
  historyAutomation(params) {
2530
2537
  return this.client.notifications.listFeed(params);
2531
2538
  }
2532
- historyPlaybook(params) {
2533
- return this.client.notifications.listPlaybook(params);
2534
- }
2535
2539
  preferences() {
2536
2540
  return this.client.notificationPreferences.list();
2537
2541
  }
@@ -3705,7 +3709,7 @@ var installPlaybookRuntime = (targetWindow) => {
3705
3709
  };
3706
3710
 
3707
3711
  // src/index.ts
3708
- var VERSION = true ? "0.16.1-beta.0" : "dev";
3712
+ var VERSION = true ? "0.16.1-beta.2" : "dev";
3709
3713
  export {
3710
3714
  AlertsResource,
3711
3715
  AlvaClient,