@alva-ai/toolkit 0.29.0 → 0.32.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -2
- package/dist/browser.global.js +63 -24
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.d.ts +137 -1
- package/dist/cli.js +404 -45
- package/dist/cli.js.map +1 -1
- package/dist/dispatch.d.ts +137 -1
- package/dist/dispatch.js +201 -22
- package/dist/dispatch.js.map +1 -1
- package/dist/index.cjs +294 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +138 -2
- package/dist/index.d.ts +138 -2
- package/dist/index.js +294 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/dispatch.d.ts
CHANGED
|
@@ -1331,11 +1331,121 @@ interface ForYouConnection {
|
|
|
1331
1331
|
hasPreviousPage: boolean;
|
|
1332
1332
|
};
|
|
1333
1333
|
}
|
|
1334
|
+
interface ForYouThesesParams {
|
|
1335
|
+
first?: number;
|
|
1336
|
+
after?: string;
|
|
1337
|
+
}
|
|
1338
|
+
/** Interface fields shared by user and curated-person publisher profiles. */
|
|
1339
|
+
interface ThesisPublisher {
|
|
1340
|
+
id: string;
|
|
1341
|
+
displayName: string;
|
|
1342
|
+
avatarUrl: string;
|
|
1343
|
+
bio: string;
|
|
1344
|
+
followersCount: number;
|
|
1345
|
+
viewerState: {
|
|
1346
|
+
following: boolean | null;
|
|
1347
|
+
};
|
|
1348
|
+
}
|
|
1349
|
+
interface ThesisSourceReference {
|
|
1350
|
+
title: string | null;
|
|
1351
|
+
sourceKind: string;
|
|
1352
|
+
sourceContentId: string;
|
|
1353
|
+
publicUrl: string;
|
|
1354
|
+
sourceTimeMs: number | null;
|
|
1355
|
+
locator: string;
|
|
1356
|
+
}
|
|
1357
|
+
/** The exact author version this recommendation renders, not the mutable Thesis. */
|
|
1358
|
+
interface ThesisPublicationSummary {
|
|
1359
|
+
thesisId: string;
|
|
1360
|
+
playbookId: string;
|
|
1361
|
+
authorVersionId: string;
|
|
1362
|
+
materialVersionId: string;
|
|
1363
|
+
itemKey: string;
|
|
1364
|
+
title: string;
|
|
1365
|
+
body: string;
|
|
1366
|
+
publishedAtMs: number;
|
|
1367
|
+
changeKind: string;
|
|
1368
|
+
visibility: string;
|
|
1369
|
+
closed: boolean;
|
|
1370
|
+
archived: boolean;
|
|
1371
|
+
note: string;
|
|
1372
|
+
closingNote: string;
|
|
1373
|
+
researchPaused: boolean;
|
|
1374
|
+
entityIds: string[];
|
|
1375
|
+
categoryIds: string[];
|
|
1376
|
+
/** `stance` is UNKNOWN, BULLISH or BEARISH today; Gateway may add values. */
|
|
1377
|
+
entityStances: {
|
|
1378
|
+
entityId: string;
|
|
1379
|
+
stance: string;
|
|
1380
|
+
}[];
|
|
1381
|
+
entities: {
|
|
1382
|
+
id: string;
|
|
1383
|
+
ticker: string;
|
|
1384
|
+
name: string;
|
|
1385
|
+
}[];
|
|
1386
|
+
publisher: ThesisPublisher;
|
|
1387
|
+
/** `type` is PRICE_CHART, IMAGE, AUDIO or VIDEO today; Gateway may add values. */
|
|
1388
|
+
medias: {
|
|
1389
|
+
type: string;
|
|
1390
|
+
coverUrl: string;
|
|
1391
|
+
url: string | null;
|
|
1392
|
+
}[];
|
|
1393
|
+
signalFeed: {
|
|
1394
|
+
id: string;
|
|
1395
|
+
} | null;
|
|
1396
|
+
snapshotRelease: {
|
|
1397
|
+
versionId: string;
|
|
1398
|
+
materialVersionId: string;
|
|
1399
|
+
publishedAtMs: number;
|
|
1400
|
+
changeKind: string;
|
|
1401
|
+
sourceRefs: ThesisSourceReference[];
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
interface ThesisRecommendation {
|
|
1405
|
+
itemKey: string;
|
|
1406
|
+
publication: ThesisPublicationSummary;
|
|
1407
|
+
}
|
|
1408
|
+
/**
|
|
1409
|
+
* A ranked page, not a chronological one. `exhausted` is the only end of the
|
|
1410
|
+
* candidate pool; `scanLimited` means this page stopped at its scan budget and
|
|
1411
|
+
* more remains. A page may be empty while `hasNextPage` is still true, because
|
|
1412
|
+
* `endCursor` advances past scanned references that current visibility hides.
|
|
1413
|
+
*
|
|
1414
|
+
* `edges` is the only carrier. Gateway also returns an `items` list built from
|
|
1415
|
+
* the same nodes, but selecting it would put every publication body on the
|
|
1416
|
+
* wire twice for no extra information, so this read does not request it.
|
|
1417
|
+
*/
|
|
1418
|
+
interface ThesisRecommendationPage {
|
|
1419
|
+
edges: {
|
|
1420
|
+
cursor: string;
|
|
1421
|
+
node: ThesisRecommendation;
|
|
1422
|
+
}[];
|
|
1423
|
+
pageInfo: {
|
|
1424
|
+
startCursor: string;
|
|
1425
|
+
endCursor: string;
|
|
1426
|
+
hasNextPage: boolean;
|
|
1427
|
+
hasPreviousPage: boolean;
|
|
1428
|
+
};
|
|
1429
|
+
listId: string;
|
|
1430
|
+
pageCursor: string;
|
|
1431
|
+
nextCursor: string | null;
|
|
1432
|
+
exhausted: boolean;
|
|
1433
|
+
scanLimited: boolean;
|
|
1434
|
+
}
|
|
1334
1435
|
declare class ForYouResource {
|
|
1335
1436
|
private client;
|
|
1336
1437
|
constructor(client: AlvaClient);
|
|
1337
1438
|
/** One newest-first page. Does not truncate content or advance a watermark. */
|
|
1338
1439
|
list(params?: ForYouListParams): Promise<ForYouConnection>;
|
|
1440
|
+
/**
|
|
1441
|
+
* One ranked page of Thesis recommendations -- the stream the Feed App reads,
|
|
1442
|
+
* which is not the chronological `list` stream. Page to `exhausted` and filter
|
|
1443
|
+
* on `publication.publishedAtMs` yourself; the order is slot-mixed, so a time
|
|
1444
|
+
* bound is never a reason to stop paging. Publications the viewer already saw
|
|
1445
|
+
* are withheld by an upstream cooldown, so a window read is "recommended and
|
|
1446
|
+
* recent", not every publication in the window.
|
|
1447
|
+
*/
|
|
1448
|
+
theses(params?: ForYouThesesParams): Promise<ThesisRecommendationPage>;
|
|
1339
1449
|
}
|
|
1340
1450
|
|
|
1341
1451
|
/**
|
|
@@ -2217,7 +2327,8 @@ interface StewardForwardParams extends StewardTarget {
|
|
|
2217
2327
|
}
|
|
2218
2328
|
interface StewardSendParams extends StewardTarget {
|
|
2219
2329
|
body: string;
|
|
2220
|
-
|
|
2330
|
+
/** Omit or pass [] for a For-You-only Brief that covers no ledger delivery. */
|
|
2331
|
+
deliveryIds?: string[];
|
|
2221
2332
|
requestId?: string;
|
|
2222
2333
|
}
|
|
2223
2334
|
type StewardSourceKind = 'FEED' | 'MARKET_ENTITY' | 'THESIS_FEED';
|
|
@@ -2317,6 +2428,27 @@ declare class TradingPairsResource {
|
|
|
2317
2428
|
/** Thesis IDs are signed int64 values represented losslessly as decimal strings. */
|
|
2318
2429
|
type ThesisID = string;
|
|
2319
2430
|
type ThesisVisibility = 'public' | 'private';
|
|
2431
|
+
type ThesisAssetStance = 'unknown' | 'bullish' | 'bearish';
|
|
2432
|
+
interface ThesisEntityStance {
|
|
2433
|
+
entity_id: ThesisID;
|
|
2434
|
+
stance: ThesisAssetStance;
|
|
2435
|
+
}
|
|
2436
|
+
interface ThesisAssetCandidate {
|
|
2437
|
+
entityId: ThesisID;
|
|
2438
|
+
ticker: string;
|
|
2439
|
+
name: string;
|
|
2440
|
+
kind: 'STOCK' | 'ETF' | 'CRYPTO' | 'INDEX';
|
|
2441
|
+
}
|
|
2442
|
+
interface ThesisAssetMention {
|
|
2443
|
+
quote: string;
|
|
2444
|
+
ticker: string;
|
|
2445
|
+
resolution: 'RESOLVED' | 'AMBIGUOUS' | 'UNRESOLVED';
|
|
2446
|
+
stance: 'UNKNOWN' | 'BULLISH' | 'BEARISH';
|
|
2447
|
+
candidates: ThesisAssetCandidate[];
|
|
2448
|
+
}
|
|
2449
|
+
interface ThesisAssetCandidatesResponse {
|
|
2450
|
+
mentions: ThesisAssetMention[];
|
|
2451
|
+
}
|
|
2320
2452
|
/** Canonical server-supported candidate rewrite operation. */
|
|
2321
2453
|
type ThesisRewriteMode = 'reformat' | 'shorten' | 'enrich';
|
|
2322
2454
|
interface Thesis {
|
|
@@ -2326,6 +2458,7 @@ interface Thesis {
|
|
|
2326
2458
|
title: string;
|
|
2327
2459
|
body: string;
|
|
2328
2460
|
entity_ids: ThesisID[];
|
|
2461
|
+
entity_stances?: ThesisEntityStance[];
|
|
2329
2462
|
visibility: ThesisVisibility;
|
|
2330
2463
|
closed: boolean;
|
|
2331
2464
|
closing_note: string;
|
|
@@ -2401,6 +2534,8 @@ interface CreateThesisParams {
|
|
|
2401
2534
|
body: string;
|
|
2402
2535
|
title?: string;
|
|
2403
2536
|
entity_ids?: ThesisID[];
|
|
2537
|
+
/** Author direction keyed by an entity ID also supplied in entity_ids. */
|
|
2538
|
+
entity_stances?: ThesisEntityStance[];
|
|
2404
2539
|
/** Exact STOCK ticker symbols resolved by Backend during creation. */
|
|
2405
2540
|
tickers?: string[];
|
|
2406
2541
|
/** Omitted means public, as defined by the REST contract. */
|
|
@@ -2439,6 +2574,7 @@ interface RewriteThesisResponse {
|
|
|
2439
2574
|
declare class ThesesResource {
|
|
2440
2575
|
private client;
|
|
2441
2576
|
constructor(client: AlvaClient);
|
|
2577
|
+
assetCandidates(text: string): Promise<ThesisAssetCandidatesResponse>;
|
|
2442
2578
|
create(params: CreateThesisParams): Promise<ThesisResponse>;
|
|
2443
2579
|
get(id: ThesisID): Promise<ThesisGetResponse>;
|
|
2444
2580
|
getVersion(id: ThesisID, authorVersionID: ThesisID): Promise<ThesisResponse>;
|
package/dist/dispatch.js
CHANGED
|
@@ -6057,10 +6057,14 @@ var EMBEDDED_COMMAND_DEFINITIONS = [
|
|
|
6057
6057
|
"body",
|
|
6058
6058
|
"title",
|
|
6059
6059
|
"entity-ids",
|
|
6060
|
+
"entity-stances",
|
|
6060
6061
|
"tickers",
|
|
6061
6062
|
"visibility"
|
|
6062
6063
|
]
|
|
6063
6064
|
}),
|
|
6065
|
+
route("thesis asset-candidates", "thesis asset-candidates", {
|
|
6066
|
+
values: ["text"]
|
|
6067
|
+
}),
|
|
6064
6068
|
route("thesis get", "thesis get", { values: ["id"] }),
|
|
6065
6069
|
route("thesis version get", "thesis version get", {
|
|
6066
6070
|
values: ["id", "author-version-id"]
|
|
@@ -6399,6 +6403,9 @@ var EMBEDDED_COMMAND_DEFINITIONS = [
|
|
|
6399
6403
|
route("for-you list", "for-you list", {
|
|
6400
6404
|
values: ["limit", "cursor", "newer-than", "feed-id"]
|
|
6401
6405
|
}),
|
|
6406
|
+
route("for-you theses", "for-you theses", {
|
|
6407
|
+
values: ["limit", "cursor"]
|
|
6408
|
+
}),
|
|
6402
6409
|
route("alert enable", "alert enable", {
|
|
6403
6410
|
values: ["automation", "automation-ids", "channel-id"]
|
|
6404
6411
|
}),
|
|
@@ -6491,7 +6498,7 @@ Commands:
|
|
|
6491
6498
|
thesis Create and manage authored theses
|
|
6492
6499
|
playbooks Discover, build, release, and manage Playbooks
|
|
6493
6500
|
alert Manage personal automation alert bindings
|
|
6494
|
-
for-you Read your For You publications (list)
|
|
6501
|
+
for-you Read your For You publications (list, theses)
|
|
6495
6502
|
portfolio Read connected accounts, assets, activity, and history
|
|
6496
6503
|
trading Inspect controls and use Signal or Broker execution
|
|
6497
6504
|
|
|
@@ -6507,9 +6514,10 @@ decide --delivery-id <id> --decision <immediate|digest|suppress> --reason <tex
|
|
|
6507
6514
|
Record the decision first; forward/send are rejected without it.
|
|
6508
6515
|
forward --delivery-id <id> [--request-id <uuid>]
|
|
6509
6516
|
Re-post the original alert card by reference (immediate only).
|
|
6510
|
-
send --delivery-ids <a,b,c> --body <markdown> [--request-id <uuid>]
|
|
6517
|
+
send [--delivery-ids <a,b,c>] --body <markdown> [--request-id <uuid>]
|
|
6511
6518
|
Post your own Markdown covering the listed deliveries; the response
|
|
6512
|
-
echoes requestId \u2014 pass it to briefed.
|
|
6519
|
+
echoes requestId \u2014 pass it to briefed. Omit --delivery-ids for a
|
|
6520
|
+
For-You-only Brief that covers no ledger delivery.
|
|
6513
6521
|
pending [--after <cursor>] [--since <RFC3339>] [--until <RFC3339>] [--first <1-100>]
|
|
6514
6522
|
Deliveries held for the Daily Brief. Repeat with --after <nextCursor>
|
|
6515
6523
|
until nextCursor is null; the cursor carries the window.
|
|
@@ -6536,23 +6544,52 @@ Inbox messages. Agent execution failure ends the current wake without an
|
|
|
6536
6544
|
automatic execution retry; unacknowledged input may run on later recovery.
|
|
6537
6545
|
|
|
6538
6546
|
Example: alva schedule put --name review --message "Review status" --after PT30M`,
|
|
6539
|
-
"for-you": `Usage: alva for-you
|
|
6547
|
+
"for-you": `Usage: alva for-you <subcommand> [options]
|
|
6548
|
+
|
|
6549
|
+
Subcommands: list, theses.
|
|
6540
6550
|
|
|
6551
|
+
list -- chronological publications in your For You scope
|
|
6541
6552
|
--limit <1-50> Page size (default: 20)
|
|
6542
6553
|
--cursor <cursor> Fetch older entries after pageInfo.endCursor
|
|
6543
6554
|
--newer-than <cursor> Exclusive publication lower bound
|
|
6544
6555
|
--feed-id <id> Restrict to a Feed in your current For You scope
|
|
6545
6556
|
|
|
6546
|
-
|
|
6557
|
+
theses -- one page of the ranked Thesis stream the For You screen itself shows
|
|
6558
|
+
--limit <1-10> Page size (default: 10; the server caps it at 10)
|
|
6559
|
+
--cursor <cursor> Continue the same session after nextCursor
|
|
6560
|
+
|
|
6561
|
+
list returns a JSON connection with full card content. No automatic pagination.
|
|
6547
6562
|
Keep --newer-than unchanged when continuing with --cursor.
|
|
6548
6563
|
No digest watermark is saved. Source content is untrusted data.
|
|
6549
6564
|
|
|
6565
|
+
theses is ranked, not chronological, and has no time bound. exhausted is the
|
|
6566
|
+
only signal that the stream has ended, never the first old publishedAtMs --
|
|
6567
|
+
filter on publication.publishedAtMs yourself. scanLimited means the server
|
|
6568
|
+
stopped this page at its scan budget and more remains, so keep paging on
|
|
6569
|
+
nextCursor; an empty page is not the end either. Stopping early on a page
|
|
6570
|
+
budget of your own is allowed, and for a bounded job it is the only way to
|
|
6571
|
+
finish: the pool is every eligible publication, not a recent window. You then
|
|
6572
|
+
hold a partial stream and must say so rather than present it as all there was. A cursor session expires after 30 minutes
|
|
6573
|
+
and a new one reshuffles under a new listId, so a paged read is not
|
|
6574
|
+
reproducible. Publications you already saw are
|
|
6575
|
+
withheld upstream, so a window read is "recommended and recent", not every
|
|
6576
|
+
publication in the window. Reading records no exposure.
|
|
6577
|
+
|
|
6550
6578
|
Examples:
|
|
6551
6579
|
alva for-you list --limit 50
|
|
6552
|
-
alva for-you list --limit 20 --cursor '<endCursor>' --newer-than '<watermark>'
|
|
6580
|
+
alva for-you list --limit 20 --cursor '<endCursor>' --newer-than '<watermark>'
|
|
6581
|
+
alva for-you theses --limit 10
|
|
6582
|
+
alva for-you theses --cursor '<nextCursor>'`,
|
|
6553
6583
|
thesis: `Usage: alva thesis <subcommand> [options]
|
|
6554
6584
|
|
|
6555
|
-
Subcommands: create, get, version get, signals, set-visibility, update, close, delete, rewrite.
|
|
6585
|
+
Subcommands: asset-candidates, create, get, version get, signals, set-visibility, update, close, delete, rewrite.
|
|
6586
|
+
|
|
6587
|
+
asset-candidates --text <unsaved thesis text> reads catalog IDs and suggested
|
|
6588
|
+
directions without publishing. Use resolved entity IDs with create --entity-ids
|
|
6589
|
+
<id,id> and --entity-stances <json> to preserve the author's direction.
|
|
6590
|
+
Map each candidate.entityId to JSON entity_id and lowercase its stance:
|
|
6591
|
+
--entity-stances '[{"entity_id":"745337","stance":"bearish"}]'. Valid stances:
|
|
6592
|
+
unknown, bullish, bearish. Ask the author if a suggested direction is ambiguous.
|
|
6556
6593
|
|
|
6557
6594
|
Embedded thesis commands accept literal --body text only; file and stdin body
|
|
6558
6595
|
transports are intentionally unavailable because this runtime has no verified
|
|
@@ -6587,7 +6624,8 @@ Subcommands:
|
|
|
6587
6624
|
run: `Usage: alva run (--code <js> | --entry-path <alfs-path>) [options]
|
|
6588
6625
|
|
|
6589
6626
|
Execute JavaScript in the Jagent runtime. Local-file flags are unavailable in
|
|
6590
|
-
the embedded Agent; use ALFS paths or inline code
|
|
6627
|
+
the embedded Agent; use ALFS paths or inline code. Return values directly, not
|
|
6628
|
+
JSON.stringify(...).`,
|
|
6591
6629
|
"data-skills": `Usage: alva data-skills <subcommand>
|
|
6592
6630
|
|
|
6593
6631
|
Subcommands:
|
|
@@ -7046,6 +7084,52 @@ function validateForYouListParams(params) {
|
|
|
7046
7084
|
function isPositiveInt64(value) {
|
|
7047
7085
|
return typeof value === "string" && /^[1-9]\d{0,18}$/.test(value) && BigInt(value) <= 9223372036854775807n;
|
|
7048
7086
|
}
|
|
7087
|
+
var THESIS_RECOMMENDATION_QUERY = `
|
|
7088
|
+
query ToolkitForYouTheses($input: ThesisRecommendationInput) {
|
|
7089
|
+
viewer {
|
|
7090
|
+
thesisRecommendations(input: $input) {
|
|
7091
|
+
listId pageCursor nextCursor exhausted scanLimited
|
|
7092
|
+
pageInfo { startCursor endCursor hasNextPage hasPreviousPage }
|
|
7093
|
+
edges {
|
|
7094
|
+
cursor
|
|
7095
|
+
node {
|
|
7096
|
+
itemKey
|
|
7097
|
+
publication {
|
|
7098
|
+
thesisId playbookId authorVersionId materialVersionId itemKey
|
|
7099
|
+
title body publishedAtMs changeKind visibility
|
|
7100
|
+
closed archived note closingNote researchPaused
|
|
7101
|
+
entityIds categoryIds
|
|
7102
|
+
entityStances { entityId stance }
|
|
7103
|
+
entities { id ticker name }
|
|
7104
|
+
publisher {
|
|
7105
|
+
id displayName avatarUrl bio followersCount
|
|
7106
|
+
viewerState { following }
|
|
7107
|
+
}
|
|
7108
|
+
medias { type coverUrl url }
|
|
7109
|
+
signalFeed { id }
|
|
7110
|
+
snapshotRelease {
|
|
7111
|
+
versionId materialVersionId publishedAtMs changeKind
|
|
7112
|
+
sourceRefs {
|
|
7113
|
+
title sourceKind sourceContentId publicUrl sourceTimeMs locator
|
|
7114
|
+
}
|
|
7115
|
+
}
|
|
7116
|
+
}
|
|
7117
|
+
}
|
|
7118
|
+
}
|
|
7119
|
+
}
|
|
7120
|
+
}
|
|
7121
|
+
}
|
|
7122
|
+
`.trim();
|
|
7123
|
+
function validateForYouThesesParams(params) {
|
|
7124
|
+
if (!record(params)) throw new Error("Thesis parameters must be an object");
|
|
7125
|
+
const first = params.first === void 0 ? 10 : params.first;
|
|
7126
|
+
if (typeof first !== "number" || !Number.isInteger(first) || first < 1 || first > 10) {
|
|
7127
|
+
throw new Error("first must be an integer between 1 and 10");
|
|
7128
|
+
}
|
|
7129
|
+
if (params.after !== void 0 && (typeof params.after !== "string" || !params.after.trim())) {
|
|
7130
|
+
throw new Error("after must be a non-empty cursor");
|
|
7131
|
+
}
|
|
7132
|
+
}
|
|
7049
7133
|
|
|
7050
7134
|
// src/resources/steward.ts
|
|
7051
7135
|
var DECIDE = `
|
|
@@ -7324,11 +7408,13 @@ var COMMAND_DEFINITIONS = [
|
|
|
7324
7408
|
"body-file",
|
|
7325
7409
|
"title",
|
|
7326
7410
|
"entity-ids",
|
|
7411
|
+
"entity-stances",
|
|
7327
7412
|
"tickers",
|
|
7328
7413
|
"visibility"
|
|
7329
7414
|
],
|
|
7330
7415
|
booleans: ["body-stdin"]
|
|
7331
7416
|
}),
|
|
7417
|
+
command("thesis asset-candidates", { values: ["text"] }),
|
|
7332
7418
|
command("thesis get", { values: ["id"] }),
|
|
7333
7419
|
command("thesis version get", {
|
|
7334
7420
|
values: ["id", "author-version-id"]
|
|
@@ -7415,6 +7501,7 @@ var COMMAND_DEFINITIONS = [
|
|
|
7415
7501
|
command("for-you list", {
|
|
7416
7502
|
values: ["limit", "cursor", "newer-than", "feed-id"]
|
|
7417
7503
|
}),
|
|
7504
|
+
command("for-you theses", { values: ["limit", "cursor"] }),
|
|
7418
7505
|
command("credits items", {
|
|
7419
7506
|
values: ["last", "start", "end", "session-id", "first", "after"],
|
|
7420
7507
|
booleans: ["today"]
|
|
@@ -11479,7 +11566,7 @@ function formatTradingPairResolved(result) {
|
|
|
11479
11566
|
}
|
|
11480
11567
|
|
|
11481
11568
|
// src/cli/dispatch.ts
|
|
11482
|
-
var CLI_VERSION = true ? "0.
|
|
11569
|
+
var CLI_VERSION = true ? "0.32.0-beta.0" : "dev";
|
|
11483
11570
|
var DEFAULT_RUN_TIMEOUT_MS = 6e5;
|
|
11484
11571
|
var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
|
|
11485
11572
|
var GLOBAL_VALUE_FLAGS = Object.entries(GLOBAL_FLAG_DEFINITIONS).filter(([, kind]) => kind === "value").map(([name]) => `--${name}`);
|
|
@@ -11530,7 +11617,7 @@ Subcommands:
|
|
|
11530
11617
|
Flags:
|
|
11531
11618
|
--inbox-path <path> Steward Session Inbox (terminal CLI only)
|
|
11532
11619
|
--delivery-id <id> One delivery (decide, forward)
|
|
11533
|
-
--delivery-ids <a,b,c> Comma-separated deliveries (send
|
|
11620
|
+
--delivery-ids <a,b,c> Comma-separated deliveries (briefed; optional for send \u2014 omit for a For-You-only Brief)
|
|
11534
11621
|
--decision <immediate|digest|suppress>
|
|
11535
11622
|
--reason <text> Short audit note stored with the decision
|
|
11536
11623
|
--body <markdown> Message body (send)
|
|
@@ -11545,6 +11632,7 @@ Examples (terminal; the embedded Agent tool omits --inbox-path):
|
|
|
11545
11632
|
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%"
|
|
11546
11633
|
alva steward forward --inbox-path <inbox> --delivery-id 123
|
|
11547
11634
|
alva steward send --inbox-path <inbox> --delivery-ids 124,125 --body "Two related moves..."
|
|
11635
|
+
alva steward send --inbox-path <inbox> --body "For You: ..." # For-You-only Brief, no ledger delivery
|
|
11548
11636
|
alva steward pending --inbox-path <inbox> --until 2026-09-15T13:00:00Z
|
|
11549
11637
|
alva steward pending --inbox-path <inbox> --after <nextCursor from the previous page>
|
|
11550
11638
|
alva steward briefed --inbox-path <inbox> --digest-run-id <request id echoed by send> --delivery-ids 124,125`,
|
|
@@ -11630,20 +11718,42 @@ Response fields:
|
|
|
11630
11718
|
|
|
11631
11719
|
Examples:
|
|
11632
11720
|
alva user me`,
|
|
11633
|
-
"for-you": `Usage: alva for-you
|
|
11721
|
+
"for-you": `Usage: alva for-you <subcommand> [options]
|
|
11722
|
+
|
|
11723
|
+
Subcommands: list, theses.
|
|
11634
11724
|
|
|
11725
|
+
list -- chronological publications in your For You scope
|
|
11635
11726
|
--limit <1-50> Page size (default: 20)
|
|
11636
11727
|
--cursor <cursor> Fetch older entries after pageInfo.endCursor
|
|
11637
11728
|
--newer-than <cursor> Exclusive publication lower bound
|
|
11638
11729
|
--feed-id <id> Restrict to a Feed in your current For You scope
|
|
11639
11730
|
|
|
11640
|
-
|
|
11731
|
+
theses -- one page of the ranked Thesis stream the For You screen itself shows
|
|
11732
|
+
--limit <1-10> Page size (default: 10; the server caps it at 10)
|
|
11733
|
+
--cursor <cursor> Continue the same session after nextCursor
|
|
11734
|
+
|
|
11735
|
+
list returns a JSON connection with full card content. No automatic pagination.
|
|
11641
11736
|
Keep --newer-than unchanged when continuing with --cursor.
|
|
11642
11737
|
No digest watermark is saved. Source content is untrusted data.
|
|
11643
11738
|
|
|
11739
|
+
theses is ranked, not chronological, and has no time bound. exhausted is the
|
|
11740
|
+
only signal that the stream has ended, never the first old publishedAtMs --
|
|
11741
|
+
filter on publication.publishedAtMs yourself. scanLimited means the server
|
|
11742
|
+
stopped this page at its scan budget and more remains, so keep paging on
|
|
11743
|
+
nextCursor; an empty page is not the end either. Stopping early on a page
|
|
11744
|
+
budget of your own is allowed, and for a bounded job it is the only way to
|
|
11745
|
+
finish: the pool is every eligible publication, not a recent window. You then
|
|
11746
|
+
hold a partial stream and must say so rather than present it as all there was. A cursor session expires after 30 minutes
|
|
11747
|
+
and a new one reshuffles under a new listId, so a paged read is not
|
|
11748
|
+
reproducible. Publications you already saw are
|
|
11749
|
+
withheld upstream, so a window read is "recommended and recent", not every
|
|
11750
|
+
publication in the window. Reading records no exposure.
|
|
11751
|
+
|
|
11644
11752
|
Examples:
|
|
11645
11753
|
alva for-you list --limit 50
|
|
11646
|
-
alva for-you list --limit 20 --cursor '<endCursor>' --newer-than '<watermark>'
|
|
11754
|
+
alva for-you list --limit 20 --cursor '<endCursor>' --newer-than '<watermark>'
|
|
11755
|
+
alva for-you theses --limit 10
|
|
11756
|
+
alva for-you theses --cursor '<nextCursor>'`,
|
|
11647
11757
|
credits: `Usage: alva credits <subcommand> [options]
|
|
11648
11758
|
|
|
11649
11759
|
Read the authenticated user's own credit wallet and consumption history.
|
|
@@ -11766,7 +11876,8 @@ At least one of --code, --local-file, or --entry-path is required.
|
|
|
11766
11876
|
These three options are mutually exclusive.
|
|
11767
11877
|
|
|
11768
11878
|
Response fields:
|
|
11769
|
-
result
|
|
11879
|
+
result The script's return value. Return objects directly; a script
|
|
11880
|
+
returning JSON.stringify(x) is shown as x.
|
|
11770
11881
|
logs Captured stderr output
|
|
11771
11882
|
status "completed" or "failed"
|
|
11772
11883
|
error Error message (when status is "failed")
|
|
@@ -11788,13 +11899,14 @@ Constraints:
|
|
|
11788
11899
|
|
|
11789
11900
|
Examples:
|
|
11790
11901
|
alva run --code "1 + 2 + 3;"
|
|
11791
|
-
alva run --code "
|
|
11902
|
+
alva run --code "require('env').args;" --args '{"symbol":"BTC"}'
|
|
11792
11903
|
alva run --entry-path "~/feeds/my-feed/v1/src/index.js"
|
|
11793
11904
|
alva run --entry-path "~/tasks/analyze/src/index.js" --args '{"symbol":"NVDA","limit":50}'
|
|
11794
11905
|
alva run --local-file ./my-script.js --args '{"symbol":"BTC"}'
|
|
11795
11906
|
printf '%s' '{"symbol":"BTC"}' | alva run --local-file ./my-script.js --args-stdin
|
|
11796
11907
|
alva run --entry-path "~/tasks/heavy/src/index.js" --max-heap-size-mb 1024
|
|
11797
|
-
alva run --entry-path "~/feeds/slow/v1/src/index.js" --timeout-ms 900000
|
|
11908
|
+
alva run --entry-path "~/feeds/slow/v1/src/index.js" --timeout-ms 900000
|
|
11909
|
+
alva run --local-file ./research.js > research.json && jq -c '.result.income[:4]' research.json`,
|
|
11798
11910
|
deploy: `Usage: alva deploy <subcommand> [options]
|
|
11799
11911
|
|
|
11800
11912
|
Manage scheduled cronjobs that run your scripts on a cron schedule.
|
|
@@ -12822,7 +12934,8 @@ the backend; do not send a fresh ID. Create defaults --visibility to public.
|
|
|
12822
12934
|
Update requires --visibility explicitly so it cannot inadvertently publish.
|
|
12823
12935
|
|
|
12824
12936
|
Other flags:
|
|
12825
|
-
create --request-id <uuid> --body ... [--title <text>] [--tickers <ticker,ticker>] [--entity-ids <id,id>] [--visibility <value>]
|
|
12937
|
+
create --request-id <uuid> --body ... [--title <text>] [--tickers <ticker,ticker>] [--entity-ids <id,id>] [--entity-stances <json>] [--visibility <value>]
|
|
12938
|
+
asset-candidates --text <unsaved thesis text>
|
|
12826
12939
|
get --id <signed-int64-decimal>
|
|
12827
12940
|
version get --id <signed-int64-decimal> --author-version-id <signed-int64-decimal>
|
|
12828
12941
|
signals --id <id> [--first <1-50>] [--cursor <opaque-cursor>]
|
|
@@ -12839,7 +12952,7 @@ it must not invent factual evidence, numbers, or citations. Rewrite returns a
|
|
|
12839
12952
|
candidate only: it never creates, updates, retries, or chooses a mode from body
|
|
12840
12953
|
length or errors.
|
|
12841
12954
|
|
|
12842
|
-
IDs are decimal strings, never JavaScript numbers; provide at most
|
|
12955
|
+
IDs are decimal strings, never JavaScript numbers; provide at most 100 entity
|
|
12843
12956
|
IDs. Body text must be nonblank,
|
|
12844
12957
|
valid Unicode, and at most 65536 UTF-8 bytes; title is optional and at most
|
|
12845
12958
|
500 UTF-8 bytes. Text is passed without trimming or newline conversion.
|
|
@@ -13450,6 +13563,24 @@ function assertLocalFileAvailable(command2, flag, deps) {
|
|
|
13450
13563
|
throw localFileUnsupported(command2, flag);
|
|
13451
13564
|
}
|
|
13452
13565
|
}
|
|
13566
|
+
function decodeRunResult(result) {
|
|
13567
|
+
let value;
|
|
13568
|
+
try {
|
|
13569
|
+
value = JSON.parse(result);
|
|
13570
|
+
} catch {
|
|
13571
|
+
return result;
|
|
13572
|
+
}
|
|
13573
|
+
let inner = value;
|
|
13574
|
+
while (typeof inner === "string") {
|
|
13575
|
+
try {
|
|
13576
|
+
inner = JSON.parse(inner);
|
|
13577
|
+
} catch {
|
|
13578
|
+
break;
|
|
13579
|
+
}
|
|
13580
|
+
if (inner !== null && typeof inner === "object") return inner;
|
|
13581
|
+
}
|
|
13582
|
+
return value;
|
|
13583
|
+
}
|
|
13453
13584
|
function readLocalTextFile(path, command2, flag, deps) {
|
|
13454
13585
|
assertLocalFileAvailable(command2, flag, deps);
|
|
13455
13586
|
if (!deps?.localFiles) {
|
|
@@ -13513,6 +13644,19 @@ function thesisTickers(flags) {
|
|
|
13513
13644
|
}
|
|
13514
13645
|
return tickers;
|
|
13515
13646
|
}
|
|
13647
|
+
function thesisEntityStances(flags) {
|
|
13648
|
+
const raw = flags["entity-stances"];
|
|
13649
|
+
if (raw === void 0) return void 0;
|
|
13650
|
+
let parsed;
|
|
13651
|
+
try {
|
|
13652
|
+
parsed = JSON.parse(raw);
|
|
13653
|
+
} catch {
|
|
13654
|
+
throw new CliUsageError("--entity-stances must be a JSON array", "thesis");
|
|
13655
|
+
}
|
|
13656
|
+
if (!Array.isArray(parsed))
|
|
13657
|
+
throw new CliUsageError("--entity-stances must be a JSON array", "thesis");
|
|
13658
|
+
return parsed;
|
|
13659
|
+
}
|
|
13516
13660
|
function strictThesisUTF8(value, command2, flag) {
|
|
13517
13661
|
const bytes = toByteView(value);
|
|
13518
13662
|
if (bytes === void 0) {
|
|
@@ -13834,7 +13978,8 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
13834
13978
|
);
|
|
13835
13979
|
}
|
|
13836
13980
|
}
|
|
13837
|
-
|
|
13981
|
+
const response = serializedArgs === void 0 ? await client.run.execute(params) : await client.run._executeSerializedArgs(params, serializedArgs);
|
|
13982
|
+
return { ...response, result: decodeRunResult(response.result) };
|
|
13838
13983
|
}
|
|
13839
13984
|
case "deploy": {
|
|
13840
13985
|
if (!subcommand)
|
|
@@ -14020,7 +14165,12 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
14020
14165
|
"inbox-path",
|
|
14021
14166
|
`steward ${subcommand}`
|
|
14022
14167
|
);
|
|
14023
|
-
const
|
|
14168
|
+
const splitIds = (raw) => raw.split(",").map((value) => value.trim()).filter((value) => value !== "");
|
|
14169
|
+
const ids = (name) => splitIds(requireFlag(flags, name, `steward ${subcommand}`));
|
|
14170
|
+
const optionalIds = (name) => {
|
|
14171
|
+
const raw = flags[name];
|
|
14172
|
+
return raw === void 0 ? [] : splitIds(raw);
|
|
14173
|
+
};
|
|
14024
14174
|
switch (subcommand) {
|
|
14025
14175
|
case "decide":
|
|
14026
14176
|
return client.steward.decide({
|
|
@@ -14041,7 +14191,7 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
14041
14191
|
return client.steward.send({
|
|
14042
14192
|
inboxPath,
|
|
14043
14193
|
body: requireFlag(flags, "body", "steward send"),
|
|
14044
|
-
deliveryIds:
|
|
14194
|
+
deliveryIds: optionalIds("delivery-ids"),
|
|
14045
14195
|
requestId: flags["request-id"]
|
|
14046
14196
|
});
|
|
14047
14197
|
case "pending": {
|
|
@@ -14090,9 +14240,14 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
14090
14240
|
body: await thesisBodyFromFlags(flags, "thesis create", deps),
|
|
14091
14241
|
title: flags.title ?? "",
|
|
14092
14242
|
entity_ids: thesisEntityIDs(flags),
|
|
14243
|
+
entity_stances: thesisEntityStances(flags),
|
|
14093
14244
|
tickers: thesisTickers(flags),
|
|
14094
14245
|
visibility: flags.visibility === void 0 ? "public" : thesisVisibility(flags.visibility)
|
|
14095
14246
|
});
|
|
14247
|
+
case "asset-candidates":
|
|
14248
|
+
return client.theses.assetCandidates(
|
|
14249
|
+
requireFlag(flags, "text", "thesis asset-candidates")
|
|
14250
|
+
);
|
|
14096
14251
|
case "get":
|
|
14097
14252
|
return client.theses.get(requireFlag(flags, "id", "thesis get"));
|
|
14098
14253
|
case "version":
|
|
@@ -14313,8 +14468,32 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
14313
14468
|
}
|
|
14314
14469
|
}
|
|
14315
14470
|
case "for-you": {
|
|
14471
|
+
if (subcommand === "theses") {
|
|
14472
|
+
const params2 = {
|
|
14473
|
+
first: optionalBoundedIntegerFlag(
|
|
14474
|
+
flags,
|
|
14475
|
+
"limit",
|
|
14476
|
+
"for-you theses",
|
|
14477
|
+
1,
|
|
14478
|
+
10
|
|
14479
|
+
),
|
|
14480
|
+
after: flags.cursor
|
|
14481
|
+
};
|
|
14482
|
+
try {
|
|
14483
|
+
validateForYouThesesParams(params2);
|
|
14484
|
+
} catch (error) {
|
|
14485
|
+
throw new CliUsageError(
|
|
14486
|
+
error instanceof Error ? error.message : String(error),
|
|
14487
|
+
"for-you"
|
|
14488
|
+
);
|
|
14489
|
+
}
|
|
14490
|
+
return client.forYou.theses(params2);
|
|
14491
|
+
}
|
|
14316
14492
|
if (subcommand !== "list") {
|
|
14317
|
-
throw new CliUsageError(
|
|
14493
|
+
throw new CliUsageError(
|
|
14494
|
+
"Expected for-you list or for-you theses",
|
|
14495
|
+
"for-you"
|
|
14496
|
+
);
|
|
14318
14497
|
}
|
|
14319
14498
|
const params = {
|
|
14320
14499
|
first: optionalBoundedIntegerFlag(
|