@promptbook/legacy-documents 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
@@ -23,7 +23,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
23
23
  *
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- var PROMPTBOOK_ENGINE_VERSION = '0.75.1';
26
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.2';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
29
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -3167,16 +3167,16 @@ function $registeredScrapersMessage() {
3167
3167
  * Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
3168
3168
  */
3169
3169
  var all = [];
3170
- var _loop_1 = function (packageName, className) {
3170
+ var _loop_1 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
3171
3171
  if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
3172
3172
  return "continue";
3173
3173
  }
3174
- all.push({ packageName: packageName, className: className });
3174
+ all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
3175
3175
  };
3176
3176
  try {
3177
3177
  for (var _c = __values($scrapersMetadataRegister.list()), _d = _c.next(); !_d.done; _d = _c.next()) {
3178
- var _e = _d.value, packageName = _e.packageName, className = _e.className;
3179
- _loop_1(packageName, className);
3178
+ var _e = _d.value, packageName = _e.packageName, className = _e.className, mimeTypes = _e.mimeTypes, documentationUrl = _e.documentationUrl, isAvilableInBrowser = _e.isAvilableInBrowser;
3179
+ _loop_1(packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser);
3180
3180
  }
3181
3181
  }
3182
3182
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -3186,16 +3186,16 @@ function $registeredScrapersMessage() {
3186
3186
  }
3187
3187
  finally { if (e_1) throw e_1.error; }
3188
3188
  }
3189
- var _loop_2 = function (packageName, className) {
3189
+ var _loop_2 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
3190
3190
  if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
3191
3191
  return "continue";
3192
3192
  }
3193
- all.push({ packageName: packageName, className: className });
3193
+ all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
3194
3194
  };
3195
3195
  try {
3196
3196
  for (var _f = __values($scrapersRegister.list()), _g = _f.next(); !_g.done; _g = _f.next()) {
3197
- var _h = _g.value, packageName = _h.packageName, className = _h.className;
3198
- _loop_2(packageName, className);
3197
+ var _h = _g.value, packageName = _h.packageName, className = _h.className, mimeTypes = _h.mimeTypes, documentationUrl = _h.documentationUrl, isAvilableInBrowser = _h.isAvilableInBrowser;
3198
+ _loop_2(packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser);
3199
3199
  }
3200
3200
  }
3201
3201
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -3225,29 +3225,33 @@ function $registeredScrapersMessage() {
3225
3225
  }
3226
3226
  return spaceTrim$1(function (block) { return "\n Available scrapers are:\n ".concat(block(metadata
3227
3227
  .map(function (_a, i) {
3228
- var packageName = _a.packageName, className = _a.className, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled;
3228
+ var packageName = _a.packageName, className = _a.className, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled, mimeTypes = _a.mimeTypes, isAvilableInBrowser = _a.isAvilableInBrowser;
3229
3229
  var more;
3230
+ // TODO: Use documentationUrl
3230
3231
  if (just(false)) {
3231
3232
  more = '';
3232
3233
  }
3233
3234
  else if (!isMetadataAviailable && !isInstalled) {
3234
3235
  // TODO: [�][�] Maybe do allow to do auto-install if package not registered and not found
3235
- more = "(not installed and no metadata, looks like a unexpected behavior)";
3236
+ more = "*(not installed and no metadata, looks like a unexpected behavior)*";
3236
3237
  }
3237
3238
  else if (isMetadataAviailable && !isInstalled) {
3238
3239
  // TODO: [�][�]
3239
- more = "(not installed)";
3240
+ more = "*(not installed)*";
3240
3241
  }
3241
3242
  else if (!isMetadataAviailable && isInstalled) {
3242
- more = "(no metadata, looks like a unexpected behavior)";
3243
+ more = "*(no metadata, looks like a unexpected behavior)*";
3243
3244
  }
3244
3245
  else if (isMetadataAviailable && isInstalled) {
3245
3246
  more = "(installed)";
3246
3247
  }
3247
3248
  else {
3248
- more = "(unknown state, looks like a unexpected behavior)";
3249
+ more = "*(unknown state, looks like a unexpected behavior)*";
3249
3250
  }
3250
- return "".concat(i + 1, ") `").concat(className, "` from `").concat(packageName, "` ").concat(more);
3251
+ if (!isAvilableInBrowser) {
3252
+ more += " *(not available in browser)*";
3253
+ }
3254
+ return "".concat(i + 1, ") `").concat(className, "` from `").concat(packageName, "` compatible to scrape ").concat(mimeTypes.join(', '), " ").concat(more);
3251
3255
  })
3252
3256
  .join('\n')), "\n "); });
3253
3257
  }
@@ -3498,7 +3502,10 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
3498
3502
  return [7 /*endfinally*/];
3499
3503
  case 9:
3500
3504
  if (partialPieces === null) {
3501
- 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 "); }));
3505
+ throw new KnowledgeScrapeError(spaceTrim$1(function (block) { return "\n Cannot scrape knowledge from source:\n \n > ".concat(block(knowledgeSource.sourceContent
3506
+ .split('\n')
3507
+ .map(function (line) { return "> ".concat(line); })
3508
+ .join('\n')), "\n\n No scraper found for the mime type \"").concat(sourceHandler.mimeType, "\"\n\n ").concat(block($registeredScrapersMessage()), "\n\n\n "); }));
3502
3509
  }
3503
3510
  pieces = partialPieces.map(function (partialPiece) { return (__assign(__assign({}, partialPiece), { sources: [
3504
3511
  {