@promptbook/remote-server 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 +148 -148
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/src/cli/cli-commands/coder/{find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags.d.ts} +1 -1
  4. package/esm/src/cli/cli-commands/coder.d.ts +1 -1
  5. package/esm/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +1 -1
  6. package/esm/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  7. package/esm/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
  8. package/esm/src/llm-providers/google/google-models.d.ts +1 -1
  9. package/esm/src/llm-providers/openai/openai-models.d.ts +1 -1
  10. package/esm/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -2
  11. package/esm/src/scrapers/document/DocumentScraper.d.ts +1 -2
  12. package/esm/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -2
  13. package/esm/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
  14. package/esm/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -2
  15. package/esm/src/version.d.ts +1 -1
  16. package/package.json +2 -2
  17. package/umd/index.umd.js +331 -331
  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,7 +1,7 @@
1
1
  import { join, basename, dirname, isAbsolute } from 'path';
2
2
  import { spawn } from 'child_process';
3
3
  import colors from 'colors';
4
- import spaceTrim$2, { spaceTrim as spaceTrim$1 } from 'spacetrim';
4
+ import _spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
5
5
  import { forTime } from 'waitasecond';
6
6
  import express from 'express';
7
7
  import * as OpenApiValidator from 'express-openapi-validator';
@@ -40,7 +40,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
40
40
  * @generated
41
41
  * @see https://github.com/webgptorg/promptbook
42
42
  */
43
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-13';
43
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-16';
44
44
  /**
45
45
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
46
46
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1429,7 +1429,7 @@ async function startAgentServer(options) {
1429
1429
  function getErrorReportUrl(error) {
1430
1430
  const report = {
1431
1431
  title: `🐜 Error report from ${NAME}`,
1432
- body: spaceTrim$2((block) => `
1432
+ body: spaceTrim$1((block) => `
1433
1433
 
1434
1434
 
1435
1435
  \`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
@@ -1896,7 +1896,7 @@ function serializeError(error) {
1896
1896
  const { name, message, stack } = error;
1897
1897
  const { id } = error;
1898
1898
  if (!Object.keys(ALL_ERRORS).includes(name)) {
1899
- console.error(spaceTrim$2((block) => `
1899
+ console.error(spaceTrim$1((block) => `
1900
1900
 
1901
1901
  Cannot serialize error with name "${name}"
1902
1902
 
@@ -2242,7 +2242,7 @@ function checkSerializableAsJson(options) {
2242
2242
  }
2243
2243
  else if (typeof value === 'object') {
2244
2244
  if (value instanceof Date) {
2245
- throw new UnexpectedError(spaceTrim$2((block) => `
2245
+ throw new UnexpectedError(spaceTrim$1((block) => `
2246
2246
  \`${name}\` is Date
2247
2247
 
2248
2248
  Use \`string_date_iso8601\` instead
@@ -2261,7 +2261,7 @@ function checkSerializableAsJson(options) {
2261
2261
  throw new UnexpectedError(`${name} is RegExp`);
2262
2262
  }
2263
2263
  else if (value instanceof Error) {
2264
- throw new UnexpectedError(spaceTrim$2((block) => `
2264
+ throw new UnexpectedError(spaceTrim$1((block) => `
2265
2265
  \`${name}\` is unserialized Error
2266
2266
 
2267
2267
  Use function \`serializeError\`
@@ -2284,7 +2284,7 @@ function checkSerializableAsJson(options) {
2284
2284
  }
2285
2285
  catch (error) {
2286
2286
  assertsError(error);
2287
- throw new UnexpectedError(spaceTrim$2((block) => `
2287
+ throw new UnexpectedError(spaceTrim$1((block) => `
2288
2288
  \`${name}\` is not serializable
2289
2289
 
2290
2290
  ${block(error.stack || error.message)}
@@ -2316,7 +2316,7 @@ function checkSerializableAsJson(options) {
2316
2316
  }
2317
2317
  }
2318
2318
  else {
2319
- throw new UnexpectedError(spaceTrim$2((block) => `
2319
+ throw new UnexpectedError(spaceTrim$1((block) => `
2320
2320
  \`${name}\` is unknown type
2321
2321
 
2322
2322
  Additional message for \`${name}\`:
@@ -2979,7 +2979,7 @@ function jsonParse(value) {
2979
2979
  }
2980
2980
  else if (typeof value !== 'string') {
2981
2981
  console.error('Can not parse JSON from non-string value.', { text: value });
2982
- throw new Error(spaceTrim$2(`
2982
+ throw new Error(spaceTrim$1(`
2983
2983
  Can not parse JSON from non-string value.
2984
2984
 
2985
2985
  The value type: ${typeof value}
@@ -2993,7 +2993,7 @@ function jsonParse(value) {
2993
2993
  if (!(error instanceof Error)) {
2994
2994
  throw error;
2995
2995
  }
2996
- throw new Error(spaceTrim$2((block) => `
2996
+ throw new Error(spaceTrim$1((block) => `
2997
2997
  ${block(error.message)}
2998
2998
 
2999
2999
  The expected JSON text:
@@ -3046,7 +3046,7 @@ function deserializeError(error, isStackAddedToMessage = true) {
3046
3046
  message = `${name}: ${message}`;
3047
3047
  }
3048
3048
  if (isStackAddedToMessage && stack !== undefined && stack !== '') {
3049
- message = spaceTrim$2((block) => `
3049
+ message = spaceTrim$1((block) => `
3050
3050
  ${block(message)}
3051
3051
 
3052
3052
  Original stack trace:
@@ -3601,7 +3601,7 @@ function pipelineJsonToString(pipelineJson) {
3601
3601
  pipelineString += '\n\n';
3602
3602
  pipelineString += '```' + contentLanguage;
3603
3603
  pipelineString += '\n';
3604
- pipelineString += spaceTrim$2(content);
3604
+ pipelineString += spaceTrim$1(content);
3605
3605
  // <- TODO: [main] !!3 Escape
3606
3606
  // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
3607
3607
  pipelineString += '\n';
@@ -4033,14 +4033,14 @@ class MultipleLlmExecutionTools {
4033
4033
  if (description === undefined) {
4034
4034
  return headLine;
4035
4035
  }
4036
- return spaceTrim$2((block) => `
4036
+ return spaceTrim$1((block) => `
4037
4037
  ${headLine}
4038
4038
 
4039
4039
  ${ /* <- Note: Indenting the description: */block(description)}
