@alva-ai/toolkit 0.15.1-beta.0 → 0.16.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.d.ts CHANGED
@@ -371,6 +371,20 @@ interface FeedDeleteResponse {
371
371
  /** Echoed feed id (string form, matching gateway response). */
372
372
  id: string;
373
373
  }
374
+ /** Feed visibility: 'public' publishes the feed, 'private' unpublishes it. */
375
+ type FeedVisibility = 'public' | 'private';
376
+ interface FeedSetVisibilityRequest {
377
+ /** Numeric feed id to publish/unpublish. */
378
+ id: number;
379
+ /** Target visibility. */
380
+ visibility: FeedVisibility;
381
+ }
382
+ interface FeedSetVisibilityResponse {
383
+ /** Echoed feed id (string form, matching gateway response). */
384
+ id: string;
385
+ /** Feed visibility after the update. */
386
+ visibility: FeedVisibility;
387
+ }
374
388
  interface PlaybookDraftRequest {
375
389
  name: string;
376
390
  display_name: string;
@@ -917,6 +931,33 @@ interface ChannelGroupSubscriptionMutationResponse {
917
931
  admin: ChannelGroupAdminInfo | null;
918
932
  subscriptions: ChannelGroupSubscription[];
919
933
  }
934
+ /** Params for reading a group's buffered chat history (group-chat digest). */
935
+ interface ChannelGroupHistoryParams {
936
+ /** Platform: "telegram" | "discord" | "slack". */
937
+ channel: string;
938
+ /** Platform group/channel id. */
939
+ remote_chat_id: string;
940
+ /** Window start, message-origin timestamp in microseconds (inclusive). */
941
+ from_micros: number | string;
942
+ /** Window end, message-origin timestamp in microseconds (inclusive). */
943
+ to_micros: number | string;
944
+ }
945
+ /** One buffered group message, projected for the digest. */
946
+ interface GroupChatMessage {
947
+ sender_username: string;
948
+ content: string;
949
+ /** "[photo]" etc. when the message carried media. */
950
+ media_summary: string;
951
+ ts_micros: number;
952
+ /** Deep link back to the original message; empty when unavailable. */
953
+ permalink: string;
954
+ /** "user" | "assistant" (bot replies). */
955
+ role: string;
956
+ }
957
+ interface ChannelGroupHistoryResponse {
958
+ /** Chronological (ts ascending). */
959
+ messages: GroupChatMessage[];
960
+ }
920
961
  interface ServiceAccount {
921
962
  id: string;
922
963
  display_name: string;
@@ -1071,6 +1112,18 @@ declare class FeedResource {
1071
1112
  * Auth: caller must own the feed (uid match), enforced by the backend.
1072
1113
  */
1073
1114
  delete(params: FeedDeleteRequest): Promise<FeedDeleteResponse>;
1115
+ /**
1116
+ * Publish or unpublish a feed. Backed by POST /api/v1/feed/:id/visibility.
1117
+ *
1118
+ * Setting visibility to 'public' publishes the feed (the backend sets
1119
+ * feeds.is_public and projects the ALFS public read grant in the same
1120
+ * transaction); 'private' unpublishes it. Prefer this over granting the
1121
+ * ALFS public read subject directly (e.g. `alva fs grant`), which bypasses
1122
+ * the is_public flag and causes drift.
1123
+ *
1124
+ * Auth: caller must own the feed (uid match), enforced by the backend.
1125
+ */
1126
+ setVisibility(params: FeedSetVisibilityRequest): Promise<FeedSetVisibilityResponse>;
1074
1127
  }
1075
1128
 
1076
1129
  /**
@@ -1553,6 +1606,7 @@ declare class AlertsResource {
1553
1606
  private client;
1554
1607
  constructor(client: AlvaClient);
1555
1608
  list(params?: PushSubscriptionListParams): Promise<PushSubscriptionListResponse>;
1609
+ follows(params?: FollowsListParams): Promise<FollowsListResponse>;
1556
1610
  enableAutomation(params: PushSubscriptionFeedParams): Promise<SubscribeFeedResponse>;
1557
1611
  disableAutomation(params: PushSubscriptionFeedParams): Promise<UnsubscribeResponse>;
1558
1612
  enablePlaybook(params: PushSubscriptionPlaybookParams): Promise<SubscribePlaybookResponse>;
@@ -1578,6 +1632,14 @@ declare class ChannelGroupSubscriptionsResource {
1578
1632
  list(params: ChannelGroupSubscriptionSessionParams): Promise<ChannelGroupSubscriptionListResponse>;
1579
1633
  subscribe(params: ChannelGroupSubscriptionMutationParams): Promise<ChannelGroupSubscriptionMutationResponse>;
1580
1634
  unsubscribe(params: ChannelGroupSubscriptionMutationParams): Promise<ChannelGroupSubscriptionMutationResponse>;
1635
+ /**
1636
+ * Read a group's buffered chat messages in a time window, for the group-chat
1637
+ * digest automation. Admin-gated: the authenticated caller must be that
1638
+ * group's Alva admin (a digest feed runs as that admin). Each message carries
1639
+ * a `permalink` deep-link back to the original message for "jump to original".
1640
+ * `from_micros`/`to_micros` are message-origin timestamps in microseconds.
1641
+ */
1642
+ getGroupChatHistory(params: ChannelGroupHistoryParams): Promise<ChannelGroupHistoryResponse>;
1581
1643
  }
1582
1644
 
1583
1645
  declare class FeedbackResource {
package/dist/cli.js CHANGED
@@ -9938,6 +9938,29 @@ var FeedResource = class {
9938
9938
  `/api/v1/feed/${encodeURIComponent(String(id))}`
9939
9939
  );
9940
9940
  }
9941
+ /**
9942
+ * Publish or unpublish a feed. Backed by POST /api/v1/feed/:id/visibility.
9943
+ *
9944
+ * Setting visibility to 'public' publishes the feed (the backend sets
9945
+ * feeds.is_public and projects the ALFS public read grant in the same
9946
+ * transaction); 'private' unpublishes it. Prefer this over granting the
9947
+ * ALFS public read subject directly (e.g. `alva fs grant`), which bypasses
9948
+ * the is_public flag and causes drift.
9949
+ *
9950
+ * Auth: caller must own the feed (uid match), enforced by the backend.
9951
+ */
9952
+ async setVisibility(params) {
9953
+ this.client._requireAuth();
9954
+ const id = requireFeedID(params.id);
9955
+ if (params.visibility !== "public" && params.visibility !== "private") {
9956
+ throw new Error("visibility must be 'public' or 'private'");
9957
+ }
9958
+ return this.client._request(
9959
+ "POST",
9960
+ `/api/v1/feed/${encodeURIComponent(String(id))}/visibility`,
9961
+ { body: { visibility: params.visibility } }
9962
+ );
9963
+ }
9941
9964
  };
