@alva-ai/toolkit 0.37.0-beta.0 → 0.38.0-beta.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/dispatch.js CHANGED
@@ -6240,6 +6240,9 @@ var EMBEDDED_COMMAND_DEFINITIONS = [
6240
6240
  route("people follows list", "people follows list", {
6241
6241
  values: ["kind", "limit", "cursor"]
6242
6242
  }),
6243
+ route("people follows theses", "people follows theses", {
6244
+ values: ["cursor"]
6245
+ }),
6243
6246
  route("people follows follow", "people follows follow", {
6244
6247
  values: ["kind", "id"]
6245
6248
  }),
@@ -6796,16 +6799,18 @@ resolves. add re-adds a ticker the user removed earlier. list takes
6796
6799
 
6797
6800
  Subcommands:
6798
6801
  search --query <text> [--kind user|person] [--limit <1-50>]
6799
- follows list|follow|unfollow
6802
+ follows list|theses|follow|unfollow
6800
6803
 
6801
6804
  USER is an Alva user; PERSON is a curated person (KOL). follow/unfollow take
6802
6805
  --kind and --id from search or list results. Search is a prefix match on
6803
6806
  name, username, or slug. Follow only an exact match; when several profiles
6804
6807
  match, ask the user which one. Act only when the user asks to follow or
6805
6808
  unfollow.`,
6806
- "people follows": `Usage: alva people follows <list|follow|unfollow> [options]
6809
+ "people follows": `Usage: alva people follows <list|theses|follow|unfollow> [options]
6807
6810
 
6808
6811
  list: [--kind user|person] [--limit <1-50>] [--cursor <pageInfo.endCursor>]
6812
+ theses: [--cursor <next_cursor>] Thesis Updates by followed profiles in the
6813
+ order they reached Alva; page while has_more, keep the last next_cursor
6809
6814
  follow|unfollow: --kind user|person --id <profile id>`,
6810
6815
  "trading-pairs": `Usage: alva trading-pairs <subcommand>
6811
6816
 
@@ -7216,103 +7221,8 @@ function validateXReadParams(params) {
7216
7221
  }
7217
7222
  }
7218
7223
 
7219
- // src/resources/follows.ts
7220
- var MAX_TICKERS = 50;
7221
- var MAX_TICKER_LENGTH = 40;
7222
- var MAX_PROFILE_FIRST = 50;
7223
- var MAX_PROFILE_QUERY_LENGTH = 200;
7224
- var TICKER_KINDS = ["STOCK", "ETF", "CRYPTO"];
7225
- var PROFILE_KINDS = ["USER", "PERSON"];
7226
- function record2(value) {
7227
- return typeof value === "object" && value !== null && !Array.isArray(value);
7228
- }
7229
- function boundedFirst(value, max, name = "first") {
7230
- if (value === void 0) return void 0;
7231
- if (!Number.isInteger(value) || value < 1 || value > max) {
7232
- throw new Error(`${name} must be an integer between 1 and ${max}`);
7233
- }
7234
- return value;
7235
- }
7236
- function profileKind(value, required) {
7237
- if (value === void 0 && !required) return void 0;
7238
- if (typeof value !== "string" || !PROFILE_KINDS.includes(value)) {
7239
- throw new Error("kind must be USER or PERSON");
7240
- }
7241
- return value;
7242
- }
7243
- function tickerKind(value) {
7244
- if (value === void 0) return void 0;
7245
- if (typeof value !== "string" || !TICKER_KINDS.includes(value)) {
7246
- throw new Error("kind must be STOCK, ETF, or CRYPTO");
7247
- }
7248
- return value;
7249
- }
7250
- function parseTickerSpec(raw) {
7251
- const separator = raw.lastIndexOf(":");
7252
- if (separator === -1) return { ticker: raw };
7253
- return {
7254
- ticker: raw.slice(0, separator),
7255
- kind: tickerKind(
7256
- raw.slice(separator + 1).trim().toUpperCase()
7257
- )
7258
- };
7259
- }
7260
- function normalizeWatchlistTickersParams(params) {
7261
- if (!record2(params) || !Array.isArray(params.tickers)) {
7262
- throw new Error("tickers must be a list of ticker symbols");
7263
- }
7264
- const defaultKind = tickerKind(params.kind);
7265
- const tickers = [];
7266
- for (const raw of params.tickers) {
7267
- const spec = typeof raw === "string" ? { ticker: raw } : raw;
7268
- if (!record2(spec) || typeof spec.ticker !== "string") {
7269
- throw new Error("tickers must be symbols or {ticker, kind} specs");
7270
- }
7271
- const ticker = spec.ticker.trim().toUpperCase();
7272
- if (!ticker || /\s/.test(ticker) || ticker.length > MAX_TICKER_LENGTH) {
7273
- throw new Error(
7274
- `ticker '${spec.ticker}' must be a non-empty symbol of at most ${MAX_TICKER_LENGTH} characters`
7275
- );
7276
- }
7277
- const kind = tickerKind(spec.kind) ?? defaultKind;
7278
- if (!tickers.some((t) => t.ticker === ticker && t.kind === kind)) {
7279
- tickers.push(kind === void 0 ? { ticker } : { ticker, kind });
7280
- }
7281
- }
7282
- if (tickers.length === 0 || tickers.length > MAX_TICKERS) {
7283
- throw new Error(
7284
- `tickers must contain between 1 and ${MAX_TICKERS} symbols`
7285
- );
7286
- }
7287
- return { tickers };
7288
- }
7289
- function validateProfileRef(params) {
7290
- if (!record2(params)) throw new Error("profile reference must be an object");
7291
- const kind = profileKind(params.kind, true);
7292
- if (typeof params.id !== "string" || !/^[1-9]\d{0,18}$/.test(params.id)) {
7293
- throw new Error("id must be a positive decimal profile id");
7294
- }
7295
- return { kind, id: params.id };
7296
- }
7297
- function validateSearchProfilesParams(params) {
7298
- if (!record2(params) || typeof params.query !== "string") {
7299
- throw new Error("query is required");
7300
- }
7301
- const query = params.query.trim();
7302
- if (!query || query.length > MAX_PROFILE_QUERY_LENGTH) {
7303
- throw new Error(
7304
- `query must be non-empty and at most ${MAX_PROFILE_QUERY_LENGTH} characters`
7305
- );
7306
- }
7307
- return {
7308
- query,
7309
- kind: profileKind(params.kind, false),
7310
- first: boundedFirst(params.first, MAX_PROFILE_FIRST)
7311
- };
7312
- }
7313
-
7314
7224
  // src/resources/thesisPublication.ts
7315
- function record3(value) {
7225
+ function record2(value) {
7316
7226
  return typeof value === "object" && value !== null && !Array.isArray(value);
7317
7227
  }
7318
7228
  function isPositiveInt64(value) {
@@ -7385,7 +7295,7 @@ var SELECTORS = [
7385
7295
  "entityId"
7386
7296
  ];
7387
7297
  function validateThesisPageParams(params) {
7388
- if (!record3(params)) throw argument("Thesis parameters must be an object");
7298
+ if (!record2(params)) throw argument("Thesis parameters must be an object");
7389
7299
  const first = params.first === void 0 ? 10 : params.first;
7390
7300
  if (typeof first !== "number" || !Number.isInteger(first) || first < 1 || first > 50) {
7391
7301
  throw argument("first must be an integer between 1 and 50");
@@ -7421,6 +7331,104 @@ function argument(message) {
7421
7331
  return new AlvaError("INVALID_ARGUMENT", message, 400);
7422
7332
  }
7423
7333
 
7334
+ // src/resources/theses.ts
7335
+ var encoder = new TextEncoder();
7336
+
7337
+ // src/resources/follows.ts
7338
+ var MAX_TICKERS = 50;
7339
+ var MAX_TICKER_LENGTH = 40;
7340
+ var MAX_PROFILE_FIRST = 50;
7341
+ var MAX_PROFILE_QUERY_LENGTH = 200;
7342
+ var TICKER_KINDS = ["STOCK", "ETF", "CRYPTO"];
7343
+ var PROFILE_KINDS = ["USER", "PERSON"];
7344
+ function record3(value) {
7345
+ return typeof value === "object" && value !== null && !Array.isArray(value);
7346
+ }
7347
+ function boundedFirst(value, max, name = "first") {
7348
+ if (value === void 0) return void 0;
7349
+ if (!Number.isInteger(value) || value < 1 || value > max) {
7350
+ throw new Error(`${name} must be an integer between 1 and ${max}`);
7351
+ }
7352
+ return value;
7353
+ }
7354
+ function profileKind(value, required) {
7355
+ if (value === void 0 && !required) return void 0;
7356
+ if (typeof value !== "string" || !PROFILE_KINDS.includes(value)) {
7357
+ throw new Error("kind must be USER or PERSON");
7358
+ }
7359
+ return value;
7360
+ }
7361
+ function tickerKind(value) {
7362
+ if (value === void 0) return void 0;
7363
+ if (typeof value !== "string" || !TICKER_KINDS.includes(value)) {
7364
+ throw new Error("kind must be STOCK, ETF, or CRYPTO");
7365
+ }
7366
+ return value;
7367
+ }
7368
+ function parseTickerSpec(raw) {
7369
+ const separator = raw.lastIndexOf(":");
7370
+ if (separator === -1) return { ticker: raw };
7371
+ return {
7372
+ ticker: raw.slice(0, separator),
7373
+ kind: tickerKind(
7374
+ raw.slice(separator + 1).trim().toUpperCase()
7375
+ )
7376
+ };
7377
+ }
7378
+ function normalizeWatchlistTickersParams(params) {
7379
+ if (!record3(params) || !Array.isArray(params.tickers)) {
7380
+ throw new Error("tickers must be a list of ticker symbols");
7381
+ }
7382
+ const defaultKind = tickerKind(params.kind);
7383
+ const tickers = [];
7384
+ for (const raw of params.tickers) {
7385
+ const spec = typeof raw === "string" ? { ticker: raw } : raw;
7386
+ if (!record3(spec) || typeof spec.ticker !== "string") {
7387
+ throw new Error("tickers must be symbols or {ticker, kind} specs");
7388
+ }
7389
+ const ticker = spec.ticker.trim().toUpperCase();
7390
+ if (!ticker || /\s/.test(ticker) || ticker.length > MAX_TICKER_LENGTH) {
7391
+ throw new Error(
7392
+ `ticker '${spec.ticker}' must be a non-empty symbol of at most ${MAX_TICKER_LENGTH} characters`
7393
+ );
7394
+ }
7395
+ const kind = tickerKind(spec.kind) ?? defaultKind;
7396
+ if (!tickers.some((t) => t.ticker === ticker && t.kind === kind)) {
7397
+ tickers.push(kind === void 0 ? { ticker } : { ticker, kind });
7398
+ }
7399
+ }
7400
+ if (tickers.length === 0 || tickers.length > MAX_TICKERS) {
7401
+ throw new Error(
7402
+ `tickers must contain between 1 and ${MAX_TICKERS} symbols`
7403
+ );
7404
+ }
7405
+ return { tickers };
7406
+ }
7407
+ function validateProfileRef(params) {
7408
+ if (!record3(params)) throw new Error("profile reference must be an object");
7409
+ const kind = profileKind(params.kind, true);
7410
+ if (typeof params.id !== "string" || !/^[1-9]\d{0,18}$/.test(params.id)) {
7411
+ throw new Error("id must be a positive decimal profile id");
7412
+ }
7413
+ return { kind, id: params.id };
7414
+ }
7415
+ function validateSearchProfilesParams(params) {
7416
+ if (!record3(params) || typeof params.query !== "string") {
7417
+ throw new Error("query is required");
7418
+ }
7419
+ const query = params.query.trim();
7420
+ if (!query || query.length > MAX_PROFILE_QUERY_LENGTH) {
7421
+ throw new Error(
7422
+ `query must be non-empty and at most ${MAX_PROFILE_QUERY_LENGTH} characters`
7423
+ );
7424
+ }
7425
+ return {
7426
+ query,
7427
+ kind: profileKind(params.kind, false),
7428
+ first: boundedFirst(params.first, MAX_PROFILE_FIRST)
7429
+ };
7430
+ }
7431
+
7424
7432
  // src/resources/forYou.ts
7425
7433
  var FOR_YOU_QUERY = `
7426
7434
  query ToolkitForYou($input: FeedEntryConnectionInput) {
@@ -7451,7 +7459,7 @@ query ToolkitForYou($input: FeedEntryConnectionInput) {
7451
7459
  }
7452
7460
  `.trim();
7453
7461
  function validateForYouListParams(params) {
7454
- if (!record3(params)) throw new Error("For You parameters must be an object");
7462
+ if (!record2(params)) throw new Error("For You parameters must be an object");
7455
7463
  const first = params.first === void 0 ? 20 : params.first;
7456
7464
  if (typeof first !== "number" || !Number.isInteger(first) || first < 1 || first > 50) {
7457
7465
  throw new Error("first must be an integer between 1 and 50");
@@ -7486,7 +7494,7 @@ query ToolkitForYouTheses($input: ThesisRecommendationInput) {
7486
7494
  }
7487
7495
  `.trim();
7488
7496
  function validateForYouThesesParams(params) {
7489
- if (!record3(params)) throw new Error("Thesis parameters must be an object");
7497
+ if (!record2(params)) throw new Error("Thesis parameters must be an object");
7490
7498
  const first = params.first === void 0 ? 10 : params.first;
7491
7499
  if (typeof first !== "number" || !Number.isInteger(first) || first < 1 || first > 10) {
7492
7500
  throw new Error("first must be an integer between 1 and 10");
@@ -7714,7 +7722,7 @@ var COMMAND_DEFINITIONS = [
7714
7722
  // deeper leaves.
7715
7723
  command("auth"),
7716
7724
  command("auth login", {
7717
- values: ["profile", "auth-url", "base-url"],
7725
+ values: ["profile", "auth-url", "base-url", "agent"],
7718
7726
  booleans: ["browser", "no-browser"]
7719
7727
  }),
7720
7728
  command("whoami"),
@@ -8205,6 +8213,7 @@ var COMMAND_DEFINITIONS = [
8205
8213
  command("people search", { values: ["query", "kind", "limit"] }),
8206
8214
  command("people follows"),
8207
8215
  command("people follows list", { values: ["kind", "limit", "cursor"] }),
8216
+ command("people follows theses", { values: ["cursor"] }),
8208
8217
  command("people follows follow", { values: ["kind", "id"] }),
8209
8218
  command("people follows unfollow", { values: ["kind", "id"] }),
8210
8219
  command("trading-pairs search", {
@@ -12036,7 +12045,7 @@ function formatTradingPairResolved(result) {
12036
12045
  }
12037
12046
 
12038
12047
  // src/cli/dispatch.ts
12039
- var CLI_VERSION = true ? "0.37.0-beta.0" : "dev";
12048
+ var CLI_VERSION = true ? "0.38.0-beta.0" : "dev";
12040
12049
  var DEFAULT_RUN_TIMEOUT_MS = 6e5;
12041
12050
  var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
12042
12051
  var GLOBAL_VALUE_FLAGS = Object.entries(GLOBAL_FLAG_DEFINITIONS).filter(([, kind]) => kind === "value").map(([name]) => `--${name}`);
@@ -12154,7 +12163,7 @@ Examples:
12154
12163
  alva configure --api-key alva_abc123 --base-url http://localhost:8080
12155
12164
  alva configure --profile staging --api-key alva_stg_key --base-url https://api-llm.stg.alva.ai
12156
12165
  alva --profile staging whoami`,
12157
- auth: `Usage: alva auth login [--browser | --no-browser] [--profile <name>]
12166
+ auth: `Usage: alva auth login [--browser | --no-browser] [--profile <name>] [--agent <name>]
12158
12167
 
12159
12168
  By default, opens a browser locally and listens for the OAuth callback. Use
12160
12169
  --no-browser for SSH / container / headless environments \u2014 alva will print
@@ -12171,12 +12180,16 @@ Flags:
12171
12180
  --browser Force the local browser + 127.0.0.1 callback flow
12172
12181
  --no-browser Force the paste-code flow (no local listener)
12173
12182
  --profile <name> Profile name to save credentials under (default: "default")
12183
+ --agent <name> The AI agent signing in, e.g. "Claude Code" or "Grok bot".
12184
+ The new key is named "<agent> \xB7 <computer>"; without it
12185
+ the agent is detected from the environment when it can be.
12174
12186
 
12175
12187
  Examples:
12176
12188
  alva auth login # auto-detect
12177
12189
  alva auth login --no-browser # force paste-code flow
12178
12190
  alva auth login --browser # force browser flow
12179
- alva auth login --profile staging`,
12191
+ alva auth login --profile staging
12192
+ alva auth login --agent "Codex"`,
12180
12193
  whoami: `Usage: alva whoami [--profile <name>]
12181
12194
 
12182
12195
  Verify that your credentials are valid by calling the Alva API. Shows your
@@ -13327,6 +13340,7 @@ person. These change the same Following list the user sees in the Alva App.
13327
13340
  Subcommands:
13328
13341
  search Prefix match on name, username, slug, or alias
13329
13342
  follows list List the profiles the caller follows
13343
+ follows theses Thesis Updates by followed profiles, oldest arrival first
13330
13344
  follows follow Follow one profile (idempotent)
13331
13345
  follows unfollow Unfollow one profile (idempotent)
13332
13346
 
@@ -13336,12 +13350,15 @@ Flags:
13336
13350
  required, from a search or list result
13337
13351
  --id <id> follow/unfollow: profile id (required)
13338
13352
  --limit <1-50> search/list: page size
13339
- --cursor <endCursor> list: pageInfo.endCursor of the previous page
13353
+ --cursor <endCursor> list: pageInfo.endCursor of the previous page;
13354
+ theses: next_cursor of the previous read (omitted:
13355
+ the last 24 hours)
13340
13356
 
13341
13357
  Examples:
13342
13358
  alva people search --query "cathie wood" --kind person
13343
13359
  alva people follows follow --kind person --id 42
13344
- alva people follows list`,
13360
+ alva people follows list
13361
+ alva people follows theses --cursor <next_cursor>`,
13345
13362
  "trading-pairs": `Usage: alva trading-pairs <subcommand> [options]
13346
13363
 
13347
13364
  Discover canonical trading-pair identities before backtesting or trading.
@@ -13884,6 +13901,14 @@ function dispatchPeople(client, path, flags) {
13884
13901
  first: optionalBoundedIntegerFlag(flags, "limit", command2, 1, 50),
13885
13902
  after: usageChecked(command2, () => optionalCursorFlag(flags["cursor"]))
13886
13903
  });
13904
+ case "follows theses":
13905
+ return client.follows.theses({
13906
+ cursor: usageChecked(
13907
+ command2,
13908
+ () => optionalCursorFlag(flags["cursor"])
13909
+ ),
13910
+ first: 100
13911
+ });
13887
13912
  case "follows follow":
13888
13913
  case "follows unfollow": {
13889
13914
  const params = usageChecked(