@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/index.cjs
CHANGED
|
@@ -1703,6 +1703,17 @@ function metadataSummaryForSkill(skill) {
|
|
|
1703
1703
|
}
|
|
1704
1704
|
|
|
1705
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
|
+
}
|
|
1706
1717
|
function parsePlaybookSkillId(s) {
|
|
1707
1718
|
const parts = s.split("/");
|
|
1708
1719
|
if (parts.length !== 2 || !parts[0] || !parts[1]) {
|
|
@@ -1726,7 +1737,7 @@ var PlaybookSkillsResource = class {
|
|
|
1726
1737
|
const res = await this.client._request("GET", "/api/v1/skills", {
|
|
1727
1738
|
query
|
|
1728
1739
|
});
|
|
1729
|
-
return { skills: res.data ?? [] };
|
|
1740
|
+
return { skills: (res.data ?? []).map(normalizePlaybookSkillSummary) };
|
|
1730
1741
|
}
|
|
1731
1742
|
async tags() {
|
|
1732
1743
|
const res = await this.client._request(
|
|
@@ -1751,7 +1762,10 @@ var PlaybookSkillsResource = class {
|
|
|
1751
1762
|
0
|
|
1752
1763
|
);
|
|
1753
1764
|
}
|
|
1754
|
-
return
|
|
1765
|
+
return {
|
|
1766
|
+
...normalizePlaybookSkillSummary(meta),
|
|
1767
|
+
files: meta.files ?? []
|
|
1768
|
+
};
|
|
1755
1769
|
}
|
|
1756
1770
|
async file(id, path) {
|
|
1757
1771
|
const { username, name } = parsePlaybookSkillId(id);
|
|
@@ -2062,66 +2076,56 @@ var NotificationPreferencesResource = class {
|
|
|
2062
2076
|
}
|
|
2063
2077
|
};
|
|
2064
2078
|
|
|
2065
|
-
// src/resources/
|
|
2066
|
-
var
|
|
2079
|
+
// src/resources/subscriptions.ts
|
|
2080
|
+
var SubscriptionsResource = class {
|
|
2067
2081
|
constructor(client) {
|
|
2068
2082
|
this.client = client;
|
|
2069
2083
|
}
|
|
2070
2084
|
client;
|
|
2071
2085
|
/**
|
|
2072
|
-
*
|
|
2073
|
-
*
|
|
2074
|
-
*
|
|
2075
|
-
*
|
|
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.
|
|
2076
2090
|
*/
|
|
2077
2091
|
async subscribePlaybook(params) {
|
|
2078
2092
|
this.client._requireAuth();
|
|
2079
|
-
const path = `/api/v1/
|
|
2093
|
+
const path = `/api/v1/subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
2080
2094
|
return this.client._request(
|
|
2081
2095
|
"POST",
|
|
2082
2096
|
path
|
|
2083
2097
|
);
|
|
2084
2098
|
}
|
|
2085
2099
|
/**
|
|
2086
|
-
*
|
|
2087
|
-
*
|
|
2100
|
+
* Unsubscribe from a playbook `(username, name)`: unfollow it and disable
|
|
2101
|
+
* all of its push alerts for the caller. Idempotent.
|
|
2088
2102
|
*/
|
|
2089
2103
|
async unsubscribePlaybook(params) {
|
|
2090
2104
|
this.client._requireAuth();
|
|
2091
|
-
const path = `/api/v1/
|
|
2092
|
-
return this.client._request(
|
|
2093
|
-
"DELETE",
|
|
2094
|
-
path
|
|
2095
|
-
);
|
|
2105
|
+
const path = `/api/v1/subscriptions/playbook/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
2106
|
+
return this.client._request("DELETE", path);
|
|
2096
2107
|
}
|
|
2097
2108
|
/**
|
|
2098
|
-
*
|
|
2099
|
-
*
|
|
2100
|
-
*
|
|
2101
|
-
* 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.
|
|
2102
2112
|
*/
|
|
2103
2113
|
async subscribeFeed(params) {
|
|
2104
2114
|
this.client._requireAuth();
|
|
2105
|
-
const path = `/api/v1/
|
|
2106
|
-
return this.client._request(
|
|
2107
|
-
"POST",
|
|
2108
|
-
path
|
|
2109
|
-
);
|
|
2115
|
+
const path = `/api/v1/subscriptions/feed/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
2116
|
+
return this.client._request("POST", path);
|
|
2110
2117
|
}
|
|
2111
2118
|
/**
|
|
2112
|
-
*
|
|
2113
|
-
* Idempotent.
|
|
2119
|
+
* Unsubscribe from one feed `(username, name)` — disable that automation's
|
|
2120
|
+
* alerts for the caller. Idempotent.
|
|
2114
2121
|
*/
|
|
2115
2122
|
async unsubscribeFeed(params) {
|
|
2116
2123
|
this.client._requireAuth();
|
|
2117
|
-
const path = `/api/v1/
|
|
2118
|
-
return this.client._request(
|
|
2119
|
-
"DELETE",
|
|
2120
|
-
path
|
|
2121
|
-
);
|
|
2124
|
+
const path = `/api/v1/subscriptions/feed/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
2125
|
+
return this.client._request("DELETE", path);
|
|
2122
2126
|
}
|
|
2123
2127
|
/**
|
|
2124
|
-
* List the caller's currently active
|
|
2128
|
+
* List the caller's currently active subscriptions.
|
|
2125
2129
|
* Results are cursor-paginated.
|
|
2126
2130
|
*/
|
|
2127
2131
|
async list(params = {}) {
|
|
@@ -2131,7 +2135,7 @@ var PushSubscriptionsResource = class {
|
|
|
2131
2135
|
query.first = String(params.first);
|
|
2132
2136
|
}
|
|
2133
2137
|
if (params.cursor) query.cursor = params.cursor;
|
|
2134
|
-
return this.client._request("GET", "/api/v1/me/
|
|
2138
|
+
return this.client._request("GET", "/api/v1/me/subscriptions", {
|
|
2135
2139
|
query
|
|
2136
2140
|
});
|
|
2137
2141
|
}
|
|
@@ -2200,6 +2204,20 @@ function idLiteral(value) {
|
|
|
2200
2204
|
return value;
|
|
2201
2205
|
}
|
|
2202
2206
|
|
|
2207
|
+
// src/resources/feedback.ts
|
|
2208
|
+
var FeedbackResource = class {
|
|
2209
|
+
constructor(client) {
|
|
2210
|
+
this.client = client;
|
|
2211
|
+
}
|
|
2212
|
+
client;
|
|
2213
|
+
async submit(params) {
|
|
2214
|
+
this.client._requireAuth();
|
|
2215
|
+
return this.client._request("POST", "/api/v1/feedback", {
|
|
2216
|
+
body: params
|
|
2217
|
+
});
|
|
2218
|
+
}
|
|
2219
|
+
};
|
|
2220
|
+
|
|
2203
2221
|
// src/client.ts
|
|
2204
2222
|
var DEFAULT_BASE_URL = "https://api-llm.prd.alva.ai";
|
|
2205
2223
|
var DEFAULT_ARRAYS_BASE_URL = "https://data-tools.prd.space.id";
|
|
@@ -2231,8 +2249,9 @@ var AlvaClient = class {
|
|
|
2231
2249
|
_arraysJwt;
|
|
2232
2250
|
_notifications;
|
|
2233
2251
|
_notificationPreferences;
|
|
2234
|
-
|
|
2252
|
+
_subscriptions;
|
|
2235
2253
|
_channelGroupSubscriptions;
|
|
2254
|
+
_feedback;
|
|
2236
2255
|
constructor(config) {
|
|
2237
2256
|
this.baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
|
|
2238
2257
|
this.arraysBaseUrl = config.arraysBaseUrl ?? DEFAULT_ARRAYS_BASE_URL;
|
|
@@ -2300,12 +2319,15 @@ var AlvaClient = class {
|
|
|
2300
2319
|
get notificationPreferences() {
|
|
2301
2320
|
return this._notificationPreferences ??= new NotificationPreferencesResource(this);
|
|
2302
2321
|
}
|
|
2303
|
-
get
|
|
2304
|
-
return this.
|
|
2322
|
+
get subscriptions() {
|
|
2323
|
+
return this._subscriptions ??= new SubscriptionsResource(this);
|
|
2305
2324
|
}
|
|
2306
2325
|
get channelGroupSubscriptions() {
|
|
2307
2326
|
return this._channelGroupSubscriptions ??= new ChannelGroupSubscriptionsResource(this);
|
|
2308
2327
|
}
|
|
2328
|
+
get feedback() {
|
|
2329
|
+
return this._feedback ??= new FeedbackResource(this);
|
|
2330
|
+
}
|
|
2309
2331
|
_requireAuth() {
|
|
2310
2332
|
if (!this.pbsvToken && !this.viewer_token && !this.apiKey) {
|
|
2311
2333
|
throw new AlvaError(
|
|
@@ -2790,7 +2812,7 @@ var installPlaybookRuntime = (targetWindow) => {
|
|
|
2790
2812
|
};
|
|
2791
2813
|
|
|
2792
2814
|
// src/index.ts
|
|
2793
|
-
var VERSION = true ? "0.
|
|
2815
|
+
var VERSION = true ? "0.11.1" : "dev";
|
|
2794
2816
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2795
2817
|
0 && (module.exports = {
|
|
2796
2818
|
AlvaClient,
|