@botpress/adk-cli 1.5.11 → 1.5.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.
Files changed (2) hide show
  1. package/dist/cli.js +77 -46
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -315684,7 +315684,7 @@ var init_internal = __esm(() => {
315684
315684
  });
315685
315685
  init_define_PACKAGE_VERSIONS = __esm2({
315686
315686
  "<define:__PACKAGE_VERSIONS__>"() {
315687
- define_PACKAGE_VERSIONS_default = { runtime: "1.3.11", adk: "not-installed", sdk: "4.17.0", llmz: "0.0.26", zai: "2.1.16", cognitive: "0.1.47" };
315687
+ define_PACKAGE_VERSIONS_default = { runtime: "1.3.13", adk: "not-installed", sdk: "4.17.0", llmz: "0.0.26", zai: "2.1.16", cognitive: "0.1.47" };
315688
315688
  }
315689
315689
  });
315690
315690
  init_globalThis = __esm2({
@@ -350189,6 +350189,7 @@ If the question is not related to the knowledge bases, do NOT use this tool.`.tr
350189
350189
  }
350190
350190
  });
350191
350191
  }
350192
+ Autonomous2.createKnowledgeSearchTool = createKnowledgeSearchTool;
350192
350193
  function createExecute(options) {
350193
350194
  return async (props) => {
350194
350195
  const cognitive = context.get("cognitive");
@@ -366418,14 +366419,14 @@ class ValidationErrors {
366418
366419
  context: { integration, version }
366419
366420
  };
366420
366421
  }
366421
- static unknownIntegration(integration, source) {
366422
+ static unknownIntegration(integration, source, detailedMessage) {
366422
366423
  return {
366423
366424
  $type: ValidationErrors.$type,
366424
366425
  code: "UNKNOWN_INTEGRATION",
366425
366426
  severity: "error",
366426
- message: `Unknown integration '${integration}' from source '${source}'`,
366427
+ message: detailedMessage || `Unknown integration '${integration}' from source '${source}'`,
366427
366428
  file: "dependencies.json",
366428
- hint: `Check if the integration name is correct or if it exists in ${source}`,
366429
+ hint: detailedMessage ? undefined : `Check if the integration name is correct or if it exists in ${source}`,
366429
366430
  context: { integration, source }
366430
366431
  };
366431
366432
  }
@@ -366692,7 +366693,8 @@ class IntegrationManager {
366692
366693
  if (error instanceof Error && error.message.includes("version")) {
366693
366694
  errors.push(ValidationErrors.integrationVersionError(integration.alias, error.message));
366694
366695
  } else {
366695
- errors.push(ValidationErrors.unknownIntegration(integration.alias, integration.ref.fullName));
366696
+ const errorMessage = error instanceof Error ? error.message : undefined;
366697
+ errors.push(ValidationErrors.unknownIntegration(integration.alias, integration.ref.fullName, errorMessage));
366696
366698
  }
366697
366699
  }
366698
366700
  });
@@ -366712,51 +366714,80 @@ class IntegrationManager {
366712
366714
  }
366713
366715
  }
366714
366716
  const client = await this.getClient();
366715
- let integrationResponse;
366716
- let versionError = null;
366717
+ const integration = await this._findPrivateOrPublicIntegration(client, ref);
366718
+ if (!integration) {
366719
+ throw await this._buildIntegrationNotFoundError(client, ref);
366720
+ }
366721
+ await this.cache.setResolution(ref.name, ref.version, ref.workspace, integration.id, integration.updatedAt);
366722
+ const definition = integration;
366723
+ await this.cache.setDefinition(integration.id, integration.updatedAt, definition);
366724
+ return definition;
366725
+ }
366726
+ async _findPrivateOrPublicIntegration(client, ref) {
366727
+ const privateIntegration = await this._findPrivateIntegration(client, ref);
366728
+ if (privateIntegration) {
366729
+ return privateIntegration;
366730
+ }
366731
+ const publicIntegration = await this._findPublicIntegration(client, ref);
366732
+ if (publicIntegration) {
366733
+ return publicIntegration;
366734
+ }
366735
+ return;
366736
+ }
366737
+ async _findPrivateIntegration(client, ref) {
366717
366738
  try {
366718
- integrationResponse = await client.getIntegrationByName({
366739
+ const version = ref.workspace && ref.version !== "latest" ? "latest" : ref.version;
366740
+ const response = await client.getIntegrationByName({
366741
+ name: ref.fullName,
366742
+ version
366743
+ });
366744
+ return response.integration;
366745
+ } catch (error) {
366746
+ if (this._isResourceNotFoundError(error)) {
366747
+ return;
366748
+ }
366749
+ throw error;
366750
+ }
366751
+ }
366752
+ async _findPublicIntegration(client, ref) {
366753
+ try {
366754
+ const response = await client.getPublicIntegration({
366719
366755
  name: ref.fullName,
366720
366756
  version: ref.version
366721
366757
  });
366722
- } catch (privateError) {
366723
- try {
366724
- integrationResponse = await client.getPublicIntegration({
366725
- name: ref.name,
366726
- version: ref.version
366727
- });
366728
- } catch (publicError) {
366729
- versionError = publicError;
366758
+ return response.integration;
366759
+ } catch (error) {
366760
+ if (this._isResourceNotFoundError(error)) {
366761
+ return;
366730
366762
  }
366763
+ throw error;
366731
366764
  }
366732
- if (!integrationResponse && versionError) {
366733
- let latestVersion = null;
366734
- try {
366735
- const latestResponse = await client.getIntegrationByName({
366736
- name: ref.fullName,
366737
- version: "latest"
366738
- });
366739
- latestVersion = latestResponse.integration.version;
366740
- } catch {
366741
- try {
366742
- const latestResponse = await client.getPublicIntegration({
366743
- name: ref.fullName,
366744
- version: "latest"
366745
- });
366746
- latestVersion = latestResponse.integration.version;
366747
- } catch {
366748
- const location2 = ref.workspace ? `workspace "${ref.workspace}"` : "the official Botpress hub";
366749
- throw new Error(`Integration "${ref.name}" does not exist in ${location2}`);
366750
- }
366765
+ }
366766
+ _isResourceNotFoundError(error) {
366767
+ if (error && typeof error === "object" && "type" in error) {
366768
+ return error.type === "ResourceNotFound";
366769
+ }
366770
+ return false;
366771
+ }
366772
+ async _buildIntegrationNotFoundError(client, ref) {
366773
+ if (!ref.workspace) {
366774
+ return new Error(`Integration "${ref.name}" not found in the official Botpress hub`);
366775
+ }
366776
+ let currentWorkspaceHandle;
366777
+ try {
366778
+ const credentials = this.options.credentials || await auth.getActiveCredentials();
366779
+ const workspaceId = this.options.workspaceId || credentials.workspaceId;
366780
+ if (workspaceId) {
366781
+ const currentWorkspace = await client.getWorkspace({ id: workspaceId });
366782
+ currentWorkspaceHandle = currentWorkspace?.handle;
366751
366783
  }
366752
- const location = ref.workspace ? `workspace "${ref.workspace}"` : "Botpress";
366753
- throw new Error(`Integration "${ref.name}" version "${ref.version}" not found in ${location}. Latest available version is "${latestVersion}"`);
366784
+ } catch {
366785
+ return new Error(`Integration "${ref.name}" not found in workspace "${ref.workspace}"`);
366754
366786
  }
366755
- const integration = integrationResponse.integration;
366756
- await this.cache.setResolution(ref.name, ref.version, ref.workspace, integration.id, integration.updatedAt);
366757
- const definition = integration;
366758
- await this.cache.setDefinition(integration.id, integration.updatedAt, definition);
366759
- return definition;
366787
+ if (currentWorkspaceHandle === ref.workspace) {
366788
+ return new Error(`Integration "${ref.name}" not found in workspace "${ref.workspace}". Are you sure you published the integration? Run 'adk deploy' to publish it to your workspace.`);
366789
+ }
366790
+ return new Error(`Integration "${ref.name}" not found in workspace "${ref.workspace}". This integration may be private. Private integrations can only be installed in the same workspace. If you want to share this integration with other workspaces, deploy it with --visibility="unlisted" or --visibility="public".`);
366760
366791
  }
366761
366792
  validateIntegration(integration) {
366762
366793
  const errors = [];
@@ -367779,7 +367810,7 @@ class AgentProjectGenerator {
367779
367810
  deploy: "adk deploy"
367780
367811
  },
367781
367812
  dependencies: {
367782
- "@botpress/runtime": "^1.3.11"
367813
+ "@botpress/runtime": "^1.3.13"
367783
367814
  },
367784
367815
  devDependencies: {
367785
367816
  typescript: "^5.0.0"
@@ -377020,7 +377051,7 @@ var init_Separator = __esm(async () => {
377020
377051
  var require_package3 = __commonJS((exports, module) => {
377021
377052
  module.exports = {
377022
377053
  name: "@botpress/adk",
377023
- version: "1.3.11",
377054
+ version: "1.3.13",
377024
377055
  description: "Core ADK library for building AI agents on Botpress",
377025
377056
  type: "module",
377026
377057
  main: "dist/index.js",
@@ -380245,7 +380276,7 @@ function checkRuntimeVersion(agentRoot) {
380245
380276
  `));
380246
380277
  }
380247
380278
  }
380248
- var semver, EXPECTED_RUNTIME_VERSION = "1.3.11";
380279
+ var semver, EXPECTED_RUNTIME_VERSION = "1.3.13";
380249
380280
  var init_runtime_version_check = __esm(() => {
380250
380281
  init_source();
380251
380282
  semver = __toESM(require_semver3(), 1);
@@ -395786,7 +395817,7 @@ function formatHelp(cmd, version) {
395786
395817
  // src/cli.ts
395787
395818
  var __filename2 = fileURLToPath9(import.meta.url);
395788
395819
  var __dirname5 = dirname3(__filename2);
395789
- var CLI_VERSION = "1.5.11";
395820
+ var CLI_VERSION = "1.5.13";
395790
395821
  program.name("adk").description("Botpress Agent Development Kit (ADK) - CLI for building AI agents").version(CLI_VERSION).option("--no-cache", "Disable caching for integration lookups").configureHelp({
395791
395822
  formatHelp: () => formatHelp(program, CLI_VERSION)
395792
395823
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/adk-cli",
3
- "version": "1.5.11",
3
+ "version": "1.5.13",
4
4
  "description": "Command-line interface for the Botpress Agent Development Kit (ADK)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",