@promptbook/markitdown 0.84.0 โ†’ 0.85.0-0

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 (33) hide show
  1. package/README.md +4 -0
  2. package/esm/index.es.js +213 -160
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/core.index.d.ts +0 -2
  5. package/esm/typings/src/_packages/types.index.d.ts +14 -2
  6. package/esm/typings/src/_packages/utils.index.d.ts +0 -2
  7. package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +13 -0
  8. package/esm/typings/src/cli/cli-commands/start-server.d.ts +13 -0
  9. package/esm/typings/src/conversion/compilePipelineOnRemoteServer.d.ts +1 -1
  10. package/esm/typings/src/execution/AbstractTaskResult.d.ts +25 -0
  11. package/esm/typings/src/execution/ExecutionTask.d.ts +71 -0
  12. package/esm/typings/src/execution/PipelineExecutor.d.ts +2 -5
  13. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +2 -15
  14. package/esm/typings/src/execution/PromptbookFetch.d.ts +8 -1
  15. package/esm/typings/src/execution/{assertsExecutionSuccessful.d.ts โ†’ assertsTaskSuccessful.d.ts} +2 -3
  16. package/esm/typings/src/execution/createPipelineExecutor/00-createPipelineExecutor.d.ts +0 -3
  17. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +2 -6
  18. package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +3 -6
  19. package/esm/typings/src/prepare/preparePipelineOnRemoteServer.d.ts +1 -1
  20. package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -0
  21. package/esm/typings/src/types/typeAliases.d.ts +2 -0
  22. package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +2 -2
  23. package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +2 -2
  24. package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +2 -2
  25. package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +1 -1
  26. package/esm/typings/src/utils/random/$randomSeed.d.ts +2 -1
  27. package/esm/typings/src/utils/random/$randomToken.d.ts +13 -0
  28. package/esm/typings/src/wizzard/wizzard.d.ts +2 -3
  29. package/package.json +4 -2
  30. package/umd/index.umd.js +215 -164
  31. package/umd/index.umd.js.map +1 -1
  32. package/esm/typings/src/remote-server/socket-types/_common/PromptbookServer_Progress.d.ts +0 -10
  33. package/esm/typings/src/types/TaskProgress.d.ts +0 -43
