@botpress/adk 1.12.2 → 1.12.4

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.4", 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.4",
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.4",
848
848
  "@botpress/sdk": "^4.18.1",
849
849
  "@bpinternal/jex": "^1.2.4",
850
850
  "@bpinternal/yargs-extra": "^0.0.21",
@@ -3539,6 +3539,13 @@ class IntegrationChecker {
3539
3539
  }
3540
3540
  // src/integrations/sync-manager.ts
3541
3541
  import { Client as Client9 } from "@botpress/client";
3542
+ function normalizeConfigurationType(configType) {
3543
+ if (configType === "default" || configType === null) {
3544
+ return;
3545
+ }
3546
+ return configType;
3547
+ }
3548
+
3542
3549
  class IntegrationSyncManager {
3543
3550
  projectPath;
3544
3551
  client;
@@ -3597,7 +3604,7 @@ class IntegrationSyncManager {
3597
3604
  integrationId: result.desiredIntegrationId || result.definition.id,
3598
3605
  enabled: result.desiredInstallStatus === "enabled",
3599
3606
  configuration: result.desiredConfiguration || {},
3600
- configurationType: result.desiredConfigurationType
3607
+ configurationType: normalizeConfigurationType(result.desiredConfigurationType)
3601
3608
  }
3602
3609
  }
3603
3610
  });
@@ -3616,7 +3623,7 @@ class IntegrationSyncManager {
3616
3623
  integrationId: result.desiredIntegrationId || result.definition.id,
3617
3624
  enabled: result.desiredInstallStatus === "enabled",
3618
3625
  configuration: result.desiredConfiguration || {},
3619
- configurationType: result.desiredConfigurationType
3626
+ configurationType: normalizeConfigurationType(result.desiredConfigurationType)
3620
3627
  }
3621
3628
  }
3622
3629
  });
@@ -6163,7 +6170,7 @@ class AgentProjectGenerator {
6163
6170
  deploy: "adk deploy"
6164
6171
  },
6165
6172
  dependencies: {
6166
- "@botpress/runtime": `^${"1.12.2"}`
6173
+ "@botpress/runtime": `^${"1.12.4"}`
6167
6174
  },
