@alva-ai/toolkit 0.9.4 → 0.11.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 +2 -2
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.js +139 -83
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +71 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -33
- package/dist/index.d.ts +65 -33
- package/dist/index.js +71 -38
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -374,6 +374,11 @@ var FeedResource = class {
|
|
|
374
374
|
};
|
|
375
375
|
|
|
376
376
|
// src/resources/playbooks.ts
|
|
377
|
+
var PLAYBOOK_VISIBILITIES = [
|
|
378
|
+
"public",
|
|
379
|
+
"private",
|
|
380
|
+
"paid"
|
|
381
|
+
];
|
|
377
382
|
var PlaybooksResource = class {
|
|
378
383
|
constructor(client) {
|
|
379
384
|
this.client = client;
|
|
@@ -407,6 +412,30 @@ var PlaybooksResource = class {
|
|
|
407
412
|
has_next: raw.has_next ?? false
|
|
408
413
|
};
|
|
409
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* Set a playbook's visibility. Requires authentication; the owner is
|
|
417
|
+
* resolved server-side from the authenticated user, so only the playbook
|
|
418
|
+
* `name` is needed.
|
|
419
|
+
*
|
|
420
|
+
* Note: `private` and `paid` are paid-tier capabilities. A free-tier user
|
|
421
|
+
* receives a `PERMISSION_DENIED` error from the gateway, which is surfaced
|
|
422
|
+
* here unchanged.
|
|
423
|
+
*/
|
|
424
|
+
async setVisibility(params) {
|
|
425
|
+
if (!PLAYBOOK_VISIBILITIES.includes(params.visibility)) {
|
|
426
|
+
throw new AlvaError(
|
|
427
|
+
"INVALID_ARGUMENT",
|
|
428
|
+
`Invalid visibility "${params.visibility}". Expected one of: ${PLAYBOOK_VISIBILITIES.join(", ")}.`,
|
|
429
|
+
400
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
this.client._requireAuth();
|
|
433
|
+
return await this.client._request(
|
|
434
|
+
"POST",
|
|
435
|
+
`/api/v1/playbook/${encodeURIComponent(params.name)}/visibility`,
|
|
436
|
+
{ body: { visibility: params.visibility } }
|
|
437
|
+
);
|
|
438
|
+
}
|
|
410
439
|
};
|
|
411
440
|
function toAgentPlaybook(raw) {
|
|
412
441
|
const username = raw.creator?.name ?? "";
|
|
@@ -1674,6 +1703,17 @@ function metadataSummaryForSkill(skill) {
|
|
|
1674
1703
|
}
|
|
1675
1704
|
|
|
1676
1705
|
// src/resources/playbookSkills.ts
|
|
1706
|
+
function normalizePlaybookSkillSummary(raw) {
|
|
1707
|
+
return {
|
|
1708
|
+
username: raw.username,
|
|
1709
|
+
name: raw.name,
|
|
1710
|
+
display_name: raw.display_name,
|
|
1711
|
+
description: raw.description,
|
|
1712
|
+
tags: raw.tags,
|
|
1713
|
+
creator_uid: raw.creator_uid,
|
|
1714
|
+
updated_at: raw.updated_at
|
|
1715
|
+
};
|
|
1716
|
+
}
|
|
1677
1717
|
function parsePlaybookSkillId(s) {
|
|
1678
1718
|
const parts = s.split("/");
|
|
1679
1719
|
if (parts.length !== 2 || !parts[0] || !parts[1]) {
|
|
@@ -1697,7 +1737,7 @@ var PlaybookSkillsResource = class {
|
|
|
1697
1737
|
const res = await this.client._request("GET", "/api/v1/skills", {
|
|
1698
1738
|
query
|
|
1699
1739
|
});
|
|
1700
|
-
return { skills: res.data ?? [] };
|
|
1740
|
+
return { skills: (res.data ?? []).map(normalizePlaybookSkillSummary) };
|
|
1701
1741
|
}
|
|
1702
1742
|
async tags() {
|
|
1703
1743
|
const res = await this.client._request(
|
|
@@ -1722,7 +1762,10 @@ var PlaybookSkillsResource = class {
|
|
|
1722
1762
|
0
|
|
1723
1763
|
);
|
|
1724
1764
|
}
|
|
1725
|
-
return
|
|
1765
|
+
return {
|
|
1766
|
+
...normalizePlaybookSkillSummary(meta),
|
|
1767
|
+
files: meta.files ?? []
|
|
1768
|
+
};
|
|
1726
1769
|
}
|
|
1727
1770
|
async file(id, path) {
|
|
1728
1771
|
const { username, name } = parsePlaybookSkillId(id);
|
|
@@ -2033,66 +2076,56 @@ var NotificationPreferencesResource = class {
|
|
|
2033
2076
|
}
|
|
2034
2077
|
};
|
|
2035
2078
|
|
|
2036
|
-
// src/resources/
|
|
2037
|
-
var
|
|
2079
|
+
// src/resources/subscriptions.ts
|
|
2080
|
+
var SubscriptionsResource = class {
|
|
2038
2081
|
constructor(client) {
|
|
2039
2082
|
this.client = client;
|
|
2040
2083
|
}
|
|
2041
2084
|
client;
|
|
2042
2085
|
/**
|
|
2043
|
-
*
|
|
2044
|
-
*
|
|
2045
|
-
*
|
|
2046
|
-
*
|
|
2086
|
+
* Subscribe to a playbook `(username, name)`: follow it and enable alerts
|
|
2087
|
+
* on all its push-enabled automations. Idempotent. Auth: the caller must be
|
|
2088
|
+
* able to read the playbook — public passes; paid requires an active unlock;
|
|
2089
|
+
* private requires owner/admin.
|
|
2047
2090
|
*/
|
|
2048
2091
|
async subscribePlaybook(params) {
|
|
2049
2092
|
this.client._requireAuth();
|
|
2050
|
-
const path = `/api/v1/
|
|
2093
|
+
const path = `/api/v1/subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
2051
2094
|
return this.client._request(
|
|
2052
2095
|
"POST",
|
|
2053
2096
|
path
|
|
2054
2097
|
);
|
|
2055
2098
|
}
|
|
2056
2099
|
/**
|
|
2057
|
-
*
|
|
2058
|
-
*
|
|
2100
|
+
* Unsubscribe from a playbook `(username, name)`: unfollow it and disable
|
|
2101
|
+
* all of its push alerts for the caller. Idempotent.
|
|
2059
2102
|
*/
|
|
2060
2103
|
async unsubscribePlaybook(params) {
|
|
2061
2104
|
this.client._requireAuth();
|
|
2062
|
-
const path = `/api/v1/
|
|
2063
|
-
return this.client._request(
|
|
2064
|
-
"DELETE",
|
|
2065
|
-
path
|
|
2066
|
-
);
|
|
2105
|
+
const path = `/api/v1/subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
2106
|
+
return this.client._request("DELETE", path);
|
|
2067
2107
|
}
|
|
2068
2108
|
/**
|
|
2069
|
-
*
|
|
2070
|
-
*
|
|
2071
|
-
*
|
|
2072
|
-
* push per playbook context. Idempotent.
|
|
2109
|
+
* Subscribe to one feed `(username, name)` — enable personal push for that
|
|
2110
|
+
* single automation's alerts, regardless of which playbook(s) consume it.
|
|
2111
|
+
* Does NOT follow any playbook. Idempotent.
|
|
2073
2112
|
*/
|
|
2074
2113
|
async subscribeFeed(params) {
|
|
2075
2114
|
this.client._requireAuth();
|
|
2076
|
-
const path = `/api/v1/
|
|
2077
|
-
return this.client._request(
|
|
2078
|
-
"POST",
|
|
2079
|
-
path
|
|
2080
|
-
);
|
|
2115
|
+
const path = `/api/v1/subscriptions/feed/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
2116
|
+
return this.client._request("POST", path);
|
|
2081
2117
|
}
|
|
2082
2118
|
/**
|
|
2083
|
-
*
|
|
2084
|
-
* Idempotent.
|
|
2119
|
+
* Unsubscribe from one feed `(username, name)` — disable that automation's
|
|
2120
|
+
* alerts for the caller. Idempotent.
|
|
2085
2121
|
*/
|
|
2086
2122
|
async unsubscribeFeed(params) {
|
|
2087
2123
|
this.client._requireAuth();
|
|
2088
|
-
const path = `/api/v1/
|
|
2089
|
-
return this.client._request(
|
|
2090
|
-
"DELETE",
|
|
2091
|
-
path
|
|
2092
|
-
);
|
|
2124
|
+
const path = `/api/v1/subscriptions/feed/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
2125
|
+
return this.client._request("DELETE", path);
|
|
2093
2126
|
}
|
|
2094
2127
|
/**
|
|
2095
|
-
* List the caller's currently active
|
|
2128
|
+
* List the caller's currently active subscriptions.
|
|
2096
2129
|
* Results are cursor-paginated.
|
|
2097
2130
|
*/
|
|
2098
2131
|
async list(params = {}) {
|
|
@@ -2102,7 +2135,7 @@ var PushSubscriptionsResource = class {
|
|
|
2102
2135
|
query.first = String(params.first);
|
|
2103
2136
|
}
|
|
2104
2137
|
if (params.cursor) query.cursor = params.cursor;
|
|
2105
|
-
return this.client._request("GET", "/api/v1/me/
|
|
2138
|
+
return this.client._request("GET", "/api/v1/me/subscriptions", {
|
|
2106
2139
|
query
|
|
2107
2140
|
});
|
|
2108
2141
|
}
|
|
@@ -2202,7 +2235,7 @@ var AlvaClient = class {
|
|
|
2202
2235
|
_arraysJwt;
|
|
2203
2236
|
_notifications;
|
|
2204
2237
|
_notificationPreferences;
|
|
2205
|
-
|
|
2238
|
+
_subscriptions;
|
|
2206
2239
|
_channelGroupSubscriptions;
|
|
2207
2240
|
constructor(config) {
|
|
2208
2241
|
this.baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
|
|
@@ -2271,8 +2304,8 @@ var AlvaClient = class {
|
|
|
2271
2304
|
get notificationPreferences() {
|
|
2272
2305
|
return this._notificationPreferences ??= new NotificationPreferencesResource(this);
|
|
2273
2306
|
}
|
|
2274
|
-
get
|
|
2275
|
-
return this.
|
|
2307
|
+
get subscriptions() {
|
|
2308
|
+
return this._subscriptions ??= new SubscriptionsResource(this);
|
|
2276
2309
|
}
|
|
2277
2310
|
get channelGroupSubscriptions() {
|
|
2278
2311
|
return this._channelGroupSubscriptions ??= new ChannelGroupSubscriptionsResource(this);
|
|
@@ -2761,7 +2794,7 @@ var installPlaybookRuntime = (targetWindow) => {
|
|
|
2761
2794
|
};
|
|
2762
2795
|
|
|
2763
2796
|
// src/index.ts
|
|
2764
|
-
var VERSION = true ? "0.
|
|
2797
|
+
var VERSION = true ? "0.11.0" : "dev";
|
|
2765
2798
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2766
2799
|
0 && (module.exports = {
|
|
2767
2800
|
AlvaClient,
|