@promptbook/wizard 0.100.0-44 → 0.100.0-46

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 (34) hide show
  1. package/esm/index.es.js +214 -129
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/components.index.d.ts +14 -0
  4. package/esm/typings/src/_packages/core.index.d.ts +4 -0
  5. package/esm/typings/src/_packages/types.index.d.ts +8 -0
  6. package/esm/typings/src/book-2.0/commitments/_misc/AgentModelRequirements.d.ts +1 -1
  7. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +26 -0
  8. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfileFromSource.d.ts +19 -0
  9. package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +15 -0
  10. package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +128 -0
  11. package/esm/typings/src/book-components/Chat/interfaces/ChatMessage.d.ts +16 -0
  12. package/esm/typings/src/book-components/Chat/interfaces/ChatParticipant.d.ts +12 -0
  13. package/esm/typings/src/book-components/Chat/utils/ExportFormat.d.ts +4 -0
  14. package/esm/typings/src/book-components/Chat/utils/addUtmParamsToUrl.d.ts +7 -0
  15. package/esm/typings/src/book-components/Chat/utils/createShortLinkForChat.d.ts +7 -0
  16. package/esm/typings/src/book-components/Chat/utils/downloadFile.d.ts +6 -0
  17. package/esm/typings/src/book-components/Chat/utils/exportChatHistory.d.ts +11 -0
  18. package/esm/typings/src/book-components/Chat/utils/generatePdfContent.d.ts +10 -0
  19. package/esm/typings/src/book-components/Chat/utils/generateQrDataUrl.d.ts +7 -0
  20. package/esm/typings/src/book-components/Chat/utils/getPromptbookBranding.d.ts +6 -0
  21. package/esm/typings/src/book-components/Chat/utils/messagesToHtml.d.ts +10 -0
  22. package/esm/typings/src/book-components/Chat/utils/messagesToJson.d.ts +7 -0
  23. package/esm/typings/src/book-components/Chat/utils/messagesToMarkdown.d.ts +10 -0
  24. package/esm/typings/src/book-components/Chat/utils/messagesToText.d.ts +10 -0
  25. package/esm/typings/src/config.d.ts +13 -0
  26. package/esm/typings/src/execution/ExecutionTask.d.ts +12 -13
  27. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +8 -0
  28. package/esm/typings/src/playground/permanent/error-handling-playground.d.ts +5 -0
  29. package/esm/typings/src/utils/organization/preserve.d.ts +21 -0
  30. package/esm/typings/src/version.d.ts +1 -1
  31. package/package.json +2 -3
  32. package/umd/index.umd.js +218 -133
  33. package/umd/index.umd.js.map +1 -1
  34. package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +0 -14
package/esm/index.es.js CHANGED
@@ -12,8 +12,9 @@ import { forTime } from 'waitasecond';
12
12
  import { SHA256 } from 'crypto-js';
13
13
  import hexEncoder from 'crypto-js/enc-hex';
14
14
  import { basename, join, dirname, relative } from 'path';
15
- import { format } from 'prettier';
16
15
  import parserHtml from 'prettier/parser-html';
16
+ import parserMarkdown from 'prettier/parser-markdown';
17
+ import { format } from 'prettier/standalone';
17
18
  import { Subject } from 'rxjs';
18
19
  import sha256 from 'crypto-js/sha256';
19
20
  import { lookup, extension } from 'mime-types';
@@ -38,7 +39,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
38
39
  * @generated
39
40
  * @see https://github.com/webgptorg/promptbook
40
41
  */
41
- const PROMPTBOOK_ENGINE_VERSION = '0.100.0-44';
42
+ const PROMPTBOOK_ENGINE_VERSION = '0.100.0-46';
42
43
  /**
43
44
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
44
45
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -326,6 +327,13 @@ const DEFAULT_TASK_SIMULATED_DURATION_MS = 5 * 60 * 1000; // 5 minutes
326
327
  * @public exported from `@promptbook/core`
327
328
  */
328
329
  const DEFAULT_MAX_REQUESTS_PER_MINUTE = 60;
