@alva-ai/toolkit 0.38.0-beta.1 → 0.38.0-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.
@@ -2265,6 +2265,10 @@ interface Thesis {
2265
2265
  interface ThesisResponse {
2266
2266
  thesis: Thesis;
2267
2267
  }
2268
+ /** A created Thesis and its clickable web url, e.g. `https://alva.ai/thesis/123`. */
2269
+ interface ThesisCreateResponse extends ThesisResponse {
2270
+ url: string;
2271
+ }
2268
2272
  interface ThesisAuthor {
2269
2273
  id: ThesisID;
2270
2274
  kind: string;
@@ -2427,7 +2431,7 @@ declare class ThesesResource {
2427
2431
  * things the Thesis depends on, or that would show it right or wrong.
2428
2432
  */
2429
2433
  watchpoints(id: ThesisID): Promise<ThesisWatchpointsResult>;
2430
- create(params: CreateThesisParams): Promise<ThesisResponse>;
2434
+ create(params: CreateThesisParams): Promise<ThesisCreateResponse>;
2431
2435
  get(id: ThesisID): Promise<ThesisGetResponse>;
2432
2436
  getVersion(id: ThesisID, authorVersionID: ThesisID): Promise<ThesisResponse>;
2433
2437
  /** Lists reader-visible Updates, with editorial revisions folded together. */
package/dist/dispatch.js CHANGED
@@ -6681,7 +6681,7 @@ Examples:
6681
6681
  alva for-you theses --cursor '<nextCursor>'`,
6682
6682
  thesis: `Usage: alva thesis <subcommand> [options]
6683
6683
 
6684
- Subcommands: list, related, asset-candidates, create, get, version get, signals, watchpoints, set-visibility, archive, star, unstar, set-signal-enabled, signal-preferences get|set, update, rewrite.
6684
+ Subcommands: list, related, asset-candidates, create, get, version get, signals, watchpoints, return, set-visibility, archive, star, unstar, set-signal-enabled, signal-preferences get|set, update, rewrite.
6685
6685
 
6686
6686
  list --person <slug> | --person-name <name> | --user <username>
6687
6687
  | --ticker <ticker> | --entity-id <id>
@@ -6702,7 +6702,8 @@ directions without publishing. For known tickers, add --entity-ids <id,id>
6702
6702
  --no-discovery (and --thesis-id <id> for an Update): it skips ticker discovery
6703
6703
  and returns returnPreview, the directions publishing would store, whether to ask
6704
6704
  the Thesis return switch (askSwitch) and whether the draft would be rejected
6705
- (lastLegRemoved). Publish with create/update --entity-ids <id,id> and
6705
+ (lastLegRemoved). UNRESOLVED or UNKNOWN is an answer, not an error: the text
6706
+ names no catalog asset or no clear direction. Publish with create/update --entity-ids <id,id> and
6706
6707
  --entity-stances <json> equal to returnPreview.directions, lowercased:
6707
6708
  --entity-stances '[{"entity_id":"745337","stance":"bearish"}]'. Valid stances:
6708
6709
  unknown, bullish, bearish, none. An optional "weight" (a fraction, 0.4 is 40%,
@@ -6736,7 +6737,9 @@ author's only through an Update the author asks for.
6736
6737
  Embedded thesis commands accept literal --body text only; file and stdin body
6737
6738
  transports are intentionally unavailable because this runtime has no verified
6738
6739
  local filesystem or stdin adapter. Rewrite accepts --mode reformat|shorten|enrich;
6739
- only omission defaults to canonical reformat, which is sent to the API. Create defaults --visibility to public.
6740
+ only omission defaults to canonical reformat, which is sent to the API. Create
6741
+ and update require --visibility public|private explicitly; create returns the
6742
+ Thesis's web url.
6740
6743
  Set-visibility changes current access without publishing a new author version.
6741
6744
  It requires --id and --visibility public|private and never uses a request ID.
6742
6745
  Archive preserves the current Thesis fields and uses the current author version
@@ -7351,6 +7354,20 @@ function argument(message) {
7351
7354
  return new AlvaError("INVALID_ARGUMENT", message, 400);
7352
7355
  }
7353
7356
 
7357
+ // src/resources/webOrigin.ts
7358
+ function webOriginFromApiBase(apiBaseUrl) {
7359
+ try {
7360
+ const host = new URL(apiBaseUrl).hostname;
7361
+ const match = /^api-llm\.([a-z0-9-]+)\.alva\.ai$/i.exec(host);
7362
+ if (match) {
7363
+ const env = match[1].toLowerCase();
7364
+ return env === "prd" ? "https://alva.ai" : `https://${env}.alva.ai`;
7365
+ }
7366
+ } catch {
7367
+ }
7368
+ return "https://alva.ai";
7369
+ }
7370
+
7354
7371
  // src/resources/theses.ts
7355
7372
  var THESIS_SIGNAL_KINDS = [
7356
7373
  "fundamentals",
@@ -8436,18 +8453,6 @@ var PLAYBOOK_VISIBILITIES = [
8436
8453
  "paid"
8437
8454
  ];
8438
8455
  var OWNED_PLAYBOOK_FILTERS = ["draft", "running", "paused"];
8439
- function webOriginFromApiBase(apiBaseUrl) {
8440
- try {
8441
- const host = new URL(apiBaseUrl).hostname;
8442
- const match = /^api-llm\.([a-z0-9-]+)\.alva\.ai$/i.exec(host);
8443
- if (match) {
8444
- const env = match[1].toLowerCase();
8445
- return env === "prd" ? "https://alva.ai" : `https://${env}.alva.ai`;
8446
- }
8447
- } catch {
8448
- }
8449
- return "https://alva.ai";
8450
- }
8451
8456
 
8452
8457
  // src/cli/playbooksFormat.ts
8453
8458
  var MAX_DESC = 200;
@@ -12077,7 +12082,7 @@ function formatTradingPairResolved(result) {
12077
12082
  }
12078
12083
 
12079
12084
  // src/cli/dispatch.ts
12080
- var CLI_VERSION = true ? "0.38.0-beta.1" : "dev";
12085
+ var CLI_VERSION = true ? "0.38.0-beta.2" : "dev";
12081
12086
  var DEFAULT_RUN_TIMEOUT_MS = 6e5;
12082
12087
  var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
12083
12088
  var GLOBAL_VALUE_FLAGS = Object.entries(GLOBAL_FLAG_DEFINITIONS).filter(([, kind]) => kind === "value").map(([name]) => `--${name}`);
@@ -13506,6 +13511,7 @@ Create and update never rewrite text automatically.
13506
13511
 
13507
13512
  Subcommands:
13508
13513
  create Create a thesis
13514
+ asset-candidates Read catalog IDs and the directions publishing would store, without publishing
13509
13515
  list Read theses by author or market entity
13510
13516
  related Read related current publications
13511
13517
  get Get one thesis
@@ -13513,6 +13519,7 @@ Subcommands:
13513
13519
  version list List visible Updates with editorial revisions folded together
13514
13520
  signals Read published Signal history
13515
13521
  watchpoints List a Thesis's current watchpoints
13522
+ return Read the Thesis return
13516
13523
  set-visibility Change current access without publishing a version
13517
13524
  archive Archive the current author version
13518
13525
  star Add the Thesis to your bookmarks
@@ -13531,11 +13538,12 @@ Body input (create, update, rewrite): choose exactly one:
13531
13538
  Create and update require --request-id: a caller-supplied non-zero UUID. The
13532
13539
  toolkit does not generate or retry request IDs. If a response is ambiguous
13533
13540
  after a write, reuse the same request ID only after resolving that ambiguity with
13534
- the backend; do not send a fresh ID. Create defaults --visibility to public.
13535
- Update requires --visibility explicitly so it cannot inadvertently publish.
13541
+ the backend; do not send a fresh ID. Create and update require --visibility
13542
+ explicitly so neither can publish by accident. Create returns the Thesis's web
13543
+ url.
13536
13544
 
13537
13545
  Other flags:
13538
- create --request-id <uuid> --body ... [--images <json-array-of-https-urls>] [--title <text>] [--tickers <ticker,ticker>] [--entity-ids <id,id>] [--entity-stances <json>] [--visibility <value>] [--track-return true|false] [--signal-kinds <kind,kind>] [--signal-min-importance all|notable|major]
13546
+ create --request-id <uuid> --body ... [--images <json-array-of-https-urls>] [--title <text>] [--tickers <ticker,ticker>] [--entity-ids <id,id>] [--entity-stances <json>] --visibility public|private [--track-return true|false] [--signal-kinds <kind,kind>] [--signal-min-importance all|notable|major]
13539
13547
  Signals: omit both to show every Signal. Kinds: fundamentals, macro,
13540
13548
  technicals, commentary; with only one flag the other keeps its default.
13541
13549
  Images: public creation only, at most 20 in display order. Upload selected files
@@ -13559,6 +13567,8 @@ Other flags:
13559
13567
  --no-discovery only classifies --entity-ids (no ticker discovery) and
13560
13568
  returns returnPreview: the directions publishing would store, the return
13561
13569
  switch (askSwitch) and lastLegRemoved. --thesis-id seeds an Update.
13570
+ A mention resolved UNRESOLVED or a direction UNKNOWN is an answer, not
13571
+ an error: the text names no catalog asset or no clear direction.
13562
13572
  return --id <id> [--detail] the Thesis return; --detail adds each Update's positions
13563
13573
  get --id <signed-int64-decimal>
13564
13574
  version get --id <signed-int64-decimal> --author-version-id <signed-int64-decimal>
@@ -13624,7 +13634,7 @@ valid Unicode, and at most 65536 UTF-8 bytes; title is optional and at most
13624
13634
  500 UTF-8 bytes. Text is passed without trimming or newline conversion.
13625
13635
 
13626
13636
  Examples:
13627
- alva thesis create --request-id 123e4567-e89b-42d3-a456-426614174000 --body $'line one\\r\\nline two'
13637
+ alva thesis create --request-id 123e4567-e89b-42d3-a456-426614174000 --body $'line one\\r\\nline two' --visibility private
13628
13638
  alva thesis set-visibility --id 9223372036854775807 --visibility private
13629
13639
  alva thesis update --id 9223372036854775807 --request-id 123e4567-e89b-42d3-a456-426614174000 --expected-author-version-id 9223372036854775806 --body-file ./thesis.md --visibility private
13630
13640
  printf '%s' 'Draft body' | alva thesis rewrite --body-stdin --mode shorten`
@@ -15169,7 +15179,9 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
15169
15179
  entity_ids: thesisEntityIDs(flags),
15170
15180
  entity_stances: thesisEntityStances(flags),
15171
15181
  tickers: thesisTickers(flags),
15172
- visibility: flags.visibility === void 0 ? "public" : thesisCreateVisibility(flags.visibility),
15182
+ visibility: thesisCreateVisibility(
15183
+ requireFlag(flags, "visibility", "thesis create")
15184
+ ),
15173
15185
  track_return: thesisTrackReturn(flags, "thesis create"),
15174
15186
  signal_preferences: thesisCreateSignalPreferences(flags)
15175
15187
  });