@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.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
  });
@@ -2336,19 +2339,6 @@ var NotificationsResource = class {
2336
2339
  this.client = client;
2337
2340
  }
2338
2341
  client;
2339
- /**
2340
- * List the caller's notification history for one playbook
2341
- * `(username, name)`. Returns `NOT_FOUND` when the playbook is
2342
- * private or does not exist (the two cases are deliberately
2343
- * indistinguishable to prevent namespace enumeration).
2344
- */
2345
- async listPlaybook(params) {
2346
- this.client._requireAuth();
2347
- const path = `/api/v1/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}/notifications`;
2348
- return this.client._request("GET", path, {
2349
- query: buildQuery(params)
2350
- });
2351
- }
2352
2342
  /**
2353
2343
  * List the caller's notification history for one feed
2354
2344
  * `(username, name)`. Authorization is alfs read on
@@ -2415,27 +2405,27 @@ var SubscriptionsResource = class {
2415
2405
  }
2416
2406
  client;
2417
2407
  /**
2418
- * Subscribe to a playbook `(username, name)`: follow it and enable alerts
2419
- * on all its push-enabled automations. Idempotent. Auth: the caller must be
2420
- * able to read the playbook — public passes; paid requires an active unlock;
2421
- * private requires owner/admin.
2408
+ * Follow a playbook `(username, name)`. Alerts are independent and require
2409
+ * explicit FEED subscriptions. Idempotent.
2422
2410
  */
2423
- async subscribePlaybook(params) {
2411
+ async followPlaybook(params) {
2424
2412
  this.client._requireAuth();
2425
- 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)}`;
2426
2414
  return this.client._request(
2427
2415
  "POST",
2428
2416
  path
2429
2417
  );
2430
2418
  }
2431
2419
  /**
2432
- * Unsubscribe from a playbook `(username, name)`: unfollow it and disable
2433
- * all of its push alerts for the caller. Idempotent.
2420
+ * Unfollow a playbook `(username, name)` without changing FEED alerts.
2434
2421
  */
2435
- async unsubscribePlaybook(params) {
2422
+ async unfollowPlaybook(params) {
2436
2423
  this.client._requireAuth();
2437
- const path = `/api/v1/subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
2438
- 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
+ );
2439
2429
  }
2440
2430
  /**
2441
2431
  * Subscribe to one feed `(username, name)` — enable personal push for that
@@ -2487,12 +2477,23 @@ var SubscriptionsResource = class {
2487
2477
  query
2488
2478
  });
2489
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
+ }
2490
2494
  /**
2491
- * Disable alerts for many playbook/feed targets BY TARGET ID in one
2492
- * idempotent call (max 100 ids). Ids are strings (snowflake-safe). Works
2493
- * for ghost rows (deleted targets) because no name resolution happens —
2494
- * the per-id results report `INVALID_ID` for malformed entries while
2495
- * 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.
2496
2497
  */
2497
2498
  async unsubscribeBatch(params) {
2498
2499
  this.client._requireAuth();
@@ -2501,8 +2502,7 @@ var SubscriptionsResource = class {
2501
2502
  "/api/v1/subscriptions/unsubscribe-batch",
2502
2503
  {
2503
2504
  body: {
2504
- playbook_ids: params.playbookIds ?? [],
2505
- feed_ids: params.feedIds ?? []
2505
+ feed_ids: params.feedIds
2506
2506
  }
2507
2507
  }
2508
2508
  );
@@ -2527,11 +2527,8 @@ var AlertsResource = class {
2527
2527
  disableAutomation(params) {
2528
2528
  return this.client.subscriptions.unsubscribeFeed(params);
2529
2529
  }
2530
- enablePlaybook(params) {
2531
- return this.client.subscriptions.subscribePlaybook(params);
2532
- }
2533
- disablePlaybook(params) {
2534
- return this.client.subscriptions.unsubscribePlaybook(params);
2530
+ enableBatch(params) {
2531
+ return this.client.subscriptions.subscribeBatch(params);
2535
2532
  }
2536
2533
  disableBatch(params) {
2537
2534
  return this.client.subscriptions.unsubscribeBatch(params);
@@ -2539,9 +2536,6 @@ var AlertsResource = class {
2539
2536
  historyAutomation(params) {
2540
2537
  return this.client.notifications.listFeed(params);
2541
2538
  }
2542
- historyPlaybook(params) {
2543
- return this.client.notifications.listPlaybook(params);
2544
- }
2545
2539
  preferences() {
2546
2540
  return this.client.notificationPreferences.list();
2547
2541
  }
@@ -3715,7 +3709,7 @@ var installPlaybookRuntime = (targetWindow) => {
3715
3709
  };
3716
3710
 
3717
3711
  // src/index.ts
3718
- var VERSION = true ? "0.16.1-beta.1" : "dev";
3712
+ var VERSION = true ? "0.16.1-beta.2" : "dev";
3719
3713
  export {
3720
3714
  AlertsResource,
3721
3715
  AlvaClient,