330
+ /**
331
+ * API request timeout in milliseconds
332
+ * Can be overridden via API_REQUEST_TIMEOUT environment variable
333
+ *
334
+ * @public exported from `@promptbook/core`
335
+ */
336
+ const API_REQUEST_TIMEOUT = parseInt(process.env.API_REQUEST_TIMEOUT || '90000');
329
337
  /**
330
338
  * Indicates whether pipeline logic validation is enabled. When true, the pipeline logic is checked for consistency.
331
339
  *
@@ -4554,7 +4562,18 @@ class OpenAiCompatibleExecutionTools {
4554
4562
  const openAiOptions = { ...this.options };
4555
4563
  delete openAiOptions.isVerbose;
4556
4564
  delete openAiOptions.userId;
4557
- this.client = new OpenAI(openAiOptions);
4565
+ // Enhanced configuration for better ECONNRESET handling
4566
+ const enhancedOptions = {
4567
+ ...openAiOptions,
4568
+ timeout: API_REQUEST_TIMEOUT,
4569
+ maxRetries: CONNECTION_RETRIES_LIMIT,
4570
+ defaultHeaders: {
4571
+ Connection: 'keep-alive',
4572
+ 'Keep-Alive': 'timeout=30, max=100',
4573
+ ...openAiOptions.defaultHeaders,
4574
+ },
4575
+ };
4576
+ this.client = new OpenAI(enhancedOptions);
4558
4577
  }
4559
4578
  return this.client;
4560
4579
  }
@@ -4642,7 +4661,7 @@ class OpenAiCompatibleExecutionTools {
4642
4661
  console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
4643
4662
  }
4644
4663
  const rawResponse = await this.limiter
4645
- .schedule(() => client.chat.completions.create(rawRequest))
4664
+ .schedule(() => this.makeRequestWithRetry(() => client.chat.completions.create(rawRequest)))
4646
4665
  .catch((error) => {
4647
4666
  assertsError(error);
4648
4667
  if (this.options.isVerbose) {
@@ -4718,7 +4737,7 @@ class OpenAiCompatibleExecutionTools {
4718
4737
  console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
4719
4738
  }
4720
4739
  const rawResponse = await this.limiter
4721
- .schedule(() => client.completions.create(rawRequest))
4740
+ .schedule(() => this.makeRequestWithRetry(() => client.completions.create(rawRequest)))
4722
4741
  .catch((error) => {
4723
4742
  assertsError(error);
4724
4743
  if (this.options.isVerbose) {
@@ -4782,7 +4801,7 @@ class OpenAiCompatibleExecutionTools {
4782
4801
  console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
4783
4802
  }
4784
4803
  const rawResponse = await this.limiter
4785
- .schedule(() => client.embeddings.create(rawRequest))
4804
+ .schedule(() => this.makeRequestWithRetry(() => client.embeddings.create(rawRequest)))
4786
4805
  .catch((error) => {
4787
4806
  assertsError(error);
4788
4807
  if (this.options.isVerbose) {
@@ -4840,6 +4859,76 @@ class OpenAiCompatibleExecutionTools {
4840
4859
  }
4841
4860
  return model;
4842
4861
  }
4862
+ // <- Note: [🤖] getDefaultXxxModel
4863
+ /**
4864
+ * Makes a request with retry logic for network errors like ECONNRESET
4865
+ */
4866
+ async makeRequestWithRetry(requestFn) {
4867
+ let lastError;
4868
+ for (let attempt = 1; attempt <= CONNECTION_RETRIES_LIMIT; attempt++) {
4869
+ try {
4870
+ return await requestFn();
4871
+ }
4872
+ catch (error) {
4873
+ assertsError(error);
4874
+ lastError = error;
4875
+ // Check if this is a retryable network error
4876
+ const isRetryableError = this.isRetryableNetworkError(error);
4877
+ if (!isRetryableError || attempt === CONNECTION_RETRIES_LIMIT) {
4878
+ if (this.options.isVerbose) {
4879
+ console.info(colors.bgRed('Final error after retries'), `Attempt ${attempt}/${CONNECTION_RETRIES_LIMIT}:`, error);
4880
+ }
4881
+ throw error;
4882
+ }
4883
+ // Calculate exponential backoff delay
4884
+ const baseDelay = 1000; // 1 second
4885
+ const backoffDelay = baseDelay * Math.pow(2, attempt - 1);
4886
+ const jitterDelay = Math.random() * 500; // Add some randomness
4887
+ const totalDelay = backoffDelay + jitterDelay;
4888
+ if (this.options.isVerbose) {
4889
+ console.info(colors.bgYellow('Retrying request'), `Attempt ${attempt}/${CONNECTION_RETRIES_LIMIT}, waiting ${Math.round(totalDelay)}ms:`, error.message);
4890
+ }
4891
+ // Wait before retrying
4892
+ await new Promise((resolve) => setTimeout(resolve, totalDelay));
4893
+ }
4894
+ }
4895
+ throw lastError;
4896
+ }
4897
+ /**
4898
+ * Determines if an error is retryable (network-related errors)
4899
+ */
4900
+ isRetryableNetworkError(error) {
4901
+ const errorMessage = error.message.toLowerCase();
4902
+ const errorCode = error.code;
4903
+ // Network connection errors that should be retried
4904
+ const retryableErrors = [
4905
+ 'econnreset',
4906
+ 'enotfound',
4907
+ 'econnrefused',
4908
+ 'etimedout',
4909
+ 'socket hang up',
4910
+ 'network error',
4911
+ 'fetch failed',
4912
+ 'connection reset',
4913
+ 'connection refused',
4914
+ 'timeout',
4915
+ ];
4916
+ // Check error message
4917
+ if (retryableErrors.some((retryableError) => errorMessage.includes(retryableError))) {
4918
+ return true;
4919
+ }
4920
+ // Check error code
4921
+ if (errorCode && retryableErrors.includes(errorCode.toLowerCase())) {
4922
+ return true;
4923
+ }
4924
+ // Check for specific HTTP status codes that are retryable
4925
+ const errorWithStatus = error;
4926
+ const httpStatus = errorWithStatus.status || errorWithStatus.statusCode;
4927
+ if (httpStatus && [429, 500, 502, 503, 504].includes(httpStatus)) {
4928
+ return true;
4929
+ }
4930
+ return false;
4931
+ }
4843
4932
  }
