@botpress/adk 1.14.0 → 1.15.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-wrapper.d.ts","sourceRoot":"","sources":["../../src/generators/client-wrapper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client-wrapper.d.ts","sourceRoot":"","sources":["../../src/generators/client-wrapper.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAShE,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAkdhF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tests.d.ts","sourceRoot":"","sources":["../../src/generators/tests.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB,GAAI,aAAa,MAAM,EAAE,SAAS,MAAM,oDAiBrE,CAAA;AAEJ,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM;;;;;;;;
|
|
1
|
+
{"version":3,"file":"tests.d.ts","sourceRoot":"","sources":["../../src/generators/tests.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB,GAAI,aAAa,MAAM,EAAE,SAAS,MAAM,oDAiBrE,CAAA;AAEJ,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM;;;;;;;;iBAkB8i8+B,CAAC;uBAA0H,CAAC;;;;;;;;iBAAuU,CAAC;uBAAyH,CAAC;;;;sBAAsM,CAAC;;;;;;;iBAA6S,CAAC;uBAA0H,CAAC;oBAAkC,CAAC;qBAAoC,CAAC;;;;;;;;;;;sBAA2Y,CAAC;;;;;;;iBAA8O,CAAC;uBAA2H,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA/6rN,CAAC;uBAA0H,CAAC;;;;;;;;iBAAuU,CAAC;uBAAyH,CAAC;;;;sBAAsM,CAAC;;;;;;;iBAA6S,CAAC;uBAA0H,CAAC;oBAAkC,CAAC;qBAAoC,CAAC;;;;;;;;;;;sBAA2Y,CAAC;;;;;;;iBAA8O,CAAC;uBAA2H,CAAC;;;;;;;;;;;;;;;;;;;;;;EADpp4xB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,5 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
4
2
|
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
-
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
-
for (let key of __getOwnPropNames(mod))
|
|
11
|
-
if (!__hasOwnProp.call(to, key))
|
|
12
|
-
__defProp(to, key, {
|
|
13
|
-
get: () => mod[key],
|
|
14
|
-
enumerable: true
|
|
15
|
-
});
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
3
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
4
|
var __export = (target, all) => {
|
|
20
5
|
for (var name in all)
|
|
@@ -666,7 +651,7 @@ var PRETTIER_CONFIG, formatCode = async (code, filepath) => {
|
|
|
666
651
|
`));
|
|
667
652
|
return code;
|
|
668
653
|
}
|
|
669
|
-
}, ADK_VERSION = "1.
|
|
654
|
+
}, ADK_VERSION = "1.15.0", relative2 = (from, to) => {
|
|
670
655
|
const fromDir = path10.dirname(from);
|
|
671
656
|
const relative3 = path10.relative(fromDir, to);
|
|
672
657
|
return relative3.startsWith(".") ? relative3 : `./${relative3}`;
|
|
@@ -809,7 +794,7 @@ var init_integration_action_types = __esm(() => {
|
|
|
809
794
|
var require_package = __commonJS((exports, module) => {
|
|
810
795
|
module.exports = {
|
|
811
796
|
name: "@botpress/adk",
|
|
812
|
-
version: "1.
|
|
797
|
+
version: "1.15.0",
|
|
813
798
|
description: "Core ADK library for building AI agents on Botpress",
|
|
814
799
|
type: "module",
|
|
815
800
|
main: "dist/index.js",
|
|
@@ -854,10 +839,10 @@ var require_package = __commonJS((exports, module) => {
|
|
|
854
839
|
},
|
|
855
840
|
dependencies: {
|
|
856
841
|
"@botpress/cli": "^5.2.0",
|
|
857
|
-
"@botpress/client": "^1.
|
|
858
|
-
"@botpress/cognitive": "^0.3.
|
|
859
|
-
"@botpress/runtime": "^1.
|
|
860
|
-
"@botpress/sdk": "^5.
|
|
842
|
+
"@botpress/client": "^1.35.0",
|
|
843
|
+
"@botpress/cognitive": "^0.3.14",
|
|
844
|
+
"@botpress/runtime": "^1.15.0",
|
|
845
|
+
"@botpress/sdk": "^5.4.3",
|
|
861
846
|
"@bpinternal/jex": "^1.2.4",
|
|
862
847
|
"@bpinternal/yargs-extra": "^0.0.21",
|
|
863
848
|
"@parcel/watcher": "^2.5.1",
|
|
@@ -1100,7 +1085,7 @@ import os3 from "os";
|
|
|
1100
1085
|
import path4 from "path";
|
|
1101
1086
|
import createDebug from "debug";
|
|
1102
1087
|
var debug = createDebug("adk:bp-cli");
|
|
1103
|
-
var BP_CLI_VERSION = "5.
|
|
1088
|
+
var BP_CLI_VERSION = "5.5.6";
|
|
1104
1089
|
var BP_CLI_INSTALL_ALL = path4.join(os3.homedir(), ".adk", `bp-cli`);
|
|
1105
1090
|
var BP_CLI_INSTALL_DIR = path4.join(BP_CLI_INSTALL_ALL, BP_CLI_VERSION);
|
|
1106
1091
|
var BP_CLI_BIN_PATH = path4.join(BP_CLI_INSTALL_DIR, "node_modules", "@botpress", "cli", "bin.js");
|
|
@@ -6408,7 +6393,7 @@ class AgentProjectGenerator {
|
|
|
6408
6393
|
deploy: "adk deploy"
|
|
6409
6394
|
},
|
|
6410
6395
|
dependencies: {
|
|
6411
|
-
"@botpress/runtime": `^${"1.
|
|
6396
|
+
"@botpress/runtime": `^${"1.15.0"}`
|
|
6412
6397
|
},
|
|
6413
6398
|
devDependencies: {
|
|
6414
6399
|
typescript: "^5.9.3"
|
|
@@ -7022,6 +7007,8 @@ Description: ${tag?.description}`);
|
|
|
7022
7007
|
init_utils();
|
|
7023
7008
|
init_fs();
|
|
7024
7009
|
import path18 from "path";
|
|
7010
|
+
import crypto3 from "crypto";
|
|
7011
|
+
import { readFile as readFile3 } from "fs/promises";
|
|
7025
7012
|
import { BuiltInWorkflows as BuiltInWorkflows2 } from "@botpress/runtime/internal";
|
|
7026
7013
|
function isBuiltinWorkflow(name) {
|
|
7027
7014
|
return !!Object.values(BuiltInWorkflows2).find((x) => x.name === name);
|
|
@@ -7045,7 +7032,7 @@ async function generateClientWrapper(project) {
|
|
|
7045
7032
|
const actionModule = await import(`${absolutePath}?t=${Date.now()}`);
|
|
7046
7033
|
const actionInstance = actionModule[action.export] || actionModule.default;
|
|
7047
7034
|
if (actionInstance && actionInstance.input && actionInstance.output) {
|
|
7048
|
-
const inputType = actionInstance.input.toTypescriptType ? actionInstance.input.toTypescriptType() : "any";
|
|
7035
|
+
const inputType = actionInstance.input.toTypescriptType ? actionInstance.input.toTypescriptType({ treatDefaultAsOptional: true }) : "any";
|
|
7049
7036
|
const outputType = actionInstance.output.toTypescriptType ? actionInstance.output.toTypescriptType() : "any";
|
|
7050
7037
|
actionTypes.push({
|
|
7051
7038
|
name: action.definition.name,
|
|
@@ -7072,7 +7059,7 @@ async function generateClientWrapper(project) {
|
|
|
7072
7059
|
const workflowModule = await import(`${workflowPath}?t=${Date.now()}`);
|
|
7073
7060
|
const workflowInstance = workflowModule[workflow.export] || workflowModule.default;
|
|
7074
7061
|
if (workflowInstance) {
|
|
7075
|
-
const inputType = workflowInstance.inputSchema ? workflowInstance.inputSchema.toTypescriptType?.() || "any" : "{}";
|
|
7062
|
+
const inputType = workflowInstance.inputSchema ? workflowInstance.inputSchema.toTypescriptType?.({ treatDefaultAsOptional: true }) || "any" : "{}";
|
|
7076
7063
|
const outputType = workflowInstance.outputSchema ? workflowInstance.outputSchema.toTypescriptType?.() || "any" : "{}";
|
|
7077
7064
|
workflowTypes.push({
|
|
7078
7065
|
name: workflow.definition.name,
|
|
@@ -7102,7 +7089,7 @@ async function generateClientWrapper(project) {
|
|
|
7102
7089
|
} else {
|
|
7103
7090
|
schema = colDef;
|
|
7104
7091
|
}
|
|
7105
|
-
const tsType = schema.toTypescriptType ? schema.toTypescriptType() : "any";
|
|
7092
|
+
const tsType = schema.toTypescriptType ? schema.toTypescriptType({ treatDefaultAsOptional: true }) : "any";
|
|
7106
7093
|
if (!computed) {
|
|
7107
7094
|
inputColumns.push(`${colName}: ${tsType}`);
|
|
7108
7095
|
}
|
|
@@ -7399,7 +7386,16 @@ export function createAdkClient(client: Client): AdkClient {
|
|
|
7399
7386
|
}
|
|
7400
7387
|
`;
|
|
7401
7388
|
const clientWrapperPath = path18.join(project.path, ".adk", "client.ts");
|
|
7402
|
-
|
|
7389
|
+
const formattedContent = await formatCode(content);
|
|
7390
|
+
const contentHash = crypto3.createHash("sha256").update(formattedContent.replace(/\/\/ Generated at: .+\n/, "")).digest("hex");
|
|
7391
|
+
try {
|
|
7392
|
+
const existingContent = await readFile3(clientWrapperPath, "utf-8");
|
|
7393
|
+
const existingHash = crypto3.createHash("sha256").update(existingContent.replace(/\/\/ Generated at: .+\n/, "")).digest("hex");
|
|
7394
|
+
if (contentHash === existingHash) {
|
|
7395
|
+
return;
|
|
7396
|
+
}
|
|
7397
|
+
} catch {}
|
|
7398
|
+
await createFile(clientWrapperPath, formattedContent);
|
|
7403
7399
|
}
|
|
7404
7400
|
// src/bot-generator/generator.ts
|
|
7405
7401
|
import dedent from "dedent";
|
|
@@ -7409,7 +7405,7 @@ import path34 from "path";
|
|
|
7409
7405
|
|
|
7410
7406
|
// src/generators/interface-types.ts
|
|
7411
7407
|
import { transforms as transforms2 } from "@botpress/sdk";
|
|
7412
|
-
import
|
|
7408
|
+
import crypto4 from "crypto";
|
|
7413
7409
|
import path19 from "path";
|
|
7414
7410
|
init_utils();
|
|
7415
7411
|
var sameMajorVersion = (a, b) => {
|
|
@@ -7422,7 +7418,7 @@ var getIntegrationInterface = (integration, int) => {
|
|
|
7422
7418
|
};
|
|
7423
7419
|
var getInterfaceHash = (int, integrations) => {
|
|
7424
7420
|
const versions = integrations.filter((x) => !!getIntegrationInterface(x.definition, int)).map((x) => `${x.definition.id}|${x.definition.version}|${x.definition.updatedAt}|${x.alias}`).sort().join("|");
|
|
7425
|
-
return
|
|
7421
|
+
return crypto4.createHash("sha256").update(`${int.id}|${int.version}|${int.updatedAt}|${versions}`).digest("hex");
|
|
7426
7422
|
};
|
|
7427
7423
|
var getInterfaceNames = (int) => ({
|
|
7428
7424
|
name: camelCase(int.name),
|
|
@@ -8921,9 +8917,9 @@ declare module "@botpress/runtime/_types/state" {
|
|
|
8921
8917
|
if (project.config?.workflow?.tags) {
|
|
8922
8918
|
Object.assign(workflowTags, project.config.workflow.tags);
|
|
8923
8919
|
}
|
|
8924
|
-
const
|
|
8920
|
+
const crypto5 = __require("crypto");
|
|
8925
8921
|
const hashString = (str) => {
|
|
8926
|
-
return
|
|
8922
|
+
return crypto5.createHash("md5").update(str).digest("hex").substring(0, 5).toUpperCase();
|
|
8927
8923
|
};
|
|
8928
8924
|
for (const trigger of project.triggers) {
|
|
8929
8925
|
const triggerName = trigger.definition.name;
|
|
@@ -10174,7 +10170,7 @@ class TableManager {
|
|
|
10174
10170
|
}
|
|
10175
10171
|
}
|
|
10176
10172
|
// src/knowledge/manager.ts
|
|
10177
|
-
import
|
|
10173
|
+
import crypto5 from "crypto";
|
|
10178
10174
|
import path35 from "path";
|
|
10179
10175
|
import fs17 from "fs/promises";
|
|
10180
10176
|
import { glob } from "glob";
|
|
@@ -10265,7 +10261,7 @@ class KnowledgeManager {
|
|
|
10265
10261
|
const sortedEntries = Object.entries(fileHashes).sort(([a], [b]) => a.localeCompare(b));
|
|
10266
10262
|
const combined = sortedEntries.map(([filePath, hash]) => `${filePath}:${hash}`).join(`
|
|
10267
10263
|
`);
|
|
10268
|
-
return
|
|
10264
|
+
return crypto5.createHash("sha256").update(combined).digest("hex");
|
|
10269
10265
|
}
|
|
10270
10266
|
async listRemoteKnowledgeBases() {
|
|
10271
10267
|
const client = await this.getClient();
|
|
@@ -10380,7 +10376,7 @@ class KnowledgeManager {
|
|
|
10380
10376
|
}
|
|
10381
10377
|
computeConfigHash(config) {
|
|
10382
10378
|
const sortedConfig = JSON.stringify(config, Object.keys(config).sort());
|
|
10383
|
-
return
|
|
10379
|
+
return crypto5.createHash("sha256").update(sortedConfig).digest("hex");
|
|
10384
10380
|
}
|
|
10385
10381
|
async syncWebsiteSource(kbName, kbId, force) {
|
|
10386
10382
|
const client = await this.getClient();
|
|
@@ -10634,7 +10630,7 @@ class KnowledgeManager {
|
|
|
10634
10630
|
for (const file of files) {
|
|
10635
10631
|
const relPath = path35.relative(directory, file);
|
|
10636
10632
|
const content = await fs17.readFile(file);
|
|
10637
|
-
hashes[relPath] =
|
|
10633
|
+
hashes[relPath] = crypto5.createHash("sha256").update(content).digest("hex");
|
|
10638
10634
|
}
|
|
10639
10635
|
this.fileHashCache.set(directory, hashes);
|
|
10640
10636
|
return hashes;
|
|
@@ -10838,7 +10834,7 @@ class KnowledgeManager {
|
|
|
10838
10834
|
async upsertFile(client, local, dsId, tags, force, cachedHash) {
|
|
10839
10835
|
const key = `data_source://document/${dsId}/${local.rel}`;
|
|
10840
10836
|
const content = await fs17.readFile(local.abs);
|
|
10841
|
-
const hash = cachedHash ??
|
|
10837
|
+
const hash = cachedHash ?? crypto5.createHash("sha256").update(content).digest("hex");
|
|
10842
10838
|
try {
|
|
10843
10839
|
const { file } = await client.getFile({ id: key });
|
|
10844
10840
|
if (!force && isFileMetadata(file.metadata) && file.metadata.hash === hash) {
|
|
@@ -11863,4 +11859,4 @@ export {
|
|
|
11863
11859
|
AgentProject
|
|
11864
11860
|
};
|
|
11865
11861
|
|
|
11866
|
-
//# debugId=
|
|
11862
|
+
//# debugId=EB9DD7B62C5F67EA64756E2164756E21
|