@botpress/adk 1.12.2 → 1.12.3

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
@@ -654,7 +654,7 @@ var PRETTIER_CONFIG, formatCode = async (code, filepath) => {
654
654
  `));
655
655
  return code;
656
656
  }
657
- }, ADK_VERSION = "1.12.2", relative2 = (from, to) => {
657
+ }, ADK_VERSION = "1.12.3", relative2 = (from, to) => {
658
658
  const fromDir = path10.dirname(from);
659
659
  const relative3 = path10.relative(fromDir, to);
660
660
  return relative3.startsWith(".") ? relative3 : `./${relative3}`;
@@ -678,7 +678,7 @@ var exports_action_types = {};
678
678
  __export(exports_action_types, {
679
679
  generateActionTypes: () => generateActionTypes
680
680
  });
681
- import path30 from "path";
681
+ import path31 from "path";
682
682
  async function generateActionTypes(project) {
683
683
  const actionDefs = [];
684
684
  for (const action of project.actions) {
@@ -693,7 +693,7 @@ async function generateActionTypes(project) {
693
693
  };`);
694
694
  continue;
695
695
  }
696
- const absolutePath = path30.join(project.path, action.path);
696
+ const absolutePath = path31.join(project.path, action.path);
697
697
  const actionModule = await import(`${absolutePath}?t=${Date.now()}`);
698
698
  const actionInstance = actionModule[action.export] || actionModule.default;
