@botpress/adk 1.19.0-beta.12 → 1.19.0-beta.13

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
@@ -944,7 +944,7 @@ class CredentialsManager {
944
944
  await this.writeCredentials(store);
945
945
  }
946
946
  async getActiveCredentials() {
947
- const profileName = this.profileOverride || process.env.ADK_PROFILE;
947
+ const profileName = this.profileOverride;
948
948
  const credentials = await this.getCredentials(profileName);
949
949
  if (!credentials) {
950
950
  const displayName = profileName || "default";
@@ -976,7 +976,7 @@ class CredentialsManager {
976
976
  });
977
977
  const agentApiUrl = agentInfo.apiUrl;
978
978
  let baseCredentials;
979
- const hasExplicitProfile = !!(this.profileOverride || process.env.ADK_PROFILE);
979
+ const hasExplicitProfile = !!this.profileOverride;
980
980
  if (hasExplicitProfile) {
981
981
  baseCredentials = await this.getActiveCredentials();
982
982
  } else {
@@ -1766,6 +1766,8 @@ function normalize(value) {
1766
1766
  var init_search_ranking = () => {};
1767
1767
 
1768
1768
  // src/integrations/manager.ts
1769
+ import { Client as Client3 } from "@botpress/client";
1770
+
1769
1771
  class IntegrationManager {
1770
1772
  cache;
1771
1773
  options;
@@ -1776,15 +1778,33 @@ class IntegrationManager {
1776
1778
  }
1777
1779
  async getClient() {
1778
1780
  if (!this.client) {
1779
- this.client = await getProjectClient({
1780
- project: this.options.project,
1781
- credentials: this.options.credentials,
1782
- apiUrl: this.options.apiUrl,
1783
- workspaceId: this.options.workspaceId,
1784
- headers: {
1785
- "x-multiple-integrations": "true"
1786
- }
1787
- });
1781
+ const hasProjectScope = !!(this.options.project || this.options.workspaceId);
1782
+ if (hasProjectScope) {
1783
+ this.client = await getProjectClient({
1784
+ project: this.options.project,
1785
+ credentials: this.options.credentials,
1786
+ apiUrl: this.options.apiUrl,
1787
+ workspaceId: this.options.workspaceId,
1788
+ headers: {
1789
+ "x-multiple-integrations": "true"
1790
+ }
1791
+ });
1792
+ } else if (this.options.credentials) {
1793
+ this.client = new Client3({
1794
+ token: this.options.credentials.token,
1795
+ apiUrl: this.options.apiUrl || this.options.credentials.apiUrl,
1796
+ ...this.options.credentials.workspaceId ? { workspaceId: this.options.credentials.workspaceId } : {},
1797
+ headers: {
1798
+ "x-multiple-integrations": "true"
1799
+ }
1800
+ });
1801
+ } else {
1802
+ this.client = await getProjectClient({
1803
+ headers: {
1804
+ "x-multiple-integrations": "true"
1805
+ }
1806
+ });
1807
+ }
1788
1808
  }
1789
1809
  return this.client;
1790
1810
  }
@@ -2157,11 +2177,13 @@ class AssetsManager {
2157
2177
  assetsPath;
2158
2178
  client;
2159
2179
  botId;
2180
+ credentials;
2160
2181
  cacheManager;
2161
2182
  constructor(options) {
2162
2183
  this.projectPath = options.projectPath;
2163
2184
  this.assetsPath = path9.join(this.projectPath, "assets");
2164
2185
  this.botId = options.botId;
2186
+ this.credentials = options.credentials;
2165
2187
  this.cacheManager = new AssetsCacheManager(this.projectPath);
2166
2188
  }
2167
2189
  async getClient() {
@@ -2176,6 +2198,7 @@ class AssetsManager {
2176
2198
  }
2177
2199
  this.client = await getProjectClient({
2178
2200
  project: { path: this.projectPath },
2201
+ credentials: this.credentials,
2179
2202
  botId: this.botId,
2180
2203
  headers: {
2181
2204
  "x-multiple-integrations": "true"
@@ -2633,171 +2656,6 @@ class IntegrationCache {
2633
2656
  }
2634
2657
  var init_cache2 = () => {};
2635
2658
 
2636
- // src/integrations/hub-cache.ts
2637
- import { Client as Client3 } from "@botpress/client";
2638
- import * as fs10 from "fs/promises";
2639
- import * as path11 from "path";
2640
- import * as os7 from "os";
2641
- var HubCache;
2642
- var init_hub_cache = __esm(() => {
2643
- init_src();
2644
- init_auth();
2645
- HubCache = class HubCache {
2646
- static CACHE_FILE = "botpress-hub-cache.json";
2647
- static CACHE_DIR = path11.join(os7.homedir(), ".adk", "cache");
2648
- static CACHE_PATH = path11.join(HubCache.CACHE_DIR, HubCache.CACHE_FILE);
2649
- static CACHE_DURATION = 30 * 60 * 1000;
2650
- client;
2651
- constructor() {}
2652
- async getClient() {
2653
- if (!this.client) {
2654
- const credentials = await auth.getActiveCredentials();
2655
- if (!credentials.workspaceId) {
2656
- throw new AdkError({
2657
- code: "WORKSPACE_ID_MISSING",
2658
- message: 'No workspace ID found in current profile. Please login again with "adk login"',
2659
- expected: true,
2660
- suggestion: 'Please login again with "adk login".'
2661
- });
2662
- }
2663
- this.client = new Client3({
2664
- token: credentials.token,
2665
- apiUrl: credentials.apiUrl,
2666
- workspaceId: credentials.workspaceId,
2667
- headers: {
2668
- "x-multiple-integrations": "true"
2669
- }
2670
- });
2671
- }
2672
- return this.client;
2673
- }
2674
- async ensureCacheDir() {
2675
- try {
2676
- await fs10.mkdir(HubCache.CACHE_DIR, { recursive: true });
2677
- } catch {}
2678
- }
2679
- async loadCache() {
2680
- try {
2681
- const data = await fs10.readFile(HubCache.CACHE_PATH, "utf-8");
2682
- return JSON.parse(data);
2683
- } catch {
2684
- return null;
2685
- }
2686
- }
2687
- async saveCache(data) {
2688
- await this.ensureCacheDir();
2689
- await fs10.writeFile(HubCache.CACHE_PATH, JSON.stringify(data, null, 2));
2690
- }
2691
- async needsRefresh() {
2692
- const cache2 = await this.loadCache();
2693
- if (!cache2)
2694
- return true;
2695
- const lastUpdated = new Date(cache2.lastUpdated);
2696
- const now = new Date;
2697
- const diff = now.getTime() - lastUpdated.getTime();
2698
- return diff > HubCache.CACHE_DURATION;
2699
- }
2700
- async refresh(force = false) {
2701
- if (!force && !await this.needsRefresh()) {
2702
- return;
2703
- }
2704
- const client = await this.getClient();
2705
- const cache2 = await this.loadCache();
2706
- const latestByName = new Map;
2707
- if (cache2) {
2708
- for (const entry of cache2.integrations) {
2709
- latestByName.set(entry.name, entry);
2710
- }
2711
- }
2712
- try {
2713
- for await (const integration of client.list.publicIntegrations({
2714
- sortBy: "updatedAt",
2715
- direction: "desc"
2716
- })) {
2717
- const existing = latestByName.get(integration.name);
2718
- if (existing && integration.id === existing.id && integration.updatedAt === existing.updatedAt) {
2719
- break;
2720
- }
2721
- if (!existing || integration.version.localeCompare(existing.version, undefined, {
2722
- numeric: true
2723
- }) > 0) {
2724
- latestByName.set(integration.name, {
2725
- id: integration.id,
2726
- name: integration.name,
2727
- version: integration.version,
2728
- updatedAt: integration.updatedAt,
2729
- createdAt: integration.createdAt,
2730
- title: integration.title,
2731
- description: integration.description,
2732
- iconUrl: integration.iconUrl,
2733
- public: integration.public,
2734
- visibility: integration.visibility,
2735
- ownerWorkspace: integration.ownerWorkspace ? {
2736
- id: integration.ownerWorkspace.id,
2737
- name: integration.ownerWorkspace.name
2738
- } : undefined,
2739
- verificationStatus: integration.verificationStatus
2740
- });
2741
- }
2742
- }
2743
- const integrations = Array.from(latestByName.values()).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
2744
- const newCache = {
2745
- lastUpdated: new Date().toISOString(),
2746
- integrations
2747
- };
2748
- await this.saveCache(newCache);
2749
- } catch (error) {
2750
- throw new AdkError({
2751
- code: "HUB_CACHE_REFRESH_FAILED",
2752
- message: `Failed to refresh hub cache: ${error instanceof Error ? error.message : String(error)}`,
2753
- expected: true,
2754
- cause: error
2755
- });
2756
- }
2757
- }
2758
- async getAllIntegrations() {
2759
- await this.refresh();
2760
- const cache2 = await this.loadCache();
2761
- return cache2?.integrations || [];
2762
- }
2763
- async searchIntegrations(query) {
2764
- const integrations = await this.getAllIntegrations();
2765
- const lowerQuery = query.toLowerCase();
2766
- return integrations.filter((integration) => integration.name.toLowerCase().includes(lowerQuery) || integration.title?.toLowerCase().includes(lowerQuery) || integration.description?.toLowerCase().includes(lowerQuery));
2767
- }
2768
- async getIntegrationByName(name) {
2769
- const integrations = await this.getAllIntegrations();
2770
- return integrations.find((i) => i.name === name) || null;
2771
- }
2772
- async getIntegrationVersions(name) {
2773
- const integration = await this.getIntegrationByName(name);
2774
- return integration ? [integration.version] : [];
2775
- }
2776
- async getStats() {
2777
- const cache2 = await this.loadCache();
2778
- try {
2779
- const stats = await fs10.stat(HubCache.CACHE_PATH);
2780
- return {
2781
- lastUpdated: cache2 ? new Date(cache2.lastUpdated) : null,
2782
- integrationCount: cache2?.integrations.length || 0,
2783
- cacheSize: stats.size
2784
- };
2785
- } catch {
2786
- return {
2787
- lastUpdated: null,
2788
- integrationCount: 0,
2789
- cacheSize: 0
2790
- };
2791
- }
2792
- }
2793
- async clear() {
2794
- try {
2795
- await fs10.unlink(HubCache.CACHE_PATH);
2796
- } catch {}
2797
- }
2798
- };
2799
- });
2800
-
2801
2659
  // src/integrations/config-utils.ts
2802
2660
  function mergeIntegrationConfig(current, desired) {
2803
2661
  if (desired === undefined) {
@@ -2896,14 +2754,13 @@ var init_integrations = __esm(() => {
2896
2754
  init_dependencies_parser();
2897
2755
  init_cache2();
2898
2756
  init_enhanced_cache();
2899
- init_hub_cache();
2900
2757
  init_config_utils();
2901
2758
  });
2902
2759
 
2903
2760
  // src/interfaces/enhanced-cache.ts
2904
- import fs11 from "fs/promises";
2905
- import path12 from "path";
2906
- import os8 from "os";
2761
+ import fs10 from "fs/promises";
2762
+ import path11 from "path";
2763
+ import os7 from "os";
2907
2764
 
2908
2765
  class EnhancedInterfaceCache {
2909
2766
  cacheDir;
@@ -2912,21 +2769,21 @@ class EnhancedInterfaceCache {
2912
2769
  noCache;
2913
2770
  constructor(noCache = false) {
2914
2771
  this.noCache = noCache;
2915
- this.cacheDir = path12.join(os8.homedir(), ".adk", "cache", "interfaces");
2916
- this.resolutionsDir = path12.join(this.cacheDir, "resolutions");
2917
- this.definitionsDir = path12.join(this.cacheDir, "definitions");
2772
+ this.cacheDir = path11.join(os7.homedir(), ".adk", "cache", "interfaces");
2773
+ this.resolutionsDir = path11.join(this.cacheDir, "resolutions");
2774
+ this.definitionsDir = path11.join(this.cacheDir, "definitions");
2918
2775
  }
2919
2776
  async ensureCacheDirs() {
2920
- await fs11.mkdir(this.resolutionsDir, { recursive: true });
2921
- await fs11.mkdir(this.definitionsDir, { recursive: true });
2777
+ await fs10.mkdir(this.resolutionsDir, { recursive: true });
2778
+ await fs10.mkdir(this.definitionsDir, { recursive: true });
2922
2779
  }
2923
2780
  async getResolution(name, version, workspace) {
2924
2781
  if (this.noCache)
2925
2782
  return null;
2926
2783
  try {
2927
2784
  const key = this.getResolutionKey(name, version, workspace);
2928
- const cachePath = path12.join(this.resolutionsDir, `${key}.json`);
2929
- const data = await fs11.readFile(cachePath, "utf-8");
2785
+ const cachePath = path11.join(this.resolutionsDir, `${key}.json`);
2786
+ const data = await fs10.readFile(cachePath, "utf-8");
2930
2787
  const resolution = JSON.parse(data);
2931
2788
  const cachedAt = new Date(resolution.cachedAt);
2932
2789
  const ageMinutes = (Date.now() - cachedAt.getTime()) / (1000 * 60);
@@ -2940,21 +2797,21 @@ class EnhancedInterfaceCache {
2940
2797
  async setResolution(name, version, workspace, interfaceId, updatedAt) {
2941
2798
  await this.ensureCacheDirs();
2942
2799
  const key = this.getResolutionKey(name, version, workspace);
2943
- const cachePath = path12.join(this.resolutionsDir, `${key}.json`);
2800
+ const cachePath = path11.join(this.resolutionsDir, `${key}.json`);
2944
2801
  const resolution = {
2945
2802
  interfaceId,
2946
2803
  updatedAt,
2947
2804
  cachedAt: new Date().toISOString()
2948
2805
  };
2949
- await fs11.writeFile(cachePath, JSON.stringify(resolution));
2806
+ await fs10.writeFile(cachePath, JSON.stringify(resolution));
2950
2807
  }
2951
2808
  async getDefinition(interfaceId, updatedAt) {
2952
2809
  if (this.noCache)
2953
2810
  return null;
2954
2811
  try {
2955
2812
  const key = this.getDefinitionKey(interfaceId, updatedAt);
2956
- const cachePath = path12.join(this.definitionsDir, `${key}.json`);
2957
- const data = await fs11.readFile(cachePath, "utf-8");
2813
+ const cachePath = path11.join(this.definitionsDir, `${key}.json`);
2814
+ const data = await fs10.readFile(cachePath, "utf-8");
2958
2815
  const cached = JSON.parse(data);
2959
2816
  return cached.definition;
2960
2817
  } catch {
@@ -2964,28 +2821,28 @@ class EnhancedInterfaceCache {
2964
2821
  async setDefinition(interfaceId, updatedAt, definition) {
2965
2822
  await this.ensureCacheDirs();
2966
2823
  const key = this.getDefinitionKey(interfaceId, updatedAt);
2967
- const cachePath = path12.join(this.definitionsDir, `${key}.json`);
2824
+ const cachePath = path11.join(this.definitionsDir, `${key}.json`);
2968
2825
  const cached = {
2969
2826
  definition,
2970
2827
  cachedAt: new Date().toISOString()
2971
2828
  };
2972
- await fs11.writeFile(cachePath, JSON.stringify(cached));
2829
+ await fs10.writeFile(cachePath, JSON.stringify(cached));
2973
2830
  }
2974
2831
  async clear() {
2975
2832
  try {
2976
- const resolutionFiles = await fs11.readdir(this.resolutionsDir);
2977
- await Promise.all(resolutionFiles.map((f) => fs11.unlink(path12.join(this.resolutionsDir, f))));
2978
- const definitionFiles = await fs11.readdir(this.definitionsDir);
2979
- await Promise.all(definitionFiles.map((f) => fs11.unlink(path12.join(this.definitionsDir, f))));
2833
+ const resolutionFiles = await fs10.readdir(this.resolutionsDir);
2834
+ await Promise.all(resolutionFiles.map((f) => fs10.unlink(path11.join(this.resolutionsDir, f))));
2835
+ const definitionFiles = await fs10.readdir(this.definitionsDir);
2836
+ await Promise.all(definitionFiles.map((f) => fs10.unlink(path11.join(this.definitionsDir, f))));
2980
2837
  } catch {}
2981
2838
  }
2982
2839
  async getStats() {
2983
2840
  const getDirectoryStats = async (dir) => {
2984
2841
  try {
2985
- const files = await fs11.readdir(dir);
2842
+ const files = await fs10.readdir(dir);
2986
2843
  let totalSize = 0;
2987
2844
  for (const file of files) {
2988
- const stats = await fs11.stat(path12.join(dir, file));
2845
+ const stats = await fs10.stat(path11.join(dir, file));
2989
2846
  totalSize += stats.size;
2990
2847
  }
2991
2848
  return { count: files.length, sizeBytes: totalSize };
@@ -3382,7 +3239,7 @@ var init_component_files = __esm(() => {
3382
3239
  // src/agent-project/component-source-resolver.ts
3383
3240
  import { Project, SyntaxKind } from "ts-morph";
3384
3241
  import { readFileSync } from "fs";
3385
- import * as path13 from "path";
3242
+ import * as path12 from "path";
3386
3243
  function resolveComponentSources(absolutePath) {
3387
3244
  const project = new Project({ useInMemoryFileSystem: false, skipAddingFilesFromTsConfig: true });
3388
3245
  const sourceFile = project.createSourceFile(absolutePath, readFileSync(absolutePath, "utf-8"), { overwrite: true });
@@ -3395,12 +3252,12 @@ function resolveComponentSources(absolutePath) {
3395
3252
  }
3396
3253
  function collectBpTsxImports(sourceFile, absolutePath) {
3397
3254
  const imports = new Map;
3398
- const dir = path13.dirname(absolutePath);
3255
+ const dir = path12.dirname(absolutePath);
3399
3256
  for (const decl of sourceFile.getImportDeclarations()) {
3400
3257
  const specifier = decl.getModuleSpecifierValue();
3401
3258
  if (!specifier.endsWith(BP_TSX_SUFFIX))
3402
3259
  continue;
3403
- const resolved = path13.resolve(dir, specifier);
3260
+ const resolved = path12.resolve(dir, specifier);
3404
3261
  const defaultImport = decl.getDefaultImport();
3405
3262
  if (defaultImport) {
3406
3263
  imports.set(defaultImport.getText(), resolved);
@@ -3526,8 +3383,8 @@ import { BuiltInActions, BuiltInWorkflows, Errors as Errors2, Primitives as Prim
3526
3383
  import { Autonomous } from "@botpress/runtime";
3527
3384
  import createDebug2 from "debug";
3528
3385
  import { createRequire as createRequire2 } from "module";
3529
- import fs12 from "fs/promises";
3530
- import path14 from "path";
3386
+ import fs11 from "fs/promises";
3387
+ import path13 from "path";
3531
3388
  function getToolDefinition(value) {
3532
3389
  if (typeof value !== "object" || value === null) {
3533
3390
  return;
@@ -3586,7 +3443,7 @@ var init_agent_project = __esm(() => {
3586
3443
  _tools = [];
3587
3444
  constructor(projectPath, options = {}) {
3588
3445
  this._options = options;
3589
- this._path = path14.resolve(projectPath);
3446
+ this._path = path13.resolve(projectPath);
3590
3447
  this._integrationManager = new IntegrationManager({
3591
3448
  noCache: options.noCache
3592
3449
  });
@@ -3598,7 +3455,7 @@ var init_agent_project = __esm(() => {
3598
3455
  });
3599
3456
  }
3600
3457
  static async load(projectPath, options = {}) {
3601
- const resolvedPath = path14.resolve(projectPath);
3458
+ const resolvedPath = path13.resolve(projectPath);
3602
3459
  if (!options.noCache) {
3603
3460
  const cached = AgentProject._projectCache.get(resolvedPath);
3604
3461
  if (cached) {
@@ -3616,7 +3473,7 @@ var init_agent_project = __esm(() => {
3616
3473
  AgentProject._projectCache.clear();
3617
3474
  }
3618
3475
  static clearCacheForPath(projectPath) {
3619
- const resolvedPath = path14.resolve(projectPath);
3476
+ const resolvedPath = path13.resolve(projectPath);
3620
3477
  AgentProject._projectCache.delete(resolvedPath);
3621
3478
  }
3622
3479
  get path() {
@@ -3732,17 +3589,17 @@ var init_agent_project = __esm(() => {
3732
3589
  const warnings = [];
3733
3590
  const info = [];
3734
3591
  try {
3735
- await fs12.access(this._path);
3592
+ await fs11.access(this._path);
3736
3593
  const requiredFiles = ["agent.config.ts"];
3737
3594
  for (const file of requiredFiles) {
3738
3595
  try {
3739
- await fs12.access(path14.join(this._path, file));
3596
+ await fs11.access(path13.join(this._path, file));
3740
3597
  } catch {
3741
3598
  errors.push(ValidationErrors.requiredFileMissing(file));
3742
3599
  }
3743
3600
  }
3744
3601
  try {
3745
- await fs12.access(path14.join(this._path, "agent.json"));
3602
+ await fs11.access(path13.join(this._path, "agent.json"));
3746
3603
  } catch {
3747
3604
  info.push({
3748
3605
  $type: "ValidationError",
@@ -3756,7 +3613,7 @@ var init_agent_project = __esm(() => {
3756
3613
  const expectedDirs = ["actions", "workflows", "conversations", "assets"];
3757
3614
  for (const dir of expectedDirs) {
3758
3615
  try {
3759
- const stats = await fs12.stat(path14.join(this._path, dir));
3616
+ const stats = await fs11.stat(path13.join(this._path, dir));
3760
3617
  if (!stats.isDirectory()) {
3761
3618
  warnings.push(ValidationErrors.invalidStructure(dir, "directory"));
3762
3619
  }
@@ -3840,9 +3697,9 @@ var init_agent_project = __esm(() => {
3840
3697
  }
3841
3698
  async createAgentInfo(info) {
3842
3699
  const { devId, ...agentJsonInfo } = info;
3843
- const agentPath = path14.join(this._path, "agent.json");
3700
+ const agentPath = path13.join(this._path, "agent.json");
3844
3701
  const agentContent = stringifyWithOrder(agentJsonInfo, agentInfoKeyOrder);
3845
- await fs12.writeFile(agentPath, agentContent);
3702
+ await fs11.writeFile(agentPath, agentContent);
3846
3703
  this._agentInfo = info;
3847
3704
  if (devId) {
3848
3705
  await this.createAgentLocalInfo({ devId });
@@ -3859,24 +3716,24 @@ var init_agent_project = __esm(() => {
3859
3716
  const { devId, ...agentJsonUpdates } = updates;
3860
3717
  const updatedInfo = { ...this._agentInfo, ...agentJsonUpdates };
3861
3718
  const { devId: _devId, ...agentJsonData } = updatedInfo;
3862
- const agentPath = path14.join(this._path, "agent.json");
3719
+ const agentPath = path13.join(this._path, "agent.json");
3863
3720
  const agentContent = stringifyWithOrder(agentJsonData, agentInfoKeyOrder);
3864
- await fs12.writeFile(agentPath, agentContent);
3721
+ await fs11.writeFile(agentPath, agentContent);
3865
3722
  this._agentInfo = updatedInfo;
3866
3723
  if (devId !== undefined) {
3867
3724
  await this.updateAgentLocalInfo({ devId });
3868
3725
  }
3869
3726
  }
3870
3727
  async createAgentLocalInfo(info) {
3871
- const localPath = path14.join(this._path, "agent.local.json");
3728
+ const localPath = path13.join(this._path, "agent.local.json");
3872
3729
  let existing = {};
3873
3730
  try {
3874
- const content2 = await fs12.readFile(localPath, "utf-8");
3731
+ const content2 = await fs11.readFile(localPath, "utf-8");
3875
3732
  existing = JSON.parse(content2);
3876
3733
  } catch {}
3877
3734
  const merged = { ...existing, ...info };
3878
3735
  const content = stringifyWithOrder(merged, agentLocalInfoKeyOrder);
3879
- await fs12.writeFile(localPath, content);
3736
+ await fs11.writeFile(localPath, content);
3880
3737
  if (this._agentInfo) {
3881
3738
  if (merged.botId)
3882
3739
  this._agentInfo.botId = merged.botId;
@@ -3896,10 +3753,10 @@ var init_agent_project = __esm(() => {
3896
3753
  }
3897
3754
  }
3898
3755
  async updateAgentLocalInfo(updates) {
3899
- const localPath = path14.join(this._path, "agent.local.json");
3756
+ const localPath = path13.join(this._path, "agent.local.json");
3900
3757
  let existing = {};
3901
3758
  try {
3902
- const content = await fs12.readFile(localPath, "utf-8");
3759
+ const content = await fs11.readFile(localPath, "utf-8");
3903
3760
  existing = JSON.parse(content);
3904
3761
  } catch {}
3905
3762
  const updated = { ...existing, ...updates };
@@ -3910,21 +3767,21 @@ var init_agent_project = __esm(() => {
3910
3767
  }
3911
3768
  if (Object.keys(updated).length === 0) {
3912
3769
  try {
3913
- await fs12.unlink(localPath);
3770
+ await fs11.unlink(localPath);
3914
3771
  } catch {}
3915
3772
  } else {
3916
3773
  const content = stringifyWithOrder(updated, agentLocalInfoKeyOrder);
3917
- await fs12.writeFile(localPath, content);
3774
+ await fs11.writeFile(localPath, content);
3918
3775
  }
3919
3776
  if (this._agentInfo) {
3920
- const agentJsonPath = path14.join(this._path, "agent.json");
3777
+ const agentJsonPath = path13.join(this._path, "agent.json");
3921
3778
  let base = {
3922
3779
  botId: this._agentInfo.botId,
3923
3780
  workspaceId: this._agentInfo.workspaceId,
3924
3781
  apiUrl: this._agentInfo.apiUrl
3925
3782
  };
3926
3783
  try {
3927
- const agentJsonContent = await fs12.readFile(agentJsonPath, "utf-8");
3784
+ const agentJsonContent = await fs11.readFile(agentJsonPath, "utf-8");
3928
3785
  const parsed = JSON.parse(agentJsonContent);
3929
3786
  base = {
3930
3787
  botId: parsed.botId ?? this._agentInfo.botId,
@@ -3956,10 +3813,10 @@ var init_agent_project = __esm(() => {
3956
3813
  this._integrations = [];
3957
3814
  this._interfaces = [];
3958
3815
  try {
3959
- const configPath = path14.join(this._path, "agent.config.ts");
3816
+ const configPath = path13.join(this._path, "agent.config.ts");
3960
3817
  debug2("loading agent.config.ts from %s", configPath);
3961
- const projectRequire = createRequire2(path14.join(this._path, "package.json"));
3962
- debug2("created projectRequire from %s", path14.join(this._path, "package.json"));
3818
+ const projectRequire = createRequire2(path13.join(this._path, "package.json"));
3819
+ debug2("created projectRequire from %s", path13.join(this._path, "package.json"));
3963
3820
  try {
3964
3821
  const resolvedPath = projectRequire.resolve(configPath);
3965
3822
  debug2("resolved config path: %s", resolvedPath);
@@ -4156,8 +4013,8 @@ ${err.stack?.split(`
4156
4013
  }
4157
4014
  }
4158
4015
  isBarrelReexport(existing, newPath, newExport, newDefinition) {
4159
- const isNewBarrel = /^index\.[tj]s$/i.test(path14.basename(newPath));
4160
- const isExistingBarrel = /^index\.[tj]s$/i.test(path14.basename(existing.path));
4016
+ const isNewBarrel = /^index\.[tj]s$/i.test(path13.basename(newPath));
4017
+ const isExistingBarrel = /^index\.[tj]s$/i.test(path13.basename(existing.path));
4161
4018
  if (!isNewBarrel && !isExistingBarrel) {
4162
4019
  return false;
4163
4020
  }
@@ -4169,16 +4026,16 @@ ${err.stack?.split(`
4169
4026
  return true;
4170
4027
  }
4171
4028
  isToolBarrelReexport(existingPath, newPath) {
4172
- const isNewBarrel = /^index\.[tj]s$/i.test(path14.basename(newPath));
4173
- const isExistingBarrel = /^index\.[tj]s$/i.test(path14.basename(existingPath));
4029
+ const isNewBarrel = /^index\.[tj]s$/i.test(path13.basename(newPath));
4030
+ const isExistingBarrel = /^index\.[tj]s$/i.test(path13.basename(existingPath));
4174
4031
  if (!isNewBarrel && !isExistingBarrel) {
4175
4032
  return false;
4176
4033
  }
4177
4034
  return true;
4178
4035
  }
4179
4036
  shouldPreferToolDefinition(existingPath, newPath) {
4180
- const isNewBarrel = /^index\.[tj]s$/i.test(path14.basename(newPath));
4181
- const isExistingBarrel = /^index\.[tj]s$/i.test(path14.basename(existingPath));
4037
+ const isNewBarrel = /^index\.[tj]s$/i.test(path13.basename(newPath));
4038
+ const isExistingBarrel = /^index\.[tj]s$/i.test(path13.basename(existingPath));
4182
4039
  return isExistingBarrel && !isNewBarrel;
4183
4040
  }
4184
4041
  getChannelsList(channelSpec) {
@@ -4194,8 +4051,8 @@ ${err.stack?.split(`
4194
4051
  if (this._options.adkCommand) {
4195
4052
  setAdkCommand(this._options.adkCommand);
4196
4053
  }
4197
- const src = path14.join(this._path, "src");
4198
- if (!await fs12.stat(src).catch(() => false)) {
4054
+ const src = path13.join(this._path, "src");
4055
+ if (!await fs11.stat(src).catch(() => false)) {
4199
4056
  this._errors.push({
4200
4057
  $type: "ValidationError",
4201
4058
  code: "INVALID_STRUCTURE" /* INVALID_STRUCTURE */,
@@ -4204,14 +4061,14 @@ ${err.stack?.split(`
4204
4061
  });
4205
4062
  return;
4206
4063
  }
4207
- const allFiles = await fs12.readdir(src, {
4064
+ const allFiles = await fs11.readdir(src, {
4208
4065
  withFileTypes: true,
4209
4066
  recursive: true
4210
4067
  });
4211
4068
  for (const file of allFiles.filter((x) => x.isFile())) {
4212
4069
  const filename = file.name;
4213
- const absolutePath = path14.join(file.parentPath, file.name);
4214
- const relPath = path14.relative(this.path, absolutePath);
4070
+ const absolutePath = path13.join(file.parentPath, file.name);
4071
+ const relPath = path13.relative(this.path, absolutePath);
4215
4072
  if (filename.toLowerCase().endsWith(".d.ts")) {
4216
4073
  continue;
4217
4074
  }
@@ -4498,7 +4355,7 @@ ${err.stack?.split(`
4498
4355
  });
4499
4356
 
4500
4357
  // src/generators/utils.ts
4501
- import path15 from "path";
4358
+ import path14 from "path";
4502
4359
  async function getFormat() {
4503
4360
  if (!_formatLoaded) {
4504
4361
  _formatLoaded = true;
@@ -4546,9 +4403,9 @@ var _format = null, _formatLoaded = false, formatCode = async (code, filepath) =
4546
4403
  `));
4547
4404
  return code;
4548
4405
  }
4549
- }, ADK_VERSION = "1.19.0-beta.12", relative = (from, to) => {
4550
- const fromDir = path15.dirname(from);
4551
- const relative2 = path15.relative(fromDir, to);
4406
+ }, ADK_VERSION = "1.19.0-beta.13", relative = (from, to) => {
4407
+ const fromDir = path14.dirname(from);
4408
+ const relative2 = path14.relative(fromDir, to);
4552
4409
  return relative2.startsWith(".") ? relative2 : `./${relative2}`;
4553
4410
  };
4554
4411
  var init_utils = () => {};
@@ -15505,7 +15362,7 @@ __export(exports_action_types, {
15505
15362
  generateActionTypes: () => generateActionTypes
15506
15363
  });
15507
15364
  import { z as z9 } from "@botpress/sdk";
15508
- import path42 from "path";
15365
+ import path41 from "path";
15509
15366
  async function generateActionTypes(project) {
15510
15367
  const actionDefs = [];
15511
15368
  for (const action of project.actions) {
@@ -15522,7 +15379,7 @@ async function generateActionTypes(project) {
15522
15379
  };`);
15523
15380
  continue;
15524
15381
  }
15525
- const absolutePath = path42.join(project.path, action.path);
15382
+ const absolutePath = path41.join(project.path, action.path);
15526
15383
  const actionModule = await import(`${absolutePath}?t=${Date.now()}`);
15527
15384
  const actionInstance = actionModule[action.export] || actionModule.default;
15528
15385
  if (actionInstance && actionInstance.input && actionInstance.output) {
@@ -15567,7 +15424,7 @@ ${actionDefs.join(`
15567
15424
  };
15568
15425
  }
15569
15426
  `;
15570
- const actionTypesPath = path42.join(project.path, ".adk", "action-types.d.ts");
15427
+ const actionTypesPath = path41.join(project.path, ".adk", "action-types.d.ts");
15571
15428
  await createFile(actionTypesPath, await formatCode(content));
15572
15429
  }
15573
15430
  var transforms5;
@@ -15582,7 +15439,7 @@ var exports_integration_action_types = {};
15582
15439
  __export(exports_integration_action_types, {
15583
15440
  generateIntegrationActionTypes: () => generateIntegrationActionTypes
15584
15441
  });
15585
- import path43 from "path";
15442
+ import path42 from "path";
15586
15443
  async function generateIntegrationActionTypes(project) {
15587
15444
  const content = `
15588
15445
  ////////////////////////////////////////////////////////
@@ -15616,7 +15473,7 @@ type IntegrationsMap<T> = {
15616
15473
  export type IntegrationActions = IntegrationsMap<Integrations>;
15617
15474
  }
15618
15475
  `;
15619
- const integrationActionTypesPath = path43.join(project.path, ".adk", "integration-action-types.d.ts");
15476
+ const integrationActionTypesPath = path42.join(project.path, ".adk", "integration-action-types.d.ts");
15620
15477
  await createFile(integrationActionTypesPath, await formatCode(content));
15621
15478
  }
15622
15479
  var init_integration_action_types = __esm(() => {
@@ -15628,7 +15485,7 @@ var init_integration_action_types = __esm(() => {
15628
15485
  var require_package = __commonJS((exports, module) => {
15629
15486
  module.exports = {
15630
15487
  name: "@botpress/adk",
15631
- version: "1.19.0-beta.12",
15488
+ version: "1.19.0-beta.13",
15632
15489
  description: "Core ADK library for building AI agents on Botpress",
15633
15490
  keywords: [
15634
15491
  "adk",
@@ -15689,7 +15546,7 @@ var require_package = __commonJS((exports, module) => {
15689
15546
  "@botpress/cli": "~6.8.6",
15690
15547
  "@botpress/client": "~1.46.0",
15691
15548
  "@botpress/cognitive": "~0.6.0",
15692
- "@botpress/runtime": "^1.19.0-beta.12",
15549
+ "@botpress/runtime": "^1.19.0-beta.13",
15693
15550
  "@botpress/sdk": "~6.11.1",
15694
15551
  "@bpinternal/jex": "^1.2.4",
15695
15552
  "@bpinternal/yargs-extra": "^0.0.21",
@@ -15982,6 +15839,7 @@ class IntegrationRegistry {
15982
15839
  // src/plugins/manager.ts
15983
15840
  init_src();
15984
15841
  init_auth();
15842
+ import { Client as Client4 } from "@botpress/client";
15985
15843
 
15986
15844
  // src/plugins/enhanced-cache.ts
15987
15845
  import fs6 from "fs/promises";
@@ -16114,15 +15972,33 @@ class PluginManager {
16114
15972
  }
16115
15973
  async getClient() {
16116
15974
  if (!this.client) {
16117
- this.client = await getProjectClient({
16118
- project: this.options.project,
16119
- credentials: this.options.credentials,
16120
- apiUrl: this.options.apiUrl,
16121
- workspaceId: this.options.workspaceId,
16122
- headers: {
16123
- "x-multiple-integrations": "true"
16124
- }
16125
- });
15975
+ const hasProjectScope = !!(this.options.project || this.options.workspaceId);
15976
+ if (hasProjectScope) {
15977
+ this.client = await getProjectClient({
15978
+ project: this.options.project,
15979
+ credentials: this.options.credentials,
15980
+ apiUrl: this.options.apiUrl,
15981
+ workspaceId: this.options.workspaceId,
15982
+ headers: {
15983
+ "x-multiple-integrations": "true"
15984
+ }
15985
+ });
15986
+ } else if (this.options.credentials) {
15987
+ this.client = new Client4({
15988
+ token: this.options.credentials.token,
15989
+ apiUrl: this.options.apiUrl || this.options.credentials.apiUrl,
15990
+ ...this.options.credentials.workspaceId ? { workspaceId: this.options.credentials.workspaceId } : {},
15991
+ headers: {
15992
+ "x-multiple-integrations": "true"
15993
+ }
15994
+ });
15995
+ } else {
15996
+ this.client = await getProjectClient({
15997
+ headers: {
15998
+ "x-multiple-integrations": "true"
15999
+ }
16000
+ });
16001
+ }
16126
16002
  }
16127
16003
  return this.client;
16128
16004
  }
@@ -16952,8 +16828,8 @@ class InterfaceRegistry {
16952
16828
  }
16953
16829
  // src/dependencies/migration.ts
16954
16830
  init_lock_file();
16955
- import * as fs13 from "fs/promises";
16956
- import * as path17 from "path";
16831
+ import * as fs12 from "fs/promises";
16832
+ import * as path16 from "path";
16957
16833
  import { Project as Project3, SyntaxKind as SyntaxKind3 } from "ts-morph";
16958
16834
 
16959
16835
  // src/agent-project/config-writer.ts
@@ -16961,12 +16837,12 @@ init_utils();
16961
16837
  init_src();
16962
16838
  import { Project as Project2, SyntaxKind as SyntaxKind2 } from "ts-morph";
16963
16839
  import { readFileSync as readFileSync2 } from "fs";
16964
- import * as path16 from "path";
16840
+ import * as path15 from "path";
16965
16841
 
16966
16842
  class ConfigWriter {
16967
16843
  configPath;
16968
16844
  constructor(projectPath) {
16969
- this.configPath = path16.join(projectPath, "agent.config.ts");
16845
+ this.configPath = path15.join(projectPath, "agent.config.ts");
16970
16846
  }
16971
16847
  loadConfig() {
16972
16848
  const project = new Project2;
@@ -17375,9 +17251,9 @@ async function migrateFromConfig(opts) {
17375
17251
  return result;
17376
17252
  }
17377
17253
  async function readAliasesFromConfig(projectPath) {
17378
- const configPath = path17.join(projectPath, "agent.config.ts");
17254
+ const configPath = path16.join(projectPath, "agent.config.ts");
17379
17255
  try {
17380
- await fs13.access(configPath);
17256
+ await fs12.access(configPath);
17381
17257
  } catch {
17382
17258
  return { integrations: {}, plugins: {} };
17383
17259
  }
@@ -17534,12 +17410,12 @@ class BpAddCommand extends BaseCommand {
17534
17410
  }
17535
17411
  // src/commands/bp-build-command.ts
17536
17412
  import { execa as execa2 } from "execa";
17537
- import { join as join5 } from "path";
17413
+ import { join as join4 } from "path";
17538
17414
  import { access as access3 } from "fs/promises";
17539
17415
 
17540
17416
  // src/utils/source-map-optimizer.ts
17541
17417
  init_src();
17542
- import { readFile as readFile3, writeFile as writeFile4 } from "fs/promises";
17418
+ import { readFile as readFile2, writeFile as writeFile3 } from "fs/promises";
17543
17419
  import { resolve as resolve2, isAbsolute, relative as relative2, dirname as dirname2 } from "path";
17544
17420
  function encodeVLQ(value) {
17545
17421
  const base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -17704,7 +17580,7 @@ function encodeKeptSegments(keptByLine, totalLines, sourceIndexMap, nameIndexMap
17704
17580
  }
17705
17581
  async function optimizeSourceMap(options) {
17706
17582
  const { sourceMapPath, agentSrcPath } = options;
17707
- const sourceMapContent = await readFile3(sourceMapPath, "utf-8");
17583
+ const sourceMapContent = await readFile2(sourceMapPath, "utf-8");
17708
17584
  const sourceMap = JSON.parse(sourceMapContent);
17709
17585
  const resolvedAgentSrc = resolve2(agentSrcPath);
17710
17586
  const sourceMapDir = resolve2(sourceMapPath, "..");
@@ -17764,9 +17640,9 @@ async function optimizeSourceMap(options) {
17764
17640
  if (optimizedContent === sourceMapContent) {
17765
17641
  return;
17766
17642
  }
17767
- await writeFile4(sourceMapPath, optimizedContent, "utf-8");
17643
+ await writeFile3(sourceMapPath, optimizedContent, "utf-8");
17768
17644
  const cjsPath = sourceMapPath.replace(".cjs.map", ".cjs");
17769
- let cjsContent = await readFile3(cjsPath, "utf-8");
17645
+ let cjsContent = await readFile2(cjsPath, "utf-8");
17770
17646
  const base64SourceMap = Buffer.from(optimizedContent, "utf-8").toString("base64");
17771
17647
  const inlineSourceMap = `//# sourceMappingURL=data:application/json;base64,${base64SourceMap}`;
17772
17648
  cjsContent = cjsContent.replace(/\/\/# sourceMappingURL=.*$/m, inlineSourceMap);
@@ -17774,7 +17650,7 @@ async function optimizeSourceMap(options) {
17774
17650
  cjsContent += `
17775
17651
  ${inlineSourceMap}`;
17776
17652
  }
17777
- await writeFile4(cjsPath, cjsContent, "utf-8");
17653
+ await writeFile3(cjsPath, cjsContent, "utf-8");
17778
17654
  }
17779
17655
 
17780
17656
  // src/commands/bp-build-command.ts
@@ -17825,10 +17701,10 @@ class BpBuildCommand extends BaseCommand {
17825
17701
  }
17826
17702
  async optimizeSourceMapIfExists() {
17827
17703
  const { botPath } = this.options;
17828
- const sourceMapPath = join5(botPath, ".botpress", "dist", "index.cjs.map");
17704
+ const sourceMapPath = join4(botPath, ".botpress", "dist", "index.cjs.map");
17829
17705
  try {
17830
17706
  await access3(sourceMapPath);
17831
- const agentSrcPath = join5(botPath, "..", "..", "src");
17707
+ const agentSrcPath = join4(botPath, "..", "..", "src");
17832
17708
  await optimizeSourceMap({
17833
17709
  sourceMapPath,
17834
17710
  agentSrcPath
@@ -17915,7 +17791,7 @@ class BpDeployCommand extends BaseCommand {
17915
17791
  // src/commands/bp-dev-command.ts
17916
17792
  import { execa as execa4 } from "execa";
17917
17793
  import treeKill from "tree-kill";
17918
- import { join as join6 } from "path";
17794
+ import { join as join5 } from "path";
17919
17795
  import { access as access4 } from "fs/promises";
17920
17796
 
17921
17797
  // src/commands/bp-dev-stderr.ts
@@ -18017,7 +17893,7 @@ class BpDevCommand extends BaseCommand {
18017
17893
  this.childProcess = execa4(bpCommand, bpArgs, {
18018
17894
  cwd: botPath,
18019
17895
  env: getBpCliEnvironment({
18020
- TRACE_DIR: join6(botPath, "traces"),
17896
+ TRACE_DIR: join5(botPath, "traces"),
18021
17897
  NODE_ENV: process.env.ADK_DEV_WORKER_NODE_ENV || "development",
18022
17898
  VM_DRIVER: process.env.ADK_DEV_WORKER_VM_DRIVER || "node",
18023
17899
  ADK_LOCAL_PAT: credentials.token,
@@ -18040,7 +17916,7 @@ class BpDevCommand extends BaseCommand {
18040
17916
  ADK_SPAN_INGEST_URL: spanIngestUrl,
18041
17917
  ...otlpEndpoint && { OTEL_EXPORTER_OTLP_ENDPOINT: otlpEndpoint },
18042
17918
  ...this.options.botName && { ADK_BOT_NAME: this.options.botName },
18043
- ADK_DIRECTORY: join6(botPath, ".."),
17919
+ ADK_DIRECTORY: join5(botPath, ".."),
18044
17920
  AGENT_DIRECTORY: this.options.agentPath,
18045
17921
  NODE_OPTIONS: getWorkerNodeOptions()
18046
17922
  }),
@@ -18198,10 +18074,10 @@ ${this.stderrLines.join(`
18198
18074
  }
18199
18075
  async optimizeSourceMapIfExists() {
18200
18076
  const { botPath } = this.options;
18201
- const sourceMapPath = join6(botPath, ".botpress", "dist", "index.cjs.map");
18077
+ const sourceMapPath = join5(botPath, ".botpress", "dist", "index.cjs.map");
18202
18078
  try {
18203
18079
  await access4(sourceMapPath);
18204
- const agentSrcPath = join6(botPath, "..", "..", "src");
18080
+ const agentSrcPath = join5(botPath, "..", "..", "src");
18205
18081
  await optimizeSourceMap({
18206
18082
  sourceMapPath,
18207
18083
  agentSrcPath
@@ -18301,21 +18177,23 @@ init_src();
18301
18177
 
18302
18178
  // src/workspace/workspace-cache.ts
18303
18179
  init_auth();
18304
- import { Client as Client4 } from "@botpress/client";
18180
+ import { Client as Client5 } from "@botpress/client";
18305
18181
 
18306
18182
  class WorkspaceCache {
18307
18183
  cache = new Map;
18308
18184
  CACHE_TTL = 60 * 60 * 1000;
18309
- async getWorkspaceName(workspaceId) {
18310
- const cached = this.cache.get(workspaceId);
18185
+ async getWorkspaceName(workspaceId, credentials) {
18186
+ const resolvedCredentials = credentials ?? await auth.getActiveCredentials();
18187
+ const apiUrl = resolvedCredentials.apiUrl ?? "https://api.botpress.cloud";
18188
+ const cacheKey = `${apiUrl.replace(/\/+$/, "")}:${workspaceId}`;
18189
+ const cached = this.cache.get(cacheKey);
18311
18190
  if (cached && Date.now() - cached.fetchedAt < this.CACHE_TTL) {
18312
18191
  return cached.name;
18313
18192
  }
18314
18193
  try {
18315
- const credentials = await auth.getActiveCredentials();
18316
- const client = new Client4({
18317
- apiUrl: credentials.apiUrl,
18318
- token: credentials.token,
18194
+ const client = new Client5({
18195
+ apiUrl,
18196
+ token: resolvedCredentials.token,
18319
18197
  headers: {
18320
18198
  "x-multiple-integrations": "true"
18321
18199
  }
@@ -18325,7 +18203,7 @@ class WorkspaceCache {
18325
18203
  if (!workspace) {
18326
18204
  return;
18327
18205
  }
18328
- this.cache.set(workspaceId, {
18206
+ this.cache.set(cacheKey, {
18329
18207
  id: workspaceId,
18330
18208
  name: workspace.name,
18331
18209
  fetchedAt: Date.now()
@@ -18365,14 +18243,14 @@ init_src();
18365
18243
  var chatBundle = __toESM(require_chat_bundle(), 1);
18366
18244
  function getChatClient() {
18367
18245
  const mod = chatBundle;
18368
- const Client5 = mod.default?.Client ?? mod.Client;
18369
- if (!Client5) {
18246
+ const Client6 = mod.default?.Client ?? mod.Client;
18247
+ if (!Client6) {
18370
18248
  throw new AdkError({
18371
18249
  code: "CHAT_BUNDLE_STALE",
18372
18250
  message: "@botpress/chat bundle did not expose a Client export — build artifact may be stale."
18373
18251
  });
18374
18252
  }
18375
- return Client5;
18253
+ return Client6;
18376
18254
  }
18377
18255
 
18378
18256
  // src/index.ts
@@ -18455,7 +18333,7 @@ init_types2();
18455
18333
  init_src();
18456
18334
  import { watch } from "fs";
18457
18335
  import { EventEmitter as EventEmitter2 } from "events";
18458
- import path18 from "path";
18336
+ import path17 from "path";
18459
18337
 
18460
18338
  class FileWatcher extends EventEmitter2 {
18461
18339
  basePath;
@@ -18479,7 +18357,7 @@ class FileWatcher extends EventEmitter2 {
18479
18357
  this.watcher = watch(this.basePath, { recursive: true }, (eventType, filename) => {
18480
18358
  if (!filename)
18481
18359
  return;
18482
- const fullPath = path18.join(this.basePath, filename);
18360
+ const fullPath = path17.join(this.basePath, filename);
18483
18361
  const relativePath = filename;
18484
18362
  if (this.shouldIgnore(relativePath)) {
18485
18363
  return;
@@ -18723,18 +18601,18 @@ class ConfigManager {
18723
18601
  }
18724
18602
  // src/secrets/manager.ts
18725
18603
  init_src();
18726
- import fs14 from "fs/promises";
18727
- import path19 from "path";
18604
+ import fs13 from "fs/promises";
18605
+ import path18 from "path";
18728
18606
 
18729
18607
  class SecretsManager {
18730
18608
  storePath;
18731
18609
  constructor(projectPath) {
18732
- this.storePath = path19.join(projectPath, ".adk", "secrets.json");
18610
+ this.storePath = path18.join(projectPath, ".adk", "secrets.json");
18733
18611
  }
18734
18612
  async readStore() {
18735
18613
  let content;
18736
18614
  try {
18737
- content = await fs14.readFile(this.storePath, "utf-8");
18615
+ content = await fs13.readFile(this.storePath, "utf-8");
18738
18616
  } catch (err) {
18739
18617
  if (err.code === "ENOENT") {
18740
18618
  return { dev: {}, prod: {} };
@@ -18770,11 +18648,11 @@ class SecretsManager {
18770
18648
  return parsed;
18771
18649
  }
18772
18650
  async writeStore(store) {
18773
- await fs14.mkdir(path19.dirname(this.storePath), { recursive: true });
18651
+ await fs13.mkdir(path18.dirname(this.storePath), { recursive: true });
18774
18652
  const tmpPath = `${this.storePath}.tmp`;
18775
- await fs14.writeFile(tmpPath, JSON.stringify(store, null, 2) + `
18653
+ await fs13.writeFile(tmpPath, JSON.stringify(store, null, 2) + `
18776
18654
  `, { encoding: "utf-8", mode: 384 });
18777
- await fs14.rename(tmpPath, this.storePath);
18655
+ await fs13.rename(tmpPath, this.storePath);
18778
18656
  }
18779
18657
  async list(env) {
18780
18658
  const store = await this.readStore();
@@ -18817,8 +18695,8 @@ import { validateSecretName } from "@botpress/runtime/definition";
18817
18695
  // src/agent-init/agent-project-generator.ts
18818
18696
  init_src();
18819
18697
  init_utils();
18820
- import * as fs15 from "fs";
18821
- import * as path20 from "path";
18698
+ import * as fs14 from "fs";
18699
+ import * as path19 from "path";
18822
18700
  import { fileURLToPath } from "url";
18823
18701
  import { createRequire as createRequire3 } from "module";
18824
18702
 
@@ -18846,7 +18724,7 @@ var TEXT_EXTENSIONS = new Set([
18846
18724
  function isTextFile(filename) {
18847
18725
  if (filename === ".gitignore")
18848
18726
  return true;
18849
- const ext = path20.extname(filename).toLowerCase();
18727
+ const ext = path19.extname(filename).toLowerCase();
18850
18728
  return TEXT_EXTENSIONS.has(ext);
18851
18729
  }
18852
18730
 
@@ -18856,8 +18734,8 @@ class AgentProjectGenerator {
18856
18734
  packageManager;
18857
18735
  template;
18858
18736
  constructor(projectPath, packageManager = "bun", template = "blank") {
18859
- this.projectPath = path20.resolve(projectPath);
18860
- this.projectName = path20.basename(this.projectPath);
18737
+ this.projectPath = path19.resolve(projectPath);
18738
+ this.projectName = path19.basename(this.projectPath);
18861
18739
  this.packageManager = packageManager;
18862
18740
  this.template = template;
18863
18741
  }
@@ -18865,21 +18743,21 @@ class AgentProjectGenerator {
18865
18743
  this.ensureEmptyDirectory();
18866
18744
  const templateDir = this.resolveTemplateDir();
18867
18745
  await this.copyTemplateFiles(templateDir);
18868
- if (!fs15.existsSync(path20.join(this.projectPath, "agent.json"))) {
18746
+ if (!fs14.existsSync(path19.join(this.projectPath, "agent.json"))) {
18869
18747
  this.createAgentJson();
18870
18748
  }
18871
- if (!fs15.existsSync(path20.join(this.projectPath, "CLAUDE.md"))) {
18749
+ if (!fs14.existsSync(path19.join(this.projectPath, "CLAUDE.md"))) {
18872
18750
  this.createAIAssistantInstructions();
18873
18751
  }
18874
18752
  }
18875
18753
  static getAvailableTemplates() {
18876
18754
  try {
18877
18755
  const templatesRoot = AgentProjectGenerator.getTemplatesRoot();
18878
- const configPath = path20.join(templatesRoot, "template.config.json");
18879
- if (!fs15.existsSync(configPath)) {
18756
+ const configPath = path19.join(templatesRoot, "template.config.json");
18757
+ if (!fs14.existsSync(configPath)) {
18880
18758
  return [];
18881
18759
  }
18882
- const raw = fs15.readFileSync(configPath, "utf-8");
18760
+ const raw = fs14.readFileSync(configPath, "utf-8");
18883
18761
  const registry = JSON.parse(raw);
18884
18762
  return registry.templates;
18885
18763
  } catch {
@@ -18903,16 +18781,16 @@ class AgentProjectGenerator {
18903
18781
  try {
18904
18782
  const esmRequire = createRequire3(import.meta.url);
18905
18783
  const adkPkgPath = esmRequire.resolve("@botpress/adk/package.json");
18906
- const adkRoot = path20.dirname(adkPkgPath);
18907
- candidates.push(path20.join(adkRoot, "dist", "templates"));
18908
- candidates.push(path20.join(adkRoot, "templates"));
18784
+ const adkRoot = path19.dirname(adkPkgPath);
18785
+ candidates.push(path19.join(adkRoot, "dist", "templates"));
18786
+ candidates.push(path19.join(adkRoot, "templates"));
18909
18787
  } catch {}
18910
- const thisDir = path20.dirname(fileURLToPath(import.meta.url));
18911
- candidates.push(path20.resolve(thisDir, "templates"));
18912
- candidates.push(path20.resolve(thisDir, "../../templates"));
18913
- candidates.push(path20.join(path20.dirname(process.execPath), "templates"));
18788
+ const thisDir = path19.dirname(fileURLToPath(import.meta.url));
18789
+ candidates.push(path19.resolve(thisDir, "templates"));
18790
+ candidates.push(path19.resolve(thisDir, "../../templates"));
18791
+ candidates.push(path19.join(path19.dirname(process.execPath), "templates"));
18914
18792
  for (const candidate of candidates) {
18915
- if (fs15.existsSync(candidate) && fs15.existsSync(path20.join(candidate, "template.config.json"))) {
18793
+ if (fs14.existsSync(candidate) && fs14.existsSync(path19.join(candidate, "template.config.json"))) {
18916
18794
  return candidate;
18917
18795
  }
18918
18796
  }
@@ -18931,8 +18809,8 @@ Ensure the ADK package is properly installed or run the CLI build.`
18931
18809
  }
18932
18810
  resolveTemplateDir() {
18933
18811
  const templatesRoot = AgentProjectGenerator.getTemplatesRoot();
18934
- const templateDir = path20.join(templatesRoot, this.template);
18935
- if (!fs15.existsSync(templateDir)) {
18812
+ const templateDir = path19.join(templatesRoot, this.template);
18813
+ if (!fs14.existsSync(templateDir)) {
18936
18814
  const available = AgentProjectGenerator.getAvailableTemplates();
18937
18815
  const names = available.map((t) => ` - ${t.name}: ${t.description}`).join(`
18938
18816
  `);
@@ -18947,8 +18825,8 @@ ${names || " (none found)"}`,
18947
18825
  suggestion: validNames ? `Re-run with a valid template name (one of: ${validNames}).` : "Re-run with a valid template name."
18948
18826
  });
18949
18827
  }
18950
- const configFile = path20.join(templateDir, "agent.config.ts");
18951
- if (!fs15.existsSync(configFile)) {
18828
+ const configFile = path19.join(templateDir, "agent.config.ts");
18829
+ if (!fs14.existsSync(configFile)) {
18952
18830
  throw new AdkError({
18953
18831
  code: "TEMPLATE_INVALID",
18954
18832
  expected: false,
@@ -18960,23 +18838,23 @@ ${names || " (none found)"}`,
18960
18838
  async copyTemplateFiles(templateDir) {
18961
18839
  const substitutions = {
18962
18840
  "{{projectName}}": this.projectName,
18963
- "{{runtimeVersion}}": "1.19.0-beta.12",
18841
+ "{{runtimeVersion}}": "1.19.0-beta.13",
18964
18842
  "{{packageManager}}": this.packageManager
18965
18843
  };
18966
18844
  await this.copyDirRecursive(templateDir, this.projectPath, substitutions);
18967
18845
  }
18968
18846
  async copyDirRecursive(src, dest, substitutions) {
18969
- if (!fs15.existsSync(dest)) {
18970
- fs15.mkdirSync(dest, { recursive: true });
18847
+ if (!fs14.existsSync(dest)) {
18848
+ fs14.mkdirSync(dest, { recursive: true });
18971
18849
  }
18972
- const entries = fs15.readdirSync(src, { withFileTypes: true });
18850
+ const entries = fs14.readdirSync(src, { withFileTypes: true });
18973
18851
  for (const entry of entries) {
18974
- const srcPath = path20.join(src, entry.name);
18975
- const destPath = path20.join(dest, entry.name);
18852
+ const srcPath = path19.join(src, entry.name);
18853
+ const destPath = path19.join(dest, entry.name);
18976
18854
  if (entry.isDirectory()) {
18977
18855
  await this.copyDirRecursive(srcPath, destPath, substitutions);
18978
18856
  } else if (isTextFile(entry.name)) {
18979
- let content = fs15.readFileSync(srcPath, "utf-8");
18857
+ let content = fs14.readFileSync(srcPath, "utf-8");
18980
18858
  for (const [placeholder, value] of Object.entries(substitutions)) {
18981
18859
  content = content.replaceAll(placeholder, value);
18982
18860
  }
@@ -18989,17 +18867,17 @@ ${names || " (none found)"}`,
18989
18867
  content = await formatCode(content, destPath);
18990
18868
  } catch {}
18991
18869
  }
18992
- fs15.writeFileSync(destPath, content);
18870
+ fs14.writeFileSync(destPath, content);
18993
18871
  } else {
18994
- fs15.copyFileSync(srcPath, destPath);
18872
+ fs14.copyFileSync(srcPath, destPath);
18995
18873
  }
18996
18874
  }
18997
18875
  }
18998
18876
  ensureEmptyDirectory() {
18999
- if (!fs15.existsSync(this.projectPath)) {
19000
- fs15.mkdirSync(this.projectPath, { recursive: true });
18877
+ if (!fs14.existsSync(this.projectPath)) {
18878
+ fs14.mkdirSync(this.projectPath, { recursive: true });
19001
18879
  }
19002
- const files = fs15.readdirSync(this.projectPath);
18880
+ const files = fs14.readdirSync(this.projectPath);
19003
18881
  if (files.length > 0) {
19004
18882
  throw new AdkError({
19005
18883
  code: "TARGET_DIR_NOT_EMPTY",
@@ -19019,8 +18897,8 @@ ${names || " (none found)"}`,
19019
18897
  this.writeFile("AGENTS.md", content);
19020
18898
  }
19021
18899
  writeFile(relativePath, content) {
19022
- const filePath = path20.join(this.projectPath, relativePath);
19023
- fs15.writeFileSync(filePath, content);
18900
+ const filePath = path19.join(this.projectPath, relativePath);
18901
+ fs14.writeFileSync(filePath, content);
19024
18902
  }
19025
18903
  writeJsonFile(relativePath, data) {
19026
18904
  this.writeFile(relativePath, JSON.stringify(data, null, 2) + `
@@ -19214,11 +19092,11 @@ function isRecordLike(value) {
19214
19092
  // src/generators/assets.ts
19215
19093
  init_fs();
19216
19094
  init_assets();
19217
- import path21 from "path";
19095
+ import path20 from "path";
19218
19096
  async function generateAssetsTypes(projectPath) {
19219
19097
  const assetsManager = new AssetsManager({ projectPath });
19220
19098
  const typesCode = await assetsManager.generateTypes();
19221
- const typesPath = path21.join(projectPath, defaultAdkFolder, "assets.d.ts");
19099
+ const typesPath = path20.join(projectPath, defaultAdkFolder, "assets.d.ts");
19222
19100
  await createFile(typesPath, typesCode);
19223
19101
  }
19224
19102
  async function generateAssetsRuntime(projectPath, botId, options) {
@@ -19279,7 +19157,7 @@ if (typeof globalThis !== 'undefined') {
19279
19157
  initializeAssets(global);
19280
19158
  }
19281
19159
  `;
19282
- const runtimePath = path21.join(projectPath, defaultAdkFolder, "assets-runtime.ts");
19160
+ const runtimePath = path20.join(projectPath, defaultAdkFolder, "assets-runtime.ts");
19283
19161
  await createFile(runtimePath, runtimeCode);
19284
19162
  }
19285
19163
  async function initAssets(projectPath, botId, options) {
@@ -19309,7 +19187,7 @@ declare global {
19309
19187
  };
19310
19188
  }
19311
19189
  `;
19312
- const typesPath = path21.join(projectPath, defaultAdkFolder, "assets.d.ts");
19190
+ const typesPath = path20.join(projectPath, defaultAdkFolder, "assets.d.ts");
19313
19191
  await createFile(typesPath, emptyTypesCode);
19314
19192
  const emptyRuntimeCode = `
19315
19193
  // No assets available
@@ -19330,14 +19208,14 @@ if (typeof globalThis !== 'undefined') {
19330
19208
  initializeAssets(global);
19331
19209
  }
19332
19210
  `;
19333
- const runtimePath = path21.join(projectPath, defaultAdkFolder, "assets-runtime.ts");
19211
+ const runtimePath = path20.join(projectPath, defaultAdkFolder, "assets-runtime.ts");
19334
19212
  await createFile(runtimePath, emptyRuntimeCode);
19335
19213
  }
19336
19214
  }
19337
19215
  // src/generators/integration-types.ts
19338
19216
  import { z as z5 } from "@botpress/sdk";
19339
19217
  import crypto2 from "crypto";
19340
- import path22 from "path";
19218
+ import path21 from "path";
19341
19219
 
19342
19220
  // src/utils/strings.ts
19343
19221
  function pascalCase(str) {
@@ -19378,12 +19256,12 @@ var getIntegrationNames = (integration) => ({
19378
19256
  configurations: `Integration_Configurations_${getPascalAlias(integration)}`
19379
19257
  },
19380
19258
  paths: {
19381
- index: path22.join(snakeCase(getPascalAlias(integration)), `index.ts`),
19382
- actions: path22.join(snakeCase(getPascalAlias(integration)), `actions.ts`),
19383
- channels: path22.join(snakeCase(getPascalAlias(integration)), `channels.ts`),
19384
- events: path22.join(snakeCase(getPascalAlias(integration)), `events.ts`),
19385
- users: path22.join(snakeCase(getPascalAlias(integration)), `users.ts`),
19386
- configurations: path22.join(snakeCase(getPascalAlias(integration)), `configurations.ts`)
19259
+ index: path21.join(snakeCase(getPascalAlias(integration)), `index.ts`),
19260
+ actions: path21.join(snakeCase(getPascalAlias(integration)), `actions.ts`),
19261
+ channels: path21.join(snakeCase(getPascalAlias(integration)), `channels.ts`),
19262
+ events: path21.join(snakeCase(getPascalAlias(integration)), `events.ts`),
19263
+ users: path21.join(snakeCase(getPascalAlias(integration)), `users.ts`),
19264
+ configurations: path21.join(snakeCase(getPascalAlias(integration)), `configurations.ts`)
19387
19265
  }
19388
19266
  });
19389
19267
  async function generateIntegrationTypes(integration) {
@@ -19639,9 +19517,9 @@ Description: ${tag?.description}`);
19639
19517
  init_utils();
19640
19518
  init_fs();
19641
19519
  import { z as z6 } from "@botpress/sdk";
19642
- import path23 from "path";
19520
+ import path22 from "path";
19643
19521
  import crypto3 from "crypto";
19644
- import { readFile as readFile4 } from "fs/promises";
19522
+ import { readFile as readFile3 } from "fs/promises";
19645
19523
  import { BuiltInWorkflows as BuiltInWorkflows2 } from "@botpress/runtime/internal";
19646
19524
  var { transforms: transforms2 } = z6;
19647
19525
  function isBuiltinWorkflow(name) {
@@ -19664,7 +19542,7 @@ async function generateClientWrapper(project) {
19664
19542
  });
19665
19543
  continue;
19666
19544
  }
19667
- const absolutePath = path23.join(project.path, action.path);
19545
+ const absolutePath = path22.join(project.path, action.path);
19668
19546
  const actionModule = await import(`${absolutePath}?t=${Date.now()}`);
19669
19547
  const actionInstance = actionModule[action.export] || actionModule.default;
19670
19548
  if (actionInstance && actionInstance.input && actionInstance.output) {
@@ -19691,7 +19569,7 @@ async function generateClientWrapper(project) {
19691
19569
  if (isBuiltinWorkflow(workflow.definition.name)) {
19692
19570
  continue;
19693
19571
  }
19694
- const workflowPath = path23.join(project.path, workflow.path);
19572
+ const workflowPath = path22.join(project.path, workflow.path);
19695
19573
  const workflowModule = await import(`${workflowPath}?t=${Date.now()}`);
19696
19574
  const workflowInstance = workflowModule[workflow.export] || workflowModule.default;
19697
19575
  if (workflowInstance) {
@@ -19710,7 +19588,7 @@ async function generateClientWrapper(project) {
19710
19588
  const tableTypes = [];
19711
19589
  for (const table of project.tables) {
19712
19590
  try {
19713
- const tablePath = path23.join(project.path, table.path);
19591
+ const tablePath = path22.join(project.path, table.path);
19714
19592
  const tableModule = await import(`${tablePath}?t=${Date.now()}`);
19715
19593
  const tableInstance = tableModule.default || tableModule[table.export];
19716
19594
  if (tableInstance && tableInstance.columns) {
@@ -20023,11 +19901,11 @@ export function createAdkClient(client: Client): AdkClient {
20023
19901
  }
20024
19902
  }
20025
19903
  `;
20026
- const clientWrapperPath = path23.join(project.path, ".adk", "client.ts");
19904
+ const clientWrapperPath = path22.join(project.path, ".adk", "client.ts");
20027
19905
  const formattedContent = await formatCode(content);
20028
19906
  const contentHash = crypto3.createHash("sha256").update(formattedContent.replace(/\/\/ Generated at: .+\n/, "")).digest("hex");
20029
19907
  try {
20030
- const existingContent = await readFile4(clientWrapperPath, "utf-8");
19908
+ const existingContent = await readFile3(clientWrapperPath, "utf-8");
20031
19909
  const existingHash = crypto3.createHash("sha256").update(existingContent.replace(/\/\/ Generated at: .+\n/, "")).digest("hex");
20032
19910
  if (contentHash === existingHash) {
20033
19911
  return;
@@ -20039,14 +19917,14 @@ export function createAdkClient(client: Client): AdkClient {
20039
19917
  init_src();
20040
19918
  import dedent from "dedent";
20041
19919
  import { existsSync as existsSync7 } from "fs";
20042
- import fs21 from "fs/promises";
20043
- import path44 from "path";
19920
+ import fs20 from "fs/promises";
19921
+ import path43 from "path";
20044
19922
  init_config_utils();
20045
19923
 
20046
19924
  // src/generators/plugin-types.ts
20047
19925
  import { z as z7 } from "@botpress/sdk";
20048
19926
  import crypto4 from "crypto";
20049
- import path24 from "path";
19927
+ import path23 from "path";
20050
19928
  init_utils();
20051
19929
  var { transforms: transforms3 } = z7;
20052
19930
  function stripRefs(schema) {
@@ -20085,8 +19963,8 @@ var getPluginNames = (plugin) => ({
20085
19963
  actions: `Plugin_Actions_${getPascalAlias2(plugin)}`
20086
19964
  },
20087
19965
  paths: {
20088
- index: path24.join(snakeCase(getPascalAlias2(plugin)), `index.ts`),
20089
- actions: path24.join(snakeCase(getPascalAlias2(plugin)), `actions.ts`)
19966
+ index: path23.join(snakeCase(getPascalAlias2(plugin)), `index.ts`),
19967
+ actions: path23.join(snakeCase(getPascalAlias2(plugin)), `actions.ts`)
20090
19968
  }
20091
19969
  });
20092
19970
  async function generatePluginTypes(plugin) {
@@ -20154,7 +20032,7 @@ Description: ${action.description || "No description"}`)}
20154
20032
  // src/generators/plugin-action-types.ts
20155
20033
  init_utils();
20156
20034
  init_fs();
20157
- import path25 from "path";
20035
+ import path24 from "path";
20158
20036
  async function generatePluginActionTypes(project) {
20159
20037
  const content = `
20160
20038
  ////////////////////////////////////////////////////////
@@ -20189,14 +20067,14 @@ type PluginsMap<T> = {
20189
20067
  export type PluginActions = PluginsMap<Plugins>;
20190
20068
  }
20191
20069
  `;
20192
- const pluginActionTypesPath = path25.join(project.path, ".adk", "plugin-action-types.d.ts");
20070
+ const pluginActionTypesPath = path24.join(project.path, ".adk", "plugin-action-types.d.ts");
20193
20071
  await createFile(pluginActionTypesPath, await formatCode(content));
20194
20072
  }
20195
20073
 
20196
20074
  // src/generators/interface-types.ts
20197
20075
  import { z as z8 } from "@botpress/sdk";
20198
20076
  import crypto5 from "crypto";
20199
- import path26 from "path";
20077
+ import path25 from "path";
20200
20078
  init_utils();
20201
20079
  var { transforms: transforms4 } = z8;
20202
20080
  var sameMajorVersion = (a, b) => {
@@ -20218,8 +20096,8 @@ var getInterfaceNames = (int) => ({
20218
20096
  actions: `Interface_Actions_${pascalCase(int.name)}`
20219
20097
  },
20220
20098
  paths: {
20221
- index: path26.join(snakeCase(int.name), `index.ts`),
20222
- actions: path26.join(snakeCase(int.name), `actions.ts`)
20099
+ index: path25.join(snakeCase(int.name), `index.ts`),
20100
+ actions: path25.join(snakeCase(int.name), `actions.ts`)
20223
20101
  }
20224
20102
  });
20225
20103
  async function generateInterfaceTypes(int, integrations) {
@@ -20324,12 +20202,12 @@ Description: ${action.description || "No description"}`)}
20324
20202
  // src/generators/table-types.ts
20325
20203
  init_utils();
20326
20204
  init_fs();
20327
- import path27 from "path";
20205
+ import path26 from "path";
20328
20206
  async function generateTableTypes(project) {
20329
20207
  const tables = [];
20330
20208
  for (const tableRef of project.tables) {
20331
20209
  try {
20332
- const tablePath = path27.join(project.path, tableRef.path);
20210
+ const tablePath = path26.join(project.path, tableRef.path);
20333
20211
  const tableModule = await import(`${tablePath}?t=${Date.now()}`);
20334
20212
  const tableInstance = tableModule.default || tableModule[tableRef.export];
20335
20213
  if (tableInstance && tableInstance.columns) {
@@ -20415,14 +20293,14 @@ ${outputColumns}
20415
20293
  content += ` };
20416
20294
  }
20417
20295
  `;
20418
- const tableTypesPath = path27.join(project.path, ".adk", "table-types.d.ts");
20296
+ const tableTypesPath = path26.join(project.path, ".adk", "table-types.d.ts");
20419
20297
  await createFile(tableTypesPath, await formatCode(content));
20420
20298
  }
20421
20299
 
20422
20300
  // src/generators/trigger-types.ts
20423
20301
  init_utils();
20424
20302
  init_fs();
20425
- import path28 from "path";
20303
+ import path27 from "path";
20426
20304
  async function generateTriggerTypes(project) {
20427
20305
  const triggerEvents = {};
20428
20306
  for (const trigger of project.triggers) {
@@ -20462,19 +20340,19 @@ ${triggersType}
20462
20340
  };
20463
20341
  }
20464
20342
  `;
20465
- const triggerTypesPath = path28.join(project.path, ".adk", "trigger-types.d.ts");
20343
+ const triggerTypesPath = path27.join(project.path, ".adk", "trigger-types.d.ts");
20466
20344
  await createFile(triggerTypesPath, await formatCode(content));
20467
20345
  }
20468
20346
 
20469
20347
  // src/generators/state-types.ts
20470
20348
  init_utils();
20471
20349
  init_fs();
20472
- import path29 from "path";
20350
+ import path28 from "path";
20473
20351
  async function generateStateTypes(project) {
20474
20352
  let botStateType = "{}";
20475
20353
  let userStateType = "{}";
20476
20354
  try {
20477
- const configPath = path29.join(project.path, "agent.config.ts");
20355
+ const configPath = path28.join(project.path, "agent.config.ts");
20478
20356
  const configModule = await import(`${configPath}?t=${Date.now()}`);
20479
20357
  const config = configModule.default;
20480
20358
  if (config?.bot?.state) {
@@ -20505,14 +20383,14 @@ declare module "@botpress/runtime/_types/state" {
20505
20383
  export type UserState = ${userStateType};
20506
20384
  }
20507
20385
  `;
20508
- const stateTypesPath = path29.join(project.path, ".adk", "state-types.d.ts");
20386
+ const stateTypesPath = path28.join(project.path, ".adk", "state-types.d.ts");
20509
20387
  await createFile(stateTypesPath, await formatCode(content));
20510
20388
  }
20511
20389
 
20512
20390
  // src/generators/tag-types.ts
20513
20391
  init_utils();
20514
20392
  init_fs();
20515
- import path30 from "path";
20393
+ import path29 from "path";
20516
20394
  import { BUILT_IN_TAGS } from "@botpress/runtime/definition";
20517
20395
  function generateTagTypeString(builtInTags, configTags) {
20518
20396
  const builtInTagStrings = Object.entries(builtInTags).map(([key, tag]) => {
@@ -20551,7 +20429,7 @@ async function generateTagTypes(project) {
20551
20429
  let messageTagsType = "Record<string, string | undefined>";
20552
20430
  let workflowTagsType = "Record<string, string | undefined>";
20553
20431
  try {
20554
- const configPath = path30.join(project.path, "agent.config.ts");
20432
+ const configPath = path29.join(project.path, "agent.config.ts");
20555
20433
  const configModule = await import(`${configPath}?t=${Date.now()}`);
20556
20434
  const config = configModule.default;
20557
20435
  botTagsType = generateTagTypeString(BUILT_IN_TAGS.bot, config?.bot?.tags);
@@ -20597,18 +20475,18 @@ declare module "@botpress/runtime/_types/tags" {
20597
20475
  export type WorkflowTags = ${workflowTagsType};
20598
20476
  }
20599
20477
  `;
20600
- const tagTypesPath = path30.join(project.path, ".adk", "tag-types.d.ts");
20478
+ const tagTypesPath = path29.join(project.path, ".adk", "tag-types.d.ts");
20601
20479
  await createFile(tagTypesPath, await formatCode(content));
20602
20480
  }
20603
20481
 
20604
20482
  // src/generators/configuration-types.ts
20605
20483
  init_utils();
20606
20484
  init_fs();
20607
- import path31 from "path";
20485
+ import path30 from "path";
20608
20486
  async function generateConfigurationTypes(project) {
20609
20487
  let configurationType = "{}";
20610
20488
  try {
20611
- const configPath = path31.join(project.path, "agent.config.ts");
20489
+ const configPath = path30.join(project.path, "agent.config.ts");
20612
20490
  const configModule = await import(`${configPath}?t=${Date.now()}`);
20613
20491
  const config = configModule.default;
20614
20492
  if (config?.configuration?.schema) {
@@ -20632,18 +20510,18 @@ declare module "@botpress/runtime/_types/configuration" {
20632
20510
  export type Configuration = ${configurationType};
20633
20511
  }
20634
20512
  `;
20635
- const configTypesPath = path31.join(project.path, ".adk", "configuration-types.d.ts");
20513
+ const configTypesPath = path30.join(project.path, ".adk", "configuration-types.d.ts");
20636
20514
  await createFile(configTypesPath, await formatCode(content));
20637
20515
  }
20638
20516
 
20639
20517
  // src/generators/secret-types.ts
20640
20518
  init_utils();
20641
20519
  init_fs();
20642
- import path32 from "path";
20520
+ import path31 from "path";
20643
20521
  async function generateSecretTypes(project) {
20644
20522
  let secretsType = "{}";
20645
20523
  try {
20646
- const configPath = path32.join(project.path, "agent.config.ts");
20524
+ const configPath = path31.join(project.path, "agent.config.ts");
20647
20525
  const configModule = await import(`${configPath}?t=${Date.now()}`);
20648
20526
  const config = configModule.default;
20649
20527
  if (config?.secrets) {
@@ -20675,14 +20553,14 @@ declare module "@botpress/runtime/_types/secrets" {
20675
20553
  export type Secrets = ${secretsType};
20676
20554
  }
20677
20555
  `;
20678
- const secretTypesPath = path32.join(project.path, ".adk", "secret-types.d.ts");
20556
+ const secretTypesPath = path31.join(project.path, ".adk", "secret-types.d.ts");
20679
20557
  await createFile(secretTypesPath, await formatCode(content));
20680
20558
  }
20681
20559
 
20682
20560
  // src/generators/workflow-types.ts
20683
20561
  init_utils();
20684
20562
  init_fs();
20685
- import * as path33 from "path";
20563
+ import * as path32 from "path";
20686
20564
  import { BuiltInWorkflows as BuiltInWorkflows3 } from "@botpress/runtime/internal";
20687
20565
  function isBuiltinWorkflow2(name) {
20688
20566
  return !!Object.values(BuiltInWorkflows3).find((x) => x.name === name);
@@ -20694,7 +20572,7 @@ async function generateWorkflowTypes(project) {
20694
20572
  if (isBuiltinWorkflow2(workflowRef.definition.name)) {
20695
20573
  continue;
20696
20574
  }
20697
- const workflowPath = path33.join(project.path, workflowRef.path);
20575
+ const workflowPath = path32.join(project.path, workflowRef.path);
20698
20576
  const workflowModule = await import(`${workflowPath}?t=${Date.now()}`);
20699
20577
  const workflowInstance = workflowModule[workflowRef.export] || workflowModule.default;
20700
20578
  if (!workflowInstance) {
@@ -20752,14 +20630,14 @@ declare module "@botpress/runtime/_types/workflows" {
20752
20630
  ${typeDefinitions || " // No workflows defined yet"}
20753
20631
  };
20754
20632
  }`;
20755
- const workflowTypesPath = path33.join(project.path, ".adk", "workflow-types.d.ts");
20633
+ const workflowTypesPath = path32.join(project.path, ".adk", "workflow-types.d.ts");
20756
20634
  await createFile(workflowTypesPath, await formatCode(content));
20757
20635
  }
20758
20636
 
20759
20637
  // src/generators/conversation-types.ts
20760
20638
  init_utils();
20761
20639
  init_fs();
20762
- import path34 from "path";
20640
+ import path33 from "path";
20763
20641
  function hasConversationIdProperty(schema) {
20764
20642
  if (!schema || typeof schema !== "object") {
20765
20643
  return false;
@@ -20782,7 +20660,7 @@ async function generateConversationTypes(project) {
20782
20660
  const conversationTypes = {};
20783
20661
  for (const conversationRef of project.conversations) {
20784
20662
  try {
20785
- const conversationPath = path34.join(project.path, conversationRef.path);
20663
+ const conversationPath = path33.join(project.path, conversationRef.path);
20786
20664
  const conversationModule = await import(`${conversationPath}?t=${Date.now()}`);
20787
20665
  const conversationInstance = conversationModule[conversationRef.export] || conversationModule.default;
20788
20666
  if (!conversationInstance) {
@@ -20870,14 +20748,14 @@ ${routableEventsDefinitions || " // No routable events found"}
20870
20748
  };
20871
20749
  }
20872
20750
  `;
20873
- const conversationTypesPath = path34.join(project.path, ".adk", "conversation-types.d.ts");
20751
+ const conversationTypesPath = path33.join(project.path, ".adk", "conversation-types.d.ts");
20874
20752
  await createFile(conversationTypesPath, await formatCode(content));
20875
20753
  }
20876
20754
 
20877
20755
  // src/generators/component-types.ts
20878
20756
  init_utils();
20879
20757
  init_fs();
20880
- import path35 from "path";
20758
+ import path34 from "path";
20881
20759
  async function generateComponentTypes(project) {
20882
20760
  const components = project.customComponents;
20883
20761
  if (components.length === 0) {
@@ -20893,7 +20771,7 @@ declare module "@botpress/runtime/_types/components" {
20893
20771
  export type CustomComponentMessage = never;
20894
20772
  }
20895
20773
  `;
20896
- const typesPath2 = path35.join(project.path, ".adk", "component-types.d.ts");
20774
+ const typesPath2 = path34.join(project.path, ".adk", "component-types.d.ts");
20897
20775
  await createFile(typesPath2, await formatCode(content2));
20898
20776
  return;
20899
20777
  }
@@ -20917,14 +20795,14 @@ declare module "@botpress/runtime/_types/components" {
20917
20795
  | `)};
20918
20796
  }
20919
20797
  `;
20920
- const typesPath = path35.join(project.path, ".adk", "component-types.d.ts");
20798
+ const typesPath = path34.join(project.path, ".adk", "component-types.d.ts");
20921
20799
  await createFile(typesPath, await formatCode(content));
20922
20800
  }
20923
20801
 
20924
20802
  // src/generators/event-types.ts
20925
20803
  init_utils();
20926
20804
  init_fs();
20927
- import path36 from "path";
20805
+ import path35 from "path";
20928
20806
  async function generateEventTypes(project) {
20929
20807
  const defaultEvents = ["register: {}"];
20930
20808
  const integrationEvents = [];
@@ -20976,7 +20854,7 @@ ${allEvents.map((e) => ` ${e}`).join(`
20976
20854
  export type EventPayload<T extends EventName> = Events[T];
20977
20855
  }
20978
20856
  `;
20979
- const eventTypesPath = path36.join(project.path, ".adk", "event-types.d.ts");
20857
+ const eventTypesPath = path35.join(project.path, ".adk", "event-types.d.ts");
20980
20858
  await createFile(eventTypesPath, await formatCode(content));
20981
20859
  }
20982
20860
 
@@ -20987,11 +20865,11 @@ init_fs();
20987
20865
 
20988
20866
  // src/utils/link-sdk.ts
20989
20867
  import { existsSync as existsSync3, realpathSync } from "fs";
20990
- import fs16 from "fs/promises";
20991
- import path37 from "path";
20868
+ import fs15 from "fs/promises";
20869
+ import path36 from "path";
20992
20870
  async function lexists(p) {
20993
20871
  try {
20994
- await fs16.lstat(p);
20872
+ await fs15.lstat(p);
20995
20873
  return true;
20996
20874
  } catch (err) {
20997
20875
  if (err.code === "ENOENT") {
@@ -21007,17 +20885,17 @@ function findPackage(name, startDir) {
21007
20885
  } catch {
21008
20886
  current = startDir;
21009
20887
  }
21010
- while (current !== path37.dirname(current)) {
21011
- const pkgPath = path37.join(current, "node_modules", name);
20888
+ while (current !== path36.dirname(current)) {
20889
+ const pkgPath = path36.join(current, "node_modules", name);
21012
20890
  if (existsSync3(pkgPath)) {
21013
20891
  return pkgPath;
21014
20892
  }
21015
- current = path37.dirname(current);
20893
+ current = path36.dirname(current);
21016
20894
  }
21017
20895
  return null;
21018
20896
  }
21019
20897
  async function linkSdk(agentDir, botDir) {
21020
- const targetSdkPath = path37.join(botDir, "node_modules", "@botpress", "sdk");
20898
+ const targetSdkPath = path36.join(botDir, "node_modules", "@botpress", "sdk");
21021
20899
  if (existsSync3(targetSdkPath)) {
21022
20900
  return;
21023
20901
  }
@@ -21031,21 +20909,21 @@ async function linkSdk(agentDir, botDir) {
21031
20909
  console.warn(`Warning: Could not find @botpress/sdk from @botpress/runtime location (${runtimePath})`);
21032
20910
  return;
21033
20911
  }
21034
- const targetBotpressDir = path37.join(botDir, "node_modules", "@botpress");
21035
- await fs16.mkdir(targetBotpressDir, { recursive: true });
20912
+ const targetBotpressDir = path36.join(botDir, "node_modules", "@botpress");
20913
+ await fs15.mkdir(targetBotpressDir, { recursive: true });
21036
20914
  if (await lexists(targetSdkPath)) {
21037
- await fs16.rm(targetSdkPath, { force: true });
20915
+ await fs15.rm(targetSdkPath, { force: true });
21038
20916
  }
21039
20917
  const symlinkType = process.platform === "win32" ? "junction" : undefined;
21040
- await fs16.symlink(sdkPath, targetSdkPath, symlinkType);
20918
+ await fs15.symlink(sdkPath, targetSdkPath, symlinkType);
21041
20919
  }
21042
20920
 
21043
20921
  // src/bot-generator/dev-id-manager.ts
21044
20922
  init_auth();
21045
20923
  init_agent_project();
21046
20924
  init_validation_errors();
21047
- import path38 from "path";
21048
- import fs17 from "fs/promises";
20925
+ import path37 from "path";
20926
+ import fs16 from "fs/promises";
21049
20927
  import createDebug3 from "debug";
21050
20928
  var debug3 = createDebug3("adk:dev-id-manager");
21051
20929
 
@@ -21059,7 +20937,7 @@ class DevIdManager {
21059
20937
  constructor(projectPath, botProjectPath, options = {}) {
21060
20938
  this.projectPath = projectPath;
21061
20939
  this.botProjectPath = botProjectPath;
21062
- this.projectCachePath = path38.join(botProjectPath, ".botpress", "project.cache.json");
20940
+ this.projectCachePath = path37.join(botProjectPath, ".botpress", "project.cache.json");
21063
20941
  this.loadAgentProject = options.loadAgentProject ?? ((p) => AgentProject.load(p));
21064
20942
  this.validationErrors = options.validationErrors ?? ValidationErrors;
21065
20943
  }
@@ -21080,7 +20958,7 @@ class DevIdManager {
21080
20958
  }
21081
20959
  async readProjectCache() {
21082
20960
  try {
21083
- const content = await fs17.readFile(this.projectCachePath, "utf-8");
20961
+ const content = await fs16.readFile(this.projectCachePath, "utf-8");
21084
20962
  if (content.trim().length === 0) {
21085
20963
  debug3("project cache is empty, treating as bootstrap state: %s", this.projectCachePath);
21086
20964
  return {};
@@ -21106,8 +20984,8 @@ class DevIdManager {
21106
20984
  }
21107
20985
  async saveProjectCache(cache2) {
21108
20986
  try {
21109
- await fs17.mkdir(path38.dirname(this.projectCachePath), { recursive: true });
21110
- await fs17.writeFile(this.projectCachePath, JSON.stringify(cache2, null, 2));
20987
+ await fs16.mkdir(path37.dirname(this.projectCachePath), { recursive: true });
20988
+ await fs16.writeFile(this.projectCachePath, JSON.stringify(cache2, null, 2));
21111
20989
  } catch (error) {
21112
20990
  console.error("Error saving project.cache.json:", error);
21113
20991
  }
@@ -21164,8 +21042,8 @@ function isProjectCache(value) {
21164
21042
  init_src();
21165
21043
  init_agent_project();
21166
21044
  init_auth();
21167
- import path39 from "path";
21168
- import fs18 from "fs/promises";
21045
+ import path38 from "path";
21046
+ import fs17 from "fs/promises";
21169
21047
  import { existsSync as existsSync4 } from "fs";
21170
21048
  class IntegrationSync {
21171
21049
  projectPath;
@@ -21175,7 +21053,7 @@ class IntegrationSync {
21175
21053
  constructor(projectPath, botProjectPath) {
21176
21054
  this.projectPath = projectPath;
21177
21055
  this.botProjectPath = botProjectPath;
21178
- this.bpModulesPath = path39.join(botProjectPath, "bp_modules");
21056
+ this.bpModulesPath = path38.join(botProjectPath, "bp_modules");
21179
21057
  }
21180
21058
  getCredentials() {
21181
21059
  if (!this.credentialsPromise) {
@@ -21215,16 +21093,16 @@ class IntegrationSync {
21215
21093
  return integrations;
21216
21094
  }
21217
21095
  async isIntegrationSynced(integration) {
21218
- const targetFolder = path39.join(this.bpModulesPath, `integration_${integration.alias}`);
21096
+ const targetFolder = path38.join(this.bpModulesPath, `integration_${integration.alias}`);
21219
21097
  if (!existsSync4(targetFolder)) {
21220
21098
  return false;
21221
21099
  }
21222
21100
  try {
21223
- const indexPath = path39.join(targetFolder, "index.ts");
21101
+ const indexPath = path38.join(targetFolder, "index.ts");
21224
21102
  if (!existsSync4(indexPath)) {
21225
21103
  return false;
21226
21104
  }
21227
- const indexContent = await fs18.readFile(indexPath, "utf-8");
21105
+ const indexContent = await fs17.readFile(indexPath, "utf-8");
21228
21106
  const versionMatch = indexContent.match(/version:\s*["']([^"']+)["']/);
21229
21107
  if (!versionMatch) {
21230
21108
  return false;
@@ -21250,8 +21128,8 @@ class IntegrationSync {
21250
21128
  await command.output();
21251
21129
  }
21252
21130
  async renameIntegrationFolder(integration) {
21253
- const sourceFolder = path39.join(this.bpModulesPath, integration.name.replace(/[/_]/g, "-"));
21254
- const targetFolder = path39.join(this.bpModulesPath, `integration_${integration.alias}`);
21131
+ const sourceFolder = path38.join(this.bpModulesPath, integration.name.replace(/[/_]/g, "-"));
21132
+ const targetFolder = path38.join(this.bpModulesPath, `integration_${integration.alias}`);
21255
21133
  if (!existsSync4(sourceFolder)) {
21256
21134
  throw new AdkError({
21257
21135
  code: "GENERATED_FOLDER_MISSING",
@@ -21260,14 +21138,14 @@ class IntegrationSync {
21260
21138
  });
21261
21139
  }
21262
21140
  if (existsSync4(targetFolder)) {
21263
- await fs18.rm(targetFolder, { recursive: true, force: true });
21141
+ await fs17.rm(targetFolder, { recursive: true, force: true });
21264
21142
  }
21265
- await fs18.rename(sourceFolder, targetFolder);
21143
+ await fs17.rename(sourceFolder, targetFolder);
21266
21144
  }
21267
21145
  async removeIntegrationFolder(alias) {
21268
- const targetFolder = path39.join(this.bpModulesPath, `integration_${alias}`);
21146
+ const targetFolder = path38.join(this.bpModulesPath, `integration_${alias}`);
21269
21147
  if (existsSync4(targetFolder)) {
21270
- await fs18.rm(targetFolder, { recursive: true, force: true });
21148
+ await fs17.rm(targetFolder, { recursive: true, force: true });
21271
21149
  }
21272
21150
  }
21273
21151
  async syncIntegrations() {
@@ -21277,7 +21155,7 @@ class IntegrationSync {
21277
21155
  if (integrations.length === 0) {
21278
21156
  return { synced, errors };
21279
21157
  }
21280
- await fs18.mkdir(this.bpModulesPath, { recursive: true });
21158
+ await fs17.mkdir(this.bpModulesPath, { recursive: true });
21281
21159
  for (const integration of integrations) {
21282
21160
  try {
21283
21161
  const isAlreadySynced = await this.isIntegrationSynced(integration);
@@ -21302,8 +21180,8 @@ class IntegrationSync {
21302
21180
  init_src();
21303
21181
  init_agent_project();
21304
21182
  init_auth();
21305
- import path40 from "path";
21306
- import fs19 from "fs/promises";
21183
+ import path39 from "path";
21184
+ import fs18 from "fs/promises";
21307
21185
  import { existsSync as existsSync5 } from "fs";
21308
21186
  init_constants();
21309
21187
  class InterfaceSync {
@@ -21314,7 +21192,7 @@ class InterfaceSync {
21314
21192
  constructor(projectPath, botProjectPath) {
21315
21193
  this.projectPath = projectPath;
21316
21194
  this.botProjectPath = botProjectPath;
21317
- this.bpModulesPath = path40.join(botProjectPath, "bp_modules");
21195
+ this.bpModulesPath = path39.join(botProjectPath, "bp_modules");
21318
21196
  }
21319
21197
  getCredentials() {
21320
21198
  if (!this.credentialsPromise) {
@@ -21341,16 +21219,16 @@ class InterfaceSync {
21341
21219
  return interfaces;
21342
21220
  }
21343
21221
  async isInterfaceSynced(interfaceInfo) {
21344
- const targetFolder = path40.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
21222
+ const targetFolder = path39.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
21345
21223
  if (!existsSync5(targetFolder)) {
21346
21224
  return false;
21347
21225
  }
21348
21226
  try {
21349
- const indexPath = path40.join(targetFolder, "index.ts");
21227
+ const indexPath = path39.join(targetFolder, "index.ts");
21350
21228
  if (!existsSync5(indexPath)) {
21351
21229
  return false;
21352
21230
  }
21353
- const indexContent = await fs19.readFile(indexPath, "utf-8");
21231
+ const indexContent = await fs18.readFile(indexPath, "utf-8");
21354
21232
  const versionMatch = indexContent.match(/version:\s*["']([^"']+)["']/);
21355
21233
  if (!versionMatch) {
21356
21234
  return false;
@@ -21387,8 +21265,8 @@ class InterfaceSync {
21387
21265
  });
21388
21266
  }
21389
21267
  async renameInterfaceFolder(interfaceInfo) {
21390
- const sourceFolder = path40.join(this.bpModulesPath, interfaceInfo.name);
21391
- const targetFolder = path40.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
21268
+ const sourceFolder = path39.join(this.bpModulesPath, interfaceInfo.name);
21269
+ const targetFolder = path39.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
21392
21270
  if (!existsSync5(sourceFolder)) {
21393
21271
  throw new AdkError({
21394
21272
  code: "GENERATED_FOLDER_MISSING",
@@ -21397,14 +21275,14 @@ class InterfaceSync {
21397
21275
  });
21398
21276
  }
21399
21277
  if (existsSync5(targetFolder)) {
21400
- await fs19.rm(targetFolder, { recursive: true, force: true });
21278
+ await fs18.rm(targetFolder, { recursive: true, force: true });
21401
21279
  }
21402
- await fs19.rename(sourceFolder, targetFolder);
21280
+ await fs18.rename(sourceFolder, targetFolder);
21403
21281
  }
21404
21282
  async removeInterfaceFolder(alias) {
21405
- const targetFolder = path40.join(this.bpModulesPath, `interface_${pascalCase(alias)}`);
21283
+ const targetFolder = path39.join(this.bpModulesPath, `interface_${pascalCase(alias)}`);
21406
21284
  if (existsSync5(targetFolder)) {
21407
- await fs19.rm(targetFolder, { recursive: true, force: true });
21285
+ await fs18.rm(targetFolder, { recursive: true, force: true });
21408
21286
  }
21409
21287
  }
21410
21288
  async syncInterfaces() {
@@ -21414,7 +21292,7 @@ class InterfaceSync {
21414
21292
  if (interfaces.length === 0) {
21415
21293
  return { synced, errors };
21416
21294
  }
21417
- await fs19.mkdir(this.bpModulesPath, { recursive: true });
21295
+ await fs18.mkdir(this.bpModulesPath, { recursive: true });
21418
21296
  for (const interfaceInfo of interfaces) {
21419
21297
  try {
21420
21298
  const isAlreadySynced = await this.isInterfaceSynced(interfaceInfo);
@@ -21439,8 +21317,8 @@ class InterfaceSync {
21439
21317
  init_src();
21440
21318
  init_agent_project();
21441
21319
  init_auth();
21442
- import path41 from "path";
21443
- import fs20 from "fs/promises";
21320
+ import path40 from "path";
21321
+ import fs19 from "fs/promises";
21444
21322
  import { existsSync as existsSync6 } from "fs";
21445
21323
  class PluginSync {
21446
21324
  projectPath;
@@ -21450,7 +21328,7 @@ class PluginSync {
21450
21328
  constructor(projectPath, botProjectPath) {
21451
21329
  this.projectPath = projectPath;
21452
21330
  this.botProjectPath = botProjectPath;
21453
- this.bpModulesPath = path41.join(botProjectPath, "bp_modules");
21331
+ this.bpModulesPath = path40.join(botProjectPath, "bp_modules");
21454
21332
  }
21455
21333
  getCredentials() {
21456
21334
  if (!this.credentialsPromise) {
@@ -21482,16 +21360,16 @@ class PluginSync {
21482
21360
  return plugins;
21483
21361
  }
21484
21362
  async isPluginSynced(plugin) {
21485
- const targetFolder = path41.join(this.bpModulesPath, `plugin_${plugin.alias}`);
21363
+ const targetFolder = path40.join(this.bpModulesPath, `plugin_${plugin.alias}`);
21486
21364
  if (!existsSync6(targetFolder)) {
21487
21365
  return false;
21488
21366
  }
21489
21367
  try {
21490
- const indexPath = path41.join(targetFolder, "index.ts");
21368
+ const indexPath = path40.join(targetFolder, "index.ts");
21491
21369
  if (!existsSync6(indexPath)) {
21492
21370
  return false;
21493
21371
  }
21494
- const indexContent = await fs20.readFile(indexPath, "utf-8");
21372
+ const indexContent = await fs19.readFile(indexPath, "utf-8");
21495
21373
  const versionMatch = indexContent.match(/version:\s*["']([^"']+)["']/);
21496
21374
  if (!versionMatch) {
21497
21375
  return false;
@@ -21517,8 +21395,8 @@ class PluginSync {
21517
21395
  await command.output();
21518
21396
  }
21519
21397
  async renamePluginFolder(plugin) {
21520
- const sourceFolder = path41.join(this.bpModulesPath, plugin.name.replace("/", "-"));
21521
- const targetFolder = path41.join(this.bpModulesPath, `plugin_${plugin.alias}`);
21398
+ const sourceFolder = path40.join(this.bpModulesPath, plugin.name.replace("/", "-"));
21399
+ const targetFolder = path40.join(this.bpModulesPath, `plugin_${plugin.alias}`);
21522
21400
  if (!existsSync6(sourceFolder)) {
21523
21401
  throw new AdkError({
21524
21402
  code: "GENERATED_FOLDER_MISSING",
@@ -21527,14 +21405,14 @@ class PluginSync {
21527
21405
  });
21528
21406
  }
21529
21407
  if (existsSync6(targetFolder)) {
21530
- await fs20.rm(targetFolder, { recursive: true, force: true });
21408
+ await fs19.rm(targetFolder, { recursive: true, force: true });
21531
21409
  }
21532
- await fs20.rename(sourceFolder, targetFolder);
21410
+ await fs19.rename(sourceFolder, targetFolder);
21533
21411
  }
21534
21412
  async removePluginFolder(alias) {
21535
- const targetFolder = path41.join(this.bpModulesPath, `plugin_${alias}`);
21413
+ const targetFolder = path40.join(this.bpModulesPath, `plugin_${alias}`);
21536
21414
  if (existsSync6(targetFolder)) {
21537
- await fs20.rm(targetFolder, { recursive: true, force: true });
21415
+ await fs19.rm(targetFolder, { recursive: true, force: true });
21538
21416
  }
21539
21417
  }
21540
21418
  async syncPlugins() {
@@ -21544,7 +21422,7 @@ class PluginSync {
21544
21422
  if (plugins.length === 0) {
21545
21423
  return { synced, errors };
21546
21424
  }
21547
- await fs20.mkdir(this.bpModulesPath, { recursive: true });
21425
+ await fs19.mkdir(this.bpModulesPath, { recursive: true });
21548
21426
  for (const plugin of plugins) {
21549
21427
  try {
21550
21428
  const isAlreadySynced = await this.isPluginSynced(plugin);
@@ -21603,7 +21481,7 @@ function isBuiltinAction(name) {
21603
21481
  return !!Object.values(BuiltInActions2).find((x) => x.name === name);
21604
21482
  }
21605
21483
  function getImportPath(from, to) {
21606
- return path44.relative(path44.dirname(from), to).replace(/\.ts$/, "").replace(/\\/g, "/");
21484
+ return path43.relative(path43.dirname(from), to).replace(/\.ts$/, "").replace(/\\/g, "/");
21607
21485
  }
21608
21486
 
21609
21487
  class BotGenerator {
@@ -21612,8 +21490,8 @@ class BotGenerator {
21612
21490
  adkCommand;
21613
21491
  callbacks;
21614
21492
  constructor(options) {
21615
- this.projectPath = path44.resolve(options.projectPath);
21616
- this.outputPath = path44.resolve(options.outputPath || path44.join(this.projectPath, ".adk"));
21493
+ this.projectPath = path43.resolve(options.projectPath);
21494
+ this.outputPath = path43.resolve(options.outputPath || path43.join(this.projectPath, ".adk"));
21617
21495
  this.adkCommand = options.adkCommand;
21618
21496
  this.callbacks = options.callbacks;
21619
21497
  }
@@ -21623,10 +21501,10 @@ class BotGenerator {
21623
21501
  return [];
21624
21502
  const result = [];
21625
21503
  const walk = async (dir, relativeBase) => {
21626
- const entries = await fs21.readdir(dir, { withFileTypes: true });
21504
+ const entries = await fs20.readdir(dir, { withFileTypes: true });
21627
21505
  for (const entry of entries) {
21628
- const abs = path44.join(dir, entry.name);
21629
- const rel = path44.join(relativeBase, entry.name);
21506
+ const abs = path43.join(dir, entry.name);
21507
+ const rel = path43.join(relativeBase, entry.name);
21630
21508
  if (entry.isDirectory()) {
21631
21509
  await walk(abs, rel);
21632
21510
  } else {
@@ -21644,17 +21522,17 @@ class BotGenerator {
21644
21522
  if (!existsSync7(rootDir))
21645
21523
  return;
21646
21524
  const removeIfEmpty = async (dir) => {
21647
- const entries = await fs21.readdir(dir, { withFileTypes: true });
21525
+ const entries = await fs20.readdir(dir, { withFileTypes: true });
21648
21526
  for (const entry of entries) {
21649
21527
  if (entry.isDirectory()) {
21650
- const subdir = path44.join(dir, entry.name);
21528
+ const subdir = path43.join(dir, entry.name);
21651
21529
  await removeIfEmpty(subdir);
21652
21530
  }
21653
21531
  }
21654
- const after = await fs21.readdir(dir);
21532
+ const after = await fs20.readdir(dir);
21655
21533
  if (after.length === 0 && dir !== rootDir) {
21656
21534
  try {
21657
- await fs21.rmdir(dir, { recursive: false });
21535
+ await fs20.rmdir(dir, { recursive: false });
21658
21536
  } catch {}
21659
21537
  }
21660
21538
  };
@@ -21662,7 +21540,7 @@ class BotGenerator {
21662
21540
  }
21663
21541
  async generate() {
21664
21542
  const project = await AgentProject.load(this.projectPath);
21665
- await fs21.mkdir(this.outputPath, { recursive: true });
21543
+ await fs20.mkdir(this.outputPath, { recursive: true });
21666
21544
  await this.generateBotDefinition();
21667
21545
  await this.generateIntegrationsDefinition();
21668
21546
  await this.generatePluginsDefinition();
@@ -21697,19 +21575,19 @@ class BotGenerator {
21697
21575
  project
21698
21576
  });
21699
21577
  const integrations = await manager3.loadIntegrations(project.dependencies || {});
21700
- const integrationsDir = path44.join(this.projectPath, ".adk", "integrations");
21578
+ const integrationsDir = path43.join(this.projectPath, ".adk", "integrations");
21701
21579
  const existingIntegrationFiles = await this.listFilesRecursive(integrationsDir);
21702
21580
  let aliases = new Set;
21703
21581
  let files = new Set;
21704
21582
  for (const integration of integrations.integrations) {
21705
21583
  if (integration.definition) {
21706
21584
  const types6 = await generateIntegrationTypes(integration);
21707
- const importPath = `./${path44.join("integrations", types6.names.paths.index).replace(/\\/g, "/")}`;
21585
+ const importPath = `./${path43.join("integrations", types6.names.paths.index).replace(/\\/g, "/")}`;
21708
21586
  aliases.add(`"${integration.alias}": import("${importPath}").${types6.names.typings.index}`);
21709
21587
  for (const [filePath, content] of Object.entries(types6.files)) {
21710
- const fullPath = path44.join(this.projectPath, ".adk", "integrations", filePath);
21711
- const dir = path44.dirname(fullPath);
21712
- await fs21.mkdir(dir, { recursive: true });
21588
+ const fullPath = path43.join(this.projectPath, ".adk", "integrations", filePath);
21589
+ const dir = path43.dirname(fullPath);
21590
+ await fs20.mkdir(dir, { recursive: true });
21713
21591
  await createFile(fullPath, content);
21714
21592
  files.add(filePath);
21715
21593
  }
@@ -21729,13 +21607,13 @@ class BotGenerator {
21729
21607
  };
21730
21608
  }
21731
21609
  `;
21732
- await createFile(path44.join(this.projectPath, ".adk", "integrations-types.d.ts"), await formatCode(types5));
21610
+ await createFile(path43.join(this.projectPath, ".adk", "integrations-types.d.ts"), await formatCode(types5));
21733
21611
  const staleIntegrationFiles = existingIntegrationFiles.filter((f) => !files.has(f));
21734
21612
  if (staleIntegrationFiles.length > 0) {
21735
21613
  for (const rel of staleIntegrationFiles) {
21736
- const abs = path44.join(integrationsDir, rel);
21614
+ const abs = path43.join(integrationsDir, rel);
21737
21615
  try {
21738
- await fs21.rm(abs, { force: true });
21616
+ await fs20.rm(abs, { force: true });
21739
21617
  } catch {}
21740
21618
  }
21741
21619
  }
@@ -21747,19 +21625,19 @@ class BotGenerator {
21747
21625
  project
21748
21626
  });
21749
21627
  const result = await manager3.loadPlugins(project.dependencies || {});
21750
- const pluginsDir = path44.join(this.projectPath, ".adk", "plugins");
21628
+ const pluginsDir = path43.join(this.projectPath, ".adk", "plugins");
21751
21629
  const existingPluginFiles = await this.listFilesRecursive(pluginsDir);
21752
21630
  let aliases = new Set;
21753
21631
  let files = new Set;
21754
21632
  for (const plugin of result.plugins) {
21755
21633
  if (plugin.definition) {
21756
21634
  const types6 = await generatePluginTypes(plugin);
21757
- const importPath = `./${path44.join("plugins", types6.names.paths.index).replace(/\\/g, "/")}`;
21635
+ const importPath = `./${path43.join("plugins", types6.names.paths.index).replace(/\\/g, "/")}`;
21758
21636
  aliases.add(`"${plugin.alias}": import("${importPath}").${types6.names.typings.index}`);
21759
21637
  for (const [filePath, content] of Object.entries(types6.files)) {
21760
- const fullPath = path44.join(this.projectPath, ".adk", "plugins", filePath);
21761
- const dir = path44.dirname(fullPath);
21762
- await fs21.mkdir(dir, { recursive: true });
21638
+ const fullPath = path43.join(this.projectPath, ".adk", "plugins", filePath);
21639
+ const dir = path43.dirname(fullPath);
21640
+ await fs20.mkdir(dir, { recursive: true });
21763
21641
  await createFile(fullPath, content);
21764
21642
  files.add(filePath);
21765
21643
  }
@@ -21779,13 +21657,13 @@ class BotGenerator {
21779
21657
  };
21780
21658
  }
21781
21659
  `;
21782
- await createFile(path44.join(this.projectPath, ".adk", "plugins-types.d.ts"), await formatCode(types5));
21660
+ await createFile(path43.join(this.projectPath, ".adk", "plugins-types.d.ts"), await formatCode(types5));
21783
21661
  const stalePluginFiles = existingPluginFiles.filter((f) => !files.has(f));
21784
21662
  if (stalePluginFiles.length > 0) {
21785
21663
  for (const rel of stalePluginFiles) {
21786
- const abs = path44.join(pluginsDir, rel);
21664
+ const abs = path43.join(pluginsDir, rel);
21787
21665
  try {
21788
- await fs21.rm(abs, { force: true });
21666
+ await fs20.rm(abs, { force: true });
21789
21667
  } catch {}
21790
21668
  }
21791
21669
  }
@@ -21868,7 +21746,7 @@ class BotGenerator {
21868
21746
  let botStateType = "{}";
21869
21747
  let userStateType = "{}";
21870
21748
  try {
21871
- const configPath = path44.join(project.path, "agent.config.ts");
21749
+ const configPath = path43.join(project.path, "agent.config.ts");
21872
21750
  const configModule = await import(`${configPath}?t=${Date.now()}`);
21873
21751
  const config = configModule.default;
21874
21752
  if (config?.bot?.state) {
@@ -21904,7 +21782,7 @@ declare module "@botpress/runtime/_types/state" {
21904
21782
  export type UserState = ${userStateType};
21905
21783
  }
21906
21784
  `;
21907
- await createFile(path44.join(this.projectPath, ".adk", "runtime.d.ts"), await formatCode(types5));
21785
+ await createFile(path43.join(this.projectPath, ".adk", "runtime.d.ts"), await formatCode(types5));
21908
21786
  }
21909
21787
  async generateInterfacesTypes() {
21910
21788
  const project = await AgentProject.load(this.projectPath);
@@ -21914,7 +21792,7 @@ declare module "@botpress/runtime/_types/state" {
21914
21792
  const manager3 = new InterfaceManager({
21915
21793
  project
21916
21794
  });
21917
- const interfacesDir = path44.join(this.projectPath, ".adk", "interfaces");
21795
+ const interfacesDir = path43.join(this.projectPath, ".adk", "interfaces");
21918
21796
  const existingInterfaceFiles = await this.listFilesRecursive(interfacesDir);
21919
21797
  const interfaces = await manager3.loadInterfaces(project.dependencies || {}).then((result) => result.interfaces.filter((int) => int.definition).map((x) => x.definition));
21920
21798
  const integrationsWithAlias = await integrationManager.loadIntegrations(project.dependencies || {}).then((result) => result.integrations.filter((int) => int.definition).map((x) => ({ alias: x.alias, definition: x.definition })));
@@ -21923,12 +21801,12 @@ declare module "@botpress/runtime/_types/state" {
21923
21801
  let files = new Set;
21924
21802
  for (const int of interfaces) {
21925
21803
  const types6 = await generateInterfaceTypes(int, integrationsWithAlias);
21926
- imports.add(`import { ${types6.names.typings.index} } from "./${path44.join("interfaces", types6.names.paths.index).replace(/\\/g, "/")}";`);
21804
+ imports.add(`import { ${types6.names.typings.index} } from "./${path43.join("interfaces", types6.names.paths.index).replace(/\\/g, "/")}";`);
21927
21805
  aliases.add(`"${types6.names.name}": ${types6.names.typings.index}`);
21928
21806
  for (const [filePath, content] of Object.entries(types6.files)) {
21929
- const fullPath = path44.join(this.projectPath, ".adk", "interfaces", filePath);
21930
- const dir = path44.dirname(fullPath);
21931
- await fs21.mkdir(dir, { recursive: true });
21807
+ const fullPath = path43.join(this.projectPath, ".adk", "interfaces", filePath);
21808
+ const dir = path43.dirname(fullPath);
21809
+ await fs20.mkdir(dir, { recursive: true });
21932
21810
  await createFile(fullPath, content);
21933
21811
  files.add(filePath);
21934
21812
  }
@@ -21964,14 +21842,14 @@ declare module "@botpress/runtime/_types/state" {
21964
21842
  `)}
21965
21843
  };
21966
21844
  `;
21967
- await createFile(path44.join(this.projectPath, ".adk", "interfaces.d.ts"), await formatCode(types5));
21968
- await createFile(path44.join(this.projectPath, ".adk", "interfaces.ts"), await formatCode(consts));
21845
+ await createFile(path43.join(this.projectPath, ".adk", "interfaces.d.ts"), await formatCode(types5));
21846
+ await createFile(path43.join(this.projectPath, ".adk", "interfaces.ts"), await formatCode(consts));
21969
21847
  const staleInterfaceFiles = existingInterfaceFiles.filter((f) => !files.has(f));
21970
21848
  if (staleInterfaceFiles.length > 0) {
21971
21849
  for (const rel of staleInterfaceFiles) {
21972
- const abs = path44.join(interfacesDir, rel);
21850
+ const abs = path43.join(interfacesDir, rel);
21973
21851
  try {
21974
- await fs21.rm(abs, { force: true });
21852
+ await fs20.rm(abs, { force: true });
21975
21853
  } catch {}
21976
21854
  }
21977
21855
  }
@@ -21999,7 +21877,7 @@ declare module "@botpress/runtime/_types/state" {
21999
21877
  `) : ""}
22000
21878
  } as Record<string, IntegrationPackage>;
22001
21879
  `;
22002
- await createFile(path44.join(this.outputPath, "src", "integrations.ts"), content);
21880
+ await createFile(path43.join(this.outputPath, "src", "integrations.ts"), content);
22003
21881
  }
22004
21882
  async generatePluginsDefinition() {
22005
21883
  const project = await AgentProject.load(this.projectPath);
@@ -22023,7 +21901,7 @@ declare module "@botpress/runtime/_types/state" {
22023
21901
  `) : ""}
22024
21902
  } as Record<string, PluginPackage>;
22025
21903
  `;
22026
- await createFile(path44.join(this.outputPath, "src", "plugins.ts"), content);
21904
+ await createFile(path43.join(this.outputPath, "src", "plugins.ts"), content);
22027
21905
  }
22028
21906
  async generateInterfacesDefinition() {
22029
21907
  const interfaces = BUILTIN_INTERFACES;
@@ -22046,7 +21924,7 @@ declare module "@botpress/runtime/_types/state" {
22046
21924
  `) : ""}
22047
21925
  } as Record<string, InterfacePackage>;
22048
21926
  `;
22049
- await createFile(path44.join(this.outputPath, "src", "interfaces.ts"), await formatCode(content));
21927
+ await createFile(path43.join(this.outputPath, "src", "interfaces.ts"), await formatCode(content));
22050
21928
  }
22051
21929
  reportServerConfigSync(label, serverConfigResult, items) {
22052
21930
  if (!this.callbacks) {
@@ -22169,7 +22047,7 @@ declare module "@botpress/runtime/_types/state" {
22169
22047
  if (isBuiltinWorkflow3(workflow.definition.name)) {
22170
22048
  continue;
22171
22049
  }
22172
- const workflowPath = path44.join(project.path, workflow.path);
22050
+ const workflowPath = path43.join(project.path, workflow.path);
22173
22051
  const workflowModule = await import(`${workflowPath}?t=${Date.now()}`);
22174
22052
  const workflowInstance = workflowModule.default || workflowModule[workflow.export];
22175
22053
  if (workflowInstance) {
@@ -22475,7 +22353,7 @@ secrets: ${secretsDef},
22475
22353
  const fullContent = content + integrationsSection + pluginsSection + `
22476
22354
 
22477
22355
  export default bot;`;
22478
- await createFile(path44.join(this.outputPath, "bot.definition.ts"), await formatCode(fullContent));
22356
+ await createFile(path43.join(this.outputPath, "bot.definition.ts"), await formatCode(fullContent));
22479
22357
  }
22480
22358
  async generateBotIndex() {
22481
22359
  const content = dedent`
@@ -22517,7 +22395,7 @@ export default bot;`;
22517
22395
 
22518
22396
  export default bot
22519
22397
  `;
22520
- await createFile(path44.join(this.outputPath, "src", "index.ts"), await formatCode(content));
22398
+ await createFile(path43.join(this.outputPath, "src", "index.ts"), await formatCode(content));
22521
22399
  }
22522
22400
  async generatePackageJson(project) {
22523
22401
  const packageJson = {
@@ -22531,7 +22409,7 @@ export default bot;`;
22531
22409
  typescript: "^5.9.3"
22532
22410
  }
22533
22411
  };
22534
- await createFile(path44.join(this.outputPath, "package.json"), JSON.stringify(packageJson, null, 2));
22412
+ await createFile(path43.join(this.outputPath, "package.json"), JSON.stringify(packageJson, null, 2));
22535
22413
  }
22536
22414
  async generateTsConfig() {
22537
22415
  const tsConfig = {
@@ -22564,7 +22442,7 @@ export default bot;`;
22564
22442
  },
22565
22443
  include: [".botpress/**/*", "src/**/*", "bp_modules/**/*", "./*.ts", "./*.json", "../*.d.ts"]
22566
22444
  };
22567
- await createFile(path44.join(this.outputPath, "tsconfig.json"), JSON.stringify(tsConfig, null, 2));
22445
+ await createFile(path43.join(this.outputPath, "tsconfig.json"), JSON.stringify(tsConfig, null, 2));
22568
22446
  }
22569
22447
  async generateGlobalTypes() {
22570
22448
  const content = dedent`
@@ -22587,42 +22465,42 @@ export default bot;`;
22587
22465
 
22588
22466
  export {};
22589
22467
  `;
22590
- await createFile(path44.join(this.outputPath, "global.d.ts"), await formatCode(content));
22468
+ await createFile(path43.join(this.outputPath, "global.d.ts"), await formatCode(content));
22591
22469
  }
22592
22470
  async copyAssets() {
22593
- const assetsPath = path44.join(this.projectPath, "assets");
22594
- const targetPath = path44.join(this.outputPath, "assets");
22471
+ const assetsPath = path43.join(this.projectPath, "assets");
22472
+ const targetPath = path43.join(this.outputPath, "assets");
22595
22473
  if (existsSync7(assetsPath)) {
22596
- await fs21.mkdir(targetPath, { recursive: true });
22474
+ await fs20.mkdir(targetPath, { recursive: true });
22597
22475
  await this.copyDirectory(assetsPath, targetPath);
22598
22476
  }
22599
22477
  }
22600
22478
  async copyDirectory(src, dest) {
22601
- const entries = await fs21.readdir(src, { withFileTypes: true });
22479
+ const entries = await fs20.readdir(src, { withFileTypes: true });
22602
22480
  for (const entry of entries) {
22603
- const srcPath = path44.join(src, entry.name);
22604
- const destPath = path44.join(dest, entry.name);
22481
+ const srcPath = path43.join(src, entry.name);
22482
+ const destPath = path43.join(dest, entry.name);
22605
22483
  if (entry.isDirectory()) {
22606
- await fs21.mkdir(destPath, { recursive: true });
22484
+ await fs20.mkdir(destPath, { recursive: true });
22607
22485
  await this.copyDirectory(srcPath, destPath);
22608
22486
  } else {
22609
- await fs21.copyFile(srcPath, destPath);
22487
+ await fs20.copyFile(srcPath, destPath);
22610
22488
  }
22611
22489
  }
22612
22490
  }
22613
22491
  async generateAdkRuntime() {
22614
22492
  const project = new AgentProject(this.projectPath);
22615
22493
  await project.reload();
22616
- const srcDir = path44.join(this.outputPath, "src");
22494
+ const srcDir = path43.join(this.outputPath, "src");
22617
22495
  {
22618
- const dest = path44.join(srcDir, "conversations.ts");
22496
+ const dest = path43.join(srcDir, "conversations.ts");
22619
22497
  const imports = new Map;
22620
22498
  const exports = new Set;
22621
22499
  let index = 1;
22622
22500
  for (const conversation of project.conversations) {
22623
22501
  if (!imports.has(conversation.path)) {
22624
22502
  const name = `conversations_${index++}`;
22625
- const importPath = getImportPath(dest, path44.join(project.path, conversation.path));
22503
+ const importPath = getImportPath(dest, path43.join(project.path, conversation.path));
22626
22504
  imports.set(conversation.path, {
22627
22505
  name,
22628
22506
  statement: `import * as ${name} from "${importPath}";`
@@ -22648,14 +22526,14 @@ export default bot;`;
22648
22526
  await createFile(dest, await formatCode(content2));
22649
22527
  }
22650
22528
  {
22651
- const dest = path44.join(srcDir, "knowledge.ts");
22529
+ const dest = path43.join(srcDir, "knowledge.ts");
22652
22530
  const imports = new Map;
22653
22531
  const exports = new Set;
22654
22532
  let index = 1;
22655
22533
  for (const knowledge of project.knowledge) {
22656
22534
  if (!imports.has(knowledge.path)) {
22657
22535
  const name = `knowledge_${index++}`;
22658
- const importPath = getImportPath(dest, path44.join(project.path, knowledge.path));
22536
+ const importPath = getImportPath(dest, path43.join(project.path, knowledge.path));
22659
22537
  imports.set(knowledge.path, {
22660
22538
  name,
22661
22539
  statement: `import * as ${name} from "${importPath}";`
@@ -22681,14 +22559,14 @@ export default bot;`;
22681
22559
  await createFile(dest, await formatCode(content2));
22682
22560
  }
22683
22561
  {
22684
- const dest = path44.join(srcDir, "custom-components.ts");
22562
+ const dest = path43.join(srcDir, "custom-components.ts");
22685
22563
  const imports = new Map;
22686
22564
  const exports = new Set;
22687
22565
  let index = 1;
22688
22566
  for (const comp of project.customComponents) {
22689
22567
  if (!imports.has(comp.path)) {
22690
22568
  const name = `components_${index++}`;
22691
- const importPath = getImportPath(dest, path44.join(project.path, comp.path));
22569
+ const importPath = getImportPath(dest, path43.join(project.path, comp.path));
22692
22570
  imports.set(comp.path, {
22693
22571
  name,
22694
22572
  statement: `import * as ${name} from "${importPath}";`
@@ -22714,7 +22592,7 @@ export default bot;`;
22714
22592
  await createFile(dest, await formatCode(content2));
22715
22593
  }
22716
22594
  {
22717
- const dest = path44.join(srcDir, "triggers.ts");
22595
+ const dest = path43.join(srcDir, "triggers.ts");
22718
22596
  const {
22719
22597
  z: { transforms: transforms7 }
22720
22598
  } = await import("@botpress/sdk");
@@ -22725,7 +22603,7 @@ export default bot;`;
22725
22603
  for (const trigger of project.triggers) {
22726
22604
  if (!imports.has(trigger.path)) {
22727
22605
  const name = `triggers_${index++}`;
22728
- const importPath = getImportPath(dest, path44.join(project.path, trigger.path));
22606
+ const importPath = getImportPath(dest, path43.join(project.path, trigger.path));
22729
22607
  imports.set(trigger.path, {
22730
22608
  name,
22731
22609
  statement: `import * as ${name} from "${importPath}";`
@@ -22735,7 +22613,7 @@ export default bot;`;
22735
22613
  }
22736
22614
  for (const trigger of project.triggers) {
22737
22615
  try {
22738
- const absolutePath = path44.join(project.path, trigger.path);
22616
+ const absolutePath = path43.join(project.path, trigger.path);
22739
22617
  const triggerModule = await import(`${absolutePath}?t=${Date.now()}`);
22740
22618
  const triggerInstance = triggerModule[trigger.export] || triggerModule.default;
22741
22619
  if (triggerInstance && triggerInstance.payload) {
@@ -22778,7 +22656,7 @@ export default bot;`;
22778
22656
  await createFile(dest, await formatCode(content2));
22779
22657
  }
22780
22658
  {
22781
- const dest = path44.join(srcDir, "workflows.ts");
22659
+ const dest = path43.join(srcDir, "workflows.ts");
22782
22660
  const imports = new Map;
22783
22661
  const exports = new Set;
22784
22662
  let index = 1;
@@ -22788,7 +22666,7 @@ export default bot;`;
22788
22666
  }
22789
22667
  if (!imports.has(workflow.path)) {
22790
22668
  const name = `workflows_${index++}`;
22791
- const importPath = getImportPath(dest, path44.join(project.path, workflow.path));
22669
+ const importPath = getImportPath(dest, path43.join(project.path, workflow.path));
22792
22670
  const statement = `import * as ${name} from "${importPath}";`;
22793
22671
  imports.set(workflow.path, {
22794
22672
  name,
@@ -22822,7 +22700,7 @@ export default bot;`;
22822
22700
  await createFile(dest, await formatCode(content2));
22823
22701
  }
22824
22702
  {
22825
- const dest = path44.join(srcDir, "actions.ts");
22703
+ const dest = path43.join(srcDir, "actions.ts");
22826
22704
  const imports = new Map;
22827
22705
  const exports = new Set;
22828
22706
  let index = 1;
@@ -22832,7 +22710,7 @@ export default bot;`;
22832
22710
  }
22833
22711
  if (!imports.has(action.path)) {
22834
22712
  const name = `actions_${index++}`;
22835
- const importPath = getImportPath(dest, path44.join(project.path, action.path));
22713
+ const importPath = getImportPath(dest, path43.join(project.path, action.path));
22836
22714
  imports.set(action.path, {
22837
22715
  name,
22838
22716
  statement: `import * as ${name} from "${importPath}";`
@@ -22858,14 +22736,14 @@ export default bot;`;
22858
22736
  await createFile(dest, await formatCode(content2));
22859
22737
  }
22860
22738
  {
22861
- const dest = path44.join(srcDir, "tables.ts");
22739
+ const dest = path43.join(srcDir, "tables.ts");
22862
22740
  const imports = new Map;
22863
22741
  const exports = new Set;
22864
22742
  let index = 1;
22865
22743
  for (const table of project.tables) {
22866
22744
  if (!imports.has(table.path)) {
22867
22745
  const name = `tables_${index++}`;
22868
- const importPath = getImportPath(dest, path44.join(project.path, table.path));
22746
+ const importPath = getImportPath(dest, path43.join(project.path, table.path));
22869
22747
  imports.set(table.path, {
22870
22748
  name,
22871
22749
  statement: `import * as ${name} from "${importPath}";`
@@ -22891,8 +22769,8 @@ export default bot;`;
22891
22769
  await createFile(dest, await formatCode(content2));
22892
22770
  }
22893
22771
  {
22894
- const dest = path44.join(srcDir, "config.ts");
22895
- const importPath = getImportPath(dest, path44.join(project.path, "agent.config.ts"));
22772
+ const dest = path43.join(srcDir, "config.ts");
22773
+ const importPath = getImportPath(dest, path43.join(project.path, "agent.config.ts"));
22896
22774
  const content2 = `
22897
22775
  ////////////////////////////////////////////////////////
22898
22776
  // DO NOT EDIT THIS FILE DIRECTLY
@@ -22972,15 +22850,15 @@ export default bot;`;
22972
22850
  handlers.plugins.setup(runtimeBot);
22973
22851
  }
22974
22852
  `;
22975
- await createFile(path44.join(this.outputPath, "src", "adk-runtime.ts"), await formatCode(content));
22853
+ await createFile(path43.join(this.outputPath, "src", "adk-runtime.ts"), await formatCode(content));
22976
22854
  }
22977
22855
  async generateComponentUrlsBlock() {
22978
- const manifestPath = path44.join(this.projectPath, ".adk", "components.manifest.json");
22856
+ const manifestPath = path43.join(this.projectPath, ".adk", "components.manifest.json");
22979
22857
  try {
22980
22858
  if (!existsSync7(manifestPath)) {
22981
22859
  return "const componentUrls: Record<string, string> = {};";
22982
22860
  }
22983
- const manifest = JSON.parse(await fs21.readFile(manifestPath, "utf-8"));
22861
+ const manifest = JSON.parse(await fs20.readFile(manifestPath, "utf-8"));
22984
22862
  const entries = Object.entries(manifest).map(([name, data]) => `"${name}": "${data.url}"`).join(`,
22985
22863
  `);
22986
22864
  return `const componentUrls: Record<string, string> = {
@@ -22991,21 +22869,21 @@ export default bot;`;
22991
22869
  }
22992
22870
  }
22993
22871
  async copyAssetsRuntime() {
22994
- const assetsRuntimePath = path44.join(this.projectPath, ".adk", "assets-runtime.ts");
22872
+ const assetsRuntimePath = path43.join(this.projectPath, ".adk", "assets-runtime.ts");
22995
22873
  const isShippingBuild = this.adkCommand !== "adk-dev";
22996
22874
  if (isShippingBuild) {
22997
22875
  const project = await AgentProject.load(this.projectPath);
22998
22876
  await initAssets(this.projectPath, project.agentInfo?.botId, { dev: false });
22999
22877
  }
23000
22878
  if (existsSync7(assetsRuntimePath)) {
23001
- const content = await fs21.readFile(assetsRuntimePath, "utf-8");
23002
- await createFile(path44.join(this.outputPath, "src", "assets-runtime.ts"), await formatCode(content));
22879
+ const content = await fs20.readFile(assetsRuntimePath, "utf-8");
22880
+ await createFile(path43.join(this.outputPath, "src", "assets-runtime.ts"), await formatCode(content));
23003
22881
  }
23004
22882
  }
23005
22883
  }
23006
22884
  async function generateBotProject(options) {
23007
22885
  const generator = new BotGenerator(options);
23008
- const botPath = options.outputPath || path44.join(options.projectPath, ".adk", "bot");
22886
+ const botPath = options.outputPath || path43.join(options.projectPath, ".adk", "bot");
23009
22887
  await generator.generate();
23010
22888
  const devIdManager = new DevIdManager(options.projectPath, botPath);
23011
22889
  await Promise.all([
@@ -23049,15 +22927,18 @@ class TableManager {
23049
22927
  client;
23050
22928
  botId;
23051
22929
  project;
22930
+ credentials;
23052
22931
  constructor(options) {
23053
22932
  this.botId = options.botId;
23054
22933
  this.project = options.project;
22934
+ this.credentials = options.credentials;
23055
22935
  }
23056
22936
  async getClient() {
23057
22937
  if (!this.client) {
23058
22938
  this.assertBotId("initialize client");
23059
22939
  this.client = await getProjectClient({
23060
22940
  project: this.project,
22941
+ credentials: this.credentials,
23061
22942
  botId: this.botId,
23062
22943
  headers: {
23063
22944
  "x-multiple-integrations": "true"
@@ -23544,8 +23425,8 @@ class TableManager {
23544
23425
  init_src();
23545
23426
  init_auth();
23546
23427
  import crypto6 from "crypto";
23547
- import path45 from "path";
23548
- import fs22 from "fs/promises";
23428
+ import path44 from "path";
23429
+ import fs21 from "fs/promises";
23549
23430
  import { glob } from "glob";
23550
23431
  import { DataSource } from "@botpress/runtime";
23551
23432
 
@@ -23579,11 +23460,13 @@ class KnowledgeManager {
23579
23460
  client;
23580
23461
  botId;
23581
23462
  project;
23463
+ credentials;
23582
23464
  fileHashCache = new Map;
23583
23465
  remoteKbsPromise = null;
23584
23466
  constructor(options) {
23585
23467
  this.botId = options.botId;
23586
23468
  this.project = options.project;
23469
+ this.credentials = options.credentials;
23587
23470
  }
23588
23471
  clearHashCache() {
23589
23472
  this.fileHashCache.clear();
@@ -23593,6 +23476,7 @@ class KnowledgeManager {
23593
23476
  this.assertBotId("initialize client");
23594
23477
  this.client = await getProjectClient({
23595
23478
  project: this.project,
23479
+ credentials: this.credentials,
23596
23480
  botId: this.botId,
23597
23481
  headers: {
23598
23482
  "x-multiple-integrations": "true"
@@ -24015,15 +23899,15 @@ class KnowledgeManager {
24015
23899
  }
24016
23900
  async scanLocalFileHashes(directoryPath, filterFn) {
24017
23901
  const projectDir = this.project.path;
24018
- const directory = path45.resolve(projectDir, directoryPath);
23902
+ const directory = path44.resolve(projectDir, directoryPath);
24019
23903
  if (this.fileHashCache.has(directory)) {
24020
23904
  return this.fileHashCache.get(directory);
24021
23905
  }
24022
23906
  const files = glob.sync(directory + "/**/*.*", { absolute: true, nodir: true }).filter((file) => !filterFn || filterFn(file));
24023
23907
  const hashes = {};
24024
23908
  for (const file of files) {
24025
- const relPath = path45.relative(directory, file);
24026
- const content = await fs22.readFile(file);
23909
+ const relPath = path44.relative(directory, file);
23910
+ const content = await fs21.readFile(file);
24027
23911
  hashes[relPath] = crypto6.createHash("sha256").update(content).digest("hex");
24028
23912
  }
24029
23913
  this.fileHashCache.set(directory, hashes);
@@ -24154,7 +24038,7 @@ class KnowledgeManager {
24154
24038
  }
24155
24039
  async syncDirectorySource(client, kbName, kbId, dsId, directoryPath, filterFn, force) {
24156
24040
  const projectDir = this.project.path;
24157
- const directory = path45.resolve(projectDir, directoryPath);
24041
+ const directory = path44.resolve(projectDir, directoryPath);
24158
24042
  if (!directory.startsWith(projectDir)) {
24159
24043
  throw new AdkError({
24160
24044
  code: "PATH_OUTSIDE_PROJECT",
@@ -24180,8 +24064,8 @@ class KnowledgeManager {
24180
24064
  return true;
24181
24065
  }).map((f) => ({
24182
24066
  abs: f,
24183
- rel: path45.relative(directory, f),
24184
- name: path45.basename(f)
24067
+ rel: path44.relative(directory, f),
24068
+ name: path44.basename(f)
24185
24069
  }));
24186
24070
  console.log(` Found ${allFiles.length} files in ${directoryPath}`);
24187
24071
  const cachedHashes = await this.scanLocalFileHashes(directoryPath, filterFn);
@@ -24255,7 +24139,7 @@ class KnowledgeManager {
24255
24139
  }
24256
24140
  async upsertFile(client, local, dsId, tags, force, cachedHash) {
24257
24141
  const key = `data_source://document/${dsId}/${local.rel}`;
24258
- const content = await fs22.readFile(local.abs);
24142
+ const content = await fs21.readFile(local.abs);
24259
24143
  const hash = cachedHash ?? crypto6.createHash("sha256").update(content).digest("hex");
24260
24144
  try {
24261
24145
  const { file } = await client.getFile({ id: key });
@@ -24263,7 +24147,7 @@ class KnowledgeManager {
24263
24147
  return null;
24264
24148
  }
24265
24149
  } catch {}
24266
- const title = path45.basename(local.name, path45.extname(local.name));
24150
+ const title = path44.basename(local.name, path44.extname(local.name));
24267
24151
  const metadata = {
24268
24152
  hash,
24269
24153
  dsId,
@@ -24289,14 +24173,14 @@ class KnowledgeManager {
24289
24173
  }
24290
24174
  // src/knowledge/sync-formatter.ts
24291
24175
  import { readFileSync as readFileSync4 } from "fs";
24292
- import { join as join9 } from "path";
24176
+ import { join as join8 } from "path";
24293
24177
  var getAdkVersion = () => {
24294
24178
  try {
24295
24179
  const packageJson = require_package();
24296
24180
  return packageJson.version;
24297
24181
  } catch {
24298
24182
  try {
24299
- const adkPackagePath = join9(process.cwd(), "node_modules/@botpress/adk/package.json");
24183
+ const adkPackagePath = join8(process.cwd(), "node_modules/@botpress/adk/package.json");
24300
24184
  const pkg = JSON.parse(readFileSync4(adkPackagePath, "utf-8"));
24301
24185
  return pkg.version;
24302
24186
  } catch {
@@ -24390,7 +24274,7 @@ class KBSyncFormatter {
24390
24274
  // src/file-watcher/watcher.ts
24391
24275
  import { watch as watch2, readdirSync as readdirSync2, statSync } from "fs";
24392
24276
  import { EventEmitter as EventEmitter3 } from "events";
24393
- import { dirname as dirname4, join as join10, relative as relative3, sep } from "path";
24277
+ import { dirname as dirname4, join as join9, relative as relative3, sep } from "path";
24394
24278
  import { existsSync as existsSync8 } from "fs";
24395
24279
 
24396
24280
  class FileWatcher2 extends EventEmitter3 {
@@ -24409,13 +24293,13 @@ class FileWatcher2 extends EventEmitter3 {
24409
24293
  start() {
24410
24294
  const rootFiles = ["package.json", "agent.json", "agent.config.ts"];
24411
24295
  for (const file of rootFiles) {
24412
- const filePath = join10(this.projectPath, file);
24296
+ const filePath = join9(this.projectPath, file);
24413
24297
  if (existsSync8(filePath)) {
24414
24298
  this.updateFileState(filePath);
24415
24299
  }
24416
24300
  }
24417
24301
  this.watchRootFiles(new Set(rootFiles));
24418
- const srcPath = join10(this.projectPath, "src");
24302
+ const srcPath = join9(this.projectPath, "src");
24419
24303
  if (existsSync8(srcPath)) {
24420
24304
  this.initializeDirectoryState(srcPath);
24421
24305
  this.watchDirectory(srcPath);
@@ -24425,7 +24309,7 @@ class FileWatcher2 extends EventEmitter3 {
24425
24309
  try {
24426
24310
  const entries = readdirSync2(dirPath, { withFileTypes: true });
24427
24311
  for (const entry of entries) {
24428
- const fullPath = join10(dirPath, entry.name);
24312
+ const fullPath = join9(dirPath, entry.name);
24429
24313
  if (entry.isDirectory()) {
24430
24314
  this.initializeDirectoryState(fullPath);
24431
24315
  } else if (entry.isFile()) {
@@ -24441,7 +24325,7 @@ class FileWatcher2 extends EventEmitter3 {
24441
24325
  try {
24442
24326
  const watcher = watch2(this.projectPath, { persistent: true }, (_eventType, filename) => {
24443
24327
  if (filename && rootFileNames.has(filename)) {
24444
- this.handleFileChange(join10(this.projectPath, filename));
24328
+ this.handleFileChange(join9(this.projectPath, filename));
24445
24329
  return;
24446
24330
  }
24447
24331
  this.scheduleRootMtimeCheck(rootFileNames);
@@ -24460,7 +24344,7 @@ class FileWatcher2 extends EventEmitter3 {
24460
24344
  }
24461
24345
  checkRootFilesByMtime(rootFileNames) {
24462
24346
  for (const name of rootFileNames) {
24463
- const fullPath = join10(this.projectPath, name);
24347
+ const fullPath = join9(this.projectPath, name);
24464
24348
  const tracked = this.fileStates.get(fullPath);
24465
24349
  let mtime;
24466
24350
  try {
@@ -24493,7 +24377,7 @@ class FileWatcher2 extends EventEmitter3 {
24493
24377
  try {
24494
24378
  const watcher = watch2(dirPath, { recursive: true, persistent: true }, (_eventType, filename) => {
24495
24379
  if (filename) {
24496
- const fullPath = join10(dirPath, filename);
24380
+ const fullPath = join9(dirPath, filename);
24497
24381
  this.handleFileChange(fullPath);
24498
24382
  }
24499
24383
  });
@@ -24523,7 +24407,7 @@ class FileWatcher2 extends EventEmitter3 {
24523
24407
  this.updateFileState(filePath);
24524
24408
  } else {
24525
24409
  const parentDir = dirname4(filePath);
24526
- const srcPath = join10(this.projectPath, "src");
24410
+ const srcPath = join9(this.projectPath, "src");
24527
24411
  if (parentDir === srcPath || parentDir.startsWith(srcPath + sep)) {
24528
24412
  this.scanDirectoryForChanges(parentDir);
24529
24413
  }
@@ -24558,7 +24442,7 @@ class FileWatcher2 extends EventEmitter3 {
24558
24442
  const entries = readdirSync2(dirPath, { withFileTypes: true });
24559
24443
  const currentFiles = new Set;
24560
24444
  for (const entry of entries) {
24561
- const fullPath = join10(dirPath, entry.name);
24445
+ const fullPath = join9(dirPath, entry.name);
24562
24446
  if (entry.isFile()) {
24563
24447
  currentFiles.add(fullPath);
24564
24448
  const trackedMtime = this.fileStates.get(fullPath);
@@ -24633,7 +24517,7 @@ class FileWatcher2 extends EventEmitter3 {
24633
24517
  // src/preflight/checker.ts
24634
24518
  init_agent_project();
24635
24519
  init_auth();
24636
- import path46 from "path";
24520
+ import path45 from "path";
24637
24521
  init_manager2();
24638
24522
 
24639
24523
  // src/preflight/agent-config-sync.ts
@@ -24687,8 +24571,10 @@ class PreflightChecker {
24687
24571
  projectPath;
24688
24572
  client;
24689
24573
  project;
24690
- constructor(projectPath) {
24574
+ credentials;
24575
+ constructor(projectPath, options = {}) {
24691
24576
  this.projectPath = projectPath;
24577
+ this.credentials = options.credentials;
24692
24578
  }
24693
24579
  async getProject() {
24694
24580
  if (!this.project) {
@@ -24700,7 +24586,8 @@ class PreflightChecker {
24700
24586
  if (!this.client) {
24701
24587
  const project = await this.getProject();
24702
24588
  this.client = await getProjectClient({
24703
- project
24589
+ project,
24590
+ credentials: this.credentials
24704
24591
  });
24705
24592
  }
24706
24593
  return this.client;
@@ -24776,9 +24663,9 @@ class PreflightChecker {
24776
24663
  }
24777
24664
  async computeDeployPlan(botId, env = "prod") {
24778
24665
  const project = await this.getProject();
24779
- const tableManager = project.tables.length > 0 ? new TableManager({ project, botId }) : null;
24780
- const kbManager = project.knowledge.length > 0 ? new KnowledgeManager({ project, botId }) : null;
24781
- const assetsManager = await project.hasAssetsDirectory() ? new AssetsManager({ projectPath: this.projectPath, botId }) : null;
24666
+ const tableManager = project.tables.length > 0 ? new TableManager({ project, botId, credentials: this.credentials }) : null;
24667
+ const kbManager = project.knowledge.length > 0 ? new KnowledgeManager({ project, botId, credentials: this.credentials }) : null;
24668
+ const assetsManager = await project.hasAssetsDirectory() ? new AssetsManager({ projectPath: this.projectPath, botId, credentials: this.credentials }) : null;
24782
24669
  const [preflight, tablePlan, kbResult, assetPlan] = await Promise.all([
24783
24670
  this.checkWithPendingApply(botId, env),
24784
24671
  tableManager ? tableManager.createSyncPlan() : Promise.resolve(null),
@@ -24810,7 +24697,7 @@ class PreflightChecker {
24810
24697
  options?.onProgress?.("Regenerating bot project...");
24811
24698
  await generateBotProject({
24812
24699
  projectPath: this.projectPath,
24813
- outputPath: path46.join(this.projectPath, ".adk", "bot"),
24700
+ outputPath: path45.join(this.projectPath, ".adk", "bot"),
24814
24701
  callbacks: options
24815
24702
  });
24816
24703
  options?.onSuccess?.("Bot project regenerated");
@@ -24824,20 +24711,20 @@ function pluralize2(count, word) {
24824
24711
  // src/runner/script-runner.ts
24825
24712
  import dedent2 from "dedent";
24826
24713
  import { existsSync as existsSync9 } from "fs";
24827
- import fs23 from "fs/promises";
24828
- import path47 from "path";
24714
+ import fs22 from "fs/promises";
24715
+ import path46 from "path";
24829
24716
  import { spawn } from "child_process";
24830
24717
  init_utils();
24831
24718
  init_auth();
24832
24719
 
24833
24720
  // src/runner/supervise-child.ts
24834
- import os9 from "os";
24721
+ import os8 from "os";
24835
24722
  var FORCE_KILL_MS = 2000;
24836
24723
  function exitCodeFromClose(code, signal) {
24837
24724
  if (code != null)
24838
24725
  return code;
24839
24726
  if (signal) {
24840
- const num = os9.constants.signals[signal];
24727
+ const num = os8.constants.signals[signal];
24841
24728
  return typeof num === "number" ? 128 + num : 1;
24842
24729
  }
24843
24730
  return 0;
@@ -24903,14 +24790,14 @@ function superviseChild(child, options = {}) {
24903
24790
  // src/runner/script-runner.ts
24904
24791
  init_src();
24905
24792
  async function findAgentRoot(startPath) {
24906
- let currentPath = path47.resolve(startPath);
24907
- const root = path47.parse(currentPath).root;
24793
+ let currentPath = path46.resolve(startPath);
24794
+ const root = path46.parse(currentPath).root;
24908
24795
  while (currentPath !== root) {
24909
24796
  try {
24910
- await fs23.access(path47.join(currentPath, "agent.config.ts"));
24797
+ await fs22.access(path46.join(currentPath, "agent.config.ts"));
24911
24798
  return currentPath;
24912
24799
  } catch {
24913
- currentPath = path47.dirname(currentPath);
24800
+ currentPath = path46.dirname(currentPath);
24914
24801
  }
24915
24802
  }
24916
24803
  return null;
@@ -24922,7 +24809,7 @@ class ScriptRunner {
24922
24809
  prod;
24923
24810
  credentials;
24924
24811
  constructor(options) {
24925
- this.projectPath = path47.resolve(options.projectPath);
24812
+ this.projectPath = path46.resolve(options.projectPath);
24926
24813
  this.forceRegenerate = options.forceRegenerate ?? false;
24927
24814
  this.prod = options.prod ?? false;
24928
24815
  this.credentials = options.credentials;
@@ -24931,9 +24818,9 @@ class ScriptRunner {
24931
24818
  const project = await AgentProject.load(this.projectPath, {
24932
24819
  adkCommand: "adk-build"
24933
24820
  });
24934
- const botPath = path47.join(this.projectPath, ".adk", "bot");
24935
- const runnerPath = path47.join(botPath, "src", "script-runner.ts");
24936
- const botpressTypesPath = path47.join(botPath, ".botpress", "implementation", "index.ts");
24821
+ const botPath = path46.join(this.projectPath, ".adk", "bot");
24822
+ const runnerPath = path46.join(botPath, "src", "script-runner.ts");
24823
+ const botpressTypesPath = path46.join(botPath, ".botpress", "implementation", "index.ts");
24937
24824
  const needsRegenerate = this.forceRegenerate || !existsSync9(runnerPath) || !existsSync9(botpressTypesPath);
24938
24825
  if (needsRegenerate) {
24939
24826
  try {
@@ -25052,7 +24939,7 @@ class ScriptRunner {
25052
24939
 
25053
24940
  runScript()
25054
24941
  `;
25055
- await fs23.writeFile(path47.join(botPath, "src", "script-runner.ts"), await formatCode(content), "utf-8");
24942
+ await fs22.writeFile(path46.join(botPath, "src", "script-runner.ts"), await formatCode(content), "utf-8");
25056
24943
  }
25057
24944
  async setupTestRuntime(options = {}) {
25058
24945
  const { botPath, project } = await this.prepare();
@@ -25092,7 +24979,7 @@ class ScriptRunner {
25092
24979
  for (const [key, value] of Object.entries(envVars)) {
25093
24980
  process.env[key] = value;
25094
24981
  }
25095
- const runtimePath = path47.join(botPath, "src", "index.ts");
24982
+ const runtimePath = path46.join(botPath, "src", "index.ts");
25096
24983
  return {
25097
24984
  botPath,
25098
24985
  runtimePath,
@@ -25105,10 +24992,10 @@ class ScriptRunner {
25105
24992
  const runtimeModule = await import("@botpress/runtime/runtime");
25106
24993
  const { Autonomous: Autonomous2 } = await import("@botpress/runtime");
25107
24994
  const { context, agentRegistry } = runtimeModule;
25108
- const { Client: Client5 } = await import("@botpress/client");
24995
+ const { Client: Client6 } = await import("@botpress/client");
25109
24996
  const { BotSpecificClient, BotLogger } = await import("@botpress/sdk");
25110
24997
  const { Cognitive } = await import("@botpress/cognitive");
25111
- const vanillaClient = new Client5({
24998
+ const vanillaClient = new Client6({
25112
24999
  token: this.credentials.token,
25113
25000
  apiUrl: this.credentials.apiUrl,
25114
25001
  workspaceId,
@@ -25141,7 +25028,7 @@ class ScriptRunner {
25141
25028
  }
25142
25029
  async run(scriptPath, options = {}) {
25143
25030
  const { botPath, runnerPath, project } = await this.prepare();
25144
- const absoluteScriptPath = path47.isAbsolute(scriptPath) ? scriptPath : path47.resolve(this.projectPath, scriptPath);
25031
+ const absoluteScriptPath = path46.isAbsolute(scriptPath) ? scriptPath : path46.resolve(this.projectPath, scriptPath);
25145
25032
  if (!existsSync9(absoluteScriptPath)) {
25146
25033
  throw new AdkError({
25147
25034
  code: "SCRIPT_NOT_FOUND",
@@ -25298,7 +25185,6 @@ export {
25298
25185
  IntegrationParser,
25299
25186
  IntegrationManager,
25300
25187
  IntegrationCache,
25301
- HubCache,
25302
25188
  FileWatcher2 as FileWatcher,
25303
25189
  EnhancedInterfaceCache,
25304
25190
  DevIdManager,
@@ -25330,4 +25216,4 @@ export {
25330
25216
  ADK_MANIFEST_BOT_TAGS
25331
25217
  };
25332
25218
 
25333
- //# debugId=B63299D6F4E7B94864756E2164756E21
25219
+ //# debugId=32600FBA87BCDF0664756E2164756E21