@botpress/adk 1.13.8 → 1.13.10
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":"generator.d.ts","sourceRoot":"","sources":["../../src/bot-generator/generator.ts"],"names":[],"mappings":"AA6BA,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,YAAY,CAAA;CACpD;AAkBD,qBAAa,YAAY;IACvB,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,UAAU,CAAQ;gBAEd,OAAO,EAAE,mBAAmB;YAK1B,kBAAkB;YAuBlB,sBAAsB;IAsB9B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YA+BjB,yBAAyB;YAkEzB,kBAAkB;YAKlB,oBAAoB;YAKpB,gBAAgB;YAKhB,kBAAkB;YAKlB,0BAA0B;YAK1B,kBAAkB;YAKlB,qBAAqB;YAKrB,yBAAyB;YAKzB,mBAAmB;YAMnB,8BAA8B;YAM9B,oBAAoB;YAyEpB,uBAAuB;
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/bot-generator/generator.ts"],"names":[],"mappings":"AA6BA,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,YAAY,CAAA;CACpD;AAkBD,qBAAa,YAAY;IACvB,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,UAAU,CAAQ;gBAEd,OAAO,EAAE,mBAAmB;YAK1B,kBAAkB;YAuBlB,sBAAsB;IAsB9B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YA+BjB,yBAAyB;YAkEzB,kBAAkB;YAKlB,oBAAoB;YAKpB,gBAAgB;YAKhB,kBAAkB;YAKlB,0BAA0B;YAK1B,kBAAkB;YAKlB,qBAAqB;YAKrB,yBAAyB;YAKzB,mBAAmB;YAMnB,8BAA8B;YAM9B,oBAAoB;YAyEpB,uBAAuB;YAkGvB,8BAA8B;YAiC9B,4BAA4B;YA2B5B,qBAAqB;YAwZrB,gBAAgB;YAoChB,mBAAmB;YAgBnB,gBAAgB;YAiChB,mBAAmB;YAyBnB,UAAU;YAWV,aAAa;IAgBrB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IA6ZnC,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;CAOzC;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8CpF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-types.d.ts","sourceRoot":"","sources":["../../src/generators/event-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;
|
|
1
|
+
{"version":3,"file":"event-types.d.ts","sourceRoot":"","sources":["../../src/generators/event-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAWhE,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAgE7E"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Integration, Interface } from '@botpress/client';
|
|
2
2
|
export declare const sameMajorVersion: (a: string, b: string) => boolean;
|
|
3
|
+
type IntegrationWithAlias = {
|
|
4
|
+
alias: string;
|
|
5
|
+
definition: Integration;
|
|
6
|
+
};
|
|
3
7
|
declare const getInterfaceNames: (int: Interface) => {
|
|
4
8
|
name: string;
|
|
5
9
|
typings: {
|
|
@@ -11,7 +15,7 @@ declare const getInterfaceNames: (int: Interface) => {
|
|
|
11
15
|
actions: string;
|
|
12
16
|
};
|
|
13
17
|
};
|
|
14
|
-
export declare function generateInterfaceTypes(int: Interface, integrations:
|
|
18
|
+
export declare function generateInterfaceTypes(int: Interface, integrations: IntegrationWithAlias[]): Promise<{
|
|
15
19
|
names: ReturnType<typeof getInterfaceNames>;
|
|
16
20
|
files: Record<string, string>;
|
|
17
21
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface-types.d.ts","sourceRoot":"","sources":["../../src/generators/interface-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAQzD,eAAO,MAAM,gBAAgB,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,OAIvD,CAAA;
|
|
1
|
+
{"version":3,"file":"interface-types.d.ts","sourceRoot":"","sources":["../../src/generators/interface-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAQzD,eAAO,MAAM,gBAAgB,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,OAIvD,CAAA;AAWD,KAAK,oBAAoB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,WAAW,CAAA;CAAE,CAAA;AAYtE,QAAA,MAAM,iBAAiB,GAAI,KAAK,SAAS;;;;;;;;;;CAUvC,CAAA;AAEF,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,SAAS,EACd,YAAY,EAAE,oBAAoB,EAAE,GACnC,OAAO,CAAC;IACT,KAAK,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAA;IAC3C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC9B,CAAC,CAuHD"}
|
package/dist/index.js
CHANGED
|
@@ -666,7 +666,7 @@ var PRETTIER_CONFIG, formatCode = async (code, filepath) => {
|
|
|
666
666
|
`));
|
|
667
667
|
return code;
|
|
668
668
|
}
|
|
669
|
-
}, ADK_VERSION = "1.13.
|
|
669
|
+
}, ADK_VERSION = "1.13.10", relative2 = (from, to) => {
|
|
670
670
|
const fromDir = path10.dirname(from);
|
|
671
671
|
const relative3 = path10.relative(fromDir, to);
|
|
672
672
|
return relative3.startsWith(".") ? relative3 : `./${relative3}`;
|
|
@@ -809,7 +809,7 @@ var init_integration_action_types = __esm(() => {
|
|
|
809
809
|
var require_package = __commonJS((exports, module) => {
|
|
810
810
|
module.exports = {
|
|
811
811
|
name: "@botpress/adk",
|
|
812
|
-
version: "1.13.
|
|
812
|
+
version: "1.13.10",
|
|
813
813
|
description: "Core ADK library for building AI agents on Botpress",
|
|
814
814
|
type: "module",
|
|
815
815
|
main: "dist/index.js",
|
|
@@ -856,7 +856,7 @@ var require_package = __commonJS((exports, module) => {
|
|
|
856
856
|
"@botpress/cli": "^5.1.1",
|
|
857
857
|
"@botpress/client": "^1.28.0",
|
|
858
858
|
"@botpress/cognitive": "^0.3.3",
|
|
859
|
-
"@botpress/runtime": "^1.13.
|
|
859
|
+
"@botpress/runtime": "^1.13.10",
|
|
860
860
|
"@botpress/sdk": "^5.0.2",
|
|
861
861
|
"@bpinternal/jex": "^1.2.4",
|
|
862
862
|
"@bpinternal/yargs-extra": "^0.0.21",
|
|
@@ -6280,7 +6280,7 @@ class AgentProjectGenerator {
|
|
|
6280
6280
|
deploy: "adk deploy"
|
|
6281
6281
|
},
|
|
6282
6282
|
dependencies: {
|
|
6283
|
-
"@botpress/runtime": `^${"1.13.
|
|
6283
|
+
"@botpress/runtime": `^${"1.13.10"}`
|
|
6284
6284
|
},
|
|
6285
6285
|
devDependencies: {
|
|
6286
6286
|
typescript: "^5.9.3"
|
|
@@ -6910,7 +6910,7 @@ var getIntegrationInterface = (integration, int) => {
|
|
|
6910
6910
|
return Object.values(integration.interfaces || {}).find((x) => x.name === int.name && sameMajorVersion(x.version, int.version));
|
|
6911
6911
|
};
|
|
6912
6912
|
var getInterfaceHash = (int, integrations) => {
|
|
6913
|
-
const versions = integrations.filter((x) => !!getIntegrationInterface(x, int)).map((x) => `${x.id}|${x.version}|${x.updatedAt}`).sort().join("|");
|
|
6913
|
+
const versions = integrations.filter((x) => !!getIntegrationInterface(x.definition, int)).map((x) => `${x.definition.id}|${x.definition.version}|${x.definition.updatedAt}|${x.alias}`).sort().join("|");
|
|
6914
6914
|
return crypto3.createHash("sha256").update(`${int.id}|${int.version}|${int.updatedAt}|${versions}`).digest("hex");
|
|
6915
6915
|
};
|
|
6916
6916
|
var getInterfaceNames = (int) => ({
|
|
@@ -6927,7 +6927,7 @@ var getInterfaceNames = (int) => ({
|
|
|
6927
6927
|
async function generateInterfaceTypes(int, integrations) {
|
|
6928
6928
|
const names = getInterfaceNames(int);
|
|
6929
6929
|
const hash = getInterfaceHash(int, integrations);
|
|
6930
|
-
const implementors = integrations.filter((x) => !!getIntegrationInterface(x, int)).sort((a, b) => a.
|
|
6930
|
+
const implementors = integrations.filter((x) => !!getIntegrationInterface(x.definition, int)).sort((a, b) => a.alias.localeCompare(b.alias));
|
|
6931
6931
|
const rel = (to) => {
|
|
6932
6932
|
const from = names.paths.index;
|
|
6933
6933
|
return relative2(from, to).replace(/\.ts$/i, "");
|
|
@@ -6938,7 +6938,7 @@ async function generateInterfaceTypes(int, integrations) {
|
|
|
6938
6938
|
// This file is auto-generated from the Botpress ADK
|
|
6939
6939
|
// ADK Version: ${ADK_VERSION}
|
|
6940
6940
|
// Interface: ${int.name}
|
|
6941
|
-
// Integrations: ${implementors.map((x) => x.
|
|
6941
|
+
// Integrations: ${implementors.map((x) => x.alias).join(", ")}
|
|
6942
6942
|
// Version: ${int.version}
|
|
6943
6943
|
// File: ${names.paths.index}
|
|
6944
6944
|
// Hash: ${hash}
|
|
@@ -6959,11 +6959,11 @@ async function generateInterfaceTypes(int, integrations) {
|
|
|
6959
6959
|
`;
|
|
6960
6960
|
let iActions = ``;
|
|
6961
6961
|
let cActions = new Set;
|
|
6962
|
-
for (const integration of implementors) {
|
|
6962
|
+
for (const { alias, definition: integration } of implementors) {
|
|
6963
6963
|
iActions += `
|
|
6964
|
-
// Integration: ${
|
|
6964
|
+
// Integration: ${alias} (${integration.name}@${integration.version})
|
|
6965
6965
|
// Updated at: ${integration.updatedAt}
|
|
6966
|
-
"${
|
|
6966
|
+
"${alias}": {`;
|
|
6967
6967
|
for (const [name, action] of Object.entries(int.actions)) {
|
|
6968
6968
|
const integrationInt = getIntegrationInterface(integration, int);
|
|
6969
6969
|
const mapping = integrationInt?.actions[name]?.name;
|
|
@@ -6979,7 +6979,7 @@ async function generateInterfaceTypes(int, integrations) {
|
|
|
6979
6979
|
}, {});
|
|
6980
6980
|
const input = transforms2.fromJSONSchema(action.input.schema).dereference(entities).toTypescriptType();
|
|
6981
6981
|
const output = transforms2.fromJSONSchema(action.output.schema).dereference(entities).toTypescriptType();
|
|
6982
|
-
cActions.add(`"${
|
|
6982
|
+
cActions.add(`"${alias}:${name}": "${alias}:${mapping}"`);
|
|
6983
6983
|
iActions += `
|
|
6984
6984
|
${toMultilineComment(`Title: ${action.title || name}
|
|
6985
6985
|
Description: ${action.description || "No description"}`)}
|
|
@@ -6997,7 +6997,7 @@ Description: ${action.description || "No description"}`)}
|
|
|
6997
6997
|
// This file is auto-generated from the Botpress ADK
|
|
6998
6998
|
// ADK Version: ${ADK_VERSION}
|
|
6999
6999
|
// Interface: ${int.name}
|
|
7000
|
-
// Integrations: ${implementors.map((x) => x.
|
|
7000
|
+
// Integrations: ${implementors.map((x) => x.alias).join(", ")}
|
|
7001
7001
|
// Version: ${int.version}
|
|
7002
7002
|
// File: ${names.paths.index}
|
|
7003
7003
|
// Hash: ${hash}
|
|
@@ -7012,7 +7012,7 @@ Description: ${action.description || "No description"}`)}
|
|
|
7012
7012
|
${Array.from(cActions).join(`,
|
|
7013
7013
|
`)}
|
|
7014
7014
|
};
|
|
7015
|
-
|
|
7015
|
+
|
|
7016
7016
|
`;
|
|
7017
7017
|
return {
|
|
7018
7018
|
names,
|
|
@@ -7592,9 +7592,21 @@ async function generateEventTypes(project) {
|
|
|
7592
7592
|
const integrationEvents = [];
|
|
7593
7593
|
for (const int of project.integrations) {
|
|
7594
7594
|
for (const event in int.definition?.events || []) {
|
|
7595
|
-
integrationEvents.push(`
|
|
7595
|
+
integrationEvents.push(` "${int.alias}:${event}": Integrations["${int.alias}"]["events"]["${event}"];`);
|
|
7596
|
+
}
|
|
7597
|
+
}
|
|
7598
|
+
const customEvents = [];
|
|
7599
|
+
const config = project.config;
|
|
7600
|
+
const customEventEntries = config?.events || {};
|
|
7601
|
+
for (const [eventName, eventDef] of Object.entries(customEventEntries)) {
|
|
7602
|
+
const schema = eventDef.schema;
|
|
7603
|
+
let payloadType = "{}";
|
|
7604
|
+
if (schema && typeof schema.toTypescriptType === "function") {
|
|
7605
|
+
payloadType = schema.toTypescriptType();
|
|
7596
7606
|
}
|
|
7607
|
+
customEvents.push(` "${eventName}": ${payloadType};`);
|
|
7597
7608
|
}
|
|
7609
|
+
const allEvents = [...integrationEvents, ...customEvents];
|
|
7598
7610
|
const content = `
|
|
7599
7611
|
////////////////////////////////////////////////////////
|
|
7600
7612
|
// DO NOT EDIT THIS FILE DIRECTLY
|
|
@@ -7607,15 +7619,15 @@ type Integrations = import("@botpress/runtime/_types/integrations").Integrations
|
|
|
7607
7619
|
|
|
7608
7620
|
declare module "@botpress/runtime/_types/events" {
|
|
7609
7621
|
/**
|
|
7610
|
-
* Global Events type that includes all integration events.
|
|
7622
|
+
* Global Events type that includes all integration events and custom events.
|
|
7611
7623
|
* Use this type to reference any event that can occur in the system.
|
|
7612
|
-
*
|
|
7624
|
+
*
|
|
7613
7625
|
* Events are namespaced by their source:
|
|
7614
7626
|
* - Integration events: "<integration>:<eventName>" (e.g., "linear:issueCreated")
|
|
7615
|
-
* -
|
|
7627
|
+
* - Custom events: "<eventName>" (e.g., "orderPlaced", "userRegistered")
|
|
7616
7628
|
*/
|
|
7617
7629
|
export type Events = {
|
|
7618
|
-
${
|
|
7630
|
+
${allEvents.join(`
|
|
7619
7631
|
`)}
|
|
7620
7632
|
};
|
|
7621
7633
|
|
|
@@ -8268,12 +8280,12 @@ declare module "@botpress/runtime/_types/state" {
|
|
|
8268
8280
|
const interfacesDir = path33.join(this.projectPath, ".adk", "interfaces");
|
|
8269
8281
|
const existingInterfaceFiles = await this.listFilesRecursive(interfacesDir);
|
|
8270
8282
|
const interfaces = await manager3.loadInterfaces(project.dependencies || {}).then((result) => result.interfaces.filter((int) => int.definition).map((x) => x.definition));
|
|
8271
|
-
const
|
|
8283
|
+
const integrationsWithAlias = await integrationManager.loadIntegrations(project.dependencies || {}).then((result) => result.integrations.filter((int) => int.enabled && int.definition).map((x) => ({ alias: x.alias, definition: x.definition })));
|
|
8272
8284
|
let imports = new Set;
|
|
8273
8285
|
let aliases = new Set;
|
|
8274
8286
|
let files = new Set;
|
|
8275
8287
|
for (const int of interfaces) {
|
|
8276
|
-
const types6 = await generateInterfaceTypes(int,
|
|
8288
|
+
const types6 = await generateInterfaceTypes(int, integrationsWithAlias);
|
|
8277
8289
|
imports.add(`import { ${types6.names.typings.index} } from "./${path33.join("interfaces", types6.names.paths.index).replace(/\\/g, "/")}";`);
|
|
8278
8290
|
aliases.add(`"${types6.names.name}": ${types6.names.typings.index}`);
|
|
8279
8291
|
for (const [filePath, content] of Object.entries(types6.files)) {
|
|
@@ -8488,6 +8500,24 @@ declare module "@botpress/runtime/_types/state" {
|
|
|
8488
8500
|
};
|
|
8489
8501
|
}
|
|
8490
8502
|
const toEventName = (ename) => ename.replaceAll(/[^a-zA-Z0-9]/g, "").toLowerCase();
|
|
8503
|
+
const customEventDefs = [];
|
|
8504
|
+
const configForEvents = project.config;
|
|
8505
|
+
const customEvents = configForEvents?.events || {};
|
|
8506
|
+
for (const [eventName, eventDef] of Object.entries(customEvents)) {
|
|
8507
|
+
const schema = eventDef.schema;
|
|
8508
|
+
let schemaCode = "z.object({})";
|
|
8509
|
+
if (schema && typeof schema.toJSONSchema === "function") {
|
|
8510
|
+
schemaCode = transforms3.fromJSONSchema(schema.toJSONSchema()).toTypescriptSchema();
|
|
8511
|
+
}
|
|
8512
|
+
const parts = [`schema: ${schemaCode}`];
|
|
8513
|
+
if (eventDef.description) {
|
|
8514
|
+
parts.unshift(`description: ${JSON.stringify(eventDef.description)}`);
|
|
8515
|
+
}
|
|
8516
|
+
customEventDefs.push(`"${eventName}": {
|
|
8517
|
+
${parts.join(`,
|
|
8518
|
+
`)}
|
|
8519
|
+
}`);
|
|
8520
|
+
}
|
|
8491
8521
|
const configSchema = project.config?.configuration?.schema;
|
|
8492
8522
|
const configSchemaCode = configSchema ? transforms3.fromJSONSchema(configSchema.toJSONSchema()).toTypescriptSchema() : undefined;
|
|
8493
8523
|
const content = dedent`
|
|
@@ -8599,6 +8629,8 @@ configuration: {
|
|
|
8599
8629
|
[WorkflowDataRequestEvent.name]: {
|
|
8600
8630
|
schema: WorkflowDataRequestEvent.schema,
|
|
8601
8631
|
},
|
|
8632
|
+
${customEventDefs.length > 0 ? customEventDefs.join(`,
|
|
8633
|
+
`) + "," : ""}
|
|
8602
8634
|
},
|
|
8603
8635
|
|
|
8604
8636
|
states: {
|
|
@@ -11176,4 +11208,4 @@ export {
|
|
|
11176
11208
|
AgentProject
|
|
11177
11209
|
};
|
|
11178
11210
|
|
|
11179
|
-
//# debugId=
|
|
11211
|
+
//# debugId=34DC1EC72B61FDE964756E2164756E21
|