9942
9965
  function requireFeedID(id) {
9943
9966
  if (!Number.isInteger(id) || id <= 0) {
@@ -10238,16 +10261,6 @@ var SKILL_ENDPOINT_METADATA = [
10238
10261
  access: "free_and_pro",
10239
10262
  pro_required: false
10240
10263
  },
10241
- {
10242
- skill: "arrays-data-api-spot-market-price-and-volume",
10243
- file: "crypto-detail",
10244
- method: "GET",
10245
- path: "/api/v1/crypto/detail",
10246
- tier: "public",
10247
- required_subscription_tier: "free",
10248
- access: "free_and_pro",
10249
- pro_required: false
10250
- },
10251
10264
  {
10252
10265
  skill: "arrays-data-api-crypto-metrics-and-screener",
10253
10266
  file: "fear-greed-index",
@@ -10288,16 +10301,6 @@ var SKILL_ENDPOINT_METADATA = [
10288
10301
  access: "free_and_pro",
10289
10302
  pro_required: false
10290
10303
  },
10291
- {
10292
- skill: "arrays-data-api-crypto-metrics-and-screener",
10293
- file: "list",
10294
- method: "GET",
10295
- path: "/api/v1/crypto/list",
10296
- tier: "public",
10297
- required_subscription_tier: "free",
10298
- access: "free_and_pro",
10299
- pro_required: false
10300
- },
10301
10304
  {
10302
10305
  skill: "arrays-data-api-crypto-futures-data",
10303
10306
  file: "long-short-ratio",
@@ -10360,9 +10363,9 @@ var SKILL_ENDPOINT_METADATA = [
10360
10363
  },
10361
10364
  {
10362
10365
  skill: "arrays-data-api-crypto-metrics-and-screener",
10363
- file: "trading-pair",
10366
+ file: "crypto-detail",
10364
10367
  method: "GET",
10365
- path: "/api/v1/crypto/trading-pair",
10368
+ path: "/api/v1/crypto/detail",
10366
10369
  tier: "public",
10367
10370
  required_subscription_tier: "free",
10368
10371
  access: "free_and_pro",
@@ -10968,6 +10971,26 @@ var SKILL_ENDPOINT_METADATA = [
10968
10971
  access: "pro_only",
10969
10972
  pro_required: true
10970
10973
  },
10974
+ {
10975
+ skill: "arrays-data-api-options",
10976
+ file: "greeks",
10977
+ method: "GET",
10978
+ path: "/api/v1/options/greeks",
10979
+ tier: "alternative",
10980
+ required_subscription_tier: "pro",
10981
+ access: "pro_only",
10982
+ pro_required: true
10983
+ },
10984
+ {
10985
+ skill: "arrays-data-api-options",
10986
+ file: "chain",
10987
+ method: "GET",
10988
+ path: "/api/v1/options/chain",
10989
+ tier: "alternative",
10990
+ required_subscription_tier: "pro",
10991
+ access: "pro_only",
10992
+ pro_required: true
10993
+ },
10971
10994
  {
10972
10995
  skill: "arrays-data-api-equity-fundamentals",
10973
10996
  file: "company-executives",
@@ -11331,6 +11354,66 @@ var SKILL_ENDPOINT_METADATA = [
11331
11354
  required_subscription_tier: "free",
11332
11355
  access: "free_and_pro",
11333
11356
  pro_required: false
11357
+ },
11358
+ {
11359
+ skill: "arrays-data-api-semiconductor-price",
11360
+ file: "dram-spot-price",
11361
+ method: "GET",
11362
+ path: "/api/v1/other/semiconductor/dram-spot-price",
11363
+ tier: "alternative",
11364
+ required_subscription_tier: "pro",
11365
+ access: "pro_only",
11366
+ pro_required: true
11367
+ },
11368
+ {
11369
+ skill: "arrays-data-api-semiconductor-price",
11370
+ file: "dram-contract-price",
11371
+ method: "GET",
11372
+ path: "/api/v1/other/semiconductor/dram-contract-price",
11373
+ tier: "alternative",
11374
+ required_subscription_tier: "pro",
11375
+ access: "pro_only",
11376
+ pro_required: true
11377
+ },
11378
+ {
11379
+ skill: "arrays-data-api-semiconductor-price",
11380
+ file: "nand-flash-spot-price",
11381
+ method: "GET",
11382
+ path: "/api/v1/other/semiconductor/nand-flash-spot-price",
11383
+ tier: "alternative",
11384
+ required_subscription_tier: "pro",
11385
+ access: "pro_only",
11386
+ pro_required: true
11387
+ },
11388
+ {
11389
+ skill: "arrays-data-api-semiconductor-price",
11390
+ file: "nand-flash-contract-price",
11391
+ method: "GET",
11392
+ path: "/api/v1/other/semiconductor/nand-flash-contract-price",
11393
+ tier: "alternative",
11394
+ required_subscription_tier: "pro",
11395
+ access: "pro_only",
11396
+ pro_required: true
11397
+ },
11398
+ {
11399
+ skill: "arrays-data-api-semiconductor-price",
11400
+ file: "memory-card-price",
11401
+ method: "GET",
11402
+ path: "/api/v1/other/semiconductor/memory-card-price",
11403
+ tier: "alternative",
11404
+ required_subscription_tier: "pro",
11405
+ access: "pro_only",
11406
+ pro_required: true
11407
+ },
11408
+ {
11409
+ skill: "arrays-data-api-semiconductor-price",
11410
+ file: "dxi-index",
11411
+ method: "GET",
11412
+ path: "/api/v1/other/semiconductor/dxi-index",
11413
+ tier: "alternative",
11414
+ required_subscription_tier: "pro",
11415
+ access: "pro_only",
11416
+ pro_required: true
11334
11417
  }
11335
11418
  ];
11336
11419
  function getSkillEndpointMetadata(skill, file) {
@@ -11909,6 +11992,9 @@ var AlertsResource = class {
11909
11992
  list(params = {}) {
11910
11993
  return this.client.subscriptions.list(params);
11911
11994
  }
11995
+ follows(params = {}) {
11996
+ return this.client.subscriptions.follows(params);
11997
+ }
11912
11998
  enableAutomation(params) {
11913
11999
  return this.client.subscriptions.subscribeFeed(params);
11914
12000
  }
@@ -11976,6 +12062,24 @@ var ChannelGroupSubscriptionsResource = class {
11976
12062
  }
11977
12063
  );
11978
12064
  }
12065
+ /**
12066
+ * Read a group's buffered chat messages in a time window, for the group-chat
12067
+ * digest automation. Admin-gated: the authenticated caller must be that
12068
+ * group's Alva admin (a digest feed runs as that admin). Each message carries
12069
+ * a `permalink` deep-link back to the original message for "jump to original".
12070
+ * `from_micros`/`to_micros` are message-origin timestamps in microseconds.
12071
+ */
12072
+ async getGroupChatHistory(params) {
12073
+ this.client._requireAuth();
12074
+ return this.client._request("GET", "/api/v1/channel/group-history", {
12075
+ query: {
12076
+ channel: params.channel,
12077
+ remote_chat_id: params.remote_chat_id,
12078
+ from_micros: String(params.from_micros),
12079
+ to_micros: String(params.to_micros)
12080
+ }
12081
+ });
12082
+ }
11979
12083
  };
11980
12084
  function mutationBody(params) {
11981
12085
  return `{"session_id":${idLiteral(params.session_id)},"target_type":${JSON.stringify(params.target_type)},"target_id":${idLiteral(params.target_id)}}`;
@@ -13546,7 +13650,7 @@ import * as fs2 from "fs";
13546
13650
  import * as os2 from "os";
13547
13651
  import * as fsPromises2 from "fs/promises";
13548
13652
  import { Agent, setGlobalDispatcher } from "undici";
13549
- var CLI_VERSION = true ? "0.15.1-beta.0" : "dev";
13653
+ var CLI_VERSION = true ? "0.16.0" : "dev";
13550
13654
  var DEFAULT_RUN_TIMEOUT_MS = 6e5;
13551
13655
  var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
13552
13656
  var configuredRunFetchTimeoutMs;
@@ -13580,8 +13684,8 @@ Commands:
13580
13684
  release Feed and playbook releases (feed, playbook-draft, playbook)
13581
13685
  lint Design-system lint (playbook)
13582
13686
  automation Automation management (list, inspect, publish, stop, resume, delete)
13583
- alert Alert management (list, enable, disable, history, preferences, enable-session-completed, disable-session-completed)
13584
- feed Legacy automation alias (list, stop, resume, delete)
13687
+ alert Alert management (list, follows, enable, disable, history, preferences, enable-session-completed, disable-session-completed)
13688
+ feed Legacy automation alias (list, stop, resume, delete, set-visibility)
13585
13689
  playbooks Playbook discovery (trending, get, list) and visibility
13586
13690
  functions Playbook UDF function management (register, list, delete, invoke, allowance)
13587
13691
  credits Credit wallet and self-scoped usage history (wallet, items)
@@ -13598,6 +13702,7 @@ Commands:
13598
13702
  remix Save playbook remix lineage
13599
13703
  portfolio Connected-account portfolio (accounts, summary, activities)
13600
13704
  trading Trading operations (accounts, portfolio, orders, subscriptions, equity-history, risk-rules, subscribe, unsubscribe, execute, update-risk-rules)
13705
+ broker Agentic order execution \u2014 venue-native passthrough to trex (accounts, quote, order, balance, positions, ...; run 'alva broker describe')
13601
13706
  auth Authentication (login)
13602
13707
  screenshot Capture a web screenshot as PNG
13603
13708
  arrays Arrays backend operations (token ensure, token status)
@@ -13987,6 +14092,7 @@ playbooks. Delivery history and global alert preferences live here too.
13987
14092
 
13988
14093
  Subcommands:
13989
14094
  list List the caller's active alerts
14095
+ follows List the playbooks the caller follows
13990
14096
  enable Enable an alert for an automation or playbook
13991
14097
  disable Disable alerts by automation/playbook name or id
13992
14098
  history List alert delivery history for an automation or playbook
@@ -14008,6 +14114,10 @@ List flags:
14008
14114
  --cursor <token> Optional cursor from previous response
14009
14115
  --json Print raw JSON instead of a human-readable summary
14010
14116
 
14117
+ Follows flags:
14118
+ --limit <n> Optional page size
14119
+ --cursor <token> Optional cursor from previous response
14120
+
14011
14121
  History flags:
14012
14122
  --channel <name> Optional delivery channel filter
14013
14123
  --status <status> Optional status filter (sent, failed, filtered)
@@ -14015,6 +14125,7 @@ History flags:
14015
14125
 
14016
14126
  Examples:
14017
14127
  alva alert list
14128
+ alva alert follows --limit 20
14018
14129
  alva alert enable --automation alice/btc-ema
14019
14130
  alva alert disable --automation alice/btc-ema
14020
14131
  alva alert enable --playbook alice/btc-dashboard
@@ -14027,13 +14138,15 @@ Examples:
14027
14138
  Legacy alias for automation lifecycle management. Prefer "alva automation".
14028
14139
 
14029
14140
  Subcommands:
14030
- list List feeds owned by the caller
14031
- stop Stop a feed's producer cronjob
14032
- resume Resume a stopped feed's producer cronjob
14033
- delete Soft-delete a feed and all its active majors
14141
+ list List feeds owned by the caller
14142
+ stop Stop a feed's producer cronjob
14143
+ resume Resume a stopped feed's producer cronjob
14144
+ delete Soft-delete a feed and all its active majors
14145
+ set-visibility Publish or unpublish a feed (--visibility public|private)
14034
14146
 
14035
14147
  Flags:
14036
- --id <feed_id> Numeric feed id (required for stop/resume/delete)
14148
+ --id <feed_id> Numeric feed id (required for stop/resume/delete/set-visibility)
14149
+ --visibility <level> public | private (required for set-visibility)
14037
14150
 
14038
14151
  List flags:
14039
14152
  --limit <n> Max results per page (default 50, max 100 server-side)
@@ -14047,6 +14160,10 @@ Notes:
14047
14160
  - delete cascades to all active feed_majors in the same DB transaction.
14048
14161
  - delete removes producer cronjobs best-effort; the cronjob scavenger
14049
14162
  reconciles any leftover rows on its next sweep.
14163
+ - set-visibility publishes (public) or unpublishes (private) a feed; the
14164
+ backend sets feeds.is_public and projects the ALFS public read grant
14165
+ together. Prefer this over "alva fs grant" on the feed path, which causes
14166
+ drift.
14050
14167
  - Auth: caller must own the feed (uid match), enforced by the backend.
14051
14168
 
14052
14169
  Examples:
@@ -14054,7 +14171,9 @@ Examples:
14054
14171
  alva feed list --status all --limit 20
14055
14172
  alva feed stop --id 42
14056
14173
  alva feed resume --id 42
14057
- alva feed delete --id 42`,
14174
+ alva feed delete --id 42
14175
+ alva feed set-visibility --id 42 --visibility public
14176
+ alva feed set-visibility --id 42 --visibility private`,
14058
14177
  playbooks: `Usage: alva playbooks <subcommand> [options]
14059
14178
 
14060
14179
  Find and resolve playbooks with an agent-friendly response shape.
@@ -14988,6 +15107,16 @@ function playbookVisibility(val) {
14988
15107
  "playbooks"
14989
15108
  );
14990
15109
  }
15110
+ function feedVisibility(val) {
15111
+ const normalized = val.trim().toLowerCase();
15112
+ if (normalized === "public" || normalized === "private") {
15113
+ return normalized;
15114
+ }
15115
+ throw new CliUsageError(
15116
+ `--visibility must be one of public, private for 'feed set-visibility', got '${val}'`,
15117
+ "feed"
15118
+ );
15119
+ }
14991
15120
  function parseCreditsTimestamp(value, flag, command) {
14992
15121
  const trimmed = value.trim();
14993
15122
  if (/^\d+$/.test(trimmed)) {
@@ -15544,6 +15673,13 @@ async function dispatch(client, args, meta, deps) {
15544
15673
  return client.feed.delete({
15545
15674
  id: requireNumericFlag(flags, "id", "feed delete")
15546
15675
  });
15676
+ case "set-visibility":
15677
+ return client.feed.setVisibility({
15678
+ id: requireNumericFlag(flags, "id", "feed set-visibility"),
15679
+ visibility: feedVisibility(
15680
+ requireFlag(flags, "visibility", "feed set-visibility")
15681
+ )
15682
+ });
15547
15683
  default:
15548
15684
  throw new CliUsageError(
15549
15685
  `Unknown subcommand: feed ${subcommand}`,
@@ -16245,6 +16381,11 @@ async function dispatch(client, args, meta, deps) {
16245
16381
  });
16246
16382
  return boolFlag(flags["json"]) ? result : formatAlertList(result);
16247
16383
  }
16384
+ case "follows":
16385
+ return client.alerts.follows({
16386
+ limit: num(flags["limit"]),
16387
+ cursor: flags["cursor"]
16388
+ });
16248
16389
  case "enable": {
16249
16390
  const target = requireSingleAlertTarget(flags, "alert enable");
16250
16391
  return target.kind === "automation" ? client.alerts.enableAutomation(target.target) : client.alerts.enablePlaybook(target.target);
@@ -16640,6 +16781,10 @@ function stripGlobalFlags(argv) {
16640
16781
  const result = [];
16641
16782
  for (let i = 0; i < argv.length; i++) {
16642
16783
  const a = argv[i];
16784
+ if (a === "broker") {
16785
+ result.push(...argv.slice(i));
16786
+ break;
16787
+ }
16643
16788
  if (GLOBAL_FLAGS.includes(a)) {
16644
16789
  i++;
16645
16790
  continue;