@alva-ai/toolkit 0.38.0-beta.0 → 0.38.0-beta.1
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 +3 -3
- package/dist/browser.global.js +50 -49
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.d.ts +62 -5
- package/dist/cli.js +204 -13
- package/dist/cli.js.map +1 -1
- package/dist/dispatch.d.ts +62 -5
- package/dist/dispatch.js +84 -8
- package/dist/dispatch.js.map +1 -1
- package/dist/index.cjs +151 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +62 -5
- package/dist/index.d.ts +62 -5
- package/dist/index.js +151 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/dispatch.d.ts
CHANGED
|
@@ -2106,6 +2106,25 @@ interface ThesisPositionReturn {
|
|
|
2106
2106
|
end: 'PENDING' | 'NEXT_UPDATE' | 'LATEST';
|
|
2107
2107
|
positionReturn: number;
|
|
2108
2108
|
currency: string;
|
|
2109
|
+
/** The Update's target share of this position; equal shares when it states none. */
|
|
2110
|
+
weight: number;
|
|
2111
|
+
}
|
|
2112
|
+
/** One long or short of a target portfolio. */
|
|
2113
|
+
interface ThesisHolding {
|
|
2114
|
+
entityId: string;
|
|
2115
|
+
symbol: string;
|
|
2116
|
+
direction: 'BULLISH' | 'BEARISH';
|
|
2117
|
+
/** Target share as a fraction; equal shares when the Update states none. */
|
|
2118
|
+
weight: number;
|
|
2119
|
+
}
|
|
2120
|
+
/**
|
|
2121
|
+
* The current target portfolio: the shares the latest Update set, not drifted
|
|
2122
|
+
* with prices. Holdings and cash sum to 1; cash is 1 with no direction or
|
|
2123
|
+
* while archived.
|
|
2124
|
+
*/
|
|
2125
|
+
interface ThesisAllocation {
|
|
2126
|
+
holdings: ThesisHolding[];
|
|
2127
|
+
cash: number;
|
|
2109
2128
|
}
|
|
2110
2129
|
/** One Update on the return chart. */
|
|
2111
2130
|
interface ThesisUpdateReturn {
|
|
@@ -2124,6 +2143,8 @@ interface ThesisReturnValue {
|
|
|
2124
2143
|
stale: boolean;
|
|
2125
2144
|
computedAtMs: number;
|
|
2126
2145
|
updates: ThesisUpdateReturn[];
|
|
2146
|
+
/** The current target portfolio, with detail; null on card reads. */
|
|
2147
|
+
allocation: ThesisAllocation | null;
|
|
2127
2148
|
}
|
|
2128
2149
|
interface ThesisReturnResult {
|
|
2129
2150
|
playbookId: string;
|
|
@@ -2159,6 +2180,14 @@ interface ThesisEntityStance {
|
|
|
2159
2180
|
stance: ThesisAssetStance;
|
|
2160
2181
|
/** Full direction in responses; stance reports none as unknown there. */
|
|
2161
2182
|
direction?: ThesisAssetStance;
|
|
2183
|
+
/**
|
|
2184
|
+
* The Update's share of this long or short as a fraction (0.4 is 40%), with
|
|
2185
|
+
* at most four decimals. On create and update give one to every bullish or
|
|
2186
|
+
* bearish entity, and the rest is cash, or to none, and the shares follow
|
|
2187
|
+
* the default rules and what the body says. Responses carry it only on an
|
|
2188
|
+
* Update published with weights.
|
|
2189
|
+
*/
|
|
2190
|
+
weight?: number;
|
|
2162
2191
|
}
|
|
2163
2192
|
/** GraphQL direction, including NONE. */
|
|
2164
2193
|
type ThesisDirection = 'UNKNOWN' | 'BULLISH' | 'BEARISH' | 'NONE';
|
|
@@ -2312,6 +2341,25 @@ interface CreateThesisParams {
|
|
|
2312
2341
|
visibility?: 'public' | 'private';
|
|
2313
2342
|
/** Thesis return switch; omitted keeps the default (on). */
|
|
2314
2343
|
track_return?: boolean;
|
|
2344
|
+
/** Which Signals the Thesis shows; omitted shows every Signal. */
|
|
2345
|
+
signal_preferences?: ThesisSignalPreferences;
|
|
2346
|
+
}
|
|
2347
|
+
/** What a Thesis Signal is about. */
|
|
2348
|
+
type ThesisSignalKind = 'fundamentals' | 'macro' | 'technicals' | 'commentary';
|
|
2349
|
+
/** The least important Signals a Thesis shows; notable means notable and major. */
|
|
2350
|
+
type ThesisSignalMinImportance = 'all' | 'notable' | 'major';
|
|
2351
|
+
/**
|
|
2352
|
+
* Which Signals a Thesis shows to every reader, chosen by its author. Signals
|
|
2353
|
+
* without a label always show.
|
|
2354
|
+
*/
|
|
2355
|
+
interface ThesisSignalPreferences {
|
|
2356
|
+
kinds: ThesisSignalKind[];
|
|
2357
|
+
min_importance: ThesisSignalMinImportance;
|
|
2358
|
+
}
|
|
2359
|
+
interface ThesisSignalPreferencesResponse {
|
|
2360
|
+
/** The Thesis read or written; null for the caller's last choice. */
|
|
2361
|
+
thesis_id: ThesisID | null;
|
|
2362
|
+
preferences: ThesisSignalPreferences;
|
|
2315
2363
|
}
|
|
2316
2364
|
interface UpdateThesisParams {
|
|
2317
2365
|
/** Full media replacement; pass current medias for a text-only update. */
|
|
@@ -2399,6 +2447,17 @@ declare class ThesesResource {
|
|
|
2399
2447
|
*/
|
|
2400
2448
|
setArchived(id: ThesisID, params: SetThesisArchivedParams): Promise<ThesisResponse>;
|
|
2401
2449
|
setStarred(id: ThesisID, isStarred: boolean): Promise<ThesisStarredResponse>;
|
|
2450
|
+
/**
|
|
2451
|
+
* Reads which Signals one of the caller's Theses shows: its setting, or every
|
|
2452
|
+
* kind and `all` when it has none. Without an id, reads the setting the caller
|
|
2453
|
+
* last saved, which prefills a new Thesis. Only the Thesis's author can read it.
|
|
2454
|
+
*/
|
|
2455
|
+
getSignalPreferences(id?: ThesisID): Promise<ThesisSignalPreferencesResponse>;
|
|
2456
|
+
/**
|
|
2457
|
+
* Replaces which Signals one of the caller's Theses shows, for every reader,
|
|
2458
|
+
* and records it as the caller's last choice. Author only.
|
|
2459
|
+
*/
|
|
2460
|
+
setSignalPreferences(id: ThesisID, preferences: ThesisSignalPreferences): Promise<ThesisSignalPreferencesResponse>;
|
|
2402
2461
|
setSignalEnabled(id: ThesisID, enabled: boolean): Promise<ThesisSignalEnabledResponse>;
|
|
2403
2462
|
setVisibility(id: ThesisID, params: SetThesisVisibilityParams): Promise<ThesisResponse>;
|
|
2404
2463
|
rewrite(params: RewriteThesisParams): Promise<RewriteThesisResponse>;
|
|
@@ -2512,12 +2571,10 @@ interface FollowingThesesParams {
|
|
|
2512
2571
|
first?: number;
|
|
2513
2572
|
}
|
|
2514
2573
|
/** The author of a Thesis in the following feed. */
|
|
2574
|
+
/** The followed user who wrote a Thesis Update. Persons cannot be followed. */
|
|
2515
2575
|
interface FollowingThesisAuthor {
|
|
2516
|
-
kind: 'user'
|
|
2517
|
-
|
|
2518
|
-
username?: string;
|
|
2519
|
-
/** Set for a person. */
|
|
2520
|
-
slug?: string;
|
|
2576
|
+
kind: 'user';
|
|
2577
|
+
username: string;
|
|
2521
2578
|
display_name: string;
|
|
2522
2579
|
}
|
|
2523
2580
|
interface FollowingThesisItem {
|
package/dist/dispatch.js
CHANGED
|
@@ -6065,7 +6065,9 @@ var EMBEDDED_COMMAND_DEFINITIONS = [
|
|
|
6065
6065
|
"entity-stances",
|
|
6066
6066
|
"tickers",
|
|
6067
6067
|
"visibility",
|
|
6068
|
-
"track-return"
|
|
6068
|
+
"track-return",
|
|
6069
|
+
"signal-kinds",
|
|
6070
|
+
"signal-min-importance"
|
|
6069
6071
|
]
|
|
6070
6072
|
}),
|
|
6071
6073
|
route("thesis asset-candidates", "thesis asset-candidates", {
|
|
@@ -6113,6 +6115,12 @@ var EMBEDDED_COMMAND_DEFINITIONS = [
|
|
|
6113
6115
|
route("thesis set-signal-enabled", "thesis set-signal-enabled", {
|
|
6114
6116
|
values: ["id", "enabled"]
|
|
6115
6117
|
}),
|
|
6118
|
+
route("thesis signal-preferences get", "thesis signal-preferences get", {
|
|
6119
|
+
values: ["id"]
|
|
6120
|
+
}),
|
|
6121
|
+
route("thesis signal-preferences set", "thesis signal-preferences set", {
|
|
6122
|
+
values: ["id", "kinds", "min-importance"]
|
|
6123
|
+
}),
|
|
6116
6124
|
route("thesis update", "thesis update", {
|
|
6117
6125
|
values: [
|
|
6118
6126
|
"id",
|
|
@@ -6673,7 +6681,7 @@ Examples:
|
|
|
6673
6681
|
alva for-you theses --cursor '<nextCursor>'`,
|
|
6674
6682
|
thesis: `Usage: alva thesis <subcommand> [options]
|
|
6675
6683
|
|
|
6676
|
-
Subcommands: list, related, asset-candidates, create, get, version get, signals, watchpoints, set-visibility, archive, star, unstar, set-signal-enabled, update, rewrite.
|
|
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.
|
|
6677
6685
|
|
|
6678
6686
|
list --person <slug> | --person-name <name> | --user <username>
|
|
6679
6687
|
| --ticker <ticker> | --entity-id <id>
|
|
@@ -6697,10 +6705,22 @@ the Thesis return switch (askSwitch) and whether the draft would be rejected
|
|
|
6697
6705
|
(lastLegRemoved). Publish with create/update --entity-ids <id,id> and
|
|
6698
6706
|
--entity-stances <json> equal to returnPreview.directions, lowercased:
|
|
6699
6707
|
--entity-stances '[{"entity_id":"745337","stance":"bearish"}]'. Valid stances:
|
|
6700
|
-
unknown, bullish, bearish, none.
|
|
6708
|
+
unknown, bullish, bearish, none. An optional "weight" (a fraction, 0.4 is 40%,
|
|
6709
|
+
at most four decimals) sets that long or short's share and the rest is cash:
|
|
6710
|
+
give one to every bullish or bearish entity or to none; without weights the
|
|
6711
|
+
shares follow the default rules and what the body says, and get shows weight
|
|
6712
|
+
only on an Update published with weights. --track-return false turns the Thesis return
|
|
6701
6713
|
off for good; it is accepted only while the switch is UNSET.
|
|
6714
|
+
create --signal-kinds <kind,kind> --signal-min-importance all|notable|major
|
|
6715
|
+
limits which Signals the new Thesis shows (omit both: every Signal). Kinds:
|
|
6716
|
+
fundamentals, macro, technicals, commentary.
|
|
6717
|
+
signal-preferences get [--id <id>] reads which Signals your Thesis shows
|
|
6718
|
+
(without --id: your last saved setting); signal-preferences set --id <id>
|
|
6719
|
+
[--kinds <kind,kind>] [--min-importance all|notable|major] changes only what is
|
|
6720
|
+
given, for every reader of that Thesis. Author only.
|
|
6702
6721
|
return --id <id> [--detail] reads the Thesis return (fractions; --detail adds
|
|
6703
|
-
each Update's positions
|
|
6722
|
+
each Update's positions with their weight and the allocation: the current
|
|
6723
|
+
target shares and cash, not drifted with prices).
|
|
6704
6724
|
watchpoints --id <thesis-id> lists every watchpoint of the Thesis (the same id
|
|
6705
6725
|
as get and signals). A watchpoint is one thing the Thesis depends on, or that
|
|
6706
6726
|
would show it right or wrong; Alva's Signal research checks each new source
|
|
@@ -7332,6 +7352,12 @@ function argument(message) {
|
|
|
7332
7352
|
}
|
|
7333
7353
|
|
|
7334
7354
|
// src/resources/theses.ts
|
|
7355
|
+
var THESIS_SIGNAL_KINDS = [
|
|
7356
|
+
"fundamentals",
|
|
7357
|
+
"macro",
|
|
7358
|
+
"technicals",
|
|
7359
|
+
"commentary"
|
|
7360
|
+
];
|
|
7335
7361
|
var encoder = new TextEncoder();
|
|
7336
7362
|
|
|
7337
7363
|
// src/resources/follows.ts
|
|
@@ -7852,7 +7878,9 @@ var COMMAND_DEFINITIONS = [
|
|
|
7852
7878
|
"entity-stances",
|
|
7853
7879
|
"tickers",
|
|
7854
7880
|
"visibility",
|
|
7855
|
-
"track-return"
|
|
7881
|
+
"track-return",
|
|
7882
|
+
"signal-kinds",
|
|
7883
|
+
"signal-min-importance"
|
|
7856
7884
|
],
|
|
7857
7885
|
booleans: ["body-stdin"]
|
|
7858
7886
|
}),
|
|
@@ -7886,6 +7914,10 @@ var COMMAND_DEFINITIONS = [
|
|
|
7886
7914
|
command("thesis star", { values: ["id"] }),
|
|
7887
7915
|
command("thesis unstar", { values: ["id"] }),
|
|
7888
7916
|
command("thesis set-signal-enabled", { values: ["id", "enabled"] }),
|
|
7917
|
+
command("thesis signal-preferences get", { values: ["id"] }),
|
|
7918
|
+
command("thesis signal-preferences set", {
|
|
7919
|
+
values: ["id", "kinds", "min-importance"]
|
|
7920
|
+
}),
|
|
7889
7921
|
command("thesis update", {
|
|
7890
7922
|
values: [
|
|
7891
7923
|
"id",
|
|
@@ -12045,7 +12077,7 @@ function formatTradingPairResolved(result) {
|
|
|
12045
12077
|
}
|
|
12046
12078
|
|
|
12047
12079
|
// src/cli/dispatch.ts
|
|
12048
|
-
var CLI_VERSION = true ? "0.38.0-beta.
|
|
12080
|
+
var CLI_VERSION = true ? "0.38.0-beta.1" : "dev";
|
|
12049
12081
|
var DEFAULT_RUN_TIMEOUT_MS = 6e5;
|
|
12050
12082
|
var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
|
|
12051
12083
|
var GLOBAL_VALUE_FLAGS = Object.entries(GLOBAL_FLAG_DEFINITIONS).filter(([, kind]) => kind === "value").map(([name]) => `--${name}`);
|
|
@@ -13486,6 +13518,7 @@ Subcommands:
|
|
|
13486
13518
|
star Add the Thesis to your bookmarks
|
|
13487
13519
|
unstar Remove the Thesis from your bookmarks
|
|
13488
13520
|
set-signal-enabled Enable or disable managed Signal research
|
|
13521
|
+
signal-preferences get|set Read or change which Signals your Thesis shows
|
|
13489
13522
|
update Publish a new Update replacing body, title, entities, visibility (all sent in full);
|
|
13490
13523
|
with --archived false it also unarchives the Thesis
|
|
13491
13524
|
rewrite Explicitly request a candidate body rewrite; never called by another command
|
|
@@ -13502,7 +13535,9 @@ the backend; do not send a fresh ID. Create defaults --visibility to public.
|
|
|
13502
13535
|
Update requires --visibility explicitly so it cannot inadvertently publish.
|
|
13503
13536
|
|
|
13504
13537
|
Other flags:
|
|
13505
|
-
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]
|
|
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]
|
|
13539
|
+
Signals: omit both to show every Signal. Kinds: fundamentals, macro,
|
|
13540
|
+
technicals, commentary; with only one flag the other keeps its default.
|
|
13506
13541
|
Images: public creation only, at most 20 in display order. Upload selected files
|
|
13507
13542
|
with the existing host upload tool after publication confirmation. Private
|
|
13508
13543
|
images and local/ALFS paths are not supported; this flag does not upload.
|
|
@@ -13543,6 +13578,13 @@ Other flags:
|
|
|
13543
13578
|
archive --id <id> --request-id <uuid> [--note <text>]
|
|
13544
13579
|
star|unstar --id <id>
|
|
13545
13580
|
set-signal-enabled --id <id> --enabled true|false
|
|
13581
|
+
signal-preferences get [--id <id>]
|
|
13582
|
+
Which Signals your Thesis shows to every reader: {thesis_id, preferences:
|
|
13583
|
+
{kinds, min_importance}}. Without --id: the setting you last saved, which
|
|
13584
|
+
prefills a new Thesis. Only the author can read or set it.
|
|
13585
|
+
signal-preferences set --id <id> [--kinds <kind,kind>] [--min-importance all|notable|major]
|
|
13586
|
+
Changes only what is given. Applies to every reader, the Thesis's
|
|
13587
|
+
deliveries and, from its next daily run, its Overview.
|
|
13546
13588
|
|
|
13547
13589
|
Maintenance behavior:
|
|
13548
13590
|
archive reads the current Thesis first, preserves its body, title,
|
|
@@ -14438,6 +14480,22 @@ function thesisImages(flags) {
|
|
|
14438
14480
|
"thesis"
|
|
14439
14481
|
);
|
|
14440
14482
|
}
|
|
14483
|
+
function thesisSignalKindList(raw, flag) {
|
|
14484
|
+
const kinds = raw.split(",").map((kind) => kind.trim());
|
|
14485
|
+
if (kinds.some((kind) => kind === "")) {
|
|
14486
|
+
throw new CliUsageError(`${flag} must not contain empty kinds`, "thesis");
|
|
14487
|
+
}
|
|
14488
|
+
return kinds;
|
|
14489
|
+
}
|
|
14490
|
+
function thesisCreateSignalPreferences(flags) {
|
|
14491
|
+
const kinds = flags["signal-kinds"];
|
|
14492
|
+
const minImportance = flags["signal-min-importance"];
|
|
14493
|
+
if (kinds === void 0 && minImportance === void 0) return void 0;
|
|
14494
|
+
return {
|
|
14495
|
+
kinds: kinds === void 0 ? [...THESIS_SIGNAL_KINDS] : thesisSignalKindList(kinds, "--signal-kinds"),
|
|
14496
|
+
min_importance: minImportance ?? "all"
|
|
14497
|
+
};
|
|
14498
|
+
}
|
|
14441
14499
|
function thesisTrackReturn(flags, command2) {
|
|
14442
14500
|
const raw = flags["track-return"];
|
|
14443
14501
|
if (raw === void 0) return void 0;
|
|
@@ -15112,7 +15170,8 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
15112
15170
|
entity_stances: thesisEntityStances(flags),
|
|
15113
15171
|
tickers: thesisTickers(flags),
|
|
15114
15172
|
visibility: flags.visibility === void 0 ? "public" : thesisCreateVisibility(flags.visibility),
|
|
15115
|
-
track_return: thesisTrackReturn(flags, "thesis create")
|
|
15173
|
+
track_return: thesisTrackReturn(flags, "thesis create"),
|
|
15174
|
+
signal_preferences: thesisCreateSignalPreferences(flags)
|
|
15116
15175
|
});
|
|
15117
15176
|
case "asset-candidates":
|
|
15118
15177
|
return client.theses.assetCandidates(
|
|
@@ -15217,6 +15276,23 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
15217
15276
|
requireFlag(flags, "id", "thesis unstar"),
|
|
15218
15277
|
false
|
|
15219
15278
|
);
|
|
15279
|
+
case "signal-preferences": {
|
|
15280
|
+
if (parsedCommand.path[2] === "get") {
|
|
15281
|
+
return client.theses.getSignalPreferences(flags.id);
|
|
15282
|
+
}
|
|
15283
|
+
const id = requireFlag(flags, "id", "thesis signal-preferences set");
|
|
15284
|
+
if (flags.kinds === void 0 && flags["min-importance"] === void 0) {
|
|
15285
|
+
throw new CliUsageError(
|
|
15286
|
+
"thesis signal-preferences set needs --kinds or --min-importance",
|
|
15287
|
+
"thesis"
|
|
15288
|
+
);
|
|
15289
|
+
}
|
|
15290
|
+
const current = await client.theses.getSignalPreferences(id);
|
|
15291
|
+
return client.theses.setSignalPreferences(id, {
|
|
15292
|
+
kinds: flags.kinds === void 0 ? current.preferences.kinds : thesisSignalKindList(flags.kinds, "--kinds"),
|
|
15293
|
+
min_importance: flags["min-importance"] === void 0 ? current.preferences.min_importance : flags["min-importance"]
|
|
15294
|
+
});
|
|
15295
|
+
}
|
|
15220
15296
|
case "set-signal-enabled":
|
|
15221
15297
|
return client.theses.setSignalEnabled(
|
|
15222
15298
|
requireFlag(flags, "id", "thesis set-signal-enabled"),
|