@alva-ai/toolkit 0.7.0 → 0.8.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
@@ -209,6 +209,14 @@ interface FeedReleaseResponse {
209
209
  /** Canonical alfs path: `/alva/home/<username>/feeds/<name>`. */
210
210
  feed_path: string;
211
211
  }
212
+ interface FeedDeleteRequest {
213
+ /** Numeric feed id to delete. */
214
+ id: number;
215
+ }
216
+ interface FeedDeleteResponse {
217
+ /** Echoed feed id (string form, matching gateway response). */
218
+ id: string;
219
+ }
212
220
  interface PlaybookDraftRequest {
213
221
  name: string;
214
222
  display_name: string;
@@ -219,11 +227,20 @@ interface PlaybookDraftRequest {
219
227
  }>;
220
228
  trading_symbols?: string[];
221
229
  /**
222
- * Optional source-template reference in "username/name" form (matches
223
- * playbook_templates PK, e.g. "alva/screener"). Persisted set-once on
224
- * the playbook's first draft; subsequent drafts ignore the field.
230
+ * Optional source-skill reference in "username/name" form (e.g.
231
+ * "alva/screener"). The value identifies a playbook skill published to
232
+ * Skillhub; discover available skills via `alva skillhub list`.
233
+ * Persisted set-once on the playbook's first draft; subsequent drafts
234
+ * ignore the field.
235
+ */
236
+ skill_id?: string;
237
+ /**
238
+ * Optional discovery tags (max 10, each up to 32 characters). On a
239
+ * playbook's first draft these merge with any template-inherited tags;
240
+ * on a re-draft of an existing playbook they replace the current tag
241
+ * set. Omitted/empty leaves tags unchanged.
225
242
  */
226
- template_id?: string;
243
+ tags?: string[];
227
244
  }