package/umd/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs/promises'), require('spacetrim'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('prettier'), require('prettier/parser-html'), require('waitasecond'), require('crypto-js/sha256'), require('mime-types'), require('papaparse')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'fs/promises', 'spacetrim', 'crypto-js', 'crypto-js/enc-hex', 'path', 'prettier', 'prettier/parser-html', 'waitasecond', 'crypto-js/sha256', 'mime-types', 'papaparse'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-markitdown"] = {}, global.promises, global.spaceTrim, global.cryptoJs, global.hexEncoder, global.path, global.prettier, global.parserHtml, global.waitasecond, global.sha256, global.mimeTypes, global.papaparse));
5
- })(this, (function (exports, promises, spaceTrim, cryptoJs, hexEncoder, path, prettier, parserHtml, waitasecond, sha256, mimeTypes, papaparse) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs/promises'), require('spacetrim'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('prettier'), require('prettier/parser-html'), require('rxjs'), require('crypto'), require('waitasecond'), require('crypto-js/sha256'), require('mime-types'), require('papaparse')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'fs/promises', 'spacetrim', 'crypto-js', 'crypto-js/enc-hex', 'path', 'prettier', 'prettier/parser-html', 'rxjs', 'crypto', 'waitasecond', 'crypto-js/sha256', 'mime-types', 'papaparse'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-markitdown"] = {}, global.promises, global.spaceTrim, global.cryptoJs, global.hexEncoder, global.path, global.prettier, global.parserHtml, global.rxjs, global.crypto, global.waitasecond, global.sha256, global.mimeTypes, global.papaparse));
5
+ })(this, (function (exports, promises, spaceTrim, cryptoJs, hexEncoder, path, prettier, parserHtml, rxjs, crypto, waitasecond, sha256, mimeTypes, papaparse) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -25,7 +25,7 @@
25
25
  * @generated
26
26
  * @see https://github.com/webgptorg/promptbook
27
27
  */
28
- var PROMPTBOOK_ENGINE_VERSION = '0.84.0-21';
28
+ var PROMPTBOOK_ENGINE_VERSION = '0.84.0';
29
29
  /**
30
30
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
31
31
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
@@ -390,7 +390,7 @@
390
390
  */
391
391
  var $isRunningInNode = new Function("\n try {\n return this === global;\n } catch (e) {\n return false;\n }\n");
392
392
  /**
393
- * TODO: [โ˜‘]
393
+ * TODO: [๐ŸŽบ]
394
394
  */
395
395
 
396
396
  /**
@@ -2229,6 +2229,58 @@
2229
2229
  return PipelineExecutionError;
2230
2230
  }(Error));
2231
2231
 
2232
+ /**
2233
+ * Determine if the pipeline is fully prepared
2234
+ *
2235
+ * @see https://github.com/webgptorg/promptbook/discussions/196
2236
+ *
2237
+ * @public exported from `@promptbook/core`
2238
+ */
2239
+ function isPipelinePrepared(pipeline) {
2240
+ // Note: Ignoring `pipeline.preparations` @@@
2241
+ // Note: Ignoring `pipeline.knowledgePieces` @@@
2242
+ if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
2243
+ return false;
2244
+ }
2245
+ if (!pipeline.personas.every(function (persona) { return persona.modelRequirements !== undefined; })) {
2246
+ return false;
2247
+ }
2248
+ if (!pipeline.knowledgeSources.every(function (knowledgeSource) { return knowledgeSource.preparationIds !== undefined; })) {
2249
+ return false;
2250
+ }
2251
+ /*
2252
+ TODO: [๐Ÿง ][๐Ÿซ] `tasks` can not be determined if they are fully prepared SO ignoring them
2253
+ > if (!pipeline.tasks.every(({ preparedContent }) => preparedContent === undefined)) {
2254
+ > return false;
2255
+ > }
2256
+ */
2257
+ return true;
2258
+ }
2259
+ /**
2260
+ * TODO: [๐Ÿ”ƒ][main] If the pipeline was prepared with different version or different set of models, prepare it once again
2261
+ * TODO: [๐Ÿ ] Maybe base this on `makeValidator`
2262
+ * TODO: [๐ŸงŠ] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2263
+ * TODO: [๐Ÿงฟ] Maybe do same process with same granularity and subfinctions as `preparePipeline`
2264
+ * - [๐Ÿ] ? Is context in each task
2265
+ * - [โ™จ] Are examples prepared
2266
+ * - [โ™จ] Are tasks prepared
2267
+ */
2268
+
2269
+ /**
2270
+ * Generates random token
2271
+ *
2272
+ * Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
2273
+ *
2274
+ * @private internal helper function
2275
+ * @returns secure random token
2276
+ */
2277
+ function $randomToken(randomness) {
2278
+ return crypto.randomBytes(randomness).toString('hex');
2279
+ }
2280
+ /**
2281
+ * TODO: Maybe use nanoid instead https://github.com/ai/nanoid
2282
+ */
2283
+
2232
2284
  /**
2233
2285
  * This error indicates problems parsing the format value
2234
2286
  *
@@ -2414,9 +2466,9 @@
2414
2466
  *
2415
2467
  * @param executionResult - The partial result of the Promptbook execution
2416
2468
  * @throws {PipelineExecutionError} If the execution is not successful or if multiple errors occurred
2417
- * @public exported from `@promptbook/core`
2469
+ * @private internal helper function of `asPromise` method of `ExecutionTask`
2418
2470
  */
2419
- function assertsExecutionSuccessful(executionResult) {
2471
+ function assertsTaskSuccessful(executionResult) {
2420
2472
  var e_1, _a;
2421
2473
  var isSuccessful = executionResult.isSuccessful, errors = executionResult.errors, warnings = executionResult.warnings;
2422
2474
  try {
@@ -2451,121 +2503,54 @@
2451
2503
  }
2452
2504
  }
2453
2505
  /**
2454
- * TODO: [๐Ÿš] This function should be removed OR changed OR be completely rewritten
2455
2506
  * TODO: [๐Ÿง ] Can this return type be better typed than void
2456
2507
  */
2457
2508
 
2458
2509
  /**
2459
- * Determine if the pipeline is fully prepared
2460
- *
2461
- * @see https://github.com/webgptorg/promptbook/discussions/196
2462
- *
2463
- * @public exported from `@promptbook/core`
2464
- */
2465
- function isPipelinePrepared(pipeline) {
2466
- // Note: Ignoring `pipeline.preparations` @@@
2467
- // Note: Ignoring `pipeline.knowledgePieces` @@@
2468
- if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
2469
- return false;
2470
- }
2471
- if (!pipeline.personas.every(function (persona) { return persona.modelRequirements !== undefined; })) {
2472
- return false;
2473
- }
2474
- if (!pipeline.knowledgeSources.every(function (knowledgeSource) { return knowledgeSource.preparationIds !== undefined; })) {
2475
- return false;
2476
- }
2477
- /*
2478
- TODO: [๐Ÿง ][๐Ÿซ] `tasks` can not be determined if they are fully prepared SO ignoring them
2479
- > if (!pipeline.tasks.every(({ preparedContent }) => preparedContent === undefined)) {
2480
- > return false;
2481
- > }
2482
- */
2483
- return true;
2484
- }
2485
- /**
2486
- * TODO: [๐Ÿ”ƒ][main] If the pipeline was prepared with different version or different set of models, prepare it once again
2487
- * TODO: [๐Ÿ ] Maybe base this on `makeValidator`
2488
- * TODO: [๐ŸงŠ] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2489
- * TODO: [๐Ÿงฟ] Maybe do same process with same granularity and subfinctions as `preparePipeline`
2490
- * - [๐Ÿ] ? Is context in each task
2491
- * - [โ™จ] Are examples prepared
2492
- * - [โ™จ] Are tasks prepared
2493
- */
2494
-
2495
- /**
2496
- * Format either small or big number
2510
+ * Helper to create a new task
2497
2511
  *
2498
- * @public exported from `@promptbook/utils`
2512
+ * @private internal helper function
2499
2513
  */
2500
- function numberToString(value) {
2501
- if (value === 0) {
2502
- return '0';
2503
- }
2504
- else if (Number.isNaN(value)) {
2505
- return VALUE_STRINGS.nan;
2506
- }
2507
- else if (value === Infinity) {
2508
- return VALUE_STRINGS.infinity;
2509
- }
2510
- else if (value === -Infinity) {
2511
- return VALUE_STRINGS.negativeInfinity;
2512
- }
2513
- for (var exponent = 0; exponent < 15; exponent++) {
2514
- var factor = Math.pow(10, exponent);
2515
- var valueRounded = Math.round(value * factor) / factor;
2516
- if (Math.abs(value - valueRounded) / value < SMALL_NUMBER) {
2517
- return valueRounded.toFixed(exponent);
2518
- }
2514
+ function createTask(options) {
2515
+ var taskType = options.taskType, taskProcessCallback = options.taskProcessCallback;
2516
+ var taskId = "".concat(taskType.toLowerCase(), "-").concat($randomToken(256 /* <- TODO: !!! To global config */));
2517
+ var resultSubject = new rxjs.BehaviorSubject({});
2518
+ var finalResultPromise = /* not await */ taskProcessCallback(function (newOngoingResult) {
2519
+ resultSubject.next(newOngoingResult);
2520
+ });
2521
+ function asPromise(options) {
2522
+ return __awaiter(this, void 0, void 0, function () {
2523
+ var _a, isCrashedOnError, finalResult;
2524
+ return __generator(this, function (_b) {
2525
+ switch (_b.label) {
2526
+ case 0:
2527
+ _a = (options || {}).isCrashedOnError, isCrashedOnError = _a === void 0 ? true : _a;
2528
+ return [4 /*yield*/, finalResultPromise];
2529
+ case 1:
2530
+ finalResult = _b.sent();
2531
+ if (isCrashedOnError) {
2532
+ assertsTaskSuccessful(finalResult);
2533
+ }
2534
+ return [2 /*return*/, finalResult];
2535
+ }
2536
+ });
2537
+ });
2519
2538
  }
2520
- return value.toString();
2539
+ return {
2540
+ taskType: taskType,
2541
+ taskId: taskId,
2542
+ asPromise: asPromise,
2543
+ asObservable: function () {
2544
+ return rxjs.concat(resultSubject.asObservable(), rxjs.from(asPromise({
2545
+ isCrashedOnError: true,
2546
+ })));
2547
+ },
2548
+ };
2521
2549
  }
2522
-
2523
2550
  /**
2524
- * Function `valueToString` will convert the given value to string
2525
- * This is useful and used in the `templateParameters` function
2526
- *
2527
- * Note: This function is not just calling `toString` method
2528
- * It's more complex and can handle this conversion specifically for LLM models
2529
- * See `VALUE_STRINGS`
2530
- *
2531
- * Note: There are 2 similar functions
2532
- * - `valueToString` converts value to string for LLM models as human-readable string
2533
- * - `asSerializable` converts value to string to preserve full information to be able to convert it back
2534
- *
2535
- * @public exported from `@promptbook/utils`
2551
+ * TODO: Maybe allow to terminate the task and add getter `isFinished` or `status`
2552
+ * TODO: [๐Ÿš] Split into more files and make `PrepareTask` & `RemoteTask` + split the function
2536
2553
  */
2537
- function valueToString(value) {
2538
- try {
2539
- if (value === '') {
2540
- return VALUE_STRINGS.empty;
2541
- }
2542
- else if (value === null) {
2543
- return VALUE_STRINGS.null;
2544
- }
2545
- else if (value === undefined) {
2546
- return VALUE_STRINGS.undefined;
2547
- }
2548
- else if (typeof value === 'string') {
2549
- return value;
2550
- }
2551
- else if (typeof value === 'number') {
2552
- return numberToString(value);
2553
- }
2554
- else if (value instanceof Date) {
2555
- return value.toISOString();
2556
- }
2557
- else {
2558
- return JSON.stringify(value);
2559
- }
2560
- }
2561
- catch (error) {
2562
- if (!(error instanceof Error)) {
2563
- throw error;
2564
- }
2565
- console.error(error);
2566
- return VALUE_STRINGS.unserializable;
2567
- }
2568
- }
2569
2554
 
2570
2555
  /**
2571
2556
  * Serializes an error into a [๐Ÿš‰] JSON-serializable object
@@ -3229,10 +3214,9 @@
3229
3214
  return modelName;
3230
3215
  })
3231
3216
  .join(',');
3232
- return [4 /*yield*/, preparePersonaExecutor({ availableModelNames: availableModelNames, personaDescription: personaDescription })];
3217
+ return [4 /*yield*/, preparePersonaExecutor({ availableModelNames: availableModelNames, personaDescription: personaDescription }).asPromise()];
3233
3218
  case 3:
3234
3219
  result = _d.sent();
3235
- assertsExecutionSuccessful(result);
3236
3220
  outputParameters = result.outputParameters;
3237
3221
  modelRequirementsRaw = outputParameters.modelRequirements;
3238
3222
  modelRequirements = JSON.parse(modelRequirementsRaw);
@@ -4030,10 +4014,9 @@
4030
4014
  var content = _a.content;
4031
4015
  return content;
4032
4016
  }).join('\n\n'),
