@promptbook/cli 0.75.2 → 0.75.3

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/esm/index.es.js CHANGED
@@ -37,7 +37,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
37
37
  *
38
38
  * @see https://github.com/webgptorg/promptbook
39
39
  */
40
- var PROMPTBOOK_ENGINE_VERSION = '0.75.1';
40
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.2';
41
41
  /**
42
42
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
43
43
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -4961,16 +4961,16 @@ function $registeredScrapersMessage() {
4961
4961
  * Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
4962
4962
  */
4963
4963
  var all = [];
4964
- var _loop_1 = function (packageName, className) {
4964
+ var _loop_1 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
4965
4965
  if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
4966
4966
  return "continue";
4967
4967
  }
4968
- all.push({ packageName: packageName, className: className });
4968
+ all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
4969
4969
  };
4970
4970
  try {
4971
4971
  for (var _c = __values($scrapersMetadataRegister.list()), _d = _c.next(); !_d.done; _d = _c.next()) {
4972
- var _e = _d.value, packageName = _e.packageName, className = _e.className;
4973
- _loop_1(packageName, className);
4972
+ var _e = _d.value, packageName = _e.packageName, className = _e.className, mimeTypes = _e.mimeTypes, documentationUrl = _e.documentationUrl, isAvilableInBrowser = _e.isAvilableInBrowser;
4973
+ _loop_1(packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser);
4974
4974
  }
4975
4975
  }
4976
4976
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -4980,16 +4980,16 @@ function $registeredScrapersMessage() {
4980
4980
  }
4981
4981
  finally { if (e_1) throw e_1.error; }
4982
4982
  }
4983
- var _loop_2 = function (packageName, className) {
4983
+ var _loop_2 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
4984
4984
  if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
4985
4985
  return "continue";
4986
4986
  }
4987
- all.push({ packageName: packageName, className: className });
4987
+ all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
4988
4988
  };
4989
4989
  try {
4990
4990
  for (var _f = __values($scrapersRegister.list()), _g = _f.next(); !_g.done; _g = _f.next()) {
4991
- var _h = _g.value, packageName = _h.packageName, className = _h.className;
4992
- _loop_2(packageName, className);
4991
+ var _h = _g.value, packageName = _h.packageName, className = _h.className, mimeTypes = _h.mimeTypes, documentationUrl = _h.documentationUrl, isAvilableInBrowser = _h.isAvilableInBrowser;
4992
+ _loop_2(packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser);
4993
4993
  }
4994
4994
  }
4995
4995
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -5019,29 +5019,33 @@ function $registeredScrapersMessage() {
5019
5019
  }
5020
5020
  return spaceTrim$1(function (block) { return "\n Available scrapers are:\n ".concat(block(metadata
5021
5021
  .map(function (_a, i) {
5022
- var packageName = _a.packageName, className = _a.className, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled;
5022
+ var packageName = _a.packageName, className = _a.className, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled, mimeTypes = _a.mimeTypes, isAvilableInBrowser = _a.isAvilableInBrowser;
5023
5023
  var more;
5024
+ // TODO: Use documentationUrl
5024
5025
  if (just(false)) {
5025
5026
  more = '';
5026
5027
  }
5027
5028
  else if (!isMetadataAviailable && !isInstalled) {
5028
5029
  // TODO: [�][�] Maybe do allow to do auto-install if package not registered and not found
5029
- more = "(not installed and no metadata, looks like a unexpected behavior)";
5030
+ more = "*(not installed and no metadata, looks like a unexpected behavior)*";
5030
5031
  }
5031
5032
  else if (isMetadataAviailable && !isInstalled) {
5032
5033
  // TODO: [�][�]
5033
- more = "(not installed)";
5034
+ more = "*(not installed)*";
5034
5035
  }
5035
5036
  else if (!isMetadataAviailable && isInstalled) {
5036
- more = "(no metadata, looks like a unexpected behavior)";
5037
+ more = "*(no metadata, looks like a unexpected behavior)*";
5037
5038
  }
5038
5039
  else if (isMetadataAviailable && isInstalled) {
5039
5040
  more = "(installed)";
5040
5041
  }
5041
5042
  else {
5042
- more = "(unknown state, looks like a unexpected behavior)";
5043
+ more = "*(unknown state, looks like a unexpected behavior)*";
5043
5044
  }
5044
- return "".concat(i + 1, ") `").concat(className, "` from `").concat(packageName, "` ").concat(more);
5045
+ if (!isAvilableInBrowser) {
5046
+ more += " *(not available in browser)*";
5047
+ }
5048
+ return "".concat(i + 1, ") `").concat(className, "` from `").concat(packageName, "` compatible to scrape ").concat(mimeTypes.join(', '), " ").concat(more);
5045
5049
  })
5046
5050
  .join('\n')), "\n "); });
5047
5051
  }
@@ -5426,7 +5430,10 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
5426
5430
  return [7 /*endfinally*/];
5427
5431
  case 9:
5428
5432
  if (partialPieces === null) {
5429
- throw new KnowledgeScrapeError(spaceTrim$1(function (block) { return "\n Cannot scrape knowledge from source: ".concat(knowledgeSource.sourceContent, "\n\n No scraper found for the mime type \"").concat(sourceHandler.mimeType, "\"\n\n ").concat(block($registeredScrapersMessage()), "\n\n\n "); }));
5433
+ throw new KnowledgeScrapeError(spaceTrim$1(function (block) { return "\n Cannot scrape knowledge from source:\n \n > ".concat(block(knowledgeSource.sourceContent
5434
+ .split('\n')
5435
+ .map(function (line) { return "> ".concat(line); })
5436
+ .join('\n')), "\n\n No scraper found for the mime type \"").concat(sourceHandler.mimeType, "\"\n\n ").concat(block($registeredScrapersMessage()), "\n\n\n "); }));
5430
5437
  }
5431
5438
  pieces = partialPieces.map(function (partialPiece) { return (__assign(__assign({}, partialPiece), { sources: [
5432
5439
  {