@promptbook/cli 0.84.0-0 → 0.84.0-10

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 (29) hide show
  1. package/README.md +1 -0
  2. package/esm/index.es.js +611 -208
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/cli.index.d.ts +8 -0
  5. package/esm/typings/src/_packages/core.index.d.ts +4 -0
  6. package/esm/typings/src/_packages/markitdown.index.d.ts +8 -0
  7. package/esm/typings/src/_packages/pdf.index.d.ts +6 -0
  8. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  9. package/esm/typings/src/_packages/wizzard.index.d.ts +8 -0
  10. package/esm/typings/src/constants.d.ts +1 -1
  11. package/esm/typings/src/executables/platforms/locateAppOnLinux.d.ts +1 -1
  12. package/esm/typings/src/executables/platforms/locateAppOnMacOs.d.ts +1 -1
  13. package/esm/typings/src/pipeline/book-notation.d.ts +4 -0
  14. package/esm/typings/src/pipeline/prompt-notation.d.ts +18 -0
  15. package/esm/typings/src/pipeline/prompt-notation.test.d.ts +4 -0
  16. package/esm/typings/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +43 -0
  17. package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +20 -0
  18. package/esm/typings/src/scrapers/_boilerplate/playground/boilerplate-scraper-playground.d.ts +5 -0
  19. package/esm/typings/src/scrapers/_boilerplate/register-constructor.d.ts +15 -0
  20. package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +28 -0
  21. package/esm/typings/src/scrapers/markitdown/MarkitdownScraper.d.ts +50 -0
  22. package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +22 -0
  23. package/esm/typings/src/scrapers/markitdown/playground/markitdown-scraper-playground.d.ts +5 -0
  24. package/esm/typings/src/scrapers/markitdown/register-constructor.d.ts +17 -0
  25. package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +28 -0
  26. package/esm/typings/src/types/typeAliases.d.ts +1 -1
  27. package/package.json +3 -2
  28. package/umd/index.umd.js +617 -209
  29. package/umd/index.umd.js.map +1 -1
package/esm/index.es.js CHANGED
@@ -12,8 +12,7 @@ import parserHtml from 'prettier/parser-html';
12
12
  import { unparse, parse } from 'papaparse';
13
13
  import { SHA256 } from 'crypto-js';
14
14
  import { lookup } from 'mime-types';
15
- import { exec as exec$2, spawn } from 'child_process';
16
- import { promisify } from 'util';
15
+ import { spawn } from 'child_process';
17
16
  import glob from 'glob-promise';
18
17
  import prompts from 'prompts';
19
18
  import moment from 'moment';
@@ -39,7 +38,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
39
38
  * @generated
40
39
  * @see https://github.com/webgptorg/promptbook
41
40
  */
42
- var PROMPTBOOK_ENGINE_VERSION = '0.83.0';
41
+ var PROMPTBOOK_ENGINE_VERSION = '0.84.0-9';
43
42
  /**
44
43
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
45
44
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -203,7 +202,7 @@ var NAME = "Promptbook";
203
202
  *
204
203
  * @public exported from `@promptbook/core`
205
204
  */
206
- var ADMIN_EMAIL = 'me@pavolhejny.com';
205
+ var ADMIN_EMAIL = 'pavol@ptbk.io';
207
206
  /**
208
207
  * Name of the responsible person for the Promptbook on GitHub
209
208
  *
@@ -813,7 +812,7 @@ var ORDER_OF_PIPELINE_JSON = [
813
812
  *
814
813
  * @private within the repository
815
814
  */