4033
- })];
4017
+ }).asPromise()];
4034
4018
  case 2:
4035
4019
  result = _e.sent();
4036
- assertsExecutionSuccessful(result);
4037
4020
  outputParameters = result.outputParameters;
4038
4021
  titleRaw = outputParameters.title;
4039
4022
  if (isVerbose) {
@@ -4105,6 +4088,81 @@
4105
4088
  * @see https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/increase-consistency#specify-the-desired-output-format
4106
4089
  */
4107
4090
 
4091
+ /**
4092
+ * Format either small or big number
4093
+ *
4094
+ * @public exported from `@promptbook/utils`
4095
+ */
4096
+ function numberToString(value) {
4097
+ if (value === 0) {
4098
+ return '0';
4099
+ }
4100
+ else if (Number.isNaN(value)) {
4101
+ return VALUE_STRINGS.nan;
4102
+ }
4103
+ else if (value === Infinity) {
4104
+ return VALUE_STRINGS.infinity;
4105
+ }
4106
+ else if (value === -Infinity) {
4107
+ return VALUE_STRINGS.negativeInfinity;
4108
+ }
4109
+ for (var exponent = 0; exponent < 15; exponent++) {
4110
+ var factor = Math.pow(10, exponent);
4111
+ var valueRounded = Math.round(value * factor) / factor;
4112
+ if (Math.abs(value - valueRounded) / value < SMALL_NUMBER) {
4113
+ return valueRounded.toFixed(exponent);
4114
+ }
4115
+ }
4116
+ return value.toString();
4117
+ }
4118
+
4119
+ /**
4120
+ * Function `valueToString` will convert the given value to string
4121
+ * This is useful and used in the `templateParameters` function
4122
+ *
4123
+ * Note: This function is not just calling `toString` method
4124
+ * It's more complex and can handle this conversion specifically for LLM models
4125
+ * See `VALUE_STRINGS`
4126
+ *
4127
+ * Note: There are 2 similar functions
4128
+ * - `valueToString` converts value to string for LLM models as human-readable string
4129
+ * - `asSerializable` converts value to string to preserve full information to be able to convert it back
4130
+ *
4131
+ * @public exported from `@promptbook/utils`
4132
+ */
4133
+ function valueToString(value) {
4134
+ try {
4135
+ if (value === '') {
4136
+ return VALUE_STRINGS.empty;
4137
+ }
4138
+ else if (value === null) {
4139
+ return VALUE_STRINGS.null;
4140
+ }
4141
+ else if (value === undefined) {
4142
+ return VALUE_STRINGS.undefined;
4143
+ }
4144
+ else if (typeof value === 'string') {
4145
+ return value;
4146
+ }
4147
+ else if (typeof value === 'number') {
4148
+ return numberToString(value);
4149
+ }
4150
+ else if (value instanceof Date) {
4151
+ return value.toISOString();
4152
+ }
4153
+ else {
4154
+ return JSON.stringify(value);
4155
+ }
4156
+ }
4157
+ catch (error) {
4158
+ if (!(error instanceof Error)) {
4159
+ throw error;
4160
+ }
4161
+ console.error(error);
4162
+ return VALUE_STRINGS.unserializable;
4163
+ }
4164
+ }
4165
+
4108
4166
  /**
4109
4167
  * Parses the given script and returns the list of all used variables that are not defined in the script
4110
4168
  *
@@ -5549,27 +5607,20 @@
5549
5607
  */
5550
5608
  function executeTask(options) {
5551
5609
  return __awaiter(this, void 0, void 0, function () {
5552
- var currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSupressed, name, title, priority, usedParameterNames, dependentParameterNames, definedParameters, _a, _b, _c, definedParameterNames, parameters, _loop_1, _d, _e, parameterName, maxAttempts, jokerParameterNames, preparedContent, resultString;
5553
- var e_1, _f, _g;
5554
- return __generator(this, function (_h) {
5555
- switch (_h.label) {
5610
+ var currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSupressed, priority, usedParameterNames, dependentParameterNames, definedParameters, _a, _b, _c, definedParameterNames, parameters, _loop_1, _d, _e, parameterName, maxAttempts, jokerParameterNames, preparedContent, resultString;
5611
+ var _f, e_1, _g, _h, _j;
5612
+ return __generator(this, function (_k) {
5613
+ switch (_k.label) {
5556
5614
  case 0:
5557
5615
  currentTask = options.currentTask, preparedPipeline = options.preparedPipeline, parametersToPass = options.parametersToPass, tools = options.tools, onProgress = options.onProgress, $executionReport = options.$executionReport, pipelineIdentification = options.pipelineIdentification, maxExecutionAttempts = options.maxExecutionAttempts, maxParallelCount = options.maxParallelCount, csvSettings = options.csvSettings, isVerbose = options.isVerbose, rootDirname = options.rootDirname, cacheDirname = options.cacheDirname, intermediateFilesStrategy = options.intermediateFilesStrategy, isAutoInstalled = options.isAutoInstalled, isNotPreparedWarningSupressed = options.isNotPreparedWarningSupressed;
5558
- name = "pipeline-executor-frame-".concat(currentTask.name);
5559
- title = currentTask.title;
5560
5616
  priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
5561
5617
  return [4 /*yield*/, onProgress({
5562
- name: name,
5563
- title: title,
5564
- isStarted: false,
5565
- isDone: false,
5566
- taskType: currentTask.taskType,
5567
- parameterName: currentTask.resultingParameterName,
5568
- parameterValue: null,
5569
- // <- [๐Ÿธ]
5618
+ outputParameters: (_f = {},
5619
+ _f[currentTask.resultingParameterName] = '',
5620
+ _f),
5570
5621
  })];
5571
5622
  case 1:
5572
- _h.sent();
5623
+ _k.sent();
5573
5624
  usedParameterNames = extractParameterNamesFromTask(currentTask);
5574
5625
  dependentParameterNames = new Set(currentTask.dependentParameterNames);
5575
5626
  // TODO: [๐Ÿ‘ฉ๐Ÿพโ€๐Ÿคโ€๐Ÿ‘ฉ๐Ÿป] Use here `mapAvailableToExpectedParameters`
@@ -5588,7 +5639,7 @@
5588
5639
  pipelineIdentification: pipelineIdentification,
5589
5640
  })];
5590
5641
  case 2:
5591
- definedParameters = _b.apply(_a, [__assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_h.sent())])), parametersToPass])]);
5642
+ definedParameters = _b.apply(_a, [__assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_k.sent())])), parametersToPass])]);
5592
5643
  definedParameterNames = new Set(Object.keys(definedParameters));
