@botpress/adk 1.8.3 → 1.9.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/dist/commands/bp-cli.d.ts +5 -1
- package/dist/commands/bp-cli.d.ts.map +1 -1
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/index.js +73 -127
- package/dist/index.js.map +8 -8
- package/package.json +2 -2
|
@@ -2,8 +2,12 @@ export interface BpCliInfo {
|
|
|
2
2
|
path: string;
|
|
3
3
|
version: string;
|
|
4
4
|
}
|
|
5
|
+
export declare const BP_CLI_VERSION: string;
|
|
6
|
+
export declare const BP_CLI_INSTALL_ALL: string;
|
|
7
|
+
export declare const BP_CLI_INSTALL_DIR: string;
|
|
8
|
+
export declare const BP_CLI_BIN_PATH: string;
|
|
5
9
|
/**
|
|
6
10
|
* Get bp CLI info (path and version)
|
|
7
11
|
*/
|
|
8
|
-
export declare function getBpCli(
|
|
12
|
+
export declare function getBpCli(): BpCliInfo;
|
|
9
13
|
//# sourceMappingURL=bp-cli.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bp-cli.d.ts","sourceRoot":"","sources":["../../src/commands/bp-cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bp-cli.d.ts","sourceRoot":"","sources":["../../src/commands/bp-cli.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAKD,eAAO,MAAM,cAAc,QAAqB,CAAA;AAChD,eAAO,MAAM,kBAAkB,QAA4C,CAAA;AAC3E,eAAO,MAAM,kBAAkB,QAAgD,CAAA;AAC/E,eAAO,MAAM,eAAe,QAA8E,CAAA;AAE1G;;GAEG;AACH,wBAAgB,QAAQ,IAAI,SAAS,CAWpC"}
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -10,4 +10,5 @@ export { BpDevCommand } from './bp-dev-command.js';
|
|
|
10
10
|
export type { BpDevCommandOptions, BpDevProgressEvent } from './bp-dev-command.js';
|
|
11
11
|
export { BpChatCommand } from './bp-chat-command.js';
|
|
12
12
|
export type { BpChatCommandOptions } from './bp-chat-command.js';
|
|
13
|
+
export { BP_CLI_BIN_PATH, BP_CLI_VERSION, BP_CLI_INSTALL_DIR } from './bp-cli.js';
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,YAAY,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,YAAY,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAEhE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -654,7 +654,7 @@ var PRETTIER_CONFIG, formatCode = async (code, filepath) => {
|
|
|
654
654
|
`));
|
|
655
655
|
return code;
|
|
656
656
|
}
|
|
657
|
-
}, ADK_VERSION = "1.
|
|
657
|
+
}, ADK_VERSION = "1.9.0", relative2 = (from, to) => {
|
|
658
658
|
const fromDir = path10.dirname(from);
|
|
659
659
|
const relative3 = path10.relative(fromDir, to);
|
|
660
660
|
return relative3.startsWith(".") ? relative3 : `./${relative3}`;
|
|
@@ -797,7 +797,7 @@ var init_integration_action_types = __esm(() => {
|
|
|
797
797
|
var require_package = __commonJS((exports, module) => {
|
|
798
798
|
module.exports = {
|
|
799
799
|
name: "@botpress/adk",
|
|
800
|
-
version: "1.
|
|
800
|
+
version: "1.9.0",
|
|
801
801
|
description: "Core ADK library for building AI agents on Botpress",
|
|
802
802
|
type: "module",
|
|
803
803
|
main: "dist/index.js",
|
|
@@ -844,7 +844,7 @@ var require_package = __commonJS((exports, module) => {
|
|
|
844
844
|
"@botpress/cli": "^4.27.3",
|
|
845
845
|
"@botpress/client": "^1.27.2",
|
|
846
846
|
"@botpress/cognitive": "^0.2.0",
|
|
847
|
-
"@botpress/runtime": "^1.
|
|
847
|
+
"@botpress/runtime": "^1.9.0",
|
|
848
848
|
"@botpress/sdk": "^4.18.1",
|
|
849
849
|
"@bpinternal/yargs-extra": "^0.0.21",
|
|
850
850
|
"@parcel/watcher": "^2.5.1",
|
|
@@ -1069,81 +1069,24 @@ class BaseCommand {
|
|
|
1069
1069
|
}
|
|
1070
1070
|
}
|
|
1071
1071
|
// src/commands/bp-add-command.ts
|
|
1072
|
-
import { execa
|
|
1072
|
+
import { execa } from "execa";
|
|
1073
1073
|
|
|
1074
1074
|
// src/commands/bp-cli.ts
|
|
1075
|
-
import {
|
|
1075
|
+
import { existsSync } from "fs";
|
|
1076
|
+
import os3 from "os";
|
|
1076
1077
|
import path4 from "path";
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
const cliDir = path4.dirname(cliPackagePath);
|
|
1085
|
-
const bundledBpPath = path4.join(cliDir, "dist", "bp-cli", "bin.js");
|
|
1086
|
-
await access(bundledBpPath);
|
|
1087
|
-
return bundledBpPath;
|
|
1088
|
-
} catch {}
|
|
1089
|
-
return null;
|
|
1090
|
-
} catch {
|
|
1091
|
-
return null;
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
async function findBpPath(projectPath) {
|
|
1095
|
-
const basePath = projectPath || process.cwd();
|
|
1096
|
-
const bundledPath = await findBundledBpPath();
|
|
1097
|
-
if (bundledPath) {
|
|
1098
|
-
return bundledPath;
|
|
1099
|
-
}
|
|
1100
|
-
try {
|
|
1101
|
-
const require2 = createRequire2(path4.join(basePath, "package.json"));
|
|
1102
|
-
const cliPath = require2.resolve("@botpress/cli/package.json");
|
|
1103
|
-
const cliDir = path4.dirname(cliPath);
|
|
1104
|
-
return path4.join(cliDir, "bin.js");
|
|
1105
|
-
} catch {
|
|
1106
|
-
try {
|
|
1107
|
-
const require2 = createRequire2(path4.join(process.cwd(), "package.json"));
|
|
1108
|
-
const cliPath = require2.resolve("@botpress/cli/package.json");
|
|
1109
|
-
const cliDir = path4.dirname(cliPath);
|
|
1110
|
-
return path4.join(cliDir, "bin.js");
|
|
1111
|
-
} catch {
|
|
1112
|
-
return null;
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
async function getVersionFromPath(bpPath) {
|
|
1117
|
-
try {
|
|
1118
|
-
const { stdout } = await execa("node", [bpPath, "--version"]);
|
|
1119
|
-
return parseVersion(stdout);
|
|
1120
|
-
} catch {
|
|
1121
|
-
return "unknown";
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
function parseVersion(versionOutput) {
|
|
1125
|
-
const match = versionOutput.match(/v?(\d+\.\d+\.\d+)/);
|
|
1126
|
-
return match?.[1] || "0.0.0";
|
|
1127
|
-
}
|
|
1128
|
-
async function getBpCli(projectPath) {
|
|
1129
|
-
const localBpPath = await findBpPath(projectPath);
|
|
1130
|
-
if (localBpPath) {
|
|
1131
|
-
const version = await getVersionFromPath(localBpPath);
|
|
1132
|
-
return {
|
|
1133
|
-
path: localBpPath,
|
|
1134
|
-
version
|
|
1135
|
-
};
|
|
1136
|
-
}
|
|
1137
|
-
try {
|
|
1138
|
-
const { stdout } = await execa("bp", ["--version"]);
|
|
1139
|
-
const version = parseVersion(stdout);
|
|
1140
|
-
return {
|
|
1141
|
-
path: "bp",
|
|
1142
|
-
version
|
|
1143
|
-
};
|
|
1144
|
-
} catch {
|
|
1145
|
-
throw new Error("Botpress CLI not found. This should not happen as @botpress/cli is bundled with the ADK CLI.");
|
|
1078
|
+
var BP_CLI_VERSION = "4.27.3";
|
|
1079
|
+
var BP_CLI_INSTALL_ALL = path4.join(os3.homedir(), ".adk", `bp-cli`);
|
|
1080
|
+
var BP_CLI_INSTALL_DIR = path4.join(BP_CLI_INSTALL_ALL, BP_CLI_VERSION);
|
|
1081
|
+
var BP_CLI_BIN_PATH = path4.join(BP_CLI_INSTALL_DIR, "node_modules", "@botpress", "cli", "bin.js");
|
|
1082
|
+
function getBpCli() {
|
|
1083
|
+
if (!existsSync(BP_CLI_BIN_PATH)) {
|
|
1084
|
+
throw new Error(`@botpress/cli version ${BP_CLI_VERSION} is not installed in the ADK directory "${BP_CLI_INSTALL_DIR}". This is a bug, please report it to the Botpress team.`);
|
|
1146
1085
|
}
|
|
1086
|
+
return {
|
|
1087
|
+
path: BP_CLI_BIN_PATH,
|
|
1088
|
+
version: BP_CLI_VERSION
|
|
1089
|
+
};
|
|
1147
1090
|
}
|
|
1148
1091
|
|
|
1149
1092
|
// src/commands/bp-add-command.ts
|
|
@@ -1157,7 +1100,7 @@ class BpAddCommand extends BaseCommand {
|
|
|
1157
1100
|
}
|
|
1158
1101
|
async run() {
|
|
1159
1102
|
const { resource, botPath, workspaceId, credentials } = this.options;
|
|
1160
|
-
const { path: bpCommand } =
|
|
1103
|
+
const { path: bpCommand } = getBpCli();
|
|
1161
1104
|
const args = [
|
|
1162
1105
|
"add",
|
|
1163
1106
|
resource,
|
|
@@ -1171,7 +1114,7 @@ class BpAddCommand extends BaseCommand {
|
|
|
1171
1114
|
"--apiUrl",
|
|
1172
1115
|
credentials.apiUrl
|
|
1173
1116
|
];
|
|
1174
|
-
this.childProcess =
|
|
1117
|
+
this.childProcess = execa(bpCommand, args, {
|
|
1175
1118
|
cwd: botPath,
|
|
1176
1119
|
stdio: ["ignore", "pipe", "pipe"]
|
|
1177
1120
|
});
|
|
@@ -1209,9 +1152,9 @@ class BpAddCommand extends BaseCommand {
|
|
|
1209
1152
|
}
|
|
1210
1153
|
}
|
|
1211
1154
|
// src/commands/bp-build-command.ts
|
|
1212
|
-
import { execa as
|
|
1155
|
+
import { execa as execa2 } from "execa";
|
|
1213
1156
|
import { join } from "path";
|
|
1214
|
-
import { access
|
|
1157
|
+
import { access } from "fs/promises";
|
|
1215
1158
|
|
|
1216
1159
|
// src/utils/source-map-optimizer.ts
|
|
1217
1160
|
import { readFile, writeFile } from "fs/promises";
|
|
@@ -1467,9 +1410,9 @@ class BpBuildCommand extends BaseCommand {
|
|
|
1467
1410
|
}
|
|
1468
1411
|
async run() {
|
|
1469
1412
|
const { botPath } = this.options;
|
|
1470
|
-
const { path: bpCommand } =
|
|
1413
|
+
const { path: bpCommand } = getBpCli();
|
|
1471
1414
|
const args = ["build", "--sourceMap"];
|
|
1472
|
-
this.childProcess =
|
|
1415
|
+
this.childProcess = execa2(bpCommand, args, {
|
|
1473
1416
|
cwd: botPath,
|
|
1474
1417
|
stdio: ["ignore", "pipe", "pipe"]
|
|
1475
1418
|
});
|
|
@@ -1504,7 +1447,7 @@ class BpBuildCommand extends BaseCommand {
|
|
|
1504
1447
|
const { botPath } = this.options;
|
|
1505
1448
|
const sourceMapPath = join(botPath, ".botpress", "dist", "index.cjs.map");
|
|
1506
1449
|
try {
|
|
1507
|
-
await
|
|
1450
|
+
await access(sourceMapPath);
|
|
1508
1451
|
const agentSrcPath = join(botPath, "..", "..", "src");
|
|
1509
1452
|
await optimizeSourceMap({
|
|
1510
1453
|
sourceMapPath,
|
|
@@ -1520,7 +1463,7 @@ class BpBuildCommand extends BaseCommand {
|
|
|
1520
1463
|
}
|
|
1521
1464
|
}
|
|
1522
1465
|
// src/commands/bp-deploy-command.ts
|
|
1523
|
-
import { execa as
|
|
1466
|
+
import { execa as execa3 } from "execa";
|
|
1524
1467
|
class BpDeployCommand extends BaseCommand {
|
|
1525
1468
|
options;
|
|
1526
1469
|
childProcess = null;
|
|
@@ -1531,7 +1474,7 @@ class BpDeployCommand extends BaseCommand {
|
|
|
1531
1474
|
}
|
|
1532
1475
|
async run() {
|
|
1533
1476
|
const { botPath, botId, workspaceId, credentials } = this.options;
|
|
1534
|
-
const { path: bpCommand } =
|
|
1477
|
+
const { path: bpCommand } = getBpCli();
|
|
1535
1478
|
const args = [
|
|
1536
1479
|
"deploy",
|
|
1537
1480
|
"--botId",
|
|
@@ -1544,7 +1487,7 @@ class BpDeployCommand extends BaseCommand {
|
|
|
1544
1487
|
"--apiUrl",
|
|
1545
1488
|
credentials.apiUrl
|
|
1546
1489
|
];
|
|
1547
|
-
this.childProcess =
|
|
1490
|
+
this.childProcess = execa3(bpCommand, args, {
|
|
1548
1491
|
cwd: botPath,
|
|
1549
1492
|
stdio: ["ignore", "pipe", "pipe"]
|
|
1550
1493
|
});
|
|
@@ -1582,9 +1525,9 @@ class BpDeployCommand extends BaseCommand {
|
|
|
1582
1525
|
}
|
|
1583
1526
|
}
|
|
1584
1527
|
// src/commands/bp-dev-command.ts
|
|
1585
|
-
import { execa as
|
|
1528
|
+
import { execa as execa4 } from "execa";
|
|
1586
1529
|
import { join as join2 } from "path";
|
|
1587
|
-
import { access as
|
|
1530
|
+
import { access as access2 } from "fs/promises";
|
|
1588
1531
|
class BpDevCommand extends BaseCommand {
|
|
1589
1532
|
options;
|
|
1590
1533
|
childProcess = null;
|
|
@@ -1598,7 +1541,7 @@ class BpDevCommand extends BaseCommand {
|
|
|
1598
1541
|
}
|
|
1599
1542
|
async run() {
|
|
1600
1543
|
const { port, botPath, workspaceId, credentials, sourceMap = true } = this.options;
|
|
1601
|
-
const { path: bpCommand } =
|
|
1544
|
+
const { path: bpCommand } = getBpCli();
|
|
1602
1545
|
const bpArgs = [
|
|
1603
1546
|
"dev",
|
|
1604
1547
|
"--port",
|
|
@@ -1613,7 +1556,7 @@ class BpDevCommand extends BaseCommand {
|
|
|
1613
1556
|
if (sourceMap) {
|
|
1614
1557
|
bpArgs.push("--sourceMap");
|
|
1615
1558
|
}
|
|
1616
|
-
this.childProcess =
|
|
1559
|
+
this.childProcess = execa4(bpCommand, bpArgs, {
|
|
1617
1560
|
cwd: botPath,
|
|
1618
1561
|
env: {
|
|
1619
1562
|
...process.env,
|
|
@@ -1783,7 +1726,7 @@ ${this.stderrLines.join(`
|
|
|
1783
1726
|
const { botPath } = this.options;
|
|
1784
1727
|
const sourceMapPath = join2(botPath, ".botpress", "dist", "index.cjs.map");
|
|
1785
1728
|
try {
|
|
1786
|
-
await
|
|
1729
|
+
await access2(sourceMapPath);
|
|
1787
1730
|
const agentSrcPath = join2(botPath, "..", "..", "src");
|
|
1788
1731
|
await optimizeSourceMap({
|
|
1789
1732
|
sourceMapPath,
|
|
@@ -1812,7 +1755,7 @@ ${this.stderrLines.join(`
|
|
|
1812
1755
|
}
|
|
1813
1756
|
}
|
|
1814
1757
|
// src/commands/bp-chat-command.ts
|
|
1815
|
-
import { execa as
|
|
1758
|
+
import { execa as execa5 } from "execa";
|
|
1816
1759
|
class BpChatCommand extends BaseCommand {
|
|
1817
1760
|
options;
|
|
1818
1761
|
childProcess = null;
|
|
@@ -1821,8 +1764,8 @@ class BpChatCommand extends BaseCommand {
|
|
|
1821
1764
|
this.options = options;
|
|
1822
1765
|
}
|
|
1823
1766
|
async run() {
|
|
1824
|
-
const { botId, workspaceId, credentials
|
|
1825
|
-
const { path: bpCommand } =
|
|
1767
|
+
const { botId, workspaceId, credentials } = this.options;
|
|
1768
|
+
const { path: bpCommand } = getBpCli();
|
|
1826
1769
|
const bpArgs = [
|
|
1827
1770
|
"chat",
|
|
1828
1771
|
"--botId",
|
|
@@ -1834,7 +1777,7 @@ class BpChatCommand extends BaseCommand {
|
|
|
1834
1777
|
"--apiUrl",
|
|
1835
1778
|
credentials.apiUrl
|
|
1836
1779
|
];
|
|
1837
|
-
this.childProcess =
|
|
1780
|
+
this.childProcess = execa5(bpCommand, bpArgs, {
|
|
1838
1781
|
stdio: "inherit"
|
|
1839
1782
|
});
|
|
1840
1783
|
try {
|
|
@@ -2415,7 +2358,7 @@ import { Client as Client4 } from "@botpress/client";
|
|
|
2415
2358
|
// src/integrations/enhanced-cache.ts
|
|
2416
2359
|
import fs6 from "fs/promises";
|
|
2417
2360
|
import path7 from "path";
|
|
2418
|
-
import
|
|
2361
|
+
import os4 from "os";
|
|
2419
2362
|
|
|
2420
2363
|
class EnhancedIntegrationCache {
|
|
2421
2364
|
cacheDir;
|
|
@@ -2424,7 +2367,7 @@ class EnhancedIntegrationCache {
|
|
|
2424
2367
|
noCache;
|
|
2425
2368
|
constructor(noCache = false) {
|
|
2426
2369
|
this.noCache = noCache;
|
|
2427
|
-
this.cacheDir = path7.join(
|
|
2370
|
+
this.cacheDir = path7.join(os4.homedir(), ".adk", "cache", "integrations");
|
|
2428
2371
|
this.resolutionsDir = path7.join(this.cacheDir, "resolutions");
|
|
2429
2372
|
this.definitionsDir = path7.join(this.cacheDir, "definitions");
|
|
2430
2373
|
}
|
|
@@ -2805,13 +2748,13 @@ class IntegrationManager {
|
|
|
2805
2748
|
// src/integrations/cache.ts
|
|
2806
2749
|
import fs7 from "fs/promises";
|
|
2807
2750
|
import path8 from "path";
|
|
2808
|
-
import
|
|
2751
|
+
import os5 from "os";
|
|
2809
2752
|
|
|
2810
2753
|
class IntegrationCache {
|
|
2811
2754
|
cacheDir;
|
|
2812
2755
|
integrationsDir;
|
|
2813
2756
|
constructor() {
|
|
2814
|
-
this.cacheDir = path8.join(
|
|
2757
|
+
this.cacheDir = path8.join(os5.homedir(), ".adk", "cache");
|
|
2815
2758
|
this.integrationsDir = path8.join(this.cacheDir, "integrations");
|
|
2816
2759
|
}
|
|
2817
2760
|
async ensureCacheDir() {
|
|
@@ -2891,10 +2834,10 @@ import * as process2 from "process";
|
|
|
2891
2834
|
import { Client as Client5 } from "@botpress/client";
|
|
2892
2835
|
import * as fs8 from "fs/promises";
|
|
2893
2836
|
import * as path9 from "path";
|
|
2894
|
-
import * as
|
|
2837
|
+
import * as os6 from "os";
|
|
2895
2838
|
class HubCache {
|
|
2896
2839
|
static CACHE_FILE = "botpress-hub-cache.json";
|
|
2897
|
-
static CACHE_DIR = path9.join(
|
|
2840
|
+
static CACHE_DIR = path9.join(os6.homedir(), ".adk", "cache");
|
|
2898
2841
|
static CACHE_PATH = path9.join(HubCache.CACHE_DIR, HubCache.CACHE_FILE);
|
|
2899
2842
|
static CACHE_DURATION = 30 * 60 * 1000;
|
|
2900
2843
|
client;
|
|
@@ -3661,7 +3604,7 @@ import { Client as Client9 } from "@botpress/client";
|
|
|
3661
3604
|
// src/interfaces/enhanced-cache.ts
|
|
3662
3605
|
import fs9 from "fs/promises";
|
|
3663
3606
|
import path12 from "path";
|
|
3664
|
-
import
|
|
3607
|
+
import os7 from "os";
|
|
3665
3608
|
|
|
3666
3609
|
class EnhancedInterfaceCache {
|
|
3667
3610
|
cacheDir;
|
|
@@ -3670,7 +3613,7 @@ class EnhancedInterfaceCache {
|
|
|
3670
3613
|
noCache;
|
|
3671
3614
|
constructor(noCache = false) {
|
|
3672
3615
|
this.noCache = noCache;
|
|
3673
|
-
this.cacheDir = path12.join(
|
|
3616
|
+
this.cacheDir = path12.join(os7.homedir(), ".adk", "cache", "interfaces");
|
|
3674
3617
|
this.resolutionsDir = path12.join(this.cacheDir, "resolutions");
|
|
3675
3618
|
this.definitionsDir = path12.join(this.cacheDir, "definitions");
|
|
3676
3619
|
}
|
|
@@ -4829,7 +4772,7 @@ class AgentProjectGenerator {
|
|
|
4829
4772
|
deploy: "adk deploy"
|
|
4830
4773
|
},
|
|
4831
4774
|
dependencies: {
|
|
4832
|
-
"@botpress/runtime": `^${"1.
|
|
4775
|
+
"@botpress/runtime": `^${"1.9.0"}`
|
|
4833
4776
|
},
|
|
4834
4777
|
devDependencies: {
|
|
4835
4778
|
typescript: "^5.9.3"
|
|
@@ -5405,7 +5348,7 @@ Description: ${tag?.description}`);
|
|
|
5405
5348
|
}
|
|
5406
5349
|
// src/bot-generator/generator.ts
|
|
5407
5350
|
import dedent from "dedent";
|
|
5408
|
-
import { existsSync as
|
|
5351
|
+
import { existsSync as existsSync6 } from "fs";
|
|
5409
5352
|
import fs15 from "fs/promises";
|
|
5410
5353
|
import path30 from "path";
|
|
5411
5354
|
|
|
@@ -5906,7 +5849,7 @@ init_fs();
|
|
|
5906
5849
|
// src/bot-generator/dev-id-manager.ts
|
|
5907
5850
|
import path25 from "path";
|
|
5908
5851
|
import fs12 from "fs/promises";
|
|
5909
|
-
import { existsSync as
|
|
5852
|
+
import { existsSync as existsSync3 } from "fs";
|
|
5910
5853
|
import { Client as Client10 } from "@botpress/client";
|
|
5911
5854
|
class DevIdManager {
|
|
5912
5855
|
projectPath;
|
|
@@ -5942,7 +5885,7 @@ class DevIdManager {
|
|
|
5942
5885
|
}
|
|
5943
5886
|
async readProjectCache() {
|
|
5944
5887
|
try {
|
|
5945
|
-
if (
|
|
5888
|
+
if (existsSync3(this.projectCachePath)) {
|
|
5946
5889
|
const content = await fs12.readFile(this.projectCachePath, "utf-8");
|
|
5947
5890
|
return JSON.parse(content);
|
|
5948
5891
|
}
|
|
@@ -6004,7 +5947,7 @@ class DevIdManager {
|
|
|
6004
5947
|
// src/bot-generator/integration-sync.ts
|
|
6005
5948
|
import path26 from "path";
|
|
6006
5949
|
import fs13 from "fs/promises";
|
|
6007
|
-
import { existsSync as
|
|
5950
|
+
import { existsSync as existsSync4 } from "fs";
|
|
6008
5951
|
class IntegrationSync {
|
|
6009
5952
|
projectPath;
|
|
6010
5953
|
botProjectPath;
|
|
@@ -6044,12 +5987,12 @@ class IntegrationSync {
|
|
|
6044
5987
|
}
|
|
6045
5988
|
async isIntegrationSynced(integration) {
|
|
6046
5989
|
const targetFolder = path26.join(this.bpModulesPath, `integration_${integration.alias}`);
|
|
6047
|
-
if (!
|
|
5990
|
+
if (!existsSync4(targetFolder)) {
|
|
6048
5991
|
return false;
|
|
6049
5992
|
}
|
|
6050
5993
|
try {
|
|
6051
5994
|
const indexPath = path26.join(targetFolder, "index.ts");
|
|
6052
|
-
if (!
|
|
5995
|
+
if (!existsSync4(indexPath)) {
|
|
6053
5996
|
return false;
|
|
6054
5997
|
}
|
|
6055
5998
|
const indexContent = await fs13.readFile(indexPath, "utf-8");
|
|
@@ -6083,17 +6026,17 @@ class IntegrationSync {
|
|
|
6083
6026
|
console.log(integration.name, integration.alias);
|
|
6084
6027
|
const sourceFolder = path26.join(this.bpModulesPath, integration.name.replace("/", "-"));
|
|
6085
6028
|
const targetFolder = path26.join(this.bpModulesPath, `integration_${integration.alias}`);
|
|
6086
|
-
if (!
|
|
6029
|
+
if (!existsSync4(sourceFolder)) {
|
|
6087
6030
|
throw new Error(`Integration folder not found: ${sourceFolder}`);
|
|
6088
6031
|
}
|
|
6089
|
-
if (
|
|
6032
|
+
if (existsSync4(targetFolder)) {
|
|
6090
6033
|
await fs13.rm(targetFolder, { recursive: true, force: true });
|
|
6091
6034
|
}
|
|
6092
6035
|
await fs13.rename(sourceFolder, targetFolder);
|
|
6093
6036
|
}
|
|
6094
6037
|
async removeIntegrationFolder(alias) {
|
|
6095
6038
|
const targetFolder = path26.join(this.bpModulesPath, `integration_${alias}`);
|
|
6096
|
-
if (
|
|
6039
|
+
if (existsSync4(targetFolder)) {
|
|
6097
6040
|
await fs13.rm(targetFolder, { recursive: true, force: true });
|
|
6098
6041
|
}
|
|
6099
6042
|
}
|
|
@@ -6128,7 +6071,7 @@ class IntegrationSync {
|
|
|
6128
6071
|
// src/bot-generator/interface-sync.ts
|
|
6129
6072
|
import path27 from "path";
|
|
6130
6073
|
import fs14 from "fs/promises";
|
|
6131
|
-
import { existsSync as
|
|
6074
|
+
import { existsSync as existsSync5 } from "fs";
|
|
6132
6075
|
init_constants();
|
|
6133
6076
|
class InterfaceSync {
|
|
6134
6077
|
projectPath;
|
|
@@ -6156,12 +6099,12 @@ class InterfaceSync {
|
|
|
6156
6099
|
}
|
|
6157
6100
|
async isInterfaceSynced(interfaceInfo) {
|
|
6158
6101
|
const targetFolder = path27.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
|
|
6159
|
-
if (!
|
|
6102
|
+
if (!existsSync5(targetFolder)) {
|
|
6160
6103
|
return false;
|
|
6161
6104
|
}
|
|
6162
6105
|
try {
|
|
6163
6106
|
const indexPath = path27.join(targetFolder, "index.ts");
|
|
6164
|
-
if (!
|
|
6107
|
+
if (!existsSync5(indexPath)) {
|
|
6165
6108
|
return false;
|
|
6166
6109
|
}
|
|
6167
6110
|
const indexContent = await fs14.readFile(indexPath, "utf-8");
|
|
@@ -6208,17 +6151,17 @@ class InterfaceSync {
|
|
|
6208
6151
|
async renameInterfaceFolder(interfaceInfo) {
|
|
6209
6152
|
const sourceFolder = path27.join(this.bpModulesPath, interfaceInfo.name);
|
|
6210
6153
|
const targetFolder = path27.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
|
|
6211
|
-
if (!
|
|
6154
|
+
if (!existsSync5(sourceFolder)) {
|
|
6212
6155
|
throw new Error(`Interface folder not found: ${sourceFolder}`);
|
|
6213
6156
|
}
|
|
6214
|
-
if (
|
|
6157
|
+
if (existsSync5(targetFolder)) {
|
|
6215
6158
|
await fs14.rm(targetFolder, { recursive: true, force: true });
|
|
6216
6159
|
}
|
|
6217
6160
|
await fs14.rename(sourceFolder, targetFolder);
|
|
6218
6161
|
}
|
|
6219
6162
|
async removeInterfaceFolder(alias) {
|
|
6220
6163
|
const targetFolder = path27.join(this.bpModulesPath, `interface_${pascalCase(alias)}`);
|
|
6221
|
-
if (
|
|
6164
|
+
if (existsSync5(targetFolder)) {
|
|
6222
6165
|
await fs14.rm(targetFolder, { recursive: true, force: true });
|
|
6223
6166
|
}
|
|
6224
6167
|
}
|
|
@@ -6274,7 +6217,7 @@ class BotGenerator {
|
|
|
6274
6217
|
}
|
|
6275
6218
|
async listFilesRecursive(rootDir) {
|
|
6276
6219
|
try {
|
|
6277
|
-
if (!
|
|
6220
|
+
if (!existsSync6(rootDir))
|
|
6278
6221
|
return [];
|
|
6279
6222
|
const result = [];
|
|
6280
6223
|
const walk = async (dir, relativeBase) => {
|
|
@@ -6296,7 +6239,7 @@ class BotGenerator {
|
|
|
6296
6239
|
}
|
|
6297
6240
|
}
|
|
6298
6241
|
async removeEmptyDirectories(rootDir) {
|
|
6299
|
-
if (!
|
|
6242
|
+
if (!existsSync6(rootDir))
|
|
6300
6243
|
return;
|
|
6301
6244
|
const removeIfEmpty = async (dir) => {
|
|
6302
6245
|
const entries = await fs15.readdir(dir, { withFileTypes: true });
|
|
@@ -6951,7 +6894,7 @@ declare module "@botpress/runtime/_types/state" {
|
|
|
6951
6894
|
async copyAssets() {
|
|
6952
6895
|
const assetsPath = path30.join(this.projectPath, "assets");
|
|
6953
6896
|
const targetPath = path30.join(this.outputPath, "assets");
|
|
6954
|
-
if (
|
|
6897
|
+
if (existsSync6(assetsPath)) {
|
|
6955
6898
|
await fs15.mkdir(targetPath, { recursive: true });
|
|
6956
6899
|
await this.copyDirectory(assetsPath, targetPath);
|
|
6957
6900
|
}
|
|
@@ -7286,7 +7229,7 @@ declare module "@botpress/runtime/_types/state" {
|
|
|
7286
7229
|
}
|
|
7287
7230
|
async copyAssetsRuntime() {
|
|
7288
7231
|
const assetsRuntimePath = path30.join(this.projectPath, ".adk", "assets-runtime.ts");
|
|
7289
|
-
if (
|
|
7232
|
+
if (existsSync6(assetsRuntimePath)) {
|
|
7290
7233
|
const content = await fs15.readFile(assetsRuntimePath, "utf-8");
|
|
7291
7234
|
await createFile(path30.join(this.outputPath, "src", "assets-runtime.ts"), await formatCode(content));
|
|
7292
7235
|
}
|
|
@@ -8519,7 +8462,7 @@ class KBSyncFormatter {
|
|
|
8519
8462
|
import { watch as watch2, readdirSync as readdirSync2 } from "fs";
|
|
8520
8463
|
import { EventEmitter as EventEmitter3 } from "events";
|
|
8521
8464
|
import { join as join8, relative as relative3 } from "path";
|
|
8522
|
-
import { existsSync as
|
|
8465
|
+
import { existsSync as existsSync7 } from "fs";
|
|
8523
8466
|
|
|
8524
8467
|
class FileWatcher2 extends EventEmitter3 {
|
|
8525
8468
|
projectPath;
|
|
@@ -8537,12 +8480,12 @@ class FileWatcher2 extends EventEmitter3 {
|
|
|
8537
8480
|
const rootFiles = ["package.json", "agent.json", "agent.config.ts"];
|
|
8538
8481
|
for (const file of rootFiles) {
|
|
8539
8482
|
const filePath = join8(this.projectPath, file);
|
|
8540
|
-
if (
|
|
8483
|
+
if (existsSync7(filePath)) {
|
|
8541
8484
|
this.watchFile(filePath);
|
|
8542
8485
|
}
|
|
8543
8486
|
}
|
|
8544
8487
|
const srcPath = join8(this.projectPath, "src");
|
|
8545
|
-
if (
|
|
8488
|
+
if (existsSync7(srcPath)) {
|
|
8546
8489
|
this.initializeDirectoryState(srcPath);
|
|
8547
8490
|
this.watchDirectory(srcPath);
|
|
8548
8491
|
}
|
|
@@ -8591,7 +8534,7 @@ class FileWatcher2 extends EventEmitter3 {
|
|
|
8591
8534
|
}
|
|
8592
8535
|
}
|
|
8593
8536
|
handleFileChange(filePath) {
|
|
8594
|
-
const fileExists =
|
|
8537
|
+
const fileExists = existsSync7(filePath);
|
|
8595
8538
|
const previousState = this.fileStates.get(filePath);
|
|
8596
8539
|
let changeType;
|
|
8597
8540
|
if (!fileExists && previousState !== undefined) {
|
|
@@ -8631,7 +8574,7 @@ class FileWatcher2 extends EventEmitter3 {
|
|
|
8631
8574
|
this.emit("change", event);
|
|
8632
8575
|
}
|
|
8633
8576
|
updateFileState(filePath) {
|
|
8634
|
-
if (
|
|
8577
|
+
if (existsSync7(filePath)) {
|
|
8635
8578
|
this.fileStates.set(filePath, Date.now());
|
|
8636
8579
|
}
|
|
8637
8580
|
}
|
|
@@ -9069,10 +9012,13 @@ export {
|
|
|
9069
9012
|
BpAddCommand,
|
|
9070
9013
|
BotGenerator,
|
|
9071
9014
|
BaseCommand,
|
|
9015
|
+
BP_CLI_VERSION,
|
|
9016
|
+
BP_CLI_INSTALL_DIR,
|
|
9017
|
+
BP_CLI_BIN_PATH,
|
|
9072
9018
|
AssetsManager,
|
|
9073
9019
|
AgentProjectGenerator,
|
|
9074
9020
|
AgentProject
|
|
9075
9021
|
};
|
|
9076
9022
|
|
|
9077
|
-
//# debugId=
|
|
9023
|
+
//# debugId=172A55A72F67A32A64756E2164756E21
|
|
9078
9024
|
//# sourceMappingURL=index.js.map
|