@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/esm/index.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SHA256 } from 'crypto-js';
2
2
  import hexEncoder from 'crypto-js/enc-hex';
3
- import spaceTrim$2, { spaceTrim as spaceTrim$1 } from 'spacetrim';
3
+ import { spaceTrim as spaceTrim$1 } from 'spacetrim';
4
4
  import { randomBytes } from 'crypto';
5
5
  import { Subject, BehaviorSubject } from 'rxjs';
6
6
  import { forTime } from 'waitasecond';
@@ -28,7 +28,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
28
28
  * @generated
29
29
  * @see https://github.com/webgptorg/promptbook
30
30
  */
31
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-13';
31
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-16';
32
32
  /**
33
33
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
34
34
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1353,7 +1353,7 @@ false);
1353
1353
  function getErrorReportUrl(error) {
1354
1354
  const report = {
1355
1355
  title: `🐜 Error report from ${NAME}`,
1356
- body: spaceTrim$2((block) => `
1356
+ body: spaceTrim$1((block) => `
1357
1357
 
1358
1358
 
1359
1359
  \`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
@@ -1548,7 +1548,7 @@ function valueToString(value) {
1548
1548
  * @public exported from `@promptbook/utils`
1549
1549
  */
1550
1550
  function computeHash(value) {
1551
- return SHA256(hexEncoder.parse(spaceTrim$2(valueToString(value)))).toString( /* hex */);
1551
+ return SHA256(hexEncoder.parse(spaceTrim$1(valueToString(value)))).toString( /* hex */);
1552
1552
  }
1553
1553
  /**
1554
1554
  * TODO: [🥬][🥬] Use this ACRY
@@ -1870,7 +1870,7 @@ function pipelineJsonToString(pipelineJson) {
1870
1870
  pipelineString += '\n\n';
1871
1871
  pipelineString += '```' + contentLanguage;
1872
1872
  pipelineString += '\n';
1873
- pipelineString += spaceTrim$2(content);
1873
+ pipelineString += spaceTrim$1(content);
1874
1874
  // <- TODO: [main] !!3 Escape
1875
1875
  // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
1876
1876
  pipelineString += '\n';
@@ -1991,7 +1991,7 @@ function checkSerializableAsJson(options) {
1991
1991
  }
1992
1992
  else if (typeof value === 'object') {
1993
1993
  if (value instanceof Date) {
1994
- throw new UnexpectedError(spaceTrim$2((block) => `
1994
+ throw new UnexpectedError(spaceTrim$1((block) => `
1995
1995
  \`${name}\` is Date
1996
1996
 
1997
1997
  Use \`string_date_iso8601\` instead
@@ -2010,7 +2010,7 @@ function checkSerializableAsJson(options) {
2010
2010
  throw new UnexpectedError(`${name} is RegExp`);
2011
2011
  }
2012
2012
  else if (value instanceof Error) {
2013
- throw new UnexpectedError(spaceTrim$2((block) => `
2013
+ throw new UnexpectedError(spaceTrim$1((block) => `
2014
2014
  \`${name}\` is unserialized Error
2015
2015
 
2016
2016
  Use function \`serializeError\`
@@ -2033,7 +2033,7 @@ function checkSerializableAsJson(options) {
2033
2033
  }
2034
2034
  catch (error) {
2035
2035
  assertsError(error);
2036
- throw new UnexpectedError(spaceTrim$2((block) => `
2036
+ throw new UnexpectedError(spaceTrim$1((block) => `
2037
2037
  \`${name}\` is not serializable
2038
2038
 
2039
2039
  ${block(error.stack || error.message)}
@@ -2065,7 +2065,7 @@ function checkSerializableAsJson(options) {
2065
2065
  }
2066
2066
  }
2067
2067
  else {
2068
- throw new UnexpectedError(spaceTrim$2((block) => `
2068
+ throw new UnexpectedError(spaceTrim$1((block) => `
2069
2069
  \`${name}\` is unknown type
2070
2070
 
2071
2071
  Additional message for \`${name}\`:
@@ -3314,7 +3314,7 @@ function serializeError(error) {
3314
3314
  const { name, message, stack } = error;
3315
3315
  const { id } = error;
3316
3316
  if (!Object.keys(ALL_ERRORS).includes(name)) {
3317
- console.error(spaceTrim$2((block) => `
3317
+ console.error(spaceTrim$1((block) => `
3318
3318
 
3319
3319
  Cannot serialize error with name "${name}"
3320
3320
 
@@ -3347,7 +3347,7 @@ function jsonParse(value) {
3347
3347
  }
3348
3348
  else if (typeof value !== 'string') {
3349
3349
  console.error('Can not parse JSON from non-string value.', { text: value });
3350
- throw new Error(spaceTrim$2(`
3350
+ throw new Error(spaceTrim$1(`
3351
3351
  Can not parse JSON from non-string value.
3352
3352
 
3353
3353
  The value type: ${typeof value}
@@ -3361,7 +3361,7 @@ function jsonParse(value) {
3361
3361
  if (!(error instanceof Error)) {
3362
3362
  throw error;
3363
3363
  }
3364
- throw new Error(spaceTrim$2((block) => `
3364
+ throw new Error(spaceTrim$1((block) => `
3365
3365
  ${block(error.message)}
3366
3366
 
3367
3367
  The expected JSON text:
@@ -3414,7 +3414,7 @@ function deserializeError(error, isStackAddedToMessage = true) {
3414
3414
  message = `${name}: ${message}`;
3415
3415
  }
3416
3416
  if (isStackAddedToMessage && stack !== undefined && stack !== '') {
3417
- message = spaceTrim$2((block) => `
3417
+ message = spaceTrim$1((block) => `
3418
3418
  ${block(message)}
3419
3419
 
3420
3420
  Original stack trace:
@@ -3964,14 +3964,14 @@ class MultipleLlmExecutionTools {
3964
3964
  if (description === undefined) {
3965
3965
  return headLine;
3966
3966
  }
3967
- return spaceTrim$2((block) => `
3967
+ return spaceTrim$1((block) => `
3968
3968
  ${headLine}
3969
3969
 
3970
3970
  ${ /* <- Note: Indenting the description: */block(description)}
