@botpress/adk-cli 1.7.14 → 1.7.16

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 +169 -12
  2. package/package.json +3 -3
package/dist/cli.js CHANGED
@@ -346924,7 +346924,7 @@ var init_internal = __esm(() => {
346924
346924
  });
346925
346925
  init_define_PACKAGE_VERSIONS = __esm2({
346926
346926
  "<define:__PACKAGE_VERSIONS__>"() {
346927
- define_PACKAGE_VERSIONS_default = { runtime: "1.7.14", adk: "1.7.14", sdk: "4.19.0", llmz: "0.0.31", zai: "2.5.0", cognitive: "0.2.0" };
346927
+ define_PACKAGE_VERSIONS_default = { runtime: "1.7.16", adk: "1.7.16", sdk: "4.19.0", llmz: "0.0.31", zai: "2.5.0", cognitive: "0.2.0" };
346928
346928
  }
346929
346929
  });
346930
346930
  init_globalThis = __esm2({
@@ -381402,6 +381402,12 @@ If the question is not related to the knowledge bases, do NOT use this tool.`.tr
381402
381402
  if (tags[WellKnownTags.knowledge.KNOWLEDGE_SOURCE_ID]) {
381403
381403
  citationMetadata.sourceId = tags[WellKnownTags.knowledge.KNOWLEDGE_SOURCE_ID];
381404
381404
  }
381405
+ for (const key in citationMetadata) {
381406
+ let value2 = citationMetadata[key];
381407
+ if (typeof value2 !== "string" || value2.trim().length === 0 || value2.length > 1024) {
381408
+ delete citationMetadata[key];
381409
+ }
381410
+ }
381405
381411
  const { tag } = citations.registerSource(citationMetadata);
381406
381412
  message3.push(`<${tag} file="${p.file.key}" title="${citationMetadata.title || p.file.key}">`);
381407
381413
  message3.push(p.content);
@@ -627100,7 +627106,7 @@ class AgentProjectGenerator {
627100
627106
  deploy: "adk deploy"
627101
627107
  },
627102
627108
  dependencies: {
627103
- "@botpress/runtime": "^1.7.14"
627109
+ "@botpress/runtime": "^1.7.16"
627104
627110
  },
627105
627111
  devDependencies: {
627106
627112
  typescript: "^5.9.3"
@@ -630051,7 +630057,7 @@ var import_ts_morph, __defProp9, __commonJS5 = (cb4, mod) => () => (mod || cb4((
630051
630057
  `));
630052
630058
  return code;
630053
630059
  }
