@promptbook/legacy-documents 0.71.0-18 → 0.71.0-20

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 (88) hide show
  1. package/README.md +0 -6
  2. package/esm/index.es.js +80 -86
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/core.index.d.ts +22 -18
  5. package/esm/typings/src/_packages/types.index.d.ts +2 -2
  6. package/esm/typings/src/collection/PipelineCollection.d.ts +1 -1
  7. package/esm/typings/src/collection/SimplePipelineCollection.d.ts +2 -2
  8. package/esm/typings/src/collection/collectionToJson.d.ts +1 -1
  9. package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +1 -1
  10. package/esm/typings/src/collection/constructors/createCollectionFromPromise.d.ts +1 -1
  11. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +5 -5
  12. package/esm/typings/src/config.d.ts +21 -14
  13. package/esm/typings/src/execution/EmbeddingVector.d.ts +1 -1
  14. package/esm/typings/src/execution/LlmExecutionTools.d.ts +1 -1
  15. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +2 -2
  16. package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +1 -0
  17. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +29 -6
  18. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +2 -11
  19. package/esm/typings/src/execution/createPipelineExecutor/20-executeTemplate.d.ts +4 -13
  20. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +9 -14
  21. package/esm/typings/src/execution/utils/addUsage.d.ts +1 -1
  22. package/esm/typings/src/execution/utils/forEachAsync.d.ts +1 -1
  23. package/esm/typings/src/formats/_common/FormatDefinition.d.ts +2 -2
  24. package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +2 -2
  25. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForCli.d.ts +2 -2
  26. package/esm/typings/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +1 -1
  27. package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +4 -1
  28. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
  29. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  30. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -1
  31. package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -1
  32. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
  33. package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
  34. package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +3 -3
  35. package/esm/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +1 -1
  36. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +1 -1
  37. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
  38. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
  39. package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Response.d.ts +1 -1
  40. package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +4 -4
  41. package/esm/typings/src/prepare/prepareTemplates.d.ts +1 -1
  42. package/esm/typings/src/scrapers/_common/Scraper.d.ts +1 -5
  43. package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +1 -1
  44. package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +1 -1
  45. package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +1 -1
  46. package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +2 -2
  47. package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +2 -2
  48. package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +1 -1
  49. package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +1 -1
  50. package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
  51. package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -1
  52. package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -1
  53. package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -1
  54. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -1
  55. package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -1
  56. package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -1
  57. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -1
  58. package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +1 -1
  59. package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -1
  60. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +1 -1
  61. package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +1 -1
  62. package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -1
  63. package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -1
  64. package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +1 -1
  65. package/esm/typings/src/storage/file-cache-storage/utils/nameToSubfolderPath.d.ts +1 -1
  66. package/esm/typings/src/types/Arrayable.d.ts +1 -1
  67. package/esm/typings/src/types/IntermediateFilesStrategy.d.ts +7 -0
  68. package/esm/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +4 -4
  69. package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +1 -1
  70. package/esm/typings/src/types/PipelineJson/PersonaJson.d.ts +1 -1
  71. package/esm/typings/src/types/Prompt.d.ts +1 -1
  72. package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +1 -1
  73. package/esm/typings/src/utils/$Register.d.ts +1 -1
  74. package/esm/typings/src/utils/FromtoItems.d.ts +1 -1
  75. package/esm/typings/src/utils/arrayableToArray.d.ts +1 -1
  76. package/esm/typings/src/utils/emojis.d.ts +1 -1
  77. package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
  78. package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -1
  79. package/esm/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +1 -1
  80. package/esm/typings/src/utils/organization/TODO_USE.d.ts +1 -1
  81. package/esm/typings/src/utils/organization/keepUnused.d.ts +1 -1
  82. package/esm/typings/src/utils/random/$randomSeed.d.ts +1 -1
  83. package/esm/typings/src/utils/sets/intersection.d.ts +1 -1
  84. package/esm/typings/src/utils/sets/union.d.ts +1 -1
  85. package/package.json +2 -2
  86. package/umd/index.umd.js +80 -86
  87. package/umd/index.umd.js.map +1 -1
  88. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorSettings.d.ts +0 -29
package/README.md CHANGED
@@ -20,12 +20,6 @@ Build responsible, controlled and transparent applications on top of LLM models!
20
20
 