4844
4933
  /**
4845
4934
  * TODO: [🛄] Some way how to re-wrap the errors from `OpenAiCompatibleExecutionTools`
@@ -6282,7 +6371,7 @@ function prettifyMarkdown(content) {
6282
6371
  try {
6283
6372
  return format(content, {
6284
6373
  parser: 'markdown',
6285
- plugins: [parserHtml],
6374
+ plugins: [parserMarkdown, parserHtml],
6286
6375
  // TODO: DRY - make some import or auto-copy of .prettierrc
6287
6376
  endOfLine: 'lf',
6288
6377
  tabWidth: 4,
@@ -7171,7 +7260,7 @@ function assertsTaskSuccessful(executionResult) {
7171
7260
  * @private internal helper function
7172
7261
  */
7173
7262
  function createTask(options) {
7174
- const { taskType, taskProcessCallback, tldrProvider } = options;
7263
+ const { taskType, taskProcessCallback } = options;
7175
7264
  let { title } = options;
7176
7265
  // TODO: [🐙] DRY
7177
7266
  const taskId = `${taskType.toLowerCase().substring(0, 4)}-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid similar char conflicts */)}`;
@@ -7181,6 +7270,7 @@ function createTask(options) {
7181
7270
  const errors = [];
7182
7271
  const warnings = [];
7183
7272
  let currentValue = {};
7273
+ let customTldr = null;
7184
7274
  const partialResultSubject = new Subject();
7185
7275
  // <- Note: Not using `BehaviorSubject` because on error we can't access the last value
7186
7276
  const finalResultPromise = /* not await */ taskProcessCallback((newOngoingResult) => {
@@ -7191,6 +7281,9 @@ function createTask(options) {
7191
7281
  Object.assign(currentValue, newOngoingResult);
7192
7282
  // <- TODO: assign deep
7193
7283
  partialResultSubject.next(newOngoingResult);
7284
+ }, (tldrInfo) => {
7285
+ customTldr = tldrInfo;
7286
+ updatedAt = new Date();
7194
7287
  });
7195
7288
  finalResultPromise
7196
7289
  .catch((error) => {
@@ -7246,9 +7339,9 @@ function createTask(options) {
7246
7339
  },
7247
7340
  get tldr() {
7248
7341
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
7249
- // Use custom tldr provider if available
7250
- if (tldrProvider) {
7251
- return tldrProvider(createdAt, status, currentValue, errors, warnings);
7342
+ // Use custom tldr if available
7343
+ if (customTldr) {
7344
+ return customTldr;
7252
7345
  }
7253
7346
  // Fallback to default implementation
7254
7347
  const cv = currentValue;
@@ -7747,7 +7840,7 @@ async function preparePersona(personaDescription, tools, options) {
7747
7840
  const result = await preparePersonaExecutor({
7748
7841
  availableModels /* <- Note: Passing as JSON */,
7749
7842
  personaDescription,
7750
- }).asPromise();
7843
+ }).asPromise({ isCrashedOnError: true });
7751
7844
  const { outputParameters } = result;
7752
7845
  const { modelsRequirements: modelsRequirementsJson } = outputParameters;
7753
7846
  let modelsRequirementsUnchecked = jsonParse(modelsRequirementsJson);
@@ -8360,7 +8453,7 @@ async function preparePipeline(pipeline, tools, options) {
8360
8453
  });
8361
8454
  const result = await prepareTitleExecutor({
8362
8455
  book: sources.map(({ content }) => content).join('\n\n'),
8363
- }).asPromise();
8456
+ }).asPromise({ isCrashedOnError: true });
8364
8457
  const { outputParameters } = result;
8365
8458
  const { title: titleRaw } = outputParameters;
8366
8459
  if (isVerbose) {
@@ -10309,80 +10402,74 @@ function createPipelineExecutor(options) {
10309
10402
  });
10310
10403
  });
10311
10404
  };
