@botpress/adk 1.7.7 → 1.7.8

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
@@ -180,7 +180,7 @@ var createFile = async (path6, content) => {
180
180
  var init_fs = () => {};
181
181
 
182
182
  // src/generators/utils.ts
183
- import path13 from "path";
183
+ import path9 from "path";
184
184
  import { format } from "prettier";
185
185
  function toMultilineComment(comment) {
186
186
  if (!comment || comment.trim() === "") {
@@ -217,9 +217,9 @@ var PRETTIER_CONFIG, formatCode = async (code, filepath) => {
217
217
  `));
218
218
  return code;
219
219
  }
220
- }, ADK_VERSION = "1.7.7", relative2 = (from, to) => {
221
- const fromDir = path13.dirname(from);
222
- const relative3 = path13.relative(fromDir, to);
220
+ }, ADK_VERSION = "1.7.8", relative2 = (from, to) => {
221
+ const fromDir = path9.dirname(from);
222
+ const relative3 = path9.relative(fromDir, to);
223
223
  return relative3.startsWith(".") ? relative3 : `./${relative3}`;
224
224
  };
225
225
  var init_utils = __esm(() => {
@@ -1446,8 +1446,8 @@ function stringifyWithOrder(obj, keyOrder, space = 2) {
1446
1446
  }
1447
1447
  // src/agent-project/agent-project.ts
1448
1448
  import { BuiltInActions, BuiltInWorkflows, Errors as Errors2, Primitives as Primitives2, setAdkCommand } from "@botpress/runtime/internal";
1449
- import fs10 from "fs/promises";
1450
- import path11 from "path";
1449
+ import fs9 from "fs/promises";
1450
+ import path12 from "path";
1451
1451
  // src/assets/manager.ts
1452
1452
  import fs4 from "fs/promises";
1453
1453
  import path5 from "path";
@@ -2009,7 +2009,7 @@ class EnhancedIntegrationCache {
2009
2009
  }
2010
2010
  }
2011
2011
 
2012
- // src/agent-project/dependencies-json.ts
2012
+ // src/agent-project/dependencies-parser.ts
2013
2013
  import { z as z2, ZodIssueCode } from "@botpress/sdk";
2014
2014
 
2015
2015
  // src/agent-project/types.ts
@@ -2153,10 +2153,10 @@ class ValidationErrors {
2153
2153
  $type: ValidationErrors.$type,
2154
2154
  code: "INVALID_DEPENDENCIES_SYNTAX" /* INVALID_DEPENDENCIES_SYNTAX */,
2155
2155
  severity: "error" /* ERROR */,
2156
- message: `Invalid JSON syntax in dependencies.json: ${error}`,
2157
- file: "dependencies.json",
2156
+ message: `Invalid syntax in agent.config.ts dependencies: ${error}`,
2157
+ file: "agent.config.ts",
2158
2158
  line,
2159
- hint: "Ensure dependencies.json contains valid JSON"
2159
+ hint: "Ensure agent.config.ts exports a valid dependencies object"
2160
2160
  };
2161
2161
  }
2162
2162
  static invalidVersionFormat(integration, version) {
@@ -2165,7 +2165,7 @@ class ValidationErrors {
2165
2165
  code: "INVALID_VERSION_FORMAT" /* INVALID_VERSION_FORMAT */,
2166
2166
  severity: "error" /* ERROR */,
2167
2167
  message: `Invalid version format '${version}' for integration '${integration}'`,
2168
- file: "dependencies.json",
2168
+ file: "agent.config.ts",
2169
2169
  hint: 'Use exact versioning (e.g., "1.2.3", "2.0.0", "1.5.0")',
2170
2170
  context: { integration, version }
2171
2171
  };
@@ -2176,7 +2176,7 @@ class ValidationErrors {
2176
2176
  code: "UNKNOWN_INTEGRATION" /* UNKNOWN_INTEGRATION */,
2177
2177
  severity: "error" /* ERROR */,
2178
2178
  message: detailedMessage || `Unknown integration '${integration}' from source '${source}'`,
2179
- file: "dependencies.json",
2179
+ file: "agent.config.ts",
2180
2180
  hint: detailedMessage ? undefined : `Check if the integration name is correct or if it exists in ${source}`,
2181
2181
  context: { integration, source }
2182
2182
  };
@@ -2187,8 +2187,8 @@ class ValidationErrors {
2187
2187
  code: "UNKNOWN_INTEGRATION" /* UNKNOWN_INTEGRATION */,
2188
2188
  severity: "error" /* ERROR */,
2189
2189
  message: errorMessage,
2190
- file: "dependencies.json",
2191
- hint: `Update the version for "${integration}" in dependencies.json`
2190
+ file: "agent.config.ts",
2191
+ hint: `Update the version for "${integration}" in agent.config.ts dependencies`
2192
2192
  };
2193
2193
  }
2194
2194
  static unknownInterface(errorMessage) {
@@ -2197,7 +2197,7 @@ class ValidationErrors {
2197
2197
  code: "UNKNOWN_INTEGRATION" /* UNKNOWN_INTEGRATION */,
2198
2198
  severity: "error" /* ERROR */,
2199
2199
  message: errorMessage,
2200
- file: "dependencies.json"
2200
+ file: "agent.config.ts"
2201
2201
  };
2202
2202
  }
2203
2203
  static incompatibleVersion(integration, required, available) {
@@ -2206,7 +2206,7 @@ class ValidationErrors {
2206
2206
  code: "INCOMPATIBLE_VERSION" /* INCOMPATIBLE_VERSION */,
2207
2207
  severity: "error" /* ERROR */,
2208
2208
  message: `Integration '${integration}' requires version ${required}, but only ${available} is available`,
2209
- file: "dependencies.json",
2209
+ file: "agent.config.ts",
2210
2210
  hint: "Update the version requirement or check for compatible versions",
2211
2211
  context: { integration, required, available }
2212
2212
  };
@@ -2338,7 +2338,7 @@ function formatBytes(bytes) {
2338
2338
  return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
2339
2339
  }
2340
2340
 
2341
- // src/agent-project/dependencies-json.ts
2341
+ // src/agent-project/dependencies-parser.ts
2342
2342
  var integrationRefSchema = z2.string().transform((val, ctx) => {
2343
2343
  const match = val.match(/^(?:([^/]+)\/)?([^@]+)@(.+)$/);
2344
2344
  if (!match) {
@@ -2408,7 +2408,7 @@ class IntegrationParser {
2408
2408
  }
2409
2409
  for (const [integration, aliases] of seen.entries()) {
2410
2410
  if (aliases.length > 1) {
2411
- errors.push(ValidationErrors.warning(`Integration '${integration}' is used with multiple aliases: ${aliases.join(", ")}. This is valid but ensure each has different configurations.`, "dependencies.json"));
2411
+ errors.push(ValidationErrors.warning(`Integration '${integration}' is used with multiple aliases: ${aliases.join(", ")}. This is valid but ensure each has different configurations.`, "agent.config.ts"));
2412
2412
  }
2413
2413
  }
2414
2414
  return errors;
@@ -2463,7 +2463,7 @@ class IntegrationManager {
2463
2463
  }
2464
2464
  if (validation.warnings.length > 0) {
2465
2465
  validation.warnings.forEach((warn) => {
2466
- warnings.push(ValidationErrors.warning(warn, "dependencies.json"));
2466
+ warnings.push(ValidationErrors.warning(warn, "agent.config.ts"));
2467
2467
  });
2468
2468
  }
2469
2469
  } catch (error) {
@@ -2478,7 +2478,7 @@ class IntegrationManager {
2478
2478
  await Promise.all(fetchPromises);
2479
2479
  const hasChannels = integrations.some((i) => i.definition?.channels && Object.keys(i.definition.channels).length > 0);
2480
2480
  if (!hasChannels && integrations.length > 0) {
2481
- warnings.push(ValidationErrors.warning("No integrations with channels found. Your agent may not be able to receive messages.", "dependencies.json", "Add an integration with channels (e.g., slack, webchat) to enable conversations"));
2481
+ warnings.push(ValidationErrors.warning("No integrations with channels found. Your agent may not be able to receive messages.", "agent.config.ts", "Add an integration with channels (e.g., slack, webchat) to enable conversations"));
2482
2482
  }
2483
2483
  return { integrations, errors, warnings };
2484
2484
  }
@@ -2585,7 +2585,7 @@ class IntegrationManager {
2585
2585
  requiresConfig = schema?.required && schema.required.length > 0;
2586
2586
  }
2587
2587
  if (requiresConfig) {
2588
- warnings.push(`Integration '${integration.alias}' requires configuration. Add a connection in dependencies.json`);
2588
+ warnings.push(`Integration '${integration.alias}' requires configuration. Add a connection in agent.config.ts dependencies`);
2589
2589
  }
2590
2590
  }
2591
2591
  return {
@@ -2689,8 +2689,6 @@ class IntegrationCache {
2689
2689
  }
2690
2690
  // src/integrations/operations.ts
2691
2691
  import { Client as Client6 } from "@botpress/client";
2692
- import * as fs8 from "fs";
2693
- import * as path9 from "path";
2694
2692
  import * as process2 from "process";
2695
2693
 
2696
2694
  // src/integrations/hub-cache.ts
@@ -2843,6 +2841,51 @@ class HubCache {
2843
2841
  }
2844
2842
  }
2845
2843
 
2844
+ // src/agent-project/config-writer.ts
2845
+ init_utils();
2846
+ import { Project, SyntaxKind } from "ts-morph";
2847
+ import * as path10 from "path";
2848
+
2849
+ class ConfigWriter {
2850
+ configPath;
2851
+ constructor(projectPath) {
2852
+ this.configPath = path10.join(projectPath, "agent.config.ts");
2853
+ }
2854
+ async updateDependencies(dependencies) {
2855
+ const project = new Project;
2856
+ const sourceFile = project.addSourceFileAtPath(this.configPath);
2857
+ const defineConfigCall = sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression).find((call) => {
2858
+ const expression = call.getExpression();
2859
+ return expression.getText() === "defineConfig";
2860
+ });
2861
+ if (!defineConfigCall) {
2862
+ throw new Error("Could not find defineConfig() call in agent.config.ts");
2863
+ }
2864
+ const configArg = defineConfigCall.getArguments()[0];
2865
+ if (!configArg || !configArg.isKind(SyntaxKind.ObjectLiteralExpression)) {
2866
+ throw new Error("defineConfig() must have an object literal as its first argument");
2867
+ }
2868
+ const configObject = configArg.asKind(SyntaxKind.ObjectLiteralExpression);
2869
+ if (!configObject) {
2870
+ throw new Error("Could not find dependencies property in agent.config.ts");
2871
+ }
2872
+ let dependenciesProperty = configObject.getProperty("dependencies");
2873
+ if (dependenciesProperty) {
2874
+ dependenciesProperty.setInitializer(JSON.stringify(dependencies));
2875
+ } else {
2876
+ dependenciesProperty = configObject.addPropertyAssignment({
2877
+ name: "dependencies",
2878
+ initializer: JSON.stringify(dependencies)
2879
+ });
2880
+ }
2881
+ sourceFile.formatText();
2882
+ const content = sourceFile.getFullText();
2883
+ const formatted = await formatCode(content, this.configPath);
2884
+ sourceFile.replaceWithText(formatted);
2885
+ await sourceFile.save();
2886
+ }
2887
+ }
2888
+
2846
2889
  // src/integrations/operations.ts
2847
2890
  class IntegrationOperations {
2848
2891
  hubCache;
@@ -2932,8 +2975,7 @@ class IntegrationOperations {
2932
2975
  const { name, version = "latest" } = options;
2933
2976
  const ref = this.parseIntegrationRef(`${name}@${version}`);
2934
2977
  const alias = options.alias || ref.name;
2935
- const depsPath = path9.join(project.path, "dependencies.json");
2936
- const dependencies = JSON.parse(fs8.readFileSync(depsPath, "utf-8"));
2978
+ const dependencies = project.dependencies || { integrations: {} };
2937
2979
  if (!dependencies.integrations) {
2938
2980
  dependencies.integrations = {};
2939
2981
  }
@@ -2983,52 +3025,79 @@ class IntegrationOperations {
2983
3025
  throw new Error(`Failed to add integration: ${error instanceof Error ? error.message : String(error)}`);
2984
3026
  }
2985
3027
  let requiresConfiguration = false;
2986
- if (integrationDefinition.configurations) {
2987
- requiresConfiguration = Object.values(integrationDefinition.configurations).some((config) => config.identifier?.required === true);
2988
- }
3028
+ requiresConfiguration = Object.values(integrationDefinition.configurations).some((config2) => config2.identifier?.required === true);
2989
3029
  if (!requiresConfiguration && integrationDefinition.configuration) {
2990
- const config = integrationDefinition.configuration;
2991
- const schema = config.schema;
3030
+ const config2 = integrationDefinition.configuration;
3031
+ const schema = config2.schema;
2992
3032
  requiresConfiguration = schema?.required && schema.required.length > 0;
2993
3033
  }
2994
3034
  const actualVersion = integrationDefinition.version;
2995
3035
  const integrationVersion = `${ref.fullName}@${actualVersion}`;
2996
3036
  const existingEntry = dependencies.integrations[alias];
3037
+ const existingConfig = existingEntry && typeof existingEntry === "object" ? existingEntry.config : undefined;
3038
+ const config = requiresConfiguration && !existingConfig ? this.getPlaceholderConfig(integrationDefinition) : existingConfig;
2997
3039
  if (existingEntry && typeof existingEntry === "object" && "version" in existingEntry) {
2998
3040
  dependencies.integrations[alias] = {
2999
3041
  ...existingEntry,
3000
3042
  version: integrationVersion
3001
3043
  };
3002
3044
  } else {
3003
- dependencies.integrations[alias] = {
3045
+ const newEntry = {
3004
3046
  version: integrationVersion,
3005
- enabled: !requiresConfiguration
3047
+ enabled: !requiresConfiguration,
3048
+ config
3006
3049
  };
3050
+ dependencies.integrations[alias] = newEntry;
3007
3051
  }
3008
- fs8.writeFileSync(depsPath, stringifyWithOrder(dependencies, dependenciesKeyOrder) + `
3009
- `);
3052
+ const configWriter = new ConfigWriter(project.path);
3053
+ await configWriter.updateDependencies(dependencies);
3010
3054
  return {
3011
3055
  success: true,
3012
3056
  requiresConfiguration,
3013
3057
  newVersion: actualVersion
3014
3058
  };
3015
3059
  }
3060
+ getPlaceholderConfig(integrationDefinition) {
3061
+ const configPlaceholder = {};
3062
+ if (integrationDefinition.configuration) {
3063
+ const config = integrationDefinition.configuration;
3064
+ const schema = config.schema;
3065
+ if (schema?.required && schema.required.length > 0) {
3066
+ const properties = schema.properties || {};
3067
+ for (const fieldName of schema.required) {
3068
+ const fieldDef = properties[fieldName];
3069
+ if (fieldDef?.type === "string") {
3070
+ configPlaceholder[fieldName] = `YOUR_${fieldName.toUpperCase()}_HERE`;
3071
+ } else if (fieldDef?.type === "number" || fieldDef?.type === "integer") {
3072
+ configPlaceholder[fieldName] = 0;
3073
+ } else if (fieldDef?.type === "boolean") {
3074
+ configPlaceholder[fieldName] = false;
3075
+ } else {
3076
+ configPlaceholder[fieldName] = null;
3077
+ }
3078
+ }
3079
+ if (Object.keys(configPlaceholder).length > 0) {
3080
+ console.log("Generated config placeholders:", configPlaceholder);
3081
+ return configPlaceholder;
3082
+ }
3083
+ }
3084
+ }
3085
+ return;
3086
+ }
3016
3087
  async removeIntegration(name) {
3017
3088
  const project = await AgentProject.load(this.projectPath || process2.cwd());
3018
- const depsPath = path9.join(project.path, "dependencies.json");
3019
- const dependencies = JSON.parse(fs8.readFileSync(depsPath, "utf-8"));
3020
- if (!dependencies.integrations || !dependencies.integrations[name]) {
3089
+ const dependencies = project.dependencies;
3090
+ if (!dependencies || !dependencies.integrations || !dependencies.integrations[name]) {
3021
3091
  throw new Error(`Integration "${name}" not found in dependencies`);
3022
3092
  }
3023
3093
  delete dependencies.integrations[name];
3024
- fs8.writeFileSync(depsPath, stringifyWithOrder(dependencies, dependenciesKeyOrder) + `
3025
- `);
3094
+ const configWriter = new ConfigWriter(project.path);
3095
+ await configWriter.updateDependencies(dependencies);
3026
3096
  }
3027
3097
  async upgradeIntegration(name) {
3028
3098
  const project = await AgentProject.load(this.projectPath || process2.cwd());
3029
- const depsPath = path9.join(project.path, "dependencies.json");
3030
- const dependencies = JSON.parse(fs8.readFileSync(depsPath, "utf-8"));
3031
- if (!dependencies.integrations) {
3099
+ const dependencies = project.dependencies;
3100
+ if (!dependencies || !dependencies.integrations) {
3032
3101
  throw new Error("No integrations found in dependencies");
3033
3102
  }
3034
3103
  const upgraded = [];
@@ -3064,16 +3133,15 @@ class IntegrationOperations {
3064
3133
  }
3065
3134
  }
3066
3135
  if (upgraded.length > 0) {
3067
- fs8.writeFileSync(depsPath, stringifyWithOrder(dependencies, dependenciesKeyOrder) + `
3068
- `);
3136
+ const configWriter = new ConfigWriter(project.path);
3137
+ await configWriter.updateDependencies(dependencies);
3069
3138
  }
3070
3139
  return { upgraded, failed };
3071
3140
  }
3072
3141
  async listIntegrations() {
3073
3142
  const project = await AgentProject.load(this.projectPath || process2.cwd());
3074
- const depsPath = path9.join(project.path, "dependencies.json");
3075
- const dependencies = JSON.parse(fs8.readFileSync(depsPath, "utf-8"));
3076
- if (!dependencies.integrations) {
3143
+ const dependencies = project.dependencies;
3144
+ if (!dependencies || !dependencies.integrations) {
3077
3145
  return [];
3078
3146
  }
3079
3147
  const integrations = [];
@@ -3303,8 +3371,8 @@ class IntegrationChecker {
3303
3371
  import { Client as Client8 } from "@botpress/client";
3304
3372
 
3305
3373
  // src/interfaces/enhanced-cache.ts
3306
- import fs9 from "fs/promises";
3307
- import path10 from "path";
3374
+ import fs8 from "fs/promises";
3375
+ import path11 from "path";
3308
3376
  import os6 from "os";
3309
3377
 
3310
3378
  class EnhancedInterfaceCache {
@@ -3314,21 +3382,21 @@ class EnhancedInterfaceCache {
3314
3382
  noCache;
3315
3383
  constructor(noCache = false) {
3316
3384
  this.noCache = noCache;
3317
- this.cacheDir = path10.join(os6.homedir(), ".adk", "cache", "interfaces");
3318
- this.resolutionsDir = path10.join(this.cacheDir, "resolutions");
3319
- this.definitionsDir = path10.join(this.cacheDir, "definitions");
3385
+ this.cacheDir = path11.join(os6.homedir(), ".adk", "cache", "interfaces");
3386
+ this.resolutionsDir = path11.join(this.cacheDir, "resolutions");
3387
+ this.definitionsDir = path11.join(this.cacheDir, "definitions");
3320
3388
  }
3321
3389
  async ensureCacheDirs() {
3322
- await fs9.mkdir(this.resolutionsDir, { recursive: true });
3323
- await fs9.mkdir(this.definitionsDir, { recursive: true });
3390
+ await fs8.mkdir(this.resolutionsDir, { recursive: true });
3391
+ await fs8.mkdir(this.definitionsDir, { recursive: true });
3324
3392
  }
3325
3393
  async getResolution(name, version, workspace) {
3326
3394
  if (this.noCache)
3327
3395
  return null;
3328
3396
  try {
3329
3397
  const key = this.getResolutionKey(name, version, workspace);
3330
- const cachePath = path10.join(this.resolutionsDir, `${key}.json`);
3331
- const data = await fs9.readFile(cachePath, "utf-8");
3398
+ const cachePath = path11.join(this.resolutionsDir, `${key}.json`);
3399
+ const data = await fs8.readFile(cachePath, "utf-8");
3332
3400
  const resolution = JSON.parse(data);
3333
3401
  const cachedAt = new Date(resolution.cachedAt);
3334
3402
  const ageMinutes = (Date.now() - cachedAt.getTime()) / (1000 * 60);
@@ -3342,21 +3410,21 @@ class EnhancedInterfaceCache {
3342
3410
  async setResolution(name, version, workspace, interfaceId, updatedAt) {
3343
3411
  await this.ensureCacheDirs();
3344
3412
  const key = this.getResolutionKey(name, version, workspace);
3345
- const cachePath = path10.join(this.resolutionsDir, `${key}.json`);
3413
+ const cachePath = path11.join(this.resolutionsDir, `${key}.json`);
3346
3414
  const resolution = {
3347
3415
  interfaceId,
3348
3416
  updatedAt,
3349
3417
  cachedAt: new Date().toISOString()
3350
3418
  };
3351
- await fs9.writeFile(cachePath, JSON.stringify(resolution, null, 2));
3419
+ await fs8.writeFile(cachePath, JSON.stringify(resolution, null, 2));
3352
3420
  }
3353
3421
  async getDefinition(interfaceId, updatedAt) {
3354
3422
  if (this.noCache)
3355
3423
  return null;
3356
3424
  try {
3357
3425
  const key = this.getDefinitionKey(interfaceId, updatedAt);
3358
- const cachePath = path10.join(this.definitionsDir, `${key}.json`);
3359
- const data = await fs9.readFile(cachePath, "utf-8");
3426
+ const cachePath = path11.join(this.definitionsDir, `${key}.json`);
3427
+ const data = await fs8.readFile(cachePath, "utf-8");
3360
3428
  const cached = JSON.parse(data);
3361
3429
  return cached.definition;
3362
3430
  } catch {
@@ -3366,28 +3434,28 @@ class EnhancedInterfaceCache {
3366
3434
  async setDefinition(interfaceId, updatedAt, definition) {
3367
3435
  await this.ensureCacheDirs();
3368
3436
  const key = this.getDefinitionKey(interfaceId, updatedAt);
3369
- const cachePath = path10.join(this.definitionsDir, `${key}.json`);
3437
+ const cachePath = path11.join(this.definitionsDir, `${key}.json`);
3370
3438
  const cached = {
3371
3439
  definition,
3372
3440
  cachedAt: new Date().toISOString()
3373
3441
  };
3374
- await fs9.writeFile(cachePath, JSON.stringify(cached, null, 2));
3442
+ await fs8.writeFile(cachePath, JSON.stringify(cached, null, 2));
3375
3443
  }
3376
3444
  async clear() {
3377
3445
  try {
3378
- const resolutionFiles = await fs9.readdir(this.resolutionsDir);
3379
- await Promise.all(resolutionFiles.map((f) => fs9.unlink(path10.join(this.resolutionsDir, f))));
3380
- const definitionFiles = await fs9.readdir(this.definitionsDir);
3381
- await Promise.all(definitionFiles.map((f) => fs9.unlink(path10.join(this.definitionsDir, f))));
3446
+ const resolutionFiles = await fs8.readdir(this.resolutionsDir);
3447
+ await Promise.all(resolutionFiles.map((f) => fs8.unlink(path11.join(this.resolutionsDir, f))));
3448
+ const definitionFiles = await fs8.readdir(this.definitionsDir);
3449
+ await Promise.all(definitionFiles.map((f) => fs8.unlink(path11.join(this.definitionsDir, f))));
3382
3450
  } catch {}
3383
3451
  }
3384
3452
  async getStats() {
3385
3453
  const getDirectoryStats = async (dir) => {
3386
3454
  try {
3387
- const files = await fs9.readdir(dir);
3455
+ const files = await fs8.readdir(dir);
3388
3456
  let totalSize = 0;
3389
3457
  for (const file of files) {
3390
- const stats = await fs9.stat(path10.join(dir, file));
3458
+ const stats = await fs8.stat(path11.join(dir, file));
3391
3459
  totalSize += stats.size;
3392
3460
  }
3393
3461
  return { count: files.length, sizeBytes: totalSize };
@@ -3498,7 +3566,7 @@ class InterfaceManager {
3498
3566
  intf.validationResult = validation;
3499
3567
  if (!validation.valid) {
3500
3568
  validation.errors.forEach((msg) => {
3501
- errors.push(ValidationErrors.warning(msg, "dependencies.json"));
3569
+ errors.push(ValidationErrors.warning(msg, "agent.config.ts"));
3502
3570
  });
3503
3571
  }
3504
3572
  } catch (error) {
@@ -3748,7 +3816,7 @@ class AgentProject {
3748
3816
  _tables = [];
3749
3817
  constructor(projectPath, options = {}) {
3750
3818
  this._options = options;
3751
- this._path = path11.resolve(projectPath);
3819
+ this._path = path12.resolve(projectPath);
3752
3820
  this._integrationManager = new IntegrationManager({
3753
3821
  noCache: options.noCache
3754
3822
  });
@@ -3760,7 +3828,7 @@ class AgentProject {
3760
3828
  });
3761
3829
  }
3762
3830
  static async load(projectPath, options = {}) {
3763
- const resolvedPath = path11.resolve(projectPath);
3831
+ const resolvedPath = path12.resolve(projectPath);
3764
3832
  if (!options.noCache) {
3765
3833
  const cached = AgentProject._projectCache.get(resolvedPath);
3766
3834
  if (cached) {
@@ -3778,7 +3846,7 @@ class AgentProject {
3778
3846
  AgentProject._projectCache.clear();
3779
3847
  }
3780
3848
  static clearCacheForPath(projectPath) {
3781
- const resolvedPath = path11.resolve(projectPath);
3849
+ const resolvedPath = path12.resolve(projectPath);
3782
3850
  AgentProject._projectCache.delete(resolvedPath);
3783
3851
  }
3784
3852
  get path() {
@@ -3864,7 +3932,6 @@ class AgentProject {
3864
3932
  workspaceId: this._agentInfo?.workspaceId,
3865
3933
  botId: this._agentInfo?.botId
3866
3934
  });
3867
- await this.loadDependencies();
3868
3935
  await this.loadBuiltInWorkflows();
3869
3936
  await this.loadBuiltInActions();
3870
3937
  await this.loadAgentPrimitives();
@@ -3890,17 +3957,17 @@ class AgentProject {
3890
3957
  const warnings = [];
3891
3958
  const info = [];
3892
3959
  try {
3893
- await fs10.access(this._path);
3894
- const requiredFiles = ["agent.config.ts", "dependencies.json"];
3960
+ await fs9.access(this._path);
3961
+ const requiredFiles = ["agent.config.ts"];
3895
3962
  for (const file of requiredFiles) {
3896
3963
  try {
3897
- await fs10.access(path11.join(this._path, file));
3964
+ await fs9.access(path12.join(this._path, file));
3898
3965
  } catch {
3899
3966
  errors.push(ValidationErrors.requiredFileMissing(file));
3900
3967
  }
3901
3968
  }
3902
3969
  try {
3903
- await fs10.access(path11.join(this._path, "agent.json"));
3970
+ await fs9.access(path12.join(this._path, "agent.json"));
3904
3971
  } catch {
3905
3972
  info.push({
3906
3973
  $type: "ValidationError",
@@ -3914,7 +3981,7 @@ class AgentProject {
3914
3981
  const expectedDirs = ["actions", "workflows", "conversations", "assets"];
3915
3982
  for (const dir of expectedDirs) {
3916
3983
  try {
3917
- const stats = await fs10.stat(path11.join(this._path, dir));
3984
+ const stats = await fs9.stat(path12.join(this._path, dir));
3918
3985
  if (!stats.isDirectory()) {
3919
3986
  warnings.push(ValidationErrors.invalidStructure(dir, "directory"));
3920
3987
  }
@@ -3987,9 +4054,9 @@ class AgentProject {
3987
4054
  return this._assetsManager;
3988
4055
  }
3989
4056
  async createAgentInfo(info) {
3990
- const agentPath = path11.join(this._path, "agent.json");
4057
+ const agentPath = path12.join(this._path, "agent.json");
3991
4058
  const agentContent = stringifyWithOrder(info, agentInfoKeyOrder);
3992
- await fs10.writeFile(agentPath, agentContent);
4059
+ await fs9.writeFile(agentPath, agentContent);
3993
4060
  this._agentInfo = info;
3994
4061
  }
3995
4062
  async updateAgentInfo(updates) {
@@ -3997,9 +4064,9 @@ class AgentProject {
3997
4064
  throw new Error("No agent.json found. Use createAgentInfo() first.");
3998
4065
  }
3999
4066
  const updatedInfo = { ...this._agentInfo, ...updates };
4000
- const agentPath = path11.join(this._path, "agent.json");
4067
+ const agentPath = path12.join(this._path, "agent.json");
4001
4068
  const agentContent = stringifyWithOrder(updatedInfo, agentInfoKeyOrder);
4002
- await fs10.writeFile(agentPath, agentContent);
4069
+ await fs9.writeFile(agentPath, agentContent);
4003
4070
  this._agentInfo = updatedInfo;
4004
4071
  }
4005
4072
  requiresAgentInfo(operation) {
@@ -4009,7 +4076,7 @@ class AgentProject {
4009
4076
  }
4010
4077
  async loadConfig() {
4011
4078
  try {
4012
- const configPath = path11.join(this._path, "agent.config.ts");
4079
+ const configPath = path12.join(this._path, "agent.config.ts");
4013
4080
  const configModule = await import(`${configPath}?t=${Date.now()}`);
4014
4081
  if (!configModule || !configModule.default) {
4015
4082
  this._errors.push({
@@ -4034,81 +4101,64 @@ class AgentProject {
4034
4101
  return;
4035
4102
  }
4036
4103
  this._config = configModule.default;
4037
- } catch (error) {
4038
- this._errors.push({
4039
- $type: "ValidationError",
4040
- code: "INVALID_CONFIG_SYNTAX" /* INVALID_CONFIG_SYNTAX */,
4041
- severity: "error" /* ERROR */,
4042
- message: `Failed to load agent.config.ts: ${error.message}`,
4043
- file: "agent.config.ts"
4044
- });
4045
- }
4046
- }
4047
- async loadDependencies() {
4048
- try {
4049
- const depsPath = path11.join(this._path, "dependencies.json");
4050
- const depsContent = await fs10.readFile(depsPath, "utf-8");
4051
- let depsData;
4052
- try {
4053
- depsData = JSON.parse(depsContent);
4054
- } catch (parseError) {
4104
+ const config = configModule.default;
4105
+ if (config.dependencies) {
4106
+ const validationResult = dependenciesSchema.safeParse(config.dependencies);
4107
+ if (!validationResult.success) {
4108
+ const errors = validationResult.error.errors;
4109
+ for (const error of errors) {
4110
+ this._errors.push({
4111
+ $type: "ValidationError",
4112
+ code: "INVALID_DEPENDENCIES_SCHEMA" /* INVALID_DEPENDENCIES_SCHEMA */,
4113
+ severity: "error" /* ERROR */,
4114
+ message: `Invalid dependencies in agent.config.ts: ${error.path.join(".")} - ${error.message}`,
4115
+ file: "agent.config.ts",
4116
+ hint: error.code === "invalid_type" ? `Expected ${error.expected}, but got ${error.received}` : undefined
4117
+ });
4118
+ }
4119
+ this._dependencies = { integrations: {} };
4120
+ this._integrations = [];
4121
+ this._interfaces = [];
4122
+ return;
4123
+ }
4124
+ this._dependencies = validationResult.data;
4125
+ if (this._dependencies) {
4126
+ const [intRes, ifRes] = await Promise.all([
4127
+ this._integrationManager.loadIntegrations(this._dependencies),
4128
+ this._interfaceManager.loadInterfaces(this._dependencies)
4129
+ ]);
4130
+ this._integrations = intRes.integrations;
4131
+ this._interfaces = ifRes.interfaces;
4132
+ this._errors.push(...intRes.errors, ...ifRes.errors);
4133
+ this._warnings.push(...intRes.warnings, ...ifRes.warnings);
4134
+ }
4135
+ } else {
4055
4136
  this._errors.push({
4056
4137
  $type: "ValidationError",
4057
- code: "INVALID_DEPENDENCIES_SYNTAX" /* INVALID_DEPENDENCIES_SYNTAX */,
4138
+ code: "MISSING_REQUIRED_FIELD" /* MISSING_REQUIRED_FIELD */,
4058
4139
  severity: "error" /* ERROR */,
4059
- message: `Invalid JSON syntax in dependencies.json: ${parseError.message}`,
4060
- file: "dependencies.json"
4140
+ message: "agent.config.ts must include a dependencies field",
4141
+ file: "agent.config.ts",
4142
+ hint: "Add dependencies: { integrations: {} } to your defineConfig() call"
4061
4143
  });
4062
4144
  this._dependencies = { integrations: {} };
4063
4145
  this._integrations = [];
4064
4146
  this._interfaces = [];
4065
- return;
4066
- }
4067
- const validationResult = dependenciesSchema.safeParse(depsData);
4068
- if (!validationResult.success) {
4069
- const errors = validationResult.error.errors;
4070
- for (const error of errors) {
4071
- this._errors.push({
4072
- $type: "ValidationError",
4073
- code: "INVALID_DEPENDENCIES_SCHEMA" /* INVALID_DEPENDENCIES_SCHEMA */,
4074
- severity: "error" /* ERROR */,
4075
- message: `Invalid dependencies.json: ${error.path.join(".")} - ${JSON.stringify(error, null, 2)}`,
4076
- file: "dependencies.json",
4077
- hint: error.code === "invalid_type" ? `Expected ${error.expected}, but got ${error.received}` : undefined
4078
- });
4079
- }
4080
- this._dependencies = { integrations: {} };
4081
- this._integrations = [];
4082
- this._interfaces = [];
4083
- return;
4084
- }
4085
- this._dependencies = validationResult.data;
4086
- if (this._dependencies) {
4087
- const [intRes, ifRes] = await Promise.all([
4088
- this._integrationManager.loadIntegrations(this._dependencies),
4089
- this._interfaceManager.loadInterfaces(this._dependencies)
4090
- ]);
4091
- this._integrations = intRes.integrations;
4092
- this._interfaces = ifRes.interfaces;
4093
- this._errors.push(...intRes.errors, ...ifRes.errors);
4094
- this._warnings.push(...intRes.warnings, ...ifRes.warnings);
4095
4147
  }
4096
4148
  } catch (error) {
4097
- if (error.code === "ENOENT") {
4098
- this._dependencies = {
4099
- integrations: {}
4100
- };
4101
- this._integrations = [];
4102
- this._interfaces = [];
4103
- } else {
4104
- throw error;
4105
- }
4149
+ this._errors.push({
4150
+ $type: "ValidationError",
4151
+ code: "INVALID_CONFIG_SYNTAX" /* INVALID_CONFIG_SYNTAX */,
4152
+ severity: "error" /* ERROR */,
4153
+ message: `Failed to load agent.config.ts: ${error.message}`,
4154
+ file: "agent.config.ts"
4155
+ });
4106
4156
  }
4107
4157
  }
4108
4158
  async loadAgentInfo() {
4109
4159
  try {
4110
- const agentPath = path11.join(this._path, "agent.json");
4111
- const agentContent = await fs10.readFile(agentPath, "utf-8");
4160
+ const agentPath = path12.join(this._path, "agent.json");
4161
+ const agentContent = await fs9.readFile(agentPath, "utf-8");
4112
4162
  let agentData;
4113
4163
  try {
4114
4164
  agentData = JSON.parse(agentContent);
@@ -4205,8 +4255,8 @@ class AgentProject {
4205
4255
  setAdkCommand(this._options.adkCommand);
4206
4256
  }
4207
4257
  try {
4208
- const src = path11.join(this._path, "src");
4209
- if (!await fs10.stat(src).catch(() => false)) {
4258
+ const src = path12.join(this._path, "src");
4259
+ if (!await fs9.stat(src).catch(() => false)) {
4210
4260
  this._errors.push({
4211
4261
  $type: "ValidationError",
4212
4262
  code: "INVALID_STRUCTURE" /* INVALID_STRUCTURE */,
@@ -4215,14 +4265,14 @@ class AgentProject {
4215
4265
  });
4216
4266
  return;
4217
4267
  }
4218
- const allFiles = await fs10.readdir(src, {
4268
+ const allFiles = await fs9.readdir(src, {
4219
4269
  withFileTypes: true,
4220
4270
  recursive: true
4221
4271
  });
4222
4272
  for (const file of allFiles.filter((x) => x.isFile())) {
4223
4273
  const filename = file.name;
4224
- const absolutePath = path11.join(file.parentPath, file.name);
4225
- const relPath = path11.relative(this.path, absolutePath);
4274
+ const absolutePath = path12.join(file.parentPath, file.name);
4275
+ const relPath = path12.relative(this.path, absolutePath);
4226
4276
  if (filename.toLowerCase().endsWith(".d.ts")) {
4227
4277
  continue;
4228
4278
  }
@@ -4398,7 +4448,7 @@ class AgentProject {
4398
4448
  // src/agent-project/file-watcher.ts
4399
4449
  import { watch } from "fs";
4400
4450
  import { EventEmitter as EventEmitter2 } from "events";
4401
- import path12 from "path";
4451
+ import path13 from "path";
4402
4452
  class FileWatcher extends EventEmitter2 {
4403
4453
  basePath;
4404
4454
  watcher;
@@ -4421,7 +4471,7 @@ class FileWatcher extends EventEmitter2 {
4421
4471
  this.watcher = watch(this.basePath, { recursive: true }, (eventType, filename) => {
4422
4472
  if (!filename)
4423
4473
  return;
4424
- const fullPath = path12.join(this.basePath, filename);
4474
+ const fullPath = path13.join(this.basePath, filename);
4425
4475
  const relativePath = filename;
4426
4476
  if (this.shouldIgnore(relativePath)) {
4427
4477
  return;
@@ -4470,7 +4520,7 @@ class FileWatcher extends EventEmitter2 {
4470
4520
  }
4471
4521
  // src/agent-init/agent-project-generator.ts
4472
4522
  init_utils();
4473
- import * as fs11 from "fs";
4523
+ import * as fs10 from "fs";
4474
4524
  import * as path14 from "path";
4475
4525
 
4476
4526
  class AgentProjectGenerator {
@@ -4487,7 +4537,6 @@ class AgentProjectGenerator {
4487
4537
  async generate() {
4488
4538
  this.ensureEmptyDirectory();
4489
4539
  this.createPackageJson();
4490
- this.createDependenciesJson();
4491
4540
  await this.createAgentConfig();
4492
4541
  this.createTsConfig();
4493
4542
  this.createAgentJson();
@@ -4496,10 +4545,10 @@ class AgentProjectGenerator {
4496
4545
  await this.createSourceStructure();
4497
4546
  }
4498
4547
  ensureEmptyDirectory() {
4499
- if (!fs11.existsSync(this.projectPath)) {
4500
- fs11.mkdirSync(this.projectPath, { recursive: true });
4548
+ if (!fs10.existsSync(this.projectPath)) {
4549
+ fs10.mkdirSync(this.projectPath, { recursive: true });
4501
4550
  }
4502
- const files = fs11.readdirSync(this.projectPath);
4551
+ const files = fs10.readdirSync(this.projectPath);
4503
4552
  if (files.length > 0) {
4504
4553
  throw new Error(`Directory ${this.projectPath} is not empty. Please use an empty directory.`);
4505
4554
  }
@@ -4517,7 +4566,7 @@ class AgentProjectGenerator {
4517
4566
  deploy: "adk deploy"
4518
4567
  },
4519
4568
  dependencies: {
4520
- "@botpress/runtime": `^${"1.7.7"}`
4569
+ "@botpress/runtime": `^${"1.7.8"}`
4521
4570
  },
4522
4571
  devDependencies: {
4523
4572
  typescript: "^5.9.3"
@@ -4528,12 +4577,12 @@ class AgentProjectGenerator {
4528
4577
  }
4529
4578
  this.writeJsonFile("package.json", packageJson);
4530
4579
  }
4531
- createDependenciesJson() {
4532
- const dependenciesJson = {
4580
+ getDefaultDependencies() {
4581
+ const dependencies = {
4533
4582
  integrations: {}
4534
4583
  };
4535
4584
  if (this.template === "hello-world") {
4536
- dependenciesJson.integrations = {
4585
+ dependencies.integrations = {
4537
4586
  chat: {
4538
4587
  version: "chat@latest",
4539
4588
  enabled: true
@@ -4544,9 +4593,12 @@ class AgentProjectGenerator {
4544
4593
  }
4545
4594
  };
4546
4595
  }
4547
- this.writeJsonFile("dependencies.json", dependenciesJson);
4596
+ return dependencies;
4548
4597
  }
4549
4598
  async createAgentConfig() {
4599
+ const dependencies = this.getDefaultDependencies();
4600
+ const integrationsJson = JSON.stringify(dependencies.integrations, null, 4).replace(/\n/g, `
4601
+ `);
4550
4602
  const defaultModels = this.template === "hello-world" ? `
4551
4603
  defaultModels: {
4552
4604
  autonomous: "cerebras:gpt-oss-120b",
@@ -4566,6 +4618,10 @@ ${defaultModels}
4566
4618
  user: {
4567
4619
  state: z.object({}),
4568
4620
  },
4621
+
4622
+ dependencies: {
4623
+ integrations: ${integrationsJson},
4624
+ },
4569
4625
  });
4570
4626
  `;
4571
4627
  await this.writeFormattedFile("agent.config.ts", agentConfig);
@@ -4675,11 +4731,11 @@ A Botpress Agent built with the ADK.
4675
4731
  }
4676
4732
  async createSourceStructure() {
4677
4733
  const srcPath = path14.join(this.projectPath, "src");
4678
- fs11.mkdirSync(srcPath);
4734
+ fs10.mkdirSync(srcPath);
4679
4735
  const subdirectories = ["actions", "conversations", "knowledge", "tables", "triggers", "workflows"];
4680
4736
  for (const subdir of subdirectories) {
4681
4737
  const subdirPath = path14.join(srcPath, subdir);
4682
- fs11.mkdirSync(subdirPath);
4738
+ fs10.mkdirSync(subdirPath);
4683
4739
  if (subdir === "conversations" && this.template === "hello-world") {
4684
4740
  const conversationContent = `import { Conversation } from "@botpress/runtime";
4685
4741
 
@@ -4709,7 +4765,7 @@ export default {};
4709
4765
  }
4710
4766
  writeFile(relativePath, content) {
4711
4767
  const filePath = path14.join(this.projectPath, relativePath);
4712
- fs11.writeFileSync(filePath, content);
4768
+ fs10.writeFileSync(filePath, content);
4713
4769
  }
4714
4770
  async writeFormattedFile(relativePath, content) {
4715
4771
  const formatted = await formatCode(content, relativePath);
@@ -4857,14 +4913,16 @@ var getIntegrationNames = (integration) => ({
4857
4913
  actions: `Integration_Actions_${getPascalAlias(integration)}`,
4858
4914
  channels: `Integration_Channels_${getPascalAlias(integration)}`,
4859
4915
  events: `Integration_Events_${getPascalAlias(integration)}`,
4860
- users: `Integration_Users_${getPascalAlias(integration)}`
4916
+ users: `Integration_Users_${getPascalAlias(integration)}`,
4917
+ config: `Integration_Config_${getPascalAlias(integration)}`
4861
4918
  },
4862
4919
  paths: {
4863
4920
  index: path16.join(snakeCase(getPascalAlias(integration)), `index.ts`),
4864
4921
  actions: path16.join(snakeCase(getPascalAlias(integration)), `actions.ts`),
4865
4922
  channels: path16.join(snakeCase(getPascalAlias(integration)), `channels.ts`),
4866
4923
  events: path16.join(snakeCase(getPascalAlias(integration)), `events.ts`),
4867
- users: path16.join(snakeCase(getPascalAlias(integration)), `users.ts`)
4924
+ users: path16.join(snakeCase(getPascalAlias(integration)), `users.ts`),
4925
+ config: path16.join(snakeCase(getPascalAlias(integration)), `config.ts`)
4868
4926
  }
4869
4927
  });
4870
4928
  async function generateIntegrationTypes(integration) {
@@ -4890,17 +4948,20 @@ async function generateIntegrationTypes(integration) {
4890
4948
  import { Integration_Channels_${getPascalAlias(integration)} } from "${rel(names.paths.channels)}";
4891
4949
  import { Integration_Events_${getPascalAlias(integration)} } from "${rel(names.paths.events)}";
4892
4950
  import { Integration_Users_${getPascalAlias(integration)} } from "${rel(names.paths.users)}";
4951
+ import { Integration_Config_${getPascalAlias(integration)} } from "${rel(names.paths.config)}";
4893
4952
 
4894
4953
  export * from "${rel(names.paths.actions)}";
4895
4954
  export * from "${rel(names.paths.channels)}";
4896
4955
  export * from "${rel(names.paths.events)}";
4897
4956
  export * from "${rel(names.paths.users)}";
4957
+ export * from "${rel(names.paths.config)}";
4898
4958
 
4899
4959
  export type Integration_All_${getPascalAlias(integration)} = {
4900
4960
  actions: Integration_Actions_${getPascalAlias(integration)};
4901
4961
  channels: Integration_Channels_${getPascalAlias(integration)};
4902
4962
  events: Integration_Events_${getPascalAlias(integration)};
4903
4963
  users: Integration_Users_${getPascalAlias(integration)};
4964
+ config: Integration_Config_${getPascalAlias(integration)};
4904
4965
  };
4905
4966
  `;
4906
4967
  let tActions = `
@@ -5039,6 +5100,34 @@ Description: ${tag?.description}`);
5039
5100
  tags: ${userTagsUnion};
5040
5101
  };
5041
5102
  `;
5103
+ let tConfig = `
5104
+ ////////////////////////////////////////////////////////
5105
+ // DO NOT EDIT THIS FILE DIRECTLY
5106
+ // This file is auto-generated from the Botpress ADK
5107
+ // ADK Version: ${ADK_VERSION}
5108
+ // Integration: ${integration.definition?.name}
5109
+ // Version: ${integration.definition?.version}
5110
+ // File: ${names.paths.config}
5111
+ // Hash: ${hash}
5112
+ // Updated at: ${integration.definition?.updatedAt}
5113
+ ////////////////////////////////////////////////////////
5114
+
5115
+ export type Integration_Config_${getPascalAlias(integration)} = `;
5116
+ const configurationType = integration.configurationType || "default";
5117
+ let configType = "{}";
5118
+ if (integration.definition?.configurations && integration.definition.configurations[configurationType]) {
5119
+ const configSchema = integration.definition.configurations[configurationType].schema;
5120
+ if (configSchema) {
5121
+ configType = transforms.fromJSONSchema(configSchema).toTypescriptType();
5122
+ }
5123
+ } else if (integration.definition?.configuration) {
5124
+ const configSchema = integration.definition.configuration.schema;
5125
+ if (configSchema) {
5126
+ configType = transforms.fromJSONSchema(configSchema).toTypescriptType();
5127
+ }
5128
+ }
5129
+ tConfig += `${configType};
5130
+ `;
5042
5131
  return {
5043
5132
  names,
5044
5133
  files: {
@@ -5046,14 +5135,15 @@ Description: ${tag?.description}`);
5046
5135
  [names.paths.actions]: await formatCode(tActions),
5047
5136
  [names.paths.channels]: await formatCode(tChannels),
5048
5137
  [names.paths.events]: await formatCode(tEvents),
5049
- [names.paths.users]: await formatCode(tUsers)
5138
+ [names.paths.users]: await formatCode(tUsers),
5139
+ [names.paths.config]: await formatCode(tConfig)
5050
5140
  }
5051
5141
  };
5052
5142
  }
5053
5143
  // src/bot-generator/generator.ts
5054
5144
  import dedent from "dedent";
5055
5145
  import { existsSync as existsSync5 } from "fs";
5056
- import fs15 from "fs/promises";
5146
+ import fs14 from "fs/promises";
5057
5147
  import path29 from "path";
5058
5148
 
5059
5149
  // src/generators/interface-types.ts
@@ -5552,7 +5642,7 @@ init_fs();
5552
5642
 
5553
5643
  // src/bot-generator/dev-id-manager.ts
5554
5644
  import path24 from "path";
5555
- import fs12 from "fs/promises";
5645
+ import fs11 from "fs/promises";
5556
5646
  import { existsSync as existsSync2 } from "fs";
5557
5647
  import { Client as Client9 } from "@botpress/client";
5558
5648
  class DevIdManager {
@@ -5590,7 +5680,7 @@ class DevIdManager {
5590
5680
  async readProjectCache() {
5591
5681
  try {
5592
5682
  if (existsSync2(this.projectCachePath)) {
5593
- const content = await fs12.readFile(this.projectCachePath, "utf-8");
5683
+ const content = await fs11.readFile(this.projectCachePath, "utf-8");
5594
5684
  return JSON.parse(content);
5595
5685
  }
5596
5686
  } catch (error) {
@@ -5600,8 +5690,8 @@ class DevIdManager {
5600
5690
  }
5601
5691
  async saveProjectCache(cache2) {
5602
5692
  try {
5603
- await fs12.mkdir(path24.dirname(this.projectCachePath), { recursive: true });
5604
- await fs12.writeFile(this.projectCachePath, JSON.stringify(cache2, null, 2));
5693
+ await fs11.mkdir(path24.dirname(this.projectCachePath), { recursive: true });
5694
+ await fs11.writeFile(this.projectCachePath, JSON.stringify(cache2, null, 2));
5605
5695
  } catch (error) {
5606
5696
  console.error("Error saving project.cache.json:", error);
5607
5697
  }
@@ -5655,7 +5745,7 @@ class DevIdManager {
5655
5745
 
5656
5746
  // src/bot-generator/integration-sync.ts
5657
5747
  import path25 from "path";
5658
- import fs13 from "fs/promises";
5748
+ import fs12 from "fs/promises";
5659
5749
  import { existsSync as existsSync3 } from "fs";
5660
5750
  class IntegrationSync {
5661
5751
  projectPath;
@@ -5704,7 +5794,7 @@ class IntegrationSync {
5704
5794
  if (!existsSync3(indexPath)) {
5705
5795
  return false;
5706
5796
  }
5707
- const indexContent = await fs13.readFile(indexPath, "utf-8");
5797
+ const indexContent = await fs12.readFile(indexPath, "utf-8");
5708
5798
  const versionMatch = indexContent.match(/version:\s*["']([^"']+)["']/);
5709
5799
  if (!versionMatch) {
5710
5800
  return false;
@@ -5739,14 +5829,14 @@ class IntegrationSync {
5739
5829
  throw new Error(`Integration folder not found: ${sourceFolder}`);
5740
5830
  }
5741
5831
  if (existsSync3(targetFolder)) {
5742
- await fs13.rm(targetFolder, { recursive: true, force: true });
5832
+ await fs12.rm(targetFolder, { recursive: true, force: true });
5743
5833
  }
5744
- await fs13.rename(sourceFolder, targetFolder);
5834
+ await fs12.rename(sourceFolder, targetFolder);
5745
5835
  }
5746
5836
  async removeIntegrationFolder(alias) {
5747
5837
  const targetFolder = path25.join(this.bpModulesPath, `integration_${alias}`);
5748
5838
  if (existsSync3(targetFolder)) {
5749
- await fs13.rm(targetFolder, { recursive: true, force: true });
5839
+ await fs12.rm(targetFolder, { recursive: true, force: true });
5750
5840
  }
5751
5841
  }
5752
5842
  async syncIntegrations() {
@@ -5756,7 +5846,7 @@ class IntegrationSync {
5756
5846
  if (integrations.length === 0) {
5757
5847
  return { synced, errors };
5758
5848
  }
5759
- await fs13.mkdir(this.bpModulesPath, { recursive: true });
5849
+ await fs12.mkdir(this.bpModulesPath, { recursive: true });
5760
5850
  for (const integration of integrations) {
5761
5851
  try {
5762
5852
  const isAlreadySynced = await this.isIntegrationSynced(integration);
@@ -5779,7 +5869,7 @@ class IntegrationSync {
5779
5869
 
5780
5870
  // src/bot-generator/interface-sync.ts
5781
5871
  import path26 from "path";
5782
- import fs14 from "fs/promises";
5872
+ import fs13 from "fs/promises";
5783
5873
  import { existsSync as existsSync4 } from "fs";
5784
5874
  import { spawn } from "child_process";
5785
5875
  class InterfaceSync {
@@ -5816,7 +5906,7 @@ class InterfaceSync {
5816
5906
  if (!existsSync4(indexPath)) {
5817
5907
  return false;
5818
5908
  }
5819
- const indexContent = await fs14.readFile(indexPath, "utf-8");
5909
+ const indexContent = await fs13.readFile(indexPath, "utf-8");
5820
5910
  const versionMatch = indexContent.match(/version:\s*["']([^"']+)["']/);
5821
5911
  if (!versionMatch) {
5822
5912
  return false;
@@ -5884,14 +5974,14 @@ class InterfaceSync {
5884
5974
  throw new Error(`Interface folder not found: ${sourceFolder}`);
5885
5975
  }
5886
5976
  if (existsSync4(targetFolder)) {
5887
- await fs14.rm(targetFolder, { recursive: true, force: true });
5977
+ await fs13.rm(targetFolder, { recursive: true, force: true });
5888
5978
  }
5889
- await fs14.rename(sourceFolder, targetFolder);
5979
+ await fs13.rename(sourceFolder, targetFolder);
5890
5980
  }
5891
5981
  async removeInterfaceFolder(alias) {
5892
5982
  const targetFolder = path26.join(this.bpModulesPath, `interface_${pascalCase(alias)}`);
5893
5983
  if (existsSync4(targetFolder)) {
5894
- await fs14.rm(targetFolder, { recursive: true, force: true });
5984
+ await fs13.rm(targetFolder, { recursive: true, force: true });
5895
5985
  }
5896
5986
  }
5897
5987
  async syncInterfaces() {
@@ -5901,7 +5991,7 @@ class InterfaceSync {
5901
5991
  if (interfaces.length === 0) {
5902
5992
  return { synced, errors };
5903
5993
  }
5904
- await fs14.mkdir(this.bpModulesPath, { recursive: true });
5994
+ await fs13.mkdir(this.bpModulesPath, { recursive: true });
5905
5995
  for (const interfaceInfo of interfaces) {
5906
5996
  try {
5907
5997
  const isAlreadySynced = await this.isInterfaceSynced(interfaceInfo);
@@ -5949,7 +6039,7 @@ class BotGenerator {
5949
6039
  return [];
5950
6040
  const result = [];
5951
6041
  const walk = async (dir, relativeBase) => {
5952
- const entries = await fs15.readdir(dir, { withFileTypes: true });
6042
+ const entries = await fs14.readdir(dir, { withFileTypes: true });
5953
6043
  for (const entry of entries) {
5954
6044
  const abs = path29.join(dir, entry.name);
5955
6045
  const rel = path29.join(relativeBase, entry.name);
@@ -5970,17 +6060,17 @@ class BotGenerator {
5970
6060
  if (!existsSync5(rootDir))
5971
6061
  return;
5972
6062
  const removeIfEmpty = async (dir) => {
5973
- const entries = await fs15.readdir(dir, { withFileTypes: true });
6063
+ const entries = await fs14.readdir(dir, { withFileTypes: true });
5974
6064
  for (const entry of entries) {
5975
6065
  if (entry.isDirectory()) {
5976
6066
  const subdir = path29.join(dir, entry.name);
5977
6067
  await removeIfEmpty(subdir);
5978
6068
  }
5979
6069
  }
5980
- const after = await fs15.readdir(dir);
6070
+ const after = await fs14.readdir(dir);
5981
6071
  if (after.length === 0 && dir !== rootDir) {
5982
6072
  try {
5983
- await fs15.rmdir(dir, { recursive: false });
6073
+ await fs14.rmdir(dir, { recursive: false });
5984
6074
  } catch {}
5985
6075
  }
5986
6076
  };
@@ -5988,7 +6078,7 @@ class BotGenerator {
5988
6078
  }
5989
6079
  async generate() {
5990
6080
  const project = await AgentProject.load(this.projectPath);
5991
- await fs15.mkdir(this.outputPath, { recursive: true });
6081
+ await fs14.mkdir(this.outputPath, { recursive: true });
5992
6082
  await this.generateBotDefinition();
5993
6083
  await this.generateIntegrationsDefinition();
5994
6084
  await this.generateInterfacesDefinition();
@@ -6027,7 +6117,7 @@ class BotGenerator {
6027
6117
  for (const [filePath, content] of Object.entries(types6.files)) {
6028
6118
  const fullPath = path29.join(this.projectPath, ".adk", "integrations", filePath);
6029
6119
  const dir = path29.dirname(fullPath);
6030
- await fs15.mkdir(dir, { recursive: true });
6120
+ await fs14.mkdir(dir, { recursive: true });
6031
6121
  await createFile(fullPath, content);
6032
6122
  files.add(filePath);
6033
6123
  }
@@ -6037,7 +6127,8 @@ class BotGenerator {
6037
6127
  ////////////////////////////////////////////////////////
6038
6128
  // DO NOT EDIT THIS FILE DIRECTLY
6039
6129
  // This file is auto-generated from the Botpress ADK
6040
- // File: integrations.ts
6130
+ // ADK Version: ${ADK_VERSION}
6131
+ // Generated at: ${new Date().toISOString()}
6041
6132
  ////////////////////////////////////////////////////////
6042
6133
 
6043
6134
  declare module "@botpress/runtime/_types/integrations" {
@@ -6046,13 +6137,13 @@ class BotGenerator {
6046
6137
  };
6047
6138
  }
6048
6139
  `;
6049
- await createFile(path29.join(this.projectPath, ".adk", "integrations.d.ts"), await formatCode(types5));
6140
+ await createFile(path29.join(this.projectPath, ".adk", "integrations-types.d.ts"), await formatCode(types5));
6050
6141
  const staleIntegrationFiles = existingIntegrationFiles.filter((f) => !files.has(f));
6051
6142
  if (staleIntegrationFiles.length > 0) {
6052
6143
  for (const rel of staleIntegrationFiles) {
6053
6144
  const abs = path29.join(integrationsDir, rel);
6054
6145
  try {
6055
- await fs15.rm(abs, { force: true });
6146
+ await fs14.rm(abs, { force: true });
6056
6147
  } catch {}
6057
6148
  }
6058
6149
  }
@@ -6169,7 +6260,7 @@ declare module "@botpress/runtime/_types/state" {
6169
6260
  for (const [filePath, content] of Object.entries(types6.files)) {
6170
6261
  const fullPath = path29.join(this.projectPath, ".adk", "interfaces", filePath);
6171
6262
  const dir = path29.dirname(fullPath);
6172
- await fs15.mkdir(dir, { recursive: true });
6263
+ await fs14.mkdir(dir, { recursive: true });
6173
6264
  await createFile(fullPath, content);
6174
6265
  files.add(filePath);
6175
6266
  }
@@ -6212,7 +6303,7 @@ declare module "@botpress/runtime/_types/state" {
6212
6303
  for (const rel of staleInterfaceFiles) {
6213
6304
  const abs = path29.join(interfacesDir, rel);
6214
6305
  try {
6215
- await fs15.rm(abs, { force: true });
6306
+ await fs14.rm(abs, { force: true });
6216
6307
  } catch {}
6217
6308
  }
6218
6309
  }
@@ -6584,7 +6675,7 @@ declare module "@botpress/runtime/_types/state" {
6584
6675
  noPropertyAccessFromIndexSignature: false,
6585
6676
  noUnusedLocals: false
6586
6677
  },
6587
- include: [".botpress/**/*", "src/**/*", "bp_modules/**/*", "./*.ts", "./*.json"]
6678
+ include: [".botpress/**/*", "src/**/*", "bp_modules/**/*", "./*.ts", "./*.json", "../*.d.ts"]
6588
6679
  };
6589
6680
  await createFile(path29.join(this.outputPath, "tsconfig.json"), JSON.stringify(tsConfig, null, 2));
6590
6681
  }
@@ -6615,20 +6706,20 @@ declare module "@botpress/runtime/_types/state" {
6615
6706
  const assetsPath = path29.join(this.projectPath, "assets");
6616
6707
  const targetPath = path29.join(this.outputPath, "assets");
6617
6708
  if (existsSync5(assetsPath)) {
6618
- await fs15.mkdir(targetPath, { recursive: true });
6709
+ await fs14.mkdir(targetPath, { recursive: true });
6619
6710
  await this.copyDirectory(assetsPath, targetPath);
6620
6711
  }
6621
6712
  }
6622
6713
  async copyDirectory(src, dest) {
6623
- const entries = await fs15.readdir(src, { withFileTypes: true });
6714
+ const entries = await fs14.readdir(src, { withFileTypes: true });
6624
6715
  for (const entry of entries) {
6625
6716
  const srcPath = path29.join(src, entry.name);
6626
6717
  const destPath = path29.join(dest, entry.name);
6627
6718
  if (entry.isDirectory()) {
6628
- await fs15.mkdir(destPath, { recursive: true });
6719
+ await fs14.mkdir(destPath, { recursive: true });
6629
6720
  await this.copyDirectory(srcPath, destPath);
6630
6721
  } else {
6631
- await fs15.copyFile(srcPath, destPath);
6722
+ await fs14.copyFile(srcPath, destPath);
6632
6723
  }
6633
6724
  }
6634
6725
  }
@@ -6950,7 +7041,7 @@ declare module "@botpress/runtime/_types/state" {
6950
7041
  async copyAssetsRuntime() {
6951
7042
  const assetsRuntimePath = path29.join(this.projectPath, ".adk", "assets-runtime.ts");
6952
7043
  if (existsSync5(assetsRuntimePath)) {
6953
- const content = await fs15.readFile(assetsRuntimePath, "utf-8");
7044
+ const content = await fs14.readFile(assetsRuntimePath, "utf-8");
6954
7045
  await createFile(path29.join(this.outputPath, "src", "assets-runtime.ts"), await formatCode(content));
6955
7046
  }
6956
7047
  }
@@ -7198,7 +7289,7 @@ class FileWatcher2 extends EventEmitter3 {
7198
7289
  this.debounceMs = options.debounceMs ?? 100;
7199
7290
  }
7200
7291
  start() {
7201
- const rootFiles = ["dependencies.json", "package.json", "agent.json", "agent.config.ts"];
7292
+ const rootFiles = ["package.json", "agent.json", "agent.config.ts"];
7202
7293
  for (const file of rootFiles) {
7203
7294
  const filePath = join7(this.projectPath, file);
7204
7295
  if (existsSync6(filePath)) {
@@ -7363,5 +7454,5 @@ export {
7363
7454
  AgentProject
7364
7455
  };
7365
7456
 
7366
- //# debugId=D326A7034ACA98B664756E2164756E21
7457
+ //# debugId=AB6CC084B3E80E8D64756E2164756E21
7367
7458
  //# sourceMappingURL=index.js.map