@alva-ai/toolkit 0.34.0 → 0.36.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/README.md +39 -4
- package/dist/browser.global.js +77 -47
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.d.ts +273 -13
- package/dist/cli.js +1114 -212
- package/dist/cli.js.map +1 -1
- package/dist/dispatch.d.ts +273 -13
- package/dist/dispatch.js +478 -116
- package/dist/dispatch.js.map +1 -1
- package/dist/index.cjs +846 -135
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +274 -14
- package/dist/index.d.ts +274 -14
- package/dist/index.js +845 -135
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/dispatch.js
CHANGED
|
@@ -6038,12 +6038,12 @@ var EMBEDDED_COMMAND_DEFINITIONS = [
|
|
|
6038
6038
|
),
|
|
6039
6039
|
action(
|
|
6040
6040
|
"steward send",
|
|
6041
|
-
{ values: ["body", "delivery-ids", "request-id"] },
|
|
6041
|
+
{ values: ["body", "delivery-ids", "request-id", "digest-run-id"] },
|
|
6042
6042
|
"steward-self"
|
|
6043
6043
|
),
|
|
6044
6044
|
action(
|
|
6045
6045
|
"steward pending",
|
|
6046
|
-
{ values: ["
|
|
6046
|
+
{ values: ["since", "until", "digest-run-id"] },
|
|
6047
6047
|
"steward-self"
|
|
6048
6048
|
),
|
|
6049
6049
|
action(
|
|
@@ -6051,6 +6051,7 @@ var EMBEDDED_COMMAND_DEFINITIONS = [
|
|
|
6051
6051
|
{ values: ["delivery-ids", "digest-run-id"] },
|
|
6052
6052
|
"steward-self"
|
|
6053
6053
|
),
|
|
6054
|
+
action("steward status", { values: ["digest-run-id"] }, "steward-self"),
|
|
6054
6055
|
route("company-news create", "company-news create", {
|
|
6055
6056
|
values: ["name", "tickers", "initial-lookback-hours", "page-size"]
|
|
6056
6057
|
}),
|
|
@@ -6063,11 +6064,17 @@ var EMBEDDED_COMMAND_DEFINITIONS = [
|
|
|
6063
6064
|
"entity-ids",
|
|
6064
6065
|
"entity-stances",
|
|
6065
6066
|
"tickers",
|
|
6066
|
-
"visibility"
|
|
6067
|
+
"visibility",
|
|
6068
|
+
"track-return"
|
|
6067
6069
|
]
|
|
6068
6070
|
}),
|
|
6069
6071
|
route("thesis asset-candidates", "thesis asset-candidates", {
|
|
6070
|
-
values: ["text"]
|
|
6072
|
+
values: ["text", "entity-ids", "thesis-id"],
|
|
6073
|
+
booleans: ["no-discovery"]
|
|
6074
|
+
}),
|
|
6075
|
+
route("thesis return", "thesis return", {
|
|
6076
|
+
values: ["id"],
|
|
6077
|
+
booleans: ["detail"]
|
|
6071
6078
|
}),
|
|
6072
6079
|
route("thesis list", "thesis list", {
|
|
6073
6080
|
values: [
|
|
@@ -6088,9 +6095,6 @@ var EMBEDDED_COMMAND_DEFINITIONS = [
|
|
|
6088
6095
|
route("thesis version list", "thesis version list", {
|
|
6089
6096
|
values: ["id", "first", "cursor"]
|
|
6090
6097
|
}),
|
|
6091
|
-
route("thesis version delete", "thesis version delete", {
|
|
6092
|
-
values: ["id", "author-version-id", "expected-author-version-id"]
|
|
6093
|
-
}),
|
|
6094
6098
|
route("thesis version get", "thesis version get", {
|
|
6095
6099
|
values: ["id", "author-version-id"]
|
|
6096
6100
|
}),
|
|
@@ -6121,14 +6125,10 @@ var EMBEDDED_COMMAND_DEFINITIONS = [
|
|
|
6121
6125
|
"entity-ids",
|
|
6122
6126
|
"entity-stances",
|
|
6123
6127
|
"medias",
|
|
6124
|
-
"visibility"
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
}),
|
|
6128
|
-
route("thesis close", "thesis close", {
|
|
6129
|
-
values: ["id", "expected-author-version-id", "note"]
|
|
6128
|
+
"visibility",
|
|
6129
|
+
"track-return"
|
|
6130
|
+
]
|
|
6130
6131
|
}),
|
|
6131
|
-
route("thesis delete", "thesis delete", { values: ["id"] }),
|
|
6132
6132
|
route("thesis rewrite", "thesis rewrite", { values: ["body", "mode"] }),
|
|
6133
6133
|
route("account whoami", "whoami"),
|
|
6134
6134
|
route("account credits wallet", "credits wallet"),
|
|
@@ -6226,6 +6226,27 @@ var EMBEDDED_COMMAND_DEFINITIONS = [
|
|
|
6226
6226
|
route("markets earnings", "markets earnings", {
|
|
6227
6227
|
values: ["ticker", "event", "fiscal-year", "fiscal-quarter"]
|
|
6228
6228
|
}),
|
|
6229
|
+
route("markets watchlist list", "markets watchlist list", {
|
|
6230
|
+
values: ["limit", "cursor"]
|
|
6231
|
+
}),
|
|
6232
|
+
route("markets watchlist add", "markets watchlist add", {
|
|
6233
|
+
values: ["tickers", "kind"]
|
|
6234
|
+
}),
|
|
6235
|
+
route("markets watchlist remove", "markets watchlist remove", {
|
|
6236
|
+
values: ["tickers", "kind"]
|
|
6237
|
+
}),
|
|
6238
|
+
route("people search", "people search", {
|
|
6239
|
+
values: ["query", "kind", "limit"]
|
|
6240
|
+
}),
|
|
6241
|
+
route("people follows list", "people follows list", {
|
|
6242
|
+
values: ["kind", "limit", "cursor"]
|
|
6243
|
+
}),
|
|
6244
|
+
route("people follows follow", "people follows follow", {
|
|
6245
|
+
values: ["kind", "id"]
|
|
6246
|
+
}),
|
|
6247
|
+
route("people follows unfollow", "people follows unfollow", {
|
|
6248
|
+
values: ["kind", "id"]
|
|
6249
|
+
}),
|
|
6229
6250
|
route("trading-pairs search", "trading-pairs search", {
|
|
6230
6251
|
values: [
|
|
6231
6252
|
"symbol",
|
|
@@ -6531,11 +6552,12 @@ Commands:
|
|
|
6531
6552
|
run Execute Jagent JavaScript
|
|
6532
6553
|
data-skills Discover structured Arrays data endpoints
|
|
6533
6554
|
skillhub Discover curated methodology blueprints
|
|
6534
|
-
markets Read market
|
|
6555
|
+
markets Read market context; manage the ticker watchlist
|
|
6556
|
+
people Search, follow, and unfollow Alva users and curated people
|
|
6535
6557
|
trading-pairs Discover and strictly verify canonical trading pairs
|
|
6536
6558
|
automation Create and operate scheduled automations
|
|
6537
6559
|
schedule Manage future messages for this Session Inbox
|
|
6538
|
-
steward Push steward
|
|
6560
|
+
steward Push steward routing and durable Daily Brief runs
|
|
6539
6561
|
thesis Read published viewpoints and manage authored theses
|
|
6540
6562
|
company-news Create backend-managed multi-ticker News Feeds
|
|
6541
6563
|
playbooks Discover, build, release, and manage Playbooks
|
|
@@ -6579,16 +6601,18 @@ decide --delivery-id <id> --decision <immediate|digest|suppress> --reason <tex
|
|
|
6579
6601
|
Record the decision first; forward/send are rejected without it.
|
|
6580
6602
|
forward --delivery-id <id> [--request-id <uuid>]
|
|
6581
6603
|
Re-post the original alert card by reference (immediate only).
|
|
6604
|
+
status --digest-run-id <uuid>
|
|
6605
|
+
Read the durable state and receipt of this Brief occurrence.
|
|
6606
|
+
pending --digest-run-id <uuid>
|
|
6607
|
+
Read the complete fixed-window delivery set owned by this run.
|
|
6608
|
+
send --digest-run-id <uuid> [--delivery-ids <a,b,c>] [--body <markdown>]
|
|
6609
|
+
Publish the reviewed coverage and complete the run. Omit the body
|
|
6610
|
+
when reviewed coverage yields no useful content; keep those ids.
|
|
6611
|
+
pending [--since <RFC3339>] [--until <RFC3339>]
|
|
6612
|
+
Legacy fixed-window read; automatic paging and bounded retries.
|
|
6582
6613
|
send [--delivery-ids <a,b,c>] --body <markdown> [--request-id <uuid>]
|
|
6583
|
-
Post your own Markdown covering the listed deliveries; the response
|
|
6584
|
-
echoes requestId \u2014 pass it to briefed. Omit --delivery-ids for a
|
|
6585
|
-
For-You-only Brief that covers no ledger delivery.
|
|
6586
|
-
pending [--after <cursor>] [--since <RFC3339>] [--until <RFC3339>] [--first <1-100>]
|
|
6587
|
-
Deliveries held for the Daily Brief. Repeat with --after <nextCursor>
|
|
6588
|
-
until nextCursor is null; the cursor carries the window.
|
|
6589
6614
|
briefed --digest-run-id <id> --delivery-ids <a,b,c>
|
|
6590
|
-
|
|
6591
|
-
or the digest_request run id when nothing was worth sending.
|
|
6615
|
+
Legacy send/completion contract; do not use for durable runs.
|
|
6592
6616
|
|
|
6593
6617
|
request ids are generated when omitted; pass one to retry an unclear result.
|
|
6594
6618
|
|
|
@@ -6647,7 +6671,7 @@ Examples:
|
|
|
6647
6671
|
alva for-you theses --cursor '<nextCursor>'`,
|
|
6648
6672
|
thesis: `Usage: alva thesis <subcommand> [options]
|
|
6649
6673
|
|
|
6650
|
-
Subcommands: list, related, asset-candidates, create, get, version get, signals, set-visibility, archive, restore, star, unstar, set-signal-enabled, update,
|
|
6674
|
+
Subcommands: list, related, asset-candidates, create, get, version get, signals, set-visibility, archive, restore, star, unstar, set-signal-enabled, update, rewrite.
|
|
6651
6675
|
|
|
6652
6676
|
list --person <slug> | --person-name <name> | --user <username>
|
|
6653
6677
|
| --ticker <ticker> | --entity-id <id>
|
|
@@ -6664,11 +6688,17 @@ signed-in owner's private Theses. Related uses the source's current version
|
|
|
6664
6688
|
(GENERATING, READY or FAILED), never a quoted historical version.
|
|
6665
6689
|
|
|
6666
6690
|
asset-candidates --text <unsaved thesis text> reads catalog IDs and suggested
|
|
6667
|
-
directions without publishing.
|
|
6668
|
-
|
|
6669
|
-
|
|
6691
|
+
directions without publishing. For known tickers, add --entity-ids <id,id>
|
|
6692
|
+
--no-discovery (and --thesis-id <id> for an Update): it skips ticker discovery
|
|
6693
|
+
and returns returnPreview, the directions publishing would store, whether to ask
|
|
6694
|
+
the Thesis return switch (askSwitch) and whether the draft would be rejected
|
|
6695
|
+
(lastLegRemoved). Publish with create/update --entity-ids <id,id> and
|
|
6696
|
+
--entity-stances <json> equal to returnPreview.directions, lowercased:
|
|
6670
6697
|
--entity-stances '[{"entity_id":"745337","stance":"bearish"}]'. Valid stances:
|
|
6671
|
-
unknown, bullish, bearish.
|
|
6698
|
+
unknown, bullish, bearish, none. --track-return false turns the Thesis return
|
|
6699
|
+
off for good; it is accepted only while the switch is UNSET.
|
|
6700
|
+
return --id <id> [--detail] reads the Thesis return (fractions; --detail adds
|
|
6701
|
+
each Update's positions).
|
|
6672
6702
|
|
|
6673
6703
|
Embedded thesis commands accept literal --body text only; file and stdin body
|
|
6674
6704
|
transports are intentionally unavailable because this runtime has no verified
|
|
@@ -6689,16 +6719,18 @@ IDs, and noncanonical GraphQL errors fail closed. The returned state is the
|
|
|
6689
6719
|
authority for archive, bookmark, and research results.
|
|
6690
6720
|
Update requires both --expected-author-version-id and --visibility, preventing
|
|
6691
6721
|
inadvertent publication, and replaces the document's body, title, and entity
|
|
6692
|
-
IDs and directions as a full author-version update.
|
|
6722
|
+
IDs and directions as a full author-version update. Each update publishes a new
|
|
6723
|
+
Update; a published Update cannot be edited in place. Update accepts --entity-stances <json>.
|
|
6693
6724
|
Only editing the body? Resubmit the existing entity IDs, directions, and medias.
|
|
6694
6725
|
Pass current medias unchanged with --medias; omission clears attachments.
|
|
6695
|
-
|
|
6726
|
+
On an Update, an omitted or unknown direction of a carried ticker keeps its
|
|
6727
|
+
previous direction; none is an exit.
|
|
6696
6728
|
Create and update require a caller-supplied non-zero
|
|
6697
6729
|
UUID in --request-id; the dispatcher never creates request IDs or retries.
|
|
6698
6730
|
|
|
6699
6731
|
If a write response is ambiguous, retain and reuse the same request ID only
|
|
6700
6732
|
when resolving that ambiguity with the backend. Rewrite is explicit-only: no
|
|
6701
|
-
create
|
|
6733
|
+
create or update command invokes it. Backend owns Signal/Alert
|
|
6702
6734
|
setup; the CLI never starts them separately. IDs remain decimal strings, never
|
|
6703
6735
|
numbers. Rewrite returns a candidate only; it does not create or update a Thesis,
|
|
6704
6736
|
select a mode from body length/errors, or invent supporting evidence.`,
|
|
@@ -6734,7 +6766,34 @@ Subcommands:
|
|
|
6734
6766
|
|
|
6735
6767
|
Subcommands:
|
|
6736
6768
|
narrative
|
|
6737
|
-
earnings
|
|
6769
|
+
earnings
|
|
6770
|
+
watchlist list|add|remove`,
|
|
6771
|
+
"markets watchlist": `Usage: alva markets watchlist <list|add|remove> [options]
|
|
6772
|
+
|
|
6773
|
+
The user's ticker watchlist in the Alva App. Act only when the user asks to
|
|
6774
|
+
add or remove tickers. add/remove take --tickers <A,B> (1-50 exact symbols;
|
|
6775
|
+
suffix one with :stock, :etf, or :crypto to pick its kind, e.g. BTC:crypto)
|
|
6776
|
+
and optional --kind stock|etf|crypto as the default kind; one atomic write.
|
|
6777
|
+
Report every group: added|removed (written now), unchanged (already in that
|
|
6778
|
+
state), unresolved (NOT_FOUND, or FAILED_PRECONDITION = ambiguous symbol: ask
|
|
6779
|
+
the user or retry with a kind suffix). Nothing is written when no ticker
|
|
6780
|
+
resolves. add re-adds a ticker the user removed earlier. list takes
|
|
6781
|
+
--limit <1-100> and --cursor <pageInfo.endCursor>.`,
|
|
6782
|
+
people: `Usage: alva people <subcommand> [options]
|
|
6783
|
+
|
|
6784
|
+
Subcommands:
|
|
6785
|
+
search --query <text> [--kind user|person] [--limit <1-50>]
|
|
6786
|
+
follows list|follow|unfollow
|
|
6787
|
+
|
|
6788
|
+
USER is an Alva user; PERSON is a curated person (KOL). follow/unfollow take
|
|
6789
|
+
--kind and --id from search or list results. Search is a prefix match on
|
|
6790
|
+
name, username, or slug. Follow only an exact match; when several profiles
|
|
6791
|
+
match, ask the user which one. Act only when the user asks to follow or
|
|
6792
|
+
unfollow.`,
|
|
6793
|
+
"people follows": `Usage: alva people follows <list|follow|unfollow> [options]
|
|
6794
|
+
|
|
6795
|
+
list: [--kind user|person] [--limit <1-50>] [--cursor <pageInfo.endCursor>]
|
|
6796
|
+
follow|unfollow: --kind user|person --id <profile id>`,
|
|
6738
6797
|
"trading-pairs": `Usage: alva trading-pairs <subcommand>
|
|
6739
6798
|
|
|
6740
6799
|
Subcommands:
|
|
@@ -7144,10 +7203,105 @@ function validateXReadParams(params) {
|
|
|
7144
7203
|
}
|
|
7145
7204
|
}
|
|
7146
7205
|
|
|
7147
|
-
// src/resources/
|
|
7206
|
+
// src/resources/follows.ts
|
|
7207
|
+
var MAX_TICKERS = 50;
|
|
7208
|
+
var MAX_TICKER_LENGTH = 40;
|
|
7209
|
+
var MAX_PROFILE_FIRST = 50;
|
|
7210
|
+
var MAX_PROFILE_QUERY_LENGTH = 200;
|
|
7211
|
+
var TICKER_KINDS = ["STOCK", "ETF", "CRYPTO"];
|
|
7212
|
+
var PROFILE_KINDS = ["USER", "PERSON"];
|
|
7148
7213
|
function record2(value) {
|
|
7149
7214
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7150
7215
|
}
|
|
7216
|
+
function boundedFirst(value, max, name = "first") {
|
|
7217
|
+
if (value === void 0) return void 0;
|
|
7218
|
+
if (!Number.isInteger(value) || value < 1 || value > max) {
|
|
7219
|
+
throw new Error(`${name} must be an integer between 1 and ${max}`);
|
|
7220
|
+
}
|
|
7221
|
+
return value;
|
|
7222
|
+
}
|
|
7223
|
+
function profileKind(value, required) {
|
|
7224
|
+
if (value === void 0 && !required) return void 0;
|
|
7225
|
+
if (typeof value !== "string" || !PROFILE_KINDS.includes(value)) {
|
|
7226
|
+
throw new Error("kind must be USER or PERSON");
|
|
7227
|
+
}
|
|
7228
|
+
return value;
|
|
7229
|
+
}
|
|
7230
|
+
function tickerKind(value) {
|
|
7231
|
+
if (value === void 0) return void 0;
|
|
7232
|
+
if (typeof value !== "string" || !TICKER_KINDS.includes(value)) {
|
|
7233
|
+
throw new Error("kind must be STOCK, ETF, or CRYPTO");
|
|
7234
|
+
}
|
|
7235
|
+
return value;
|
|
7236
|
+
}
|
|
7237
|
+
function parseTickerSpec(raw) {
|
|
7238
|
+
const separator = raw.lastIndexOf(":");
|
|
7239
|
+
if (separator === -1) return { ticker: raw };
|
|
7240
|
+
return {
|
|
7241
|
+
ticker: raw.slice(0, separator),
|
|
7242
|
+
kind: tickerKind(
|
|
7243
|
+
raw.slice(separator + 1).trim().toUpperCase()
|
|
7244
|
+
)
|
|
7245
|
+
};
|
|
7246
|
+
}
|
|
7247
|
+
function normalizeWatchlistTickersParams(params) {
|
|
7248
|
+
if (!record2(params) || !Array.isArray(params.tickers)) {
|
|
7249
|
+
throw new Error("tickers must be a list of ticker symbols");
|
|
7250
|
+
}
|
|
7251
|
+
const defaultKind = tickerKind(params.kind);
|
|
7252
|
+
const tickers = [];
|
|
7253
|
+
for (const raw of params.tickers) {
|
|
7254
|
+
const spec = typeof raw === "string" ? { ticker: raw } : raw;
|
|
7255
|
+
if (!record2(spec) || typeof spec.ticker !== "string") {
|
|
7256
|
+
throw new Error("tickers must be symbols or {ticker, kind} specs");
|
|
7257
|
+
}
|
|
7258
|
+
const ticker = spec.ticker.trim().toUpperCase();
|
|
7259
|
+
if (!ticker || /\s/.test(ticker) || ticker.length > MAX_TICKER_LENGTH) {
|
|
7260
|
+
throw new Error(
|
|
7261
|
+
`ticker '${spec.ticker}' must be a non-empty symbol of at most ${MAX_TICKER_LENGTH} characters`
|
|
7262
|
+
);
|
|
7263
|
+
}
|
|
7264
|
+
const kind = tickerKind(spec.kind) ?? defaultKind;
|
|
7265
|
+
if (!tickers.some((t) => t.ticker === ticker && t.kind === kind)) {
|
|
7266
|
+
tickers.push(kind === void 0 ? { ticker } : { ticker, kind });
|
|
7267
|
+
}
|
|
7268
|
+
}
|
|
7269
|
+
if (tickers.length === 0 || tickers.length > MAX_TICKERS) {
|
|
7270
|
+
throw new Error(
|
|
7271
|
+
`tickers must contain between 1 and ${MAX_TICKERS} symbols`
|
|
7272
|
+
);
|
|
7273
|
+
}
|
|
7274
|
+
return { tickers };
|
|
7275
|
+
}
|
|
7276
|
+
function validateProfileRef(params) {
|
|
7277
|
+
if (!record2(params)) throw new Error("profile reference must be an object");
|
|
7278
|
+
const kind = profileKind(params.kind, true);
|
|
7279
|
+
if (typeof params.id !== "string" || !/^[1-9]\d{0,18}$/.test(params.id)) {
|
|
7280
|
+
throw new Error("id must be a positive decimal profile id");
|
|
7281
|
+
}
|
|
7282
|
+
return { kind, id: params.id };
|
|
7283
|
+
}
|
|
7284
|
+
function validateSearchProfilesParams(params) {
|
|
7285
|
+
if (!record2(params) || typeof params.query !== "string") {
|
|
7286
|
+
throw new Error("query is required");
|
|
7287
|
+
}
|
|
7288
|
+
const query = params.query.trim();
|
|
7289
|
+
if (!query || query.length > MAX_PROFILE_QUERY_LENGTH) {
|
|
7290
|
+
throw new Error(
|
|
7291
|
+
`query must be non-empty and at most ${MAX_PROFILE_QUERY_LENGTH} characters`
|
|
7292
|
+
);
|
|
7293
|
+
}
|
|
7294
|
+
return {
|
|
7295
|
+
query,
|
|
7296
|
+
kind: profileKind(params.kind, false),
|
|
7297
|
+
first: boundedFirst(params.first, MAX_PROFILE_FIRST)
|
|
7298
|
+
};
|
|
7299
|
+
}
|
|
7300
|
+
|
|
7301
|
+
// src/resources/thesisPublication.ts
|
|
7302
|
+
function record3(value) {
|
|
7303
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7304
|
+
}
|
|
7151
7305
|
function isPositiveInt64(value) {
|
|
7152
7306
|
return typeof value === "string" && /^[1-9]\d{0,18}$/.test(value) && BigInt(value) <= 9223372036854775807n;
|
|
7153
7307
|
}
|
|
@@ -7218,7 +7372,7 @@ var SELECTORS = [
|
|
|
7218
7372
|
"entityId"
|
|
7219
7373
|
];
|
|
7220
7374
|
function validateThesisPageParams(params) {
|
|
7221
|
-
if (!
|
|
7375
|
+
if (!record3(params)) throw argument("Thesis parameters must be an object");
|
|
7222
7376
|
const first = params.first === void 0 ? 10 : params.first;
|
|
7223
7377
|
if (typeof first !== "number" || !Number.isInteger(first) || first < 1 || first > 50) {
|
|
7224
7378
|
throw argument("first must be an integer between 1 and 50");
|
|
@@ -7284,7 +7438,7 @@ query ToolkitForYou($input: FeedEntryConnectionInput) {
|
|
|
7284
7438
|
}
|
|
7285
7439
|
`.trim();
|
|
7286
7440
|
function validateForYouListParams(params) {
|
|
7287
|
-
if (!
|
|
7441
|
+
if (!record3(params)) throw new Error("For You parameters must be an object");
|
|
7288
7442
|
const first = params.first === void 0 ? 20 : params.first;
|
|
7289
7443
|
if (typeof first !== "number" || !Number.isInteger(first) || first < 1 || first > 50) {
|
|
7290
7444
|
throw new Error("first must be an integer between 1 and 50");
|
|
@@ -7319,7 +7473,7 @@ query ToolkitForYouTheses($input: ThesisRecommendationInput) {
|
|
|
7319
7473
|
}
|
|
7320
7474
|
`.trim();
|
|
7321
7475
|
function validateForYouThesesParams(params) {
|
|
7322
|
-
if (!
|
|
7476
|
+
if (!record3(params)) throw new Error("Thesis parameters must be an object");
|
|
7323
7477
|
const first = params.first === void 0 ? 10 : params.first;
|
|
7324
7478
|
if (typeof first !== "number" || !Number.isInteger(first) || first < 1 || first > 10) {
|
|
7325
7479
|
throw new Error("first must be an integer between 1 and 10");
|
|
@@ -7360,6 +7514,30 @@ var BRIEFED = `
|
|
|
7360
7514
|
mutation ToolkitStewardBriefed($input: CompleteStewardBriefInput!) {
|
|
7361
7515
|
completeStewardBrief(input: $input) { ok }
|
|
7362
7516
|
}`.trim();
|
|
7517
|
+
var DIGEST_RUN_FIELDS = `
|
|
7518
|
+
digestRunId state scheduleId scheduleVersion occurrenceIndex
|
|
7519
|
+
windowSinceMs windowUntilMs scanCompletedAtMs bodySha256 coverageSha256
|
|
7520
|
+
channelMessageId attempts lastError startedAtMs completedAtMs sendUncertainAtMs
|
|
7521
|
+
`.trim();
|
|
7522
|
+
var DIGEST_RUN = `
|
|
7523
|
+
query ToolkitStewardDigestRun($inboxPath: String!, $digestRunId: String!) {
|
|
7524
|
+
viewer { stewardDigestRun(inboxPath: $inboxPath, digestRunId: $digestRunId) { ${DIGEST_RUN_FIELDS} } }
|
|
7525
|
+
}`.trim();
|
|
7526
|
+
var DIGEST_RUN_PENDING = `
|
|
7527
|
+
query ToolkitStewardDigestRunPending($inboxPath: String!, $digestRunId: String!, $input: StewardDigestRunPendingInput) {
|
|
7528
|
+
viewer {
|
|
7529
|
+
stewardDigestRunPending(inboxPath: $inboxPath, digestRunId: $digestRunId, input: $input) {
|
|
7530
|
+
edges {
|
|
7531
|
+
node { deliveryId feedEntryId source { kind id } decisionReason consumedAtMs alertSnapshot }
|
|
7532
|
+
}
|
|
7533
|
+
pageInfo { hasNextPage endCursor }
|
|
7534
|
+
}
|
|
7535
|
+
}
|
|
7536
|
+
}`.trim();
|
|
7537
|
+
var PUBLISH_DAILY_BRIEF = `
|
|
7538
|
+
mutation ToolkitStewardPublishDailyBrief($input: PublishStewardDailyBriefInput!) {
|
|
7539
|
+
publishStewardDailyBrief(input: $input) { run { ${DIGEST_RUN_FIELDS} } }
|
|
7540
|
+
}`.trim();
|
|
7363
7541
|
var DECISIONS = /* @__PURE__ */ new Set([
|
|
7364
7542
|
"immediate",
|
|
7365
7543
|
"digest",
|
|
@@ -7624,14 +7802,21 @@ var COMMAND_DEFINITIONS = [
|
|
|
7624
7802
|
values: ["inbox-path", "delivery-id", "request-id"]
|
|
7625
7803
|
}),
|
|
7626
7804
|
command("steward send", {
|
|
7627
|
-
values: [
|
|
7805
|
+
values: [
|
|
7806
|
+
"inbox-path",
|
|
7807
|
+
"body",
|
|
7808
|
+
"delivery-ids",
|
|
7809
|
+
"request-id",
|
|
7810
|
+
"digest-run-id"
|
|
7811
|
+
]
|
|
7628
7812
|
}),
|
|
7629
7813
|
command("steward pending", {
|
|
7630
|
-
values: ["inbox-path", "
|
|
7814
|
+
values: ["inbox-path", "since", "until", "first", "digest-run-id"]
|
|
7631
7815
|
}),
|
|
7632
7816
|
command("steward briefed", {
|
|
7633
7817
|
values: ["inbox-path", "delivery-ids", "digest-run-id"]
|
|
7634
7818
|
}),
|
|
7819
|
+
command("steward status", { values: ["inbox-path", "digest-run-id"] }),
|
|
7635
7820
|
command("company-news create", {
|
|
7636
7821
|
values: ["name", "tickers", "initial-lookback-hours", "page-size"]
|
|
7637
7822
|
}),
|
|
@@ -7645,11 +7830,16 @@ var COMMAND_DEFINITIONS = [
|
|
|
7645
7830
|
"entity-ids",
|
|
7646
7831
|
"entity-stances",
|
|
7647
7832
|
"tickers",
|
|
7648
|
-
"visibility"
|
|
7833
|
+
"visibility",
|
|
7834
|
+
"track-return"
|
|
7649
7835
|
],
|
|
7650
7836
|
booleans: ["body-stdin"]
|
|
7651
7837
|
}),
|
|
7652
|
-
command("thesis asset-candidates", {
|
|
7838
|
+
command("thesis asset-candidates", {
|
|
7839
|
+
values: ["text", "entity-ids", "thesis-id"],
|
|
7840
|
+
booleans: ["no-discovery"]
|
|
7841
|
+
}),
|
|
7842
|
+
command("thesis return", { values: ["id"], booleans: ["detail"] }),
|
|
7653
7843
|
command("thesis list", {
|
|
7654
7844
|
values: [
|
|
7655
7845
|
"person",
|
|
@@ -7665,9 +7855,6 @@ var COMMAND_DEFINITIONS = [
|
|
|
7665
7855
|
command("thesis related", { values: ["id", "first", "cursor"] }),
|
|
7666
7856
|
command("thesis get", { values: ["id"] }),
|
|
7667
7857
|
command("thesis version list", { values: ["id", "first", "cursor"] }),
|
|
7668
|
-
command("thesis version delete", {
|
|
7669
|
-
values: ["id", "author-version-id", "expected-author-version-id"]
|
|
7670
|
-
}),
|
|
7671
7858
|
command("thesis version get", {
|
|
7672
7859
|
values: ["id", "author-version-id"]
|
|
7673
7860
|
}),
|
|
@@ -7689,14 +7876,11 @@ var COMMAND_DEFINITIONS = [
|
|
|
7689
7876
|
"entity-ids",
|
|
7690
7877
|
"entity-stances",
|
|
7691
7878
|
"medias",
|
|
7692
|
-
"visibility"
|
|
7879
|
+
"visibility",
|
|
7880
|
+
"track-return"
|
|
7693
7881
|
],
|
|
7694
|
-
booleans: ["body-stdin"
|
|
7695
|
-
}),
|
|
7696
|
-
command("thesis close", {
|
|
7697
|
-
values: ["id", "expected-author-version-id", "note"]
|
|
7882
|
+
booleans: ["body-stdin"]
|
|
7698
7883
|
}),
|
|
7699
|
-
command("thesis delete", { values: ["id"] }),
|
|
7700
7884
|
command("thesis rewrite", {
|
|
7701
7885
|
values: ["body", "body-file", "mode"],
|
|
7702
7886
|
booleans: ["body-stdin"]
|
|
@@ -7997,9 +8181,18 @@ var COMMAND_DEFINITIONS = [
|
|
|
7997
8181
|
values: ["account-id", "limit", "page-token"]
|
|
7998
8182
|
}),
|
|
7999
8183
|
command("markets narrative", { values: ["ticker"] }),
|
|
8184
|
+
command("markets watchlist"),
|
|
8185
|
+
command("markets watchlist list", { values: ["limit", "cursor"] }),
|
|
8186
|
+
command("markets watchlist add", { values: ["tickers", "kind"] }),
|
|
8187
|
+
command("markets watchlist remove", { values: ["tickers", "kind"] }),
|
|
8000
8188
|
command("markets earnings", {
|
|
8001
8189
|
values: ["ticker", "event", "fiscal-year", "fiscal-quarter"]
|
|
8002
8190
|
}),
|
|
8191
|
+
command("people search", { values: ["query", "kind", "limit"] }),
|
|
8192
|
+
command("people follows"),
|
|
8193
|
+
command("people follows list", { values: ["kind", "limit", "cursor"] }),
|
|
8194
|
+
command("people follows follow", { values: ["kind", "id"] }),
|
|
8195
|
+
command("people follows unfollow", { values: ["kind", "id"] }),
|
|
8003
8196
|
command("trading-pairs search", {
|
|
8004
8197
|
values: [
|
|
8005
8198
|
"symbol",
|
|
@@ -11829,7 +12022,7 @@ function formatTradingPairResolved(result) {
|
|
|
11829
12022
|
}
|
|
11830
12023
|
|
|
11831
12024
|
// src/cli/dispatch.ts
|
|
11832
|
-
var CLI_VERSION = true ? "0.
|
|
12025
|
+
var CLI_VERSION = true ? "0.36.0-beta.0" : "dev";
|
|
11833
12026
|
var DEFAULT_RUN_TIMEOUT_MS = 6e5;
|
|
11834
12027
|
var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
|
|
11835
12028
|
var GLOBAL_VALUE_FLAGS = Object.entries(GLOBAL_FLAG_DEFINITIONS).filter(([, kind]) => kind === "value").map(([name]) => `--${name}`);
|
|
@@ -11894,31 +12087,30 @@ Embedded commands target the host-attached Inbox; the terminal CLI requires
|
|
|
11894
12087
|
Subcommands:
|
|
11895
12088
|
decide Record the decision for one delivery (required before forward/send)
|
|
11896
12089
|
forward Re-post the original alert card by reference (immediate only)
|
|
11897
|
-
|
|
11898
|
-
pending
|
|
11899
|
-
|
|
12090
|
+
status Read one durable Daily Brief run
|
|
12091
|
+
pending Read a durable run's complete fixed-window set, or use legacy bounds
|
|
12092
|
+
send Publish and complete a durable run, or use the legacy send contract
|
|
12093
|
+
briefed Record that a Daily Brief covered at most 100 listed deliveries
|
|
11900
12094
|
|
|
11901
12095
|
Flags:
|
|
11902
12096
|
--inbox-path <path> Steward Session Inbox (terminal CLI only)
|
|
11903
12097
|
--delivery-id <id> One delivery (decide, forward)
|
|
11904
|
-
--delivery-ids <a,b,c> Comma-separated deliveries (briefed; optional for send \u2014 omit for a For-You-only Brief)
|
|
12098
|
+
--delivery-ids <a,b,c> Comma-separated deliveries (legacy briefed: max 100; optional for send \u2014 omit for a For-You-only Brief)
|
|
11905
12099
|
--decision <immediate|digest|suppress>
|
|
11906
12100
|
--reason <text> Short audit note stored with the decision
|
|
11907
|
-
--body <markdown> Message body (send)
|
|
12101
|
+
--body <markdown> Message body (durable send: omit when reviewed coverage yields no useful content)
|
|
11908
12102
|
--request-id <uuid> Idempotency key; generated when omitted
|
|
11909
|
-
--
|
|
11910
|
-
--
|
|
11911
|
-
--
|
|
11912
|
-
--
|
|
11913
|
-
--digest-run-id <id> The request id echoed by the send that carried these deliveries (briefed)
|
|
12103
|
+
--since <RFC3339> Lower bound on decision time (pending)
|
|
12104
|
+
--until <RFC3339> Fixed upper bound of the Brief window (pending)
|
|
12105
|
+
--first <n> Internal page size, 1-100 (terminal pending only)
|
|
12106
|
+
--digest-run-id <uuid> Durable run identity (status/pending/send)
|
|
11914
12107
|
|
|
11915
12108
|
Examples (terminal; the embedded Agent tool omits --inbox-path):
|
|
11916
12109
|
alva steward decide --inbox-path /alva/home/alice/agents/steward-9/.pi/agent/sessions/main.inbox.jsonl --delivery-id 123 --decision immediate --reason "guidance cut 15%"
|
|
11917
12110
|
alva steward forward --inbox-path <inbox> --delivery-id 123
|
|
11918
|
-
alva steward
|
|
11919
|
-
alva steward
|
|
11920
|
-
alva steward
|
|
11921
|
-
alva steward pending --inbox-path <inbox> --after <nextCursor from the previous page>
|
|
12111
|
+
alva steward status --inbox-path <inbox> --digest-run-id <uuid>
|
|
12112
|
+
alva steward pending --inbox-path <inbox> --digest-run-id <uuid>
|
|
12113
|
+
alva steward send --inbox-path <inbox> --digest-run-id <uuid> --delivery-ids 124,125 --body "Daily Brief..."
|
|
11922
12114
|
alva steward briefed --inbox-path <inbox> --digest-run-id <request id echoed by send> --delivery-ids 124,125`,
|
|
11923
12115
|
configure: `Usage: alva configure --api-key <key> [--base-url <url>] [--profile <name>]
|
|
11924
12116
|
|
|
@@ -13063,6 +13255,8 @@ owners, feed slugs, versions, or paths.
|
|
|
13063
13255
|
Subcommands:
|
|
13064
13256
|
narrative Get the current narrative, history, and narrative change log
|
|
13065
13257
|
earnings Get Pre, Release, Transcript, and Post for one fiscal event
|
|
13258
|
+
watchlist list|add|remove
|
|
13259
|
+
The user's ticker watchlist in the Alva App
|
|
13066
13260
|
|
|
13067
13261
|
Narrative flags:
|
|
13068
13262
|
--ticker <symbol> Stock ticker (required)
|
|
@@ -13076,6 +13270,21 @@ Earnings flags:
|
|
|
13076
13270
|
Do not combine --event with --fiscal-year/--fiscal-quarter. These commands read
|
|
13077
13271
|
the current backend view; historical query-as-of gating is not supported yet.
|
|
13078
13272
|
|
|
13273
|
+
Watchlist flags:
|
|
13274
|
+
--tickers <A,B> add/remove: 1-50 exact symbols (required).
|
|
13275
|
+
Suffix one symbol with :stock, :etf, or
|
|
13276
|
+
:crypto to pick its kind (BTC:crypto)
|
|
13277
|
+
--kind <stock|etf|crypto> add/remove: default kind for unsuffixed symbols
|
|
13278
|
+
--limit <1-100> list: page size (default 20)
|
|
13279
|
+
--cursor <endCursor> list: pageInfo.endCursor of the previous page
|
|
13280
|
+
|
|
13281
|
+
add/remove write every resolved symbol in one atomic batch. Result groups:
|
|
13282
|
+
added|removed (written now), unchanged (already in that state), unresolved
|
|
13283
|
+
(NOT_FOUND, or FAILED_PRECONDITION = several entities share the symbol:
|
|
13284
|
+
retry it with a kind suffix). Nothing is written when no symbol resolves.
|
|
13285
|
+
remove is recorded even for symbols not in the watchlist, so holdings sync
|
|
13286
|
+
does not add them back; add re-adds a symbol the user removed earlier.
|
|
13287
|
+
|
|
13079
13288
|
Output semantics:
|
|
13080
13289
|
Narrative is dated Alva analysis. Use current for present-tense company
|
|
13081
13290
|
context and history only to explain changes; use separate sources for live
|
|
@@ -13093,7 +13302,32 @@ Examples:
|
|
|
13093
13302
|
alva markets narrative --ticker AAPL
|
|
13094
13303
|
alva markets earnings --ticker AAPL
|
|
13095
13304
|
alva markets earnings --ticker AAPL --event next-confirmed
|
|
13096
|
-
alva markets earnings --ticker AAPL --fiscal-year 2026 --fiscal-quarter Q3
|
|
13305
|
+
alva markets earnings --ticker AAPL --fiscal-year 2026 --fiscal-quarter Q3
|
|
13306
|
+
alva markets watchlist add --tickers NVDA,LMT,BTC:crypto
|
|
13307
|
+
alva markets watchlist list --limit 50`,
|
|
13308
|
+
people: `Usage: alva people <subcommand> [options]
|
|
13309
|
+
|
|
13310
|
+
Search and follow public profiles: USER is an Alva user, PERSON is a curated
|
|
13311
|
+
person. These change the same Following list the user sees in the Alva App.
|
|
13312
|
+
|
|
13313
|
+
Subcommands:
|
|
13314
|
+
search Prefix match on name, username, slug, or alias
|
|
13315
|
+
follows list List the profiles the caller follows
|
|
13316
|
+
follows follow Follow one profile (idempotent)
|
|
13317
|
+
follows unfollow Unfollow one profile (idempotent)
|
|
13318
|
+
|
|
13319
|
+
Flags:
|
|
13320
|
+
--query <text> search: name or username prefix (required)
|
|
13321
|
+
--kind <user|person> search/list: optional filter; follow/unfollow:
|
|
13322
|
+
required, from a search or list result
|
|
13323
|
+
--id <id> follow/unfollow: profile id (required)
|
|
13324
|
+
--limit <1-50> search/list: page size
|
|
13325
|
+
--cursor <endCursor> list: pageInfo.endCursor of the previous page
|
|
13326
|
+
|
|
13327
|
+
Examples:
|
|
13328
|
+
alva people search --query "cathie wood" --kind person
|
|
13329
|
+
alva people follows follow --kind person --id 42
|
|
13330
|
+
alva people follows list`,
|
|
13097
13331
|
"trading-pairs": `Usage: alva trading-pairs <subcommand> [options]
|
|
13098
13332
|
|
|
13099
13333
|
Discover canonical trading-pair identities before backtesting or trading.
|
|
@@ -13203,7 +13437,7 @@ Examples:
|
|
|
13203
13437
|
alva arrays token status`,
|
|
13204
13438
|
thesis: `Usage: alva thesis <subcommand> [options]
|
|
13205
13439
|
|
|
13206
|
-
Create, read, inspect Signals and exact author versions,
|
|
13440
|
+
Create, read, inspect Signals and exact author versions, publish Updates to, or explicitly rewrite an authored thesis.
|
|
13207
13441
|
Backend owns Signal/Alert setup; the CLI never starts them separately.
|
|
13208
13442
|
Create and update never rewrite text automatically.
|
|
13209
13443
|
|
|
@@ -13214,7 +13448,6 @@ Subcommands:
|
|
|
13214
13448
|
get Get one thesis
|
|
13215
13449
|
version get Get one exact author version
|
|
13216
13450
|
version list List visible Updates with editorial revisions folded together
|
|
13217
|
-
version delete Delete one Update; restore prior content if it is current
|
|
13218
13451
|
signals Read published Signal history
|
|
13219
13452
|
set-visibility Change current access without publishing a version
|
|
13220
13453
|
archive Archive the current author version
|
|
@@ -13222,9 +13455,7 @@ Subcommands:
|
|
|
13222
13455
|
star Add the Thesis to your bookmarks
|
|
13223
13456
|
unstar Remove the Thesis from your bookmarks
|
|
13224
13457
|
set-signal-enabled Enable or disable managed Signal research
|
|
13225
|
-
update
|
|
13226
|
-
close Close the current author version with an optional note
|
|
13227
|
-
delete Delete a thesis
|
|
13458
|
+
update Publish a new Update replacing body, title, entities, visibility (all sent in full)
|
|
13228
13459
|
rewrite Explicitly request a candidate body rewrite; never called by another command
|
|
13229
13460
|
|
|
13230
13461
|
Body input (create, update, rewrite): choose exactly one:
|
|
@@ -13239,7 +13470,7 @@ the backend; do not send a fresh ID. Create defaults --visibility to public.
|
|
|
13239
13470
|
Update requires --visibility explicitly so it cannot inadvertently publish.
|
|
13240
13471
|
|
|
13241
13472
|
Other flags:
|
|
13242
|
-
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>]
|
|
13473
|
+
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]
|
|
13243
13474
|
Images: public creation only, at most 20 in display order. Upload selected files
|
|
13244
13475
|
with the existing host upload tool after publication confirmation. Private
|
|
13245
13476
|
images and local/ALFS paths are not supported; this flag does not upload.
|
|
@@ -13257,12 +13488,14 @@ Other flags:
|
|
|
13257
13488
|
publication.playbookId is the ID for get/version/signals/related;
|
|
13258
13489
|
publication=null means no readable snapshot. Author lists include the
|
|
13259
13490
|
signed-in owner's private Theses (visibility private).
|
|
13260
|
-
asset-candidates --text <unsaved thesis text>
|
|
13491
|
+
asset-candidates --text <unsaved thesis text> [--entity-ids <id,id>] [--thesis-id <id>] [--no-discovery]
|
|
13492
|
+
--no-discovery only classifies --entity-ids (no ticker discovery) and
|
|
13493
|
+
returns returnPreview: the directions publishing would store, the return
|
|
13494
|
+
switch (askSwitch) and lastLegRemoved. --thesis-id seeds an Update.
|
|
13495
|
+
return --id <id> [--detail] the Thesis return; --detail adds each Update's positions
|
|
13261
13496
|
get --id <signed-int64-decimal>
|
|
13262
13497
|
version get --id <signed-int64-decimal> --author-version-id <signed-int64-decimal>
|
|
13263
13498
|
version list --id <id> [--first <1-100>] [--cursor <next_cursor>]
|
|
13264
|
-
version delete --id <id> --author-version-id <selected> --expected-author-version-id <current>
|
|
13265
|
-
Cannot remove the last Update. Never falls back to whole-Thesis deletion.
|
|
13266
13499
|
signals --id <id> [--first <1-50>] [--cursor <opaque-cursor>]
|
|
13267
13500
|
set-visibility --id <id> --visibility public|private
|
|
13268
13501
|
archive --id <id> --request-id <uuid> [--note <text>]
|
|
@@ -13283,13 +13516,12 @@ Maintenance behavior:
|
|
|
13283
13516
|
set-signal-enabled changes managed Signal research without deleting history.
|
|
13284
13517
|
The command returns enabled, research_paused, archived, and author version
|
|
13285
13518
|
state; GraphQL errors and noncanonical error codes fail closed.
|
|
13286
|
-
update --id <id> --request-id <uuid> --expected-author-version-id <id> --body ... --visibility <value> [--title <text>] [--entity-ids <id,id>] [--entity-stances <json>] [--medias <json-array>] [--
|
|
13519
|
+
update --id <id> --request-id <uuid> --expected-author-version-id <id> --body ... --visibility <value> [--title <text>] [--entity-ids <id,id>] [--entity-stances <json>] [--medias <json-array>] [--track-return true|false]
|
|
13287
13520
|
For text edits, pass current medias unchanged; omission clears media.
|
|
13288
13521
|
|
|
13289
13522
|
Only editing the body? Resubmit the existing entity IDs and directions.
|
|
13290
|
-
|
|
13291
|
-
|
|
13292
|
-
delete --id <id>
|
|
13523
|
+
On an Update, an omitted or unknown direction of a carried ticker keeps its
|
|
13524
|
+
previous direction; none is an exit.
|
|
13293
13525
|
rewrite --body ... [--mode reformat|shorten|enrich]
|
|
13294
13526
|
|
|
13295
13527
|
Rewrite mode defaults only when omitted, and the toolkit always sends the
|
|
@@ -13516,19 +13748,19 @@ function deliveryProviderFilter(flags, command2) {
|
|
|
13516
13748
|
}
|
|
13517
13749
|
return flags["delivery-provider"];
|
|
13518
13750
|
}
|
|
13519
|
-
function projectUserProfileForCLI(
|
|
13520
|
-
const { active_channel: activeIMProvider, ...profile } =
|
|
13751
|
+
function projectUserProfileForCLI(record4) {
|
|
13752
|
+
const { active_channel: activeIMProvider, ...profile } = record4;
|
|
13521
13753
|
return { ...profile, active_im_provider: activeIMProvider };
|
|
13522
13754
|
}
|
|
13523
13755
|
function projectNotificationHistoryForCLI(response) {
|
|
13524
13756
|
if (response === null || typeof response !== "object" || Array.isArray(response)) {
|
|
13525
13757
|
return response;
|
|
13526
13758
|
}
|
|
13527
|
-
const
|
|
13528
|
-
if (!Array.isArray(
|
|
13759
|
+
const record4 = response;
|
|
13760
|
+
if (!Array.isArray(record4.items)) return response;
|
|
13529
13761
|
return {
|
|
13530
|
-
...
|
|
13531
|
-
items:
|
|
13762
|
+
...record4,
|
|
13763
|
+
items: record4.items.map((item) => {
|
|
13532
13764
|
if (item === null || typeof item !== "object" || Array.isArray(item)) {
|
|
13533
13765
|
return item;
|
|
13534
13766
|
}
|
|
@@ -13542,6 +13774,111 @@ function num(val) {
|
|
|
13542
13774
|
const n = Number(val);
|
|
13543
13775
|
return Number.isNaN(n) ? void 0 : n;
|
|
13544
13776
|
}
|
|
13777
|
+
function upperFlag(val) {
|
|
13778
|
+
return val === void 0 ? void 0 : val.trim().toUpperCase();
|
|
13779
|
+
}
|
|
13780
|
+
function optionalCursorFlag(val) {
|
|
13781
|
+
if (val === void 0) return void 0;
|
|
13782
|
+
if (!val.trim() || val.length > 4096) {
|
|
13783
|
+
throw new Error(
|
|
13784
|
+
"--cursor must be a non-empty cursor of at most 4096 characters"
|
|
13785
|
+
);
|
|
13786
|
+
}
|
|
13787
|
+
return val;
|
|
13788
|
+
}
|
|
13789
|
+
function usageChecked(command2, check) {
|
|
13790
|
+
try {
|
|
13791
|
+
return check();
|
|
13792
|
+
} catch (error) {
|
|
13793
|
+
if (error instanceof CliUsageError) throw error;
|
|
13794
|
+
throw new CliUsageError(
|
|
13795
|
+
error instanceof Error ? error.message : String(error),
|
|
13796
|
+
command2.split(" ")[0]
|
|
13797
|
+
);
|
|
13798
|
+
}
|
|
13799
|
+
}
|
|
13800
|
+
function dispatchWatchlist(client, leaf, flags) {
|
|
13801
|
+
switch (leaf) {
|
|
13802
|
+
case void 0:
|
|
13803
|
+
return { _help: true, text: COMMAND_HELP.markets };
|
|
13804
|
+
case "add":
|
|
13805
|
+
case "remove": {
|
|
13806
|
+
const command2 = `markets watchlist ${leaf}`;
|
|
13807
|
+
const params = usageChecked(
|
|
13808
|
+
command2,
|
|
13809
|
+
() => normalizeWatchlistTickersParams({
|
|
13810
|
+
tickers: (csvList(requireFlag(flags, "tickers", command2)) ?? []).map(
|
|
13811
|
+
parseTickerSpec
|
|
13812
|
+
),
|
|
13813
|
+
kind: upperFlag(flags["kind"])
|
|
13814
|
+
})
|
|
13815
|
+
);
|
|
13816
|
+
return leaf === "add" ? client.follows.addToWatchlist(params) : client.follows.removeFromWatchlist(params);
|
|
13817
|
+
}
|
|
13818
|
+
case "list": {
|
|
13819
|
+
const command2 = "markets watchlist list";
|
|
13820
|
+
return client.follows.watchlist({
|
|
13821
|
+
first: optionalBoundedIntegerFlag(flags, "limit", command2, 1, 100),
|
|
13822
|
+
after: usageChecked(command2, () => optionalCursorFlag(flags["cursor"]))
|
|
13823
|
+
});
|
|
13824
|
+
}
|
|
13825
|
+
default:
|
|
13826
|
+
throw new CliUsageError(
|
|
13827
|
+
`Unknown subcommand: markets watchlist ${leaf}`,
|
|
13828
|
+
"markets"
|
|
13829
|
+
);
|
|
13830
|
+
}
|
|
13831
|
+
}
|
|
13832
|
+
function dispatchPeople(client, path, flags) {
|
|
13833
|
+
const [subcommand, leaf] = path;
|
|
13834
|
+
if (subcommand === void 0 || subcommand === "follows" && !leaf) {
|
|
13835
|
+
return { _help: true, text: COMMAND_HELP.people };
|
|
13836
|
+
}
|
|
13837
|
+
const command2 = ["people", ...path].join(" ");
|
|
13838
|
+
switch (subcommand === "follows" ? `follows ${leaf}` : subcommand) {
|
|
13839
|
+
case "search":
|
|
13840
|
+
return client.follows.searchProfiles(
|
|
13841
|
+
usageChecked(
|
|
13842
|
+
command2,
|
|
13843
|
+
() => validateSearchProfilesParams({
|
|
13844
|
+
query: requireFlag(flags, "query", command2),
|
|
13845
|
+
kind: upperFlag(flags["kind"]),
|
|
13846
|
+
first: optionalBoundedIntegerFlag(flags, "limit", command2, 1, 50)
|
|
13847
|
+
})
|
|
13848
|
+
)
|
|
13849
|
+
);
|
|
13850
|
+
case "follows list":
|
|
13851
|
+
return client.follows.profiles({
|
|
13852
|
+
kind: usageChecked(
|
|
13853
|
+
command2,
|
|
13854
|
+
() => optionalProfileKind(upperFlag(flags["kind"]))
|
|
13855
|
+
),
|
|
13856
|
+
first: optionalBoundedIntegerFlag(flags, "limit", command2, 1, 50),
|
|
13857
|
+
after: usageChecked(command2, () => optionalCursorFlag(flags["cursor"]))
|
|
13858
|
+
});
|
|
13859
|
+
case "follows follow":
|
|
13860
|
+
case "follows unfollow": {
|
|
13861
|
+
const params = usageChecked(
|
|
13862
|
+
command2,
|
|
13863
|
+
() => validateProfileRef({
|
|
13864
|
+
kind: upperFlag(
|
|
13865
|
+
requireFlag(flags, "kind", command2)
|
|
13866
|
+
),
|
|
13867
|
+
id: requireFlag(flags, "id", command2)
|
|
13868
|
+
})
|
|
13869
|
+
);
|
|
13870
|
+
return leaf === "follow" ? client.follows.followProfile(params) : client.follows.unfollowProfile(params);
|
|
13871
|
+
}
|
|
13872
|
+
default:
|
|
13873
|
+
throw new CliUsageError(`Unknown subcommand: ${command2}`, "people");
|
|
13874
|
+
}
|
|
13875
|
+
}
|
|
13876
|
+
function optionalProfileKind(kind) {
|
|
13877
|
+
if (kind !== void 0 && kind !== "USER" && kind !== "PERSON") {
|
|
13878
|
+
throw new Error("kind must be USER or PERSON");
|
|
13879
|
+
}
|
|
13880
|
+
return kind;
|
|
13881
|
+
}
|
|
13545
13882
|
function csvList(val) {
|
|
13546
13883
|
if (val === void 0) return void 0;
|
|
13547
13884
|
const values = val.split(",").map((item) => item.trim()).filter(Boolean);
|
|
@@ -14048,6 +14385,17 @@ function thesisImages(flags) {
|
|
|
14048
14385
|
"thesis"
|
|
14049
14386
|
);
|
|
14050
14387
|
}
|
|
14388
|
+
function thesisTrackReturn(flags, command2) {
|
|
14389
|
+
const raw = flags["track-return"];
|
|
14390
|
+
if (raw === void 0) return void 0;
|
|
14391
|
+
const parsed = boolFlag(raw);
|
|
14392
|
+
if (parsed === void 0)
|
|
14393
|
+
throw new CliUsageError(
|
|
14394
|
+
`--track-return must be true or false for ${command2}`,
|
|
14395
|
+
"thesis"
|
|
14396
|
+
);
|
|
14397
|
+
return parsed;
|
|
14398
|
+
}
|
|
14051
14399
|
function thesisEntityStances(flags) {
|
|
14052
14400
|
const raw = flags["entity-stances"];
|
|
14053
14401
|
if (raw === void 0) return void 0;
|
|
@@ -14198,7 +14546,7 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
14198
14546
|
const positionals = parsedCommand.positionals;
|
|
14199
14547
|
if (group === "whoami") {
|
|
14200
14548
|
const user = await client.user.me();
|
|
14201
|
-
const
|
|
14549
|
+
const record4 = projectUserProfileForCLI(
|
|
14202
14550
|
user
|
|
14203
14551
|
);
|
|
14204
14552
|
const version = meta?.cliVersion ?? CLI_VERSION;
|
|
@@ -14215,10 +14563,10 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
14215
14563
|
metaBlock.arrays_jwt = arraysJwtStatus;
|
|
14216
14564
|
}
|
|
14217
14565
|
const result = {
|
|
14218
|
-
...
|
|
14566
|
+
...record4,
|
|
14219
14567
|
_meta: metaBlock
|
|
14220
14568
|
};
|
|
14221
|
-
const minVersion =
|
|
14569
|
+
const minVersion = record4.toolkit_min_version;
|
|
14222
14570
|
if (typeof minVersion === "string" && version && version !== "dev" && isVersionOlderThan(version, minVersion)) {
|
|
14223
14571
|
result._warning = `Warning: your toolkit version (${version}) is older than the minimum recommended version (${minVersion}). Please upgrade: npm install -g @alva-ai/toolkit`;
|
|
14224
14572
|
}
|
|
@@ -14592,6 +14940,14 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
14592
14940
|
requestId: flags["request-id"]
|
|
14593
14941
|
});
|
|
14594
14942
|
case "send":
|
|
14943
|
+
if (flags["digest-run-id"] !== void 0) {
|
|
14944
|
+
return client.steward.sendDigestRun({
|
|
14945
|
+
inboxPath,
|
|
14946
|
+
digestRunId: requireFlag(flags, "digest-run-id", "steward send"),
|
|
14947
|
+
deliveryIds: optionalIds("delivery-ids"),
|
|
14948
|
+
body: flags.body
|
|
14949
|
+
});
|
|
14950
|
+
}
|
|
14595
14951
|
return client.steward.send({
|
|
14596
14952
|
inboxPath,
|
|
14597
14953
|
body: requireFlag(flags, "body", "steward send"),
|
|
@@ -14599,6 +14955,16 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
14599
14955
|
requestId: flags["request-id"]
|
|
14600
14956
|
});
|
|
14601
14957
|
case "pending": {
|
|
14958
|
+
if (flags["digest-run-id"] !== void 0) {
|
|
14959
|
+
return client.steward.digestRunPending({
|
|
14960
|
+
inboxPath,
|
|
14961
|
+
digestRunId: requireFlag(
|
|
14962
|
+
flags,
|
|
14963
|
+
"digest-run-id",
|
|
14964
|
+
"steward pending"
|
|
14965
|
+
)
|
|
14966
|
+
});
|
|
14967
|
+
}
|
|
14602
14968
|
const parseTime = (name) => {
|
|
14603
14969
|
const value = flags[name];
|
|
14604
14970
|
if (value === void 0) return void 0;
|
|
@@ -14614,7 +14980,6 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
14614
14980
|
const first = flags.first === void 0 ? void 0 : Number(flags.first);
|
|
14615
14981
|
return client.steward.pending({
|
|
14616
14982
|
inboxPath,
|
|
14617
|
-
after: flags.after,
|
|
14618
14983
|
sinceMs: parseTime("since"),
|
|
14619
14984
|
untilMs: parseTime("until"),
|
|
14620
14985
|
first
|
|
@@ -14626,6 +14991,11 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
14626
14991
|
deliveryIds: ids("delivery-ids"),
|
|
14627
14992
|
digestRunId: requireFlag(flags, "digest-run-id", "steward briefed")
|
|
14628
14993
|
});
|
|
14994
|
+
case "status":
|
|
14995
|
+
return client.steward.digestRun({
|
|
14996
|
+
inboxPath,
|
|
14997
|
+
digestRunId: requireFlag(flags, "digest-run-id", "steward status")
|
|
14998
|
+
});
|
|
14629
14999
|
default:
|
|
14630
15000
|
throw new CliUsageError(
|
|
14631
15001
|
`Unknown subcommand: steward ${subcommand}`,
|
|
@@ -14679,11 +15049,22 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
14679
15049
|
entity_ids: thesisEntityIDs(flags),
|
|
14680
15050
|
entity_stances: thesisEntityStances(flags),
|
|
14681
15051
|
tickers: thesisTickers(flags),
|
|
14682
|
-
visibility: flags.visibility === void 0 ? "public" : thesisCreateVisibility(flags.visibility)
|
|
15052
|
+
visibility: flags.visibility === void 0 ? "public" : thesisCreateVisibility(flags.visibility),
|
|
15053
|
+
track_return: thesisTrackReturn(flags, "thesis create")
|
|
14683
15054
|
});
|
|
14684
15055
|
case "asset-candidates":
|
|
14685
15056
|
return client.theses.assetCandidates(
|
|
14686
|
-
requireFlag(flags, "text", "thesis asset-candidates")
|
|
15057
|
+
requireFlag(flags, "text", "thesis asset-candidates"),
|
|
15058
|
+
{
|
|
15059
|
+
entityIds: thesisEntityIDs(flags),
|
|
15060
|
+
thesisId: flags["thesis-id"],
|
|
15061
|
+
discover: boolFlag(flags["no-discovery"]) !== true
|
|
15062
|
+
}
|
|
15063
|
+
);
|
|
15064
|
+
case "return":
|
|
15065
|
+
return client.theses.thesisReturn(
|
|
15066
|
+
requireFlag(flags, "id", "thesis return"),
|
|
15067
|
+
{ detail: boolFlag(flags.detail) === true }
|
|
14687
15068
|
);
|
|
14688
15069
|
case "list": {
|
|
14689
15070
|
const params = {
|
|
@@ -14730,17 +15111,6 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
14730
15111
|
}
|
|
14731
15112
|
);
|
|
14732
15113
|
}
|
|
14733
|
-
if (parsedCommand.path[2] === "delete") {
|
|
14734
|
-
return client.theses.deleteUpdate(
|
|
14735
|
-
requireFlag(flags, "id", "thesis version delete"),
|
|
14736
|
-
requireFlag(flags, "author-version-id", "thesis version delete"),
|
|
14737
|
-
requireFlag(
|
|
14738
|
-
flags,
|
|
14739
|
-
"expected-author-version-id",
|
|
14740
|
-
"thesis version delete"
|
|
14741
|
-
)
|
|
14742
|
-
);
|
|
14743
|
-
}
|
|
14744
15114
|
return client.theses.getVersion(
|
|
14745
15115
|
requireFlag(flags, "id", "thesis version get"),
|
|
14746
15116
|
requireFlag(flags, "author-version-id", "thesis version get")
|
|
@@ -14813,22 +15183,9 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
14813
15183
|
visibility: thesisVisibility(
|
|
14814
15184
|
requireFlag(flags, "visibility", "thesis update")
|
|
14815
15185
|
),
|
|
14816
|
-
|
|
15186
|
+
track_return: thesisTrackReturn(flags, "thesis update")
|
|
14817
15187
|
}
|
|
14818
15188
|
);
|
|
14819
|
-
case "close":
|
|
14820
|
-
return client.theses.close(requireFlag(flags, "id", "thesis close"), {
|
|
14821
|
-
expected_author_version_id: requireFlag(
|
|
14822
|
-
flags,
|
|
14823
|
-
"expected-author-version-id",
|
|
14824
|
-
"thesis close"
|
|
14825
|
-
),
|
|
14826
|
-
note: flags.note
|
|
14827
|
-
});
|
|
14828
|
-
case "delete":
|
|
14829
|
-
return client.theses.delete(
|
|
14830
|
-
requireFlag(flags, "id", "thesis delete")
|
|
14831
|
-
);
|
|
14832
15189
|
case "rewrite":
|
|
14833
15190
|
return client.theses.rewrite({
|
|
14834
15191
|
body: await thesisBodyFromFlags(flags, "thesis rewrite", deps),
|
|
@@ -16011,6 +16368,9 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
16011
16368
|
case "markets": {
|
|
16012
16369
|
if (!subcommand)
|
|
16013
16370
|
throw new CliUsageError("Missing subcommand for markets", "markets");
|
|
16371
|
+
if (subcommand === "watchlist") {
|
|
16372
|
+
return dispatchWatchlist(client, parsedCommand.path[2], flags);
|
|
16373
|
+
}
|
|
16014
16374
|
const ticker = requireFlag(flags, "ticker", `markets ${subcommand}`);
|
|
16015
16375
|
switch (subcommand) {
|
|
16016
16376
|
case "narrative":
|
|
@@ -16124,6 +16484,8 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
16124
16484
|
);
|
|
16125
16485
|
}
|
|
16126
16486
|
}
|
|
16487
|
+
case "people":
|
|
16488
|
+
return dispatchPeople(client, parsedCommand.path.slice(1), flags);
|
|
16127
16489
|
case "trading": {
|
|
16128
16490
|
if (!subcommand)
|
|
16129
16491
|
throw new CliUsageError("Missing subcommand for trading", "trading");
|