5593
5644
  parameters = {};
5594
5645
  _loop_1 = function (parameterName) {
@@ -5616,7 +5667,7 @@
5616
5667
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
5617
5668
  finally {
5618
5669
  try {
5619
- if (_e && !_e.done && (_f = _d.return)) _f.call(_d);
5670
+ if (_e && !_e.done && (_g = _d.return)) _g.call(_d);
5620
5671
  }
5621
5672
  finally { if (e_1) throw e_1.error; }
5622
5673
  }
@@ -5647,24 +5698,19 @@
5647
5698
  isNotPreparedWarningSupressed: isNotPreparedWarningSupressed,
5648
5699
  })];
5649
5700
  case 3:
5650
- resultString = _h.sent();
5701
+ resultString = _k.sent();
5651
5702
  return [4 /*yield*/, onProgress({
5652
- name: name,
5653
- title: title,
5654
- isStarted: true,
5655
- isDone: true,
5656
- taskType: currentTask.taskType,
5657
- parameterName: currentTask.resultingParameterName,
5658
- parameterValue: resultString,
5659
- // <- [๐Ÿธ]
5703
+ outputParameters: (_h = {},
5704
+ _h[currentTask.resultingParameterName] = resultString,
5705
+ _h),
5660
5706
  })];
5661
5707
  case 4:
