@promptbook/node 0.103.0-55 → 0.103.0-66

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 (42) hide show
  1. package/esm/index.es.js +137 -85
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/components.index.d.ts +2 -2
  4. package/esm/typings/src/_packages/core.index.d.ts +6 -8
  5. package/esm/typings/src/_packages/types.index.d.ts +7 -1
  6. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -1
  7. package/esm/typings/src/book-2.0/agent-source/createCommitmentRegex.d.ts +1 -1
  8. package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.d.ts +3 -0
  9. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +6 -0
  10. package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +5 -0
  11. package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentIntegration.d.ts +52 -0
  12. package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentSeamlessIntegration.d.ts +14 -0
  13. package/esm/typings/src/book-components/icons/SendIcon.d.ts +3 -0
  14. package/esm/typings/src/commitments/CLOSED/CLOSED.d.ts +4 -0
  15. package/esm/typings/src/commitments/CLOSED/CLOSED.test.d.ts +4 -0
  16. package/esm/typings/src/commitments/META_COLOR/META_COLOR.d.ts +6 -0
  17. package/esm/typings/src/commitments/META_FONT/META_FONT.d.ts +42 -0
  18. package/esm/typings/src/commitments/USE/USE.d.ts +53 -0
  19. package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +42 -0
  20. package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.test.d.ts +1 -0
  21. package/esm/typings/src/commitments/{IMPORTANT/IMPORTANT.d.ts → USE_MCP/USE_MCP.d.ts} +16 -5
  22. package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +38 -0
  23. package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +6 -0
  24. package/esm/typings/src/commitments/index.d.ts +93 -1
  25. package/esm/typings/src/llm-providers/agent/Agent.d.ts +3 -1
  26. package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +1 -1
  27. package/esm/typings/src/playground/playground.d.ts +3 -0
  28. package/esm/typings/src/types/typeAliases.d.ts +6 -0
  29. package/esm/typings/src/utils/color/Color.d.ts +9 -1
  30. package/esm/typings/src/utils/color/css-colors.d.ts +1 -0
  31. package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +6 -0
  32. package/esm/typings/src/utils/random/CzechNamePool.d.ts +7 -0
  33. package/esm/typings/src/utils/random/EnglishNamePool.d.ts +7 -0
  34. package/esm/typings/src/utils/random/NamePool.d.ts +17 -0
  35. package/esm/typings/src/utils/random/getNamePool.d.ts +10 -0
  36. package/esm/typings/src/version.d.ts +1 -1
  37. package/package.json +3 -3
  38. package/umd/index.umd.js +145 -93
  39. package/umd/index.umd.js.map +1 -1
  40. package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgent.d.ts +0 -29
  41. package/esm/typings/src/commitments/registry.d.ts +0 -68
  42. package/esm/typings/src/playground/playground1.d.ts +0 -2
