@promptbook/markdown-utils 0.112.0-13 → 0.112.0-15

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 (31) hide show
  1. package/esm/index.es.js +67 -67
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/src/cli/cli-commands/coder/{find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags.d.ts} +1 -1
  4. package/esm/src/cli/cli-commands/coder.d.ts +1 -1
  5. package/esm/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +1 -1
  6. package/esm/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  7. package/esm/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
  8. package/esm/src/llm-providers/google/google-models.d.ts +1 -1
  9. package/esm/src/llm-providers/openai/openai-models.d.ts +1 -1
  10. package/esm/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -2
  11. package/esm/src/scrapers/document/DocumentScraper.d.ts +1 -2
  12. package/esm/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -2
  13. package/esm/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
  14. package/esm/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -2
  15. package/esm/src/version.d.ts +1 -1
  16. package/package.json +1 -1
  17. package/umd/index.umd.js +105 -106
  18. package/umd/index.umd.js.map +1 -1
  19. package/umd/src/cli/cli-commands/coder/{find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags.d.ts} +1 -1
  20. package/umd/src/cli/cli-commands/coder.d.ts +1 -1
  21. package/umd/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +1 -1
  22. package/umd/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  23. package/umd/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
  24. package/umd/src/llm-providers/google/google-models.d.ts +1 -1
  25. package/umd/src/llm-providers/openai/openai-models.d.ts +1 -1
  26. package/umd/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -2
  27. package/umd/src/scrapers/document/DocumentScraper.d.ts +1 -2
  28. package/umd/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -2
  29. package/umd/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
  30. package/umd/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -2
  31. package/umd/src/version.d.ts +1 -1
package/esm/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import spaceTrim$1, { spaceTrim as spaceTrim$2 } from 'spacetrim';
1
+ import { spaceTrim as spaceTrim$1 } from 'spacetrim';
2
2
  import { randomBytes } from 'crypto';
3
3
  import { Subject } from 'rxjs';
4
4
  import { forTime } from 'waitasecond';
@@ -23,7 +23,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
23
23
  * @generated
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-13';
26
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-15';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
29
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -181,7 +181,7 @@ function extractBlock(markdown) {
181
181
  * @public exported from `@promptbook/utils`
182
182
  * @see https://github.com/hejny/spacetrim#usage
183
183
  */
184
- const spaceTrim = spaceTrim$2;
184
+ const spaceTrim = spaceTrim$1;
185
185
 
186
186
  /**
187
187
  * @private util of `@promptbook/color`
@@ -1351,7 +1351,7 @@ function getErrorReportUrl(error) {
1351
1351
  */
1352
1352
  class UnexpectedError extends Error {
1353
1353
  constructor(message) {
1354
- super(spaceTrim$2((block) => `
1354
+ super(spaceTrim$1((block) => `
1355
1355
  ${block(message)}
1356
1356
 
1357
1357
  Note: This error should not happen.
@@ -1377,7 +1377,7 @@ class WrappedError extends Error {
1377
1377
  constructor(whatWasThrown) {
1378
1378
  const tag = `[🤮]`;
1379
1379
  console.error(tag, whatWasThrown);
1380
- super(spaceTrim$2(`
1380
+ super(spaceTrim$1(`
1381
1381
  Non-Error object was thrown
1382
1382
 
1383
1383
  Note: Look for ${tag} in the console for more details
@@ -2199,7 +2199,7 @@ function validatePipeline(pipeline) {
2199
2199
  if (!(error instanceof PipelineLogicError)) {
2200
2200
  throw error;
2201
2201
  }
2202
- console.error(spaceTrim$2((block) => `
2202
+ console.error(spaceTrim$1((block) => `
2203
2203
  Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
2204
2204
 
2205
2205
  ${block(error.message)}
@@ -2226,7 +2226,7 @@ function validatePipeline_InnerFunction(pipeline) {
2226
2226
  })();
2227
2227
  if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
2228
2228
  // <- Note: [🚲]
2229
- throw new PipelineLogicError(spaceTrim$2((block) => `
2229
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2230
2230
  Invalid promptbook URL "${pipeline.pipelineUrl}"
2231
2231
 
2232
2232
  ${block(pipelineIdentification)}
@@ -2234,7 +2234,7 @@ function validatePipeline_InnerFunction(pipeline) {
2234
2234
  }
2235
2235
  if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
2236
2236
  // <- Note: [🚲]
2237
- throw new PipelineLogicError(spaceTrim$2((block) => `
2237
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2238
2238
  Invalid Promptbook Version "${pipeline.bookVersion}"
2239
2239
 
2240
2240
  ${block(pipelineIdentification)}
@@ -2243,7 +2243,7 @@ function validatePipeline_InnerFunction(pipeline) {
2243
2243
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2244
2244
  if (!Array.isArray(pipeline.parameters)) {
2245
2245
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2246
- throw new ParseError(spaceTrim$2((block) => `
2246
+ throw new ParseError(spaceTrim$1((block) => `
2247
2247
  Pipeline is valid JSON but with wrong structure
2248
2248
 
2249
2249
  \`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
@@ -2254,7 +2254,7 @@ function validatePipeline_InnerFunction(pipeline) {
2254
2254
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2255
2255
  if (!Array.isArray(pipeline.tasks)) {
2256
2256
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2257
- throw new ParseError(spaceTrim$2((block) => `
2257
+ throw new ParseError(spaceTrim$1((block) => `
2258
2258
  Pipeline is valid JSON but with wrong structure
2259
2259
 
2260
2260
  \`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
@@ -2280,7 +2280,7 @@ function validatePipeline_InnerFunction(pipeline) {
2280
2280
  // Note: Check each parameter individually
2281
2281
  for (const parameter of pipeline.parameters) {
2282
2282
  if (parameter.isInput && parameter.isOutput) {
2283
- throw new PipelineLogicError(spaceTrim$2((block) => `
2283
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2284
2284
 
2285
2285
  Parameter \`{${parameter.name}}\` can not be both input and output
2286
2286
 
@@ -2291,7 +2291,7 @@ function validatePipeline_InnerFunction(pipeline) {
2291
2291
  if (!parameter.isInput &&
2292
2292
  !parameter.isOutput &&
2293
2293
  !pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
2294
- throw new PipelineLogicError(spaceTrim$2((block) => `
2294
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2295
2295
  Parameter \`{${parameter.name}}\` is created but not used
2296
2296
 
2297
2297
  You can declare {${parameter.name}} as output parameter by adding in the header:
@@ -2303,7 +2303,7 @@ function validatePipeline_InnerFunction(pipeline) {
2303
2303
  }
2304
2304
  // Note: Testing that parameter is either input or result of some task
2305
2305
  if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
2306
- throw new PipelineLogicError(spaceTrim$2((block) => `
2306
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2307
2307
  Parameter \`{${parameter.name}}\` is declared but not defined
2308
2308
 
2309
2309
  You can do one of these:
@@ -2319,14 +2319,14 @@ function validatePipeline_InnerFunction(pipeline) {
2319
2319
  // Note: Checking each task individually
2320
2320
  for (const task of pipeline.tasks) {
2321
2321
  if (definedParameters.has(task.resultingParameterName)) {
2322
- throw new PipelineLogicError(spaceTrim$2((block) => `
2322
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2323
2323
  Parameter \`{${task.resultingParameterName}}\` is defined multiple times
2324
2324
 
2325
2325
  ${block(pipelineIdentification)}
2326
2326
  `));
2327
2327
  }
2328
2328
  if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
2329
- throw new PipelineLogicError(spaceTrim$2((block) => `
2329
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2330
2330
  Parameter name {${task.resultingParameterName}} is reserved, please use different name
2331
2331
 
2332
2332
  ${block(pipelineIdentification)}
@@ -2336,7 +2336,7 @@ function validatePipeline_InnerFunction(pipeline) {
2336
2336
  if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
2337
2337
  if (!task.format &&
2338
2338
  !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
2339
- throw new PipelineLogicError(spaceTrim$2((block) => `
2339
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2340
2340
  Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
2341
2341
 
2342
2342
  ${block(pipelineIdentification)}
@@ -2344,7 +2344,7 @@ function validatePipeline_InnerFunction(pipeline) {
2344
2344
  }
2345
2345
  for (const joker of task.jokerParameterNames) {
2346
2346
  if (!task.dependentParameterNames.includes(joker)) {
2347
- throw new PipelineLogicError(spaceTrim$2((block) => `
2347
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2348
2348
  Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
2349
2349
 
2350
2350
  ${block(pipelineIdentification)}
@@ -2355,21 +2355,21 @@ function validatePipeline_InnerFunction(pipeline) {
2355
2355
  if (task.expectations) {
2356
2356
  for (const [unit, { min, max }] of Object.entries(task.expectations)) {
2357
2357
  if (min !== undefined && max !== undefined && min > max) {
2358
- throw new PipelineLogicError(spaceTrim$2((block) => `
2358
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2359
2359
  Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
2360
2360
 
2361
2361
  ${block(pipelineIdentification)}
2362
2362
  `));
2363
2363
  }
2364
2364
  if (min !== undefined && min < 0) {
2365
- throw new PipelineLogicError(spaceTrim$2((block) => `
2365
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2366
2366
  Min expectation of ${unit} must be zero or positive
2367
2367
 
2368
2368
  ${block(pipelineIdentification)}
2369
2369
  `));
2370
2370
  }
2371
2371
  if (max !== undefined && max <= 0) {
2372
- throw new PipelineLogicError(spaceTrim$2((block) => `
2372
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2373
2373
  Max expectation of ${unit} must be positive
2374
2374
 
2375
2375
  ${block(pipelineIdentification)}
@@ -2391,7 +2391,7 @@ function validatePipeline_InnerFunction(pipeline) {
2391
2391
  while (unresovedTasks.length > 0) {
2392
2392
  if (loopLimit-- < 0) {
2393
2393
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
2394
- throw new UnexpectedError(spaceTrim$2((block) => `
2394
+ throw new UnexpectedError(spaceTrim$1((block) => `
2395
2395
  Loop limit reached during detection of circular dependencies in \`validatePipeline\`
2396
2396
 
2397
2397
  ${block(pipelineIdentification)}
@@ -2401,7 +2401,7 @@ function validatePipeline_InnerFunction(pipeline) {
2401
2401
  if (currentlyResovedTasks.length === 0) {
2402
2402
  throw new PipelineLogicError(
2403
2403
  // TODO: [🐎] DRY
2404
- spaceTrim$2((block) => `
2404
+ spaceTrim$1((block) => `
2405
2405
 
2406
2406
  Can not resolve some parameters:
2407
2407
  Either you are using a parameter that is not defined, or there are some circular dependencies.
@@ -2565,7 +2565,7 @@ class SimplePipelineCollection {
2565
2565
  for (const pipeline of pipelines) {
2566
2566
  // TODO: [👠] DRY
2567
2567
  if (pipeline.pipelineUrl === undefined) {
2568
- throw new PipelineUrlError(spaceTrim$2(`
2568
+ throw new PipelineUrlError(spaceTrim$1(`
2569
2569
  Pipeline with name "${pipeline.title}" does not have defined URL
2570
2570
 
2571
2571
  File:
@@ -2587,7 +2587,7 @@ class SimplePipelineCollection {
2587
2587
  pipelineJsonToString(unpreparePipeline(pipeline)) !==
2588
2588
  pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
2589
2589
  const existing = this.collection.get(pipeline.pipelineUrl);
2590
- throw new PipelineUrlError(spaceTrim$2(`
2590
+ throw new PipelineUrlError(spaceTrim$1(`
2591
2591
  Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
2592
2592
 
2593
2593
  Conflicting files:
@@ -2619,13 +2619,13 @@ class SimplePipelineCollection {
2619
2619
  const pipeline = this.collection.get(url);
2620
2620
  if (!pipeline) {
2621
2621
  if (this.listPipelines().length === 0) {
2622
- throw new NotFoundError(spaceTrim$2(`
2622
+ throw new NotFoundError(spaceTrim$1(`
2623
2623
  Pipeline with url "${url}" not found
2624
2624
 
2625
2625
  No pipelines available
2626
2626
  `));
2627
2627
  }
2628
- throw new NotFoundError(spaceTrim$2((block) => `
2628
+ throw new NotFoundError(spaceTrim$1((block) => `
2629
2629
  Pipeline with url "${url}" not found
2630
2630
 
2631
2631
  Available pipelines:
@@ -2666,7 +2666,7 @@ function createPipelineCollectionFromJson(...promptbooks) {
2666
2666
  */
2667
2667
  class MissingToolsError extends Error {
2668
2668
  constructor(message) {
2669
- super(spaceTrim$2((block) => `
2669
+ super(spaceTrim$1((block) => `
2670
2670
  ${block(message)}
2671
2671
 
2672
2672
  Note: You have probably forgot to provide some tools for pipeline execution or preparation
@@ -2913,7 +2913,7 @@ class NotAllowed extends Error {
2913
2913
  */
2914
2914
  class NotYetImplementedError extends Error {
2915
2915
  constructor(message) {
2916
- super(spaceTrim$2((block) => `
2916
+ super(spaceTrim$1((block) => `
2917
2917
  ${block(message)}
2918
2918
 
2919
2919
  Note: This feature is not implemented yet but it will be soon.
@@ -3153,11 +3153,11 @@ function assertsTaskSuccessful(executionResult) {
3153
3153
  throw deserializeError(errors[0]);
3154
3154
  }
3155
3155
  else {
3156
- throw new PipelineExecutionError(spaceTrim$2((block) => `
3156
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
3157
3157
  Multiple errors occurred during Promptbook execution
3158
3158
 
3159
3159
  ${block(errors
3160
- .map(({ name, stack, message }, index) => spaceTrim$2((block) => `
3160
+ .map(({ name, stack, message }, index) => spaceTrim$1((block) => `
3161
3161
  ${name} ${index + 1}:
3162
3162
  ${block(stack || message)}
3163
3163
  `))
@@ -5003,7 +5003,7 @@ async function prepareTasks(pipeline, tools, options) {
5003
5003
  if (task.taskType === 'PROMPT_TASK' &&
5004
5004
  knowledgePiecesCount > 0 &&
5005
5005
  !dependentParameterNames.includes('knowledge')) {
5006
- preparedContent = spaceTrim$2(`
5006
+ preparedContent = spaceTrim$1(`
5007
5007
  {content}
5008
5008
 
5009
5009
  ## Knowledge
@@ -5316,7 +5316,7 @@ function extractVariablesFromJavascript(script) {
5316
5316
  }
5317
5317
  catch (error) {
5318
5318
  assertsError(error);
5319
- throw new ParseError(spaceTrim$2((block) => `
5319
+ throw new ParseError(spaceTrim$1((block) => `
5320
5320
  Can not extract variables from the script
5321
5321
  ${block(error.stack || error.message)}
5322
5322
 
@@ -6051,7 +6051,7 @@ function validatePromptResult(options) {
6051
6051
  }
6052
6052
  catch (error) {
6053
6053
  keepUnused(error);
6054
- throw new ExpectError(spaceTrim$2((block) => `
6054
+ throw new ExpectError(spaceTrim$1((block) => `
6055
6055
  Expected valid JSON string
6056
6056
 
6057
6057
  The expected JSON text:
@@ -6114,7 +6114,7 @@ async function executeAttempts(options) {
6114
6114
  const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
6115
6115
  // TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
6116
6116
  if (isJokerAttempt && !jokerParameterName) {
6117
- throw new UnexpectedError(spaceTrim$2((block) => `
6117
+ throw new UnexpectedError(spaceTrim$1((block) => `
6118
6118
  Joker not found in attempt ${attemptIndex}
6119
6119
 
6120
6120
  ${block(pipelineIdentification)}
@@ -6125,7 +6125,7 @@ async function executeAttempts(options) {
6125
6125
  $ongoingTaskResult.$expectError = null;
6126
6126
  if (isJokerAttempt) {
6127
6127
  if (parameters[jokerParameterName] === undefined) {
6128
- throw new PipelineExecutionError(spaceTrim$2((block) => `
6128
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6129
6129
  Joker parameter {${jokerParameterName}} not defined
6130
6130
 
6131
6131
  ${block(pipelineIdentification)}
@@ -6184,7 +6184,7 @@ async function executeAttempts(options) {
6184
6184
  break variant;
6185
6185
  case 'EMBEDDING':
6186
6186
  case 'IMAGE_GENERATION':
6187
- throw new PipelineExecutionError(spaceTrim$2((block) => `
6187
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6188
6188
  ${modelRequirements.modelVariant} model can not be used in pipeline
6189
6189
 
6190
6190
  This should be catched during parsing
@@ -6195,7 +6195,7 @@ async function executeAttempts(options) {
6195
6195
  break variant;
6196
6196
  // <- case [🤖]:
6197
6197
  default:
6198
- throw new PipelineExecutionError(spaceTrim$2((block) => `
6198
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6199
6199
  Unknown model variant "${task.modelRequirements.modelVariant}"
6200
6200
 
6201
6201
  ${block(pipelineIdentification)}
@@ -6206,14 +6206,14 @@ async function executeAttempts(options) {
6206
6206
  break;
6207
6207
  case 'SCRIPT_TASK':
6208
6208
  if (arrayableToArray(tools.script).length === 0) {
6209
- throw new PipelineExecutionError(spaceTrim$2((block) => `
6209
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6210
6210
  No script execution tools are available
6211
6211
 
6212
6212
  ${block(pipelineIdentification)}
6213
6213
  `));
6214
6214
  }
6215
6215
  if (!task.contentLanguage) {
6216
- throw new PipelineExecutionError(spaceTrim$2((block) => `
6216
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6217
6217
  Script language is not defined for SCRIPT TASK "${task.name}"
6218
6218
 
6219
6219
  ${block(pipelineIdentification)}
@@ -6244,7 +6244,7 @@ async function executeAttempts(options) {
6244
6244
  throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
6245
6245
  }
6246
6246
  else {
6247
- throw new PipelineExecutionError(spaceTrim$2((block) => `
6247
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6248
6248
  Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
6249
6249
 
6250
6250
  ${block(pipelineIdentification)}
@@ -6258,7 +6258,7 @@ async function executeAttempts(options) {
6258
6258
  break taskType;
6259
6259
  case 'DIALOG_TASK':
6260
6260
  if (tools.userInterface === undefined) {
6261
- throw new PipelineExecutionError(spaceTrim$2((block) => `
6261
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6262
6262
  User interface tools are not available
6263
6263
 
6264
6264
  ${block(pipelineIdentification)}
@@ -6276,7 +6276,7 @@ async function executeAttempts(options) {
6276
6276
  break taskType;
6277
6277
  // <- case: [🅱]
6278
6278
  default:
6279
- throw new PipelineExecutionError(spaceTrim$2((block) => `
6279
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6280
6280
  Unknown execution type "${task.taskType}"
6281
6281
 
6282
6282
  ${block(pipelineIdentification)}
@@ -6374,7 +6374,7 @@ async function executeAttempts(options) {
6374
6374
  if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
6375
6375
  // Note: Create a summary of all failures
6376
6376
  const failuresSummary = $ongoingTaskResult.$failedResults
6377
- .map((failure) => spaceTrim$2((block) => {
6377
+ .map((failure) => spaceTrim$1((block) => {
6378
6378
  var _a, _b;
6379
6379
  return `
6380
6380
  Attempt ${failure.attemptIndex + 1}:
@@ -6384,14 +6384,14 @@ async function executeAttempts(options) {
6384
6384
  Result:
6385
6385
  ${block(failure.result === null
6386
6386
  ? 'null'
6387
- : spaceTrim$2(failure.result)
6387
+ : spaceTrim$1(failure.result)
6388
6388
  .split(/\r?\n/)
6389
6389
  .map((line) => `> ${line}`)
6390
6390
  .join('\n'))}
6391
6391
  `;
6392
6392
  }))
6393
6393
  .join('\n\n---\n\n');
6394
- throw new PipelineExecutionError(spaceTrim$2((block) => {
6394
+ throw new PipelineExecutionError(spaceTrim$1((block) => {
6395
6395
  var _a;
6396
6396
  return `
6397
6397
  LLM execution failed ${maxExecutionAttempts}x
@@ -6411,7 +6411,7 @@ async function executeAttempts(options) {
6411
6411
  }
6412
6412
  }
6413
6413
  if ($ongoingTaskResult.$resultString === null) {
6414
- throw new UnexpectedError(spaceTrim$2((block) => `
6414
+ throw new UnexpectedError(spaceTrim$1((block) => `
6415
6415
  Something went wrong and prompt result is null
6416
6416
 
6417
6417
  ${block(pipelineIdentification)}
@@ -6717,7 +6717,7 @@ async function getReservedParametersForTask(options) {
6717
6717
  // Note: Doublecheck that ALL reserved parameters are defined:
6718
6718
  for (const parameterName of RESERVED_PARAMETER_NAMES) {
6719
6719
  if (reservedParameters[parameterName] === undefined) {
6720
- throw new UnexpectedError(spaceTrim$2((block) => `
6720
+ throw new UnexpectedError(spaceTrim$1((block) => `
6721
6721
  Reserved parameter {${parameterName}} is not defined
6722
6722
 
6723
6723
  ${block(pipelineIdentification)}
@@ -6743,7 +6743,7 @@ async function executeTask(options) {
6743
6743
  const dependentParameterNames = new Set(currentTask.dependentParameterNames);
6744
6744
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
6745
6745
  if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
6746
- throw new UnexpectedError(spaceTrim$2((block) => `
6746
+ throw new UnexpectedError(spaceTrim$1((block) => `
6747
6747
  Dependent parameters are not consistent with used parameters:
6748
6748
 
6749
6749
  Dependent parameters:
@@ -6787,7 +6787,7 @@ async function executeTask(options) {
6787
6787
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
6788
6788
  // Houston, we have a problem
6789
6789
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
6790
- throw new UnexpectedError(spaceTrim$2((block) => `
6790
+ throw new UnexpectedError(spaceTrim$1((block) => `
6791
6791
  Parameter \`{${parameterName}}\` is NOT defined
6792
6792
  BUT used in task "${currentTask.title || currentTask.name}"
6793
6793
 
@@ -6856,7 +6856,7 @@ function filterJustOutputParameters(options) {
6856
6856
  for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
6857
6857
  if (parametersToPass[parameter.name] === undefined) {
6858
6858
  // [4]
6859
- $warnings.push(new PipelineExecutionError(spaceTrim$2((block) => `
6859
+ $warnings.push(new PipelineExecutionError(spaceTrim$1((block) => `
6860
6860
  Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
6861
6861
 
6862
6862
  Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
@@ -6964,7 +6964,7 @@ async function executePipeline(options) {
6964
6964
  for (const parameterName of Object.keys(inputParameters)) {
6965
6965
  const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
6966
6966
  if (parameter === undefined) {
6967
- warnings.push(new PipelineExecutionError(spaceTrim$2((block) => `
6967
+ warnings.push(new PipelineExecutionError(spaceTrim$1((block) => `
6968
6968
  Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
6969
6969
 
6970
6970
  ${block(pipelineIdentification)}
@@ -6979,7 +6979,7 @@ async function executePipeline(options) {
6979
6979
  // TODO: [🧠] This should be also non-critical error
6980
6980
  return exportJson({
6981
6981
  name: 'pipelineExecutorResult',
6982
- message: spaceTrim$2((block) => `
6982
+ message: spaceTrim$1((block) => `
6983
6983
  Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
6984
6984
 
6985
6985
  ${block(pipelineIdentification)}
@@ -6988,7 +6988,7 @@ async function executePipeline(options) {
6988
6988
  value: {
6989
6989
  isSuccessful: false,
6990
6990
  errors: [
6991
- new PipelineExecutionError(spaceTrim$2((block) => `
6991
+ new PipelineExecutionError(spaceTrim$1((block) => `
6992
6992
  Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
6993
6993
 
6994
6994
  ${block(pipelineIdentification)}
@@ -7015,7 +7015,7 @@ async function executePipeline(options) {
7015
7015
  while (unresovedTasks.length > 0) {
7016
7016
  if (loopLimit-- < 0) {
7017
7017
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
7018
- throw new UnexpectedError(spaceTrim$2((block) => `
7018
+ throw new UnexpectedError(spaceTrim$1((block) => `
7019
7019
  Loop limit reached during resolving parameters pipeline execution
7020
7020
 
7021
7021
  ${block(pipelineIdentification)}
@@ -7025,7 +7025,7 @@ async function executePipeline(options) {
7025
7025
  if (!currentTask && resolving.length === 0) {
7026
7026
  throw new UnexpectedError(
7027
7027
  // TODO: [🐎] DRY
7028
- spaceTrim$2((block) => `
7028
+ spaceTrim$1((block) => `
7029
7029
  Can not resolve some parameters:
7030
7030
 
7031
7031
  ${block(pipelineIdentification)}
@@ -7065,7 +7065,7 @@ async function executePipeline(options) {
7065
7065
  tools,
7066
7066
  onProgress(newOngoingResult) {
7067
7067
  if (isReturned) {
7068
- throw new UnexpectedError(spaceTrim$2((block) => `
7068
+ throw new UnexpectedError(spaceTrim$1((block) => `
7069
7069
  Can not call \`onProgress\` after pipeline execution is finished
7070
7070
 
7071
7071
  ${block(pipelineIdentification)}
@@ -7082,7 +7082,7 @@ async function executePipeline(options) {
7082
7082
  },
7083
7083
  logLlmCall,
7084
7084
  $executionReport: executionReport,
7085
- pipelineIdentification: spaceTrim$2((block) => `
7085
+ pipelineIdentification: spaceTrim$1((block) => `
7086
7086
  ${block(pipelineIdentification)}
7087
7087
  Task name: ${currentTask.name}
7088
7088
  Task title: ${currentTask.title}
@@ -7191,7 +7191,7 @@ function createPipelineExecutor(options) {
7191
7191
  preparedPipeline = pipeline;
7192
7192
  }
7193
7193
  else if (isNotPreparedWarningSuppressed !== true) {
7194
- console.warn(spaceTrim$2((block) => `
7194
+ console.warn(spaceTrim$1((block) => `
7195
7195
  Pipeline is not prepared
7196
7196
 
7197
7197
  ${block(pipelineIdentification)}
@@ -7216,7 +7216,7 @@ function createPipelineExecutor(options) {
7216
7216
  tools,
7217
7217
  onProgress,
7218
7218
  logLlmCall,
7219
- pipelineIdentification: spaceTrim$2((block) => `
7219
+ pipelineIdentification: spaceTrim$1((block) => `
7220
7220
  ${block(pipelineIdentification)}
7221
7221
  ${runCount === 1 ? '' : `Run #${runCount}`}
7222
7222
  `),
@@ -7524,7 +7524,7 @@ const _MarkdownScraperRegistration = $scrapersRegister.register(createMarkdownSc
7524
7524
  * @public exported from `@promptbook/markdown-utils`
7525
7525
  */
7526
7526
  function removeMarkdownComments(content) {
7527
- return spaceTrim$2(content.replace(/<!--(.*?)-->/gs, ''));
7527
+ return spaceTrim$1(content.replace(/<!--(.*?)-->/gs, ''));
7528
7528
  }
7529
7529
 
7530
7530
  /**
@@ -7537,7 +7537,7 @@ function addAutoGeneratedSection(content, options) {
7537
7537
  const warningLine = `<!-- ${GENERATOR_WARNING} -->`;
7538
7538
  const sectionRegex = new RegExp(`<!--${sectionName}-->([\\s\\S]*?)<!--/${sectionName}-->`, 'g');
7539
7539
  const sectionMatch = content.match(sectionRegex);
7540
- const contentToInsert = spaceTrim$2((block) => `
7540
+ const contentToInsert = spaceTrim$1((block) => `
7541
7541
  <!--${sectionName}-->
7542
7542
  ${block(warningLine)}
7543
7543
  ${block(sectionContent)}
@@ -7550,7 +7550,7 @@ function addAutoGeneratedSection(content, options) {
7550
7550
  const placeForSection = removeMarkdownComments(content).match(/^##.*$/im);
7551
7551
  if (placeForSection !== null) {
7552
7552
  const [heading] = placeForSection;
7553
- return content.replace(heading, spaceTrim$2((block) => `
7553
+ return content.replace(heading, spaceTrim$1((block) => `
7554
7554
  ${block(contentToInsert)}
7555
7555
 
7556
7556
  ${block(heading)}
@@ -7559,7 +7559,7 @@ function addAutoGeneratedSection(content, options) {
7559
7559
  console.warn(`No place where to put the section <!--${sectionName}-->, using the end of the file`);
7560
7560
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
7561
7561
  // <- TODO: [🏮] Some better way how to get warnings from pipeline parsing / logic
7562
- return spaceTrim$2((block) => `
7562
+ return spaceTrim$1((block) => `
7563
7563
  ${block(content)}
7564
7564
 
7565
7565
  ${block(contentToInsert)}
@@ -7983,13 +7983,13 @@ function removeMarkdownLinks(str) {
7983
7983
  * @public exported from `@promptbook/markdown-utils`
7984
7984
  */
7985
7985
  function trimCodeBlock(value) {
7986
- value = spaceTrim$2(value);
7986
+ value = spaceTrim$1(value);
7987
7987
  if (!/^```[a-z]*(.*)```$/is.test(value)) {
7988
7988
  return value;
7989
7989
  }
7990
7990
  value = value.replace(/^```[a-z]*/i, '');
7991
7991
  value = value.replace(/```$/i, '');
7992
- value = spaceTrim$2(value);
7992
+ value = spaceTrim$1(value);
7993
7993
  return value;
7994
7994
  }
7995
7995
 
@@ -8002,9 +8002,9 @@ function trimCodeBlock(value) {
8002
8002
  * @public exported from `@promptbook/markdown-utils`
8003
8003
  */
8004
8004
  function trimEndOfCodeBlock(value) {
8005
- value = spaceTrim$2(value);
8005
+ value = spaceTrim$1(value);
8006
8006
  value = value.replace(/```$/g, '');
8007
- value = spaceTrim$2(value);
8007
+ value = spaceTrim$1(value);
8008
8008
  return value;
8009
8009
  }
8010
8010