228
245
  interface PlaybookDraftResponse {
229
246
  playbook_id: number;
@@ -470,15 +487,25 @@ interface PushTarget {
470
487
  }
471
488
  interface PushSubscription {
472
489
  target: PushTarget;
473
- /**
474
- * `true` when the row is currently active. `false` means the user
475
- * previously subscribed and then unsubscribed; the row is preserved
476
- * so re-subscribe restores seniority via UPSERT-revive. Only present
477
- * when `include_history=true` is passed to `list`.
478
- */
479
- subscribed: boolean;
480
490
  created_at_ms: number;
481
491
  updated_at_ms: number;
492
+ /** Present on list responses. */
493
+ cursor?: string;
494
+ /** Feed metadata is present for FEED targets when available. */
495
+ feed_name?: string;
496
+ feed_status?: 'ACTIVE' | 'PAUSED' | 'UNSPECIFIED' | string;
497
+ /** Unix milliseconds of the latest successful delivery for this user+target. */
498
+ last_pushed_at_ms?: number;
499
+ /** Playbooks whose latest release currently references this feed. */
500
+ used_by?: PushSubscriptionUsedBy[];
501
+ used_by_total?: number;
502
+ }
503
+ interface PushSubscriptionUsedBy {
504
+ playbook_id: string;
505
+ owner_username: string;
506
+ playbook_name: string;
507
+ display_name: string;
508
+ owner_avatar_url: string;
482
509
  }
483
510
  interface PushSubscriptionPlaybookParams {
484
511
  username: string;
@@ -489,11 +516,15 @@ interface PushSubscriptionFeedParams {
489
516
  name: string;
490
517
  }
491
518
  interface PushSubscriptionListParams {
492
- /** Default `false`. When `true`, include rows with `subscribed=false`. */
493
- include_history?: boolean;
519
+ /** Page size, default 50, max 200 server-side. */
520
+ first?: number;
521
+ /** Opaque cursor token from previous page's `next_cursor`. */
522
+ cursor?: string;
494
523
  }
495
524
  interface PushSubscriptionListResponse {
496
525
  items: PushSubscription[];
526
+ /** Empty when there is no next page. */
527
+ next_cursor?: string;
497
528
  }
498
529
  interface SubscribePushTargetResponse {
499
530
  subscription: PushSubscription;
@@ -636,6 +667,24 @@ declare class ReleaseResource {
636
667
  playbook(params: PlaybookReleaseRequest): Promise<PlaybookReleaseResponse>;
637
668
  }
638
669
 
670
+ /**
671
+ * Feed lifecycle management. Backed by alva-gateway REST (mirrors the
672
+ * GraphQL surface in `pkg/schema/feed.graphql`).
673
+ */
674
+ declare class FeedResource {
675
+ private client;
676
+ constructor(client: AlvaClient);
677
+ /**
678
+ * Soft-delete a feed and all its active majors. Cascades:
679
+ * - all active feed_majors are soft-deleted in the same transaction
680
+ * - associated producer cronjobs are removed best-effort (the cronjob
681
+ * scavenger reconciles any leftover rows on its next sweep)
682
+ *
683
+ * Auth: caller must own the feed (uid match), enforced by the backend.
684
+ */
685
+ delete(params: FeedDeleteRequest): Promise<FeedDeleteResponse>;
686
+ }
687
+
639
688
  declare class SecretsResource {
640
689
  private client;
641
690
  constructor(client: AlvaClient);
@@ -859,7 +908,8 @@ declare class NotificationsResource {
859
908
  *
860
909
  * - `subscribePlaybook` / `subscribeFeed` do not start following.
861
910
  * - `unsubscribePlaybook` / `unsubscribeFeed` do not unfollow.
862
- * - Following a playbook elsewhere will compound-subscribe automatically.
911
+ * - Following a playbook elsewhere does not create or revive a push
912
+ * subscription.
863
913
  *
864
914
  * Backed by alva-gateway REST (mirrors the GraphQL surface in
865
915
  * `pkg/schema/push_subscription.graphql`).
@@ -892,9 +942,8 @@ declare class PushSubscriptionsResource {
892
942
  */
893
943
  unsubscribeFeed(params: PushSubscriptionFeedParams): Promise<UnsubscribePushTargetResponse>;
894
944
  /**
895
- * List the caller's personal push subscriptions across all targets
896
- * (playbook + feed). Defaults to currently-active rows only; pass
897
- * `include_history=true` to also return previously-unsubscribed rows.
945
+ * List the caller's currently active personal push subscriptions.
946
+ * Results are cursor-paginated.
898
947
  */
899
948
  list(params?: PushSubscriptionListParams): Promise<PushSubscriptionListResponse>;
900
949
  }
@@ -936,6 +985,7 @@ declare class AlvaClient {
936
985
  private _run?;
937
986
  private _deploy?;
938
987
  private _release?;
988
+ private _feed?;
939
989
  private _secrets?;
940
990
  private _sdk?;
941
991
  private _dataSkills?;
@@ -954,6 +1004,7 @@ declare class AlvaClient {
954
1004
  get run(): RunResource;
955
1005
  get deploy(): DeployResource;
956
1006
  get release(): ReleaseResource;
1007
+ get feed(): FeedResource;
957
1008
  get secrets(): SecretsResource;
958
1009
  get sdk(): SdkDocsResource;
959
1010
  get dataSkills(): DataSkillsResource;
@@ -980,4 +1031,4 @@ declare class AlvaError extends Error {
980
1031
  /** SDK version, injected at build time from package.json. */
981
1032
  declare const VERSION: string;
982
1033
 
983
- 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 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -209,6 +209,14 @@ interface FeedReleaseResponse {
209
209
  /** Canonical alfs path: `/alva/home/<username>/feeds/<name>`. */
210
210
  feed_path: string;
211
211
  }
212
+ interface FeedDeleteRequest {
213
+ /** Numeric feed id to delete. */
214
+ id: number;
215
+ }
216
+ interface FeedDeleteResponse {
217
+ /** Echoed feed id (string form, matching gateway response). */
218
+ id: string;
219
+ }
212
220
  interface PlaybookDraftRequest {
213
221
  name: string;
214
222
  display_name: string;
@@ -219,11 +227,20 @@ interface PlaybookDraftRequest {
219
227
  }>;
220
228
  trading_symbols?: string[];
221
229
  /**
222
- * Optional source-template reference in "username/name" form (matches
223
- * playbook_templates PK, e.g. "alva/screener"). Persisted set-once on
224
- * the playbook's first draft; subsequent drafts ignore the field.
230
+ * Optional source-skill reference in "username/name" form (e.g.
231
+ * "alva/screener"). The value identifies a playbook skill published to
232
+ * Skillhub; discover available skills via `alva skillhub list`.
233
+ * Persisted set-once on the playbook's first draft; subsequent drafts
234
+ * ignore the field.
235
+ */
236
+ skill_id?: string;
237
+ /**
238
+ * Optional discovery tags (max 10, each up to 32 characters). On a
239
+ * playbook's first draft these merge with any template-inherited tags;
240
+ * on a re-draft of an existing playbook they replace the current tag
241
+ * set. Omitted/empty leaves tags unchanged.
225
242
  */
226
- template_id?: string;
243
+ tags?: string[];
227
244
  }
228
245
  interface PlaybookDraftResponse {
229
246
  playbook_id: number;
@@ -470,15 +487,25 @@ interface PushTarget {
470
487
  }
471
488
  interface PushSubscription {
472
489
  target: PushTarget;
473
- /**
474
- * `true` when the row is currently active. `false` means the user
475
- * previously subscribed and then unsubscribed; the row is preserved
476
- * so re-subscribe restores seniority via UPSERT-revive. Only present
477
- * when `include_history=true` is passed to `list`.
478
- */
479
- subscribed: boolean;
480
490
  created_at_ms: number;
481
491
  updated_at_ms: number;
492
+ /** Present on list responses. */
493
+ cursor?: string;
494
+ /** Feed metadata is present for FEED targets when available. */
495
+ feed_name?: string;
496
+ feed_status?: 'ACTIVE' | 'PAUSED' | 'UNSPECIFIED' | string;
497
+ /** Unix milliseconds of the latest successful delivery for this user+target. */
498
+ last_pushed_at_ms?: number;
499
+ /** Playbooks whose latest release currently references this feed. */
500
+ used_by?: PushSubscriptionUsedBy[];
501
+ used_by_total?: number;
502
+ }
503
+ interface PushSubscriptionUsedBy {
504
+ playbook_id: string;
505
+ owner_username: string;
506
+ playbook_name: string;
507
+ display_name: string;
508
+ owner_avatar_url: string;
482
509
  }
483
510
  interface PushSubscriptionPlaybookParams {
484
511
  username: string;
@@ -489,11 +516,15 @@ interface PushSubscriptionFeedParams {
489
516
  name: string;
490
517
  }
491
518
  interface PushSubscriptionListParams {
492
- /** Default `false`. When `true`, include rows with `subscribed=false`. */
493
- include_history?: boolean;
519
+ /** Page size, default 50, max 200 server-side. */
520
+ first?: number;
521
+ /** Opaque cursor token from previous page's `next_cursor`. */
522
+ cursor?: string;
494
523
  }
495
524
  interface PushSubscriptionListResponse {
496
525
  items: PushSubscription[];
526
+ /** Empty when there is no next page. */
527
+ next_cursor?: string;
497
528
  }
498
529
  interface SubscribePushTargetResponse {
499
530
  subscription: PushSubscription;
@@ -636,6 +667,24 @@ declare class ReleaseResource {
636
667
  playbook(params: PlaybookReleaseRequest): Promise<PlaybookReleaseResponse>;
637
668
  }
638
669
 
670
+ /**
671
+ * Feed lifecycle management. Backed by alva-gateway REST (mirrors the
672
+ * GraphQL surface in `pkg/schema/feed.graphql`).
673
+ */
674
+ declare class FeedResource {
675
+ private client;
676
+ constructor(client: AlvaClient);
677
+ /**
678
+ * Soft-delete a feed and all its active majors. Cascades:
679
+ * - all active feed_majors are soft-deleted in the same transaction
680
+ * - associated producer cronjobs are removed best-effort (the cronjob
681
+ * scavenger reconciles any leftover rows on its next sweep)
682
+ *
683
+ * Auth: caller must own the feed (uid match), enforced by the backend.
684
+ */
685
+ delete(params: FeedDeleteRequest): Promise<FeedDeleteResponse>;
686
+ }
687
+
639
688
  declare class SecretsResource {
640
689
  private client;
641
690
  constructor(client: AlvaClient);
@@ -859,7 +908,8 @@ declare class NotificationsResource {
859
908
  *
860
909
  * - `subscribePlaybook` / `subscribeFeed` do not start following.
861
910
  * - `unsubscribePlaybook` / `unsubscribeFeed` do not unfollow.
862
- * - Following a playbook elsewhere will compound-subscribe automatically.
911
+ * - Following a playbook elsewhere does not create or revive a push
912
+ * subscription.
863
913
  *
864
914
  * Backed by alva-gateway REST (mirrors the GraphQL surface in
865
915
  * `pkg/schema/push_subscription.graphql`).
@@ -892,9 +942,8 @@ declare class PushSubscriptionsResource {
892
942
  */
893
943
  unsubscribeFeed(params: PushSubscriptionFeedParams): Promise<UnsubscribePushTargetResponse>;
894
944
  /**
895
- * List the caller's personal push subscriptions across all targets
896
- * (playbook + feed). Defaults to currently-active rows only; pass
897
- * `include_history=true` to also return previously-unsubscribed rows.
945
+ * List the caller's currently active personal push subscriptions.
946
+ * Results are cursor-paginated.
898
947
  */
899
948
  list(params?: PushSubscriptionListParams): Promise<PushSubscriptionListResponse>;
900
949
  }
@@ -936,6 +985,7 @@ declare class AlvaClient {
936
985
  private _run?;
937
986
  private _deploy?;
938
987
  private _release?;
988
+ private _feed?;
939
989
  private _secrets?;
940
990
  private _sdk?;
941
991
  private _dataSkills?;
@@ -954,6 +1004,7 @@ declare class AlvaClient {
954
1004
  get run(): RunResource;
955
1005
  get deploy(): DeployResource;
956
1006
  get release(): ReleaseResource;
1007
+ get feed(): FeedResource;
957
1008
  get secrets(): SecretsResource;
958
1009
  get sdk(): SdkDocsResource;
959
1010
  get dataSkills(): DataSkillsResource;
@@ -980,4 +1031,4 @@ declare class AlvaError extends Error {
980
1031
  /** SDK version, injected at build time from package.json. */
981
1032
  declare const VERSION: string;
982
1033
 
983
- 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 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 };
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 };
package/dist/index.js CHANGED
@@ -275,7 +275,8 @@ var ReleaseResource = class {
275
275
  description: params.description,
276
276
  feeds: params.feeds,
277
277
  trading_symbols: params.trading_symbols,
278
- template_id: params.template_id
278
+ skill_id: params.skill_id,
279
+ tags: params.tags
279
280
  }
280
281
  });
281
282
  }
@@ -293,6 +294,32 @@ var ReleaseResource = class {
293
294
  }
294
295
  };
295
296
 
297
+ // src/resources/feed.ts
298
+ var FeedResource = class {
299
+ constructor(client) {
300
+ this.client = client;
301
+ }
302
+ client;
303
+ /**
304
+ * Soft-delete a feed and all its active majors. Cascades:
305
+ * - all active feed_majors are soft-deleted in the same transaction
306
+ * - associated producer cronjobs are removed best-effort (the cronjob
307
+ * scavenger reconciles any leftover rows on its next sweep)
308
+ *
309
+ * Auth: caller must own the feed (uid match), enforced by the backend.
310
+ */
311
+ async delete(params) {
312
+ this.client._requireAuth();
313
+ if (!Number.isInteger(params.id) || params.id <= 0) {
314
+ throw new Error("feed id must be a positive integer");
315
+ }
316
+ return this.client._request(
317
+ "DELETE",
318
+ `/api/v1/feed/${encodeURIComponent(String(params.id))}`
319
+ );
320
+ }
321
+ };
322
+
296
323
  // src/resources/secrets.ts
297
324
  var SecretsResource = class {
298
325
  constructor(client) {
@@ -1854,16 +1881,16 @@ var PushSubscriptionsResource = class {
1854
1881
  );
1855
1882
  }
1856
1883
  /**
1857
- * List the caller's personal push subscriptions across all targets
1858
- * (playbook + feed). Defaults to currently-active rows only; pass
1859
- * `include_history=true` to also return previously-unsubscribed rows.
1884
+ * List the caller's currently active personal push subscriptions.
1885
+ * Results are cursor-paginated.
1860
1886
  */
1861
1887
  async list(params = {}) {
1862
1888
  this.client._requireAuth();
1863
1889
  const query = {};
1864
- if (params.include_history !== void 0) {
1865
- query.include_history = String(params.include_history);
1890
+ if (params.first !== void 0 && params.first > 0) {
1891
+ query.first = String(params.first);
1866
1892
  }
1893
+ if (params.cursor) query.cursor = params.cursor;
1867
1894
  return this.client._request("GET", "/api/v1/me/push-subscriptions", {
1868
1895
  query
1869
1896
  });
@@ -1945,6 +1972,7 @@ var AlvaClient = class {
1945
1972
  _run;
1946
1973
  _deploy;
1947
1974
  _release;
1975
+ _feed;
1948
1976
  _secrets;
1949
1977
  _sdk;
1950
1978
  _dataSkills;
@@ -1976,6 +2004,9 @@ var AlvaClient = class {
1976
2004
  get release() {
1977
2005
  return this._release ??= new ReleaseResource(this);
1978
2006
  }
2007
+ get feed() {
2008
+ return this._feed ??= new FeedResource(this);
2009
+ }
1979
2010
  get secrets() {
1980
2011
  return this._secrets ??= new SecretsResource(this);
1981
2012
  }
@@ -2107,7 +2138,7 @@ var AlvaClient = class {
2107
2138
  };
2108
2139
 
2109
2140
  // src/index.ts
2110
- var VERSION = true ? "0.7.0" : "dev";
2141
+ var VERSION = true ? "0.8.0" : "dev";
2111
2142
  export {
2112
2143
  AlvaClient,
2113
2144
  AlvaError,