5662
- _h.sent();
5663
- return [2 /*return*/, Object.freeze((_g = {},
5664
- _g[currentTask.resultingParameterName] =
5708
+ _k.sent();
5709
+ return [2 /*return*/, Object.freeze((_j = {},
5710
+ _j[currentTask.resultingParameterName] =
5665
5711
  // <- Note: [๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘ง] No need to detect parameter collision here because pipeline checks logic consistency during construction
5666
5712
  resultString,
5667
- _g))];
5713
+ _j))];
5668
5714
  }
5669
5715
  });
5670
5716
  });
@@ -5672,9 +5718,6 @@
5672
5718
  /**
5673
5719
  * TODO: [๐Ÿคนโ€โ™‚๏ธ]
5674
5720
  */
5675
- /**
5676
- * TODO: [๐Ÿš] Change onProgress to object that represents the running execution, can be subscribed via RxJS to and also awaited
5677
- */
5678
5721
 
5679
5722
  /**
5680
5723
  * @@@
@@ -5936,15 +5979,15 @@
5936
5979
  return [3 /*break*/, 4];
5937
5980
  case 3:
5938
5981
  unresovedTasks_1 = unresovedTasks_1.filter(function (task) { return task !== currentTask; });
5939
- work_1 = executeTask(__assign(__assign({}, options), { currentTask: currentTask, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
5982
+ work_1 = executeTask(__assign(__assign({}, options), { currentTask: currentTask, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (newOngoingResult) {
5940
5983
  if (isReturned) {
5941
- throw new UnexpectedError(spaceTrim.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)
5984
+ throw new UnexpectedError(spaceTrim.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(newOngoingResult, null, 4)
5942
5985
  .split('\n')
5943
5986
  .map(function (line) { return "> ".concat(line); })
5944
5987
  .join('\n')), "\n "); }));
5945
5988
  }
5946
5989
  if (onProgress) {
5947
- onProgress(progress);
5990
+ onProgress(newOngoingResult);
5948
5991
  }
5949
5992
  }, $executionReport: executionReport, pipelineIdentification: spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Task name: ").concat(currentTask.name, "\n Task title: ").concat(currentTask.title, "\n "); }) }))
5950
5993
  .then(function (newParametersToPass) {
@@ -6047,9 +6090,6 @@
6047
6090
  });
6048
6091
  });