4040
4040
  `);
4041
4041
  })
4042
4042
  .join('\n\n');
4043
- return spaceTrim$2((block) => `
4043
+ return spaceTrim$1((block) => `
4044
4044
  Multiple LLM Providers:
4045
4045
 
4046
4046
  ${block(innerModelsTitlesAndDescriptions)}
@@ -4142,7 +4142,7 @@ class MultipleLlmExecutionTools {
4142
4142
  // 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
4143
4143
  // 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
4144
4144
  // 3) ...
4145
- spaceTrim$2((block) => `
4145
+ spaceTrim$1((block) => `
4146
4146
  All execution tools of ${this.title} failed:
4147
4147
 
4148
4148
  ${block(errors
@@ -4155,7 +4155,7 @@ class MultipleLlmExecutionTools {
4155
4155
  throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
4156
4156
  }
4157
4157
  else {
4158
- throw new PipelineExecutionError(spaceTrim$2((block) => `
4158
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
4159
4159
  You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
4160
4160
 
4161
4161
  Available \`LlmExecutionTools\`:
@@ -4192,7 +4192,7 @@ class MultipleLlmExecutionTools {
4192
4192
  */
4193
4193
  function joinLlmExecutionTools(title, ...llmExecutionTools) {
4194
4194
  if (llmExecutionTools.length === 0) {
4195
- const warningMessage = spaceTrim$2(`
4195
+ const warningMessage = spaceTrim$1(`
4196
4196
  You have not provided any \`LlmExecutionTools\`
4197
4197
  This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.
4198
4198
 
@@ -4509,14 +4509,14 @@ function $registeredScrapersMessage(availableScrapers) {
4509
4509
  return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
4510
4510
  });
4511
4511
  if (metadata.length === 0) {
4512
- return spaceTrim$2(`
4512
+ return spaceTrim$1(`
4513
4513
  **No scrapers are available**
4514
4514
 
4515
4515
  This is a unexpected behavior, you are probably using some broken version of Promptbook
4516
4516
  At least there should be available the metadata of the scrapers
4517
4517
  `);
4518
4518
  }
4519
- return spaceTrim$2((block) => `
4519
+ return spaceTrim$1((block) => `
4520
4520
  Available scrapers are:
4521
4521
  ${block(metadata
4522
4522
  .map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
@@ -5022,7 +5022,7 @@ const promptbookFetch = async (urlOrRequest, init) => {
5022
5022
  else if (urlOrRequest instanceof Request) {
5023
5023
  url = urlOrRequest.url;
5024
5024
  }
5025
- throw new PromptbookFetchError(spaceTrim$2((block) => `
5025
+ throw new PromptbookFetchError(spaceTrim$1((block) => `
5026
5026
  Can not fetch "${url}"
5027
5027
 
5028
5028
  Fetch error:
@@ -5182,7 +5182,7 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
5182
5182
  const fileExtension = getFileExtension(filename);
5183
5183
  const mimeType = extensionToMimeType(fileExtension || '');
5184
5184
  if (!(await isFileExisting(filename, tools.fs))) {
5185
- throw new NotFoundError(spaceTrim$2((block) => `
5185
+ throw new NotFoundError(spaceTrim$1((block) => `
5186
5186
  Can not make source handler for file which does not exist:
5187
5187
 
5188
5188
  File:
@@ -5275,7 +5275,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
5275
5275
  // <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
5276
5276
  break;
5277
5277
  }
5278
- console.warn(spaceTrim$2((block) => `
5278
+ console.warn(spaceTrim$1((block) => `
5279
5279
  Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
5280
5280
 
5281
5281
  The source:
@@ -5291,7 +5291,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
5291
5291
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
5292
5292
  }
5293
5293
  if (partialPieces === null) {
5294
- throw new KnowledgeScrapeError(spaceTrim$2((block) => `
5294
+ throw new KnowledgeScrapeError(spaceTrim$1((block) => `
5295
5295
  Cannot scrape knowledge
5296
5296
 
5297
5297
  The source:
@@ -5866,7 +5866,7 @@ const CsvFormatParser = {
5866
5866
  const { value, outputParameterName, settings, mapCallback, onProgress } = options;
5867
5867
  const csv = csvParse(value, settings);
5868
5868
  if (csv.errors.length !== 0) {
5869
- throw new CsvFormatError(spaceTrim$2((block) => `
5869
+ throw new CsvFormatError(spaceTrim$1((block) => `
5870
5870
  CSV parsing error
5871
5871
 
5872
5872
  Error(s) from CSV parsing:
@@ -5911,7 +5911,7 @@ const CsvFormatParser = {
5911
5911
  const { value, settings, mapCallback, onProgress } = options;
5912
5912
  const csv = csvParse(value, settings);
5913
5913
  if (csv.errors.length !== 0) {
5914
- throw new CsvFormatError(spaceTrim$2((block) => `
5914
+ throw new CsvFormatError(spaceTrim$1((block) => `
5915
5915
  CSV parsing error
5916
5916
 
5917
5917
  Error(s) from CSV parsing:
@@ -6121,7 +6121,7 @@ function mapAvailableToExpectedParameters(options) {
6121
6121
  }
6122
6122
  // Phase 2️⃣: Non-matching mapping
6123
6123
  if (expectedParameterNames.size !== availableParametersNames.size) {
6124
- throw new PipelineExecutionError(spaceTrim$2((block) => `
6124
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6125
6125
  Can not map available parameters to expected parameters
6126
6126
 
6127
6127
  Mapped parameters:
@@ -6924,7 +6924,7 @@ async function executeFormatSubvalues(options) {
6924
6924
  return /* not await */ executeAttempts({ ...options, logLlmCall });
6925
6925
  }
6926
6926
  if (jokerParameterNames.length !== 0) {
6927
- throw new UnexpectedError(spaceTrim$2((block) => `
6927
+ throw new UnexpectedError(spaceTrim$1((block) => `
6928
6928
  JOKER parameters are not supported together with FOREACH command
6929
6929
 
6930
6930
  [🧞‍♀️] This should be prevented in \`validatePipeline\`
@@ -6937,7 +6937,7 @@ async function executeFormatSubvalues(options) {
6937
6937
  if (formatDefinition === undefined) {
6938
6938
  throw new UnexpectedError(
6939
6939
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6940
- spaceTrim$2((block) => `
6940
+ spaceTrim$1((block) => `
6941
6941
  Unsupported format "${task.foreach.formatName}"
6942
6942
 
6943
6943
  Available formats:
@@ -6954,7 +6954,7 @@ async function executeFormatSubvalues(options) {
6954
6954
  if (subvalueParser === undefined) {
6955
6955
  throw new UnexpectedError(
6956
6956
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6957
- spaceTrim$2((block) => `
6957
+ spaceTrim$1((block) => `
6958
6958
  Unsupported subformat name "${task.foreach.subformatName}" for format "${task.foreach.formatName}"
6959
6959
 
6960
6960
  Available subformat names for format "${formatDefinition.formatName}":
@@ -6994,7 +6994,7 @@ async function executeFormatSubvalues(options) {
6994
6994
  if (!(error instanceof PipelineExecutionError)) {
6995
6995
  throw error;
6996
6996
  }
6997
- const highLevelError = new PipelineExecutionError(spaceTrim$2((block) => `
6997
+ const highLevelError = new PipelineExecutionError(spaceTrim$1((block) => `
6998
6998
  ${error.message}
6999
6999
 
7000
7000
  This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -7018,7 +7018,7 @@ async function executeFormatSubvalues(options) {
7018
7018
  ...options,
7019
7019
  priority: priority + index,
7020
7020
  parameters: allSubparameters,
7021
- pipelineIdentification: spaceTrim$2((block) => `
7021
+ pipelineIdentification: spaceTrim$1((block) => `
7022
7022
  ${block(pipelineIdentification)}
7023
7023
  Subparameter index: ${index}
7024
7024
  `),
@@ -7027,7 +7027,7 @@ async function executeFormatSubvalues(options) {
7027
7027
  }
7028
7028
  catch (error) {
7029
7029
  if (length > BIG_DATASET_TRESHOLD) {
7030
- console.error(spaceTrim$2((block) => `
7030
+ console.error(spaceTrim$1((block) => `
7031
7031
  ${error.message}
7032
7032
 
7033
7033
  This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -7917,13 +7917,13 @@ function $registeredLlmToolsMessage() {
7917
7917
  });
7918
7918
  const usedEnvMessage = `Unknown \`.env\` file` ;
7919
7919
  if (metadata.length === 0) {
7920
- return spaceTrim$2((block) => `
7920
+ return spaceTrim$1((block) => `
7921
7921
  No LLM providers are available.
7922
7922
 
7923
7923
  ${block(usedEnvMessage)}
7924
7924
  `);
7925
7925
  }
7926
- return spaceTrim$2((block) => `
7926
+ return spaceTrim$1((block) => `
7927
7927
 
7928
7928
  ${block(usedEnvMessage)}
7929
7929
 
@@ -7969,7 +7969,7 @@ function $registeredLlmToolsMessage() {
7969
7969
  morePieces.push(`Not configured`); // <- Note: Can not be configured via environment variables
7970
7970
  }
7971
7971
  }
7972
- let providerMessage = spaceTrim$2(`
7972
+ let providerMessage = spaceTrim$1(`
7973
7973
  ${i + 1}) **${title}** \`${className}\` from \`${packageName}\`
7974
7974
  ${morePieces.join('; ')}
7975
7975
  `);
@@ -8015,7 +8015,7 @@ function createLlmToolsFromConfiguration(configuration, options = {}) {
8015
8015
  .find(({ packageName, className }) => llmConfiguration.packageName === packageName && llmConfiguration.className === className);
8016
8016
  if (registeredItem === undefined) {
8017
8017
  // console.log('$llmToolsRegister.list()', $llmToolsRegister.list());
8018
- throw new Error(spaceTrim$2((block) => `
8018
+ throw new Error(spaceTrim$1((block) => `
8019
8019
  There is no constructor for LLM provider \`${llmConfiguration.className}\` from \`${llmConfiguration.packageName}\`
8020
8020
  Running in ${!$isRunningInBrowser() ? '' : 'browser environment'}${!$isRunningInNode() ? '' : 'node environment'}${!$isRunningInWebWorker() ? '' : 'worker environment'}
8021
8021
 
@@ -8394,7 +8394,7 @@ function buildParametersSection(items) {
8394
8394
  const entries = items
8395
8395
  .flatMap((item) => formatParameterListItem(item).split(/\r?\n/))
8396
8396
  .filter((line) => line !== '');
8397
- return spaceTrim$2((block) => `
8397
+ return spaceTrim$1((block) => `
8398
8398
  **Parameters:**
8399
8399
  ${block(entries.join('\n'))}
8400
8400
 
@@ -8467,7 +8467,7 @@ function isPromptString(value) {
8467
8467
  */
8468
8468
  function prompt(strings, ...values) {
8469
8469
  if (values.length === 0) {
8470
- return new PromptString(spaceTrim$2(strings.join('')));
8470
+ return new PromptString(spaceTrim$1(strings.join('')));
8471
8471
  }
8472
8472
  const stringsWithHiddenParameters = strings.map((stringsItem) => ParameterEscaping.hideBrackets(stringsItem));
8473
8473
  const parameterMetadata = values.map((value) => {
@@ -8508,7 +8508,7 @@ function prompt(strings, ...values) {
8508
8508
  ? `${result}${stringsItem}`
8509
8509
  : `${result}${stringsItem}${ParameterSection.formatParameterPlaceholder(parameterName)}`;
8510
8510
  }, '');
8511
- pipelineString = spaceTrim$2(pipelineString);
8511
+ pipelineString = spaceTrim$1(pipelineString);
8512
8512
  try {
8513
8513
  pipelineString = templateParameters(pipelineString, parameters);
8514
8514
  }
@@ -8517,7 +8517,7 @@ function prompt(strings, ...values) {
8517
8517
  throw error;
8518
8518
  }
8519
8519
  console.error({ pipelineString, parameters, parameterNames: parameterNamesOrdered, error });
8520
- throw new UnexpectedError(spaceTrim$2((block) => `
8520
+ throw new UnexpectedError(spaceTrim$1((block) => `
8521
8521
  Internal error in prompt template literal
8522
8522
 
8523
8523
  ${block(JSON.stringify({ strings, values }, null, 4))}}
@@ -8598,7 +8598,7 @@ function attachClientVersionHeader(headers) {
8598
8598
  * @public exported from `@promptbook/utils`
8599
8599
  */
8600
8600
  function computeHash(value) {
8601
- return SHA256(hexEncoder.parse(spaceTrim$2(valueToString(value)))).toString( /* hex */);
8601
+ return SHA256(hexEncoder.parse(spaceTrim$1(valueToString(value)))).toString( /* hex */);
8602
8602
  }
8603
8603
  /**
8604
8604
  * TODO: [🥬][🥬] Use this ACRY
@@ -10507,8 +10507,8 @@ class MarkdownScraper {
10507
10507
  knowledgeTextPieces.map(async (knowledgeTextPiece, i) => {
10508
10508
  // Note: These are just default values, they will be overwritten by the actual values:
10509
10509
  let name = `piece-${i}`;
10510
- let title = spaceTrim$2(knowledgeTextPiece.substring(0, 100));
10511
- const knowledgePieceContent = spaceTrim$2(knowledgeTextPiece);
10510
+ let title = spaceTrim$1(knowledgeTextPiece.substring(0, 100));
10511
+ const knowledgePieceContent = spaceTrim$1(knowledgeTextPiece);
10512
10512
  let keywords = [];
10513
10513
  const index = [];
10514
10514
  /*
@@ -10521,7 +10521,7 @@ class MarkdownScraper {
10521
10521
  isCrashedOnError: true,
10522
10522
  });
10523
10523
  const { title: titleRaw = 'Untitled' } = titleResult.outputParameters;
10524
- title = spaceTrim$2(titleRaw) /* <- TODO: Maybe do in pipeline */;
10524
+ title = spaceTrim$1(titleRaw) /* <- TODO: Maybe do in pipeline */;
10525
10525
  name = titleToName(title);
10526
10526
  // --- Keywords
10527
10527
  const keywordsResult = await prepareKeywordsExecutor({ knowledgePieceContent }).asPromise({
@@ -21875,7 +21875,7 @@ function getAllCommitmentsToolFunctionsForNode() {
21875
21875
  function extractOneBlockFromMarkdown(markdown) {
21876
21876
  const codeBlocks = extractAllBlocksFromMarkdown(markdown);
21877
21877
  if (codeBlocks.length !== 1) {
21878
- throw new ParseError(spaceTrim$2((block) => `
21878
+ throw new ParseError(spaceTrim$1((block) => `
21879
21879
  There should be exactly 1 code block in task section, found ${codeBlocks.length} code blocks
21880
21880
 
21881
21881
  ${block(codeBlocks.map((block, i) => `Block ${i + 1}:\n${block.content}`).join('\n\n\n'))}
@@ -21984,7 +21984,7 @@ class JavascriptEvalExecutionTools {
21984
21984
  }
21985
21985
  // Note: [💎]
21986
21986
  // Note: Using direct eval, following variables are in same scope as eval call so they are accessible from inside the evaluated script:
21987
- const spaceTrim = (_) => spaceTrim$2(_);
21987
+ const spaceTrim = (_) => _spaceTrim(_);
21988
21988
  $preserve(spaceTrim);
21989
21989
  const removeQuotes$1 = removeQuotes;
21990
21990
  $preserve(removeQuotes$1);
@@ -22075,7 +22075,7 @@ class JavascriptEvalExecutionTools {
22075
22075
  .join('\n');
22076
22076
  // script = templateParameters(script, parameters);
22077
22077
  // <- TODO: [🧠][🥳] Should be this is one of two variants how to use parameters in script
22078
- const statementToEvaluate = spaceTrim$2((block) => `
22078
+ const statementToEvaluate = _spaceTrim((block) => `
22079
22079
 
22080
22080
  // Build-in functions:
22081
22081
  ${block(buildinFunctionsStatement)}
@@ -22090,7 +22090,7 @@ class JavascriptEvalExecutionTools {
22090
22090
  (async ()=>{ ${script} })()
22091
22091
  `);
22092
22092
  if (this.options.isVerbose) {
22093
- console.info(spaceTrim$2((block) => `
22093
+ console.info(_spaceTrim((block) => `
22094
22094
  🚀 Evaluating ${scriptLanguage} script:
22095
22095
 
22096
22096
  ${block(statementToEvaluate)}`));
@@ -22099,7 +22099,7 @@ class JavascriptEvalExecutionTools {
22099
22099
  try {
22100
22100
  result = await eval(statementToEvaluate);
22101
22101
  if (this.options.isVerbose) {
22102
- console.info(spaceTrim$2((block) => `
22102
+ console.info(_spaceTrim((block) => `
22103
22103
  🚀 Script evaluated successfully, result:
22104
22104
  ${block(valueToString(result))}
22105
22105
  `));
@@ -22118,7 +22118,7 @@ class JavascriptEvalExecutionTools {
22118
22118
  To: [PipelineExecutionError: Parameter `{thing}` is not defined],
22119
22119
  */
22120
22120
  if (!statementToEvaluate.includes(undefinedName + '(')) {
22121
- throw new PipelineExecutionError(spaceTrim$2((block) => `
22121
+ throw new PipelineExecutionError(_spaceTrim((block) => `
22122
22122
 
22123
22123
  Parameter \`{${undefinedName}}\` is not defined
22124
22124
 
@@ -22140,7 +22140,7 @@ class JavascriptEvalExecutionTools {
22140
22140
  `));
22141
22141
  }
22142
22142
  else {
22143
- throw new PipelineExecutionError(spaceTrim$2((block) => `
22143
+ throw new PipelineExecutionError(_spaceTrim((block) => `
22144
22144
  Function ${undefinedName}() is not defined
22145
22145
 
22146
22146
  - Make sure that the function is one of built-in functions
@@ -23497,7 +23497,7 @@ function validateBook(source) {
23497
23497
  * @deprecated Use `$generateBookBoilerplate` instead
23498
23498
  * @public exported from `@promptbook/core`
23499
23499
  */
23500
- padBook(validateBook(spaceTrim$2(`
23500
+ padBook(validateBook(spaceTrim$1(`
23501
23501
  AI Avatar
23502
23502
 
23503
23503
  PERSONA A friendly AI assistant that helps you with your tasks
@@ -23546,7 +23546,7 @@ function book(strings, ...values) {
23546
23546
  const bookString = prompt(strings, ...values).toString();
23547
23547
  if (!isValidPipelineString(bookString)) {
23548
23548
  // TODO: Make the CustomError for this
23549
- throw new Error(spaceTrim$2(`
23549
+ throw new Error(spaceTrim$1(`
23550
23550
  The string is not a valid pipeline string
23551
23551
 
23552
23552
  book\`
@@ -23556,7 +23556,7 @@ function book(strings, ...values) {
23556
23556
  }
23557
23557
  if (!isValidBook(bookString)) {
23558
23558
  // TODO: Make the CustomError for this
23559
- throw new Error(spaceTrim$2(`
23559
+ throw new Error(spaceTrim$1(`
23560
23560
  The string is not a valid book
23561
23561
 
23562
23562
  book\`
@@ -23840,7 +23840,7 @@ function computeAgentHash(agentSource) {
23840
23840
  * @public exported from `@promptbook/core`
23841
23841
  */
23842
23842
  function normalizeAgentName(rawAgentName) {
23843
- return titleToName(spaceTrim$2(rawAgentName));
23843
+ return titleToName(spaceTrim$1(rawAgentName));
23844
23844
  }
23845
23845
 
23846
23846
  /**
@@ -24284,7 +24284,7 @@ function parseAgentSource(agentSource) {
24284
24284
  continue;
24285
24285
  }
24286
24286
  if (commitment.type === 'FROM') {
24287
- const content = spaceTrim$2(commitment.content).split(/\r?\n/)[0] || '';
24287
+ const content = spaceTrim$1(commitment.content).split(/\r?\n/)[0] || '';
24288
24288
  if (content === 'Adam' || content === '' /* <- Note: Adam is implicit */) {
24289
24289
  continue;
24290
24290
  }
@@ -24307,7 +24307,7 @@ function parseAgentSource(agentSource) {
24307
24307
  continue;
24308
24308
  }
24309
24309
  if (commitment.type === 'IMPORT') {
24310
- const content = spaceTrim$2(commitment.content).split(/\r?\n/)[0] || '';
24310
+ const content = spaceTrim$1(commitment.content).split(/\r?\n/)[0] || '';
24311
24311
  let label = content;
24312
24312
  let iconName = 'ExternalLink'; // Import remote
24313
24313
  try {
@@ -24345,7 +24345,7 @@ function parseAgentSource(agentSource) {
24345
24345
  continue;
24346
24346
  }
24347
24347
  if (commitment.type === 'KNOWLEDGE') {
24348
- const content = spaceTrim$2(commitment.content);
24348
+ const content = spaceTrim$1(commitment.content);
24349
24349
  const extractedUrls = extractUrlsFromText(content);
24350
24350
  let label = content;
24351
24351
  let iconName = 'Book';
@@ -24404,7 +24404,7 @@ function parseAgentSource(agentSource) {
24404
24404
  continue;
24405
24405
  }
24406
24406
  if (commitment.type === 'META LINK') {
24407
- const linkValue = spaceTrim$2(commitment.content);
24407
+ const linkValue = spaceTrim$1(commitment.content);
24408
24408
  links.push(linkValue);
24409
24409
  meta.link = linkValue;
24410
24410
  continue;
@@ -24414,11 +24414,11 @@ function parseAgentSource(agentSource) {
24414
24414
  continue;
24415
24415
  }
24416
24416
  if (commitment.type === 'META IMAGE') {
24417
- meta.image = spaceTrim$2(commitment.content);
24417
+ meta.image = spaceTrim$1(commitment.content);
24418
24418
  continue;
24419
24419
  }
24420
24420
  if (commitment.type === 'META DESCRIPTION') {
24421
- meta.description = spaceTrim$2(commitment.content);
24421
+ meta.description = spaceTrim$1(commitment.content);
24422
24422
  continue;
24423
24423
  }
24424
24424
  if (commitment.type === 'META DISCLAIMER') {
@@ -24426,7 +24426,7 @@ function parseAgentSource(agentSource) {
24426
24426
  continue;
24427
24427
  }
24428
24428
  if (commitment.type === 'META INPUT PLACEHOLDER') {
24429
- meta.inputPlaceholder = spaceTrim$2(commitment.content);
24429
+ meta.inputPlaceholder = spaceTrim$1(commitment.content);
24430
24430
  continue;
24431
24431
  }
24432
24432
  if (commitment.type === 'MESSAGE SUFFIX') {
@@ -24442,7 +24442,7 @@ function parseAgentSource(agentSource) {
24442
24442
  continue;
24443
24443
  }
24444
24444
  if (commitment.type === 'META VOICE') {
24445
- meta.voice = spaceTrim$2(commitment.content);
24445
+ meta.voice = spaceTrim$1(commitment.content);
24446
24446
  continue;
24447
24447
  }
24448
24448
  if (commitment.type !== 'META') {
@@ -24451,10 +24451,10 @@ function parseAgentSource(agentSource) {
24451
24451
  // Parse META commitments - format is "META TYPE content"
24452
24452
  const metaTypeRaw = commitment.content.split(' ')[0] || 'NONE';
24453
24453
  if (metaTypeRaw === 'LINK') {
24454
- links.push(spaceTrim$2(commitment.content.substring(metaTypeRaw.length)));
24454
+ links.push(spaceTrim$1(commitment.content.substring(metaTypeRaw.length)));
24455
24455
  }
24456
24456
  const metaType = normalizeTo_camelCase(metaTypeRaw);
24457
- meta[metaType] = spaceTrim$2(commitment.content.substring(metaTypeRaw.length));
24457
+ meta[metaType] = spaceTrim$1(commitment.content.substring(metaTypeRaw.length));
24458
24458
  }
24459
24459
  // Generate fullname fallback if no meta fullname specified
24460
24460
  if (!meta.fullname) {
@@ -24485,7 +24485,7 @@ function parseAgentSource(agentSource) {
24485
24485
  * @returns The content with normalized separators
24486
24486
  */
24487
24487
  function normalizeSeparator(content) {
24488
- const trimmed = spaceTrim$2(content);
24488
+ const trimmed = spaceTrim$1(content);
24489
24489
  if (trimmed.includes(',')) {
24490
24490
  return trimmed;
24491
24491
  }
@@ -24498,7 +24498,7 @@ function normalizeSeparator(content) {
24498
24498
  * @returns Normalized domain or a trimmed fallback.
24499
24499
  */
24500
24500
  function normalizeMetaDomain(content) {
24501
- const trimmed = spaceTrim$2(content);
24501
+ const trimmed = spaceTrim$1(content);
24502
24502
  return normalizeDomainForMatching(trimmed) || trimmed.toLowerCase();
24503
24503
  }
24504
24504
  /**
@@ -25758,7 +25758,7 @@ function pricing(value) {
25758
25758
  /**
25759
25759
  * List of available OpenAI models with pricing
25760
25760
  *
25761
- * Note: Synced with official API docs at 2025-11-19
25761
+ * Note: Synced with official API docs at 2026-03-22
25762
25762
  *
25763
25763
  * @see https://platform.openai.com/docs/models/
25764
25764
  * @see https://openai.com/api/pricing/
@@ -25880,8 +25880,8 @@ const OPENAI_MODELS = exportJson({
25880
25880
  modelName: 'gpt-4.1',
25881
25881
  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.',
25882
25882
  pricing: {
25883
- prompt: pricing(`$3.00 / 1M tokens`),
25884
- output: pricing(`$12.00 / 1M tokens`),
25883
+ prompt: pricing(`$2.00 / 1M tokens`),
25884
+ output: pricing(`$8.00 / 1M tokens`),
25885
25885
  },
25886
25886
  },
25887
25887
  /**/
@@ -25892,8 +25892,8 @@ const OPENAI_MODELS = exportJson({
25892
25892
  modelName: 'gpt-4.1-mini',
25893
25893
  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.',
25894
25894
  pricing: {
25895
- prompt: pricing(`$0.80 / 1M tokens`),
25896
- output: pricing(`$3.20 / 1M tokens`),
25895
+ prompt: pricing(`$0.40 / 1M tokens`),
25896
+ output: pricing(`$1.60 / 1M tokens`),
25897
25897
  },
25898
25898
  },
25899
25899
  /**/
@@ -25904,8 +25904,8 @@ const OPENAI_MODELS = exportJson({
25904
25904
  modelName: 'gpt-4.1-nano',
25905
25905
  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.',
25906
25906
  pricing: {
25907
- prompt: pricing(`$0.20 / 1M tokens`),
25908
- output: pricing(`$0.80 / 1M tokens`),
25907
+ prompt: pricing(`$0.10 / 1M tokens`),
25908
+ output: pricing(`$0.40 / 1M tokens`),
25909
25909
  },
25910
25910
  },
25911
25911
  /**/
@@ -25916,8 +25916,8 @@ const OPENAI_MODELS = exportJson({
25916
25916
  modelName: 'o3',
25917
25917
  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.',
25918
25918
  pricing: {
25919
- prompt: pricing(`$15.00 / 1M tokens`),
25920
- output: pricing(`$60.00 / 1M tokens`),
25919
+ prompt: pricing(`$2.00 / 1M tokens`),
25920
+ output: pricing(`$8.00 / 1M tokens`),
25921
25921
  },
25922
25922
  },
25923
25923
  /**/
@@ -25928,8 +25928,8 @@ const OPENAI_MODELS = exportJson({
25928
25928
  modelName: 'o3-pro',
25929
25929
  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.',
25930
25930
  pricing: {
25931
- prompt: pricing(`$30.00 / 1M tokens`),
25932
- output: pricing(`$120.00 / 1M tokens`),
25931
+ prompt: pricing(`$20.00 / 1M tokens`),
25932
+ output: pricing(`$80.00 / 1M tokens`),
25933
25933
  },
25934
25934
  },
25935
25935
  /**/
@@ -25940,8 +25940,8 @@ const OPENAI_MODELS = exportJson({
25940
25940
  modelName: 'o4-mini',
25941
25941
  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.',
25942
25942
  pricing: {
25943
- prompt: pricing(`$4.00 / 1M tokens`),
25944
- output: pricing(`$16.00 / 1M tokens`),
25943
+ prompt: pricing(`$1.10 / 1M tokens`),
25944
+ output: pricing(`$4.40 / 1M tokens`),
25945
25945
  },
25946
25946
  },
25947
25947
  /**/
@@ -26299,8 +26299,8 @@ const OPENAI_MODELS = exportJson({
26299
26299
  modelName: 'gpt-4o-2024-05-13',
26300
26300
  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.',
26301
26301
  pricing: {
26302
- prompt: pricing(`$5.00 / 1M tokens`),
26303
- output: pricing(`$15.00 / 1M tokens`),
26302
+ prompt: pricing(`$2.50 / 1M tokens`),
26303
+ output: pricing(`$10.00 / 1M tokens`),
26304
26304
  },
26305
26305
  },
26306
26306
  /**/
@@ -26311,8 +26311,8 @@ const OPENAI_MODELS = exportJson({
26311
26311
  modelName: 'gpt-4o',
26312
26312
  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.",
26313
26313
  pricing: {
26314
- prompt: pricing(`$5.00 / 1M tokens`),
26315
- output: pricing(`$15.00 / 1M tokens`),
26314
+ prompt: pricing(`$2.50 / 1M tokens`),
26315
+ output: pricing(`$10.00 / 1M tokens`),
26316
26316
  },
26317
26317
  },
26318
26318
  /**/
@@ -26383,8 +26383,8 @@ const OPENAI_MODELS = exportJson({
26383
26383
  modelName: 'o3-mini',
26384
26384
  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.',
26385
26385
  pricing: {
26386
- prompt: pricing(`$3.00 / 1M tokens`),
26387
- output: pricing(`$12.00 / 1M tokens`),
26386
+ prompt: pricing(`$1.10 / 1M tokens`),
26387
+ output: pricing(`$4.40 / 1M tokens`),
26388
26388
  },
26389
26389
  },
26390
26390
  /**/
@@ -26484,53 +26484,6 @@ resultContent, rawResponse, duration = ZERO_VALUE) {
26484
26484
  * TODO: [🤝] DRY Maybe some common abstraction between `computeOpenAiUsage` and `computeAnthropicClaudeUsage`
26485
26485
  */
26486
26486
 
26487
- /**
26488
- * Maps Promptbook tools to OpenAI tools.
26489
- *
26490
- * @private
26491
- */
26492
- function mapToolsToOpenAi(tools) {
26493
- return tools.map((tool) => ({
26494
- type: 'function',
26495
- function: {
26496
- name: tool.name,
26497
- description: tool.description,
26498
- parameters: tool.parameters,
26499
- },
26500
- }));
26501
- }
26502
-
26503
- /**
26504
- * Builds a tool invocation script that injects hidden runtime context into tool args.
26505
- *
26506
- * @private utility of OpenAI tool execution wrappers
26507
- */
26508
- function buildToolInvocationScript(options) {
26509
- const { functionName, functionArgsExpression } = options;
26510
- return `
26511
- const args = ${functionArgsExpression};
26512
- const runtimeContextRaw =
26513
- typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
26514
- ? undefined
26515
- : ${TOOL_RUNTIME_CONTEXT_PARAMETER};
26516
-
26517
- if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
26518
- args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
26519
- }
26520
-
26521
- const toolProgressTokenRaw =
26522
- typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
26523
- ? undefined
26524
- : ${TOOL_PROGRESS_TOKEN_PARAMETER};
26525
-
26526
- if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
26527
- args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
26528
- }
26529
-
26530
- return await ${functionName}(args);
26531
- `;
26532
- }
26533
-
26534
26487
  /**
26535
26488
  * Parses an OpenAI error message to identify which parameter is unsupported
26536
26489
  *
@@ -26587,6 +26540,53 @@ function isUnsupportedParameterError(error) {
26587
26540
  errorMessage.includes('does not support'));
26588
26541
  }
26589
26542
 
26543
+ /**
26544
+ * Builds a tool invocation script that injects hidden runtime context into tool args.
26545
+ *
26546
+ * @private utility of OpenAI tool execution wrappers
26547
+ */
26548
+ function buildToolInvocationScript(options) {
26549
+ const { functionName, functionArgsExpression } = options;
26550
+ return `
26551
+ const args = ${functionArgsExpression};
26552
+ const runtimeContextRaw =
26553
+ typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
26554
+ ? undefined
26555
+ : ${TOOL_RUNTIME_CONTEXT_PARAMETER};
26556
+
26557
+ if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
26558
+ args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
26559
+ }
26560
+
26561
+ const toolProgressTokenRaw =
26562
+ typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
26563
+ ? undefined
26564
+ : ${TOOL_PROGRESS_TOKEN_PARAMETER};
26565
+
26566
+ if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
26567
+ args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
26568
+ }
26569
+
26570
+ return await ${functionName}(args);
26571
+ `;
26572
+ }
26573
+
26574
+ /**
26575
+ * Maps Promptbook tools to OpenAI tools.
26576
+ *
26577
+ * @private
26578
+ */
26579
+ function mapToolsToOpenAi(tools) {
26580
+ return tools.map((tool) => ({
26581
+ type: 'function',
26582
+ function: {
26583
+ name: tool.name,
26584
+ description: tool.description,
26585
+ parameters: tool.parameters,
26586
+ },
26587
+ }));
26588
+ }
26589
+
26590
26590
  /**
26591
26591
  * Provides access to the structured clone implementation when available.
26592
26592
  */
@@ -27553,7 +27553,7 @@ class OpenAiCompatibleExecutionTools {
27553
27553
  // Note: Match exact or prefix for model families
27554
27554
  const model = this.HARDCODED_MODELS.find(({ modelName }) => modelName === defaultModelName || modelName.startsWith(defaultModelName));
27555
27555
  if (model === undefined) {
27556
- throw new PipelineExecutionError(spaceTrim$2((block) => `
27556
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
27557
27557
  Cannot find model in ${this.title} models with name "${defaultModelName}" which should be used as default.
27558
27558
 
27559
27559
  Available models:
@@ -28479,7 +28479,7 @@ class OpenAiVectorStoreHandler extends OpenAiExecutionTools {
28479
28479
  }
28480
28480
  }
28481
28481
 
28482
- const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5-mini-2025-08-07';
28482
+ const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-nano';
28483
28483
  /**
28484
28484
  * Creates one structured log entry for streamed tool-call updates.
28485
28485
  *
@@ -28974,7 +28974,7 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
28974
28974
  }),
28975
28975
  ],
28976
28976
  };
28977
- const errorMessage = spaceTrim$2((block) => `
28977
+ const errorMessage = spaceTrim$1((block) => `
28978
28978
 
28979
28979
  The invoked tool \`${functionName}\` failed with error:
28980
28980
 
@@ -29692,7 +29692,7 @@ class OpenAiAssistantExecutionTools extends OpenAiVectorStoreHandler {
29692
29692
  assertsError(error);
29693
29693
  const serializedError = serializeError(error);
29694
29694
  errors = [serializedError];
29695
- functionResponse = spaceTrim$2((block) => `
29695
+ functionResponse = spaceTrim$1((block) => `
29696
29696
 
29697
29697
  The invoked tool \`${functionName}\` failed with error:
29698
29698
 
@@ -30700,7 +30700,7 @@ class SelfLearningManager {
30700
30700
  if (isJsonSchemaResponseFormat(responseFormat)) {
30701
30701
  const jsonSchema = responseFormat.json_schema;
30702
30702
  const schemaJson = JSON.stringify(jsonSchema, null, 4);
30703
- userMessageContent = spaceTrim$2((block) => `
30703
+ userMessageContent = spaceTrim$1((block) => `
30704
30704
  ${block(prompt.content)}
30705
30705
 
30706
30706
  NOTE Request was made through OpenAI Compatible API with \`response_format\` of type \`json_schema\` with the following schema:
@@ -30731,12 +30731,12 @@ class SelfLearningManager {
30731
30731
  const formattedAgentMessage = formatAgentMessageForJsonMode(result.content, usesJsonSchemaMode);
30732
30732
  const teacherInstructions = extractOpenTeacherInstructions(agentSource);
30733
30733
  const teacherInstructionsSection = teacherInstructions
30734
- ? spaceTrim$2((block) => `
30734
+ ? spaceTrim$1((block) => `
30735
30735
  **Teacher instructions:**
30736
30736
  ${block(teacherInstructions)}
30737
30737
  `)
30738
30738
  : '';
30739
- const teacherPromptContent = spaceTrim$2((block) => `
30739
+ const teacherPromptContent = spaceTrim$1((block) => `
30740
30740
 
30741
30741
  You are a teacher agent helping another agent to learn from its interactions.
30742
30742
 
@@ -30769,7 +30769,7 @@ class SelfLearningManager {
30769
30769
  ? '- This interaction used JSON mode, so the agent answer should stay as a formatted JSON code block.'
30770
30770
  : ''}
30771
30771
  ${block(isInitialMessageMissing
30772
- ? spaceTrim$2(`
30772
+ ? spaceTrim$1(`
30773
30773
  - The agent source does not have an INITIAL MESSAGE defined, generate one.
30774
30774
  - 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.
30775
30775
  - The quick option looks like \`[👋 Hello](?message=Hello, how are you?)\`
@@ -30812,7 +30812,7 @@ class SelfLearningManager {
30812
30812
  */
30813
30813
  appendToAgentSource(section) {
30814
30814
  const currentSource = this.options.getAgentSource();
30815
- const newSource = padBook(validateBook(spaceTrim$2(currentSource) + section));
30815
+ const newSource = padBook(validateBook(spaceTrim$1(currentSource) + section));
30816
30816
  this.options.updateAgentSource(newSource);
30817
30817
  }
30818
30818
  }
@@ -30840,13 +30840,13 @@ function formatAgentMessageForJsonMode(content, isJsonMode) {
30840
30840
  }
30841
30841
  const parsedJson = tryParseJson(content);
30842
30842
  if (parsedJson === null) {
30843
- return spaceTrim$2((block) => `
30843
+ return spaceTrim$1((block) => `
30844
30844
  \`\`\`json
30845
30845
  ${block(content)}
30846
30846
  \`\`\`
30847
30847
  `);
30848
30848
  }
30849
- return spaceTrim$2((block) => `
30849
+ return spaceTrim$1((block) => `
30850
30850
  \`\`\`json
30851
30851
  ${block(JSON.stringify(parsedJson, null, 4))}
30852
30852
  \`\`\`
@@ -30878,7 +30878,7 @@ function formatSelfLearningSample(options) {
30878
30878
  const internalMessagesSection = options.internalMessages
30879
30879
  .map((internalMessage) => formatInternalLearningMessage(internalMessage))
30880
30880
  .join('\n\n');
30881
- return spaceTrim$2((block) => `
30881
+ return spaceTrim$1((block) => `
30882
30882
 
30883
30883
  USER MESSAGE
30884
30884
  ${block(options.userMessageContent)}
@@ -30896,7 +30896,7 @@ function formatSelfLearningSample(options) {
30896
30896
  * @private function of Agent
30897
30897
  */
30898
30898
  function formatInternalLearningMessage(internalMessage) {
30899
- return spaceTrim$2((block) => `
30899
+ return spaceTrim$1((block) => `
30900
30900
  INTERNAL MESSAGE
30901
30901
  ${block(stringifyInternalLearningPayload(internalMessage))}
30902
30902
  `);
@@ -31362,7 +31362,7 @@ function buildRemoteAgentSource(profile, meta) {
31362
31362
  .filter((line) => Boolean(line))
31363
31363
  .join('\n');
31364
31364
  const personaBlock = profile.personaDescription
31365
- ? spaceTrim$2((block) => `
31365
+ ? spaceTrim$1((block) => `
31366
31366
  PERSONA
31367
31367
  ${block(profile.personaDescription || '')}
31368
31368
  `)
@@ -31398,7 +31398,7 @@ class RemoteAgent extends Agent {
31398
31398
  // <- TODO: [🐱‍🚀] What about closed-source agents?
31399
31399
  // <- TODO: [🐱‍🚀] Maybe use promptbookFetch
31400
31400
  if (!profileResponse.ok) {
31401
- throw new Error(spaceTrim$2((block) => `
31401
+ throw new Error(spaceTrim$1((block) => `
31402
31402
  Failed to fetch remote agent profile:
31403
31403
 
31404
31404
  Agent URL: