@botpress/adk 1.14.1 → 1.15.1

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":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAShE,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA6dhF"}
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;;;;;;;;iBAkBi3/6B,CAAC;uBAA0H,CAAC;;;;;;;;iBAAuU,CAAC;uBAAyH,CAAC;;;;sBAAsM,CAAC;;;;;;;iBAA6S,CAAC;uBAA0H,CAAC;oBAAkC,CAAC;qBAAoC,CAAC;;;;;;;;;;;sBAA2Y,CAAC;;;;;;;iBAA8O,CAAC;uBAA2H,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAApnlN,CAAC;uBAA0H,CAAC;;;;;;;;iBAAuU,CAAC;uBAAyH,CAAC;;;;sBAAsM,CAAC;;;;;;;iBAA6S,CAAC;uBAA0H,CAAC;oBAAkC,CAAC;qBAAoC,CAAC;;;;;;;;;;;sBAA2Y,CAAC;;;;;;;iBAA8O,CAAC;uBAA2H,CAAC;;;;;;;;;;;;;;;;;;;;;;EADlxiuB,CAAA"}
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
@@ -651,7 +651,7 @@ var PRETTIER_CONFIG, formatCode = async (code, filepath) => {
651
651
  `));
652
652
  return code;
653
653
  }
654
- }, ADK_VERSION = "1.14.1", relative2 = (from, to) => {
654
+ }, ADK_VERSION = "1.15.1", relative2 = (from, to) => {
655
655
  const fromDir = path10.dirname(from);
656
656
  const relative3 = path10.relative(fromDir, to);
657
657
  return relative3.startsWith(".") ? relative3 : `./${relative3}`;
@@ -794,7 +794,7 @@ var init_integration_action_types = __esm(() => {
794
794
  var require_package = __commonJS((exports, module) => {
795
795
  module.exports = {
796
796
  name: "@botpress/adk",
797
- version: "1.14.1",
797
+ version: "1.15.1",
798
798
  description: "Core ADK library for building AI agents on Botpress",
799
799
  type: "module",
800
800
  main: "dist/index.js",
@@ -838,11 +838,11 @@ var require_package = __commonJS((exports, module) => {
838
838
  url: "https://github.com/botpress/adk"
839
839
  },
840
840
  dependencies: {
841
- "@botpress/cli": "^5.2.0",
842
- "@botpress/client": "^1.28.0",
843
- "@botpress/cognitive": "^0.3.3",
844
- "@botpress/runtime": "^1.14.1",
845
- "@botpress/sdk": "^5.1.0",
841
+ "@botpress/cli": "catalog:",
842
+ "@botpress/client": "catalog:",
843
+ "@botpress/cognitive": "catalog:",
844
+ "@botpress/runtime": "workspace:*",
845
+ "@botpress/sdk": "catalog:",
846
846
  "@bpinternal/jex": "^1.2.4",
847
847
  "@bpinternal/yargs-extra": "^0.0.21",
848
848
  "@parcel/watcher": "^2.5.1",
@@ -851,7 +851,7 @@ var require_package = __commonJS((exports, module) => {
851
851
  execa: "9.6.1",
852
852
  glob: "^11.1.0",
853
853
  luxon: "^3.7.2",
854
- prettier: "^3.7.4",
854
+ prettier: "catalog:",
855
855
  semver: "^7.7.2",
856
856
  "ts-morph": "^27.0.2"
857
857
  },
@@ -867,9 +867,9 @@ var require_package = __commonJS((exports, module) => {
867
867
  },
868
868
  engines: {
869
869
  node: ">=22.0.0",
870
- bun: ">=1.3.0"
870
+ bun: ">=1.3.9"
871
871
  },
872
- packageManager: "bun@1.3.0"
872
+ packageManager: "bun@1.3.9"
873
873
  };
874
874
  });
875
875
 
@@ -1085,7 +1085,7 @@ import os3 from "os";
1085
1085
  import path4 from "path";
1086
1086
  import createDebug from "debug";
1087
1087
  var debug = createDebug("adk:bp-cli");
1088
- var BP_CLI_VERSION = "5.2.0";
1088
+ var BP_CLI_VERSION = "5.5.6";
1089
1089
  var BP_CLI_INSTALL_ALL = path4.join(os3.homedir(), ".adk", `bp-cli`);
1090
1090
  var BP_CLI_INSTALL_DIR = path4.join(BP_CLI_INSTALL_ALL, BP_CLI_VERSION);
1091
1091
  var BP_CLI_BIN_PATH = path4.join(BP_CLI_INSTALL_DIR, "node_modules", "@botpress", "cli", "bin.js");
@@ -6393,7 +6393,7 @@ class AgentProjectGenerator {
6393
6393
  deploy: "adk deploy"
6394
6394
  },
6395
6395
  dependencies: {
6396
- "@botpress/runtime": `^${"1.14.1"}`
6396
+ "@botpress/runtime": `^${"1.15.1"}`
6397
6397
  },
6398
6398
  devDependencies: {
6399
6399
  typescript: "^5.9.3"
@@ -7019,32 +7019,57 @@ async function generateClientWrapper(project) {
7019
7019
  if (action.definition.attributes?.visibility === "hidden") {
7020
7020
  continue;
7021
7021
  }
7022
- if (action.path === "<adk:builtin>") {
7022
+ try {
7023
+ if (action.path === "<adk:builtin>") {
7024
+ actionTypes.push({
7025
+ name: action.definition.name,
7026
+ inputType: "any",
7027
+ outputType: "any"
7028
+ });
7029
+ continue;
7030
+ }
7031
+ const absolutePath = path18.join(project.path, action.path);
7032
+ const actionModule = await import(`${absolutePath}?t=${Date.now()}`);
7033
+ const actionInstance = actionModule[action.export] || actionModule.default;
7034
+ if (actionInstance && actionInstance.input && actionInstance.output) {
7035
+ const inputType = actionInstance.input.toTypescriptType ? actionInstance.input.toTypescriptType({ treatDefaultAsOptional: true }) : "any";
7036
+ const outputType = actionInstance.output.toTypescriptType ? actionInstance.output.toTypescriptType() : "any";
7037
+ actionTypes.push({
7038
+ name: action.definition.name,
7039
+ inputType,
7040
+ outputType
7041
+ });
7042
+ }
7043
+ } catch (error) {
7044
+ console.warn(`Warning: Could not process action ${action.definition.name}:`, error);
7023
7045
  actionTypes.push({
7024
7046
  name: action.definition.name,
7025
- path: "",
7026
- export: "",
7027
- isBuiltin: true
7047
+ inputType: "any",
7048
+ outputType: "any"
7028
7049
  });
7029
- continue;
7030
7050
  }
7031
- actionTypes.push({
7032
- name: action.definition.name,
7033
- path: action.path,
7034
- export: action.export,
7035
- isBuiltin: false
7036
- });
7037
7051
  }
7038
7052
  const workflowTypes = [];
7039
7053
  for (const workflow of project.workflows) {
7040
- if (isBuiltinWorkflow(workflow.definition.name)) {
7041
- continue;
7054
+ try {
7055
+ if (isBuiltinWorkflow(workflow.definition.name)) {
7056
+ continue;
7057
+ }
7058
+ const workflowPath = path18.join(project.path, workflow.path);
7059
+ const workflowModule = await import(`${workflowPath}?t=${Date.now()}`);
7060
+ const workflowInstance = workflowModule[workflow.export] || workflowModule.default;
7061
+ if (workflowInstance) {
7062
+ const inputType = workflowInstance.inputSchema ? workflowInstance.inputSchema.toTypescriptType?.({ treatDefaultAsOptional: true }) || "any" : "{}";
7063
+ const outputType = workflowInstance.outputSchema ? workflowInstance.outputSchema.toTypescriptType?.() || "any" : "{}";
7064
+ workflowTypes.push({
7065
+ name: workflow.definition.name,
7066
+ inputType,
7067
+ outputType
7068
+ });
7069
+ }
7070
+ } catch (error) {
7071
+ console.warn(`Warning: Could not process workflow ${workflow.definition.name}:`, error);
7042
7072
  }
7043
- workflowTypes.push({
7044
- name: workflow.definition.name,
7045
- path: workflow.path,
7046
- export: workflow.export
7047
- });
7048
7073
  }
7049
7074
  const tableTypes = [];
7050
7075
  for (const table of project.tables) {
@@ -7064,7 +7089,7 @@ async function generateClientWrapper(project) {
7064
7089
  } else {
7065
7090
  schema = colDef;
7066
7091
  }
7067
- const tsType = schema.toTypescriptType ? schema.toTypescriptType() : "any";
7092
+ const tsType = schema.toTypescriptType ? schema.toTypescriptType({ treatDefaultAsOptional: true }) : "any";
7068
7093
  if (!computed) {
7069
7094
  inputColumns.push(`${colName}: ${tsType}`);
7070
7095
  }
@@ -7080,21 +7105,6 @@ async function generateClientWrapper(project) {
7080
7105
  console.warn(`Warning: Could not process table ${table.definition.name}:`, error);
7081
7106
  }
7082
7107
  }
7083
- const actionImportMap = new Map;
7084
- let actionImportIndex = 0;
7085
- const actionImports = actionTypes.filter((action) => !action.isBuiltin).map((action) => {
7086
- const importPath = action.path.replace(/\.ts$/, ".js");
7087
- actionImportMap.set(action.name, actionImportIndex);
7088
- const importStatement = `import type * as Action${actionImportIndex} from '../${importPath}'`;
7089
- actionImportIndex++;
7090
- return importStatement;
7091
- }).join(`
7092
- `);
7093
- const workflowImports = workflowTypes.map((workflow, index) => {
7094
- const importPath = workflow.path.replace(/\.ts$/, ".js");
7095
- return `import type * as Workflow${index} from '../${importPath}'`;
7096
- }).join(`
7097
- `);
7098
7108
  const content = `
7099
7109
  // @ts-nocheck
7100
7110
  ////////////////////////////////////////////////////////
@@ -7105,10 +7115,6 @@ async function generateClientWrapper(project) {
7105
7115
  ////////////////////////////////////////////////////////
7106
7116
 
7107
7117
  import type { Client, Workflow } from '@botpress/client'
7108
- import type { z } from '@botpress/sdk'
7109
-
7110
- ${actionImports}
7111
- ${workflowImports}
7112
7118
 
7113
7119
  // Utility type to simplify complex types
7114
7120
  type Simplify<T> = T extends (...args: infer A) => infer R
@@ -7176,23 +7182,12 @@ export interface AdkClient {
7176
7182
  * Typed action calls
7177
7183
  */
7178
7184
  actions: {
7179
- ${actionTypes.map((action) => {
7180
- if (action.isBuiltin) {
7181
- return `
7182
- /**
7183
- * Call action: ${action.name}
7184
- */
7185
- '${action.name}': (input: any) => Promise<any>
7186
- `;
7187
- }
7188
- const importIndex = actionImportMap.get(action.name);
7189
- return `
7185
+ ${actionTypes.map((action) => `
7190
7186
  /**
7191
7187
  * Call action: ${action.name}
7192
7188
  */
7193
- '${action.name}': (input: z.input<typeof Action${importIndex}.default.input>) => Promise<z.infer<typeof Action${importIndex}.default.output>>
7194
- `;
7195
- }).join(`
7189
+ '${action.name}': (input: ${action.inputType}) => Promise<${action.outputType}>
7190
+ `).join(`
7196
7191
  `)}
7197
7192
  }
7198
7193
 
@@ -7200,23 +7195,20 @@ export interface AdkClient {
7200
7195
  * Typed workflow operations
7201
7196
  */
7202
7197
  workflows: {
7203
- ${workflowTypes.map((workflow, index) => {
7204
- const inputType = `z.input<typeof Workflow${index}.default.inputSchema>`;
7205
- const outputType = `z.infer<typeof Workflow${index}.default.outputSchema>`;
7206
- return `
7198
+ ${workflowTypes.map((workflow) => `
7207
7199
  '${workflow.name}': {
7208
7200
  /**
7209
7201
  * Create workflow: ${workflow.name}
7210
7202
  */
7211
- createWorkflow: (params: Omit<ParamCreateWorkflow, 'name' | 'input'> & { input?: ${inputType} }) => Promise<Omit<CreateWorkflowResponse, 'workflow'> & { workflow: TypedWorkflow<${inputType}, ${outputType}> }>
7203
+ createWorkflow: (params: Omit<ParamCreateWorkflow, 'name' | 'input'> & { input?: ${workflow.inputType} }) => Promise<Omit<CreateWorkflowResponse, 'workflow'> & { workflow: TypedWorkflow<${workflow.inputType}, ${workflow.outputType}> }>
7212
7204
  /**
7213
7205
  * Get workflow by ID
7214
7206
  */
7215
- getWorkflow: (params: ParamGetWorkflow) => Promise<Omit<GetWorkflowResponse, 'workflow'> & { workflow: TypedWorkflow<${inputType}, ${outputType}> }>
7207
+ getWorkflow: (params: ParamGetWorkflow) => Promise<Omit<GetWorkflowResponse, 'workflow'> & { workflow: TypedWorkflow<${workflow.inputType}, ${workflow.outputType}> }>
7216
7208
  /**
7217
7209
  * Update workflow
7218
7210
  */
7219
- updateWorkflow: (params: Omit<ParamUpdateWorkflow, 'output'> & { output?: ${outputType} }) => Promise<Omit<UpdateWorkflowResponse, 'workflow'> & { workflow: TypedWorkflow<${inputType}, ${outputType}> }>
7211
+ updateWorkflow: (params: Omit<ParamUpdateWorkflow, 'output'> & { output?: ${workflow.outputType} }) => Promise<Omit<UpdateWorkflowResponse, 'workflow'> & { workflow: TypedWorkflow<${workflow.inputType}, ${workflow.outputType}> }>
7220
7212
  /**
7221
7213
  * Delete workflow
7222
7214
  */
@@ -7224,10 +7216,9 @@ export interface AdkClient {
7224
7216
  /**
7225
7217
  * Get or create workflow with deduplication key
7226
7218
  */
7227
- getOrCreateWorkflow: (params: Omit<ParamGetOrCreateWorkflow, 'name' | 'input'> & { input?: ${inputType} }) => Promise<Omit<GetOrCreateWorkflowResponse, 'workflow'> & { workflow: TypedWorkflow<${inputType}, ${outputType}> }>
7219
+ getOrCreateWorkflow: (params: Omit<ParamGetOrCreateWorkflow, 'name' | 'input'> & { input?: ${workflow.inputType} }) => Promise<Omit<GetOrCreateWorkflowResponse, 'workflow'> & { workflow: TypedWorkflow<${workflow.inputType}, ${workflow.outputType}> }>
7228
7220
  }
7229
- `;
7230
- }).join(`
7221
+ `).join(`
7231
7222
  `)}
7232
7223
  }
7233
7224
 
@@ -7306,12 +7297,12 @@ export function createAdkClient(client: Client): AdkClient {
7306
7297
  return {
7307
7298
  actions: {
7308
7299
  ${actionTypes.map((action) => `
7309
- '${action.name}': async (input) => {
7300
+ '${action.name}': async (input: ${action.inputType}) => {
7310
7301
  const response = await client.callAction({
7311
7302
  type: '${action.name}',
7312
7303
  input,
7313
7304
  })
7314
- return response.output as any
7305
+ return response.output as ${action.outputType}
7315
7306
  }
7316
7307
  `).join(`,
7317
7308
  `)}
@@ -11868,4 +11859,4 @@ export {
11868
11859
  AgentProject
11869
11860
  };
11870
11861
 
11871
- //# debugId=9C7E68110BCAF64064756E2164756E21
11862
+ //# debugId=1ABEC121119F1E3B64756E2164756E21