6049
6092
  }
6050
- /**
6051
- * TODO: [๐Ÿš] Change onProgress to object that represents the running execution, can be subscribed via RxJS to and also awaited
6052
- */
6053
6093
 
6054
6094
  /**
6055
6095
  * Creates executor function from pipeline and execution tools.
@@ -6081,7 +6121,7 @@
6081
6121
  console.warn(spaceTrim.spaceTrim(function (block) { return "\n Pipeline is not prepared\n\n ".concat(block(pipelineIdentification), "\n\n It will be prepared ad-hoc before the first execution and **returned as `preparedPipeline` in `PipelineExecutorResult`**\n But it is recommended to prepare the pipeline during collection preparation\n\n @see more at https://ptbk.io/prepare-pipeline\n "); }));
6082
6122
  }
6083
6123
  var runCount = 0;
6084
- var pipelineExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
6124
+ var pipelineExecutorWithCallback = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
6085
6125
  return __generator(this, function (_a) {
6086
6126
  runCount++;
6087
6127
  return [2 /*return*/, /* not await */ executePipeline({
@@ -6106,11 +6146,23 @@
6106
6146
  })];
6107
6147
  });
6108
6148
  }); };
6149
+ var pipelineExecutor = function (inputParameters) {
6150
+ return createTask({
6151
+ taskType: 'EXECUTION',
6152
+ taskProcessCallback: function (updateOngoingResult) {
6153
+ var _this = this;
6154
+ return pipelineExecutorWithCallback(inputParameters, function (newOngoingResult) { return __awaiter(_this, void 0, void 0, function () {
6155
+ return __generator(this, function (_a) {
6156
+ updateOngoingResult(newOngoingResult);
6157
+ return [2 /*return*/];
6158
+ });
6159
+ }); });
6160
+ },
6161
+ });
6162
+ };
6163
+ // <- TODO: Make types such as there is no need to do `as` for `createTask`
6109
6164
  return pipelineExecutor;