package/umd/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('colors'), require('fs/promises'), require('path'), require('spacetrim'), require('jszip'), require('crypto'), require('rxjs'), require('waitasecond'), require('papaparse'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('crypto-js'), require('mime-types'), require('child_process'), require('dotenv')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', 'colors', 'fs/promises', 'path', 'spacetrim', 'jszip', 'crypto', 'rxjs', 'waitasecond', 'papaparse', 'crypto-js/enc-hex', 'crypto-js/sha256', 'crypto-js', 'mime-types', 'child_process', 'dotenv'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-node"] = {}, global.colors, global.promises, global.path, global.spaceTrim, global.JSZip, global.crypto, global.rxjs, global.waitasecond, global.papaparse, global.hexEncoder, global.sha256, global.cryptoJs, global.mimeTypes, global.child_process, global.dotenv));
5
- })(this, (function (exports, colors, promises, path, spaceTrim, JSZip, crypto, rxjs, waitasecond, papaparse, hexEncoder, sha256, cryptoJs, mimeTypes, child_process, dotenv) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-node"] = {}, global.colors, global.promises, global.path, global.spaceTrim$1, global.JSZip, global.crypto, global.rxjs, global.waitasecond, global.papaparse, global.hexEncoder, global.sha256, global.cryptoJs, global.mimeTypes, global.child_process, global.dotenv));
5
+ })(this, (function (exports, colors, promises, path, spaceTrim$1, JSZip, crypto, rxjs, waitasecond, papaparse, hexEncoder, sha256, cryptoJs, mimeTypes, child_process, dotenv) { '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
  }
26
26
 
27
27
  var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
28
- var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
28
+ var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
29
29
  var JSZip__default = /*#__PURE__*/_interopDefaultLegacy(JSZip);
30
30
  var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
31
31
  var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
@@ -45,12 +45,23 @@
45
45
  * @generated
46
46
  * @see https://github.com/webgptorg/promptbook
47
47
  */
48
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-55';
48
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-66';
49
49
  /**
50
50
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
51
51
  * Note: [💞] Ignore a discrepancy between file name and entity name
52
52
  */
53
53
 
54
+ /**
55
+ * Trims string from all 4 sides
56
+ *
57
+ * Note: This is a re-exported function from the `spacetrim` package which is
58
+ * Developed by same author @hejny as this package
59
+ *
60
+ * @public exported from `@promptbook/utils`
61
+ * @see https://github.com/hejny/spacetrim#usage
62
+ */
63
+ const spaceTrim = spaceTrim$1.spaceTrim;
64
+
54
65
  /**
55
66
  * @private util of `@promptbook/color`
56
67
  * @de
@@ -99,6 +110,7 @@
99
110
  * @public exported from `@promptbook/color`
100
111
  */
101
112
  const CSS_COLORS = {
113
+ promptbook: '#79EAFD',
102
114
  transparent: 'rgba(0,0,0,0)',
103
115
  aliceblue: '#f0f8ff',
104
116
  antiquewhite: '#faebd7',
@@ -299,21 +311,61 @@
299
311
  * @param color
300
312
  * @returns Color object
301
313
  */
302
- static from(color) {
303
- if (color instanceof Color) {
314
+ static from(color, _isSingleValue = false) {
315
+ if (color === '') {
316
+ throw new Error(`Can not create color from empty string`);
317
+ }
318
+ else if (color instanceof Color) {
304
319
  return take(color);
305
320
  }
306
321
  else if (Color.isColor(color)) {
307
322
  return take(color);
308
323
  }
309
324
  else if (typeof color === 'string') {
310
- return Color.fromString(color);
325
+ try {
326
+ return Color.fromString(color);
327
+ }
328
+ catch (error) {
329
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
330
+ if (_isSingleValue) {
331
+ throw error;
332
+ }
333
+ const parts = color.split(/[\s+,;|]/);
334
+ if (parts.length > 0) {
335
+ return Color.from(parts[0].trim(), true);
336
+ }
337
+ else {
338
+ throw new Error(`Can not create color from given string "${color}"`);
339
+ }
340
+ }
311
341
  }
312
342
  else {
313
343
  console.error({ color });
314
344
  throw new Error(`Can not create color from given object`);
315
345
  }
316
346
  }
347
+ /**
348
+ * Creates a new Color instance from miscellaneous formats
349
+ * It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
350
+ *
351
+ * @param color
352
+ * @returns Color object
353
+ */
354
+ static fromSafe(color) {
355
+ try {
356
+ return Color.from(color);
357
+ }
358
+ catch (error) {
359
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
360
+ console.warn(spaceTrim((block) => `
361
+ Color.fromSafe error:
362
+ ${block(error.message)}
363
+
364
+ Returning default PROMPTBOOK_COLOR.
365
+ `));
366
+ return Color.fromString('promptbook');
367
+ }
368
+ }
317
369
  /**
318
370
  * Creates a new Color instance from miscellaneous string formats
319
371
  *
@@ -923,7 +975,7 @@
923
975
  *
924
976
  * @public exported from `@promptbook/core`
925
977
  */
926
- const PROMPTBOOK_COLOR = Color.fromHex('#79EAFD');
978
+ const PROMPTBOOK_COLOR = Color.fromString('promptbook');
927
979
  // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
928
980
  /**
929
981
  * Colors for syntax highlighting in the `<BookEditor/>`
@@ -1191,7 +1243,7 @@
1191
1243
  */
1192
1244
  class UnexpectedError extends Error {
1193
1245
  constructor(message) {
1194
- super(spaceTrim.spaceTrim((block) => `
1246
+ super(spaceTrim$1.spaceTrim((block) => `
1195
1247
  ${block(message)}
1196
1248
 
1197
1249
  Note: This error should not happen.
@@ -1295,7 +1347,7 @@
1295
1347
  constructor(whatWasThrown) {
1296
1348
  const tag = `[🤮]`;
1297
1349
  console.error(tag, whatWasThrown);
1298
- super(spaceTrim.spaceTrim(`
1350
+ super(spaceTrim$1.spaceTrim(`
1299
1351
  Non-Error object was thrown
1300
1352
 
1301
1353
  Note: Look for ${tag} in the console for more details
@@ -1758,7 +1810,7 @@
1758
1810
  if (!(error instanceof PipelineLogicError)) {
1759
1811
  throw error;
1760
1812
  }
1761
- console.error(spaceTrim.spaceTrim((block) => `
1813
+ console.error(spaceTrim$1.spaceTrim((block) => `
1762
1814
  Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
1763
1815
 
1764
1816
  ${block(error.message)}
@@ -1785,7 +1837,7 @@
1785
1837
  })();
1786
1838
  if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
1787
1839
  // <- Note: [🚲]
1788
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1840
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1789
1841
  Invalid promptbook URL "${pipeline.pipelineUrl}"
1790
1842
 
1791
1843
  ${block(pipelineIdentification)}
@@ -1793,7 +1845,7 @@
1793
1845
  }
1794
1846
  if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
1795
1847
  // <- Note: [🚲]
1796
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1848
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1797
1849
  Invalid Promptbook Version "${pipeline.bookVersion}"
1798
1850
 
1799
1851
  ${block(pipelineIdentification)}
@@ -1802,7 +1854,7 @@
1802
1854
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
1803
1855
  if (!Array.isArray(pipeline.parameters)) {
1804
1856
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
1805
- throw new ParseError(spaceTrim.spaceTrim((block) => `
1857
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
1806
1858
  Pipeline is valid JSON but with wrong structure
1807
1859
 
1808
1860
  \`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
@@ -1813,7 +1865,7 @@
1813
1865
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
1814
1866
  if (!Array.isArray(pipeline.tasks)) {
1815
1867
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
1816
- throw new ParseError(spaceTrim.spaceTrim((block) => `
1868
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
1817
1869
  Pipeline is valid JSON but with wrong structure
1818
1870
 
1819
1871
  \`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
@@ -1839,7 +1891,7 @@
1839
1891
  // Note: Check each parameter individually
1840
1892
  for (const parameter of pipeline.parameters) {
1841
1893
  if (parameter.isInput && parameter.isOutput) {
1842
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1894
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1843
1895
 
1844
1896
  Parameter \`{${parameter.name}}\` can not be both input and output
1845
1897
 
@@ -1850,7 +1902,7 @@
1850
1902
  if (!parameter.isInput &&
1851
1903
  !parameter.isOutput &&
1852
1904
  !pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
1853
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1905
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1854
1906
  Parameter \`{${parameter.name}}\` is created but not used
1855
1907
 
1856
1908
  You can declare {${parameter.name}} as output parameter by adding in the header:
@@ -1862,7 +1914,7 @@
1862
1914
  }
1863
1915
  // Note: Testing that parameter is either input or result of some task
1864
1916
  if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
1865
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1917
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1866
1918
  Parameter \`{${parameter.name}}\` is declared but not defined
1867
1919
 
1868
1920
  You can do one of these:
@@ -1878,14 +1930,14 @@
1878
1930
  // Note: Checking each task individually
1879
1931
  for (const task of pipeline.tasks) {
1880
1932
  if (definedParameters.has(task.resultingParameterName)) {
1881
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1933
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1882
1934
  Parameter \`{${task.resultingParameterName}}\` is defined multiple times
1883
1935
 
1884
1936
  ${block(pipelineIdentification)}
1885
1937
  `));
1886
1938
  }
1887
1939
  if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
1888
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1940
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1889
1941
  Parameter name {${task.resultingParameterName}} is reserved, please use different name
1890
1942
 
1891
1943
  ${block(pipelineIdentification)}
@@ -1895,7 +1947,7 @@
1895
1947
  if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
1896
1948
  if (!task.format &&
1897
1949
  !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
1898
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1950
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1899
1951
  Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
1900
1952
 
1901
1953
  ${block(pipelineIdentification)}
@@ -1903,7 +1955,7 @@
1903
1955
  }
1904
1956
  for (const joker of task.jokerParameterNames) {
1905
1957
  if (!task.dependentParameterNames.includes(joker)) {
1906
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1958
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1907
1959
  Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
1908
1960
 
1909
1961
  ${block(pipelineIdentification)}
@@ -1914,21 +1966,21 @@
1914
1966
  if (task.expectations) {
1915
1967
  for (const [unit, { min, max }] of Object.entries(task.expectations)) {
1916
1968
  if (min !== undefined && max !== undefined && min > max) {
1917
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1969
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1918
1970
  Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
1919
1971
 
1920
1972
  ${block(pipelineIdentification)}
1921
1973
  `));
1922
1974
  }
1923
1975
  if (min !== undefined && min < 0) {
1924
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1976
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1925
1977
  Min expectation of ${unit} must be zero or positive
1926
1978
 
1927
1979
  ${block(pipelineIdentification)}
1928
1980
  `));
1929
1981
  }
1930
1982
  if (max !== undefined && max <= 0) {
1931
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1983
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1932
1984
  Max expectation of ${unit} must be positive
1933
1985
 
1934
1986
  ${block(pipelineIdentification)}
@@ -1950,7 +2002,7 @@
1950
2002
  while (unresovedTasks.length > 0) {
1951
2003
  if (loopLimit-- < 0) {
1952
2004
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
1953
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
2005
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
1954
2006
  Loop limit reached during detection of circular dependencies in \`validatePipeline\`
1955
2007
 
1956
2008
  ${block(pipelineIdentification)}
@@ -1960,7 +2012,7 @@
1960
2012
  if (currentlyResovedTasks.length === 0) {
1961
2013
  throw new PipelineLogicError(
1962
2014
  // TODO: [🐎] DRY
1963
- spaceTrim.spaceTrim((block) => `
2015
+ spaceTrim$1.spaceTrim((block) => `
1964
2016
 
1965
2017
  Can not resolve some parameters:
1966
2018
  Either you are using a parameter that is not defined, or there are some circular dependencies.
@@ -2442,7 +2494,7 @@
2442
2494
  for (const pipeline of pipelines) {
2443
2495
  // TODO: [👠] DRY
2444
2496
  if (pipeline.pipelineUrl === undefined) {
2445
- throw new PipelineUrlError(spaceTrim.spaceTrim(`
2497
+ throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
2446
2498
  Pipeline with name "${pipeline.title}" does not have defined URL
2447
2499
 
2448
2500
  File:
@@ -2464,7 +2516,7 @@
2464
2516
  pipelineJsonToString(unpreparePipeline(pipeline)) !==
2465
2517
  pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
2466
2518
  const existing = this.collection.get(pipeline.pipelineUrl);
2467
- throw new PipelineUrlError(spaceTrim.spaceTrim(`
2519
+ throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
2468
2520
  Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
2469
2521
 
2470
2522
  Conflicting files:
@@ -2496,13 +2548,13 @@
2496
2548
  const pipeline = this.collection.get(url);
2497
2549
  if (!pipeline) {
2498
2550
  if (this.listPipelines().length === 0) {
2499
- throw new NotFoundError(spaceTrim.spaceTrim(`
2551
+ throw new NotFoundError(spaceTrim$1.spaceTrim(`
2500
2552
  Pipeline with url "${url}" not found
2501
2553
 
2502
2554
  No pipelines available
2503
2555
  `));
2504
2556
  }
2505
- throw new NotFoundError(spaceTrim.spaceTrim((block) => `
2557
+ throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
2506
2558
  Pipeline with url "${url}" not found
2507
2559
 
2508
2560
  Available pipelines:
@@ -2543,7 +2595,7 @@
2543
2595
  */
2544
2596
  class MissingToolsError extends Error {
2545
2597
  constructor(message) {
2546
- super(spaceTrim.spaceTrim((block) => `
2598
+ super(spaceTrim$1.spaceTrim((block) => `
2547
2599
  ${block(message)}
2548
2600
 
2549
2601
  Note: You have probably forgot to provide some tools for pipeline execution or preparation
@@ -2741,7 +2793,7 @@
2741
2793
  */
2742
2794
  class NotYetImplementedError extends Error {
2743
2795
  constructor(message) {
2744
- super(spaceTrim.spaceTrim((block) => `
2796
+ super(spaceTrim$1.spaceTrim((block) => `
2745
2797
  ${block(message)}
2746
2798
 
2747
2799
  Note: This feature is not implemented yet but it will be soon.
@@ -2980,11 +3032,11 @@
2980
3032
  throw deserializeError(errors[0]);
2981
3033
  }
2982
3034
  else {
2983
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
3035
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
2984
3036
  Multiple errors occurred during Promptbook execution
2985
3037
 
2986
3038
  ${block(errors
2987
- .map(({ name, stack, message }, index) => spaceTrim.spaceTrim((block) => `
3039
+ .map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
2988
3040
  ${name} ${index + 1}:
2989
3041
  ${block(stack || message)}
2990
3042
  `))
@@ -3438,7 +3490,7 @@
3438
3490
  }
3439
3491
  catch (error) {
3440
3492
  assertsError(error);
3441
- throw new ParseError(spaceTrim.spaceTrim((block) => `
3493
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
3442
3494
  Can not extract variables from the script
3443
3495
  ${block(error.stack || error.message)}
3444
3496
 
@@ -4801,7 +4853,7 @@
4801
4853
  }
4802
4854
  catch (error) {
4803
4855
  keepUnused(error);
4804
- throw new ExpectError(spaceTrim.spaceTrim((block) => `
4856
+ throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
4805
4857
  Expected valid JSON string
4806
4858
 
4807
4859
  The expected JSON text:
@@ -4864,7 +4916,7 @@
4864
4916
  const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
4865
4917
  // TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
4866
4918
  if (isJokerAttempt && !jokerParameterName) {
4867
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
4919
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
4868
4920
  Joker not found in attempt ${attemptIndex}
4869
4921
 
4870
4922
  ${block(pipelineIdentification)}
@@ -4875,7 +4927,7 @@
4875
4927
  $ongoingTaskResult.$expectError = null;
4876
4928
  if (isJokerAttempt) {
4877
4929
  if (parameters[jokerParameterName] === undefined) {
4878
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
4930
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
4879
4931
  Joker parameter {${jokerParameterName}} not defined
4880
4932
 
4881
4933
  ${block(pipelineIdentification)}
@@ -4933,7 +4985,7 @@
4933
4985
  $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
4934
4986
  break variant;
4935
4987
  case 'EMBEDDING':
4936
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
4988
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
4937
4989
  Embedding model can not be used in pipeline
4938
4990
 
4939
4991
  This should be catched during parsing
@@ -4944,7 +4996,7 @@
4944
4996
  break variant;
4945
4997
  // <- case [🤖]:
4946
4998
  default:
4947
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
4999
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
4948
5000
  Unknown model variant "${task.modelRequirements.modelVariant}"
4949
5001
 
4950
5002
  ${block(pipelineIdentification)}
@@ -4955,14 +5007,14 @@
4955
5007
  break;
4956
5008
  case 'SCRIPT_TASK':
4957
5009
  if (arrayableToArray(tools.script).length === 0) {
4958
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
5010
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
4959
5011
  No script execution tools are available
4960
5012
 
4961
5013
  ${block(pipelineIdentification)}
4962
5014
  `));
4963
5015
  }
4964
5016
  if (!task.contentLanguage) {
4965
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
5017
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
4966
5018
  Script language is not defined for SCRIPT TASK "${task.name}"
4967
5019
 
4968
5020
  ${block(pipelineIdentification)}
@@ -4993,7 +5045,7 @@
4993
5045
  throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
4994
5046
  }
4995
5047
  else {
4996
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
5048
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
4997
5049
  Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
4998
5050
 
4999
5051
  ${block(pipelineIdentification)}
@@ -5007,7 +5059,7 @@
5007
5059
  break taskType;
5008
5060
  case 'DIALOG_TASK':
5009
5061
  if (tools.userInterface === undefined) {
5010
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
5062
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
5011
5063
  User interface tools are not available
5012
5064
 
5013
5065
  ${block(pipelineIdentification)}
@@ -5025,7 +5077,7 @@
5025
5077
  break taskType;
5026
5078
  // <- case: [🅱]
5027
5079
  default:
5028
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
5080
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
5029
5081
  Unknown execution type "${task.taskType}"
5030
5082
 
5031
5083
  ${block(pipelineIdentification)}
@@ -5123,7 +5175,7 @@
5123
5175
  if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
5124
5176
  // Note: Create a summary of all failures
5125
5177
  const failuresSummary = $ongoingTaskResult.$failedResults
5126
- .map((failure) => spaceTrim.spaceTrim((block) => {
5178
+ .map((failure) => spaceTrim$1.spaceTrim((block) => {
5127
5179
  var _a, _b;
5128
5180
  return `
5129
5181
  Attempt ${failure.attemptIndex + 1}:
@@ -5133,14 +5185,14 @@
5133
5185
  Result:
5134
5186
  ${block(failure.result === null
5135
5187
  ? 'null'
5136
- : spaceTrim.spaceTrim(failure.result)
5188
+ : spaceTrim$1.spaceTrim(failure.result)
5137
5189
  .split('\n')
5138
5190
  .map((line) => `> ${line}`)
5139
5191
  .join('\n'))}
5140
5192
  `;
5141
5193
  }))
5142
5194
  .join('\n\n---\n\n');
5143
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
5195
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
5144
5196
  var _a;
5145
5197
  return `
5146
5198
  LLM execution failed ${maxExecutionAttempts}x
@@ -5160,7 +5212,7 @@
5160
5212
  }
5161
5213
  }
5162
5214
  if ($ongoingTaskResult.$resultString === null) {
5163
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
5215
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
5164
5216
  Something went wrong and prompt result is null
5165
5217
 
5166
5218
  ${block(pipelineIdentification)}
@@ -5466,7 +5518,7 @@
5466
5518
  // Note: Doublecheck that ALL reserved parameters are defined:
5467
5519
  for (const parameterName of RESERVED_PARAMETER_NAMES) {
5468
5520
  if (reservedParameters[parameterName] === undefined) {
5469
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
5521
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
5470
5522
  Reserved parameter {${parameterName}} is not defined
5471
5523
 
5472
5524
  ${block(pipelineIdentification)}
@@ -5492,7 +5544,7 @@
5492
5544
  const dependentParameterNames = new Set(currentTask.dependentParameterNames);
5493
5545
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
5494
5546
  if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
5495
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
5547
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
5496
5548
  Dependent parameters are not consistent with used parameters:
5497
5549
 
5498
5550
  Dependent parameters:
@@ -5536,7 +5588,7 @@
5536
5588
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
5537
5589
  // Houston, we have a problem
5538
5590
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
5539
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
5591
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
5540
5592
  Parameter \`{${parameterName}}\` is NOT defined
5541
5593
  BUT used in task "${currentTask.title || currentTask.name}"
5542
5594
 
@@ -5605,7 +5657,7 @@
5605
5657
  for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
5606
5658
  if (parametersToPass[parameter.name] === undefined) {
5607
5659
  // [4]
5608
- $warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
5660
+ $warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
5609
5661
  Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
5610
5662
 
5611
5663
  Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
@@ -5713,7 +5765,7 @@
5713
5765
  for (const parameterName of Object.keys(inputParameters)) {
5714
5766
  const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
5715
5767
  if (parameter === undefined) {
5716
- warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
5768
+ warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
5717
5769
  Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
5718
5770
 
5719
5771
  ${block(pipelineIdentification)}
@@ -5728,7 +5780,7 @@
5728
5780
  // TODO: [🧠] This should be also non-critical error
5729
5781
  return exportJson({
5730
5782
  name: 'pipelineExecutorResult',
5731
- message: spaceTrim.spaceTrim((block) => `
5783
+ message: spaceTrim$1.spaceTrim((block) => `
5732
5784
  Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
5733
5785
 
5734
5786
  ${block(pipelineIdentification)}
@@ -5737,7 +5789,7 @@
5737
5789
  value: {
5738
5790
  isSuccessful: false,
5739
5791
  errors: [
5740
- new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
5792
+ new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
5741
5793
  Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
5742
5794
 
5743
5795
  ${block(pipelineIdentification)}
@@ -5764,7 +5816,7 @@
5764
5816
  while (unresovedTasks.length > 0) {
5765
5817
  if (loopLimit-- < 0) {
5766
5818
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
5767
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
5819
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
5768
5820
  Loop limit reached during resolving parameters pipeline execution
5769
5821
 
5770
5822
  ${block(pipelineIdentification)}
@@ -5774,7 +5826,7 @@
5774
5826
  if (!currentTask && resolving.length === 0) {
5775
5827
  throw new UnexpectedError(
5776
5828
  // TODO: [🐎] DRY
5777
- spaceTrim.spaceTrim((block) => `
5829
+ spaceTrim$1.spaceTrim((block) => `
5778
5830
  Can not resolve some parameters:
5779
5831
 
5780
5832
  ${block(pipelineIdentification)}
@@ -5814,7 +5866,7 @@
5814
5866
  tools,
5815
5867
  onProgress(newOngoingResult) {
5816
5868
  if (isReturned) {
5817
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
5869
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
5818
5870
  Can not call \`onProgress\` after pipeline execution is finished
5819
5871
 
5820
5872
  ${block(pipelineIdentification)}
@@ -5831,7 +5883,7 @@
5831
5883
  },
5832
5884
  logLlmCall,
5833
5885
  $executionReport: executionReport,
5834
- pipelineIdentification: spaceTrim.spaceTrim((block) => `
5886
+ pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
5835
5887
  ${block(pipelineIdentification)}
5836
5888
  Task name: ${currentTask.name}
5837
5889
  Task title: ${currentTask.title}
@@ -5940,7 +5992,7 @@
5940
5992
  preparedPipeline = pipeline;
5941
5993
  }
5942
5994
  else if (isNotPreparedWarningSuppressed !== true) {
5943
- console.warn(spaceTrim.spaceTrim((block) => `
5995
+ console.warn(spaceTrim$1.spaceTrim((block) => `
5944
5996
  Pipeline is not prepared
5945
5997
 
5946
5998
  ${block(pipelineIdentification)}
@@ -5965,7 +6017,7 @@
5965
6017
  tools,
5966
6018
  onProgress,
5967
6019
  logLlmCall,
5968
- pipelineIdentification: spaceTrim.spaceTrim((block) => `
6020
+ pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
5969
6021
  ${block(pipelineIdentification)}
5970
6022
  ${runCount === 1 ? '' : `Run #${runCount}`}
5971
6023
  `),
@@ -7032,7 +7084,7 @@
7032
7084
  if (task.taskType === 'PROMPT_TASK' &&
7033
7085
  knowledgePiecesCount > 0 &&
7034
7086
  !dependentParameterNames.includes('knowledge')) {
7035
- preparedContent = spaceTrim.spaceTrim(`
7087
+ preparedContent = spaceTrim$1.spaceTrim(`
7036
7088
  {content}
7037
7089
 
7038
7090
  ## Knowledge
@@ -9549,7 +9601,7 @@
9549
9601
  function getParserForCommand(command) {
9550
9602
  const commandParser = COMMANDS.find((commandParser) => commandParser.name === command.type);
9551
9603
  if (commandParser === undefined) {
9552
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
9604
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
9553
9605
  Command ${command.type} parser is not found
9554
9606
 
9555
9607
  ${block(JSON.stringify(command, null, 4)
@@ -9625,7 +9677,7 @@
9625
9677
  .map(removeMarkdownFormatting)
9626
9678
  .map((item) => item.trim());
9627
9679
  if (items.length === 0 || items[0] === '') {
9628
- throw new ParseError(spaceTrim.spaceTrim((block) => `
9680
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
9629
9681
  Malformed command:
9630
9682
  - ${raw}
9631
9683
 
@@ -9661,7 +9713,7 @@
9661
9713
  return command;
9662
9714
  }
9663
9715
  }
9664
- throw new ParseError(spaceTrim.spaceTrim((block) => `
9716
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
9665
9717
  Malformed or unknown command:
9666
9718
  - ${raw}
9667
9719
 
@@ -9712,7 +9764,7 @@
9712
9764
  if (!(error instanceof ParseError)) {
9713
9765
  throw error;
9714
9766
  }
9715
- throw new ParseError(spaceTrim.spaceTrim((block) => `
9767
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
9716
9768
  Invalid ${commandName} command:
9717
9769
 
9718
9770
  Your command:
@@ -10028,7 +10080,7 @@
10028
10080
  * @public exported from `@promptbook/markdown-utils`
10029
10081
  */
10030
10082
  function removeMarkdownComments(content) {
10031
- return spaceTrim.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
10083
+ return spaceTrim$1.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
10032
10084
  }
10033
10085
 
10034
10086
  /**
@@ -10344,7 +10396,7 @@
10344
10396
  if (pipelineString.startsWith('#!')) {
10345
10397
  const [shebangLine, ...restLines] = pipelineString.split('\n');
10346
10398
  if (!(shebangLine || '').includes('ptbk')) {
10347
- throw new ParseError(spaceTrim.spaceTrim((block) => `
10399
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
10348
10400
  It seems that you try to parse a book file which has non-standard shebang line for book files:
10349
10401
  Shebang line must contain 'ptbk'
10350
10402
 
@@ -10360,7 +10412,7 @@
10360
10412
  pipelineString = validatePipelineString(restLines.join('\n'));
10361
10413
  }
10362
10414
  pipelineString = removeMarkdownComments(pipelineString);
10363
- pipelineString = spaceTrim.spaceTrim(pipelineString);
10415
+ pipelineString = spaceTrim$1.spaceTrim(pipelineString);
10364
10416
  // <- TODO: [😧] `spaceTrim` should preserve discriminated type *(or at lease `PipelineString`)*
10365
10417
  pipelineString = deflatePipeline(pipelineString);
10366
10418
  // ==============
@@ -10372,7 +10424,7 @@
10372
10424
  // ==============
10373
10425
  // Note: 1️⃣◽4️⃣ Check markdown structure
10374
10426
  if (pipelineHead === undefined) {
10375
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
10427
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
10376
10428
  Pipeline head is not defined
10377
10429
 
10378
10430
  ${block(getPipelineIdentification())}
@@ -10381,7 +10433,7 @@
10381
10433
  `));
10382
10434
  }
10383
10435
  if (pipelineHead.level !== 1) {
10384
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
10436
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
10385
10437
  Pipeline head is not h1
10386
10438
 
10387
10439
  ${block(getPipelineIdentification())}
@@ -10390,7 +10442,7 @@
10390
10442
  `));
10391
10443
  }
10392
10444
  if (!pipelineSections.every((section) => section.level === 2)) {
10393
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
10445
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
10394
10446
  Not every pipeline section is h2
10395
10447
 
10396
10448
  ${block(getPipelineIdentification())}
@@ -10403,7 +10455,7 @@
10403
10455
  const defineParam = (parameterCommand) => {
10404
10456
  const { parameterName, parameterDescription, isInput, isOutput } = parameterCommand;
10405
10457
  if (RESERVED_PARAMETER_NAMES.includes(parameterName)) {
10406
- throw new ParseError(spaceTrim.spaceTrim((block) => `
10458
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
10407
10459
  Parameter name {${parameterName}} is reserved and cannot be used as resulting parameter name
10408
10460
 
10409
10461
  ${block(getPipelineIdentification())}
@@ -10414,7 +10466,7 @@
10414
10466
  existingParameter.description &&
10415
10467
  existingParameter.description !== parameterDescription &&
10416
10468
  parameterDescription) {
10417
- throw new ParseError(spaceTrim.spaceTrim((block) => `
10469
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
10418
10470
  Parameter \`{${parameterName}}\` is defined multiple times with different description:
10419
10471
 
10420
10472
  ${block(getPipelineIdentification())}
@@ -10452,7 +10504,7 @@
10452
10504
  description = description.split(/^>.*$/gm).join('');
10453
10505
  //Note: Remove lists and return statement - TODO: [🎾] Make util (exported from `@promptbool/utils`)
10454
10506
  description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
10455
- description = spaceTrim.spaceTrim(description);
10507
+ description = spaceTrim$1.spaceTrim(description);
10456
10508
  if (description === '') {
10457
10509
  description = undefined;
10458
10510
  }
@@ -10463,7 +10515,7 @@
10463
10515
  const command = parseCommand(listItem, 'PIPELINE_HEAD');
10464
10516
  const commandParser = getParserForCommand(command);
10465
10517
  if (commandParser.isUsedInPipelineHead !== true /* <- Note: [🦦][4] */) {
10466
- throw new ParseError(spaceTrim.spaceTrim((block) => `
10518
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
10467
10519
  Command \`${command.type}\` is not allowed in the head of the pipeline ONLY at the pipeline task
10468
10520
 
10469
10521
  ${block(getPipelineIdentification())}
@@ -10477,7 +10529,7 @@
10477
10529
  if (!(error instanceof ParseError)) {
10478
10530
  throw error;
10479
10531
  }
10480
- throw new ParseError(spaceTrim.spaceTrim((block) => `
10532
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
10481
10533
  Command ${command.type} failed to apply to the pipeline
10482
10534
 
10483
10535
  The error:
@@ -10530,7 +10582,7 @@
10530
10582
  description = description.split(/^>.*$/gm).join('');
10531
10583
  //Note: Remove lists and return statement - TODO: [🎾]
10532
10584
  description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
10533
- description = spaceTrim.spaceTrim(description);
10585
+ description = spaceTrim$1.spaceTrim(description);
10534
10586
  if (description === '') {
10535
10587
  description = undefined;
10536
10588
  }
@@ -10564,7 +10616,7 @@
10564
10616
  for (const { listItem, command } of commands) {
10565
10617
  const commandParser = getParserForCommand(command);
10566
10618
  if (commandParser.isUsedInPipelineTask !== true /* <- Note: [🦦][4] */) {
10567
- throw new ParseError(spaceTrim.spaceTrim((block) => `
10619
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
10568
10620
  Command \`${command.type}\` is not allowed in the task of the promptbook ONLY at the pipeline head
10569
10621
 
10570
10622
  ${block(getPipelineIdentification())}
@@ -10579,7 +10631,7 @@
10579
10631
  if (!(error instanceof ParseError)) {
10580
10632
  throw error;
10581
10633
  }
10582
- throw new ParseError(spaceTrim.spaceTrim((block) => `
10634
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
10583
10635
  Command \`${command.type}\` failed to apply to the task
10584
10636
 
10585
10637
  The error:
@@ -10610,14 +10662,14 @@
10610
10662
  // TODO: [🍧] Should be done in SECTION command
10611
10663
  if ($taskJson.taskType === 'SCRIPT_TASK') {
10612
10664
  if (!language) {
10613
- throw new ParseError(spaceTrim.spaceTrim((block) => `
10665
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
10614
10666
  You must specify the language of the script in the \`SCRIPT\` task
10615
10667
 
10616
10668
  ${block(getPipelineIdentification())}
10617
10669
  `));
10618
10670
  }
10619
10671
  if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
10620
- throw new ParseError(spaceTrim.spaceTrim((block) => `
10672
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
10621
10673
  Script language ${language} is not supported.
10622
10674
 
10623
10675
  Supported languages are:
@@ -10913,11 +10965,11 @@
10913
10965
  console.warn(`Command "${humanReadableCommand}" exited with code ${code}`);
10914
10966
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
10915
10967
  }
10916
- resolve(spaceTrim.spaceTrim(output.join('\n')));
10968
+ resolve(spaceTrim$1.spaceTrim(output.join('\n')));
10917
10969
  }
10918
10970
  }
10919
10971
  else {
10920
- resolve(spaceTrim.spaceTrim(output.join('\n')));
10972
+ resolve(spaceTrim$1.spaceTrim(output.join('\n')));
10921
10973
  }
10922
10974
  };
10923
10975
  commandProcess.on('close', finishWithCode);
@@ -10935,7 +10987,7 @@
10935
10987
  console.warn(error);
10936
10988
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
10937
10989
  }
10938
- resolve(spaceTrim.spaceTrim(output.join('\n')));
10990
+ resolve(spaceTrim$1.spaceTrim(output.join('\n')));
10939
10991
  }
10940
10992
  });
10941
10993
  }
@@ -11750,7 +11802,7 @@
11750
11802
  let trimmedText = text;
11751
11803
  // Remove leading and trailing spaces and newlines
11752
11804
  if (isTrimmed) {
11753
- trimmedText = spaceTrim.spaceTrim(trimmedText);
11805
+ trimmedText = spaceTrim$1.spaceTrim(trimmedText);
11754
11806
  }
11755
11807
  let processedText = trimmedText;
11756
11808
  if (isIntroduceSentenceRemoved) {
@@ -11759,7 +11811,7 @@
11759
11811
  // Remove the introduce sentence and quotes by replacing it with an empty string
11760
11812
  processedText = processedText.replace(introduceSentenceRegex, '');
11761
11813
  }
11762
- processedText = spaceTrim.spaceTrim(processedText);
11814
+ processedText = spaceTrim$1.spaceTrim(processedText);
11763
11815
  }
11764
11816
  if (processedText.length < 3) {
11765
11817
  return trimmedText;
@@ -11866,13 +11918,13 @@
11866
11918
  * @public exported from `@promptbook/markdown-utils`
11867
11919
  */
11868
11920
  function trimCodeBlock(value) {
11869
- value = spaceTrim.spaceTrim(value);
11921
+ value = spaceTrim$1.spaceTrim(value);
11870
11922
  if (!/^```[a-z]*(.*)```$/is.test(value)) {
11871
11923
  return value;
11872
11924
  }
11873
11925
  value = value.replace(/^```[a-z]*/i, '');
11874
11926
  value = value.replace(/```$/i, '');
11875
- value = spaceTrim.spaceTrim(value);
11927
+ value = spaceTrim$1.spaceTrim(value);
11876
11928
  return value;
11877
11929
  }
11878
11930
 
@@ -11885,9 +11937,9 @@
11885
11937
  * @public exported from `@promptbook/markdown-utils`
11886
11938
  */
11887
11939
  function trimEndOfCodeBlock(value) {
11888
- value = spaceTrim.spaceTrim(value);
11940
+ value = spaceTrim$1.spaceTrim(value);
11889
11941
  value = value.replace(/```$/g, '');
11890
- value = spaceTrim.spaceTrim(value);
11942
+ value = spaceTrim$1.spaceTrim(value);
11891
11943
  return value;
11892
11944
  }
11893
11945