@alva-ai/toolkit 0.15.1-beta.0 → 0.16.1-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/dist/browser.global.js +2 -2
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.d.ts +74 -0
- package/dist/cli.js +269 -32
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +129 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +75 -1
- package/dist/index.d.ts +75 -1
- package/dist/index.js +129 -24
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.d.ts
CHANGED
|
@@ -194,6 +194,13 @@ interface CronjobCreateRequest {
|
|
|
194
194
|
* A string: SA ids are snowflake int64s that overflow JS number precision.
|
|
195
195
|
*/
|
|
196
196
|
run_as_user_id?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Lifetime ceiling (RFC3339 timestamp). Once now >= end_at the runner
|
|
199
|
+
* self-terminates the cronjob before running (backend#1799). Omitted ⇒ no
|
|
200
|
+
* expiry. The `alva loop create` sugar sets this to now + (expires_in ?? 7d);
|
|
201
|
+
* feeds and other crons leave it unset.
|
|
202
|
+
*/
|
|
203
|
+
end_at?: string;
|
|
197
204
|
}
|
|
198
205
|
interface Cronjob {
|
|
199
206
|
id: number;
|
|
@@ -210,6 +217,11 @@ interface Cronjob {
|
|
|
210
217
|
* A string: snowflake int64 ids overflow JS number precision.
|
|
211
218
|
*/
|
|
212
219
|
run_as_user_id: string;
|
|
220
|
+
/**
|
|
221
|
+
* Lifetime ceiling (RFC3339), or null/omitted when the cronjob has no expiry.
|
|
222
|
+
* Set by `alva loop create`; unset for feeds and other crons.
|
|
223
|
+
*/
|
|
224
|
+
end_at?: string | null;
|
|
213
225
|
created_at: string;
|
|
214
226
|
updated_at: string;
|
|
215
227
|
}
|
|
@@ -371,6 +383,20 @@ interface FeedDeleteResponse {
|
|
|
371
383
|
/** Echoed feed id (string form, matching gateway response). */
|
|
372
384
|
id: string;
|
|
373
385
|
}
|
|
386
|
+
/** Feed visibility: 'public' publishes the feed, 'private' unpublishes it. */
|
|
387
|
+
type FeedVisibility = 'public' | 'private';
|
|
388
|
+
interface FeedSetVisibilityRequest {
|
|
389
|
+
/** Numeric feed id to publish/unpublish. */
|
|
390
|
+
id: number;
|
|
391
|
+
/** Target visibility. */
|
|
392
|
+
visibility: FeedVisibility;
|
|
393
|
+
}
|
|
394
|
+
interface FeedSetVisibilityResponse {
|
|
395
|
+
/** Echoed feed id (string form, matching gateway response). */
|
|
396
|
+
id: string;
|
|
397
|
+
/** Feed visibility after the update. */
|
|
398
|
+
visibility: FeedVisibility;
|
|
399
|
+
}
|
|
374
400
|
interface PlaybookDraftRequest {
|
|
375
401
|
name: string;
|
|
376
402
|
display_name: string;
|
|
@@ -917,6 +943,33 @@ interface ChannelGroupSubscriptionMutationResponse {
|
|
|
917
943
|
admin: ChannelGroupAdminInfo | null;
|
|
918
944
|
subscriptions: ChannelGroupSubscription[];
|
|
919
945
|
}
|
|
946
|
+
/** Params for reading a group's buffered chat history (group-chat digest). */
|
|
947
|
+
interface ChannelGroupHistoryParams {
|
|
948
|
+
/** Platform: "telegram" | "discord" | "slack". */
|
|
949
|
+
channel: string;
|
|
950
|
+
/** Platform group/channel id. */
|
|
951
|
+
remote_chat_id: string;
|
|
952
|
+
/** Window start, message-origin timestamp in microseconds (inclusive). */
|
|
953
|
+
from_micros: number | string;
|
|
954
|
+
/** Window end, message-origin timestamp in microseconds (inclusive). */
|
|
955
|
+
to_micros: number | string;
|
|
956
|
+
}
|
|
957
|
+
/** One buffered group message, projected for the digest. */
|
|
958
|
+
interface GroupChatMessage {
|
|
959
|
+
sender_username: string;
|
|
960
|
+
content: string;
|
|
961
|
+
/** "[photo]" etc. when the message carried media. */
|
|
962
|
+
media_summary: string;
|
|
963
|
+
ts_micros: number;
|
|
964
|
+
/** Deep link back to the original message; empty when unavailable. */
|
|
965
|
+
permalink: string;
|
|
966
|
+
/** "user" | "assistant" (bot replies). */
|
|
967
|
+
role: string;
|
|
968
|
+
}
|
|
969
|
+
interface ChannelGroupHistoryResponse {
|
|
970
|
+
/** Chronological (ts ascending). */
|
|
971
|
+
messages: GroupChatMessage[];
|
|
972
|
+
}
|
|
920
973
|
interface ServiceAccount {
|
|
921
974
|
id: string;
|
|
922
975
|
display_name: string;
|
|
@@ -1071,6 +1124,18 @@ declare class FeedResource {
|
|
|
1071
1124
|
* Auth: caller must own the feed (uid match), enforced by the backend.
|
|
1072
1125
|
*/
|
|
1073
1126
|
delete(params: FeedDeleteRequest): Promise<FeedDeleteResponse>;
|
|
1127
|
+
/**
|
|
1128
|
+
* Publish or unpublish a feed. Backed by POST /api/v1/feed/:id/visibility.
|
|
1129
|
+
*
|
|
1130
|
+
* Setting visibility to 'public' publishes the feed (the backend sets
|
|
1131
|
+
* feeds.is_public and projects the ALFS public read grant in the same
|
|
1132
|
+
* transaction); 'private' unpublishes it. Prefer this over granting the
|
|
1133
|
+
* ALFS public read subject directly (e.g. `alva fs grant`), which bypasses
|
|
1134
|
+
* the is_public flag and causes drift.
|
|
1135
|
+
*
|
|
1136
|
+
* Auth: caller must own the feed (uid match), enforced by the backend.
|
|
1137
|
+
*/
|
|
1138
|
+
setVisibility(params: FeedSetVisibilityRequest): Promise<FeedSetVisibilityResponse>;
|
|
1074
1139
|
}
|
|
1075
1140
|
|
|
1076
1141
|
/**
|
|
@@ -1553,6 +1618,7 @@ declare class AlertsResource {
|
|
|
1553
1618
|
private client;
|
|
1554
1619
|
constructor(client: AlvaClient);
|
|
1555
1620
|
list(params?: PushSubscriptionListParams): Promise<PushSubscriptionListResponse>;
|
|
1621
|
+
follows(params?: FollowsListParams): Promise<FollowsListResponse>;
|
|
1556
1622
|
enableAutomation(params: PushSubscriptionFeedParams): Promise<SubscribeFeedResponse>;
|
|
1557
1623
|
disableAutomation(params: PushSubscriptionFeedParams): Promise<UnsubscribeResponse>;
|
|
1558
1624
|
enablePlaybook(params: PushSubscriptionPlaybookParams): Promise<SubscribePlaybookResponse>;
|
|
@@ -1578,6 +1644,14 @@ declare class ChannelGroupSubscriptionsResource {
|
|
|
1578
1644
|
list(params: ChannelGroupSubscriptionSessionParams): Promise<ChannelGroupSubscriptionListResponse>;
|
|
1579
1645
|
subscribe(params: ChannelGroupSubscriptionMutationParams): Promise<ChannelGroupSubscriptionMutationResponse>;
|
|
1580
1646
|
unsubscribe(params: ChannelGroupSubscriptionMutationParams): Promise<ChannelGroupSubscriptionMutationResponse>;
|
|
1647
|
+
/**
|
|
1648
|
+
* Read a group's buffered chat messages in a time window, for the group-chat
|
|
1649
|
+
* digest automation. Admin-gated: the authenticated caller must be that
|
|
1650
|
+
* group's Alva admin (a digest feed runs as that admin). Each message carries
|
|
1651
|
+
* a `permalink` deep-link back to the original message for "jump to original".
|
|
1652
|
+
* `from_micros`/`to_micros` are message-origin timestamps in microseconds.
|
|
1653
|
+
*/
|
|
1654
|
+
getGroupChatHistory(params: ChannelGroupHistoryParams): Promise<ChannelGroupHistoryResponse>;
|
|
1581
1655
|
}
|
|
1582
1656
|
|
|
1583
1657
|
declare class FeedbackResource {
|
package/dist/cli.js
CHANGED
|
@@ -9704,7 +9704,8 @@ var DeployResource = class {
|
|
|
9704
9704
|
args: params.args,
|
|
9705
9705
|
push_notify: params.push_notify,
|
|
9706
9706
|
max_heap_size_mb: params.max_heap_size_mb,
|
|
9707
|
-
run_as_user_id: params.run_as_user_id
|
|
9707
|
+
run_as_user_id: params.run_as_user_id,
|
|
9708
|
+
end_at: params.end_at
|
|
9708
9709
|
}
|
|
9709
9710
|
});
|
|
9710
9711
|
}
|
|
@@ -9938,6 +9939,29 @@ var FeedResource = class {
|
|
|
9938
9939
|
`/api/v1/feed/${encodeURIComponent(String(id))}`
|
|
9939
9940
|
);
|
|
9940
9941
|
}
|
|
9942
|
+
/**
|
|
9943
|
+
* Publish or unpublish a feed. Backed by POST /api/v1/feed/:id/visibility.
|
|
9944
|
+
*
|
|
9945
|
+
* Setting visibility to 'public' publishes the feed (the backend sets
|
|
9946
|
+
* feeds.is_public and projects the ALFS public read grant in the same
|
|
9947
|
+
* transaction); 'private' unpublishes it. Prefer this over granting the
|
|
9948
|
+
* ALFS public read subject directly (e.g. `alva fs grant`), which bypasses
|
|
9949
|
+
* the is_public flag and causes drift.
|
|
9950
|
+
*
|
|
9951
|
+
* Auth: caller must own the feed (uid match), enforced by the backend.
|
|
9952
|
+
*/
|
|
9953
|
+
async setVisibility(params) {
|
|
9954
|
+
this.client._requireAuth();
|
|
9955
|
+
const id = requireFeedID(params.id);
|
|
9956
|
+
if (params.visibility !== "public" && params.visibility !== "private") {
|
|
9957
|
+
throw new Error("visibility must be 'public' or 'private'");
|
|
9958
|
+
}
|
|
9959
|
+
return this.client._request(
|
|
9960
|
+
"POST",
|
|
9961
|
+
`/api/v1/feed/${encodeURIComponent(String(id))}/visibility`,
|
|
9962
|
+
{ body: { visibility: params.visibility } }
|
|
9963
|
+
);
|
|
9964
|
+
}
|
|
9941
9965
|
};
|
|
9942
9966
|
function requireFeedID(id) {
|
|
9943
9967
|
if (!Number.isInteger(id) || id <= 0) {
|
|
@@ -10238,16 +10262,6 @@ var SKILL_ENDPOINT_METADATA = [
|
|
|
10238
10262
|
access: "free_and_pro",
|
|
10239
10263
|
pro_required: false
|
|
10240
10264
|
},
|
|
10241
|
-
{
|
|
10242
|
-
skill: "arrays-data-api-spot-market-price-and-volume",
|
|
10243
|
-
file: "crypto-detail",
|
|
10244
|
-
method: "GET",
|
|
10245
|
-
path: "/api/v1/crypto/detail",
|
|
10246
|
-
tier: "public",
|
|
10247
|
-
required_subscription_tier: "free",
|
|
10248
|
-
access: "free_and_pro",
|
|
10249
|
-
pro_required: false
|
|
10250
|
-
},
|
|
10251
10265
|
{
|
|
10252
10266
|
skill: "arrays-data-api-crypto-metrics-and-screener",
|
|
10253
10267
|
file: "fear-greed-index",
|
|
@@ -10288,16 +10302,6 @@ var SKILL_ENDPOINT_METADATA = [
|
|
|
10288
10302
|
access: "free_and_pro",
|
|
10289
10303
|
pro_required: false
|
|
10290
10304
|
},
|
|
10291
|
-
{
|
|
10292
|
-
skill: "arrays-data-api-crypto-metrics-and-screener",
|
|
10293
|
-
file: "list",
|
|
10294
|
-
method: "GET",
|
|
10295
|
-
path: "/api/v1/crypto/list",
|
|
10296
|
-
tier: "public",
|
|
10297
|
-
required_subscription_tier: "free",
|
|
10298
|
-
access: "free_and_pro",
|
|
10299
|
-
pro_required: false
|
|
10300
|
-
},
|
|
10301
10305
|
{
|
|
10302
10306
|
skill: "arrays-data-api-crypto-futures-data",
|
|
10303
10307
|
file: "long-short-ratio",
|
|
@@ -10360,9 +10364,9 @@ var SKILL_ENDPOINT_METADATA = [
|
|
|
10360
10364
|
},
|
|
10361
10365
|
{
|
|
10362
10366
|
skill: "arrays-data-api-crypto-metrics-and-screener",
|
|
10363
|
-
file: "
|
|
10367
|
+
file: "crypto-detail",
|
|
10364
10368
|
method: "GET",
|
|
10365
|
-
path: "/api/v1/crypto/
|
|
10369
|
+
path: "/api/v1/crypto/detail",
|
|
10366
10370
|
tier: "public",
|
|
10367
10371
|
required_subscription_tier: "free",
|
|
10368
10372
|
access: "free_and_pro",
|
|
@@ -10968,6 +10972,26 @@ var SKILL_ENDPOINT_METADATA = [
|
|
|
10968
10972
|
access: "pro_only",
|
|
10969
10973
|
pro_required: true
|
|
10970
10974
|
},
|
|
10975
|
+
{
|
|
10976
|
+
skill: "arrays-data-api-options",
|
|
10977
|
+
file: "greeks",
|
|
10978
|
+
method: "GET",
|
|
10979
|
+
path: "/api/v1/options/greeks",
|
|
10980
|
+
tier: "alternative",
|
|
10981
|
+
required_subscription_tier: "pro",
|
|
10982
|
+
access: "pro_only",
|
|
10983
|
+
pro_required: true
|
|
10984
|
+
},
|
|
10985
|
+
{
|
|
10986
|
+
skill: "arrays-data-api-options",
|
|
10987
|
+
file: "chain",
|
|
10988
|
+
method: "GET",
|
|
10989
|
+
path: "/api/v1/options/chain",
|
|
10990
|
+
tier: "alternative",
|
|
10991
|
+
required_subscription_tier: "pro",
|
|
10992
|
+
access: "pro_only",
|
|
10993
|
+
pro_required: true
|
|
10994
|
+
},
|
|
10971
10995
|
{
|
|
10972
10996
|
skill: "arrays-data-api-equity-fundamentals",
|
|
10973
10997
|
file: "company-executives",
|
|
@@ -11331,6 +11355,66 @@ var SKILL_ENDPOINT_METADATA = [
|
|
|
11331
11355
|
required_subscription_tier: "free",
|
|
11332
11356
|
access: "free_and_pro",
|
|
11333
11357
|
pro_required: false
|
|
11358
|
+
},
|
|
11359
|
+
{
|
|
11360
|
+
skill: "arrays-data-api-semiconductor-price",
|
|
11361
|
+
file: "dram-spot-price",
|
|
11362
|
+
method: "GET",
|
|
11363
|
+
path: "/api/v1/other/semiconductor/dram-spot-price",
|
|
11364
|
+
tier: "alternative",
|
|
11365
|
+
required_subscription_tier: "pro",
|
|
11366
|
+
access: "pro_only",
|
|
11367
|
+
pro_required: true
|
|
11368
|
+
},
|
|
11369
|
+
{
|
|
11370
|
+
skill: "arrays-data-api-semiconductor-price",
|
|
11371
|
+
file: "dram-contract-price",
|
|
11372
|
+
method: "GET",
|
|
11373
|
+
path: "/api/v1/other/semiconductor/dram-contract-price",
|
|
11374
|
+
tier: "alternative",
|
|
11375
|
+
required_subscription_tier: "pro",
|
|
11376
|
+
access: "pro_only",
|
|
11377
|
+
pro_required: true
|
|
11378
|
+
},
|
|
11379
|
+
{
|
|
11380
|
+
skill: "arrays-data-api-semiconductor-price",
|
|
11381
|
+
file: "nand-flash-spot-price",
|
|
11382
|
+
method: "GET",
|
|
11383
|
+
path: "/api/v1/other/semiconductor/nand-flash-spot-price",
|
|
11384
|
+
tier: "alternative",
|
|
11385
|
+
required_subscription_tier: "pro",
|
|
11386
|
+
access: "pro_only",
|
|
11387
|
+
pro_required: true
|
|
11388
|
+
},
|
|
11389
|
+
{
|
|
11390
|
+
skill: "arrays-data-api-semiconductor-price",
|
|
11391
|
+
file: "nand-flash-contract-price",
|
|
11392
|
+
method: "GET",
|
|
11393
|
+
path: "/api/v1/other/semiconductor/nand-flash-contract-price",
|
|
11394
|
+
tier: "alternative",
|
|
11395
|
+
required_subscription_tier: "pro",
|
|
11396
|
+
access: "pro_only",
|
|
11397
|
+
pro_required: true
|
|
11398
|
+
},
|
|
11399
|
+
{
|
|
11400
|
+
skill: "arrays-data-api-semiconductor-price",
|
|
11401
|
+
file: "memory-card-price",
|
|
11402
|
+
method: "GET",
|
|
11403
|
+
path: "/api/v1/other/semiconductor/memory-card-price",
|
|
11404
|
+
tier: "alternative",
|
|
11405
|
+
required_subscription_tier: "pro",
|
|
11406
|
+
access: "pro_only",
|
|
11407
|
+
pro_required: true
|
|
11408
|
+
},
|
|
11409
|
+
{
|
|
11410
|
+
skill: "arrays-data-api-semiconductor-price",
|
|
11411
|
+
file: "dxi-index",
|
|
11412
|
+
method: "GET",
|
|
11413
|
+
path: "/api/v1/other/semiconductor/dxi-index",
|
|
11414
|
+
tier: "alternative",
|
|
11415
|
+
required_subscription_tier: "pro",
|
|
11416
|
+
access: "pro_only",
|
|
11417
|
+
pro_required: true
|
|
11334
11418
|
}
|
|
11335
11419
|
];
|
|
11336
11420
|
function getSkillEndpointMetadata(skill, file) {
|
|
@@ -11909,6 +11993,9 @@ var AlertsResource = class {
|
|
|
11909
11993
|
list(params = {}) {
|
|
11910
11994
|
return this.client.subscriptions.list(params);
|
|
11911
11995
|
}
|
|
11996
|
+
follows(params = {}) {
|
|
11997
|
+
return this.client.subscriptions.follows(params);
|
|
11998
|
+
}
|
|
11912
11999
|
enableAutomation(params) {
|
|
11913
12000
|
return this.client.subscriptions.subscribeFeed(params);
|
|
11914
12001
|
}
|
|
@@ -11976,6 +12063,24 @@ var ChannelGroupSubscriptionsResource = class {
|
|
|
11976
12063
|
}
|
|
11977
12064
|
);
|
|
11978
12065
|
}
|
|
12066
|
+
/**
|
|
12067
|
+
* Read a group's buffered chat messages in a time window, for the group-chat
|
|
12068
|
+
* digest automation. Admin-gated: the authenticated caller must be that
|
|
12069
|
+
* group's Alva admin (a digest feed runs as that admin). Each message carries
|
|
12070
|
+
* a `permalink` deep-link back to the original message for "jump to original".
|
|
12071
|
+
* `from_micros`/`to_micros` are message-origin timestamps in microseconds.
|
|
12072
|
+
*/
|
|
12073
|
+
async getGroupChatHistory(params) {
|
|
12074
|
+
this.client._requireAuth();
|
|
12075
|
+
return this.client._request("GET", "/api/v1/channel/group-history", {
|
|
12076
|
+
query: {
|
|
12077
|
+
channel: params.channel,
|
|
12078
|
+
remote_chat_id: params.remote_chat_id,
|
|
12079
|
+
from_micros: String(params.from_micros),
|
|
12080
|
+
to_micros: String(params.to_micros)
|
|
12081
|
+
}
|
|
12082
|
+
});
|
|
12083
|
+
}
|
|
11979
12084
|
};
|
|
11980
12085
|
function mutationBody(params) {
|
|
11981
12086
|
return `{"session_id":${idLiteral(params.session_id)},"target_type":${JSON.stringify(params.target_type)},"target_id":${idLiteral(params.target_id)}}`;
|
|
@@ -13546,7 +13651,7 @@ import * as fs2 from "fs";
|
|
|
13546
13651
|
import * as os2 from "os";
|
|
13547
13652
|
import * as fsPromises2 from "fs/promises";
|
|
13548
13653
|
import { Agent, setGlobalDispatcher } from "undici";
|
|
13549
|
-
var CLI_VERSION = true ? "0.
|
|
13654
|
+
var CLI_VERSION = true ? "0.16.1-beta.0" : "dev";
|
|
13550
13655
|
var DEFAULT_RUN_TIMEOUT_MS = 6e5;
|
|
13551
13656
|
var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
|
|
13552
13657
|
var configuredRunFetchTimeoutMs;
|
|
@@ -13576,12 +13681,13 @@ Commands:
|
|
|
13576
13681
|
fs Filesystem operations (read, write, stat, readdir, mkdir, remove, rename, copy, symlink, readlink, chmod, grant, revoke)
|
|
13577
13682
|
run Execute code in the Alva runtime
|
|
13578
13683
|
deploy Cronjob management (create, list, get, update, delete, pause, resume, runs, run-logs)
|
|
13684
|
+
loop Self-scheduled in-channel goal loops (create)
|
|
13579
13685
|
service-account Restricted run-as identities (create, list, delete, grant, revoke)
|
|
13580
13686
|
release Feed and playbook releases (feed, playbook-draft, playbook)
|
|
13581
13687
|
lint Design-system lint (playbook)
|
|
13582
13688
|
automation Automation management (list, inspect, publish, stop, resume, delete)
|
|
13583
|
-
alert Alert management (list, enable, disable, history, preferences, enable-session-completed, disable-session-completed)
|
|
13584
|
-
feed Legacy automation alias (list, stop, resume, delete)
|
|
13689
|
+
alert Alert management (list, follows, enable, disable, history, preferences, enable-session-completed, disable-session-completed)
|
|
13690
|
+
feed Legacy automation alias (list, stop, resume, delete, set-visibility)
|
|
13585
13691
|
playbooks Playbook discovery (trending, get, list) and visibility
|
|
13586
13692
|
functions Playbook UDF function management (register, list, delete, invoke, allowance)
|
|
13587
13693
|
credits Credit wallet and self-scoped usage history (wallet, items)
|
|
@@ -13598,6 +13704,7 @@ Commands:
|
|
|
13598
13704
|
remix Save playbook remix lineage
|
|
13599
13705
|
portfolio Connected-account portfolio (accounts, summary, activities)
|
|
13600
13706
|
trading Trading operations (accounts, portfolio, orders, subscriptions, equity-history, risk-rules, subscribe, unsubscribe, execute, update-risk-rules)
|
|
13707
|
+
broker Agentic order execution \u2014 venue-native passthrough to trex (accounts, quote, order, balance, positions, ...; run 'alva broker describe')
|
|
13601
13708
|
auth Authentication (login)
|
|
13602
13709
|
screenshot Capture a web screenshot as PNG
|
|
13603
13710
|
arrays Arrays backend operations (token ensure, token status)
|
|
@@ -13919,6 +14026,30 @@ Build-time verify (fire once, then poll until your run completes):
|
|
|
13919
14026
|
STATUS=$(echo "$ROW" | jq -r .status)
|
|
13920
14027
|
[ "$STATUS" = completed ] || alva deploy run-logs --id 42 \\
|
|
13921
14028
|
--run-id "$(echo "$ROW" | jq -r .id)"`,
|
|
14029
|
+
loop: `Usage: alva loop <subcommand> [options]
|
|
14030
|
+
|
|
14031
|
+
Create a self-scheduled, in-channel goal loop: a cronjob that each tick runs
|
|
14032
|
+
one fire-and-forget agent turn on a channel's stable main session (via the
|
|
14033
|
+
@alva/loop SDK), continuing that channel's conversation toward a goal. Every
|
|
14034
|
+
loop gets a lifetime ceiling (default 7 days) so a self-scheduled loop always
|
|
14035
|
+
terminates. Sugar over 'alva deploy create' \u2014 it seeds a shared loop-runner
|
|
14036
|
+
script and packs the goal/channel into the cronjob's args.
|
|
14037
|
+
|
|
14038
|
+
Subcommands:
|
|
14039
|
+
create Create a loop (seeds the shared loop-runner + a cronjob)
|
|
14040
|
+
|
|
14041
|
+
Create flags:
|
|
14042
|
+
--goal <text> Instruction run each tick (required)
|
|
14043
|
+
--cron <expression> Cron schedule (required, e.g. "0 * * * *")
|
|
14044
|
+
--channel-id <id> Target channel id. Omit \u21D2 your DM/agent channel
|
|
14045
|
+
--expires-in <dur> Lifetime: 30m | 24h | 7d, or 'never' (unbounded \u2014
|
|
14046
|
+
discouraged). Default: 7d
|
|
14047
|
+
--name <name> Cronjob name (default: derived from --goal;
|
|
14048
|
+
1-63 lowercase alphanumeric/hyphens)
|
|
14049
|
+
|
|
14050
|
+
Examples:
|
|
14051
|
+
alva loop create --channel-id 7284... --goal "watch NVDA pre-market, alert on setup" --cron "0 * * * *"
|
|
14052
|
+
alva loop create --goal "summarize my unread channels" --cron "0 8 * * *" --expires-in 30d`,
|
|
13922
14053
|
"service-account": `Usage: alva service-account <subcommand> [options]
|
|
13923
14054
|
|
|
13924
14055
|
Manage restricted run-as identities. A service account executes a UDF or
|
|
@@ -13987,6 +14118,7 @@ playbooks. Delivery history and global alert preferences live here too.
|
|
|
13987
14118
|
|
|
13988
14119
|
Subcommands:
|
|
13989
14120
|
list List the caller's active alerts
|
|
14121
|
+
follows List the playbooks the caller follows
|
|
13990
14122
|
enable Enable an alert for an automation or playbook
|
|
13991
14123
|
disable Disable alerts by automation/playbook name or id
|
|
13992
14124
|
history List alert delivery history for an automation or playbook
|
|
@@ -14008,6 +14140,10 @@ List flags:
|
|
|
14008
14140
|
--cursor <token> Optional cursor from previous response
|
|
14009
14141
|
--json Print raw JSON instead of a human-readable summary
|
|
14010
14142
|
|
|
14143
|
+
Follows flags:
|
|
14144
|
+
--limit <n> Optional page size
|
|
14145
|
+
--cursor <token> Optional cursor from previous response
|
|
14146
|
+
|
|
14011
14147
|
History flags:
|
|
14012
14148
|
--channel <name> Optional delivery channel filter
|
|
14013
14149
|
--status <status> Optional status filter (sent, failed, filtered)
|
|
@@ -14015,6 +14151,7 @@ History flags:
|
|
|
14015
14151
|
|
|
14016
14152
|
Examples:
|
|
14017
14153
|
alva alert list
|
|
14154
|
+
alva alert follows --limit 20
|
|
14018
14155
|
alva alert enable --automation alice/btc-ema
|
|
14019
14156
|
alva alert disable --automation alice/btc-ema
|
|
14020
14157
|
alva alert enable --playbook alice/btc-dashboard
|
|
@@ -14027,13 +14164,15 @@ Examples:
|
|
|
14027
14164
|
Legacy alias for automation lifecycle management. Prefer "alva automation".
|
|
14028
14165
|
|
|
14029
14166
|
Subcommands:
|
|
14030
|
-
list
|
|
14031
|
-
stop
|
|
14032
|
-
resume
|
|
14033
|
-
delete
|
|
14167
|
+
list List feeds owned by the caller
|
|
14168
|
+
stop Stop a feed's producer cronjob
|
|
14169
|
+
resume Resume a stopped feed's producer cronjob
|
|
14170
|
+
delete Soft-delete a feed and all its active majors
|
|
14171
|
+
set-visibility Publish or unpublish a feed (--visibility public|private)
|
|
14034
14172
|
|
|
14035
14173
|
Flags:
|
|
14036
|
-
--id <feed_id>
|
|
14174
|
+
--id <feed_id> Numeric feed id (required for stop/resume/delete/set-visibility)
|
|
14175
|
+
--visibility <level> public | private (required for set-visibility)
|
|
14037
14176
|
|
|
14038
14177
|
List flags:
|
|
14039
14178
|
--limit <n> Max results per page (default 50, max 100 server-side)
|
|
@@ -14047,6 +14186,10 @@ Notes:
|
|
|
14047
14186
|
- delete cascades to all active feed_majors in the same DB transaction.
|
|
14048
14187
|
- delete removes producer cronjobs best-effort; the cronjob scavenger
|
|
14049
14188
|
reconciles any leftover rows on its next sweep.
|
|
14189
|
+
- set-visibility publishes (public) or unpublishes (private) a feed; the
|
|
14190
|
+
backend sets feeds.is_public and projects the ALFS public read grant
|
|
14191
|
+
together. Prefer this over "alva fs grant" on the feed path, which causes
|
|
14192
|
+
drift.
|
|
14050
14193
|
- Auth: caller must own the feed (uid match), enforced by the backend.
|
|
14051
14194
|
|
|
14052
14195
|
Examples:
|
|
@@ -14054,7 +14197,9 @@ Examples:
|
|
|
14054
14197
|
alva feed list --status all --limit 20
|
|
14055
14198
|
alva feed stop --id 42
|
|
14056
14199
|
alva feed resume --id 42
|
|
14057
|
-
alva feed delete --id 42
|
|
14200
|
+
alva feed delete --id 42
|
|
14201
|
+
alva feed set-visibility --id 42 --visibility public
|
|
14202
|
+
alva feed set-visibility --id 42 --visibility private`,
|
|
14058
14203
|
playbooks: `Usage: alva playbooks <subcommand> [options]
|
|
14059
14204
|
|
|
14060
14205
|
Find and resolve playbooks with an agent-friendly response shape.
|
|
@@ -14988,6 +15133,16 @@ function playbookVisibility(val) {
|
|
|
14988
15133
|
"playbooks"
|
|
14989
15134
|
);
|
|
14990
15135
|
}
|
|
15136
|
+
function feedVisibility(val) {
|
|
15137
|
+
const normalized = val.trim().toLowerCase();
|
|
15138
|
+
if (normalized === "public" || normalized === "private") {
|
|
15139
|
+
return normalized;
|
|
15140
|
+
}
|
|
15141
|
+
throw new CliUsageError(
|
|
15142
|
+
`--visibility must be one of public, private for 'feed set-visibility', got '${val}'`,
|
|
15143
|
+
"feed"
|
|
15144
|
+
);
|
|
15145
|
+
}
|
|
14991
15146
|
function parseCreditsTimestamp(value, flag, command) {
|
|
14992
15147
|
const trimmed = value.trim();
|
|
14993
15148
|
if (/^\d+$/.test(trimmed)) {
|
|
@@ -15024,6 +15179,40 @@ function parseCreditsDurationMs(value) {
|
|
|
15024
15179
|
}
|
|
15025
15180
|
return durationMs;
|
|
15026
15181
|
}
|
|
15182
|
+
var LOOP_RUNNER_PATH = "~/loops/_runner/index.js";
|
|
15183
|
+
var LOOP_RUNNER_SRC = [
|
|
15184
|
+
"const { loop } = require('@alva/loop');",
|
|
15185
|
+
"const { goal, channelId } = require('env').args;",
|
|
15186
|
+
"loop(goal, channelId ? { channelId } : {});",
|
|
15187
|
+
""
|
|
15188
|
+
].join("\n");
|
|
15189
|
+
function parseExpiresInToEndAt(value, command) {
|
|
15190
|
+
const raw = (value ?? "7d").trim().toLowerCase();
|
|
15191
|
+
if (raw === "never") return void 0;
|
|
15192
|
+
const match = /^([1-9]\d*)([mhd])$/.exec(raw);
|
|
15193
|
+
if (!match) {
|
|
15194
|
+
throw new CliUsageError(
|
|
15195
|
+
`--expires-in must be a positive duration like 30m, 24h, 7d, or 'never', got '${value}'`,
|
|
15196
|
+
command.split(" ")[0]
|
|
15197
|
+
);
|
|
15198
|
+
}
|
|
15199
|
+
const amount = Number(match[1]);
|
|
15200
|
+
const unit = match[2];
|
|
15201
|
+
const durationMs = amount * (unit === "m" ? 6e4 : unit === "h" ? 36e5 : 864e5);
|
|
15202
|
+
if (!Number.isSafeInteger(durationMs)) {
|
|
15203
|
+
throw new CliUsageError(
|
|
15204
|
+
`--expires-in is too large, got '${value}'`,
|
|
15205
|
+
command.split(" ")[0]
|
|
15206
|
+
);
|
|
15207
|
+
}
|
|
15208
|
+
return new Date(Date.now() + durationMs).toISOString();
|
|
15209
|
+
}
|
|
15210
|
+
function loopCronjobName(flags, goal) {
|
|
15211
|
+
if (flags["name"] !== void 0) return flags["name"];
|
|
15212
|
+
const base = goal.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
15213
|
+
const slug = (base ? `loop-${base}` : "loop").slice(0, 63).replace(/-+$/g, "");
|
|
15214
|
+
return slug || "loop";
|
|
15215
|
+
}
|
|
15027
15216
|
function parseCreditsItemsParams(flags) {
|
|
15028
15217
|
const command = "credits items";
|
|
15029
15218
|
const hasToday = boolFlag(flags["today"]) === true;
|
|
@@ -15478,6 +15667,38 @@ async function dispatch(client, args, meta, deps) {
|
|
|
15478
15667
|
);
|
|
15479
15668
|
}
|
|
15480
15669
|
}
|
|
15670
|
+
case "loop": {
|
|
15671
|
+
if (!subcommand)
|
|
15672
|
+
throw new CliUsageError("Missing subcommand for loop", "loop");
|
|
15673
|
+
switch (subcommand) {
|
|
15674
|
+
case "create": {
|
|
15675
|
+
const goal = requireFlag(flags, "goal", "loop create");
|
|
15676
|
+
const cron = requireFlag(flags, "cron", "loop create");
|
|
15677
|
+
const channelId = flags["channel-id"];
|
|
15678
|
+
const endAt = parseExpiresInToEndAt(
|
|
15679
|
+
flags["expires-in"],
|
|
15680
|
+
"loop create"
|
|
15681
|
+
);
|
|
15682
|
+
await client.fs.write({
|
|
15683
|
+
path: LOOP_RUNNER_PATH,
|
|
15684
|
+
data: LOOP_RUNNER_SRC,
|
|
15685
|
+
mkdir_parents: true
|
|
15686
|
+
});
|
|
15687
|
+
return client.deploy.create({
|
|
15688
|
+
name: loopCronjobName(flags, goal),
|
|
15689
|
+
path: LOOP_RUNNER_PATH,
|
|
15690
|
+
cron_expression: cron,
|
|
15691
|
+
args: channelId ? { goal, channelId } : { goal },
|
|
15692
|
+
end_at: endAt
|
|
15693
|
+
});
|
|
15694
|
+
}
|
|
15695
|
+
default:
|
|
15696
|
+
throw new CliUsageError(
|
|
15697
|
+
`Unknown subcommand: loop ${subcommand}`,
|
|
15698
|
+
"loop"
|
|
15699
|
+
);
|
|
15700
|
+
}
|
|
15701
|
+
}
|
|
15481
15702
|
case "service-account": {
|
|
15482
15703
|
if (!subcommand)
|
|
15483
15704
|
throw new CliUsageError(
|
|
@@ -15544,6 +15765,13 @@ async function dispatch(client, args, meta, deps) {
|
|
|
15544
15765
|
return client.feed.delete({
|
|
15545
15766
|
id: requireNumericFlag(flags, "id", "feed delete")
|
|
15546
15767
|
});
|
|
15768
|
+
case "set-visibility":
|
|
15769
|
+
return client.feed.setVisibility({
|
|
15770
|
+
id: requireNumericFlag(flags, "id", "feed set-visibility"),
|
|
15771
|
+
visibility: feedVisibility(
|
|
15772
|
+
requireFlag(flags, "visibility", "feed set-visibility")
|
|
15773
|
+
)
|
|
15774
|
+
});
|
|
15547
15775
|
default:
|
|
15548
15776
|
throw new CliUsageError(
|
|
15549
15777
|
`Unknown subcommand: feed ${subcommand}`,
|
|
@@ -16245,6 +16473,11 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16245
16473
|
});
|
|
16246
16474
|
return boolFlag(flags["json"]) ? result : formatAlertList(result);
|
|
16247
16475
|
}
|
|
16476
|
+
case "follows":
|
|
16477
|
+
return client.alerts.follows({
|
|
16478
|
+
limit: num(flags["limit"]),
|
|
16479
|
+
cursor: flags["cursor"]
|
|
16480
|
+
});
|
|
16248
16481
|
case "enable": {
|
|
16249
16482
|
const target = requireSingleAlertTarget(flags, "alert enable");
|
|
16250
16483
|
return target.kind === "automation" ? client.alerts.enableAutomation(target.target) : client.alerts.enablePlaybook(target.target);
|
|
@@ -16640,6 +16873,10 @@ function stripGlobalFlags(argv) {
|
|
|
16640
16873
|
const result = [];
|
|
16641
16874
|
for (let i = 0; i < argv.length; i++) {
|
|
16642
16875
|
const a = argv[i];
|
|
16876
|
+
if (a === "broker") {
|
|
16877
|
+
result.push(...argv.slice(i));
|
|
16878
|
+
break;
|
|
16879
|
+
}
|
|
16643
16880
|
if (GLOBAL_FLAGS.includes(a)) {
|
|
16644
16881
|
i++;
|
|
16645
16882
|
continue;
|