6110
6165
  }
6111
- /**
6112
- * TODO: [๐Ÿš] Change onProgress to object that represents the running execution, can be subscribed via RxJS to and also awaited
6113
- */
6114
6166
 
6115
6167
  /**
6116
6168
  * Metadata of the scraper
@@ -6212,10 +6264,9 @@
6212
6264
  return [4 /*yield*/, source.asText()];
6213
6265
  case 4:
6214
6266
  knowledgeContent = _k.sent();
6215
- return [4 /*yield*/, prepareKnowledgeFromMarkdownExecutor({ knowledgeContent: knowledgeContent })];
6267
+ return [4 /*yield*/, prepareKnowledgeFromMarkdownExecutor({ knowledgeContent: knowledgeContent }).asPromise()];
6216
6268
  case 5:
6217
6269
  result = _k.sent();
6218
- assertsExecutionSuccessful(result);
6219
6270
  outputParameters = result.outputParameters;
6220
6271
  knowledgePiecesRaw = outputParameters.knowledgePieces;
6221
6272
  knowledgeTextPieces = (knowledgePiecesRaw || '').split('\n---\n');
@@ -6238,13 +6289,13 @@
6238
6289
  _c.label = 1;
6239
6290
  case 1:
6240
6291
  _c.trys.push([1, 7, , 8]);
6241
- return [4 /*yield*/, prepareTitleExecutor({ knowledgePieceContent: knowledgePieceContent })];
6292
+ return [4 /*yield*/, prepareTitleExecutor({ knowledgePieceContent: knowledgePieceContent }).asPromise()];
6242
6293
  case 2:
6243
6294
  titleResult = _c.sent();
6244
6295
  _a = titleResult.outputParameters.title, titleRaw = _a === void 0 ? 'Untitled' : _a;
6245
6296
  title = spaceTrim__default["default"](titleRaw) /* <- TODO: Maybe do in pipeline */;
6246
6297
  name = titleToName(title);
6247
- return [4 /*yield*/, prepareKeywordsExecutor({ knowledgePieceContent: knowledgePieceContent })];
6298
+ return [4 /*yield*/, prepareKeywordsExecutor({ knowledgePieceContent: knowledgePieceContent }).asPromise()];
6248
6299
  case 3:
6249
6300
  keywordsResult = _c.sent();
6250
6301
  _b = keywordsResult.outputParameters.keywords, keywordsRaw = _b === void 0 ? '' : _b;