@promptbook/remote-client 0.112.0-13 → 0.112.0-16

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 +42 -42
  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 +2 -2
  17. package/umd/index.umd.js +69 -70
  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/umd/index.umd.js CHANGED
@@ -1,12 +1,11 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto'), require('socket.io-client'), require('crypto-js'), require('crypto-js/enc-hex'), require('papaparse'), require('path')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto', 'socket.io-client', 'crypto-js', 'crypto-js/enc-hex', 'papaparse', 'path'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-client"] = {}, global.spaceTrim$1, global.crypto, global.socket_ioClient, global.cryptoJs, global.hexEncoder, global.papaparse, global.path));
5
- })(this, (function (exports, spaceTrim$1, crypto, socket_ioClient, cryptoJs, hexEncoder, papaparse, path) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-client"] = {}, global.spacetrim, global.crypto, global.socket_ioClient, global.cryptoJs, global.hexEncoder, global.papaparse, global.path));
5
+ })(this, (function (exports, spacetrim, crypto, socket_ioClient, cryptoJs, hexEncoder, papaparse, path) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
- var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
10
9
  var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
11
10
 
12
11
  // ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
@@ -23,7 +22,7 @@
23
22
  * @generated
24
23
  * @see https://github.com/webgptorg/promptbook
25
24
  */
26
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-13';
25
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-16';
27
26
  /**
28
27
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
28
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -176,7 +175,7 @@
176
175
  */
177
176
  class MissingToolsError extends Error {
178
177
  constructor(message) {
179
- super(spaceTrim$1.spaceTrim((block) => `
178
+ super(spacetrim.spaceTrim((block) => `
180
179
  ${block(message)}
181
180
 
182
181
  Note: You have probably forgot to provide some tools for pipeline execution or preparation
@@ -220,7 +219,7 @@
220
219
  */
221
220
  class NotYetImplementedError extends Error {
222
221
  constructor(message) {
223
- super(spaceTrim$1.spaceTrim((block) => `
222
+ super(spacetrim.spaceTrim((block) => `
224
223
  ${block(message)}
225
224
 
226
225
  Note: This feature is not implemented yet but it will be soon.
@@ -336,7 +335,7 @@
336
335
  * @public exported from `@promptbook/utils`
337
336
  * @see https://github.com/hejny/spacetrim#usage
338
337
  */
339
- const spaceTrim = spaceTrim$1.spaceTrim;
338
+ const spaceTrim = spacetrim.spaceTrim;
340
339
 
341
340
  /**
342
341
  * @private util of `@promptbook/color`
@@ -1364,7 +1363,7 @@
1364
1363
  function getErrorReportUrl(error) {
1365
1364
  const report = {
1366
1365
  title: `🐜 Error report from ${NAME}`,
1367
- body: spaceTrim__default["default"]((block) => `
1366
+ body: spacetrim.spaceTrim((block) => `
1368
1367
 
1369
1368
 
1370
1369
  \`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
@@ -1407,7 +1406,7 @@
1407
1406
  */
1408
1407
  class UnexpectedError extends Error {
1409
1408
  constructor(message) {
1410
- super(spaceTrim$1.spaceTrim((block) => `
1409
+ super(spacetrim.spaceTrim((block) => `
1411
1410
  ${block(message)}
1412
1411
 
1413
1412
  Note: This error should not happen.
@@ -1433,7 +1432,7 @@
1433
1432
  constructor(whatWasThrown) {
1434
1433
  const tag = `[🤮]`;
1435
1434
  console.error(tag, whatWasThrown);
1436
- super(spaceTrim$1.spaceTrim(`
1435
+ super(spacetrim.spaceTrim(`
1437
1436
  Non-Error object was thrown
1438
1437
 
1439
1438
  Note: Look for ${tag} in the console for more details
@@ -1523,7 +1522,7 @@
1523
1522
  message = `${name}: ${message}`;
1524
1523
  }
1525
1524
  if (isStackAddedToMessage && stack !== undefined && stack !== '') {
1526
- message = spaceTrim__default["default"]((block) => `
1525
+ message = spacetrim.spaceTrim((block) => `
1527
1526
  ${block(message)}
1528
1527
 
1529
1528
  Original stack trace:
@@ -1581,7 +1580,7 @@
1581
1580
  const remoteServerUrlParsed = new URL(remoteServerUrl);
1582
1581
  if (remoteServerUrlParsed.pathname !== '/' && remoteServerUrlParsed.pathname !== '') {
1583
1582
  remoteServerUrlParsed.pathname = '/';
1584
- throw new Error(spaceTrim__default["default"]((block) => `
1583
+ throw new Error(spacetrim.spaceTrim((block) => `
1585
1584
  Remote server requires root url \`/\`
1586
1585
 
1587
1586
  You have provided \`remoteServerUrl\`:
@@ -2117,7 +2116,7 @@
2117
2116
  */
2118
2117
  parse(input) {
2119
2118
  const { args } = input;
2120
- const knowledgeSourceContent = spaceTrim__default["default"](args[0] || '');
2119
+ const knowledgeSourceContent = spacetrim.spaceTrim(args[0] || '');
2121
2120
  if (knowledgeSourceContent === '') {
2122
2121
  throw new ParseError(`Source is not defined`);
2123
2122
  }
@@ -2261,7 +2260,7 @@
2261
2260
  normalized = normalized.split('DIALOGUE').join('DIALOG');
2262
2261
  const taskTypes = SectionTypes.filter((sectionType) => normalized.includes(sectionType.split('_TASK').join('')));
2263
2262
  if (taskTypes.length !== 1) {
2264
- throw new ParseError(spaceTrim__default["default"]((block) => `
2263
+ throw new ParseError(spacetrim.spaceTrim((block) => `
2265
2264
  Unknown section type "${normalized}"
2266
2265
 
2267
2266
  Supported section types are:
@@ -2281,7 +2280,7 @@
2281
2280
  */
2282
2281
  $applyToTaskJson(command, $taskJson, $pipelineJson) {
2283
2282
  if ($taskJson.isSectionTypeSet === true) {
2284
- throw new ParseError(spaceTrim__default["default"](`
2283
+ throw new ParseError(spacetrim.spaceTrim(`
2285
2284
  Section type is already defined in the section.
2286
2285
  It can be defined only once.
2287
2286
  `));
@@ -2703,7 +2702,7 @@
2703
2702
  /**
2704
2703
  * Description of the FORMAT command
2705
2704
  */
2706
- description: spaceTrim__default["default"](`
2705
+ description: spacetrim.spaceTrim(`
2707
2706
  Expect command describes the desired output of the task *(after post-processing)*
2708
2707
  It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.
2709
2708
  `),
@@ -2777,7 +2776,7 @@
2777
2776
  }
2778
2777
  catch (error) {
2779
2778
  assertsError(error);
2780
- throw new ParseError(spaceTrim__default["default"]((block) => `
2779
+ throw new ParseError(spacetrim.spaceTrim((block) => `
2781
2780
  Invalid FORMAT command
2782
2781
  ${block(error.message)}:
2783
2782
  `));
@@ -2899,7 +2898,7 @@
2899
2898
  const { value, outputParameterName, settings, mapCallback, onProgress } = options;
2900
2899
  const csv = csvParse(value, settings);
2901
2900
  if (csv.errors.length !== 0) {
2902
- throw new CsvFormatError(spaceTrim__default["default"]((block) => `
2901
+ throw new CsvFormatError(spacetrim.spaceTrim((block) => `
2903
2902
  CSV parsing error
2904
2903
 
2905
2904
  Error(s) from CSV parsing:
@@ -2944,7 +2943,7 @@
2944
2943
  const { value, settings, mapCallback, onProgress } = options;
2945
2944
  const csv = csvParse(value, settings);
2946
2945
  if (csv.errors.length !== 0) {
2947
- throw new CsvFormatError(spaceTrim__default["default"]((block) => `
2946
+ throw new CsvFormatError(spacetrim.spaceTrim((block) => `
2948
2947
  CSV parsing error
2949
2948
 
2950
2949
  Error(s) from CSV parsing:
@@ -3289,7 +3288,7 @@
3289
3288
  }
3290
3289
  else if (typeof value === 'object') {
3291
3290
  if (value instanceof Date) {
3292
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
3291
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
3293
3292
  \`${name}\` is Date
3294
3293
 
3295
3294
  Use \`string_date_iso8601\` instead
@@ -3308,7 +3307,7 @@
3308
3307
  throw new UnexpectedError(`${name} is RegExp`);
3309
3308
  }
3310
3309
  else if (value instanceof Error) {
3311
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
3310
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
3312
3311
  \`${name}\` is unserialized Error
3313
3312
 
3314
3313
  Use function \`serializeError\`
@@ -3331,7 +3330,7 @@
3331
3330
  }
3332
3331
  catch (error) {
3333
3332
  assertsError(error);
3334
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
3333
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
3335
3334
  \`${name}\` is not serializable
3336
3335
 
3337
3336
  ${block(error.stack || error.message)}
@@ -3363,7 +3362,7 @@
3363
3362
  }
3364
3363
  }
3365
3364
  else {
3366
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
3365
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
3367
3366
  \`${name}\` is unknown type
3368
3367
 
3369
3368
  Additional message for \`${name}\`:
@@ -3644,7 +3643,7 @@
3644
3643
  if (!(error instanceof ParseError)) {
3645
3644
  throw error;
3646
3645
  }
3647
- throw new ParseError(spaceTrim__default["default"]((block) => `
3646
+ throw new ParseError(spacetrim.spaceTrim((block) => `
3648
3647
  ${block(error.message)}
3649
3648
 
3650
3649
  Tried to validate parameter name:
@@ -3703,7 +3702,7 @@
3703
3702
  const assignSign = args[3];
3704
3703
  const formatDefinition = FORMAT_DEFINITIONS.find((formatDefinition) => [formatDefinition.formatName, ...(formatDefinition.aliases || [])].includes(formatName));
3705
3704
  if (formatDefinition === undefined) {
3706
- throw new ParseError(spaceTrim__default["default"]((block) => `
3705
+ throw new ParseError(spacetrim.spaceTrim((block) => `
3707
3706
  Unsupported format "${formatName}"
3708
3707
 
3709
3708
  Available formats:
@@ -3715,7 +3714,7 @@
3715
3714
  }
3716
3715
  const subvalueParser = formatDefinition.subvalueParsers.find((subvalueParser) => [subvalueParser.subvalueName, ...(subvalueParser.aliases || [])].includes(subformatName));
3717
3716
  if (subvalueParser === undefined) {
3718
- throw new ParseError(spaceTrim__default["default"]((block) => `
3717
+ throw new ParseError(spacetrim.spaceTrim((block) => `
3719
3718
  Unsupported subformat name "${subformatName}" for format "${formatName}"
3720
3719
 
3721
3720
  Available subformat names for format "${formatDefinition.formatName}":
@@ -3763,7 +3762,7 @@
3763
3762
  outputSubparameterName = 'newLine';
3764
3763
  }
3765
3764
  else {
3766
- throw new ParseError(spaceTrim__default["default"](`
3765
+ throw new ParseError(spacetrim.spaceTrim(`
3767
3766
  FOREACH ${formatName} ${subformatName} must specify output subparameter
3768
3767
 
3769
3768
  Correct example:
@@ -3839,7 +3838,7 @@
3839
3838
  /**
3840
3839
  * Description of the FORMAT command
3841
3840
  */
3842
- description: spaceTrim__default["default"](`
3841
+ description: spacetrim.spaceTrim(`
3843
3842
  Format command describes the desired output of the task (after post-processing)
3844
3843
  It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.
3845
3844
  `),
@@ -4211,7 +4210,7 @@
4211
4210
  const formfactorNameCandidate = args[0].toUpperCase();
4212
4211
  const formfactor = FORMFACTOR_DEFINITIONS.find((definition) => [definition.name, ...{ aliasNames: [], ...definition }.aliasNames].includes(formfactorNameCandidate));
4213
4212
  if (formfactor === undefined) {
4214
- throw new ParseError(spaceTrim__default["default"]((block) => `
4213
+ throw new ParseError(spacetrim.spaceTrim((block) => `
4215
4214
  Unknown formfactor name "${formfactorNameCandidate}"
4216
4215
 
4217
4216
  Available formfactors:
@@ -4230,7 +4229,7 @@
4230
4229
  */
4231
4230
  $applyToPipelineJson(command, $pipelineJson) {
4232
4231
  if ($pipelineJson.formfactorName !== undefined && $pipelineJson.formfactorName !== command.formfactorName) {
4233
- throw new ParseError(spaceTrim__default["default"](`
4232
+ throw new ParseError(spacetrim.spaceTrim(`
4234
4233
  Redefinition of \`FORMFACTOR\` in the pipeline head
4235
4234
 
4236
4235
  You have used:
@@ -4378,7 +4377,7 @@
4378
4377
  */
4379
4378
  parse(input) {
4380
4379
  const { args, normalized } = input;
4381
- const availableVariantsMessage = spaceTrim__default["default"]((block) => `
4380
+ const availableVariantsMessage = spacetrim.spaceTrim((block) => `
4382
4381
  Available variants are:
4383
4382
  ${block(MODEL_VARIANTS.map((variantName) => `- ${variantName}${variantName !== 'EMBEDDING' ? '' : ' (Not available in pipeline)'}`).join('\n'))}
4384
4383
  `);
@@ -4400,14 +4399,14 @@
4400
4399
  // <- Note: [🤖]
4401
4400
  }
4402
4401
  else if (normalized.startsWith('MODEL_VARIANT_EMBED')) {
4403
- spaceTrim__default["default"]((block) => `
4402
+ spacetrim.spaceTrim((block) => `
4404
4403
  Embedding model can not be used in pipeline
4405
4404
 
4406
4405
  ${block(availableVariantsMessage)}
4407
4406
  `);
4408
4407
  }
4409
4408
  else {
4410
- throw new ParseError(spaceTrim__default["default"]((block) => `
4409
+ throw new ParseError(spacetrim.spaceTrim((block) => `
4411
4410
  Unknown model variant in command:
4412
4411
 
4413
4412
  ${block(availableVariantsMessage)}
@@ -4422,7 +4421,7 @@
4422
4421
  };
4423
4422
  }
4424
4423
  else {
4425
- throw new ParseError(spaceTrim__default["default"]((block) => `
4424
+ throw new ParseError(spacetrim.spaceTrim((block) => `
4426
4425
  Unknown model key in command.
4427
4426
 
4428
4427
  Supported model keys are:
@@ -4449,7 +4448,7 @@
4449
4448
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
4450
4449
  }
4451
4450
  else {
4452
- throw new ParseError(spaceTrim__default["default"](`
4451
+ throw new ParseError(spacetrim.spaceTrim(`
4453
4452
  Redefinition of \`MODEL ${command.key}\` in the pipeline head
4454
4453
 
4455
4454
  You have used:
@@ -4477,7 +4476,7 @@
4477
4476
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
4478
4477
  }
4479
4478
  else {
4480
- throw new ParseError(spaceTrim__default["default"](`
4479
+ throw new ParseError(spacetrim.spaceTrim(`
4481
4480
  Redefinition of MODEL \`${command.key}\` in the task "${$taskJson.title || $taskJson.name}"
4482
4481
 
4483
4482
  You have used:
@@ -4487,7 +4486,7 @@
4487
4486
  }
4488
4487
  }
4489
4488
  if (command.value === ($pipelineJson.defaultModelRequirements || {})[command.key]) {
4490
- console.log(spaceTrim__default["default"](`
4489
+ console.log(spacetrim.spaceTrim(`
4491
4490
  Setting MODEL \`${command.key}\` in the task "${$taskJson.title || $taskJson.name}" to the same value as in the pipeline head
4492
4491
 
4493
4492
  In pipeline head:
@@ -4570,7 +4569,7 @@
4570
4569
  // <- TODO: When [🥶] fixed, change to:
4571
4570
  // > const parameterDescriptionRaw = rawArgs.split(parameterNameRaw).join('').trim();
4572
4571
  if (parameterDescriptionRaw && parameterDescriptionRaw.match(/\{(?<embeddedParameterName>[a-z0-9_]+)\}/im)) {
4573
- throw new ParseError(spaceTrim__default["default"]((block) => `
4572
+ throw new ParseError(spacetrim.spaceTrim((block) => `
4574
4573
  Parameter \`{${parameterNameRaw}}\` can not contain another parameter in description
4575
4574
 
4576
4575
  The description:
@@ -4752,7 +4751,7 @@
4752
4751
  persona.description = personaDescription;
4753
4752
  return;
4754
4753
  }
4755
- console.warn(spaceTrim__default["default"](`
4754
+ console.warn(spacetrim.spaceTrim(`
4756
4755
 
4757
4756
  Persona "${personaName}" is defined multiple times with different description:
4758
4757
 
@@ -4763,7 +4762,7 @@
4763
4762
  ${personaDescription}
4764
4763
 
4765
4764
  `));
4766
- persona.description += spaceTrim__default["default"]('\n\n' + personaDescription);
4765
+ persona.description += spacetrim.spaceTrim('\n\n' + personaDescription);
4767
4766
  }
4768
4767
 
4769
4768
  /**
@@ -5161,7 +5160,7 @@
5161
5160
  function getParserForCommand(command) {
5162
5161
  const commandParser = COMMANDS.find((commandParser) => commandParser.name === command.type);
5163
5162
  if (commandParser === undefined) {
5164
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
5163
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
5165
5164
  Command ${command.type} parser is not found
5166
5165
 
5167
5166
  ${block(JSON.stringify(command, null, 4)
@@ -5237,7 +5236,7 @@
5237
5236
  .map(removeMarkdownFormatting)
5238
5237
  .map((item) => item.trim());
5239
5238
  if (items.length === 0 || items[0] === '') {
5240
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
5239
+ throw new ParseError(spacetrim.spaceTrim((block) => `
5241
5240
  Malformed command:
5242
5241
  - ${raw}
5243
5242
 
@@ -5273,7 +5272,7 @@
5273
5272
  return command;
5274
5273
  }
5275
5274
  }
5276
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
5275
+ throw new ParseError(spacetrim.spaceTrim((block) => `
5277
5276
  Malformed or unknown command:
5278
5277
  - ${raw}
5279
5278
 
@@ -5324,7 +5323,7 @@
5324
5323
  if (!(error instanceof ParseError)) {
5325
5324
  throw error;
5326
5325
  }
5327
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
5326
+ throw new ParseError(spacetrim.spaceTrim((block) => `
5328
5327
  Invalid ${commandName} command:
5329
5328
 
5330
5329
  Your command:
@@ -5686,7 +5685,7 @@
5686
5685
  * @public exported from `@promptbook/markdown-utils`
5687
5686
  */
5688
5687
  function removeMarkdownComments(content) {
5689
- return spaceTrim$1.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
5688
+ return spacetrim.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
5690
5689
  }
5691
5690
 
5692
5691
  /**
@@ -5697,7 +5696,7 @@
5697
5696
  */
5698
5697
  function isFlatPipeline(pipelineString) {
5699
5698
  pipelineString = removeMarkdownComments(pipelineString);
5700
- pipelineString = spaceTrim__default["default"](pipelineString);
5699
+ pipelineString = spacetrim.spaceTrim(pipelineString);
5701
5700
  const isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
5702
5701
  //const isLastLineReturnStatement = pipelineString.split(/\r?\n/).pop()!.split('`').join('').startsWith('->');
5703
5702
  const isBacktickBlockUsed = pipelineString.includes('```');
@@ -5723,7 +5722,7 @@
5723
5722
  if (!isFlatPipeline(pipelineString)) {
5724
5723
  return pipelineString;
5725
5724
  }
5726
- pipelineString = spaceTrim__default["default"](pipelineString);
5725
+ pipelineString = spacetrim.spaceTrim(pipelineString);
5727
5726
  const pipelineStringLines = pipelineString.split(/\r?\n/);
5728
5727
  const potentialReturnStatement = pipelineStringLines.pop();
5729
5728
  let returnStatement;
@@ -5736,19 +5735,19 @@
5736
5735
  returnStatement = `-> {${DEFAULT_BOOK_OUTPUT_PARAMETER_NAME}}`;
5737
5736
  pipelineStringLines.push(potentialReturnStatement);
5738
5737
  }
5739
- const prompt = spaceTrim__default["default"](pipelineStringLines.join('\n'));
5738
+ const prompt = spacetrim.spaceTrim(pipelineStringLines.join('\n'));
5740
5739
  let quotedPrompt;
5741
5740
  if (prompt.split(/\r?\n/).length <= 1) {
5742
5741
  quotedPrompt = `> ${prompt}`;
5743
5742
  }
5744
5743
  else {
5745
- quotedPrompt = spaceTrim__default["default"]((block) => `
5744
+ quotedPrompt = spacetrim.spaceTrim((block) => `
5746
5745
  \`\`\`
5747
5746
  ${block(prompt.split('`').join('\\`'))}
5748
5747
  \`\`\`
5749
5748
  `);
5750
5749
  }
5751
- pipelineString = validatePipelineString(spaceTrim__default["default"]((block) => `
5750
+ pipelineString = validatePipelineString(spacetrim.spaceTrim((block) => `
5752
5751
  # ${DEFAULT_BOOK_TITLE}
5753
5752
 
5754
5753
  ## Prompt
@@ -5889,7 +5888,7 @@
5889
5888
  function extractOneBlockFromMarkdown(markdown) {
5890
5889
  const codeBlocks = extractAllBlocksFromMarkdown(markdown);
5891
5890
  if (codeBlocks.length !== 1) {
5892
- throw new ParseError(spaceTrim__default["default"]((block) => `
5891
+ throw new ParseError(spacetrim.spaceTrim((block) => `
5893
5892
  There should be exactly 1 code block in task section, found ${codeBlocks.length} code blocks
5894
5893
 
5895
5894
  ${block(codeBlocks.map((block, i) => `Block ${i + 1}:\n${block.content}`).join('\n\n\n'))}
@@ -5914,7 +5913,7 @@
5914
5913
  }
5915
5914
  const title = lines[0].replace(/^#+\s*/, '');
5916
5915
  const level = (_b = (_a = lines[0].match(/^#+/)) === null || _a === void 0 ? void 0 : _a[0].length) !== null && _b !== void 0 ? _b : 0;
5917
- const content = spaceTrim__default["default"](lines.slice(1).join('\n'));
5916
+ const content = spacetrim.spaceTrim(lines.slice(1).join('\n'));
5918
5917
  if (level < 1 || level > 6) {
5919
5918
  throw new ParseError('Markdown section must have heading level between 1 and 6');
5920
5919
  }
@@ -5942,7 +5941,7 @@
5942
5941
  if (buffer.length === 0) {
5943
5942
  return;
5944
5943
  }
5945
- let section = spaceTrim__default["default"](buffer.join('\n'));
5944
+ let section = spacetrim.spaceTrim(buffer.join('\n'));
5946
5945
  if (section === '') {
5947
5946
  return;
5948
5947
  }
@@ -6017,7 +6016,7 @@
6017
6016
  flattenedMarkdown += `## ${title}` + `\n\n`;
6018
6017
  flattenedMarkdown += content + `\n\n`; // <- [🧠] Maybe 3 new lines?
6019
6018
  }
6020
- return spaceTrim__default["default"](flattenedMarkdown);
6019
+ return spacetrim.spaceTrim(flattenedMarkdown);
6021
6020
  }
6022
6021
  /**
6023
6022
  * TODO: [🏛] This can be part of markdown builder
@@ -6105,7 +6104,7 @@
6105
6104
  }
6106
6105
  catch (error) {
6107
6106
  assertsError(error);
6108
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
6107
+ throw new ParseError(spacetrim.spaceTrim((block) => `
6109
6108
  Can not extract variables from the script
6110
6109
  ${block(error.stack || error.message)}
6111
6110
 
@@ -6247,7 +6246,7 @@
6247
6246
  if (pipelineString.startsWith('#!')) {
6248
6247
  const [shebangLine, ...restLines] = pipelineString.split(/\r?\n/);
6249
6248
  if (!(shebangLine || '').includes('ptbk')) {
6250
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
6249
+ throw new ParseError(spacetrim.spaceTrim((block) => `
6251
6250
  It seems that you try to parse a book file which has non-standard shebang line for book files:
6252
6251
  Shebang line must contain 'ptbk'
6253
6252
 
@@ -6263,7 +6262,7 @@
6263
6262
  pipelineString = validatePipelineString(restLines.join('\n'));
6264
6263
  }
6265
6264
  pipelineString = removeMarkdownComments(pipelineString);
6266
- pipelineString = spaceTrim$1.spaceTrim(pipelineString);
6265
+ pipelineString = spacetrim.spaceTrim(pipelineString);
6267
6266
  // <- TODO: [😧] `spaceTrim` should preserve discriminated type *(or at lease `PipelineString`)*
6268
6267
  pipelineString = deflatePipeline(pipelineString);
6269
6268
  // ==============
@@ -6275,7 +6274,7 @@
6275
6274
  // ==============
6276
6275
  // Note: 1️⃣◽4️⃣ Check markdown structure
6277
6276
  if (pipelineHead === undefined) {
6278
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6277
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
6279
6278
  Pipeline head is not defined
6280
6279
 
6281
6280
  ${block(getPipelineIdentification())}
@@ -6284,7 +6283,7 @@
6284
6283
  `));
6285
6284
  }
6286
6285
  if (pipelineHead.level !== 1) {
6287
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6286
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
6288
6287
  Pipeline head is not h1
6289
6288
 
6290
6289
  ${block(getPipelineIdentification())}
@@ -6293,7 +6292,7 @@
6293
6292
  `));
6294
6293
  }
6295
6294
  if (!pipelineSections.every((section) => section.level === 2)) {
6296
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6295
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
6297
6296
  Not every pipeline section is h2
6298
6297
 
6299
6298
  ${block(getPipelineIdentification())}
@@ -6306,7 +6305,7 @@
6306
6305
  const defineParam = (parameterCommand) => {
6307
6306
  const { parameterName, parameterDescription, isInput, isOutput } = parameterCommand;
6308
6307
  if (RESERVED_PARAMETER_NAMES.includes(parameterName)) {
6309
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
6308
+ throw new ParseError(spacetrim.spaceTrim((block) => `
6310
6309
  Parameter name {${parameterName}} is reserved and cannot be used as resulting parameter name
6311
6310
 
6312
6311
  ${block(getPipelineIdentification())}
@@ -6317,7 +6316,7 @@
6317
6316
  existingParameter.description &&
6318
6317
  existingParameter.description !== parameterDescription &&
6319
6318
  parameterDescription) {
6320
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
6319
+ throw new ParseError(spacetrim.spaceTrim((block) => `
6321
6320
  Parameter \`{${parameterName}}\` is defined multiple times with different description:
6322
6321
 
6323
6322
  ${block(getPipelineIdentification())}
@@ -6355,7 +6354,7 @@
6355
6354
  description = description.split(/^>.*$/gm).join('');
6356
6355
  //Note: Remove lists and return statement - TODO: [🎾] Make util (exported from `@promptbool/utils`)
6357
6356
  description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
6358
- description = spaceTrim$1.spaceTrim(description);
6357
+ description = spacetrim.spaceTrim(description);
6359
6358
  if (description === '') {
6360
6359
  description = undefined;
6361
6360
  }
@@ -6366,7 +6365,7 @@
6366
6365
  const command = parseCommand(listItem, 'PIPELINE_HEAD');
6367
6366
  const commandParser = getParserForCommand(command);
6368
6367
  if (commandParser.isUsedInPipelineHead !== true /* <- Note: [🦦][4] */) {
6369
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
6368
+ throw new ParseError(spacetrim.spaceTrim((block) => `
6370
6369
  Command \`${command.type}\` is not allowed in the head of the pipeline ONLY at the pipeline task
6371
6370
 
6372
6371
  ${block(getPipelineIdentification())}
@@ -6380,7 +6379,7 @@
6380
6379
  if (!(error instanceof ParseError)) {
6381
6380
  throw error;
6382
6381
  }
6383
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
6382
+ throw new ParseError(spacetrim.spaceTrim((block) => `
6384
6383
  Command ${command.type} failed to apply to the pipeline
6385
6384
 
6386
6385
  The error:
@@ -6433,7 +6432,7 @@
6433
6432
  description = description.split(/^>.*$/gm).join('');
6434
6433
  //Note: Remove lists and return statement - TODO: [🎾]
6435
6434
  description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
6436
- description = spaceTrim$1.spaceTrim(description);
6435
+ description = spacetrim.spaceTrim(description);
6437
6436
  if (description === '') {
6438
6437
  description = undefined;
6439
6438
  }
@@ -6467,7 +6466,7 @@
6467
6466
  for (const { listItem, command } of commands) {
6468
6467
  const commandParser = getParserForCommand(command);
6469
6468
  if (commandParser.isUsedInPipelineTask !== true /* <- Note: [🦦][4] */) {
6470
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
6469
+ throw new ParseError(spacetrim.spaceTrim((block) => `
6471
6470
  Command \`${command.type}\` is not allowed in the task of the promptbook ONLY at the pipeline head
6472
6471
 
6473
6472
  ${block(getPipelineIdentification())}
@@ -6482,7 +6481,7 @@
6482
6481
  if (!(error instanceof ParseError)) {
6483
6482
  throw error;
6484
6483
  }
6485
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
6484
+ throw new ParseError(spacetrim.spaceTrim((block) => `
6486
6485
  Command \`${command.type}\` failed to apply to the task
6487
6486
 
6488
6487
  The error:
@@ -6513,14 +6512,14 @@
6513
6512
  // TODO: [🍧] Should be done in SECTION command
6514
6513
  if ($taskJson.taskType === 'SCRIPT_TASK') {
6515
6514
  if (!language) {
6516
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
6515
+ throw new ParseError(spacetrim.spaceTrim((block) => `
6517
6516
  You must specify the language of the script in the \`SCRIPT\` task
6518
6517
 
6519
6518
  ${block(getPipelineIdentification())}
6520
6519
  `));
6521
6520
  }
6522
6521
  if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
6523
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
6522
+ throw new ParseError(spacetrim.spaceTrim((block) => `
6524
6523
  Script language ${language} is not supported.
6525
6524
 
6526
6525
  Supported languages are: