@alva-ai/toolkit 0.16.1-beta.1 → 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.cjs CHANGED
@@ -78,6 +78,7 @@ var CliUsageError = class extends Error {
78
78
  };
79
79
 
80
80
  // src/resources/fs.ts
81
+ var WRITE_FLAG_APPEND = 1 << 0;
81
82
  function isValidUtf8(bytes) {
82
83
  let i = 0;
83
84
  while (i < bytes.length) {
@@ -145,7 +146,8 @@ var FsResource = class {
145
146
  body: {
146
147
  path: params.path,
147
148
  data: params.data,
148
- mkdir_parents: params.mkdir_parents
149
+ mkdir_parents: params.mkdir_parents,
150
+ ...params.append ? { flags: WRITE_FLAG_APPEND } : {}
149
151
  }
150
152
  });
151
153
  }
@@ -155,7 +157,8 @@ var FsResource = class {
155
157
  return this.client._request("POST", "/api/v1/fs/write", {
156
158
  query: {
157
159
  path: params.path,
158
- mkdir_parents: params.mkdir_parents
160
+ mkdir_parents: params.mkdir_parents,
161
+ ...params.append ? { flags: WRITE_FLAG_APPEND } : {}
159
162
  },
160
163
  rawBody: params.body
161
164
  });
@@ -2393,19 +2396,6 @@ var NotificationsResource = class {
2393
2396
  this.client = client;
2394
2397
  }
2395
2398
  client;
2396
- /**
2397
- * List the caller's notification history for one playbook
2398
- * `(username, name)`. Returns `NOT_FOUND` when the playbook is
2399
- * private or does not exist (the two cases are deliberately
2400
- * indistinguishable to prevent namespace enumeration).
2401
- */
2402
- async listPlaybook(params) {
2403
- this.client._requireAuth();
2404
- const path = `/api/v1/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}/notifications`;
2405
- return this.client._request("GET", path, {
2406
- query: buildQuery(params)
2407
- });
2408
- }
2409
2399
  /**
2410
2400
  * List the caller's notification history for one feed
2411
2401
  * `(username, name)`. Authorization is alfs read on
@@ -2472,27 +2462,27 @@ var SubscriptionsResource = class {
2472
2462
  }
2473
2463
  client;
2474
2464
  /**
2475
- * Subscribe to a playbook `(username, name)`: follow it and enable alerts
2476
- * on all its push-enabled automations. Idempotent. Auth: the caller must be
2477
- * able to read the playbook — public passes; paid requires an active unlock;
2478
- * private requires owner/admin.
2465
+ * Follow a playbook `(username, name)`. Alerts are independent and require
2466
+ * explicit FEED subscriptions. Idempotent.
2479
2467
  */
2480
- async subscribePlaybook(params) {
2468
+ async followPlaybook(params) {
2481
2469
  this.client._requireAuth();
2482
- const path = `/api/v1/subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
2470
+ const path = `/api/v1/follows/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
2483
2471
  return this.client._request(
2484
2472
  "POST",
2485
2473
  path
2486
2474
  );
2487
2475
  }
2488
2476
  /**
2489
- * Unsubscribe from a playbook `(username, name)`: unfollow it and disable
2490
- * all of its push alerts for the caller. Idempotent.
2477
+ * Unfollow a playbook `(username, name)` without changing FEED alerts.
2491
2478
  */
2492
- async unsubscribePlaybook(params) {
2479
+ async unfollowPlaybook(params) {
2493
2480
  this.client._requireAuth();
2494
- const path = `/api/v1/subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
2495
- return this.client._request("DELETE", path);
2481
+ const path = `/api/v1/follows/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
2482
+ return this.client._request(
2483
+ "DELETE",
2484
+ path
2485
+ );
2496
2486
  }
2497
2487
  /**
2498
2488
  * Subscribe to one feed `(username, name)` — enable personal push for that
@@ -2544,12 +2534,23 @@ var SubscriptionsResource = class {
2544
2534
  query
2545
2535
  });
2546
2536
  }
2537
+ /** Atomically enable alerts for FEED target ids (max 100). */
2538
+ async subscribeBatch(params) {
2539
+ this.client._requireAuth();
2540
+ return this.client._request(
2541
+ "POST",
2542
+ "/api/v1/subscriptions/subscribe-batch",
2543
+ {
2544
+ body: {
2545
+ feed_ids: params.feedIds,
2546
+ channel_id: params.channelId
2547
+ }
2548
+ }
2549
+ );
2550
+ }
2547
2551
  /**
2548
- * Disable alerts for many playbook/feed targets BY TARGET ID in one
2549
- * idempotent call (max 100 ids). Ids are strings (snowflake-safe). Works
2550
- * for ghost rows (deleted targets) because no name resolution happens —
2551
- * the per-id results report `INVALID_ID` for malformed entries while
2552
- * valid ones proceed. Safe to re-run: already-gone rows are no-ops.
2552
+ * Disable alerts for many FEED targets by id in one idempotent call (max
2553
+ * 100 ids). The per-id results report `INVALID_ID` for malformed entries.
2553
2554
  */
2554
2555
  async unsubscribeBatch(params) {
2555
2556
  this.client._requireAuth();
@@ -2558,8 +2559,7 @@ var SubscriptionsResource = class {
2558
2559
  "/api/v1/subscriptions/unsubscribe-batch",
2559
2560
  {
2560
2561
  body: {
2561
- playbook_ids: params.playbookIds ?? [],
2562
- feed_ids: params.feedIds ?? []
2562
+ feed_ids: params.feedIds
2563
2563
  }
2564
2564
  }
2565
2565
  );
@@ -2584,11 +2584,8 @@ var AlertsResource = class {
2584
2584
  disableAutomation(params) {
2585
2585
  return this.client.subscriptions.unsubscribeFeed(params);
2586
2586
  }
2587
- enablePlaybook(params) {
2588
- return this.client.subscriptions.subscribePlaybook(params);
2589
- }
2590
- disablePlaybook(params) {
2591
- return this.client.subscriptions.unsubscribePlaybook(params);
2587
+ enableBatch(params) {
2588
+ return this.client.subscriptions.subscribeBatch(params);
2592
2589
  }
2593
2590
  disableBatch(params) {
2594
2591
  return this.client.subscriptions.unsubscribeBatch(params);
@@ -2596,9 +2593,6 @@ var AlertsResource = class {
2596
2593
  historyAutomation(params) {
2597
2594
  return this.client.notifications.listFeed(params);
2598
2595
  }
2599
- historyPlaybook(params) {
2600
- return this.client.notifications.listPlaybook(params);
2601
- }
2602
2596
  preferences() {
2603
2597
  return this.client.notificationPreferences.list();
2604
2598
  }
@@ -3772,7 +3766,7 @@ var installPlaybookRuntime = (targetWindow) => {
3772
3766
  };
3773
3767
 
3774
3768
  // src/index.ts
3775
- var VERSION = true ? "0.16.1-beta.1" : "dev";
3769
+ var VERSION = true ? "0.16.1-beta.2" : "dev";
3776
3770
  // Annotate the CommonJS export names for ESM import in node:
3777
3771
  0 && (module.exports = {
3778
3772
  AlertsResource,