10312
- const pipelineExecutor = (inputParameters) => createTask({
10313
- taskType: 'EXECUTION',
10314
- title: pipeline.title,
10315
- taskProcessCallback(updateOngoingResult) {
10316
- return pipelineExecutorWithCallback(inputParameters, async (newOngoingResult) => {
10317
- updateOngoingResult(newOngoingResult);
10318
- });
10319
- },
10320
- tldrProvider(createdAt, status, currentValue, errors) {
10321
- var _a;
10322
- // Better progress estimation based on pipeline structure
10323
- const cv = currentValue;
10324
- // Handle finished/error states
10325
- if (status === 'FINISHED') {
10326
- return {
10327
- percent: 1,
10328
- message: 'Finished',
10329
- };
10330
- }
10331
- if (status === 'ERROR') {
10332
- const errorMessage = errors.length > 0 ? errors[errors.length - 1].message : 'Error';
10333
- return {
10334
- percent: 0,
10335
- message: errorMessage,
10336
- };
10337
- }
10338
- // Calculate progress based on pipeline tasks
10339
- const totalTasks = pipeline.tasks.length;
10340
- let completedTasks = 0;
10341
- let currentTaskName = '';
10342
- // Check execution report for completed tasks
10343
- if ((_a = cv === null || cv === void 0 ? void 0 : cv.executionReport) === null || _a === void 0 ? void 0 : _a.promptExecutions) {
10344
- const executedTaskTitles = new Set(cv.executionReport.promptExecutions.map((execution) => execution.prompt.title));
10345
- // Count completed tasks by matching titles
10346
- const completedTasksByTitle = pipeline.tasks.filter(task => executedTaskTitles.has(task.title));
10347
- completedTasks = completedTasksByTitle.length;
10348
- // Find current task being executed (first task not yet completed)
10349
- const remainingTasks = pipeline.tasks.filter(task => !executedTaskTitles.has(task.title));
10350
- if (remainingTasks.length > 0) {
10351
- currentTaskName = remainingTasks[0].name;
10352
- }
10353
- }
10354
- // Calculate progress percentage
10355
- let percent = totalTasks > 0 ? completedTasks / totalTasks : 0;
10356
- // Add time-based progress for current task (assuming 5 minutes total)
10357
- if (completedTasks < totalTasks) {
10358
- const elapsedMs = new Date().getTime() - createdAt.getTime();
10359
- const totalMs = 5 * 60 * 1000; // 5 minutes
10360
- const timeProgress = Math.min(elapsedMs / totalMs, 1);
10361
- // Add partial progress for current task
10362
- percent += (1 / totalTasks) * timeProgress;
10363
- }
10364
- // Clamp to [0,1]
10365
- percent = Math.min(Math.max(percent, 0), 1);
10366
- // Generate message
10367
- let message = '';
10368
- if (currentTaskName) {
10369
- // Find the task to get its title
10370
- const currentTask = pipeline.tasks.find(task => task.name === currentTaskName);
10371
- const taskTitle = (currentTask === null || currentTask === void 0 ? void 0 : currentTask.title) || currentTaskName;
10372
- message = `Working on task ${taskTitle}`;
10373
- }
10374
- else if (completedTasks === 0) {
10375
- message = 'Starting pipeline execution';
10376
- }
10377
- else {
10378
- message = `Processing pipeline (${completedTasks}/${totalTasks} tasks completed)`;
10379
- }
10380
- return {
10381
- percent,
10382
- message,
10383
- };
10384
- },
10385
- });
10405
+ const pipelineExecutor = (inputParameters) => {
10406
+ const startTime = new Date().getTime();
10407
+ return createTask({
10408
+ taskType: 'EXECUTION',
10409
+ title: pipeline.title,
10410
+ taskProcessCallback(updateOngoingResult, updateTldr) {
10411
+ return pipelineExecutorWithCallback(inputParameters, async (newOngoingResult) => {
10412
+ var _a, _b;
10413
+ updateOngoingResult(newOngoingResult);
10414
+ // Calculate and update tldr based on pipeline progress
10415
+ const cv = newOngoingResult;
10416
+ // Calculate progress based on parameters resolved vs total parameters
10417
+ const totalParameters = pipeline.parameters.filter(p => !p.isInput).length;
10418
+ let resolvedParameters = 0;
10419
+ let currentTaskTitle = '';
10420
+ // Get the resolved parameters from output parameters
10421
+ if (cv === null || cv === void 0 ? void 0 : cv.outputParameters) {
10422
+ // Count how many output parameters have non-empty values
10423
+ resolvedParameters = Object.values(cv.outputParameters).filter(value => value !== undefined && value !== null && String(value).trim() !== '').length;
10424
+ }
10425
+ // Try to determine current task from execution report
10426
+ if (((_a = cv === null || cv === void 0 ? void 0 : cv.executionReport) === null || _a === void 0 ? void 0 : _a.promptExecutions) && cv.executionReport.promptExecutions.length > 0) {
10427
+ const lastExecution = cv.executionReport.promptExecutions[cv.executionReport.promptExecutions.length - 1];
10428
+ if ((_b = lastExecution === null || lastExecution === void 0 ? void 0 : lastExecution.prompt) === null || _b === void 0 ? void 0 : _b.title) {
10429
+ currentTaskTitle = lastExecution.prompt.title;
10430
+ }
10431
+ }
10432
+ // Calculate base progress percentage
10433
+ let percent = totalParameters > 0 ? resolvedParameters / totalParameters : 0;
10434
+ // Add time-based progress for current task if we haven't completed all parameters
10435
+ if (resolvedParameters < totalParameters) {
10436
+ const elapsedMs = new Date().getTime() - startTime;
10437
+ const estimatedTotalMs = totalParameters * 30 * 1000; // Estimate 30 seconds per parameter
10438
+ const timeProgress = Math.min(elapsedMs / estimatedTotalMs, 0.9); // Cap at 90% for time-based progress
10439
+ // If we have time progress but no parameter progress, show time progress
10440
+ if (percent === 0 && timeProgress > 0) {
10441
+ percent = Math.min(timeProgress, 0.1); // Show some progress but not more than 10%
10442
+ }
10443
+ else if (percent < 1) {
10444
+ // Add partial progress for current task
10445
+ const taskProgress = totalParameters > 0 ? (1 / totalParameters) * 0.5 : 0; // 50% of task progress
10446
+ percent = Math.min(percent + taskProgress, 0.95); // Cap at 95% until fully complete
10447
+ }
10448
+ }
10449
+ // Clamp to [0,1]
10450
+ percent = Math.min(Math.max(percent, 0), 1);
10451
+ // Generate message
10452
+ let message = '';
10453
+ if (currentTaskTitle) {
10454
+ message = `Executing: ${currentTaskTitle}`;
10455
+ }
10456
+ else if (resolvedParameters === 0) {
10457
+ message = 'Starting pipeline execution';
10458
+ }
10459
+ else if (resolvedParameters < totalParameters) {
10460
+ message = `Processing pipeline (${resolvedParameters}/${totalParameters} parameters resolved)`;
10461
+ }
10462
+ else {
10463
+ message = 'Completing pipeline execution';
10464
+ }
10465
+ updateTldr({
10466
+ percent: percent,
10467
+ message,
10468
+ });
10469
+ });
10470
+ },
10471
+ });
10472
+ };
10386
10473
  // <- TODO: Make types such as there is no need to do `as` for `createTask`
10387
10474
  return pipelineExecutor;
10388
10475
  }
@@ -10467,7 +10554,9 @@ class MarkdownScraper {
10467
10554
  },
10468
10555
  });
10469
10556
  const knowledgeContent = await source.asText();
10470
- const result = await prepareKnowledgeFromMarkdownExecutor({ knowledgeContent }).asPromise();
10557
+ const result = await prepareKnowledgeFromMarkdownExecutor({ knowledgeContent }).asPromise({
10558
+ isCrashedOnError: true,
10559
+ });
10471
10560
  const { outputParameters } = result;
10472
10561
  const { knowledgePieces: knowledgePiecesRaw } = outputParameters;
10473
10562
  const knowledgeTextPieces = (knowledgePiecesRaw || '').split('\n---\n');
@@ -10491,12 +10580,16 @@ class MarkdownScraper {
10491
10580
  ];
10492
10581
  */
10493
10582
  try {
10494
- const titleResult = await prepareTitleExecutor({ knowledgePieceContent }).asPromise();
10583
+ const titleResult = await prepareTitleExecutor({ knowledgePieceContent }).asPromise({
10584
+ isCrashedOnError: true,
10585
+ });
10495
10586
  const { title: titleRaw = 'Untitled' } = titleResult.outputParameters;
10496
10587
  title = spaceTrim(titleRaw) /* <- TODO: Maybe do in pipeline */;
10497
10588
  name = titleToName(title);
10498
10589
  // --- Keywords
10499
- const keywordsResult = await prepareKeywordsExecutor({ knowledgePieceContent }).asPromise();
10590
+ const keywordsResult = await prepareKeywordsExecutor({ knowledgePieceContent }).asPromise({
10591
+ isCrashedOnError: true,
10592
+ });
10500
10593
  const { keywords: keywordsRaw = '' } = keywordsResult.outputParameters;
10501
10594
  keywords = (keywordsRaw || '')
10502
10595
  .split(',')
@@ -13163,31 +13256,23 @@ function extractBlock(markdown) {
13163
13256
  return content;
13164
13257
  }
13165
13258
 
13259
+ /**
13260
+ * @private internal for `preserve`
13261
+ */
13262
+ const _preserved = [];
13166
13263
  /**
13167
13264
  * Does nothing, but preserves the function in the bundle
13168
13265
  * Compiler is tricked into thinking the function is used
13169
13266
  *
13170
13267
  * @param value any function to preserve
13171
13268
  * @returns nothing
13172
- * @private internal function of `JavascriptExecutionTools` and `JavascriptEvalExecutionTools`
13173
- */
13174
- function preserve(func) {
13175
- // Note: NOT calling the function
13176
- (async () => {
13177
- // TODO: [💩] Change to `await forEver` or `forTime(Infinity)`
13178
- await forTime(100000000);
13179
- // [1]
13180
- try {
13181
- await func();
13182
- }
13183
- finally {
13184
- // do nothing
13185
- }
13186
- })();
13269
+ * @private within the repository
13270
+ */
13271
+ function $preserve(...value) {
13272
+ _preserved.push(...value);
13187
13273
  }
13188
13274
  /**
13189
- * TODO: Probably remove in favour of `keepImported`
13190
- * TODO: [1] This maybe does memory leak
13275
+ * Note: [💞] Ignore a discrepancy between file name and entity name
13191
13276
  */
13192
13277
 
13193
13278
  // Note: [💎]
@@ -13215,25 +13300,25 @@ class JavascriptEvalExecutionTools {
13215
13300
  // Note: [💎]
13216
13301
  // Note: Using direct eval, following variables are in same scope as eval call so they are accessible from inside the evaluated script:
13217
13302
  const spaceTrim$1 = (_) => spaceTrim(_);
13218
- preserve(spaceTrim$1);
13303
+ $preserve(spaceTrim$1);
13219
13304
  const removeQuotes$1 = removeQuotes;
13220
- preserve(removeQuotes$1);
13305
+ $preserve(removeQuotes$1);
13221
13306
  const unwrapResult$1 = unwrapResult;
13222
- preserve(unwrapResult$1);
13307
+ $preserve(unwrapResult$1);
13223
13308
  const trimEndOfCodeBlock$1 = trimEndOfCodeBlock;
13224
- preserve(trimEndOfCodeBlock$1);
13309
+ $preserve(trimEndOfCodeBlock$1);
13225
13310
  const trimCodeBlock$1 = trimCodeBlock;
13226
- preserve(trimCodeBlock$1);
13311
+ $preserve(trimCodeBlock$1);
13227
13312
  // TODO: DRY [🍯]
13228
13313
  const trim = (str) => str.trim();
13229
- preserve(trim);
13314
+ $preserve(trim);
13230
13315
  // TODO: DRY [🍯]
13231
13316
  const reverse = (str) => str.split('').reverse().join('');
13232
- preserve(reverse);
13317
+ $preserve(reverse);
13233
13318
  const removeEmojis$1 = removeEmojis;
13234
- preserve(removeEmojis$1);
13319
+ $preserve(removeEmojis$1);
13235
13320
  const prettifyMarkdown$1 = prettifyMarkdown;
13236
- preserve(prettifyMarkdown$1);
13321
+ $preserve(prettifyMarkdown$1);
13237
13322
  //-------[n12:]---
13238
13323
  const capitalize$1 = capitalize;
13239
13324
  const decapitalize$1 = decapitalize;
@@ -13249,18 +13334,18 @@ class JavascriptEvalExecutionTools {
13249
13334
  // TODO: DRY [🍯]
13250
13335
  Array.from(parseKeywordsFromString(input)).join(', '); /* <- TODO: [🧠] What is the best format comma list, bullet list,...? */
13251
13336
  const normalizeTo_SCREAMING_CASE$1 = normalizeTo_SCREAMING_CASE;
13252
- preserve(capitalize$1);
13253
- preserve(decapitalize$1);
13254
- preserve(nameToUriPart$1);
13255
- preserve(nameToUriParts$1);
13256
- preserve(removeDiacritics$1);
13257
- preserve(normalizeWhitespaces$1);
13258
- preserve(normalizeToKebabCase$1);
13259
- preserve(normalizeTo_camelCase$1);
13260
- preserve(normalizeTo_snake_case$1);
13261
- preserve(normalizeTo_PascalCase$1);
13262
- preserve(parseKeywords);
13263
- preserve(normalizeTo_SCREAMING_CASE$1);
13337
+ $preserve(capitalize$1);
13338
+ $preserve(decapitalize$1);
13339
+ $preserve(nameToUriPart$1);
13340
+ $preserve(nameToUriParts$1);
13341
+ $preserve(removeDiacritics$1);
13342
+ $preserve(normalizeWhitespaces$1);
13343
+ $preserve(normalizeToKebabCase$1);
13344
+ $preserve(normalizeTo_camelCase$1);
13345
+ $preserve(normalizeTo_snake_case$1);
13346
+ $preserve(normalizeTo_PascalCase$1);
13347
+ $preserve(parseKeywords);
13348
+ $preserve(normalizeTo_SCREAMING_CASE$1);
13264
13349
  //-------[/n12]---
13265
13350
  if (!script.includes('return')) {
13266
13351
  script = `return ${script}`;
@@ -17309,7 +17394,7 @@ class Wizard {
17309
17394
  // ▶ Create executor - the function that will execute the Pipeline
17310
17395
  const pipelineExecutor = createPipelineExecutor({ pipeline, tools });
17311
17396
  // 🚀▶ Execute the Pipeline
17312
- const result = await pipelineExecutor(inputParameters).asPromise();
17397
+ const result = await pipelineExecutor(inputParameters).asPromise({ isCrashedOnError: true });
17313
17398
  const { outputParameters } = result;
17314
17399
  const outputParametersLength = Object.keys(outputParameters).length;
17315
17400
  let resultString;