@alva-ai/toolkit 0.21.0 → 0.22.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 +3 -3
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.d.ts +80 -10
- package/dist/cli.js +407 -689
- package/dist/cli.js.map +1 -1
- package/dist/dispatch.d.ts +81 -11
- package/dist/dispatch.js +221 -81
- package/dist/dispatch.js.map +1 -1
- package/dist/index.cjs +187 -609
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +80 -10
- package/dist/index.d.ts +80 -10
- package/dist/index.js +187 -609
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/dispatch.d.ts
CHANGED
|
@@ -424,6 +424,30 @@ interface AutomationInspectResponse {
|
|
|
424
424
|
*/
|
|
425
425
|
flow_config_path: string | null;
|
|
426
426
|
}
|
|
427
|
+
interface AutomationUpdateRequest {
|
|
428
|
+
/** Positive decimal automation id kept as a string to preserve int64 precision. */
|
|
429
|
+
id: string;
|
|
430
|
+
/** Contract version to republish. Omitted preserves the current version. */
|
|
431
|
+
version?: string;
|
|
432
|
+
/** Replacement producer cronjob. Omitted preserves the current producer. */
|
|
433
|
+
cronjob_id?: number;
|
|
434
|
+
/** Omitted preserves; an explicit empty string clears the field. */
|
|
435
|
+
description?: string;
|
|
436
|
+
/** Omitted preserves; an explicit empty string clears the field. */
|
|
437
|
+
changelog?: string;
|
|
438
|
+
/** Omitted preserves; an explicit empty string clears the agent marker. */
|
|
439
|
+
agent_type?: string;
|
|
440
|
+
/** Trigger the effective producer once after the update commits. */
|
|
441
|
+
trigger?: boolean;
|
|
442
|
+
}
|
|
443
|
+
interface AutomationUpdateResponse {
|
|
444
|
+
id: string;
|
|
445
|
+
feed_id: string;
|
|
446
|
+
name: string;
|
|
447
|
+
feed_major: number;
|
|
448
|
+
version: string;
|
|
449
|
+
cronjob_id: number;
|
|
450
|
+
}
|
|
427
451
|
interface FeedStatusUpdateRequest {
|
|
428
452
|
/** Numeric feed id to stop/resume. */
|
|
429
453
|
id: number;
|
|
@@ -1193,6 +1217,8 @@ declare class AutomationResource {
|
|
|
1193
1217
|
* Inspect one automation. Backed by GET /api/v1/automation/:id.
|
|
1194
1218
|
*/
|
|
1195
1219
|
inspect(params: AutomationInspectRequest): Promise<AutomationInspectResponse>;
|
|
1220
|
+
/** Partially update one existing automation by immutable decimal-string id. */
|
|
1221
|
+
update(params: AutomationUpdateRequest): Promise<AutomationUpdateResponse>;
|
|
1196
1222
|
stop(params: FeedStatusUpdateRequest): Promise<FeedStatusUpdateResponse>;
|
|
1197
1223
|
resume(params: FeedStatusUpdateRequest): Promise<FeedStatusUpdateResponse>;
|
|
1198
1224
|
delete(params: FeedDeleteRequest): Promise<FeedDeleteResponse>;
|
|
@@ -1288,6 +1314,33 @@ interface ListByOwnerResponse {
|
|
|
1288
1314
|
has_next: boolean;
|
|
1289
1315
|
next_cursor?: string;
|
|
1290
1316
|
}
|
|
1317
|
+
/** Lifecycle filters for the owner-scoped list (GET /api/v1/playbook). */
|
|
1318
|
+
declare const OWNED_PLAYBOOK_FILTERS: readonly ["draft", "running", "paused"];
|
|
1319
|
+
type OwnedPlaybookFilter = (typeof OWNED_PLAYBOOK_FILTERS)[number];
|
|
1320
|
+
interface ListOwnParams {
|
|
1321
|
+
/** draft | running | paused. Omit to list all your published playbooks. */
|
|
1322
|
+
filter?: OwnedPlaybookFilter;
|
|
1323
|
+
/** Page size, default 50, max 100 server-side. */
|
|
1324
|
+
limit?: number;
|
|
1325
|
+
cursor?: string;
|
|
1326
|
+
}
|
|
1327
|
+
/** One row from the owner-scoped list (GET /api/v1/playbook). */
|
|
1328
|
+
interface OwnedPlaybookItem {
|
|
1329
|
+
/** Numeric playbook id encoded as a string. */
|
|
1330
|
+
id: string;
|
|
1331
|
+
/** URL-safe playbook name. */
|
|
1332
|
+
name: string;
|
|
1333
|
+
display_name?: string;
|
|
1334
|
+
visibility?: string;
|
|
1335
|
+
created_at?: string;
|
|
1336
|
+
updated_at?: string;
|
|
1337
|
+
/** Cursor to pass as `cursor` for the next page. */
|
|
1338
|
+
cursor?: string;
|
|
1339
|
+
}
|
|
1340
|
+
interface ListOwnResponse {
|
|
1341
|
+
playbooks: OwnedPlaybookItem[];
|
|
1342
|
+
has_next: boolean;
|
|
1343
|
+
}
|
|
1291
1344
|
declare class PlaybooksResource {
|
|
1292
1345
|
private client;
|
|
1293
1346
|
constructor(client: AlvaClient);
|
|
@@ -1310,6 +1363,16 @@ declare class PlaybooksResource {
|
|
|
1310
1363
|
* playbooks are listed.
|
|
1311
1364
|
*/
|
|
1312
1365
|
listByOwner(params: ListByOwnerParams): Promise<ListByOwnerResponse>;
|
|
1366
|
+
/**
|
|
1367
|
+
* List the authenticated user's OWN playbooks via GET /api/v1/playbook —
|
|
1368
|
+
* the owner-scoped surface that INCLUDES drafts. Unlike `listByOwner` (the
|
|
1369
|
+
* public discovery view, which requires at least one release and therefore
|
|
1370
|
+
* hides drafts), this shows work-in-progress playbooks you created but
|
|
1371
|
+
* never released. Requires an API key: the owner is derived from auth, not
|
|
1372
|
+
* a username argument. Optional `filter` narrows to draft | running |
|
|
1373
|
+
* paused.
|
|
1374
|
+
*/
|
|
1375
|
+
listOwn(params?: ListOwnParams): Promise<ListOwnResponse>;
|
|
1313
1376
|
/**
|
|
1314
1377
|
* Get one playbook by numeric id or by "owner/name" ref. Returns null when
|
|
1315
1378
|
* not found / not visible / deleted.
|
|
@@ -1369,30 +1432,36 @@ declare class SdkDocsResource {
|
|
|
1369
1432
|
}): Promise<PartitionSummaryResponse>;
|
|
1370
1433
|
}
|
|
1371
1434
|
|
|
1435
|
+
/** @deprecated Arrays no longer uses endpoint subscription tiers. */
|
|
1372
1436
|
type SkillEndpointTier = 'public' | 'alternative' | 'unstructured';
|
|
1373
1437
|
interface SkillEndpointMetadata {
|
|
1374
1438
|
skill: string;
|
|
1375
1439
|
file: string;
|
|
1376
1440
|
method: string;
|
|
1377
1441
|
path: string;
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1442
|
+
/** @deprecated Arrays no longer uses endpoint subscription tiers. */
|
|
1443
|
+
tier?: SkillEndpointTier;
|
|
1444
|
+
/** @deprecated Arrays no longer uses endpoint subscription tiers. */
|
|
1445
|
+
required_subscription_tier?: 'free' | 'pro';
|
|
1446
|
+
/** @deprecated Arrays no longer uses endpoint subscription tiers. */
|
|
1447
|
+
access?: 'free_and_pro' | 'pro_only';
|
|
1448
|
+
/** @deprecated Arrays no longer uses endpoint subscription tiers. */
|
|
1449
|
+
pro_required?: boolean;
|
|
1382
1450
|
}
|
|
1383
1451
|
|
|
1384
|
-
type SkillTierCounts = Partial<Record<SkillEndpointTier, number>>;
|
|
1385
|
-
|
|
1386
1452
|
interface SkillMetadata {
|
|
1387
1453
|
endpoint_count: number;
|
|
1388
|
-
|
|
1389
|
-
|
|
1454
|
+
/** @deprecated Data-skills no longer adds local endpoint tier metadata. */
|
|
1455
|
+
endpoint_tier_counts?: Partial<Record<SkillEndpointTier, number>>;
|
|
1456
|
+
/** @deprecated Data-skills no longer adds local endpoint tier metadata. */
|
|
1457
|
+
pro_count?: number;
|
|
1390
1458
|
}
|
|
1391
1459
|
interface SkillSummary {
|
|
1392
1460
|
name: string;
|
|
1393
1461
|
description: string;
|
|
1394
1462
|
metadata?: SkillMetadata;
|
|
1395
|
-
|
|
1463
|
+
/** @deprecated Data-skills no longer adds this local metadata. */
|
|
1464
|
+
endpoint_tier_counts?: Partial<Record<SkillEndpointTier, number>>;
|
|
1396
1465
|
}
|
|
1397
1466
|
interface SkillDoc {
|
|
1398
1467
|
name: string;
|
|
@@ -1400,7 +1469,8 @@ interface SkillDoc {
|
|
|
1400
1469
|
content: string;
|
|
1401
1470
|
metadata?: SkillMetadata | SkillEndpointMetadata;
|
|
1402
1471
|
endpoint_metadata?: SkillEndpointMetadata[];
|
|
1403
|
-
|
|
1472
|
+
/** @deprecated Data-skills no longer adds this local metadata. */
|
|
1473
|
+
endpoint_tier_counts?: Partial<Record<SkillEndpointTier, number>>;
|
|
1404
1474
|
}
|
|
1405
1475
|
declare class DataSkillsResource {
|
|
1406
1476
|
private client;
|
|
@@ -1903,7 +1973,7 @@ declare const BOOLEAN_FLAGS: Set<string>;
|
|
|
1903
1973
|
* Compares major.minor.patch as integers. Returns false on malformed input.
|
|
1904
1974
|
*/
|
|
1905
1975
|
declare function isVersionOlderThan(a: string, b: string): boolean;
|
|
1906
|
-
declare const HELP_TEXT = "Usage: alva <command> [options]\n\nCommands:\n configure Save API key and endpoint to a named profile\n whoami Verify credentials and show current identity\n user User profile operations (me)\n fs Filesystem operations (read, write, stat, readdir, mkdir, remove, rename, copy, symlink, readlink, chmod, grant, revoke)\n run Execute code in the Alva runtime\n deploy Cronjob management (create, list, get, update, delete, pause, resume, runs, run-logs)\n loop Self-scheduled in-channel goal loops (create)\n service-account Restricted run-as identities (create, list, delete, grant, revoke)\n release Feed and playbook releases (feed, playbook-draft, playbook)\n lint Design-system lint (playbook)\n automation Automation management (list, inspect, publish, stop, resume, delete)\n alert Alert management (list, follows, enable, disable, history, preferences, enable-session-completed, disable-session-completed)\n feed Legacy automation alias (list, stop, resume, delete, set-visibility)\n playbooks Playbook discovery (trending, get, list) and visibility\n functions Playbook UDF function management (register, list, delete, invoke, allowance)\n credits Credit wallet and self-scoped usage history (wallet, items)\n secrets Secret management (create, list, get, update, delete)\n sdk SDK documentation (doc, partitions, partition-summary)\n skillhub Playbook skills (list, tags, get, file)\n data-skills Data-skill documentation from the Arrays backend (list, summary, endpoint)\n comments Playbook comments (create, pin, unpin)\n notification-history Feed notification delivery history (list-feed)\n notification-preferences Notification preferences (list, enable-session-completed, disable-session-completed)\n feedback Submit user-confirmed Alva platform feedback (submit)\n subscriptions Playbook follows and feed alert subscriptions\n remix Save playbook remix lineage\n portfolio Connected-account portfolio (accounts, summary, activities)\n trading Trading operations (accounts, portfolio, orders, subscriptions, equity-history, risk-rules, subscribe, unsubscribe, execute, update-risk-rules)\n broker Agentic order execution \u2014 venue-native passthrough to trex (accounts, quote, order, balance, positions, ...; run 'alva broker describe')\n auth Authentication (login)\n screenshot Capture a web screenshot as PNG\n arrays Arrays backend operations (token ensure, token status)\n\nGlobal options:\n --api-key <key> API key (overrides env and config file)\n --base-url <url> API base URL (overrides env and config file)\n --profile <name> Named profile to use (default: \"default\")\n --arrays-endpoint <url> Arrays backend URL (or ARRAYS_ENDPOINT env; default: https://data-tools.prd.space.id)\n -v, --version Show CLI version\n --help Show help (use 'alva <command> --help' for command details)\n\nConfig resolution: --api-key flag > ALVA_API_KEY env > profile in ~/.config/alva/config.json\nProfile resolution: --profile flag > ALVA_PROFILE env > \"default\"\n\nQuick start:\n npm install -g @alva-ai/toolkit\n alva configure --api-key alva_your_key_here\n alva whoami";
|
|
1976
|
+
declare const HELP_TEXT = "Usage: alva <command> [options]\n\nCommands:\n configure Save API key and endpoint to a named profile\n whoami Verify credentials and show current identity\n user User profile operations (me)\n fs Filesystem operations (read, write, stat, readdir, mkdir, remove, rename, copy, symlink, readlink, chmod, grant, revoke)\n run Execute code in the Alva runtime\n deploy Cronjob management (create, list, get, update, delete, pause, resume, runs, run-logs)\n loop Self-scheduled in-channel goal loops (create)\n service-account Restricted run-as identities (create, list, delete, grant, revoke)\n release Feed and playbook releases (feed, playbook-draft, playbook)\n lint Design-system lint (playbook)\n automation Automation management (list, inspect, publish, update, stop, resume, delete)\n alert Alert management (list, follows, enable, disable, history, preferences, enable-session-completed, disable-session-completed)\n feed Legacy automation alias (list, stop, resume, delete, set-visibility)\n playbooks Playbook discovery (trending, get, list) and visibility\n functions Playbook UDF function management (register, list, delete, invoke, allowance)\n credits Credit wallet and self-scoped usage history (wallet, items)\n secrets Secret management (create, list, get, update, delete)\n sdk SDK documentation (doc, partitions, partition-summary)\n skillhub Playbook skills (list, tags, get, file)\n data-skills Data-skill documentation from the Arrays backend (list, summary, endpoint)\n comments Playbook comments (create, pin, unpin)\n notification-history Feed notification delivery history (list-feed)\n notification-preferences Notification preferences (list, enable-session-completed, disable-session-completed)\n feedback Submit user-confirmed Alva platform feedback (submit)\n subscriptions Playbook follows and feed alert subscriptions\n remix Save playbook remix lineage\n portfolio Connected-account portfolio (accounts, summary, activities)\n trading Trading operations (accounts, portfolio, orders, subscriptions, equity-history, risk-rules, subscribe, unsubscribe, execute, update-risk-rules)\n broker Agentic order execution \u2014 venue-native passthrough to trex (accounts, quote, order, balance, positions, ...; run 'alva broker describe')\n auth Authentication (login)\n screenshot Capture a web screenshot as PNG\n arrays Arrays backend operations (token ensure, token status)\n\nGlobal options:\n --api-key <key> API key (overrides env and config file)\n --base-url <url> API base URL (overrides env and config file)\n --profile <name> Named profile to use (default: \"default\")\n --arrays-endpoint <url> Arrays backend URL (or ARRAYS_ENDPOINT env; default: https://data-tools.prd.space.id)\n -v, --version Show CLI version\n --help Show help (use 'alva <command> --help' for command details)\n\nConfig resolution: --api-key flag > ALVA_API_KEY env > profile in ~/.config/alva/config.json\nProfile resolution: --profile flag > ALVA_PROFILE env > \"default\"\n\nQuick start:\n npm install -g @alva-ai/toolkit\n alva configure --api-key alva_your_key_here\n alva whoami";
|
|
1907
1977
|
declare const COMMAND_HELP: Record<string, string>;
|
|
1908
1978
|
type AlvaCliRuntimeMode = 'nodejs' | 'jagent';
|
|
1909
1979
|
interface DispatchLocalFiles {
|
package/dist/dispatch.js
CHANGED
|
@@ -6115,7 +6115,19 @@ var COMMAND_DEFINITIONS = [
|
|
|
6115
6115
|
"description",
|
|
6116
6116
|
"changelog",
|
|
6117
6117
|
"agent-type"
|
|
6118
|
-
]
|
|
6118
|
+
],
|
|
6119
|
+
booleans: ["skip-auto-trigger"]
|
|
6120
|
+
}),
|
|
6121
|
+
command("automation update", {
|
|
6122
|
+
values: [
|
|
6123
|
+
"id",
|
|
6124
|
+
"version",
|
|
6125
|
+
"cronjob-id",
|
|
6126
|
+
"description",
|
|
6127
|
+
"changelog",
|
|
6128
|
+
"agent-type"
|
|
6129
|
+
],
|
|
6130
|
+
booleans: ["trigger"]
|
|
6119
6131
|
}),
|
|
6120
6132
|
command("automation stop", { values: ["id"] }),
|
|
6121
6133
|
command("automation resume", { values: ["id"] }),
|
|
@@ -6138,7 +6150,11 @@ var COMMAND_DEFINITIONS = [
|
|
|
6138
6150
|
}),
|
|
6139
6151
|
command("playbooks list", {
|
|
6140
6152
|
values: ["owner", "limit", "cursor"],
|
|
6141
|
-
booleans: ["json"]
|
|
6153
|
+
booleans: ["json", "all"]
|
|
6154
|
+
}),
|
|
6155
|
+
command("playbooks mine", {
|
|
6156
|
+
values: ["filter", "limit", "cursor"],
|
|
6157
|
+
booleans: ["json", "all"]
|
|
6142
6158
|
}),
|
|
6143
6159
|
command("functions allowance"),
|
|
6144
6160
|
command("functions allowance get", { values: ["playbook-id"] }),
|
|
@@ -6174,7 +6190,8 @@ var COMMAND_DEFINITIONS = [
|
|
|
6174
6190
|
"description",
|
|
6175
6191
|
"changelog",
|
|
6176
6192
|
"agent-type"
|
|
6177
|
-
]
|
|
6193
|
+
],
|
|
6194
|
+
booleans: ["skip-auto-trigger"]
|
|
6178
6195
|
}),
|
|
6179
6196
|
command("release playbook-draft", {
|
|
6180
6197
|
values: [
|
|
@@ -6582,35 +6599,13 @@ function parseCommand(args) {
|
|
|
6582
6599
|
}
|
|
6583
6600
|
|
|
6584
6601
|
// src/cli/dataSkillsFormat.ts
|
|
6585
|
-
var TIER_ORDER = [
|
|
6586
|
-
"public",
|
|
6587
|
-
"alternative",
|
|
6588
|
-
"unstructured"
|
|
6589
|
-
];
|
|
6590
|
-
function formatTierCounts(counts) {
|
|
6591
|
-
if (!counts) return "";
|
|
6592
|
-
const parts = [];
|
|
6593
|
-
for (const tier of TIER_ORDER) {
|
|
6594
|
-
const n = counts[tier];
|
|
6595
|
-
if (n) parts.push(`${tier}=${n}`);
|
|
6596
|
-
}
|
|
6597
|
-
return parts.join(" ");
|
|
6598
|
-
}
|
|
6599
6602
|
function formatSkillsList(payload) {
|
|
6600
6603
|
const skills = payload.skills ?? [];
|
|
6601
6604
|
if (skills.length === 0) return "(no skills)\n";
|
|
6602
6605
|
const lines = [`${skills.length} skill(s):`, ""];
|
|
6603
6606
|
for (const s of skills) {
|
|
6604
|
-
const
|
|
6605
|
-
|
|
6606
|
-
if (meta) {
|
|
6607
|
-
const parts = [`${meta.endpoint_count} endpoints`];
|
|
6608
|
-
const tiers = formatTierCounts(meta.endpoint_tier_counts);
|
|
6609
|
-
if (tiers) parts.push(tiers);
|
|
6610
|
-
if (meta.pro_count > 0) parts.push(`${meta.pro_count} pro`);
|
|
6611
|
-
tag = `[${parts.join("; ")}]`;
|
|
6612
|
-
}
|
|
6613
|
-
lines.push(`\u2022 ${s.name}${tag ? ` ${tag}` : ""}`);
|
|
6607
|
+
const tag = s.metadata ? ` [${s.metadata.endpoint_count} endpoints]` : "";
|
|
6608
|
+
lines.push(`\u2022 ${s.name}${tag}`);
|
|
6614
6609
|
if (s.description) lines.push(` ${s.description}`);
|
|
6615
6610
|
lines.push("");
|
|
6616
6611
|
}
|
|
@@ -6618,52 +6613,37 @@ function formatSkillsList(payload) {
|
|
|
6618
6613
|
}
|
|
6619
6614
|
function formatEndpointMetadataTable(endpoints) {
|
|
6620
6615
|
if (endpoints.length === 0) return "";
|
|
6621
|
-
const rows = endpoints.map((
|
|
6622
|
-
method:
|
|
6623
|
-
path:
|
|
6624
|
-
file:
|
|
6625
|
-
tier: e.tier,
|
|
6626
|
-
access: e.pro_required ? "pro" : "free"
|
|
6616
|
+
const rows = endpoints.map((endpoint) => ({
|
|
6617
|
+
method: endpoint.method,
|
|
6618
|
+
path: endpoint.path,
|
|
6619
|
+
file: endpoint.file
|
|
6627
6620
|
}));
|
|
6628
|
-
const headers = ["METHOD", "PATH", "FILE"
|
|
6629
|
-
const
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
const lines = [
|
|
6635
|
-
headers.map((h, i) => pad(h, widths[i])).join(" "),
|
|
6636
|
-
widths.map((w) => "-".repeat(w)).join(" "),
|
|
6637
|
-
...rows.map(
|
|
6638
|
-
(r) => [r.method, r.path, r.file, r.tier, r.access].map((v, i) => pad(String(v), widths[i])).join(" ")
|
|
6621
|
+
const headers = ["METHOD", "PATH", "FILE"];
|
|
6622
|
+
const keys = ["method", "path", "file"];
|
|
6623
|
+
const widths = headers.map(
|
|
6624
|
+
(header, index) => Math.max(
|
|
6625
|
+
header.length,
|
|
6626
|
+
...rows.map((row) => String(row[keys[index]]).length)
|
|
6639
6627
|
)
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
}
|
|
6643
|
-
function formatSingleEndpointMetadata(meta) {
|
|
6644
|
-
if (!meta) return "";
|
|
6628
|
+
);
|
|
6629
|
+
const pad = (value, width) => value + " ".repeat(Math.max(0, width - value.length));
|
|
6645
6630
|
return [
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6631
|
+
headers.map((header, index) => pad(header, widths[index])).join(" "),
|
|
6632
|
+
widths.map((width) => "-".repeat(width)).join(" "),
|
|
6633
|
+
...rows.map(
|
|
6634
|
+
(row) => keys.map((key, index) => pad(String(row[key]), widths[index])).join(" ")
|
|
6635
|
+
)
|
|
6651
6636
|
].join("\n");
|
|
6652
6637
|
}
|
|
6653
|
-
function isEndpointMetadata(
|
|
6654
|
-
return !!
|
|
6638
|
+
function isEndpointMetadata(metadata) {
|
|
6639
|
+
return !!metadata && typeof metadata === "object" && "path" in metadata && "method" in metadata;
|
|
6655
6640
|
}
|
|
6656
6641
|
function formatSkillSummary(doc) {
|
|
6657
6642
|
const sections = [];
|
|
6658
6643
|
sections.push(`# ${doc.name}`);
|
|
6659
6644
|
if (doc.description) sections.push(doc.description);
|
|
6660
6645
|
if (doc.metadata && !isEndpointMetadata(doc.metadata)) {
|
|
6661
|
-
|
|
6662
|
-
const parts = [`${m.endpoint_count} endpoints`];
|
|
6663
|
-
const counts = formatTierCounts(m.endpoint_tier_counts);
|
|
6664
|
-
if (counts) parts.push(counts);
|
|
6665
|
-
if (m.pro_count > 0) parts.push(`${m.pro_count} pro`);
|
|
6666
|
-
sections.push(`(${parts.join("; ")})`);
|
|
6646
|
+
sections.push(`(${doc.metadata.endpoint_count} endpoints)`);
|
|
6667
6647
|
}
|
|
6668
6648
|
sections.push("---");
|
|
6669
6649
|
sections.push((doc.content ?? "").trimEnd());
|
|
@@ -6678,7 +6658,13 @@ function formatSkillEndpoint(doc) {
|
|
|
6678
6658
|
sections.push(`# ${doc.name}`);
|
|
6679
6659
|
if (doc.description) sections.push(doc.description);
|
|
6680
6660
|
if (isEndpointMetadata(doc.metadata)) {
|
|
6681
|
-
sections.push(
|
|
6661
|
+
sections.push(
|
|
6662
|
+
[
|
|
6663
|
+
"Endpoint metadata:",
|
|
6664
|
+
` ${doc.metadata.method} ${doc.metadata.path}`,
|
|
6665
|
+
` file: ${doc.metadata.file}`
|
|
6666
|
+
].join("\n")
|
|
6667
|
+
);
|
|
6682
6668
|
}
|
|
6683
6669
|
sections.push("---");
|
|
6684
6670
|
sections.push((doc.content ?? "").trimEnd());
|
|
@@ -6733,6 +6719,7 @@ var PLAYBOOK_VISIBILITIES = [
|
|
|
6733
6719
|
"private",
|
|
6734
6720
|
"paid"
|
|
6735
6721
|
];
|
|
6722
|
+
var OWNED_PLAYBOOK_FILTERS = ["draft", "running", "paused"];
|
|
6736
6723
|
function webOriginFromApiBase(apiBaseUrl) {
|
|
6737
6724
|
try {
|
|
6738
6725
|
const host = new URL(apiBaseUrl).hostname;
|
|
@@ -6802,6 +6789,25 @@ function discoveryItemLines(item, webOrigin) {
|
|
|
6802
6789
|
out.push("");
|
|
6803
6790
|
return out;
|
|
6804
6791
|
}
|
|
6792
|
+
function formatOwnedPlaybookList(items, opts = {}) {
|
|
6793
|
+
if (!items || items.length === 0) return "(no playbooks)\n";
|
|
6794
|
+
const lines = [`${items.length} playbook(s):`, ""];
|
|
6795
|
+
for (const item of items) {
|
|
6796
|
+
const title = item.display_name || item.name || item.id;
|
|
6797
|
+
const visibility = item.visibility ? ` [${item.visibility}]` : "";
|
|
6798
|
+
lines.push(`\u2022 ${title}${visibility}`);
|
|
6799
|
+
if (item.name && item.name !== title) lines.push(` ${item.name}`);
|
|
6800
|
+
lines.push(` id: ${item.id}`);
|
|
6801
|
+
lines.push("");
|
|
6802
|
+
}
|
|
6803
|
+
if (opts.hasNext && !opts.all) {
|
|
6804
|
+
lines.push(
|
|
6805
|
+
"(more results \u2014 pass --cursor <last item cursor>, or --all for every page)",
|
|
6806
|
+
""
|
|
6807
|
+
);
|
|
6808
|
+
}
|
|
6809
|
+
return lines.join("\n");
|
|
6810
|
+
}
|
|
6805
6811
|
|
|
6806
6812
|
// src/cli/productFormat.ts
|
|
6807
6813
|
function formatAutomationList(result) {
|
|
@@ -10258,7 +10264,7 @@ ${formatReport(report, "human")}
|
|
|
10258
10264
|
}
|
|
10259
10265
|
|
|
10260
10266
|
// src/cli/dispatch.ts
|
|
10261
|
-
var CLI_VERSION = true ? "0.
|
|
10267
|
+
var CLI_VERSION = true ? "0.22.0" : "dev";
|
|
10262
10268
|
var DEFAULT_RUN_TIMEOUT_MS = 6e5;
|
|
10263
10269
|
var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
|
|
10264
10270
|
var GLOBAL_VALUE_FLAGS = Object.entries(GLOBAL_FLAG_DEFINITIONS).filter(([, kind]) => kind === "value").map(([name]) => `--${name}`);
|
|
@@ -10304,7 +10310,7 @@ Commands:
|
|
|
10304
10310
|
service-account Restricted run-as identities (create, list, delete, grant, revoke)
|
|
10305
10311
|
release Feed and playbook releases (feed, playbook-draft, playbook)
|
|
10306
10312
|
lint Design-system lint (playbook)
|
|
10307
|
-
automation Automation management (list, inspect, publish, stop, resume, delete)
|
|
10313
|
+
automation Automation management (list, inspect, publish, update, stop, resume, delete)
|
|
10308
10314
|
alert Alert management (list, follows, enable, disable, history, preferences, enable-session-completed, disable-session-completed)
|
|
10309
10315
|
feed Legacy automation alias (list, stop, resume, delete, set-visibility)
|
|
10310
10316
|
playbooks Playbook discovery (trending, get, list) and visibility
|
|
@@ -10491,12 +10497,13 @@ Path conventions:
|
|
|
10491
10497
|
Quote tilde paths to prevent shell expansion: --path "~/data" (not --path ~/data).
|
|
10492
10498
|
|
|
10493
10499
|
Time series reads:
|
|
10494
|
-
|
|
10495
|
-
@last/{n}
|
|
10496
|
-
@range/{
|
|
10497
|
-
@
|
|
10498
|
-
@
|
|
10499
|
-
@
|
|
10500
|
+
Feed data directories are synth mounts. Their supported read suffixes are:
|
|
10501
|
+
@last/{n} Last N data points (chronological order)
|
|
10502
|
+
@range/{start_ms}..{end_ms} Between Unix millisecond timestamps
|
|
10503
|
+
@before/{timestamp_ms}/{limit} Up to limit points before a Unix millisecond timestamp
|
|
10504
|
+
@after/{timestamp_ms}/{limit} Up to limit points after a Unix millisecond timestamp
|
|
10505
|
+
@count Data point count
|
|
10506
|
+
RFC 3339, Unix-second timestamps, @range/{duration}, and @now are not supported.
|
|
10500
10507
|
|
|
10501
10508
|
Grant/revoke subjects:
|
|
10502
10509
|
special:user:* Public (anyone, including unauthenticated)
|
|
@@ -10724,7 +10731,8 @@ commands called "feeds"; ids are currently the same underlying feed ids.
|
|
|
10724
10731
|
Subcommands:
|
|
10725
10732
|
list List automations owned by the caller
|
|
10726
10733
|
inspect Inspect one automation and show its flow config path when available
|
|
10727
|
-
publish
|
|
10734
|
+
publish First-publish/register a new automation after deploying its cronjob
|
|
10735
|
+
update Partially update an existing automation by numeric id
|
|
10728
10736
|
stop Stop an automation's producer cronjob
|
|
10729
10737
|
resume Resume a stopped automation's producer cronjob
|
|
10730
10738
|
delete Soft-delete an automation
|
|
@@ -10743,15 +10751,33 @@ Publish flags:
|
|
|
10743
10751
|
--description <text> Automation description
|
|
10744
10752
|
--changelog <text> Per-major changelog summary
|
|
10745
10753
|
--agent-type <type> Agent kind that produces this automation, e.g. "alpi"
|
|
10754
|
+
--skip-auto-trigger Suppress the default first producer run. Publishing
|
|
10755
|
+
still creates the owner's alert binding.
|
|
10756
|
+
|
|
10757
|
+
Publish behavior:
|
|
10758
|
+
A new automation creates an ACTIVE owner alert binding, then triggers its
|
|
10759
|
+
first producer run unless --skip-auto-trigger is present. Use the flag when
|
|
10760
|
+
you will route the binding or trigger the producer explicitly afterward.
|
|
10761
|
+
|
|
10762
|
+
Update flags:
|
|
10763
|
+
--id <automation_id> Existing automation id (required)
|
|
10764
|
+
--version <version> New semantic version; omitted preserves the current one
|
|
10765
|
+
--cronjob-id <id> Replacement producer; omitted preserves the current one
|
|
10766
|
+
--description <text> Replace description; explicit empty string clears it
|
|
10767
|
+
--changelog <text> Replace per-major changelog; explicit empty clears it
|
|
10768
|
+
--agent-type <type> Replace agent kind; explicit empty clears it
|
|
10769
|
+
--trigger Trigger one run after the update commits
|
|
10746
10770
|
|
|
10747
10771
|
Lifecycle flags:
|
|
10748
|
-
--id <automation_id> Numeric automation id (required for inspect/stop/resume/delete)
|
|
10772
|
+
--id <automation_id> Numeric automation id (required for inspect/update/stop/resume/delete)
|
|
10749
10773
|
|
|
10750
10774
|
Examples:
|
|
10751
10775
|
alva automation list
|
|
10752
10776
|
alva automation list --status all --limit 20
|
|
10753
10777
|
alva automation inspect --id 42
|
|
10754
10778
|
alva automation publish --name btc-ema --version 1.0.0 --cronjob-id 42
|
|
10779
|
+
alva automation update --id 42 --description "Updated BTC EMA"
|
|
10780
|
+
alva automation update --id 42 --version 2.0.0 --trigger
|
|
10755
10781
|
alva automation stop --id 42
|
|
10756
10782
|
alva automation resume --id 42
|
|
10757
10783
|
alva automation delete --id 42`,
|
|
@@ -10861,7 +10887,8 @@ Find and resolve playbooks with an agent-friendly response shape.
|
|
|
10861
10887
|
Subcommands:
|
|
10862
10888
|
trending List trending playbooks
|
|
10863
10889
|
get Resolve playbooks by id(s) or "owner/name" ref
|
|
10864
|
-
list List a user's playbooks by owner username
|
|
10890
|
+
list List a user's public (released) playbooks by owner username
|
|
10891
|
+
mine List YOUR OWN playbooks incl. drafts (requires auth)
|
|
10865
10892
|
set-visibility Set a playbook's visibility (requires auth)
|
|
10866
10893
|
|
|
10867
10894
|
Get flags:
|
|
@@ -10872,8 +10899,16 @@ Get flags:
|
|
|
10872
10899
|
|
|
10873
10900
|
List flags:
|
|
10874
10901
|
--owner <username> Owner username (required)
|
|
10875
|
-
--limit <n> Max results per page
|
|
10902
|
+
--limit <n> Max results per page (default one page of ~50)
|
|
10876
10903
|
--cursor <cursor> Pagination cursor from previous response
|
|
10904
|
+
--all Fetch every page (auto-paginate); without it a
|
|
10905
|
+
single page is returned \u2014 check has_next
|
|
10906
|
+
|
|
10907
|
+
Mine flags (your own playbooks, drafts included):
|
|
10908
|
+
--filter <f> draft | running | paused (optional; omit for all)
|
|
10909
|
+
--limit <n> Max results per page (default one page of ~50)
|
|
10910
|
+
--cursor <cursor> Pagination cursor from previous response
|
|
10911
|
+
--all Fetch every page (auto-paginate)
|
|
10877
10912
|
|
|
10878
10913
|
Trending flags:
|
|
10879
10914
|
--keyword <text> Search text
|
|
@@ -10913,7 +10948,8 @@ Examples:
|
|
|
10913
10948
|
alva playbooks trending --keyword scanner --tags macro,ai --sort recent --limit 5
|
|
10914
10949
|
alva playbooks get --ids 8009,8010
|
|
10915
10950
|
alva playbooks get --ref alice/btc-dashboard
|
|
10916
|
-
alva playbooks list --owner alice
|
|
10951
|
+
alva playbooks list --owner alice --all
|
|
10952
|
+
alva playbooks mine --filter draft
|
|
10917
10953
|
alva playbooks set-visibility --name my-scanner --visibility private
|
|
10918
10954
|
alva playbooks set-visibility --name my-scanner --visibility public`,
|
|
10919
10955
|
functions: `Usage: alva functions <subcommand> [options]
|
|
@@ -11007,6 +11043,13 @@ Feed flags:
|
|
|
11007
11043
|
--agent-type <type> Agent kind that produces this feed, e.g. "alpi".
|
|
11008
11044
|
Marks the feed as an agent feed with an editable
|
|
11009
11045
|
prompt (AGENTS.md). Omit for a regular feed.
|
|
11046
|
+
--skip-auto-trigger Suppress the default first producer run. Releasing
|
|
11047
|
+
still creates the owner's alert binding.
|
|
11048
|
+
|
|
11049
|
+
Feed release behavior:
|
|
11050
|
+
A new feed creates an ACTIVE owner alert binding, then triggers its first
|
|
11051
|
+
producer run unless --skip-auto-trigger is present. Use the flag when you
|
|
11052
|
+
will route the binding or trigger the producer explicitly afterward.
|
|
11010
11053
|
|
|
11011
11054
|
Playbook-draft flags:
|
|
11012
11055
|
--name <name> URL-safe playbook name, unique per user (required)
|
|
@@ -11131,8 +11174,8 @@ public \u2014 no Alva credentials required.
|
|
|
11131
11174
|
|
|
11132
11175
|
Subcommands:
|
|
11133
11176
|
list List all available data skills
|
|
11134
|
-
summary <skill> Get the endpoints table for a skill
|
|
11135
|
-
endpoint <skill> <file> Get full documentation
|
|
11177
|
+
summary <skill> Get the endpoints table for a skill
|
|
11178
|
+
endpoint <skill> <file> Get full documentation for a specific endpoint
|
|
11136
11179
|
|
|
11137
11180
|
Flags:
|
|
11138
11181
|
--json Emit raw JSON instead of the readable rendering (for scripting / jq)
|
|
@@ -11722,8 +11765,36 @@ function feedReleaseParams(flags, command2) {
|
|
|
11722
11765
|
view_json: jsonParse(flags["view-json"]),
|
|
11723
11766
|
description: flags["description"],
|
|
11724
11767
|
changelog: flags["changelog"],
|
|
11725
|
-
agent_type: flags["agent-type"]
|
|
11768
|
+
agent_type: flags["agent-type"],
|
|
11769
|
+
skip_auto_trigger: boolFlag(flags["skip-auto-trigger"])
|
|
11770
|
+
};
|
|
11771
|
+
}
|
|
11772
|
+
function automationUpdateParams(flags) {
|
|
11773
|
+
const command2 = "automation update";
|
|
11774
|
+
const cronjobID = flags["cronjob-id"] === void 0 ? void 0 : optionalBoundedIntegerFlag(
|
|
11775
|
+
flags,
|
|
11776
|
+
"cronjob-id",
|
|
11777
|
+
command2,
|
|
11778
|
+
1,
|
|
11779
|
+
Number.MAX_SAFE_INTEGER
|
|
11780
|
+
);
|
|
11781
|
+
const trigger = boolFlag(flags["trigger"]);
|
|
11782
|
+
const params = {
|
|
11783
|
+
id: requirePositiveIntegerStringFlag(flags, "id", command2),
|
|
11784
|
+
version: flags["version"],
|
|
11785
|
+
cronjob_id: cronjobID,
|
|
11786
|
+
description: flags["description"],
|
|
11787
|
+
changelog: flags["changelog"],
|
|
11788
|
+
agent_type: flags["agent-type"],
|
|
11789
|
+
trigger: trigger === true ? true : void 0
|
|
11726
11790
|
};
|
|
11791
|
+
if (params.version === void 0 && params.cronjob_id === void 0 && params.description === void 0 && params.changelog === void 0 && params.agent_type === void 0 && params.trigger !== true) {
|
|
11792
|
+
throw new CliUsageError(
|
|
11793
|
+
"automation update requires at least one field or --trigger",
|
|
11794
|
+
"automation"
|
|
11795
|
+
);
|
|
11796
|
+
}
|
|
11797
|
+
return params;
|
|
11727
11798
|
}
|
|
11728
11799
|
function trendingPlaybooksSort(val) {
|
|
11729
11800
|
if (val === void 0) return void 0;
|
|
@@ -11744,6 +11815,17 @@ function playbookVisibility(val) {
|
|
|
11744
11815
|
"playbooks"
|
|
11745
11816
|
);
|
|
11746
11817
|
}
|
|
11818
|
+
function ownedPlaybookFilter(val) {
|
|
11819
|
+
if (val === void 0 || val === "") return void 0;
|
|
11820
|
+
const normalized = val.trim().toLowerCase();
|
|
11821
|
+
if (OWNED_PLAYBOOK_FILTERS.includes(normalized)) {
|
|
11822
|
+
return normalized;
|
|
11823
|
+
}
|
|
11824
|
+
throw new CliUsageError(
|
|
11825
|
+
`--filter must be one of ${OWNED_PLAYBOOK_FILTERS.join(", ")} for 'playbooks mine', got '${val}'`,
|
|
11826
|
+
"playbooks"
|
|
11827
|
+
);
|
|
11828
|
+
}
|
|
11747
11829
|
function feedVisibility(val) {
|
|
11748
11830
|
const normalized = val.trim().toLowerCase();
|
|
11749
11831
|
if (normalized === "public" || normalized === "private") {
|
|
@@ -12581,6 +12663,8 @@ async function dispatch(client, args, meta, deps) {
|
|
|
12581
12663
|
return client.automation.publish(
|
|
12582
12664
|
feedReleaseParams(flags, "automation publish")
|
|
12583
12665
|
);
|
|
12666
|
+
case "update":
|
|
12667
|
+
return client.automation.update(automationUpdateParams(flags));
|
|
12584
12668
|
case "stop":
|
|
12585
12669
|
return client.automation.stop({
|
|
12586
12670
|
id: requireNumericFlag(flags, "id", "automation stop")
|
|
@@ -12661,15 +12745,71 @@ async function dispatch(client, args, meta, deps) {
|
|
|
12661
12745
|
);
|
|
12662
12746
|
}
|
|
12663
12747
|
case "list": {
|
|
12748
|
+
const owner = requireFlag(flags, "owner", "playbooks list");
|
|
12749
|
+
const limit = num(flags["limit"]);
|
|
12750
|
+
if (boolFlag(flags["all"]) ?? false) {
|
|
12751
|
+
const first = await client.playbooks.listByOwner({
|
|
12752
|
+
owner,
|
|
12753
|
+
limit,
|
|
12754
|
+
cursor: flags["cursor"]
|
|
12755
|
+
});
|
|
12756
|
+
const items = first.items;
|
|
12757
|
+
let hasNext = first.has_next;
|
|
12758
|
+
let cursor = first.next_cursor;
|
|
12759
|
+
while (hasNext && cursor) {
|
|
12760
|
+
const page = await client.playbooks.listByOwner({
|
|
12761
|
+
owner,
|
|
12762
|
+
limit,
|
|
12763
|
+
cursor
|
|
12764
|
+
});
|
|
12765
|
+
items.push(...page.items);
|
|
12766
|
+
hasNext = page.has_next;
|
|
12767
|
+
cursor = page.next_cursor;
|
|
12768
|
+
}
|
|
12769
|
+
return asJson ? { items, has_next: false } : formatPlaybookList(items, webOrigin);
|
|
12770
|
+
}
|
|
12664
12771
|
const result = await client.playbooks.listByOwner({
|
|
12665
|
-
owner
|
|
12666
|
-
limit
|
|
12772
|
+
owner,
|
|
12773
|
+
limit,
|
|
12667
12774
|
cursor: flags["cursor"]
|
|
12668
12775
|
});
|
|
12669
12776
|
return asJson ? result : formatPlaybookList(result.items, webOrigin, {
|
|
12670
12777
|
hasNext: result.has_next
|
|
12671
12778
|
});
|
|
12672
12779
|
}
|
|
12780
|
+
case "mine": {
|
|
12781
|
+
const filter = ownedPlaybookFilter(flags["filter"]);
|
|
12782
|
+
const limit = num(flags["limit"]);
|
|
12783
|
+
if (boolFlag(flags["all"]) ?? false) {
|
|
12784
|
+
const first = await client.playbooks.listOwn({
|
|
12785
|
+
filter,
|
|
12786
|
+
limit,
|
|
12787
|
+
cursor: flags["cursor"]
|
|
12788
|
+
});
|
|
12789
|
+
const items = first.playbooks;
|
|
12790
|
+
let hasNext = first.has_next;
|
|
12791
|
+
let cursor = items.length ? items[items.length - 1].cursor : void 0;
|
|
12792
|
+
while (hasNext && cursor) {
|
|
12793
|
+
const page = await client.playbooks.listOwn({
|
|
12794
|
+
filter,
|
|
12795
|
+
limit,
|
|
12796
|
+
cursor
|
|
12797
|
+
});
|
|
12798
|
+
items.push(...page.playbooks);
|
|
12799
|
+
hasNext = page.has_next;
|
|
12800
|
+
cursor = page.playbooks.length ? page.playbooks[page.playbooks.length - 1].cursor : void 0;
|
|
12801
|
+
}
|
|
12802
|
+
return asJson ? { playbooks: items, has_next: false } : formatOwnedPlaybookList(items, { all: true });
|
|
12803
|
+
}
|
|
12804
|
+
const result = await client.playbooks.listOwn({
|
|
12805
|
+
filter,
|
|
12806
|
+
limit,
|
|
12807
|
+
cursor: flags["cursor"]
|
|
12808
|
+
});
|
|
12809
|
+
return asJson ? result : formatOwnedPlaybookList(result.playbooks, {
|
|
12810
|
+
hasNext: result.has_next
|
|
12811
|
+
});
|
|
12812
|
+
}
|
|
12673
12813
|
default:
|
|
12674
12814
|
throw new CliUsageError(
|
|
12675
12815
|
`Unknown subcommand: playbooks ${subcommand}`,
|