@alva-ai/toolkit 0.9.5 → 0.11.1
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 +2 -2
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.js +164 -80
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +60 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +70 -33
- package/dist/index.d.ts +70 -33
- package/dist/index.js +60 -38
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -11059,6 +11059,17 @@ function metadataSummaryForSkill(skill) {
|
|
|
11059
11059
|
}
|
|
11060
11060
|
|
|
11061
11061
|
// src/resources/playbookSkills.ts
|
|
11062
|
+
function normalizePlaybookSkillSummary(raw) {
|
|
11063
|
+
return {
|
|
11064
|
+
username: raw.username,
|
|
11065
|
+
name: raw.name,
|
|
11066
|
+
display_name: raw.display_name,
|
|
11067
|
+
description: raw.description,
|
|
11068
|
+
tags: raw.tags,
|
|
11069
|
+
creator_uid: raw.creator_uid,
|
|
11070
|
+
updated_at: raw.updated_at
|
|
11071
|
+
};
|
|
11072
|
+
}
|
|
11062
11073
|
function parsePlaybookSkillId(s) {
|
|
11063
11074
|
const parts = s.split("/");
|
|
11064
11075
|
if (parts.length !== 2 || !parts[0] || !parts[1]) {
|
|
@@ -11082,7 +11093,7 @@ var PlaybookSkillsResource = class {
|
|
|
11082
11093
|
const res = await this.client._request("GET", "/api/v1/skills", {
|
|
11083
11094
|
query
|
|
11084
11095
|
});
|
|
11085
|
-
return { skills: res.data ?? [] };
|
|
11096
|
+
return { skills: (res.data ?? []).map(normalizePlaybookSkillSummary) };
|
|
11086
11097
|
}
|
|
11087
11098
|
async tags() {
|
|
11088
11099
|
const res = await this.client._request(
|
|
@@ -11107,7 +11118,10 @@ var PlaybookSkillsResource = class {
|
|
|
11107
11118
|
0
|
|
11108
11119
|
);
|
|
11109
11120
|
}
|
|
11110
|
-
return
|
|
11121
|
+
return {
|
|
11122
|
+
...normalizePlaybookSkillSummary(meta),
|
|
11123
|
+
files: meta.files ?? []
|
|
11124
|
+
};
|
|
11111
11125
|
}
|
|
11112
11126
|
async file(id, path) {
|
|
11113
11127
|
const { username, name } = parsePlaybookSkillId(id);
|
|
@@ -11418,66 +11432,56 @@ var NotificationPreferencesResource = class {
|
|
|
11418
11432
|
}
|
|
11419
11433
|
};
|
|
11420
11434
|
|
|
11421
|
-
// src/resources/
|
|
11422
|
-
var
|
|
11435
|
+
// src/resources/subscriptions.ts
|
|
11436
|
+
var SubscriptionsResource = class {
|
|
11423
11437
|
constructor(client) {
|
|
11424
11438
|
this.client = client;
|
|
11425
11439
|
}
|
|
11426
11440
|
client;
|
|
11427
11441
|
/**
|
|
11428
|
-
*
|
|
11429
|
-
*
|
|
11430
|
-
*
|
|
11431
|
-
*
|
|
11442
|
+
* Subscribe to a playbook `(username, name)`: follow it and enable alerts
|
|
11443
|
+
* on all its push-enabled automations. Idempotent. Auth: the caller must be
|
|
11444
|
+
* able to read the playbook — public passes; paid requires an active unlock;
|
|
11445
|
+
* private requires owner/admin.
|
|
11432
11446
|
*/
|
|
11433
11447
|
async subscribePlaybook(params) {
|
|
11434
11448
|
this.client._requireAuth();
|
|
11435
|
-
const path = `/api/v1/
|
|
11449
|
+
const path = `/api/v1/subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
11436
11450
|
return this.client._request(
|
|
11437
11451
|
"POST",
|
|
11438
11452
|
path
|
|
11439
11453
|
);
|
|
11440
11454
|
}
|
|
11441
11455
|
/**
|
|
11442
|
-
*
|
|
11443
|
-
*
|
|
11456
|
+
* Unsubscribe from a playbook `(username, name)`: unfollow it and disable
|
|
11457
|
+
* all of its push alerts for the caller. Idempotent.
|
|
11444
11458
|
*/
|
|
11445
11459
|
async unsubscribePlaybook(params) {
|
|
11446
11460
|
this.client._requireAuth();
|
|
11447
|
-
const path = `/api/v1/
|
|
11448
|
-
return this.client._request(
|
|
11449
|
-
"DELETE",
|
|
11450
|
-
path
|
|
11451
|
-
);
|
|
11461
|
+
const path = `/api/v1/subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
11462
|
+
return this.client._request("DELETE", path);
|
|
11452
11463
|
}
|
|
11453
11464
|
/**
|
|
11454
|
-
*
|
|
11455
|
-
*
|
|
11456
|
-
*
|
|
11457
|
-
* push per playbook context. Idempotent.
|
|
11465
|
+
* Subscribe to one feed `(username, name)` — enable personal push for that
|
|
11466
|
+
* single automation's alerts, regardless of which playbook(s) consume it.
|
|
11467
|
+
* Does NOT follow any playbook. Idempotent.
|
|
11458
11468
|
*/
|
|
11459
11469
|
async subscribeFeed(params) {
|
|
11460
11470
|
this.client._requireAuth();
|
|
11461
|
-
const path = `/api/v1/
|
|
11462
|
-
return this.client._request(
|
|
11463
|
-
"POST",
|
|
11464
|
-
path
|
|
11465
|
-
);
|
|
11471
|
+
const path = `/api/v1/subscriptions/feed/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
11472
|
+
return this.client._request("POST", path);
|
|
11466
11473
|
}
|
|
11467
11474
|
/**
|
|
11468
|
-
*
|
|
11469
|
-
* Idempotent.
|
|
11475
|
+
* Unsubscribe from one feed `(username, name)` — disable that automation's
|
|
11476
|
+
* alerts for the caller. Idempotent.
|
|
11470
11477
|
*/
|
|
11471
11478
|
async unsubscribeFeed(params) {
|
|
11472
11479
|
this.client._requireAuth();
|
|
11473
|
-
const path = `/api/v1/
|
|
11474
|
-
return this.client._request(
|
|
11475
|
-
"DELETE",
|
|
11476
|
-
path
|
|
11477
|
-
);
|
|
11480
|
+
const path = `/api/v1/subscriptions/feed/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
11481
|
+
return this.client._request("DELETE", path);
|
|
11478
11482
|
}
|
|
11479
11483
|
/**
|
|
11480
|
-
* List the caller's currently active
|
|
11484
|
+
* List the caller's currently active subscriptions.
|
|
11481
11485
|
* Results are cursor-paginated.
|
|
11482
11486
|
*/
|
|
11483
11487
|
async list(params = {}) {
|
|
@@ -11487,7 +11491,7 @@ var PushSubscriptionsResource = class {
|
|
|
11487
11491
|
query.first = String(params.first);
|
|
11488
11492
|
}
|
|
11489
11493
|
if (params.cursor) query.cursor = params.cursor;
|
|
11490
|
-
return this.client._request("GET", "/api/v1/me/
|
|
11494
|
+
return this.client._request("GET", "/api/v1/me/subscriptions", {
|
|
11491
11495
|
query
|
|
11492
11496
|
});
|
|
11493
11497
|
}
|
|
@@ -11556,6 +11560,20 @@ function idLiteral(value) {
|
|
|
11556
11560
|
return value;
|
|
11557
11561
|
}
|
|
11558
11562
|
|
|
11563
|
+
// src/resources/feedback.ts
|
|
11564
|
+
var FeedbackResource = class {
|
|
11565
|
+
constructor(client) {
|
|
11566
|
+
this.client = client;
|
|
11567
|
+
}
|
|
11568
|
+
client;
|
|
11569
|
+
async submit(params) {
|
|
11570
|
+
this.client._requireAuth();
|
|
11571
|
+
return this.client._request("POST", "/api/v1/feedback", {
|
|
11572
|
+
body: params
|
|
11573
|
+
});
|
|
11574
|
+
}
|
|
11575
|
+
};
|
|
11576
|
+
|
|
11559
11577
|
// src/client.ts
|
|
11560
11578
|
var DEFAULT_BASE_URL = "https://api-llm.prd.alva.ai";
|
|
11561
11579
|
var DEFAULT_ARRAYS_BASE_URL = "https://data-tools.prd.space.id";
|
|
@@ -11587,8 +11605,9 @@ var AlvaClient = class {
|
|
|
11587
11605
|
_arraysJwt;
|
|
11588
11606
|
_notifications;
|
|
11589
11607
|
_notificationPreferences;
|
|
11590
|
-
|
|
11608
|
+
_subscriptions;
|
|
11591
11609
|
_channelGroupSubscriptions;
|
|
11610
|
+
_feedback;
|
|
11592
11611
|
constructor(config) {
|
|
11593
11612
|
this.baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
|
|
11594
11613
|
this.arraysBaseUrl = config.arraysBaseUrl ?? DEFAULT_ARRAYS_BASE_URL;
|
|
@@ -11656,12 +11675,15 @@ var AlvaClient = class {
|
|
|
11656
11675
|
get notificationPreferences() {
|
|
11657
11676
|
return this._notificationPreferences ??= new NotificationPreferencesResource(this);
|
|
11658
11677
|
}
|
|
11659
|
-
get
|
|
11660
|
-
return this.
|
|
11678
|
+
get subscriptions() {
|
|
11679
|
+
return this._subscriptions ??= new SubscriptionsResource(this);
|
|
11661
11680
|
}
|
|
11662
11681
|
get channelGroupSubscriptions() {
|
|
11663
11682
|
return this._channelGroupSubscriptions ??= new ChannelGroupSubscriptionsResource(this);
|
|
11664
11683
|
}
|
|
11684
|
+
get feedback() {
|
|
11685
|
+
return this._feedback ??= new FeedbackResource(this);
|
|
11686
|
+
}
|
|
11665
11687
|
_requireAuth() {
|
|
11666
11688
|
if (!this.pbsvToken && !this.viewer_token && !this.apiKey) {
|
|
11667
11689
|
throw new AlvaError(
|
|
@@ -12515,7 +12537,7 @@ function formatPlaybookSkillFile(file) {
|
|
|
12515
12537
|
import * as fs2 from "fs";
|
|
12516
12538
|
import * as os2 from "os";
|
|
12517
12539
|
import * as fsPromises2 from "fs/promises";
|
|
12518
|
-
var CLI_VERSION = true ? "0.
|
|
12540
|
+
var CLI_VERSION = true ? "0.11.1" : "dev";
|
|
12519
12541
|
function isVersionOlderThan(a, b) {
|
|
12520
12542
|
const parse4 = (v) => {
|
|
12521
12543
|
if (!v) return null;
|
|
@@ -12553,7 +12575,8 @@ Commands:
|
|
|
12553
12575
|
comments Playbook comments (create, pin, unpin)
|
|
12554
12576
|
notification-history Notification delivery history (list-playbook, list-feed)
|
|
12555
12577
|
notification-preferences Notification preferences (list, enable-session-completed, disable-session-completed)
|
|
12556
|
-
|
|
12578
|
+
feedback Submit user-confirmed Alva platform feedback (submit)
|
|
12579
|
+
subscriptions Subscribe to playbooks/feeds (subscribe-playbook, unsubscribe-playbook, subscribe-feed, unsubscribe-feed, list)
|
|
12557
12580
|
channel Channel group operations (group-subscriptions context, list, subscribe, unsubscribe)
|
|
12558
12581
|
remix Save playbook remix lineage
|
|
12559
12582
|
portfolio Connected-account portfolio (accounts, summary, activities)
|
|
@@ -13076,7 +13099,7 @@ fetch individual file contents (progressive loading).
|
|
|
13076
13099
|
|
|
13077
13100
|
Subcommands:
|
|
13078
13101
|
list List skill summaries (filter by --tag and/or --username)
|
|
13079
|
-
tags Distinct tag set used across
|
|
13102
|
+
tags Distinct tag set used across skills
|
|
13080
13103
|
get Get one skill's metadata + file listing (path + size_bytes only)
|
|
13081
13104
|
file Get one file's content from a skill
|
|
13082
13105
|
|
|
@@ -13153,19 +13176,41 @@ Examples:
|
|
|
13153
13176
|
alva notification-preferences list
|
|
13154
13177
|
alva notification-preferences disable-session-completed
|
|
13155
13178
|
alva notification-preferences enable-session-completed`,
|
|
13156
|
-
|
|
13179
|
+
feedback: `Usage: alva feedback submit [options]
|
|
13157
13180
|
|
|
13158
|
-
|
|
13159
|
-
|
|
13160
|
-
unfollow. Following a playbook elsewhere does not create or revive a
|
|
13161
|
-
push subscription.
|
|
13181
|
+
Submit user-confirmed Alva platform feedback. Agents should only call this
|
|
13182
|
+
after the user explicitly agrees to send feedback to Alva.
|
|
13162
13183
|
|
|
13163
13184
|
Subcommands:
|
|
13164
|
-
|
|
13165
|
-
|
|
13166
|
-
|
|
13167
|
-
|
|
13168
|
-
|
|
13185
|
+
submit Send one feedback report to Alva
|
|
13186
|
+
|
|
13187
|
+
Submit flags:
|
|
13188
|
+
--summary <text> Short issue summary (required)
|
|
13189
|
+
--details <text> Additional context
|
|
13190
|
+
--category <category> api_error, data_quality, docs, runtime, auth, billing, other
|
|
13191
|
+
--severity <severity> low, medium, high, critical
|
|
13192
|
+
--source <source> agent_detected, user_reported, system_detected
|
|
13193
|
+
--evidence-json <json> Optional structured diagnostics for agents
|
|
13194
|
+
--context-json <json> Optional structured session metadata for agents
|
|
13195
|
+
|
|
13196
|
+
Examples:
|
|
13197
|
+
alva feedback submit --summary "runtime failed" --category runtime --severity high
|
|
13198
|
+
alva feedback submit --summary "bad quote data" --category data_quality`,
|
|
13199
|
+
subscriptions: `Usage: alva subscriptions <subcommand> [options]
|
|
13200
|
+
|
|
13201
|
+
Subscribe to playbooks and feeds.
|
|
13202
|
+
- subscribe-playbook is a CASCADE: follows the playbook AND enables alerts
|
|
13203
|
+
on all its push-enabled automations (one call). unsubscribe-playbook
|
|
13204
|
+
reverses both (unfollow + disable all of its alerts).
|
|
13205
|
+
- subscribe-feed / unsubscribe-feed toggle ONE feed's alert (a single
|
|
13206
|
+
automation) without touching the playbook follow.
|
|
13207
|
+
|
|
13208
|
+
Subcommands:
|
|
13209
|
+
subscribe-playbook Subscribe a playbook (follow + enable all its alerts)
|
|
13210
|
+
unsubscribe-playbook Unsubscribe a playbook (unfollow + disable its alerts)
|
|
13211
|
+
subscribe-feed Enable alerts for a single feed
|
|
13212
|
+
unsubscribe-feed Disable alerts for a single feed
|
|
13213
|
+
list List the caller's active subscriptions
|
|
13169
13214
|
|
|
13170
13215
|
Subscribe/unsubscribe flags (playbook + feed):
|
|
13171
13216
|
--username <user> Owner's username (required)
|
|
@@ -13176,10 +13221,10 @@ List flags:
|
|
|
13176
13221
|
--cursor <token> Optional cursor from the previous page
|
|
13177
13222
|
|
|
13178
13223
|
Examples:
|
|
13179
|
-
alva
|
|
13180
|
-
alva
|
|
13181
|
-
alva
|
|
13182
|
-
alva
|
|
13224
|
+
alva subscriptions subscribe-playbook --username alice --name btc-dashboard
|
|
13225
|
+
alva subscriptions subscribe-feed --username alice --name btc-ema-cross
|
|
13226
|
+
alva subscriptions unsubscribe-feed --username alice --name btc-ema-cross
|
|
13227
|
+
alva subscriptions list --first 20`,
|
|
13183
13228
|
channel: `Usage: alva channel group-subscriptions <subcommand> [options]
|
|
13184
13229
|
|
|
13185
13230
|
Manage push notifications delivered into the external group chat attached
|
|
@@ -13519,6 +13564,26 @@ function jsonParse(val) {
|
|
|
13519
13564
|
return val;
|
|
13520
13565
|
}
|
|
13521
13566
|
}
|
|
13567
|
+
function jsonObjectFlag(flags, name, command) {
|
|
13568
|
+
const raw = flags[name];
|
|
13569
|
+
if (raw === void 0) return void 0;
|
|
13570
|
+
let parsed;
|
|
13571
|
+
try {
|
|
13572
|
+
parsed = JSON.parse(raw);
|
|
13573
|
+
} catch {
|
|
13574
|
+
throw new CliUsageError(
|
|
13575
|
+
`--${name} must be valid JSON for '${command}'`,
|
|
13576
|
+
command.split(" ")[0]
|
|
13577
|
+
);
|
|
13578
|
+
}
|
|
13579
|
+
if (parsed === null || Array.isArray(parsed) || typeof parsed !== "object") {
|
|
13580
|
+
throw new CliUsageError(
|
|
13581
|
+
`--${name} must be a JSON object for '${command}'`,
|
|
13582
|
+
command.split(" ")[0]
|
|
13583
|
+
);
|
|
13584
|
+
}
|
|
13585
|
+
return parsed;
|
|
13586
|
+
}
|
|
13522
13587
|
async function dispatch(client, args, meta) {
|
|
13523
13588
|
const group = args[0];
|
|
13524
13589
|
if (!group || group === "--help" || group === "-h") {
|
|
@@ -14135,74 +14200,93 @@ async function dispatch(client, args, meta) {
|
|
|
14135
14200
|
);
|
|
14136
14201
|
}
|
|
14137
14202
|
}
|
|
14138
|
-
case "
|
|
14203
|
+
case "feedback": {
|
|
14204
|
+
if (!subcommand)
|
|
14205
|
+
throw new CliUsageError("Missing subcommand for feedback", "feedback");
|
|
14206
|
+
switch (subcommand) {
|
|
14207
|
+
case "submit":
|
|
14208
|
+
if (flags["dedupe-key"] !== void 0) {
|
|
14209
|
+
throw new CliUsageError(
|
|
14210
|
+
"--dedupe-key is no longer supported for 'feedback submit'",
|
|
14211
|
+
"feedback"
|
|
14212
|
+
);
|
|
14213
|
+
}
|
|
14214
|
+
return client.feedback.submit({
|
|
14215
|
+
source: flags["source"],
|
|
14216
|
+
category: flags["category"],
|
|
14217
|
+
severity: flags["severity"],
|
|
14218
|
+
summary: requireFlag(flags, "summary", "feedback submit"),
|
|
14219
|
+
details: flags["details"],
|
|
14220
|
+
evidence: jsonObjectFlag(flags, "evidence-json", "feedback submit"),
|
|
14221
|
+
context: jsonObjectFlag(flags, "context-json", "feedback submit")
|
|
14222
|
+
});
|
|
14223
|
+
default:
|
|
14224
|
+
throw new CliUsageError(
|
|
14225
|
+
`Unknown subcommand: feedback ${subcommand}`,
|
|
14226
|
+
"feedback"
|
|
14227
|
+
);
|
|
14228
|
+
}
|
|
14229
|
+
}
|
|
14230
|
+
case "subscriptions": {
|
|
14139
14231
|
if (!subcommand)
|
|
14140
14232
|
throw new CliUsageError(
|
|
14141
|
-
"Missing subcommand for
|
|
14142
|
-
"
|
|
14233
|
+
"Missing subcommand for subscriptions",
|
|
14234
|
+
"subscriptions"
|
|
14143
14235
|
);
|
|
14144
14236
|
switch (subcommand) {
|
|
14145
14237
|
case "subscribe-playbook":
|
|
14146
|
-
return client.
|
|
14238
|
+
return client.subscriptions.subscribePlaybook({
|
|
14147
14239
|
username: requireFlag(
|
|
14148
14240
|
flags,
|
|
14149
14241
|
"username",
|
|
14150
|
-
"
|
|
14242
|
+
"subscriptions subscribe-playbook"
|
|
14151
14243
|
),
|
|
14152
14244
|
name: requireFlag(
|
|
14153
14245
|
flags,
|
|
14154
14246
|
"name",
|
|
14155
|
-
"
|
|
14247
|
+
"subscriptions subscribe-playbook"
|
|
14156
14248
|
)
|
|
14157
14249
|
});
|
|
14158
14250
|
case "unsubscribe-playbook":
|
|
14159
|
-
return client.
|
|
14251
|
+
return client.subscriptions.unsubscribePlaybook({
|
|
14160
14252
|
username: requireFlag(
|
|
14161
14253
|
flags,
|
|
14162
14254
|
"username",
|
|
14163
|
-
"
|
|
14255
|
+
"subscriptions unsubscribe-playbook"
|
|
14164
14256
|
),
|
|
14165
14257
|
name: requireFlag(
|
|
14166
14258
|
flags,
|
|
14167
14259
|
"name",
|
|
14168
|
-
"
|
|
14260
|
+
"subscriptions unsubscribe-playbook"
|
|
14169
14261
|
)
|
|
14170
14262
|
});
|
|
14171
14263
|
case "subscribe-feed":
|
|
14172
|
-
return client.
|
|
14264
|
+
return client.subscriptions.subscribeFeed({
|
|
14173
14265
|
username: requireFlag(
|
|
14174
14266
|
flags,
|
|
14175
14267
|
"username",
|
|
14176
|
-
"
|
|
14268
|
+
"subscriptions subscribe-feed"
|
|
14177
14269
|
),
|
|
14178
|
-
name: requireFlag(
|
|
14179
|
-
flags,
|
|
14180
|
-
"name",
|
|
14181
|
-
"push-subscriptions subscribe-feed"
|
|
14182
|
-
)
|
|
14270
|
+
name: requireFlag(flags, "name", "subscriptions subscribe-feed")
|
|
14183
14271
|
});
|
|
14184
14272
|
case "unsubscribe-feed":
|
|
14185
|
-
return client.
|
|
14273
|
+
return client.subscriptions.unsubscribeFeed({
|
|
14186
14274
|
username: requireFlag(
|
|
14187
14275
|
flags,
|
|
14188
14276
|
"username",
|
|
14189
|
-
"
|
|
14277
|
+
"subscriptions unsubscribe-feed"
|
|
14190
14278
|
),
|
|
14191
|
-
name: requireFlag(
|
|
14192
|
-
flags,
|
|
14193
|
-
"name",
|
|
14194
|
-
"push-subscriptions unsubscribe-feed"
|
|
14195
|
-
)
|
|
14279
|
+
name: requireFlag(flags, "name", "subscriptions unsubscribe-feed")
|
|
14196
14280
|
});
|
|
14197
14281
|
case "list":
|
|
14198
|
-
return client.
|
|
14282
|
+
return client.subscriptions.list({
|
|
14199
14283
|
first: num(flags["first"]),
|
|
14200
14284
|
cursor: flags["cursor"]
|
|
14201
14285
|
});
|
|
14202
14286
|
default:
|
|
14203
14287
|
throw new CliUsageError(
|
|
14204
|
-
`Unknown subcommand:
|
|
14205
|
-
"
|
|
14288
|
+
`Unknown subcommand: subscriptions ${subcommand}`,
|
|
14289
|
+
"subscriptions"
|
|
14206
14290
|
);
|
|
14207
14291
|
}
|
|
14208
14292
|
}
|