6168
6175
  devDependencies: {
6169
6176
  typescript: "^5.9.3"
@@ -6775,9 +6782,9 @@ Description: ${tag?.description}`);
6775
6782
  }
6776
6783
  // src/bot-generator/generator.ts
6777
6784
  import dedent from "dedent";
6778
- import { existsSync as existsSync6 } from "fs";
6779
- import fs15 from "fs/promises";
6780
- import path32 from "path";
6785
+ import { existsSync as existsSync7 } from "fs";
6786
+ import fs16 from "fs/promises";
6787
+ import path33 from "path";
6781
6788
 
6782
6789
  // src/generators/interface-types.ts
6783
6790
  import { transforms as transforms2 } from "@botpress/sdk";
@@ -7516,10 +7523,51 @@ ${integrationEvents.join(`
7516
7523
  // src/bot-generator/generator.ts
7517
7524
  init_fs();
7518
7525
 
7519
- // src/bot-generator/dev-id-manager.ts
7520
- import path27 from "path";
7526
+ // src/utils/link-sdk.ts
7527
+ import { existsSync as existsSync3, realpathSync } from "fs";
7521
7528
  import fs12 from "fs/promises";
7522
- import { existsSync as existsSync3 } from "fs";
7529
+ import path27 from "path";
7530
+ function findPackage(name, startDir) {
7531
+ let current;
7532
+ try {
7533
+ current = realpathSync(startDir);
7534
+ } catch {
7535
+ current = startDir;
7536
+ }
7537
+ while (current !== path27.dirname(current)) {
7538
+ const pkgPath = path27.join(current, "node_modules", name);
7539
+ if (existsSync3(pkgPath)) {
7540
+ return pkgPath;
7541
+ }
7542
+ current = path27.dirname(current);
7543
+ }
7544
+ return null;
7545
+ }
7546
+ async function linkSdk(agentDir, botDir) {
7547
+ const targetSdkPath = path27.join(botDir, "node_modules", "@botpress", "sdk");
7548
+ if (existsSync3(targetSdkPath)) {
7549
+ return;
7550
+ }
7551
+ const runtimePath = findPackage("@botpress/runtime", agentDir);
7552
+ if (!runtimePath) {
7553
+ console.warn("Warning: Could not find @botpress/runtime in agent directory");
7554
+ return;
7555
+ }
7556
+ let sdkPath = findPackage("@botpress/sdk", runtimePath);
7557
+ if (!sdkPath) {
7558
+ console.warn(`Warning: Could not find @botpress/sdk from @botpress/runtime location (${runtimePath})`);
7559
+ return;
7560
+ }
7561
+ const targetBotpressDir = path27.join(botDir, "node_modules", "@botpress");
7562
+ await fs12.mkdir(targetBotpressDir, { recursive: true });
7563
+ const symlinkType = process.platform === "win32" ? "junction" : undefined;
7564
+ await fs12.symlink(sdkPath, targetSdkPath, symlinkType);
7565
+ }
7566
+
7567
+ // src/bot-generator/dev-id-manager.ts
7568
+ import path28 from "path";
7569
+ import fs13 from "fs/promises";
7570
+ import { existsSync as existsSync4 } from "fs";
7523
7571
  import { Client as Client12 } from "@botpress/client";
7524
7572
  class DevIdManager {
7525
7573
  projectPath;
@@ -7529,7 +7577,7 @@ class DevIdManager {
7529
7577
  constructor(projectPath, botProjectPath) {
7530
7578
  this.projectPath = projectPath;
7531
7579
  this.botProjectPath = botProjectPath;
7532
- this.projectCachePath = path27.join(botProjectPath, ".botpress", "project.cache.json");
7580
+ this.projectCachePath = path28.join(botProjectPath, ".botpress", "project.cache.json");
7533
7581
  }
7534
7582
  async getClient() {
7535
7583
  if (!this.client) {
@@ -7555,8 +7603,8 @@ class DevIdManager {
7555
7603
  }
7556
7604
  async readProjectCache() {
7557
7605
  try {
7558
- if (existsSync3(this.projectCachePath)) {
7559
- const content = await fs12.readFile(this.projectCachePath, "utf-8");
7606
+ if (existsSync4(this.projectCachePath)) {
7607
+ const content = await fs13.readFile(this.projectCachePath, "utf-8");
7560
7608
  return JSON.parse(content);
7561
7609
  }
7562
7610
  } catch (error) {
@@ -7566,8 +7614,8 @@ class DevIdManager {
7566
7614
  }
7567
7615
  async saveProjectCache(cache2) {
7568
7616
  try {
7569
- await fs12.mkdir(path27.dirname(this.projectCachePath), { recursive: true });
7570
- await fs12.writeFile(this.projectCachePath, JSON.stringify(cache2, null, 2));
7617
+ await fs13.mkdir(path28.dirname(this.projectCachePath), { recursive: true });
7618
+ await fs13.writeFile(this.projectCachePath, JSON.stringify(cache2, null, 2));
7571
7619
  } catch (error) {
7572
7620
  console.error("Error saving project.cache.json:", error);
7573
7621
  }
@@ -7615,9 +7663,9 @@ class DevIdManager {
7615
7663
  }
7616
7664
 
7617
7665
  // src/bot-generator/integration-sync.ts
7618
- import path28 from "path";
7619
- import fs13 from "fs/promises";
7620
- import { existsSync as existsSync4 } from "fs";
7666
+ import path29 from "path";
7667
+ import fs14 from "fs/promises";
7668
+ import { existsSync as existsSync5 } from "fs";
7621
7669
  class IntegrationSync {
7622
7670
  projectPath;
7623
7671
  botProjectPath;
@@ -7625,7 +7673,7 @@ class IntegrationSync {
7625
7673
  constructor(projectPath, botProjectPath) {
7626
7674
  this.projectPath = projectPath;
7627
7675
  this.botProjectPath = botProjectPath;
7628
- this.bpModulesPath = path28.join(botProjectPath, "bp_modules");
7676
+ this.bpModulesPath = path29.join(botProjectPath, "bp_modules");
7629
7677
  }
7630
7678
  async parseIntegrations() {
7631
7679
  const project = await AgentProject.load(this.projectPath);
@@ -7656,16 +7704,16 @@ class IntegrationSync {
7656
7704
  return integrations;
7657
7705
  }
7658
7706
  async isIntegrationSynced(integration) {
7659
- const targetFolder = path28.join(this.bpModulesPath, `integration_${integration.alias}`);
7660
- if (!existsSync4(targetFolder)) {
7707
+ const targetFolder = path29.join(this.bpModulesPath, `integration_${integration.alias}`);
7708
+ if (!existsSync5(targetFolder)) {
7661
7709
  return false;
7662
7710
  }
7663
7711
  try {
7664
- const indexPath = path28.join(targetFolder, "index.ts");
7665
- if (!existsSync4(indexPath)) {
7712
+ const indexPath = path29.join(targetFolder, "index.ts");
7713
+ if (!existsSync5(indexPath)) {
7666
7714
  return false;
7667
7715
  }
7668
- const indexContent = await fs13.readFile(indexPath, "utf-8");
7716
+ const indexContent = await fs14.readFile(indexPath, "utf-8");
7669
7717
  const versionMatch = indexContent.match(/version:\s*["']([^"']+)["']/);
7670
7718
  if (!versionMatch) {
7671
7719
  return false;
@@ -7693,20 +7741,20 @@ class IntegrationSync {
7693
7741
  await command.output();
7694
7742
  }
7695
7743
  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)) {
7744
+ const sourceFolder = path29.join(this.bpModulesPath, integration.name.replace("/", "-"));
7745
+ const targetFolder = path29.join(this.bpModulesPath, `integration_${integration.alias}`);
7746
+ if (!existsSync5(sourceFolder)) {
7699
7747
  throw new Error(`Integration folder not found: ${sourceFolder}`);
7700
7748
  }
7701
- if (existsSync4(targetFolder)) {
7702
- await fs13.rm(targetFolder, { recursive: true, force: true });
7749
+ if (existsSync5(targetFolder)) {
7750
+ await fs14.rm(targetFolder, { recursive: true, force: true });
7703
7751
  }
7704
- await fs13.rename(sourceFolder, targetFolder);
7752
+ await fs14.rename(sourceFolder, targetFolder);
7705
7753
  }
7706
7754
  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 });
7755
+ const targetFolder = path29.join(this.bpModulesPath, `integration_${alias}`);
7756
+ if (existsSync5(targetFolder)) {
7757
+ await fs14.rm(targetFolder, { recursive: true, force: true });
7710
7758
  }
7711
7759
  }
7712
7760
  async syncIntegrations() {
@@ -7716,7 +7764,7 @@ class IntegrationSync {
7716
7764
  if (integrations.length === 0) {
7717
7765
  return { synced, errors };
7718
7766
  }
7719
- await fs13.mkdir(this.bpModulesPath, { recursive: true });
7767
+ await fs14.mkdir(this.bpModulesPath, { recursive: true });
7720
7768
  for (const integration of integrations) {
7721
7769
  try {
7722
7770
  const isAlreadySynced = await this.isIntegrationSynced(integration);
@@ -7738,9 +7786,9 @@ class IntegrationSync {
7738
7786
  }
7739
7787
 
7740
7788
  // src/bot-generator/interface-sync.ts
7741
- import path29 from "path";
7742
- import fs14 from "fs/promises";
7743
- import { existsSync as existsSync5 } from "fs";
7789
+ import path30 from "path";
7790
+ import fs15 from "fs/promises";
7791
+ import { existsSync as existsSync6 } from "fs";
7744
7792
  init_constants();
7745
7793
  class InterfaceSync {
7746
7794
  projectPath;
@@ -7749,7 +7797,7 @@ class InterfaceSync {
7749
7797
  constructor(projectPath, botProjectPath) {
7750
7798
  this.projectPath = projectPath;
7751
7799
  this.botProjectPath = botProjectPath;
7752
- this.bpModulesPath = path29.join(botProjectPath, "bp_modules");
7800
+ this.bpModulesPath = path30.join(botProjectPath, "bp_modules");
7753
7801
  }
7754
7802
  async parseInterfaces() {
7755
7803
  const interfaces = [];
@@ -7767,16 +7815,16 @@ class InterfaceSync {
7767
7815
  return interfaces;
7768
7816
  }
7769
7817
  async isInterfaceSynced(interfaceInfo) {
7770
- const targetFolder = path29.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
7771
- if (!existsSync5(targetFolder)) {
7818
+ const targetFolder = path30.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
7819
+ if (!existsSync6(targetFolder)) {
7772
7820
  return false;
7773
7821
  }
7774
7822
  try {
7775
- const indexPath = path29.join(targetFolder, "index.ts");
7776
- if (!existsSync5(indexPath)) {
7823
+ const indexPath = path30.join(targetFolder, "index.ts");
7824
+ if (!existsSync6(indexPath)) {
7777
7825
  return false;
7778
7826
  }
7779
- const indexContent = await fs14.readFile(indexPath, "utf-8");
7827
+ const indexContent = await fs15.readFile(indexPath, "utf-8");
7780
7828
  const versionMatch = indexContent.match(/version:\s*["']([^"']+)["']/);
7781
7829
  if (!versionMatch) {
7782
7830
  return false;
@@ -7818,20 +7866,20 @@ class InterfaceSync {
7818
7866
  });
7819
7867
  }
7820
7868
  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)) {
7869
+ const sourceFolder = path30.join(this.bpModulesPath, interfaceInfo.name);
7870
+ const targetFolder = path30.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
7871
+ if (!existsSync6(sourceFolder)) {
7824
7872
  throw new Error(`Interface folder not found: ${sourceFolder}`);
7825
7873
  }
7826
- if (existsSync5(targetFolder)) {
7827
- await fs14.rm(targetFolder, { recursive: true, force: true });
7874
+ if (existsSync6(targetFolder)) {
7875
+ await fs15.rm(targetFolder, { recursive: true, force: true });
7828
7876
  }
7829
- await fs14.rename(sourceFolder, targetFolder);
7877
+ await fs15.rename(sourceFolder, targetFolder);
7830
7878
  }
7831
7879
  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 });
7880
+ const targetFolder = path30.join(this.bpModulesPath, `interface_${pascalCase(alias)}`);
7881
+ if (existsSync6(targetFolder)) {
7882
+ await fs15.rm(targetFolder, { recursive: true, force: true });
7835
7883
  }
7836
7884
  }
7837
7885
  async syncInterfaces() {
@@ -7841,7 +7889,7 @@ class InterfaceSync {
7841
7889
  if (interfaces.length === 0) {
7842
7890
  return { synced, errors };
7843
7891
  }
7844
- await fs14.mkdir(this.bpModulesPath, { recursive: true });
7892
+ await fs15.mkdir(this.bpModulesPath, { recursive: true });
7845
7893
  for (const interfaceInfo of interfaces) {
7846
7894
  try {
7847
7895
  const isAlreadySynced = await this.isInterfaceSynced(interfaceInfo);
@@ -7874,26 +7922,26 @@ function isBuiltinAction(name) {
7874
7922
  return !!Object.values(BuiltInActions2).find((x) => x.name === name);
7875
7923
  }
7876
7924
  function getImportPath(from, to) {
7877
- return path32.relative(path32.dirname(from), to).replace(/\.ts$/, "").replace(/\\/g, "/");
7925
+ return path33.relative(path33.dirname(from), to).replace(/\.ts$/, "").replace(/\\/g, "/");
7878
7926
  }
7879
7927
 
7880
7928
  class BotGenerator {
7881
7929
  projectPath;
7882
7930
  outputPath;
7883
7931
  constructor(options) {
7884
- this.projectPath = path32.resolve(options.projectPath);
7885
- this.outputPath = path32.resolve(options.outputPath || path32.join(this.projectPath, ".adk"));
7932
+ this.projectPath = path33.resolve(options.projectPath);
7933
+ this.outputPath = path33.resolve(options.outputPath || path33.join(this.projectPath, ".adk"));
7886
7934
  }
7887
7935
  async listFilesRecursive(rootDir) {
7888
7936
  try {
7889
- if (!existsSync6(rootDir))
7937
+ if (!existsSync7(rootDir))
7890
7938
  return [];
7891
7939
  const result = [];
7892
7940
  const walk = async (dir, relativeBase) => {
7893
- const entries = await fs15.readdir(dir, { withFileTypes: true });
7941
+ const entries = await fs16.readdir(dir, { withFileTypes: true });
7894
7942
  for (const entry of entries) {
7895
- const abs = path32.join(dir, entry.name);
7896
- const rel = path32.join(relativeBase, entry.name);
7943
+ const abs = path33.join(dir, entry.name);
7944
+ const rel = path33.join(relativeBase, entry.name);
7897
7945
  if (entry.isDirectory()) {
7898
7946
  await walk(abs, rel);
7899
7947
  } else {
@@ -7908,20 +7956,20 @@ class BotGenerator {
7908
7956
  }
7909
7957
  }
7910
7958
  async removeEmptyDirectories(rootDir) {
7911
- if (!existsSync6(rootDir))
7959
+ if (!existsSync7(rootDir))
7912
7960
  return;
7913
7961
  const removeIfEmpty = async (dir) => {
7914
- const entries = await fs15.readdir(dir, { withFileTypes: true });
7962
+ const entries = await fs16.readdir(dir, { withFileTypes: true });
7915
7963
  for (const entry of entries) {
7916
7964
  if (entry.isDirectory()) {
7917
- const subdir = path32.join(dir, entry.name);
7965
+ const subdir = path33.join(dir, entry.name);
7918
7966
  await removeIfEmpty(subdir);
7919
7967
  }
7920
7968
  }
7921
- const after = await fs15.readdir(dir);
7969
+ const after = await fs16.readdir(dir);
7922
7970
  if (after.length === 0 && dir !== rootDir) {
7923
7971
  try {
7924
- await fs15.rmdir(dir, { recursive: false });
7972
+ await fs16.rmdir(dir, { recursive: false });
7925
7973
  } catch {}
7926
7974
  }
7927
7975
  };
@@ -7929,7 +7977,7 @@ class BotGenerator {
7929
7977
  }
7930
7978
  async generate() {
7931
7979
  const project = await AgentProject.load(this.projectPath);
7932
- await fs15.mkdir(this.outputPath, { recursive: true });
7980
+ await fs16.mkdir(this.outputPath, { recursive: true });
7933
7981
  await this.generateBotDefinition();
7934
7982
  await this.generateIntegrationsDefinition();
7935
7983
  await this.generateInterfacesDefinition();
@@ -7958,19 +8006,19 @@ class BotGenerator {
7958
8006
  workspaceId: project.agentInfo?.workspaceId
7959
8007
  });
7960
8008
  const integrations = await manager3.loadIntegrations(project.dependencies || {});
7961
- const integrationsDir = path32.join(this.projectPath, ".adk", "integrations");
8009
+ const integrationsDir = path33.join(this.projectPath, ".adk", "integrations");
7962
8010
  const existingIntegrationFiles = await this.listFilesRecursive(integrationsDir);
7963
8011
  let aliases = new Set;
7964
8012
  let files = new Set;
7965
8013
  for (const integration of integrations.integrations) {
7966
8014
  if (integration.definition) {
7967
8015
  const types6 = await generateIntegrationTypes(integration);
7968
- const importPath = `./${path32.join("integrations", types6.names.paths.index).replace(/\\/g, "/")}`;
8016
+ const importPath = `./${path33.join("integrations", types6.names.paths.index).replace(/\\/g, "/")}`;
7969
8017
  aliases.add(`"${integration.alias}": import("${importPath}").${types6.names.typings.index}`);
7970
8018
  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 });
8019
+ const fullPath = path33.join(this.projectPath, ".adk", "integrations", filePath);
8020
+ const dir = path33.dirname(fullPath);
8021
+ await fs16.mkdir(dir, { recursive: true });
7974
8022
  await createFile(fullPath, content);
7975
8023
  files.add(filePath);
7976
8024
  }
@@ -7990,13 +8038,13 @@ class BotGenerator {
7990
8038
  };
7991
8039
  }
7992
8040
  `;
7993
- await createFile(path32.join(this.projectPath, ".adk", "integrations-types.d.ts"), await formatCode(types5));
8041
+ await createFile(path33.join(this.projectPath, ".adk", "integrations-types.d.ts"), await formatCode(types5));
7994
8042
  const staleIntegrationFiles = existingIntegrationFiles.filter((f) => !files.has(f));
7995
8043
  if (staleIntegrationFiles.length > 0) {
7996
8044
  for (const rel of staleIntegrationFiles) {
7997
- const abs = path32.join(integrationsDir, rel);
8045
+ const abs = path33.join(integrationsDir, rel);
7998
8046
  try {
7999
- await fs15.rm(abs, { force: true });
8047
+ await fs16.rm(abs, { force: true });
8000
8048
  } catch {}
8001
8049
  }
8002
8050
  }
@@ -8063,7 +8111,7 @@ class BotGenerator {
8063
8111
  let botStateType = "{}";
8064
8112
  let userStateType = "{}";
8065
8113
  try {
8066
- const configPath = path32.join(project.path, "agent.config.ts");
8114
+ const configPath = path33.join(project.path, "agent.config.ts");
8067
8115
  const configModule = await import(`${configPath}?t=${Date.now()}`);
8068
8116
  const config = configModule.default;
8069
8117
  if (config?.bot?.state) {
@@ -8099,7 +8147,7 @@ declare module "@botpress/runtime/_types/state" {
8099
8147
  export type UserState = ${userStateType};
8100
8148
  }
8101
8149
  `;
8102
- await createFile(path32.join(this.projectPath, ".adk", "runtime.d.ts"), await formatCode(types5));
8150
+ await createFile(path33.join(this.projectPath, ".adk", "runtime.d.ts"), await formatCode(types5));
8103
8151
  }
8104
8152
  async generateInterfacesTypes() {
8105
8153
  const project = await AgentProject.load(this.projectPath);
@@ -8107,7 +8155,7 @@ declare module "@botpress/runtime/_types/state" {
8107
8155
  workspaceId: project.agentInfo?.workspaceId
8108
8156
  });
8109
8157
  const manager3 = new InterfaceManager;
8110
- const interfacesDir = path32.join(this.projectPath, ".adk", "interfaces");
8158
+ const interfacesDir = path33.join(this.projectPath, ".adk", "interfaces");
8111
8159
  const existingInterfaceFiles = await this.listFilesRecursive(interfacesDir);
8112
8160
  const interfaces = await manager3.loadInterfaces(project.dependencies || {}).then((result) => result.interfaces.filter((int) => int.definition).map((x) => x.definition));
8113
8161
  const integrations = await integrationManager.loadIntegrations(project.dependencies || {}).then((result) => result.integrations.filter((int) => int.enabled && int.definition).map((x) => x.definition));
@@ -8116,12 +8164,12 @@ declare module "@botpress/runtime/_types/state" {
8116
8164
  let files = new Set;
8117
8165
  for (const int of interfaces) {
8118
8166
  const types6 = await generateInterfaceTypes(int, integrations);
8119
- imports.add(`import { ${types6.names.typings.index} } from "./${path32.join("interfaces", types6.names.paths.index).replace(/\\/g, "/")}";`);
8167
+ imports.add(`import { ${types6.names.typings.index} } from "./${path33.join("interfaces", types6.names.paths.index).replace(/\\/g, "/")}";`);
8120
8168
  aliases.add(`"${types6.names.name}": ${types6.names.typings.index}`);
8121
8169
  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 });
8170
+ const fullPath = path33.join(this.projectPath, ".adk", "interfaces", filePath);
8171
+ const dir = path33.dirname(fullPath);
8172
+ await fs16.mkdir(dir, { recursive: true });
8125
8173
  await createFile(fullPath, content);
8126
8174
  files.add(filePath);
8127
8175
  }
@@ -8157,14 +8205,14 @@ declare module "@botpress/runtime/_types/state" {
8157
8205
  `)}
8158
8206
  };
8159
8207
  `;
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));
8208
+ await createFile(path33.join(this.projectPath, ".adk", "interfaces.d.ts"), await formatCode(types5));
8209
+ await createFile(path33.join(this.projectPath, ".adk", "interfaces.ts"), await formatCode(consts));
8162
8210
  const staleInterfaceFiles = existingInterfaceFiles.filter((f) => !files.has(f));
8163
8211
  if (staleInterfaceFiles.length > 0) {
8164
8212
  for (const rel of staleInterfaceFiles) {
8165
- const abs = path32.join(interfacesDir, rel);
8213
+ const abs = path33.join(interfacesDir, rel);
8166
8214
  try {
8167
- await fs15.rm(abs, { force: true });
8215
+ await fs16.rm(abs, { force: true });
8168
8216
  } catch {}
8169
8217
  }
8170
8218
  }
@@ -8195,7 +8243,7 @@ declare module "@botpress/runtime/_types/state" {
8195
8243
  `) : ""}
8196
8244
  } as Record<string, IntegrationPackage>;
8197
8245
  `;
8198
- await createFile(path32.join(this.outputPath, "src", "integrations.ts"), content);
8246
+ await createFile(path33.join(this.outputPath, "src", "integrations.ts"), content);
8199
8247
  }
8200
8248
  async generateInterfacesDefinition() {
8201
8249
  const interfaces = BUILTIN_INTERFACES;
@@ -8218,7 +8266,7 @@ declare module "@botpress/runtime/_types/state" {
8218
8266
  `) : ""}
8219
8267
  } as Record<string, InterfacePackage>;
8220
8268
  `;
8221
- await createFile(path32.join(this.outputPath, "src", "interfaces.ts"), await formatCode(content));
8269
+ await createFile(path33.join(this.outputPath, "src", "interfaces.ts"), await formatCode(content));
8222
8270
  }
8223
8271
  async generateBotDefinition() {
8224
8272
  const project = await AgentProject.load(this.projectPath);
@@ -8229,7 +8277,7 @@ declare module "@botpress/runtime/_types/state" {
8229
8277
  const { alias, configurationType, config } = integration;
8230
8278
  const importName = `integration_${getIntegrationAlias(alias)}`;
8231
8279
  imports.push(`import ${importName} from "./bp_modules/${importName}";`);
8232
- const configType = configurationType ? `, configurationType: "${configurationType}"` : "";
8280
+ const configType = configurationType && configurationType !== "default" ? `, configurationType: "${configurationType}"` : "";
8233
8281
  const configData = config && Object.keys(config).length > 0 ? `, configuration: ${JSON.stringify(config)}` : "";
8234
8282
  addIntegrations.push(`bot.addIntegration(${importName}, { alias: "${alias}", enabled: true${configType}${configData} });`);
8235
8283
  }
@@ -8273,7 +8321,7 @@ declare module "@botpress/runtime/_types/state" {
8273
8321
  if (isBuiltinWorkflow2(workflow.definition.name)) {
8274
8322
  continue;
8275
8323
  }
8276
- const workflowPath = path32.join(project.path, workflow.path);
8324
+ const workflowPath = path33.join(project.path, workflow.path);
8277
8325
  const workflowModule = await import(`${workflowPath}?t=${Date.now()}`);
8278
8326
  const workflowInstance = workflowModule.default || workflowModule[workflow.export];
8279
8327
  if (workflowInstance) {
@@ -8511,7 +8559,7 @@ configuration: {
8511
8559
  const fullContent = content + integrationsSection + `
8512
8560
 
8513
8561
  export default bot;`;
8514
- await createFile(path32.join(this.outputPath, "bot.definition.ts"), await formatCode(fullContent));
8562
+ await createFile(path33.join(this.outputPath, "bot.definition.ts"), await formatCode(fullContent));
8515
8563
  }
8516
8564
  async generateBotIndex() {
8517
8565
  const content = dedent`
@@ -8545,7 +8593,7 @@ export default bot;`;
8545
8593
 
8546
8594
  export default bot
8547
8595
  `;
8548
- await createFile(path32.join(this.outputPath, "src", "index.ts"), await formatCode(content));
8596
+ await createFile(path33.join(this.outputPath, "src", "index.ts"), await formatCode(content));
8549
8597
  }
8550
8598
  async generatePackageJson(project) {
8551
8599
  const packageJson = {
@@ -8559,7 +8607,7 @@ export default bot;`;
8559
8607
  typescript: "^5.9.3"
8560
8608
  }
8561
8609
  };
8562
- await createFile(path32.join(this.outputPath, "package.json"), JSON.stringify(packageJson, null, 2));
8610
+ await createFile(path33.join(this.outputPath, "package.json"), JSON.stringify(packageJson, null, 2));
8563
8611
  }
8564
8612
  async generateTsConfig() {
8565
8613
  const tsConfig = {
@@ -8590,7 +8638,7 @@ export default bot;`;
8590
8638
  },
8591
8639
  include: [".botpress/**/*", "src/**/*", "bp_modules/**/*", "./*.ts", "./*.json", "../*.d.ts"]
8592
8640
  };
8593
- await createFile(path32.join(this.outputPath, "tsconfig.json"), JSON.stringify(tsConfig, null, 2));
8641
+ await createFile(path33.join(this.outputPath, "tsconfig.json"), JSON.stringify(tsConfig, null, 2));
8594
8642
  }
8595
8643
  async generateGlobalTypes() {
8596
8644
  const content = dedent`
@@ -8613,42 +8661,42 @@ export default bot;`;
8613
8661
 
8614
8662
  export {};
8615
8663
  `;
8616
- await createFile(path32.join(this.outputPath, "global.d.ts"), await formatCode(content));
8664
+ await createFile(path33.join(this.outputPath, "global.d.ts"), await formatCode(content));
8617
8665
  }
8618
8666
  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 });
8667
+ const assetsPath = path33.join(this.projectPath, "assets");
8668
+ const targetPath = path33.join(this.outputPath, "assets");
8669
+ if (existsSync7(assetsPath)) {
8670
+ await fs16.mkdir(targetPath, { recursive: true });
8623
8671
  await this.copyDirectory(assetsPath, targetPath);
8624
8672
  }
8625
8673
  }
8626
8674
  async copyDirectory(src, dest) {
8627
- const entries = await fs15.readdir(src, { withFileTypes: true });
8675
+ const entries = await fs16.readdir(src, { withFileTypes: true });
8628
8676
  for (const entry of entries) {
8629
- const srcPath = path32.join(src, entry.name);
8630
- const destPath = path32.join(dest, entry.name);
8677
+ const srcPath = path33.join(src, entry.name);
8678
+ const destPath = path33.join(dest, entry.name);
8631
8679
  if (entry.isDirectory()) {
8632
- await fs15.mkdir(destPath, { recursive: true });
8680
+ await fs16.mkdir(destPath, { recursive: true });
8633
8681
  await this.copyDirectory(srcPath, destPath);
8634
8682
  } else {
8635
- await fs15.copyFile(srcPath, destPath);
8683
+ await fs16.copyFile(srcPath, destPath);
8636
8684
  }
8637
8685
  }
8638
8686
  }
8639
8687
  async generateAdkRuntime() {
8640
8688
  const project = new AgentProject(this.projectPath);
8641
8689
  await project.reload();
8642
- const srcDir = path32.join(this.outputPath, "src");
8690
+ const srcDir = path33.join(this.outputPath, "src");
8643
8691
  {
8644
- const dest = path32.join(srcDir, "conversations.ts");
8692
+ const dest = path33.join(srcDir, "conversations.ts");
8645
8693
  const imports = new Map;
8646
8694
  const exports = new Set;
8647
8695
  let index = 1;
8648
8696
  for (const conversation of project.conversations) {
8649
8697
  if (!imports.has(conversation.path)) {
8650
8698
  const name = `conversations_${index++}`;
8651
- const importPath = getImportPath(dest, path32.join(project.path, conversation.path));
8699
+ const importPath = getImportPath(dest, path33.join(project.path, conversation.path));
8652
8700
  imports.set(conversation.path, {
8653
8701
  name,
8654
8702
  statement: `import * as ${name} from "${importPath}";`
@@ -8674,14 +8722,14 @@ export default bot;`;
8674
8722
  await createFile(dest, await formatCode(content2));
8675
8723
  }
8676
8724
  {
8677
- const dest = path32.join(srcDir, "knowledge.ts");
8725
+ const dest = path33.join(srcDir, "knowledge.ts");
8678
8726
  const imports = new Map;
8679
8727
  const exports = new Set;
8680
8728
  let index = 1;
8681
8729
  for (const knowledge of project.knowledge) {
8682
8730
  if (!imports.has(knowledge.path)) {
8683
8731
  const name = `knowledge_${index++}`;
8684
- const importPath = getImportPath(dest, path32.join(project.path, knowledge.path));
8732
+ const importPath = getImportPath(dest, path33.join(project.path, knowledge.path));
8685
8733
  imports.set(knowledge.path, {
8686
8734
  name,
8687
8735
  statement: `import * as ${name} from "${importPath}";`
@@ -8707,7 +8755,7 @@ export default bot;`;
8707
8755
  await createFile(dest, await formatCode(content2));
8708
8756
  }
8709
8757
  {
8710
- const dest = path32.join(srcDir, "triggers.ts");
8758
+ const dest = path33.join(srcDir, "triggers.ts");
8711
8759
  const { transforms: transforms4 } = await import("@botpress/sdk");
8712
8760
  const imports = new Map;
8713
8761
  const exports = new Set;
@@ -8716,7 +8764,7 @@ export default bot;`;
8716
8764
  for (const trigger of project.triggers) {
8717
8765
  if (!imports.has(trigger.path)) {
8718
8766
  const name = `triggers_${index++}`;
8719
- const importPath = getImportPath(dest, path32.join(project.path, trigger.path));
8767
+ const importPath = getImportPath(dest, path33.join(project.path, trigger.path));
8720
8768
  imports.set(trigger.path, {
8721
8769
  name,
8722
8770
  statement: `import * as ${name} from "${importPath}";`
@@ -8726,7 +8774,7 @@ export default bot;`;
8726
8774
  }
8727
8775
  for (const trigger of project.triggers) {
8728
8776
  try {
8729
- const absolutePath = path32.join(project.path, trigger.path);
8777
+ const absolutePath = path33.join(project.path, trigger.path);
8730
8778
  const triggerModule = await import(`${absolutePath}?t=${Date.now()}`);
8731
8779
  const triggerInstance = triggerModule[trigger.export] || triggerModule.default;
8732
8780
  if (triggerInstance && triggerInstance.payload) {
@@ -8769,7 +8817,7 @@ export default bot;`;
8769
8817
  await createFile(dest, await formatCode(content2));
8770
8818
  }
8771
8819
  {
8772
- const dest = path32.join(srcDir, "workflows.ts");
8820
+ const dest = path33.join(srcDir, "workflows.ts");
8773
8821
  const imports = new Map;
8774
8822
  const exports = new Set;
8775
8823
  let index = 1;
@@ -8779,7 +8827,7 @@ export default bot;`;
8779
8827
  }
8780
8828
  if (!imports.has(workflow.path)) {
8781
8829
  const name = `workflows_${index++}`;
8782
- const importPath = getImportPath(dest, path32.join(project.path, workflow.path));
8830
+ const importPath = getImportPath(dest, path33.join(project.path, workflow.path));
8783
8831
  const statement = `import * as ${name} from "${importPath}";`;
8784
8832
  imports.set(workflow.path, {
8785
8833
  name,
@@ -8813,7 +8861,7 @@ export default bot;`;
8813
8861
  await createFile(dest, await formatCode(content2));
8814
8862
  }
8815
8863
  {
8816
- const dest = path32.join(srcDir, "actions.ts");
8864
+ const dest = path33.join(srcDir, "actions.ts");
8817
8865
  const imports = new Map;
8818
8866
  const exports = new Set;
8819
8867
  let index = 1;
@@ -8823,7 +8871,7 @@ export default bot;`;
8823
8871
  }
8824
8872
  if (!imports.has(action.path)) {
8825
8873
  const name = `actions_${index++}`;
8826
- const importPath = getImportPath(dest, path32.join(project.path, action.path));
8874
+ const importPath = getImportPath(dest, path33.join(project.path, action.path));
8827
8875
  imports.set(action.path, {
8828
8876
  name,
8829
8877
  statement: `import * as ${name} from "${importPath}";`
@@ -8849,14 +8897,14 @@ export default bot;`;
8849
8897
  await createFile(dest, await formatCode(content2));
8850
8898
  }
8851
8899
  {
8852
- const dest = path32.join(srcDir, "tables.ts");
8900
+ const dest = path33.join(srcDir, "tables.ts");
8853
8901
  const imports = new Map;
8854
8902
  const exports = new Set;
8855
8903
  let index = 1;
8856
8904
  for (const table of project.tables) {
8857
8905
  if (!imports.has(table.path)) {
8858
8906
  const name = `tables_${index++}`;
8859
- const importPath = getImportPath(dest, path32.join(project.path, table.path));
8907
+ const importPath = getImportPath(dest, path33.join(project.path, table.path));
8860
8908
  imports.set(table.path, {
8861
8909
  name,
8862
8910
  statement: `import * as ${name} from "${importPath}";`
@@ -8882,8 +8930,8 @@ export default bot;`;
8882
8930
  await createFile(dest, await formatCode(content2));
8883
8931
  }
8884
8932
  {
8885
- const dest = path32.join(srcDir, "config.ts");
8886
- const importPath = getImportPath(dest, path32.join(project.path, "agent.config.ts"));
8933
+ const dest = path33.join(srcDir, "config.ts");
8934
+ const importPath = getImportPath(dest, path33.join(project.path, "agent.config.ts"));
8887
8935
  const content2 = `
8888
8936
  ////////////////////////////////////////////////////////
8889
8937
  // DO NOT EDIT THIS FILE DIRECTLY
@@ -8949,13 +8997,13 @@ export default bot;`;
8949
8997
  handlers.actions.setup(bot);
8950
8998
  }
8951
8999
  `;
8952
- await createFile(path32.join(this.outputPath, "src", "adk-runtime.ts"), await formatCode(content));
9000
+ await createFile(path33.join(this.outputPath, "src", "adk-runtime.ts"), await formatCode(content));
8953
9001
  }
8954
9002
  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));
9003
+ const assetsRuntimePath = path33.join(this.projectPath, ".adk", "assets-runtime.ts");
9004
+ if (existsSync7(assetsRuntimePath)) {
9005
+ const content = await fs16.readFile(assetsRuntimePath, "utf-8");
9006
+ await createFile(path33.join(this.outputPath, "src", "assets-runtime.ts"), await formatCode(content));
8959
9007
  }
8960
9008
  }
8961
9009
  }
@@ -8964,9 +9012,11 @@ async function generateBotProject(options) {
8964
9012
  await generator.generate();
8965
9013
  await generator.generateAdkRuntime();
8966
9014
  await generator.copyAssetsRuntime();
8967
- const devIdManager = new DevIdManager(options.projectPath, options.outputPath || path32.join(options.projectPath, ".adk", "bot"));
9015
+ const botPath = options.outputPath || path33.join(options.projectPath, ".adk", "bot");
9016
+ await linkSdk(options.projectPath, botPath);
9017
+ const devIdManager = new DevIdManager(options.projectPath, options.outputPath || path33.join(options.projectPath, ".adk", "bot"));
8968
9018
  await devIdManager.restoreDevId();
8969
- const integrationSync = new IntegrationSync(options.projectPath, options.outputPath || path32.join(options.projectPath, ".adk", "bot"));
9019
+ const integrationSync = new IntegrationSync(options.projectPath, options.outputPath || path33.join(options.projectPath, ".adk", "bot"));
8970
9020
  const integrationSyncResult = await integrationSync.syncIntegrations();
8971
9021
  if (integrationSyncResult.errors.length > 0) {
8972
9022
  console.warn(`⚠️ Some integrations failed to sync:`);
@@ -8974,7 +9024,7 @@ async function generateBotProject(options) {
8974
9024
  console.warn(` - ${alias}: ${error}`);
8975
9025
  });
8976
9026
  }
8977
- const interfaceSync = new InterfaceSync(options.projectPath, options.outputPath || path32.join(options.projectPath, ".adk", "bot"));
9027
+ const interfaceSync = new InterfaceSync(options.projectPath, options.outputPath || path33.join(options.projectPath, ".adk", "bot"));
8978
9028
  const interfaceSyncResult = await interfaceSync.syncInterfaces();
8979
9029
  if (interfaceSyncResult.errors.length > 0) {
8980
9030
  console.warn(`⚠️ Some interfaces failed to sync:`);
@@ -9483,8 +9533,8 @@ class TableManager {
9483
9533
  }
9484
9534
  // src/knowledge/manager.ts
9485
9535
  import crypto4 from "crypto";
9486
- import path33 from "path";
9487
- import fs16 from "fs/promises";
9536
+ import path34 from "path";
9537
+ import fs17 from "fs/promises";
9488
9538
  import { glob } from "glob";
9489
9539
  import { Client as Client14 } from "@botpress/client";
9490
9540
  import { DataSource } from "@botpress/runtime";
@@ -9933,15 +9983,15 @@ class KnowledgeManager {
9933
9983
  }
9934
9984
  async scanLocalFileHashes(directoryPath, filterFn) {
9935
9985
  const projectDir = this.project.path;
9936
- const directory = path33.resolve(projectDir, directoryPath);
9986
+ const directory = path34.resolve(projectDir, directoryPath);
9937
9987
  if (this.fileHashCache.has(directory)) {
9938
9988
  return this.fileHashCache.get(directory);
9939
9989
  }
9940
9990
  const files = glob.sync(directory + "/**/*.*", { absolute: true, nodir: true }).filter((file) => !filterFn || filterFn(file));
9941
9991
  const hashes = {};
9942
9992
  for (const file of files) {
9943
- const relPath = path33.relative(directory, file);
9944
- const content = await fs16.readFile(file);
9993
+ const relPath = path34.relative(directory, file);
9994
+ const content = await fs17.readFile(file);
9945
9995
  hashes[relPath] = crypto4.createHash("sha256").update(content).digest("hex");
9946
9996
  }
9947
9997
  this.fileHashCache.set(directory, hashes);
@@ -10048,7 +10098,7 @@ class KnowledgeManager {
10048
10098
  }
10049
10099
  async syncDirectorySource(client, kbName, kbId, dsId, directoryPath, filterFn, force) {
10050
10100
  const projectDir = this.project.path;
10051
- const directory = path33.resolve(projectDir, directoryPath);
10101
+ const directory = path34.resolve(projectDir, directoryPath);
10052
10102
  if (!directory.startsWith(projectDir)) {
10053
10103
  throw new Error("Directory path must be within the agent's directory");
10054
10104
  }
@@ -10070,8 +10120,8 @@ class KnowledgeManager {
10070
10120
  return true;
10071
10121
  }).map((f) => ({
10072
10122
  abs: f,
10073
- rel: path33.relative(directory, f),
10074
- name: path33.basename(f)
10123
+ rel: path34.relative(directory, f),
10124
+ name: path34.basename(f)
10075
10125
  }));
10076
10126
  console.log(` Found ${allFiles.length} files in ${directoryPath}`);
10077
10127
  const cachedHashes = await this.scanLocalFileHashes(directoryPath, filterFn);
@@ -10145,7 +10195,7 @@ class KnowledgeManager {
10145
10195
  }
10146
10196
  async upsertFile(client, local, dsId, tags, force, cachedHash) {
10147
10197
  const key = `data_source://document/${dsId}/${local.rel}`;
10148
- const content = await fs16.readFile(local.abs);
10198
+ const content = await fs17.readFile(local.abs);
10149
10199
  const hash = cachedHash ?? crypto4.createHash("sha256").update(content).digest("hex");
10150
10200
  try {
10151
10201
  const { file } = await client.getFile({ id: key });
@@ -10153,7 +10203,7 @@ class KnowledgeManager {
10153
10203
  return null;
10154
10204
  }
10155
10205
  } catch {}
10156
- const title = path33.basename(local.name, path33.extname(local.name));
10206
+ const title = path34.basename(local.name, path34.extname(local.name));
10157
10207
  const metadata = {
10158
10208
  hash,
10159
10209
  dsId,
@@ -10281,7 +10331,7 @@ class KBSyncFormatter {
10281
10331
  import { watch as watch2, readdirSync as readdirSync2 } from "fs";
10282
10332
  import { EventEmitter as EventEmitter3 } from "events";
10283
10333
  import { join as join8, relative as relative3 } from "path";
10284
- import { existsSync as existsSync7 } from "fs";
10334
+ import { existsSync as existsSync8 } from "fs";
10285
10335
 
10286
10336
  class FileWatcher2 extends EventEmitter3 {
10287
10337
  projectPath;
@@ -10299,12 +10349,12 @@ class FileWatcher2 extends EventEmitter3 {
10299
10349
  const rootFiles = ["package.json", "agent.json", "agent.config.ts"];
10300
10350
  for (const file of rootFiles) {
10301
10351
  const filePath = join8(this.projectPath, file);
10302
- if (existsSync7(filePath)) {
10352
+ if (existsSync8(filePath)) {
10303
10353
  this.watchFile(filePath);
10304
10354
  }
10305
10355
  }
10306
10356
  const srcPath = join8(this.projectPath, "src");
10307
- if (existsSync7(srcPath)) {
10357
+ if (existsSync8(srcPath)) {
10308
10358
  this.initializeDirectoryState(srcPath);
10309
10359
  this.watchDirectory(srcPath);
10310
10360
  }
@@ -10353,7 +10403,7 @@ class FileWatcher2 extends EventEmitter3 {
10353
10403
  }
10354
10404
  }
10355
10405
  handleFileChange(filePath) {
10356
- const fileExists = existsSync7(filePath);
10406
+ const fileExists = existsSync8(filePath);
10357
10407
  const previousState = this.fileStates.get(filePath);
10358
10408
  let changeType;
10359
10409
  if (!fileExists && previousState !== undefined) {
@@ -10393,7 +10443,7 @@ class FileWatcher2 extends EventEmitter3 {
10393
10443
  this.emit("change", event);
10394
10444
  }
10395
10445
  updateFileState(filePath) {
10396
- if (existsSync7(filePath)) {
10446
+ if (existsSync8(filePath)) {
10397
10447
  this.fileStates.set(filePath, Date.now());
10398
10448
  }
10399
10449
  }
@@ -10418,7 +10468,7 @@ class FileWatcher2 extends EventEmitter3 {
10418
10468
  }
10419
10469
  // src/preflight/checker.ts
10420
10470
  import { Client as Client15 } from "@botpress/client";
10421
- import path34 from "path";
10471
+ import path35 from "path";
10422
10472
 
10423
10473
  // src/preflight/types.ts
10424
10474
  function hasIntegrationChanges(integrations) {
@@ -10780,16 +10830,16 @@ class PreflightChecker {
10780
10830
  options?.onProgress?.("Regenerating bot project...");
10781
10831
  await generateBotProject({
10782
10832
  projectPath: this.projectPath,
10783
- outputPath: path34.join(this.projectPath, ".adk", "bot")
10833
+ outputPath: path35.join(this.projectPath, ".adk", "bot")
10784
10834
  });
10785
10835
  options?.onSuccess?.("Bot project regenerated");
10786
10836
  }
10787
10837
  }
10788
10838
  // src/runner/script-runner.ts
10789
10839
  import dedent2 from "dedent";
10790
- import { existsSync as existsSync8 } from "fs";
10791
- import fs17 from "fs/promises";
10792
- import path35 from "path";
10840
+ import { existsSync as existsSync9 } from "fs";
10841
+ import fs18 from "fs/promises";
10842
+ import path36 from "path";
10793
10843
  import { spawn } from "child_process";
10794
10844
  init_utils();
10795
10845
  class ScriptRunner {
@@ -10798,7 +10848,7 @@ class ScriptRunner {
10798
10848
  prod;
10799
10849
  credentials;
10800
10850
  constructor(options) {
10801
- this.projectPath = path35.resolve(options.projectPath);
10851
+ this.projectPath = path36.resolve(options.projectPath);
10802
10852
  this.forceRegenerate = options.forceRegenerate ?? false;
10803
10853
  this.prod = options.prod ?? false;
10804
10854
  this.credentials = options.credentials;
@@ -10807,10 +10857,10 @@ class ScriptRunner {
10807
10857
  const project = await AgentProject.load(this.projectPath, {
10808
10858
  adkCommand: "adk-build"
10809
10859
  });
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);
10860
+ const botPath = path36.join(this.projectPath, ".adk", "bot");
10861
+ const runnerPath = path36.join(botPath, "src", "script-runner.ts");
10862
+ const botpressTypesPath = path36.join(botPath, ".botpress", "implementation", "index.ts");
10863
+ const needsRegenerate = this.forceRegenerate || !existsSync9(runnerPath) || !existsSync9(botpressTypesPath);
10814
10864
  if (needsRegenerate) {
10815
10865
  try {
10816
10866
  await generateAssetsTypes(project.path);
@@ -10894,12 +10944,12 @@ class ScriptRunner {
10894
10944
 
10895
10945
  runScript()
10896
10946
  `;
10897
- await fs17.writeFile(path35.join(botPath, "src", "script-runner.ts"), await formatCode(content), "utf-8");
10947
+ await fs18.writeFile(path36.join(botPath, "src", "script-runner.ts"), await formatCode(content), "utf-8");
10898
10948
  }
10899
10949
  async run(scriptPath, options = {}) {
10900
10950
  const { botPath, runnerPath, project } = await this.prepare();
10901
- const absoluteScriptPath = path35.isAbsolute(scriptPath) ? scriptPath : path35.resolve(this.projectPath, scriptPath);
10902
- if (!existsSync8(absoluteScriptPath)) {
10951
+ const absoluteScriptPath = path36.isAbsolute(scriptPath) ? scriptPath : path36.resolve(this.projectPath, scriptPath);
10952
+ if (!existsSync9(absoluteScriptPath)) {
10903
10953
  throw new Error(`Script not found: ${absoluteScriptPath}`);
10904
10954
  }
10905
10955
  const botId = this.prod ? project.agentInfo?.botId : project.agentInfo?.devId || project.agentInfo?.botId;
@@ -11010,5 +11060,5 @@ export {
11010
11060
  AgentProject
11011
11061
  };
11012
11062
 
11013
- //# debugId=4A3ECF72EBA6C21464756E2164756E21
11063
+ //# debugId=04C11AF687D138E464756E2164756E21
11014
11064
  //# sourceMappingURL=index.js.map