@botpress/adk-cli 1.18.1 → 1.18.2
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/cli.js +121 -29
- package/dist/commands.json +2 -2
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -36888,7 +36888,7 @@ var require_jsx_dev_runtime = __commonJS((exports2, module2) => {
|
|
|
36888
36888
|
});
|
|
36889
36889
|
|
|
36890
36890
|
// src/utils/build-constants.ts
|
|
36891
|
-
var CLI_VERSION = "1.18.
|
|
36891
|
+
var CLI_VERSION = "1.18.2", EXPECTED_RUNTIME_VERSION = "1.18.2", UNLEASH_PROD_TOKEN = "";
|
|
36892
36892
|
|
|
36893
36893
|
// ../../node_modules/.bun/browser-or-node@2.1.1/node_modules/browser-or-node/lib/index.js
|
|
36894
36894
|
var require_lib = __commonJS((exports2) => {
|
|
@@ -76841,6 +76841,7 @@ class TelemetryService {
|
|
|
76841
76841
|
event,
|
|
76842
76842
|
properties: {
|
|
76843
76843
|
...properties,
|
|
76844
|
+
adk_version: CLI_VERSION,
|
|
76844
76845
|
timestamp: new Date().toISOString()
|
|
76845
76846
|
}
|
|
76846
76847
|
});
|
|
@@ -609348,7 +609349,7 @@ var init_internal = __esm(() => {
|
|
|
609348
609349
|
});
|
|
609349
609350
|
init_define_PACKAGE_VERSIONS = __esm2({
|
|
609350
609351
|
"<define:__PACKAGE_VERSIONS__>"() {
|
|
609351
|
-
define_PACKAGE_VERSIONS_default = { runtime: "1.18.
|
|
609352
|
+
define_PACKAGE_VERSIONS_default = { runtime: "1.18.2", adk: "not-installed", sdk: "6.4.5", llmz: "0.0.71", zai: "2.6.19", cognitive: "0.5.3" };
|
|
609352
609353
|
}
|
|
609353
609354
|
});
|
|
609354
609355
|
init_eval = __esm2({
|
|
@@ -675430,7 +675431,7 @@ var init_library2 = __esm(() => {
|
|
|
675430
675431
|
});
|
|
675431
675432
|
init_define_PACKAGE_VERSIONS2 = __esm3({
|
|
675432
675433
|
"<define:__PACKAGE_VERSIONS__>"() {
|
|
675433
|
-
define_PACKAGE_VERSIONS_default2 = { runtime: "1.18.
|
|
675434
|
+
define_PACKAGE_VERSIONS_default2 = { runtime: "1.18.2", adk: "not-installed", sdk: "6.4.5", llmz: "0.0.71", zai: "2.6.19", cognitive: "0.5.3" };
|
|
675434
675435
|
}
|
|
675435
675436
|
});
|
|
675436
675437
|
init_assets2 = __esm3({
|
|
@@ -770104,7 +770105,7 @@ var init_definition3 = __esm(() => {
|
|
|
770104
770105
|
});
|
|
770105
770106
|
init_define_PACKAGE_VERSIONS3 = __esm5({
|
|
770106
770107
|
"<define:__PACKAGE_VERSIONS__>"() {
|
|
770107
|
-
define_PACKAGE_VERSIONS_default3 = { runtime: "1.18.
|
|
770108
|
+
define_PACKAGE_VERSIONS_default3 = { runtime: "1.18.2", adk: "not-installed", sdk: "6.4.5", llmz: "0.0.71", zai: "2.6.19", cognitive: "0.5.3" };
|
|
770108
770109
|
}
|
|
770109
770110
|
});
|
|
770110
770111
|
init_transcript3 = __esm5({
|
|
@@ -840647,7 +840648,7 @@ var init_runtime6 = __esm(() => {
|
|
|
840647
840648
|
});
|
|
840648
840649
|
init_define_PACKAGE_VERSIONS4 = __esm6({
|
|
840649
840650
|
"<define:__PACKAGE_VERSIONS__>"() {
|
|
840650
|
-
define_PACKAGE_VERSIONS_default4 = { runtime: "1.18.
|
|
840651
|
+
define_PACKAGE_VERSIONS_default4 = { runtime: "1.18.2", adk: "not-installed", sdk: "6.4.5", llmz: "0.0.71", zai: "2.6.19", cognitive: "0.5.3" };
|
|
840651
840652
|
}
|
|
840652
840653
|
});
|
|
840653
840654
|
init_globals4 = __esm6({
|
|
@@ -906795,7 +906796,7 @@ ${names || " (none found)"}`);
|
|
|
906795
906796
|
async copyTemplateFiles(templateDir) {
|
|
906796
906797
|
const substitutions = {
|
|
906797
906798
|
"{{projectName}}": this.projectName,
|
|
906798
|
-
"{{runtimeVersion}}": "1.18.
|
|
906799
|
+
"{{runtimeVersion}}": "1.18.2",
|
|
906799
906800
|
"{{packageManager}}": this.packageManager
|
|
906800
906801
|
};
|
|
906801
906802
|
await this.copyDirRecursive(templateDir, this.projectPath, substitutions);
|
|
@@ -908694,6 +908695,17 @@ ${allEvents.map((e7) => ` ${e7}`).join(`
|
|
|
908694
908695
|
const eventTypesPath = path34.join(project.path, ".adk", "event-types.d.ts");
|
|
908695
908696
|
await createFile(eventTypesPath, await formatCode(content));
|
|
908696
908697
|
}
|
|
908698
|
+
async function lexists(p4) {
|
|
908699
|
+
try {
|
|
908700
|
+
await fs14.lstat(p4);
|
|
908701
|
+
return true;
|
|
908702
|
+
} catch (err) {
|
|
908703
|
+
if (err.code === "ENOENT") {
|
|
908704
|
+
return false;
|
|
908705
|
+
}
|
|
908706
|
+
throw err;
|
|
908707
|
+
}
|
|
908708
|
+
}
|
|
908697
908709
|
function findPackage(name2, startDir) {
|
|
908698
908710
|
let current;
|
|
908699
908711
|
try {
|
|
@@ -908727,6 +908739,9 @@ async function linkSdk(agentDir, botDir) {
|
|
|
908727
908739
|
}
|
|
908728
908740
|
const targetBotpressDir = path35.join(botDir, "node_modules", "@botpress");
|
|
908729
908741
|
await fs14.mkdir(targetBotpressDir, { recursive: true });
|
|
908742
|
+
if (await lexists(targetSdkPath)) {
|
|
908743
|
+
await fs14.rm(targetSdkPath, { force: true });
|
|
908744
|
+
}
|
|
908730
908745
|
const symlinkType = process.platform === "win32" ? "junction" : undefined;
|
|
908731
908746
|
await fs14.symlink(sdkPath, targetSdkPath, symlinkType);
|
|
908732
908747
|
}
|
|
@@ -912639,7 +912654,7 @@ var import_ts_morph, import_ts_morph2, import_debug, import_debug2, import_tree_
|
|
|
912639
912654
|
`));
|
|
912640
912655
|
return code;
|
|
912641
912656
|
}
|
|
912642
|
-
}, ADK_VERSION = "1.18.
|
|
912657
|
+
}, ADK_VERSION = "1.18.2", relative22 = (from, to6) => {
|
|
912643
912658
|
const fromDir = path92.dirname(from);
|
|
912644
912659
|
const relative32 = path92.relative(fromDir, to6);
|
|
912645
912660
|
return relative32.startsWith(".") ? relative32 : `./${relative32}`;
|
|
@@ -913655,6 +913670,9 @@ var init_dist16 = __esm(() => {
|
|
|
913655
913670
|
}
|
|
913656
913671
|
}
|
|
913657
913672
|
async loadConfig() {
|
|
913673
|
+
this._dependencies = { integrations: {} };
|
|
913674
|
+
this._integrations = [];
|
|
913675
|
+
this._interfaces = [];
|
|
913658
913676
|
try {
|
|
913659
913677
|
const configPath = path142.join(this._path, "agent.config.ts");
|
|
913660
913678
|
debug2("loading agent.config.ts from %s", configPath);
|
|
@@ -914188,7 +914206,7 @@ ${err.stack?.split(`
|
|
|
914188
914206
|
require_package3 = __commonJS9((exports7, module2) => {
|
|
914189
914207
|
module2.exports = {
|
|
914190
914208
|
name: "@botpress/adk",
|
|
914191
|
-
version: "1.18.
|
|
914209
|
+
version: "1.18.2",
|
|
914192
914210
|
description: "Core ADK library for building AI agents on Botpress",
|
|
914193
914211
|
keywords: [
|
|
914194
914212
|
"adk",
|
|
@@ -914237,7 +914255,7 @@ ${err.stack?.split(`
|
|
|
914237
914255
|
"@botpress/cli": "~6.3.2",
|
|
914238
914256
|
"@botpress/client": "~1.39.0",
|
|
914239
914257
|
"@botpress/cognitive": "~0.5.2",
|
|
914240
|
-
"@botpress/runtime": "^1.18.
|
|
914258
|
+
"@botpress/runtime": "^1.18.2",
|
|
914241
914259
|
"@botpress/sdk": "~6.4.4",
|
|
914242
914260
|
"@bpinternal/jex": "^1.2.4",
|
|
914243
914261
|
"@bpinternal/yargs-extra": "^0.0.21",
|
|
@@ -915205,7 +915223,7 @@ var package_default;
|
|
|
915205
915223
|
var init_package = __esm(() => {
|
|
915206
915224
|
package_default = {
|
|
915207
915225
|
name: "@botpress/adk-cli",
|
|
915208
|
-
version: "1.18.
|
|
915226
|
+
version: "1.18.2",
|
|
915209
915227
|
description: "Command-line interface for the Botpress Agent Development Kit (ADK)",
|
|
915210
915228
|
keywords: [
|
|
915211
915229
|
"adk",
|
|
@@ -915246,11 +915264,11 @@ var init_package = __esm(() => {
|
|
|
915246
915264
|
"check:type": "bun scripts/generate-build-constants.ts >/dev/null && bun scripts/embed-assets.ts >/dev/null && tsc --noEmit"
|
|
915247
915265
|
},
|
|
915248
915266
|
dependencies: {
|
|
915249
|
-
"@botpress/adk": "^1.18.
|
|
915267
|
+
"@botpress/adk": "^1.18.2",
|
|
915250
915268
|
"@botpress/chat": "~0.5.5",
|
|
915251
915269
|
"@botpress/cli": "~6.3.2",
|
|
915252
915270
|
"@botpress/client": "~1.39.0",
|
|
915253
|
-
"@botpress/runtime": "^1.18.
|
|
915271
|
+
"@botpress/runtime": "^1.18.2",
|
|
915254
915272
|
"@botpress/sdk": "~6.4.4",
|
|
915255
915273
|
"@botpress/webchat-client": "^0.7.2",
|
|
915256
915274
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
@@ -929671,7 +929689,10 @@ async function summarizeSupportingTables(project, botId) {
|
|
|
929671
929689
|
}
|
|
929672
929690
|
async function collectProjectStatus(options = {}) {
|
|
929673
929691
|
const agentRoot = await findAgentRootOrFail(options.cwd ?? process.cwd());
|
|
929674
|
-
const project = await AgentProject.load(agentRoot, {
|
|
929692
|
+
const project = await AgentProject.load(agentRoot, {
|
|
929693
|
+
noCache: options.noCache,
|
|
929694
|
+
offline: options.offline
|
|
929695
|
+
});
|
|
929675
929696
|
const adkDevConsole = await findMatchingAdkDevConsole(project.path);
|
|
929676
929697
|
const devBot = adkDevConsole?.config.devBot;
|
|
929677
929698
|
const actionSummary = summarizeActions(project);
|
|
@@ -932518,7 +932539,7 @@ async function runNonInteractiveDev(port, options) {
|
|
|
932518
932539
|
writer.lifecycle("generate", "Generating assets");
|
|
932519
932540
|
try {
|
|
932520
932541
|
await generateAssetsTypes(agentProject.path);
|
|
932521
|
-
await generateAssetsRuntime(agentProject.path, agentProject.agentInfo?.botId, agentProject.agentInfo?.workspaceId);
|
|
932542
|
+
await generateAssetsRuntime(agentProject.path, agentProject.agentInfo?.botId, agentProject.agentInfo?.workspaceId, { dev: true });
|
|
932522
932543
|
writer.lifecycle("generate", "Assets generated", { duration: Date.now() - assetsStart });
|
|
932523
932544
|
} catch {
|
|
932524
932545
|
writer.lifecycle("generate", "No assets found", { duration: Date.now() - assetsStart });
|
|
@@ -932550,6 +932571,7 @@ async function runNonInteractiveDev(port, options) {
|
|
|
932550
932571
|
await generateBotProject({
|
|
932551
932572
|
projectPath: agentProject.path,
|
|
932552
932573
|
outputPath: botPath,
|
|
932574
|
+
adkCommand: "adk-dev",
|
|
932553
932575
|
callbacks: {
|
|
932554
932576
|
onProgress: (message) => writer.lifecycle("bot-generate", message),
|
|
932555
932577
|
onSuccess: (message) => writer.lifecycle("bot-generate", message),
|
|
@@ -933011,6 +933033,7 @@ Set them with: ${missingReq.map((n7) => `adk secret:set ${n7} <value>`).join(",
|
|
|
933011
933033
|
await generateBotProject({
|
|
933012
933034
|
projectPath: agentProject.path,
|
|
933013
933035
|
outputPath: botPath,
|
|
933036
|
+
adkCommand: "adk-dev",
|
|
933014
933037
|
callbacks: {
|
|
933015
933038
|
onProgress: (message) => writer.lifecycle("rebuild", message),
|
|
933016
933039
|
onSuccess: (message) => writer.lifecycle("rebuild", message),
|
|
@@ -933353,7 +933376,7 @@ var import_react42, jsx_dev_runtime25, logger4, AdkDevProcess = ({
|
|
|
933353
933376
|
addActivity("Generating assets...");
|
|
933354
933377
|
try {
|
|
933355
933378
|
await generateAssetsTypes(agentProject2.path);
|
|
933356
|
-
await generateAssetsRuntime(agentProject2.path, agentProject2.agentInfo?.botId, agentProject2.agentInfo?.workspaceId);
|
|
933379
|
+
await generateAssetsRuntime(agentProject2.path, agentProject2.agentInfo?.botId, agentProject2.agentInfo?.workspaceId, { dev: true });
|
|
933357
933380
|
addActivity("Assets generated", "success");
|
|
933358
933381
|
} catch {
|
|
933359
933382
|
addActivity("No assets found", "warn");
|
|
@@ -933365,6 +933388,7 @@ var import_react42, jsx_dev_runtime25, logger4, AdkDevProcess = ({
|
|
|
933365
933388
|
await generateBotProject({
|
|
933366
933389
|
projectPath: agentProject2.path,
|
|
933367
933390
|
outputPath: botPath,
|
|
933391
|
+
adkCommand: "adk-dev",
|
|
933368
933392
|
callbacks: {
|
|
933369
933393
|
onProgress: (msg) => addActivity(msg),
|
|
933370
933394
|
onSuccess: (msg) => addActivity(msg, "success"),
|
|
@@ -933979,6 +934003,7 @@ var import_react42, jsx_dev_runtime25, logger4, AdkDevProcess = ({
|
|
|
933979
934003
|
await generateBotProject({
|
|
933980
934004
|
projectPath: agentProject2.path,
|
|
933981
934005
|
outputPath: botPath,
|
|
934006
|
+
adkCommand: "adk-dev",
|
|
933982
934007
|
callbacks: {
|
|
933983
934008
|
onProgress: (msg) => addActivity(msg),
|
|
933984
934009
|
onSuccess: (msg) => addActivity(msg, "success"),
|
|
@@ -934227,6 +934252,7 @@ Set them with: ${missingRequired.map((n7) => `adk secret:set ${n7} <value>`).joi
|
|
|
934227
934252
|
await generateBotProject({
|
|
934228
934253
|
projectPath: agentProject2.path,
|
|
934229
934254
|
outputPath: botPath,
|
|
934255
|
+
adkCommand: "adk-dev",
|
|
934230
934256
|
callbacks: {
|
|
934231
934257
|
onProgress: (msg) => addActivity(msg),
|
|
934232
934258
|
onSuccess: (msg) => addActivity(msg, "success"),
|
|
@@ -934421,7 +934447,8 @@ async function adkStatus(options = {}) {
|
|
|
934421
934447
|
const logger5 = createCliLogger({ format: options.format });
|
|
934422
934448
|
const status = await collectProjectStatus({
|
|
934423
934449
|
cwd: process.cwd(),
|
|
934424
|
-
noCache: options.noCache
|
|
934450
|
+
noCache: options.noCache,
|
|
934451
|
+
offline: options.offline
|
|
934425
934452
|
});
|
|
934426
934453
|
logger5.info(renderProjectStatus(status)).result(status);
|
|
934427
934454
|
}
|
|
@@ -943208,7 +943235,7 @@ import {
|
|
|
943208
943235
|
accessSync,
|
|
943209
943236
|
constants as constants7
|
|
943210
943237
|
} from "fs";
|
|
943211
|
-
import { join as join33, dirname as dirname11 } from "path";
|
|
943238
|
+
import { join as join33, dirname as dirname11, basename as basename6 } from "path";
|
|
943212
943239
|
import { tmpdir as tmpdir3 } from "os";
|
|
943213
943240
|
import { execSync as execSync6 } from "child_process";
|
|
943214
943241
|
function getPlatformInfo() {
|
|
@@ -943307,8 +943334,29 @@ async function downloadBinaryWindows(version4, target, extension, logger5) {
|
|
|
943307
943334
|
}
|
|
943308
943335
|
return binaryEntry.getData();
|
|
943309
943336
|
}
|
|
943337
|
+
function isRuntimeOrPackageManagerExecutable(path47) {
|
|
943338
|
+
return RUNTIME_BASENAMES.has(basename6(path47).toLowerCase());
|
|
943339
|
+
}
|
|
943340
|
+
function isInPackageManagerDirectory(path47) {
|
|
943341
|
+
const normalized = path47.replace(/\\/g, "/");
|
|
943342
|
+
return PACKAGE_MANAGER_DIR_MARKERS.some((marker) => normalized.includes(marker));
|
|
943343
|
+
}
|
|
943344
|
+
function isLaunchedAsScript() {
|
|
943345
|
+
const script = process.argv[1];
|
|
943346
|
+
return !!script && script !== process.execPath && /\.(c|m)?js$/i.test(script) && existsSync33(script);
|
|
943347
|
+
}
|
|
943310
943348
|
function getCurrentBinaryPath() {
|
|
943311
|
-
|
|
943349
|
+
const execPath3 = process.execPath;
|
|
943350
|
+
if (isLaunchedAsScript() || isInPackageManagerDirectory(execPath3) || isRuntimeOrPackageManagerExecutable(execPath3)) {
|
|
943351
|
+
throw new Error(`Refusing to self-upgrade because ADK is running through a JavaScript runtime or package manager: ${execPath3}
|
|
943352
|
+
|
|
943353
|
+
` + `Please upgrade ADK using the same method you used to install it, for example:
|
|
943354
|
+
` + ` bun add -g @botpress/adk-cli@latest
|
|
943355
|
+
` + `Or reinstall with the standalone installer:
|
|
943356
|
+
` + ` curl -fsSL https://github.com/${GITHUB_REPO}/releases/latest/download/install.sh | bash
|
|
943357
|
+
` + ` powershell -c "irm https://github.com/${GITHUB_REPO}/releases/latest/download/install.ps1 | iex"`);
|
|
943358
|
+
}
|
|
943359
|
+
return execPath3;
|
|
943312
943360
|
}
|
|
943313
943361
|
function checkWritePermissions(path47) {
|
|
943314
943362
|
try {
|
|
@@ -943322,8 +943370,7 @@ function checkWritePermissions(path47) {
|
|
|
943322
943370
|
return false;
|
|
943323
943371
|
}
|
|
943324
943372
|
}
|
|
943325
|
-
function replaceBinary(newBinaryBuffer, isWindows3, logger5) {
|
|
943326
|
-
const currentPath = getCurrentBinaryPath();
|
|
943373
|
+
function replaceBinary(currentPath, newBinaryBuffer, isWindows3, logger5) {
|
|
943327
943374
|
if (isWindows3) {
|
|
943328
943375
|
const batchScript = `
|
|
943329
943376
|
@echo off
|
|
@@ -943364,6 +943411,7 @@ del "%~f0"
|
|
|
943364
943411
|
async function adkSelfUpgrade(currentVersion, tagOrVersion) {
|
|
943365
943412
|
const logger5 = createCliLogger();
|
|
943366
943413
|
try {
|
|
943414
|
+
const { isWindows: isWindows3 } = getPlatformInfo();
|
|
943367
943415
|
const currentPath = getCurrentBinaryPath();
|
|
943368
943416
|
logger5.info(`Current version: ${currentVersion}`);
|
|
943369
943417
|
logger5.info(`Binary path: ${currentPath}`);
|
|
@@ -943377,7 +943425,6 @@ async function adkSelfUpgrade(currentVersion, tagOrVersion) {
|
|
|
943377
943425
|
logger5.info("You already have this version!", "green");
|
|
943378
943426
|
return;
|
|
943379
943427
|
}
|
|
943380
|
-
const { isWindows: isWindows3 } = getPlatformInfo();
|
|
943381
943428
|
if (!isWindows3 && !checkWritePermissions(currentPath)) {
|
|
943382
943429
|
logger5.error(`
|
|
943383
943430
|
Upgrade failed: Permission denied`);
|
|
@@ -943399,7 +943446,7 @@ Upgrade failed: Permission denied`);
|
|
|
943399
943446
|
} else {
|
|
943400
943447
|
binaryBuffer = await downloadBinary(targetVersion, target, extension, logger5);
|
|
943401
943448
|
}
|
|
943402
|
-
replaceBinary(binaryBuffer, isWindows3, logger5);
|
|
943449
|
+
replaceBinary(currentPath, binaryBuffer, isWindows3, logger5);
|
|
943403
943450
|
if (!isWindows3) {
|
|
943404
943451
|
logger5.info(`
|
|
943405
943452
|
v${currentVersion} \u2192 v${targetVersion}`);
|
|
@@ -943408,6 +943455,11 @@ Upgrade failed: Permission denied`);
|
|
|
943408
943455
|
}
|
|
943409
943456
|
} catch (error) {
|
|
943410
943457
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
943458
|
+
if (errorMessage.startsWith("Refusing to self-upgrade")) {
|
|
943459
|
+
logger5.error(`
|
|
943460
|
+
${errorMessage}`);
|
|
943461
|
+
throw new Error("Self-upgrade refused");
|
|
943462
|
+
}
|
|
943411
943463
|
if (!errorMessage.includes("Permission denied")) {
|
|
943412
943464
|
logger5.error(`
|
|
943413
943465
|
Upgrade failed: ${errorMessage}`);
|
|
@@ -943418,11 +943470,17 @@ Upgrade failed: ${errorMessage}`);
|
|
|
943418
943470
|
throw error;
|
|
943419
943471
|
}
|
|
943420
943472
|
}
|
|
943421
|
-
var import_adm_zip, GITHUB_REPO = "botpress/adk", REGISTRY_URL2 = "https://registry.npmjs.org/@botpress/adk-cli";
|
|
943473
|
+
var import_adm_zip, GITHUB_REPO = "botpress/adk", REGISTRY_URL2 = "https://registry.npmjs.org/@botpress/adk-cli", RUNTIME_BASENAMES, PACKAGE_MANAGER_DIR_MARKERS;
|
|
943422
943474
|
var init_upgrade = __esm(() => {
|
|
943423
943475
|
init_index_min();
|
|
943424
943476
|
init_logger();
|
|
943425
943477
|
import_adm_zip = __toESM(require_adm_zip(), 1);
|
|
943478
|
+
RUNTIME_BASENAMES = new Set(["bun", "bunx", "node", "nodejs", "npm", "npx", "pnpm", "pnpx", "yarn", "yarnpkg", "corepack"].flatMap((n7) => [
|
|
943479
|
+
n7,
|
|
943480
|
+
`${n7}.exe`,
|
|
943481
|
+
`${n7}.cmd`
|
|
943482
|
+
]));
|
|
943483
|
+
PACKAGE_MANAGER_DIR_MARKERS = ["/node_modules/", "/.bun/install/", "/.npm/", "/.pnpm/", "/.yarn/"];
|
|
943426
943484
|
});
|
|
943427
943485
|
|
|
943428
943486
|
// src/commands/adk-ai-upgrade.ts
|
|
@@ -959319,14 +959377,41 @@ async function assertDevServerRunning2(baseUrl) {
|
|
|
959319
959377
|
throw new SingleMessageError("dev_server_down", DEV_SERVER_DOWN_ERROR);
|
|
959320
959378
|
}
|
|
959321
959379
|
}
|
|
959380
|
+
function sanitizeBodyPreview(raw) {
|
|
959381
|
+
const cleaned = raw.replace(/[\u0000-\u001f\u007f-\u009f]+/g, " ").trim();
|
|
959382
|
+
return cleaned.length > 120 ? `${cleaned.slice(0, 120)}\u2026` : cleaned;
|
|
959383
|
+
}
|
|
959384
|
+
async function parseJsonOrThrow(response, pathname) {
|
|
959385
|
+
const contentType = response.headers?.get?.("content-type") ?? "unknown";
|
|
959386
|
+
let bodyText;
|
|
959387
|
+
if (typeof response.text === "function") {
|
|
959388
|
+
try {
|
|
959389
|
+
bodyText = await response.text();
|
|
959390
|
+
} catch {}
|
|
959391
|
+
}
|
|
959392
|
+
if (bodyText !== undefined) {
|
|
959393
|
+
try {
|
|
959394
|
+
return JSON.parse(bodyText);
|
|
959395
|
+
} catch {
|
|
959396
|
+
const preview = sanitizeBodyPreview(bodyText);
|
|
959397
|
+
const previewSuffix = preview ? ` Body preview: "${preview}".` : "";
|
|
959398
|
+
throw new SingleMessageError("request_failed", `Dev server returned non-JSON from ${pathname} (status ${response.status}, content-type: ${contentType}).${previewSuffix} ${DEV_SERVER_RECOVERY_HINT}`);
|
|
959399
|
+
}
|
|
959400
|
+
}
|
|
959401
|
+
try {
|
|
959402
|
+
return await response.json();
|
|
959403
|
+
} catch {
|
|
959404
|
+
throw new SingleMessageError("request_failed", `Dev server returned non-JSON from ${pathname} (status ${response.status}, content-type: ${contentType}). ${DEV_SERVER_RECOVERY_HINT}`);
|
|
959405
|
+
}
|
|
959406
|
+
}
|
|
959322
959407
|
async function fetchJson3(baseUrl, pathname, timeoutMs = DEV_SERVER_REQUEST_TIMEOUT_MS) {
|
|
959323
959408
|
const response = await fetch(`${baseUrl}${pathname}`, {
|
|
959324
959409
|
signal: AbortSignal.timeout(timeoutMs)
|
|
959325
959410
|
});
|
|
959326
959411
|
if (!response.ok) {
|
|
959327
|
-
throw new
|
|
959412
|
+
throw new SingleMessageError("request_failed", `Failed to fetch ${pathname} from dev server (${response.status} ${response.statusText}). ${DEV_SERVER_RECOVERY_HINT}`);
|
|
959328
959413
|
}
|
|
959329
|
-
return
|
|
959414
|
+
return parseJsonOrThrow(response, pathname);
|
|
959330
959415
|
}
|
|
959331
959416
|
async function lookupUserToken(baseUrl, conversationId) {
|
|
959332
959417
|
try {
|
|
@@ -959609,7 +959694,13 @@ async function sendViaChat(message, webhookId, options) {
|
|
|
959609
959694
|
async function sendSingleMessage(options) {
|
|
959610
959695
|
const timeout = options.timeout ?? parseChatSingleTimeout(undefined);
|
|
959611
959696
|
const baseUrl = options.devServerUrl ?? DEFAULT_DEV_SERVER_URL2;
|
|
959612
|
-
|
|
959697
|
+
let available;
|
|
959698
|
+
try {
|
|
959699
|
+
const discovery = await discoverAvailableIntegrations(baseUrl);
|
|
959700
|
+
available = discovery.available;
|
|
959701
|
+
} catch (error2) {
|
|
959702
|
+
throw normalizeSingleMessageError(error2, options.conversationId);
|
|
959703
|
+
}
|
|
959613
959704
|
const requestedChannel = options.channel ?? "auto";
|
|
959614
959705
|
const attempts = resolveChannelAttempts(available, requestedChannel);
|
|
959615
959706
|
let userKey;
|
|
@@ -959652,7 +959743,7 @@ async function sendSingleMessage(options) {
|
|
|
959652
959743
|
}
|
|
959653
959744
|
throw new SingleMessageError("request_failed", "Failed to send message: no available channel succeeded.");
|
|
959654
959745
|
}
|
|
959655
|
-
var DEFAULT_DEV_SERVER_URL2 = "http://localhost:3001", DEV_SERVER_HEALTH_TIMEOUT_MS = 2000, DEV_SERVER_REQUEST_TIMEOUT_MS = 5000, RESPONSE_POLL_INTERVAL_MS = 100, CHAT_IDLE_TIMEOUT_MS = 2000, DEFAULT_CHAT_SINGLE_TIMEOUT = "60s", INVALID_CHAT_TIMEOUT_ERROR = "Invalid timeout. Use a duration like 500ms, 30s, 1m, or 5m.", SingleMessageError;
|
|
959746
|
+
var DEFAULT_DEV_SERVER_URL2 = "http://localhost:3001", DEV_SERVER_HEALTH_TIMEOUT_MS = 2000, DEV_SERVER_REQUEST_TIMEOUT_MS = 5000, RESPONSE_POLL_INTERVAL_MS = 100, CHAT_IDLE_TIMEOUT_MS = 2000, DEFAULT_CHAT_SINGLE_TIMEOUT = "60s", INVALID_CHAT_TIMEOUT_ERROR = "Invalid timeout. Use a duration like 500ms, 30s, 1m, or 5m.", SingleMessageError, DEV_SERVER_RECOVERY_HINT = "Verify `adk dev` is running on this port, restart it, or check for another local app/proxy on the same port.";
|
|
959656
959747
|
var init_chat_single = __esm(() => {
|
|
959657
959748
|
init_dist16();
|
|
959658
959749
|
init_dist4();
|
|
@@ -965644,7 +965735,7 @@ program.command("dev").description("Start development mode with hot reloading").
|
|
|
965644
965735
|
logger7.fatal(error2);
|
|
965645
965736
|
}
|
|
965646
965737
|
});
|
|
965647
|
-
program.command("status").description("Show project status, integrations, and local server state").option("--format <format>", "output format (json)").addHelpText("after", `
|
|
965738
|
+
program.command("status").description("Show project status, integrations, and local server state").option("--format <format>", "output format (json)").addOption(new Option("--offline").hideHelp()).addHelpText("after", `
|
|
965648
965739
|
Examples:
|
|
965649
965740
|
$ adk status
|
|
965650
965741
|
$ adk status --format json
|
|
@@ -965654,7 +965745,8 @@ Examples:
|
|
|
965654
965745
|
const { adkStatus: adkStatus2 } = await Promise.resolve().then(() => (init_adk_status(), exports_adk_status));
|
|
965655
965746
|
await adkStatus2({
|
|
965656
965747
|
format: options.format,
|
|
965657
|
-
noCache: program.opts().noCache
|
|
965748
|
+
noCache: program.opts().noCache,
|
|
965749
|
+
offline: options.offline
|
|
965658
965750
|
});
|
|
965659
965751
|
}, false);
|
|
965660
965752
|
} catch (error2) {
|
package/dist/commands.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/adk-cli",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.2",
|
|
4
4
|
"description": "Command-line interface for the Botpress Agent Development Kit (ADK)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adk",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"check:type": "bun scripts/generate-build-constants.ts >/dev/null && bun scripts/embed-assets.ts >/dev/null && tsc --noEmit"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@botpress/adk": "^1.18.
|
|
44
|
+
"@botpress/adk": "^1.18.2",
|
|
45
45
|
"@botpress/chat": "~0.5.5",
|
|
46
46
|
"@botpress/cli": "~6.3.2",
|
|
47
47
|
"@botpress/client": "~1.39.0",
|
|
48
|
-
"@botpress/runtime": "^1.18.
|
|
48
|
+
"@botpress/runtime": "^1.18.2",
|
|
49
49
|
"@botpress/sdk": "~6.4.4",
|
|
50
50
|
"@botpress/webchat-client": "^0.7.2",
|
|
51
51
|
"@modelcontextprotocol/sdk": "^1.25.1",
|