@botpress/adk-cli 1.5.11 → 1.5.12

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 +76 -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.12", 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({
@@ -366418,14 +366418,14 @@ class ValidationErrors {
366418
366418
  context: { integration, version }
366419
366419
  };
366420
366420
  }
366421
- static unknownIntegration(integration, source) {
366421
+ static unknownIntegration(integration, source, detailedMessage) {
366422
366422
  return {
366423
366423
  $type: ValidationErrors.$type,
366424
366424
  code: "UNKNOWN_INTEGRATION",
366425
366425
  severity: "error",
366426
- message: `Unknown integration '${integration}' from source '${source}'`,
366426
+ message: detailedMessage || `Unknown integration '${integration}' from source '${source}'`,
366427
366427
  file: "dependencies.json",
366428
- hint: `Check if the integration name is correct or if it exists in ${source}`,
366428
+ hint: detailedMessage ? undefined : `Check if the integration name is correct or if it exists in ${source}`,
366429
366429
  context: { integration, source }
366430
366430
  };
366431
366431
  }
@@ -366692,7 +366692,8 @@ class IntegrationManager {
366692
366692
  if (error instanceof Error && error.message.includes("version")) {
366693
366693
  errors.push(ValidationErrors.integrationVersionError(integration.alias, error.message));
366694
366694
  } else {
366695
- errors.push(ValidationErrors.unknownIntegration(integration.alias, integration.ref.fullName));
366695
+ const errorMessage = error instanceof Error ? error.message : undefined;
366696
+ errors.push(ValidationErrors.unknownIntegration(integration.alias, integration.ref.fullName, errorMessage));
366696
366697
  }
366697
366698
  }
366698
366699
  });
@@ -366712,51 +366713,80 @@ class IntegrationManager {
366712
366713
  }
366713
366714
  }
366714
366715
  const client = await this.getClient();
366715
- let integrationResponse;
366716
- let versionError = null;
366716
+ const integration = await this._findPrivateOrPublicIntegration(client, ref);
366717
+ if (!integration) {
366718
+ throw await this._buildIntegrationNotFoundError(client, ref);
366719
+ }
366720
+ await this.cache.setResolution(ref.name, ref.version, ref.workspace, integration.id, integration.updatedAt);
366721
+ const definition = integration;
366722
+ await this.cache.setDefinition(integration.id, integration.updatedAt, definition);
366723
+ return definition;
366724
+ }
366725
+ async _findPrivateOrPublicIntegration(client, ref) {
366726
+ const privateIntegration = await this._findPrivateIntegration(client, ref);
366727
+ if (privateIntegration) {
366728
+ return privateIntegration;
366729
+ }
366730
+ const publicIntegration = await this._findPublicIntegration(client, ref);
366731
+ if (publicIntegration) {
366732
+ return publicIntegration;
366733
+ }
366734
+ return;
366735
+ }
366736
+ async _findPrivateIntegration(client, ref) {
366717
366737
  try {
366718
- integrationResponse = await client.getIntegrationByName({
366738
+ const version = ref.workspace && ref.version !== "latest" ? "latest" : ref.version;
366739
+ const response = await client.getIntegrationByName({
366740
+ name: ref.fullName,
366741
+ version
366742
+ });
366743
+ return response.integration;
366744
+ } catch (error) {
366745
+ if (this._isResourceNotFoundError(error)) {
366746
+ return;
366747
+ }
366748
+ throw error;
366749
+ }
366750
+ }
366751
+ async _findPublicIntegration(client, ref) {
366752
+ try {
366753
+ const response = await client.getPublicIntegration({
366719
366754
  name: ref.fullName,
366720
366755
  version: ref.version
366721
366756
  });
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;
366757
+ return response.integration;
366758
+ } catch (error) {
366759
+ if (this._isResourceNotFoundError(error)) {
366760
+ return;
366730
366761
  }
366762
+ throw error;
366731
366763
  }
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
- }
366764
+ }
366765
+ _isResourceNotFoundError(error) {
366766
+ if (error && typeof error === "object" && "type" in error) {
366767
+ return error.type === "ResourceNotFound";
366768
+ }
366769
+ return false;
366770
+ }
366771
+ async _buildIntegrationNotFoundError(client, ref) {
366772
+ if (!ref.workspace) {
366773
+ return new Error(`Integration "${ref.name}" not found in the official Botpress hub`);
366774
+ }
366775
+ let currentWorkspaceHandle;
366776
+ try {
366777
+ const credentials = this.options.credentials || await auth.getActiveCredentials();
366778
+ const workspaceId = this.options.workspaceId || credentials.workspaceId;
366779
+ if (workspaceId) {
366780
+ const currentWorkspace = await client.getWorkspace({ id: workspaceId });
366781
+ currentWorkspaceHandle = currentWorkspace?.handle;
366751
366782
  }
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}"`);
366783
+ } catch {
366784
+ return new Error(`Integration "${ref.name}" not found in workspace "${ref.workspace}"`);
366754
366785
  }
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;
366786
+ if (currentWorkspaceHandle === ref.workspace) {
366787
+ 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.`);
366788
+ }
366789
+ 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
366790
  }
366761
366791
  validateIntegration(integration) {
366762
366792
  const errors = [];
@@ -367779,7 +367809,7 @@ class AgentProjectGenerator {
367779
367809
  deploy: "adk deploy"
367780
367810
  },
367781
367811
  dependencies: {
367782
- "@botpress/runtime": "^1.3.11"
367812
+ "@botpress/runtime": "^1.3.12"
367783
367813
  },
367784
367814
  devDependencies: {
367785
367815
  typescript: "^5.0.0"
@@ -377020,7 +377050,7 @@ var init_Separator = __esm(async () => {
377020
377050
  var require_package3 = __commonJS((exports, module) => {
377021
377051
  module.exports = {
377022
377052
  name: "@botpress/adk",
377023
- version: "1.3.11",
377053
+ version: "1.3.12",
377024
377054
  description: "Core ADK library for building AI agents on Botpress",
377025
377055
  type: "module",
377026
377056
  main: "dist/index.js",
@@ -380245,7 +380275,7 @@ function checkRuntimeVersion(agentRoot) {
380245
380275
  `));
380246
380276
  }
380247
380277
  }
380248
- var semver, EXPECTED_RUNTIME_VERSION = "1.3.11";
380278
+ var semver, EXPECTED_RUNTIME_VERSION = "1.3.12";
380249
380279
  var init_runtime_version_check = __esm(() => {
380250
380280
  init_source();
380251
380281
  semver = __toESM(require_semver3(), 1);
@@ -395786,7 +395816,7 @@ function formatHelp(cmd, version) {
395786
395816
  // src/cli.ts
395787
395817
  var __filename2 = fileURLToPath9(import.meta.url);
395788
395818
  var __dirname5 = dirname3(__filename2);
395789
- var CLI_VERSION = "1.5.11";
395819
+ var CLI_VERSION = "1.5.12";
395790
395820
  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
395821
  formatHelp: () => formatHelp(program, CLI_VERSION)
395792
395822
  });
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.12",
4
4
  "description": "Command-line interface for the Botpress Agent Development Kit (ADK)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",