@promptbook/core 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 +179 -179
  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 +379 -380
  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,13 +1,12 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('crypto-js'), require('crypto-js/enc-hex'), require('spacetrim'), require('crypto'), require('rxjs'), require('waitasecond'), require('crypto-js/sha256'), require('path'), require('mime-types'), require('papaparse'), require('moment'), require('colors'), require('@openai/agents'), require('bottleneck'), require('openai')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', 'crypto-js', 'crypto-js/enc-hex', 'spacetrim', 'crypto', 'rxjs', 'waitasecond', 'crypto-js/sha256', 'path', 'mime-types', 'papaparse', 'moment', 'colors', '@openai/agents', 'bottleneck', 'openai'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-core"] = {}, global.cryptoJs, global.hexEncoder, global.spaceTrim$1, global.crypto, global.rxjs, global.waitasecond, global.sha256, global.path, global.mimeTypes, global.papaparse, global.moment, global.colors, global.agents, global.Bottleneck, global.OpenAI));
5
- })(this, (function (exports, cryptoJs, hexEncoder, spaceTrim$1, crypto, rxjs, waitasecond, sha256, path, mimeTypes, papaparse, moment, colors, agents, Bottleneck, OpenAI) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-core"] = {}, global.cryptoJs, global.hexEncoder, global.spacetrim, global.crypto, global.rxjs, global.waitasecond, global.sha256, global.path, global.mimeTypes, global.papaparse, global.moment, global.colors, global.agents, global.Bottleneck, global.OpenAI));
5
+ })(this, (function (exports, cryptoJs, hexEncoder, spacetrim, crypto, rxjs, waitasecond, sha256, path, mimeTypes, papaparse, moment, colors, agents, Bottleneck, OpenAI) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
9
  var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
10
- var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
11
10
  var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
12
11
  var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
13
12
  var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
@@ -28,7 +27,7 @@
28
27
  * @generated
29
28
  * @see https://github.com/webgptorg/promptbook
30
29
  */
31
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-13';
30
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-16';
32
31
  /**
33
32
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
34
33
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -43,7 +42,7 @@
43
42
  * @public exported from `@promptbook/utils`
44
43
  * @see https://github.com/hejny/spacetrim#usage
45
44
  */
46
- const spaceTrim = spaceTrim$1.spaceTrim;
45
+ const spaceTrim = spacetrim.spaceTrim;
47
46
 
48
47
  /**
49
48
  * @private util of `@promptbook/color`
@@ -1353,7 +1352,7 @@
1353
1352
  function getErrorReportUrl(error) {
1354
1353
  const report = {
1355
1354
  title: `🐜 Error report from ${NAME}`,
1356
- body: spaceTrim__default["default"]((block) => `
1355
+ body: spacetrim.spaceTrim((block) => `
1357
1356
 
1358
1357
 
1359
1358
  \`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
@@ -1396,7 +1395,7 @@
1396
1395
  */
1397
1396
  class UnexpectedError extends Error {
1398
1397
  constructor(message) {
1399
- super(spaceTrim$1.spaceTrim((block) => `
1398
+ super(spacetrim.spaceTrim((block) => `
1400
1399
  ${block(message)}
1401
1400
 
1402
1401
  Note: This error should not happen.
@@ -1422,7 +1421,7 @@
1422
1421
  constructor(whatWasThrown) {
1423
1422
  const tag = `[🤮]`;
1424
1423
  console.error(tag, whatWasThrown);
1425
- super(spaceTrim$1.spaceTrim(`
1424
+ super(spacetrim.spaceTrim(`
1426
1425
  Non-Error object was thrown
1427
1426
 
1428
1427
  Note: Look for ${tag} in the console for more details
@@ -1548,7 +1547,7 @@
1548
1547
  * @public exported from `@promptbook/utils`
1549
1548
  */
1550
1549
  function computeHash(value) {
1551
- return cryptoJs.SHA256(hexEncoder__default["default"].parse(spaceTrim__default["default"](valueToString(value)))).toString( /* hex */);
1550
+ return cryptoJs.SHA256(hexEncoder__default["default"].parse(spacetrim.spaceTrim(valueToString(value)))).toString( /* hex */);
1552
1551
  }
1553
1552
  /**
1554
1553
  * TODO: [🥬][🥬] Use this ACRY
@@ -1870,7 +1869,7 @@
1870
1869
  pipelineString += '\n\n';
1871
1870
  pipelineString += '```' + contentLanguage;
1872
1871
  pipelineString += '\n';
1873
- pipelineString += spaceTrim__default["default"](content);
1872
+ pipelineString += spacetrim.spaceTrim(content);
1874
1873
  // <- TODO: [main] !!3 Escape
1875
1874
  // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
1876
1875
  pipelineString += '\n';
@@ -1991,7 +1990,7 @@
1991
1990
  }
1992
1991
  else if (typeof value === 'object') {
1993
1992
  if (value instanceof Date) {
1994
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
1993
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
1995
1994
  \`${name}\` is Date
1996
1995
 
1997
1996
  Use \`string_date_iso8601\` instead
@@ -2010,7 +2009,7 @@
2010
2009
  throw new UnexpectedError(`${name} is RegExp`);
2011
2010
  }
2012
2011
  else if (value instanceof Error) {
2013
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
2012
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
2014
2013
  \`${name}\` is unserialized Error
2015
2014
 
2016
2015
  Use function \`serializeError\`
@@ -2033,7 +2032,7 @@
2033
2032
  }
2034
2033
  catch (error) {
2035
2034
  assertsError(error);
2036
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
2035
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
2037
2036
  \`${name}\` is not serializable
2038
2037
 
2039
2038
  ${block(error.stack || error.message)}
@@ -2065,7 +2064,7 @@
2065
2064
  }
2066
2065
  }
2067
2066
  else {
2068
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
2067
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
2069
2068
  \`${name}\` is unknown type
2070
2069
 
2071
2070
  Additional message for \`${name}\`:
@@ -2497,7 +2496,7 @@
2497
2496
  if (!(error instanceof PipelineLogicError)) {
2498
2497
  throw error;
2499
2498
  }
2500
- console.error(spaceTrim$1.spaceTrim((block) => `
2499
+ console.error(spacetrim.spaceTrim((block) => `
2501
2500
  Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
2502
2501
 
2503
2502
  ${block(error.message)}
@@ -2524,7 +2523,7 @@
2524
2523
  })();
2525
2524
  if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
2526
2525
  // <- Note: [🚲]
2527
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2526
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
2528
2527
  Invalid promptbook URL "${pipeline.pipelineUrl}"
2529
2528
 
2530
2529
  ${block(pipelineIdentification)}
@@ -2532,7 +2531,7 @@
2532
2531
  }
2533
2532
  if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
2534
2533
  // <- Note: [🚲]
2535
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2534
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
2536
2535
  Invalid Promptbook Version "${pipeline.bookVersion}"
2537
2536
 
2538
2537
  ${block(pipelineIdentification)}
@@ -2541,7 +2540,7 @@
2541
2540
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2542
2541
  if (!Array.isArray(pipeline.parameters)) {
2543
2542
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2544
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
2543
+ throw new ParseError(spacetrim.spaceTrim((block) => `
2545
2544
  Pipeline is valid JSON but with wrong structure
2546
2545
 
2547
2546
  \`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
@@ -2552,7 +2551,7 @@
2552
2551
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2553
2552
  if (!Array.isArray(pipeline.tasks)) {
2554
2553
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2555
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
2554
+ throw new ParseError(spacetrim.spaceTrim((block) => `
2556
2555
  Pipeline is valid JSON but with wrong structure
2557
2556
 
2558
2557
  \`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
@@ -2578,7 +2577,7 @@
2578
2577
  // Note: Check each parameter individually
2579
2578
  for (const parameter of pipeline.parameters) {
2580
2579
  if (parameter.isInput && parameter.isOutput) {
2581
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2580
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
2582
2581
 
2583
2582
  Parameter \`{${parameter.name}}\` can not be both input and output
2584
2583
 
@@ -2589,7 +2588,7 @@
2589
2588
  if (!parameter.isInput &&
2590
2589
  !parameter.isOutput &&
2591
2590
  !pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
2592
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2591
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
2593
2592
  Parameter \`{${parameter.name}}\` is created but not used
2594
2593
 
2595
2594
  You can declare {${parameter.name}} as output parameter by adding in the header:
@@ -2601,7 +2600,7 @@
2601
2600
  }
2602
2601
  // Note: Testing that parameter is either input or result of some task
2603
2602
  if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
2604
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2603
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
2605
2604
  Parameter \`{${parameter.name}}\` is declared but not defined
2606
2605
 
2607
2606
  You can do one of these:
@@ -2617,14 +2616,14 @@
2617
2616
  // Note: Checking each task individually
2618
2617
  for (const task of pipeline.tasks) {
2619
2618
  if (definedParameters.has(task.resultingParameterName)) {
2620
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2619
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
2621
2620
  Parameter \`{${task.resultingParameterName}}\` is defined multiple times
2622
2621
 
2623
2622
  ${block(pipelineIdentification)}
2624
2623
  `));
2625
2624
  }
2626
2625
  if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
2627
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2626
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
2628
2627
  Parameter name {${task.resultingParameterName}} is reserved, please use different name
2629
2628
 
2630
2629
  ${block(pipelineIdentification)}
@@ -2634,7 +2633,7 @@
2634
2633
  if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
2635
2634
  if (!task.format &&
2636
2635
  !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
2637
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2636
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
2638
2637
  Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
2639
2638
 
2640
2639
  ${block(pipelineIdentification)}
@@ -2642,7 +2641,7 @@
2642
2641
  }
2643
2642
  for (const joker of task.jokerParameterNames) {
2644
2643
  if (!task.dependentParameterNames.includes(joker)) {
2645
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2644
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
2646
2645
  Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
2647
2646
 
2648
2647
  ${block(pipelineIdentification)}
@@ -2653,21 +2652,21 @@
2653
2652
  if (task.expectations) {
2654
2653
  for (const [unit, { min, max }] of Object.entries(task.expectations)) {
2655
2654
  if (min !== undefined && max !== undefined && min > max) {
2656
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2655
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
2657
2656
  Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
2658
2657
 
2659
2658
  ${block(pipelineIdentification)}
2660
2659
  `));
2661
2660
  }
2662
2661
  if (min !== undefined && min < 0) {
2663
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2662
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
2664
2663
  Min expectation of ${unit} must be zero or positive
2665
2664
 
2666
2665
  ${block(pipelineIdentification)}
2667
2666
  `));
2668
2667
  }
2669
2668
  if (max !== undefined && max <= 0) {
2670
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2669
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
2671
2670
  Max expectation of ${unit} must be positive
2672
2671
 
2673
2672
  ${block(pipelineIdentification)}
@@ -2689,7 +2688,7 @@
2689
2688
  while (unresovedTasks.length > 0) {
2690
2689
  if (loopLimit-- < 0) {
2691
2690
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
2692
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
2691
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
2693
2692
  Loop limit reached during detection of circular dependencies in \`validatePipeline\`
2694
2693
 
2695
2694
  ${block(pipelineIdentification)}
@@ -2699,7 +2698,7 @@
2699
2698
  if (currentlyResovedTasks.length === 0) {
2700
2699
  throw new PipelineLogicError(
2701
2700
  // TODO: [🐎] DRY
2702
- spaceTrim$1.spaceTrim((block) => `
2701
+ spacetrim.spaceTrim((block) => `
2703
2702
 
2704
2703
  Can not resolve some parameters:
2705
2704
  Either you are using a parameter that is not defined, or there are some circular dependencies.
@@ -2863,7 +2862,7 @@
2863
2862
  for (const pipeline of pipelines) {
2864
2863
  // TODO: [👠] DRY
2865
2864
  if (pipeline.pipelineUrl === undefined) {
2866
- throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
2865
+ throw new PipelineUrlError(spacetrim.spaceTrim(`
2867
2866
  Pipeline with name "${pipeline.title}" does not have defined URL
2868
2867
 
2869
2868
  File:
@@ -2885,7 +2884,7 @@
2885
2884
  pipelineJsonToString(unpreparePipeline(pipeline)) !==
2886
2885
  pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
2887
2886
  const existing = this.collection.get(pipeline.pipelineUrl);
2888
- throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
2887
+ throw new PipelineUrlError(spacetrim.spaceTrim(`
2889
2888
  Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
2890
2889
 
2891
2890
  Conflicting files:
@@ -2917,13 +2916,13 @@
2917
2916
  const pipeline = this.collection.get(url);
2918
2917
  if (!pipeline) {
2919
2918
  if (this.listPipelines().length === 0) {
2920
- throw new NotFoundError(spaceTrim$1.spaceTrim(`
2919
+ throw new NotFoundError(spacetrim.spaceTrim(`
2921
2920
  Pipeline with url "${url}" not found
2922
2921
 
2923
2922
  No pipelines available
2924
2923
  `));
2925
2924
  }
2926
- throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
2925
+ throw new NotFoundError(spacetrim.spaceTrim((block) => `
2927
2926
  Pipeline with url "${url}" not found
2928
2927
 
2929
2928
  Available pipelines:
@@ -2964,7 +2963,7 @@
2964
2963
  */
2965
2964
  class MissingToolsError extends Error {
2966
2965
  constructor(message) {
2967
- super(spaceTrim$1.spaceTrim((block) => `
2966
+ super(spacetrim.spaceTrim((block) => `
2968
2967
  ${block(message)}
2969
2968
 
2970
2969
  Note: You have probably forgot to provide some tools for pipeline execution or preparation
@@ -3175,7 +3174,7 @@
3175
3174
  */
3176
3175
  class NotYetImplementedError extends Error {
3177
3176
  constructor(message) {
3178
- super(spaceTrim$1.spaceTrim((block) => `
3177
+ super(spacetrim.spaceTrim((block) => `
3179
3178
  ${block(message)}
3180
3179
 
3181
3180
  Note: This feature is not implemented yet but it will be soon.
@@ -3314,7 +3313,7 @@
3314
3313
  const { name, message, stack } = error;
3315
3314
  const { id } = error;
3316
3315
  if (!Object.keys(ALL_ERRORS).includes(name)) {
3317
- console.error(spaceTrim__default["default"]((block) => `
3316
+ console.error(spacetrim.spaceTrim((block) => `
3318
3317
 
3319
3318
  Cannot serialize error with name "${name}"
3320
3319
 
@@ -3347,7 +3346,7 @@
3347
3346
  }
3348
3347
  else if (typeof value !== 'string') {
3349
3348
  console.error('Can not parse JSON from non-string value.', { text: value });
3350
- throw new Error(spaceTrim__default["default"](`
3349
+ throw new Error(spacetrim.spaceTrim(`
3351
3350
  Can not parse JSON from non-string value.
3352
3351
 
3353
3352
  The value type: ${typeof value}
@@ -3361,7 +3360,7 @@
3361
3360
  if (!(error instanceof Error)) {
3362
3361
  throw error;
3363
3362
  }
3364
- throw new Error(spaceTrim__default["default"]((block) => `
3363
+ throw new Error(spacetrim.spaceTrim((block) => `
3365
3364
  ${block(error.message)}
3366
3365
 
3367
3366
  The expected JSON text:
@@ -3414,7 +3413,7 @@
3414
3413
  message = `${name}: ${message}`;
3415
3414
  }
3416
3415
  if (isStackAddedToMessage && stack !== undefined && stack !== '') {
3417
- message = spaceTrim__default["default"]((block) => `
3416
+ message = spacetrim.spaceTrim((block) => `
3418
3417
  ${block(message)}
3419
3418
 
3420
3419
  Original stack trace:
@@ -3451,11 +3450,11 @@
3451
3450
  throw deserializeError(errors[0]);
3452
3451
  }
3453
3452
  else {
3454
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
3453
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
3455
3454
  Multiple errors occurred during Promptbook execution
3456
3455
 
3457
3456
  ${block(errors
3458
- .map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
3457
+ .map(({ name, stack, message }, index) => spacetrim.spaceTrim((block) => `
3459
3458
  ${name} ${index + 1}:
3460
3459
  ${block(stack || message)}
3461
3460
  `))
@@ -3964,14 +3963,14 @@
3964
3963
  if (description === undefined) {
3965
3964
  return headLine;
3966
3965
  }
3967
- return spaceTrim__default["default"]((block) => `
3966
+ return spacetrim.spaceTrim((block) => `
3968
3967
  ${headLine}
3969
3968
 
3970
3969
  ${ /* <- Note: Indenting the description: */block(description)}
3971
3970
  `);
3972
3971
  })
3973
3972
  .join('\n\n');
3974
- return spaceTrim__default["default"]((block) => `
3973
+ return spacetrim.spaceTrim((block) => `
3975
3974
  Multiple LLM Providers:
3976
3975
 
3977
3976
  ${block(innerModelsTitlesAndDescriptions)}
@@ -4073,7 +4072,7 @@
4073
4072
  // 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
4074
4073
  // 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
4075
4074
  // 3) ...
4076
- spaceTrim__default["default"]((block) => `
4075
+ spacetrim.spaceTrim((block) => `
4077
4076
  All execution tools of ${this.title} failed:
4078
4077
 
4079
4078
  ${block(errors
@@ -4086,7 +4085,7 @@
4086
4085
  throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
4087
4086
  }
4088
4087
  else {
4089
- throw new PipelineExecutionError(spaceTrim__default["default"]((block) => `
4088
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
4090
4089
  You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
4091
4090
 
4092
4091
  Available \`LlmExecutionTools\`:
@@ -4123,7 +4122,7 @@
4123
4122
  */
4124
4123
  function joinLlmExecutionTools(title, ...llmExecutionTools) {
4125
4124
  if (llmExecutionTools.length === 0) {
4126
- const warningMessage = spaceTrim__default["default"](`
4125
+ const warningMessage = spacetrim.spaceTrim(`
4127
4126
  You have not provided any \`LlmExecutionTools\`
4128
4127
  This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.
4129
4128
 
@@ -4378,14 +4377,14 @@
4378
4377
  return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
4379
4378
  });
4380
4379
  if (metadata.length === 0) {
4381
- return spaceTrim__default["default"](`
4380
+ return spacetrim.spaceTrim(`
4382
4381
  **No scrapers are available**
4383
4382
 
4384
4383
  This is a unexpected behavior, you are probably using some broken version of Promptbook
4385
4384
  At least there should be available the metadata of the scrapers
4386
4385
  `);
4387
4386
  }
4388
- return spaceTrim__default["default"]((block) => `
4387
+ return spacetrim.spaceTrim((block) => `
4389
4388
  Available scrapers are:
4390
4389
  ${block(metadata
4391
4390
  .map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
@@ -4891,7 +4890,7 @@
4891
4890
  else if (urlOrRequest instanceof Request) {
4892
4891
  url = urlOrRequest.url;
4893
4892
  }
4894
- throw new PromptbookFetchError(spaceTrim__default["default"]((block) => `
4893
+ throw new PromptbookFetchError(spacetrim.spaceTrim((block) => `
4895
4894
  Can not fetch "${url}"
4896
4895
 
4897
4896
  Fetch error:
@@ -5051,7 +5050,7 @@
5051
5050
  const fileExtension = getFileExtension(filename);
5052
5051
  const mimeType = extensionToMimeType(fileExtension || '');
5053
5052
  if (!(await isFileExisting(filename, tools.fs))) {
5054
- throw new NotFoundError(spaceTrim__default["default"]((block) => `
5053
+ throw new NotFoundError(spacetrim.spaceTrim((block) => `
5055
5054
  Can not make source handler for file which does not exist:
5056
5055
 
5057
5056
  File:
@@ -5144,7 +5143,7 @@
5144
5143
  // <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
5145
5144
  break;
5146
5145
  }
5147
- console.warn(spaceTrim__default["default"]((block) => `
5146
+ console.warn(spacetrim.spaceTrim((block) => `
5148
5147
  Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
5149
5148
 
5150
5149
  The source:
@@ -5160,7 +5159,7 @@
5160
5159
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
5161
5160
  }
5162
5161
  if (partialPieces === null) {
5163
- throw new KnowledgeScrapeError(spaceTrim__default["default"]((block) => `
5162
+ throw new KnowledgeScrapeError(spacetrim.spaceTrim((block) => `
5164
5163
  Cannot scrape knowledge
5165
5164
 
5166
5165
  The source:
@@ -5239,7 +5238,7 @@
5239
5238
  if (task.taskType === 'PROMPT_TASK' &&
5240
5239
  knowledgePiecesCount > 0 &&
5241
5240
  !dependentParameterNames.includes('knowledge')) {
5242
- preparedContent = spaceTrim$1.spaceTrim(`
5241
+ preparedContent = spacetrim.spaceTrim(`
5243
5242
  {content}
5244
5243
 
5245
5244
  ## Knowledge
@@ -5471,7 +5470,7 @@
5471
5470
  }
5472
5471
  catch (error) {
5473
5472
  assertsError(error);
5474
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
5473
+ throw new ParseError(spacetrim.spaceTrim((block) => `
5475
5474
  Can not extract variables from the script
5476
5475
  ${block(error.stack || error.message)}
5477
5476
 
@@ -5654,7 +5653,7 @@
5654
5653
  const { value, outputParameterName, settings, mapCallback, onProgress } = options;
5655
5654
  const csv = csvParse(value, settings);
5656
5655
  if (csv.errors.length !== 0) {
5657
- throw new CsvFormatError(spaceTrim__default["default"]((block) => `
5656
+ throw new CsvFormatError(spacetrim.spaceTrim((block) => `
5658
5657
  CSV parsing error
5659
5658
 
5660
5659
  Error(s) from CSV parsing:
@@ -5699,7 +5698,7 @@
5699
5698
  const { value, settings, mapCallback, onProgress } = options;
5700
5699
  const csv = csvParse(value, settings);
5701
5700
  if (csv.errors.length !== 0) {
5702
- throw new CsvFormatError(spaceTrim__default["default"]((block) => `
5701
+ throw new CsvFormatError(spacetrim.spaceTrim((block) => `
5703
5702
  CSV parsing error
5704
5703
 
5705
5704
  Error(s) from CSV parsing:
@@ -5909,7 +5908,7 @@
5909
5908
  }
5910
5909
  // Phase 2️⃣: Non-matching mapping
5911
5910
  if (expectedParameterNames.size !== availableParametersNames.size) {
5912
- throw new PipelineExecutionError(spaceTrim__default["default"]((block) => `
5911
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
5913
5912
  Can not map available parameters to expected parameters
5914
5913
 
5915
5914
  Mapped parameters:
@@ -6347,7 +6346,7 @@
6347
6346
  }
6348
6347
  catch (error) {
6349
6348
  keepUnused(error);
6350
- throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
6349
+ throw new ExpectError(spacetrim.spaceTrim((block) => `
6351
6350
  Expected valid JSON string
6352
6351
 
6353
6352
  The expected JSON text:
@@ -6410,7 +6409,7 @@
6410
6409
  const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
6411
6410
  // TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
6412
6411
  if (isJokerAttempt && !jokerParameterName) {
6413
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6412
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
6414
6413
  Joker not found in attempt ${attemptIndex}
6415
6414
 
6416
6415
  ${block(pipelineIdentification)}
@@ -6421,7 +6420,7 @@
6421
6420
  $ongoingTaskResult.$expectError = null;
6422
6421
  if (isJokerAttempt) {
6423
6422
  if (parameters[jokerParameterName] === undefined) {
6424
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6423
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
6425
6424
  Joker parameter {${jokerParameterName}} not defined
6426
6425
 
6427
6426
  ${block(pipelineIdentification)}
@@ -6480,7 +6479,7 @@
6480
6479
  break variant;
6481
6480
  case 'EMBEDDING':
6482
6481
  case 'IMAGE_GENERATION':
6483
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6482
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
6484
6483
  ${modelRequirements.modelVariant} model can not be used in pipeline
6485
6484
 
6486
6485
  This should be catched during parsing
@@ -6491,7 +6490,7 @@
6491
6490
  break variant;
6492
6491
  // <- case [🤖]:
6493
6492
  default:
6494
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6493
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
6495
6494
  Unknown model variant "${task.modelRequirements.modelVariant}"
6496
6495
 
6497
6496
  ${block(pipelineIdentification)}
@@ -6502,14 +6501,14 @@
6502
6501
  break;
6503
6502
  case 'SCRIPT_TASK':
6504
6503
  if (arrayableToArray(tools.script).length === 0) {
6505
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6504
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
6506
6505
  No script execution tools are available
6507
6506
 
6508
6507
  ${block(pipelineIdentification)}
6509
6508
  `));
6510
6509
  }
6511
6510
  if (!task.contentLanguage) {
6512
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6511
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
6513
6512
  Script language is not defined for SCRIPT TASK "${task.name}"
6514
6513
 
6515
6514
  ${block(pipelineIdentification)}
@@ -6540,7 +6539,7 @@
6540
6539
  throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
6541
6540
  }
6542
6541
  else {
6543
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6542
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
6544
6543
  Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
6545
6544
 
6546
6545
  ${block(pipelineIdentification)}
@@ -6554,7 +6553,7 @@
6554
6553
  break taskType;
6555
6554
  case 'DIALOG_TASK':
6556
6555
  if (tools.userInterface === undefined) {
6557
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6556
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
6558
6557
  User interface tools are not available
6559
6558
 
6560
6559
  ${block(pipelineIdentification)}
@@ -6572,7 +6571,7 @@
6572
6571
  break taskType;
6573
6572
  // <- case: [🅱]
6574
6573
  default:
6575
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6574
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
6576
6575
  Unknown execution type "${task.taskType}"
6577
6576
 
6578
6577
  ${block(pipelineIdentification)}
@@ -6670,7 +6669,7 @@
6670
6669
  if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
6671
6670
  // Note: Create a summary of all failures
6672
6671
  const failuresSummary = $ongoingTaskResult.$failedResults
6673
- .map((failure) => spaceTrim$1.spaceTrim((block) => {
6672
+ .map((failure) => spacetrim.spaceTrim((block) => {
6674
6673
  var _a, _b;
6675
6674
  return `
6676
6675
  Attempt ${failure.attemptIndex + 1}:
@@ -6680,14 +6679,14 @@
6680
6679
  Result:
6681
6680
  ${block(failure.result === null
6682
6681
  ? 'null'
6683
- : spaceTrim$1.spaceTrim(failure.result)
6682
+ : spacetrim.spaceTrim(failure.result)
6684
6683
  .split(/\r?\n/)
6685
6684
  .map((line) => `> ${line}`)
6686
6685
  .join('\n'))}
6687
6686
  `;
6688
6687
  }))
6689
6688
  .join('\n\n---\n\n');
6690
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
6689
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => {
6691
6690
  var _a;
6692
6691
  return `
6693
6692
  LLM execution failed ${maxExecutionAttempts}x
@@ -6707,7 +6706,7 @@
6707
6706
  }
6708
6707
  }
6709
6708
  if ($ongoingTaskResult.$resultString === null) {
6710
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6709
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
6711
6710
  Something went wrong and prompt result is null
6712
6711
 
6713
6712
  ${block(pipelineIdentification)}
@@ -6734,7 +6733,7 @@
6734
6733
  return /* not await */ executeAttempts({ ...options, logLlmCall });
6735
6734
  }
6736
6735
  if (jokerParameterNames.length !== 0) {
6737
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
6736
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
6738
6737
  JOKER parameters are not supported together with FOREACH command
6739
6738
 
6740
6739
  [🧞‍♀️] This should be prevented in \`validatePipeline\`
@@ -6747,7 +6746,7 @@
6747
6746
  if (formatDefinition === undefined) {
6748
6747
  throw new UnexpectedError(
6749
6748
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6750
- spaceTrim__default["default"]((block) => `
6749
+ spacetrim.spaceTrim((block) => `
6751
6750
  Unsupported format "${task.foreach.formatName}"
6752
6751
 
6753
6752
  Available formats:
@@ -6764,7 +6763,7 @@
6764
6763
  if (subvalueParser === undefined) {
6765
6764
  throw new UnexpectedError(
6766
6765
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6767
- spaceTrim__default["default"]((block) => `
6766
+ spacetrim.spaceTrim((block) => `
6768
6767
  Unsupported subformat name "${task.foreach.subformatName}" for format "${task.foreach.formatName}"
6769
6768
 
6770
6769
  Available subformat names for format "${formatDefinition.formatName}":
@@ -6804,7 +6803,7 @@
6804
6803
  if (!(error instanceof PipelineExecutionError)) {
6805
6804
  throw error;
6806
6805
  }
6807
- const highLevelError = new PipelineExecutionError(spaceTrim__default["default"]((block) => `
6806
+ const highLevelError = new PipelineExecutionError(spacetrim.spaceTrim((block) => `
6808
6807
  ${error.message}
6809
6808
 
6810
6809
  This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -6828,7 +6827,7 @@
6828
6827
  ...options,
6829
6828
  priority: priority + index,
6830
6829
  parameters: allSubparameters,
6831
- pipelineIdentification: spaceTrim__default["default"]((block) => `
6830
+ pipelineIdentification: spacetrim.spaceTrim((block) => `
6832
6831
  ${block(pipelineIdentification)}
6833
6832
  Subparameter index: ${index}
6834
6833
  `),
@@ -6837,7 +6836,7 @@
6837
6836
  }
6838
6837
  catch (error) {
6839
6838
  if (length > BIG_DATASET_TRESHOLD) {
6840
- console.error(spaceTrim__default["default"]((block) => `
6839
+ console.error(spacetrim.spaceTrim((block) => `
6841
6840
  ${error.message}
6842
6841
 
6843
6842
  This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -7013,7 +7012,7 @@
7013
7012
  // Note: Doublecheck that ALL reserved parameters are defined:
7014
7013
  for (const parameterName of RESERVED_PARAMETER_NAMES) {
7015
7014
  if (reservedParameters[parameterName] === undefined) {
7016
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
7015
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
7017
7016
  Reserved parameter {${parameterName}} is not defined
7018
7017
 
7019
7018
  ${block(pipelineIdentification)}
@@ -7039,7 +7038,7 @@
7039
7038
  const dependentParameterNames = new Set(currentTask.dependentParameterNames);
7040
7039
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
7041
7040
  if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
7042
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
7041
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
7043
7042
  Dependent parameters are not consistent with used parameters:
7044
7043
 
7045
7044
  Dependent parameters:
@@ -7083,7 +7082,7 @@
7083
7082
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
7084
7083
  // Houston, we have a problem
7085
7084
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
7086
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
7085
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
7087
7086
  Parameter \`{${parameterName}}\` is NOT defined
7088
7087
  BUT used in task "${currentTask.title || currentTask.name}"
7089
7088
 
@@ -7152,7 +7151,7 @@
7152
7151
  for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
7153
7152
  if (parametersToPass[parameter.name] === undefined) {
7154
7153
  // [4]
7155
- $warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
7154
+ $warnings.push(new PipelineExecutionError(spacetrim.spaceTrim((block) => `
7156
7155
  Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
7157
7156
 
7158
7157
  Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
@@ -7260,7 +7259,7 @@
7260
7259
  for (const parameterName of Object.keys(inputParameters)) {
7261
7260
  const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
7262
7261
  if (parameter === undefined) {
7263
- warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
7262
+ warnings.push(new PipelineExecutionError(spacetrim.spaceTrim((block) => `
7264
7263
  Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
7265
7264
 
7266
7265
  ${block(pipelineIdentification)}
@@ -7275,7 +7274,7 @@
7275
7274
  // TODO: [🧠] This should be also non-critical error
7276
7275
  return exportJson({
7277
7276
  name: 'pipelineExecutorResult',
7278
- message: spaceTrim$1.spaceTrim((block) => `
7277
+ message: spacetrim.spaceTrim((block) => `
7279
7278
  Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
7280
7279
 
7281
7280
  ${block(pipelineIdentification)}
@@ -7284,7 +7283,7 @@
7284
7283
  value: {
7285
7284
  isSuccessful: false,
7286
7285
  errors: [
7287
- new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
7286
+ new PipelineExecutionError(spacetrim.spaceTrim((block) => `
7288
7287
  Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
7289
7288
 
7290
7289
  ${block(pipelineIdentification)}
@@ -7311,7 +7310,7 @@
7311
7310
  while (unresovedTasks.length > 0) {
7312
7311
  if (loopLimit-- < 0) {
7313
7312
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
7314
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
7313
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
7315
7314
  Loop limit reached during resolving parameters pipeline execution
7316
7315
 
7317
7316
  ${block(pipelineIdentification)}
@@ -7321,7 +7320,7 @@
7321
7320
  if (!currentTask && resolving.length === 0) {
7322
7321
  throw new UnexpectedError(
7323
7322
  // TODO: [🐎] DRY
7324
- spaceTrim$1.spaceTrim((block) => `
7323
+ spacetrim.spaceTrim((block) => `
7325
7324
  Can not resolve some parameters:
7326
7325
 
7327
7326
  ${block(pipelineIdentification)}
@@ -7361,7 +7360,7 @@
7361
7360
  tools,
7362
7361
  onProgress(newOngoingResult) {
7363
7362
  if (isReturned) {
7364
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
7363
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
7365
7364
  Can not call \`onProgress\` after pipeline execution is finished
7366
7365
 
7367
7366
  ${block(pipelineIdentification)}
@@ -7378,7 +7377,7 @@
7378
7377
  },
7379
7378
  logLlmCall,
7380
7379
  $executionReport: executionReport,
7381
- pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
7380
+ pipelineIdentification: spacetrim.spaceTrim((block) => `
7382
7381
  ${block(pipelineIdentification)}
7383
7382
  Task name: ${currentTask.name}
7384
7383
  Task title: ${currentTask.title}
@@ -7487,7 +7486,7 @@
7487
7486
  preparedPipeline = pipeline;
7488
7487
  }
7489
7488
  else if (isNotPreparedWarningSuppressed !== true) {
7490
- console.warn(spaceTrim$1.spaceTrim((block) => `
7489
+ console.warn(spacetrim.spaceTrim((block) => `
7491
7490
  Pipeline is not prepared
7492
7491
 
7493
7492
  ${block(pipelineIdentification)}
@@ -7512,7 +7511,7 @@
7512
7511
  tools,
7513
7512
  onProgress,
7514
7513
  logLlmCall,
7515
- pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
7514
+ pipelineIdentification: spacetrim.spaceTrim((block) => `
7516
7515
  ${block(pipelineIdentification)}
7517
7516
  ${runCount === 1 ? '' : `Run #${runCount}`}
7518
7517
  `),
@@ -7929,7 +7928,7 @@
7929
7928
  * Markdown documentation for ACTION commitment.
7930
7929
  */
7931
7930
  get documentation() {
7932
- return spaceTrim$1.spaceTrim(`
7931
+ return spacetrim.spaceTrim(`
7933
7932
  # ${this.type}
7934
7933
 
7935
7934
  Defines specific actions or capabilities that the agent can perform.
@@ -8016,7 +8015,7 @@
8016
8015
  * Markdown documentation for CLOSED commitment.
8017
8016
  */
8018
8017
  get documentation() {
8019
- return spaceTrim$1.spaceTrim(`
8018
+ return spacetrim.spaceTrim(`
8020
8019
  # CLOSED
8021
8020
 
8022
8021
  Specifies that the agent **cannot** be modified by conversation with it.
@@ -8071,7 +8070,7 @@
8071
8070
  * Markdown documentation for COMPONENT commitment.
8072
8071
  */
8073
8072
  get documentation() {
8074
- return spaceTrim$1.spaceTrim(`
8073
+ return spacetrim.spaceTrim(`
8075
8074
  # COMPONENT
8076
8075
 
8077
8076
  Defines a UI component that the agent can render in the chat.
@@ -8143,7 +8142,7 @@
8143
8142
  * Markdown documentation for DELETE commitment.
8144
8143
  */
8145
8144
  get documentation() {
8146
- return spaceTrim$1.spaceTrim(`
8145
+ return spacetrim.spaceTrim(`
8147
8146
  # DELETE (CANCEL, DISCARD, REMOVE)
8148
8147
 
8149
8148
  A commitment to remove or disregard certain information or context. This can be useful for overriding previous commitments or removing unwanted behaviors.
@@ -8274,7 +8273,7 @@
8274
8273
  * Markdown documentation for DICTIONARY commitment.
8275
8274
  */
8276
8275
  get documentation() {
8277
- return spaceTrim$1.spaceTrim(`
8276
+ return spacetrim.spaceTrim(`
8278
8277
  # DICTIONARY
8279
8278
 
8280
8279
  Defines specific terms and their meanings that the agent should use correctly in reasoning and responses.
@@ -8371,7 +8370,7 @@
8371
8370
  * Markdown documentation for FORMAT commitment.
8372
8371
  */
8373
8372
  get documentation() {
8374
- return spaceTrim$1.spaceTrim(`
8373
+ return spacetrim.spaceTrim(`
8375
8374
  # ${this.type}
8376
8375
 
8377
8376
  Defines the specific output structure and formatting for responses (data formats, templates, structure).
@@ -8536,7 +8535,7 @@
8536
8535
  .filter(([MERMAID_NAME]) => (inputAndIntermediateParametersMermaid + outputParametersMermaid).includes(MERMAID_NAME))
8537
8536
  .map(([MERMAID_NAME, title]) => `${MERMAID_NAME}((${title})):::${MERMAID_NAME}`)
8538
8537
  .join('\n');
8539
- const promptbookMermaid = spaceTrim$1.spaceTrim((block) => `
8538
+ const promptbookMermaid = spacetrim.spaceTrim((block) => `
8540
8539
 
8541
8540
  %% 🔮 Tip: Open this on GitHub or in the VSCode website to see the Mermaid graph visually
8542
8541
 
@@ -8834,7 +8833,7 @@
8834
8833
  const entries = items
8835
8834
  .flatMap((item) => formatParameterListItem(item).split(/\r?\n/))
8836
8835
  .filter((line) => line !== '');
8837
- return spaceTrim__default["default"]((block) => `
8836
+ return spacetrim.spaceTrim((block) => `
8838
8837
  **Parameters:**
8839
8838
  ${block(entries.join('\n'))}
8840
8839
 
@@ -8907,7 +8906,7 @@
8907
8906
  */
8908
8907
  function prompt(strings, ...values) {
8909
8908
  if (values.length === 0) {
8910
- return new PromptString(spaceTrim__default["default"](strings.join('')));
8909
+ return new PromptString(spacetrim.spaceTrim(strings.join('')));
8911
8910
  }
8912
8911
  const stringsWithHiddenParameters = strings.map((stringsItem) => ParameterEscaping.hideBrackets(stringsItem));
8913
8912
  const parameterMetadata = values.map((value) => {
@@ -8948,7 +8947,7 @@
8948
8947
  ? `${result}${stringsItem}`
8949
8948
  : `${result}${stringsItem}${ParameterSection.formatParameterPlaceholder(parameterName)}`;
8950
8949
  }, '');
8951
- pipelineString = spaceTrim__default["default"](pipelineString);
8950
+ pipelineString = spacetrim.spaceTrim(pipelineString);
8952
8951
  try {
8953
8952
  pipelineString = templateParameters(pipelineString, parameters);
8954
8953
  }
@@ -8957,7 +8956,7 @@
8957
8956
  throw error;
8958
8957
  }
8959
8958
  console.error({ pipelineString, parameters, parameterNames: parameterNamesOrdered, error });
8960
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
8959
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
8961
8960
  Internal error in prompt template literal
8962
8961
 
8963
8962
  ${block(JSON.stringify({ strings, values }, null, 4))}}
@@ -10656,7 +10655,7 @@
10656
10655
  * @public exported from `@promptbook/utils`
10657
10656
  */
10658
10657
  function normalizeMessageText(text) {
10659
- return spaceTrim$1.spaceTrim(text);
10658
+ return spacetrim.spaceTrim(text);
10660
10659
  }
10661
10660
 
10662
10661
  /**
@@ -10712,7 +10711,7 @@
10712
10711
  let trimmedText = text;
10713
10712
  // Remove leading and trailing spaces and newlines
10714
10713
  if (isTrimmed) {
10715
- trimmedText = spaceTrim$1.spaceTrim(trimmedText);
10714
+ trimmedText = spacetrim.spaceTrim(trimmedText);
10716
10715
  }
10717
10716
  let processedText = trimmedText;
10718
10717
  // Check for markdown code block
@@ -10731,7 +10730,7 @@
10731
10730
  // Remove the introduce sentence and quotes by replacing it with an empty string
10732
10731
  processedText = processedText.replace(introduceSentenceRegex, '');
10733
10732
  }
10734
- processedText = spaceTrim$1.spaceTrim(processedText);
10733
+ processedText = spacetrim.spaceTrim(processedText);
10735
10734
  // Check again for code block after removing introduce sentence
10736
10735
  const codeBlockMatch2 = processedText.match(codeBlockRegex);
10737
10736
  if (codeBlockMatch2 && codeBlockMatch2[1] !== undefined) {
@@ -11164,7 +11163,7 @@
11164
11163
  * Markdown documentation for FROM commitment.
11165
11164
  */
11166
11165
  get documentation() {
11167
- return spaceTrim$1.spaceTrim(`
11166
+ return spacetrim.spaceTrim(`
11168
11167
  # ${this.type}
11169
11168
 
11170
11169
  Inherits agent source from another agent.
@@ -11191,7 +11190,7 @@
11191
11190
  };
11192
11191
  }
11193
11192
  if (!isValidAgentUrl(trimmedContent)) {
11194
- throw new Error(spaceTrim$1.spaceTrim((block) => `
11193
+ throw new Error(spacetrim.spaceTrim((block) => `
11195
11194
  Invalid agent URL in FROM commitment: "${trimmedContent}"
11196
11195
 
11197
11196
  \`\`\`book
@@ -11248,7 +11247,7 @@
11248
11247
  * Markdown documentation for GOAL commitment.
11249
11248
  */
11250
11249
  get documentation() {
11251
- return spaceTrim$1.spaceTrim(`
11250
+ return spacetrim.spaceTrim(`
11252
11251
  # ${this.type}
11253
11252
 
11254
11253
  Defines the main goal which should be achieved by the AI assistant. There can be multiple goals, and later goals are more important than earlier goals.
@@ -11345,7 +11344,7 @@
11345
11344
  * Markdown documentation for IMPORT commitment.
11346
11345
  */
11347
11346
  get documentation() {
11348
- return spaceTrim$1.spaceTrim(`
11347
+ return spacetrim.spaceTrim(`
11349
11348
  # ${this.type}
11350
11349
 
11351
11350
  Imports content from another agent or a generic text file at the location of the commitment.
@@ -11380,7 +11379,7 @@
11380
11379
  importedFileUrls: [...(requirements.importedFileUrls || []), trimmedContent],
11381
11380
  };
11382
11381
  }
11383
- throw new Error(spaceTrim$1.spaceTrim((block) => `
11382
+ throw new Error(spacetrim.spaceTrim((block) => `
11384
11383
  Invalid agent URL or file path in IMPORT commitment: "${trimmedContent}"
11385
11384
 
11386
11385
  \`\`\`book
@@ -11634,7 +11633,7 @@
11634
11633
  * Markdown documentation for KNOWLEDGE commitment.
11635
11634
  */
11636
11635
  get documentation() {
11637
- return spaceTrim$1.spaceTrim(`
11636
+ return spacetrim.spaceTrim(`
11638
11637
  # ${this.type}
11639
11638
 
11640
11639
  Adds specific knowledge, facts, or context to the agent using a RAG (Retrieval-Augmented Generation) approach for external sources.
@@ -11762,7 +11761,7 @@
11762
11761
  * Markdown documentation for LANGUAGE/LANGUAGES commitment.
11763
11762
  */
11764
11763
  get documentation() {
11765
- return spaceTrim$1.spaceTrim(`
11764
+ return spacetrim.spaceTrim(`
11766
11765
  # ${this.type}
11767
11766
 
11768
11767
  Specifies the language(s) the agent should use in its responses.
@@ -11791,7 +11790,7 @@
11791
11790
  return requirements;
11792
11791
  }
11793
11792
  // Add language rule to the system message
11794
- const languageSection = this.createSystemMessageSection('Language:', spaceTrim$1.spaceTrim((block) => `
11793
+ const languageSection = this.createSystemMessageSection('Language:', spacetrim.spaceTrim((block) => `
11795
11794
  ${block(trimmedContent)}
11796
11795
  <- You are speaking these languages in your responses to the user.
11797
11796
  `));
@@ -11808,11 +11807,11 @@
11808
11807
  * @private utility for commitments
11809
11808
  */
11810
11809
  function formatOptionalInstructionBlock(label, content) {
11811
- const trimmedContent = spaceTrim$1.spaceTrim(content);
11810
+ const trimmedContent = spacetrim.spaceTrim(content);
11812
11811
  if (!trimmedContent) {
11813
11812
  return '';
11814
11813
  }
11815
- return spaceTrim$1.spaceTrim((block) => `
11814
+ return spacetrim.spaceTrim((block) => `
11816
11815
  - ${label}:
11817
11816
  ${block(trimmedContent
11818
11817
  .split(/\r?\n/)
@@ -11839,7 +11838,7 @@
11839
11838
  * @private function of MemoryCommitmentDefinition
11840
11839
  */
11841
11840
  function createMemorySystemMessage(extraInstructions) {
11842
- return spaceTrim$1.spaceTrim((block) => `
11841
+ return spacetrim.spaceTrim((block) => `
11843
11842
  Memory:
11844
11843
  - Prefer storing agent-scoped memories; only make them global when the fact should apply across all your agents.
11845
11844
  - You can use persistent user memory tools.
@@ -12229,7 +12228,7 @@
12229
12228
  if (!tools.some((tool) => tool.name === MemoryToolNames.retrieve)) {
12230
12229
  tools.push({
12231
12230
  name: MemoryToolNames.retrieve,
12232
- description: spaceTrim$1.spaceTrim(`
12231
+ description: spacetrim.spaceTrim(`
12233
12232
  Retrieve previously stored user memories relevant to the current conversation.
12234
12233
  Use this before responding when user context can improve the answer.
12235
12234
  `),
@@ -12251,7 +12250,7 @@
12251
12250
  if (!tools.some((tool) => tool.name === MemoryToolNames.store)) {
12252
12251
  tools.push({
12253
12252
  name: MemoryToolNames.store,
12254
- description: spaceTrim$1.spaceTrim(`
12253
+ description: spacetrim.spaceTrim(`
12255
12254
  Store a durable user memory that should be remembered in future conversations.
12256
12255
  Store only stable and useful user-specific facts or preferences.
12257
12256
  `),
@@ -12274,7 +12273,7 @@
12274
12273
  if (!tools.some((tool) => tool.name === MemoryToolNames.update)) {
12275
12274
  tools.push({
12276
12275
  name: MemoryToolNames.update,
12277
- description: spaceTrim$1.spaceTrim(`
12276
+ description: spacetrim.spaceTrim(`
12278
12277
  Update an existing user memory after retrieving it, so the stored fact stays accurate.
12279
12278
  Always pass the memory id you retrieved along with the new content.
12280
12279
  `),
@@ -12301,7 +12300,7 @@
12301
12300
  if (!tools.some((tool) => tool.name === MemoryToolNames.delete)) {
12302
12301
  tools.push({
12303
12302
  name: MemoryToolNames.delete,
12304
- description: spaceTrim$1.spaceTrim(`
12303
+ description: spacetrim.spaceTrim(`
12305
12304
  Delete a user memory that is no longer relevant. Deletions are soft so the record is hidden from future queries.
12306
12305
  `),
12307
12306
  parameters: {
@@ -12325,7 +12324,7 @@
12325
12324
  * @private function of MemoryCommitmentDefinition
12326
12325
  */
12327
12326
  function getMemoryCommitmentDocumentation(type) {
12328
- return spaceTrim$1.spaceTrim(`
12327
+ return spacetrim.spaceTrim(`
12329
12328
  # ${type}
12330
12329
 
12331
12330
  Enables persistent user memory for the current agent. The memory is stored by the runtime and can be retrieved in future conversations.
@@ -12484,7 +12483,7 @@
12484
12483
  * Markdown documentation for AGENT MESSAGE commitment.
12485
12484
  */
12486
12485
  get documentation() {
12487
- return spaceTrim$1.spaceTrim(`
12486
+ return spacetrim.spaceTrim(`
12488
12487
  # ${this.type}
12489
12488
 
12490
12489
  Defines a message from the agent in the conversation history. This is used to pre-fill the chat with a conversation history or to provide few-shot examples.
@@ -12561,7 +12560,7 @@
12561
12560
  * Markdown documentation for INITIAL MESSAGE commitment.
12562
12561
  */
12563
12562
  get documentation() {
12564
- return spaceTrim$1.spaceTrim(`
12563
+ return spacetrim.spaceTrim(`
12565
12564
  # ${this.type}
12566
12565
 
12567
12566
  Defines the first message that the user sees when opening the chat. This message is purely for display purposes in the UI and does not inherently become part of the LLM's system prompt context (unless also included via other means).
@@ -12628,7 +12627,7 @@
12628
12627
  * Markdown documentation for INTERNAL MESSAGE commitment.
12629
12628
  */
12630
12629
  get documentation() {
12631
- return spaceTrim$1.spaceTrim(`
12630
+ return spacetrim.spaceTrim(`
12632
12631
  # ${this.type}
12633
12632
 
12634
12633
  Defines an internal trace message related to one interaction. This is intended mainly for self-learning analytics and future training datasets.
@@ -12704,7 +12703,7 @@
12704
12703
  * Markdown documentation for MESSAGE commitment.
12705
12704
  */
12706
12705
  get documentation() {
12707
- return spaceTrim$1.spaceTrim(`
12706
+ return spacetrim.spaceTrim(`
12708
12707
  # ${this.type}
12709
12708
 
12710
12709
  Contains 1:1 text of the message which AI assistant already sent during the conversation. Later messages are later in the conversation. It is similar to \`WRITING SAMPLE\`, but it is not a sample. It is the real message which the AI assistant already sent.
@@ -12816,7 +12815,7 @@
12816
12815
  * Markdown documentation for USER MESSAGE commitment.
12817
12816
  */
12818
12817
  get documentation() {
12819
- return spaceTrim$1.spaceTrim(`
12818
+ return spacetrim.spaceTrim(`
12820
12819
  # ${this.type}
12821
12820
 
12822
12821
  Defines a message from the user in the conversation history. This is used to pre-fill the chat with a conversation history or to provide few-shot examples.
@@ -12883,7 +12882,7 @@
12883
12882
  * Markdown documentation for MESSAGE SUFFIX commitment.
12884
12883
  */
12885
12884
  get documentation() {
12886
- return spaceTrim$1.spaceTrim(`
12885
+ return spacetrim.spaceTrim(`
12887
12886
  # MESSAGE SUFFIX
12888
12887
 
12889
12888
  Defines a hardcoded message appended to every assistant response.
@@ -12965,7 +12964,7 @@
12965
12964
  * Markdown documentation for META commitment.
12966
12965
  */
12967
12966
  get documentation() {
12968
- return spaceTrim$1.spaceTrim(`
12967
+ return spacetrim.spaceTrim(`
12969
12968
  # META
12970
12969
 
12971
12970
  Sets meta-information about the agent that is used for display and attribution purposes.
@@ -13106,7 +13105,7 @@
13106
13105
  * Markdown documentation for META COLOR commitment.
13107
13106
  */
13108
13107
  get documentation() {
13109
- return spaceTrim$1.spaceTrim(`
13108
+ return spacetrim.spaceTrim(`
13110
13109
  # META COLOR
13111
13110
 
13112
13111
  Sets the agent's accent color or gradient.
@@ -13190,7 +13189,7 @@
13190
13189
  * Markdown documentation for META DOMAIN commitment.
13191
13190
  */
13192
13191
  get documentation() {
13193
- return spaceTrim$1.spaceTrim(`
13192
+ return spacetrim.spaceTrim(`
13194
13193
  # META DOMAIN
13195
13194
 
13196
13195
  Sets the canonical domain (host) of the agent, for example a custom domain that should open this agent directly.
@@ -13265,7 +13264,7 @@
13265
13264
  * Markdown documentation for META DISCLAIMER commitment.
13266
13265
  */
13267
13266
  get documentation() {
13268
- return spaceTrim$1.spaceTrim(`
13267
+ return spacetrim.spaceTrim(`
13269
13268
  # META DISCLAIMER
13270
13269
 
13271
13270
  Defines a markdown disclaimer shown to users before they can start chatting with the agent.
@@ -13335,7 +13334,7 @@
13335
13334
  * Markdown documentation for META FONT commitment.
13336
13335
  */
13337
13336
  get documentation() {
13338
- return spaceTrim$1.spaceTrim(`
13337
+ return spacetrim.spaceTrim(`
13339
13338
  # META FONT
13340
13339
 
13341
13340
  Sets the agent's font.
@@ -13420,7 +13419,7 @@
13420
13419
  * Markdown documentation for META IMAGE commitment.
13421
13420
  */
13422
13421
  get documentation() {
13423
- return spaceTrim$1.spaceTrim(`
13422
+ return spacetrim.spaceTrim(`
13424
13423
  # META IMAGE
13425
13424
 
13426
13425
  Sets the agent's avatar/profile image URL.
@@ -13499,7 +13498,7 @@
13499
13498
  * Markdown documentation for META INPUT PLACEHOLDER commitment.
13500
13499
  */
13501
13500
  get documentation() {
13502
- return spaceTrim$1.spaceTrim(`
13501
+ return spacetrim.spaceTrim(`
13503
13502
  # META INPUT PLACEHOLDER
13504
13503
 
13505
13504
  Sets custom placeholder text for the chat input field.
@@ -13580,7 +13579,7 @@
13580
13579
  * Markdown documentation for META LINK commitment.
13581
13580
  */
13582
13581
  get documentation() {
13583
- return spaceTrim$1.spaceTrim(`
13582
+ return spacetrim.spaceTrim(`
13584
13583
  # META LINK
13585
13584
 
13586
13585
  Represents a profile or source link for the person the agent is modeled after.
@@ -13679,7 +13678,7 @@
13679
13678
  * Markdown documentation for META VOICE commitment.
13680
13679
  */
13681
13680
  get documentation() {
13682
- return spaceTrim$1.spaceTrim(`
13681
+ return spacetrim.spaceTrim(`
13683
13682
  # META VOICE
13684
13683
 
13685
13684
  Instructs the UI to use a specific ElevenLabs voice when reading this agent's replies aloud.
@@ -13761,7 +13760,7 @@
13761
13760
  * Markdown documentation for MODEL commitment.
13762
13761
  */
13763
13762
  get documentation() {
13764
- return spaceTrim$1.spaceTrim(`
13763
+ return spacetrim.spaceTrim(`
13765
13764
  # ${this.type}
13766
13765
 
13767
13766
  Enforces technical parameters for the AI model, ensuring consistent behavior across different execution environments.
@@ -14002,7 +14001,7 @@
14002
14001
  * Markdown documentation for NOTE commitment.
14003
14002
  */
14004
14003
  get documentation() {
14005
- return spaceTrim$1.spaceTrim(`
14004
+ return spacetrim.spaceTrim(`
14006
14005
  # ${this.type}
14007
14006
 
14008
14007
  Adds comments for documentation without changing agent behavior.
@@ -14041,7 +14040,7 @@
14041
14040
  applyToAgentModelRequirements(requirements, content) {
14042
14041
  // The NOTE commitment makes no changes to the system message or model requirements
14043
14042
  // It only stores the note content in metadata for documentation purposes
14044
- const trimmedContent = spaceTrim$1.spaceTrim(content);
14043
+ const trimmedContent = spacetrim.spaceTrim(content);
14045
14044
  if (trimmedContent === '') {
14046
14045
  return requirements;
14047
14046
  }
@@ -14086,7 +14085,7 @@
14086
14085
  * Markdown documentation for OPEN commitment.
14087
14086
  */
14088
14087
  get documentation() {
14089
- return spaceTrim$1.spaceTrim(`
14088
+ return spacetrim.spaceTrim(`
14090
14089
  # OPEN
14091
14090
 
14092
14091
  Specifies that the agent can be modified by conversation with it.
@@ -14163,7 +14162,7 @@
14163
14162
  * Markdown documentation for PERSONA commitment.
14164
14163
  */
14165
14164
  get documentation() {
14166
- return spaceTrim$1.spaceTrim(`
14165
+ return spacetrim.spaceTrim(`
14167
14166
  # ${this.type}
14168
14167
 
14169
14168
  Defines who the agent is, their background, expertise, and personality traits.
@@ -14296,7 +14295,7 @@
14296
14295
  * Markdown documentation for RULE/RULES commitment.
14297
14296
  */
14298
14297
  get documentation() {
14299
- return spaceTrim$1.spaceTrim(`
14298
+ return spacetrim.spaceTrim(`
14300
14299
  # ${this.type}
14301
14300
 
14302
14301
  Adds behavioral constraints and guidelines that the agent must follow.
@@ -14360,7 +14359,7 @@
14360
14359
  * @private internal utility of writing commitments
14361
14360
  */
14362
14361
  function createWritingSampleSection(content) {
14363
- return spaceTrim$1.spaceTrim(`
14362
+ return spacetrim.spaceTrim(`
14364
14363
  Use this as a 1:1 voice exemplar for how your replies should sound.
14365
14364
  Treat it as sample-only guidance for voice, cadence, phrasing, and emotional texture, not as task-solving instructions.
14366
14365
  If multiple writing samples exist, newer samples have higher weight than older ones.
@@ -14377,7 +14376,7 @@
14377
14376
  * @private internal utility of writing commitments
14378
14377
  */
14379
14378
  function createWritingRulesSection(content) {
14380
- return spaceTrim$1.spaceTrim(`
14379
+ return spacetrim.spaceTrim(`
14381
14380
  These instructions apply only to how you write: tone, formatting, length, emoji usage, punctuation, and similar presentation choices.
14382
14381
  They do not change your task-solving behavior, business logic, or factual decision-making rules.
14383
14382
  If multiple writing-rules blocks conflict, prefer the newer writing-rules blocks.
@@ -14427,7 +14426,7 @@
14427
14426
  * Markdown documentation for `SAMPLE` / `EXAMPLE`.
14428
14427
  */
14429
14428
  get documentation() {
14430
- return spaceTrim$1.spaceTrim(`
14429
+ return spacetrim.spaceTrim(`
14431
14430
  # ${this.type}
14432
14431
 
14433
14432
  Deprecated legacy alias for \`WRITING SAMPLE\`.
@@ -14508,7 +14507,7 @@
14508
14507
  * Markdown documentation for SCENARIO commitment.
14509
14508
  */
14510
14509
  get documentation() {
14511
- return spaceTrim$1.spaceTrim(`
14510
+ return spacetrim.spaceTrim(`
14512
14511
  # ${this.type}
14513
14512
 
14514
14513
  Defines a specific situation or context in which the AI assistant should operate. It helps to set the scene for the AI's responses. Later scenarios are more important than earlier scenarios.
@@ -14630,7 +14629,7 @@
14630
14629
  * Markdown documentation for STYLE commitment.
14631
14630
  */
14632
14631
  get documentation() {
14633
- return spaceTrim$1.spaceTrim(`
14632
+ return spacetrim.spaceTrim(`
14634
14633
  # ${this.type}
14635
14634
 
14636
14635
  Defines how the agent should format and present its responses (tone, writing style, formatting).
@@ -14903,7 +14902,7 @@
14903
14902
  * Markdown documentation for TEAM commitment.
14904
14903
  */
14905
14904
  get documentation() {
14906
- return spaceTrim$1.spaceTrim(`
14905
+ return spacetrim.spaceTrim(`
14907
14906
  # TEAM
14908
14907
 
14909
14908
  Registers teammate agents that the current agent can consult via tools.
@@ -15269,7 +15268,7 @@
15269
15268
  * Markdown documentation for TEMPLATE commitment.
15270
15269
  */
15271
15270
  get documentation() {
15272
- return spaceTrim$1.spaceTrim(`
15271
+ return spacetrim.spaceTrim(`
15273
15272
  # ${this.type}
15274
15273
 
15275
15274
  Enforces a specific response structure or template that the agent must follow when generating responses.
@@ -15325,7 +15324,7 @@
15325
15324
  templateMode: true,
15326
15325
  };
15327
15326
  // Add a general instruction about using structured templates
15328
- const templateModeInstruction = spaceTrim$1.spaceTrim(`
15327
+ const templateModeInstruction = spacetrim.spaceTrim(`
15329
15328
  Use a clear, structured template format for your responses.
15330
15329
  Maintain consistency in how you organize and present information.
15331
15330
  `);
@@ -15396,7 +15395,7 @@
15396
15395
  * Markdown documentation for USE commitment.
15397
15396
  */
15398
15397
  get documentation() {
15399
- return spaceTrim$1.spaceTrim(`
15398
+ return spacetrim.spaceTrim(`
15400
15399
  # USE
15401
15400
 
15402
15401
  Enables the agent to use specific tools or capabilities for interacting with external systems.
@@ -15554,7 +15553,7 @@
15554
15553
  * Markdown documentation for USE BROWSER commitment.
15555
15554
  */
15556
15555
  get documentation() {
15557
- return spaceTrim$1.spaceTrim(`
15556
+ return spacetrim.spaceTrim(`
15558
15557
  # USE BROWSER
15559
15558
 
15560
15559
  Enables the agent to use browser tools to access and retrieve up-to-date information from the internet.
@@ -15617,7 +15616,7 @@
15617
15616
  if (!existingTools.some((tool) => tool.name === 'fetch_url_content')) {
15618
15617
  toolsToAdd.push({
15619
15618
  name: 'fetch_url_content',
15620
- description: spaceTrim$1.spaceTrim(`
15619
+ description: spacetrim.spaceTrim(`
15621
15620
  Fetches and scrapes the content from a URL (webpage or document).
15622
15621
  This tool retrieves the content of the specified URL and converts it to markdown format.
15623
15622
  Use this when you need to access information from a specific website or document.
@@ -15639,7 +15638,7 @@
15639
15638
  if (!existingTools.some((tool) => tool.name === 'run_browser')) {
15640
15639
  toolsToAdd.push({
15641
15640
  name: 'run_browser',
15642
- description: spaceTrim$1.spaceTrim(`
15641
+ description: spacetrim.spaceTrim(`
15643
15642
  Launches a browser session for complex interactions.
15644
15643
  This tool is for advanced browser automation tasks like scrolling, clicking, form filling, etc.
15645
15644
  Use this when simple one-shot URL fetching is not enough.
@@ -15686,7 +15685,7 @@
15686
15685
  ...requirements._metadata,
15687
15686
  useBrowser: true,
15688
15687
  },
15689
- }, spaceTrim$1.spaceTrim(`
15688
+ }, spacetrim.spaceTrim(`
15690
15689
  You have access to browser tools to fetch and access content from the internet.
15691
15690
  - Use "fetch_url_content" to retrieve content from specific URLs (webpages or documents) using scrapers.
15692
15691
  - Use "run_browser" for real interactive browser automation (navigation, clicks, typing, waiting, scrolling).
@@ -15718,7 +15717,7 @@
15718
15717
  async run_browser(args) {
15719
15718
  console.log('!!!! [Tool] run_browser called', { args });
15720
15719
  const { url } = args;
15721
- return spaceTrim$1.spaceTrim(`
15720
+ return spacetrim.spaceTrim(`
15722
15721
  # Running browser
15723
15722
 
15724
15723
  The running browser tool is not available in this runtime.
@@ -15771,7 +15770,7 @@
15771
15770
  return null;
15772
15771
  }
15773
15772
  if (!response.ok) {
15774
- throw new Error(spaceTrim$1.spaceTrim(`
15773
+ throw new Error(spacetrim.spaceTrim(`
15775
15774
  Google Calendar API request failed (${response.status} ${response.statusText}):
15776
15775
  ${extractGoogleCalendarApiErrorMessage(parsedPayload, textPayload)}
15777
15776
  `));
@@ -15880,7 +15879,7 @@
15880
15879
  * @private internal utility of USE CALENDAR commitment
15881
15880
  */
15882
15881
  function parseUseCalendarCommitmentContent(content) {
15883
- const trimmedContent = spaceTrim$1.spaceTrim(content);
15882
+ const trimmedContent = spacetrim.spaceTrim(content);
15884
15883
  if (!trimmedContent) {
15885
15884
  return {
15886
15885
  calendar: null,
@@ -16860,7 +16859,7 @@
16860
16859
  * Markdown documentation for USE CALENDAR commitment.
16861
16860
  */
16862
16861
  get documentation() {
16863
- return spaceTrim$1.spaceTrim(`
16862
+ return spacetrim.spaceTrim(`
16864
16863
  # USE CALENDAR
16865
16864
 
16866
16865
  Enables the agent to access and manage one Google Calendar.
@@ -16917,7 +16916,7 @@
16917
16916
  useCalendar: true,
16918
16917
  useCalendars: existingConfiguredCalendars,
16919
16918
  },
16920
- }, spaceTrim$1.spaceTrim((block) => `
16919
+ }, spacetrim.spaceTrim((block) => `
16921
16920
  Calendar tools:
16922
16921
  - You can inspect and manage events in configured calendars.
16923
16922
  - Supported operations include read, create, update, delete, invite guests, and reminders.
@@ -16979,7 +16978,7 @@
16979
16978
  * @private internal utility of USE EMAIL commitment
16980
16979
  */
16981
16980
  function parseUseEmailCommitmentContent(content) {
16982
- const trimmedContent = spaceTrim$1.spaceTrim(content);
16981
+ const trimmedContent = spacetrim.spaceTrim(content);
16983
16982
  if (!trimmedContent) {
16984
16983
  return {
16985
16984
  senderEmail: null,
@@ -17108,7 +17107,7 @@
17108
17107
  * Markdown documentation for USE EMAIL commitment.
17109
17108
  */
17110
17109
  get documentation() {
17111
- return spaceTrim$1.spaceTrim(`
17110
+ return spacetrim.spaceTrim(`
17112
17111
  # USE EMAIL
17113
17112
 
17114
17113
  Enables the agent to send outbound emails through SMTP.
@@ -17150,7 +17149,7 @@
17150
17149
  useEmail: true,
17151
17150
  ...(parsedCommitment.senderEmail ? { useEmailSender: parsedCommitment.senderEmail } : {}),
17152
17151
  },
17153
- }, spaceTrim$1.spaceTrim((block) => `
17152
+ }, spacetrim.spaceTrim((block) => `
17154
17153
  Email tool:
17155
17154
  - Use "${SEND_EMAIL_TOOL_NAME}" to send outbound emails.
17156
17155
  - Prefer \`message\` argument compatible with Promptbook \`Message\` type.
@@ -17268,7 +17267,7 @@
17268
17267
  * Markdown documentation for USE IMAGE GENERATOR commitment.
17269
17268
  */
17270
17269
  get documentation() {
17271
- return spaceTrim$1.spaceTrim(`
17270
+ return spacetrim.spaceTrim(`
17272
17271
  # USE IMAGE GENERATOR
17273
17272
 
17274
17273
  Enables the agent to output markdown image placeholders that trigger image generation in the user interface.
@@ -17307,7 +17306,7 @@
17307
17306
  ...requirements._metadata,
17308
17307
  useImageGenerator: content || true,
17309
17308
  },
17310
- }, spaceTrim$1.spaceTrim((block) => `
17309
+ }, spacetrim.spaceTrim((block) => `
17311
17310
  Image generation:
17312
17311
  - You do not generate images directly and you do not call any image tool.
17313
17312
  - When the user asks for an image, include markdown notation in your message:
@@ -17359,7 +17358,7 @@
17359
17358
  * Markdown documentation for USE MCP commitment.
17360
17359
  */
17361
17360
  get documentation() {
17362
- return spaceTrim$1.spaceTrim(`
17361
+ return spacetrim.spaceTrim(`
17363
17362
  # USE MCP
17364
17363
 
17365
17364
  Connects the agent to an external Model Context Protocol (MCP) server.
@@ -17440,7 +17439,7 @@
17440
17439
  * Markdown documentation for USE POPUP commitment.
17441
17440
  */
17442
17441
  get documentation() {
17443
- return spaceTrim$1.spaceTrim(`
17442
+ return spacetrim.spaceTrim(`
17444
17443
  # USE POPUP
17445
17444
 
17446
17445
  Enables the agent to open a popup window with a specific website.
@@ -17472,7 +17471,7 @@
17472
17471
  ...existingTools,
17473
17472
  {
17474
17473
  name: 'open_popup',
17475
- description: spaceTrim$1.spaceTrim(`
17474
+ description: spacetrim.spaceTrim(`
17476
17475
  Opens a popup window with a specific URL.
17477
17476
  Use this when you want to show a specific website to the user in a new window.
17478
17477
  ${!content ? '' : `Constraints / instructions: ${content}`}
@@ -17497,7 +17496,7 @@
17497
17496
  ...requirements._metadata,
17498
17497
  usePopup: content || true,
17499
17498
  },
17500
- }, spaceTrim$1.spaceTrim((block) => `
17499
+ }, spacetrim.spaceTrim((block) => `
17501
17500
  Tool:
17502
17501
  - You can open a popup window with a specific URL using the tool "open_popup".
17503
17502
  - Use this when you want the user to see or interact with a specific website.
@@ -17524,7 +17523,7 @@
17524
17523
  window.open(url, '_blank');
17525
17524
  return `Popup window with URL "${url}" was opened.`;
17526
17525
  }
17527
- return spaceTrim$1.spaceTrim(`
17526
+ return spacetrim.spaceTrim(`
17528
17527
  Popup window with URL "${url}" was requested.
17529
17528
 
17530
17529
  Note: The agent is currently running on the server, so the popup cannot be opened automatically.
@@ -17618,7 +17617,7 @@
17618
17617
  * Markdown documentation for USE PRIVACY commitment.
17619
17618
  */
17620
17619
  get documentation() {
17621
- return spaceTrim$1.spaceTrim(`
17620
+ return spacetrim.spaceTrim(`
17622
17621
  # USE PRIVACY
17623
17622
 
17624
17623
  Enables the agent to request turning on private mode in chat.
@@ -17658,7 +17657,7 @@
17658
17657
  ...existingTools,
17659
17658
  {
17660
17659
  name: TURN_PRIVACY_ON_TOOL_NAME,
17661
- description: spaceTrim$1.spaceTrim(`
17660
+ description: spacetrim.spaceTrim(`
17662
17661
  Requests turning private mode on in the chat UI.
17663
17662
  The user must explicitly confirm the action in a dialog before private mode is enabled.
17664
17663
  Use this for sensitive topics or when the user asks not to store conversation data.
@@ -17677,7 +17676,7 @@
17677
17676
  ...requirements._metadata,
17678
17677
  usePrivacy: content || true,
17679
17678
  },
17680
- }, spaceTrim$1.spaceTrim((block) => `
17679
+ }, spacetrim.spaceTrim((block) => `
17681
17680
  Privacy mode:
17682
17681
  - Use "${TURN_PRIVACY_ON_TOOL_NAME}" when the user asks for a private/sensitive conversation.
17683
17682
  - This tool requests a UI confirmation dialog. Private mode is enabled only after user confirms.
@@ -18248,7 +18247,7 @@
18248
18247
  return null;
18249
18248
  }
18250
18249
  if (!response.ok) {
18251
- throw new Error(spaceTrim$1.spaceTrim(`
18250
+ throw new Error(spacetrim.spaceTrim(`
18252
18251
  GitHub API request failed (${response.status} ${response.statusText}):
18253
18252
  ${extractGitHubApiErrorMessage(parsedPayload, textPayload)}
18254
18253
  `));
@@ -18379,7 +18378,7 @@
18379
18378
  * @private internal utility of USE PROJECT commitment
18380
18379
  */
18381
18380
  function parseUseProjectCommitmentContent(content) {
18382
- const trimmedContent = spaceTrim$1.spaceTrim(content);
18381
+ const trimmedContent = spacetrim.spaceTrim(content);
18383
18382
  if (!trimmedContent) {
18384
18383
  return {
18385
18384
  repository: null,
@@ -19280,7 +19279,7 @@
19280
19279
  * Markdown documentation for USE PROJECT commitment.
19281
19280
  */
19282
19281
  get documentation() {
19283
- return spaceTrim$1.spaceTrim(`
19282
+ return spacetrim.spaceTrim(`
19284
19283
  # USE PROJECT
19285
19284
 
19286
19285
  Enables the agent to work with files in a GitHub repository and create pull requests.
@@ -19320,7 +19319,7 @@
19320
19319
  useProject: true,
19321
19320
  useProjects: existingConfiguredProjects,
19322
19321
  },
19323
- }, spaceTrim$1.spaceTrim((block) => `
19322
+ }, spacetrim.spaceTrim((block) => `
19324
19323
  Project tools:
19325
19324
  - You can inspect and edit configured GitHub repositories using project tools.
19326
19325
  - Configured repositories:
@@ -19446,7 +19445,7 @@
19446
19445
  * Markdown documentation for USE SEARCH ENGINE commitment.
19447
19446
  */
19448
19447
  get documentation() {
19449
- return spaceTrim$1.spaceTrim(`
19448
+ return spacetrim.spaceTrim(`
19450
19449
  # USE SEARCH ENGINE
19451
19450
 
19452
19451
  Enables the agent to use a search engine tool to access and retrieve up-to-date information from the internet.
@@ -19488,7 +19487,7 @@
19488
19487
  ...existingTools,
19489
19488
  {
19490
19489
  name: 'web_search',
19491
- description: spaceTrim$1.spaceTrim(`
19490
+ description: spacetrim.spaceTrim(`
19492
19491
  Search the internet for information.
19493
19492
  Use this tool when you need to find up-to-date information or facts that you don't know.
19494
19493
  ${!content ? '' : `Search scope / instructions: ${content}`}
@@ -19537,7 +19536,7 @@
19537
19536
  ...requirements._metadata,
19538
19537
  useSearchEngine: content || true,
19539
19538
  },
19540
- }, spaceTrim$1.spaceTrim((block) => `
19539
+ }, spacetrim.spaceTrim((block) => `
19541
19540
  Tool:
19542
19541
  - You have access to the web search engine via the tool "web_search".
19543
19542
  - Use it to find up-to-date information or facts that you don't know.
@@ -19568,11 +19567,11 @@
19568
19567
  }
19569
19568
  const searchEngine = new SerpSearchEngine();
19570
19569
  const results = await searchEngine.search(query, options);
19571
- return spaceTrim$1.spaceTrim((block) => `
19570
+ return spacetrim.spaceTrim((block) => `
19572
19571
  Search results for "${query}"${Object.keys(options).length === 0 ? '' : ` with options ${JSON.stringify(options)}`}:
19573
19572
 
19574
19573
  ${block(results
19575
- .map((result) => spaceTrim$1.spaceTrim(`
19574
+ .map((result) => spacetrim.spaceTrim(`
19576
19575
  - **${result.title}**
19577
19576
  ${result.url}
19578
19577
  ${result.snippet}
@@ -19700,7 +19699,7 @@
19700
19699
  * Markdown documentation for USE SPAWN commitment.
19701
19700
  */
19702
19701
  get documentation() {
19703
- return spaceTrim$1.spaceTrim(`
19702
+ return spacetrim.spaceTrim(`
19704
19703
  # USE SPAWN
19705
19704
 
19706
19705
  Enables the agent to create a new persistent child agent using the \`spawn_agent\` tool.
@@ -19737,7 +19736,7 @@
19737
19736
  ...existingTools,
19738
19737
  {
19739
19738
  name: SPAWN_AGENT_TOOL_NAME,
19740
- description: spaceTrim$1.spaceTrim(`
19739
+ description: spacetrim.spaceTrim(`
19741
19740
  Creates one new persistent child agent in Agents Server.
19742
19741
  Use this when the user asks to create a new dedicated agent profile.
19743
19742
  The tool returns JSON with \`status\`, \`agentId\`, and created \`agent\` or \`error\`.
@@ -19752,7 +19751,7 @@
19752
19751
  ...requirements._metadata,
19753
19752
  useSpawn: content || true,
19754
19753
  },
19755
- }, spaceTrim$1.spaceTrim((block) => `
19754
+ }, spacetrim.spaceTrim((block) => `
19756
19755
  Spawning agents:
19757
19756
  - Use "${SPAWN_AGENT_TOOL_NAME}" only when user asks to create a persistent new agent.
19758
19757
  - Pass full agent source in \`source\`.
@@ -19792,7 +19791,7 @@
19792
19791
  * @private internal utility of USE TIMEOUT
19793
19792
  */
19794
19793
  function createTimeoutSystemMessage(extraInstructions) {
19795
- return spaceTrim$1.spaceTrim((block) => `
19794
+ return spacetrim.spaceTrim((block) => `
19796
19795
  Timeout scheduling:
19797
19796
  - Use "set_timeout" to wake this same chat thread in the future.
19798
19797
  - Use "list_timeouts" to review timeouts across all chats for the same user+agent scope.
@@ -19908,7 +19907,7 @@
19908
19907
  set(args) {
19909
19908
  const parsedMilliseconds = Number(args.milliseconds);
19910
19909
  if (!Number.isFinite(parsedMilliseconds) || parsedMilliseconds <= 0) {
19911
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim(`
19910
+ throw new PipelineExecutionError(spacetrim.spaceTrim(`
19912
19911
  Timeout \`milliseconds\` must be a positive number.
19913
19912
  `));
19914
19913
  }
@@ -19924,7 +19923,7 @@
19924
19923
  cancel(args) {
19925
19924
  const timeoutId = typeof args.timeoutId === 'string' ? args.timeoutId.trim() : '';
19926
19925
  if (!timeoutId) {
19927
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim(`
19926
+ throw new PipelineExecutionError(spacetrim.spaceTrim(`
19928
19927
  Timeout \`timeoutId\` is required.
19929
19928
  `));
19930
19929
  }
@@ -19935,18 +19934,18 @@
19935
19934
  */
19936
19935
  list(args) {
19937
19936
  if (args.includeFinished !== undefined && typeof args.includeFinished !== 'boolean') {
19938
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim(`
19937
+ throw new PipelineExecutionError(spacetrim.spaceTrim(`
19939
19938
  Timeout \`includeFinished\` must be a boolean when provided.
19940
19939
  `));
19941
19940
  }
19942
19941
  const parsedLimit = args.limit === undefined ? DEFAULT_LIST_TIMEOUTS_LIMIT : Math.floor(Number(args.limit));
19943
19942
  if (!Number.isFinite(parsedLimit) || parsedLimit <= 0) {
19944
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim(`
19943
+ throw new PipelineExecutionError(spacetrim.spaceTrim(`
19945
19944
  Timeout \`limit\` must be a positive number.
19946
19945
  `));
19947
19946
  }
19948
19947
  if (parsedLimit > MAX_LIST_TIMEOUTS_LIMIT) {
19949
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim(`
19948
+ throw new PipelineExecutionError(spacetrim.spaceTrim(`
19950
19949
  Timeout \`limit\` must be at most \`${MAX_LIST_TIMEOUTS_LIMIT}\`.
19951
19950
  `));
19952
19951
  }
@@ -20192,7 +20191,7 @@
20192
20191
  * Markdown documentation for `USE TIMEOUT`.
20193
20192
  */
20194
20193
  get documentation() {
20195
- return spaceTrim$1.spaceTrim(`
20194
+ return spacetrim.spaceTrim(`
20196
20195
  # USE TIMEOUT
20197
20196
 
20198
20197
  Enables timeout wake-ups and timeout management for the same user+agent scope.
@@ -20283,7 +20282,7 @@
20283
20282
  * Markdown documentation for USE TIME commitment.
20284
20283
  */
20285
20284
  get documentation() {
20286
- return spaceTrim$1.spaceTrim(`
20285
+ return spacetrim.spaceTrim(`
20287
20286
  # USE TIME
20288
20287
 
20289
20288
  Enables the agent to determine the current date and time.
@@ -20344,7 +20343,7 @@
20344
20343
  _metadata: {
20345
20344
  ...requirements._metadata,
20346
20345
  },
20347
- }, spaceTrim$1.spaceTrim((block) => `
20346
+ }, spacetrim.spaceTrim((block) => `
20348
20347
  Time and date context:
20349
20348
  - It is ${moment__default["default"]().format('MMMM YYYY')} now.
20350
20349
  - If you need more precise current time information, use the tool "get_current_time".
@@ -20512,7 +20511,7 @@
20512
20511
  * Markdown documentation for USE USER LOCATION commitment.
20513
20512
  */
20514
20513
  get documentation() {
20515
- return spaceTrim$1.spaceTrim(`
20514
+ return spacetrim.spaceTrim(`
20516
20515
  # USE USER LOCATION
20517
20516
 
20518
20517
  Enables the agent to retrieve the user's location from runtime context.
@@ -20550,7 +20549,7 @@
20550
20549
  ...existingTools,
20551
20550
  {
20552
20551
  name: GET_USER_LOCATION_TOOL_NAME,
20553
- description: spaceTrim$1.spaceTrim(`
20552
+ description: spacetrim.spaceTrim(`
20554
20553
  Retrieves user location shared by browser runtime (if permission is granted).
20555
20554
  Returns JSON status with coordinates and metadata when available.
20556
20555
  `),
@@ -20568,7 +20567,7 @@
20568
20567
  ...requirements._metadata,
20569
20568
  useUserLocation: content || true,
20570
20569
  },
20571
- }, spaceTrim$1.spaceTrim((block) => `
20570
+ }, spacetrim.spaceTrim((block) => `
20572
20571
  User location:
20573
20572
  - Use "${GET_USER_LOCATION_TOOL_NAME}" only when location is needed for a better answer.
20574
20573
  - If the tool returns "unavailable" or "permission-denied", ask user to share location or provide city manually.
@@ -20645,7 +20644,7 @@
20645
20644
  * Markdown documentation for `WRITING RULES`.
20646
20645
  */
20647
20646
  get documentation() {
20648
- return spaceTrim$1.spaceTrim(`
20647
+ return spacetrim.spaceTrim(`
20649
20648
  # ${this.type}
20650
20649
 
20651
20650
  Adds instructions that apply strictly to how the agent writes.
@@ -20723,7 +20722,7 @@
20723
20722
  * Markdown documentation for `WRITING SAMPLE`.
20724
20723
  */
20725
20724
  get documentation() {
20726
- return spaceTrim$1.spaceTrim(`
20725
+ return spacetrim.spaceTrim(`
20727
20726
  # ${this.type}
20728
20727
 
20729
20728
  Provides explicit 1:1 sample text that demonstrates how the agent should sound.
@@ -20795,7 +20794,7 @@
20795
20794
  * Markdown documentation available at runtime.
20796
20795
  */
20797
20796
  get documentation() {
20798
- return spaceTrim$1.spaceTrim(`
20797
+ return spacetrim.spaceTrim(`
20799
20798
  # ${this.type}
20800
20799
 
20801
20800
  This commitment is not yet fully implemented.
@@ -21051,7 +21050,7 @@
21051
21050
  const fullContent = currentCommitment.contentLines.join('\n');
21052
21051
  commitments.push({
21053
21052
  type: currentCommitment.type,
21054
- content: spaceTrim$1.spaceTrim(fullContent),
21053
+ content: spacetrim.spaceTrim(fullContent),
21055
21054
  originalLine: currentCommitment.originalStartLine,
21056
21055
  lineNumber: currentCommitment.startLineNumber,
21057
21056
  });
@@ -21079,7 +21078,7 @@
21079
21078
  const fullContent = currentCommitment.contentLines.join('\n');
21080
21079
  commitments.push({
21081
21080
  type: currentCommitment.type,
21082
- content: spaceTrim$1.spaceTrim(fullContent),
21081
+ content: spacetrim.spaceTrim(fullContent),
21083
21082
  originalLine: currentCommitment.originalStartLine,
21084
21083
  lineNumber: currentCommitment.startLineNumber,
21085
21084
  });
@@ -21105,7 +21104,7 @@
21105
21104
  const fullContent = currentCommitment.contentLines.join('\n');
21106
21105
  commitments.push({
21107
21106
  type: currentCommitment.type,
21108
- content: spaceTrim$1.spaceTrim(fullContent),
21107
+ content: spacetrim.spaceTrim(fullContent),
21109
21108
  originalLine: currentCommitment.originalStartLine,
21110
21109
  lineNumber: currentCommitment.startLineNumber,
21111
21110
  });
@@ -21144,7 +21143,7 @@
21144
21143
  .filter((c) => ['PERSONA', 'RULE', 'KNOWLEDGE'].includes(c.type))
21145
21144
  .map((c) => `${c.type} ${c.content}`)
21146
21145
  .join('\n\n');
21147
- return spaceTrim$1.spaceTrim((block) => `
21146
+ return spacetrim.spaceTrim((block) => `
21148
21147
  ${block(relevantCommitments)}
21149
21148
 
21150
21149
  ${block(corpus)}
@@ -21636,7 +21635,7 @@
21636
21635
  * @public exported from `@promptbook/core`
21637
21636
  */
21638
21637
  function normalizeAgentName(rawAgentName) {
21639
- return titleToName(spaceTrim__default["default"](rawAgentName));
21638
+ return titleToName(spacetrim.spaceTrim(rawAgentName));
21640
21639
  }
21641
21640
 
21642
21641
  /**
@@ -21811,7 +21810,7 @@
21811
21810
  continue;
21812
21811
  }
21813
21812
  if (commitment.type === 'FROM') {
21814
- const content = spaceTrim__default["default"](commitment.content).split(/\r?\n/)[0] || '';
21813
+ const content = spacetrim.spaceTrim(commitment.content).split(/\r?\n/)[0] || '';
21815
21814
  if (content === 'Adam' || content === '' /* <- Note: Adam is implicit */) {
21816
21815
  continue;
21817
21816
  }
@@ -21834,7 +21833,7 @@
21834
21833
  continue;
21835
21834
  }
21836
21835
  if (commitment.type === 'IMPORT') {
21837
- const content = spaceTrim__default["default"](commitment.content).split(/\r?\n/)[0] || '';
21836
+ const content = spacetrim.spaceTrim(commitment.content).split(/\r?\n/)[0] || '';
21838
21837
  let label = content;
21839
21838
  let iconName = 'ExternalLink'; // Import remote
21840
21839
  try {
@@ -21872,7 +21871,7 @@
21872
21871
  continue;
21873
21872
  }
21874
21873
  if (commitment.type === 'KNOWLEDGE') {
21875
- const content = spaceTrim__default["default"](commitment.content);
21874
+ const content = spacetrim.spaceTrim(commitment.content);
21876
21875
  const extractedUrls = extractUrlsFromText(content);
21877
21876
  let label = content;
21878
21877
  let iconName = 'Book';
@@ -21931,7 +21930,7 @@
21931
21930
  continue;
21932
21931
  }
21933
21932
  if (commitment.type === 'META LINK') {
21934
- const linkValue = spaceTrim__default["default"](commitment.content);
21933
+ const linkValue = spacetrim.spaceTrim(commitment.content);
21935
21934
  links.push(linkValue);
21936
21935
  meta.link = linkValue;
21937
21936
  continue;
@@ -21941,11 +21940,11 @@
21941
21940
  continue;
21942
21941
  }
21943
21942
  if (commitment.type === 'META IMAGE') {
21944
- meta.image = spaceTrim__default["default"](commitment.content);
21943
+ meta.image = spacetrim.spaceTrim(commitment.content);
21945
21944
  continue;
21946
21945
  }
21947
21946
  if (commitment.type === 'META DESCRIPTION') {
21948
- meta.description = spaceTrim__default["default"](commitment.content);
21947
+ meta.description = spacetrim.spaceTrim(commitment.content);
21949
21948
  continue;
21950
21949
  }
21951
21950
  if (commitment.type === 'META DISCLAIMER') {
@@ -21953,7 +21952,7 @@
21953
21952
  continue;
21954
21953
  }
21955
21954
  if (commitment.type === 'META INPUT PLACEHOLDER') {
21956
- meta.inputPlaceholder = spaceTrim__default["default"](commitment.content);
21955
+ meta.inputPlaceholder = spacetrim.spaceTrim(commitment.content);
21957
21956
  continue;
21958
21957
  }
21959
21958
  if (commitment.type === 'MESSAGE SUFFIX') {
@@ -21969,7 +21968,7 @@
21969
21968
  continue;
21970
21969
  }
21971
21970
  if (commitment.type === 'META VOICE') {
21972
- meta.voice = spaceTrim__default["default"](commitment.content);
21971
+ meta.voice = spacetrim.spaceTrim(commitment.content);
21973
21972
  continue;
21974
21973
  }
21975
21974
  if (commitment.type !== 'META') {
@@ -21978,10 +21977,10 @@
21978
21977
  // Parse META commitments - format is "META TYPE content"
21979
21978
  const metaTypeRaw = commitment.content.split(' ')[0] || 'NONE';
21980
21979
  if (metaTypeRaw === 'LINK') {
21981
- links.push(spaceTrim__default["default"](commitment.content.substring(metaTypeRaw.length)));
21980
+ links.push(spacetrim.spaceTrim(commitment.content.substring(metaTypeRaw.length)));
21982
21981
  }
21983
21982
  const metaType = normalizeTo_camelCase(metaTypeRaw);
21984
- meta[metaType] = spaceTrim__default["default"](commitment.content.substring(metaTypeRaw.length));
21983
+ meta[metaType] = spacetrim.spaceTrim(commitment.content.substring(metaTypeRaw.length));
21985
21984
  }
21986
21985
  // Generate fullname fallback if no meta fullname specified
21987
21986
  if (!meta.fullname) {
@@ -22012,7 +22011,7 @@
22012
22011
  * @returns The content with normalized separators
22013
22012
  */
22014
22013
  function normalizeSeparator(content) {
22015
- const trimmed = spaceTrim__default["default"](content);
22014
+ const trimmed = spacetrim.spaceTrim(content);
22016
22015
  if (trimmed.includes(',')) {
22017
22016
  return trimmed;
22018
22017
  }
@@ -22025,7 +22024,7 @@
22025
22024
  * @returns Normalized domain or a trimmed fallback.
22026
22025
  */
22027
22026
  function normalizeMetaDomain(content) {
22028
- const trimmed = spaceTrim__default["default"](content);
22027
+ const trimmed = spacetrim.spaceTrim(content);
22029
22028
  return normalizeDomainForMatching(trimmed) || trimmed.toLowerCase();
22030
22029
  }
22031
22030
  /**
@@ -22184,7 +22183,7 @@
22184
22183
  * @deprecated Use `$generateBookBoilerplate` instead
22185
22184
  * @public exported from `@promptbook/core`
22186
22185
  */
22187
- const DEFAULT_BOOK = padBook(validateBook(spaceTrim__default["default"](`
22186
+ const DEFAULT_BOOK = padBook(validateBook(spacetrim.spaceTrim(`
22188
22187
  AI Avatar
22189
22188
 
22190
22189
  PERSONA A friendly AI assistant that helps you with your tasks
@@ -22806,7 +22805,7 @@
22806
22805
  }
22807
22806
  async function getPipelineByUrl(url) {
22808
22807
  if (!predicate(url)) {
22809
- throw new NotFoundError(await spaceTrim$1.spaceTrim(async (block) => `
22808
+ throw new NotFoundError(await spacetrim.spaceTrim(async (block) => `
22810
22809
  Promptbook with url "${url}" not found or not accessible
22811
22810
 
22812
22811
  Available promptbooks:
@@ -23016,7 +23015,7 @@
23016
23015
  */
23017
23016
  parse(input) {
23018
23017
  const { args } = input;
23019
- const knowledgeSourceContent = spaceTrim__default["default"](args[0] || '');
23018
+ const knowledgeSourceContent = spacetrim.spaceTrim(args[0] || '');
23020
23019
  if (knowledgeSourceContent === '') {
23021
23020
  throw new ParseError(`Source is not defined`);
23022
23021
  }
@@ -23160,7 +23159,7 @@
23160
23159
  normalized = normalized.split('DIALOGUE').join('DIALOG');
23161
23160
  const taskTypes = SectionTypes.filter((sectionType) => normalized.includes(sectionType.split('_TASK').join('')));
23162
23161
  if (taskTypes.length !== 1) {
23163
- throw new ParseError(spaceTrim__default["default"]((block) => `
23162
+ throw new ParseError(spacetrim.spaceTrim((block) => `
23164
23163
  Unknown section type "${normalized}"
23165
23164
 
23166
23165
  Supported section types are:
@@ -23180,7 +23179,7 @@
23180
23179
  */
23181
23180
  $applyToTaskJson(command, $taskJson, $pipelineJson) {
23182
23181
  if ($taskJson.isSectionTypeSet === true) {
23183
- throw new ParseError(spaceTrim__default["default"](`
23182
+ throw new ParseError(spacetrim.spaceTrim(`
23184
23183
  Section type is already defined in the section.
23185
23184
  It can be defined only once.
23186
23185
  `));
@@ -23460,7 +23459,7 @@
23460
23459
  /**
23461
23460
  * Description of the FORMAT command
23462
23461
  */
23463
- description: spaceTrim__default["default"](`
23462
+ description: spacetrim.spaceTrim(`
23464
23463
  Expect command describes the desired output of the task *(after post-processing)*
23465
23464
  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.
23466
23465
  `),
@@ -23534,7 +23533,7 @@
23534
23533
  }
23535
23534
  catch (error) {
23536
23535
  assertsError(error);
23537
- throw new ParseError(spaceTrim__default["default"]((block) => `
23536
+ throw new ParseError(spacetrim.spaceTrim((block) => `
23538
23537
  Invalid FORMAT command
23539
23538
  ${block(error.message)}:
23540
23539
  `));
@@ -23646,7 +23645,7 @@
23646
23645
  if (!(error instanceof ParseError)) {
23647
23646
  throw error;
23648
23647
  }
23649
- throw new ParseError(spaceTrim__default["default"]((block) => `
23648
+ throw new ParseError(spacetrim.spaceTrim((block) => `
23650
23649
  ${block(error.message)}
23651
23650
 
23652
23651
  Tried to validate parameter name:
@@ -23705,7 +23704,7 @@
23705
23704
  const assignSign = args[3];
23706
23705
  const formatDefinition = FORMAT_DEFINITIONS.find((formatDefinition) => [formatDefinition.formatName, ...(formatDefinition.aliases || [])].includes(formatName));
23707
23706
  if (formatDefinition === undefined) {
23708
- throw new ParseError(spaceTrim__default["default"]((block) => `
23707
+ throw new ParseError(spacetrim.spaceTrim((block) => `
23709
23708
  Unsupported format "${formatName}"
23710
23709
 
23711
23710
  Available formats:
@@ -23717,7 +23716,7 @@
23717
23716
  }
23718
23717
  const subvalueParser = formatDefinition.subvalueParsers.find((subvalueParser) => [subvalueParser.subvalueName, ...(subvalueParser.aliases || [])].includes(subformatName));
23719
23718
  if (subvalueParser === undefined) {
23720
- throw new ParseError(spaceTrim__default["default"]((block) => `
23719
+ throw new ParseError(spacetrim.spaceTrim((block) => `
23721
23720
  Unsupported subformat name "${subformatName}" for format "${formatName}"
23722
23721
 
23723
23722
  Available subformat names for format "${formatDefinition.formatName}":
@@ -23765,7 +23764,7 @@
23765
23764
  outputSubparameterName = 'newLine';
23766
23765
  }
23767
23766
  else {
23768
- throw new ParseError(spaceTrim__default["default"](`
23767
+ throw new ParseError(spacetrim.spaceTrim(`
23769
23768
  FOREACH ${formatName} ${subformatName} must specify output subparameter
23770
23769
 
23771
23770
  Correct example:
@@ -23841,7 +23840,7 @@
23841
23840
  /**
23842
23841
  * Description of the FORMAT command
23843
23842
  */
23844
- description: spaceTrim__default["default"](`
23843
+ description: spacetrim.spaceTrim(`
23845
23844
  Format command describes the desired output of the task (after post-processing)
23846
23845
  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.
23847
23846
  `),
@@ -24213,7 +24212,7 @@
24213
24212
  const formfactorNameCandidate = args[0].toUpperCase();
24214
24213
  const formfactor = FORMFACTOR_DEFINITIONS.find((definition) => [definition.name, ...{ aliasNames: [], ...definition }.aliasNames].includes(formfactorNameCandidate));
24215
24214
  if (formfactor === undefined) {
24216
- throw new ParseError(spaceTrim__default["default"]((block) => `
24215
+ throw new ParseError(spacetrim.spaceTrim((block) => `
24217
24216
  Unknown formfactor name "${formfactorNameCandidate}"
24218
24217
 
24219
24218
  Available formfactors:
@@ -24232,7 +24231,7 @@
24232
24231
  */
24233
24232
  $applyToPipelineJson(command, $pipelineJson) {
24234
24233
  if ($pipelineJson.formfactorName !== undefined && $pipelineJson.formfactorName !== command.formfactorName) {
24235
- throw new ParseError(spaceTrim__default["default"](`
24234
+ throw new ParseError(spacetrim.spaceTrim(`
24236
24235
  Redefinition of \`FORMFACTOR\` in the pipeline head
24237
24236
 
24238
24237
  You have used:
@@ -24380,7 +24379,7 @@
24380
24379
  */
24381
24380
  parse(input) {
24382
24381
  const { args, normalized } = input;
24383
- const availableVariantsMessage = spaceTrim__default["default"]((block) => `
24382
+ const availableVariantsMessage = spacetrim.spaceTrim((block) => `
24384
24383
  Available variants are:
24385
24384
  ${block(MODEL_VARIANTS.map((variantName) => `- ${variantName}${variantName !== 'EMBEDDING' ? '' : ' (Not available in pipeline)'}`).join('\n'))}
24386
24385
  `);
@@ -24402,14 +24401,14 @@
24402
24401
  // <- Note: [🤖]
24403
24402
  }
24404
24403
  else if (normalized.startsWith('MODEL_VARIANT_EMBED')) {
24405
- spaceTrim__default["default"]((block) => `
24404
+ spacetrim.spaceTrim((block) => `
24406
24405
  Embedding model can not be used in pipeline
24407
24406
 
24408
24407
  ${block(availableVariantsMessage)}
24409
24408
  `);
24410
24409
  }
24411
24410
  else {
24412
- throw new ParseError(spaceTrim__default["default"]((block) => `
24411
+ throw new ParseError(spacetrim.spaceTrim((block) => `
24413
24412
  Unknown model variant in command:
24414
24413
 
24415
24414
  ${block(availableVariantsMessage)}
@@ -24424,7 +24423,7 @@
24424
24423
  };
24425
24424
  }
24426
24425
  else {
24427
- throw new ParseError(spaceTrim__default["default"]((block) => `
24426
+ throw new ParseError(spacetrim.spaceTrim((block) => `
24428
24427
  Unknown model key in command.
24429
24428
 
24430
24429
  Supported model keys are:
@@ -24451,7 +24450,7 @@
24451
24450
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
24452
24451
  }
24453
24452
  else {
24454
- throw new ParseError(spaceTrim__default["default"](`
24453
+ throw new ParseError(spacetrim.spaceTrim(`
24455
24454
  Redefinition of \`MODEL ${command.key}\` in the pipeline head
24456
24455
 
24457
24456
  You have used:
@@ -24479,7 +24478,7 @@
24479
24478
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
24480
24479
  }
24481
24480
  else {
24482
- throw new ParseError(spaceTrim__default["default"](`
24481
+ throw new ParseError(spacetrim.spaceTrim(`
24483
24482
  Redefinition of MODEL \`${command.key}\` in the task "${$taskJson.title || $taskJson.name}"
24484
24483
 
24485
24484
  You have used:
@@ -24489,7 +24488,7 @@
24489
24488
  }
24490
24489
  }
24491
24490
  if (command.value === ($pipelineJson.defaultModelRequirements || {})[command.key]) {
24492
- console.log(spaceTrim__default["default"](`
24491
+ console.log(spacetrim.spaceTrim(`
24493
24492
  Setting MODEL \`${command.key}\` in the task "${$taskJson.title || $taskJson.name}" to the same value as in the pipeline head
24494
24493
 
24495
24494
  In pipeline head:
@@ -24572,7 +24571,7 @@
24572
24571
  // <- TODO: When [🥶] fixed, change to:
24573
24572
  // > const parameterDescriptionRaw = rawArgs.split(parameterNameRaw).join('').trim();
24574
24573
  if (parameterDescriptionRaw && parameterDescriptionRaw.match(/\{(?<embeddedParameterName>[a-z0-9_]+)\}/im)) {
24575
- throw new ParseError(spaceTrim__default["default"]((block) => `
24574
+ throw new ParseError(spacetrim.spaceTrim((block) => `
24576
24575
  Parameter \`{${parameterNameRaw}}\` can not contain another parameter in description
24577
24576
 
24578
24577
  The description:
@@ -24754,7 +24753,7 @@
24754
24753
  persona.description = personaDescription;
24755
24754
  return;
24756
24755
  }
24757
- console.warn(spaceTrim__default["default"](`
24756
+ console.warn(spacetrim.spaceTrim(`
24758
24757
 
24759
24758
  Persona "${personaName}" is defined multiple times with different description:
24760
24759
 
@@ -24765,7 +24764,7 @@
24765
24764
  ${personaDescription}
24766
24765
 
24767
24766
  `));
24768
- persona.description += spaceTrim__default["default"]('\n\n' + personaDescription);
24767
+ persona.description += spacetrim.spaceTrim('\n\n' + personaDescription);
24769
24768
  }
24770
24769
 
24771
24770
  /**
@@ -25116,7 +25115,7 @@
25116
25115
  function getParserForCommand(command) {
25117
25116
  const commandParser = COMMANDS.find((commandParser) => commandParser.name === command.type);
25118
25117
  if (commandParser === undefined) {
25119
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
25118
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
25120
25119
  Command ${command.type} parser is not found
25121
25120
 
25122
25121
  ${block(JSON.stringify(command, null, 4)
@@ -25192,7 +25191,7 @@
25192
25191
  .map(removeMarkdownFormatting)
25193
25192
  .map((item) => item.trim());
25194
25193
  if (items.length === 0 || items[0] === '') {
25195
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
25194
+ throw new ParseError(spacetrim.spaceTrim((block) => `
25196
25195
  Malformed command:
25197
25196
  - ${raw}
25198
25197
 
@@ -25228,7 +25227,7 @@
25228
25227
  return command;
25229
25228
  }
25230
25229
  }
25231
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
25230
+ throw new ParseError(spacetrim.spaceTrim((block) => `
25232
25231
  Malformed or unknown command:
25233
25232
  - ${raw}
25234
25233
 
@@ -25279,7 +25278,7 @@
25279
25278
  if (!(error instanceof ParseError)) {
25280
25279
  throw error;
25281
25280
  }
25282
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
25281
+ throw new ParseError(spacetrim.spaceTrim((block) => `
25283
25282
  Invalid ${commandName} command:
25284
25283
 
25285
25284
  Your command:
@@ -25553,7 +25552,7 @@
25553
25552
  * @public exported from `@promptbook/markdown-utils`
25554
25553
  */
25555
25554
  function removeMarkdownComments(content) {
25556
- return spaceTrim$1.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
25555
+ return spacetrim.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
25557
25556
  }
25558
25557
 
25559
25558
  /**
@@ -25564,7 +25563,7 @@
25564
25563
  */
25565
25564
  function isFlatPipeline(pipelineString) {
25566
25565
  pipelineString = removeMarkdownComments(pipelineString);
25567
- pipelineString = spaceTrim__default["default"](pipelineString);
25566
+ pipelineString = spacetrim.spaceTrim(pipelineString);
25568
25567
  const isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
25569
25568
  //const isLastLineReturnStatement = pipelineString.split(/\r?\n/).pop()!.split('`').join('').startsWith('->');
25570
25569
  const isBacktickBlockUsed = pipelineString.includes('```');
@@ -25590,7 +25589,7 @@
25590
25589
  if (!isFlatPipeline(pipelineString)) {
25591
25590
  return pipelineString;
25592
25591
  }
25593
- pipelineString = spaceTrim__default["default"](pipelineString);
25592
+ pipelineString = spacetrim.spaceTrim(pipelineString);
25594
25593
  const pipelineStringLines = pipelineString.split(/\r?\n/);
25595
25594
  const potentialReturnStatement = pipelineStringLines.pop();
25596
25595
  let returnStatement;
@@ -25603,19 +25602,19 @@
25603
25602
  returnStatement = `-> {${DEFAULT_BOOK_OUTPUT_PARAMETER_NAME}}`;
25604
25603
  pipelineStringLines.push(potentialReturnStatement);
25605
25604
  }
25606
- const prompt = spaceTrim__default["default"](pipelineStringLines.join('\n'));
25605
+ const prompt = spacetrim.spaceTrim(pipelineStringLines.join('\n'));
25607
25606
  let quotedPrompt;
25608
25607
  if (prompt.split(/\r?\n/).length <= 1) {
25609
25608
  quotedPrompt = `> ${prompt}`;
25610
25609
  }
25611
25610
  else {
25612
- quotedPrompt = spaceTrim__default["default"]((block) => `
25611
+ quotedPrompt = spacetrim.spaceTrim((block) => `
25613
25612
  \`\`\`
25614
25613
  ${block(prompt.split('`').join('\\`'))}
25615
25614
  \`\`\`
25616
25615
  `);
25617
25616
  }
25618
- pipelineString = validatePipelineString(spaceTrim__default["default"]((block) => `
25617
+ pipelineString = validatePipelineString(spacetrim.spaceTrim((block) => `
25619
25618
  # ${DEFAULT_BOOK_TITLE}
25620
25619
 
25621
25620
  ## Prompt
@@ -25679,7 +25678,7 @@
25679
25678
  function extractOneBlockFromMarkdown(markdown) {
25680
25679
  const codeBlocks = extractAllBlocksFromMarkdown(markdown);
25681
25680
  if (codeBlocks.length !== 1) {
25682
- throw new ParseError(spaceTrim__default["default"]((block) => `
25681
+ throw new ParseError(spacetrim.spaceTrim((block) => `
25683
25682
  There should be exactly 1 code block in task section, found ${codeBlocks.length} code blocks
25684
25683
 
25685
25684
  ${block(codeBlocks.map((block, i) => `Block ${i + 1}:\n${block.content}`).join('\n\n\n'))}
@@ -25704,7 +25703,7 @@
25704
25703
  }
25705
25704
  const title = lines[0].replace(/^#+\s*/, '');
25706
25705
  const level = (_b = (_a = lines[0].match(/^#+/)) === null || _a === void 0 ? void 0 : _a[0].length) !== null && _b !== void 0 ? _b : 0;
25707
- const content = spaceTrim__default["default"](lines.slice(1).join('\n'));
25706
+ const content = spacetrim.spaceTrim(lines.slice(1).join('\n'));
25708
25707
  if (level < 1 || level > 6) {
25709
25708
  throw new ParseError('Markdown section must have heading level between 1 and 6');
25710
25709
  }
@@ -25732,7 +25731,7 @@
25732
25731
  if (buffer.length === 0) {
25733
25732
  return;
25734
25733
  }
25735
- let section = spaceTrim__default["default"](buffer.join('\n'));
25734
+ let section = spacetrim.spaceTrim(buffer.join('\n'));
25736
25735
  if (section === '') {
25737
25736
  return;
25738
25737
  }
@@ -25807,7 +25806,7 @@
25807
25806
  flattenedMarkdown += `## ${title}` + `\n\n`;
25808
25807
  flattenedMarkdown += content + `\n\n`; // <- [🧠] Maybe 3 new lines?
25809
25808
  }
25810
- return spaceTrim__default["default"](flattenedMarkdown);
25809
+ return spacetrim.spaceTrim(flattenedMarkdown);
25811
25810
  }
25812
25811
  /**
25813
25812
  * TODO: [🏛] This can be part of markdown builder
@@ -25869,7 +25868,7 @@
25869
25868
  if (pipelineString.startsWith('#!')) {
25870
25869
  const [shebangLine, ...restLines] = pipelineString.split(/\r?\n/);
25871
25870
  if (!(shebangLine || '').includes('ptbk')) {
25872
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
25871
+ throw new ParseError(spacetrim.spaceTrim((block) => `
25873
25872
  It seems that you try to parse a book file which has non-standard shebang line for book files:
25874
25873
  Shebang line must contain 'ptbk'
25875
25874
 
@@ -25885,7 +25884,7 @@
25885
25884
  pipelineString = validatePipelineString(restLines.join('\n'));
25886
25885
  }
25887
25886
  pipelineString = removeMarkdownComments(pipelineString);
25888
- pipelineString = spaceTrim$1.spaceTrim(pipelineString);
25887
+ pipelineString = spacetrim.spaceTrim(pipelineString);
25889
25888
  // <- TODO: [😧] `spaceTrim` should preserve discriminated type *(or at lease `PipelineString`)*
25890
25889
  pipelineString = deflatePipeline(pipelineString);
25891
25890
  // ==============
@@ -25897,7 +25896,7 @@
25897
25896
  // ==============
25898
25897
  // Note: 1️⃣◽4️⃣ Check markdown structure
25899
25898
  if (pipelineHead === undefined) {
25900
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
25899
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
25901
25900
  Pipeline head is not defined
25902
25901
 
25903
25902
  ${block(getPipelineIdentification())}
@@ -25906,7 +25905,7 @@
25906
25905
  `));
25907
25906
  }
25908
25907
  if (pipelineHead.level !== 1) {
25909
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
25908
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
25910
25909
  Pipeline head is not h1
25911
25910
 
25912
25911
  ${block(getPipelineIdentification())}
@@ -25915,7 +25914,7 @@
25915
25914
  `));
25916
25915
  }
25917
25916
  if (!pipelineSections.every((section) => section.level === 2)) {
25918
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
25917
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
25919
25918
  Not every pipeline section is h2
25920
25919
 
25921
25920
  ${block(getPipelineIdentification())}
@@ -25928,7 +25927,7 @@
25928
25927
  const defineParam = (parameterCommand) => {
25929
25928
  const { parameterName, parameterDescription, isInput, isOutput } = parameterCommand;
25930
25929
  if (RESERVED_PARAMETER_NAMES.includes(parameterName)) {
25931
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
25930
+ throw new ParseError(spacetrim.spaceTrim((block) => `
25932
25931
  Parameter name {${parameterName}} is reserved and cannot be used as resulting parameter name
25933
25932
 
25934
25933
  ${block(getPipelineIdentification())}
@@ -25939,7 +25938,7 @@
25939
25938
  existingParameter.description &&
25940
25939
  existingParameter.description !== parameterDescription &&
25941
25940
  parameterDescription) {
25942
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
25941
+ throw new ParseError(spacetrim.spaceTrim((block) => `
25943
25942
  Parameter \`{${parameterName}}\` is defined multiple times with different description:
25944
25943
 
25945
25944
  ${block(getPipelineIdentification())}
@@ -25977,7 +25976,7 @@
25977
25976
  description = description.split(/^>.*$/gm).join('');
25978
25977
  //Note: Remove lists and return statement - TODO: [🎾] Make util (exported from `@promptbool/utils`)
25979
25978
  description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
25980
- description = spaceTrim$1.spaceTrim(description);
25979
+ description = spacetrim.spaceTrim(description);
25981
25980
  if (description === '') {
25982
25981
  description = undefined;
25983
25982
  }
@@ -25988,7 +25987,7 @@
25988
25987
  const command = parseCommand(listItem, 'PIPELINE_HEAD');
25989
25988
  const commandParser = getParserForCommand(command);
25990
25989
  if (commandParser.isUsedInPipelineHead !== true /* <- Note: [🦦][4] */) {
25991
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
25990
+ throw new ParseError(spacetrim.spaceTrim((block) => `
25992
25991
  Command \`${command.type}\` is not allowed in the head of the pipeline ONLY at the pipeline task
25993
25992
 
25994
25993
  ${block(getPipelineIdentification())}
@@ -26002,7 +26001,7 @@
26002
26001
  if (!(error instanceof ParseError)) {
26003
26002
  throw error;
26004
26003
  }
26005
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
26004
+ throw new ParseError(spacetrim.spaceTrim((block) => `
26006
26005
  Command ${command.type} failed to apply to the pipeline
26007
26006
 
26008
26007
  The error:
@@ -26055,7 +26054,7 @@
26055
26054
  description = description.split(/^>.*$/gm).join('');
26056
26055
  //Note: Remove lists and return statement - TODO: [🎾]
26057
26056
  description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
26058
- description = spaceTrim$1.spaceTrim(description);
26057
+ description = spacetrim.spaceTrim(description);
26059
26058
  if (description === '') {
26060
26059
  description = undefined;
26061
26060
  }
@@ -26089,7 +26088,7 @@
26089
26088
  for (const { listItem, command } of commands) {
26090
26089
  const commandParser = getParserForCommand(command);
26091
26090
  if (commandParser.isUsedInPipelineTask !== true /* <- Note: [🦦][4] */) {
26092
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
26091
+ throw new ParseError(spacetrim.spaceTrim((block) => `
26093
26092
  Command \`${command.type}\` is not allowed in the task of the promptbook ONLY at the pipeline head
26094
26093
 
26095
26094
  ${block(getPipelineIdentification())}
@@ -26104,7 +26103,7 @@
26104
26103
  if (!(error instanceof ParseError)) {
26105
26104
  throw error;
26106
26105
  }
26107
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
26106
+ throw new ParseError(spacetrim.spaceTrim((block) => `
26108
26107
  Command \`${command.type}\` failed to apply to the task
26109
26108
 
26110
26109
  The error:
@@ -26135,14 +26134,14 @@
26135
26134
  // TODO: [🍧] Should be done in SECTION command
26136
26135
  if ($taskJson.taskType === 'SCRIPT_TASK') {
26137
26136
  if (!language) {
26138
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
26137
+ throw new ParseError(spacetrim.spaceTrim((block) => `
26139
26138
  You must specify the language of the script in the \`SCRIPT\` task
26140
26139
 
26141
26140
  ${block(getPipelineIdentification())}
26142
26141
  `));
26143
26142
  }
26144
26143
  if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
26145
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
26144
+ throw new ParseError(spacetrim.spaceTrim((block) => `
26146
26145
  Script language ${language} is not supported.
26147
26146
 
26148
26147
  Supported languages are:
@@ -26304,7 +26303,7 @@
26304
26303
  const warningLine = `<!-- ${GENERATOR_WARNING} -->`;
26305
26304
  const sectionRegex = new RegExp(`<!--${sectionName}-->([\\s\\S]*?)<!--/${sectionName}-->`, 'g');
26306
26305
  const sectionMatch = content.match(sectionRegex);
26307
- const contentToInsert = spaceTrim$1.spaceTrim((block) => `
26306
+ const contentToInsert = spacetrim.spaceTrim((block) => `
26308
26307
  <!--${sectionName}-->
26309
26308
  ${block(warningLine)}
26310
26309
  ${block(sectionContent)}
@@ -26317,7 +26316,7 @@
26317
26316
  const placeForSection = removeMarkdownComments(content).match(/^##.*$/im);
26318
26317
  if (placeForSection !== null) {
26319
26318
  const [heading] = placeForSection;
26320
- return content.replace(heading, spaceTrim$1.spaceTrim((block) => `
26319
+ return content.replace(heading, spacetrim.spaceTrim((block) => `
26321
26320
  ${block(contentToInsert)}
26322
26321
 
26323
26322
  ${block(heading)}
@@ -26326,7 +26325,7 @@
26326
26325
  console.warn(`No place where to put the section <!--${sectionName}-->, using the end of the file`);
26327
26326
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
26328
26327
  // <- TODO: [🏮] Some better way how to get warnings from pipeline parsing / logic
26329
- return spaceTrim$1.spaceTrim((block) => `
26328
+ return spacetrim.spaceTrim((block) => `
26330
26329
  ${block(content)}
26331
26330
 
26332
26331
  ${block(contentToInsert)}
@@ -26350,7 +26349,7 @@
26350
26349
  return { href: `#${task.name}`, title: task.title };
26351
26350
  },
26352
26351
  });
26353
- const promptbookMermaidBlock = spaceTrim$1.spaceTrim((block) => `
26352
+ const promptbookMermaidBlock = spacetrim.spaceTrim((block) => `
26354
26353
  \`\`\`mermaid
26355
26354
  ${block(promptbookMermaid)}
26356
26355
  \`\`\`
@@ -26388,7 +26387,7 @@
26388
26387
  async promptDialog(options) {
26389
26388
  const answer = await this.options.callback(options);
26390
26389
  if (this.options.isVerbose) {
26391
- console.info(spaceTrim$1.spaceTrim((block) => `
26390
+ console.info(spacetrim.spaceTrim((block) => `
26392
26391
  📖 ${block(options.promptTitle)}
26393
26392
  👤 ${block(answer)}
26394
26393
  `));
@@ -26529,7 +26528,7 @@
26529
26528
  function executionReportJsonToString(executionReportJson, options) {
26530
26529
  var _a, _b, _c, _d, _e, _f;
26531
26530
  const { taxRate, chartsWidth } = { ...ExecutionReportStringOptionsDefaults, ...(options || {}) };
26532
- let executionReportString = spaceTrim$1.spaceTrim((block) => `
26531
+ let executionReportString = spacetrim.spaceTrim((block) => `
26533
26532
  # ${executionReportJson.title || 'Execution report'}
26534
26533
 
26535
26534
  ${block(executionReportJson.description || '')}
@@ -26651,7 +26650,7 @@
26651
26650
  if (just(true)) {
26652
26651
  executionReportString +=
26653
26652
  '\n\n\n\n' +
26654
- spaceTrim$1.spaceTrim((block) => {
26653
+ spacetrim.spaceTrim((block) => {
26655
26654
  var _a;
26656
26655
  return `
26657
26656
 
@@ -26670,7 +26669,7 @@
26670
26669
  executionReportString += '*No result*';
26671
26670
  }
26672
26671
  else if (typeof promptExecution.result.content === 'string') {
26673
- executionReportString += spaceTrim$1.spaceTrim((block) => `
26672
+ executionReportString += spacetrim.spaceTrim((block) => `
26674
26673
  \`\`\`
26675
26674
  ${block(escapeMarkdownBlock(promptExecution.result.content))}
26676
26675
  \`\`\`
@@ -26683,7 +26682,7 @@
26683
26682
  if (promptExecution.error && promptExecution.error.message) {
26684
26683
  executionReportString +=
26685
26684
  '\n\n\n\n' +
26686
- spaceTrim$1.spaceTrim((block) => `
26685
+ spacetrim.spaceTrim((block) => `
26687
26686
 
26688
26687
  ### Error
26689
26688
 
@@ -26762,7 +26761,7 @@
26762
26761
  // Note: For negligible usage, we report at least something
26763
26762
  reportItems.push('Negligible');
26764
26763
  }
26765
- return spaceTrim__default["default"]((block) => `
26764
+ return spacetrim.spaceTrim((block) => `
26766
26765
  Usage:
26767
26766
  ${block(reportItems.map((item) => `- ${item}`).join('\n'))}
26768
26767
  `);
@@ -26859,7 +26858,7 @@
26859
26858
  isSafe: true,
26860
26859
  status: 'UNKNOWN',
26861
26860
  confidence: 0.5,
26862
- message: spaceTrim$1.spaceTrim(`
26861
+ message: spacetrim.spaceTrim(`
26863
26862
  File is currently being analyzed by VirusTotal.
26864
26863
  Please check again later.
26865
26864
  `),
@@ -26896,7 +26895,7 @@
26896
26895
  isSafe,
26897
26896
  status,
26898
26897
  confidence,
26899
- message: spaceTrim$1.spaceTrim(`
26898
+ message: spacetrim.spaceTrim(`
26900
26899
  VirusTotal report:
26901
26900
  - Malicious: ${maliciousCount}
26902
26901
  - Suspicious: ${suspiciousCount}
@@ -27091,13 +27090,13 @@
27091
27090
  });
27092
27091
  const usedEnvMessage = `Unknown \`.env\` file` ;
27093
27092
  if (metadata.length === 0) {
27094
- return spaceTrim__default["default"]((block) => `
27093
+ return spacetrim.spaceTrim((block) => `
27095
27094
  No LLM providers are available.
27096
27095
 
27097
27096
  ${block(usedEnvMessage)}
27098
27097
  `);
27099
27098
  }
27100
- return spaceTrim__default["default"]((block) => `
27099
+ return spacetrim.spaceTrim((block) => `
27101
27100
 
27102
27101
  ${block(usedEnvMessage)}
27103
27102
 
@@ -27143,7 +27142,7 @@
27143
27142
  morePieces.push(`Not configured`); // <- Note: Can not be configured via environment variables
27144
27143
  }
27145
27144
  }
27146
- let providerMessage = spaceTrim__default["default"](`
27145
+ let providerMessage = spacetrim.spaceTrim(`
27147
27146
  ${i + 1}) **${title}** \`${className}\` from \`${packageName}\`
27148
27147
  ${morePieces.join('; ')}
27149
27148
  `);
@@ -27189,7 +27188,7 @@
27189
27188
  .find(({ packageName, className }) => llmConfiguration.packageName === packageName && llmConfiguration.className === className);
27190
27189
  if (registeredItem === undefined) {
27191
27190
  // console.log('$llmToolsRegister.list()', $llmToolsRegister.list());
27192
- throw new Error(spaceTrim__default["default"]((block) => `
27191
+ throw new Error(spacetrim.spaceTrim((block) => `
27193
27192
  There is no constructor for LLM provider \`${llmConfiguration.className}\` from \`${llmConfiguration.packageName}\`
27194
27193
  Running in ${!$isRunningInBrowser() ? '' : 'browser environment'}${!$isRunningInNode() ? '' : 'node environment'}${!$isRunningInWebWorker() ? '' : 'worker environment'}
27195
27194
 
@@ -27297,7 +27296,7 @@
27297
27296
  let normalizedContent = content;
27298
27297
  normalizedContent = normalizedContent.replace(/\s+/g, ' ');
27299
27298
  normalizedContent = normalizedContent.split('\r\n').join('\n');
27300
- normalizedContent = spaceTrim__default["default"](normalizedContent);
27299
+ normalizedContent = spacetrim.spaceTrim(normalizedContent);
27301
27300
  // Note: Do not need to save everything in the cache, just the relevant parameters
27302
27301
  const relevantParameterNames = extractParameterNames(content);
27303
27302
  const relevantParameters = Object.fromEntries(Object.entries(parameters).filter(([key]) => relevantParameterNames.has(key)));
@@ -28240,7 +28239,7 @@
28240
28239
  /**
28241
28240
  * List of available OpenAI models with pricing
28242
28241
  *
28243
- * Note: Synced with official API docs at 2025-11-19
28242
+ * Note: Synced with official API docs at 2026-03-22
28244
28243
  *
28245
28244
  * @see https://platform.openai.com/docs/models/
28246
28245
  * @see https://openai.com/api/pricing/
@@ -28362,8 +28361,8 @@
28362
28361
  modelName: 'gpt-4.1',
28363
28362
  modelDescription: 'Smartest non-reasoning model with 128K context window. Enhanced version of GPT-4 with improved instruction following, better factual accuracy, and reduced hallucinations. Features advanced function calling capabilities and superior performance on coding tasks. Ideal for applications requiring high intelligence without reasoning overhead.',
28364
28363
  pricing: {
28365
- prompt: pricing(`$3.00 / 1M tokens`),
28366
- output: pricing(`$12.00 / 1M tokens`),
28364
+ prompt: pricing(`$2.00 / 1M tokens`),
28365
+ output: pricing(`$8.00 / 1M tokens`),
28367
28366
  },
28368
28367
  },
28369
28368
  /**/
@@ -28374,8 +28373,8 @@
28374
28373
  modelName: 'gpt-4.1-mini',
28375
28374
  modelDescription: 'Smaller, faster version of GPT-4.1 with 128K context window. Balances intelligence and efficiency with 3x faster inference than base GPT-4.1. Maintains strong capabilities across text generation, reasoning, and coding while offering better cost-performance ratio for most applications.',
28376
28375
  pricing: {
28377
- prompt: pricing(`$0.80 / 1M tokens`),
28378
- output: pricing(`$3.20 / 1M tokens`),
28376
+ prompt: pricing(`$0.40 / 1M tokens`),
28377
+ output: pricing(`$1.60 / 1M tokens`),
28379
28378
  },
28380
28379
  },
28381
28380
  /**/
@@ -28386,8 +28385,8 @@
28386
28385
  modelName: 'gpt-4.1-nano',
28387
28386
  modelDescription: 'Fastest, most cost-efficient version of GPT-4.1 with 128K context window. Optimized for high-throughput applications requiring good quality at minimal cost. Features 5x faster inference than GPT-4.1 while maintaining adequate performance for most general-purpose tasks.',
28388
28387
  pricing: {
28389
- prompt: pricing(`$0.20 / 1M tokens`),
28390
- output: pricing(`$0.80 / 1M tokens`),
28388
+ prompt: pricing(`$0.10 / 1M tokens`),
28389
+ output: pricing(`$0.40 / 1M tokens`),
28391
28390
  },
28392
28391
  },
28393
28392
  /**/
@@ -28398,8 +28397,8 @@
28398
28397
  modelName: 'o3',
28399
28398
  modelDescription: 'Advanced reasoning model with 128K context window specializing in complex logical, mathematical, and analytical tasks. Successor to o1 with enhanced step-by-step problem-solving capabilities and superior performance on STEM-focused problems. Ideal for professional applications requiring deep analytical thinking and precise reasoning.',
28400
28399
  pricing: {
28401
- prompt: pricing(`$15.00 / 1M tokens`),
28402
- output: pricing(`$60.00 / 1M tokens`),
28400
+ prompt: pricing(`$2.00 / 1M tokens`),
28401
+ output: pricing(`$8.00 / 1M tokens`),
28403
28402
  },
28404
28403
  },
28405
28404
  /**/
@@ -28410,8 +28409,8 @@
28410
28409
  modelName: 'o3-pro',
28411
28410
  modelDescription: 'Enhanced version of o3 with more compute allocated for better responses on the most challenging problems. Features extended reasoning time and improved accuracy on complex analytical tasks. Designed for applications where maximum reasoning quality is more important than response speed.',
28412
28411
  pricing: {
28413
- prompt: pricing(`$30.00 / 1M tokens`),
28414
- output: pricing(`$120.00 / 1M tokens`),
28412
+ prompt: pricing(`$20.00 / 1M tokens`),
28413
+ output: pricing(`$80.00 / 1M tokens`),
28415
28414
  },
28416
28415
  },
28417
28416
  /**/
@@ -28422,8 +28421,8 @@
28422
28421
  modelName: 'o4-mini',
28423
28422
  modelDescription: 'Fast, cost-efficient reasoning model with 128K context window. Successor to o1-mini with improved analytical capabilities while maintaining speed advantages. Features enhanced mathematical reasoning and logical problem-solving at significantly lower cost than full reasoning models.',
28424
28423
  pricing: {
28425
- prompt: pricing(`$4.00 / 1M tokens`),
28426
- output: pricing(`$16.00 / 1M tokens`),
28424
+ prompt: pricing(`$1.10 / 1M tokens`),
28425
+ output: pricing(`$4.40 / 1M tokens`),
28427
28426
  },
28428
28427
  },
28429
28428
  /**/
@@ -28781,8 +28780,8 @@
28781
28780
  modelName: 'gpt-4o-2024-05-13',
28782
28781
  modelDescription: 'May 2024 version of GPT-4o with 128K context window. Features enhanced multimodal capabilities including superior image understanding (up to 20MP), audio processing, and improved reasoning. Optimized for 2x lower latency than GPT-4 Turbo while maintaining high performance. Includes knowledge up to October 2023. Ideal for production applications requiring reliable multimodal capabilities.',
28783
28782
  pricing: {
28784
- prompt: pricing(`$5.00 / 1M tokens`),
28785
- output: pricing(`$15.00 / 1M tokens`),
28783
+ prompt: pricing(`$2.50 / 1M tokens`),
28784
+ output: pricing(`$10.00 / 1M tokens`),
28786
28785
  },
28787
28786
  },
28788
28787
  /**/
@@ -28793,8 +28792,8 @@
28793
28792
  modelName: 'gpt-4o',
28794
28793
  modelDescription: "OpenAI's most advanced general-purpose multimodal model with 128K context window. Optimized for balanced performance, speed, and cost with 2x faster responses than GPT-4 Turbo. Features excellent vision processing, audio understanding, reasoning, and text generation quality. Represents optimal balance of capability and efficiency for most advanced applications.",
28795
28794
  pricing: {
28796
- prompt: pricing(`$5.00 / 1M tokens`),
28797
- output: pricing(`$15.00 / 1M tokens`),
28795
+ prompt: pricing(`$2.50 / 1M tokens`),
28796
+ output: pricing(`$10.00 / 1M tokens`),
28798
28797
  },
28799
28798
  },
28800
28799
  /**/
@@ -28865,8 +28864,8 @@
28865
28864
  modelName: 'o3-mini',
28866
28865
  modelDescription: 'Cost-effective reasoning model with 128K context window optimized for academic and scientific problem-solving. Features efficient performance on STEM tasks with specialized capabilities in mathematics, physics, chemistry, and computer science. Offers 80% of O1 performance on technical domains at significantly lower cost. Ideal for educational applications and research support.',
28867
28866
  pricing: {
28868
- prompt: pricing(`$3.00 / 1M tokens`),
28869
- output: pricing(`$12.00 / 1M tokens`),
28867
+ prompt: pricing(`$1.10 / 1M tokens`),
28868
+ output: pricing(`$4.40 / 1M tokens`),
28870
28869
  },
28871
28870
  },
28872
28871
  /**/
@@ -28966,53 +28965,6 @@
28966
28965
  * TODO: [🤝] DRY Maybe some common abstraction between `computeOpenAiUsage` and `computeAnthropicClaudeUsage`
28967
28966
  */
28968
28967
 
28969
- /**
28970
- * Maps Promptbook tools to OpenAI tools.
28971
- *
28972
- * @private
28973
- */
28974
- function mapToolsToOpenAi(tools) {
28975
- return tools.map((tool) => ({
28976
- type: 'function',
28977
- function: {
28978
- name: tool.name,
28979
- description: tool.description,
28980
- parameters: tool.parameters,
28981
- },
28982
- }));
28983
- }
28984
-
28985
- /**
28986
- * Builds a tool invocation script that injects hidden runtime context into tool args.
28987
- *
28988
- * @private utility of OpenAI tool execution wrappers
28989
- */
28990
- function buildToolInvocationScript(options) {
28991
- const { functionName, functionArgsExpression } = options;
28992
- return `
28993
- const args = ${functionArgsExpression};
28994
- const runtimeContextRaw =
28995
- typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
28996
- ? undefined
28997
- : ${TOOL_RUNTIME_CONTEXT_PARAMETER};
28998
-
28999
- if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
29000
- args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
29001
- }
29002
-
29003
- const toolProgressTokenRaw =
29004
- typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
29005
- ? undefined
29006
- : ${TOOL_PROGRESS_TOKEN_PARAMETER};
29007
-
29008
- if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
29009
- args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
29010
- }
29011
-
29012
- return await ${functionName}(args);
29013
- `;
29014
- }
29015
-
29016
28968
  /**
29017
28969
  * Parses an OpenAI error message to identify which parameter is unsupported
29018
28970
  *
@@ -29069,6 +29021,53 @@
29069
29021
  errorMessage.includes('does not support'));
29070
29022
  }
29071
29023
 
29024
+ /**
29025
+ * Builds a tool invocation script that injects hidden runtime context into tool args.
29026
+ *
29027
+ * @private utility of OpenAI tool execution wrappers
29028
+ */
29029
+ function buildToolInvocationScript(options) {
29030
+ const { functionName, functionArgsExpression } = options;
29031
+ return `
29032
+ const args = ${functionArgsExpression};
29033
+ const runtimeContextRaw =
29034
+ typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
29035
+ ? undefined
29036
+ : ${TOOL_RUNTIME_CONTEXT_PARAMETER};
29037
+
29038
+ if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
29039
+ args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
29040
+ }
29041
+
29042
+ const toolProgressTokenRaw =
29043
+ typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
29044
+ ? undefined
29045
+ : ${TOOL_PROGRESS_TOKEN_PARAMETER};
29046
+
29047
+ if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
29048
+ args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
29049
+ }
29050
+
29051
+ return await ${functionName}(args);
29052
+ `;
29053
+ }
29054
+
29055
+ /**
29056
+ * Maps Promptbook tools to OpenAI tools.
29057
+ *
29058
+ * @private
29059
+ */
29060
+ function mapToolsToOpenAi(tools) {
29061
+ return tools.map((tool) => ({
29062
+ type: 'function',
29063
+ function: {
29064
+ name: tool.name,
29065
+ description: tool.description,
29066
+ parameters: tool.parameters,
29067
+ },
29068
+ }));
29069
+ }
29070
+
29072
29071
  /**
29073
29072
  * Provides access to the structured clone implementation when available.
29074
29073
  */
@@ -30035,7 +30034,7 @@
30035
30034
  // Note: Match exact or prefix for model families
30036
30035
  const model = this.HARDCODED_MODELS.find(({ modelName }) => modelName === defaultModelName || modelName.startsWith(defaultModelName));
30037
30036
  if (model === undefined) {
30038
- throw new PipelineExecutionError(spaceTrim__default["default"]((block) => `
30037
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
30039
30038
  Cannot find model in ${this.title} models with name "${defaultModelName}" which should be used as default.
30040
30039
 
30041
30040
  Available models:
@@ -30961,7 +30960,7 @@
30961
30960
  }
30962
30961
  }
30963
30962
 
30964
- const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5-mini-2025-08-07';
30963
+ const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-nano';
30965
30964
  /**
30966
30965
  * Creates one structured log entry for streamed tool-call updates.
30967
30966
  *
@@ -31456,7 +31455,7 @@
31456
31455
  }),
31457
31456
  ],
31458
31457
  };
31459
- const errorMessage = spaceTrim__default["default"]((block) => `
31458
+ const errorMessage = spacetrim.spaceTrim((block) => `
31460
31459
 
31461
31460
  The invoked tool \`${functionName}\` failed with error:
31462
31461
 
@@ -32174,7 +32173,7 @@
32174
32173
  assertsError(error);
32175
32174
  const serializedError = serializeError(error);
32176
32175
  errors = [serializedError];
32177
- functionResponse = spaceTrim__default["default"]((block) => `
32176
+ functionResponse = spacetrim.spaceTrim((block) => `
32178
32177
 
32179
32178
  The invoked tool \`${functionName}\` failed with error:
32180
32179
 
@@ -33113,7 +33112,7 @@
33113
33112
  if (commitment.type !== 'OPEN') {
33114
33113
  continue;
33115
33114
  }
33116
- const trimmed = spaceTrim$1.spaceTrim(commitment.content);
33115
+ const trimmed = spacetrim.spaceTrim(commitment.content);
33117
33116
  return trimmed || null;
33118
33117
  }
33119
33118
  return null;
@@ -33182,7 +33181,7 @@
33182
33181
  if (isJsonSchemaResponseFormat(responseFormat)) {
33183
33182
  const jsonSchema = responseFormat.json_schema;
33184
33183
  const schemaJson = JSON.stringify(jsonSchema, null, 4);
33185
- userMessageContent = spaceTrim__default["default"]((block) => `
33184
+ userMessageContent = spacetrim.spaceTrim((block) => `
33186
33185
  ${block(prompt.content)}
33187
33186
 
33188
33187
  NOTE Request was made through OpenAI Compatible API with \`response_format\` of type \`json_schema\` with the following schema:
@@ -33213,12 +33212,12 @@
33213
33212
  const formattedAgentMessage = formatAgentMessageForJsonMode(result.content, usesJsonSchemaMode);
33214
33213
  const teacherInstructions = extractOpenTeacherInstructions(agentSource);
33215
33214
  const teacherInstructionsSection = teacherInstructions
33216
- ? spaceTrim__default["default"]((block) => `
33215
+ ? spacetrim.spaceTrim((block) => `
33217
33216
  **Teacher instructions:**
33218
33217
  ${block(teacherInstructions)}
33219
33218
  `)
33220
33219
  : '';
33221
- const teacherPromptContent = spaceTrim__default["default"]((block) => `
33220
+ const teacherPromptContent = spacetrim.spaceTrim((block) => `
33222
33221
 
33223
33222
  You are a teacher agent helping another agent to learn from its interactions.
33224
33223
 
@@ -33251,7 +33250,7 @@
33251
33250
  ? '- This interaction used JSON mode, so the agent answer should stay as a formatted JSON code block.'
33252
33251
  : ''}
33253
33252
  ${block(isInitialMessageMissing
33254
- ? spaceTrim__default["default"](`
33253
+ ? spacetrim.spaceTrim(`
33255
33254
  - The agent source does not have an INITIAL MESSAGE defined, generate one.
33256
33255
  - The INITIAL MESSAGE should be welcoming, informative about the agent capabilities and also should give some quick options to start the conversation with the agent.
33257
33256
  - The quick option looks like \`[👋 Hello](?message=Hello, how are you?)\`
@@ -33294,7 +33293,7 @@
33294
33293
  */
33295
33294
  appendToAgentSource(section) {
33296
33295
  const currentSource = this.options.getAgentSource();
33297
- const newSource = padBook(validateBook(spaceTrim__default["default"](currentSource) + section));
33296
+ const newSource = padBook(validateBook(spacetrim.spaceTrim(currentSource) + section));
33298
33297
  this.options.updateAgentSource(newSource);
33299
33298
  }
33300
33299
  }
@@ -33322,13 +33321,13 @@
33322
33321
  }
33323
33322
  const parsedJson = tryParseJson(content);
33324
33323
  if (parsedJson === null) {
33325
- return spaceTrim__default["default"]((block) => `
33324
+ return spacetrim.spaceTrim((block) => `
33326
33325
  \`\`\`json
33327
33326
  ${block(content)}
33328
33327
  \`\`\`
33329
33328
  `);
33330
33329
  }
33331
- return spaceTrim__default["default"]((block) => `
33330
+ return spacetrim.spaceTrim((block) => `
33332
33331
  \`\`\`json
33333
33332
  ${block(JSON.stringify(parsedJson, null, 4))}
33334
33333
  \`\`\`
@@ -33360,7 +33359,7 @@
33360
33359
  const internalMessagesSection = options.internalMessages
33361
33360
  .map((internalMessage) => formatInternalLearningMessage(internalMessage))
33362
33361
  .join('\n\n');
33363
- return spaceTrim__default["default"]((block) => `
33362
+ return spacetrim.spaceTrim((block) => `
33364
33363
 
33365
33364
  USER MESSAGE
33366
33365
  ${block(options.userMessageContent)}
@@ -33378,7 +33377,7 @@
33378
33377
  * @private function of Agent
33379
33378
  */
33380
33379
  function formatInternalLearningMessage(internalMessage) {
33381
- return spaceTrim__default["default"]((block) => `
33380
+ return spacetrim.spaceTrim((block) => `
33382
33381
  INTERNAL MESSAGE
33383
33382
  ${block(stringifyInternalLearningPayload(internalMessage))}
33384
33383
  `);
@@ -33882,7 +33881,7 @@
33882
33881
  const bookString = prompt(strings, ...values).toString();
33883
33882
  if (!isValidPipelineString(bookString)) {
33884
33883
  // TODO: Make the CustomError for this
33885
- throw new Error(spaceTrim__default["default"](`
33884
+ throw new Error(spacetrim.spaceTrim(`
33886
33885
  The string is not a valid pipeline string
33887
33886
 
33888
33887
  book\`
@@ -33892,7 +33891,7 @@
33892
33891
  }
33893
33892
  if (!isValidBook(bookString)) {
33894
33893
  // TODO: Make the CustomError for this
33895
- throw new Error(spaceTrim__default["default"](`
33894
+ throw new Error(spacetrim.spaceTrim(`
33896
33895
  The string is not a valid book
33897
33896
 
33898
33897
  book\`
@@ -34219,7 +34218,7 @@
34219
34218
  .filter((line) => Boolean(line))
34220
34219
  .join('\n');
34221
34220
  const personaBlock = profile.personaDescription
34222
- ? spaceTrim__default["default"]((block) => `
34221
+ ? spacetrim.spaceTrim((block) => `
34223
34222
  PERSONA
34224
34223
  ${block(profile.personaDescription || '')}
34225
34224
  `)
@@ -34255,7 +34254,7 @@
34255
34254
  // <- TODO: [🐱‍🚀] What about closed-source agents?
34256
34255
  // <- TODO: [🐱‍🚀] Maybe use promptbookFetch
34257
34256
  if (!profileResponse.ok) {
34258
- throw new Error(spaceTrim__default["default"]((block) => `
34257
+ throw new Error(spacetrim.spaceTrim((block) => `
34259
34258
  Failed to fetch remote agent profile:
34260
34259
 
34261
34260
  Agent URL:
@@ -35489,7 +35488,7 @@
35489
35488
  }
35490
35489
  const KNOWLEDGE_THRESHOLD = 1000;
35491
35490
  if (directKnowledge.join('\n').length > KNOWLEDGE_THRESHOLD || knowledgeSources.length > 0) {
35492
- return spaceTrim__default["default"]((block) => `
35491
+ return spacetrim.spaceTrim((block) => `
35493
35492
  #!/usr/bin/env node
35494
35493
 
35495
35494
  import * as dotenv from 'dotenv';
@@ -35564,7 +35563,7 @@
35564
35563
 
35565
35564
  if (context) {
35566
35565
  question = spaceTrim(\`
35567
- ${block(spaceTrim__default["default"](`
35566
+ ${block(spacetrim.spaceTrim(`
35568
35567
  Here is some additional context to help you answer the question:
35569
35568
  \${context}
35570
35569
 
@@ -35645,7 +35644,7 @@
35645
35644
  })();
35646
35645
  `);
35647
35646
  }
35648
- const source = spaceTrim__default["default"]((block) => `
35647
+ const source = spacetrim.spaceTrim((block) => `
35649
35648
 
35650
35649
  #!/usr/bin/env node
35651
35650
 
@@ -35837,7 +35836,7 @@
35837
35836
  function aboutPromptbookInformation(options) {
35838
35837
  const { isServersInfoIncluded = true, isRuntimeEnvironmentInfoIncluded = true } = options || {};
35839
35838
  const fullInfoPieces = [];
35840
- const basicInfo = spaceTrim__default["default"](`
35839
+ const basicInfo = spacetrim.spaceTrim(`
35841
35840
 
35842
35841
  # ${NAME}
35843
35842
 
@@ -35849,7 +35848,7 @@
35849
35848
  `);
35850
35849
  fullInfoPieces.push(basicInfo);
35851
35850
  if (isServersInfoIncluded) {
35852
- const serversInfo = spaceTrim__default["default"]((block) => `
35851
+ const serversInfo = spacetrim.spaceTrim((block) => `
35853
35852
 
35854
35853
  ## Servers
35855
35854
 
@@ -35863,7 +35862,7 @@
35863
35862
  ...runtimeEnvironment,
35864
35863
  isCostPrevented: IS_COST_PREVENTED,
35865
35864
  };
35866
- const environmentInfo = spaceTrim__default["default"]((block) => `
35865
+ const environmentInfo = spacetrim.spaceTrim((block) => `
35867
35866
 
35868
35867
  ## Environment
35869
35868
 
@@ -35873,7 +35872,7 @@
35873
35872
  `);
35874
35873
  fullInfoPieces.push(environmentInfo);
35875
35874
  }
35876
- const fullInfo = spaceTrim__default["default"](fullInfoPieces.join('\n\n'));
35875
+ const fullInfo = spacetrim.spaceTrim(fullInfoPieces.join('\n\n'));
35877
35876
  return fullInfo;
35878
35877
  }
35879
35878
  /**
@@ -36196,7 +36195,7 @@
36196
36195
  if (initialRules.length === 0) {
36197
36196
  initialRules.push($randomAgentRule(namePool));
36198
36197
  }
36199
- const agentSource = validateBook(spaceTrim__default["default"]((block) => `
36198
+ const agentSource = validateBook(spacetrim.spaceTrim((block) => `
36200
36199
  ${agentName}
36201
36200
 
36202
36201