@botpress/adk 1.11.0 → 1.11.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.
@@ -1 +1 @@
1
- {"version":3,"file":"conversation-types.d.ts","sourceRoot":"","sources":["../../src/generators/conversation-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAKhE,wBAAsB,yBAAyB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAsFpF"}
1
+ {"version":3,"file":"conversation-types.d.ts","sourceRoot":"","sources":["../../src/generators/conversation-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAiChE,wBAAsB,yBAAyB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA6HpF"}
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.11.0", relative2 = (from, to) => {
657
+ }, ADK_VERSION = "1.11.2", 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.11.0",
800
+ version: "1.11.2",
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.11.0",
847
+ "@botpress/runtime": "^1.11.2",
848
848
  "@botpress/sdk": "^4.18.1",
849
849
  "@bpinternal/jex": "^1.2.4",
850
850
  "@bpinternal/yargs-extra": "^0.0.21",
@@ -4866,7 +4866,7 @@ class AgentProjectGenerator {
4866
4866
  deploy: "adk deploy"
4867
4867
  },
4868
4868
  dependencies: {
4869
- "@botpress/runtime": `^${"1.11.0"}`
4869
+ "@botpress/runtime": `^${"1.11.2"}`
4870
4870
  },
4871
4871
  devDependencies: {
4872
4872
  typescript: "^5.9.3"
@@ -6022,6 +6022,24 @@ ${typeDefinitions || " // No workflows defined yet"}
6022
6022
  init_utils();
6023
6023
  init_fs();
6024
6024
  import path25 from "path";
6025
+ function hasConversationIdProperty(schema) {
6026
+ if (!schema || typeof schema !== "object") {
6027
+ return false;
6028
+ }
6029
+ if (schema.properties && "conversationId" in schema.properties) {
6030
+ return true;
6031
+ }
6032
+ for (const key of ["allOf", "anyOf", "oneOf"]) {
6033
+ if (Array.isArray(schema[key])) {
6034
+ for (const subSchema of schema[key]) {
6035
+ if (hasConversationIdProperty(subSchema)) {
6036
+ return true;
6037
+ }
6038
+ }
6039
+ }
6040
+ }
6041
+ return false;
6042
+ }
6025
6043
  async function generateConversationTypes(project) {
6026
6044
  const conversationTypes = {};
6027
6045
  for (const conversationRef of project.conversations) {
@@ -6052,6 +6070,20 @@ async function generateConversationTypes(project) {
6052
6070
  console.error(`Failed to process conversation ${conversationRef.export}:`, error);
6053
6071
  }
6054
6072
  }
6073
+ const routableEventsByIntegration = {};
6074
+ for (const int of project.integrations) {
6075
+ if (!int.definition?.events)
6076
+ continue;
6077
+ const routableEvents = [];
6078
+ for (const [eventName, event] of Object.entries(int.definition.events)) {
6079
+ if (hasConversationIdProperty(event.schema)) {
6080
+ routableEvents.push(`${int.alias}:${eventName}`);
6081
+ }
6082
+ }
6083
+ if (routableEvents.length > 0) {
6084
+ routableEventsByIntegration[int.alias] = routableEvents;
6085
+ }
6086
+ }
6055
6087
  const channelDefinitions = Object.entries(conversationTypes).filter(([channel]) => channel !== "*").map(([channel, info]) => {
6056
6088
  const [integration, channelName] = channel.split(".");
6057
6089
  return ` "${channel}": {
@@ -6064,6 +6096,13 @@ async function generateConversationTypes(project) {
6064
6096
  events: Integrations["${integration}"]["events"];
6065
6097
  };`;
6066
6098
  }).join(`
6099
+ `);
6100
+ const routableEventsDefinitions = Object.entries(conversationTypes).filter(([channel]) => channel !== "*").map(([channel]) => {
6101
+ const [integration] = channel.split(".");
6102
+ const events = routableEventsByIntegration[integration] || [];
6103
+ const eventsTuple = events.length > 0 ? `readonly [${events.map((e) => `"${e}"`).join(", ")}]` : "readonly []";
6104
+ return ` "${channel}": ${eventsTuple};`;
6105
+ }).join(`
6067
6106
  `);
6068
6107
  const content = `
6069
6108
  ////////////////////////////////////////////////////////
@@ -6081,6 +6120,14 @@ declare module "@botpress/runtime/_types/conversations" {
6081
6120
  export type ConversationDefinitions = {
6082
6121
  ${channelDefinitions || " // No conversations defined yet"}
6083
6122
  };
6123
+
6124
+ /**
6125
+ * Events that can be routed to conversations (events with conversationId property).
6126
+ * Keyed by channel, containing a tuple of event names that have conversationId.
6127
+ */
6128
+ export type ConversationRoutableEvents = {
6129
+ ${routableEventsDefinitions || " // No routable events found"}
6130
+ };
6084
6131
  }
6085
6132
  `;
6086
6133
  const conversationTypesPath = path25.join(project.path, ".adk", "conversation-types.d.ts");
@@ -9441,5 +9488,5 @@ export {
9441
9488
  AgentProject
9442
9489
  };
9443
9490
 
9444
- //# debugId=E605CF41773DDE2A64756E2164756E21
9491
+ //# debugId=D1BF745DF658981964756E2164756E21
9445
9492
  //# sourceMappingURL=index.js.map