@alva-ai/toolkit 0.11.2 → 0.12.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
@@ -7373,6 +7373,7 @@ var init_fallback_bundle = __esm({
7373
7373
  --chart-grey-2: #b7b7b7; /* \u26A0 Only When chart has \u2265 3 series */
7374
7374
 
7375
7375
  /* \u2500\u2500 Spacing \u2500\u2500 */
7376
+ --spacing-min: 0px;
7376
7377
  --spacing-xxxs: 2px;
7377
7378
  --spacing-xxs: 4px;
7378
7379
  --spacing-xs: 8px;
@@ -7387,21 +7388,25 @@ var init_fallback_bundle = __esm({
7387
7388
  --spacing-xxxxxxl: 56px;
7388
7389
 
7389
7390
  /* \u2500\u2500 Radius \u2500\u2500 */
7390
- --radius-ct-xs: 2px;
7391
+ --radius-ct-min: 2px;
7391
7392
  --radius-ct-s: 4px;
7392
7393
  --radius-ct-m: 6px;
7393
7394
  --radius-ct-l: 8px;
7394
7395
  --radius-ct-xl: 12px;
7395
- --radius-pop-dialog: 12px;
7396
- --radius-pop-action-sheets: 12px;
7397
- --radius-pop-dropdown: 8px;
7398
- --radius-pop-popover: 8px;
7399
- --radius-pop-toast: 8px;
7400
- --radius-pop-tips: 8px;
7401
- --radius-btn-xs: 4px;
7402
- --radius-btn-s: 6px;
7403
- --radius-btn-m: 8px;
7404
- --radius-btn-l: 12px;
7396
+ --radius-ct-xxl: 16px;
7397
+ --radius-ct-xxxl: 20px;
7398
+ --radius-ct-max: 960px;
7399
+ --radius-pop-dialog: 8px;
7400
+ --radius-pop-action-sheets: 8px;
7401
+ --radius-pop-dropdown: 6px;
7402
+ --radius-pop-popover: 6px;
7403
+ --radius-pop-toast: 4px;
7404
+ --radius-pop-tips: 4px;
7405
+ --radius-btn-min: 0px;
7406
+ --radius-btn-xs: 2px;
7407
+ --radius-btn-s: 4px;
7408
+ --radius-btn-m: 6px;
7409
+ --radius-btn-l: 8px;
7405
7410
  }
7406
7411
  }
7407
7412
 
@@ -7420,12 +7425,17 @@ var init_fallback_bundle = __esm({
7420
7425
  --b0-page: #ffffff;
7421
7426
  --b0-container: #ffffff;
7422
7427
  --b0-sidebar: #2a2a38;
7423
- --b0-sidebar-select: rgba(255, 255, 255, 0.03);
7428
+ --b0-sidebar-select: rgba(255, 255, 255, 0.05);
7429
+ --b0-special: #375454;
7424
7430
  --grey-g01: #fafafa; /* Dashboard Card */
7425
7431
  --grey-g02: #f5f5f5;
7426
7432
  --grey-g03: #f0f0f0;
7427
7433
  --grey-g05: #eaeaea;
7428
7434
  --grey-g1: #dedede;
7435
+ --grey-g2: #c5c5c5;
7436
+ --grey-g3: #acacac;
7437
+ --grey-g5: #7b7b7b;
7438
+ --grey-g7: #4a4a4a;
7429
7439
  --b-r02: rgba(0, 0, 0, 0.02); /* Content Block */
7430
7440
  --b-r03: rgba(0, 0, 0, 0.03); /* Darker Block */
7431
7441
  --b-r05: rgba(0, 0, 0, 0.05);
@@ -7575,6 +7585,7 @@ body {
7575
7585
  position: relative;
7576
7586
  width: 100%;
7577
7587
  cursor: pointer;
7588
+ border-radius: var(--radius-ct-s);
7578
7589
  transition: background-color 0.12s ease;
7579
7590
  }
7580
7591
 
@@ -7583,10 +7594,6 @@ body {
7583
7594
  background-color: rgba(73,163,166,0.08);
7584
7595
  }
7585
7596
 
7586
- .list-item.selected {
7587
- border-radius: var(--radius-ct-m);
7588
- }
7589
-
7590
7597
  .list-item.selected .list-item-text {
7591
7598
  color: var(--main-m1);
7592
7599
  }
@@ -7615,6 +7622,13 @@ body {
7615
7622
  text-overflow: ellipsis;
7616
7623
  }
7617
7624
 
7625
+ /* Size S \u2014 width follows the Select trigger; only typography shrinks */
7626
+ .dropdown.size-s .list-item-text {
7627
+ font-size: 12px;
7628
+ line-height: 20px;
7629
+ letter-spacing: 0.12px;
7630
+ }
7631
+
7618
7632
  /* \u2500\u2500 Container \u2500\u2500 */
7619
7633
  .markdown-container {
7620
7634
  width: 100%;
@@ -7740,14 +7754,14 @@ body {
7740
7754
  .markdown-container code,
7741
7755
  .markdown-container pre {
7742
7756
  background: var(--b-r02);
7743
- border-radius: var(--radius-ct-xs);
7757
+ border-radius: var(--radius-ct-min);
7744
7758
  font-family: "JetBrains Mono", monospace;
7745
7759
  color: var(--text-n7);
7746
7760
  }
7747
7761
  .markdown-container code {
7748
7762
  display: inline-block;
7749
7763
  vertical-align: middle;
7750
- box-shadow: inset 0 0 0 1px var(--line-l07);
7764
+ box-shadow: inset 0 0 0 0.5px var(--line-l12);
7751
7765
  font-size: 12px;
7752
7766
  line-height: 20px;
7753
7767
  letter-spacing: 0.12px;
@@ -7755,7 +7769,8 @@ body {
7755
7769
  margin: 0 var(--spacing-xxs);
7756
7770
  }
7757
7771
  .markdown-container pre {
7758
- border: 1px solid var(--line-l07);
7772
+ border: 0.5px solid var(--line-l12);
7773
+ border-radius: var(--radius-ct-s);
7759
7774
  font-size: 12px;
7760
7775
  line-height: 20px;
7761
7776
  letter-spacing: 0.12px;
@@ -7777,8 +7792,8 @@ body {
7777
7792
 
7778
7793
  /* \u2500\u2500 Divider \u2500\u2500 */
7779
7794
  .markdown-container hr {
7780
- height: 1px;
7781
- background: var(--line-l07);
7795
+ height: 0.5px;
7796
+ background: var(--line-l12);
7782
7797
  border: none;
7783
7798
  margin: var(--spacing-xxs) 0;
7784
7799
  }
@@ -7806,7 +7821,7 @@ body {
7806
7821
  min-height: 176px;
7807
7822
  }
7808
7823
  .markdown-container tr {
7809
- border-bottom: 1px solid var(--line-l07);
7824
+ border-bottom: 0.5px solid var(--line-l12);
7810
7825
  }
7811
7826
  .markdown-container tr:last-child {
7812
7827
  border-bottom: none;
@@ -8165,7 +8180,7 @@ body {
8165
8180
  outline-offset: 2px;
8166
8181
  }
8167
8182
 
8168
- /* Base (default size = Small) */
8183
+ /* Base (default size) */
8169
8184
  .tag {
8170
8185
  display: inline-flex;
8171
8186
  align-items: center;
@@ -8199,14 +8214,24 @@ body {
8199
8214
  letter-spacing: 0.14px;
8200
8215
  }
8201
8216
 
8217
+ /* Size \u2014 Small */
8218
+ .tag-sm {
8219
+ height: 20px;
8220
+ padding: 1px 4px;
8221
+ font-size: 11px;
8222
+ line-height: 18px;
8223
+ letter-spacing: 0.11px;
8224
+ border-radius: var(--radius-ct-min);
8225
+ }
8226
+
8202
8227
  /* Size \u2014 Extra Small */
8203
8228
  .tag-xs {
8204
8229
  height: 18px;
8205
- padding: 1px 6px;
8230
+ padding: 1px 4px;
8206
8231
  font-size: 10px;
8207
8232
  line-height: 16px;
8208
8233
  letter-spacing: 0.1px;
8209
- border-radius: var(--radius-ct-xs);
8234
+ border-radius: var(--radius-ct-min);
8210
8235
  }
8211
8236
 
8212
8237
  /*
@@ -8348,8 +8373,10 @@ body {
8348
8373
  transition: border-color 0.12s ease;
8349
8374
  }
8350
8375
 
8351
- .select:hover .select-border {
8376
+ /* Activated (dropdown open) \u2014 color + 1px border. Hover does not change color. */
8377
+ .select.open .select-border {
8352
8378
  border-color: var(--line-l9);
8379
+ border-width: 1px;
8353
8380
  }
8354
8381
 
8355
8382
  .select-text {
@@ -8365,7 +8392,7 @@ body {
8365
8392
  color: var(--text-n9);
8366
8393
  }
8367
8394
 
8368
- .select:hover .select-text {
8395
+ .select.open .select-text {
8369
8396
  color: var(--text-n9);
8370
8397
  }
8371
8398
 
@@ -8397,6 +8424,17 @@ body {
8397
8424
 
8398
8425
  /* Size \u2014 Small */
8399
8426
  .select-sm {
8427
+ height: 32px;
8428
+ padding: 6px var(--spacing-s);
8429
+ gap: var(--spacing-xxs);
8430
+ border-radius: var(--radius-btn-s);
8431
+ font-size: 12px;
8432
+ line-height: 20px;
8433
+ letter-spacing: 0.12px;
8434
+ }
8435
+
8436
+ /* Size \u2014 Extra Small */
8437
+ .select-xs {
8400
8438
  height: 28px;
8401
8439
  padding: var(--spacing-xxs) var(--spacing-xs);
8402
8440
  gap: var(--spacing-xxs);
@@ -8405,22 +8443,25 @@ body {
8405
8443
  line-height: 20px;
8406
8444
  letter-spacing: 0.12px;
8407
8445
  }
8408
- .select-sm .select-text {
8409
- width: 70px;
8410
- flex: none;
8411
- }
8412
8446
 
8413
- /* Arrow Icon */
8447
+ /* Arrow Icon \u2014 14px for L/M, 12px for S/XS */
8414
8448
  .select-icon {
8415
8449
  flex-shrink: 0;
8416
8450
  display: flex;
8417
8451
  align-items: center;
8418
8452
  justify-content: center;
8453
+ width: 14px;
8454
+ height: 14px;
8419
8455
  opacity: 0.22;
8420
8456
  transition: opacity 0.12s ease;
8421
8457
  }
8422
8458
 
8423
- .select:hover .select-icon,
8459
+ .select-sm .select-icon,
8460
+ .select-xs .select-icon {
8461
+ width: 12px;
8462
+ height: 12px;
8463
+ }
8464
+
8424
8465
  .select.open .select-icon {
8425
8466
  opacity: 1;
8426
8467
  }
@@ -8454,9 +8495,10 @@ body {
8454
8495
  transition: border-color 0.12s ease;
8455
8496
  }
8456
8497
 
8457
- .input:hover .input-border,
8498
+ /* Activated (focused/typing) \u2014 color + 1px border. Hover does not change color. */
8458
8499
  .input:focus-within .input-border {
8459
8500
  border-color: var(--line-l9);
8501
+ border-width: 1px;
8460
8502
  }
8461
8503
 
8462
8504
  .input-field {
@@ -8496,6 +8538,16 @@ body {
8496
8538
 
8497
8539
  /* Size \u2014 Small */
8498
8540
  .input-sm {
8541
+ height: 32px;
8542
+ padding: 6px var(--spacing-s);
8543
+ border-radius: var(--radius-btn-s);
8544
+ font-size: 12px;
8545
+ line-height: 20px;
8546
+ letter-spacing: 0.12px;
8547
+ }
8548
+
8549
+ /* Size \u2014 Extra Small */
8550
+ .input-xs {
8499
8551
  height: 28px;
8500
8552
  padding: var(--spacing-xxs) var(--spacing-xs);
8501
8553
  border-radius: var(--radius-btn-s);
@@ -8531,10 +8583,13 @@ body {
8531
8583
  overflow: hidden;
8532
8584
  }
8533
8585
 
8534
- /* \u2500\u2500 Underline \u2500\u2500 */
8586
+ /* \u2500\u2500 Underline \u2500\u2500 divider + active bar are bottom-anchored overlays (both bottom:0,
8587
+ so bottoms align); bar covers divider via z-index. Do not refactor to a border. */
8535
8588
  .tab-underline {
8589
+ position: relative;
8590
+ width: 100%;
8591
+ align-items: flex-end;
8536
8592
  gap: var(--spacing-m);
8537
- border-bottom: 1px solid var(--line-l07);
8538
8593
  flex-wrap: nowrap;
8539
8594
  overflow-x: auto;
8540
8595
  scrollbar-width: none; /* Firefox */
@@ -8542,19 +8597,37 @@ body {
8542
8597
  .tab-underline::-webkit-scrollbar {
8543
8598
  display: none;
8544
8599
  }
8600
+ .tab-underline::after {
8601
+ content: "";
8602
+ position: absolute;
8603
+ left: 0;
8604
+ right: 0;
8605
+ bottom: 0;
8606
+ height: 0.5px;
8607
+ background: var(--line-l12);
8608
+ z-index: 0;
8609
+ }
8545
8610
  .tab-underline .tab-item {
8546
8611
  padding-bottom: var(--spacing-xxs);
8547
- margin-bottom: -1px;
8548
8612
  font-size: 14px;
8549
8613
  line-height: 22px;
8550
8614
  letter-spacing: 0.14px;
8551
8615
  color: var(--text-n7);
8552
- border-bottom: 2px solid transparent;
8553
8616
  }
8554
8617
  .tab-underline .tab-item.active {
8618
+ position: relative;
8619
+ z-index: 1;
8555
8620
  color: var(--text-n9);
8556
8621
  font-weight: 500;
8557
- border-bottom-color: var(--main-m1);
8622
+ }
8623
+ .tab-underline .tab-item.active::before {
8624
+ content: "";
8625
+ position: absolute;
8626
+ left: 0;
8627
+ right: 0;
8628
+ bottom: 0;
8629
+ height: 2px;
8630
+ background: var(--main-m1);
8558
8631
  }
8559
8632
 
8560
8633
  /* Underline \u2014 Size L */
@@ -8584,7 +8657,7 @@ body {
8584
8657
  }
8585
8658
  .tab-underline.tab-xl .tab-item {
8586
8659
  padding-top: var(--spacing-s);
8587
- padding-bottom: 10px; /* 12 \u2212 2px border = matches inactive py-12 */
8660
+ padding-bottom: 10px;
8588
8661
  font-size: 18px;
8589
8662
  line-height: 28px;
8590
8663
  letter-spacing: 0.18px;
@@ -8629,7 +8702,7 @@ body {
8629
8702
  }
8630
8703
  .tab-segmented.tab-s .tab-item {
8631
8704
  padding: var(--spacing-xxs) 10px;
8632
- border-radius: var(--radius-ct-xs); /* 2px */
8705
+ border-radius: var(--radius-ct-min); /* 2px */
8633
8706
  font-size: 12px;
8634
8707
  line-height: 20px;
8635
8708
  letter-spacing: 0.12px;
@@ -8642,7 +8715,7 @@ body {
8642
8715
  }
8643
8716
  .tab-pill .tab-item {
8644
8717
  padding: 6px var(--spacing-s);
8645
- border-radius: 999px; /* capsule */
8718
+ border-radius: var(--radius-ct-max); /* capsule */
8646
8719
  font-size: 14px;
8647
8720
  line-height: 22px;
8648
8721
  letter-spacing: 0.14px;
@@ -8677,7 +8750,7 @@ body {
8677
8750
  .tooltip {
8678
8751
  background-color: var(--b0-container);
8679
8752
  position: absolute;
8680
- border-radius: var(--radius-ct-m);
8753
+ border-radius: var(--radius-pop-tips);
8681
8754
  box-shadow: var(--shadow-s);
8682
8755
  padding: var(--spacing-m);
8683
8756
  width: fit-content;
@@ -8690,7 +8763,7 @@ body {
8690
8763
  .tooltip-border {
8691
8764
  position: absolute;
8692
8765
  border: 0.5px solid var(--line-l2);
8693
- border-radius: var(--radius-ct-m);
8766
+ border-radius: var(--radius-pop-tips);
8694
8767
  inset: 0;
8695
8768
  pointer-events: none;
8696
8769
  }
@@ -8779,16 +8852,16 @@ body {
8779
8852
 
8780
8853
  /* \u2500\u2500 Dividers \u2500\u2500 */
8781
8854
  .divider-v {
8782
- width: 1px;
8855
+ width: 0.5px;
8783
8856
  flex-shrink: 0;
8784
8857
  margin-block: var(--spacing-l);
8785
- background-color: var(--line-l05);
8858
+ background-color: var(--line-l07);
8786
8859
  }
8787
8860
 
8788
8861
  .divider-h {
8789
- height: 1px;
8862
+ height: 0.5px;
8790
8863
  margin-inline: var(--spacing-l);
8791
- background-color: var(--line-l05);
8864
+ background-color: var(--line-l07);
8792
8865
  }
8793
8866
 
8794
8867
  /* \u2500\u2500 Equal Height Fill \u2500\u2500 */
@@ -8962,7 +9035,7 @@ body {
8962
9035
  display: flex;
8963
9036
  width: 100%;
8964
9037
  gap: var(--spacing-m); /* column spacing between cells */
8965
- border-bottom: 1px solid var(--line-l07); /* row divider \u2014 on the row, not cells */
9038
+ border-bottom: 0.5px solid var(--line-l12); /* row divider \u2014 on the row, not cells */
8966
9039
  /* min-width is set by initTableAlignment JS \u2014 do NOT use CSS min-width here */
8967
9040
  }
8968
9041
  .table-row:last-child {
@@ -9012,8 +9085,8 @@ body {
9012
9085
  bottom: 0;
9013
9086
  left: var(--spacing-m);
9014
9087
  right: var(--spacing-m);
9015
- height: 1px;
9016
- background: var(--line-l05);
9088
+ height: 0.5px;
9089
+ background: var(--line-l07);
9017
9090
  }
9018
9091
 
9019
9092
  .feed-item:last-child::after {
@@ -9274,7 +9347,7 @@ body {
9274
9347
  letter-spacing: 0.12px;
9275
9348
  color: var(--text-n5);
9276
9349
  padding-left: 8px;
9277
- border-left: 1px solid var(--line-l07);
9350
+ border-left: 0.5px solid var(--line-l12);
9278
9351
  }
9279
9352
  `;
9280
9353
  }
@@ -9771,6 +9844,69 @@ var PlaybooksResource = class {
9771
9844
  this.client = client;
9772
9845
  }
9773
9846
  client;
9847
+ /**
9848
+ * Resolve playbook ids to named, addressable records (mono-meta#584 A2).
9849
+ * Visibility-gated server-side; ids the caller cannot see — and DELETED
9850
+ * playbook ids — return no row. Treat a missing id as "deleted or not
9851
+ * visible" (the subscriptions list's `target_status` distinguishes ghosts).
9852
+ * Ids are strings (snowflake-safe). Max 100 per call.
9853
+ *
9854
+ * Auth is optional (like `trending`): with an API key, private/paid
9855
+ * visibility is evaluated for the caller; without one, only public
9856
+ * playbooks resolve. The server decides — no client-side gate.
9857
+ */
9858
+ async getByIds(ids) {
9859
+ return await this.client._request("GET", "/api/v1/playbooks", {
9860
+ query: { ids: ids.join(",") }
9861
+ });
9862
+ }
9863
+ /**
9864
+ * List a user's playbooks by owner username (mono-meta#584 C10).
9865
+ * Visibility-gated: another user's private playbooks are omitted.
9866
+ * Auth is optional (like `trending`); without credentials only public
9867
+ * playbooks are listed.
9868
+ */
9869
+ async listByOwner(params) {
9870
+ const query = { owner: params.owner };
9871
+ if (params.limit !== void 0 && params.limit > 0) {
9872
+ query.limit = String(params.limit);
9873
+ }
9874
+ if (params.cursor) query.cursor = params.cursor;
9875
+ return await this.client._request("GET", "/api/v1/playbooks", {
9876
+ query
9877
+ });
9878
+ }
9879
+ /**
9880
+ * Get one playbook by numeric id or by "owner/name" ref. Returns null when
9881
+ * not found / not visible / deleted.
9882
+ */
9883
+ async get(params) {
9884
+ if (params.id) {
9885
+ const resp = await this.getByIds([params.id]);
9886
+ return resp.items[0] ?? null;
9887
+ }
9888
+ if (params.ref) {
9889
+ const slash = params.ref.indexOf("/");
9890
+ if (slash <= 0 || slash === params.ref.length - 1) {
9891
+ throw new AlvaError(
9892
+ "INVALID_ARGUMENT",
9893
+ `Invalid ref "${params.ref}". Expected "owner/name".`,
9894
+ 400
9895
+ );
9896
+ }
9897
+ const owner = params.ref.slice(0, slash);
9898
+ const name = params.ref.slice(slash + 1);
9899
+ let cursor;
9900
+ for (; ; ) {
9901
+ const page = await this.listByOwner({ owner, cursor, limit: 100 });
9902
+ const hit = page.items.find((item) => item.name === name);
9903
+ if (hit) return hit;
9904
+ if (!page.has_next || !page.next_cursor) return null;
9905
+ cursor = page.next_cursor;
9906
+ }
9907
+ }
9908
+ throw new AlvaError("INVALID_ARGUMENT", "id or ref is required", 400);
9909
+ }
9774
9910
  /**
9775
9911
  * List trending / searchable playbooks. Auth is optional: when the client
9776
9912
  * has an API key it is forwarded, otherwise this uses the public surface.
@@ -10995,6 +11131,36 @@ var SKILL_ENDPOINT_METADATA = [
10995
11131
  required_subscription_tier: "pro",
10996
11132
  access: "pro_only",
10997
11133
  pro_required: true
11134
+ },
11135
+ {
11136
+ skill: "arrays-data-api-equity-fundamentals",
11137
+ file: "company-detail-non-us",
11138
+ method: "GET",
11139
+ path: "/api/v1/stocks/non-us/company/detail",
11140
+ tier: "public",
11141
+ required_subscription_tier: "free",
11142
+ access: "free_and_pro",
11143
+ pro_required: false
11144
+ },
11145
+ {
11146
+ skill: "arrays-data-api-social-feeds",
11147
+ file: "x-search",
11148
+ method: "GET",
11149
+ path: "/api/v1/social-feeds/x/search",
11150
+ tier: "alternative",
11151
+ required_subscription_tier: "pro",
11152
+ access: "pro_only",
11153
+ pro_required: true
11154
+ },
11155
+ {
11156
+ skill: "arrays-data-api-spot-market-price-and-volume",
11157
+ file: "stocks-non-us-kline",
11158
+ method: "GET",
11159
+ path: "/api/v1/stocks/non-us/kline",
11160
+ tier: "public",
11161
+ required_subscription_tier: "free",
11162
+ access: "free_and_pro",
11163
+ pro_required: false
10998
11164
  }
10999
11165
  ];
11000
11166
  function getSkillEndpointMetadata(skill, file) {
@@ -11526,6 +11692,42 @@ var SubscriptionsResource = class {
11526
11692
  query
11527
11693
  });
11528
11694
  }
11695
+ /**
11696
+ * List the playbooks the caller FOLLOWS (the social relation — the UI's
11697
+ * "Subscribed Playbooks"). Rows carry the playbook identity; follows of
11698
+ * deleted playbooks are filtered server-side. Cursor-paginated.
11699
+ */
11700
+ async follows(params = {}) {
11701
+ this.client._requireAuth();
11702
+ const query = {};
11703
+ if (params.limit !== void 0 && params.limit > 0) {
11704
+ query.limit = String(params.limit);
11705
+ }
11706
+ if (params.cursor) query.cursor = params.cursor;
11707
+ return this.client._request("GET", "/api/v1/me/follows", {
11708
+ query
11709
+ });
11710
+ }
11711
+ /**
11712
+ * Disable alerts for many playbook/feed targets BY TARGET ID in one
11713
+ * idempotent call (max 100 ids). Ids are strings (snowflake-safe). Works
11714
+ * for ghost rows (deleted targets) because no name resolution happens —
11715
+ * the per-id results report `INVALID_ID` for malformed entries while
11716
+ * valid ones proceed. Safe to re-run: already-gone rows are no-ops.
11717
+ */
11718
+ async unsubscribeBatch(params) {
11719
+ this.client._requireAuth();
11720
+ return this.client._request(
11721
+ "POST",
11722
+ "/api/v1/subscriptions/unsubscribe-batch",
11723
+ {
11724
+ body: {
11725
+ playbook_ids: params.playbookIds ?? [],
11726
+ feed_ids: params.feedIds ?? []
11727
+ }
11728
+ }
11729
+ );
11730
+ }
11529
11731
  };
11530
11732
 
11531
11733
  // src/resources/channelGroupSubscriptions.ts
@@ -11605,6 +11807,160 @@ var FeedbackResource = class {
11605
11807
  }
11606
11808
  };
11607
11809
 
11810
+ // src/resources/functions.ts
11811
+ var FunctionsResource = class {
11812
+ constructor(client) {
11813
+ this.client = client;
11814
+ }
11815
+ client;
11816
+ async register(params) {
11817
+ this.client._requireAuth();
11818
+ return this.client._request("POST", "/api/v1/service/functions", {
11819
+ body: {
11820
+ playbook_id: params.playbook_id,
11821
+ function_name: params.function_name,
11822
+ entry_script_path: params.entry_script_path,
11823
+ params_schema: params.params_schema,
11824
+ allow_charges: params.allow_charges
11825
+ }
11826
+ });
11827
+ }
11828
+ async list(params) {
11829
+ this.client._requireAuth();
11830
+ return this.client._request("GET", "/api/v1/service/functions", {
11831
+ query: {
11832
+ playbook_id: params.playbook_id
11833
+ }
11834
+ });
11835
+ }
11836
+ async delete(params) {
11837
+ this.client._requireAuth();
11838
+ await this.client._request("DELETE", "/api/v1/service/functions", {
11839
+ query: {
11840
+ playbook_id: params.playbook_id,
11841
+ function_name: params.function_name
11842
+ }
11843
+ });
11844
+ }
11845
+ async invoke(params) {
11846
+ this.client._requireAuth();
11847
+ const response = await this.client._request(
11848
+ "POST",
11849
+ "/api/v1/service/invoke",
11850
+ {
11851
+ body: {
11852
+ playbook_id: params.playbook_id,
11853
+ function_name: params.function_name,
11854
+ parameters_json: JSON.stringify(params.parameters ?? {})
11855
+ }
11856
+ }
11857
+ );
11858
+ return {
11859
+ ...response,
11860
+ result: parseResultPayload(response.result)
11861
+ };
11862
+ }
11863
+ async getAllowance(params) {
11864
+ this.client._requireAuth();
11865
+ const response = await this.client._request(
11866
+ "GET",
11867
+ "/api/v1/service/allowance",
11868
+ {
11869
+ query: {
11870
+ playbook_id: params.playbook_id
11871
+ }
11872
+ }
11873
+ );
11874
+ return normalizeAllowance(response.allowance);
11875
+ }
11876
+ async listAllowances() {
11877
+ this.client._requireAuth();
11878
+ const response = await this.client._request(
11879
+ "GET",
11880
+ "/api/v1/service/allowances"
11881
+ );
11882
+ return {
11883
+ allowances: (response.allowances ?? []).map((allowance) => normalizeAllowance(allowance)).filter(
11884
+ (allowance) => allowance !== null
11885
+ )
11886
+ };
11887
+ }
11888
+ async createAllowance(params) {
11889
+ this.client._requireAuth();
11890
+ const response = await this.client._request(
11891
+ "POST",
11892
+ "/api/v1/service/allowance",
11893
+ {
11894
+ body: {
11895
+ playbook_id: params.playbook_id,
11896
+ amount: params.amount
11897
+ }
11898
+ }
11899
+ );
11900
+ return { allowance: requireAllowance(response.allowance) };
11901
+ }
11902
+ async revokeAllowance(params) {
11903
+ this.client._requireAuth();
11904
+ await this.client._request("DELETE", "/api/v1/service/allowance", {
11905
+ query: {
11906
+ playbook_id: params.playbook_id
11907
+ }
11908
+ });
11909
+ return { ok: true };
11910
+ }
11911
+ };
11912
+ function normalizeAllowance(raw) {
11913
+ if (!raw) return null;
11914
+ const allowance = {
11915
+ id: raw.id ?? "",
11916
+ consumer_uid: raw.consumer_uid ?? raw.consumerUid ?? "",
11917
+ playbook_id: raw.playbook_id ?? raw.playbookId ?? "",
11918
+ amount: raw.amount ?? 0,
11919
+ used: raw.used ?? 0,
11920
+ remaining: raw.remaining ?? 0
11921
+ };
11922
+ const createdAtMs = timestampMs(
11923
+ raw.created_at_ms ?? raw.createdAtMs ?? raw.created_at ?? raw.createdAt
11924
+ );
11925
+ const updatedAtMs = timestampMs(
11926
+ raw.updated_at_ms ?? raw.updatedAtMs ?? raw.updated_at ?? raw.updatedAt
11927
+ );
11928
+ if (createdAtMs !== void 0) allowance.created_at_ms = createdAtMs;
11929
+ if (updatedAtMs !== void 0) allowance.updated_at_ms = updatedAtMs;
11930
+ return allowance;
11931
+ }
11932
+ function requireAllowance(raw) {
11933
+ const allowance = normalizeAllowance(raw);
11934
+ if (!allowance) {
11935
+ throw new Error("allowance response missing allowance");
11936
+ }
11937
+ return allowance;
11938
+ }
11939
+ function timestampMs(value) {
11940
+ if (value === void 0 || value === null) return void 0;
11941
+ if (typeof value === "number" && Number.isFinite(value)) return value;
11942
+ if (typeof value === "string") {
11943
+ const numeric = Number(value);
11944
+ if (Number.isFinite(numeric)) return numeric;
11945
+ const parsed = Date.parse(value);
11946
+ return Number.isNaN(parsed) ? void 0 : parsed;
11947
+ }
11948
+ if (typeof value !== "object") return void 0;
11949
+ const ts = value;
11950
+ const seconds = typeof ts.seconds === "number" ? ts.seconds : typeof ts.seconds === "string" ? Number(ts.seconds) : void 0;
11951
+ const nanos = typeof ts.nanos === "number" ? ts.nanos : typeof ts.nanos === "string" ? Number(ts.nanos) : 0;
11952
+ if (seconds === void 0 || !Number.isFinite(seconds)) return void 0;
11953
+ return seconds * 1e3 + Math.floor((Number.isFinite(nanos) ? nanos : 0) / 1e6);
11954
+ }
11955
+ function parseResultPayload(result) {
11956
+ if (typeof result !== "string") return result;
11957
+ try {
11958
+ return JSON.parse(result);
11959
+ } catch {
11960
+ return result;
11961
+ }
11962
+ }
11963
+
11608
11964
  // src/client.ts
11609
11965
  var DEFAULT_BASE_URL = "https://api-llm.prd.alva.ai";
11610
11966
  var DEFAULT_ARRAYS_BASE_URL = "https://data-tools.prd.space.id";
@@ -11639,6 +11995,7 @@ var AlvaClient = class {
11639
11995
  _subscriptions;
11640
11996
  _channelGroupSubscriptions;
11641
11997
  _feedback;
11998
+ _functions;
11642
11999
  constructor(config) {
11643
12000
  this.baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
11644
12001
  this.arraysBaseUrl = config.arraysBaseUrl ?? DEFAULT_ARRAYS_BASE_URL;
@@ -11715,6 +12072,9 @@ var AlvaClient = class {
11715
12072
  get feedback() {
11716
12073
  return this._feedback ??= new FeedbackResource(this);
11717
12074
  }
12075
+ get functions() {
12076
+ return this._functions ??= new FunctionsResource(this);
12077
+ }
11718
12078
  _requireAuth() {
11719
12079
  if (!this.pbsvToken && !this.viewer_token && !this.apiKey) {
11720
12080
  throw new AlvaError(
@@ -12568,7 +12928,7 @@ function formatPlaybookSkillFile(file) {
12568
12928
  import * as fs2 from "fs";
12569
12929
  import * as os2 from "os";
12570
12930
  import * as fsPromises2 from "fs/promises";
12571
- var CLI_VERSION = true ? "0.11.2" : "dev";
12931
+ var CLI_VERSION = true ? "0.12.0" : "dev";
12572
12932
  function isVersionOlderThan(a, b) {
12573
12933
  const parse4 = (v) => {
12574
12934
  if (!v) return null;
@@ -12598,7 +12958,8 @@ Commands:
12598
12958
  release Feed and playbook releases (feed, playbook-draft, playbook)
12599
12959
  lint Design-system lint (playbook)
12600
12960
  feed Feed lifecycle management (delete)
12601
- playbooks Playbook discovery (trending) and visibility
12961
+ playbooks Playbook discovery (trending, get, list) and visibility
12962
+ functions Playbook UDF function management (register, list, delete, invoke, allowance)
12602
12963
  secrets Secret management (create, list, get, update, delete)
12603
12964
  sdk SDK documentation (doc, partitions, partition-summary)
12604
12965
  skillhub Playbook skills (list, tags, get, file)
@@ -12607,7 +12968,7 @@ Commands:
12607
12968
  notification-history Notification delivery history (list-playbook, list-feed)
12608
12969
  notification-preferences Notification preferences (list, enable-session-completed, disable-session-completed)
12609
12970
  feedback Submit user-confirmed Alva platform feedback (submit)
12610
- subscriptions Subscribe to playbooks/feeds (subscribe-playbook, unsubscribe-playbook, subscribe-feed, unsubscribe-feed, list)
12971
+ subscriptions Follows + push alerts (subscribe-playbook, unsubscribe-playbook, subscribe-feed, unsubscribe-feed, unsubscribe, list, follows)
12611
12972
  channel Channel group operations (group-subscriptions context, list, subscribe, unsubscribe)
12612
12973
  remix Save playbook remix lineage
12613
12974
  portfolio Connected-account portfolio (accounts, summary, activities)
@@ -12705,6 +13066,7 @@ Response fields:
12705
13066
  username Username (used in ALFS paths and playbook URLs)
12706
13067
  subscription_tier "free" or "pro" \u2014 determines release flow and feature gates
12707
13068
  telegram_username Telegram username if connected, null otherwise
13069
+ slack_username Slack display name if connected, null otherwise
12708
13070
 
12709
13071
  Examples:
12710
13072
  alva user me`,
@@ -12923,12 +13285,25 @@ Examples:
12923
13285
  alva feed delete --id 42`,
12924
13286
  playbooks: `Usage: alva playbooks <subcommand> [options]
12925
13287
 
12926
- Find public playbooks with an agent-friendly response shape.
13288
+ Find and resolve playbooks with an agent-friendly response shape.
12927
13289
 
12928
13290
  Subcommands:
12929
13291
  trending List trending playbooks
13292
+ get Resolve playbooks by id(s) or "owner/name" ref
13293
+ list List a user's playbooks by owner username
12930
13294
  set-visibility Set a playbook's visibility (requires auth)
12931
13295
 
13296
+ Get flags:
13297
+ --id <n> Single numeric playbook id
13298
+ --ids <a,b> Comma-separated ids (max 100); ids you cannot see
13299
+ \u2014 and DELETED playbooks \u2014 return no row
13300
+ --ref <owner/name> Resolve by handle
13301
+
13302
+ List flags:
13303
+ --owner <username> Owner username (required)
13304
+ --limit <n> Max results per page
13305
+ --cursor <cursor> Pagination cursor from previous response
13306
+
12932
13307
  Trending flags:
12933
13308
  --keyword <text> Search text
12934
13309
  --tags <a,b> Comma-separated tags
@@ -12958,9 +13333,71 @@ Notes:
12958
13333
 
12959
13334
  Examples:
12960
13335
  alva playbooks trending --keyword scanner --tags macro,ai --sort recent --limit 5
12961
- alva playbooks trending --tag btc --cursor abc
13336
+ alva playbooks get --ids 8009,8010
13337
+ alva playbooks get --ref alice/btc-dashboard
13338
+ alva playbooks list --owner alice
12962
13339
  alva playbooks set-visibility --name my-scanner --visibility private
12963
13340
  alva playbooks set-visibility --name my-scanner --visibility public`,
13341
+ functions: `Usage: alva functions <subcommand> [options]
13342
+
13343
+ Register and manage playbook UDF functions. These are creator-owned functions
13344
+ that released playbook HTML invokes through window.alva.udf.
13345
+
13346
+ Subcommands:
13347
+ register Register or update a function on a playbook
13348
+ list List registered functions for a playbook
13349
+ delete Delete a registered function
13350
+ invoke Invoke a registered function with creator/session auth
13351
+ allowance Manage your viewer credit allowance for a playbook
13352
+
13353
+ Register flags:
13354
+ --playbook-id <id> Numeric playbook id (required)
13355
+ --function-name <name> Function name exposed to window.alva.udf (required)
13356
+ --entry-script-path <path> Absolute ALFS path to a .js entry script (required)
13357
+ --params-schema <json> JSON Schema object/string for parameters_json
13358
+ --params-schema-file <path> Read JSON Schema from a local file
13359
+ --allow-charges Allow this function to charge viewer allowance
13360
+ --no-allow-charges Explicitly register as no-charge
13361
+
13362
+ List flags:
13363
+ --playbook-id <id> Numeric playbook id (required)
13364
+
13365
+ Delete flags:
13366
+ --playbook-id <id> Numeric playbook id (required)
13367
+ --function-name <name> Function name to delete (required)
13368
+
13369
+ Invoke flags:
13370
+ --playbook-id <id> Numeric playbook id (required)
13371
+ --function-name <name> Function name to invoke (required)
13372
+ --params <json> Parameters object passed as parameters_json
13373
+
13374
+ Allowance subcommands:
13375
+ allowance get Get your allowance for a playbook
13376
+ allowance list List your allowances
13377
+ allowance create Create or update your allowance for a playbook
13378
+ allowance revoke Revoke your allowance for a playbook
13379
+
13380
+ Allowance flags:
13381
+ --playbook-id <id> Numeric playbook id (required for get/create/revoke)
13382
+ --amount <credits> Positive integer allowance amount (required for create)
13383
+
13384
+ Notes:
13385
+ entry_script_path must be an absolute ALFS path under your home, such as
13386
+ /alva/home/alice/playbooks/my-playbook/udf/analyze.js. Use alva whoami to
13387
+ discover home_path. Use the browser runtime window.alva.udf for released
13388
+ playbook UI; this CLI is mainly for creator-side setup and smoke tests.
13389
+ Allowance commands use the gateway GraphQL session-user surface and reject
13390
+ playbook-scoped viewer tokens.
13391
+
13392
+ Examples:
13393
+ alva functions register --playbook-id 123 --function-name analyze --entry-script-path /alva/home/alice/playbooks/my-playbook/udf/analyze.js --params-schema-file ./schema.json --no-allow-charges
13394
+ alva functions list --playbook-id 123
13395
+ alva functions delete --playbook-id 123 --function-name analyze
13396
+ alva functions invoke --playbook-id 123 --function-name analyze --params '{"ticker":"AAPL"}'
13397
+ alva functions allowance create --playbook-id 123 --amount 25
13398
+ alva functions allowance get --playbook-id 123
13399
+ alva functions allowance list
13400
+ alva functions allowance revoke --playbook-id 123`,
12964
13401
  release: `Usage: alva release <subcommand> [options]
12965
13402
 
12966
13403
  Publish feeds and playbooks to the Alva platform. The typical workflow:
@@ -13234,33 +13671,63 @@ Examples:
13234
13671
  alva feedback submit --summary "bad quote data" --category data_quality`,
13235
13672
  subscriptions: `Usage: alva subscriptions <subcommand> [options]
13236
13673
 
13237
- Subscribe to playbooks and feeds.
13674
+ Three DISTINCT concepts share the word "subscribe" in the product:
13675
+ - FOLLOW \u2014 the social relation (the UI's "Subscribed Playbooks").
13676
+ Enumerate with: alva subscriptions follows
13677
+ - ALERTS \u2014 push/notification opt-ins (what list returns).
13678
+ - PURCHASE \u2014 paid playbook access / the SaaS plan. NOT this command.
13679
+
13680
+ Operations:
13238
13681
  - subscribe-playbook is a CASCADE: follows the playbook AND enables alerts
13239
13682
  on all its push-enabled automations (one call). unsubscribe-playbook
13240
- reverses both (unfollow + disable all of its alerts).
13683
+ reverses both and reports exactly what it changed
13684
+ ({unfollowed, wildcard_disabled}).
13241
13685
  - subscribe-feed / unsubscribe-feed toggle ONE feed's alert (a single
13242
13686
  automation) without touching the playbook follow.
13687
+ - unsubscribe disables alerts BY TARGET ID \u2014 bulk, idempotent, and the
13688
+ only way to clear ghost rows whose playbook/feed was deleted
13689
+ (name-addressed unsubscribe 404s on deleted targets).
13243
13690
 
13244
13691
  Subcommands:
13245
13692
  subscribe-playbook Subscribe a playbook (follow + enable all its alerts)
13246
13693
  unsubscribe-playbook Unsubscribe a playbook (unfollow + disable its alerts)
13247
13694
  subscribe-feed Enable alerts for a single feed
13248
13695
  unsubscribe-feed Disable alerts for a single feed
13249
- list List the caller's active subscriptions
13696
+ unsubscribe Bulk disable alerts by target id (handles ghosts)
13697
+ list List the caller's active alert subscriptions
13698
+ follows List the playbooks the caller follows
13250
13699
 
13251
- Subscribe/unsubscribe flags (playbook + feed):
13700
+ Subscribe/unsubscribe flags (playbook + feed, name-addressed):
13252
13701
  --username <user> Owner's username (required)
13253
13702
  --name <name> URL-safe playbook or feed name (required)
13254
13703
 
13704
+ Unsubscribe (by id) flags:
13705
+ --playbook-ids <a,b> Comma-separated playbook target ids
13706
+ --feed-ids <a,b> Comma-separated feed target ids
13707
+ (at least one of the two; max 100 ids total)
13708
+
13255
13709
  List flags:
13256
- --first <n> Optional page size
13710
+ --first <n> Optional page size (response carries total_count \u2014
13711
+ when items < total_count, keep paginating)
13257
13712
  --cursor <token> Optional cursor from the previous page
13258
13713
 
13714
+ Follows flags:
13715
+ --limit <n> Optional page size
13716
+ --cursor <token> Optional cursor from the previous page
13717
+
13718
+ List response notes:
13719
+ items[].kind PLAYBOOK_ALERTS (playbook-level wildcard) | FEED_ALERT
13720
+ items[].following Whether the caller also FOLLOWS the playbook
13721
+ items[].target_status ACTIVE | TARGET_DELETED (ghost \u2014 clear via
13722
+ unsubscribe --playbook-ids/--feed-ids) | PAUSED
13723
+ items[].playbook {owner_username, name, display_name} for PLAYBOOK rows
13724
+
13259
13725
  Examples:
13260
13726
  alva subscriptions subscribe-playbook --username alice --name btc-dashboard
13261
13727
  alva subscriptions subscribe-feed --username alice --name btc-ema-cross
13262
- alva subscriptions unsubscribe-feed --username alice --name btc-ema-cross
13263
- alva subscriptions list --first 20`,
13728
+ alva subscriptions unsubscribe --playbook-ids 8009,8010 --feed-ids 13292
13729
+ alva subscriptions list --first 200
13730
+ alva subscriptions follows`,
13264
13731
  channel: `Usage: alva channel group-subscriptions <subcommand> [options]
13265
13732
 
13266
13733
  Manage push notifications delivered into the external group chat attached
@@ -13466,6 +13933,7 @@ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
13466
13933
  "help",
13467
13934
  "execute-latest",
13468
13935
  "dry-run",
13936
+ "allow-charges",
13469
13937
  "json",
13470
13938
  "compress",
13471
13939
  "bypass-lint",
@@ -13531,6 +13999,17 @@ function requireNumericFlag(flags, name, command) {
13531
13999
  }
13532
14000
  return n;
13533
14001
  }
14002
+ function requirePositiveIntegerFlag(flags, name, command) {
14003
+ const val = requireFlag(flags, name, command);
14004
+ if (!/^[1-9]\d*$/.test(val)) {
14005
+ const group = command.split(" ")[0];
14006
+ throw new CliUsageError(
14007
+ `--${name} must be a positive integer for '${command}', got '${val}'`,
14008
+ group
14009
+ );
14010
+ }
14011
+ return Number(val);
14012
+ }
13534
14013
  function requirePositiveIntegerStringFlag(flags, name, command) {
13535
14014
  const val = requireFlag(flags, name, command);
13536
14015
  if (!/^[1-9]\d*$/.test(val)) {
@@ -13620,6 +14099,39 @@ function jsonObjectFlag(flags, name, command) {
13620
14099
  }
13621
14100
  return parsed;
13622
14101
  }
14102
+ function jsonRequiredFlag(flags, name, command) {
14103
+ const raw = requireFlag(flags, name, command);
14104
+ try {
14105
+ return JSON.parse(raw);
14106
+ } catch {
14107
+ throw new CliUsageError(
14108
+ `--${name} must be valid JSON for '${command}'`,
14109
+ command.split(" ")[0]
14110
+ );
14111
+ }
14112
+ }
14113
+ function jsonSchemaStringFlag(flags, command) {
14114
+ const inlineSchema = flags["params-schema"];
14115
+ const schemaFile = flags["params-schema-file"];
14116
+ if (inlineSchema !== void 0 && schemaFile !== void 0) {
14117
+ throw new CliUsageError(
14118
+ "--params-schema and --params-schema-file are mutually exclusive",
14119
+ command.split(" ")[0]
14120
+ );
14121
+ }
14122
+ const raw = schemaFile !== void 0 ? fs2.readFileSync(schemaFile, "utf-8") : inlineSchema;
14123
+ if (raw === void 0) return void 0;
14124
+ try {
14125
+ JSON.parse(raw);
14126
+ } catch {
14127
+ const flag = schemaFile !== void 0 ? "params-schema-file" : "params-schema";
14128
+ throw new CliUsageError(
14129
+ `--${flag} must contain valid JSON for '${command}'`,
14130
+ command.split(" ")[0]
14131
+ );
14132
+ }
14133
+ return raw;
14134
+ }
13623
14135
  async function dispatch(client, args, meta) {
13624
14136
  const group = args[0];
13625
14137
  if (!group || group === "--help" || group === "-h") {
@@ -13903,6 +14415,28 @@ async function dispatch(client, args, meta) {
13903
14415
  requireFlag(flags, "visibility", "playbooks set-visibility")
13904
14416
  )
13905
14417
  });
14418
+ case "get": {
14419
+ const ids = csvList(flags["ids"]);
14420
+ if (ids && ids.length > 0) {
14421
+ return client.playbooks.getByIds(ids);
14422
+ }
14423
+ if (flags["id"]) {
14424
+ return client.playbooks.get({ id: flags["id"] });
14425
+ }
14426
+ if (flags["ref"]) {
14427
+ return client.playbooks.get({ ref: flags["ref"] });
14428
+ }
14429
+ throw new CliUsageError(
14430
+ "--id, --ids or --ref is required",
14431
+ "playbooks"
14432
+ );
14433
+ }
14434
+ case "list":
14435
+ return client.playbooks.listByOwner({
14436
+ owner: requireFlag(flags, "owner", "playbooks list"),
14437
+ limit: num(flags["limit"]),
14438
+ cursor: flags["cursor"]
14439
+ });
13906
14440
  default:
13907
14441
  throw new CliUsageError(
13908
14442
  `Unknown subcommand: playbooks ${subcommand}`,
@@ -13910,6 +14444,119 @@ async function dispatch(client, args, meta) {
13910
14444
  );
13911
14445
  }
13912
14446
  }
14447
+ case "functions": {
14448
+ if (!subcommand)
14449
+ throw new CliUsageError(
14450
+ "Missing subcommand for functions",
14451
+ "functions"
14452
+ );
14453
+ switch (subcommand) {
14454
+ case "allowance": {
14455
+ const leaf = args[2];
14456
+ if (!leaf || leaf === "--help" || leaf === "-h") {
14457
+ return { _help: true, text: COMMAND_HELP.functions };
14458
+ }
14459
+ switch (leaf) {
14460
+ case "get":
14461
+ return client.functions.getAllowance({
14462
+ playbook_id: requireNumericFlag(
14463
+ flags,
14464
+ "playbook-id",
14465
+ "functions allowance get"
14466
+ )
14467
+ });
14468
+ case "list":
14469
+ return client.functions.listAllowances();
14470
+ case "create":
14471
+ return client.functions.createAllowance({
14472
+ playbook_id: requireNumericFlag(
14473
+ flags,
14474
+ "playbook-id",
14475
+ "functions allowance create"
14476
+ ),
14477
+ amount: requirePositiveIntegerFlag(
14478
+ flags,
14479
+ "amount",
14480
+ "functions allowance create"
14481
+ )
14482
+ });
14483
+ case "revoke":
14484
+ return client.functions.revokeAllowance({
14485
+ playbook_id: requireNumericFlag(
14486
+ flags,
14487
+ "playbook-id",
14488
+ "functions allowance revoke"
14489
+ )
14490
+ });
14491
+ default:
14492
+ throw new CliUsageError(
14493
+ `Unknown subcommand: functions allowance ${leaf}`,
14494
+ "functions"
14495
+ );
14496
+ }
14497
+ }
14498
+ case "register":
14499
+ return client.functions.register({
14500
+ playbook_id: requireNumericFlag(
14501
+ flags,
14502
+ "playbook-id",
14503
+ "functions register"
14504
+ ),
14505
+ function_name: requireFlag(
14506
+ flags,
14507
+ "function-name",
14508
+ "functions register"
14509
+ ),
14510
+ entry_script_path: requireFlag(
14511
+ flags,
14512
+ "entry-script-path",
14513
+ "functions register"
14514
+ ),
14515
+ params_schema: jsonSchemaStringFlag(flags, "functions register"),
14516
+ allow_charges: boolFlag(flags["allow-charges"])
14517
+ });
14518
+ case "list":
14519
+ return client.functions.list({
14520
+ playbook_id: requireNumericFlag(
14521
+ flags,
14522
+ "playbook-id",
14523
+ "functions list"
14524
+ )
14525
+ });
14526
+ case "delete":
14527
+ return client.functions.delete({
14528
+ playbook_id: requireNumericFlag(
14529
+ flags,
14530
+ "playbook-id",
14531
+ "functions delete"
14532
+ ),
14533
+ function_name: requireFlag(
14534
+ flags,
14535
+ "function-name",
14536
+ "functions delete"
14537
+ )
14538
+ });
14539
+ case "invoke":
14540
+ return client.functions.invoke({
14541
+ playbook_id: requireNumericFlag(
14542
+ flags,
14543
+ "playbook-id",
14544
+ "functions invoke"
14545
+ ),
14546
+ function_name: requireFlag(
14547
+ flags,
14548
+ "function-name",
14549
+ "functions invoke"
14550
+ ),
14551
+ parameters: flags["params"] === void 0 ? void 0 : jsonRequiredFlag(flags, "params", "functions invoke")
14552
+ });
14553
+ default:
14554
+ throw new CliUsageError(
14555
+ `Unknown subcommand: functions ${subcommand}`,
14556
+ "functions"
14557
+ );
14558
+ }
14559
+ }
13913
14560
  case "release": {
13914
14561
  if (!subcommand)
13915
14562
  throw new CliUsageError("Missing subcommand for release", "release");
@@ -14327,6 +14974,25 @@ async function dispatch(client, args, meta) {
14327
14974
  first: num(flags["first"]),
14328
14975
  cursor: flags["cursor"]
14329
14976
  });
14977
+ case "follows":
14978
+ return client.subscriptions.follows({
14979
+ limit: num(flags["limit"]),
14980
+ cursor: flags["cursor"]
14981
+ });
14982
+ case "unsubscribe": {
14983
+ const playbookIds = csvList(flags["playbook-ids"]) ?? [];
14984
+ const feedIds = csvList(flags["feed-ids"]) ?? [];
14985
+ if (playbookIds.length === 0 && feedIds.length === 0) {
14986
+ throw new CliUsageError(
14987
+ "--playbook-ids or --feed-ids is required",
14988
+ "subscriptions"
14989
+ );
14990
+ }
14991
+ return client.subscriptions.unsubscribeBatch({
14992
+ playbookIds,
14993
+ feedIds
14994
+ });
14995
+ }
14330
14996
  default:
14331
14997
  throw new CliUsageError(
14332
14998
  `Unknown subcommand: subscriptions ${subcommand}`,