3971
3971
  `);
3972
3972
  })
3973
3973
  .join('\n\n');
3974
- return spaceTrim$2((block) => `
3974
+ return spaceTrim$1((block) => `
3975
3975
  Multiple LLM Providers:
3976
3976
 
3977
3977
  ${block(innerModelsTitlesAndDescriptions)}
@@ -4073,7 +4073,7 @@ class MultipleLlmExecutionTools {
4073
4073
  // 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
4074
4074
  // 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
4075
4075
  // 3) ...
4076
- spaceTrim$2((block) => `
4076
+ spaceTrim$1((block) => `
4077
4077
  All execution tools of ${this.title} failed:
4078
4078
 
4079
4079
  ${block(errors
@@ -4086,7 +4086,7 @@ class MultipleLlmExecutionTools {
4086
4086
  throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
4087
4087
  }
4088
4088
  else {
4089
- throw new PipelineExecutionError(spaceTrim$2((block) => `
4089
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
4090
4090
  You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
4091
4091
 
4092
4092
  Available \`LlmExecutionTools\`:
@@ -4123,7 +4123,7 @@ class MultipleLlmExecutionTools {
4123
4123
  */
4124
4124
  function joinLlmExecutionTools(title, ...llmExecutionTools) {
4125
4125
  if (llmExecutionTools.length === 0) {
4126
- const warningMessage = spaceTrim$2(`
4126
+ const warningMessage = spaceTrim$1(`
4127
4127
  You have not provided any \`LlmExecutionTools\`
4128
4128
  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
4129
 
@@ -4378,14 +4378,14 @@ function $registeredScrapersMessage(availableScrapers) {
4378
4378
  return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
4379
4379
  });
4380
4380
  if (metadata.length === 0) {
4381
- return spaceTrim$2(`
4381
+ return spaceTrim$1(`
4382
4382
  **No scrapers are available**
4383
4383
 
4384
4384
  This is a unexpected behavior, you are probably using some broken version of Promptbook
4385
4385
  At least there should be available the metadata of the scrapers
4386
4386
  `);
4387
4387
  }
4388
- return spaceTrim$2((block) => `
4388
+ return spaceTrim$1((block) => `
4389
4389
  Available scrapers are:
4390
4390
  ${block(metadata
4391
4391
  .map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
@@ -4891,7 +4891,7 @@ const promptbookFetch = async (urlOrRequest, init) => {
4891
4891
  else if (urlOrRequest instanceof Request) {
4892
4892
  url = urlOrRequest.url;
4893
4893
  }
4894
- throw new PromptbookFetchError(spaceTrim$2((block) => `
4894
+ throw new PromptbookFetchError(spaceTrim$1((block) => `
4895
4895
  Can not fetch "${url}"
4896
4896
 
4897
4897
  Fetch error:
@@ -5051,7 +5051,7 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
5051
5051
  const fileExtension = getFileExtension(filename);
5052
5052
  const mimeType = extensionToMimeType(fileExtension || '');
5053
5053
  if (!(await isFileExisting(filename, tools.fs))) {
5054
- throw new NotFoundError(spaceTrim$2((block) => `
5054
+ throw new NotFoundError(spaceTrim$1((block) => `
5055
5055
  Can not make source handler for file which does not exist:
5056
5056
 
5057
5057
  File:
@@ -5144,7 +5144,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
5144
5144
  // <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
5145
5145
  break;
5146
5146
  }
5147
- console.warn(spaceTrim$2((block) => `
5147
+ console.warn(spaceTrim$1((block) => `
5148
5148
  Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
5149
5149
 
5150
5150
  The source:
@@ -5160,7 +5160,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
5160
5160
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
5161
5161
  }
5162
5162
  if (partialPieces === null) {
5163
- throw new KnowledgeScrapeError(spaceTrim$2((block) => `
5163
+ throw new KnowledgeScrapeError(spaceTrim$1((block) => `
5164
5164
  Cannot scrape knowledge
5165
5165
 
5166
5166
  The source:
@@ -5654,7 +5654,7 @@ const CsvFormatParser = {
5654
5654
  const { value, outputParameterName, settings, mapCallback, onProgress } = options;
5655
5655
  const csv = csvParse(value, settings);
5656
5656
  if (csv.errors.length !== 0) {
5657
- throw new CsvFormatError(spaceTrim$2((block) => `
5657
+ throw new CsvFormatError(spaceTrim$1((block) => `
5658
5658
  CSV parsing error
5659
5659
 
5660
5660
  Error(s) from CSV parsing:
@@ -5699,7 +5699,7 @@ const CsvFormatParser = {
5699
5699
  const { value, settings, mapCallback, onProgress } = options;
5700
5700
  const csv = csvParse(value, settings);
5701
5701
  if (csv.errors.length !== 0) {
5702
- throw new CsvFormatError(spaceTrim$2((block) => `
5702
+ throw new CsvFormatError(spaceTrim$1((block) => `
5703
5703
  CSV parsing error
5704
5704
 
5705
5705
  Error(s) from CSV parsing:
@@ -5909,7 +5909,7 @@ function mapAvailableToExpectedParameters(options) {
5909
5909
  }
5910
5910
  // Phase 2️⃣: Non-matching mapping
5911
5911
  if (expectedParameterNames.size !== availableParametersNames.size) {
5912
- throw new PipelineExecutionError(spaceTrim$2((block) => `
5912
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
5913
5913
  Can not map available parameters to expected parameters
5914
5914
 
5915
5915
  Mapped parameters:
@@ -6734,7 +6734,7 @@ async function executeFormatSubvalues(options) {
6734
6734
  return /* not await */ executeAttempts({ ...options, logLlmCall });
6735
6735
  }
6736
6736
  if (jokerParameterNames.length !== 0) {
6737
- throw new UnexpectedError(spaceTrim$2((block) => `
6737
+ throw new UnexpectedError(spaceTrim$1((block) => `
6738
6738
  JOKER parameters are not supported together with FOREACH command
6739
6739
 
6740
6740
  [🧞‍♀️] This should be prevented in \`validatePipeline\`
@@ -6747,7 +6747,7 @@ async function executeFormatSubvalues(options) {
6747
6747
  if (formatDefinition === undefined) {
6748
6748
  throw new UnexpectedError(
6749
6749
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6750
- spaceTrim$2((block) => `
6750
+ spaceTrim$1((block) => `
6751
6751
  Unsupported format "${task.foreach.formatName}"
6752
6752
 
6753
6753
  Available formats:
@@ -6764,7 +6764,7 @@ async function executeFormatSubvalues(options) {
6764
6764
  if (subvalueParser === undefined) {
6765
6765
  throw new UnexpectedError(
6766
6766
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6767
- spaceTrim$2((block) => `
6767
+ spaceTrim$1((block) => `
6768
6768
  Unsupported subformat name "${task.foreach.subformatName}" for format "${task.foreach.formatName}"
6769
6769
 
6770
6770
  Available subformat names for format "${formatDefinition.formatName}":
@@ -6804,7 +6804,7 @@ async function executeFormatSubvalues(options) {
6804
6804
  if (!(error instanceof PipelineExecutionError)) {
6805
6805
  throw error;
6806
6806
  }
6807
- const highLevelError = new PipelineExecutionError(spaceTrim$2((block) => `
6807
+ const highLevelError = new PipelineExecutionError(spaceTrim$1((block) => `
6808
6808
  ${error.message}
6809
6809
 
6810
6810
  This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -6828,7 +6828,7 @@ async function executeFormatSubvalues(options) {
6828
6828
  ...options,
6829
6829
  priority: priority + index,
6830
6830
  parameters: allSubparameters,
6831
- pipelineIdentification: spaceTrim$2((block) => `
6831
+ pipelineIdentification: spaceTrim$1((block) => `
6832
6832
  ${block(pipelineIdentification)}
6833
6833
  Subparameter index: ${index}
6834
6834
  `),
@@ -6837,7 +6837,7 @@ async function executeFormatSubvalues(options) {
6837
6837
  }
6838
6838
  catch (error) {
6839
6839
  if (length > BIG_DATASET_TRESHOLD) {
6840
- console.error(spaceTrim$2((block) => `
6840
+ console.error(spaceTrim$1((block) => `
6841
6841
  ${error.message}
6842
6842
 
6843
6843
  This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -8834,7 +8834,7 @@ function buildParametersSection(items) {
8834
8834
  const entries = items
8835
8835
  .flatMap((item) => formatParameterListItem(item).split(/\r?\n/))
8836
8836
  .filter((line) => line !== '');
8837
- return spaceTrim$2((block) => `
8837
+ return spaceTrim$1((block) => `
8838
8838
  **Parameters:**
8839
8839
  ${block(entries.join('\n'))}
8840
8840
 
@@ -8907,7 +8907,7 @@ function isPromptString(value) {
8907
8907
  */
8908
8908
  function prompt(strings, ...values) {
8909
8909
  if (values.length === 0) {
8910
- return new PromptString(spaceTrim$2(strings.join('')));
8910
+ return new PromptString(spaceTrim$1(strings.join('')));
8911
8911
  }
8912
8912
  const stringsWithHiddenParameters = strings.map((stringsItem) => ParameterEscaping.hideBrackets(stringsItem));
8913
8913
  const parameterMetadata = values.map((value) => {
@@ -8948,7 +8948,7 @@ function prompt(strings, ...values) {
8948
8948
  ? `${result}${stringsItem}`
8949
8949
  : `${result}${stringsItem}${ParameterSection.formatParameterPlaceholder(parameterName)}`;
8950
8950
  }, '');
8951
- pipelineString = spaceTrim$2(pipelineString);
8951
+ pipelineString = spaceTrim$1(pipelineString);
8952
8952
  try {
8953
8953
  pipelineString = templateParameters(pipelineString, parameters);
8954
8954
  }
@@ -8957,7 +8957,7 @@ function prompt(strings, ...values) {
8957
8957
  throw error;
8958
8958
  }
8959
8959
  console.error({ pipelineString, parameters, parameterNames: parameterNamesOrdered, error });
8960
- throw new UnexpectedError(spaceTrim$2((block) => `
8960
+ throw new UnexpectedError(spaceTrim$1((block) => `
8961
8961
  Internal error in prompt template literal
8962
8962
 
8963
8963
  ${block(JSON.stringify({ strings, values }, null, 4))}}
@@ -21636,7 +21636,7 @@ function hasHttpProtocol(value) {
21636
21636
  * @public exported from `@promptbook/core`
21637
21637
  */
21638
21638
  function normalizeAgentName(rawAgentName) {
21639
- return titleToName(spaceTrim$2(rawAgentName));
21639
+ return titleToName(spaceTrim$1(rawAgentName));
21640
21640
  }
21641
21641
 
21642
21642
  /**
@@ -21811,7 +21811,7 @@ function parseAgentSource(agentSource) {
21811
21811
  continue;
21812
21812
  }
21813
21813
  if (commitment.type === 'FROM') {
21814
- const content = spaceTrim$2(commitment.content).split(/\r?\n/)[0] || '';
21814
+ const content = spaceTrim$1(commitment.content).split(/\r?\n/)[0] || '';
21815
21815
  if (content === 'Adam' || content === '' /* <- Note: Adam is implicit */) {
21816
21816
  continue;
21817
21817
  }
@@ -21834,7 +21834,7 @@ function parseAgentSource(agentSource) {
21834
21834
  continue;
21835
21835
  }
21836
21836
  if (commitment.type === 'IMPORT') {
21837
- const content = spaceTrim$2(commitment.content).split(/\r?\n/)[0] || '';
21837
+ const content = spaceTrim$1(commitment.content).split(/\r?\n/)[0] || '';
21838
21838
  let label = content;
21839
21839
  let iconName = 'ExternalLink'; // Import remote
21840
21840
  try {
@@ -21872,7 +21872,7 @@ function parseAgentSource(agentSource) {
21872
21872
  continue;
21873
21873
  }
21874
21874
  if (commitment.type === 'KNOWLEDGE') {
21875
- const content = spaceTrim$2(commitment.content);
21875
+ const content = spaceTrim$1(commitment.content);
21876
21876
  const extractedUrls = extractUrlsFromText(content);
21877
21877
  let label = content;
21878
21878
  let iconName = 'Book';
@@ -21931,7 +21931,7 @@ function parseAgentSource(agentSource) {
21931
21931
  continue;
21932
21932
  }
21933
21933
  if (commitment.type === 'META LINK') {
21934
- const linkValue = spaceTrim$2(commitment.content);
21934
+ const linkValue = spaceTrim$1(commitment.content);
21935
21935
  links.push(linkValue);
21936
21936
  meta.link = linkValue;
21937
21937
  continue;
@@ -21941,11 +21941,11 @@ function parseAgentSource(agentSource) {
21941
21941
  continue;
21942
21942
  }
21943
21943
  if (commitment.type === 'META IMAGE') {
21944
- meta.image = spaceTrim$2(commitment.content);
21944
+ meta.image = spaceTrim$1(commitment.content);
21945
21945
  continue;
21946
21946
  }
21947
21947
  if (commitment.type === 'META DESCRIPTION') {
21948
- meta.description = spaceTrim$2(commitment.content);
21948
+ meta.description = spaceTrim$1(commitment.content);
21949
21949
  continue;
21950
21950
  }
21951
21951
  if (commitment.type === 'META DISCLAIMER') {
@@ -21953,7 +21953,7 @@ function parseAgentSource(agentSource) {
21953
21953
  continue;
21954
21954
  }
21955
21955
  if (commitment.type === 'META INPUT PLACEHOLDER') {
21956
- meta.inputPlaceholder = spaceTrim$2(commitment.content);
21956
+ meta.inputPlaceholder = spaceTrim$1(commitment.content);
21957
21957
  continue;
21958
21958
  }
21959
21959
  if (commitment.type === 'MESSAGE SUFFIX') {
@@ -21969,7 +21969,7 @@ function parseAgentSource(agentSource) {
21969
21969
  continue;
21970
21970
  }
21971
21971
  if (commitment.type === 'META VOICE') {
21972
- meta.voice = spaceTrim$2(commitment.content);
21972
+ meta.voice = spaceTrim$1(commitment.content);
21973
21973
  continue;
21974
21974
  }
21975
21975
  if (commitment.type !== 'META') {
@@ -21978,10 +21978,10 @@ function parseAgentSource(agentSource) {
21978
21978
  // Parse META commitments - format is "META TYPE content"
21979
21979
  const metaTypeRaw = commitment.content.split(' ')[0] || 'NONE';
21980
21980
  if (metaTypeRaw === 'LINK') {
21981
- links.push(spaceTrim$2(commitment.content.substring(metaTypeRaw.length)));
21981
+ links.push(spaceTrim$1(commitment.content.substring(metaTypeRaw.length)));
21982
21982
  }
21983
21983
  const metaType = normalizeTo_camelCase(metaTypeRaw);
21984
- meta[metaType] = spaceTrim$2(commitment.content.substring(metaTypeRaw.length));
21984
+ meta[metaType] = spaceTrim$1(commitment.content.substring(metaTypeRaw.length));
21985
21985
  }
21986
21986
  // Generate fullname fallback if no meta fullname specified
21987
21987
  if (!meta.fullname) {
@@ -22012,7 +22012,7 @@ function parseAgentSource(agentSource) {
22012
22012
  * @returns The content with normalized separators
22013
22013
  */
22014
22014
  function normalizeSeparator(content) {
22015
- const trimmed = spaceTrim$2(content);
22015
+ const trimmed = spaceTrim$1(content);
22016
22016
  if (trimmed.includes(',')) {
22017
22017
  return trimmed;
22018
22018
  }
@@ -22025,7 +22025,7 @@ function normalizeSeparator(content) {
22025
22025
  * @returns Normalized domain or a trimmed fallback.
22026
22026
  */
22027
22027
  function normalizeMetaDomain(content) {
22028
- const trimmed = spaceTrim$2(content);
22028
+ const trimmed = spaceTrim$1(content);
22029
22029
  return normalizeDomainForMatching(trimmed) || trimmed.toLowerCase();
22030
22030
  }
22031
22031
  /**
@@ -22184,7 +22184,7 @@ function validateBook(source) {
22184
22184
  * @deprecated Use `$generateBookBoilerplate` instead
22185
22185
  * @public exported from `@promptbook/core`
22186
22186
  */
22187
- const DEFAULT_BOOK = padBook(validateBook(spaceTrim$2(`
22187
+ const DEFAULT_BOOK = padBook(validateBook(spaceTrim$1(`
22188
22188
  AI Avatar
22189
22189
 
22190
22190
  PERSONA A friendly AI assistant that helps you with your tasks
@@ -23016,7 +23016,7 @@ const knowledgeCommandParser = {
23016
23016
  */
23017
23017
  parse(input) {
23018
23018
  const { args } = input;
23019
- const knowledgeSourceContent = spaceTrim$2(args[0] || '');
23019
+ const knowledgeSourceContent = spaceTrim$1(args[0] || '');
23020
23020
  if (knowledgeSourceContent === '') {
23021
23021
  throw new ParseError(`Source is not defined`);
23022
23022
  }
@@ -23160,7 +23160,7 @@ const sectionCommandParser = {
23160
23160
  normalized = normalized.split('DIALOGUE').join('DIALOG');
23161
23161
  const taskTypes = SectionTypes.filter((sectionType) => normalized.includes(sectionType.split('_TASK').join('')));
23162
23162
  if (taskTypes.length !== 1) {
23163
- throw new ParseError(spaceTrim$2((block) => `
23163
+ throw new ParseError(spaceTrim$1((block) => `
23164
23164
  Unknown section type "${normalized}"
23165
23165
 
23166
23166
  Supported section types are:
@@ -23180,7 +23180,7 @@ const sectionCommandParser = {
23180
23180
  */
23181
23181
  $applyToTaskJson(command, $taskJson, $pipelineJson) {
23182
23182
  if ($taskJson.isSectionTypeSet === true) {
23183
- throw new ParseError(spaceTrim$2(`
23183
+ throw new ParseError(spaceTrim$1(`
23184
23184
  Section type is already defined in the section.
23185
23185
  It can be defined only once.
23186
23186
  `));
@@ -23460,7 +23460,7 @@ const expectCommandParser = {
23460
23460
  /**
23461
23461
  * Description of the FORMAT command
23462
23462
  */
23463
- description: spaceTrim$2(`
23463
+ description: spaceTrim$1(`
23464
23464
  Expect command describes the desired output of the task *(after post-processing)*
23465
23465
  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
23466
  `),
@@ -23534,7 +23534,7 @@ const expectCommandParser = {
23534
23534
  }
23535
23535
  catch (error) {
23536
23536
  assertsError(error);
23537
- throw new ParseError(spaceTrim$2((block) => `
23537
+ throw new ParseError(spaceTrim$1((block) => `
23538
23538
  Invalid FORMAT command
23539
23539
  ${block(error.message)}:
23540
23540
  `));
@@ -23646,7 +23646,7 @@ function validateParameterName(parameterName) {
23646
23646
  if (!(error instanceof ParseError)) {
23647
23647
  throw error;
23648
23648
  }
23649
- throw new ParseError(spaceTrim$2((block) => `
23649
+ throw new ParseError(spaceTrim$1((block) => `
23650
23650
  ${block(error.message)}
23651
23651
 
23652
23652
  Tried to validate parameter name:
@@ -23705,7 +23705,7 @@ const foreachCommandParser = {
23705
23705
  const assignSign = args[3];
23706
23706
  const formatDefinition = FORMAT_DEFINITIONS.find((formatDefinition) => [formatDefinition.formatName, ...(formatDefinition.aliases || [])].includes(formatName));
23707
23707
  if (formatDefinition === undefined) {
23708
- throw new ParseError(spaceTrim$2((block) => `
23708
+ throw new ParseError(spaceTrim$1((block) => `
23709
23709
  Unsupported format "${formatName}"
23710
23710
 
23711
23711
  Available formats:
@@ -23717,7 +23717,7 @@ const foreachCommandParser = {
23717
23717
  }
23718
23718
  const subvalueParser = formatDefinition.subvalueParsers.find((subvalueParser) => [subvalueParser.subvalueName, ...(subvalueParser.aliases || [])].includes(subformatName));
23719
23719
  if (subvalueParser === undefined) {
23720
- throw new ParseError(spaceTrim$2((block) => `
23720
+ throw new ParseError(spaceTrim$1((block) => `
23721
23721
  Unsupported subformat name "${subformatName}" for format "${formatName}"
23722
23722
 
23723
23723
  Available subformat names for format "${formatDefinition.formatName}":
@@ -23765,7 +23765,7 @@ const foreachCommandParser = {
23765
23765
  outputSubparameterName = 'newLine';
23766
23766
  }
23767
23767
  else {
23768
- throw new ParseError(spaceTrim$2(`
23768
+ throw new ParseError(spaceTrim$1(`
23769
23769
  FOREACH ${formatName} ${subformatName} must specify output subparameter
23770
23770
 
23771
23771
  Correct example:
@@ -23841,7 +23841,7 @@ const formatCommandParser = {
23841
23841
  /**
23842
23842
  * Description of the FORMAT command
23843
23843
  */
23844
- description: spaceTrim$2(`
23844
+ description: spaceTrim$1(`
23845
23845
  Format command describes the desired output of the task (after post-processing)
23846
23846
  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
23847
  `),
@@ -24213,7 +24213,7 @@ const formfactorCommandParser = {
24213
24213
  const formfactorNameCandidate = args[0].toUpperCase();
24214
24214
  const formfactor = FORMFACTOR_DEFINITIONS.find((definition) => [definition.name, ...{ aliasNames: [], ...definition }.aliasNames].includes(formfactorNameCandidate));
24215
24215
  if (formfactor === undefined) {
24216
- throw new ParseError(spaceTrim$2((block) => `
24216
+ throw new ParseError(spaceTrim$1((block) => `
24217
24217
  Unknown formfactor name "${formfactorNameCandidate}"
24218
24218
 
24219
24219
  Available formfactors:
@@ -24232,7 +24232,7 @@ const formfactorCommandParser = {
24232
24232
  */
24233
24233
  $applyToPipelineJson(command, $pipelineJson) {
24234
24234
  if ($pipelineJson.formfactorName !== undefined && $pipelineJson.formfactorName !== command.formfactorName) {
24235
- throw new ParseError(spaceTrim$2(`
24235
+ throw new ParseError(spaceTrim$1(`
24236
24236
  Redefinition of \`FORMFACTOR\` in the pipeline head
24237
24237
 
24238
24238
  You have used:
@@ -24380,7 +24380,7 @@ const modelCommandParser = {
24380
24380
  */
24381
24381
  parse(input) {
24382
24382
  const { args, normalized } = input;
24383
- const availableVariantsMessage = spaceTrim$2((block) => `
24383
+ const availableVariantsMessage = spaceTrim$1((block) => `
24384
24384
  Available variants are:
24385
24385
  ${block(MODEL_VARIANTS.map((variantName) => `- ${variantName}${variantName !== 'EMBEDDING' ? '' : ' (Not available in pipeline)'}`).join('\n'))}
24386
24386
  `);
@@ -24402,14 +24402,14 @@ const modelCommandParser = {
24402
24402
  // <- Note: [🤖]
24403
24403
  }
24404
24404
  else if (normalized.startsWith('MODEL_VARIANT_EMBED')) {
24405
- spaceTrim$2((block) => `
24405
+ spaceTrim$1((block) => `
24406
24406
  Embedding model can not be used in pipeline
24407
24407
 
24408
24408
  ${block(availableVariantsMessage)}
24409
24409
  `);
24410
24410
  }
24411
24411
  else {
24412
- throw new ParseError(spaceTrim$2((block) => `
24412
+ throw new ParseError(spaceTrim$1((block) => `
24413
24413
  Unknown model variant in command:
24414
24414
 
24415
24415
  ${block(availableVariantsMessage)}
@@ -24424,7 +24424,7 @@ const modelCommandParser = {
24424
24424
  };
24425
24425
  }
24426
24426
  else {
24427
- throw new ParseError(spaceTrim$2((block) => `
24427
+ throw new ParseError(spaceTrim$1((block) => `
24428
24428
  Unknown model key in command.
24429
24429
 
24430
24430
  Supported model keys are:
@@ -24451,7 +24451,7 @@ const modelCommandParser = {
24451
24451
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
24452
24452
  }
24453
24453
  else {
24454
- throw new ParseError(spaceTrim$2(`
24454
+ throw new ParseError(spaceTrim$1(`
24455
24455
  Redefinition of \`MODEL ${command.key}\` in the pipeline head
24456
24456
 
24457
24457
  You have used:
@@ -24479,7 +24479,7 @@ const modelCommandParser = {
24479
24479
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
24480
24480
  }
24481
24481
  else {
24482
- throw new ParseError(spaceTrim$2(`
24482
+ throw new ParseError(spaceTrim$1(`
24483
24483
  Redefinition of MODEL \`${command.key}\` in the task "${$taskJson.title || $taskJson.name}"
24484
24484
 
24485
24485
  You have used:
@@ -24489,7 +24489,7 @@ const modelCommandParser = {
24489
24489
  }
24490
24490
  }
24491
24491
  if (command.value === ($pipelineJson.defaultModelRequirements || {})[command.key]) {
24492
- console.log(spaceTrim$2(`
24492
+ console.log(spaceTrim$1(`
24493
24493
  Setting MODEL \`${command.key}\` in the task "${$taskJson.title || $taskJson.name}" to the same value as in the pipeline head
24494
24494
 
24495
24495
  In pipeline head:
@@ -24572,7 +24572,7 @@ const parameterCommandParser = {
24572
24572
  // <- TODO: When [🥶] fixed, change to:
24573
24573
  // > const parameterDescriptionRaw = rawArgs.split(parameterNameRaw).join('').trim();
24574
24574
  if (parameterDescriptionRaw && parameterDescriptionRaw.match(/\{(?<embeddedParameterName>[a-z0-9_]+)\}/im)) {
24575
- throw new ParseError(spaceTrim$2((block) => `
24575
+ throw new ParseError(spaceTrim$1((block) => `
24576
24576
  Parameter \`{${parameterNameRaw}}\` can not contain another parameter in description
24577
24577
 
24578
24578
  The description:
@@ -24754,7 +24754,7 @@ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
24754
24754
  persona.description = personaDescription;
24755
24755
  return;
24756
24756
  }
24757
- console.warn(spaceTrim$2(`
24757
+ console.warn(spaceTrim$1(`
24758
24758
 
24759
24759
  Persona "${personaName}" is defined multiple times with different description:
24760
24760
 
@@ -24765,7 +24765,7 @@ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
24765
24765
  ${personaDescription}
24766
24766
 
24767
24767
  `));
24768
- persona.description += spaceTrim$2('\n\n' + personaDescription);
24768
+ persona.description += spaceTrim$1('\n\n' + personaDescription);
24769
24769
  }
24770
24770
 
24771
24771
  /**
@@ -25564,7 +25564,7 @@ function removeMarkdownComments(content) {
25564
25564
  */
25565
25565
  function isFlatPipeline(pipelineString) {
25566
25566
  pipelineString = removeMarkdownComments(pipelineString);
25567
- pipelineString = spaceTrim$2(pipelineString);
25567
+ pipelineString = spaceTrim$1(pipelineString);
25568
25568
  const isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
25569
25569
  //const isLastLineReturnStatement = pipelineString.split(/\r?\n/).pop()!.split('`').join('').startsWith('->');
25570
25570
  const isBacktickBlockUsed = pipelineString.includes('```');
@@ -25590,7 +25590,7 @@ function deflatePipeline(pipelineString) {
25590
25590
  if (!isFlatPipeline(pipelineString)) {
25591
25591
  return pipelineString;
25592
25592
  }
25593
- pipelineString = spaceTrim$2(pipelineString);
25593
+ pipelineString = spaceTrim$1(pipelineString);
25594
25594
  const pipelineStringLines = pipelineString.split(/\r?\n/);
25595
25595
  const potentialReturnStatement = pipelineStringLines.pop();
25596
25596
  let returnStatement;
@@ -25603,19 +25603,19 @@ function deflatePipeline(pipelineString) {
25603
25603
  returnStatement = `-> {${DEFAULT_BOOK_OUTPUT_PARAMETER_NAME}}`;
25604
25604
  pipelineStringLines.push(potentialReturnStatement);
25605
25605
  }
25606
- const prompt = spaceTrim$2(pipelineStringLines.join('\n'));
25606
+ const prompt = spaceTrim$1(pipelineStringLines.join('\n'));
25607
25607
  let quotedPrompt;
25608
25608
  if (prompt.split(/\r?\n/).length <= 1) {
25609
25609
  quotedPrompt = `> ${prompt}`;
25610
25610
  }
25611
25611
  else {
25612
- quotedPrompt = spaceTrim$2((block) => `
25612
+ quotedPrompt = spaceTrim$1((block) => `
25613
25613
  \`\`\`
25614
25614
  ${block(prompt.split('`').join('\\`'))}
25615
25615
  \`\`\`
25616
25616
  `);
25617
25617
  }
25618
- pipelineString = validatePipelineString(spaceTrim$2((block) => `
25618
+ pipelineString = validatePipelineString(spaceTrim$1((block) => `
25619
25619
  # ${DEFAULT_BOOK_TITLE}
25620
25620
 
25621
25621
  ## Prompt
@@ -25679,7 +25679,7 @@ function extractAllListItemsFromMarkdown(markdown) {
25679
25679
  function extractOneBlockFromMarkdown(markdown) {
25680
25680
  const codeBlocks = extractAllBlocksFromMarkdown(markdown);
25681
25681
  if (codeBlocks.length !== 1) {
25682
- throw new ParseError(spaceTrim$2((block) => `
25682
+ throw new ParseError(spaceTrim$1((block) => `
25683
25683
  There should be exactly 1 code block in task section, found ${codeBlocks.length} code blocks
25684
25684
 
25685
25685
  ${block(codeBlocks.map((block, i) => `Block ${i + 1}:\n${block.content}`).join('\n\n\n'))}
@@ -25704,7 +25704,7 @@ function parseMarkdownSection(value) {
25704
25704
  }
25705
25705
  const title = lines[0].replace(/^#+\s*/, '');
25706
25706
  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$2(lines.slice(1).join('\n'));
25707
+ const content = spaceTrim$1(lines.slice(1).join('\n'));
25708
25708
  if (level < 1 || level > 6) {
25709
25709
  throw new ParseError('Markdown section must have heading level between 1 and 6');
25710
25710
  }
@@ -25732,7 +25732,7 @@ function splitMarkdownIntoSections(markdown) {
25732
25732
  if (buffer.length === 0) {
25733
25733
  return;
25734
25734
  }
25735
- let section = spaceTrim$2(buffer.join('\n'));
25735
+ let section = spaceTrim$1(buffer.join('\n'));
25736
25736
  if (section === '') {
25737
25737
  return;
25738
25738
  }
@@ -25807,7 +25807,7 @@ function flattenMarkdown(markdown) {
25807
25807
  flattenedMarkdown += `## ${title}` + `\n\n`;
25808
25808
  flattenedMarkdown += content + `\n\n`; // <- [🧠] Maybe 3 new lines?
25809
25809
  }
25810
- return spaceTrim$2(flattenedMarkdown);
25810
+ return spaceTrim$1(flattenedMarkdown);
25811
25811
  }
25812
25812
  /**
25813
25813
  * TODO: [🏛] This can be part of markdown builder
@@ -26762,7 +26762,7 @@ function usageToHuman(usage) {
26762
26762
  // Note: For negligible usage, we report at least something
26763
26763
  reportItems.push('Negligible');
26764
26764
  }
26765
- return spaceTrim$2((block) => `
26765
+ return spaceTrim$1((block) => `
26766
26766
  Usage:
26767
26767
  ${block(reportItems.map((item) => `- ${item}`).join('\n'))}
26768
26768
  `);
@@ -27091,13 +27091,13 @@ function $registeredLlmToolsMessage() {
27091
27091
  });
27092
27092
  const usedEnvMessage = `Unknown \`.env\` file` ;
27093
27093
  if (metadata.length === 0) {
27094
- return spaceTrim$2((block) => `
27094
+ return spaceTrim$1((block) => `
27095
27095
  No LLM providers are available.
27096
27096
 
27097
27097
  ${block(usedEnvMessage)}
27098
27098
  `);
27099
27099
  }
27100
- return spaceTrim$2((block) => `
27100
+ return spaceTrim$1((block) => `
27101
27101
 
27102
27102
  ${block(usedEnvMessage)}
27103
27103
 
@@ -27143,7 +27143,7 @@ function $registeredLlmToolsMessage() {
27143
27143
  morePieces.push(`Not configured`); // <- Note: Can not be configured via environment variables
27144
27144
  }
27145
27145
  }
27146
- let providerMessage = spaceTrim$2(`
27146
+ let providerMessage = spaceTrim$1(`
27147
27147
  ${i + 1}) **${title}** \`${className}\` from \`${packageName}\`
27148
27148
  ${morePieces.join('; ')}
27149
27149
  `);
@@ -27189,7 +27189,7 @@ function createLlmToolsFromConfiguration(configuration, options = {}) {
27189
27189
  .find(({ packageName, className }) => llmConfiguration.packageName === packageName && llmConfiguration.className === className);
27190
27190
  if (registeredItem === undefined) {
27191
27191
  // console.log('$llmToolsRegister.list()', $llmToolsRegister.list());
27192
- throw new Error(spaceTrim$2((block) => `
27192
+ throw new Error(spaceTrim$1((block) => `
27193
27193
  There is no constructor for LLM provider \`${llmConfiguration.className}\` from \`${llmConfiguration.packageName}\`
27194
27194
  Running in ${!$isRunningInBrowser() ? '' : 'browser environment'}${!$isRunningInNode() ? '' : 'node environment'}${!$isRunningInWebWorker() ? '' : 'worker environment'}
27195
27195
 
@@ -27297,7 +27297,7 @@ function cacheLlmTools(llmTools, options = {}) {
27297
27297
  let normalizedContent = content;
27298
27298
  normalizedContent = normalizedContent.replace(/\s+/g, ' ');
27299
27299
  normalizedContent = normalizedContent.split('\r\n').join('\n');
27300
- normalizedContent = spaceTrim$2(normalizedContent);
27300
+ normalizedContent = spaceTrim$1(normalizedContent);
27301
27301
  // Note: Do not need to save everything in the cache, just the relevant parameters
27302
27302
  const relevantParameterNames = extractParameterNames(content);
27303
27303
  const relevantParameters = Object.fromEntries(Object.entries(parameters).filter(([key]) => relevantParameterNames.has(key)));
@@ -28240,7 +28240,7 @@ function pricing(value) {
28240
28240
  /**
28241
28241
  * List of available OpenAI models with pricing
28242
28242
  *
28243
- * Note: Synced with official API docs at 2025-11-19
28243
+ * Note: Synced with official API docs at 2026-03-22
28244
28244
  *
28245
28245
  * @see https://platform.openai.com/docs/models/
28246
28246
  * @see https://openai.com/api/pricing/
@@ -28362,8 +28362,8 @@ const OPENAI_MODELS = exportJson({
28362
28362
  modelName: 'gpt-4.1',
28363
28363
  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
28364
  pricing: {
28365
- prompt: pricing(`$3.00 / 1M tokens`),
28366
- output: pricing(`$12.00 / 1M tokens`),
28365
+ prompt: pricing(`$2.00 / 1M tokens`),
28366
+ output: pricing(`$8.00 / 1M tokens`),
28367
28367
  },
28368
28368
  },
28369
28369
  /**/
@@ -28374,8 +28374,8 @@ const OPENAI_MODELS = exportJson({
28374
28374
  modelName: 'gpt-4.1-mini',
28375
28375
  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
28376
  pricing: {
28377
- prompt: pricing(`$0.80 / 1M tokens`),
28378
- output: pricing(`$3.20 / 1M tokens`),
28377
+ prompt: pricing(`$0.40 / 1M tokens`),
28378
+ output: pricing(`$1.60 / 1M tokens`),
28379
28379
  },
28380
28380
  },
28381
28381
  /**/
@@ -28386,8 +28386,8 @@ const OPENAI_MODELS = exportJson({
28386
28386
  modelName: 'gpt-4.1-nano',
28387
28387
  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
28388
  pricing: {
28389
- prompt: pricing(`$0.20 / 1M tokens`),
28390
- output: pricing(`$0.80 / 1M tokens`),
28389
+ prompt: pricing(`$0.10 / 1M tokens`),
28390
+ output: pricing(`$0.40 / 1M tokens`),
28391
28391
  },
28392
28392
  },
28393
28393
  /**/
@@ -28398,8 +28398,8 @@ const OPENAI_MODELS = exportJson({
28398
28398
  modelName: 'o3',
28399
28399
  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
28400
  pricing: {
28401
- prompt: pricing(`$15.00 / 1M tokens`),
28402
- output: pricing(`$60.00 / 1M tokens`),
28401
+ prompt: pricing(`$2.00 / 1M tokens`),
28402
+ output: pricing(`$8.00 / 1M tokens`),
28403
28403
  },
28404
28404
  },
28405
28405
  /**/
@@ -28410,8 +28410,8 @@ const OPENAI_MODELS = exportJson({
28410
28410
  modelName: 'o3-pro',
28411
28411
  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
28412
  pricing: {
28413
- prompt: pricing(`$30.00 / 1M tokens`),
28414
- output: pricing(`$120.00 / 1M tokens`),
28413
+ prompt: pricing(`$20.00 / 1M tokens`),
28414
+ output: pricing(`$80.00 / 1M tokens`),
28415
28415
  },
28416
28416
  },
28417
28417
  /**/
@@ -28422,8 +28422,8 @@ const OPENAI_MODELS = exportJson({
28422
28422
  modelName: 'o4-mini',
28423
28423
  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
28424
  pricing: {
28425
- prompt: pricing(`$4.00 / 1M tokens`),
28426
- output: pricing(`$16.00 / 1M tokens`),
28425
+ prompt: pricing(`$1.10 / 1M tokens`),
28426
+ output: pricing(`$4.40 / 1M tokens`),
28427
28427
  },
28428
28428
  },
28429
28429
  /**/
@@ -28781,8 +28781,8 @@ const OPENAI_MODELS = exportJson({
28781
28781
  modelName: 'gpt-4o-2024-05-13',
28782
28782
  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
28783
  pricing: {
28784
- prompt: pricing(`$5.00 / 1M tokens`),
28785
- output: pricing(`$15.00 / 1M tokens`),
28784
+ prompt: pricing(`$2.50 / 1M tokens`),
28785
+ output: pricing(`$10.00 / 1M tokens`),
28786
28786
  },
28787
28787
  },
28788
28788
  /**/
@@ -28793,8 +28793,8 @@ const OPENAI_MODELS = exportJson({
28793
28793
  modelName: 'gpt-4o',
28794
28794
  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
28795
  pricing: {
28796
- prompt: pricing(`$5.00 / 1M tokens`),
28797
- output: pricing(`$15.00 / 1M tokens`),
28796
+ prompt: pricing(`$2.50 / 1M tokens`),
28797
+ output: pricing(`$10.00 / 1M tokens`),
28798
28798
  },
28799
28799
  },
28800
28800
  /**/
@@ -28865,8 +28865,8 @@ const OPENAI_MODELS = exportJson({
28865
28865
  modelName: 'o3-mini',
28866
28866
  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
28867
  pricing: {
28868
- prompt: pricing(`$3.00 / 1M tokens`),
28869
- output: pricing(`$12.00 / 1M tokens`),
28868
+ prompt: pricing(`$1.10 / 1M tokens`),
28869
+ output: pricing(`$4.40 / 1M tokens`),
28870
28870
  },
28871
28871
  },
28872
28872
  /**/
@@ -28966,53 +28966,6 @@ resultContent, rawResponse, duration = ZERO_VALUE) {
28966
28966
  * TODO: [🤝] DRY Maybe some common abstraction between `computeOpenAiUsage` and `computeAnthropicClaudeUsage`
28967
28967
  */
28968
28968
 
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
28969
  /**
29017
28970
  * Parses an OpenAI error message to identify which parameter is unsupported
29018
28971
  *
@@ -29069,6 +29022,53 @@ function isUnsupportedParameterError(error) {
29069
29022
  errorMessage.includes('does not support'));
29070
29023
  }
29071
29024
 
29025
+ /**
29026
+ * Builds a tool invocation script that injects hidden runtime context into tool args.
29027
+ *
29028
+ * @private utility of OpenAI tool execution wrappers
29029
+ */
29030
+ function buildToolInvocationScript(options) {
29031
+ const { functionName, functionArgsExpression } = options;
29032
+ return `
29033
+ const args = ${functionArgsExpression};
29034
+ const runtimeContextRaw =
29035
+ typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
29036
+ ? undefined
29037
+ : ${TOOL_RUNTIME_CONTEXT_PARAMETER};
29038
+
29039
+ if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
29040
+ args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
29041
+ }
29042
+
29043
+ const toolProgressTokenRaw =
29044
+ typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
29045
+ ? undefined
29046
+ : ${TOOL_PROGRESS_TOKEN_PARAMETER};
29047
+
29048
+ if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
29049
+ args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
29050
+ }
29051
+
29052
+ return await ${functionName}(args);
29053
+ `;
29054
+ }
29055
+
29056
+ /**
29057
+ * Maps Promptbook tools to OpenAI tools.
29058
+ *
29059
+ * @private
29060
+ */
29061
+ function mapToolsToOpenAi(tools) {
29062
+ return tools.map((tool) => ({
29063
+ type: 'function',
29064
+ function: {
29065
+ name: tool.name,
29066
+ description: tool.description,
29067
+ parameters: tool.parameters,
29068
+ },
29069
+ }));
29070
+ }
29071
+
29072
29072
  /**
29073
29073
  * Provides access to the structured clone implementation when available.
29074
29074
  */
@@ -30035,7 +30035,7 @@ class OpenAiCompatibleExecutionTools {
30035
30035
  // Note: Match exact or prefix for model families
30036
30036
  const model = this.HARDCODED_MODELS.find(({ modelName }) => modelName === defaultModelName || modelName.startsWith(defaultModelName));
30037
30037
  if (model === undefined) {
30038
- throw new PipelineExecutionError(spaceTrim$2((block) => `
30038
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
30039
30039
  Cannot find model in ${this.title} models with name "${defaultModelName}" which should be used as default.
30040
30040
 
30041
30041
  Available models:
@@ -30961,7 +30961,7 @@ class OpenAiVectorStoreHandler extends OpenAiExecutionTools {
30961
30961
  }
30962
30962
  }
30963
30963
 
30964
- const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5-mini-2025-08-07';
30964
+ const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-nano';
30965
30965
  /**
30966
30966
  * Creates one structured log entry for streamed tool-call updates.
30967
30967
  *
@@ -31456,7 +31456,7 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
31456
31456
  }),
31457
31457
  ],
31458
31458
  };
31459
- const errorMessage = spaceTrim$2((block) => `
31459
+ const errorMessage = spaceTrim$1((block) => `
31460
31460
 
31461
31461
  The invoked tool \`${functionName}\` failed with error:
31462
31462
 
@@ -32174,7 +32174,7 @@ class OpenAiAssistantExecutionTools extends OpenAiVectorStoreHandler {
32174
32174
  assertsError(error);
32175
32175
  const serializedError = serializeError(error);
32176
32176
  errors = [serializedError];
32177
- functionResponse = spaceTrim$2((block) => `
32177
+ functionResponse = spaceTrim$1((block) => `
32178
32178
 
32179
32179
  The invoked tool \`${functionName}\` failed with error:
32180
32180
 
@@ -33182,7 +33182,7 @@ class SelfLearningManager {
33182
33182
  if (isJsonSchemaResponseFormat(responseFormat)) {
33183
33183
  const jsonSchema = responseFormat.json_schema;
33184
33184
  const schemaJson = JSON.stringify(jsonSchema, null, 4);
33185
- userMessageContent = spaceTrim$2((block) => `
33185
+ userMessageContent = spaceTrim$1((block) => `
33186
33186
  ${block(prompt.content)}
33187
33187
 
33188
33188
  NOTE Request was made through OpenAI Compatible API with \`response_format\` of type \`json_schema\` with the following schema:
@@ -33213,12 +33213,12 @@ class SelfLearningManager {
33213
33213
  const formattedAgentMessage = formatAgentMessageForJsonMode(result.content, usesJsonSchemaMode);
33214
33214
  const teacherInstructions = extractOpenTeacherInstructions(agentSource);
33215
33215
  const teacherInstructionsSection = teacherInstructions
33216
- ? spaceTrim$2((block) => `
33216
+ ? spaceTrim$1((block) => `
33217
33217
  **Teacher instructions:**
33218
33218
  ${block(teacherInstructions)}
33219
33219
  `)
33220
33220
  : '';
33221
- const teacherPromptContent = spaceTrim$2((block) => `
33221
+ const teacherPromptContent = spaceTrim$1((block) => `
33222
33222
 
33223
33223
  You are a teacher agent helping another agent to learn from its interactions.
33224
33224
 
@@ -33251,7 +33251,7 @@ class SelfLearningManager {
33251
33251
  ? '- This interaction used JSON mode, so the agent answer should stay as a formatted JSON code block.'
33252
33252
  : ''}
33253
33253
  ${block(isInitialMessageMissing
33254
- ? spaceTrim$2(`
33254
+ ? spaceTrim$1(`
33255
33255
  - The agent source does not have an INITIAL MESSAGE defined, generate one.
33256
33256
  - 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
33257
  - The quick option looks like \`[👋 Hello](?message=Hello, how are you?)\`
@@ -33294,7 +33294,7 @@ class SelfLearningManager {
33294
33294
  */
33295
33295
  appendToAgentSource(section) {
33296
33296
  const currentSource = this.options.getAgentSource();
33297
- const newSource = padBook(validateBook(spaceTrim$2(currentSource) + section));
33297
+ const newSource = padBook(validateBook(spaceTrim$1(currentSource) + section));
33298
33298
  this.options.updateAgentSource(newSource);
33299
33299
  }
33300
33300
  }
@@ -33322,13 +33322,13 @@ function formatAgentMessageForJsonMode(content, isJsonMode) {
33322
33322
  }
33323
33323
  const parsedJson = tryParseJson(content);
33324
33324
  if (parsedJson === null) {
33325
- return spaceTrim$2((block) => `
33325
+ return spaceTrim$1((block) => `
33326
33326
  \`\`\`json
33327
33327
  ${block(content)}
33328
33328
  \`\`\`
33329
33329
  `);
33330
33330
  }
33331
- return spaceTrim$2((block) => `
33331
+ return spaceTrim$1((block) => `
33332
33332
  \`\`\`json
33333
33333
  ${block(JSON.stringify(parsedJson, null, 4))}
33334
33334
  \`\`\`
@@ -33360,7 +33360,7 @@ function formatSelfLearningSample(options) {
33360
33360
  const internalMessagesSection = options.internalMessages
33361
33361
  .map((internalMessage) => formatInternalLearningMessage(internalMessage))
33362
33362
  .join('\n\n');
33363
- return spaceTrim$2((block) => `
33363
+ return spaceTrim$1((block) => `
33364
33364
 
33365
33365
  USER MESSAGE
33366
33366
  ${block(options.userMessageContent)}
@@ -33378,7 +33378,7 @@ function formatSelfLearningSample(options) {
33378
33378
  * @private function of Agent
33379
33379
  */
33380
33380
  function formatInternalLearningMessage(internalMessage) {
33381
- return spaceTrim$2((block) => `
33381
+ return spaceTrim$1((block) => `
33382
33382
  INTERNAL MESSAGE
33383
33383
  ${block(stringifyInternalLearningPayload(internalMessage))}
33384
33384
  `);
@@ -33882,7 +33882,7 @@ function book(strings, ...values) {
33882
33882
  const bookString = prompt(strings, ...values).toString();
33883
33883
  if (!isValidPipelineString(bookString)) {
33884
33884
  // TODO: Make the CustomError for this
33885
- throw new Error(spaceTrim$2(`
33885
+ throw new Error(spaceTrim$1(`
33886
33886
  The string is not a valid pipeline string
33887
33887
 
33888
33888
  book\`
@@ -33892,7 +33892,7 @@ function book(strings, ...values) {
33892
33892
  }
33893
33893
  if (!isValidBook(bookString)) {
33894
33894
  // TODO: Make the CustomError for this
33895
- throw new Error(spaceTrim$2(`
33895
+ throw new Error(spaceTrim$1(`
33896
33896
  The string is not a valid book
33897
33897
 
33898
33898
  book\`
@@ -34219,7 +34219,7 @@ function buildRemoteAgentSource(profile, meta) {
34219
34219
  .filter((line) => Boolean(line))
34220
34220
  .join('\n');
34221
34221
  const personaBlock = profile.personaDescription
34222
- ? spaceTrim$2((block) => `
34222
+ ? spaceTrim$1((block) => `
34223
34223
  PERSONA
34224
34224
  ${block(profile.personaDescription || '')}
34225
34225
  `)
@@ -34255,7 +34255,7 @@ class RemoteAgent extends Agent {
34255
34255
  // <- TODO: [🐱‍🚀] What about closed-source agents?
34256
34256
  // <- TODO: [🐱‍🚀] Maybe use promptbookFetch
34257
34257
  if (!profileResponse.ok) {
34258
- throw new Error(spaceTrim$2((block) => `
34258
+ throw new Error(spaceTrim$1((block) => `
34259
34259
  Failed to fetch remote agent profile:
34260
34260
 
34261
34261
  Agent URL:
@@ -35489,7 +35489,7 @@ const OpenAiSdkTranspiler = {
35489
35489
  }
35490
35490
  const KNOWLEDGE_THRESHOLD = 1000;
35491
35491
  if (directKnowledge.join('\n').length > KNOWLEDGE_THRESHOLD || knowledgeSources.length > 0) {
35492
- return spaceTrim$2((block) => `
35492
+ return spaceTrim$1((block) => `
35493
35493
  #!/usr/bin/env node
35494
35494
 
35495
35495
  import * as dotenv from 'dotenv';
@@ -35564,7 +35564,7 @@ const OpenAiSdkTranspiler = {
35564
35564
 
35565
35565
  if (context) {
35566
35566
  question = spaceTrim(\`
35567
- ${block(spaceTrim$2(`
35567
+ ${block(spaceTrim$1(`
35568
35568
  Here is some additional context to help you answer the question:
35569
35569
  \${context}
35570
35570
 
@@ -35645,7 +35645,7 @@ const OpenAiSdkTranspiler = {
35645
35645
  })();
35646
35646
  `);
35647
35647
  }
35648
- const source = spaceTrim$2((block) => `
35648
+ const source = spaceTrim$1((block) => `
35649
35649
 
35650
35650
  #!/usr/bin/env node
35651
35651
 
@@ -35837,7 +35837,7 @@ const PUBLIC_AGENTS_SERVERS = [
35837
35837
  function aboutPromptbookInformation(options) {
35838
35838
  const { isServersInfoIncluded = true, isRuntimeEnvironmentInfoIncluded = true } = options || {};
35839
35839
  const fullInfoPieces = [];
35840
- const basicInfo = spaceTrim$2(`
35840
+ const basicInfo = spaceTrim$1(`
35841
35841
 
35842
35842
  # ${NAME}
35843
35843
 
@@ -35849,7 +35849,7 @@ function aboutPromptbookInformation(options) {
35849
35849
  `);
35850
35850
  fullInfoPieces.push(basicInfo);
35851
35851
  if (isServersInfoIncluded) {
35852
- const serversInfo = spaceTrim$2((block) => `
35852
+ const serversInfo = spaceTrim$1((block) => `
35853
35853
 
35854
35854
  ## Servers
35855
35855
 
@@ -35863,7 +35863,7 @@ function aboutPromptbookInformation(options) {
35863
35863
  ...runtimeEnvironment,
35864
35864
  isCostPrevented: IS_COST_PREVENTED,
35865
35865
  };
35866
- const environmentInfo = spaceTrim$2((block) => `
35866
+ const environmentInfo = spaceTrim$1((block) => `
35867
35867
 
35868
35868
  ## Environment
35869
35869
 
@@ -35873,7 +35873,7 @@ function aboutPromptbookInformation(options) {
35873
35873
  `);
35874
35874
  fullInfoPieces.push(environmentInfo);
35875
35875
  }
35876
- const fullInfo = spaceTrim$2(fullInfoPieces.join('\n\n'));
35876
+ const fullInfo = spaceTrim$1(fullInfoPieces.join('\n\n'));
35877
35877
  return fullInfo;
35878
35878
  }
35879
35879
  /**
@@ -36196,7 +36196,7 @@ function $generateBookBoilerplate(options) {
36196
36196
  if (initialRules.length === 0) {
36197
36197
  initialRules.push($randomAgentRule(namePool));
36198
36198
  }
36199
- const agentSource = validateBook(spaceTrim$2((block) => `
36199
+ const agentSource = validateBook(spaceTrim$1((block) => `
36200
36200
  ${agentName}
36201
36201
 
36202
36202