@alva-ai/toolkit 0.28.1-beta.1 → 0.31.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 +14 -3
- package/dist/browser.global.js +63 -24
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.d.ts +183 -1
- package/dist/cli.js +557 -45
- package/dist/cli.js.map +1 -1
- package/dist/dispatch.d.ts +183 -1
- package/dist/dispatch.js +211 -21
- package/dist/dispatch.js.map +1 -1
- package/dist/index.cjs +443 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +184 -2
- package/dist/index.d.ts +184 -2
- package/dist/index.js +443 -32
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6521,7 +6521,8 @@ var ReleaseResource = class {
|
|
|
6521
6521
|
version: params.version,
|
|
6522
6522
|
feeds: params.feeds,
|
|
6523
6523
|
changelog: params.changelog,
|
|
6524
|
-
readme_url: params.readme_url
|
|
6524
|
+
readme_url: params.readme_url,
|
|
6525
|
+
confirm_bundled_feed_exposure: params.confirm_bundled_feed_exposure
|
|
6525
6526
|
}
|
|
6526
6527
|
});
|
|
6527
6528
|
}
|
|
@@ -6706,6 +6707,166 @@ function connection(value) {
|
|
|
6706
6707
|
return invalidResponse();
|
|
6707
6708
|
return value;
|
|
6708
6709
|
}
|
|
6710
|
+
var THESIS_RECOMMENDATION_QUERY = `
|
|
6711
|
+
query ToolkitForYouTheses($input: ThesisRecommendationInput) {
|
|
6712
|
+
viewer {
|
|
6713
|
+
thesisRecommendations(input: $input) {
|
|
6714
|
+
listId pageCursor nextCursor exhausted scanLimited
|
|
6715
|
+
pageInfo { startCursor endCursor hasNextPage hasPreviousPage }
|
|
6716
|
+
edges {
|
|
6717
|
+
cursor
|
|
6718
|
+
node {
|
|
6719
|
+
itemKey
|
|
6720
|
+
publication {
|
|
6721
|
+
thesisId playbookId authorVersionId materialVersionId itemKey
|
|
6722
|
+
title body publishedAtMs changeKind visibility
|
|
6723
|
+
closed archived note closingNote researchPaused
|
|
6724
|
+
entityIds categoryIds
|
|
6725
|
+
entityStances { entityId stance }
|
|
6726
|
+
entities { id ticker name }
|
|
6727
|
+
publisher {
|
|
6728
|
+
id displayName avatarUrl bio followersCount
|
|
6729
|
+
viewerState { following }
|
|
6730
|
+
}
|
|
6731
|
+
medias { type coverUrl url }
|
|
6732
|
+
signalFeed { id }
|
|
6733
|
+
snapshotRelease {
|
|
6734
|
+
versionId materialVersionId publishedAtMs changeKind
|
|
6735
|
+
sourceRefs {
|
|
6736
|
+
title sourceKind sourceContentId publicUrl sourceTimeMs locator
|
|
6737
|
+
}
|
|
6738
|
+
}
|
|
6739
|
+
}
|
|
6740
|
+
}
|
|
6741
|
+
}
|
|
6742
|
+
}
|
|
6743
|
+
}
|
|
6744
|
+
}
|
|
6745
|
+
`.trim();
|
|
6746
|
+
function validateForYouThesesParams(params) {
|
|
6747
|
+
if (!record(params)) throw new Error("Thesis parameters must be an object");
|
|
6748
|
+
const first = params.first === void 0 ? 10 : params.first;
|
|
6749
|
+
if (typeof first !== "number" || !Number.isInteger(first) || first < 1 || first > 10) {
|
|
6750
|
+
throw new Error("first must be an integer between 1 and 10");
|
|
6751
|
+
}
|
|
6752
|
+
if (params.after !== void 0 && (typeof params.after !== "string" || !params.after.trim())) {
|
|
6753
|
+
throw new Error("after must be a non-empty cursor");
|
|
6754
|
+
}
|
|
6755
|
+
}
|
|
6756
|
+
function graphqlViewerField(response, field) {
|
|
6757
|
+
if (!record(response)) {
|
|
6758
|
+
throw new AlvaError(
|
|
6759
|
+
"GRAPHQL_INVALID_RESPONSE",
|
|
6760
|
+
`GraphQL returned an invalid viewer.${field} response`,
|
|
6761
|
+
502
|
|
6762
|
+
);
|
|
6763
|
+
}
|
|
6764
|
+
if (response.errors !== void 0) {
|
|
6765
|
+
if (!Array.isArray(response.errors)) {
|
|
6766
|
+
throw new AlvaError(
|
|
6767
|
+
"GRAPHQL_INVALID_RESPONSE",
|
|
6768
|
+
`GraphQL returned an invalid viewer.${field} response`,
|
|
6769
|
+
502
|
|
6770
|
+
);
|
|
6771
|
+
}
|
|
6772
|
+
if (response.errors.length > 0) {
|
|
6773
|
+
const messages = response.errors.flatMap(
|
|
6774
|
+
(error) => record(error) && typeof error.message === "string" ? [error.message] : []
|
|
6775
|
+
);
|
|
6776
|
+
throw new AlvaError(
|
|
6777
|
+
"GRAPHQL_ERROR",
|
|
6778
|
+
messages.join("; ") || "GraphQL request failed",
|
|
6779
|
+
400,
|
|
6780
|
+
{ errors: response.errors }
|
|
6781
|
+
);
|
|
6782
|
+
}
|
|
6783
|
+
}
|
|
6784
|
+
if (!record(response.data) || !record(response.data.viewer) || response.data.viewer[field] == null) {
|
|
6785
|
+
throw new AlvaError(
|
|
6786
|
+
"GRAPHQL_EMPTY_RESPONSE",
|
|
6787
|
+
`GraphQL response did not include viewer.${field}`,
|
|
6788
|
+
502
|
|
6789
|
+
);
|
|
6790
|
+
}
|
|
6791
|
+
return response.data.viewer[field];
|
|
6792
|
+
}
|
|
6793
|
+
function invalidPage() {
|
|
6794
|
+
throw new AlvaError(
|
|
6795
|
+
"GRAPHQL_INVALID_RESPONSE",
|
|
6796
|
+
"GraphQL returned an invalid Thesis recommendation page",
|
|
6797
|
+
502
|
|
6798
|
+
);
|
|
6799
|
+
}
|
|
6800
|
+
function positiveInt64List(value) {
|
|
6801
|
+
return Array.isArray(value) && value.every(isPositiveInt64);
|
|
6802
|
+
}
|
|
6803
|
+
function stanceList(value) {
|
|
6804
|
+
return Array.isArray(value) && value.every(
|
|
6805
|
+
(item) => record(item) && isPositiveInt64(item.entityId) && typeof item.stance === "string" && item.stance.trim() !== ""
|
|
6806
|
+
);
|
|
6807
|
+
}
|
|
6808
|
+
function entityList(value) {
|
|
6809
|
+
return Array.isArray(value) && value.every(
|
|
6810
|
+
(item) => record(item) && typeof item.id === "string" && item.id.trim() !== "" && typeof item.ticker === "string" && typeof item.name === "string"
|
|
6811
|
+
);
|
|
6812
|
+
}
|
|
6813
|
+
function mediaList(value) {
|
|
6814
|
+
return Array.isArray(value) && value.every(
|
|
6815
|
+
(item) => record(item) && typeof item.type === "string" && item.type.trim() !== "" && typeof item.coverUrl === "string" && (item.url === null || typeof item.url === "string")
|
|
6816
|
+
);
|
|
6817
|
+
}
|
|
6818
|
+
function sourceRefList(value) {
|
|
6819
|
+
return Array.isArray(value) && value.every(
|
|
6820
|
+
(item) => record(item) && (item.title === null || typeof item.title === "string") && typeof item.sourceKind === "string" && typeof item.sourceContentId === "string" && typeof item.publicUrl === "string" && nullableMs(item.sourceTimeMs) && typeof item.locator === "string"
|
|
6821
|
+
);
|
|
6822
|
+
}
|
|
6823
|
+
function nullableMs(value) {
|
|
6824
|
+
return value === null || typeof value === "number" && Number.isFinite(value);
|
|
6825
|
+
}
|
|
6826
|
+
function snapshot(value) {
|
|
6827
|
+
return record(value) && isPositiveInt64(value.versionId) && isPositiveInt64(value.materialVersionId) && typeof value.publishedAtMs === "number" && Number.isFinite(value.publishedAtMs) && typeof value.changeKind === "string" && value.changeKind.trim() !== "" && sourceRefList(value.sourceRefs);
|
|
6828
|
+
}
|
|
6829
|
+
function publisher(value) {
|
|
6830
|
+
return record(value) && typeof value.id === "string" && value.id.trim() !== "" && typeof value.displayName === "string" && typeof value.avatarUrl === "string" && typeof value.bio === "string" && typeof value.followersCount === "number" && Number.isInteger(value.followersCount) && record(value.viewerState) && (value.viewerState.following === null || typeof value.viewerState.following === "boolean");
|
|
6831
|
+
}
|
|
6832
|
+
function publication(value) {
|
|
6833
|
+
if (!record(value)) return false;
|
|
6834
|
+
for (const field of [
|
|
6835
|
+
"thesisId",
|
|
6836
|
+
"playbookId",
|
|
6837
|
+
"authorVersionId",
|
|
6838
|
+
"materialVersionId"
|
|
6839
|
+
]) {
|
|
6840
|
+
if (!isPositiveInt64(value[field])) return false;
|
|
6841
|
+
}
|
|
6842
|
+
if (typeof value.itemKey !== "string" || !value.itemKey.trim() || typeof value.title !== "string" || typeof value.body !== "string" || typeof value.publishedAtMs !== "number" || !Number.isFinite(value.publishedAtMs) || typeof value.changeKind !== "string" || !value.changeKind.trim() || typeof value.visibility !== "string" || typeof value.note !== "string" || typeof value.closingNote !== "string") {
|
|
6843
|
+
return false;
|
|
6844
|
+
}
|
|
6845
|
+
for (const field of ["closed", "archived", "researchPaused"]) {
|
|
6846
|
+
if (typeof value[field] !== "boolean") return false;
|
|
6847
|
+
}
|
|
6848
|
+
if (!positiveInt64List(value.entityIds) || !positiveInt64List(value.categoryIds) || !stanceList(value.entityStances) || !entityList(value.entities) || !mediaList(value.medias) || !publisher(value.publisher) || !snapshot(value.snapshotRelease)) {
|
|
6849
|
+
return false;
|
|
6850
|
+
}
|
|
6851
|
+
return value.signalFeed === null || record(value.signalFeed) && isPositiveInt64(value.signalFeed.id);
|
|
6852
|
+
}
|
|
6853
|
+
function recommendationPage(value) {
|
|
6854
|
+
if (!record(value) || !Array.isArray(value.edges) || !record(value.pageInfo) || typeof value.listId !== "string" || typeof value.pageCursor !== "string" || typeof value.exhausted !== "boolean" || typeof value.scanLimited !== "boolean" || value.nextCursor !== null && typeof value.nextCursor !== "string") {
|
|
6855
|
+
return invalidPage();
|
|
6856
|
+
}
|
|
6857
|
+
const page = value.pageInfo;
|
|
6858
|
+
if (typeof page.startCursor !== "string" || typeof page.endCursor !== "string" || typeof page.hasNextPage !== "boolean" || typeof page.hasPreviousPage !== "boolean" || page.hasNextPage !== (value.nextCursor !== null)) {
|
|
6859
|
+
return invalidPage();
|
|
6860
|
+
}
|
|
6861
|
+
for (const edge of value.edges) {
|
|
6862
|
+
if (!record(edge) || typeof edge.cursor !== "string" || !edge.cursor.trim() || !record(edge.node) || typeof edge.node.itemKey !== "string" || !edge.node.itemKey.trim() || !publication(edge.node.publication)) {
|
|
6863
|
+
return invalidPage();
|
|
6864
|
+
}
|
|
6865
|
+
}
|
|
6866
|
+
const first = value.edges[0];
|
|
6867
|
+
if (page.startCursor !== (first?.cursor ?? "")) return invalidPage();
|
|
6868
|
+
return value;
|
|
6869
|
+
}
|
|
6709
6870
|
var ForYouResource = class {
|
|
6710
6871
|
constructor(client) {
|
|
6711
6872
|
this.client = client;
|
|
@@ -6728,29 +6889,29 @@ var ForYouResource = class {
|
|
|
6728
6889
|
}
|
|
6729
6890
|
}
|
|
6730
6891
|
});
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6892
|
+
return connection(graphqlViewerField(response, "forYou"));
|
|
6893
|
+
}
|
|
6894
|
+
/**
|
|
6895
|
+
* One ranked page of Thesis recommendations -- the stream the Feed App reads,
|
|
6896
|
+
* which is not the chronological `list` stream. Page to `exhausted` and filter
|
|
6897
|
+
* on `publication.publishedAtMs` yourself; the order is slot-mixed, so a time
|
|
6898
|
+
* bound is never a reason to stop paging. Publications the viewer already saw
|
|
6899
|
+
* are withheld by an upstream cooldown, so a window read is "recommended and
|
|
6900
|
+
* recent", not every publication in the window.
|
|
6901
|
+
*/
|
|
6902
|
+
async theses(params = {}) {
|
|
6903
|
+
validateForYouThesesParams(params);
|
|
6904
|
+
this.client._requireAuth();
|
|
6905
|
+
const response = await this.client._request("POST", "/query", {
|
|
6906
|
+
body: {
|
|
6907
|
+
query: THESIS_RECOMMENDATION_QUERY,
|
|
6908
|
+
variables: {
|
|
6909
|
+
input: { first: params.first ?? 10, after: params.after }
|
|
6910
|
+
}
|
|
6744
6911
|
}
|
|
6745
|
-
}
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
"GRAPHQL_EMPTY_RESPONSE",
|
|
6749
|
-
"GraphQL response did not include viewer.forYou",
|
|
6750
|
-
502
|
|
6751
|
-
);
|
|
6752
|
-
}
|
|
6753
|
-
return connection(response.data.viewer.forYou);
|
|
6912
|
+
});
|
|
6913
|
+
const field = graphqlViewerField(response, "thesisRecommendations");
|
|
6914
|
+
return recommendationPage(field);
|
|
6754
6915
|
}
|
|
6755
6916
|
};
|
|
6756
6917
|
|
|
@@ -9668,9 +9829,7 @@ function requireDeliveryId(value, label = "delivery id") {
|
|
|
9668
9829
|
throw invalid2(`${label} must be a positive integer`);
|
|
9669
9830
|
return value;
|
|
9670
9831
|
}
|
|
9671
|
-
function
|
|
9672
|
-
if (values.length === 0)
|
|
9673
|
-
throw invalid2("at least one delivery id is required");
|
|
9832
|
+
function normalizeDeliveryIds(values) {
|
|
9674
9833
|
const unique = /* @__PURE__ */ new Set();
|
|
9675
9834
|
for (const value of values) {
|
|
9676
9835
|
requireDeliveryId(value);
|
|
@@ -9679,6 +9838,11 @@ function requireDeliveryIds(values) {
|
|
|
9679
9838
|
}
|
|
9680
9839
|
return [...unique];
|
|
9681
9840
|
}
|
|
9841
|
+
function requireDeliveryIds(values) {
|
|
9842
|
+
if (values.length === 0)
|
|
9843
|
+
throw invalid2("at least one delivery id is required");
|
|
9844
|
+
return normalizeDeliveryIds(values);
|
|
9845
|
+
}
|
|
9682
9846
|
function requireDecision(value) {
|
|
9683
9847
|
if (!DECISIONS.has(value))
|
|
9684
9848
|
throw invalid2("decision must be one of immediate, digest, suppress");
|
|
@@ -9761,7 +9925,10 @@ var StewardResource = class {
|
|
|
9761
9925
|
inboxPath: requireInboxPath(params),
|
|
9762
9926
|
requestId: requireRequestId(params.requestId),
|
|
9763
9927
|
body: params.body,
|
|
9764
|
-
|
|
9928
|
+
// A For-You-only Brief covers no ledger delivery, so an empty (or
|
|
9929
|
+
// omitted) set is valid here; the backend accepts it. `briefed` still
|
|
9930
|
+
// requires ids.
|
|
9931
|
+
deliveryIds: normalizeDeliveryIds(params.deliveryIds ?? [])
|
|
9765
9932
|
}
|
|
9766
9933
|
});
|
|
9767
9934
|
const message = data.postStewardMessage?.message;
|
|
@@ -10035,6 +10202,56 @@ var ThesesResource = class {
|
|
|
10035
10202
|
this.client = client;
|
|
10036
10203
|
}
|
|
10037
10204
|
client;
|
|
10205
|
+
async assetCandidates(text) {
|
|
10206
|
+
this.client._requireAuth();
|
|
10207
|
+
const source = requireBody(text);
|
|
10208
|
+
const response = await this.client._request("POST", "/query", {
|
|
10209
|
+
body: {
|
|
10210
|
+
query: `query ThesisAssetCandidates($input: ThesisAssetCandidatesInput!) {
|
|
10211
|
+
viewer { thesisAssetCandidates(input: $input) {
|
|
10212
|
+
mentions { quote ticker resolution stance candidates { entityId ticker name kind } }
|
|
10213
|
+
} }
|
|
10214
|
+
}`,
|
|
10215
|
+
variables: { input: { text: source } }
|
|
10216
|
+
}
|
|
10217
|
+
});
|
|
10218
|
+
if (Array.isArray(response?.errors) && response.errors.length > 0) {
|
|
10219
|
+
throw new AlvaError("GRAPHQL_ERROR", "Asset extraction failed", 400, {
|
|
10220
|
+
errors: response.errors
|
|
10221
|
+
});
|
|
10222
|
+
}
|
|
10223
|
+
const data = response?.data;
|
|
10224
|
+
const viewer = isRecord2(data) ? data.viewer : void 0;
|
|
10225
|
+
const result = isRecord2(viewer) ? viewer.thesisAssetCandidates : void 0;
|
|
10226
|
+
if (!isRecord2(result) || !Array.isArray(result.mentions)) {
|
|
10227
|
+
throw invalidResponse2("asset candidates response must contain mentions");
|
|
10228
|
+
}
|
|
10229
|
+
const mentions = result.mentions.map((item, index) => {
|
|
10230
|
+
if (!isRecord2(item) || typeof item.quote !== "string" || typeof item.ticker !== "string" || !["RESOLVED", "AMBIGUOUS", "UNRESOLVED"].includes(
|
|
10231
|
+
item.resolution
|
|
10232
|
+
) || !["UNKNOWN", "BULLISH", "BEARISH"].includes(item.stance) || !Array.isArray(item.candidates)) {
|
|
10233
|
+
throw invalidResponse2(`asset mention ${index} is invalid`);
|
|
10234
|
+
}
|
|
10235
|
+
const candidates = item.candidates.map((candidate) => {
|
|
10236
|
+
if (!isRecord2(candidate) || typeof candidate.ticker !== "string" || typeof candidate.name !== "string" || !["STOCK", "ETF", "CRYPTO", "INDEX"].includes(
|
|
10237
|
+
candidate.kind
|
|
10238
|
+
)) {
|
|
10239
|
+
throw invalidResponse2(`asset mention ${index} has invalid candidate`);
|
|
10240
|
+
}
|
|
10241
|
+
return {
|
|
10242
|
+
entityId: responseID(
|
|
10243
|
+
candidate.entityId,
|
|
10244
|
+
`asset mention ${index} candidate.entityId`
|
|
10245
|
+
),
|
|
10246
|
+
ticker: candidate.ticker,
|
|
10247
|
+
name: candidate.name,
|
|
10248
|
+
kind: candidate.kind
|
|
10249
|
+
};
|
|
10250
|
+
});
|
|
10251
|
+
return { ...item, candidates };
|
|
10252
|
+
});
|
|
10253
|
+
return { mentions };
|
|
10254
|
+
}
|
|
10038
10255
|
async create(params) {
|
|
10039
10256
|
this.client._requireAuth();
|
|
10040
10257
|
const body = createBody(params);
|
|
@@ -10048,6 +10265,47 @@ var ThesesResource = class {
|
|
|
10048
10265
|
await this.client._request("GET", `/api/v1/theses/${requireID(id, "id")}`)
|
|
10049
10266
|
);
|
|
10050
10267
|
}
|
|
10268
|
+
async getVersion(id, authorVersionID) {
|
|
10269
|
+
this.client._requireAuth();
|
|
10270
|
+
const thesisID = requireID(id, "id");
|
|
10271
|
+
const versionID = requireID(authorVersionID, "author_version_id");
|
|
10272
|
+
const response = thesisResponse(
|
|
10273
|
+
await this.client._request(
|
|
10274
|
+
"GET",
|
|
10275
|
+
`/api/v1/theses/${thesisID}/versions/${versionID}`
|
|
10276
|
+
)
|
|
10277
|
+
);
|
|
10278
|
+
if (response.thesis.id !== thesisID || response.thesis.author_version_id !== versionID) {
|
|
10279
|
+
throw invalidResponse2(
|
|
10280
|
+
"version response must match the requested thesis and author version"
|
|
10281
|
+
);
|
|
10282
|
+
}
|
|
10283
|
+
return response;
|
|
10284
|
+
}
|
|
10285
|
+
async signals(id, params = {}) {
|
|
10286
|
+
this.client._requireAuth();
|
|
10287
|
+
const first = params.first ?? 20;
|
|
10288
|
+
if (!Number.isInteger(first) || first < 1 || first > 50) {
|
|
10289
|
+
throw invalidArgument("first must be an integer between 1 and 50");
|
|
10290
|
+
}
|
|
10291
|
+
if (params.cursor !== void 0 && typeof params.cursor !== "string") {
|
|
10292
|
+
throw invalidArgument("cursor must be a string");
|
|
10293
|
+
}
|
|
10294
|
+
return thesisSignalsResponse(
|
|
10295
|
+
await this.client._request(
|
|
10296
|
+
"GET",
|
|
10297
|
+
`/api/v1/theses/${requireID(id, "id")}/signals`,
|
|
10298
|
+
{
|
|
10299
|
+
query: {
|
|
10300
|
+
first,
|
|
10301
|
+
...params.cursor === void 0 ? {} : { cursor: params.cursor }
|
|
10302
|
+
}
|
|
10303
|
+
}
|
|
10304
|
+
),
|
|
10305
|
+
id,
|
|
10306
|
+
first
|
|
10307
|
+
);
|
|
10308
|
+
}
|
|
10051
10309
|
async update(id, params) {
|
|
10052
10310
|
this.client._requireAuth();
|
|
10053
10311
|
const body = updateBody(params);
|
|
@@ -10138,8 +10396,36 @@ function createBody(params) {
|
|
|
10138
10396
|
};
|
|
10139
10397
|
if (params.tickers !== void 0)
|
|
10140
10398
|
body.tickers = requireTickers(params.tickers);
|
|
10399
|
+
if (params.entity_stances !== void 0) {
|
|
10400
|
+
body.entity_stances = requireEntityStances(
|
|
10401
|
+
params.entity_stances,
|
|
10402
|
+
body.entity_ids
|
|
10403
|
+
);
|
|
10404
|
+
}
|
|
10141
10405
|
return body;
|
|
10142
10406
|
}
|
|
10407
|
+
function requireEntityStances(value, entityIDs) {
|
|
10408
|
+
if (!Array.isArray(value) || value.length > MAX_ENTITY_IDS)
|
|
10409
|
+
throw invalidArgument("entity_stances must contain at most 100 values");
|
|
10410
|
+
const allowed = new Set(entityIDs);
|
|
10411
|
+
const seen = /* @__PURE__ */ new Set();
|
|
10412
|
+
return value.map((item, index) => {
|
|
10413
|
+
if (!isRecord2(item))
|
|
10414
|
+
throw invalidArgument(`entity_stances[${index}] must be an object`);
|
|
10415
|
+
const entityID = requireID(
|
|
10416
|
+
item.entity_id,
|
|
10417
|
+
`entity_stances[${index}].entity_id`
|
|
10418
|
+
);
|
|
10419
|
+
if (!allowed.has(entityID) || seen.has(entityID))
|
|
10420
|
+
throw invalidArgument(
|
|
10421
|
+
"entity stance must reference one unique entity_id"
|
|
10422
|
+
);
|
|
10423
|
+
seen.add(entityID);
|
|
10424
|
+
if (!["unknown", "bullish", "bearish"].includes(item.stance))
|
|
10425
|
+
throw invalidArgument(`entity_stances[${index}].stance is invalid`);
|
|
10426
|
+
return { entity_id: entityID, stance: item.stance };
|
|
10427
|
+
});
|
|
10428
|
+
}
|
|
10143
10429
|
function updateBody(params) {
|
|
10144
10430
|
return {
|
|
10145
10431
|
request_id: requireRequestID(params.request_id),
|
|
@@ -10178,6 +10464,20 @@ function thesisResponse(response) {
|
|
|
10178
10464
|
author_kind: responseText(thesis.author_kind, "thesis.author_kind"),
|
|
10179
10465
|
author_ref: responseText(thesis.author_ref, "thesis.author_ref")
|
|
10180
10466
|
};
|
|
10467
|
+
if (thesis.entity_stances !== void 0) {
|
|
10468
|
+
if (!Array.isArray(thesis.entity_stances))
|
|
10469
|
+
throw invalidResponse2("thesis.entity_stances must be an array");
|
|
10470
|
+
value.entity_stances = thesis.entity_stances.map((item) => {
|
|
10471
|
+
if (!isRecord2(item))
|
|
10472
|
+
throw invalidResponse2("thesis.entity_stances contains invalid entry");
|
|
10473
|
+
const entityID = responseID(item.entity_id, "entity_stances.entity_id");
|
|
10474
|
+
if (!value.entity_ids.includes(entityID))
|
|
10475
|
+
throw invalidResponse2("entity stance must reference a thesis entity");
|
|
10476
|
+
if (!["unknown", "bullish", "bearish"].includes(item.stance))
|
|
10477
|
+
throw invalidResponse2("thesis.entity_stances contains invalid stance");
|
|
10478
|
+
return { entity_id: entityID, stance: item.stance };
|
|
10479
|
+
});
|
|
10480
|
+
}
|
|
10181
10481
|
return { thesis: value };
|
|
10182
10482
|
}
|
|
10183
10483
|
function thesisGetResponse(response) {
|
|
@@ -10219,6 +10519,112 @@ function thesisGetResponse(response) {
|
|
|
10219
10519
|
});
|
|
10220
10520
|
return { thesis: base.thesis, author, entities };
|
|
10221
10521
|
}
|
|
10522
|
+
function thesisSignalsResponse(response, thesisID, first) {
|
|
10523
|
+
if (!isRecord2(response) || !isRecord2(response.research) || !Array.isArray(response.entries) || response.entries.length > first) {
|
|
10524
|
+
throw invalidResponse2("invalid Signal history response");
|
|
10525
|
+
}
|
|
10526
|
+
const research = response.research;
|
|
10527
|
+
const status = {
|
|
10528
|
+
state: responseText(research.state, "research.state"),
|
|
10529
|
+
pending_work: responseNonnegativeInteger(
|
|
10530
|
+
research.pending_work,
|
|
10531
|
+
"research.pending_work"
|
|
10532
|
+
),
|
|
10533
|
+
read_complete: responseBoolean(
|
|
10534
|
+
research.read_complete,
|
|
10535
|
+
"research.read_complete"
|
|
10536
|
+
)
|
|
10537
|
+
};
|
|
10538
|
+
if (research.last_attempt_ms !== void 0)
|
|
10539
|
+
status.last_attempt_ms = responseNonnegativeInteger(
|
|
10540
|
+
research.last_attempt_ms,
|
|
10541
|
+
"research.last_attempt_ms"
|
|
10542
|
+
);
|
|
10543
|
+
if (research.last_completed_ms !== void 0)
|
|
10544
|
+
status.last_completed_ms = responseNonnegativeInteger(
|
|
10545
|
+
research.last_completed_ms,
|
|
10546
|
+
"research.last_completed_ms"
|
|
10547
|
+
);
|
|
10548
|
+
const entries = response.entries.map((raw) => {
|
|
10549
|
+
if (!isRecord2(raw) || !isRecord2(raw.signal) || !isRecord2(raw.signal.source)) {
|
|
10550
|
+
throw invalidResponse2("entry must include a Signal and source");
|
|
10551
|
+
}
|
|
10552
|
+
const signal = raw.signal;
|
|
10553
|
+
const source = signal.source;
|
|
10554
|
+
const signalID = responseID(signal.thesis_id, "signal.thesis_id");
|
|
10555
|
+
if (signalID !== thesisID)
|
|
10556
|
+
throw invalidResponse2("Signal belongs to another Thesis");
|
|
10557
|
+
const cursor = responseNonemptyText(raw.cursor, "entry.cursor");
|
|
10558
|
+
const mappedSource = {
|
|
10559
|
+
title: responseText(source.title, "source.title")
|
|
10560
|
+
};
|
|
10561
|
+
if (source.url !== void 0)
|
|
10562
|
+
mappedSource.url = responseText(source.url, "source.url");
|
|
10563
|
+
if (source.published_at_ms !== void 0)
|
|
10564
|
+
mappedSource.published_at_ms = responseNonnegativeInteger(
|
|
10565
|
+
source.published_at_ms,
|
|
10566
|
+
"source.published_at_ms"
|
|
10567
|
+
);
|
|
10568
|
+
const mappedSignal = {
|
|
10569
|
+
id: responseID(signal.id, "signal.id"),
|
|
10570
|
+
thesis_id: signalID,
|
|
10571
|
+
author_version_id: responseID(
|
|
10572
|
+
signal.author_version_id,
|
|
10573
|
+
"signal.author_version_id"
|
|
10574
|
+
),
|
|
10575
|
+
statement_snapshot: responseNonemptyText(
|
|
10576
|
+
signal.statement_snapshot,
|
|
10577
|
+
"signal.statement_snapshot"
|
|
10578
|
+
),
|
|
10579
|
+
stance: responseText(signal.stance, "signal.stance"),
|
|
10580
|
+
explanation: responseText(signal.explanation, "signal.explanation"),
|
|
10581
|
+
information_kind: responseText(
|
|
10582
|
+
signal.information_kind,
|
|
10583
|
+
"signal.information_kind"
|
|
10584
|
+
),
|
|
10585
|
+
source: mappedSource
|
|
10586
|
+
};
|
|
10587
|
+
if (signal.evidence_excerpt !== void 0) {
|
|
10588
|
+
if (!isRecord2(signal.evidence_excerpt))
|
|
10589
|
+
throw invalidResponse2("invalid evidence excerpt");
|
|
10590
|
+
mappedSignal.evidence_excerpt = {
|
|
10591
|
+
text: responseNonemptyText(
|
|
10592
|
+
signal.evidence_excerpt.text,
|
|
10593
|
+
"evidence_excerpt.text"
|
|
10594
|
+
),
|
|
10595
|
+
omitted_before: responseBoolean(
|
|
10596
|
+
signal.evidence_excerpt.omitted_before,
|
|
10597
|
+
"evidence_excerpt.omitted_before"
|
|
10598
|
+
),
|
|
10599
|
+
omitted_after: responseBoolean(
|
|
10600
|
+
signal.evidence_excerpt.omitted_after,
|
|
10601
|
+
"evidence_excerpt.omitted_after"
|
|
10602
|
+
)
|
|
10603
|
+
};
|
|
10604
|
+
}
|
|
10605
|
+
return {
|
|
10606
|
+
feed_entry_id: responseID(raw.feed_entry_id, "feed_entry_id"),
|
|
10607
|
+
cursor,
|
|
10608
|
+
signal: mappedSignal
|
|
10609
|
+
};
|
|
10610
|
+
});
|
|
10611
|
+
const nextCursor = responseText(response.next_cursor, "next_cursor");
|
|
10612
|
+
if (nextCursor && nextCursor !== entries[entries.length - 1]?.cursor) {
|
|
10613
|
+
throw invalidResponse2("next_cursor must match the final entry");
|
|
10614
|
+
}
|
|
10615
|
+
return { research: status, entries, next_cursor: nextCursor };
|
|
10616
|
+
}
|
|
10617
|
+
function responseNonnegativeInteger(value, field) {
|
|
10618
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) {
|
|
10619
|
+
throw invalidResponse2(field + " must be a nonnegative safe integer");
|
|
10620
|
+
}
|
|
10621
|
+
return value;
|
|
10622
|
+
}
|
|
10623
|
+
function responseNonemptyText(value, field) {
|
|
10624
|
+
const valueText = responseText(value, field);
|
|
10625
|
+
if (!valueText.trim()) throw invalidResponse2(field + " must be nonempty");
|
|
10626
|
+
return valueText;
|
|
10627
|
+
}
|
|
10222
10628
|
function requireRequestID(value) {
|
|
10223
10629
|
if (!UUID.test(value) || /^0{8}-0{4}-0{4}-0{4}-0{12}$/i.test(value)) {
|
|
10224
10630
|
throw invalidArgument("request_id must be a non-zero RFC 4122 UUID");
|
|
@@ -10235,10 +10641,13 @@ function requireID(value, field) {
|
|
|
10235
10641
|
}
|
|
10236
10642
|
return value;
|
|
10237
10643
|
}
|
|
10644
|
+
var MAX_ENTITY_IDS = 100;
|
|
10238
10645
|
function requireIDs(value, field) {
|
|
10239
10646
|
if (!Array.isArray(value)) throw invalidArgument(`${field} must be an array`);
|
|
10240
|
-
if (value.length >
|
|
10241
|
-
throw invalidArgument(
|
|
10647
|
+
if (value.length > MAX_ENTITY_IDS) {
|
|
10648
|
+
throw invalidArgument(
|
|
10649
|
+
`${field} must contain at most ${MAX_ENTITY_IDS} IDs`
|
|
10650
|
+
);
|
|
10242
10651
|
}
|
|
10243
10652
|
return value.map((item, index) => requireID(item, `${field}[${index}]`));
|
|
10244
10653
|
}
|
|
@@ -10309,8 +10718,10 @@ function responseID(value, field) {
|
|
|
10309
10718
|
}
|
|
10310
10719
|
function responseIDs(value, field) {
|
|
10311
10720
|
if (!Array.isArray(value)) throw invalidResponse2(`${field} must be an array`);
|
|
10312
|
-
if (value.length >
|
|
10313
|
-
throw invalidResponse2(
|
|
10721
|
+
if (value.length > MAX_ENTITY_IDS) {
|
|
10722
|
+
throw invalidResponse2(
|
|
10723
|
+
`${field} must contain at most ${MAX_ENTITY_IDS} IDs`
|
|
10724
|
+
);
|
|
10314
10725
|
}
|
|
10315
10726
|
return value.map((item, index) => responseID(item, `${field}[${index}]`));
|
|
10316
10727
|
}
|
|
@@ -11055,12 +11466,18 @@ var COMMAND_DEFINITIONS = [
|
|
|
11055
11466
|
"body-file",
|
|
11056
11467
|
"title",
|
|
11057
11468
|
"entity-ids",
|
|
11469
|
+
"entity-stances",
|
|
11058
11470
|
"tickers",
|
|
11059
11471
|
"visibility"
|
|
11060
11472
|
],
|
|
11061
11473
|
booleans: ["body-stdin"]
|
|
11062
11474
|
}),
|
|
11475
|
+
command("thesis asset-candidates", { values: ["text"] }),
|
|
11063
11476
|
command("thesis get", { values: ["id"] }),
|
|
11477
|
+
command("thesis version get", {
|
|
11478
|
+
values: ["id", "author-version-id"]
|
|
11479
|
+
}),
|
|
11480
|
+
command("thesis signals", { values: ["id", "first", "cursor"] }),
|
|
11064
11481
|
command("thesis set-visibility", { values: ["id", "visibility"] }),
|
|
11065
11482
|
command("thesis update", {
|
|
11066
11483
|
values: [
|
|
@@ -11142,6 +11559,7 @@ var COMMAND_DEFINITIONS = [
|
|
|
11142
11559
|
command("for-you list", {
|
|
11143
11560
|
values: ["limit", "cursor", "newer-than", "feed-id"]
|
|
11144
11561
|
}),
|
|
11562
|
+
command("for-you theses", { values: ["limit", "cursor"] }),
|
|
11145
11563
|
command("credits items", {
|
|
11146
11564
|
values: ["last", "start", "end", "session-id", "first", "after"],
|
|
11147
11565
|
booleans: ["today"]
|
|
@@ -11215,7 +11633,7 @@ var COMMAND_DEFINITIONS = [
|
|
|
11215
11633
|
}),
|
|
11216
11634
|
command("release playbook", {
|
|
11217
11635
|
values: ["name", "version", "feeds", "changelog", "readme-url"],
|
|
11218
|
-
booleans: ["bypass-lint"]
|
|
11636
|
+
booleans: ["bypass-lint", "confirm-bundled-feed-exposure"]
|
|
11219
11637
|
}),
|
|
11220
11638
|
command("lint playbook", {
|
|
11221
11639
|
values: ["format"],
|
|
@@ -15751,7 +16169,7 @@ function formatTradingPairResolved(result) {
|
|
|
15751
16169
|
}
|
|
15752
16170
|
|
|
15753
16171
|
// src/cli/dispatch.ts
|
|
15754
|
-
var CLI_VERSION = true ? "0.
|
|
16172
|
+
var CLI_VERSION = true ? "0.31.0" : "dev";
|
|
15755
16173
|
var DEFAULT_RUN_TIMEOUT_MS = 6e5;
|
|
15756
16174
|
var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
|
|
15757
16175
|
var GLOBAL_VALUE_FLAGS = Object.entries(GLOBAL_FLAG_DEFINITIONS).filter(([, kind]) => kind === "value").map(([name]) => `--${name}`);
|
|
@@ -15795,7 +16213,7 @@ Commands:
|
|
|
15795
16213
|
deploy Cronjob management (create, list, get, update, delete, pause, resume, runs, run-logs)
|
|
15796
16214
|
schedule Agent-owned named schedules (list, put, pause, resume, delete)
|
|
15797
16215
|
steward Push steward reports for a Session Inbox (decide, forward, send, pending, briefed)
|
|
15798
|
-
thesis Authored thesis lifecycle (create, get, set-visibility, update, close, delete, rewrite)
|
|
16216
|
+
thesis Authored thesis lifecycle (create, get, signals, set-visibility, update, close, delete, rewrite)
|
|
15799
16217
|
service-account Restricted run-as identities (create, list, delete, grant, revoke)
|
|
15800
16218
|
release Feed and playbook releases (feed, playbook-draft, playbook)
|
|
15801
16219
|
lint Design-system lint (playbook)
|
|
@@ -15858,7 +16276,7 @@ Subcommands:
|
|
|
15858
16276
|
Flags:
|
|
15859
16277
|
--inbox-path <path> Steward Session Inbox (terminal CLI only)
|
|
15860
16278
|
--delivery-id <id> One delivery (decide, forward)
|
|
15861
|
-
--delivery-ids <a,b,c> Comma-separated deliveries (send
|
|
16279
|
+
--delivery-ids <a,b,c> Comma-separated deliveries (briefed; optional for send \u2014 omit for a For-You-only Brief)
|
|
15862
16280
|
--decision <immediate|digest|suppress>
|
|
15863
16281
|
--reason <text> Short audit note stored with the decision
|
|
15864
16282
|
--body <markdown> Message body (send)
|
|
@@ -15873,6 +16291,7 @@ Examples (terminal; the embedded Agent tool omits --inbox-path):
|
|
|
15873
16291
|
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%"
|
|
15874
16292
|
alva steward forward --inbox-path <inbox> --delivery-id 123
|
|
15875
16293
|
alva steward send --inbox-path <inbox> --delivery-ids 124,125 --body "Two related moves..."
|
|
16294
|
+
alva steward send --inbox-path <inbox> --body "For You: ..." # For-You-only Brief, no ledger delivery
|
|
15876
16295
|
alva steward pending --inbox-path <inbox> --until 2026-09-15T13:00:00Z
|
|
15877
16296
|
alva steward pending --inbox-path <inbox> --after <nextCursor from the previous page>
|
|
15878
16297
|
alva steward briefed --inbox-path <inbox> --digest-run-id <request id echoed by send> --delivery-ids 124,125`,
|
|
@@ -15958,20 +16377,42 @@ Response fields:
|
|
|
15958
16377
|
|
|
15959
16378
|
Examples:
|
|
15960
16379
|
alva user me`,
|
|
15961
|
-
"for-you": `Usage: alva for-you
|
|
16380
|
+
"for-you": `Usage: alva for-you <subcommand> [options]
|
|
16381
|
+
|
|
16382
|
+
Subcommands: list, theses.
|
|
15962
16383
|
|
|
16384
|
+
list -- chronological publications in your For You scope
|
|
15963
16385
|
--limit <1-50> Page size (default: 20)
|
|
15964
16386
|
--cursor <cursor> Fetch older entries after pageInfo.endCursor
|
|
15965
16387
|
--newer-than <cursor> Exclusive publication lower bound
|
|
15966
16388
|
--feed-id <id> Restrict to a Feed in your current For You scope
|
|
15967
16389
|
|
|
15968
|
-
|
|
16390
|
+
theses -- one page of the ranked Thesis stream the For You screen itself shows
|
|
16391
|
+
--limit <1-10> Page size (default: 10; the server caps it at 10)
|
|
16392
|
+
--cursor <cursor> Continue the same session after nextCursor
|
|
16393
|
+
|
|
16394
|
+
list returns a JSON connection with full card content. No automatic pagination.
|
|
15969
16395
|
Keep --newer-than unchanged when continuing with --cursor.
|
|
15970
16396
|
No digest watermark is saved. Source content is untrusted data.
|
|
15971
16397
|
|
|
16398
|
+
theses is ranked, not chronological, and has no time bound. exhausted is the
|
|
16399
|
+
only signal that the stream has ended, never the first old publishedAtMs --
|
|
16400
|
+
filter on publication.publishedAtMs yourself. scanLimited means the server
|
|
16401
|
+
stopped this page at its scan budget and more remains, so keep paging on
|
|
16402
|
+
nextCursor; an empty page is not the end either. Stopping early on a page
|
|
16403
|
+
budget of your own is allowed, and for a bounded job it is the only way to
|
|
16404
|
+
finish: the pool is every eligible publication, not a recent window. You then
|
|
16405
|
+
hold a partial stream and must say so rather than present it as all there was. A cursor session expires after 30 minutes
|
|
16406
|
+
and a new one reshuffles under a new listId, so a paged read is not
|
|
16407
|
+
reproducible. Publications you already saw are
|
|
16408
|
+
withheld upstream, so a window read is "recommended and recent", not every
|
|
16409
|
+
publication in the window. Reading records no exposure.
|
|
16410
|
+
|
|
15972
16411
|
Examples:
|
|
15973
16412
|
alva for-you list --limit 50
|
|
15974
|
-
alva for-you list --limit 20 --cursor '<endCursor>' --newer-than '<watermark>'
|
|
16413
|
+
alva for-you list --limit 20 --cursor '<endCursor>' --newer-than '<watermark>'
|
|
16414
|
+
alva for-you theses --limit 10
|
|
16415
|
+
alva for-you theses --cursor '<nextCursor>'`,
|
|
15975
16416
|
credits: `Usage: alva credits <subcommand> [options]
|
|
15976
16417
|
|
|
15977
16418
|
Read the authenticated user's own credit wallet and consumption history.
|
|
@@ -16628,6 +17069,9 @@ Playbook-draft flags:
|
|
|
16628
17069
|
with skill tags; re-draft replaces the tag set.
|
|
16629
17070
|
|
|
16630
17071
|
Playbook flags:
|
|
17072
|
+
--confirm-bundled-feed-exposure
|
|
17073
|
+
Confirm delivery of bundled non-public Feeds to
|
|
17074
|
+
the Playbook audience. Defaults to unconfirmed.
|
|
16631
17075
|
--name <name> Playbook name, must already exist as draft (required)
|
|
16632
17076
|
--version <version> Semantic version, e.g. "v1.0.0" (required)
|
|
16633
17077
|
--feeds <json> JSON array of {feed_id, feed_major?} (required)
|
|
@@ -17120,13 +17564,15 @@ Examples:
|
|
|
17120
17564
|
alva arrays token status`,
|
|
17121
17565
|
thesis: `Usage: alva thesis <subcommand> [options]
|
|
17122
17566
|
|
|
17123
|
-
Create, read, update, close, delete, or explicitly rewrite an authored thesis.
|
|
17567
|
+
Create, read, inspect Signals and exact author versions, update, close, delete, or explicitly rewrite an authored thesis.
|
|
17124
17568
|
Backend owns Signal/Alert setup; the CLI never starts them separately.
|
|
17125
17569
|
Create and update never rewrite text automatically.
|
|
17126
17570
|
|
|
17127
17571
|
Subcommands:
|
|
17128
17572
|
create Create a thesis
|
|
17129
17573
|
get Get one thesis
|
|
17574
|
+
version get Get one exact author version
|
|
17575
|
+
signals Read published Signal history
|
|
17130
17576
|
set-visibility Change current access without publishing a version
|
|
17131
17577
|
update Replaces document fields: body, title, entities, visibility (all sent in full)
|
|
17132
17578
|
close Close the current author version with an optional note
|
|
@@ -17145,8 +17591,11 @@ the backend; do not send a fresh ID. Create defaults --visibility to public.
|
|
|
17145
17591
|
Update requires --visibility explicitly so it cannot inadvertently publish.
|
|
17146
17592
|
|
|
17147
17593
|
Other flags:
|
|
17148
|
-
create --request-id <uuid> --body ... [--title <text>] [--tickers <ticker,ticker>] [--entity-ids <id,id>] [--visibility <value>]
|
|
17594
|
+
create --request-id <uuid> --body ... [--title <text>] [--tickers <ticker,ticker>] [--entity-ids <id,id>] [--entity-stances <json>] [--visibility <value>]
|
|
17595
|
+
asset-candidates --text <unsaved thesis text>
|
|
17149
17596
|
get --id <signed-int64-decimal>
|
|
17597
|
+
version get --id <signed-int64-decimal> --author-version-id <signed-int64-decimal>
|
|
17598
|
+
signals --id <id> [--first <1-50>] [--cursor <opaque-cursor>]
|
|
17150
17599
|
set-visibility --id <id> --visibility public|private
|
|
17151
17600
|
update --id <id> --request-id <uuid> --expected-author-version-id <id> --body ... --visibility <value> [--title <text>] [--entity-ids <id,id>] [--editorial]
|
|
17152
17601
|
close --id <id> --expected-author-version-id <id> [--note <text>]
|
|
@@ -17160,7 +17609,7 @@ it must not invent factual evidence, numbers, or citations. Rewrite returns a
|
|
|
17160
17609
|
candidate only: it never creates, updates, retries, or chooses a mode from body
|
|
17161
17610
|
length or errors.
|
|
17162
17611
|
|
|
17163
|
-
IDs are decimal strings, never JavaScript numbers; provide at most
|
|
17612
|
+
IDs are decimal strings, never JavaScript numbers; provide at most 100 entity
|
|
17164
17613
|
IDs. Body text must be nonblank,
|
|
17165
17614
|
valid Unicode, and at most 65536 UTF-8 bytes; title is optional and at most
|
|
17166
17615
|
500 UTF-8 bytes. Text is passed without trimming or newline conversion.
|
|
@@ -17862,6 +18311,19 @@ function thesisTickers(flags) {
|
|
|
17862
18311
|
}
|
|
17863
18312
|
return tickers;
|
|
17864
18313
|
}
|
|
18314
|
+
function thesisEntityStances(flags) {
|
|
18315
|
+
const raw = flags["entity-stances"];
|
|
18316
|
+
if (raw === void 0) return void 0;
|
|
18317
|
+
let parsed;
|
|
18318
|
+
try {
|
|
18319
|
+
parsed = JSON.parse(raw);
|
|
18320
|
+
} catch {
|
|
18321
|
+
throw new CliUsageError("--entity-stances must be a JSON array", "thesis");
|
|
18322
|
+
}
|
|
18323
|
+
if (!Array.isArray(parsed))
|
|
18324
|
+
throw new CliUsageError("--entity-stances must be a JSON array", "thesis");
|
|
18325
|
+
return parsed;
|
|
18326
|
+
}
|
|
17865
18327
|
function strictThesisUTF8(value, command2, flag) {
|
|
17866
18328
|
const bytes = toByteView(value);
|
|
17867
18329
|
if (bytes === void 0) {
|
|
@@ -18394,7 +18856,12 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
18394
18856
|
"inbox-path",
|
|
18395
18857
|
`steward ${subcommand}`
|
|
18396
18858
|
);
|
|
18397
|
-
const
|
|
18859
|
+
const splitIds = (raw) => raw.split(",").map((value) => value.trim()).filter((value) => value !== "");
|
|
18860
|
+
const ids = (name) => splitIds(requireFlag(flags, name, `steward ${subcommand}`));
|
|
18861
|
+
const optionalIds = (name) => {
|
|
18862
|
+
const raw = flags[name];
|
|
18863
|
+
return raw === void 0 ? [] : splitIds(raw);
|
|
18864
|
+
};
|
|
18398
18865
|
switch (subcommand) {
|
|
18399
18866
|
case "decide":
|
|
18400
18867
|
return client.steward.decide({
|
|
@@ -18415,7 +18882,7 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
18415
18882
|
return client.steward.send({
|
|
18416
18883
|
inboxPath,
|
|
18417
18884
|
body: requireFlag(flags, "body", "steward send"),
|
|
18418
|
-
deliveryIds:
|
|
18885
|
+
deliveryIds: optionalIds("delivery-ids"),
|
|
18419
18886
|
requestId: flags["request-id"]
|
|
18420
18887
|
});
|
|
18421
18888
|
case "pending": {
|
|
@@ -18464,11 +18931,29 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
18464
18931
|
body: await thesisBodyFromFlags(flags, "thesis create", deps),
|
|
18465
18932
|
title: flags.title ?? "",
|
|
18466
18933
|
entity_ids: thesisEntityIDs(flags),
|
|
18934
|
+
entity_stances: thesisEntityStances(flags),
|
|
18467
18935
|
tickers: thesisTickers(flags),
|
|
18468
18936
|
visibility: flags.visibility === void 0 ? "public" : thesisVisibility(flags.visibility)
|
|
18469
18937
|
});
|
|
18938
|
+
case "asset-candidates":
|
|
18939
|
+
return client.theses.assetCandidates(
|
|
18940
|
+
requireFlag(flags, "text", "thesis asset-candidates")
|
|
18941
|
+
);
|
|
18470
18942
|
case "get":
|
|
18471
18943
|
return client.theses.get(requireFlag(flags, "id", "thesis get"));
|
|
18944
|
+
case "version":
|
|
18945
|
+
return client.theses.getVersion(
|
|
18946
|
+
requireFlag(flags, "id", "thesis version get"),
|
|
18947
|
+
requireFlag(flags, "author-version-id", "thesis version get")
|
|
18948
|
+
);
|
|
18949
|
+
case "signals":
|
|
18950
|
+
return client.theses.signals(
|
|
18951
|
+
requireFlag(flags, "id", "thesis signals"),
|
|
18952
|
+
{
|
|
18953
|
+
first: flags.first === void 0 ? void 0 : Number(flags.first),
|
|
18954
|
+
cursor: flags.cursor
|
|
18955
|
+
}
|
|
18956
|
+
);
|
|
18472
18957
|
case "set-visibility":
|
|
18473
18958
|
return client.theses.setVisibility(
|
|
18474
18959
|
requireFlag(flags, "id", "thesis set-visibility"),
|
|
@@ -18674,8 +19159,32 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
18674
19159
|
}
|
|
18675
19160
|
}
|
|
18676
19161
|
case "for-you": {
|
|
19162
|
+
if (subcommand === "theses") {
|
|
19163
|
+
const params2 = {
|
|
19164
|
+
first: optionalBoundedIntegerFlag(
|
|
19165
|
+
flags,
|
|
19166
|
+
"limit",
|
|
19167
|
+
"for-you theses",
|
|
19168
|
+
1,
|
|
19169
|
+
10
|
|
19170
|
+
),
|
|
19171
|
+
after: flags.cursor
|
|
19172
|
+
};
|
|
19173
|
+
try {
|
|
19174
|
+
validateForYouThesesParams(params2);
|
|
19175
|
+
} catch (error) {
|
|
19176
|
+
throw new CliUsageError(
|
|
19177
|
+
error instanceof Error ? error.message : String(error),
|
|
19178
|
+
"for-you"
|
|
19179
|
+
);
|
|
19180
|
+
}
|
|
19181
|
+
return client.forYou.theses(params2);
|
|
19182
|
+
}
|
|
18677
19183
|
if (subcommand !== "list") {
|
|
18678
|
-
throw new CliUsageError(
|
|
19184
|
+
throw new CliUsageError(
|
|
19185
|
+
"Expected for-you list or for-you theses",
|
|
19186
|
+
"for-you"
|
|
19187
|
+
);
|
|
18679
19188
|
}
|
|
18680
19189
|
const params = {
|
|
18681
19190
|
first: optionalBoundedIntegerFlag(
|
|
@@ -18999,7 +19508,10 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
18999
19508
|
version,
|
|
19000
19509
|
feeds: jsonParse(feedsRaw),
|
|
19001
19510
|
changelog,
|
|
19002
|
-
readme_url: readmeUrl
|
|
19511
|
+
readme_url: readmeUrl,
|
|
19512
|
+
confirm_bundled_feed_exposure: boolFlag(
|
|
19513
|
+
flags["confirm-bundled-feed-exposure"]
|
|
19514
|
+
)
|
|
19003
19515
|
});
|
|
19004
19516
|
}
|
|
19005
19517
|
default:
|