699
699
  if (actionInstance && actionInstance.input && actionInstance.output) {
@@ -738,7 +738,7 @@ ${actionDefs.join(`
738
738
  };
739
739
  }
740
740
  `;
741
- const actionTypesPath = path30.join(project.path, ".adk", "action-types.d.ts");
741
+ const actionTypesPath = path31.join(project.path, ".adk", "action-types.d.ts");
742
742
  await createFile(actionTypesPath, await formatCode(content));
743
743
  }
744
744
  var init_action_types = __esm(() => {
@@ -751,7 +751,7 @@ var exports_integration_action_types = {};
751
751
  __export(exports_integration_action_types, {
752
752
  generateIntegrationActionTypes: () => generateIntegrationActionTypes
753
753
  });
754
- import path31 from "path";
754
+ import path32 from "path";
755
755
  async function generateIntegrationActionTypes(project) {
756
756
  const content = `
757
757
  ////////////////////////////////////////////////////////
@@ -785,7 +785,7 @@ type IntegrationsMap<T> = {
785
785
  export type IntegrationActions = IntegrationsMap<Integrations>;
786
786
  }
787
787
  `;
788
- const integrationActionTypesPath = path31.join(project.path, ".adk", "integration-action-types.d.ts");
788
+ const integrationActionTypesPath = path32.join(project.path, ".adk", "integration-action-types.d.ts");
789
789
  await createFile(integrationActionTypesPath, await formatCode(content));
790
790
  }
791
791
  var init_integration_action_types = __esm(() => {
@@ -797,7 +797,7 @@ var init_integration_action_types = __esm(() => {
797
797
  var require_package = __commonJS((exports, module) => {
798
798
  module.exports = {
799
799
  name: "@botpress/adk",
800
- version: "1.12.2",
800
+ version: "1.12.3",
801
801
  description: "Core ADK library for building AI agents on Botpress",
802
802
  type: "module",
803
803
  main: "dist/index.js",
@@ -844,7 +844,7 @@ var require_package = __commonJS((exports, module) => {
844
844
  "@botpress/cli": "^4.27.3",
845
845
  "@botpress/client": "^1.28.0",
846
846
  "@botpress/cognitive": "^0.2.0",
847
- "@botpress/runtime": "^1.12.2",
847
+ "@botpress/runtime": "^1.12.3",
848
848
  "@botpress/sdk": "^4.18.1",
849
849
  "@bpinternal/jex": "^1.2.4",
850
850
  "@bpinternal/yargs-extra": "^0.0.21",
@@ -6163,7 +6163,7 @@ class AgentProjectGenerator {
6163
6163
  deploy: "adk deploy"
6164
6164
  },
6165
6165
  dependencies: {
6166
- "@botpress/runtime": `^${"1.12.2"}`
6166
+ "@botpress/runtime": `^${"1.12.3"}`
6167
6167
  },
6168
6168
  devDependencies: {
6169
6169
  typescript: "^5.9.3"
@@ -6775,9 +6775,9 @@ Description: ${tag?.description}`);
6775
6775
  }
6776
6776
  // src/bot-generator/generator.ts
6777
6777
  import dedent from "dedent";
6778
- import { existsSync as existsSync6 } from "fs";
6779
- import fs15 from "fs/promises";
6780
- import path32 from "path";
6778
+ import { existsSync as existsSync7 } from "fs";
6779
+ import fs16 from "fs/promises";
6780
+ import path33 from "path";
6781
6781
 
6782
6782
  // src/generators/interface-types.ts
6783
6783
  import { transforms as transforms2 } from "@botpress/sdk";
@@ -7516,10 +7516,51 @@ ${integrationEvents.join(`
7516
7516
  // src/bot-generator/generator.ts
7517
7517
  init_fs();
7518
7518
 
7519
- // src/bot-generator/dev-id-manager.ts
7520
- import path27 from "path";
7519
+ // src/utils/link-sdk.ts
7520
+ import { existsSync as existsSync3, realpathSync } from "fs";
7521
7521
  import fs12 from "fs/promises";
7522
- import { existsSync as existsSync3 } from "fs";
7522
+ import path27 from "path";
7523
+ function findPackage(name, startDir) {
7524
+ let current;
7525
+ try {
7526
+ current = realpathSync(startDir);
7527
+ } catch {
7528
+ current = startDir;
7529
+ }
7530
+ while (current !== path27.dirname(current)) {
7531
+ const pkgPath = path27.join(current, "node_modules", name);
7532
+ if (existsSync3(pkgPath)) {
7533
+ return pkgPath;
7534
+ }
7535
+ current = path27.dirname(current);
7536
+ }
7537
+ return null;
7538
+ }
7539
+ async function linkSdk(agentDir, botDir) {
7540
+ const targetSdkPath = path27.join(botDir, "node_modules", "@botpress", "sdk");
7541
+ if (existsSync3(targetSdkPath)) {
7542
+ return;
7543
+ }
7544
+ const runtimePath = findPackage("@botpress/runtime", agentDir);
7545
+ if (!runtimePath) {
7546
+ console.warn("Warning: Could not find @botpress/runtime in agent directory");
7547
+ return;
7548
+ }
7549
+ let sdkPath = findPackage("@botpress/sdk", runtimePath);
7550
+ if (!sdkPath) {
7551
+ console.warn(`Warning: Could not find @botpress/sdk from @botpress/runtime location (${runtimePath})`);
7552
+ return;
7553
+ }
7554
+ const targetBotpressDir = path27.join(botDir, "node_modules", "@botpress");
7555
+ await fs12.mkdir(targetBotpressDir, { recursive: true });
7556
+ const symlinkType = process.platform === "win32" ? "junction" : undefined;
7557
+ await fs12.symlink(sdkPath, targetSdkPath, symlinkType);
7558
+ }
7559
+
7560
+ // src/bot-generator/dev-id-manager.ts
7561
+ import path28 from "path";
7562
+ import fs13 from "fs/promises";
7563
+ import { existsSync as existsSync4 } from "fs";
7523
7564
  import { Client as Client12 } from "@botpress/client";
7524
7565
  class DevIdManager {
7525
7566
  projectPath;
@@ -7529,7 +7570,7 @@ class DevIdManager {
7529
7570
  constructor(projectPath, botProjectPath) {
7530
7571
  this.projectPath = projectPath;
7531
7572
  this.botProjectPath = botProjectPath;
7532
- this.projectCachePath = path27.join(botProjectPath, ".botpress", "project.cache.json");
7573
+ this.projectCachePath = path28.join(botProjectPath, ".botpress", "project.cache.json");
7533
7574
  }
7534
7575
  async getClient() {
7535
7576
  if (!this.client) {
@@ -7555,8 +7596,8 @@ class DevIdManager {
7555
7596
  }
7556
7597
  async readProjectCache() {
7557
7598
  try {
7558
- if (existsSync3(this.projectCachePath)) {
7559
- const content = await fs12.readFile(this.projectCachePath, "utf-8");
7599
+ if (existsSync4(this.projectCachePath)) {
7600
+ const content = await fs13.readFile(this.projectCachePath, "utf-8");
7560
7601
  return JSON.parse(content);
7561
7602
  }
7562
7603
  } catch (error) {
@@ -7566,8 +7607,8 @@ class DevIdManager {
7566
7607
  }
7567
7608
  async saveProjectCache(cache2) {
7568
7609
  try {
7569
- await fs12.mkdir(path27.dirname(this.projectCachePath), { recursive: true });
7570
- await fs12.writeFile(this.projectCachePath, JSON.stringify(cache2, null, 2));
7610
+ await fs13.mkdir(path28.dirname(this.projectCachePath), { recursive: true });
7611
+ await fs13.writeFile(this.projectCachePath, JSON.stringify(cache2, null, 2));
7571
7612
  } catch (error) {
7572
7613
  console.error("Error saving project.cache.json:", error);
7573
7614
  }
@@ -7615,9 +7656,9 @@ class DevIdManager {
7615
7656
  }
7616
7657
 
7617
7658
  // src/bot-generator/integration-sync.ts
7618
- import path28 from "path";
7619
- import fs13 from "fs/promises";
7620
- import { existsSync as existsSync4 } from "fs";
7659
+ import path29 from "path";
7660
+ import fs14 from "fs/promises";
7661
+ import { existsSync as existsSync5 } from "fs";
7621
7662
  class IntegrationSync {
7622
7663
  projectPath;
7623
7664
  botProjectPath;
@@ -7625,7 +7666,7 @@ class IntegrationSync {
7625
7666
  constructor(projectPath, botProjectPath) {
7626
7667
  this.projectPath = projectPath;
7627
7668
  this.botProjectPath = botProjectPath;
7628
- this.bpModulesPath = path28.join(botProjectPath, "bp_modules");
7669
+ this.bpModulesPath = path29.join(botProjectPath, "bp_modules");
7629
7670
  }
7630
7671
  async parseIntegrations() {
7631
7672
  const project = await AgentProject.load(this.projectPath);
@@ -7656,16 +7697,16 @@ class IntegrationSync {
7656
7697
  return integrations;
7657
7698
  }
7658
7699
  async isIntegrationSynced(integration) {
7659
- const targetFolder = path28.join(this.bpModulesPath, `integration_${integration.alias}`);
7660
- if (!existsSync4(targetFolder)) {
7700
+ const targetFolder = path29.join(this.bpModulesPath, `integration_${integration.alias}`);
7701
+ if (!existsSync5(targetFolder)) {
7661
7702
  return false;
7662
7703
  }
7663
7704
  try {
7664
- const indexPath = path28.join(targetFolder, "index.ts");
7665
- if (!existsSync4(indexPath)) {
7705
+ const indexPath = path29.join(targetFolder, "index.ts");
7706
+ if (!existsSync5(indexPath)) {
7666
7707
  return false;
7667
7708
  }
7668
- const indexContent = await fs13.readFile(indexPath, "utf-8");
7709
+ const indexContent = await fs14.readFile(indexPath, "utf-8");
7669
7710
  const versionMatch = indexContent.match(/version:\s*["']([^"']+)["']/);
7670
7711
  if (!versionMatch) {
7671
7712
  return false;
@@ -7693,20 +7734,20 @@ class IntegrationSync {
7693
7734
  await command.output();
7694
7735
  }
7695
7736
  async renameIntegrationFolder(integration) {
7696
- const sourceFolder = path28.join(this.bpModulesPath, integration.name.replace("/", "-"));
7697
- const targetFolder = path28.join(this.bpModulesPath, `integration_${integration.alias}`);
7698
- if (!existsSync4(sourceFolder)) {
7737
+ const sourceFolder = path29.join(this.bpModulesPath, integration.name.replace("/", "-"));
7738
+ const targetFolder = path29.join(this.bpModulesPath, `integration_${integration.alias}`);
7739
+ if (!existsSync5(sourceFolder)) {
7699
7740
  throw new Error(`Integration folder not found: ${sourceFolder}`);
7700
7741
  }
7701
- if (existsSync4(targetFolder)) {
7702
- await fs13.rm(targetFolder, { recursive: true, force: true });
7742
+ if (existsSync5(targetFolder)) {
7743
+ await fs14.rm(targetFolder, { recursive: true, force: true });
7703
7744
  }
7704
- await fs13.rename(sourceFolder, targetFolder);
7745
+ await fs14.rename(sourceFolder, targetFolder);
7705
7746
  }
7706
7747
  async removeIntegrationFolder(alias) {
7707
- const targetFolder = path28.join(this.bpModulesPath, `integration_${alias}`);
7708
- if (existsSync4(targetFolder)) {
7709
- await fs13.rm(targetFolder, { recursive: true, force: true });
7748
+ const targetFolder = path29.join(this.bpModulesPath, `integration_${alias}`);
7749
+ if (existsSync5(targetFolder)) {
7750
+ await fs14.rm(targetFolder, { recursive: true, force: true });
7710
7751
  }
7711
7752
  }
7712
7753
  async syncIntegrations() {
@@ -7716,7 +7757,7 @@ class IntegrationSync {
7716
7757
  if (integrations.length === 0) {
7717
7758
  return { synced, errors };
7718
7759
  }
7719
- await fs13.mkdir(this.bpModulesPath, { recursive: true });
7760
+ await fs14.mkdir(this.bpModulesPath, { recursive: true });
7720
7761
  for (const integration of integrations) {
7721
7762
  try {
7722
7763
  const isAlreadySynced = await this.isIntegrationSynced(integration);
@@ -7738,9 +7779,9 @@ class IntegrationSync {
7738
7779
  }
7739
7780
 
7740
7781
  // src/bot-generator/interface-sync.ts
7741
- import path29 from "path";
7742
- import fs14 from "fs/promises";
7743
- import { existsSync as existsSync5 } from "fs";
7782
+ import path30 from "path";
7783
+ import fs15 from "fs/promises";
7784
+ import { existsSync as existsSync6 } from "fs";
7744
7785
  init_constants();
7745
7786
  class InterfaceSync {
7746
7787
  projectPath;
@@ -7749,7 +7790,7 @@ class InterfaceSync {
7749
7790
  constructor(projectPath, botProjectPath) {
7750
7791
  this.projectPath = projectPath;
7751
7792
  this.botProjectPath = botProjectPath;
7752
- this.bpModulesPath = path29.join(botProjectPath, "bp_modules");
7793
+ this.bpModulesPath = path30.join(botProjectPath, "bp_modules");
7753
7794
  }
7754
7795
  async parseInterfaces() {
7755
7796
  const interfaces = [];
@@ -7767,16 +7808,16 @@ class InterfaceSync {
7767
7808
  return interfaces;
7768
7809
  }
7769
7810
  async isInterfaceSynced(interfaceInfo) {
7770
- const targetFolder = path29.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
7771
- if (!existsSync5(targetFolder)) {
7811
+ const targetFolder = path30.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
7812
+ if (!existsSync6(targetFolder)) {
7772
7813
  return false;
7773
7814
  }
7774
7815
  try {
7775
- const indexPath = path29.join(targetFolder, "index.ts");
7776
- if (!existsSync5(indexPath)) {
7816
+ const indexPath = path30.join(targetFolder, "index.ts");
7817
+ if (!existsSync6(indexPath)) {
7777
7818
  return false;
7778
7819
  }
7779
- const indexContent = await fs14.readFile(indexPath, "utf-8");
7820
+ const indexContent = await fs15.readFile(indexPath, "utf-8");
7780
7821
  const versionMatch = indexContent.match(/version:\s*["']([^"']+)["']/);
7781
7822
  if (!versionMatch) {
7782
7823
  return false;
@@ -7818,20 +7859,20 @@ class InterfaceSync {
7818
7859
  });
7819
7860
  }
7820
7861
  async renameInterfaceFolder(interfaceInfo) {
7821
- const sourceFolder = path29.join(this.bpModulesPath, interfaceInfo.name);
7822
- const targetFolder = path29.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
7823
- if (!existsSync5(sourceFolder)) {
7862
+ const sourceFolder = path30.join(this.bpModulesPath, interfaceInfo.name);
7863
+ const targetFolder = path30.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
7864
+ if (!existsSync6(sourceFolder)) {
7824
7865
  throw new Error(`Interface folder not found: ${sourceFolder}`);
7825
7866
  }
7826
- if (existsSync5(targetFolder)) {
7827
- await fs14.rm(targetFolder, { recursive: true, force: true });
7867
+ if (existsSync6(targetFolder)) {
7868
+ await fs15.rm(targetFolder, { recursive: true, force: true });
7828
7869
  }
7829
- await fs14.rename(sourceFolder, targetFolder);
7870
+ await fs15.rename(sourceFolder, targetFolder);
7830
7871
  }
7831
7872
  async removeInterfaceFolder(alias) {
7832
- const targetFolder = path29.join(this.bpModulesPath, `interface_${pascalCase(alias)}`);
7833
- if (existsSync5(targetFolder)) {
7834
- await fs14.rm(targetFolder, { recursive: true, force: true });
7873
+ const targetFolder = path30.join(this.bpModulesPath, `interface_${pascalCase(alias)}`);
7874
+ if (existsSync6(targetFolder)) {
7875
+ await fs15.rm(targetFolder, { recursive: true, force: true });
7835
7876
  }
7836
7877
  }
7837
7878
  async syncInterfaces() {
@@ -7841,7 +7882,7 @@ class InterfaceSync {
7841
7882
  if (interfaces.length === 0) {
7842
7883
  return { synced, errors };
7843
7884
  }
7844
- await fs14.mkdir(this.bpModulesPath, { recursive: true });
7885
+ await fs15.mkdir(this.bpModulesPath, { recursive: true });
7845
7886
  for (const interfaceInfo of interfaces) {
7846
7887
  try {
7847
7888
  const isAlreadySynced = await this.isInterfaceSynced(interfaceInfo);
@@ -7874,26 +7915,26 @@ function isBuiltinAction(name) {
7874
7915
  return !!Object.values(BuiltInActions2).find((x) => x.name === name);
7875
7916
  }
7876
7917
  function getImportPath(from, to) {
7877
- return path32.relative(path32.dirname(from), to).replace(/\.ts$/, "").replace(/\\/g, "/");
7918
+ return path33.relative(path33.dirname(from), to).replace(/\.ts$/, "").replace(/\\/g, "/");
7878
7919
  }
7879
7920
 
7880
7921
  class BotGenerator {
7881
7922
  projectPath;
7882
7923
  outputPath;
7883
7924
  constructor(options) {
7884
- this.projectPath = path32.resolve(options.projectPath);
7885
- this.outputPath = path32.resolve(options.outputPath || path32.join(this.projectPath, ".adk"));
7925
+ this.projectPath = path33.resolve(options.projectPath);
7926
+ this.outputPath = path33.resolve(options.outputPath || path33.join(this.projectPath, ".adk"));
7886
7927
  }
7887
7928
  async listFilesRecursive(rootDir) {
7888
7929
  try {
7889
- if (!existsSync6(rootDir))
7930
+ if (!existsSync7(rootDir))
7890
7931
  return [];
7891
7932
  const result = [];
7892
7933
  const walk = async (dir, relativeBase) => {
7893
- const entries = await fs15.readdir(dir, { withFileTypes: true });
7934
+ const entries = await fs16.readdir(dir, { withFileTypes: true });
7894
7935
  for (const entry of entries) {
7895
- const abs = path32.join(dir, entry.name);
7896
- const rel = path32.join(relativeBase, entry.name);
7936
+ const abs = path33.join(dir, entry.name);
7937
+ const rel = path33.join(relativeBase, entry.name);
7897
7938
  if (entry.isDirectory()) {
7898
7939
  await walk(abs, rel);
7899
7940
  } else {
@@ -7908,20 +7949,20 @@ class BotGenerator {
7908
7949
  }
7909
7950
  }
7910
7951
  async removeEmptyDirectories(rootDir) {
7911
- if (!existsSync6(rootDir))
7952
+ if (!existsSync7(rootDir))
7912
7953
  return;
7913
7954
  const removeIfEmpty = async (dir) => {
7914
- const entries = await fs15.readdir(dir, { withFileTypes: true });
7955
+ const entries = await fs16.readdir(dir, { withFileTypes: true });
7915
7956
  for (const entry of entries) {
7916
7957
  if (entry.isDirectory()) {
7917
- const subdir = path32.join(dir, entry.name);
7958
+ const subdir = path33.join(dir, entry.name);
7918
7959
  await removeIfEmpty(subdir);
7919
7960
  }
7920
7961
  }
7921
- const after = await fs15.readdir(dir);
7962
+ const after = await fs16.readdir(dir);
7922
7963
  if (after.length === 0 && dir !== rootDir) {
7923
7964
  try {
7924
- await fs15.rmdir(dir, { recursive: false });
7965
+ await fs16.rmdir(dir, { recursive: false });
7925
7966
  } catch {}
7926
7967
  }
7927
7968
  };
@@ -7929,7 +7970,7 @@ class BotGenerator {
7929
7970
  }
7930
7971
  async generate() {
7931
7972
  const project = await AgentProject.load(this.projectPath);
7932
- await fs15.mkdir(this.outputPath, { recursive: true });
7973
+ await fs16.mkdir(this.outputPath, { recursive: true });
7933
7974
  await this.generateBotDefinition();
7934
7975
  await this.generateIntegrationsDefinition();
7935
7976
  await this.generateInterfacesDefinition();
@@ -7958,19 +7999,19 @@ class BotGenerator {
7958
7999
  workspaceId: project.agentInfo?.workspaceId
7959
8000
  });
7960
8001
  const integrations = await manager3.loadIntegrations(project.dependencies || {});
7961
- const integrationsDir = path32.join(this.projectPath, ".adk", "integrations");
8002
+ const integrationsDir = path33.join(this.projectPath, ".adk", "integrations");
7962
8003
  const existingIntegrationFiles = await this.listFilesRecursive(integrationsDir);
7963
8004
  let aliases = new Set;
7964
8005
  let files = new Set;
7965
8006
  for (const integration of integrations.integrations) {
7966
8007
  if (integration.definition) {
7967
8008
  const types6 = await generateIntegrationTypes(integration);
7968
- const importPath = `./${path32.join("integrations", types6.names.paths.index).replace(/\\/g, "/")}`;
8009
+ const importPath = `./${path33.join("integrations", types6.names.paths.index).replace(/\\/g, "/")}`;
7969
8010
  aliases.add(`"${integration.alias}": import("${importPath}").${types6.names.typings.index}`);
7970
8011
  for (const [filePath, content] of Object.entries(types6.files)) {
7971
- const fullPath = path32.join(this.projectPath, ".adk", "integrations", filePath);
7972
- const dir = path32.dirname(fullPath);
7973
- await fs15.mkdir(dir, { recursive: true });
8012
+ const fullPath = path33.join(this.projectPath, ".adk", "integrations", filePath);
8013
+ const dir = path33.dirname(fullPath);
8014
+ await fs16.mkdir(dir, { recursive: true });
7974
8015
  await createFile(fullPath, content);
7975
8016
  files.add(filePath);
7976
8017
  }
@@ -7990,13 +8031,13 @@ class BotGenerator {
7990
8031
  };
7991
8032
  }
7992
8033
  `;
7993
- await createFile(path32.join(this.projectPath, ".adk", "integrations-types.d.ts"), await formatCode(types5));
8034
+ await createFile(path33.join(this.projectPath, ".adk", "integrations-types.d.ts"), await formatCode(types5));
7994
8035
  const staleIntegrationFiles = existingIntegrationFiles.filter((f) => !files.has(f));
7995
8036
  if (staleIntegrationFiles.length > 0) {
7996
8037
  for (const rel of staleIntegrationFiles) {
7997
- const abs = path32.join(integrationsDir, rel);
8038
+ const abs = path33.join(integrationsDir, rel);
7998
8039
  try {
7999
- await fs15.rm(abs, { force: true });
8040
+ await fs16.rm(abs, { force: true });
8000
8041
  } catch {}
8001
8042
  }
8002
8043
  }
@@ -8063,7 +8104,7 @@ class BotGenerator {
8063
8104
  let botStateType = "{}";
8064
8105
  let userStateType = "{}";
8065
8106
  try {
8066
- const configPath = path32.join(project.path, "agent.config.ts");
8107
+ const configPath = path33.join(project.path, "agent.config.ts");
8067
8108
  const configModule = await import(`${configPath}?t=${Date.now()}`);
8068
8109
  const config = configModule.default;
8069
8110
  if (config?.bot?.state) {
@@ -8099,7 +8140,7 @@ declare module "@botpress/runtime/_types/state" {
8099
8140
  export type UserState = ${userStateType};
8100
8141
  }
8101
8142
  `;
8102
- await createFile(path32.join(this.projectPath, ".adk", "runtime.d.ts"), await formatCode(types5));
8143
+ await createFile(path33.join(this.projectPath, ".adk", "runtime.d.ts"), await formatCode(types5));
8103
8144
  }
8104
8145
  async generateInterfacesTypes() {
8105
8146
  const project = await AgentProject.load(this.projectPath);
@@ -8107,7 +8148,7 @@ declare module "@botpress/runtime/_types/state" {
8107
8148
  workspaceId: project.agentInfo?.workspaceId
8108
8149
  });
8109
8150
  const manager3 = new InterfaceManager;
8110
- const interfacesDir = path32.join(this.projectPath, ".adk", "interfaces");
8151
+ const interfacesDir = path33.join(this.projectPath, ".adk", "interfaces");
8111
8152
  const existingInterfaceFiles = await this.listFilesRecursive(interfacesDir);
8112
8153
  const interfaces = await manager3.loadInterfaces(project.dependencies || {}).then((result) => result.interfaces.filter((int) => int.definition).map((x) => x.definition));
8113
8154
  const integrations = await integrationManager.loadIntegrations(project.dependencies || {}).then((result) => result.integrations.filter((int) => int.enabled && int.definition).map((x) => x.definition));
@@ -8116,12 +8157,12 @@ declare module "@botpress/runtime/_types/state" {
8116
8157
  let files = new Set;
8117
8158
  for (const int of interfaces) {
8118
8159
  const types6 = await generateInterfaceTypes(int, integrations);
8119
- imports.add(`import { ${types6.names.typings.index} } from "./${path32.join("interfaces", types6.names.paths.index).replace(/\\/g, "/")}";`);
8160
+ imports.add(`import { ${types6.names.typings.index} } from "./${path33.join("interfaces", types6.names.paths.index).replace(/\\/g, "/")}";`);
8120
8161
  aliases.add(`"${types6.names.name}": ${types6.names.typings.index}`);
8121
8162
  for (const [filePath, content] of Object.entries(types6.files)) {
8122
- const fullPath = path32.join(this.projectPath, ".adk", "interfaces", filePath);
8123
- const dir = path32.dirname(fullPath);
8124
- await fs15.mkdir(dir, { recursive: true });
8163
+ const fullPath = path33.join(this.projectPath, ".adk", "interfaces", filePath);
8164
+ const dir = path33.dirname(fullPath);
8165
+ await fs16.mkdir(dir, { recursive: true });
8125
8166
  await createFile(fullPath, content);
8126
8167
  files.add(filePath);
8127
8168
  }
@@ -8157,14 +8198,14 @@ declare module "@botpress/runtime/_types/state" {
8157
8198
  `)}
8158
8199
  };
8159
8200
  `;
8160
- await createFile(path32.join(this.projectPath, ".adk", "interfaces.d.ts"), await formatCode(types5));
8161
- await createFile(path32.join(this.projectPath, ".adk", "interfaces.ts"), await formatCode(consts));
8201
+ await createFile(path33.join(this.projectPath, ".adk", "interfaces.d.ts"), await formatCode(types5));
8202
+ await createFile(path33.join(this.projectPath, ".adk", "interfaces.ts"), await formatCode(consts));
8162
8203
  const staleInterfaceFiles = existingInterfaceFiles.filter((f) => !files.has(f));
8163
8204
  if (staleInterfaceFiles.length > 0) {
8164
8205
  for (const rel of staleInterfaceFiles) {
8165
- const abs = path32.join(interfacesDir, rel);
8206
+ const abs = path33.join(interfacesDir, rel);
8166
8207
  try {
8167
- await fs15.rm(abs, { force: true });
8208
+ await fs16.rm(abs, { force: true });
8168
8209
  } catch {}
8169
8210
  }
8170
8211
  }
@@ -8195,7 +8236,7 @@ declare module "@botpress/runtime/_types/state" {
8195
8236
  `) : ""}
8196
8237
  } as Record<string, IntegrationPackage>;
8197
8238
  `;
8198
- await createFile(path32.join(this.outputPath, "src", "integrations.ts"), content);
8239
+ await createFile(path33.join(this.outputPath, "src", "integrations.ts"), content);
8199
8240
  }
8200
8241
  async generateInterfacesDefinition() {
8201
8242
  const interfaces = BUILTIN_INTERFACES;
@@ -8218,7 +8259,7 @@ declare module "@botpress/runtime/_types/state" {
8218
8259
  `) : ""}
8219
8260
  } as Record<string, InterfacePackage>;
8220
8261
  `;
8221
- await createFile(path32.join(this.outputPath, "src", "interfaces.ts"), await formatCode(content));
8262
+ await createFile(path33.join(this.outputPath, "src", "interfaces.ts"), await formatCode(content));
8222
8263
  }
8223
8264
  async generateBotDefinition() {
8224
8265
  const project = await AgentProject.load(this.projectPath);
@@ -8273,7 +8314,7 @@ declare module "@botpress/runtime/_types/state" {
8273
8314
  if (isBuiltinWorkflow2(workflow.definition.name)) {
8274
8315
  continue;
8275
8316
  }
8276
- const workflowPath = path32.join(project.path, workflow.path);
8317
+ const workflowPath = path33.join(project.path, workflow.path);
8277
8318
  const workflowModule = await import(`${workflowPath}?t=${Date.now()}`);
8278
8319
  const workflowInstance = workflowModule.default || workflowModule[workflow.export];
8279
8320
  if (workflowInstance) {
@@ -8511,7 +8552,7 @@ configuration: {
8511
8552
  const fullContent = content + integrationsSection + `
8512
8553
 
8513
8554
  export default bot;`;
8514
- await createFile(path32.join(this.outputPath, "bot.definition.ts"), await formatCode(fullContent));
8555
+ await createFile(path33.join(this.outputPath, "bot.definition.ts"), await formatCode(fullContent));
8515
8556
  }
8516
8557
  async generateBotIndex() {
8517
8558
  const content = dedent`
@@ -8545,7 +8586,7 @@ export default bot;`;
8545
8586
 
8546
8587
  export default bot
8547
8588
  `;
8548
- await createFile(path32.join(this.outputPath, "src", "index.ts"), await formatCode(content));
8589
+ await createFile(path33.join(this.outputPath, "src", "index.ts"), await formatCode(content));
8549
8590
  }
8550
8591
  async generatePackageJson(project) {
8551
8592
  const packageJson = {
@@ -8559,7 +8600,7 @@ export default bot;`;
8559
8600
  typescript: "^5.9.3"
8560
8601
  }
8561
8602
  };
8562
- await createFile(path32.join(this.outputPath, "package.json"), JSON.stringify(packageJson, null, 2));
8603
+ await createFile(path33.join(this.outputPath, "package.json"), JSON.stringify(packageJson, null, 2));
8563
8604
  }
8564
8605
  async generateTsConfig() {
8565
8606
  const tsConfig = {
@@ -8590,7 +8631,7 @@ export default bot;`;
8590
8631
  },
8591
8632
  include: [".botpress/**/*", "src/**/*", "bp_modules/**/*", "./*.ts", "./*.json", "../*.d.ts"]
8592
8633
  };
8593
- await createFile(path32.join(this.outputPath, "tsconfig.json"), JSON.stringify(tsConfig, null, 2));
8634
+ await createFile(path33.join(this.outputPath, "tsconfig.json"), JSON.stringify(tsConfig, null, 2));
8594
8635
  }
8595
8636
  async generateGlobalTypes() {
8596
8637
  const content = dedent`
@@ -8613,42 +8654,42 @@ export default bot;`;
8613
8654
 
8614
8655
  export {};
8615
8656
  `;
8616
- await createFile(path32.join(this.outputPath, "global.d.ts"), await formatCode(content));
8657
+ await createFile(path33.join(this.outputPath, "global.d.ts"), await formatCode(content));
8617
8658
  }
8618
8659
  async copyAssets() {
8619
- const assetsPath = path32.join(this.projectPath, "assets");
8620
- const targetPath = path32.join(this.outputPath, "assets");
8621
- if (existsSync6(assetsPath)) {
8622
- await fs15.mkdir(targetPath, { recursive: true });
8660
+ const assetsPath = path33.join(this.projectPath, "assets");
8661
+ const targetPath = path33.join(this.outputPath, "assets");
8662
+ if (existsSync7(assetsPath)) {
8663
+ await fs16.mkdir(targetPath, { recursive: true });
8623
8664
  await this.copyDirectory(assetsPath, targetPath);
8624
8665
  }
8625
8666
  }
8626
8667
  async copyDirectory(src, dest) {
8627
- const entries = await fs15.readdir(src, { withFileTypes: true });
8668
+ const entries = await fs16.readdir(src, { withFileTypes: true });
8628
8669
  for (const entry of entries) {
8629
- const srcPath = path32.join(src, entry.name);
8630
- const destPath = path32.join(dest, entry.name);
8670
+ const srcPath = path33.join(src, entry.name);
8671
+ const destPath = path33.join(dest, entry.name);
8631
8672
  if (entry.isDirectory()) {
8632
- await fs15.mkdir(destPath, { recursive: true });
8673
+ await fs16.mkdir(destPath, { recursive: true });
8633
8674
  await this.copyDirectory(srcPath, destPath);
8634
8675
  } else {
8635
- await fs15.copyFile(srcPath, destPath);
8676
+ await fs16.copyFile(srcPath, destPath);
8636
8677
  }
8637
8678
  }
8638
8679
  }
8639
8680
  async generateAdkRuntime() {
8640
8681
  const project = new AgentProject(this.projectPath);
8641
8682
  await project.reload();
8642
- const srcDir = path32.join(this.outputPath, "src");
8683
+ const srcDir = path33.join(this.outputPath, "src");
8643
8684
  {
8644
- const dest = path32.join(srcDir, "conversations.ts");
8685
+ const dest = path33.join(srcDir, "conversations.ts");
8645
8686
  const imports = new Map;
8646
8687
  const exports = new Set;
8647
8688
  let index = 1;
8648
8689
  for (const conversation of project.conversations) {
8649
8690
  if (!imports.has(conversation.path)) {
8650
8691
  const name = `conversations_${index++}`;
8651
- const importPath = getImportPath(dest, path32.join(project.path, conversation.path));
8692
+ const importPath = getImportPath(dest, path33.join(project.path, conversation.path));
8652
8693
  imports.set(conversation.path, {
8653
8694
  name,
8654
8695
  statement: `import * as ${name} from "${importPath}";`
@@ -8674,14 +8715,14 @@ export default bot;`;
8674
8715
  await createFile(dest, await formatCode(content2));
8675
8716
  }
8676
8717
  {
8677
- const dest = path32.join(srcDir, "knowledge.ts");
8718
+ const dest = path33.join(srcDir, "knowledge.ts");
8678
8719
  const imports = new Map;
8679
8720
  const exports = new Set;
8680
8721
  let index = 1;
8681
8722
  for (const knowledge of project.knowledge) {
8682
8723
  if (!imports.has(knowledge.path)) {
8683
8724
  const name = `knowledge_${index++}`;
8684
- const importPath = getImportPath(dest, path32.join(project.path, knowledge.path));
8725
+ const importPath = getImportPath(dest, path33.join(project.path, knowledge.path));
8685
8726
  imports.set(knowledge.path, {
8686
8727
  name,
8687
8728
  statement: `import * as ${name} from "${importPath}";`
@@ -8707,7 +8748,7 @@ export default bot;`;
8707
8748
  await createFile(dest, await formatCode(content2));
8708
8749
  }
8709
8750
  {
8710
- const dest = path32.join(srcDir, "triggers.ts");
8751
+ const dest = path33.join(srcDir, "triggers.ts");
8711
8752
  const { transforms: transforms4 } = await import("@botpress/sdk");
8712
8753
  const imports = new Map;
8713
8754
  const exports = new Set;
@@ -8716,7 +8757,7 @@ export default bot;`;
8716
8757
  for (const trigger of project.triggers) {
8717
8758
  if (!imports.has(trigger.path)) {
8718
8759
  const name = `triggers_${index++}`;
8719
- const importPath = getImportPath(dest, path32.join(project.path, trigger.path));
8760
+ const importPath = getImportPath(dest, path33.join(project.path, trigger.path));
8720
8761
  imports.set(trigger.path, {
8721
8762
  name,
8722
8763
  statement: `import * as ${name} from "${importPath}";`
@@ -8726,7 +8767,7 @@ export default bot;`;
8726
8767
  }
8727
8768
  for (const trigger of project.triggers) {
8728
8769
  try {
8729
- const absolutePath = path32.join(project.path, trigger.path);
8770
+ const absolutePath = path33.join(project.path, trigger.path);
8730
8771
  const triggerModule = await import(`${absolutePath}?t=${Date.now()}`);
8731
8772
  const triggerInstance = triggerModule[trigger.export] || triggerModule.default;
8732
8773
  if (triggerInstance && triggerInstance.payload) {
@@ -8769,7 +8810,7 @@ export default bot;`;
8769
8810
  await createFile(dest, await formatCode(content2));
8770
8811
  }
8771
8812
  {
8772
- const dest = path32.join(srcDir, "workflows.ts");
8813
+ const dest = path33.join(srcDir, "workflows.ts");
8773
8814
  const imports = new Map;
8774
8815
  const exports = new Set;
8775
8816
  let index = 1;
@@ -8779,7 +8820,7 @@ export default bot;`;
8779
8820
  }
8780
8821
  if (!imports.has(workflow.path)) {
8781
8822
  const name = `workflows_${index++}`;
8782
- const importPath = getImportPath(dest, path32.join(project.path, workflow.path));
8823
+ const importPath = getImportPath(dest, path33.join(project.path, workflow.path));
8783
8824
  const statement = `import * as ${name} from "${importPath}";`;
8784
8825
  imports.set(workflow.path, {
8785
8826
  name,
@@ -8813,7 +8854,7 @@ export default bot;`;
8813
8854
  await createFile(dest, await formatCode(content2));
8814
8855
  }
8815
8856
  {
8816
- const dest = path32.join(srcDir, "actions.ts");
8857
+ const dest = path33.join(srcDir, "actions.ts");
8817
8858
  const imports = new Map;
8818
8859
  const exports = new Set;
8819
8860
  let index = 1;
@@ -8823,7 +8864,7 @@ export default bot;`;
8823
8864
  }
8824
8865
  if (!imports.has(action.path)) {
8825
8866
  const name = `actions_${index++}`;
8826
- const importPath = getImportPath(dest, path32.join(project.path, action.path));
8867
+ const importPath = getImportPath(dest, path33.join(project.path, action.path));
8827
8868
  imports.set(action.path, {
8828
8869
  name,
8829
8870
  statement: `import * as ${name} from "${importPath}";`
@@ -8849,14 +8890,14 @@ export default bot;`;
8849
8890
  await createFile(dest, await formatCode(content2));
8850
8891
  }
8851
8892
  {
8852
- const dest = path32.join(srcDir, "tables.ts");
8893
+ const dest = path33.join(srcDir, "tables.ts");
8853
8894
  const imports = new Map;
8854
8895
  const exports = new Set;
8855
8896
  let index = 1;
8856
8897
  for (const table of project.tables) {
8857
8898
  if (!imports.has(table.path)) {
8858
8899
  const name = `tables_${index++}`;
8859
- const importPath = getImportPath(dest, path32.join(project.path, table.path));
8900
+ const importPath = getImportPath(dest, path33.join(project.path, table.path));
8860
8901
  imports.set(table.path, {
8861
8902
  name,
8862
8903
  statement: `import * as ${name} from "${importPath}";`
@@ -8882,8 +8923,8 @@ export default bot;`;
8882
8923
  await createFile(dest, await formatCode(content2));
8883
8924
  }
8884
8925
  {
8885
- const dest = path32.join(srcDir, "config.ts");
8886
- const importPath = getImportPath(dest, path32.join(project.path, "agent.config.ts"));
8926
+ const dest = path33.join(srcDir, "config.ts");
8927
+ const importPath = getImportPath(dest, path33.join(project.path, "agent.config.ts"));
8887
8928
  const content2 = `
8888
8929
  ////////////////////////////////////////////////////////
8889
8930
  // DO NOT EDIT THIS FILE DIRECTLY
@@ -8949,13 +8990,13 @@ export default bot;`;
8949
8990
  handlers.actions.setup(bot);
8950
8991
  }
8951
8992
  `;
8952
- await createFile(path32.join(this.outputPath, "src", "adk-runtime.ts"), await formatCode(content));
8993
+ await createFile(path33.join(this.outputPath, "src", "adk-runtime.ts"), await formatCode(content));
8953
8994
  }
8954
8995
  async copyAssetsRuntime() {
8955
- const assetsRuntimePath = path32.join(this.projectPath, ".adk", "assets-runtime.ts");
8956
- if (existsSync6(assetsRuntimePath)) {
8957
- const content = await fs15.readFile(assetsRuntimePath, "utf-8");
8958
- await createFile(path32.join(this.outputPath, "src", "assets-runtime.ts"), await formatCode(content));
8996
+ const assetsRuntimePath = path33.join(this.projectPath, ".adk", "assets-runtime.ts");
8997
+ if (existsSync7(assetsRuntimePath)) {
8998
+ const content = await fs16.readFile(assetsRuntimePath, "utf-8");
8999
+ await createFile(path33.join(this.outputPath, "src", "assets-runtime.ts"), await formatCode(content));
8959
9000
  }
8960
9001
  }
8961
9002
  }
@@ -8964,9 +9005,11 @@ async function generateBotProject(options) {
8964
9005
  await generator.generate();
8965
9006
  await generator.generateAdkRuntime();
8966
9007
  await generator.copyAssetsRuntime();
8967
- const devIdManager = new DevIdManager(options.projectPath, options.outputPath || path32.join(options.projectPath, ".adk", "bot"));
9008
+ const botPath = options.outputPath || path33.join(options.projectPath, ".adk", "bot");
9009
+ await linkSdk(options.projectPath, botPath);
9010
+ const devIdManager = new DevIdManager(options.projectPath, options.outputPath || path33.join(options.projectPath, ".adk", "bot"));
8968
9011
  await devIdManager.restoreDevId();
8969
- const integrationSync = new IntegrationSync(options.projectPath, options.outputPath || path32.join(options.projectPath, ".adk", "bot"));
9012
+ const integrationSync = new IntegrationSync(options.projectPath, options.outputPath || path33.join(options.projectPath, ".adk", "bot"));
8970
9013
  const integrationSyncResult = await integrationSync.syncIntegrations();
8971
9014
  if (integrationSyncResult.errors.length > 0) {
8972
9015
  console.warn(`⚠️ Some integrations failed to sync:`);
@@ -8974,7 +9017,7 @@ async function generateBotProject(options) {
8974
9017
  console.warn(` - ${alias}: ${error}`);
8975
9018
  });
8976
9019
  }
8977
- const interfaceSync = new InterfaceSync(options.projectPath, options.outputPath || path32.join(options.projectPath, ".adk", "bot"));
9020
+ const interfaceSync = new InterfaceSync(options.projectPath, options.outputPath || path33.join(options.projectPath, ".adk", "bot"));
8978
9021
  const interfaceSyncResult = await interfaceSync.syncInterfaces();
8979
9022
  if (interfaceSyncResult.errors.length > 0) {
8980
9023
  console.warn(`⚠️ Some interfaces failed to sync:`);
@@ -9483,8 +9526,8 @@ class TableManager {
9483
9526
  }
9484
9527
  // src/knowledge/manager.ts
9485
9528
  import crypto4 from "crypto";
9486
- import path33 from "path";
9487
- import fs16 from "fs/promises";
9529
+ import path34 from "path";
9530
+ import fs17 from "fs/promises";
9488
9531
  import { glob } from "glob";
9489
9532
  import { Client as Client14 } from "@botpress/client";
9490
9533
  import { DataSource } from "@botpress/runtime";
@@ -9933,15 +9976,15 @@ class KnowledgeManager {
9933
9976
  }
9934
9977
  async scanLocalFileHashes(directoryPath, filterFn) {
9935
9978
  const projectDir = this.project.path;
9936
- const directory = path33.resolve(projectDir, directoryPath);
9979
+ const directory = path34.resolve(projectDir, directoryPath);
9937
9980
  if (this.fileHashCache.has(directory)) {
9938
9981
  return this.fileHashCache.get(directory);
9939
9982
  }
9940
9983
  const files = glob.sync(directory + "/**/*.*", { absolute: true, nodir: true }).filter((file) => !filterFn || filterFn(file));
9941
9984
  const hashes = {};
9942
9985
  for (const file of files) {
9943
- const relPath = path33.relative(directory, file);
9944
- const content = await fs16.readFile(file);
9986
+ const relPath = path34.relative(directory, file);
9987
+ const content = await fs17.readFile(file);
9945
9988
  hashes[relPath] = crypto4.createHash("sha256").update(content).digest("hex");
9946
9989
  }
9947
9990
  this.fileHashCache.set(directory, hashes);
@@ -10048,7 +10091,7 @@ class KnowledgeManager {
10048
10091
  }
10049
10092
  async syncDirectorySource(client, kbName, kbId, dsId, directoryPath, filterFn, force) {
10050
10093
  const projectDir = this.project.path;
10051
- const directory = path33.resolve(projectDir, directoryPath);
10094
+ const directory = path34.resolve(projectDir, directoryPath);
10052
10095
  if (!directory.startsWith(projectDir)) {
10053
10096
  throw new Error("Directory path must be within the agent's directory");
10054
10097
  }
@@ -10070,8 +10113,8 @@ class KnowledgeManager {
10070
10113
  return true;
10071
10114
  }).map((f) => ({
10072
10115
  abs: f,
10073
- rel: path33.relative(directory, f),
10074
- name: path33.basename(f)
10116
+ rel: path34.relative(directory, f),
10117
+ name: path34.basename(f)
10075
10118
  }));
10076
10119
  console.log(` Found ${allFiles.length} files in ${directoryPath}`);
10077
10120
  const cachedHashes = await this.scanLocalFileHashes(directoryPath, filterFn);
@@ -10145,7 +10188,7 @@ class KnowledgeManager {
10145
10188
  }
10146
10189
  async upsertFile(client, local, dsId, tags, force, cachedHash) {
10147
10190
  const key = `data_source://document/${dsId}/${local.rel}`;
10148
- const content = await fs16.readFile(local.abs);
10191
+ const content = await fs17.readFile(local.abs);
10149
10192
  const hash = cachedHash ?? crypto4.createHash("sha256").update(content).digest("hex");
10150
10193
  try {
10151
10194
  const { file } = await client.getFile({ id: key });
@@ -10153,7 +10196,7 @@ class KnowledgeManager {
10153
10196
  return null;
10154
10197
  }
10155
10198
  } catch {}
10156
- const title = path33.basename(local.name, path33.extname(local.name));
10199
+ const title = path34.basename(local.name, path34.extname(local.name));
10157
10200
  const metadata = {
10158
10201
  hash,
10159
10202
  dsId,
@@ -10281,7 +10324,7 @@ class KBSyncFormatter {
10281
10324
  import { watch as watch2, readdirSync as readdirSync2 } from "fs";
10282
10325
  import { EventEmitter as EventEmitter3 } from "events";
10283
10326
  import { join as join8, relative as relative3 } from "path";
10284
- import { existsSync as existsSync7 } from "fs";
10327
+ import { existsSync as existsSync8 } from "fs";
10285
10328
 
10286
10329
  class FileWatcher2 extends EventEmitter3 {
10287
10330
  projectPath;
@@ -10299,12 +10342,12 @@ class FileWatcher2 extends EventEmitter3 {
10299
10342
  const rootFiles = ["package.json", "agent.json", "agent.config.ts"];
10300
10343
  for (const file of rootFiles) {
10301
10344
  const filePath = join8(this.projectPath, file);
10302
- if (existsSync7(filePath)) {
10345
+ if (existsSync8(filePath)) {
10303
10346
  this.watchFile(filePath);
10304
10347
  }
10305
10348
  }
10306
10349
  const srcPath = join8(this.projectPath, "src");
10307
- if (existsSync7(srcPath)) {
10350
+ if (existsSync8(srcPath)) {
10308
10351
  this.initializeDirectoryState(srcPath);
10309
10352
  this.watchDirectory(srcPath);
10310
10353
  }
@@ -10353,7 +10396,7 @@ class FileWatcher2 extends EventEmitter3 {
10353
10396
  }
10354
10397
  }
10355
10398
  handleFileChange(filePath) {
10356
- const fileExists = existsSync7(filePath);
10399
+ const fileExists = existsSync8(filePath);
10357
10400
  const previousState = this.fileStates.get(filePath);
10358
10401
  let changeType;
10359
10402
  if (!fileExists && previousState !== undefined) {
@@ -10393,7 +10436,7 @@ class FileWatcher2 extends EventEmitter3 {
10393
10436
  this.emit("change", event);
10394
10437
  }
10395
10438
  updateFileState(filePath) {
10396
- if (existsSync7(filePath)) {
10439
+ if (existsSync8(filePath)) {
10397
10440
  this.fileStates.set(filePath, Date.now());
10398
10441
  }
10399
10442
  }
@@ -10418,7 +10461,7 @@ class FileWatcher2 extends EventEmitter3 {
10418
10461
  }
10419
10462
  // src/preflight/checker.ts
10420
10463
  import { Client as Client15 } from "@botpress/client";
10421
- import path34 from "path";
10464
+ import path35 from "path";
10422
10465
 
10423
10466
  // src/preflight/types.ts
10424
10467
  function hasIntegrationChanges(integrations) {
@@ -10780,16 +10823,16 @@ class PreflightChecker {
10780
10823
  options?.onProgress?.("Regenerating bot project...");
10781
10824
  await generateBotProject({
10782
10825
  projectPath: this.projectPath,
10783
- outputPath: path34.join(this.projectPath, ".adk", "bot")
10826
+ outputPath: path35.join(this.projectPath, ".adk", "bot")
10784
10827
  });
10785
10828
  options?.onSuccess?.("Bot project regenerated");
10786
10829
  }
10787
10830
  }
10788
10831
  // src/runner/script-runner.ts
10789
10832
  import dedent2 from "dedent";
10790
- import { existsSync as existsSync8 } from "fs";
10791
- import fs17 from "fs/promises";
10792
- import path35 from "path";
10833
+ import { existsSync as existsSync9 } from "fs";
10834
+ import fs18 from "fs/promises";
10835
+ import path36 from "path";
10793
10836
  import { spawn } from "child_process";
10794
10837
  init_utils();
10795
10838
  class ScriptRunner {
@@ -10798,7 +10841,7 @@ class ScriptRunner {
10798
10841
  prod;
10799
10842
  credentials;
10800
10843
  constructor(options) {
10801
- this.projectPath = path35.resolve(options.projectPath);
10844
+ this.projectPath = path36.resolve(options.projectPath);
10802
10845
  this.forceRegenerate = options.forceRegenerate ?? false;
10803
10846
  this.prod = options.prod ?? false;
10804
10847
  this.credentials = options.credentials;
@@ -10807,10 +10850,10 @@ class ScriptRunner {
10807
10850
  const project = await AgentProject.load(this.projectPath, {
10808
10851
  adkCommand: "adk-build"
10809
10852
  });
10810
- const botPath = path35.join(this.projectPath, ".adk", "bot");
10811
- const runnerPath = path35.join(botPath, "src", "script-runner.ts");
10812
- const botpressTypesPath = path35.join(botPath, ".botpress", "implementation", "index.ts");
10813
- const needsRegenerate = this.forceRegenerate || !existsSync8(runnerPath) || !existsSync8(botpressTypesPath);
10853
+ const botPath = path36.join(this.projectPath, ".adk", "bot");
10854
+ const runnerPath = path36.join(botPath, "src", "script-runner.ts");
10855
+ const botpressTypesPath = path36.join(botPath, ".botpress", "implementation", "index.ts");
10856
+ const needsRegenerate = this.forceRegenerate || !existsSync9(runnerPath) || !existsSync9(botpressTypesPath);
10814
10857
  if (needsRegenerate) {
10815
10858
  try {
10816
10859
  await generateAssetsTypes(project.path);
@@ -10894,12 +10937,12 @@ class ScriptRunner {
10894
10937
 
10895
10938
  runScript()
10896
10939
  `;
10897
- await fs17.writeFile(path35.join(botPath, "src", "script-runner.ts"), await formatCode(content), "utf-8");
10940
+ await fs18.writeFile(path36.join(botPath, "src", "script-runner.ts"), await formatCode(content), "utf-8");
10898
10941
  }
10899
10942
  async run(scriptPath, options = {}) {
10900
10943
  const { botPath, runnerPath, project } = await this.prepare();
10901
- const absoluteScriptPath = path35.isAbsolute(scriptPath) ? scriptPath : path35.resolve(this.projectPath, scriptPath);
10902
- if (!existsSync8(absoluteScriptPath)) {
10944
+ const absoluteScriptPath = path36.isAbsolute(scriptPath) ? scriptPath : path36.resolve(this.projectPath, scriptPath);
10945
+ if (!existsSync9(absoluteScriptPath)) {
10903
10946
  throw new Error(`Script not found: ${absoluteScriptPath}`);
10904
10947
  }
10905
10948
  const botId = this.prod ? project.agentInfo?.botId : project.agentInfo?.devId || project.agentInfo?.botId;
@@ -11010,5 +11053,5 @@ export {
11010
11053
  AgentProject
11011
11054
  };
11012
11055
 
11013
- //# debugId=4A3ECF72EBA6C21464756E2164756E21
11056
+ //# debugId=1A3563A12165E75864756E2164756E21
11014
11057
  //# sourceMappingURL=index.js.map