@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/cli.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/cli.js
CHANGED
|
@@ -8969,7 +8969,8 @@ var RETURN_QUERY = `query ToolkitThesisReturn($id: ID!, $detail: Boolean!) {
|
|
|
8969
8969
|
thesisReturn(detail: $detail) {
|
|
8970
8970
|
live value firstFillAtMs pricedAtMs stale computedAtMs
|
|
8971
8971
|
updates { authorVersionId publishedAtMs startValue updateReturn
|
|
8972
|
-
positions { entityId symbol direction startPrice startAtMs endPrice endAtMs end positionReturn currency } }
|
|
8972
|
+
positions { entityId symbol direction startPrice startAtMs endPrice endAtMs end positionReturn currency weight } }
|
|
8973
|
+
allocation { holdings { entityId symbol direction weight } cash }
|
|
8973
8974
|
}
|
|
8974
8975
|
} } } }
|
|
8975
8976
|
}`;
|
|
@@ -9038,16 +9039,21 @@ async function thesisWatchpoints(client, id) {
|
|
|
9038
9039
|
return { playbookId: id, watchpoints };
|
|
9039
9040
|
}
|
|
9040
9041
|
function validThesisReturn(value) {
|
|
9041
|
-
if (!record2(value) || typeof value.live !== "boolean" || typeof value.value !== "number" || typeof value.stale !== "boolean" || typeof value.computedAtMs !== "number" || !Array.isArray(value.updates))
|
|
9042
|
+
if (!record2(value) || typeof value.live !== "boolean" || typeof value.value !== "number" || typeof value.stale !== "boolean" || typeof value.computedAtMs !== "number" || !Array.isArray(value.updates) || value.allocation !== null && !validAllocation(value.allocation))
|
|
9042
9043
|
return false;
|
|
9043
9044
|
return value.updates.every(
|
|
9044
9045
|
(update) => record2(update) && nonempty(update.authorVersionId) && typeof update.publishedAtMs === "number" && typeof update.startValue === "number" && Array.isArray(update.positions) && update.positions.every(
|
|
9045
9046
|
(position) => record2(position) && nonempty(position.symbol) && ["BULLISH", "BEARISH"].includes(position.direction) && ["PENDING", "NEXT_UPDATE", "LATEST"].includes(
|
|
9046
9047
|
position.end
|
|
9047
|
-
) && typeof position.positionReturn === "number"
|
|
9048
|
+
) && typeof position.positionReturn === "number" && typeof position.weight === "number"
|
|
9048
9049
|
)
|
|
9049
9050
|
);
|
|
9050
9051
|
}
|
|
9052
|
+
function validAllocation(value) {
|
|
9053
|
+
return record2(value) && typeof value.cash === "number" && Array.isArray(value.holdings) && value.holdings.every(
|
|
9054
|
+
(holding) => record2(holding) && nonempty(holding.entityId) && nonempty(holding.symbol) && ["BULLISH", "BEARISH"].includes(holding.direction) && typeof holding.weight === "number"
|
|
9055
|
+
);
|
|
9056
|
+
}
|
|
9051
9057
|
async function graphql(client, document, variables) {
|
|
9052
9058
|
const response = await client._request("POST", "/query", {
|
|
9053
9059
|
body: { query: document, variables }
|
|
@@ -9104,6 +9110,13 @@ function notFound() {
|
|
|
9104
9110
|
}
|
|
9105
9111
|
|
|
9106
9112
|
// src/resources/theses.ts
|
|
9113
|
+
var THESIS_SIGNAL_KINDS = [
|
|
9114
|
+
"fundamentals",
|
|
9115
|
+
"macro",
|
|
9116
|
+
"technicals",
|
|
9117
|
+
"commentary"
|
|
9118
|
+
];
|
|
9119
|
+
var THESIS_SIGNAL_MIN_IMPORTANCES = ["all", "notable", "major"];
|
|
9107
9120
|
var SET_THESIS_STARRED = `mutation SetThesisStarred($input: SetThesisStarredInput!) {
|
|
9108
9121
|
setThesisStarred(input: $input) {
|
|
9109
9122
|
thesisId
|
|
@@ -9209,9 +9222,11 @@ var ThesesResource = class {
|
|
|
9209
9222
|
async create(params) {
|
|
9210
9223
|
this.client._requireAuth();
|
|
9211
9224
|
const body = createBody(params);
|
|
9212
|
-
|
|
9225
|
+
const response = thesisResponse(
|
|
9213
9226
|
await this.client._request("POST", "/api/v1/theses", { body })
|
|
9214
9227
|
);
|
|
9228
|
+
requireKeptWeights(body.entity_stances, response.thesis.entity_stances);
|
|
9229
|
+
return response;
|
|
9215
9230
|
}
|
|
9216
9231
|
async get(id) {
|
|
9217
9232
|
this.client._requireAuth();
|
|
@@ -9300,6 +9315,7 @@ var ThesesResource = class {
|
|
|
9300
9315
|
if (response.thesis.id !== thesisID) {
|
|
9301
9316
|
throw invalidResponse3("update response must match the requested thesis");
|
|
9302
9317
|
}
|
|
9318
|
+
requireKeptWeights(body.entity_stances, response.thesis.entity_stances);
|
|
9303
9319
|
return response;
|
|
9304
9320
|
}
|
|
9305
9321
|
/**
|
|
@@ -9334,7 +9350,11 @@ var ThesesResource = class {
|
|
|
9334
9350
|
body: current.thesis.body,
|
|
9335
9351
|
title: current.thesis.title,
|
|
9336
9352
|
entity_ids: current.thesis.entity_ids,
|
|
9337
|
-
|
|
9353
|
+
// Directions only: archiving keeps the current Update and unarchiving
|
|
9354
|
+
// keeps its shares without restating them.
|
|
9355
|
+
entity_stances: current.thesis.entity_stances?.map(
|
|
9356
|
+
({ entity_id, stance }) => ({ entity_id, stance })
|
|
9357
|
+
),
|
|
9338
9358
|
visibility: current.thesis.visibility,
|
|
9339
9359
|
archived: params.archived,
|
|
9340
9360
|
medias: current.thesis.medias,
|
|
@@ -9381,6 +9401,45 @@ var ThesesResource = class {
|
|
|
9381
9401
|
is_starred: returnedStarred
|
|
9382
9402
|
};
|
|
9383
9403
|
}
|
|
9404
|
+
/**
|
|
9405
|
+
* Reads which Signals one of the caller's Theses shows: its setting, or every
|
|
9406
|
+
* kind and `all` when it has none. Without an id, reads the setting the caller
|
|
9407
|
+
* last saved, which prefills a new Thesis. Only the Thesis's author can read it.
|
|
9408
|
+
*/
|
|
9409
|
+
async getSignalPreferences(id) {
|
|
9410
|
+
this.client._requireAuth();
|
|
9411
|
+
if (id === void 0) {
|
|
9412
|
+
return signalPreferencesResponse(
|
|
9413
|
+
await this.client._request("GET", "/api/v1/theses/signal-preferences"),
|
|
9414
|
+
null
|
|
9415
|
+
);
|
|
9416
|
+
}
|
|
9417
|
+
const thesisID = requireID(id, "id");
|
|
9418
|
+
return signalPreferencesResponse(
|
|
9419
|
+
await this.client._request(
|
|
9420
|
+
"GET",
|
|
9421
|
+
`/api/v1/theses/${thesisID}/signal-preferences`
|
|
9422
|
+
),
|
|
9423
|
+
thesisID
|
|
9424
|
+
);
|
|
9425
|
+
}
|
|
9426
|
+
/**
|
|
9427
|
+
* Replaces which Signals one of the caller's Theses shows, for every reader,
|
|
9428
|
+
* and records it as the caller's last choice. Author only.
|
|
9429
|
+
*/
|
|
9430
|
+
async setSignalPreferences(id, preferences) {
|
|
9431
|
+
this.client._requireAuth();
|
|
9432
|
+
const thesisID = requireID(id, "id");
|
|
9433
|
+
const input = requireSignalPreferences(preferences);
|
|
9434
|
+
return signalPreferencesResponse(
|
|
9435
|
+
await this.client._request(
|
|
9436
|
+
"PUT",
|
|
9437
|
+
`/api/v1/theses/${thesisID}/signal-preferences`,
|
|
9438
|
+
{ body: { signal_preferences: input } }
|
|
9439
|
+
),
|
|
9440
|
+
thesisID
|
|
9441
|
+
);
|
|
9442
|
+
}
|
|
9384
9443
|
async setSignalEnabled(id, enabled) {
|
|
9385
9444
|
this.client._requireAuth();
|
|
9386
9445
|
const thesisID = requireID(id, "id");
|
|
@@ -9487,6 +9546,10 @@ function createBody(params) {
|
|
|
9487
9546
|
body.tickers = requireTickers(params.tickers);
|
|
9488
9547
|
if (params.track_return !== void 0)
|
|
9489
9548
|
body.track_return = requireTrackReturn(params.track_return);
|
|
9549
|
+
if (params.signal_preferences !== void 0)
|
|
9550
|
+
body.signal_preferences = requireSignalPreferences(
|
|
9551
|
+
params.signal_preferences
|
|
9552
|
+
);
|
|
9490
9553
|
if (params.entity_stances !== void 0) {
|
|
9491
9554
|
body.entity_stances = requireEntityStances(
|
|
9492
9555
|
params.entity_stances,
|
|
@@ -9495,6 +9558,43 @@ function createBody(params) {
|
|
|
9495
9558
|
}
|
|
9496
9559
|
return body;
|
|
9497
9560
|
}
|
|
9561
|
+
function requireSignalPreferences(value) {
|
|
9562
|
+
if (!isRecord(value) || !Array.isArray(value.kinds))
|
|
9563
|
+
throw invalidArgument(
|
|
9564
|
+
"signal_preferences must have kinds and min_importance"
|
|
9565
|
+
);
|
|
9566
|
+
const kinds = [...new Set(value.kinds)];
|
|
9567
|
+
if (kinds.length === 0 || !kinds.every(
|
|
9568
|
+
(kind) => THESIS_SIGNAL_KINDS.includes(kind)
|
|
9569
|
+
))
|
|
9570
|
+
throw invalidArgument(
|
|
9571
|
+
`signal kinds must be one or more of ${THESIS_SIGNAL_KINDS.join(", ")}`
|
|
9572
|
+
);
|
|
9573
|
+
if (!THESIS_SIGNAL_MIN_IMPORTANCES.includes(
|
|
9574
|
+
value.min_importance
|
|
9575
|
+
))
|
|
9576
|
+
throw invalidArgument(
|
|
9577
|
+
`min_importance must be ${THESIS_SIGNAL_MIN_IMPORTANCES.join(", ")}`
|
|
9578
|
+
);
|
|
9579
|
+
return {
|
|
9580
|
+
kinds,
|
|
9581
|
+
min_importance: value.min_importance
|
|
9582
|
+
};
|
|
9583
|
+
}
|
|
9584
|
+
function signalPreferencesResponse(value, thesisID) {
|
|
9585
|
+
if (!isRecord(value) || value.thesis_id !== thesisID)
|
|
9586
|
+
throw invalidResponse3(
|
|
9587
|
+
"Signal setting response must name the requested thesis"
|
|
9588
|
+
);
|
|
9589
|
+
try {
|
|
9590
|
+
return {
|
|
9591
|
+
thesis_id: thesisID,
|
|
9592
|
+
preferences: requireSignalPreferences(value.signal_preferences)
|
|
9593
|
+
};
|
|
9594
|
+
} catch {
|
|
9595
|
+
throw invalidResponse3("response contains an unknown Signal setting");
|
|
9596
|
+
}
|
|
9597
|
+
}
|
|
9498
9598
|
var ENTITY_STANCES = [
|
|
9499
9599
|
"unknown",
|
|
9500
9600
|
"bullish",
|
|
@@ -9560,9 +9660,44 @@ function requireEntityStances(value, entityIDs) {
|
|
|
9560
9660
|
seen.add(entityID);
|
|
9561
9661
|
if (!ENTITY_STANCES.includes(item.stance))
|
|
9562
9662
|
throw invalidArgument(`entity_stances[${index}].stance is invalid`);
|
|
9563
|
-
|
|
9663
|
+
const stance = {
|
|
9664
|
+
entity_id: entityID,
|
|
9665
|
+
stance: item.stance
|
|
9666
|
+
};
|
|
9667
|
+
if (item.weight !== void 0) {
|
|
9668
|
+
if (!validWeight(item.weight))
|
|
9669
|
+
throw invalidArgument(
|
|
9670
|
+
`entity_stances[${index}].weight must be a fraction in (0, 1] with at most four decimals`
|
|
9671
|
+
);
|
|
9672
|
+
if (stance.stance !== "bullish" && stance.stance !== "bearish")
|
|
9673
|
+
throw invalidArgument(
|
|
9674
|
+
`entity_stances[${index}].weight needs a bullish or bearish stance`
|
|
9675
|
+
);
|
|
9676
|
+
stance.weight = item.weight;
|
|
9677
|
+
}
|
|
9678
|
+
return stance;
|
|
9564
9679
|
});
|
|
9565
9680
|
}
|
|
9681
|
+
function validWeight(value) {
|
|
9682
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return false;
|
|
9683
|
+
const bps = Math.round(value * 1e4);
|
|
9684
|
+
return bps >= 1 && bps <= 1e4 && Math.abs(value * 1e4 - bps) <= 1e-6;
|
|
9685
|
+
}
|
|
9686
|
+
function requireKeptWeights(sent, returned) {
|
|
9687
|
+
if (!Array.isArray(sent)) return;
|
|
9688
|
+
const weights = /* @__PURE__ */ new Map();
|
|
9689
|
+
for (const item of returned ?? []) {
|
|
9690
|
+
if (item.weight !== void 0) weights.set(item.entity_id, item.weight);
|
|
9691
|
+
}
|
|
9692
|
+
for (const item of sent) {
|
|
9693
|
+
if (item.weight === void 0) continue;
|
|
9694
|
+
const kept = weights.get(item.entity_id);
|
|
9695
|
+
if (kept === void 0 || Math.abs(kept - item.weight) > 1e-9)
|
|
9696
|
+
throw invalidResponse3(
|
|
9697
|
+
"the Update was published without the weights sent: the server predates weights"
|
|
9698
|
+
);
|
|
9699
|
+
}
|
|
9700
|
+
}
|
|
9566
9701
|
function updateBody(params) {
|
|
9567
9702
|
const body = {
|
|
9568
9703
|
request_id: requireRequestID(params.request_id),
|
|
@@ -9670,6 +9805,13 @@ function thesisResponse(response) {
|
|
|
9670
9805
|
);
|
|
9671
9806
|
stance.direction = item.direction;
|
|
9672
9807
|
}
|
|
9808
|
+
if (item.weight !== void 0) {
|
|
9809
|
+
if (!validWeight(item.weight))
|
|
9810
|
+
throw invalidResponse3(
|
|
9811
|
+
"thesis.entity_stances contains invalid weight"
|
|
9812
|
+
);
|
|
9813
|
+
stance.weight = item.weight;
|
|
9814
|
+
}
|
|
9673
9815
|
return stance;
|
|
9674
9816
|
});
|
|
9675
9817
|
}
|
|
@@ -10544,13 +10686,12 @@ function followingThesesPage(value) {
|
|
|
10544
10686
|
}
|
|
10545
10687
|
function followingThesisAuthor(value) {
|
|
10546
10688
|
if (value === null) return null;
|
|
10547
|
-
if (!record3(value) || value.kind !== "user"
|
|
10689
|
+
if (!record3(value) || value.kind !== "user" || typeof value.username !== "string" || typeof value.display_name !== "string") {
|
|
10548
10690
|
throw invalidFollowingTheses("invalid following theses author");
|
|
10549
10691
|
}
|
|
10550
10692
|
return {
|
|
10551
10693
|
kind: value.kind,
|
|
10552
|
-
|
|
10553
|
-
...value.slug === void 0 ? {} : { slug: value.slug },
|
|
10694
|
+
username: value.username,
|
|
10554
10695
|
display_name: value.display_name
|
|
10555
10696
|
};
|
|
10556
10697
|
}
|
|
@@ -13087,7 +13228,9 @@ var COMMAND_DEFINITIONS = [
|
|
|
13087
13228
|
"entity-stances",
|
|
13088
13229
|
"tickers",
|
|
13089
13230
|
"visibility",
|
|
13090
|
-
"track-return"
|
|
13231
|
+
"track-return",
|
|
13232
|
+
"signal-kinds",
|
|
13233
|
+
"signal-min-importance"
|
|
13091
13234
|
],
|
|
13092
13235
|
booleans: ["body-stdin"]
|
|
13093
13236
|
}),
|
|
@@ -13121,6 +13264,10 @@ var COMMAND_DEFINITIONS = [
|
|
|
13121
13264
|
command("thesis star", { values: ["id"] }),
|
|
13122
13265
|
command("thesis unstar", { values: ["id"] }),
|
|
13123
13266
|
command("thesis set-signal-enabled", { values: ["id", "enabled"] }),
|
|
13267
|
+
command("thesis signal-preferences get", { values: ["id"] }),
|
|
13268
|
+
command("thesis signal-preferences set", {
|
|
13269
|
+
values: ["id", "kinds", "min-importance"]
|
|
13270
|
+
}),
|
|
13124
13271
|
command("thesis update", {
|
|
13125
13272
|
values: [
|
|
13126
13273
|
"id",
|
|
@@ -17897,7 +18044,7 @@ function formatTradingPairResolved(result) {
|
|
|
17897
18044
|
}
|
|
17898
18045
|
|
|
17899
18046
|
// src/cli/dispatch.ts
|
|
17900
|
-
var CLI_VERSION = true ? "0.38.0-beta.
|
|
18047
|
+
var CLI_VERSION = true ? "0.38.0-beta.1" : "dev";
|
|
17901
18048
|
var DEFAULT_RUN_TIMEOUT_MS = 6e5;
|
|
17902
18049
|
var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
|
|
17903
18050
|
var GLOBAL_VALUE_FLAGS = Object.entries(GLOBAL_FLAG_DEFINITIONS).filter(([, kind]) => kind === "value").map(([name]) => `--${name}`);
|
|
@@ -19397,6 +19544,7 @@ Subcommands:
|
|
|
19397
19544
|
star Add the Thesis to your bookmarks
|
|
19398
19545
|
unstar Remove the Thesis from your bookmarks
|
|
19399
19546
|
set-signal-enabled Enable or disable managed Signal research
|
|
19547
|
+
signal-preferences get|set Read or change which Signals your Thesis shows
|
|
19400
19548
|
update Publish a new Update replacing body, title, entities, visibility (all sent in full);
|
|
19401
19549
|
with --archived false it also unarchives the Thesis
|
|
19402
19550
|
rewrite Explicitly request a candidate body rewrite; never called by another command
|
|
@@ -19413,7 +19561,9 @@ the backend; do not send a fresh ID. Create defaults --visibility to public.
|
|
|
19413
19561
|
Update requires --visibility explicitly so it cannot inadvertently publish.
|
|
19414
19562
|
|
|
19415
19563
|
Other flags:
|
|
19416
|
-
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]
|
|
19564
|
+
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]
|
|
19565
|
+
Signals: omit both to show every Signal. Kinds: fundamentals, macro,
|
|
19566
|
+
technicals, commentary; with only one flag the other keeps its default.
|
|
19417
19567
|
Images: public creation only, at most 20 in display order. Upload selected files
|
|
19418
19568
|
with the existing host upload tool after publication confirmation. Private
|
|
19419
19569
|
images and local/ALFS paths are not supported; this flag does not upload.
|
|
@@ -19454,6 +19604,13 @@ Other flags:
|
|
|
19454
19604
|
archive --id <id> --request-id <uuid> [--note <text>]
|
|
19455
19605
|
star|unstar --id <id>
|
|
19456
19606
|
set-signal-enabled --id <id> --enabled true|false
|
|
19607
|
+
signal-preferences get [--id <id>]
|
|
19608
|
+
Which Signals your Thesis shows to every reader: {thesis_id, preferences:
|
|
19609
|
+
{kinds, min_importance}}. Without --id: the setting you last saved, which
|
|
19610
|
+
prefills a new Thesis. Only the author can read or set it.
|
|
19611
|
+
signal-preferences set --id <id> [--kinds <kind,kind>] [--min-importance all|notable|major]
|
|
19612
|
+
Changes only what is given. Applies to every reader, the Thesis's
|
|
19613
|
+
deliveries and, from its next daily run, its Overview.
|
|
19457
19614
|
|
|
19458
19615
|
Maintenance behavior:
|
|
19459
19616
|
archive reads the current Thesis first, preserves its body, title,
|
|
@@ -20377,6 +20534,22 @@ function thesisImages(flags) {
|
|
|
20377
20534
|
"thesis"
|
|
20378
20535
|
);
|
|
20379
20536
|
}
|
|
20537
|
+
function thesisSignalKindList(raw, flag) {
|
|
20538
|
+
const kinds = raw.split(",").map((kind) => kind.trim());
|
|
20539
|
+
if (kinds.some((kind) => kind === "")) {
|
|
20540
|
+
throw new CliUsageError(`${flag} must not contain empty kinds`, "thesis");
|
|
20541
|
+
}
|
|
20542
|
+
return kinds;
|
|
20543
|
+
}
|
|
20544
|
+
function thesisCreateSignalPreferences(flags) {
|
|
20545
|
+
const kinds = flags["signal-kinds"];
|
|
20546
|
+
const minImportance = flags["signal-min-importance"];
|
|
20547
|
+
if (kinds === void 0 && minImportance === void 0) return void 0;
|
|
20548
|
+
return {
|
|
20549
|
+
kinds: kinds === void 0 ? [...THESIS_SIGNAL_KINDS] : thesisSignalKindList(kinds, "--signal-kinds"),
|
|
20550
|
+
min_importance: minImportance ?? "all"
|
|
20551
|
+
};
|
|
20552
|
+
}
|
|
20380
20553
|
function thesisTrackReturn(flags, command2) {
|
|
20381
20554
|
const raw = flags["track-return"];
|
|
20382
20555
|
if (raw === void 0) return void 0;
|
|
@@ -21076,7 +21249,8 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
21076
21249
|
entity_stances: thesisEntityStances(flags),
|
|
21077
21250
|
tickers: thesisTickers(flags),
|
|
21078
21251
|
visibility: flags.visibility === void 0 ? "public" : thesisCreateVisibility(flags.visibility),
|
|
21079
|
-
track_return: thesisTrackReturn(flags, "thesis create")
|
|
21252
|
+
track_return: thesisTrackReturn(flags, "thesis create"),
|
|
21253
|
+
signal_preferences: thesisCreateSignalPreferences(flags)
|
|
21080
21254
|
});
|
|
21081
21255
|
case "asset-candidates":
|
|
21082
21256
|
return client.theses.assetCandidates(
|
|
@@ -21181,6 +21355,23 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
21181
21355
|
requireFlag(flags, "id", "thesis unstar"),
|
|
21182
21356
|
false
|
|
21183
21357
|
);
|
|
21358
|
+
case "signal-preferences": {
|
|
21359
|
+
if (parsedCommand.path[2] === "get") {
|
|
21360
|
+
return client.theses.getSignalPreferences(flags.id);
|
|
21361
|
+
}
|
|
21362
|
+
const id = requireFlag(flags, "id", "thesis signal-preferences set");
|
|
21363
|
+
if (flags.kinds === void 0 && flags["min-importance"] === void 0) {
|
|
21364
|
+
throw new CliUsageError(
|
|
21365
|
+
"thesis signal-preferences set needs --kinds or --min-importance",
|
|
21366
|
+
"thesis"
|
|
21367
|
+
);
|
|
21368
|
+
}
|
|
21369
|
+
const current = await client.theses.getSignalPreferences(id);
|
|
21370
|
+
return client.theses.setSignalPreferences(id, {
|
|
21371
|
+
kinds: flags.kinds === void 0 ? current.preferences.kinds : thesisSignalKindList(flags.kinds, "--kinds"),
|
|
21372
|
+
min_importance: flags["min-importance"] === void 0 ? current.preferences.min_importance : flags["min-importance"]
|
|
21373
|
+
});
|
|
21374
|
+
}
|
|
21184
21375
|
case "set-signal-enabled":
|
|
21185
21376
|
return client.theses.setSignalEnabled(
|
|
21186
21377
|
requireFlag(flags, "id", "thesis set-signal-enabled"),
|