@chatbotkit/sdk 1.29.0 â 1.30.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/cjs/client.cjs +54 -44
- package/dist/cjs/platform/ability/v1.d.ts +3 -0
- package/dist/cjs/types/ability.d.ts +2324 -0
- package/dist/cjs/types/api/v1.d.ts +230 -41
- package/dist/esm/client.js +11 -1
- package/dist/esm/platform/ability/v1.d.ts +3 -0
- package/dist/esm/types/ability.d.ts +2324 -0
- package/dist/esm/types/api/v1.d.ts +230 -41
- package/package.json +22 -3
package/README.md
CHANGED
|
@@ -11,13 +11,13 @@ Welcome to the ChatBotKit Node SDK. This is a Node.js-based solution designed to
|
|
|
11
11
|
|
|
12
12
|
## Why ChatBotKit?
|
|
13
13
|
|
|
14
|
-
**Build lighter, future-proof AI agents.** When you build with ChatBotKit, the heavy lifting happens on our servers
|
|
14
|
+
**Build lighter, future-proof AI agents.** When you build with ChatBotKit, the heavy lifting happens on our servers-not in your application. This architectural advantage delivers:
|
|
15
15
|
|
|
16
16
|
- ðŠķ **Lightweight Agents**: Your agents stay lean because complex AI processing, model orchestration, and tool execution happen server-side. Less code in your app means faster load times and simpler maintenance.
|
|
17
17
|
|
|
18
18
|
- ðĄïļ **Robust & Streamlined**: Server-side processing provides a more reliable experience with built-in error handling, automatic retries, and consistent behavior across all platforms.
|
|
19
19
|
|
|
20
|
-
- ð **Backward & Forward Compatible**: As AI technology evolves
|
|
20
|
+
- ð **Backward & Forward Compatible**: As AI technology evolves-new models, new capabilities, new paradigms-your agents automatically benefit. No code changes required on your end.
|
|
21
21
|
|
|
22
22
|
- ðŪ **Future-Proof**: Agents you build today will remain capable tomorrow. When we add support for new AI models or capabilities, your existing agents gain those powers without any updates to your codebase.
|
|
23
23
|
|
package/dist/cjs/client.cjs
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
2
13
|
var _ChatBotKitClient_secret, _ChatBotKitClient_baseUrl, _ChatBotKitClient_endpoints, _ChatBotKitClient_runAsUserId, _ChatBotKitClient_runAsChildUserEmail, _ChatBotKitClient_timezone, _ChatBotKitClient_headers, _ChatBotKitClient_timeout, _ChatBotKitClient_retries, _ChatBotKitClient_retryDelay, _ChatBotKitClient_retryTimeout, _ChatBotKitClient_fetchFn, _ChatBotKitClient_cacheMap;
|
|
3
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
15
|
exports.ChatBotKitClient = exports.ResponsePromise = void 0;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
16
|
const fetch_1 = require("@chatbotkit/fetch");
|
|
7
17
|
const fetchPlusPlus = (0, fetch_1.withRetry)((0, fetch_1.withTimeout)(fetch_1.fetch, { timeout: Infinity }), {
|
|
8
18
|
retries: 3,
|
|
@@ -169,40 +179,40 @@ class ChatBotKitClient {
|
|
|
169
179
|
_ChatBotKitClient_retryTimeout.set(this, void 0);
|
|
170
180
|
_ChatBotKitClient_fetchFn.set(this, void 0);
|
|
171
181
|
_ChatBotKitClient_cacheMap.set(this, void 0);
|
|
172
|
-
|
|
173
|
-
|
|
182
|
+
__classPrivateFieldSet(this, _ChatBotKitClient_secret, options.secret, "f");
|
|
183
|
+
__classPrivateFieldSet(this, _ChatBotKitClient_baseUrl, new URL(options.baseUrl || `https://api.chatbotkit.com`), "f");
|
|
174
184
|
if (options.host) {
|
|
175
|
-
|
|
185
|
+
__classPrivateFieldGet(this, _ChatBotKitClient_baseUrl, "f").host = options.host;
|
|
176
186
|
}
|
|
177
187
|
if (options.protocol) {
|
|
178
|
-
|
|
188
|
+
__classPrivateFieldGet(this, _ChatBotKitClient_baseUrl, "f").protocol = options.protocol;
|
|
179
189
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
190
|
+
__classPrivateFieldSet(this, _ChatBotKitClient_endpoints, options.endpoints || {}, "f");
|
|
191
|
+
__classPrivateFieldSet(this, _ChatBotKitClient_runAsUserId, options.runAsUserId, "f");
|
|
192
|
+
__classPrivateFieldSet(this, _ChatBotKitClient_runAsChildUserEmail, options.runAsChildUserEmail, "f");
|
|
193
|
+
__classPrivateFieldSet(this, _ChatBotKitClient_timezone, options.timezone, "f");
|
|
194
|
+
__classPrivateFieldSet(this, _ChatBotKitClient_headers, options.headers || {}, "f");
|
|
195
|
+
__classPrivateFieldSet(this, _ChatBotKitClient_timeout, options.timeout, "f");
|
|
196
|
+
__classPrivateFieldSet(this, _ChatBotKitClient_retries, options.retries, "f");
|
|
197
|
+
__classPrivateFieldSet(this, _ChatBotKitClient_retryDelay, options.retryDelay, "f");
|
|
198
|
+
__classPrivateFieldSet(this, _ChatBotKitClient_retryTimeout, options.retryTimeout, "f");
|
|
199
|
+
__classPrivateFieldSet(this, _ChatBotKitClient_fetchFn, options.fetchFn || fetchPlusPlus, "f");
|
|
200
|
+
__classPrivateFieldSet(this, _ChatBotKitClient_cacheMap, new Map(), "f");
|
|
191
201
|
}
|
|
192
202
|
extend(extensionOptions) {
|
|
193
203
|
const currentOptions = {
|
|
194
|
-
secret:
|
|
195
|
-
baseUrl:
|
|
196
|
-
endpoints: { ...
|
|
197
|
-
runAsUserId:
|
|
198
|
-
runAsChildUserEmail:
|
|
199
|
-
timezone:
|
|
200
|
-
headers: { ...
|
|
201
|
-
timeout:
|
|
202
|
-
retries:
|
|
203
|
-
retryDelay:
|
|
204
|
-
retryTimeout:
|
|
205
|
-
fetchFn:
|
|
204
|
+
secret: __classPrivateFieldGet(this, _ChatBotKitClient_secret, "f") || '',
|
|
205
|
+
baseUrl: __classPrivateFieldGet(this, _ChatBotKitClient_baseUrl, "f").toString(),
|
|
206
|
+
endpoints: { ...__classPrivateFieldGet(this, _ChatBotKitClient_endpoints, "f") },
|
|
207
|
+
runAsUserId: __classPrivateFieldGet(this, _ChatBotKitClient_runAsUserId, "f"),
|
|
208
|
+
runAsChildUserEmail: __classPrivateFieldGet(this, _ChatBotKitClient_runAsChildUserEmail, "f"),
|
|
209
|
+
timezone: __classPrivateFieldGet(this, _ChatBotKitClient_timezone, "f"),
|
|
210
|
+
headers: { ...__classPrivateFieldGet(this, _ChatBotKitClient_headers, "f") },
|
|
211
|
+
timeout: __classPrivateFieldGet(this, _ChatBotKitClient_timeout, "f"),
|
|
212
|
+
retries: __classPrivateFieldGet(this, _ChatBotKitClient_retries, "f"),
|
|
213
|
+
retryDelay: __classPrivateFieldGet(this, _ChatBotKitClient_retryDelay, "f"),
|
|
214
|
+
retryTimeout: __classPrivateFieldGet(this, _ChatBotKitClient_retryTimeout, "f"),
|
|
215
|
+
fetchFn: __classPrivateFieldGet(this, _ChatBotKitClient_fetchFn, "f"),
|
|
206
216
|
};
|
|
207
217
|
const mergedOptions = {
|
|
208
218
|
...currentOptions,
|
|
@@ -220,7 +230,7 @@ class ChatBotKitClient {
|
|
|
220
230
|
}
|
|
221
231
|
clientFetch(path, options) {
|
|
222
232
|
let method = options?.method;
|
|
223
|
-
const url = new URL(
|
|
233
|
+
const url = new URL(__classPrivateFieldGet(this, _ChatBotKitClient_endpoints, "f")[options?.endpoint || path] || path, __classPrivateFieldGet(this, _ChatBotKitClient_baseUrl, "f"));
|
|
224
234
|
if (url.hostname === 'api.chatbotkit.com' &&
|
|
225
235
|
url.pathname.startsWith('/api/')) {
|
|
226
236
|
url.pathname = url.pathname.substring(4);
|
|
@@ -244,21 +254,21 @@ class ChatBotKitClient {
|
|
|
244
254
|
}
|
|
245
255
|
}
|
|
246
256
|
const headers = {
|
|
247
|
-
...
|
|
257
|
+
...__classPrivateFieldGet(this, _ChatBotKitClient_headers, "f"),
|
|
248
258
|
};
|
|
249
259
|
if (!options?.external) {
|
|
250
|
-
if (
|
|
251
|
-
headers['authorization'] = `Bearer ${
|
|
260
|
+
if (__classPrivateFieldGet(this, _ChatBotKitClient_secret, "f")) {
|
|
261
|
+
headers['authorization'] = `Bearer ${__classPrivateFieldGet(this, _ChatBotKitClient_secret, "f")}`;
|
|
252
262
|
}
|
|
253
|
-
if (
|
|
254
|
-
headers['x-runas-user-id'] =
|
|
263
|
+
if (__classPrivateFieldGet(this, _ChatBotKitClient_runAsUserId, "f")) {
|
|
264
|
+
headers['x-runas-user-id'] = __classPrivateFieldGet(this, _ChatBotKitClient_runAsUserId, "f");
|
|
255
265
|
}
|
|
256
|
-
if (
|
|
257
|
-
headers['x-runas-child-user-email'] =
|
|
266
|
+
if (__classPrivateFieldGet(this, _ChatBotKitClient_runAsChildUserEmail, "f")) {
|
|
267
|
+
headers['x-runas-child-user-email'] = __classPrivateFieldGet(this, _ChatBotKitClient_runAsChildUserEmail, "f");
|
|
258
268
|
}
|
|
259
269
|
}
|
|
260
|
-
if (
|
|
261
|
-
headers['x-timezone'] =
|
|
270
|
+
if (__classPrivateFieldGet(this, _ChatBotKitClient_timezone, "f")) {
|
|
271
|
+
headers['x-timezone'] = __classPrivateFieldGet(this, _ChatBotKitClient_timezone, "f");
|
|
262
272
|
}
|
|
263
273
|
let data;
|
|
264
274
|
if (options?.record) {
|
|
@@ -286,13 +296,13 @@ class ChatBotKitClient {
|
|
|
286
296
|
method,
|
|
287
297
|
headers,
|
|
288
298
|
data,
|
|
289
|
-
timeout: options?.timeout ??
|
|
290
|
-
retries: options?.retries ??
|
|
291
|
-
retryDelay: options?.retryDelay ??
|
|
292
|
-
retryTimeout: options?.retryTimeout ??
|
|
293
|
-
fetchFn: options?.fetchFn ||
|
|
299
|
+
timeout: options?.timeout ?? __classPrivateFieldGet(this, _ChatBotKitClient_timeout, "f"),
|
|
300
|
+
retries: options?.retries ?? __classPrivateFieldGet(this, _ChatBotKitClient_retries, "f"),
|
|
301
|
+
retryDelay: options?.retryDelay ?? __classPrivateFieldGet(this, _ChatBotKitClient_retryDelay, "f"),
|
|
302
|
+
retryTimeout: options?.retryTimeout ?? __classPrivateFieldGet(this, _ChatBotKitClient_retryTimeout, "f"),
|
|
303
|
+
fetchFn: options?.fetchFn || __classPrivateFieldGet(this, _ChatBotKitClient_fetchFn, "f"),
|
|
294
304
|
};
|
|
295
|
-
return new ResponsePromise(url, request,
|
|
305
|
+
return new ResponsePromise(url, request, __classPrivateFieldGet(this, _ChatBotKitClient_cacheMap, "f"));
|
|
296
306
|
}
|
|
297
307
|
}
|
|
298
308
|
exports.ChatBotKitClient = ChatBotKitClient;
|
|
@@ -15,3 +15,6 @@ export type PlatformAbilitySearchRequestBody = import("../../types/api/v1.js").o
|
|
|
15
15
|
export type PlatformAbilitySearchRequest = PlatformAbilitySearchRequestBody;
|
|
16
16
|
export type PlatformAbilitySearchResponseBody = import("../../types/api/v1.js").operations["searchPlatformAbilities"]["responses"]["200"]["content"]["application/json"];
|
|
17
17
|
export type PlatformAbilitySearchResponse = PlatformAbilitySearchResponseBody;
|
|
18
|
+
export type CbkAbilityName = import("../../types/ability.js").CbkAbilityName;
|
|
19
|
+
export type CbkAbilityMetadata = import("../../types/ability.js").CbkAbilityMetadata;
|
|
20
|
+
export type CbkAbilityRegistry = import("../../types/ability.js").CbkAbilityRegistry;
|