@promptbook/node 0.75.1 → 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.0';
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
@@ -1796,7 +1796,6 @@ function validatePipelineCore(pipeline) {
1796
1796
  while (unresovedTasks.length > 0) {
1797
1797
  _loop_3();
1798
1798
  }
1799
- // TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
1800
1799
  }
1801
1800
  /**
1802
1801
  * TODO: !! [🧞‍♀️] Do not allow joker + foreach
@@ -4759,16 +4758,16 @@ function $registeredScrapersMessage() {
4759
4758
  * Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
4760
4759
  */
4761
4760
  var all = [];
4762
- var _loop_1 = function (packageName, className) {
4761
+ var _loop_1 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
4763
4762
  if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
4764
4763
  return "continue";
4765
4764
  }
4766
- all.push({ packageName: packageName, className: className });
4765
+ all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
4767
4766
  };
4768
4767
  try {
4769
4768
  for (var _c = __values($scrapersMetadataRegister.list()), _d = _c.next(); !_d.done; _d = _c.next()) {
4770
- var _e = _d.value, packageName = _e.packageName, className = _e.className;
4771
- _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);
4772
4771
  }
4773
4772
  }
4774
4773
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -4778,16 +4777,16 @@ function $registeredScrapersMessage() {
4778
4777
  }
4779
4778
  finally { if (e_1) throw e_1.error; }
4780
4779
  }
4781
- var _loop_2 = function (packageName, className) {
4780
+ var _loop_2 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
4782
4781
  if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
4783
4782
  return "continue";
4784
4783
  }
4785
- all.push({ packageName: packageName, className: className });
4784
+ all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
4786
4785
  };
4787
4786
  try {
4788
4787
  for (var _f = __values($scrapersRegister.list()), _g = _f.next(); !_g.done; _g = _f.next()) {
4789
- var _h = _g.value, packageName = _h.packageName, className = _h.className;
4790
- _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);
4791
4790
  }
4792
4791
  }
4793
4792
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -4817,29 +4816,33 @@ function $registeredScrapersMessage() {
4817
4816
  }
4818
4817
  return spaceTrim$1(function (block) { return "\n Available scrapers are:\n ".concat(block(metadata
4819
4818
  .map(function (_a, i) {
4820
- 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;
4821
4820
  var more;
4821
+ // TODO: Use documentationUrl
4822
4822
  if (just(false)) {
4823
4823
  more = '';
4824
4824
  }
4825
4825
  else if (!isMetadataAviailable && !isInstalled) {
4826
4826
  // TODO: [�][�] Maybe do allow to do auto-install if package not registered and not found
4827
- more = "(not installed and no metadata, looks like a unexpected behavior)";
4827
+ more = "*(not installed and no metadata, looks like a unexpected behavior)*";
4828
4828
  }
4829
4829
  else if (isMetadataAviailable && !isInstalled) {
4830
4830
  // TODO: [�][�]
4831
- more = "(not installed)";
4831
+ more = "*(not installed)*";
4832
4832
  }
4833
4833
  else if (!isMetadataAviailable && isInstalled) {
4834
- more = "(no metadata, looks like a unexpected behavior)";
4834
+ more = "*(no metadata, looks like a unexpected behavior)*";
4835
4835
  }
4836
4836
  else if (isMetadataAviailable && isInstalled) {
4837
4837
  more = "(installed)";
4838
4838
  }
4839
4839
  else {
4840
- more = "(unknown state, looks like a unexpected behavior)";
4840
+ more = "*(unknown state, looks like a unexpected behavior)*";
4841
4841
  }
4842
- 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);
4843
4846
  })
4844
4847
  .join('\n')), "\n "); });
4845
4848
  }
@@ -5224,7 +5227,10 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
5224
5227
  return [7 /*endfinally*/];
5225
5228
  case 9:
5226
5229
  if (partialPieces === null) {
5227
- 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 "); }));
5228
5234
  }
5229
5235
  pieces = partialPieces.map(function (partialPiece) { return (__assign(__assign({}, partialPiece), { sources: [
5230
5236
  {