630054
- }, ADK_VERSION = "1.7.14", relative2 = (from, to3) => {
630060
+ }, ADK_VERSION = "1.7.16", relative2 = (from, to3) => {
630055
630061
  const fromDir = path10.dirname(from);
630056
630062
  const relative32 = path10.relative(fromDir, to3);
630057
630063
  return relative32.startsWith(".") ? relative32 : `./${relative32}`;
@@ -630249,7 +630255,7 @@ var init_dist15 = __esm(() => {
630249
630255
  require_package3 = __commonJS5((exports, module) => {
630250
630256
  module.exports = {
630251
630257
  name: "@botpress/adk",
630252
- version: "1.7.14",
630258
+ version: "1.7.16",
630253
630259
  description: "Core ADK library for building AI agents on Botpress",
630254
630260
  type: "module",
630255
630261
  main: "dist/index.js",
@@ -630296,7 +630302,7 @@ var init_dist15 = __esm(() => {
630296
630302
  "@botpress/cli": "^4.23",
630297
630303
  "@botpress/client": "^1.27.0",
630298
630304
  "@botpress/cognitive": "^0.2.0",
630299
- "@botpress/runtime": "^1.7.14",
630305
+ "@botpress/runtime": "^1.7.16",
630300
630306
  "@botpress/sdk": "^4.18.1",
630301
630307
  "@bpinternal/yargs-extra": "^0.0.21",
630302
630308
  "@parcel/watcher": "^2.5.1",
@@ -636775,7 +636781,7 @@ var init_Separator = __esm(async () => {
636775
636781
  var require_package4 = __commonJS((exports, module) => {
636776
636782
  module.exports = {
636777
636783
  name: "@botpress/adk",
636778
- version: "1.7.14",
636784
+ version: "1.7.16",
636779
636785
  description: "Core ADK library for building AI agents on Botpress",
636780
636786
  type: "module",
636781
636787
  main: "dist/index.js",
@@ -636822,7 +636828,7 @@ var require_package4 = __commonJS((exports, module) => {
636822
636828
  "@botpress/cli": "^4.23",
636823
636829
  "@botpress/client": "^1.27.0",
636824
636830
  "@botpress/cognitive": "^0.2.0",
636825
- "@botpress/runtime": "^1.7.14",
636831
+ "@botpress/runtime": "^1.7.16",
636826
636832
  "@botpress/sdk": "^4.18.1",
636827
636833
  "@bpinternal/yargs-extra": "^0.0.21",
636828
636834
  "@parcel/watcher": "^2.5.1",
@@ -638298,7 +638304,7 @@ function checkRuntimeVersion(agentRoot) {
638298
638304
  `));
638299
638305
  }
638300
638306
  }
638301
- var semver2, EXPECTED_RUNTIME_VERSION = "1.7.14";
638307
+ var semver2, EXPECTED_RUNTIME_VERSION = "1.7.16";
638302
638308
  var init_runtime_version_check = __esm(() => {
638303
638309
  init_source();
638304
638310
  semver2 = __toESM(require_semver2(), 1);
@@ -654219,6 +654225,33 @@ function formatHelp(cmd, version) {
654219
654225
  return sections.join(`
654220
654226
  `);
654221
654227
  }
654228
+ function formatCommandHelp(cmd) {
654229
+ const theme = defaultTheme;
654230
+ const sections = [];
654231
+ sections.push("");
654232
+ sections.push(source_default.hex(theme.text.primary).bold(cmd.name()));
654233
+ sections.push(source_default.hex(theme.text.secondary)(cmd.description()));
654234
+ sections.push("");
654235
+ sections.push(source_default.hex(theme.text.primary).bold("Usage"));
654236
+ const usage = cmd.usage();
654237
+ sections.push(` ${source_default.hex(theme.text.dim)("$")} ${source_default.hex(theme.accent.cyan)("adk")} ${source_default.hex(theme.accent.cyan)(cmd.name())} ${source_default.hex(theme.text.dim)(usage)}`);
654238
+ sections.push("");
654239
+ const options = cmd.options;
654240
+ if (options.length > 0) {
654241
+ sections.push(source_default.hex(theme.text.primary).bold("Options"));
654242
+ for (const option of options) {
654243
+ const flags = option.flags;
654244
+ const description = option.description;
654245
+ const flagsDisplay = source_default.hex(theme.accent.yellow)(flags);
654246
+ const flagsPadded = flagsDisplay.padEnd(30);
654247
+ const descriptionText = source_default.hex(theme.text.secondary)(description);
654248
+ sections.push(` ${flagsPadded} ${descriptionText}`);
654249
+ }
654250
+ sections.push("");
654251
+ }
654252
+ return sections.join(`
654253
+ `);
654254
+ }
654222
654255
  function formatWelcome(version) {
654223
654256
  const theme = defaultTheme;
654224
654257
  const logoLine1 = source_default.hex(theme.accent.purple)(" \u2584\u2580\u2588 \u2588\u2580\u2584 \u2588\u2584\u2580");
@@ -654268,11 +654301,114 @@ function formatWelcome(version) {
654268
654301
  // src/cli.ts
654269
654302
  init_node_version_check();
654270
654303
  init_agent_root();
654304
+
654305
+ // src/utils/string-similarity.ts
654306
+ function calculateLevenshteinDistance(str1, str2) {
654307
+ const len1 = str1.length;
654308
+ const len2 = str2.length;
654309
+ const matrix = [];
654310
+ for (let i = 0;i <= len1; i++) {
654311
+ matrix[i] = [i];
654312
+ }
654313
+ for (let j = 0;j <= len2; j++) {
654314
+ matrix[0][j] = j;
654315
+ }
654316
+ for (let i = 1;i <= len1; i++) {
654317
+ for (let j = 1;j <= len2; j++) {
654318
+ if (str1[i - 1] === str2[j - 1]) {
654319
+ matrix[i][j] = matrix[i - 1][j - 1];
654320
+ } else {
654321
+ matrix[i][j] = Math.min(matrix[i - 1][j] + 1, matrix[i][j - 1] + 1, matrix[i - 1][j - 1] + 1);
654322
+ }
654323
+ }
654324
+ }
654325
+ return matrix[len1][len2];
654326
+ }
654327
+ function calculateSimilarityScore(str1, str2) {
654328
+ const len1 = str1.length;
654329
+ const len2 = str2.length;
654330
+ const maxLen = Math.max(len1, len2);
654331
+ const minLen = Math.min(len1, len2);
654332
+ if (maxLen === 0)
654333
+ return 1;
654334
+ const distance = calculateLevenshteinDistance(str1, str2);
654335
+ let score = 1 - distance / maxLen;
654336
+ const lengthDiff = Math.abs(len1 - len2);
654337
+ if (lengthDiff > 2) {
654338
+ score *= 0.5;
654339
+ } else if (lengthDiff > 1) {
654340
+ score *= 0.75;
654341
+ }
654342
+ if (str1[0] === str2[0]) {
654343
+ score *= 1.1;
654344
+ const prefixLen = Math.min(3, minLen);
654345
+ if (str1.slice(0, prefixLen) === str2.slice(0, prefixLen)) {
654346
+ score *= 1.15;
654347
+ }
654348
+ }
654349
+ return Math.min(1, score);
654350
+ }
654351
+
654352
+ // src/utils/command-suggestions.ts
654353
+ function findSimilarCommands(unknownCommand, allCommands) {
654354
+ const commandNames = [];
654355
+ for (const cmd of allCommands) {
654356
+ const cmdName = cmd.name();
654357
+ const aliases = cmd.aliases();
654358
+ const mainScore = calculateSimilarityScore(unknownCommand.toLowerCase(), cmdName.toLowerCase());
654359
+ commandNames.push({ command: cmd, name: cmdName, score: mainScore });
654360
+ for (const alias of aliases) {
654361
+ const aliasScore = calculateSimilarityScore(unknownCommand.toLowerCase(), alias.toLowerCase());
654362
+ commandNames.push({ command: cmd, name: alias, score: aliasScore });
654363
+ }
654364
+ }
654365
+ commandNames.sort((a, b) => b.score - a.score);
654366
+ const filtered = commandNames.filter((item) => {
654367
+ if (item.name.toLowerCase() === unknownCommand.toLowerCase()) {
654368
+ return false;
654369
+ }
654370
+ if (item.score < 0.5) {
654371
+ return false;
654372
+ }
654373
+ const lengthDiff = Math.abs(unknownCommand.length - item.name.length);
654374
+ if (lengthDiff > 3 && item.score < 0.65) {
654375
+ return false;
654376
+ }
654377
+ return true;
654378
+ });
654379
+ const seen = new Set;
654380
+ const unique = [];
654381
+ for (const item of filtered) {
654382
+ if (!seen.has(item.command)) {
654383
+ seen.add(item.command);
654384
+ unique.push(item.command);
654385
+ if (unique.length >= 3)
654386
+ break;
654387
+ }
654388
+ }
654389
+ return unique;
654390
+ }
654391
+ function formatSuggestion(unknownCommand, suggestions) {
654392
+ if (suggestions.length === 0) {
654393
+ return "";
654394
+ }
654395
+ if (suggestions.length === 1) {
654396
+ return `Did you mean ${suggestions[0].name()}?`;
654397
+ }
654398
+ const names = suggestions.map((cmd) => cmd.name());
654399
+ if (suggestions.length === 2) {
654400
+ return `Did you mean ${names[0]} or ${names[1]}?`;
654401
+ }
654402
+ return `Did you mean ${names.slice(0, -1).join(", ")}, or ${names[names.length - 1]}?`;
654403
+ }
654404
+
654405
+ // src/cli.ts
654406
+ init_source();
654271
654407
  if (!checkNodeVersion(true)) {
654272
654408
  checkNodeVersion(false);
654273
654409
  process.exit(1);
654274
654410
  }
654275
- var CLI_VERSION = "1.7.14";
654411
+ var CLI_VERSION = "1.7.16";
654276
654412
 
654277
654413
  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({
654278
654414
  formatHelp: () => formatHelp(program, CLI_VERSION)
@@ -654478,10 +654614,31 @@ assets.command("pull").description("Download remote assets to local directory").
654478
654614
  process.exit(1);
654479
654615
  }
654480
654616
  });
654617
+ function configureAllCommandsHelp() {
654618
+ function configureHelpRecursive(cmd) {
654619
+ cmd.configureHelp({
654620
+ formatHelp: () => formatCommandHelp(cmd)
654621
+ });
654622
+ cmd.commands.forEach((subcmd) => {
654623
+ configureHelpRecursive(subcmd);
654624
+ });
654625
+ }
654626
+ program.commands.forEach((cmd) => {
654627
+ configureHelpRecursive(cmd);
654628
+ });
654629
+ }
654630
+ configureAllCommandsHelp();
654481
654631
  program.on("command:*", function(operands) {
654482
- console.error(`
654483
- Error: Unknown command '${operands[0]}'
654484
- `);
654632
+ const unknownCommand = operands[0];
654633
+ const allCommands = Array.from(program.commands);
654634
+ const suggestions = findSimilarCommands(unknownCommand, allCommands);
654635
+ const suggestionText = formatSuggestion(unknownCommand, suggestions);
654636
+ console.error(source_default.red(`adk: "${unknownCommand}" is not an adk command. See 'adk help'.
654637
+ `));
654638
+ if (suggestionText) {
654639
+ console.error(source_default.yellow(`\uD83D\uDCA1 ${suggestionText}
654640
+ `));
654641
+ }
654485
654642
  program.help();
654486
654643
  });
654487
654644
  async function main() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/adk-cli",
3
- "version": "1.7.14",
3
+ "version": "1.7.16",
4
4
  "description": "Command-line interface for the Botpress Agent Development Kit (ADK)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -40,9 +40,9 @@
40
40
  "url": "https://github.com/botpress/adk"
41
41
  },
42
42
  "dependencies": {
43
- "@botpress/adk": "^1.7.14",
43
+ "@botpress/adk": "^1.7.16",
44
44
  "@botpress/cli": "^4.23",
45
- "@botpress/runtime": "^1.7.14",
45
+ "@botpress/runtime": "^1.7.16",
46
46
  "adm-zip": "^0.5.16",
47
47
  "chalk": "^5.4.1",
48
48
  "clipboardy": "^4.0.0",