@promptbook/node 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
@@ -26,7 +26,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
26
26
  *
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- var PROMPTBOOK_ENGINE_VERSION = '0.75.1';
29
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.2';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
32
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -4758,16 +4758,16 @@ function $registeredScrapersMessage() {
4758
4758
  * Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
4759
4759
  */
4760
4760
  var all = [];
4761
- var _loop_1 = function (packageName, className) {
4761
+ var _loop_1 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
4762
4762
  if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
4763
4763
  return "continue";
4764
4764
  }
4765
- all.push({ packageName: packageName, className: className });
4765
+ all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
4766
4766
  };
4767
4767
  try {
4768
4768
  for (var _c = __values($scrapersMetadataRegister.list()), _d = _c.next(); !_d.done; _d = _c.next()) {
4769
- var _e = _d.value, packageName = _e.packageName, className = _e.className;
4770
- _loop_1(packageName, className);
4769
+ var _e = _d.value, packageName = _e.packageName, className = _e.className, mimeTypes = _e.mimeTypes, documentationUrl = _e.documentationUrl, isAvilableInBrowser = _e.isAvilableInBrowser;
4770
+ _loop_1(packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser);
4771
4771
  }
4772
4772
  }
4773
4773
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -4777,16 +4777,16 @@ function $registeredScrapersMessage() {
4777
4777
  }
4778
4778
  finally { if (e_1) throw e_1.error; }
4779
4779
  }
4780
- var _loop_2 = function (packageName, className) {
4780
+ var _loop_2 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
4781
4781
  if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
4782
4782
  return "continue";
4783
4783
  }
4784
- all.push({ packageName: packageName, className: className });
4784
+ all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
4785
4785
  };
4786
4786
  try {
4787
4787
  for (var _f = __values($scrapersRegister.list()), _g = _f.next(); !_g.done; _g = _f.next()) {
4788
- var _h = _g.value, packageName = _h.packageName, className = _h.className;
4789
- _loop_2(packageName, className);
4788
+ var _h = _g.value, packageName = _h.packageName, className = _h.className, mimeTypes = _h.mimeTypes, documentationUrl = _h.documentationUrl, isAvilableInBrowser = _h.isAvilableInBrowser;
4789
+ _loop_2(packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser);
4790
4790
  }
4791
4791
  }
4792
4792
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -4816,29 +4816,33 @@ function $registeredScrapersMessage() {
4816
4816
  }
4817
4817
  return spaceTrim$1(function (block) { return "\n Available scrapers are:\n ".concat(block(metadata
4818
4818
  .map(function (_a, i) {
4819
- var packageName = _a.packageName, className = _a.className, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled;
4819
+ var packageName = _a.packageName, className = _a.className, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled, mimeTypes = _a.mimeTypes, isAvilableInBrowser = _a.isAvilableInBrowser;
4820
4820
  var more;
4821
+ // TODO: Use documentationUrl
4821
4822
  if (just(false)) {
4822
4823
  more = '';
4823
4824
  }
4824
4825
  else if (!isMetadataAviailable && !isInstalled) {
4825
4826
  // TODO: [�][�] Maybe do allow to do auto-install if package not registered and not found
4826
- more = "(not installed and no metadata, looks like a unexpected behavior)";
4827
+ more = "*(not installed and no metadata, looks like a unexpected behavior)*";
4827
4828
  }
4828
4829
  else if (isMetadataAviailable && !isInstalled) {
4829
4830
  // TODO: [�][�]
4830
- more = "(not installed)";
4831
+ more = "*(not installed)*";
4831
4832
  }
4832
4833
  else if (!isMetadataAviailable && isInstalled) {
4833
- more = "(no metadata, looks like a unexpected behavior)";
4834
+ more = "*(no metadata, looks like a unexpected behavior)*";
4834
4835
  }
4835
4836
  else if (isMetadataAviailable && isInstalled) {
4836
4837
  more = "(installed)";
4837
4838
  }
4838
4839
  else {
4839
- more = "(unknown state, looks like a unexpected behavior)";
4840
+ more = "*(unknown state, looks like a unexpected behavior)*";
4840
4841
  }
4841
- return "".concat(i + 1, ") `").concat(className, "` from `").concat(packageName, "` ").concat(more);
4842
+ if (!isAvilableInBrowser) {
4843
+ more += " *(not available in browser)*";
4844
+ }
4845
+ return "".concat(i + 1, ") `").concat(className, "` from `").concat(packageName, "` compatible to scrape ").concat(mimeTypes.join(', '), " ").concat(more);
4842
4846
  })
4843
4847
  .join('\n')), "\n "); });
4844
4848
  }
@@ -5223,7 +5227,10 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
5223
5227
  return [7 /*endfinally*/];
5224
5228
  case 9:
5225
5229
  if (partialPieces === null) {
5226
- 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 "); }));
5230
+ throw new KnowledgeScrapeError(spaceTrim$1(function (block) { return "\n Cannot scrape knowledge from source:\n \n > ".concat(block(knowledgeSource.sourceContent
5231
+ .split('\n')
5232
+ .map(function (line) { return "> ".concat(line); })
5233
+ .join('\n')), "\n\n No scraper found for the mime type \"").concat(sourceHandler.mimeType, "\"\n\n ").concat(block($registeredScrapersMessage()), "\n\n\n "); }));
5227
5234
  }
5228
5235
  pieces = partialPieces.map(function (partialPiece) { return (__assign(__assign({}, partialPiece), { sources: [
5229
5236
  {