@alva-ai/toolkit 0.35.0 → 0.36.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 +6 -4
- package/dist/browser.global.js +64 -50
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.d.ts +104 -11
- package/dist/cli.js +241 -114
- package/dist/cli.js.map +1 -1
- package/dist/dispatch.d.ts +104 -11
- package/dist/dispatch.js +102 -72
- package/dist/dispatch.js.map +1 -1
- package/dist/index.cjs +183 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +105 -12
- package/dist/index.d.ts +105 -12
- package/dist/index.js +183 -65
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -11148,6 +11148,91 @@ function nextCursor(page) {
|
|
|
11148
11148
|
throw invalid3();
|
|
11149
11149
|
return info.hasNextPage ? info.endCursor : null;
|
|
11150
11150
|
}
|
|
11151
|
+
var RETURN_QUERY = `query ToolkitThesisReturn($id: ID!, $detail: Boolean!) {
|
|
11152
|
+
node(id: $id) { ... on Playbook { latestRelease { thesisPublication {
|
|
11153
|
+
returnTracking
|
|
11154
|
+
thesisReturn(detail: $detail) {
|
|
11155
|
+
live value firstFillAtMs pricedAtMs stale computedAtMs
|
|
11156
|
+
updates { authorVersionId publishedAtMs startValue updateReturn
|
|
11157
|
+
positions { entityId symbol direction startPrice startAtMs endPrice endAtMs end positionReturn currency } }
|
|
11158
|
+
}
|
|
11159
|
+
} } } }
|
|
11160
|
+
}`;
|
|
11161
|
+
async function thesisReturn(client, id, params = {}) {
|
|
11162
|
+
if (!isPositiveInt64(id))
|
|
11163
|
+
throw argument("id must be an internal positive int64 Playbook ID");
|
|
11164
|
+
if (params.detail !== void 0 && typeof params.detail !== "boolean")
|
|
11165
|
+
throw argument("detail must be a boolean");
|
|
11166
|
+
client._requireAuth();
|
|
11167
|
+
const data = await graphql(client, RETURN_QUERY, {
|
|
11168
|
+
id: `Playbook:${id}`,
|
|
11169
|
+
detail: params.detail ?? false
|
|
11170
|
+
});
|
|
11171
|
+
if (data.node === null) throw notFound();
|
|
11172
|
+
if (!record2(data.node)) throw invalid3();
|
|
11173
|
+
const release = data.node.latestRelease;
|
|
11174
|
+
if (release === null || release === void 0)
|
|
11175
|
+
return { playbookId: id, returnTracking: null, thesisReturn: null };
|
|
11176
|
+
if (!record2(release)) throw invalid3();
|
|
11177
|
+
const publication = release.thesisPublication;
|
|
11178
|
+
if (publication === null)
|
|
11179
|
+
return { playbookId: id, returnTracking: null, thesisReturn: null };
|
|
11180
|
+
if (!record2(publication)) throw invalid3();
|
|
11181
|
+
const tracking = publication.returnTracking;
|
|
11182
|
+
if (tracking !== null && !["UNSET", "ON", "OFF"].includes(tracking))
|
|
11183
|
+
throw invalid3();
|
|
11184
|
+
const value = publication.thesisReturn;
|
|
11185
|
+
if (value !== null && !validThesisReturn(value)) throw invalid3();
|
|
11186
|
+
return {
|
|
11187
|
+
playbookId: id,
|
|
11188
|
+
returnTracking: tracking,
|
|
11189
|
+
thesisReturn: value
|
|
11190
|
+
};
|
|
11191
|
+
}
|
|
11192
|
+
var WATCHPOINTS_QUERY = `query ToolkitThesisWatchpoints($id: ID!) {
|
|
11193
|
+
node(id: $id) { ... on Playbook { latestRelease { thesisPublication {
|
|
11194
|
+
watchpoints { label text origin }
|
|
11195
|
+
} } } }
|
|
11196
|
+
}`;
|
|
11197
|
+
async function thesisWatchpoints(client, id) {
|
|
11198
|
+
if (!isPositiveInt64(id))
|
|
11199
|
+
throw argument("id must be an internal positive int64 Playbook ID");
|
|
11200
|
+
client._requireAuth();
|
|
11201
|
+
const data = await graphql(client, WATCHPOINTS_QUERY, {
|
|
11202
|
+
id: `Playbook:${id}`
|
|
11203
|
+
});
|
|
11204
|
+
if (data.node === null) throw notFound();
|
|
11205
|
+
if (!record2(data.node)) throw invalid3();
|
|
11206
|
+
const release = data.node.latestRelease;
|
|
11207
|
+
if (release === null || release === void 0)
|
|
11208
|
+
return { playbookId: id, watchpoints: [] };
|
|
11209
|
+
if (!record2(release)) throw invalid3();
|
|
11210
|
+
const publication = release.thesisPublication;
|
|
11211
|
+
if (publication === null) return { playbookId: id, watchpoints: [] };
|
|
11212
|
+
if (!record2(publication) || !Array.isArray(publication.watchpoints))
|
|
11213
|
+
throw invalid3();
|
|
11214
|
+
const watchpoints = publication.watchpoints.map((item) => {
|
|
11215
|
+
if (!record2(item) || !nonempty(item.label) || !nonempty(item.text) || !["stated", "inferred", "agent"].includes(item.origin))
|
|
11216
|
+
throw invalid3();
|
|
11217
|
+
return {
|
|
11218
|
+
label: item.label,
|
|
11219
|
+
text: item.text,
|
|
11220
|
+
origin: item.origin
|
|
11221
|
+
};
|
|
11222
|
+
});
|
|
11223
|
+
return { playbookId: id, watchpoints };
|
|
11224
|
+
}
|
|
11225
|
+
function validThesisReturn(value) {
|
|
11226
|
+
if (!record2(value) || typeof value.live !== "boolean" || typeof value.value !== "number" || typeof value.stale !== "boolean" || typeof value.computedAtMs !== "number" || !Array.isArray(value.updates))
|
|
11227
|
+
return false;
|
|
11228
|
+
return value.updates.every(
|
|
11229
|
+
(update) => record2(update) && nonempty(update.authorVersionId) && typeof update.publishedAtMs === "number" && typeof update.startValue === "number" && Array.isArray(update.positions) && update.positions.every(
|
|
11230
|
+
(position) => record2(position) && nonempty(position.symbol) && ["BULLISH", "BEARISH"].includes(position.direction) && ["PENDING", "NEXT_UPDATE", "LATEST"].includes(
|
|
11231
|
+
position.end
|
|
11232
|
+
) && typeof position.positionReturn === "number"
|
|
11233
|
+
)
|
|
11234
|
+
);
|
|
11235
|
+
}
|
|
11151
11236
|
async function graphql(client, document, variables) {
|
|
11152
11237
|
const response = await client._request("POST", "/query", {
|
|
11153
11238
|
body: { query: document, variables }
|
|
@@ -11233,17 +11318,29 @@ var ThesesResource = class {
|
|
|
11233
11318
|
related(id, params = {}) {
|
|
11234
11319
|
return relatedTheses(this.client, id, params);
|
|
11235
11320
|
}
|
|
11236
|
-
async assetCandidates(text) {
|
|
11321
|
+
async assetCandidates(text, params = {}) {
|
|
11237
11322
|
this.client._requireAuth();
|
|
11238
11323
|
const source = requireBody(text);
|
|
11324
|
+
const input = {
|
|
11325
|
+
text: source,
|
|
11326
|
+
selectedEntityIds: requireIDs(params.entityIds ?? [], "entityIds")
|
|
11327
|
+
};
|
|
11328
|
+
if (params.thesisId !== void 0)
|
|
11329
|
+
input.thesisId = requireID(params.thesisId, "thesisId");
|
|
11330
|
+
if (params.discover !== void 0) {
|
|
11331
|
+
if (typeof params.discover !== "boolean")
|
|
11332
|
+
throw invalidArgument("discover must be a boolean");
|
|
11333
|
+
input.discover = params.discover;
|
|
11334
|
+
}
|
|
11239
11335
|
const response = await this.client._request("POST", "/query", {
|
|
11240
11336
|
body: {
|
|
11241
11337
|
query: `query ThesisAssetCandidates($input: ThesisAssetCandidatesInput!) {
|
|
11242
11338
|
viewer { thesisAssetCandidates(input: $input) {
|
|
11243
11339
|
mentions { quote ticker resolution stance candidates { entityId ticker name kind } }
|
|
11340
|
+
returnPreview { tracking askSwitch directions { entityId direction } keptEntityIds lastLegRemoved }
|
|
11244
11341
|
} }
|
|
11245
11342
|
}`,
|
|
11246
|
-
variables: { input
|
|
11343
|
+
variables: { input }
|
|
11247
11344
|
}
|
|
11248
11345
|
});
|
|
11249
11346
|
if (Array.isArray(response?.errors) && response.errors.length > 0) {
|
|
@@ -11281,7 +11378,18 @@ var ThesesResource = class {
|
|
|
11281
11378
|
});
|
|
11282
11379
|
return { ...item, candidates };
|
|
11283
11380
|
});
|
|
11284
|
-
return { mentions };
|
|
11381
|
+
return { mentions, returnPreview: returnPreview(result.returnPreview) };
|
|
11382
|
+
}
|
|
11383
|
+
/** The Thesis return of a Playbook's current publication; detail revalues it. */
|
|
11384
|
+
thesisReturn(id, params = {}) {
|
|
11385
|
+
return thesisReturn(this.client, id, params);
|
|
11386
|
+
}
|
|
11387
|
+
/**
|
|
11388
|
+
* List every watchpoint of a Thesis (its current set, in number order): the
|
|
11389
|
+
* things the Thesis depends on, or that would show it right or wrong.
|
|
11390
|
+
*/
|
|
11391
|
+
watchpoints(id) {
|
|
11392
|
+
return thesisWatchpoints(this.client, id);
|
|
11285
11393
|
}
|
|
11286
11394
|
async create(params) {
|
|
11287
11395
|
this.client._requireAuth();
|
|
@@ -11343,30 +11451,6 @@ var ThesesResource = class {
|
|
|
11343
11451
|
throw invalidResponse4("Update list must match requested Thesis");
|
|
11344
11452
|
return { versions, next_cursor: response.next_cursor };
|
|
11345
11453
|
}
|
|
11346
|
-
/** Deletes only the selected Update; never falls back to whole-Thesis deletion. */
|
|
11347
|
-
async deleteUpdate(id, authorVersionID, expectedAuthorVersionID) {
|
|
11348
|
-
this.client._requireAuth();
|
|
11349
|
-
const thesisID = requireID(id, "id");
|
|
11350
|
-
const versionID = requireID(authorVersionID, "author_version_id");
|
|
11351
|
-
const expected = requireID(
|
|
11352
|
-
expectedAuthorVersionID,
|
|
11353
|
-
"expected_author_version_id"
|
|
11354
|
-
);
|
|
11355
|
-
const response = thesisResponse(
|
|
11356
|
-
await this.client._request(
|
|
11357
|
-
"DELETE",
|
|
11358
|
-
`/api/v1/theses/${thesisID}/versions/${versionID}`,
|
|
11359
|
-
{
|
|
11360
|
-
query: { expected_author_version_id: expected }
|
|
11361
|
-
}
|
|
11362
|
-
)
|
|
11363
|
-
);
|
|
11364
|
-
if (response.thesis.id !== thesisID)
|
|
11365
|
-
throw invalidResponse4(
|
|
11366
|
-
"delete Update response must match requested Thesis"
|
|
11367
|
-
);
|
|
11368
|
-
return response;
|
|
11369
|
-
}
|
|
11370
11454
|
async signals(id, params = {}) {
|
|
11371
11455
|
this.client._requireAuth();
|
|
11372
11456
|
const first = params.first ?? 20;
|
|
@@ -11542,35 +11626,6 @@ var ThesesResource = class {
|
|
|
11542
11626
|
}
|
|
11543
11627
|
return response;
|
|
11544
11628
|
}
|
|
11545
|
-
async close(id, params) {
|
|
11546
|
-
this.client._requireAuth();
|
|
11547
|
-
const body = {
|
|
11548
|
-
expected_author_version_id: requireID(
|
|
11549
|
-
params.expected_author_version_id,
|
|
11550
|
-
"expected_author_version_id"
|
|
11551
|
-
)
|
|
11552
|
-
};
|
|
11553
|
-
if (params.note !== void 0) body.note = requireText2(params.note, "note");
|
|
11554
|
-
return thesisResponse(
|
|
11555
|
-
await this.client._request(
|
|
11556
|
-
"POST",
|
|
11557
|
-
`/api/v1/theses/${requireID(id, "id")}/close`,
|
|
11558
|
-
{ body }
|
|
11559
|
-
)
|
|
11560
|
-
);
|
|
11561
|
-
}
|
|
11562
|
-
async delete(id) {
|
|
11563
|
-
this.client._requireAuth();
|
|
11564
|
-
const response = await this.client._request(
|
|
11565
|
-
"DELETE",
|
|
11566
|
-
`/api/v1/theses/${requireID(id, "id")}`
|
|
11567
|
-
);
|
|
11568
|
-
if (response === void 0) return {};
|
|
11569
|
-
if (!isRecord2(response) || Object.keys(response).length !== 0) {
|
|
11570
|
-
throw invalidResponse4("delete response must be {}");
|
|
11571
|
-
}
|
|
11572
|
-
return {};
|
|
11573
|
-
}
|
|
11574
11629
|
async rewrite(params) {
|
|
11575
11630
|
this.client._requireAuth();
|
|
11576
11631
|
const body = requireBody(params.body);
|
|
@@ -11613,6 +11668,8 @@ function createBody(params) {
|
|
|
11613
11668
|
}
|
|
11614
11669
|
if (params.tickers !== void 0)
|
|
11615
11670
|
body.tickers = requireTickers(params.tickers);
|
|
11671
|
+
if (params.track_return !== void 0)
|
|
11672
|
+
body.track_return = requireTrackReturn(params.track_return);
|
|
11616
11673
|
if (params.entity_stances !== void 0) {
|
|
11617
11674
|
body.entity_stances = requireEntityStances(
|
|
11618
11675
|
params.entity_stances,
|
|
@@ -11621,6 +11678,52 @@ function createBody(params) {
|
|
|
11621
11678
|
}
|
|
11622
11679
|
return body;
|
|
11623
11680
|
}
|
|
11681
|
+
var ENTITY_STANCES = [
|
|
11682
|
+
"unknown",
|
|
11683
|
+
"bullish",
|
|
11684
|
+
"bearish",
|
|
11685
|
+
"none"
|
|
11686
|
+
];
|
|
11687
|
+
var THESIS_DIRECTIONS = [
|
|
11688
|
+
"UNKNOWN",
|
|
11689
|
+
"BULLISH",
|
|
11690
|
+
"BEARISH",
|
|
11691
|
+
"NONE"
|
|
11692
|
+
];
|
|
11693
|
+
var RETURN_TRACKING = ["UNSET", "ON", "OFF"];
|
|
11694
|
+
function requireTrackReturn(value) {
|
|
11695
|
+
if (typeof value !== "boolean")
|
|
11696
|
+
throw invalidArgument("track_return must be a boolean");
|
|
11697
|
+
return value;
|
|
11698
|
+
}
|
|
11699
|
+
function selectedDirections(value, field) {
|
|
11700
|
+
if (!Array.isArray(value)) throw invalidResponse4(`${field} must be an array`);
|
|
11701
|
+
return value.map((item, index) => {
|
|
11702
|
+
if (!isRecord2(item) || !THESIS_DIRECTIONS.includes(item.direction))
|
|
11703
|
+
throw invalidResponse4(`${field}[${index}] is invalid`);
|
|
11704
|
+
return {
|
|
11705
|
+
entityId: responseID(item.entityId, `${field}[${index}].entityId`),
|
|
11706
|
+
direction: item.direction
|
|
11707
|
+
};
|
|
11708
|
+
});
|
|
11709
|
+
}
|
|
11710
|
+
function returnPreview(value) {
|
|
11711
|
+
if (value === null || value === void 0) return null;
|
|
11712
|
+
if (!isRecord2(value) || !RETURN_TRACKING.includes(value.tracking) || typeof value.askSwitch !== "boolean" || typeof value.lastLegRemoved !== "boolean" || !Array.isArray(value.keptEntityIds))
|
|
11713
|
+
throw invalidResponse4("returnPreview is invalid");
|
|
11714
|
+
return {
|
|
11715
|
+
tracking: value.tracking,
|
|
11716
|
+
askSwitch: value.askSwitch,
|
|
11717
|
+
directions: selectedDirections(
|
|
11718
|
+
value.directions,
|
|
11719
|
+
"returnPreview.directions"
|
|
11720
|
+
),
|
|
11721
|
+
keptEntityIds: value.keptEntityIds.map(
|
|
11722
|
+
(id, index) => responseID(id, `returnPreview.keptEntityIds[${index}]`)
|
|
11723
|
+
),
|
|
11724
|
+
lastLegRemoved: value.lastLegRemoved
|
|
11725
|
+
};
|
|
11726
|
+
}
|
|
11624
11727
|
function requireEntityStances(value, entityIDs) {
|
|
11625
11728
|
if (!Array.isArray(value) || value.length > MAX_ENTITY_IDS)
|
|
11626
11729
|
throw invalidArgument("entity_stances must contain at most 100 values");
|
|
@@ -11638,7 +11741,7 @@ function requireEntityStances(value, entityIDs) {
|
|
|
11638
11741
|
"entity stance must reference one unique entity_id"
|
|
11639
11742
|
);
|
|
11640
11743
|
seen.add(entityID);
|
|
11641
|
-
if (!
|
|
11744
|
+
if (!ENTITY_STANCES.includes(item.stance))
|
|
11642
11745
|
throw invalidArgument(`entity_stances[${index}].stance is invalid`);
|
|
11643
11746
|
return { entity_id: entityID, stance: item.stance };
|
|
11644
11747
|
});
|
|
@@ -11653,8 +11756,7 @@ function updateBody(params) {
|
|
|
11653
11756
|
body: requireBody(params.body),
|
|
11654
11757
|
title: requireTitle(params.title ?? ""),
|
|
11655
11758
|
entity_ids: requireIDs(params.entity_ids ?? [], "entity_ids"),
|
|
11656
|
-
visibility: requireVisibility(params.visibility)
|
|
11657
|
-
editorial: params.editorial ?? false
|
|
11759
|
+
visibility: requireVisibility(params.visibility)
|
|
11658
11760
|
};
|
|
11659
11761
|
if (params.medias !== void 0) {
|
|
11660
11762
|
if (!Array.isArray(params.medias) || params.medias.length > 20)
|
|
@@ -11669,6 +11771,8 @@ function updateBody(params) {
|
|
|
11669
11771
|
body.archived = params.archived;
|
|
11670
11772
|
}
|
|
11671
11773
|
if (params.note !== void 0) body.note = requireText2(params.note, "note");
|
|
11774
|
+
if (params.track_return !== void 0)
|
|
11775
|
+
body.track_return = requireTrackReturn(params.track_return);
|
|
11672
11776
|
if (params.entity_stances !== void 0) {
|
|
11673
11777
|
body.entity_stances = requireEntityStances(
|
|
11674
11778
|
params.entity_stances,
|
|
@@ -11731,9 +11835,20 @@ function thesisResponse(response) {
|
|
|
11731
11835
|
const entityID = responseID(item.entity_id, "entity_stances.entity_id");
|
|
11732
11836
|
if (!value.entity_ids.includes(entityID))
|
|
11733
11837
|
throw invalidResponse4("entity stance must reference a thesis entity");
|
|
11734
|
-
if (!
|
|
11838
|
+
if (!ENTITY_STANCES.includes(item.stance))
|
|
11735
11839
|
throw invalidResponse4("thesis.entity_stances contains invalid stance");
|
|
11736
|
-
|
|
11840
|
+
const stance = {
|
|
11841
|
+
entity_id: entityID,
|
|
11842
|
+
stance: item.stance
|
|
11843
|
+
};
|
|
11844
|
+
if (item.direction !== void 0) {
|
|
11845
|
+
if (!ENTITY_STANCES.includes(item.direction))
|
|
11846
|
+
throw invalidResponse4(
|
|
11847
|
+
"thesis.entity_stances contains invalid direction"
|
|
11848
|
+
);
|
|
11849
|
+
stance.direction = item.direction;
|
|
11850
|
+
}
|
|
11851
|
+
return stance;
|
|
11737
11852
|
});
|
|
11738
11853
|
}
|
|
11739
11854
|
return { thesis: value };
|
|
@@ -12584,7 +12699,8 @@ var AlvaClient = class {
|
|
|
12584
12699
|
throw new AlvaError(
|
|
12585
12700
|
data.error.code ?? "UNKNOWN",
|
|
12586
12701
|
data.error.message ?? `HTTP ${response.status}`,
|
|
12587
|
-
response.status
|
|
12702
|
+
response.status,
|
|
12703
|
+
data.details
|
|
12588
12704
|
);
|
|
12589
12705
|
}
|
|
12590
12706
|
} catch (e) {
|
|
@@ -12906,11 +13022,17 @@ var COMMAND_DEFINITIONS = [
|
|
|
12906
13022
|
"entity-ids",
|
|
12907
13023
|
"entity-stances",
|
|
12908
13024
|
"tickers",
|
|
12909
|
-
"visibility"
|
|
13025
|
+
"visibility",
|
|
13026
|
+
"track-return"
|
|
12910
13027
|
],
|
|
12911
13028
|
booleans: ["body-stdin"]
|
|
12912
13029
|
}),
|
|
12913
|
-
command("thesis asset-candidates", {
|
|
13030
|
+
command("thesis asset-candidates", {
|
|
13031
|
+
values: ["text", "entity-ids", "thesis-id"],
|
|
13032
|
+
booleans: ["no-discovery"]
|
|
13033
|
+
}),
|
|
13034
|
+
command("thesis return", { values: ["id"], booleans: ["detail"] }),
|
|
13035
|
+
command("thesis watchpoints", { values: ["id"] }),
|
|
12914
13036
|
command("thesis list", {
|
|
12915
13037
|
values: [
|
|
12916
13038
|
"person",
|
|
@@ -12926,9 +13048,6 @@ var COMMAND_DEFINITIONS = [
|
|
|
12926
13048
|
command("thesis related", { values: ["id", "first", "cursor"] }),
|
|
12927
13049
|
command("thesis get", { values: ["id"] }),
|
|
12928
13050
|
command("thesis version list", { values: ["id", "first", "cursor"] }),
|
|
12929
|
-
command("thesis version delete", {
|
|
12930
|
-
values: ["id", "author-version-id", "expected-author-version-id"]
|
|
12931
|
-
}),
|
|
12932
13051
|
command("thesis version get", {
|
|
12933
13052
|
values: ["id", "author-version-id"]
|
|
12934
13053
|
}),
|
|
@@ -12950,14 +13069,11 @@ var COMMAND_DEFINITIONS = [
|
|
|
12950
13069
|
"entity-ids",
|
|
12951
13070
|
"entity-stances",
|
|
12952
13071
|
"medias",
|
|
12953
|
-
"visibility"
|
|
13072
|
+
"visibility",
|
|
13073
|
+
"track-return"
|
|
12954
13074
|
],
|
|
12955
|
-
booleans: ["body-stdin"
|
|
12956
|
-
}),
|
|
12957
|
-
command("thesis close", {
|
|
12958
|
-
values: ["id", "expected-author-version-id", "note"]
|
|
13075
|
+
booleans: ["body-stdin"]
|
|
12959
13076
|
}),
|
|
12960
|
-
command("thesis delete", { values: ["id"] }),
|
|
12961
13077
|
command("thesis rewrite", {
|
|
12962
13078
|
values: ["body", "body-file", "mode"],
|
|
12963
13079
|
booleans: ["body-stdin"]
|
|
@@ -17644,7 +17760,7 @@ function formatTradingPairResolved(result) {
|
|
|
17644
17760
|
}
|
|
17645
17761
|
|
|
17646
17762
|
// src/cli/dispatch.ts
|
|
17647
|
-
var CLI_VERSION = true ? "0.
|
|
17763
|
+
var CLI_VERSION = true ? "0.36.0" : "dev";
|
|
17648
17764
|
var DEFAULT_RUN_TIMEOUT_MS = 6e5;
|
|
17649
17765
|
var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
|
|
17650
17766
|
var GLOBAL_VALUE_FLAGS = Object.entries(GLOBAL_FLAG_DEFINITIONS).filter(([, kind]) => kind === "value").map(([name]) => `--${name}`);
|
|
@@ -19118,7 +19234,7 @@ Examples:
|
|
|
19118
19234
|
alva arrays token status`,
|
|
19119
19235
|
thesis: `Usage: alva thesis <subcommand> [options]
|
|
19120
19236
|
|
|
19121
|
-
Create, read, inspect Signals and exact author versions,
|
|
19237
|
+
Create, read, inspect Signals and exact author versions, publish Updates to, or explicitly rewrite an authored thesis.
|
|
19122
19238
|
Backend owns Signal/Alert setup; the CLI never starts them separately.
|
|
19123
19239
|
Create and update never rewrite text automatically.
|
|
19124
19240
|
|
|
@@ -19129,17 +19245,15 @@ Subcommands:
|
|
|
19129
19245
|
get Get one thesis
|
|
19130
19246
|
version get Get one exact author version
|
|
19131
19247
|
version list List visible Updates with editorial revisions folded together
|
|
19132
|
-
version delete Delete one Update; restore prior content if it is current
|
|
19133
19248
|
signals Read published Signal history
|
|
19249
|
+
watchpoints List a Thesis's current watchpoints
|
|
19134
19250
|
set-visibility Change current access without publishing a version
|
|
19135
19251
|
archive Archive the current author version
|
|
19136
19252
|
restore Restore an archived Thesis
|
|
19137
19253
|
star Add the Thesis to your bookmarks
|
|
19138
19254
|
unstar Remove the Thesis from your bookmarks
|
|
19139
19255
|
set-signal-enabled Enable or disable managed Signal research
|
|
19140
|
-
update
|
|
19141
|
-
close Close the current author version with an optional note
|
|
19142
|
-
delete Delete a thesis
|
|
19256
|
+
update Publish a new Update replacing body, title, entities, visibility (all sent in full)
|
|
19143
19257
|
rewrite Explicitly request a candidate body rewrite; never called by another command
|
|
19144
19258
|
|
|
19145
19259
|
Body input (create, update, rewrite): choose exactly one:
|
|
@@ -19154,7 +19268,7 @@ the backend; do not send a fresh ID. Create defaults --visibility to public.
|
|
|
19154
19268
|
Update requires --visibility explicitly so it cannot inadvertently publish.
|
|
19155
19269
|
|
|
19156
19270
|
Other flags:
|
|
19157
|
-
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>]
|
|
19271
|
+
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]
|
|
19158
19272
|
Images: public creation only, at most 20 in display order. Upload selected files
|
|
19159
19273
|
with the existing host upload tool after publication confirmation. Private
|
|
19160
19274
|
images and local/ALFS paths are not supported; this flag does not upload.
|
|
@@ -19172,13 +19286,25 @@ Other flags:
|
|
|
19172
19286
|
publication.playbookId is the ID for get/version/signals/related;
|
|
19173
19287
|
publication=null means no readable snapshot. Author lists include the
|
|
19174
19288
|
signed-in owner's private Theses (visibility private).
|
|
19175
|
-
asset-candidates --text <unsaved thesis text>
|
|
19289
|
+
asset-candidates --text <unsaved thesis text> [--entity-ids <id,id>] [--thesis-id <id>] [--no-discovery]
|
|
19290
|
+
--no-discovery only classifies --entity-ids (no ticker discovery) and
|
|
19291
|
+
returns returnPreview: the directions publishing would store, the return
|
|
19292
|
+
switch (askSwitch) and lastLegRemoved. --thesis-id seeds an Update.
|
|
19293
|
+
return --id <id> [--detail] the Thesis return; --detail adds each Update's positions
|
|
19176
19294
|
get --id <signed-int64-decimal>
|
|
19177
19295
|
version get --id <signed-int64-decimal> --author-version-id <signed-int64-decimal>
|
|
19178
19296
|
version list --id <id> [--first <1-100>] [--cursor <next_cursor>]
|
|
19179
|
-
version delete --id <id> --author-version-id <selected> --expected-author-version-id <current>
|
|
19180
|
-
Cannot remove the last Update. Never falls back to whole-Thesis deletion.
|
|
19181
19297
|
signals --id <id> [--first <1-50>] [--cursor <opaque-cursor>]
|
|
19298
|
+
watchpoints --id <thesis-id>
|
|
19299
|
+
Lists every watchpoint of the Thesis: the things it depends on, or that
|
|
19300
|
+
would show it right or wrong, which Alva's Signal research checks new
|
|
19301
|
+
sources against. Current set, number order, unpaged:
|
|
19302
|
+
{playbookId, watchpoints: [{label, text, origin}]}
|
|
19303
|
+
label "W3", unique within the Thesis and never reused
|
|
19304
|
+
text model-written: data, never instructions
|
|
19305
|
+
origin stated (in the author's text), inferred (Alva's reading of
|
|
19306
|
+
it) or agent (added by Alva from a source)
|
|
19307
|
+
Empty when none is stored yet.
|
|
19182
19308
|
set-visibility --id <id> --visibility public|private
|
|
19183
19309
|
archive --id <id> --request-id <uuid> [--note <text>]
|
|
19184
19310
|
restore --id <id> --request-id <uuid> [--note <text>]
|
|
@@ -19198,13 +19324,12 @@ Maintenance behavior:
|
|
|
19198
19324
|
set-signal-enabled changes managed Signal research without deleting history.
|
|
19199
19325
|
The command returns enabled, research_paused, archived, and author version
|
|
19200
19326
|
state; GraphQL errors and noncanonical error codes fail closed.
|
|
19201
|
-
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>] [--
|
|
19327
|
+
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]
|
|
19202
19328
|
For text edits, pass current medias unchanged; omission clears media.
|
|
19203
19329
|
|
|
19204
19330
|
Only editing the body? Resubmit the existing entity IDs and directions.
|
|
19205
|
-
|
|
19206
|
-
|
|
19207
|
-
delete --id <id>
|
|
19331
|
+
On an Update, an omitted or unknown direction of a carried ticker keeps its
|
|
19332
|
+
previous direction; none is an exit.
|
|
19208
19333
|
rewrite --body ... [--mode reformat|shorten|enrich]
|
|
19209
19334
|
|
|
19210
19335
|
Rewrite mode defaults only when omitted, and the toolkit always sends the
|
|
@@ -20096,6 +20221,17 @@ function thesisImages(flags) {
|
|
|
20096
20221
|
"thesis"
|
|
20097
20222
|
);
|
|
20098
20223
|
}
|
|
20224
|
+
function thesisTrackReturn(flags, command2) {
|
|
20225
|
+
const raw = flags["track-return"];
|
|
20226
|
+
if (raw === void 0) return void 0;
|
|
20227
|
+
const parsed = boolFlag(raw);
|
|
20228
|
+
if (parsed === void 0)
|
|
20229
|
+
throw new CliUsageError(
|
|
20230
|
+
`--track-return must be true or false for ${command2}`,
|
|
20231
|
+
"thesis"
|
|
20232
|
+
);
|
|
20233
|
+
return parsed;
|
|
20234
|
+
}
|
|
20099
20235
|
function thesisEntityStances(flags) {
|
|
20100
20236
|
const raw = flags["entity-stances"];
|
|
20101
20237
|
if (raw === void 0) return void 0;
|
|
@@ -20774,11 +20910,26 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
20774
20910
|
entity_ids: thesisEntityIDs(flags),
|
|
20775
20911
|
entity_stances: thesisEntityStances(flags),
|
|
20776
20912
|
tickers: thesisTickers(flags),
|
|
20777
|
-
visibility: flags.visibility === void 0 ? "public" : thesisCreateVisibility(flags.visibility)
|
|
20913
|
+
visibility: flags.visibility === void 0 ? "public" : thesisCreateVisibility(flags.visibility),
|
|
20914
|
+
track_return: thesisTrackReturn(flags, "thesis create")
|
|
20778
20915
|
});
|
|
20779
20916
|
case "asset-candidates":
|
|
20780
20917
|
return client.theses.assetCandidates(
|
|
20781
|
-
requireFlag(flags, "text", "thesis asset-candidates")
|
|
20918
|
+
requireFlag(flags, "text", "thesis asset-candidates"),
|
|
20919
|
+
{
|
|
20920
|
+
entityIds: thesisEntityIDs(flags),
|
|
20921
|
+
thesisId: flags["thesis-id"],
|
|
20922
|
+
discover: boolFlag(flags["no-discovery"]) !== true
|
|
20923
|
+
}
|
|
20924
|
+
);
|
|
20925
|
+
case "return":
|
|
20926
|
+
return client.theses.thesisReturn(
|
|
20927
|
+
requireFlag(flags, "id", "thesis return"),
|
|
20928
|
+
{ detail: boolFlag(flags.detail) === true }
|
|
20929
|
+
);
|
|
20930
|
+
case "watchpoints":
|
|
20931
|
+
return client.theses.watchpoints(
|
|
20932
|
+
requireFlag(flags, "id", "thesis watchpoints")
|
|
20782
20933
|
);
|
|
20783
20934
|
case "list": {
|
|
20784
20935
|
const params = {
|
|
@@ -20825,17 +20976,6 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
20825
20976
|
}
|
|
20826
20977
|
);
|
|
20827
20978
|
}
|
|
20828
|
-
if (parsedCommand.path[2] === "delete") {
|
|
20829
|
-
return client.theses.deleteUpdate(
|
|
20830
|
-
requireFlag(flags, "id", "thesis version delete"),
|
|
20831
|
-
requireFlag(flags, "author-version-id", "thesis version delete"),
|
|
20832
|
-
requireFlag(
|
|
20833
|
-
flags,
|
|
20834
|
-
"expected-author-version-id",
|
|
20835
|
-
"thesis version delete"
|
|
20836
|
-
)
|
|
20837
|
-
);
|
|
20838
|
-
}
|
|
20839
20979
|
return client.theses.getVersion(
|
|
20840
20980
|
requireFlag(flags, "id", "thesis version get"),
|
|
20841
20981
|
requireFlag(flags, "author-version-id", "thesis version get")
|
|
@@ -20908,22 +21048,9 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
20908
21048
|
visibility: thesisVisibility(
|
|
20909
21049
|
requireFlag(flags, "visibility", "thesis update")
|
|
20910
21050
|
),
|
|
20911
|
-
|
|
21051
|
+
track_return: thesisTrackReturn(flags, "thesis update")
|
|
20912
21052
|
}
|
|
20913
21053
|
);
|
|
20914
|
-
case "close":
|
|
20915
|
-
return client.theses.close(requireFlag(flags, "id", "thesis close"), {
|
|
20916
|
-
expected_author_version_id: requireFlag(
|
|
20917
|
-
flags,
|
|
20918
|
-
"expected-author-version-id",
|
|
20919
|
-
"thesis close"
|
|
20920
|
-
),
|
|
20921
|
-
note: flags.note
|
|
20922
|
-
});
|
|
20923
|
-
case "delete":
|
|
20924
|
-
return client.theses.delete(
|
|
20925
|
-
requireFlag(flags, "id", "thesis delete")
|
|
20926
|
-
);
|
|
20927
21054
|
case "rewrite":
|
|
20928
21055
|
return client.theses.rewrite({
|
|
20929
21056
|
body: await thesisBodyFromFlags(flags, "thesis rewrite", deps),
|