@alva-ai/toolkit 0.9.5 → 0.11.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/cli.js CHANGED
@@ -11059,6 +11059,17 @@ function metadataSummaryForSkill(skill) {
11059
11059
  }
11060
11060
 
11061
11061
  // src/resources/playbookSkills.ts
11062
+ function normalizePlaybookSkillSummary(raw) {
11063
+ return {
11064
+ username: raw.username,
11065
+ name: raw.name,
11066
+ display_name: raw.display_name,
11067
+ description: raw.description,
11068
+ tags: raw.tags,
11069
+ creator_uid: raw.creator_uid,
11070
+ updated_at: raw.updated_at
11071
+ };
11072
+ }
11062
11073
  function parsePlaybookSkillId(s) {
11063
11074
  const parts = s.split("/");
11064
11075
  if (parts.length !== 2 || !parts[0] || !parts[1]) {
@@ -11082,7 +11093,7 @@ var PlaybookSkillsResource = class {
11082
11093
  const res = await this.client._request("GET", "/api/v1/skills", {
11083
11094
  query
11084
11095
  });
11085
- return { skills: res.data ?? [] };
11096
+ return { skills: (res.data ?? []).map(normalizePlaybookSkillSummary) };
11086
11097
  }
11087
11098
  async tags() {
11088
11099
  const res = await this.client._request(
@@ -11107,7 +11118,10 @@ var PlaybookSkillsResource = class {
11107
11118
  0
11108
11119
  );
11109
11120
  }
11110
- return meta;
11121
+ return {
11122
+ ...normalizePlaybookSkillSummary(meta),
11123
+ files: meta.files ?? []
11124
+ };
11111
11125
  }
11112
11126
  async file(id, path) {
11113
11127
  const { username, name } = parsePlaybookSkillId(id);
@@ -11418,66 +11432,56 @@ var NotificationPreferencesResource = class {
11418
11432
  }
11419
11433
  };
11420
11434
 
11421
- // src/resources/pushSubscriptions.ts
11422
- var PushSubscriptionsResource = class {
11435
+ // src/resources/subscriptions.ts
11436
+ var SubscriptionsResource = class {
11423
11437
  constructor(client) {
11424
11438
  this.client = client;
11425
11439
  }
11426
11440
  client;
11427
11441
  /**
11428
- * Opt into personal push for one playbook `(username, name)`.
11429
- * Fires for any feed of that playbook. Idempotent. Auth: callers must
11430
- * be able to read the playbook (public/paid pass; private requires
11431
- * explicit alfs grant).
11442
+ * Subscribe to a playbook `(username, name)`: follow it and enable alerts
11443
+ * on all its push-enabled automations. Idempotent. Auth: the caller must be
11444
+ * able to read the playbook — public passes; paid requires an active unlock;
11445
+ * private requires owner/admin.
11432
11446
  */
11433
11447
  async subscribePlaybook(params) {
11434
11448
  this.client._requireAuth();
11435
- const path = `/api/v1/push-subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
11449
+ const path = `/api/v1/subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
11436
11450
  return this.client._request(
11437
11451
  "POST",
11438
11452
  path
11439
11453
  );
11440
11454
  }
11441
11455
  /**
11442
- * Soft-disable personal push for one playbook `(username, name)`.
11443
- * Does NOT remove any social follow. Idempotent.
11456
+ * Unsubscribe from a playbook `(username, name)`: unfollow it and disable
11457
+ * all of its push alerts for the caller. Idempotent.
11444
11458
  */
11445
11459
  async unsubscribePlaybook(params) {
11446
11460
  this.client._requireAuth();
11447
- const path = `/api/v1/push-subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
11448
- return this.client._request(
11449
- "DELETE",
11450
- path
11451
- );
11461
+ const path = `/api/v1/subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
11462
+ return this.client._request("DELETE", path);
11452
11463
  }
11453
11464
  /**
11454
- * Opt into personal push for one feed `(username, name)`. Fires for
11455
- * that specific feed regardless of which playbook(s) consume it; if
11456
- * the feed is shared across playbooks the subscriber receives one
11457
- * push per playbook context. Idempotent.
11465
+ * Subscribe to one feed `(username, name)` — enable personal push for that
11466
+ * single automation's alerts, regardless of which playbook(s) consume it.
11467
+ * Does NOT follow any playbook. Idempotent.
11458
11468
  */
11459
11469
  async subscribeFeed(params) {
11460
11470
  this.client._requireAuth();
11461
- const path = `/api/v1/push-subscriptions/feed/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
11462
- return this.client._request(
11463
- "POST",
11464
- path
11465
- );
11471
+ const path = `/api/v1/subscriptions/feed/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
11472
+ return this.client._request("POST", path);
11466
11473
  }
11467
11474
  /**
11468
- * Soft-disable personal push for one feed `(username, name)`.
11469
- * Idempotent.
11475
+ * Unsubscribe from one feed `(username, name)` — disable that automation's
11476
+ * alerts for the caller. Idempotent.
11470
11477
  */
11471
11478
  async unsubscribeFeed(params) {
11472
11479
  this.client._requireAuth();
11473
- const path = `/api/v1/push-subscriptions/feed/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
11474
- return this.client._request(
11475
- "DELETE",
11476
- path
11477
- );
11480
+ const path = `/api/v1/subscriptions/feed/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
11481
+ return this.client._request("DELETE", path);
11478
11482
  }
11479
11483
  /**
11480
- * List the caller's currently active personal push subscriptions.
11484
+ * List the caller's currently active subscriptions.
11481
11485
  * Results are cursor-paginated.
11482
11486
  */
11483
11487
  async list(params = {}) {
@@ -11487,7 +11491,7 @@ var PushSubscriptionsResource = class {
11487
11491
  query.first = String(params.first);
11488
11492
  }
11489
11493
  if (params.cursor) query.cursor = params.cursor;
11490
- return this.client._request("GET", "/api/v1/me/push-subscriptions", {
11494
+ return this.client._request("GET", "/api/v1/me/subscriptions", {
11491
11495
  query
11492
11496
  });
11493
11497
  }
@@ -11587,7 +11591,7 @@ var AlvaClient = class {
11587
11591
  _arraysJwt;
11588
11592
  _notifications;
11589
11593
  _notificationPreferences;
11590
- _pushSubscriptions;
11594
+ _subscriptions;
11591
11595
  _channelGroupSubscriptions;
11592
11596
  constructor(config) {
11593
11597
  this.baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
@@ -11656,8 +11660,8 @@ var AlvaClient = class {
11656
11660
  get notificationPreferences() {
11657
11661
  return this._notificationPreferences ??= new NotificationPreferencesResource(this);
11658
11662
  }
11659
- get pushSubscriptions() {
11660
- return this._pushSubscriptions ??= new PushSubscriptionsResource(this);
11663
+ get subscriptions() {
11664
+ return this._subscriptions ??= new SubscriptionsResource(this);
11661
11665
  }
11662
11666
  get channelGroupSubscriptions() {
11663
11667
  return this._channelGroupSubscriptions ??= new ChannelGroupSubscriptionsResource(this);
@@ -12515,7 +12519,7 @@ function formatPlaybookSkillFile(file) {
12515
12519
  import * as fs2 from "fs";
12516
12520
  import * as os2 from "os";
12517
12521
  import * as fsPromises2 from "fs/promises";
12518
- var CLI_VERSION = true ? "0.9.5" : "dev";
12522
+ var CLI_VERSION = true ? "0.11.0" : "dev";
12519
12523
  function isVersionOlderThan(a, b) {
12520
12524
  const parse4 = (v) => {
12521
12525
  if (!v) return null;
@@ -12553,7 +12557,7 @@ Commands:
12553
12557
  comments Playbook comments (create, pin, unpin)
12554
12558
  notification-history Notification delivery history (list-playbook, list-feed)
12555
12559
  notification-preferences Notification preferences (list, enable-session-completed, disable-session-completed)
12556
- push-subscriptions Personal push opt-in (subscribe-playbook, unsubscribe-playbook, subscribe-feed, unsubscribe-feed, list)
12560
+ subscriptions Subscribe to playbooks/feeds (subscribe-playbook, unsubscribe-playbook, subscribe-feed, unsubscribe-feed, list)
12557
12561
  channel Channel group operations (group-subscriptions context, list, subscribe, unsubscribe)
12558
12562
  remix Save playbook remix lineage
12559
12563
  portfolio Connected-account portfolio (accounts, summary, activities)
@@ -13076,7 +13080,7 @@ fetch individual file contents (progressive loading).
13076
13080
 
13077
13081
  Subcommands:
13078
13082
  list List skill summaries (filter by --tag and/or --username)
13079
- tags Distinct tag set used across all skills
13083
+ tags Distinct tag set used across skills
13080
13084
  get Get one skill's metadata + file listing (path + size_bytes only)
13081
13085
  file Get one file's content from a skill
13082
13086
 
@@ -13153,19 +13157,21 @@ Examples:
13153
13157
  alva notification-preferences list
13154
13158
  alva notification-preferences disable-session-completed
13155
13159
  alva notification-preferences enable-session-completed`,
13156
- "push-subscriptions": `Usage: alva push-subscriptions <subcommand> [options]
13160
+ subscriptions: `Usage: alva subscriptions <subcommand> [options]
13157
13161
 
13158
- Personal opt-in for DM/web push notifications. Independent of social
13159
- follow: subscribing does not start following, unsubscribing does not
13160
- unfollow. Following a playbook elsewhere does not create or revive a
13161
- push subscription.
13162
+ Subscribe to playbooks and feeds.
13163
+ - subscribe-playbook is a CASCADE: follows the playbook AND enables alerts
13164
+ on all its push-enabled automations (one call). unsubscribe-playbook
13165
+ reverses both (unfollow + disable all of its alerts).
13166
+ - subscribe-feed / unsubscribe-feed toggle ONE feed's alert (a single
13167
+ automation) without touching the playbook follow.
13162
13168
 
13163
13169
  Subcommands:
13164
- subscribe-playbook Opt into push for a playbook (any of its feeds)
13165
- unsubscribe-playbook Opt out of push for a playbook (soft-disable)
13166
- subscribe-feed Opt into push for a single feed
13167
- unsubscribe-feed Opt out of push for a single feed (soft-disable)
13168
- list List the caller's push subscriptions
13170
+ subscribe-playbook Subscribe a playbook (follow + enable all its alerts)
13171
+ unsubscribe-playbook Unsubscribe a playbook (unfollow + disable its alerts)
13172
+ subscribe-feed Enable alerts for a single feed
13173
+ unsubscribe-feed Disable alerts for a single feed
13174
+ list List the caller's active subscriptions
13169
13175
 
13170
13176
  Subscribe/unsubscribe flags (playbook + feed):
13171
13177
  --username <user> Owner's username (required)
@@ -13176,10 +13182,10 @@ List flags:
13176
13182
  --cursor <token> Optional cursor from the previous page
13177
13183
 
13178
13184
  Examples:
13179
- alva push-subscriptions subscribe-playbook --username alice --name btc-dashboard
13180
- alva push-subscriptions subscribe-feed --username alice --name btc-ema-cross
13181
- alva push-subscriptions unsubscribe-feed --username alice --name btc-ema-cross
13182
- alva push-subscriptions list --first 20`,
13185
+ alva subscriptions subscribe-playbook --username alice --name btc-dashboard
13186
+ alva subscriptions subscribe-feed --username alice --name btc-ema-cross
13187
+ alva subscriptions unsubscribe-feed --username alice --name btc-ema-cross
13188
+ alva subscriptions list --first 20`,
13183
13189
  channel: `Usage: alva channel group-subscriptions <subcommand> [options]
13184
13190
 
13185
13191
  Manage push notifications delivered into the external group chat attached
@@ -14135,74 +14141,66 @@ async function dispatch(client, args, meta) {
14135
14141
  );
14136
14142
  }
14137
14143
  }
14138
- case "push-subscriptions": {
14144
+ case "subscriptions": {
14139
14145
  if (!subcommand)
14140
14146
  throw new CliUsageError(
14141
- "Missing subcommand for push-subscriptions",
14142
- "push-subscriptions"
14147
+ "Missing subcommand for subscriptions",
14148
+ "subscriptions"
14143
14149
  );
14144
14150
  switch (subcommand) {
14145
14151
  case "subscribe-playbook":
14146
- return client.pushSubscriptions.subscribePlaybook({
14152
+ return client.subscriptions.subscribePlaybook({
14147
14153
  username: requireFlag(
14148
14154
  flags,
14149
14155
  "username",
14150
- "push-subscriptions subscribe-playbook"
14156
+ "subscriptions subscribe-playbook"
14151
14157
  ),
14152
14158
  name: requireFlag(
14153
14159
  flags,
14154
14160
  "name",
14155
- "push-subscriptions subscribe-playbook"
14161
+ "subscriptions subscribe-playbook"
14156
14162
  )
14157
14163
  });
14158
14164
  case "unsubscribe-playbook":
14159
- return client.pushSubscriptions.unsubscribePlaybook({
14165
+ return client.subscriptions.unsubscribePlaybook({
14160
14166
  username: requireFlag(
14161
14167
  flags,
14162
14168
  "username",
14163
- "push-subscriptions unsubscribe-playbook"
14169
+ "subscriptions unsubscribe-playbook"
14164
14170
  ),
14165
14171
  name: requireFlag(
14166
14172
  flags,
14167
14173
  "name",
14168
- "push-subscriptions unsubscribe-playbook"
14174
+ "subscriptions unsubscribe-playbook"
14169
14175
  )
14170
14176
  });
14171
14177
  case "subscribe-feed":
14172
- return client.pushSubscriptions.subscribeFeed({
14178
+ return client.subscriptions.subscribeFeed({
14173
14179
  username: requireFlag(
14174
14180
  flags,
14175
14181
  "username",
14176
- "push-subscriptions subscribe-feed"
14182
+ "subscriptions subscribe-feed"
14177
14183
  ),
14178
- name: requireFlag(
14179
- flags,
14180
- "name",
14181
- "push-subscriptions subscribe-feed"
14182
- )
14184
+ name: requireFlag(flags, "name", "subscriptions subscribe-feed")
14183
14185
  });
14184
14186
  case "unsubscribe-feed":
14185
- return client.pushSubscriptions.unsubscribeFeed({
14187
+ return client.subscriptions.unsubscribeFeed({
14186
14188
  username: requireFlag(
14187
14189
  flags,
14188
14190
  "username",
14189
- "push-subscriptions unsubscribe-feed"
14191
+ "subscriptions unsubscribe-feed"
14190
14192
  ),
14191
- name: requireFlag(
14192
- flags,
14193
- "name",
14194
- "push-subscriptions unsubscribe-feed"
14195
- )
14193
+ name: requireFlag(flags, "name", "subscriptions unsubscribe-feed")
14196
14194
  });
14197
14195
  case "list":
14198
- return client.pushSubscriptions.list({
14196
+ return client.subscriptions.list({
14199
14197
  first: num(flags["first"]),
14200
14198
  cursor: flags["cursor"]
14201
14199
  });
14202
14200
  default:
14203
14201
  throw new CliUsageError(
14204
- `Unknown subcommand: push-subscriptions ${subcommand}`,
14205
- "push-subscriptions"
14202
+ `Unknown subcommand: subscriptions ${subcommand}`,
14203
+ "subscriptions"
14206
14204
  );
14207
14205
  }
14208
14206
  }