816
- var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
815
+ var REPLACING_NONCE = 'ptbkauk42kV2dzao34faw7FudQUHYPtW';
817
816
  /**
818
817
  * @@@
819
818
  *
@@ -1916,7 +1915,7 @@ function countTotalUsage(llmTools) {
1916
1915
  var NotYetImplementedError = /** @class */ (function (_super) {
1917
1916
  __extends(NotYetImplementedError, _super);
1918
1917
  function NotYetImplementedError(message) {
1919
- var _this = _super.call(this, spaceTrim$1(function (block) { return "\n ".concat(block(message), "\n\n Note: This feature is not implemented yet but it will be soon.\n\n If you want speed up the implementation or just read more, look here:\n https://github.com/webgptorg/promptbook\n\n Or contact us on me@pavolhejny.com\n\n "); })) || this;
1918
+ var _this = _super.call(this, spaceTrim$1(function (block) { return "\n ".concat(block(message), "\n\n Note: This feature is not implemented yet but it will be soon.\n\n If you want speed up the implementation or just read more, look here:\n https://github.com/webgptorg/promptbook\n\n Or contact us on pavol@ptbk.io\n\n "); })) || this;
1920
1919
  _this.name = 'NotYetImplementedError';
1921
1920
  Object.setPrototypeOf(_this, NotYetImplementedError.prototype);
1922
1921
  return _this;
@@ -10393,30 +10392,187 @@ function compilePipeline(pipelineString, tools, options) {
10393
10392
  * TODO: [🧠] Should be in generated JSON file GENERATOR_WARNING
10394
10393
  */
10395
10394
 
10396
- // Note: We want to use the `exec` as async function
10397
- var exec$1 = promisify(exec$2);
10395
+ /**
10396
+ * Normalize options for `execCommand` and `execCommands`
10397
+ *
10398
+ * Note: `$` is used to indicate that this function behaves differently according to `process.platform`
10399
+ *
10400
+ * @private internal utility of `execCommand` and `execCommands`
10401
+ */
10402
+ function $execCommandNormalizeOptions(options) {
10403
+ var _a;
10404
+ var _b, _c, _d, _e;
10405
+ var command;
10406
+ var cwd;
10407
+ var crashOnError;
10408
+ var args = [];
10409
+ var timeout;
10410
+ var isVerbose;
10411
+ if (typeof options === 'string') {
10412
+ // TODO: [1] DRY default values
10413
+ command = options;
10414
+ cwd = process.cwd();
10415
+ crashOnError = true;
10416
+ timeout = Infinity; // <- TODO: [⏳]
10417
+ isVerbose = DEFAULT_IS_VERBOSE;
10418
+ }
10419
+ else {
10420
+ /*
10421
+ TODO:
10422
+ if ((options as any).commands !== undefined) {
10423
+ commands = (options as any).commands;
10424
+ } else {
10425
+ commands = [(options as any).command];
10426
+ }
10427
+ */
10428
+ // TODO: [1] DRY default values
10429
+ command = options.command;
10430
+ cwd = (_b = options.cwd) !== null && _b !== void 0 ? _b : process.cwd();
10431
+ crashOnError = (_c = options.crashOnError) !== null && _c !== void 0 ? _c : true;
10432
+ timeout = (_d = options.timeout) !== null && _d !== void 0 ? _d : Infinity;
10433
+ isVerbose = (_e = options.isVerbose) !== null && _e !== void 0 ? _e : DEFAULT_IS_VERBOSE;
10434
+ }
10435
+ // TODO: /(-[a-zA-Z0-9-]+\s+[^\s]*)|[^\s]*/g
10436
+ var _ = Array.from(command.matchAll(/(".*")|([^\s]*)/g))
10437
+ .map(function (_a) {
10438
+ var _b = __read(_a, 1), match = _b[0];
10439
+ return match;
10440
+ })
10441
+ .filter(function (arg) { return arg !== ''; });
10442
+ if (_.length > 1) {
10443
+ _a = __read(_), command = _a[0], args = _a.slice(1);
10444
+ }
10445
+ if (options.args) {
10446
+ args = __spreadArray(__spreadArray([], __read(args), false), __read(options.args), false);
10447
+ }
10448
+ var humanReadableCommand = !['npx', 'npm'].includes(command) ? command : args[0];
10449
+ if (['ts-node'].includes(humanReadableCommand)) {
10450
+ humanReadableCommand += " ".concat(args[1]);
10451
+ }
10452
+ if (/^win/.test(process.platform) && ['npm', 'npx'].includes(command)) {
10453
+ command = "".concat(command, ".cmd");
10454
+ }
10455
+ return { command: command, humanReadableCommand: humanReadableCommand, args: args, cwd: cwd, crashOnError: crashOnError, timeout: timeout, isVerbose: isVerbose };
10456
+ }
10457
+ // TODO: This should show type error> execCommandNormalizeOptions({ command: '', commands: [''] });
10458
+
10459
+ /**
10460
+ * Run one command in a shell
10461
+ *
10462
+ *
10463
+ * Note: There are 2 similar functions in the codebase:
10464
+ * - `$execCommand` which runs a single command
10465
+ * - `$execCommands` which runs multiple commands
10466
+ * Note: `$` is used to indicate that this function is not a pure function - it runs a command in a shell
10467
+ *
10468
+ * @public exported from `@promptbook/node`
10469
+ */
10470
+ function $execCommand(options) {
10471
+ if (!$isRunningInNode()) {
10472
+ throw new EnvironmentMismatchError('Function `$execCommand` can run only in Node environment.js');
10473
+ }
10474
+ return new Promise(function (resolve, reject) {
10475
+ // eslint-disable-next-line prefer-const
10476
+ var _a = $execCommandNormalizeOptions(options), command = _a.command, humanReadableCommand = _a.humanReadableCommand, args = _a.args, cwd = _a.cwd, crashOnError = _a.crashOnError, timeout = _a.timeout, _b = _a.isVerbose, isVerbose = _b === void 0 ? DEFAULT_IS_VERBOSE : _b;
10477
+ if (timeout !== Infinity) {
10478
+ // TODO: In waitasecond forTime(Infinity) should be equivalent to forEver()
10479
+ forTime(timeout).then(function () {
10480
+ if (crashOnError) {
10481
+ reject(new Error("Command \"".concat(humanReadableCommand, "\" exceeded time limit of ").concat(timeout, "ms")));
10482
+ }
10483
+ else {
10484
+ console.warn("Command \"".concat(humanReadableCommand, "\" exceeded time limit of ").concat(timeout, "ms but continues running"));
10485
+ resolve('Command exceeded time limit');
10486
+ }
10487
+ });
10488
+ }
10489
+ if (isVerbose) {
10490
+ console.info(colors.yellow(cwd) + ' ' + colors.green(command) + ' ' + colors.blue(args.join(' ')));
10491
+ }
10492
+ try {
10493
+ var commandProcess = spawn(command, args, { cwd: cwd, shell: true });
10494
+ if (isVerbose) {
10495
+ commandProcess.on('message', function (message) {
10496
+ console.info({ message: message });
10497
+ });
10498
+ }
10499
+ var output_1 = [];
10500
+ commandProcess.stdout.on('data', function (stdout) {
10501
+ output_1.push(stdout.toString());
10502
+ if (isVerbose) {
10503
+ console.info(stdout.toString());
10504
+ }
10505
+ });
10506
+ commandProcess.stderr.on('data', function (stderr) {
10507
+ output_1.push(stderr.toString());
10508
+ if (isVerbose && stderr.toString().trim()) {
10509
+ console.warn(stderr.toString());
10510
+ }
10511
+ });
10512
+ var finishWithCode = function (code) {
10513
+ if (code !== 0) {
10514
+ if (crashOnError) {
10515
+ reject(new Error(output_1.join('\n').trim() ||
10516
+ "Command \"".concat(humanReadableCommand, "\" exited with code ").concat(code)));
10517
+ }
10518
+ else {
10519
+ if (isVerbose) {
10520
+ console.warn("Command \"".concat(humanReadableCommand, "\" exited with code ").concat(code));
10521
+ }
10522
+ resolve(spaceTrim$1(output_1.join('\n')));
10523
+ }
10524
+ }
10525
+ else {
10526
+ resolve(spaceTrim$1(output_1.join('\n')));
10527
+ }
10528
+ };
10529
+ commandProcess.on('close', finishWithCode);
10530
+ commandProcess.on('exit', finishWithCode);
10531
+ commandProcess.on('disconnect', function () {
10532
+ // Note: Unexpected disconnection should always result in rejection
10533
+ reject(new Error("Command \"".concat(humanReadableCommand, "\" disconnected")));
10534
+ });
10535
+ commandProcess.on('error', function (error) {
10536
+ if (crashOnError) {
10537
+ reject(new Error("Command \"".concat(humanReadableCommand, "\" failed: \n").concat(error.message)));
10538
+ }
10539
+ else {
10540
+ if (isVerbose) {
10541
+ console.warn(error);
10542
+ }
10543
+ resolve(spaceTrim$1(output_1.join('\n')));
10544
+ }
10545
+ });
10546
+ }
10547
+ catch (error) {
10548
+ // Note: Unexpected error in sync code should always result in rejection
10549
+ reject(error);
10550
+ }
10551
+ });
10552
+ }
10553
+ /**
10554
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
10555
+ */
10556
+
10398
10557
  /**
10399
10558
  * @@@
10400
10559
  *
10401
10560
  * @private within the repository
10402
10561
  */
10403
10562
  function locateAppOnLinux(_a) {
10404
- var appName = _a.appName, linuxWhich = _a.linuxWhich;
10563
+ var linuxWhich = _a.linuxWhich;
10405
10564
  return __awaiter(this, void 0, void 0, function () {
10406
- var _b, stderr, stdout, error_1;
10407
- return __generator(this, function (_c) {
10408
- switch (_c.label) {
10565
+ var result, error_1;
10566
+ return __generator(this, function (_b) {
10567
+ switch (_b.label) {
10409
10568
  case 0:
10410
- _c.trys.push([0, 2, , 3]);
10411
- return [4 /*yield*/, exec$1("which ".concat(linuxWhich))];
10569
+ _b.trys.push([0, 2, , 3]);
10570
+ return [4 /*yield*/, $execCommand({ crashOnError: true, command: "which ".concat(linuxWhich) })];
10412
10571
  case 1:
10413
- _b = _c.sent(), stderr = _b.stderr, stdout = _b.stdout;
10414
- if (!stderr && stdout) {
10415
- return [2 /*return*/, stdout.trim()];
10416
- }
10417
- throw new Error("Can not locate app ".concat(appName, " on Linux.\n ").concat(stderr));
10572
+ result = _b.sent();
10573
+ return [2 /*return*/, result.trim()];
10418
10574
  case 2:
10419
- error_1 = _c.sent();
10575
+ error_1 = _b.sent();
10420
10576
  if (!(error_1 instanceof Error)) {
10421
10577
  throw error_1;
10422
10578
  }
@@ -10463,43 +10619,41 @@ function isExecutable(path, fs) {
10463
10619
  // @see https://stackoverflow.com/questions/37000981/how-to-import-node-module-in-typescript-without-type-definitions
10464
10620
  // eslint-disable-next-line @typescript-eslint/no-var-requires
10465
10621
  var userhome = require('userhome');
10466
- // Note: We want to use the `exec` as async function
10467
- var exec = promisify(exec$2);
10468
10622
  /**
10469
10623
  * @@@
10470
10624
  *
10471
10625
  * @private within the repository
10472
10626
  */
10473
10627
  function locateAppOnMacOs(_a) {
10474
- var appName = _a.appName, macOsName = _a.macOsName;
10628
+ var macOsName = _a.macOsName;
10475
10629
  return __awaiter(this, void 0, void 0, function () {
10476
- var toExec, regPath, altPath, _b, stderr, stdout, error_1;
10477
- return __generator(this, function (_c) {
10478
- switch (_c.label) {
10630
+ var toExec, regPath, altPath, result, error_1;
10631
+ return __generator(this, function (_b) {
10632
+ switch (_b.label) {
10479
10633
  case 0:
10480
- _c.trys.push([0, 6, , 7]);
10634
+ _b.trys.push([0, 6, , 7]);
10481
10635
  toExec = "/Contents/MacOS/".concat(macOsName);
10482
10636
  regPath = "/Applications/".concat(macOsName, ".app") + toExec;
10483
10637
  altPath = userhome(regPath.slice(1));
10484
10638
  return [4 /*yield*/, isExecutable(regPath, $provideFilesystemForNode())];
10485
10639
  case 1:
10486
- if (!_c.sent()) return [3 /*break*/, 2];
10640
+ if (!_b.sent()) return [3 /*break*/, 2];
10487
10641
  return [2 /*return*/, regPath];
10488
10642
  case 2: return [4 /*yield*/, isExecutable(altPath, $provideFilesystemForNode())];
10489
10643
  case 3:
10490
- if (_c.sent()) {
10644
+ if (_b.sent()) {
10491
10645
  return [2 /*return*/, altPath];
10492
10646
  }
10493
- _c.label = 4;
10494
- case 4: return [4 /*yield*/, exec("mdfind 'kMDItemDisplayName == \"".concat(macOsName, "\" && kMDItemKind == Application'"))];
10647
+ _b.label = 4;
10648
+ case 4: return [4 /*yield*/, $execCommand({
10649
+ crashOnError: true,
10650
+ command: "mdfind 'kMDItemDisplayName == \"".concat(macOsName, "\" && kMDItemKind == Application'"),
10651
+ })];
10495
10652
  case 5:
10496
- _b = _c.sent(), stderr = _b.stderr, stdout = _b.stdout;
10497
- if (!stderr && stdout) {
10498
- return [2 /*return*/, stdout.trim() + toExec];
10499
- }
10500
- throw new Error("Can not locate app ".concat(appName, " on macOS.\n ").concat(stderr));
10653
+ result = _b.sent();
10654
+ return [2 /*return*/, result.trim() + toExec];
10501
10655
  case 6:
10502
- error_1 = _c.sent();
10656
+ error_1 = _b.sent();
10503
10657
  if (!(error_1 instanceof Error)) {
10504
10658
  throw error_1;
10505
10659
  }
@@ -10600,7 +10754,7 @@ function locateApp(options) {
10600
10754
  }
10601
10755
  else if (process.platform === 'darwin') {
10602
10756
  if (macOsName) {
10603
- return locateAppOnMacOs({ appName: appName, macOsName: macOsName });
10757
+ return locateAppOnMacOs({ macOsName: macOsName });
10604
10758
  }
10605
10759
  else {
10606
10760
  throw new Error("".concat(appName, " is not available on macOS."));
@@ -10608,7 +10762,7 @@ function locateApp(options) {
10608
10762
  }
10609
10763
  else {
10610
10764
  if (linuxWhich) {
10611
- return locateAppOnLinux({ appName: appName, linuxWhich: linuxWhich });
10765
+ return locateAppOnLinux({ linuxWhich: linuxWhich });
10612
10766
  }
10613
10767
  else {
10614
10768
  throw new Error("".concat(appName, " is not available on Linux."));
@@ -15815,173 +15969,11 @@ var _OpenAiAssistantRegistration = $llmToolsRegister.register(createOpenAiAssist
15815
15969
  */
15816
15970
 
15817
15971
  /**
15818
- * Normalize options for `execCommand` and `execCommands`
15819
- *
15820
- * Note: `$` is used to indicate that this function behaves differently according to `process.platform`
15821
- *
15822
- * @private internal utility of `execCommand` and `execCommands`
15823
- */
15824
- function $execCommandNormalizeOptions(options) {
15825
- var _a;
15826
- var _b, _c, _d, _e;
15827
- var command;
15828
- var cwd;
15829
- var crashOnError;
15830
- var args = [];
15831
- var timeout;
15832
- var isVerbose;
15833
- if (typeof options === 'string') {
15834
- // TODO: [1] DRY default values
15835
- command = options;
15836
- cwd = process.cwd();
15837
- crashOnError = true;
15838
- timeout = Infinity; // <- TODO: [⏳]
15839
- isVerbose = DEFAULT_IS_VERBOSE;
15840
- }
15841
- else {
15842
- /*
15843
- TODO:
15844
- if ((options as any).commands !== undefined) {
15845
- commands = (options as any).commands;
15846
- } else {
15847
- commands = [(options as any).command];
15848
- }
15849
- */
15850
- // TODO: [1] DRY default values
15851
- command = options.command;
15852
- cwd = (_b = options.cwd) !== null && _b !== void 0 ? _b : process.cwd();
15853
- crashOnError = (_c = options.crashOnError) !== null && _c !== void 0 ? _c : true;
15854
- timeout = (_d = options.timeout) !== null && _d !== void 0 ? _d : Infinity;
15855
- isVerbose = (_e = options.isVerbose) !== null && _e !== void 0 ? _e : DEFAULT_IS_VERBOSE;
15856
- }
15857
- // TODO: /(-[a-zA-Z0-9-]+\s+[^\s]*)|[^\s]*/g
15858
- var _ = Array.from(command.matchAll(/(".*")|([^\s]*)/g))
15859
- .map(function (_a) {
15860
- var _b = __read(_a, 1), match = _b[0];
15861
- return match;
15862
- })
15863
- .filter(function (arg) { return arg !== ''; });
15864
- if (_.length > 1) {
15865
- _a = __read(_), command = _a[0], args = _a.slice(1);
15866
- }
15867
- if (options.args) {
15868
- args = __spreadArray(__spreadArray([], __read(args), false), __read(options.args), false);
15869
- }
15870
- var humanReadableCommand = !['npx', 'npm'].includes(command) ? command : args[0];
15871
- if (['ts-node'].includes(humanReadableCommand)) {
15872
- humanReadableCommand += " ".concat(args[1]);
15873
- }
15874
- if (/^win/.test(process.platform) && ['npm', 'npx'].includes(command)) {
15875
- command = "".concat(command, ".cmd");
15876
- }
15877
- return { command: command, humanReadableCommand: humanReadableCommand, args: args, cwd: cwd, crashOnError: crashOnError, timeout: timeout, isVerbose: isVerbose };
15878
- }
15879
- // TODO: This should show type error> execCommandNormalizeOptions({ command: '', commands: [''] });
15880
-
15881
- /**
15882
- * Run one command in a shell
15883
- *
15972
+ * Create a filename for intermediate cache for scrapers
15884
15973
  *
15885
- * Note: There are 2 similar functions in the codebase:
15886
- * - `$execCommand` which runs a single command
15887
- * - `$execCommands` which runs multiple commands
15888
- * Note: `$` is used to indicate that this function is not a pure function - it runs a command in a shell
15974
+ * Note: It also checks if directory exists and creates it if not
15889
15975
  *
15890
- * @public exported from `@promptbook/node`
15891
- */
15892
- function $execCommand(options) {
15893
- if (!$isRunningInNode()) {
15894
- throw new EnvironmentMismatchError('Function `$execCommand` can run only in Node environment.js');
15895
- }
15896
- return new Promise(function (resolve, reject) {
15897
- // eslint-disable-next-line prefer-const
15898
- var _a = $execCommandNormalizeOptions(options), command = _a.command, humanReadableCommand = _a.humanReadableCommand, args = _a.args, cwd = _a.cwd, crashOnError = _a.crashOnError, timeout = _a.timeout, _b = _a.isVerbose, isVerbose = _b === void 0 ? DEFAULT_IS_VERBOSE : _b;
15899
- if (timeout !== Infinity) {
15900
- // TODO: In waitasecond forTime(Infinity) should be equivalent to forEver()
15901
- forTime(timeout).then(function () {
15902
- if (crashOnError) {
15903
- reject(new Error("Command \"".concat(humanReadableCommand, "\" exceeded time limit of ").concat(timeout, "ms")));
15904
- }
15905
- else {
15906
- console.warn("Command \"".concat(humanReadableCommand, "\" exceeded time limit of ").concat(timeout, "ms but continues running"));
15907
- resolve('Command exceeded time limit');
15908
- }
15909
- });
15910
- }
15911
- if (isVerbose) {
15912
- console.info(colors.yellow(cwd) + ' ' + colors.green(command) + ' ' + colors.blue(args.join(' ')));
15913
- }
15914
- try {
15915
- var commandProcess = spawn(command, args, { cwd: cwd, shell: true });
15916
- if (isVerbose) {
15917
- commandProcess.on('message', function (message) {
15918
- console.info({ message: message });
15919
- });
15920
- }
15921
- var output_1 = [];
15922
- commandProcess.stdout.on('data', function (stdout) {
15923
- output_1.push(stdout.toString());
15924
- if (isVerbose) {
15925
- console.info(stdout.toString());
15926
- }
15927
- });
15928
- commandProcess.stderr.on('data', function (stderr) {
15929
- output_1.push(stderr.toString());
15930
- if (isVerbose && stderr.toString().trim()) {
15931
- console.warn(stderr.toString());
15932
- }
15933
- });
15934
- var finishWithCode = function (code) {
15935
- if (code !== 0) {
15936
- if (crashOnError) {
15937
- reject(new Error(output_1.join('\n').trim() ||
15938
- "Command \"".concat(humanReadableCommand, "\" exited with code ").concat(code)));
15939
- }
15940
- else {
15941
- if (isVerbose) {
15942
- console.warn("Command \"".concat(humanReadableCommand, "\" exited with code ").concat(code));
15943
- }
15944
- resolve(spaceTrim$1(output_1.join('\n')));
15945
- }
15946
- }
15947
- else {
15948
- resolve(spaceTrim$1(output_1.join('\n')));
15949
- }
15950
- };
15951
- commandProcess.on('close', finishWithCode);
15952
- commandProcess.on('exit', finishWithCode);
15953
- commandProcess.on('disconnect', function () {
15954
- // Note: Unexpected disconnection should always result in rejection
15955
- reject(new Error("Command \"".concat(humanReadableCommand, "\" disconnected")));
15956
- });
15957
- commandProcess.on('error', function (error) {
15958
- if (crashOnError) {
15959
- reject(new Error("Command \"".concat(humanReadableCommand, "\" failed: \n").concat(error.message)));
15960
- }
15961
- else {
15962
- if (isVerbose) {
15963
- console.warn(error);
15964
- }
15965
- resolve(spaceTrim$1(output_1.join('\n')));
15966
- }
15967
- });
15968
- }
15969
- catch (error) {
15970
- // Note: Unexpected error in sync code should always result in rejection
15971
- reject(error);
15972
- }
15973
- });
15974
- }
15975
- /**
15976
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
15977
- */
15978
-
15979
- /**
15980
- * Create a filename for intermediate cache for scrapers
15981
- *
15982
- * Note: It also checks if directory exists and creates it if not
15983
- *
15984
- * @private as internal utility for scrapers
15976
+ * @private as internal utility for scrapers
15985
15977
  */
15986
15978
  function getScraperIntermediateSource(source, options) {
15987
15979
  return __awaiter(this, void 0, void 0, function () {
@@ -16246,6 +16238,207 @@ var MarkdownScraper = /** @class */ (function () {
16246
16238
  * Note: No need to aggregate usage here, it is done by intercepting the llmTools
16247
16239
  */
16248
16240
 
16241
+ /**
16242
+ * Metadata of the scraper
16243
+ *
16244
+ * @private within the scraper directory
16245
+ */
16246
+ var boilerplateScraperMetadata = $deepFreeze({
16247
+ title: 'Boilerplate scraper',
16248
+ packageName: '@promptbook/boilerplate',
16249
+ className: 'BoilerplateScraper',
16250
+ mimeTypes: [
16251
+ '@@@/@@@',
16252
+ // <- TODO: @@@ Add compatible mime types with Boilerplate scraper
16253
+ ],
16254
+ documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@@',
16255
+ isAvilableInBrowser: false,
16256
+ // <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
16257
+ requiredExecutables: [
16258
+ /* @@@ 'Pandoc' */
16259
+ ],
16260
+ }); /* <- Note: [🤛] */
16261
+ /**
16262
+ * Registration of known scraper metadata
16263
+ *
16264
+ * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
16265
+ *
16266
+ * @public exported from `@promptbook/core`
16267
+ * @public exported from `@promptbook/wizzard`
16268
+ * @public exported from `@promptbook/cli`
16269
+ */
16270
+ var _BoilerplateScraperMetadataRegistration = $scrapersMetadataRegister.register(boilerplateScraperMetadata);
16271
+ /**
16272
+ * Note: [💞] Ignore a discrepancy between file name and entity name
16273
+ */
16274
+
16275
+ /**
16276
+ * Scraper of @@@ files
16277
+ *
16278
+ * @see `documentationUrl` for more details
16279
+ * @public exported from `@promptbook/boilerplate`
16280
+ */
16281
+ var BoilerplateScraper = /** @class */ (function () {
16282
+ function BoilerplateScraper(tools, options) {
16283
+ this.tools = tools;
16284
+ this.options = options;
16285
+ this.markdownScraper = new MarkdownScraper(tools, options);
16286
+ }
16287
+ Object.defineProperty(BoilerplateScraper.prototype, "metadata", {
16288
+ /**
16289
+ * Metadata of the scraper which includes title, mime types, etc.
16290
+ */
16291
+ get: function () {
16292
+ return boilerplateScraperMetadata;
16293
+ },
16294
+ enumerable: false,
16295
+ configurable: true
16296
+ });
16297
+ /**
16298
+ * Convert the `.@@@` to `.md` file and returns intermediate source
16299
+ *
16300
+ * Note: `$` is used to indicate that this function is not a pure function - it leaves files on the disk and you are responsible for cleaning them by calling `destroy` method of returned object
16301
+ */
16302
+ BoilerplateScraper.prototype.$convert = function (source) {
16303
+ var _a;
16304
+ return __awaiter(this, void 0, void 0, function () {
16305
+ var _b, _c, rootDirname, _d, cacheDirname, _e, intermediateFilesStrategy, _f, isVerbose, extension, cacheFilehandler, command_1;
16306
+ return __generator(this, function (_g) {
16307
+ switch (_g.label) {
16308
+ case 0:
16309
+ _b = this.options, _c = _b.rootDirname, rootDirname = _c === void 0 ? process.cwd() : _c, _d = _b.cacheDirname, cacheDirname = _d === void 0 ? DEFAULT_SCRAPE_CACHE_DIRNAME : _d, _e = _b.intermediateFilesStrategy, intermediateFilesStrategy = _e === void 0 ? DEFAULT_INTERMEDIATE_FILES_STRATEGY : _e, _f = _b.isVerbose, isVerbose = _f === void 0 ? DEFAULT_IS_VERBOSE : _f;
16310
+ // TODO: @@@ Preserve or delete
16311
+ if (!$isRunningInNode()) {
16312
+ throw new KnowledgeScrapeError('BoilerplateScraper is only supported in Node environment');
16313
+ }
16314
+ // TODO: @@@ Preserve or delete
16315
+ if (this.tools.fs === undefined) {
16316
+ throw new EnvironmentMismatchError('Can not scrape boilerplates without filesystem tools');
16317
+ // <- TODO: [🧠] What is the best error type here`
16318
+ }
16319
+ // TODO: @@@ Preserve, delete or modify
16320
+ if (((_a = this.tools.executables) === null || _a === void 0 ? void 0 : _a.pandocPath) === undefined) {
16321
+ throw new MissingToolsError('Pandoc is required for scraping .docx files');
16322
+ }
16323
+ // TODO: @@@ Preserve, delete or modify
16324
+ if (source.filename === null) {
16325
+ // TODO: [🧠] Maybe save file as temporary
16326
+ throw new KnowledgeScrapeError('When parsing .@@@ file, it must be real file in the file system');
16327
+ }
16328
+ extension = getFileExtension(source.filename);
16329
+ return [4 /*yield*/, getScraperIntermediateSource(source, {
16330
+ rootDirname: rootDirname,
16331
+ cacheDirname: cacheDirname,
16332
+ intermediateFilesStrategy: intermediateFilesStrategy,
16333
+ extension: 'md',
16334
+ isVerbose: isVerbose,
16335
+ })];
16336
+ case 1:
16337
+ cacheFilehandler = _g.sent();
16338
+ return [4 /*yield*/, isFileExisting(cacheFilehandler.filename, this.tools.fs)];
16339
+ case 2:
16340
+ if (!!(_g.sent())) return [3 /*break*/, 5];
16341
+ command_1 = "\"".concat(this.tools.executables.pandocPath, "\" -f ").concat(extension, " -t markdown \"").concat(source.filename, "\" -o \"").concat(cacheFilehandler.filename, "\"");
16342
+ return [4 /*yield*/, $execCommand(command_1)];
16343
+ case 3:
16344
+ _g.sent();
16345
+ return [4 /*yield*/, isFileExisting(cacheFilehandler.filename, this.tools.fs)];
16346
+ case 4:
16347
+ // Note: [0]
16348
+ if (!(_g.sent())) {
16349
+ throw new UnexpectedError(spaceTrim(function (block) { return "\n File that was supposed to be created by Pandoc does not exist for unknown reason\n\n Expected file:\n ".concat(block(cacheFilehandler.filename), "\n\n Command:\n > ").concat(block(command_1), "\n\n "); }));
16350
+ }
16351
+ _g.label = 5;
16352
+ case 5: return [2 /*return*/, cacheFilehandler];
16353
+ }
16354
+ });
16355
+ });
16356
+ };
16357
+ /**
16358
+ * Scrapes the docx file and returns the knowledge pieces or `null` if it can't scrape it
16359
+ */
16360
+ BoilerplateScraper.prototype.scrape = function (source) {
16361
+ return __awaiter(this, void 0, void 0, function () {
16362
+ var cacheFilehandler, markdownSource, knowledge;
16363
+ return __generator(this, function (_a) {
16364
+ switch (_a.label) {
16365
+ case 0: return [4 /*yield*/, this.$convert(source)];
16366
+ case 1:
16367
+ cacheFilehandler = _a.sent();
16368
+ markdownSource = {
16369
+ source: source.source,
16370
+ filename: cacheFilehandler.filename,
16371
+ url: null,
16372
+ mimeType: 'text/markdown',
16373
+ asText: function () {
16374
+ return __awaiter(this, void 0, void 0, function () {
16375
+ return __generator(this, function (_a) {
16376
+ switch (_a.label) {
16377
+ case 0: return [4 /*yield*/, readFile(cacheFilehandler.filename, 'utf-8')];
16378
+ case 1:
16379
+ // Note: [0] In $convert we check that the file exists
16380
+ return [2 /*return*/, _a.sent()];
16381
+ }
16382
+ });
16383
+ });
16384
+ },
16385
+ asJson: function () {
16386
+ throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asJson`');
16387
+ },
16388
+ /*
16389
+ TODO: [🥽]
16390
+ > asBlob() {
16391
+ > throw new UnexpectedError(
16392
+ > 'Did not expect that `markdownScraper` would need to get the content `asBlob`',
16393
+ > );
16394
+ > },
16395
+ */
16396
+ };
16397
+ knowledge = this.markdownScraper.scrape(markdownSource);
16398
+ return [4 /*yield*/, cacheFilehandler.destroy()];
16399
+ case 2:
16400
+ _a.sent();
16401
+ return [2 /*return*/, knowledge];
16402
+ }
16403
+ });
16404
+ });
16405
+ };
16406
+ return BoilerplateScraper;
16407
+ }());
16408
+ /**
16409
+ * TODO: [👣] Converted documents can act as cached items - there is no need to run conversion each time
16410
+ * TODO: [🪂] Do it in parallel
16411
+ * Note: No need to aggregate usage here, it is done by intercepting the llmTools
16412
+ * @@@ Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
16413
+ */
16414
+
16415
+ /**
16416
+ * Constructor of `BoilerplateScraper`
16417
+ *
16418
+ * @public exported from `@promptbook/boilerplate`
16419
+ */
16420
+ var createBoilerplateScraper = Object.assign(function (tools, options) {
16421
+ return new BoilerplateScraper(tools, options);
16422
+ }, boilerplateScraperMetadata); /* <- Note: [🤛] */
16423
+ /**
16424
+ * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
16425
+ */
16426
+
16427
+ /**
16428
+ * Registration of known scraper
16429
+ *
16430
+ * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
16431
+ *
16432
+ * @public exported from `@promptbook/boilerplate`
16433
+ * @public exported from `@promptbook/wizzard`
16434
+ * @public exported from `@promptbook/cli`
16435
+ */
16436
+ var _BoilerplateScraperRegistration = $scrapersRegister.register(createBoilerplateScraper);
16437
+ /**
16438
+ * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
16439
+ * Note: [💞] Ignore a discrepancy between file name and entity name
16440
+ */
16441
+
16249
16442
  /**
16250
16443
  * Metadata of the scraper
16251
16444
  *
@@ -16345,7 +16538,7 @@ var DocumentScraper = /** @class */ (function () {
16345
16538
  case 4:
16346
16539
  // Note: [0]
16347
16540
  if (!(_g.sent())) {
16348
- throw new UnexpectedError(spaceTrim(function (block) { return "\n File that was supposed to be created by Pandoc does not exist for unknown reason\n\n Expected file:\n ".concat(block(cacheFilehandler.filename), "\n\n Command:\n > ").concat(block(command_1), "\n\n "); }));
16541
+ throw new UnexpectedError(spaceTrim(function (block) { return "\n File that was supposed to be created by Pandoc does not exist for unknown reason\n\n Expected file:\n ".concat(block(cacheFilehandler.filename), "\n\n Command:\n > ").concat(block(command_1), "\n\n "); }));
16349
16542
  }
16350
16543
  _g.label = 5;
16351
16544
  case 5: return [2 /*return*/, cacheFilehandler];
@@ -16520,7 +16713,7 @@ var LegacyDocumentScraper = /** @class */ (function () {
16520
16713
  case 4:
16521
16714
  files_1 = _g.sent();
16522
16715
  if (files_1.length !== 1) {
16523
- throw new UnexpectedError(spaceTrim(function (block) { return "\n Expected exactly 1 file in the LibreOffice output directory, got ".concat(files_1.length, "\n\n The temporary folder:\n ").concat(block(documentSourceOutdirPathForLibreOffice_1), "\n\n Command:\n > ").concat(block(command_1), "\n "); }));
16716
+ throw new UnexpectedError(spaceTrim(function (block) { return "\n Expected exactly 1 file in the LibreOffice output directory, got ".concat(files_1.length, "\n\n The temporary folder:\n ").concat(block(documentSourceOutdirPathForLibreOffice_1), "\n\n Command:\n > ").concat(block(command_1), "\n "); }));
16524
16717
  }
16525
16718
  file = files_1[0];
16526
16719
  return [4 /*yield*/, rename(join(documentSourceOutdirPathForLibreOffice_1, file), cacheFilehandler.filename)];
@@ -16670,6 +16863,216 @@ var _MarkdownScraperRegistration = $scrapersRegister.register(createMarkdownScra
16670
16863
  * Note: [💞] Ignore a discrepancy between file name and entity name
16671
16864
  */
16672
16865
 
16866
+ /**
16867
+ * Metadata of the scraper
16868
+ *
16869
+ * @private within the scraper directory
16870
+ */
16871
+ var markitdownScraperMetadata = $deepFreeze({
16872
+ title: 'Markitdown scraper',
16873
+ packageName: '@promptbook/markitdown',
16874
+ className: 'MarkitdownScraper',
16875
+ mimeTypes: [
16876
+ 'application/pdf',
16877
+ // TODO: Make priority for scrapers and than allow all mime types here:
16878
+ // 'text/html',
16879
+ // 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
16880
+ ],
16881
+ documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
16882
+ isAvilableInBrowser: false,
16883
+ // <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
16884
+ requiredExecutables: [],
16885
+ }); /* <- Note: [🤛] */
16886
+ /**
16887
+ * Registration of known scraper metadata
16888
+ *
16889
+ * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
16890
+ *
16891
+ * @public exported from `@promptbook/core`
16892
+ * @public exported from `@promptbook/wizzard`
16893
+ * @public exported from `@promptbook/cli`
16894
+ */
16895
+ var _MarkitdownScraperMetadataRegistration = $scrapersMetadataRegister.register(markitdownScraperMetadata);
16896
+ /**
16897
+ * Note: [💞] Ignore a discrepancy between file name and entity name
16898
+ */
16899
+
16900
+ /**
16901
+ * Integration of Markitdown by Microsoft into Promptbook
16902
+ *
16903
+ * @see https://github.com/microsoft/markitdown
16904
+ * @see `documentationUrl` for more details
16905
+ * @public exported from `@promptbook/markitdown`
16906
+ * @public exported from `@promptbook/pdf`
16907
+ */
16908
+ var MarkitdownScraper = /** @class */ (function () {
16909
+ function MarkitdownScraper(tools, options) {
16910
+ this.tools = tools;
16911
+ this.options = options;
16912
+ this.markdownScraper = new MarkdownScraper(tools, options);
16913
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
16914
+ var MarkItDown = require('markitdown-ts').MarkItDown;
16915
+ // <- TODO: !!! Use Markitdown directly not through this package
16916
+ // <- Note: !!!!!!!
16917
+ this.markitdown = new MarkItDown();
16918
+ }
16919
+ Object.defineProperty(MarkitdownScraper.prototype, "metadata", {
16920
+ /**
16921
+ * Metadata of the scraper which includes title, mime types, etc.
16922
+ */
16923
+ get: function () {
16924
+ return markitdownScraperMetadata;
16925
+ },
16926
+ enumerable: false,
16927
+ configurable: true
16928
+ });
16929
+ /**
16930
+ * Convert the documents to `.md` file and returns intermediate source
16931
+ *
16932
+ * Note: `$` is used to indicate that this function is not a pure function - it leaves files on the disk and you are responsible for cleaning them by calling `destroy` method of returned object
16933
+ */
16934
+ MarkitdownScraper.prototype.$convert = function (source) {
16935
+ return __awaiter(this, void 0, void 0, function () {
16936
+ var _a, _b, rootDirname, _c, cacheDirname, _d, intermediateFilesStrategy, _e, isVerbose, cacheFilehandler, src, result;
16937
+ return __generator(this, function (_f) {
16938
+ switch (_f.label) {
16939
+ case 0:
16940
+ _a = this.options, _b = _a.rootDirname, rootDirname = _b === void 0 ? process.cwd() : _b, _c = _a.cacheDirname, cacheDirname = _c === void 0 ? DEFAULT_SCRAPE_CACHE_DIRNAME : _c, _d = _a.intermediateFilesStrategy, intermediateFilesStrategy = _d === void 0 ? DEFAULT_INTERMEDIATE_FILES_STRATEGY : _d, _e = _a.isVerbose, isVerbose = _e === void 0 ? DEFAULT_IS_VERBOSE : _e;
16941
+ if (!$isRunningInNode()) {
16942
+ throw new KnowledgeScrapeError('MarkitdownScraper is only supported in Node environment');
16943
+ }
16944
+ if (this.tools.fs === undefined) {
16945
+ throw new EnvironmentMismatchError('Can not scrape boilerplates without filesystem tools');
16946
+ // <- TODO: [🧠] What is the best error type here`
16947
+ }
16948
+ return [4 /*yield*/, getScraperIntermediateSource(source, {
16949
+ rootDirname: rootDirname,
16950
+ cacheDirname: cacheDirname,
16951
+ intermediateFilesStrategy: intermediateFilesStrategy,
16952
+ extension: 'md',
16953
+ isVerbose: isVerbose,
16954
+ })];
16955
+ case 1:
16956
+ cacheFilehandler = _f.sent();
16957
+ return [4 /*yield*/, isFileExisting(cacheFilehandler.filename, this.tools.fs)];
16958
+ case 2:
16959
+ if (!!(_f.sent())) return [3 /*break*/, 5];
16960
+ src = source.filename || source.url || null;
16961
+ console.log('!!!', { src: src, source: source, cacheFilehandler: cacheFilehandler });
16962
+ if (src === null) {
16963
+ throw new UnexpectedError('Source has no filename or url');
16964
+ }
16965
+ return [4 /*yield*/, this.markitdown.convert(src, {
16966
+ // TODO: !!!!!! Pass when sacraping Youtube
16967
+ // enableYoutubeTranscript: true,
16968
+ // youtubeTranscriptLanguage: 'en',
16969
+ })];
16970
+ case 3:
16971
+ result = _f.sent();
16972
+ if (result === null || result === undefined) {
16973
+ throw new Error("Markitdown could not convert the \"".concat(source.source, "\""));
16974
+ // <- TODO: !!! Make MarkitdownError
16975
+ }
16976
+ console.log('!!!', { result: result, cacheFilehandler: cacheFilehandler });
16977
+ return [4 /*yield*/, this.tools.fs.writeFile(cacheFilehandler.filename, result.text_content)];
16978
+ case 4:
16979
+ _f.sent();
16980
+ _f.label = 5;
16981
+ case 5: return [2 /*return*/, cacheFilehandler];
16982
+ }
16983
+ });
16984
+ });
16985
+ };
16986
+ /**
16987
+ * Scrapes the docx file and returns the knowledge pieces or `null` if it can't scrape it
16988
+ */
16989
+ MarkitdownScraper.prototype.scrape = function (source) {
16990
+ return __awaiter(this, void 0, void 0, function () {
16991
+ var cacheFilehandler, markdownSource, knowledge;
16992
+ return __generator(this, function (_a) {
16993
+ switch (_a.label) {
16994
+ case 0: return [4 /*yield*/, this.$convert(source)];
16995
+ case 1:
16996
+ cacheFilehandler = _a.sent();
16997
+ markdownSource = {
16998
+ source: source.source,
16999
+ filename: cacheFilehandler.filename,
17000
+ url: null,
17001
+ mimeType: 'text/markdown',
17002
+ asText: function () {
17003
+ return __awaiter(this, void 0, void 0, function () {
17004
+ return __generator(this, function (_a) {
17005
+ switch (_a.label) {
17006
+ case 0: return [4 /*yield*/, readFile(cacheFilehandler.filename, 'utf-8')];
17007
+ case 1:
17008
+ // Note: [0] In $convert we check that the file exists
17009
+ return [2 /*return*/, _a.sent()];
17010
+ }
17011
+ });
17012
+ });
17013
+ },
17014
+ asJson: function () {
17015
+ throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asJson`');
17016
+ },
17017
+ /*
17018
+ TODO: [🥽]
17019
+ > asBlob() {
17020
+ > throw new UnexpectedError(
17021
+ > 'Did not expect that `markdownScraper` would need to get the content `asBlob`',
17022
+ > );
17023
+ > },
17024
+ */
17025
+ };
17026
+ knowledge = this.markdownScraper.scrape(markdownSource);
17027
+ return [4 /*yield*/, cacheFilehandler.destroy()];
17028
+ case 2:
17029
+ _a.sent();
17030
+ return [2 /*return*/, knowledge];
17031
+ }
17032
+ });
17033
+ });
17034
+ };
17035
+ return MarkitdownScraper;
17036
+ }());
17037
+ /**
17038
+ * TODO: [🧠][🌜] Export only from `@promptbook/markitdown` or `@promptbook/pdf` NOT both
17039
+ * TODO: [👣] Converted documents can act as cached items - there is no need to run conversion each time
17040
+ * TODO: [🪂] Do it in parallel
17041
+ * Note: No need to aggregate usage here, it is done by intercepting the llmTools
17042
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
17043
+ */
17044
+
17045
+ /**
17046
+ * Constructor of `MarkitdownScraper`
17047
+ *
17048
+ * @public exported from `@promptbook/markitdown`
17049
+ * @public exported from `@promptbook/pdf`
17050
+ */
17051
+ var createMarkitdownScraper = Object.assign(function (tools, options) {
17052
+ return new MarkitdownScraper(tools, options);
17053
+ }, markitdownScraperMetadata); /* <- Note: [🤛] */
17054
+ /**
17055
+ * TODO: [🧠][🌜] Export only from `@promptbook/markitdown` or `@promptbook/pdf` NOT both
17056
+ * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
17057
+ */
17058
+
17059
+ /**
17060
+ * Registration of known scraper
17061
+ *
17062
+ * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
17063
+ *
17064
+ * @public exported from `@promptbook/markitdown`
17065
+ * @public exported from `@promptbook/pdf`
17066
+ * @public exported from `@promptbook/wizzard`
17067
+ * @public exported from `@promptbook/cli`
17068
+ */
17069
+ var _MarkitdownScraperRegistration = $scrapersRegister.register(createMarkitdownScraper);
17070
+ /**
17071
+ * TODO: [🧠][🌜] Export only from `@promptbook/markitdown` or `@promptbook/pdf` NOT both
17072
+ * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
17073
+ * Note: [💞] Ignore a discrepancy between file name and entity name
17074
+ */
17075
+
16673
17076
  /**
16674
17077
  * Metadata of the scraper
16675
17078
  *
@@ -16679,7 +17082,7 @@ var pdfScraperMetadata = $deepFreeze({
16679
17082
  title: 'Pdf scraper',
16680
17083
  packageName: '@promptbook/pdf',
16681
17084
  className: 'PdfScraper',
16682
- mimeTypes: ['application/pdf'],
17085
+ mimeTypes: ['application/pdf-DISABLED'],
16683
17086
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
16684
17087
  isAvilableInBrowser: false,
16685
17088
  // <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
@@ -16990,5 +17393,5 @@ var _WebsiteScraperRegistration = $scrapersRegister.register(createWebsiteScrape
16990
17393
  * Note: [💞] Ignore a discrepancy between file name and entity name
16991
17394
  */
16992
17395
 
16993
- export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION, _AnthropicClaudeMetadataRegistration, _AnthropicClaudeRegistration, _AzureOpenAiMetadataRegistration, _AzureOpenAiRegistration, _CLI, _DocumentScraperMetadataRegistration, _DocumentScraperRegistration, _GoogleMetadataRegistration, _GoogleRegistration, _LegacyDocumentScraperMetadataRegistration, _LegacyDocumentScraperRegistration, _MarkdownScraperMetadataRegistration, _MarkdownScraperRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiAssistantRegistration, _OpenAiMetadataRegistration, _OpenAiRegistration, _PdfScraperMetadataRegistration, _PdfScraperRegistration, _WebsiteScraperMetadataRegistration, _WebsiteScraperRegistration };
17396
+ export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION, _AnthropicClaudeMetadataRegistration, _AnthropicClaudeRegistration, _AzureOpenAiMetadataRegistration, _AzureOpenAiRegistration, _BoilerplateScraperMetadataRegistration, _BoilerplateScraperRegistration, _CLI, _DocumentScraperMetadataRegistration, _DocumentScraperRegistration, _GoogleMetadataRegistration, _GoogleRegistration, _LegacyDocumentScraperMetadataRegistration, _LegacyDocumentScraperRegistration, _MarkdownScraperMetadataRegistration, _MarkdownScraperRegistration, _MarkitdownScraperMetadataRegistration, _MarkitdownScraperRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiAssistantRegistration, _OpenAiMetadataRegistration, _OpenAiRegistration, _PdfScraperMetadataRegistration, _PdfScraperRegistration, _WebsiteScraperMetadataRegistration, _WebsiteScraperRegistration };
16994
17397
  //# sourceMappingURL=index.es.js.map