@botpress/adk 1.13.19 → 1.14.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/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.19", relative2 = (from, to) => {
669
+ }, ADK_VERSION = "1.14.0", 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}`;
@@ -690,7 +690,7 @@ var exports_action_types = {};
690
690
  __export(exports_action_types, {
691
691
  generateActionTypes: () => generateActionTypes
692
692
  });
693
- import path31 from "path";
693
+ import path32 from "path";
694
694
  async function generateActionTypes(project) {
695
695
  const actionDefs = [];
696
696
  for (const action of project.actions) {
@@ -705,7 +705,7 @@ async function generateActionTypes(project) {
705
705
  };`);
706
706
  continue;
707
707
  }
708
- const absolutePath = path31.join(project.path, action.path);
708
+ const absolutePath = path32.join(project.path, action.path);
709
709
  const actionModule = await import(`${absolutePath}?t=${Date.now()}`);
710
710
  const actionInstance = actionModule[action.export] || actionModule.default;
711
711
  if (actionInstance && actionInstance.input && actionInstance.output) {
@@ -750,7 +750,7 @@ ${actionDefs.join(`
750
750
  };
751
751
  }
752
752
  `;
753
- const actionTypesPath = path31.join(project.path, ".adk", "action-types.d.ts");
753
+ const actionTypesPath = path32.join(project.path, ".adk", "action-types.d.ts");
754
754
  await createFile(actionTypesPath, await formatCode(content));
755
755
  }
756
756
  var init_action_types = __esm(() => {
@@ -763,7 +763,7 @@ var exports_integration_action_types = {};
763
763
  __export(exports_integration_action_types, {
764
764
  generateIntegrationActionTypes: () => generateIntegrationActionTypes
765
765
  });
766
- import path32 from "path";
766
+ import path33 from "path";
767
767
  async function generateIntegrationActionTypes(project) {
768
768
  const content = `
769
769
  ////////////////////////////////////////////////////////
@@ -797,7 +797,7 @@ type IntegrationsMap<T> = {
797
797
  export type IntegrationActions = IntegrationsMap<Integrations>;
798
798
  }
799
799
  `;
800
- const integrationActionTypesPath = path32.join(project.path, ".adk", "integration-action-types.d.ts");
800
+ const integrationActionTypesPath = path33.join(project.path, ".adk", "integration-action-types.d.ts");
801
801
  await createFile(integrationActionTypesPath, await formatCode(content));
802
802
  }
803
803
  var init_integration_action_types = __esm(() => {
@@ -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.19",
812
+ version: "1.14.0",
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.2.0",
857
857
  "@botpress/client": "^1.28.0",
858
858
  "@botpress/cognitive": "^0.3.3",
859
- "@botpress/runtime": "^1.13.19",
859
+ "@botpress/runtime": "^1.14.0",
860
860
  "@botpress/sdk": "^5.1.0",
861
861
  "@bpinternal/jex": "^1.2.4",
862
862
  "@bpinternal/yargs-extra": "^0.0.21",
@@ -3455,9 +3455,9 @@ function configsMatch(current, desired, schemaDefaults = {}) {
3455
3455
  return JSON.stringify(currentValue) === JSON.stringify(desiredValue);
3456
3456
  });
3457
3457
  }
3458
- async function fetchServerIntegrationConfigs(project) {
3458
+ async function fetchServerIntegrationConfigs(project, targetBotId) {
3459
3459
  const { devId, botId } = project.agentInfo ?? {};
3460
- const targetId = devId || botId;
3460
+ const targetId = targetBotId || devId || botId;
3461
3461
  if (!targetId) {
3462
3462
  return { configs: {}, fetched: false, skipped: true };
3463
3463
  }
@@ -3472,6 +3472,9 @@ async function fetchServerIntegrationConfigs(project) {
3472
3472
  try {
3473
3473
  return await fetchBotConfigs(client, targetId);
3474
3474
  } catch (err) {
3475
+ if (targetBotId) {
3476
+ throw err;
3477
+ }
3475
3478
  if (devId && botId && devId !== botId) {
3476
3479
  return await fetchBotConfigs(client, botId);
3477
3480
  }
@@ -6405,7 +6408,7 @@ class AgentProjectGenerator {
6405
6408
  deploy: "adk deploy"
6406
6409
  },
6407
6410
  dependencies: {
6408
- "@botpress/runtime": `^${"1.13.19"}`
6411
+ "@botpress/runtime": `^${"1.14.0"}`
6409
6412
  },
6410
6413
  devDependencies: {
6411
6414
  typescript: "^5.9.3"
@@ -7015,16 +7018,399 @@ Description: ${tag?.description}`);
7015
7018
  }
7016
7019
  };
7017
7020
  }
7021
+ // src/generators/client-wrapper.ts
7022
+ init_utils();
7023
+ init_fs();
7024
+ import path18 from "path";
7025
+ import { BuiltInWorkflows as BuiltInWorkflows2 } from "@botpress/runtime/internal";
7026
+ function isBuiltinWorkflow(name) {
7027
+ return !!Object.values(BuiltInWorkflows2).find((x) => x.name === name);
7028
+ }
7029
+ async function generateClientWrapper(project) {
7030
+ const actionTypes = [];
7031
+ for (const action of project.actions) {
7032
+ if (action.definition.attributes?.visibility === "hidden") {
7033
+ continue;
7034
+ }
7035
+ try {
7036
+ if (action.path === "<adk:builtin>") {
7037
+ actionTypes.push({
7038
+ name: action.definition.name,
7039
+ inputType: "any",
7040
+ outputType: "any"
7041
+ });
7042
+ continue;
7043
+ }
7044
+ const absolutePath = path18.join(project.path, action.path);
7045
+ const actionModule = await import(`${absolutePath}?t=${Date.now()}`);
7046
+ const actionInstance = actionModule[action.export] || actionModule.default;
7047
+ if (actionInstance && actionInstance.input && actionInstance.output) {
7048
+ const inputType = actionInstance.input.toTypescriptType ? actionInstance.input.toTypescriptType() : "any";
7049
+ const outputType = actionInstance.output.toTypescriptType ? actionInstance.output.toTypescriptType() : "any";
7050
+ actionTypes.push({
7051
+ name: action.definition.name,
7052
+ inputType,
7053
+ outputType
7054
+ });
7055
+ }
7056
+ } catch (error) {
7057
+ console.warn(`Warning: Could not process action ${action.definition.name}:`, error);
7058
+ actionTypes.push({
7059
+ name: action.definition.name,
7060
+ inputType: "any",
7061
+ outputType: "any"
7062
+ });
7063
+ }
7064
+ }
7065
+ const workflowTypes = [];
7066
+ for (const workflow of project.workflows) {
7067
+ try {
7068
+ if (isBuiltinWorkflow(workflow.definition.name)) {
7069
+ continue;
7070
+ }
7071
+ const workflowPath = path18.join(project.path, workflow.path);
7072
+ const workflowModule = await import(`${workflowPath}?t=${Date.now()}`);
7073
+ const workflowInstance = workflowModule[workflow.export] || workflowModule.default;
7074
+ if (workflowInstance) {
7075
+ const inputType = workflowInstance.inputSchema ? workflowInstance.inputSchema.toTypescriptType?.() || "any" : "{}";
7076
+ const outputType = workflowInstance.outputSchema ? workflowInstance.outputSchema.toTypescriptType?.() || "any" : "{}";
7077
+ workflowTypes.push({
7078
+ name: workflow.definition.name,
7079
+ inputType,
7080
+ outputType
7081
+ });
7082
+ }
7083
+ } catch (error) {
7084
+ console.warn(`Warning: Could not process workflow ${workflow.definition.name}:`, error);
7085
+ }
7086
+ }
7087
+ const tableTypes = [];
7088
+ for (const table of project.tables) {
7089
+ try {
7090
+ const tablePath = path18.join(project.path, table.path);
7091
+ const tableModule = await import(`${tablePath}?t=${Date.now()}`);
7092
+ const tableInstance = tableModule.default || tableModule[table.export];
7093
+ if (tableInstance && tableInstance.columns) {
7094
+ const inputColumns = [];
7095
+ const outputColumns = ["id: number", "createdAt: string", "updatedAt: string"];
7096
+ for (const [colName, colDef] of Object.entries(tableInstance.columns)) {
7097
+ let schema;
7098
+ let computed = false;
7099
+ if (typeof colDef === "object" && colDef !== null && "schema" in colDef) {
7100
+ schema = colDef.schema;
7101
+ computed = colDef.computed || false;
7102
+ } else {
7103
+ schema = colDef;
7104
+ }
7105
+ const tsType = schema.toTypescriptType ? schema.toTypescriptType() : "any";
7106
+ if (!computed) {
7107
+ inputColumns.push(`${colName}: ${tsType}`);
7108
+ }
7109
+ outputColumns.push(`${colName}: ${tsType}`);
7110
+ }
7111
+ tableTypes.push({
7112
+ name: table.definition.name,
7113
+ inputType: `{ ${inputColumns.join("; ")} }`,
7114
+ outputType: `{ ${outputColumns.join("; ")} }`
7115
+ });
7116
+ }
7117
+ } catch (error) {
7118
+ console.warn(`Warning: Could not process table ${table.definition.name}:`, error);
7119
+ }
7120
+ }
7121
+ const content = `
7122
+ // @ts-nocheck
7123
+ ////////////////////////////////////////////////////////
7124
+ // DO NOT EDIT THIS FILE DIRECTLY
7125
+ // This file is auto-generated from the Botpress ADK
7126
+ // ADK Version: ${ADK_VERSION}
7127
+ // Generated at: ${new Date().toISOString()}
7128
+ ////////////////////////////////////////////////////////
7129
+
7130
+ import type { Client, Workflow } from '@botpress/client'
7131
+
7132
+ // Utility type to simplify complex types
7133
+ type Simplify<T> = T extends (...args: infer A) => infer R
7134
+ ? (...args: SimplifyTuple<A>) => Simplify<R>
7135
+ : T extends Array<infer E>
7136
+ ? Array<Simplify<E>>
7137
+ : T extends ReadonlyArray<infer E>
7138
+ ? ReadonlyArray<Simplify<E>>
7139
+ : T extends Promise<infer R>
7140
+ ? Promise<Simplify<R>>
7141
+ : T extends Buffer
7142
+ ? Buffer
7143
+ : T extends object
7144
+ ? SimplifyObject<T>
7145
+ : T
7146
+
7147
+ type SimplifyTuple<T> = T extends [...infer A] ? { [K in keyof A]: Simplify<A[K]> } : never
7148
+ type SimplifyObject<T extends object> = T extends infer O ? { [K in keyof O]: Simplify<O[K]> } : never
7149
+
7150
+ type GenericWorkflowInput = Record<string, any>
7151
+ type GenericWorkflowOutput = Record<string, any>
7152
+
7153
+ type TypedWorkflow<TInput = GenericWorkflowInput, TOutput = GenericWorkflowOutput> = Simplify<
7154
+ Omit<Workflow, 'input' | 'output'> & {
7155
+ input: TInput
7156
+ output: TOutput
7157
+ }
7158
+ >
7159
+
7160
+ // Extract response types from Client methods
7161
+ type CreateWorkflowResponse = Simplify<Awaited<ReturnType<Client['createWorkflow']>>>
7162
+ type GetWorkflowResponse = Simplify<Awaited<ReturnType<Client['getWorkflow']>>>
7163
+ type UpdateWorkflowResponse = Simplify<Awaited<ReturnType<Client['updateWorkflow']>>>
7164
+ type DeleteWorkflowResponse = Simplify<Awaited<ReturnType<Client['deleteWorkflow']>>>
7165
+ type GetOrCreateWorkflowResponse = Simplify<Awaited<ReturnType<Client['getOrCreateWorkflow']>>>
7166
+
7167
+ type CreateTableRowsResponse = Simplify<Awaited<ReturnType<Client['createTableRows']>>>
7168
+ type UpdateTableRowsResponse = Simplify<Awaited<ReturnType<Client['updateTableRows']>>>
7169
+ type UpsertTableRowsResponse = Simplify<Awaited<ReturnType<Client['upsertTableRows']>>>
7170
+ type DeleteTableRowsResponse = Simplify<Awaited<ReturnType<Client['deleteTableRows']>>>
7171
+ type FindTableRowsResponse = Simplify<Awaited<ReturnType<Client['findTableRows']>>>
7172
+ type GetTableRowResponse = Simplify<Awaited<ReturnType<Client['getTableRow']>>>
7173
+
7174
+ // Extract parameter types from Client methods
7175
+ type ParamCreateWorkflow = Simplify<Parameters<Client['createWorkflow']>[0]>
7176
+ type ParamGetWorkflow = Simplify<Parameters<Client['getWorkflow']>[0]>
7177
+ type ParamUpdateWorkflow = Simplify<Parameters<Client['updateWorkflow']>[0]>
7178
+ type ParamDeleteWorkflow = Simplify<Parameters<Client['deleteWorkflow']>[0]>
7179
+ type ParamGetOrCreateWorkflow = Simplify<Parameters<Client['getOrCreateWorkflow']>[0]>
7180
+
7181
+ type ParamCreateTableRows = Simplify<Parameters<Client['createTableRows']>[0]>
7182
+ type ParamUpdateTableRows = Simplify<Parameters<Client['updateTableRows']>[0]>
7183
+ type ParamUpsertTableRows = Simplify<Parameters<Client['upsertTableRows']>[0]>
7184
+ type ParamDeleteTableRows = Simplify<Parameters<Client['deleteTableRows']>[0]>
7185
+ type ParamFindTableRows = Simplify<Parameters<Client['findTableRows']>[0]>
7186
+ type ParamGetTableRow = Simplify<Parameters<Client['getTableRow']>[0]>
7187
+
7188
+ /**
7189
+ * Typed ADK Client
7190
+ *
7191
+ * Provides strongly-typed wrappers around the Botpress Client for actions, workflows, and tables.
7192
+ */
7193
+ export interface AdkClient {
7194
+ /**
7195
+ * Typed action calls
7196
+ */
7197
+ actions: {
7198
+ ${actionTypes.map((action) => `
7199
+ /**
7200
+ * Call action: ${action.name}
7201
+ */
7202
+ '${action.name}': (input: ${action.inputType}) => Promise<${action.outputType}>
7203
+ `).join(`
7204
+ `)}
7205
+ }
7206
+
7207
+ /**
7208
+ * Typed workflow operations
7209
+ */
7210
+ workflows: {
7211
+ ${workflowTypes.map((workflow) => `
7212
+ '${workflow.name}': {
7213
+ /**
7214
+ * Create workflow: ${workflow.name}
7215
+ */
7216
+ createWorkflow: (params: Omit<ParamCreateWorkflow, 'name' | 'input'> & { input?: ${workflow.inputType} }) => Promise<Omit<CreateWorkflowResponse, 'workflow'> & { workflow: TypedWorkflow<${workflow.inputType}, ${workflow.outputType}> }>
7217
+ /**
7218
+ * Get workflow by ID
7219
+ */
7220
+ getWorkflow: (params: ParamGetWorkflow) => Promise<Omit<GetWorkflowResponse, 'workflow'> & { workflow: TypedWorkflow<${workflow.inputType}, ${workflow.outputType}> }>
7221
+ /**
7222
+ * Update workflow
7223
+ */
7224
+ updateWorkflow: (params: Omit<ParamUpdateWorkflow, 'output'> & { output?: ${workflow.outputType} }) => Promise<Omit<UpdateWorkflowResponse, 'workflow'> & { workflow: TypedWorkflow<${workflow.inputType}, ${workflow.outputType}> }>
7225
+ /**
7226
+ * Delete workflow
7227
+ */
7228
+ deleteWorkflow: (params: ParamDeleteWorkflow) => Promise<DeleteWorkflowResponse>
7229
+ /**
7230
+ * Get or create workflow with deduplication key
7231
+ */
7232
+ getOrCreateWorkflow: (params: Omit<ParamGetOrCreateWorkflow, 'name' | 'input'> & { input?: ${workflow.inputType} }) => Promise<Omit<GetOrCreateWorkflowResponse, 'workflow'> & { workflow: TypedWorkflow<${workflow.inputType}, ${workflow.outputType}> }>
7233
+ }
7234
+ `).join(`
7235
+ `)}
7236
+ }
7237
+
7238
+ /**
7239
+ * Typed table operations
7240
+ */
7241
+ tables: {
7242
+ ${tableTypes.map((table) => `
7243
+ '${table.name}': {
7244
+ /**
7245
+ * Find rows in table: ${table.name}
7246
+ */
7247
+ findTableRows: (params?: Omit<ParamFindTableRows, 'table'>) => Promise<Omit<FindTableRowsResponse, 'rows'> & { rows: Array<${table.outputType}> }>
7248
+ /**
7249
+ * Get a single row by ID
7250
+ */
7251
+ getTableRow: (params: Omit<ParamGetTableRow, 'table'>) => Promise<Omit<GetTableRowResponse, 'row'> & { row: ${table.outputType} }>
7252
+ /**
7253
+ * Create rows in table: ${table.name}
7254
+ */
7255
+ createTableRows: (params: Omit<ParamCreateTableRows, 'table'>) => Promise<Omit<CreateTableRowsResponse, 'rows'> & { rows: Array<${table.outputType}> }>
7256
+ /**
7257
+ * Update rows in table: ${table.name}
7258
+ */
7259
+ updateTableRows: (params: Omit<ParamUpdateTableRows, 'table'>) => Promise<Omit<UpdateTableRowsResponse, 'rows'> & { rows: Array<${table.outputType}> }>
7260
+ /**
7261
+ * Upsert rows in table: ${table.name}
7262
+ */
7263
+ upsertTableRows: (params: Omit<ParamUpsertTableRows, 'table'>) => Promise<Omit<UpsertTableRowsResponse, 'rows'> & { rows: Array<${table.outputType}> }>
7264
+ /**
7265
+ * Delete rows by IDs
7266
+ */
7267
+ deleteTableRows: (params: Omit<ParamDeleteTableRows, 'table'>) => Promise<Omit<DeleteTableRowsResponse, 'rows'> & { rows: Array<${table.outputType}> }>
7268
+ }
7269
+ `).join(`
7270
+ `)}
7271
+ }
7272
+
7273
+ /**
7274
+ * Raw Botpress client (no additional typing)
7275
+ */
7276
+ client: Client
7277
+ }
7278
+
7279
+ /**
7280
+ * Create a typed ADK client wrapper around a Botpress Client
7281
+ *
7282
+ * @example
7283
+ * \`\`\`typescript
7284
+ * import { Client } from '@botpress/client'
7285
+ * import { createAdkClient } from './.adk/client'
7286
+ *
7287
+ * const client = new Client({ token: 'xxx', botId: 'yyy' })
7288
+ * const adk = createAdkClient(client)
7289
+ *
7290
+ * // Typed action calls
7291
+ * const result = await adk.actions.myAction({ foo: 'bar' })
7292
+ *
7293
+ * // Typed workflow operations
7294
+ * const wf = await adk.workflows.myWorkflow.createWorkflow({ input: { data: 'value' } })
7295
+ * const workflow = await adk.workflows.myWorkflow.getWorkflow({ id: wf.workflow.id })
7296
+ * await adk.workflows.myWorkflow.updateWorkflow({ id: wf.workflow.id, status: 'completed' })
7297
+ * await adk.workflows.myWorkflow.deleteWorkflow({ id: wf.workflow.id })
7298
+ * await adk.workflows.myWorkflow.getOrCreateWorkflow({ key: 'unique-key', input: { data: 'value' } })
7299
+ *
7300
+ * // Typed table operations
7301
+ * const rows = await adk.tables.myTable.findTableRows({ filter: { name: 'John' } })
7302
+ * const row = await adk.tables.myTable.getTableRow({ id: 123 })
7303
+ * await adk.tables.myTable.createTableRows({ rows: [{ name: 'Jane', age: 30 }] })
7304
+ * await adk.tables.myTable.updateTableRows({ rows: [{ id: 123, name: 'Jane' }] })
7305
+ * await adk.tables.myTable.upsertTableRows({ rows: [{ name: 'Bob', age: 25 }] })
7306
+ * await adk.tables.myTable.deleteTableRows({ ids: [123, 456] })
7307
+ * \`\`\`
7308
+ */
7309
+ export function createAdkClient(client: Client): AdkClient {
7310
+ return {
7311
+ actions: {
7312
+ ${actionTypes.map((action) => `
7313
+ '${action.name}': async (input: ${action.inputType}) => {
7314
+ const response = await client.callAction({
7315
+ type: '${action.name}',
7316
+ input,
7317
+ })
7318
+ return response.output as ${action.outputType}
7319
+ }
7320
+ `).join(`,
7321
+ `)}
7322
+ },
7323
+
7324
+ workflows: {
7325
+ ${workflowTypes.map((workflow) => `
7326
+ '${workflow.name}': {
7327
+ createWorkflow: async (params) => {
7328
+ return client.createWorkflow({
7329
+ name: '${workflow.name}',
7330
+ ...params,
7331
+ }) as any
7332
+ },
7333
+ getWorkflow: async (params) => {
7334
+ return client.getWorkflow(params) as any
7335
+ },
7336
+ updateWorkflow: async (params) => {
7337
+ return client.updateWorkflow(params) as any
7338
+ },
7339
+ deleteWorkflow: async (params) => {
7340
+ return client.deleteWorkflow(params) as any
7341
+ },
7342
+ getOrCreateWorkflow: async (params) => {
7343
+ return client.getOrCreateWorkflow({
7344
+ name: '${workflow.name}',
7345
+ ...params,
7346
+ }) as any
7347
+ },
7348
+ }
7349
+ `).join(`,
7350
+ `)}
7351
+ },
7352
+
7353
+ tables: {
7354
+ ${tableTypes.map((table) => `
7355
+ '${table.name}': {
7356
+ findTableRows: async (params) => {
7357
+ return client.findTableRows({
7358
+ table: '${table.name}',
7359
+ ...params,
7360
+ }) as any
7361
+ },
7362
+ getTableRow: async (params) => {
7363
+ return client.getTableRow({
7364
+ table: '${table.name}',
7365
+ ...params,
7366
+ }) as any
7367
+ },
7368
+ createTableRows: async (params) => {
7369
+ return client.createTableRows({
7370
+ table: '${table.name}',
7371
+ ...params,
7372
+ }) as any
7373
+ },
7374
+ updateTableRows: async (params) => {
7375
+ return client.updateTableRows({
7376
+ table: '${table.name}',
7377
+ ...params,
7378
+ }) as any
7379
+ },
7380
+ upsertTableRows: async (params) => {
7381
+ return client.upsertTableRows({
7382
+ table: '${table.name}',
7383
+ ...params,
7384
+ }) as any
7385
+ },
7386
+ deleteTableRows: async (params) => {
7387
+ return client.deleteTableRows({
7388
+ table: '${table.name}',
7389
+ ...params,
7390
+ }) as any
7391
+ },
7392
+ }
7393
+ `).join(`,
7394
+ `)}
7395
+ },
7396
+
7397
+ client,
7398
+ }
7399
+ }
7400
+ `;
7401
+ const clientWrapperPath = path18.join(project.path, ".adk", "client.ts");
7402
+ await createFile(clientWrapperPath, await formatCode(content));
7403
+ }
7018
7404
  // src/bot-generator/generator.ts
7019
7405
  import dedent from "dedent";
7020
7406
  import { existsSync as existsSync7 } from "fs";
7021
7407
  import fs16 from "fs/promises";
7022
- import path33 from "path";
7408
+ import path34 from "path";
7023
7409
 
7024
7410
  // src/generators/interface-types.ts
7025
7411
  import { transforms as transforms2 } from "@botpress/sdk";
7026
7412
  import crypto3 from "crypto";
7027
- import path18 from "path";
7413
+ import path19 from "path";
7028
7414
  init_utils();
7029
7415
  var sameMajorVersion = (a, b) => {
7030
7416
  const majorA = a.split(".")[0];
@@ -7045,8 +7431,8 @@ var getInterfaceNames = (int) => ({
7045
7431
  actions: `Interface_Actions_${pascalCase(int.name)}`
7046
7432
  },
7047
7433
  paths: {
7048
- index: path18.join(snakeCase(int.name), `index.ts`),
7049
- actions: path18.join(snakeCase(int.name), `actions.ts`)
7434
+ index: path19.join(snakeCase(int.name), `index.ts`),
7435
+ actions: path19.join(snakeCase(int.name), `actions.ts`)
7050
7436
  }
7051
7437
  });
7052
7438
  async function generateInterfaceTypes(int, integrations) {
@@ -7151,12 +7537,12 @@ Description: ${action.description || "No description"}`)}
7151
7537
  // src/generators/table-types.ts
7152
7538
  init_utils();
7153
7539
  init_fs();
7154
- import path19 from "path";
7540
+ import path20 from "path";
7155
7541
  async function generateTableTypes(project) {
7156
7542
  const tables = [];
7157
7543
  for (const tableRef of project.tables) {
7158
7544
  try {
7159
- const tablePath = path19.join(project.path, tableRef.path);
7545
+ const tablePath = path20.join(project.path, tableRef.path);
7160
7546
  const tableModule = await import(`${tablePath}?t=${Date.now()}`);
7161
7547
  const tableInstance = tableModule.default || tableModule[tableRef.export];
7162
7548
  if (tableInstance && tableInstance.columns) {
@@ -7242,14 +7628,14 @@ ${outputColumns}
7242
7628
  content += ` };
7243
7629
  }
7244
7630
  `;
7245
- const tableTypesPath = path19.join(project.path, ".adk", "table-types.d.ts");
7631
+ const tableTypesPath = path20.join(project.path, ".adk", "table-types.d.ts");
7246
7632
  await createFile(tableTypesPath, await formatCode(content));
7247
7633
  }
7248
7634
 
7249
7635
  // src/generators/trigger-types.ts
7250
7636
  init_utils();
7251
7637
  init_fs();
7252
- import path20 from "path";
7638
+ import path21 from "path";
7253
7639
  async function generateTriggerTypes(project) {
7254
7640
  const triggerEvents = {};
7255
7641
  for (const trigger of project.triggers) {
@@ -7289,19 +7675,19 @@ ${triggersType}
7289
7675
  };
7290
7676
  }
7291
7677
  `;
7292
- const triggerTypesPath = path20.join(project.path, ".adk", "trigger-types.d.ts");
7678
+ const triggerTypesPath = path21.join(project.path, ".adk", "trigger-types.d.ts");
7293
7679
  await createFile(triggerTypesPath, await formatCode(content));
7294
7680
  }
7295
7681
 
7296
7682
  // src/generators/state-types.ts
7297
7683
  init_utils();
7298
7684
  init_fs();
7299
- import path21 from "path";
7685
+ import path22 from "path";
7300
7686
  async function generateStateTypes(project) {
7301
7687
  let botStateType = "{}";
7302
7688
  let userStateType = "{}";
7303
7689
  try {
7304
- const configPath = path21.join(project.path, "agent.config.ts");
7690
+ const configPath = path22.join(project.path, "agent.config.ts");
7305
7691
  const configModule = await import(`${configPath}?t=${Date.now()}`);
7306
7692
  const config = configModule.default;
7307
7693
  if (config?.bot?.state) {
@@ -7332,14 +7718,14 @@ declare module "@botpress/runtime/_types/state" {
7332
7718
  export type UserState = ${userStateType};
7333
7719
  }
7334
7720
  `;
7335
- const stateTypesPath = path21.join(project.path, ".adk", "state-types.d.ts");
7721
+ const stateTypesPath = path22.join(project.path, ".adk", "state-types.d.ts");
7336
7722
  await createFile(stateTypesPath, await formatCode(content));
7337
7723
  }
7338
7724
 
7339
7725
  // src/generators/tag-types.ts
7340
7726
  init_utils();
7341
7727
  init_fs();
7342
- import path22 from "path";
7728
+ import path23 from "path";
7343
7729
  import { BUILT_IN_TAGS } from "@botpress/runtime/definition";
7344
7730
  function generateTagTypeString(builtInTags, configTags) {
7345
7731
  const builtInTagStrings = Object.entries(builtInTags).map(([key, tag]) => {
@@ -7378,7 +7764,7 @@ async function generateTagTypes(project) {
7378
7764
  let messageTagsType = "Record<string, string | undefined>";
7379
7765
  let workflowTagsType = "Record<string, string | undefined>";
7380
7766
  try {
7381
- const configPath = path22.join(project.path, "agent.config.ts");
7767
+ const configPath = path23.join(project.path, "agent.config.ts");
7382
7768
  const configModule = await import(`${configPath}?t=${Date.now()}`);
7383
7769
  const config = configModule.default;
7384
7770
  botTagsType = generateTagTypeString(BUILT_IN_TAGS.bot, config?.bot?.tags);
@@ -7424,18 +7810,18 @@ declare module "@botpress/runtime/_types/tags" {
7424
7810
  export type WorkflowTags = ${workflowTagsType};
7425
7811
  }
7426
7812
  `;
7427
- const tagTypesPath = path22.join(project.path, ".adk", "tag-types.d.ts");
7813
+ const tagTypesPath = path23.join(project.path, ".adk", "tag-types.d.ts");
7428
7814
  await createFile(tagTypesPath, await formatCode(content));
7429
7815
  }
7430
7816
 
7431
7817
  // src/generators/configuration-types.ts
7432
7818
  init_utils();
7433
7819
  init_fs();
7434
- import path23 from "path";
7820
+ import path24 from "path";
7435
7821
  async function generateConfigurationTypes(project) {
7436
7822
  let configurationType = "{}";
7437
7823
  try {
7438
- const configPath = path23.join(project.path, "agent.config.ts");
7824
+ const configPath = path24.join(project.path, "agent.config.ts");
7439
7825
  const configModule = await import(`${configPath}?t=${Date.now()}`);
7440
7826
  const config = configModule.default;
7441
7827
  if (config?.configuration?.schema) {
@@ -7459,26 +7845,26 @@ declare module "@botpress/runtime/_types/configuration" {
7459
7845
  export type Configuration = ${configurationType};
7460
7846
  }
7461
7847
  `;
7462
- const configTypesPath = path23.join(project.path, ".adk", "configuration-types.d.ts");
7848
+ const configTypesPath = path24.join(project.path, ".adk", "configuration-types.d.ts");
7463
7849
  await createFile(configTypesPath, await formatCode(content));
7464
7850
  }
7465
7851
 
7466
7852
  // src/generators/workflow-types.ts
7467
7853
  init_utils();
7468
7854
  init_fs();
7469
- import * as path24 from "path";
7470
- import { BuiltInWorkflows as BuiltInWorkflows2 } from "@botpress/runtime/internal";
7471
- function isBuiltinWorkflow(name) {
7472
- return !!Object.values(BuiltInWorkflows2).find((x) => x.name === name);
7855
+ import * as path25 from "path";
7856
+ import { BuiltInWorkflows as BuiltInWorkflows3 } from "@botpress/runtime/internal";
7857
+ function isBuiltinWorkflow2(name) {
7858
+ return !!Object.values(BuiltInWorkflows3).find((x) => x.name === name);
7473
7859
  }
7474
7860
  async function generateWorkflowTypes(project) {
7475
7861
  const workflows = [];
7476
7862
  for (const workflowRef of project.workflows) {
7477
7863
  try {
7478
- if (isBuiltinWorkflow(workflowRef.definition.name)) {
7864
+ if (isBuiltinWorkflow2(workflowRef.definition.name)) {
7479
7865
  continue;
7480
7866
  }
7481
- const workflowPath = path24.join(project.path, workflowRef.path);
7867
+ const workflowPath = path25.join(project.path, workflowRef.path);
7482
7868
  const workflowModule = await import(`${workflowPath}?t=${Date.now()}`);
7483
7869
  const workflowInstance = workflowModule[workflowRef.export] || workflowModule.default;
7484
7870
  if (!workflowInstance) {
@@ -7525,14 +7911,14 @@ declare module "@botpress/runtime/_types/workflows" {
7525
7911
  ${typeDefinitions || " // No workflows defined yet"}
7526
7912
  };
7527
7913
  }`;
7528
- const workflowTypesPath = path24.join(project.path, ".adk", "workflow-types.d.ts");
7914
+ const workflowTypesPath = path25.join(project.path, ".adk", "workflow-types.d.ts");
7529
7915
  await createFile(workflowTypesPath, await formatCode(content));
7530
7916
  }
7531
7917
 
7532
7918
  // src/generators/conversation-types.ts
7533
7919
  init_utils();
7534
7920
  init_fs();
7535
- import path25 from "path";
7921
+ import path26 from "path";
7536
7922
  function hasConversationIdProperty(schema) {
7537
7923
  if (!schema || typeof schema !== "object") {
7538
7924
  return false;
@@ -7555,7 +7941,7 @@ async function generateConversationTypes(project) {
7555
7941
  const conversationTypes = {};
7556
7942
  for (const conversationRef of project.conversations) {
7557
7943
  try {
7558
- const conversationPath = path25.join(project.path, conversationRef.path);
7944
+ const conversationPath = path26.join(project.path, conversationRef.path);
7559
7945
  const conversationModule = await import(`${conversationPath}?t=${Date.now()}`);
7560
7946
  const conversationInstance = conversationModule[conversationRef.export] || conversationModule.default;
7561
7947
  if (!conversationInstance) {
@@ -7641,14 +8027,14 @@ ${routableEventsDefinitions || " // No routable events found"}
7641
8027
  };
7642
8028
  }
7643
8029
  `;
7644
- const conversationTypesPath = path25.join(project.path, ".adk", "conversation-types.d.ts");
8030
+ const conversationTypesPath = path26.join(project.path, ".adk", "conversation-types.d.ts");
7645
8031
  await createFile(conversationTypesPath, await formatCode(content));
7646
8032
  }
7647
8033
 
7648
8034
  // src/generators/event-types.ts
7649
8035
  init_utils();
7650
8036
  init_fs();
7651
- import path26 from "path";
8037
+ import path27 from "path";
7652
8038
  async function generateEventTypes(project) {
7653
8039
  const defaultEvents = ["register: {}"];
7654
8040
  const integrationEvents = [];
@@ -7700,7 +8086,7 @@ ${allEvents.map((e) => ` ${e}`).join(`
7700
8086
  export type EventPayload<T extends EventName> = Events[T];
7701
8087
  }
7702
8088
  `;
7703
- const eventTypesPath = path26.join(project.path, ".adk", "event-types.d.ts");
8089
+ const eventTypesPath = path27.join(project.path, ".adk", "event-types.d.ts");
7704
8090
  await createFile(eventTypesPath, await formatCode(content));
7705
8091
  }
7706
8092
 
@@ -7710,7 +8096,7 @@ init_fs();
7710
8096
  // src/utils/link-sdk.ts
7711
8097
  import { existsSync as existsSync3, realpathSync } from "fs";
7712
8098
  import fs12 from "fs/promises";
7713
- import path27 from "path";
8099
+ import path28 from "path";
7714
8100
  function findPackage(name, startDir) {
7715
8101
  let current;
7716
8102
  try {
@@ -7718,17 +8104,17 @@ function findPackage(name, startDir) {
7718
8104
  } catch {
7719
8105
  current = startDir;
7720
8106
  }
7721
- while (current !== path27.dirname(current)) {
7722
- const pkgPath = path27.join(current, "node_modules", name);
8107
+ while (current !== path28.dirname(current)) {
8108
+ const pkgPath = path28.join(current, "node_modules", name);
7723
8109
  if (existsSync3(pkgPath)) {
7724
8110
  return pkgPath;
7725
8111
  }
7726
- current = path27.dirname(current);
8112
+ current = path28.dirname(current);
7727
8113
  }
7728
8114
  return null;
7729
8115
  }
7730
8116
  async function linkSdk(agentDir, botDir) {
7731
- const targetSdkPath = path27.join(botDir, "node_modules", "@botpress", "sdk");
8117
+ const targetSdkPath = path28.join(botDir, "node_modules", "@botpress", "sdk");
7732
8118
  if (existsSync3(targetSdkPath)) {
7733
8119
  return;
7734
8120
  }
@@ -7742,14 +8128,14 @@ async function linkSdk(agentDir, botDir) {
7742
8128
  console.warn(`Warning: Could not find @botpress/sdk from @botpress/runtime location (${runtimePath})`);
7743
8129
  return;
7744
8130
  }
7745
- const targetBotpressDir = path27.join(botDir, "node_modules", "@botpress");
8131
+ const targetBotpressDir = path28.join(botDir, "node_modules", "@botpress");
7746
8132
  await fs12.mkdir(targetBotpressDir, { recursive: true });
7747
8133
  const symlinkType = process.platform === "win32" ? "junction" : undefined;
7748
8134
  await fs12.symlink(sdkPath, targetSdkPath, symlinkType);
7749
8135
  }
7750
8136
 
7751
8137
  // src/bot-generator/dev-id-manager.ts
7752
- import path28 from "path";
8138
+ import path29 from "path";
7753
8139
  import fs13 from "fs/promises";
7754
8140
  import { existsSync as existsSync4 } from "fs";
7755
8141
  import { Client as Client13 } from "@botpress/client";
@@ -7761,7 +8147,7 @@ class DevIdManager {
7761
8147
  constructor(projectPath, botProjectPath) {
7762
8148
  this.projectPath = projectPath;
7763
8149
  this.botProjectPath = botProjectPath;
7764
- this.projectCachePath = path28.join(botProjectPath, ".botpress", "project.cache.json");
8150
+ this.projectCachePath = path29.join(botProjectPath, ".botpress", "project.cache.json");
7765
8151
  }
7766
8152
  async getClient() {
7767
8153
  if (!this.client) {
@@ -7798,7 +8184,7 @@ class DevIdManager {
7798
8184
  }
7799
8185
  async saveProjectCache(cache2) {
7800
8186
  try {
7801
- await fs13.mkdir(path28.dirname(this.projectCachePath), { recursive: true });
8187
+ await fs13.mkdir(path29.dirname(this.projectCachePath), { recursive: true });
7802
8188
  await fs13.writeFile(this.projectCachePath, JSON.stringify(cache2, null, 2));
7803
8189
  } catch (error) {
7804
8190
  console.error("Error saving project.cache.json:", error);
@@ -7847,7 +8233,7 @@ class DevIdManager {
7847
8233
  }
7848
8234
 
7849
8235
  // src/bot-generator/integration-sync.ts
7850
- import path29 from "path";
8236
+ import path30 from "path";
7851
8237
  import fs14 from "fs/promises";
7852
8238
  import { existsSync as existsSync5 } from "fs";
7853
8239
  class IntegrationSync {
@@ -7857,7 +8243,7 @@ class IntegrationSync {
7857
8243
  constructor(projectPath, botProjectPath) {
7858
8244
  this.projectPath = projectPath;
7859
8245
  this.botProjectPath = botProjectPath;
7860
- this.bpModulesPath = path29.join(botProjectPath, "bp_modules");
8246
+ this.bpModulesPath = path30.join(botProjectPath, "bp_modules");
7861
8247
  }
7862
8248
  async parseIntegrations() {
7863
8249
  const project = await AgentProject.load(this.projectPath);
@@ -7888,12 +8274,12 @@ class IntegrationSync {
7888
8274
  return integrations;
7889
8275
  }
7890
8276
  async isIntegrationSynced(integration) {
7891
- const targetFolder = path29.join(this.bpModulesPath, `integration_${integration.alias}`);
8277
+ const targetFolder = path30.join(this.bpModulesPath, `integration_${integration.alias}`);
7892
8278
  if (!existsSync5(targetFolder)) {
7893
8279
  return false;
7894
8280
  }
7895
8281
  try {
7896
- const indexPath = path29.join(targetFolder, "index.ts");
8282
+ const indexPath = path30.join(targetFolder, "index.ts");
7897
8283
  if (!existsSync5(indexPath)) {
7898
8284
  return false;
7899
8285
  }
@@ -7925,8 +8311,8 @@ class IntegrationSync {
7925
8311
  await command.output();
7926
8312
  }
7927
8313
  async renameIntegrationFolder(integration) {
7928
- const sourceFolder = path29.join(this.bpModulesPath, integration.name.replace("/", "-"));
7929
- const targetFolder = path29.join(this.bpModulesPath, `integration_${integration.alias}`);
8314
+ const sourceFolder = path30.join(this.bpModulesPath, integration.name.replace("/", "-"));
8315
+ const targetFolder = path30.join(this.bpModulesPath, `integration_${integration.alias}`);
7930
8316
  if (!existsSync5(sourceFolder)) {
7931
8317
  throw new Error(`Integration folder not found: ${sourceFolder}`);
7932
8318
  }
@@ -7936,7 +8322,7 @@ class IntegrationSync {
7936
8322
  await fs14.rename(sourceFolder, targetFolder);
7937
8323
  }
7938
8324
  async removeIntegrationFolder(alias) {
7939
- const targetFolder = path29.join(this.bpModulesPath, `integration_${alias}`);
8325
+ const targetFolder = path30.join(this.bpModulesPath, `integration_${alias}`);
7940
8326
  if (existsSync5(targetFolder)) {
7941
8327
  await fs14.rm(targetFolder, { recursive: true, force: true });
7942
8328
  }
@@ -7970,7 +8356,7 @@ class IntegrationSync {
7970
8356
  }
7971
8357
 
7972
8358
  // src/bot-generator/interface-sync.ts
7973
- import path30 from "path";
8359
+ import path31 from "path";
7974
8360
  import fs15 from "fs/promises";
7975
8361
  import { existsSync as existsSync6 } from "fs";
7976
8362
  init_constants();
@@ -7981,7 +8367,7 @@ class InterfaceSync {
7981
8367
  constructor(projectPath, botProjectPath) {
7982
8368
  this.projectPath = projectPath;
7983
8369
  this.botProjectPath = botProjectPath;
7984
- this.bpModulesPath = path30.join(botProjectPath, "bp_modules");
8370
+ this.bpModulesPath = path31.join(botProjectPath, "bp_modules");
7985
8371
  }
7986
8372
  async parseInterfaces() {
7987
8373
  const interfaces = [];
@@ -7999,12 +8385,12 @@ class InterfaceSync {
7999
8385
  return interfaces;
8000
8386
  }
8001
8387
  async isInterfaceSynced(interfaceInfo) {
8002
- const targetFolder = path30.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
8388
+ const targetFolder = path31.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
8003
8389
  if (!existsSync6(targetFolder)) {
8004
8390
  return false;
8005
8391
  }
8006
8392
  try {
8007
- const indexPath = path30.join(targetFolder, "index.ts");
8393
+ const indexPath = path31.join(targetFolder, "index.ts");
8008
8394
  if (!existsSync6(indexPath)) {
8009
8395
  return false;
8010
8396
  }
@@ -8050,8 +8436,8 @@ class InterfaceSync {
8050
8436
  });
8051
8437
  }
8052
8438
  async renameInterfaceFolder(interfaceInfo) {
8053
- const sourceFolder = path30.join(this.bpModulesPath, interfaceInfo.name);
8054
- const targetFolder = path30.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
8439
+ const sourceFolder = path31.join(this.bpModulesPath, interfaceInfo.name);
8440
+ const targetFolder = path31.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
8055
8441
  if (!existsSync6(sourceFolder)) {
8056
8442
  throw new Error(`Interface folder not found: ${sourceFolder}`);
8057
8443
  }
@@ -8061,7 +8447,7 @@ class InterfaceSync {
8061
8447
  await fs15.rename(sourceFolder, targetFolder);
8062
8448
  }
8063
8449
  async removeInterfaceFolder(alias) {
8064
- const targetFolder = path30.join(this.bpModulesPath, `interface_${pascalCase(alias)}`);
8450
+ const targetFolder = path31.join(this.bpModulesPath, `interface_${pascalCase(alias)}`);
8065
8451
  if (existsSync6(targetFolder)) {
8066
8452
  await fs15.rm(targetFolder, { recursive: true, force: true });
8067
8453
  }
@@ -8098,26 +8484,28 @@ class InterfaceSync {
8098
8484
  init_utils();
8099
8485
  import { transforms as transforms3 } from "@botpress/sdk";
8100
8486
  init_constants();
8101
- import { BuiltInActions as BuiltInActions2, BuiltInWorkflows as BuiltInWorkflows3, Primitives as Primitives3 } from "@botpress/runtime/internal";
8487
+ import { BuiltInActions as BuiltInActions2, BuiltInWorkflows as BuiltInWorkflows4, Primitives as Primitives3 } from "@botpress/runtime/internal";
8102
8488
  import { BUILT_IN_TAGS as BUILT_IN_TAGS2 } from "@botpress/runtime/definition";
8103
8489
  var plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
8104
- function isBuiltinWorkflow2(name) {
8105
- return !!Object.values(BuiltInWorkflows3).find((x) => x.name === name);
8490
+ function isBuiltinWorkflow3(name) {
8491
+ return !!Object.values(BuiltInWorkflows4).find((x) => x.name === name);
8106
8492
  }
8107
8493
  function isBuiltinAction(name) {
8108
8494
  return !!Object.values(BuiltInActions2).find((x) => x.name === name);
8109
8495
  }
8110
8496
  function getImportPath(from, to) {
8111
- return path33.relative(path33.dirname(from), to).replace(/\.ts$/, "").replace(/\\/g, "/");
8497
+ return path34.relative(path34.dirname(from), to).replace(/\.ts$/, "").replace(/\\/g, "/");
8112
8498
  }
8113
8499
 
8114
8500
  class BotGenerator {
8115
8501
  projectPath;
8116
8502
  outputPath;
8503
+ adkCommand;
8117
8504
  callbacks;
8118
8505
  constructor(options) {
8119
- this.projectPath = path33.resolve(options.projectPath);
8120
- this.outputPath = path33.resolve(options.outputPath || path33.join(this.projectPath, ".adk"));
8506
+ this.projectPath = path34.resolve(options.projectPath);
8507
+ this.outputPath = path34.resolve(options.outputPath || path34.join(this.projectPath, ".adk"));
8508
+ this.adkCommand = options.adkCommand;
8121
8509
  this.callbacks = options.callbacks;
8122
8510
  }
8123
8511
  async listFilesRecursive(rootDir) {
@@ -8128,8 +8516,8 @@ class BotGenerator {
8128
8516
  const walk = async (dir, relativeBase) => {
8129
8517
  const entries = await fs16.readdir(dir, { withFileTypes: true });
8130
8518
  for (const entry of entries) {
8131
- const abs = path33.join(dir, entry.name);
8132
- const rel = path33.join(relativeBase, entry.name);
8519
+ const abs = path34.join(dir, entry.name);
8520
+ const rel = path34.join(relativeBase, entry.name);
8133
8521
  if (entry.isDirectory()) {
8134
8522
  await walk(abs, rel);
8135
8523
  } else {
@@ -8150,7 +8538,7 @@ class BotGenerator {
8150
8538
  const entries = await fs16.readdir(dir, { withFileTypes: true });
8151
8539
  for (const entry of entries) {
8152
8540
  if (entry.isDirectory()) {
8153
- const subdir = path33.join(dir, entry.name);
8541
+ const subdir = path34.join(dir, entry.name);
8154
8542
  await removeIfEmpty(subdir);
8155
8543
  }
8156
8544
  }
@@ -8182,6 +8570,7 @@ class BotGenerator {
8182
8570
  await this.generateEventTypes();
8183
8571
  await this.generateIntegrationActionTypes();
8184
8572
  await this.generateRuntimeTypes();
8573
+ await this.generateClientWrapper();
8185
8574
  await this.generateBotIndex();
8186
8575
  await this.generatePackageJson(project);
8187
8576
  await this.generateTsConfig();
@@ -8194,18 +8583,18 @@ class BotGenerator {
8194
8583
  workspaceId: project.agentInfo?.workspaceId
8195
8584
  });
8196
8585
  const integrations = await manager3.loadIntegrations(project.dependencies || {});
8197
- const integrationsDir = path33.join(this.projectPath, ".adk", "integrations");
8586
+ const integrationsDir = path34.join(this.projectPath, ".adk", "integrations");
8198
8587
  const existingIntegrationFiles = await this.listFilesRecursive(integrationsDir);
8199
8588
  let aliases = new Set;
8200
8589
  let files = new Set;
8201
8590
  for (const integration of integrations.integrations) {
8202
8591
  if (integration.definition) {
8203
8592
  const types6 = await generateIntegrationTypes(integration);
8204
- const importPath = `./${path33.join("integrations", types6.names.paths.index).replace(/\\/g, "/")}`;
8593
+ const importPath = `./${path34.join("integrations", types6.names.paths.index).replace(/\\/g, "/")}`;
8205
8594
  aliases.add(`"${integration.alias}": import("${importPath}").${types6.names.typings.index}`);
8206
8595
  for (const [filePath, content] of Object.entries(types6.files)) {
8207
- const fullPath = path33.join(this.projectPath, ".adk", "integrations", filePath);
8208
- const dir = path33.dirname(fullPath);
8596
+ const fullPath = path34.join(this.projectPath, ".adk", "integrations", filePath);
8597
+ const dir = path34.dirname(fullPath);
8209
8598
  await fs16.mkdir(dir, { recursive: true });
8210
8599
  await createFile(fullPath, content);
8211
8600
  files.add(filePath);
@@ -8226,11 +8615,11 @@ class BotGenerator {
8226
8615
  };
8227
8616
  }
8228
8617
  `;
8229
- await createFile(path33.join(this.projectPath, ".adk", "integrations-types.d.ts"), await formatCode(types5));
8618
+ await createFile(path34.join(this.projectPath, ".adk", "integrations-types.d.ts"), await formatCode(types5));
8230
8619
  const staleIntegrationFiles = existingIntegrationFiles.filter((f) => !files.has(f));
8231
8620
  if (staleIntegrationFiles.length > 0) {
8232
8621
  for (const rel of staleIntegrationFiles) {
8233
- const abs = path33.join(integrationsDir, rel);
8622
+ const abs = path34.join(integrationsDir, rel);
8234
8623
  try {
8235
8624
  await fs16.rm(abs, { force: true });
8236
8625
  } catch {}
@@ -8280,6 +8669,10 @@ class BotGenerator {
8280
8669
  const { generateIntegrationActionTypes: generateIntegrationActionTypes2 } = await Promise.resolve().then(() => (init_integration_action_types(), exports_integration_action_types));
8281
8670
  await generateIntegrationActionTypes2(project);
8282
8671
  }
8672
+ async generateClientWrapper() {
8673
+ const project = await AgentProject.load(this.projectPath);
8674
+ await generateClientWrapper(project);
8675
+ }
8283
8676
  async generateRuntimeTypes() {
8284
8677
  const project = await AgentProject.load(this.projectPath);
8285
8678
  const manager3 = new IntegrationManager({
@@ -8299,7 +8692,7 @@ class BotGenerator {
8299
8692
  let botStateType = "{}";
8300
8693
  let userStateType = "{}";
8301
8694
  try {
8302
- const configPath = path33.join(project.path, "agent.config.ts");
8695
+ const configPath = path34.join(project.path, "agent.config.ts");
8303
8696
  const configModule = await import(`${configPath}?t=${Date.now()}`);
8304
8697
  const config = configModule.default;
8305
8698
  if (config?.bot?.state) {
@@ -8335,7 +8728,7 @@ declare module "@botpress/runtime/_types/state" {
8335
8728
  export type UserState = ${userStateType};
8336
8729
  }
8337
8730
  `;
8338
- await createFile(path33.join(this.projectPath, ".adk", "runtime.d.ts"), await formatCode(types5));
8731
+ await createFile(path34.join(this.projectPath, ".adk", "runtime.d.ts"), await formatCode(types5));
8339
8732
  }
8340
8733
  async generateInterfacesTypes() {
8341
8734
  const project = await AgentProject.load(this.projectPath);
@@ -8343,7 +8736,7 @@ declare module "@botpress/runtime/_types/state" {
8343
8736
  workspaceId: project.agentInfo?.workspaceId
8344
8737
  });
8345
8738
  const manager3 = new InterfaceManager;
8346
- const interfacesDir = path33.join(this.projectPath, ".adk", "interfaces");
8739
+ const interfacesDir = path34.join(this.projectPath, ".adk", "interfaces");
8347
8740
  const existingInterfaceFiles = await this.listFilesRecursive(interfacesDir);
8348
8741
  const interfaces = await manager3.loadInterfaces(project.dependencies || {}).then((result) => result.interfaces.filter((int) => int.definition).map((x) => x.definition));
8349
8742
  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 })));
@@ -8352,11 +8745,11 @@ declare module "@botpress/runtime/_types/state" {
8352
8745
  let files = new Set;
8353
8746
  for (const int of interfaces) {
8354
8747
  const types6 = await generateInterfaceTypes(int, integrationsWithAlias);
8355
- imports.add(`import { ${types6.names.typings.index} } from "./${path33.join("interfaces", types6.names.paths.index).replace(/\\/g, "/")}";`);
8748
+ imports.add(`import { ${types6.names.typings.index} } from "./${path34.join("interfaces", types6.names.paths.index).replace(/\\/g, "/")}";`);
8356
8749
  aliases.add(`"${types6.names.name}": ${types6.names.typings.index}`);
8357
8750
  for (const [filePath, content] of Object.entries(types6.files)) {
8358
- const fullPath = path33.join(this.projectPath, ".adk", "interfaces", filePath);
8359
- const dir = path33.dirname(fullPath);
8751
+ const fullPath = path34.join(this.projectPath, ".adk", "interfaces", filePath);
8752
+ const dir = path34.dirname(fullPath);
8360
8753
  await fs16.mkdir(dir, { recursive: true });
8361
8754
  await createFile(fullPath, content);
8362
8755
  files.add(filePath);
@@ -8393,12 +8786,12 @@ declare module "@botpress/runtime/_types/state" {
8393
8786
  `)}
8394
8787
  };
8395
8788
  `;
8396
- await createFile(path33.join(this.projectPath, ".adk", "interfaces.d.ts"), await formatCode(types5));
8397
- await createFile(path33.join(this.projectPath, ".adk", "interfaces.ts"), await formatCode(consts));
8789
+ await createFile(path34.join(this.projectPath, ".adk", "interfaces.d.ts"), await formatCode(types5));
8790
+ await createFile(path34.join(this.projectPath, ".adk", "interfaces.ts"), await formatCode(consts));
8398
8791
  const staleInterfaceFiles = existingInterfaceFiles.filter((f) => !files.has(f));
8399
8792
  if (staleInterfaceFiles.length > 0) {
8400
8793
  for (const rel of staleInterfaceFiles) {
8401
- const abs = path33.join(interfacesDir, rel);
8794
+ const abs = path34.join(interfacesDir, rel);
8402
8795
  try {
8403
8796
  await fs16.rm(abs, { force: true });
8404
8797
  } catch {}
@@ -8431,7 +8824,7 @@ declare module "@botpress/runtime/_types/state" {
8431
8824
  `) : ""}
8432
8825
  } as Record<string, IntegrationPackage>;
8433
8826
  `;
8434
- await createFile(path33.join(this.outputPath, "src", "integrations.ts"), content);
8827
+ await createFile(path34.join(this.outputPath, "src", "integrations.ts"), content);
8435
8828
  }
8436
8829
  async generateInterfacesDefinition() {
8437
8830
  const interfaces = BUILTIN_INTERFACES;
@@ -8454,7 +8847,7 @@ declare module "@botpress/runtime/_types/state" {
8454
8847
  `) : ""}
8455
8848
  } as Record<string, InterfacePackage>;
8456
8849
  `;
8457
- await createFile(path33.join(this.outputPath, "src", "interfaces.ts"), await formatCode(content));
8850
+ await createFile(path34.join(this.outputPath, "src", "interfaces.ts"), await formatCode(content));
8458
8851
  }
8459
8852
  reportServerConfigSync(serverConfigResult, integrations) {
8460
8853
  if (!this.callbacks) {
@@ -8493,7 +8886,9 @@ declare module "@botpress/runtime/_types/state" {
8493
8886
  const project = await AgentProject.load(this.projectPath);
8494
8887
  const integrations = project.integrations;
8495
8888
  const enabledIntegrations = integrations.filter((i) => i.enabled);
8496
- const serverConfigResult = await fetchServerIntegrationConfigs(project);
8889
+ const isDeployOrBuild = this.adkCommand === "adk-deploy" || this.adkCommand === "adk-build";
8890
+ const configTargetBotId = isDeployOrBuild ? project.agentInfo?.botId : undefined;
8891
+ const serverConfigResult = await fetchServerIntegrationConfigs(project, configTargetBotId);
8497
8892
  this.reportServerConfigSync(serverConfigResult, enabledIntegrations);
8498
8893
  const imports = [];
8499
8894
  const addIntegrations = [];
@@ -8543,10 +8938,10 @@ declare module "@botpress/runtime/_types/state" {
8543
8938
  const workflowInstances = [];
8544
8939
  for (const workflow of project.workflows) {
8545
8940
  try {
8546
- if (isBuiltinWorkflow2(workflow.definition.name)) {
8941
+ if (isBuiltinWorkflow3(workflow.definition.name)) {
8547
8942
  continue;
8548
8943
  }
8549
- const workflowPath = path33.join(project.path, workflow.path);
8944
+ const workflowPath = path34.join(project.path, workflow.path);
8550
8945
  const workflowModule = await import(`${workflowPath}?t=${Date.now()}`);
8551
8946
  const workflowInstance = workflowModule.default || workflowModule[workflow.export];
8552
8947
  if (workflowInstance) {
@@ -8556,7 +8951,7 @@ declare module "@botpress/runtime/_types/state" {
8556
8951
  console.error(`Failed to load workflow ${workflow.definition.name}:`, error);
8557
8952
  }
8558
8953
  }
8559
- for (const workflow of Object.values(BuiltInWorkflows3)) {
8954
+ for (const workflow of Object.values(BuiltInWorkflows4)) {
8560
8955
  workflowInstances.push(workflow);
8561
8956
  }
8562
8957
  for (const workflow of workflowInstances) {
@@ -8801,7 +9196,7 @@ configuration: {
8801
9196
  const fullContent = content + integrationsSection + `
8802
9197
 
8803
9198
  export default bot;`;
8804
- await createFile(path33.join(this.outputPath, "bot.definition.ts"), await formatCode(fullContent));
9199
+ await createFile(path34.join(this.outputPath, "bot.definition.ts"), await formatCode(fullContent));
8805
9200
  }
8806
9201
  async generateBotIndex() {
8807
9202
  const content = dedent`
@@ -8840,7 +9235,7 @@ export default bot;`;
8840
9235
 
8841
9236
  export default bot
8842
9237
  `;
8843
- await createFile(path33.join(this.outputPath, "src", "index.ts"), await formatCode(content));
9238
+ await createFile(path34.join(this.outputPath, "src", "index.ts"), await formatCode(content));
8844
9239
  }
8845
9240
  async generatePackageJson(project) {
8846
9241
  const packageJson = {
@@ -8854,7 +9249,7 @@ export default bot;`;
8854
9249
  typescript: "^5.9.3"
8855
9250
  }
8856
9251
  };
8857
- await createFile(path33.join(this.outputPath, "package.json"), JSON.stringify(packageJson, null, 2));
9252
+ await createFile(path34.join(this.outputPath, "package.json"), JSON.stringify(packageJson, null, 2));
8858
9253
  }
8859
9254
  async generateTsConfig() {
8860
9255
  const tsConfig = {
@@ -8885,7 +9280,7 @@ export default bot;`;
8885
9280
  },
8886
9281
  include: [".botpress/**/*", "src/**/*", "bp_modules/**/*", "./*.ts", "./*.json", "../*.d.ts"]
8887
9282
  };
8888
- await createFile(path33.join(this.outputPath, "tsconfig.json"), JSON.stringify(tsConfig, null, 2));
9283
+ await createFile(path34.join(this.outputPath, "tsconfig.json"), JSON.stringify(tsConfig, null, 2));
8889
9284
  }
8890
9285
  async generateGlobalTypes() {
8891
9286
  const content = dedent`
@@ -8908,11 +9303,11 @@ export default bot;`;
8908
9303
 
8909
9304
  export {};
8910
9305
  `;
8911
- await createFile(path33.join(this.outputPath, "global.d.ts"), await formatCode(content));
9306
+ await createFile(path34.join(this.outputPath, "global.d.ts"), await formatCode(content));
8912
9307
  }
8913
9308
  async copyAssets() {
8914
- const assetsPath = path33.join(this.projectPath, "assets");
8915
- const targetPath = path33.join(this.outputPath, "assets");
9309
+ const assetsPath = path34.join(this.projectPath, "assets");
9310
+ const targetPath = path34.join(this.outputPath, "assets");
8916
9311
  if (existsSync7(assetsPath)) {
8917
9312
  await fs16.mkdir(targetPath, { recursive: true });
8918
9313
  await this.copyDirectory(assetsPath, targetPath);
@@ -8921,8 +9316,8 @@ export default bot;`;
8921
9316
  async copyDirectory(src, dest) {
8922
9317
  const entries = await fs16.readdir(src, { withFileTypes: true });
8923
9318
  for (const entry of entries) {
8924
- const srcPath = path33.join(src, entry.name);
8925
- const destPath = path33.join(dest, entry.name);
9319
+ const srcPath = path34.join(src, entry.name);
9320
+ const destPath = path34.join(dest, entry.name);
8926
9321
  if (entry.isDirectory()) {
8927
9322
  await fs16.mkdir(destPath, { recursive: true });
8928
9323
  await this.copyDirectory(srcPath, destPath);
@@ -8934,16 +9329,16 @@ export default bot;`;
8934
9329
  async generateAdkRuntime() {
8935
9330
  const project = new AgentProject(this.projectPath);
8936
9331
  await project.reload();
8937
- const srcDir = path33.join(this.outputPath, "src");
9332
+ const srcDir = path34.join(this.outputPath, "src");
8938
9333
  {
8939
- const dest = path33.join(srcDir, "conversations.ts");
9334
+ const dest = path34.join(srcDir, "conversations.ts");
8940
9335
  const imports = new Map;
8941
9336
  const exports = new Set;
8942
9337
  let index = 1;
8943
9338
  for (const conversation of project.conversations) {
8944
9339
  if (!imports.has(conversation.path)) {
8945
9340
  const name = `conversations_${index++}`;
8946
- const importPath = getImportPath(dest, path33.join(project.path, conversation.path));
9341
+ const importPath = getImportPath(dest, path34.join(project.path, conversation.path));
8947
9342
  imports.set(conversation.path, {
8948
9343
  name,
8949
9344
  statement: `import * as ${name} from "${importPath}";`
@@ -8969,14 +9364,14 @@ export default bot;`;
8969
9364
  await createFile(dest, await formatCode(content2));
8970
9365
  }
8971
9366
  {
8972
- const dest = path33.join(srcDir, "knowledge.ts");
9367
+ const dest = path34.join(srcDir, "knowledge.ts");
8973
9368
  const imports = new Map;
8974
9369
  const exports = new Set;
8975
9370
  let index = 1;
8976
9371
  for (const knowledge of project.knowledge) {
8977
9372
  if (!imports.has(knowledge.path)) {
8978
9373
  const name = `knowledge_${index++}`;
8979
- const importPath = getImportPath(dest, path33.join(project.path, knowledge.path));
9374
+ const importPath = getImportPath(dest, path34.join(project.path, knowledge.path));
8980
9375
  imports.set(knowledge.path, {
8981
9376
  name,
8982
9377
  statement: `import * as ${name} from "${importPath}";`
@@ -9002,7 +9397,7 @@ export default bot;`;
9002
9397
  await createFile(dest, await formatCode(content2));
9003
9398
  }
9004
9399
  {
9005
- const dest = path33.join(srcDir, "triggers.ts");
9400
+ const dest = path34.join(srcDir, "triggers.ts");
9006
9401
  const { transforms: transforms4 } = await import("@botpress/sdk");
9007
9402
  const imports = new Map;
9008
9403
  const exports = new Set;
@@ -9011,7 +9406,7 @@ export default bot;`;
9011
9406
  for (const trigger of project.triggers) {
9012
9407
  if (!imports.has(trigger.path)) {
9013
9408
  const name = `triggers_${index++}`;
9014
- const importPath = getImportPath(dest, path33.join(project.path, trigger.path));
9409
+ const importPath = getImportPath(dest, path34.join(project.path, trigger.path));
9015
9410
  imports.set(trigger.path, {
9016
9411
  name,
9017
9412
  statement: `import * as ${name} from "${importPath}";`
@@ -9021,7 +9416,7 @@ export default bot;`;
9021
9416
  }
9022
9417
  for (const trigger of project.triggers) {
9023
9418
  try {
9024
- const absolutePath = path33.join(project.path, trigger.path);
9419
+ const absolutePath = path34.join(project.path, trigger.path);
9025
9420
  const triggerModule = await import(`${absolutePath}?t=${Date.now()}`);
9026
9421
  const triggerInstance = triggerModule[trigger.export] || triggerModule.default;
9027
9422
  if (triggerInstance && triggerInstance.payload) {
@@ -9064,17 +9459,17 @@ export default bot;`;
9064
9459
  await createFile(dest, await formatCode(content2));
9065
9460
  }
9066
9461
  {
9067
- const dest = path33.join(srcDir, "workflows.ts");
9462
+ const dest = path34.join(srcDir, "workflows.ts");
9068
9463
  const imports = new Map;
9069
9464
  const exports = new Set;
9070
9465
  let index = 1;
9071
9466
  for (const workflow of project.workflows) {
9072
- if (isBuiltinWorkflow2(workflow.definition.name)) {
9467
+ if (isBuiltinWorkflow3(workflow.definition.name)) {
9073
9468
  continue;
9074
9469
  }
9075
9470
  if (!imports.has(workflow.path)) {
9076
9471
  const name = `workflows_${index++}`;
9077
- const importPath = getImportPath(dest, path33.join(project.path, workflow.path));
9472
+ const importPath = getImportPath(dest, path34.join(project.path, workflow.path));
9078
9473
  const statement = `import * as ${name} from "${importPath}";`;
9079
9474
  imports.set(workflow.path, {
9080
9475
  name,
@@ -9083,7 +9478,7 @@ export default bot;`;
9083
9478
  }
9084
9479
  }
9085
9480
  for (const workflow of project.workflows) {
9086
- if (isBuiltinWorkflow2(workflow.definition.name)) {
9481
+ if (isBuiltinWorkflow3(workflow.definition.name)) {
9087
9482
  continue;
9088
9483
  }
9089
9484
  const importEntry = imports.get(workflow.path);
@@ -9108,7 +9503,7 @@ export default bot;`;
9108
9503
  await createFile(dest, await formatCode(content2));
9109
9504
  }
9110
9505
  {
9111
- const dest = path33.join(srcDir, "actions.ts");
9506
+ const dest = path34.join(srcDir, "actions.ts");
9112
9507
  const imports = new Map;
9113
9508
  const exports = new Set;
9114
9509
  let index = 1;
@@ -9118,7 +9513,7 @@ export default bot;`;
9118
9513
  }
9119
9514
  if (!imports.has(action.path)) {
9120
9515
  const name = `actions_${index++}`;
9121
- const importPath = getImportPath(dest, path33.join(project.path, action.path));
9516
+ const importPath = getImportPath(dest, path34.join(project.path, action.path));
9122
9517
  imports.set(action.path, {
9123
9518
  name,
9124
9519
  statement: `import * as ${name} from "${importPath}";`
@@ -9144,14 +9539,14 @@ export default bot;`;
9144
9539
  await createFile(dest, await formatCode(content2));
9145
9540
  }
9146
9541
  {
9147
- const dest = path33.join(srcDir, "tables.ts");
9542
+ const dest = path34.join(srcDir, "tables.ts");
9148
9543
  const imports = new Map;
9149
9544
  const exports = new Set;
9150
9545
  let index = 1;
9151
9546
  for (const table of project.tables) {
9152
9547
  if (!imports.has(table.path)) {
9153
9548
  const name = `tables_${index++}`;
9154
- const importPath = getImportPath(dest, path33.join(project.path, table.path));
9549
+ const importPath = getImportPath(dest, path34.join(project.path, table.path));
9155
9550
  imports.set(table.path, {
9156
9551
  name,
9157
9552
  statement: `import * as ${name} from "${importPath}";`
@@ -9177,8 +9572,8 @@ export default bot;`;
9177
9572
  await createFile(dest, await formatCode(content2));
9178
9573
  }
9179
9574
  {
9180
- const dest = path33.join(srcDir, "config.ts");
9181
- const importPath = getImportPath(dest, path33.join(project.path, "agent.config.ts"));
9575
+ const dest = path34.join(srcDir, "config.ts");
9576
+ const importPath = getImportPath(dest, path34.join(project.path, "agent.config.ts"));
9182
9577
  const content2 = `
9183
9578
  ////////////////////////////////////////////////////////
9184
9579
  // DO NOT EDIT THIS FILE DIRECTLY
@@ -9244,13 +9639,13 @@ export default bot;`;
9244
9639
  handlers.actions.setup(bot);
9245
9640
  }
9246
9641
  `;
9247
- await createFile(path33.join(this.outputPath, "src", "adk-runtime.ts"), await formatCode(content));
9642
+ await createFile(path34.join(this.outputPath, "src", "adk-runtime.ts"), await formatCode(content));
9248
9643
  }
9249
9644
  async copyAssetsRuntime() {
9250
- const assetsRuntimePath = path33.join(this.projectPath, ".adk", "assets-runtime.ts");
9645
+ const assetsRuntimePath = path34.join(this.projectPath, ".adk", "assets-runtime.ts");
9251
9646
  if (existsSync7(assetsRuntimePath)) {
9252
9647
  const content = await fs16.readFile(assetsRuntimePath, "utf-8");
9253
- await createFile(path33.join(this.outputPath, "src", "assets-runtime.ts"), await formatCode(content));
9648
+ await createFile(path34.join(this.outputPath, "src", "assets-runtime.ts"), await formatCode(content));
9254
9649
  }
9255
9650
  }
9256
9651
  }
@@ -9259,11 +9654,11 @@ async function generateBotProject(options) {
9259
9654
  await generator.generate();
9260
9655
  await generator.generateAdkRuntime();
9261
9656
  await generator.copyAssetsRuntime();
9262
- const botPath = options.outputPath || path33.join(options.projectPath, ".adk", "bot");
9657
+ const botPath = options.outputPath || path34.join(options.projectPath, ".adk", "bot");
9263
9658
  await linkSdk(options.projectPath, botPath);
9264
- const devIdManager = new DevIdManager(options.projectPath, options.outputPath || path33.join(options.projectPath, ".adk", "bot"));
9659
+ const devIdManager = new DevIdManager(options.projectPath, options.outputPath || path34.join(options.projectPath, ".adk", "bot"));
9265
9660
  await devIdManager.restoreDevId();
9266
- const integrationSync = new IntegrationSync(options.projectPath, options.outputPath || path33.join(options.projectPath, ".adk", "bot"));
9661
+ const integrationSync = new IntegrationSync(options.projectPath, options.outputPath || path34.join(options.projectPath, ".adk", "bot"));
9267
9662
  const integrationSyncResult = await integrationSync.syncIntegrations();
9268
9663
  if (integrationSyncResult.errors.length > 0) {
9269
9664
  console.warn(`⚠️ Some integrations failed to sync:`);
@@ -9271,7 +9666,7 @@ async function generateBotProject(options) {
9271
9666
  console.warn(` - ${alias}: ${error}`);
9272
9667
  });
9273
9668
  }
9274
- const interfaceSync = new InterfaceSync(options.projectPath, options.outputPath || path33.join(options.projectPath, ".adk", "bot"));
9669
+ const interfaceSync = new InterfaceSync(options.projectPath, options.outputPath || path34.join(options.projectPath, ".adk", "bot"));
9275
9670
  const interfaceSyncResult = await interfaceSync.syncInterfaces();
9276
9671
  if (interfaceSyncResult.errors.length > 0) {
9277
9672
  console.warn(`⚠️ Some interfaces failed to sync:`);
@@ -9780,7 +10175,7 @@ class TableManager {
9780
10175
  }
9781
10176
  // src/knowledge/manager.ts
9782
10177
  import crypto4 from "crypto";
9783
- import path34 from "path";
10178
+ import path35 from "path";
9784
10179
  import fs17 from "fs/promises";
9785
10180
  import { glob } from "glob";
9786
10181
  import { Client as Client15 } from "@botpress/client";
@@ -10230,14 +10625,14 @@ class KnowledgeManager {
10230
10625
  }
10231
10626
  async scanLocalFileHashes(directoryPath, filterFn) {
10232
10627
  const projectDir = this.project.path;
10233
- const directory = path34.resolve(projectDir, directoryPath);
10628
+ const directory = path35.resolve(projectDir, directoryPath);
10234
10629
  if (this.fileHashCache.has(directory)) {
10235
10630
  return this.fileHashCache.get(directory);
10236
10631
  }
10237
10632
  const files = glob.sync(directory + "/**/*.*", { absolute: true, nodir: true }).filter((file) => !filterFn || filterFn(file));
10238
10633
  const hashes = {};
10239
10634
  for (const file of files) {
10240
- const relPath = path34.relative(directory, file);
10635
+ const relPath = path35.relative(directory, file);
10241
10636
  const content = await fs17.readFile(file);
10242
10637
  hashes[relPath] = crypto4.createHash("sha256").update(content).digest("hex");
10243
10638
  }
@@ -10345,7 +10740,7 @@ class KnowledgeManager {
10345
10740
  }
10346
10741
  async syncDirectorySource(client, kbName, kbId, dsId, directoryPath, filterFn, force) {
10347
10742
  const projectDir = this.project.path;
10348
- const directory = path34.resolve(projectDir, directoryPath);
10743
+ const directory = path35.resolve(projectDir, directoryPath);
10349
10744
  if (!directory.startsWith(projectDir)) {
10350
10745
  throw new Error("Directory path must be within the agent's directory");
10351
10746
  }
@@ -10367,8 +10762,8 @@ class KnowledgeManager {
10367
10762
  return true;
10368
10763
  }).map((f) => ({
10369
10764
  abs: f,
10370
- rel: path34.relative(directory, f),
10371
- name: path34.basename(f)
10765
+ rel: path35.relative(directory, f),
10766
+ name: path35.basename(f)
10372
10767
  }));
10373
10768
  console.log(` Found ${allFiles.length} files in ${directoryPath}`);
10374
10769
  const cachedHashes = await this.scanLocalFileHashes(directoryPath, filterFn);
@@ -10450,7 +10845,7 @@ class KnowledgeManager {
10450
10845
  return null;
10451
10846
  }
10452
10847
  } catch {}
10453
- const title = path34.basename(local.name, path34.extname(local.name));
10848
+ const title = path35.basename(local.name, path35.extname(local.name));
10454
10849
  const metadata = {
10455
10850
  hash,
10456
10851
  dsId,
@@ -10715,7 +11110,7 @@ class FileWatcher2 extends EventEmitter3 {
10715
11110
  }
10716
11111
  // src/preflight/checker.ts
10717
11112
  import { Client as Client16 } from "@botpress/client";
10718
- import path35 from "path";
11113
+ import path36 from "path";
10719
11114
 
10720
11115
  // src/preflight/types.ts
10721
11116
  function hasIntegrationChanges(integrations) {
@@ -11077,7 +11472,7 @@ class PreflightChecker {
11077
11472
  options?.onProgress?.("Regenerating bot project...");
11078
11473
  await generateBotProject({
11079
11474
  projectPath: this.projectPath,
11080
- outputPath: path35.join(this.projectPath, ".adk", "bot"),
11475
+ outputPath: path36.join(this.projectPath, ".adk", "bot"),
11081
11476
  callbacks: options
11082
11477
  });
11083
11478
  options?.onSuccess?.("Bot project regenerated");
@@ -11087,19 +11482,19 @@ class PreflightChecker {
11087
11482
  import dedent2 from "dedent";
11088
11483
  import { existsSync as existsSync9 } from "fs";
11089
11484
  import fs18 from "fs/promises";
11090
- import path36 from "path";
11485
+ import path37 from "path";
11091
11486
  import { spawn } from "child_process";
11092
11487
  init_utils();
11093
11488
  init_credentials();
11094
11489
  async function findAgentRoot(startPath) {
11095
- let currentPath = path36.resolve(startPath);
11096
- const root = path36.parse(currentPath).root;
11490
+ let currentPath = path37.resolve(startPath);
11491
+ const root = path37.parse(currentPath).root;
11097
11492
  while (currentPath !== root) {
11098
11493
  try {
11099
- await fs18.access(path36.join(currentPath, "agent.config.ts"));
11494
+ await fs18.access(path37.join(currentPath, "agent.config.ts"));
11100
11495
  return currentPath;
11101
11496
  } catch {
11102
- currentPath = path36.dirname(currentPath);
11497
+ currentPath = path37.dirname(currentPath);
11103
11498
  }
11104
11499
  }
11105
11500
  return null;
@@ -11111,7 +11506,7 @@ class ScriptRunner {
11111
11506
  prod;
11112
11507
  credentials;
11113
11508
  constructor(options) {
11114
- this.projectPath = path36.resolve(options.projectPath);
11509
+ this.projectPath = path37.resolve(options.projectPath);
11115
11510
  this.forceRegenerate = options.forceRegenerate ?? false;
11116
11511
  this.prod = options.prod ?? false;
11117
11512
  this.credentials = options.credentials;
@@ -11120,9 +11515,9 @@ class ScriptRunner {
11120
11515
  const project = await AgentProject.load(this.projectPath, {
11121
11516
  adkCommand: "adk-build"
11122
11517
  });
11123
- const botPath = path36.join(this.projectPath, ".adk", "bot");
11124
- const runnerPath = path36.join(botPath, "src", "script-runner.ts");
11125
- const botpressTypesPath = path36.join(botPath, ".botpress", "implementation", "index.ts");
11518
+ const botPath = path37.join(this.projectPath, ".adk", "bot");
11519
+ const runnerPath = path37.join(botPath, "src", "script-runner.ts");
11520
+ const botpressTypesPath = path37.join(botPath, ".botpress", "implementation", "index.ts");
11126
11521
  const needsRegenerate = this.forceRegenerate || !existsSync9(runnerPath) || !existsSync9(botpressTypesPath);
11127
11522
  if (needsRegenerate) {
11128
11523
  try {
@@ -11239,7 +11634,7 @@ class ScriptRunner {
11239
11634
 
11240
11635
  runScript()
11241
11636
  `;
11242
- await fs18.writeFile(path36.join(botPath, "src", "script-runner.ts"), await formatCode(content), "utf-8");
11637
+ await fs18.writeFile(path37.join(botPath, "src", "script-runner.ts"), await formatCode(content), "utf-8");
11243
11638
  }
11244
11639
  async setupTestRuntime(options = {}) {
11245
11640
  const { botPath, project } = await this.prepare();
@@ -11270,7 +11665,7 @@ class ScriptRunner {
11270
11665
  for (const [key, value] of Object.entries(envVars)) {
11271
11666
  process.env[key] = value;
11272
11667
  }
11273
- const runtimePath = path36.join(botPath, "src", "index.ts");
11668
+ const runtimePath = path37.join(botPath, "src", "index.ts");
11274
11669
  return {
11275
11670
  botPath,
11276
11671
  runtimePath,
@@ -11318,7 +11713,7 @@ class ScriptRunner {
11318
11713
  }
11319
11714
  async run(scriptPath, options = {}) {
11320
11715
  const { botPath, runnerPath, project } = await this.prepare();
11321
- const absoluteScriptPath = path36.isAbsolute(scriptPath) ? scriptPath : path36.resolve(this.projectPath, scriptPath);
11716
+ const absoluteScriptPath = path37.isAbsolute(scriptPath) ? scriptPath : path37.resolve(this.projectPath, scriptPath);
11322
11717
  if (!existsSync9(absoluteScriptPath)) {
11323
11718
  throw new Error(`Script not found: ${absoluteScriptPath}`);
11324
11719
  }
@@ -11417,6 +11812,7 @@ export {
11417
11812
  initAssets,
11418
11813
  getRelativeTime,
11419
11814
  generateIntegrationTypes,
11815
+ generateClientWrapper,
11420
11816
  generateBotProject,
11421
11817
  generateAssetsTypes,
11422
11818
  generateAssetsRuntime,
@@ -11467,4 +11863,4 @@ export {
11467
11863
  AgentProject
11468
11864
  };
11469
11865
 
11470
- //# debugId=FB5A010697544F3364756E2164756E21
11866
+ //# debugId=B2A1E741C14E701164756E2164756E21