21
21
  - ✨ **Support of [OpenAI o1 model](https://openai.com/o1/)**
22
22
 
23
- <blockquote style="color: #ff8811">
24
- <b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
25
- </blockquote>
26
-
27
-
28
-
29
23
  <blockquote style="color: #ff8811">
30
24
  <b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
31
25
  </blockquote>
package/esm/index.es.js CHANGED
@@ -15,7 +15,7 @@ import { unparse, parse } from 'papaparse';
15
15
  /**
16
16
  * The version of the Promptbook library
17
17
  */
18
- var PROMPTBOOK_VERSION = '0.71.0-17';
18
+ var PROMPTBOOK_VERSION = '0.71.0-19';
19
19
  // TODO: [main] !!!! List here all the versions and annotate + put into script
20
20
 
21
21
  /*! *****************************************************************************
@@ -363,18 +363,25 @@ var LOOP_LIMIT = 1000;
363
363
  * @private within the repository - too low-level in comparison with other `MAX_...`
364
364
  */
365
365
  var IMMEDIATE_TIME = 10;
366
+ /**
367
+ * Strategy for caching the intermediate results for knowledge sources
368
+ *
369
+ * @public exported from `@promptbook/core`
370
+ */
371
+ var DEFAULT_INTERMEDIATE_FILES_STRATEGY = 'HIDE_AND_KEEP';
372
+ // <- TODO: [😡] Change to 'VISIBLE'
366
373
  /**
367
374
  * The maximum number of (LLM) tasks running in parallel
368
375
  *
369
376
  * @public exported from `@promptbook/core`
370
377
  */
371
- var MAX_PARALLEL_COUNT = 5; // <- TODO: [🤹‍♂️]
378
+ var DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [🤹‍♂️]
372
379
  /**
373
380
  * The maximum number of attempts to execute LLM task before giving up
374
381
  *
375
382
  * @public exported from `@promptbook/core`
376
383
  */
377
- var MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [🤹‍♂️]
384
+ var DEFAULT_MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [🤹‍♂️]
378
385
  /**
379
386
  * Where to store the scrape cache
380
387
  *
@@ -382,7 +389,7 @@ var MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [🤹‍♂️]
382
389
  *
383
390
  * @public exported from `@promptbook/core`
384
391
  */
385
- var SCRAPE_CACHE_DIRNAME = '/.promptbook/scrape-cache';
392
+ var DEFAULT_SCRAPE_CACHE_DIRNAME = '/.promptbook/scrape-cache';
386
393
  /**
387
394
  * Nonce which is used for replacing things in strings
388
395
  *
@@ -434,7 +441,7 @@ var DEFAULT_CSV_SETTINGS = Object.freeze({
434
441
  *
435
442
  * @public exported from `@promptbook/core`
436
443
  */
437
- var IS_VERBOSE = false;
444
+ var DEFAULT_IS_VERBOSE = false;
438
445
  /**
439
446
  * @@@
440
447
  *
@@ -1150,12 +1157,12 @@ function TODO_USE() {
1150
1157
  */
1151
1158
  function getScraperIntermediateSource(source, options) {
1152
1159
  return __awaiter(this, void 0, void 0, function () {
1153
- var sourceFilename, url, rootDirname, cacheDirname, isCacheCleaned, extension, isVerbose, hash, semanticName, pieces, name, cacheFilename, isDestroyed, fileHandler;
1160
+ var sourceFilename, url, rootDirname, cacheDirname, intermediateFilesStrategy, extension, isVerbose, hash, semanticName, pieces, name, cacheFilename, isDestroyed, fileHandler;
1154
1161
  return __generator(this, function (_a) {
1155
1162
  switch (_a.label) {
1156
1163
  case 0:
1157
1164
  sourceFilename = source.filename, url = source.url;
1158
- rootDirname = options.rootDirname, cacheDirname = options.cacheDirname, isCacheCleaned = options.isCacheCleaned, extension = options.extension, isVerbose = options.isVerbose;
1165
+ rootDirname = options.rootDirname, cacheDirname = options.cacheDirname, intermediateFilesStrategy = options.intermediateFilesStrategy, extension = options.extension, isVerbose = options.isVerbose;
1159
1166
  hash = SHA256(
1160
1167
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
1161
1168
  hexEncoder.parse(sourceFilename || url || 'untitled'))
@@ -1165,7 +1172,7 @@ function getScraperIntermediateSource(source, options) {
1165
1172
  pieces = ['intermediate', semanticName, hash].filter(function (piece) { return piece !== ''; });
1166
1173
  name = pieces.join('-').split('--').join('-');
1167
1174
  // <- TODO: Use MAX_FILENAME_LENGTH
1168
- TODO_USE(rootDirname); // <- TODO: !!!!!!
1175
+ TODO_USE(rootDirname); // <- TODO: [😡]
1169
1176
  cacheFilename = join.apply(void 0, __spreadArray(__spreadArray([process.cwd(),
1170
1177
  cacheDirname], __read(nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */)), false), [name], false)).split('\\')
1171
1178
  .join('/') +
@@ -1185,7 +1192,7 @@ function getScraperIntermediateSource(source, options) {
1185
1192
  return __generator(this, function (_a) {
1186
1193
  switch (_a.label) {
1187
1194
  case 0:
1188
- if (!isCacheCleaned) return [3 /*break*/, 2];
1195
+ if (!(intermediateFilesStrategy === 'HIDE_AND_CLEAN')) return [3 /*break*/, 2];
1189
1196
  if (isVerbose) {
1190
1197
  console.info('legacyDocumentScraper: Clening cache');
1191
1198
  }
@@ -1209,7 +1216,7 @@ function getScraperIntermediateSource(source, options) {
1209
1216
  /**
1210
1217
  * Note: Not using `FileCacheStorage` for two reasons:
1211
1218
  * 1) Need to store more than serialized JSONs
1212
- * 2) Need to switch between a `rootDirname` and `cacheDirname` <- TODO: !!!!
1219
+ * 2) Need to switch between a `rootDirname` and `cacheDirname` <- TODO: [😡]
1213
1220
  * TODO: [🐱‍🐉][🧠] Make some smart crop
1214
1221
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
1215
1222
  */
@@ -1274,7 +1281,6 @@ function pipelineJsonToString(pipelineJson) {
1274
1281
  pipelineString += '\n\n';
1275
1282
  pipelineString += description;
1276
1283
  }
1277
- // TODO:> const commands: Array<Command>
1278
1284
  var commands = [];
1279
1285
  if (pipelineUrl) {
1280
1286
  commands.push("PIPELINE URL ".concat(pipelineUrl));
@@ -1330,7 +1336,6 @@ function pipelineJsonToString(pipelineJson) {
1330
1336
  pipelineString += '\n\n';
1331
1337
  pipelineString += description_1;
1332
1338
  }
1333
- // TODO:> const commands: Array<Command>
1334
1339
  var commands_1 = [];
1335
1340
  var contentLanguage = 'text';
1336
1341
  if (templateType === 'PROMPT_TEMPLATE') {
@@ -2215,6 +2220,7 @@ function assertsExecutionSuccessful(executionResult) {
2215
2220
  }
2216
2221
  }
2217
2222
  /**
2223
+ * TODO: [🐚] This function should be removed OR changed OR be completely rewritten
2218
2224
  * TODO: [🧠] Can this return type be better typed than void
2219
2225
  */
2220
2226
 
@@ -2875,7 +2881,7 @@ function preparePersona(personaDescription, tools, options) {
2875
2881
  return __generator(this, function (_d) {
2876
2882
  switch (_d.label) {
2877
2883
  case 0:
2878
- _a = options.isVerbose, isVerbose = _a === void 0 ? IS_VERBOSE : _a;
2884
+ _a = options.isVerbose, isVerbose = _a === void 0 ? DEFAULT_IS_VERBOSE : _a;
2879
2885
  if (tools === undefined || tools.llm === undefined) {
2880
2886
  throw new MissingToolsError('LLM tools are required for preparing persona');
2881
2887
  }
@@ -3041,7 +3047,7 @@ var $Register = /** @class */ (function () {
3041
3047
  this.storage = globalScope[storageName];
3042
3048
  }
3043
3049
  $Register.prototype.list = function () {
3044
- // <- TODO: ReadonlyDeep<Array<TRegistered>>
3050
+ // <- TODO: ReadonlyDeep<ReadonlyArray<TRegistered>>
3045
3051
  return this.storage;
3046
3052
  };
3047
3053
  $Register.prototype.register = function (registered) {
@@ -3228,7 +3234,7 @@ function extensionToMimeType(value) {
3228
3234
  /**
3229
3235
  * @@@
3230
3236
  *
3231
- * @private for scraper utilities
3237
+ * @public exported from `@promptbook/core`
3232
3238
  */
3233
3239
  function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3234
3240
  var _a;
@@ -3241,7 +3247,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3241
3247
  case 0:
3242
3248
  sourceContent = knowledgeSource.sourceContent;
3243
3249
  name = knowledgeSource.name;
3244
- _b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c, _d = _b.isVerbose, isVerbose = _d === void 0 ? IS_VERBOSE : _d;
3250
+ _b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c, _d = _b.isVerbose, isVerbose = _d === void 0 ? DEFAULT_IS_VERBOSE : _d;
3245
3251
  TODO_USE(isVerbose);
3246
3252
  if (!name) {
3247
3253
  name = sourceContentToName(sourceContent);
@@ -3394,7 +3400,7 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
3394
3400
  return __generator(this, function (_c) {
3395
3401
  switch (_c.label) {
3396
3402
  case 0:
3397
- _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a, rootDirname = options.rootDirname, _b = options.isVerbose, isVerbose = _b === void 0 ? IS_VERBOSE : _b;
3403
+ _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a, rootDirname = options.rootDirname, _b = options.isVerbose, isVerbose = _b === void 0 ? DEFAULT_IS_VERBOSE : _b;
3398
3404
  knowledgePreparedUnflatten = new Array(knowledgeSources.length);
3399
3405
  return [4 /*yield*/, forEachAsync(knowledgeSources, { maxParallelCount: maxParallelCount }, function (knowledgeSource, index) { return __awaiter(_this, void 0, void 0, function () {
3400
3406
  var partialPieces, sourceHandler, _a, _b, scraper, partialPiecesUnchecked, e_1_1, pieces;
@@ -3423,7 +3429,8 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
3423
3429
  case 4:
3424
3430
  partialPiecesUnchecked = _d.sent();
3425
3431
  if (partialPiecesUnchecked !== null) {
3426
- partialPieces = partialPiecesUnchecked;
3432
+ partialPieces = __spreadArray([], __read(partialPiecesUnchecked), false);
3433
+ // <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
3427
3434
  return [3 /*break*/, 6];
3428
3435
  }
3429
3436
  _d.label = 5;
@@ -3471,7 +3478,7 @@ TODO: [🧊] This is how it can look in future
3471
3478
  > /**
3472
3479
  > * Unprepared knowledge
3473
3480
  > * /
3474
- > readonly knowledgeSources: Array<KnowledgeSourceJson>;
3481
+ > readonly knowledgeSources: ReadonlyArray<KnowledgeSourceJson>;
3475
3482
  > };
3476
3483
  >
3477
3484
  > export async function prepareKnowledgePieces(
@@ -3529,7 +3536,7 @@ function prepareTemplates(pipeline, tools, options) {
3529
3536
  return __generator(this, function (_b) {
3530
3537
  switch (_b.label) {
3531
3538
  case 0:
3532
- _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a;
3539
+ _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
3533
3540
  templates = pipeline.templates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
3534
3541
  // TODO: [main] !!!!! Apply samples to each template (if missing and is for the template defined)
3535
3542
  TODO_USE(parameters);
@@ -3591,7 +3598,7 @@ function preparePipeline(pipeline, tools, options) {
3591
3598
  if (isPipelinePrepared(pipeline)) {
3592
3599
  return [2 /*return*/, pipeline];
3593
3600
  }
3594
- rootDirname = options.rootDirname, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a, _b = options.isVerbose, isVerbose = _b === void 0 ? IS_VERBOSE : _b;
3601
+ rootDirname = options.rootDirname, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a, _b = options.isVerbose, isVerbose = _b === void 0 ? DEFAULT_IS_VERBOSE : _b;
3595
3602
  parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
3596
3603
  if (tools === undefined || tools.llm === undefined) {
3597
3604
  throw new MissingToolsError('LLM tools are required for preparing the pipeline');
@@ -3649,7 +3656,9 @@ function preparePipeline(pipeline, tools, options) {
3649
3656
  // ----- /Templates preparation -----
3650
3657
  // Note: Count total usage
3651
3658
  currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
3652
- return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { templates: templatesPrepared, knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: preparations }))];
3659
+ return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { templates: __spreadArray([], __read(templatesPrepared), false),
3660
+ // <- TODO: [🪓] Here should be no need for spreading new array, just ` templates: templatesPrepared`
3661
+ knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }))];
3653
3662
  }
3654
3663
  });
3655
3664
  });
@@ -4620,12 +4629,11 @@ function checkExpectations(expectations, value) {
4620
4629
  */
4621
4630
  function executeAttempts(options) {
4622
4631
  return __awaiter(this, void 0, void 0, function () {
4623
- var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, template, preparedPipeline, tools, settings, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTemplateResult, _llms, llmTools, _loop_1, attempt, state_1;
4632
+ var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, template, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTemplateResult, _llms, llmTools, _loop_1, attempt, state_1;
4624
4633
  return __generator(this, function (_a) {
4625
4634
  switch (_a.label) {
4626
4635
  case 0:
4627
- jokerParameterNames = options.jokerParameterNames, priority = options.priority, maxAttempts = options.maxAttempts, preparedContent = options.preparedContent, parameters = options.parameters, template = options.template, preparedPipeline = options.preparedPipeline, tools = options.tools, settings = options.settings, $executionReport = options.$executionReport, pipelineIdentification = options.pipelineIdentification;
4628
- maxExecutionAttempts = settings.maxExecutionAttempts;
4636
+ jokerParameterNames = options.jokerParameterNames, priority = options.priority, maxAttempts = options.maxAttempts, preparedContent = options.preparedContent, parameters = options.parameters, template = options.template, preparedPipeline = options.preparedPipeline, tools = options.tools, $executionReport = options.$executionReport, pipelineIdentification = options.pipelineIdentification, maxExecutionAttempts = options.maxExecutionAttempts;
4629
4637
  $ongoingTemplateResult = {
4630
4638
  $result: null,
4631
4639
  $resultString: null,
@@ -4991,12 +4999,12 @@ function executeAttempts(options) {
4991
4999
  */
4992
5000
  function executeFormatSubvalues(options) {
4993
5001
  return __awaiter(this, void 0, void 0, function () {
4994
- var template, jokerParameterNames, parameters, priority, pipelineIdentification, settings, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
5002
+ var template, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
4995
5003
  var _this = this;
4996
5004
  return __generator(this, function (_a) {
4997
5005
  switch (_a.label) {
4998
5006
  case 0:
4999
- template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, pipelineIdentification = options.pipelineIdentification, settings = options.settings;
5007
+ template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
5000
5008
  if (template.foreach === undefined) {
5001
5009
  return [2 /*return*/, /* not await */ executeAttempts(options)];
5002
5010
  }
@@ -5026,7 +5034,7 @@ function executeFormatSubvalues(options) {
5026
5034
  .join('\n')), "\n\n [\u26F7] This should never happen because subformat name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
5027
5035
  }
5028
5036
  if (formatDefinition.formatName === 'CSV') {
5029
- formatSettings = settings.csvSettings;
5037
+ formatSettings = csvSettings;
5030
5038
  // <- TODO: [🤹‍♂️] More universal, make simmilar pattern for other formats for example \n vs \r\n in text
5031
5039
  }
5032
5040
  return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, template.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
@@ -5179,13 +5187,12 @@ function getReservedParametersForTemplate(options) {
5179
5187
  */
5180
5188
  function executeTemplate(options) {
5181
5189
  return __awaiter(this, void 0, void 0, function () {
5182
- var currentTemplate, preparedPipeline, parametersToPass, tools, onProgress, settings, $executionReport, pipelineIdentification, maxExecutionAttempts, name, title, priority, usedParameterNames, dependentParameterNames, definedParameters, _a, _b, _c, definedParameterNames, parameters, _loop_1, _d, _e, parameterName, maxAttempts, jokerParameterNames, preparedContent, resultString;
5183
- var e_1, _f, _g;
5184
- return __generator(this, function (_h) {
5185
- switch (_h.label) {
5190
+ var currentTemplate, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, _a, maxExecutionAttempts, name, title, priority, usedParameterNames, dependentParameterNames, definedParameters, _b, _c, _d, definedParameterNames, parameters, _loop_1, _e, _f, parameterName, maxAttempts, jokerParameterNames, preparedContent, resultString;
5191
+ var e_1, _g, _h;
5192
+ return __generator(this, function (_j) {
5193
+ switch (_j.label) {
5186
5194
  case 0:
5187
- currentTemplate = options.currentTemplate, preparedPipeline = options.preparedPipeline, parametersToPass = options.parametersToPass, tools = options.tools, onProgress = options.onProgress, settings = options.settings, $executionReport = options.$executionReport, pipelineIdentification = options.pipelineIdentification;
5188
- maxExecutionAttempts = settings.maxExecutionAttempts;
5195
+ currentTemplate = options.currentTemplate, preparedPipeline = options.preparedPipeline, parametersToPass = options.parametersToPass, tools = options.tools, onProgress = options.onProgress, $executionReport = options.$executionReport, pipelineIdentification = options.pipelineIdentification, _a = options.maxExecutionAttempts, maxExecutionAttempts = _a === void 0 ? DEFAULT_MAX_EXECUTION_ATTEMPTS : _a;
5189
5196
  name = "pipeline-executor-frame-".concat(currentTemplate.name);
5190
5197
  title = currentTemplate.title;
5191
5198
  priority = preparedPipeline.templates.length - preparedPipeline.templates.indexOf(currentTemplate);
@@ -5200,7 +5207,7 @@ function executeTemplate(options) {
5200
5207
  // <- [🍸]
5201
5208
  })];
5202
5209
  case 1:
5203
- _h.sent();
5210
+ _j.sent();
5204
5211
  usedParameterNames = extractParameterNamesFromTemplate(currentTemplate);
5205
5212
  dependentParameterNames = new Set(currentTemplate.dependentParameterNames);
5206
5213
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
@@ -5211,15 +5218,15 @@ function executeTemplate(options) {
5211
5218
  .map(function (name) { return "{".concat(name, "}"); })
5212
5219
  .join(', '), "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
5213
5220
  }
5214
- _b = (_a = Object).freeze;
5215
- _c = [{}];
5221
+ _c = (_b = Object).freeze;
5222
+ _d = [{}];
5216
5223
  return [4 /*yield*/, getReservedParametersForTemplate({
5217
5224
  preparedPipeline: preparedPipeline,
5218
5225
  template: currentTemplate,
5219
5226
  pipelineIdentification: pipelineIdentification,
5220
5227
  })];
5221
5228
  case 2:
5222
- definedParameters = _b.apply(_a, [__assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_h.sent())])), parametersToPass])]);
5229
+ definedParameters = _c.apply(_b, [__assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), parametersToPass])]);
5223
5230
  definedParameterNames = new Set(Object.keys(definedParameters));
5224
5231
  parameters = {};
5225
5232
  _loop_1 = function (parameterName) {
@@ -5239,15 +5246,15 @@ function executeTemplate(options) {
5239
5246
  try {
5240
5247
  // Note: [2] Check that all used parameters are defined and removing unused parameters for this template
5241
5248
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
5242
- for (_d = __values(Array.from(union(definedParameterNames, usedParameterNames, dependentParameterNames))), _e = _d.next(); !_e.done; _e = _d.next()) {
5243
- parameterName = _e.value;
5249
+ for (_e = __values(Array.from(union(definedParameterNames, usedParameterNames, dependentParameterNames))), _f = _e.next(); !_f.done; _f = _e.next()) {
5250
+ parameterName = _f.value;
5244
5251
  _loop_1(parameterName);
5245
5252
  }
5246
5253
  }
5247
5254
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
5248
5255
  finally {
5249
5256
  try {
5250
- if (_e && !_e.done && (_f = _d.return)) _f.call(_d);
5257
+ if (_f && !_f.done && (_g = _e.return)) _g.call(_e);
5251
5258
  }
5252
5259
  finally { if (e_1) throw e_1.error; }
5253
5260
  }
@@ -5267,12 +5274,11 @@ function executeTemplate(options) {
5267
5274
  template: currentTemplate,
5268
5275
  preparedPipeline: preparedPipeline,
5269
5276
  tools: tools,
5270
- settings: settings,
5271
5277
  $executionReport: $executionReport,
5272
5278
  pipelineIdentification: pipelineIdentification,
5273
5279
  })];
5274
5280
  case 3:
5275
- resultString = _h.sent();
5281
+ resultString = _j.sent();
5276
5282
  return [4 /*yield*/, onProgress({
5277
5283
  name: name,
5278
5284
  title: title,
@@ -5284,12 +5290,12 @@ function executeTemplate(options) {
5284
5290
  // <- [🍸]
5285
5291
  })];
5286
5292
  case 4:
5287
- _h.sent();
5288
- return [2 /*return*/, Object.freeze((_g = {},
5289
- _g[currentTemplate.resultingParameterName] =
5293
+ _j.sent();
5294
+ return [2 /*return*/, Object.freeze((_h = {},
5295
+ _h[currentTemplate.resultingParameterName] =
5290
5296
  // <- Note: [👩‍👩‍👧] No need to detect parameter collision here because pipeline checks logic consistency during construction
5291
5297
  resultString,
5292
- _g))];
5298
+ _h))];
5293
5299
  }
5294
5300
  });
5295
5301
  });
@@ -5348,13 +5354,12 @@ function filterJustOutputParameters(options) {
5348
5354
  */
5349
5355
  function executePipeline(options) {
5350
5356
  return __awaiter(this, void 0, void 0, function () {
5351
- var inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, settings, maxParallelCount, rootDirname, _a, isVerbose, preparedPipeline, errors, warnings, executionReport, isReturned, _b, _c, parameter, e_1_1, _loop_1, _d, _e, parameterName, state_1, e_2_1, parametersToPass, resovedParameterNames_1, unresovedTemplates_1, resolving_1, loopLimit, _loop_2, error_1, usage_1, outputParameters_1, usage, outputParameters;
5357
+ var inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, _a, isVerbose, preparedPipeline, errors, warnings, executionReport, isReturned, _b, _c, parameter, e_1_1, _loop_1, _d, _e, parameterName, state_1, e_2_1, parametersToPass, resovedParameterNames_1, unresovedTemplates_1, resolving_1, loopLimit, _loop_2, error_1, usage_1, outputParameters_1, usage, outputParameters;
5352
5358
  var e_1, _f, e_2, _g;
5353
5359
  return __generator(this, function (_h) {
5354
5360
  switch (_h.label) {
5355
5361
  case 0:
5356
- inputParameters = options.inputParameters, tools = options.tools, onProgress = options.onProgress, pipeline = options.pipeline, setPreparedPipeline = options.setPreparedPipeline, pipelineIdentification = options.pipelineIdentification, settings = options.settings;
5357
- maxParallelCount = settings.maxParallelCount, rootDirname = settings.rootDirname, _a = settings.isVerbose, isVerbose = _a === void 0 ? IS_VERBOSE : _a;
5362
+ inputParameters = options.inputParameters, tools = options.tools, onProgress = options.onProgress, pipeline = options.pipeline, setPreparedPipeline = options.setPreparedPipeline, pipelineIdentification = options.pipelineIdentification, maxParallelCount = options.maxParallelCount, rootDirname = options.rootDirname, _a = options.isVerbose, isVerbose = _a === void 0 ? DEFAULT_IS_VERBOSE : _a;
5358
5363
  preparedPipeline = options.preparedPipeline;
5359
5364
  if (!(preparedPipeline === undefined)) return [3 /*break*/, 2];
5360
5365
  return [4 /*yield*/, preparePipeline(pipeline, tools, {
@@ -5539,12 +5544,7 @@ function executePipeline(options) {
5539
5544
  return [3 /*break*/, 4];
5540
5545
  case 3:
5541
5546
  unresovedTemplates_1 = unresovedTemplates_1.filter(function (template) { return template !== currentTemplate; });
5542
- work_1 = executeTemplate({
5543
- currentTemplate: currentTemplate,
5544
- preparedPipeline: preparedPipeline,
5545
- parametersToPass: parametersToPass,
5546
- tools: tools,
5547
- onProgress: function (progress) {
5547
+ work_1 = executeTemplate(__assign(__assign({}, options), { currentTemplate: currentTemplate, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
5548
5548
  if (isReturned) {
5549
5549
  throw new UnexpectedError(spaceTrim(function (block) { return "\n Can not call `onProgress` after pipeline execution is finished\n\n ".concat(block(pipelineIdentification), "\n\n ").concat(block(JSON.stringify(progress, null, 4)
5550
5550
  .split('\n')
@@ -5554,11 +5554,7 @@ function executePipeline(options) {
5554
5554
  if (onProgress) {
5555
5555
  onProgress(progress);
5556
5556
  }
5557
- },
5558
- settings: settings,
5559
- $executionReport: executionReport,
5560
- pipelineIdentification: spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Template name: ").concat(currentTemplate.name, "\n Template title: ").concat(currentTemplate.title, "\n "); }),
5561
- })
5557
+ }, $executionReport: executionReport, pipelineIdentification: spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Template name: ").concat(currentTemplate.name, "\n Template title: ").concat(currentTemplate.title, "\n "); }) }))
5562
5558
  .then(function (newParametersToPass) {
5563
5559
  parametersToPass = __assign(__assign({}, newParametersToPass), parametersToPass);
5564
5560
  resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTemplate.resultingParameterName], false);
@@ -5662,8 +5658,7 @@ function executePipeline(options) {
5662
5658
  */
5663
5659
  function createPipelineExecutor(options) {
5664
5660
  var _this = this;
5665
- var pipeline = options.pipeline, tools = options.tools, _a = options.settings, settings = _a === void 0 ? {} : _a;
5666
- var _b = settings.maxExecutionAttempts, maxExecutionAttempts = _b === void 0 ? MAX_EXECUTION_ATTEMPTS : _b, _c = settings.maxParallelCount, maxParallelCount = _c === void 0 ? MAX_PARALLEL_COUNT : _c, _d = settings.csvSettings, csvSettings = _d === void 0 ? DEFAULT_CSV_SETTINGS : _d, _e = settings.isVerbose, isVerbose = _e === void 0 ? IS_VERBOSE : _e, _f = settings.isNotPreparedWarningSupressed, isNotPreparedWarningSupressed = _f === void 0 ? false : _f, _g = settings.rootDirname, rootDirname = _g === void 0 ? null : _g;
5661
+ var pipeline = options.pipeline, tools = options.tools, _a = options.maxExecutionAttempts, maxExecutionAttempts = _a === void 0 ? DEFAULT_MAX_EXECUTION_ATTEMPTS : _a, _b = options.maxParallelCount, maxParallelCount = _b === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _b, _c = options.csvSettings, csvSettings = _c === void 0 ? DEFAULT_CSV_SETTINGS : _c, _d = options.isVerbose, isVerbose = _d === void 0 ? DEFAULT_IS_VERBOSE : _d, _e = options.isNotPreparedWarningSupressed, isNotPreparedWarningSupressed = _e === void 0 ? false : _e, _f = options.rootDirname, rootDirname = _f === void 0 ? null : _f;
5667
5662
  validatePipeline(pipeline);
5668
5663
  var pipelineIdentification = (function () {
5669
5664
  // Note: This is a 😐 implementation of [🚞]
@@ -5697,14 +5692,12 @@ function createPipelineExecutor(options) {
5697
5692
  tools: tools,
5698
5693
  onProgress: onProgress,
5699
5694
  pipelineIdentification: spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n ").concat(runCount === 1 ? '' : "Run #".concat(runCount), "\n "); }),
5700
- settings: {
5701
- maxExecutionAttempts: maxExecutionAttempts,
5702
- maxParallelCount: maxParallelCount,
5703
- csvSettings: csvSettings,
5704
- isVerbose: isVerbose,
5705
- isNotPreparedWarningSupressed: isNotPreparedWarningSupressed,
5706
- rootDirname: rootDirname,
5707
- },
5695
+ maxExecutionAttempts: maxExecutionAttempts,
5696
+ maxParallelCount: maxParallelCount,
5697
+ csvSettings: csvSettings,
5698
+ isVerbose: isVerbose,
5699
+ isNotPreparedWarningSupressed: isNotPreparedWarningSupressed,
5700
+ rootDirname: rootDirname,
5708
5701
  })];
5709
5702
  });
5710
5703
  }); };
@@ -5726,7 +5719,7 @@ var markdownScraperMetadata = $deepFreeze({
5726
5719
  mimeTypes: ['text/markdown', 'text/plain'],
5727
5720
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
5728
5721
  isAvilableInBrowser: true,
5729
- requiredExecutables: ['!!!!!!'],
5722
+ requiredExecutables: [],
5730
5723
  }); /* <- TODO: [🤛] */
5731
5724
  /**
5732
5725
  * Registration of known scraper metadata
@@ -5770,7 +5763,7 @@ var MarkdownScraper = /** @class */ (function () {
5770
5763
  return __generator(this, function (_k) {
5771
5764
  switch (_k.label) {
5772
5765
  case 0:
5773
- _a = this.options, _b = _a.maxParallelCount, maxParallelCount = _b === void 0 ? MAX_PARALLEL_COUNT : _b, _c = _a.isVerbose, isVerbose = _c === void 0 ? IS_VERBOSE : _c;
5766
+ _a = this.options, _b = _a.maxParallelCount, maxParallelCount = _b === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _b, _c = _a.isVerbose, isVerbose = _c === void 0 ? DEFAULT_IS_VERBOSE : _c;
5774
5767
  llm = this.tools.llm;
5775
5768
  if (llm === undefined) {
5776
5769
  throw new MissingToolsError('LLM tools are required for scraping external files');
@@ -5869,7 +5862,8 @@ var MarkdownScraper = /** @class */ (function () {
5869
5862
  embeddingResult = _c.sent();
5870
5863
  index.push({
5871
5864
  modelName: embeddingResult.modelName,
5872
- position: embeddingResult.content,
5865
+ position: __spreadArray([], __read(embeddingResult.content), false),
5866
+ // <- TODO: [🪓] Here should be no need for spreading new array, just `position: embeddingResult.content`
5873
5867
  });
5874
5868
  _c.label = 6;
5875
5869
  case 6: return [3 /*break*/, 8];
@@ -5920,7 +5914,7 @@ var documentScraperMetadata = $deepFreeze({
5920
5914
  mimeTypes: ['application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
5921
5915
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
5922
5916
  isAvilableInBrowser: false,
5923
- requiredExecutables: ['!!!!!!'],
5917
+ requiredExecutables: ['Pandoc'],
5924
5918
  }); /* <- TODO: [🤛] */
5925
5919
  /**
5926
5920
  * Registration of known scraper metadata
@@ -5962,11 +5956,11 @@ var DocumentScraper = /** @class */ (function () {
5962
5956
  DocumentScraper.prototype.$convert = function (source) {
5963
5957
  var _a;
5964
5958
  return __awaiter(this, void 0, void 0, function () {
5965
- var _b, _c, rootDirname, _d, cacheDirname, _e, isCacheCleaned, _f, isVerbose, extension, cacheFilehandler, command_1;
5959
+ var _b, _c, rootDirname, _d, cacheDirname, _e, intermediateFilesStrategy, _f, isVerbose, extension, cacheFilehandler, command_1;
5966
5960
  return __generator(this, function (_g) {
5967
5961
  switch (_g.label) {
5968
5962
  case 0:
5969
- _b = this.options, _c = _b.rootDirname, rootDirname = _c === void 0 ? process.cwd() : _c, _d = _b.cacheDirname, cacheDirname = _d === void 0 ? SCRAPE_CACHE_DIRNAME : _d, _e = _b.isCacheCleaned, isCacheCleaned = _e === void 0 ? false : _e, _f = _b.isVerbose, isVerbose = _f === void 0 ? IS_VERBOSE : _f;
5963
+ _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;
5970
5964
  if (!$isRunningInNode()) {
5971
5965
  throw new KnowledgeScrapeError('Scraping .docx files is only supported in Node environment');
5972
5966
  }
@@ -5985,7 +5979,7 @@ var DocumentScraper = /** @class */ (function () {
5985
5979
  return [4 /*yield*/, getScraperIntermediateSource(source, {
5986
5980
  rootDirname: rootDirname,
5987
5981
  cacheDirname: cacheDirname,
5988
- isCacheCleaned: isCacheCleaned,
5982
+ intermediateFilesStrategy: intermediateFilesStrategy,
5989
5983
  extension: 'md',
5990
5984
  isVerbose: isVerbose,
5991
5985
  })];
@@ -5995,10 +5989,8 @@ var DocumentScraper = /** @class */ (function () {
5995
5989
  case 2:
5996
5990
  if (!!(_g.sent())) return [3 /*break*/, 5];
5997
5991
  command_1 = "\"".concat(this.tools.executables.pandocPath, "\" -f ").concat(extension, " -t markdown \"").concat(source.filename, "\" -o \"").concat(cacheFilehandler.filename, "\"");
5998
- // TODO: !!!!!! [🕊] Make execCommand standard (?node-)util of the promptbook
5999
5992
  return [4 /*yield*/, $execCommand(command_1)];
6000
5993
  case 3:
6001
- // TODO: !!!!!! [🕊] Make execCommand standard (?node-)util of the promptbook
6002
5994
  _g.sent();
6003
5995
  return [4 /*yield*/, isFileExisting(cacheFilehandler.filename, this.tools.fs)];
6004
5996
  case 4:
@@ -6077,7 +6069,11 @@ var legacyDocumentScraperMetadata = $deepFreeze({
6077
6069
  mimeTypes: ['application/msword', 'text/rtf'],
6078
6070
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
6079
6071
  isAvilableInBrowser: false,
6080
- requiredExecutables: ['!!!!!!'],
6072
+ requiredExecutables: [
6073
+ 'Pandoc',
6074
+ 'LibreOffice',
6075
+ // <- TODO: [🧠] Should be 'LibreOffice' here, its dependency of dependency
6076
+ ],
6081
6077
  }); /* <- TODO: [🤛] */
6082
6078
  /**
6083
6079
  * Registration of known scraper metadata
@@ -6119,11 +6115,11 @@ var LegacyDocumentScraper = /** @class */ (function () {
6119
6115
  LegacyDocumentScraper.prototype.$convert = function (source) {
6120
6116
  var _a;
6121
6117
  return __awaiter(this, void 0, void 0, function () {
6122
- var _b, _c, rootDirname, _d, cacheDirname, _e, isCacheCleaned, _f, isVerbose, extension, cacheFilehandler, documentSourceOutdirPathForLibreOffice_1, command_1, files_1, file;
6118
+ var _b, _c, rootDirname, _d, cacheDirname, _e, intermediateFilesStrategy, _f, isVerbose, extension, cacheFilehandler, documentSourceOutdirPathForLibreOffice_1, command_1, files_1, file;
6123
6119
  return __generator(this, function (_g) {
6124
6120
  switch (_g.label) {
6125
6121
  case 0:
6126
- _b = this.options, _c = _b.rootDirname, rootDirname = _c === void 0 ? process.cwd() : _c, _d = _b.cacheDirname, cacheDirname = _d === void 0 ? SCRAPE_CACHE_DIRNAME : _d, _e = _b.isCacheCleaned, isCacheCleaned = _e === void 0 ? false : _e, _f = _b.isVerbose, isVerbose = _f === void 0 ? IS_VERBOSE : _f;
6122
+ _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;
6127
6123
  if (!$isRunningInNode()) {
6128
6124
  throw new KnowledgeScrapeError('Scraping .doc files is only supported in Node environment');
6129
6125
  }
@@ -6142,7 +6138,7 @@ var LegacyDocumentScraper = /** @class */ (function () {
6142
6138
  return [4 /*yield*/, getScraperIntermediateSource(source, {
6143
6139
  rootDirname: rootDirname,
6144
6140
  cacheDirname: cacheDirname,
6145
- isCacheCleaned: isCacheCleaned,
6141
+ intermediateFilesStrategy: intermediateFilesStrategy,
6146
6142
  extension: 'docx',
6147
6143
  isVerbose: isVerbose,
6148
6144
  })];
@@ -6158,10 +6154,8 @@ var LegacyDocumentScraper = /** @class */ (function () {
6158
6154
  .split('\\')
6159
6155
  .join('/');
6160
6156
  command_1 = "\"".concat(this.tools.executables.libreOfficePath, "\" --headless --convert-to docx \"").concat(source.filename, "\" --outdir \"").concat(documentSourceOutdirPathForLibreOffice_1, "\"");
6161
- // TODO: !!!!!! [🕊] Make execCommand standard (?node-)util of the promptbook - this should trigger build polution error
6162
6157
  return [4 /*yield*/, $execCommand(command_1)];
6163
6158
  case 3:
6164
- // TODO: !!!!!! [🕊] Make execCommand standard (?node-)util of the promptbook - this should trigger build polution error
6165
6159
  _g.sent();
6166
6160
  return [4 /*yield*/, readdir(documentSourceOutdirPathForLibreOffice_1)];
6167
6161
  case 4: