@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.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
  });
@@ -277,7 +280,9 @@ var DeployResource = class {
277
280
  push_notify: params.push_notify,
278
281
  max_heap_size_mb: params.max_heap_size_mb,
279
282
  run_as_user_id: params.run_as_user_id,
280
- end_at: params.end_at
283
+ start_at: params.start_at,
284
+ end_at: params.end_at,
285
+ max_runs: params.max_runs
281
286
  }
282
287
  });
283
288
  }
@@ -322,9 +327,10 @@ var DeployResource = class {
322
327
  /**
323
328
  * Fire the cronjob workflow once, immediately, bypassing the schedule.
324
329
  * Async — returns the Hatchet workflow run id at enqueue. The
325
- * `cronjob_runs` row appears only after the worker finishes the run;
326
- * callers verify completion by polling `listRuns({cronjob_id})` and
327
- * matching `runs[].workflow_run_id` against the returned id.
330
+ * `cronjob_runs` row can appear as DISPATCHED/RUNNING before it reaches a
331
+ * terminal status; callers verify completion by polling
332
+ * `getRunStatus({cronjob_id, workflow_run_id})` with their own
333
+ * timeout/deadline.
328
334
  *
329
335
  * Surfaces backend status as HTTP errors (handled by AlvaClient):
330
336
  * - 404 not found / cross-user
@@ -348,6 +354,13 @@ var DeployResource = class {
348
354
  }
349
355
  );
350
356
  }
357
+ async getRunStatus(params) {
358
+ this.client._requireAuth();
359
+ return this.client._request(
360
+ "GET",
361
+ `/api/v1/deploy/cronjob/${params.cronjob_id}/runs/by-workflow/${encodeURIComponent(params.workflow_run_id)}`
362
+ );
363
+ }
351
364
  async getRunLogs(params) {
352
365
  this.client._requireAuth();
353
366
  return this.client._request(
@@ -2383,19 +2396,6 @@ var NotificationsResource = class {
2383
2396
  this.client = client;
2384
2397
  }
2385
2398
  client;
2386
- /**
2387
- * List the caller's notification history for one playbook
2388
- * `(username, name)`. Returns `NOT_FOUND` when the playbook is
2389
- * private or does not exist (the two cases are deliberately
2390
- * indistinguishable to prevent namespace enumeration).
2391
- */
2392
- async listPlaybook(params) {
2393
- this.client._requireAuth();
2394
- const path = `/api/v1/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}/notifications`;
2395
- return this.client._request("GET", path, {
2396
- query: buildQuery(params)
2397
- });
2398
- }
2399
2399
  /**
2400
2400
  * List the caller's notification history for one feed
2401
2401
  * `(username, name)`. Authorization is alfs read on
@@ -2462,27 +2462,27 @@ var SubscriptionsResource = class {
2462
2462
  }
2463
2463
  client;
2464
2464
  /**
2465
- * Subscribe to a playbook `(username, name)`: follow it and enable alerts
2466
- * on all its push-enabled automations. Idempotent. Auth: the caller must be
2467
- * able to read the playbook — public passes; paid requires an active unlock;
2468
- * private requires owner/admin.
2465
+ * Follow a playbook `(username, name)`. Alerts are independent and require
2466
+ * explicit FEED subscriptions. Idempotent.
2469
2467
  */
2470
- async subscribePlaybook(params) {
2468
+ async followPlaybook(params) {
2471
2469
  this.client._requireAuth();
2472
- 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)}`;
2473
2471
  return this.client._request(
2474
2472
  "POST",
2475
2473
  path
2476
2474
  );
2477
2475
  }
2478
2476
  /**
2479
- * Unsubscribe from a playbook `(username, name)`: unfollow it and disable
2480
- * all of its push alerts for the caller. Idempotent.
2477
+ * Unfollow a playbook `(username, name)` without changing FEED alerts.
2481
2478
  */
2482
- async unsubscribePlaybook(params) {
2479
+ async unfollowPlaybook(params) {
2483
2480
  this.client._requireAuth();
2484
- const path = `/api/v1/subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
2485
- 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
+ );
2486
2486
  }
2487
2487
  /**
2488
2488
  * Subscribe to one feed `(username, name)` — enable personal push for that
@@ -2534,12 +2534,23 @@ var SubscriptionsResource = class {
2534
2534
  query
2535
2535
  });
2536
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
+ }
2537
2551
  /**
2538
- * Disable alerts for many playbook/feed targets BY TARGET ID in one
2539
- * idempotent call (max 100 ids). Ids are strings (snowflake-safe). Works
2540
- * for ghost rows (deleted targets) because no name resolution happens —
2541
- * the per-id results report `INVALID_ID` for malformed entries while
2542
- * 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.
2543
2554
  */
2544
2555
  async unsubscribeBatch(params) {
2545
2556
  this.client._requireAuth();
@@ -2548,8 +2559,7 @@ var SubscriptionsResource = class {
2548
2559
  "/api/v1/subscriptions/unsubscribe-batch",
2549
2560
  {
2550
2561
  body: {
2551
- playbook_ids: params.playbookIds ?? [],
2552
- feed_ids: params.feedIds ?? []
2562
+ feed_ids: params.feedIds
2553
2563
  }
2554
2564
  }
2555
2565
  );
@@ -2574,11 +2584,8 @@ var AlertsResource = class {
2574
2584
  disableAutomation(params) {
2575
2585
  return this.client.subscriptions.unsubscribeFeed(params);
2576
2586
  }
2577
- enablePlaybook(params) {
2578
- return this.client.subscriptions.subscribePlaybook(params);
2579
- }
2580
- disablePlaybook(params) {
2581
- return this.client.subscriptions.unsubscribePlaybook(params);
2587
+ enableBatch(params) {
2588
+ return this.client.subscriptions.subscribeBatch(params);
2582
2589
  }
2583
2590
  disableBatch(params) {
2584
2591
  return this.client.subscriptions.unsubscribeBatch(params);
@@ -2586,9 +2593,6 @@ var AlertsResource = class {
2586
2593
  historyAutomation(params) {
2587
2594
  return this.client.notifications.listFeed(params);
2588
2595
  }
2589
- historyPlaybook(params) {
2590
- return this.client.notifications.listPlaybook(params);
2591
- }
2592
2596
  preferences() {
2593
2597
  return this.client.notificationPreferences.list();
2594
2598
  }
@@ -3762,7 +3766,7 @@ var installPlaybookRuntime = (targetWindow) => {
3762
3766
  };
3763
3767
 
3764
3768
  // src/index.ts
3765
- var VERSION = true ? "0.16.1-beta.0" : "dev";
3769
+ var VERSION = true ? "0.16.1-beta.2" : "dev";
3766
3770
  // Annotate the CommonJS export names for ESM import in node:
3767
3771
  0 && (module.exports = {
3768
3772
  AlertsResource,