@promptbook/browser 0.112.0-13 → 0.112.0-15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/esm/index.es.js +135 -135
  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 +304 -305
  18. package/umd/index.umd.js.map +1 -1
  19. package/umd/src/cli/cli-commands/coder/{find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags.d.ts} +1 -1
  20. package/umd/src/cli/cli-commands/coder.d.ts +1 -1
  21. package/umd/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +1 -1
  22. package/umd/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  23. package/umd/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
  24. package/umd/src/llm-providers/google/google-models.d.ts +1 -1
  25. package/umd/src/llm-providers/openai/openai-models.d.ts +1 -1
  26. package/umd/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -2
  27. package/umd/src/scrapers/document/DocumentScraper.d.ts +1 -2
  28. package/umd/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -2
  29. package/umd/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
  30. package/umd/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -2
  31. package/umd/src/version.d.ts +1 -1
package/umd/index.umd.js CHANGED
@@ -1,12 +1,11 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('destroyable'), require('rxjs'), require('crypto'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('mime-types'), require('moment'), require('waitasecond'), require('crypto-js/sha256'), require('papaparse'), require('@openai/agents'), require('bottleneck'), require('colors'), require('openai')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'destroyable', 'rxjs', 'crypto', 'crypto-js', 'crypto-js/enc-hex', 'path', 'mime-types', 'moment', 'waitasecond', 'crypto-js/sha256', 'papaparse', '@openai/agents', 'bottleneck', 'colors', 'openai'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-browser"] = {}, global.spaceTrim$1, global.destroyable, global.rxjs, global.crypto, global.cryptoJs, global.hexEncoder, global.path, global.mimeTypes, global.moment, global.waitasecond, global.sha256, global.papaparse, global.agents, global.Bottleneck, global.colors, global.OpenAI));
5
- })(this, (function (exports, spaceTrim$1, destroyable, rxjs, crypto, cryptoJs, hexEncoder, path, mimeTypes, moment, waitasecond, sha256, papaparse, agents, Bottleneck, colors, OpenAI) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-browser"] = {}, global.spacetrim, global.destroyable, global.rxjs, global.crypto, global.cryptoJs, global.hexEncoder, global.path, global.mimeTypes, global.moment, global.waitasecond, global.sha256, global.papaparse, global.agents, global.Bottleneck, global.colors, global.OpenAI));
5
+ })(this, (function (exports, spacetrim, destroyable, rxjs, crypto, cryptoJs, hexEncoder, path, mimeTypes, moment, waitasecond, sha256, papaparse, agents, Bottleneck, colors, OpenAI) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
- var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
10
9
  var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
11
10
  var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
12
11
  var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
@@ -28,7 +27,7 @@
28
27
  * @generated
29
28
  * @see https://github.com/webgptorg/promptbook
30
29
  */
31
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-13';
30
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-15';
32
31
  /**
33
32
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
34
33
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -43,7 +42,7 @@
43
42
  * @public exported from `@promptbook/utils`
44
43
  * @see https://github.com/hejny/spacetrim#usage
45
44
  */
46
- const spaceTrim = spaceTrim$1.spaceTrim;
45
+ const spaceTrim = spacetrim.spaceTrim;
47
46
 
48
47
  /**
49
48
  * @private util of `@promptbook/color`
@@ -1179,7 +1178,7 @@
1179
1178
  function getErrorReportUrl(error) {
1180
1179
  const report = {
1181
1180
  title: `🐜 Error report from ${NAME}`,
1182
- body: spaceTrim__default["default"]((block) => `
1181
+ body: spacetrim.spaceTrim((block) => `
1183
1182
 
1184
1183
 
1185
1184
  \`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
@@ -1222,7 +1221,7 @@
1222
1221
  */
1223
1222
  class UnexpectedError extends Error {
1224
1223
  constructor(message) {
1225
- super(spaceTrim$1.spaceTrim((block) => `
1224
+ super(spacetrim.spaceTrim((block) => `
1226
1225
  ${block(message)}
1227
1226
 
1228
1227
  Note: This error should not happen.
@@ -1448,7 +1447,7 @@
1448
1447
  * Markdown documentation for ACTION commitment.
1449
1448
  */
1450
1449
  get documentation() {
1451
- return spaceTrim$1.spaceTrim(`
1450
+ return spacetrim.spaceTrim(`
1452
1451
  # ${this.type}
1453
1452
 
1454
1453
  Defines specific actions or capabilities that the agent can perform.
@@ -1552,7 +1551,7 @@
1552
1551
  * Markdown documentation for CLOSED commitment.
1553
1552
  */
1554
1553
  get documentation() {
1555
- return spaceTrim$1.spaceTrim(`
1554
+ return spacetrim.spaceTrim(`
1556
1555
  # CLOSED
1557
1556
 
1558
1557
  Specifies that the agent **cannot** be modified by conversation with it.
@@ -1607,7 +1606,7 @@
1607
1606
  * Markdown documentation for COMPONENT commitment.
1608
1607
  */
1609
1608
  get documentation() {
1610
- return spaceTrim$1.spaceTrim(`
1609
+ return spacetrim.spaceTrim(`
1611
1610
  # COMPONENT
1612
1611
 
1613
1612
  Defines a UI component that the agent can render in the chat.
@@ -1679,7 +1678,7 @@
1679
1678
  * Markdown documentation for DELETE commitment.
1680
1679
  */
1681
1680
  get documentation() {
1682
- return spaceTrim$1.spaceTrim(`
1681
+ return spacetrim.spaceTrim(`
1683
1682
  # DELETE (CANCEL, DISCARD, REMOVE)
1684
1683
 
1685
1684
  A commitment to remove or disregard certain information or context. This can be useful for overriding previous commitments or removing unwanted behaviors.
@@ -1810,7 +1809,7 @@
1810
1809
  * Markdown documentation for DICTIONARY commitment.
1811
1810
  */
1812
1811
  get documentation() {
1813
- return spaceTrim$1.spaceTrim(`
1812
+ return spacetrim.spaceTrim(`
1814
1813
  # DICTIONARY
1815
1814
 
1816
1815
  Defines specific terms and their meanings that the agent should use correctly in reasoning and responses.
@@ -1907,7 +1906,7 @@
1907
1906
  * Markdown documentation for FORMAT commitment.
1908
1907
  */
1909
1908
  get documentation() {
1910
- return spaceTrim$1.spaceTrim(`
1909
+ return spacetrim.spaceTrim(`
1911
1910
  # ${this.type}
1912
1911
 
1913
1912
  Defines the specific output structure and formatting for responses (data formats, templates, structure).
@@ -2003,7 +2002,7 @@
2003
2002
  constructor(whatWasThrown) {
2004
2003
  const tag = `[🤮]`;
2005
2004
  console.error(tag, whatWasThrown);
2006
- super(spaceTrim$1.spaceTrim(`
2005
+ super(spacetrim.spaceTrim(`
2007
2006
  Non-Error object was thrown
2008
2007
 
2009
2008
  Note: Look for ${tag} in the console for more details
@@ -2092,7 +2091,7 @@
2092
2091
  }
2093
2092
  else if (typeof value === 'object') {
2094
2093
  if (value instanceof Date) {
2095
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
2094
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
2096
2095
  \`${name}\` is Date
2097
2096
 
2098
2097
  Use \`string_date_iso8601\` instead
@@ -2111,7 +2110,7 @@
2111
2110
  throw new UnexpectedError(`${name} is RegExp`);
2112
2111
  }
2113
2112
  else if (value instanceof Error) {
2114
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
2113
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
2115
2114
  \`${name}\` is unserialized Error
2116
2115
 
2117
2116
  Use function \`serializeError\`
@@ -2134,7 +2133,7 @@
2134
2133
  }
2135
2134
  catch (error) {
2136
2135
  assertsError(error);
2137
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
2136
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
2138
2137
  \`${name}\` is not serializable
2139
2138
 
2140
2139
  ${block(error.stack || error.message)}
@@ -2166,7 +2165,7 @@
2166
2165
  }
2167
2166
  }
2168
2167
  else {
2169
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
2168
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
2170
2169
  \`${name}\` is unknown type
2171
2170
 
2172
2171
  Additional message for \`${name}\`:
@@ -3003,7 +3002,7 @@
3003
3002
  */
3004
3003
  class MissingToolsError extends Error {
3005
3004
  constructor(message) {
3006
- super(spaceTrim$1.spaceTrim((block) => `
3005
+ super(spacetrim.spaceTrim((block) => `
3007
3006
  ${block(message)}
3008
3007
 
3009
3008
  Note: You have probably forgot to provide some tools for pipeline execution or preparation
@@ -3047,7 +3046,7 @@
3047
3046
  */
3048
3047
  class NotYetImplementedError extends Error {
3049
3048
  constructor(message) {
3050
- super(spaceTrim$1.spaceTrim((block) => `
3049
+ super(spacetrim.spaceTrim((block) => `
3051
3050
  ${block(message)}
3052
3051
 
3053
3052
  Note: This feature is not implemented yet but it will be soon.
@@ -3233,7 +3232,7 @@
3233
3232
  message = `${name}: ${message}`;
3234
3233
  }
3235
3234
  if (isStackAddedToMessage && stack !== undefined && stack !== '') {
3236
- message = spaceTrim__default["default"]((block) => `
3235
+ message = spacetrim.spaceTrim((block) => `
3237
3236
  ${block(message)}
3238
3237
 
3239
3238
  Original stack trace:
@@ -3254,7 +3253,7 @@
3254
3253
  const { name, message, stack } = error;
3255
3254
  const { id } = error;
3256
3255
  if (!Object.keys(ALL_ERRORS).includes(name)) {
3257
- console.error(spaceTrim__default["default"]((block) => `
3256
+ console.error(spacetrim.spaceTrim((block) => `
3258
3257
 
3259
3258
  Cannot serialize error with name "${name}"
3260
3259
 
@@ -3360,7 +3359,7 @@
3360
3359
  }
3361
3360
  else if (typeof value !== 'string') {
3362
3361
  console.error('Can not parse JSON from non-string value.', { text: value });
3363
- throw new Error(spaceTrim__default["default"](`
3362
+ throw new Error(spacetrim.spaceTrim(`
3364
3363
  Can not parse JSON from non-string value.
3365
3364
 
3366
3365
  The value type: ${typeof value}
@@ -3374,7 +3373,7 @@
3374
3373
  if (!(error instanceof Error)) {
3375
3374
  throw error;
3376
3375
  }
3377
- throw new Error(spaceTrim__default["default"]((block) => `
3376
+ throw new Error(spacetrim.spaceTrim((block) => `
3378
3377
  ${block(error.message)}
3379
3378
 
3380
3379
  The expected JSON text:
@@ -3815,7 +3814,7 @@
3815
3814
  const entries = items
3816
3815
  .flatMap((item) => formatParameterListItem(item).split(/\r?\n/))
3817
3816
  .filter((line) => line !== '');
3818
- return spaceTrim__default["default"]((block) => `
3817
+ return spacetrim.spaceTrim((block) => `
3819
3818
  **Parameters:**
3820
3819
  ${block(entries.join('\n'))}
3821
3820
 
@@ -3888,7 +3887,7 @@
3888
3887
  */
3889
3888
  function prompt(strings, ...values) {
3890
3889
  if (values.length === 0) {
3891
- return new PromptString(spaceTrim__default["default"](strings.join('')));
3890
+ return new PromptString(spacetrim.spaceTrim(strings.join('')));
3892
3891
  }
3893
3892
  const stringsWithHiddenParameters = strings.map((stringsItem) => ParameterEscaping.hideBrackets(stringsItem));
3894
3893
  const parameterMetadata = values.map((value) => {
@@ -3929,7 +3928,7 @@
3929
3928
  ? `${result}${stringsItem}`
3930
3929
  : `${result}${stringsItem}${ParameterSection.formatParameterPlaceholder(parameterName)}`;
3931
3930
  }, '');
3932
- pipelineString = spaceTrim__default["default"](pipelineString);
3931
+ pipelineString = spacetrim.spaceTrim(pipelineString);
3933
3932
  try {
3934
3933
  pipelineString = templateParameters(pipelineString, parameters);
3935
3934
  }
@@ -3938,7 +3937,7 @@
3938
3937
  throw error;
3939
3938
  }
3940
3939
  console.error({ pipelineString, parameters, parameterNames: parameterNamesOrdered, error });
3941
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
3940
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
3942
3941
  Internal error in prompt template literal
3943
3942
 
3944
3943
  ${block(JSON.stringify({ strings, values }, null, 4))}}
@@ -4202,7 +4201,7 @@
4202
4201
  * @public exported from `@promptbook/utils`
4203
4202
  */
4204
4203
  function computeHash(value) {
4205
- return cryptoJs.SHA256(hexEncoder__default["default"].parse(spaceTrim__default["default"](valueToString(value)))).toString( /* hex */);
4204
+ return cryptoJs.SHA256(hexEncoder__default["default"].parse(spacetrim.spaceTrim(valueToString(value)))).toString( /* hex */);
4206
4205
  }
4207
4206
  /**
4208
4207
  * TODO: [🥬][🥬] Use this ACRY
@@ -5729,7 +5728,7 @@
5729
5728
  * @public exported from `@promptbook/utils`
5730
5729
  */
5731
5730
  function normalizeMessageText(text) {
5732
- return spaceTrim$1.spaceTrim(text);
5731
+ return spacetrim.spaceTrim(text);
5733
5732
  }
5734
5733
 
5735
5734
  /**
@@ -5776,7 +5775,7 @@
5776
5775
  let trimmedText = text;
5777
5776
  // Remove leading and trailing spaces and newlines
5778
5777
  if (isTrimmed) {
5779
- trimmedText = spaceTrim$1.spaceTrim(trimmedText);
5778
+ trimmedText = spacetrim.spaceTrim(trimmedText);
5780
5779
  }
5781
5780
  let processedText = trimmedText;
5782
5781
  // Check for markdown code block
@@ -5795,7 +5794,7 @@
5795
5794
  // Remove the introduce sentence and quotes by replacing it with an empty string
5796
5795
  processedText = processedText.replace(introduceSentenceRegex, '');
5797
5796
  }
5798
- processedText = spaceTrim$1.spaceTrim(processedText);
5797
+ processedText = spacetrim.spaceTrim(processedText);
5799
5798
  // Check again for code block after removing introduce sentence
5800
5799
  const codeBlockMatch2 = processedText.match(codeBlockRegex);
5801
5800
  if (codeBlockMatch2 && codeBlockMatch2[1] !== undefined) {
@@ -6390,7 +6389,7 @@
6390
6389
  * Markdown documentation for FROM commitment.
6391
6390
  */
6392
6391
  get documentation() {
6393
- return spaceTrim$1.spaceTrim(`
6392
+ return spacetrim.spaceTrim(`
6394
6393
  # ${this.type}
6395
6394
 
6396
6395
  Inherits agent source from another agent.
@@ -6417,7 +6416,7 @@
6417
6416
  };
6418
6417
  }
6419
6418
  if (!isValidAgentUrl(trimmedContent)) {
6420
- throw new Error(spaceTrim$1.spaceTrim((block) => `
6419
+ throw new Error(spacetrim.spaceTrim((block) => `
6421
6420
  Invalid agent URL in FROM commitment: "${trimmedContent}"
6422
6421
 
6423
6422
  \`\`\`book
@@ -6474,7 +6473,7 @@
6474
6473
  * Markdown documentation for GOAL commitment.
6475
6474
  */
6476
6475
  get documentation() {
6477
- return spaceTrim$1.spaceTrim(`
6476
+ return spacetrim.spaceTrim(`
6478
6477
  # ${this.type}
6479
6478
 
6480
6479
  Defines the main goal which should be achieved by the AI assistant. There can be multiple goals, and later goals are more important than earlier goals.
@@ -6571,7 +6570,7 @@
6571
6570
  * Markdown documentation for IMPORT commitment.
6572
6571
  */
6573
6572
  get documentation() {
6574
- return spaceTrim$1.spaceTrim(`
6573
+ return spacetrim.spaceTrim(`
6575
6574
  # ${this.type}
6576
6575
 
6577
6576
  Imports content from another agent or a generic text file at the location of the commitment.
@@ -6606,7 +6605,7 @@
6606
6605
  importedFileUrls: [...(requirements.importedFileUrls || []), trimmedContent],
6607
6606
  };
6608
6607
  }
6609
- throw new Error(spaceTrim$1.spaceTrim((block) => `
6608
+ throw new Error(spacetrim.spaceTrim((block) => `
6610
6609
  Invalid agent URL or file path in IMPORT commitment: "${trimmedContent}"
6611
6610
 
6612
6611
  \`\`\`book
@@ -6860,7 +6859,7 @@
6860
6859
  * Markdown documentation for KNOWLEDGE commitment.
6861
6860
  */
6862
6861
  get documentation() {
6863
- return spaceTrim$1.spaceTrim(`
6862
+ return spacetrim.spaceTrim(`
6864
6863
  # ${this.type}
6865
6864
 
6866
6865
  Adds specific knowledge, facts, or context to the agent using a RAG (Retrieval-Augmented Generation) approach for external sources.
@@ -6988,7 +6987,7 @@
6988
6987
  * Markdown documentation for LANGUAGE/LANGUAGES commitment.
6989
6988
  */
6990
6989
  get documentation() {
6991
- return spaceTrim$1.spaceTrim(`
6990
+ return spacetrim.spaceTrim(`
6992
6991
  # ${this.type}
6993
6992
 
6994
6993
  Specifies the language(s) the agent should use in its responses.
@@ -7017,7 +7016,7 @@
7017
7016
  return requirements;
7018
7017
  }
7019
7018
  // Add language rule to the system message
7020
- const languageSection = this.createSystemMessageSection('Language:', spaceTrim$1.spaceTrim((block) => `
7019
+ const languageSection = this.createSystemMessageSection('Language:', spacetrim.spaceTrim((block) => `
7021
7020
  ${block(trimmedContent)}
7022
7021
  <- You are speaking these languages in your responses to the user.
7023
7022
  `));
@@ -7034,11 +7033,11 @@
7034
7033
  * @private utility for commitments
7035
7034
  */
7036
7035
  function formatOptionalInstructionBlock(label, content) {
7037
- const trimmedContent = spaceTrim$1.spaceTrim(content);
7036
+ const trimmedContent = spacetrim.spaceTrim(content);
7038
7037
  if (!trimmedContent) {
7039
7038
  return '';
7040
7039
  }
7041
- return spaceTrim$1.spaceTrim((block) => `
7040
+ return spacetrim.spaceTrim((block) => `
7042
7041
  - ${label}:
7043
7042
  ${block(trimmedContent
7044
7043
  .split(/\r?\n/)
@@ -7065,7 +7064,7 @@
7065
7064
  * @private function of MemoryCommitmentDefinition
7066
7065
  */
7067
7066
  function createMemorySystemMessage(extraInstructions) {
7068
- return spaceTrim$1.spaceTrim((block) => `
7067
+ return spacetrim.spaceTrim((block) => `
7069
7068
  Memory:
7070
7069
  - Prefer storing agent-scoped memories; only make them global when the fact should apply across all your agents.
7071
7070
  - You can use persistent user memory tools.
@@ -7455,7 +7454,7 @@
7455
7454
  if (!tools.some((tool) => tool.name === MemoryToolNames.retrieve)) {
7456
7455
  tools.push({
7457
7456
  name: MemoryToolNames.retrieve,
7458
- description: spaceTrim$1.spaceTrim(`
7457
+ description: spacetrim.spaceTrim(`
7459
7458
  Retrieve previously stored user memories relevant to the current conversation.
7460
7459
  Use this before responding when user context can improve the answer.
7461
7460
  `),
@@ -7477,7 +7476,7 @@
7477
7476
  if (!tools.some((tool) => tool.name === MemoryToolNames.store)) {
7478
7477
  tools.push({
7479
7478
  name: MemoryToolNames.store,
7480
- description: spaceTrim$1.spaceTrim(`
7479
+ description: spacetrim.spaceTrim(`
7481
7480
  Store a durable user memory that should be remembered in future conversations.
7482
7481
  Store only stable and useful user-specific facts or preferences.
7483
7482
  `),
@@ -7500,7 +7499,7 @@
7500
7499
  if (!tools.some((tool) => tool.name === MemoryToolNames.update)) {
7501
7500
  tools.push({
7502
7501
  name: MemoryToolNames.update,
7503
- description: spaceTrim$1.spaceTrim(`
7502
+ description: spacetrim.spaceTrim(`
7504
7503
  Update an existing user memory after retrieving it, so the stored fact stays accurate.
7505
7504
  Always pass the memory id you retrieved along with the new content.
7506
7505
  `),
@@ -7527,7 +7526,7 @@
7527
7526
  if (!tools.some((tool) => tool.name === MemoryToolNames.delete)) {
7528
7527
  tools.push({
7529
7528
  name: MemoryToolNames.delete,
7530
- description: spaceTrim$1.spaceTrim(`
7529
+ description: spacetrim.spaceTrim(`
7531
7530
  Delete a user memory that is no longer relevant. Deletions are soft so the record is hidden from future queries.
7532
7531
  `),
7533
7532
  parameters: {
@@ -7551,7 +7550,7 @@
7551
7550
  * @private function of MemoryCommitmentDefinition
7552
7551
  */
7553
7552
  function getMemoryCommitmentDocumentation(type) {
7554
- return spaceTrim$1.spaceTrim(`
7553
+ return spacetrim.spaceTrim(`
7555
7554
  # ${type}
7556
7555
 
7557
7556
  Enables persistent user memory for the current agent. The memory is stored by the runtime and can be retrieved in future conversations.
@@ -7710,7 +7709,7 @@
7710
7709
  * Markdown documentation for AGENT MESSAGE commitment.
7711
7710
  */
7712
7711
  get documentation() {
7713
- return spaceTrim$1.spaceTrim(`
7712
+ return spacetrim.spaceTrim(`
7714
7713
  # ${this.type}
7715
7714
 
7716
7715
  Defines a message from the agent in the conversation history. This is used to pre-fill the chat with a conversation history or to provide few-shot examples.
@@ -7787,7 +7786,7 @@
7787
7786
  * Markdown documentation for INITIAL MESSAGE commitment.
7788
7787
  */
7789
7788
  get documentation() {
7790
- return spaceTrim$1.spaceTrim(`
7789
+ return spacetrim.spaceTrim(`
7791
7790
  # ${this.type}
7792
7791
 
7793
7792
  Defines the first message that the user sees when opening the chat. This message is purely for display purposes in the UI and does not inherently become part of the LLM's system prompt context (unless also included via other means).
@@ -7854,7 +7853,7 @@
7854
7853
  * Markdown documentation for INTERNAL MESSAGE commitment.
7855
7854
  */
7856
7855
  get documentation() {
7857
- return spaceTrim$1.spaceTrim(`
7856
+ return spacetrim.spaceTrim(`
7858
7857
  # ${this.type}
7859
7858
 
7860
7859
  Defines an internal trace message related to one interaction. This is intended mainly for self-learning analytics and future training datasets.
@@ -7930,7 +7929,7 @@
7930
7929
  * Markdown documentation for MESSAGE commitment.
7931
7930
  */
7932
7931
  get documentation() {
7933
- return spaceTrim$1.spaceTrim(`
7932
+ return spacetrim.spaceTrim(`
7934
7933
  # ${this.type}
7935
7934
 
7936
7935
  Contains 1:1 text of the message which AI assistant already sent during the conversation. Later messages are later in the conversation. It is similar to \`WRITING SAMPLE\`, but it is not a sample. It is the real message which the AI assistant already sent.
@@ -8042,7 +8041,7 @@
8042
8041
  * Markdown documentation for USER MESSAGE commitment.
8043
8042
  */
8044
8043
  get documentation() {
8045
- return spaceTrim$1.spaceTrim(`
8044
+ return spacetrim.spaceTrim(`
8046
8045
  # ${this.type}
8047
8046
 
8048
8047
  Defines a message from the user in the conversation history. This is used to pre-fill the chat with a conversation history or to provide few-shot examples.
@@ -8109,7 +8108,7 @@
8109
8108
  * Markdown documentation for MESSAGE SUFFIX commitment.
8110
8109
  */
8111
8110
  get documentation() {
8112
- return spaceTrim$1.spaceTrim(`
8111
+ return spacetrim.spaceTrim(`
8113
8112
  # MESSAGE SUFFIX
8114
8113
 
8115
8114
  Defines a hardcoded message appended to every assistant response.
@@ -8191,7 +8190,7 @@
8191
8190
  * Markdown documentation for META commitment.
8192
8191
  */
8193
8192
  get documentation() {
8194
- return spaceTrim$1.spaceTrim(`
8193
+ return spacetrim.spaceTrim(`
8195
8194
  # META
8196
8195
 
8197
8196
  Sets meta-information about the agent that is used for display and attribution purposes.
@@ -8332,7 +8331,7 @@
8332
8331
  * Markdown documentation for META COLOR commitment.
8333
8332
  */
8334
8333
  get documentation() {
8335
- return spaceTrim$1.spaceTrim(`
8334
+ return spacetrim.spaceTrim(`
8336
8335
  # META COLOR
8337
8336
 
8338
8337
  Sets the agent's accent color or gradient.
@@ -8416,7 +8415,7 @@
8416
8415
  * Markdown documentation for META DOMAIN commitment.
8417
8416
  */
8418
8417
  get documentation() {
8419
- return spaceTrim$1.spaceTrim(`
8418
+ return spacetrim.spaceTrim(`
8420
8419
  # META DOMAIN
8421
8420
 
8422
8421
  Sets the canonical domain (host) of the agent, for example a custom domain that should open this agent directly.
@@ -8491,7 +8490,7 @@
8491
8490
  * Markdown documentation for META DISCLAIMER commitment.
8492
8491
  */
8493
8492
  get documentation() {
8494
- return spaceTrim$1.spaceTrim(`
8493
+ return spacetrim.spaceTrim(`
8495
8494
  # META DISCLAIMER
8496
8495
 
8497
8496
  Defines a markdown disclaimer shown to users before they can start chatting with the agent.
@@ -8561,7 +8560,7 @@
8561
8560
  * Markdown documentation for META FONT commitment.
8562
8561
  */
8563
8562
  get documentation() {
8564
- return spaceTrim$1.spaceTrim(`
8563
+ return spacetrim.spaceTrim(`
8565
8564
  # META FONT
8566
8565
 
8567
8566
  Sets the agent's font.
@@ -8646,7 +8645,7 @@
8646
8645
  * Markdown documentation for META IMAGE commitment.
8647
8646
  */
8648
8647
  get documentation() {
8649
- return spaceTrim$1.spaceTrim(`
8648
+ return spacetrim.spaceTrim(`
8650
8649
  # META IMAGE
8651
8650
 
8652
8651
  Sets the agent's avatar/profile image URL.
@@ -8725,7 +8724,7 @@
8725
8724
  * Markdown documentation for META INPUT PLACEHOLDER commitment.
8726
8725
  */
8727
8726
  get documentation() {
8728
- return spaceTrim$1.spaceTrim(`
8727
+ return spacetrim.spaceTrim(`
8729
8728
  # META INPUT PLACEHOLDER
8730
8729
 
8731
8730
  Sets custom placeholder text for the chat input field.
@@ -8806,7 +8805,7 @@
8806
8805
  * Markdown documentation for META LINK commitment.
8807
8806
  */
8808
8807
  get documentation() {
8809
- return spaceTrim$1.spaceTrim(`
8808
+ return spacetrim.spaceTrim(`
8810
8809
  # META LINK
8811
8810
 
8812
8811
  Represents a profile or source link for the person the agent is modeled after.
@@ -8905,7 +8904,7 @@
8905
8904
  * Markdown documentation for META VOICE commitment.
8906
8905
  */
8907
8906
  get documentation() {
8908
- return spaceTrim$1.spaceTrim(`
8907
+ return spacetrim.spaceTrim(`
8909
8908
  # META VOICE
8910
8909
 
8911
8910
  Instructs the UI to use a specific ElevenLabs voice when reading this agent's replies aloud.
@@ -8987,7 +8986,7 @@
8987
8986
  * Markdown documentation for MODEL commitment.
8988
8987
  */
8989
8988
  get documentation() {
8990
- return spaceTrim$1.spaceTrim(`
8989
+ return spacetrim.spaceTrim(`
8991
8990
  # ${this.type}
8992
8991
 
8993
8992
  Enforces technical parameters for the AI model, ensuring consistent behavior across different execution environments.
@@ -9228,7 +9227,7 @@
9228
9227
  * Markdown documentation for NOTE commitment.
9229
9228
  */
9230
9229
  get documentation() {
9231
- return spaceTrim$1.spaceTrim(`
9230
+ return spacetrim.spaceTrim(`
9232
9231
  # ${this.type}
9233
9232
 
9234
9233
  Adds comments for documentation without changing agent behavior.
@@ -9267,7 +9266,7 @@
9267
9266
  applyToAgentModelRequirements(requirements, content) {
9268
9267
  // The NOTE commitment makes no changes to the system message or model requirements
9269
9268
  // It only stores the note content in metadata for documentation purposes
9270
- const trimmedContent = spaceTrim$1.spaceTrim(content);
9269
+ const trimmedContent = spacetrim.spaceTrim(content);
9271
9270
  if (trimmedContent === '') {
9272
9271
  return requirements;
9273
9272
  }
@@ -9312,7 +9311,7 @@
9312
9311
  * Markdown documentation for OPEN commitment.
9313
9312
  */
9314
9313
  get documentation() {
9315
- return spaceTrim$1.spaceTrim(`
9314
+ return spacetrim.spaceTrim(`
9316
9315
  # OPEN
9317
9316
 
9318
9317
  Specifies that the agent can be modified by conversation with it.
@@ -9389,7 +9388,7 @@
9389
9388
  * Markdown documentation for PERSONA commitment.
9390
9389
  */
9391
9390
  get documentation() {
9392
- return spaceTrim$1.spaceTrim(`
9391
+ return spacetrim.spaceTrim(`
9393
9392
  # ${this.type}
9394
9393
 
9395
9394
  Defines who the agent is, their background, expertise, and personality traits.
@@ -9522,7 +9521,7 @@
9522
9521
  * Markdown documentation for RULE/RULES commitment.
9523
9522
  */
9524
9523
  get documentation() {
9525
- return spaceTrim$1.spaceTrim(`
9524
+ return spacetrim.spaceTrim(`
9526
9525
  # ${this.type}
9527
9526
 
9528
9527
  Adds behavioral constraints and guidelines that the agent must follow.
@@ -9586,7 +9585,7 @@
9586
9585
  * @private internal utility of writing commitments
9587
9586
  */
9588
9587
  function createWritingSampleSection(content) {
9589
- return spaceTrim$1.spaceTrim(`
9588
+ return spacetrim.spaceTrim(`
9590
9589
  Use this as a 1:1 voice exemplar for how your replies should sound.
9591
9590
  Treat it as sample-only guidance for voice, cadence, phrasing, and emotional texture, not as task-solving instructions.
9592
9591
  If multiple writing samples exist, newer samples have higher weight than older ones.
@@ -9603,7 +9602,7 @@
9603
9602
  * @private internal utility of writing commitments
9604
9603
  */
9605
9604
  function createWritingRulesSection(content) {
9606
- return spaceTrim$1.spaceTrim(`
9605
+ return spacetrim.spaceTrim(`
9607
9606
  These instructions apply only to how you write: tone, formatting, length, emoji usage, punctuation, and similar presentation choices.
9608
9607
  They do not change your task-solving behavior, business logic, or factual decision-making rules.
9609
9608
  If multiple writing-rules blocks conflict, prefer the newer writing-rules blocks.
@@ -9653,7 +9652,7 @@
9653
9652
  * Markdown documentation for `SAMPLE` / `EXAMPLE`.
9654
9653
  */
9655
9654
  get documentation() {
9656
- return spaceTrim$1.spaceTrim(`
9655
+ return spacetrim.spaceTrim(`
9657
9656
  # ${this.type}
9658
9657
 
9659
9658
  Deprecated legacy alias for \`WRITING SAMPLE\`.
@@ -9734,7 +9733,7 @@
9734
9733
  * Markdown documentation for SCENARIO commitment.
9735
9734
  */
9736
9735
  get documentation() {
9737
- return spaceTrim$1.spaceTrim(`
9736
+ return spacetrim.spaceTrim(`
9738
9737
  # ${this.type}
9739
9738
 
9740
9739
  Defines a specific situation or context in which the AI assistant should operate. It helps to set the scene for the AI's responses. Later scenarios are more important than earlier scenarios.
@@ -9856,7 +9855,7 @@
9856
9855
  * Markdown documentation for STYLE commitment.
9857
9856
  */
9858
9857
  get documentation() {
9859
- return spaceTrim$1.spaceTrim(`
9858
+ return spacetrim.spaceTrim(`
9860
9859
  # ${this.type}
9861
9860
 
9862
9861
  Defines how the agent should format and present its responses (tone, writing style, formatting).
@@ -10129,7 +10128,7 @@
10129
10128
  * Markdown documentation for TEAM commitment.
10130
10129
  */
10131
10130
  get documentation() {
10132
- return spaceTrim$1.spaceTrim(`
10131
+ return spacetrim.spaceTrim(`
10133
10132
  # TEAM
10134
10133
 
10135
10134
  Registers teammate agents that the current agent can consult via tools.
@@ -10495,7 +10494,7 @@
10495
10494
  * Markdown documentation for TEMPLATE commitment.
10496
10495
  */
10497
10496
  get documentation() {
10498
- return spaceTrim$1.spaceTrim(`
10497
+ return spacetrim.spaceTrim(`
10499
10498
  # ${this.type}
10500
10499
 
10501
10500
  Enforces a specific response structure or template that the agent must follow when generating responses.
@@ -10551,7 +10550,7 @@
10551
10550
  templateMode: true,
10552
10551
  };
10553
10552
  // Add a general instruction about using structured templates
10554
- const templateModeInstruction = spaceTrim$1.spaceTrim(`
10553
+ const templateModeInstruction = spacetrim.spaceTrim(`
10555
10554
  Use a clear, structured template format for your responses.
10556
10555
  Maintain consistency in how you organize and present information.
10557
10556
  `);
@@ -10622,7 +10621,7 @@
10622
10621
  * Markdown documentation for USE commitment.
10623
10622
  */
10624
10623
  get documentation() {
10625
- return spaceTrim$1.spaceTrim(`
10624
+ return spacetrim.spaceTrim(`
10626
10625
  # USE
10627
10626
 
10628
10627
  Enables the agent to use specific tools or capabilities for interacting with external systems.
@@ -10780,7 +10779,7 @@
10780
10779
  * Markdown documentation for USE BROWSER commitment.
10781
10780
  */
10782
10781
  get documentation() {
10783
- return spaceTrim$1.spaceTrim(`
10782
+ return spacetrim.spaceTrim(`
10784
10783
  # USE BROWSER
10785
10784
 
10786
10785
  Enables the agent to use browser tools to access and retrieve up-to-date information from the internet.
@@ -10843,7 +10842,7 @@
10843
10842
  if (!existingTools.some((tool) => tool.name === 'fetch_url_content')) {
10844
10843
  toolsToAdd.push({
10845
10844
  name: 'fetch_url_content',
10846
- description: spaceTrim$1.spaceTrim(`
10845
+ description: spacetrim.spaceTrim(`
10847
10846
  Fetches and scrapes the content from a URL (webpage or document).
10848
10847
  This tool retrieves the content of the specified URL and converts it to markdown format.
10849
10848
  Use this when you need to access information from a specific website or document.
@@ -10865,7 +10864,7 @@
10865
10864
  if (!existingTools.some((tool) => tool.name === 'run_browser')) {
10866
10865
  toolsToAdd.push({
10867
10866
  name: 'run_browser',
10868
- description: spaceTrim$1.spaceTrim(`
10867
+ description: spacetrim.spaceTrim(`
10869
10868
  Launches a browser session for complex interactions.
10870
10869
  This tool is for advanced browser automation tasks like scrolling, clicking, form filling, etc.
10871
10870
  Use this when simple one-shot URL fetching is not enough.
@@ -10912,7 +10911,7 @@
10912
10911
  ...requirements._metadata,
10913
10912
  useBrowser: true,
10914
10913
  },
10915
- }, spaceTrim$1.spaceTrim(`
10914
+ }, spacetrim.spaceTrim(`
10916
10915
  You have access to browser tools to fetch and access content from the internet.
10917
10916
  - Use "fetch_url_content" to retrieve content from specific URLs (webpages or documents) using scrapers.
10918
10917
  - Use "run_browser" for real interactive browser automation (navigation, clicks, typing, waiting, scrolling).
@@ -10944,7 +10943,7 @@
10944
10943
  async run_browser(args) {
10945
10944
  console.log('!!!! [Tool] run_browser called', { args });
10946
10945
  const { url } = args;
10947
- return spaceTrim$1.spaceTrim(`
10946
+ return spacetrim.spaceTrim(`
10948
10947
  # Running browser
10949
10948
 
10950
10949
  The running browser tool is not available in this runtime.
@@ -10997,7 +10996,7 @@
10997
10996
  return null;
10998
10997
  }
10999
10998
  if (!response.ok) {
11000
- throw new Error(spaceTrim$1.spaceTrim(`
10999
+ throw new Error(spacetrim.spaceTrim(`
11001
11000
  Google Calendar API request failed (${response.status} ${response.statusText}):
11002
11001
  ${extractGoogleCalendarApiErrorMessage(parsedPayload, textPayload)}
11003
11002
  `));
@@ -11106,7 +11105,7 @@
11106
11105
  * @private internal utility of USE CALENDAR commitment
11107
11106
  */
11108
11107
  function parseUseCalendarCommitmentContent(content) {
11109
- const trimmedContent = spaceTrim$1.spaceTrim(content);
11108
+ const trimmedContent = spacetrim.spaceTrim(content);
11110
11109
  if (!trimmedContent) {
11111
11110
  return {
11112
11111
  calendar: null,
@@ -12086,7 +12085,7 @@
12086
12085
  * Markdown documentation for USE CALENDAR commitment.
12087
12086
  */
12088
12087
  get documentation() {
12089
- return spaceTrim$1.spaceTrim(`
12088
+ return spacetrim.spaceTrim(`
12090
12089
  # USE CALENDAR
12091
12090
 
12092
12091
  Enables the agent to access and manage one Google Calendar.
@@ -12143,7 +12142,7 @@
12143
12142
  useCalendar: true,
12144
12143
  useCalendars: existingConfiguredCalendars,
12145
12144
  },
12146
- }, spaceTrim$1.spaceTrim((block) => `
12145
+ }, spacetrim.spaceTrim((block) => `
12147
12146
  Calendar tools:
12148
12147
  - You can inspect and manage events in configured calendars.
12149
12148
  - Supported operations include read, create, update, delete, invite guests, and reminders.
@@ -12205,7 +12204,7 @@
12205
12204
  * @private internal utility of USE EMAIL commitment
12206
12205
  */
12207
12206
  function parseUseEmailCommitmentContent(content) {
12208
- const trimmedContent = spaceTrim$1.spaceTrim(content);
12207
+ const trimmedContent = spacetrim.spaceTrim(content);
12209
12208
  if (!trimmedContent) {
12210
12209
  return {
12211
12210
  senderEmail: null,
@@ -12334,7 +12333,7 @@
12334
12333
  * Markdown documentation for USE EMAIL commitment.
12335
12334
  */
12336
12335
  get documentation() {
12337
- return spaceTrim$1.spaceTrim(`
12336
+ return spacetrim.spaceTrim(`
12338
12337
  # USE EMAIL
12339
12338
 
12340
12339
  Enables the agent to send outbound emails through SMTP.
@@ -12376,7 +12375,7 @@
12376
12375
  useEmail: true,
12377
12376
  ...(parsedCommitment.senderEmail ? { useEmailSender: parsedCommitment.senderEmail } : {}),
12378
12377
  },
12379
- }, spaceTrim$1.spaceTrim((block) => `
12378
+ }, spacetrim.spaceTrim((block) => `
12380
12379
  Email tool:
12381
12380
  - Use "${SEND_EMAIL_TOOL_NAME}" to send outbound emails.
12382
12381
  - Prefer \`message\` argument compatible with Promptbook \`Message\` type.
@@ -12494,7 +12493,7 @@
12494
12493
  * Markdown documentation for USE IMAGE GENERATOR commitment.
12495
12494
  */
12496
12495
  get documentation() {
12497
- return spaceTrim$1.spaceTrim(`
12496
+ return spacetrim.spaceTrim(`
12498
12497
  # USE IMAGE GENERATOR
12499
12498
 
12500
12499
  Enables the agent to output markdown image placeholders that trigger image generation in the user interface.
@@ -12533,7 +12532,7 @@
12533
12532
  ...requirements._metadata,
12534
12533
  useImageGenerator: content || true,
12535
12534
  },
12536
- }, spaceTrim$1.spaceTrim((block) => `
12535
+ }, spacetrim.spaceTrim((block) => `
12537
12536
  Image generation:
12538
12537
  - You do not generate images directly and you do not call any image tool.
12539
12538
  - When the user asks for an image, include markdown notation in your message:
@@ -12585,7 +12584,7 @@
12585
12584
  * Markdown documentation for USE MCP commitment.
12586
12585
  */
12587
12586
  get documentation() {
12588
- return spaceTrim$1.spaceTrim(`
12587
+ return spacetrim.spaceTrim(`
12589
12588
  # USE MCP
12590
12589
 
12591
12590
  Connects the agent to an external Model Context Protocol (MCP) server.
@@ -12666,7 +12665,7 @@
12666
12665
  * Markdown documentation for USE POPUP commitment.
12667
12666
  */
12668
12667
  get documentation() {
12669
- return spaceTrim$1.spaceTrim(`
12668
+ return spacetrim.spaceTrim(`
12670
12669
  # USE POPUP
12671
12670
 
12672
12671
  Enables the agent to open a popup window with a specific website.
@@ -12698,7 +12697,7 @@
12698
12697
  ...existingTools,
12699
12698
  {
12700
12699
  name: 'open_popup',
12701
- description: spaceTrim$1.spaceTrim(`
12700
+ description: spacetrim.spaceTrim(`
12702
12701
  Opens a popup window with a specific URL.
12703
12702
  Use this when you want to show a specific website to the user in a new window.
12704
12703
  ${!content ? '' : `Constraints / instructions: ${content}`}
@@ -12723,7 +12722,7 @@
12723
12722
  ...requirements._metadata,
12724
12723
  usePopup: content || true,
12725
12724
  },
12726
- }, spaceTrim$1.spaceTrim((block) => `
12725
+ }, spacetrim.spaceTrim((block) => `
12727
12726
  Tool:
12728
12727
  - You can open a popup window with a specific URL using the tool "open_popup".
12729
12728
  - Use this when you want the user to see or interact with a specific website.
@@ -12750,7 +12749,7 @@
12750
12749
  window.open(url, '_blank');
12751
12750
  return `Popup window with URL "${url}" was opened.`;
12752
12751
  }
12753
- return spaceTrim$1.spaceTrim(`
12752
+ return spacetrim.spaceTrim(`
12754
12753
  Popup window with URL "${url}" was requested.
12755
12754
 
12756
12755
  Note: The agent is currently running on the server, so the popup cannot be opened automatically.
@@ -12844,7 +12843,7 @@
12844
12843
  * Markdown documentation for USE PRIVACY commitment.
12845
12844
  */
12846
12845
  get documentation() {
12847
- return spaceTrim$1.spaceTrim(`
12846
+ return spacetrim.spaceTrim(`
12848
12847
  # USE PRIVACY
12849
12848
 
12850
12849
  Enables the agent to request turning on private mode in chat.
@@ -12884,7 +12883,7 @@
12884
12883
  ...existingTools,
12885
12884
  {
12886
12885
  name: TURN_PRIVACY_ON_TOOL_NAME,
12887
- description: spaceTrim$1.spaceTrim(`
12886
+ description: spacetrim.spaceTrim(`
12888
12887
  Requests turning private mode on in the chat UI.
12889
12888
  The user must explicitly confirm the action in a dialog before private mode is enabled.
12890
12889
  Use this for sensitive topics or when the user asks not to store conversation data.
@@ -12903,7 +12902,7 @@
12903
12902
  ...requirements._metadata,
12904
12903
  usePrivacy: content || true,
12905
12904
  },
12906
- }, spaceTrim$1.spaceTrim((block) => `
12905
+ }, spacetrim.spaceTrim((block) => `
12907
12906
  Privacy mode:
12908
12907
  - Use "${TURN_PRIVACY_ON_TOOL_NAME}" when the user asks for a private/sensitive conversation.
12909
12908
  - This tool requests a UI confirmation dialog. Private mode is enabled only after user confirms.
@@ -13493,7 +13492,7 @@
13493
13492
  return null;
13494
13493
  }
13495
13494
  if (!response.ok) {
13496
- throw new Error(spaceTrim$1.spaceTrim(`
13495
+ throw new Error(spacetrim.spaceTrim(`
13497
13496
  GitHub API request failed (${response.status} ${response.statusText}):
13498
13497
  ${extractGitHubApiErrorMessage(parsedPayload, textPayload)}
13499
13498
  `));
@@ -13624,7 +13623,7 @@
13624
13623
  * @private internal utility of USE PROJECT commitment
13625
13624
  */
13626
13625
  function parseUseProjectCommitmentContent(content) {
13627
- const trimmedContent = spaceTrim$1.spaceTrim(content);
13626
+ const trimmedContent = spacetrim.spaceTrim(content);
13628
13627
  if (!trimmedContent) {
13629
13628
  return {
13630
13629
  repository: null,
@@ -14525,7 +14524,7 @@
14525
14524
  * Markdown documentation for USE PROJECT commitment.
14526
14525
  */
14527
14526
  get documentation() {
14528
- return spaceTrim$1.spaceTrim(`
14527
+ return spacetrim.spaceTrim(`
14529
14528
  # USE PROJECT
14530
14529
 
14531
14530
  Enables the agent to work with files in a GitHub repository and create pull requests.
@@ -14565,7 +14564,7 @@
14565
14564
  useProject: true,
14566
14565
  useProjects: existingConfiguredProjects,
14567
14566
  },
14568
- }, spaceTrim$1.spaceTrim((block) => `
14567
+ }, spacetrim.spaceTrim((block) => `
14569
14568
  Project tools:
14570
14569
  - You can inspect and edit configured GitHub repositories using project tools.
14571
14570
  - Configured repositories:
@@ -14691,7 +14690,7 @@
14691
14690
  * Markdown documentation for USE SEARCH ENGINE commitment.
14692
14691
  */
14693
14692
  get documentation() {
14694
- return spaceTrim$1.spaceTrim(`
14693
+ return spacetrim.spaceTrim(`
14695
14694
  # USE SEARCH ENGINE
14696
14695
 
14697
14696
  Enables the agent to use a search engine tool to access and retrieve up-to-date information from the internet.
@@ -14733,7 +14732,7 @@
14733
14732
  ...existingTools,
14734
14733
  {
14735
14734
  name: 'web_search',
14736
- description: spaceTrim$1.spaceTrim(`
14735
+ description: spacetrim.spaceTrim(`
14737
14736
  Search the internet for information.
14738
14737
  Use this tool when you need to find up-to-date information or facts that you don't know.
14739
14738
  ${!content ? '' : `Search scope / instructions: ${content}`}
@@ -14782,7 +14781,7 @@
14782
14781
  ...requirements._metadata,
14783
14782
  useSearchEngine: content || true,
14784
14783
  },
14785
- }, spaceTrim$1.spaceTrim((block) => `
14784
+ }, spacetrim.spaceTrim((block) => `
14786
14785
  Tool:
14787
14786
  - You have access to the web search engine via the tool "web_search".
14788
14787
  - Use it to find up-to-date information or facts that you don't know.
@@ -14813,11 +14812,11 @@
14813
14812
  }
14814
14813
  const searchEngine = new SerpSearchEngine();
14815
14814
  const results = await searchEngine.search(query, options);
14816
- return spaceTrim$1.spaceTrim((block) => `
14815
+ return spacetrim.spaceTrim((block) => `
14817
14816
  Search results for "${query}"${Object.keys(options).length === 0 ? '' : ` with options ${JSON.stringify(options)}`}:
14818
14817
 
14819
14818
  ${block(results
14820
- .map((result) => spaceTrim$1.spaceTrim(`
14819
+ .map((result) => spacetrim.spaceTrim(`
14821
14820
  - **${result.title}**
14822
14821
  ${result.url}
14823
14822
  ${result.snippet}
@@ -14945,7 +14944,7 @@
14945
14944
  * Markdown documentation for USE SPAWN commitment.
14946
14945
  */
14947
14946
  get documentation() {
14948
- return spaceTrim$1.spaceTrim(`
14947
+ return spacetrim.spaceTrim(`
14949
14948
  # USE SPAWN
14950
14949
 
14951
14950
  Enables the agent to create a new persistent child agent using the \`spawn_agent\` tool.
@@ -14982,7 +14981,7 @@
14982
14981
  ...existingTools,
14983
14982
  {
14984
14983
  name: SPAWN_AGENT_TOOL_NAME,
14985
- description: spaceTrim$1.spaceTrim(`
14984
+ description: spacetrim.spaceTrim(`
14986
14985
  Creates one new persistent child agent in Agents Server.
14987
14986
  Use this when the user asks to create a new dedicated agent profile.
14988
14987
  The tool returns JSON with \`status\`, \`agentId\`, and created \`agent\` or \`error\`.
@@ -14997,7 +14996,7 @@
14997
14996
  ...requirements._metadata,
14998
14997
  useSpawn: content || true,
14999
14998
  },
15000
- }, spaceTrim$1.spaceTrim((block) => `
14999
+ }, spacetrim.spaceTrim((block) => `
15001
15000
  Spawning agents:
15002
15001
  - Use "${SPAWN_AGENT_TOOL_NAME}" only when user asks to create a persistent new agent.
15003
15002
  - Pass full agent source in \`source\`.
@@ -15037,7 +15036,7 @@
15037
15036
  * @private internal utility of USE TIMEOUT
15038
15037
  */
15039
15038
  function createTimeoutSystemMessage(extraInstructions) {
15040
- return spaceTrim$1.spaceTrim((block) => `
15039
+ return spacetrim.spaceTrim((block) => `
15041
15040
  Timeout scheduling:
15042
15041
  - Use "set_timeout" to wake this same chat thread in the future.
15043
15042
  - Use "list_timeouts" to review timeouts across all chats for the same user+agent scope.
@@ -15153,7 +15152,7 @@
15153
15152
  set(args) {
15154
15153
  const parsedMilliseconds = Number(args.milliseconds);
15155
15154
  if (!Number.isFinite(parsedMilliseconds) || parsedMilliseconds <= 0) {
15156
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim(`
15155
+ throw new PipelineExecutionError(spacetrim.spaceTrim(`
15157
15156
  Timeout \`milliseconds\` must be a positive number.
15158
15157
  `));
15159
15158
  }
@@ -15169,7 +15168,7 @@
15169
15168
  cancel(args) {
15170
15169
  const timeoutId = typeof args.timeoutId === 'string' ? args.timeoutId.trim() : '';
15171
15170
  if (!timeoutId) {
15172
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim(`
15171
+ throw new PipelineExecutionError(spacetrim.spaceTrim(`
15173
15172
  Timeout \`timeoutId\` is required.
15174
15173
  `));
15175
15174
  }
@@ -15180,18 +15179,18 @@
15180
15179
  */
15181
15180
  list(args) {
15182
15181
  if (args.includeFinished !== undefined && typeof args.includeFinished !== 'boolean') {
15183
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim(`
15182
+ throw new PipelineExecutionError(spacetrim.spaceTrim(`
15184
15183
  Timeout \`includeFinished\` must be a boolean when provided.
15185
15184
  `));
15186
15185
  }
15187
15186
  const parsedLimit = args.limit === undefined ? DEFAULT_LIST_TIMEOUTS_LIMIT : Math.floor(Number(args.limit));
15188
15187
  if (!Number.isFinite(parsedLimit) || parsedLimit <= 0) {
15189
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim(`
15188
+ throw new PipelineExecutionError(spacetrim.spaceTrim(`
15190
15189
  Timeout \`limit\` must be a positive number.
15191
15190
  `));
15192
15191
  }
15193
15192
  if (parsedLimit > MAX_LIST_TIMEOUTS_LIMIT) {
15194
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim(`
15193
+ throw new PipelineExecutionError(spacetrim.spaceTrim(`
15195
15194
  Timeout \`limit\` must be at most \`${MAX_LIST_TIMEOUTS_LIMIT}\`.
15196
15195
  `));
15197
15196
  }
@@ -15437,7 +15436,7 @@
15437
15436
  * Markdown documentation for `USE TIMEOUT`.
15438
15437
  */
15439
15438
  get documentation() {
15440
- return spaceTrim$1.spaceTrim(`
15439
+ return spacetrim.spaceTrim(`
15441
15440
  # USE TIMEOUT
15442
15441
 
15443
15442
  Enables timeout wake-ups and timeout management for the same user+agent scope.
@@ -15528,7 +15527,7 @@
15528
15527
  * Markdown documentation for USE TIME commitment.
15529
15528
  */
15530
15529
  get documentation() {
15531
- return spaceTrim$1.spaceTrim(`
15530
+ return spacetrim.spaceTrim(`
15532
15531
  # USE TIME
15533
15532
 
15534
15533
  Enables the agent to determine the current date and time.
@@ -15589,7 +15588,7 @@
15589
15588
  _metadata: {
15590
15589
  ...requirements._metadata,
15591
15590
  },
15592
- }, spaceTrim$1.spaceTrim((block) => `
15591
+ }, spacetrim.spaceTrim((block) => `
15593
15592
  Time and date context:
15594
15593
  - It is ${moment__default["default"]().format('MMMM YYYY')} now.
15595
15594
  - If you need more precise current time information, use the tool "get_current_time".
@@ -15757,7 +15756,7 @@
15757
15756
  * Markdown documentation for USE USER LOCATION commitment.
15758
15757
  */
15759
15758
  get documentation() {
15760
- return spaceTrim$1.spaceTrim(`
15759
+ return spacetrim.spaceTrim(`
15761
15760
  # USE USER LOCATION
15762
15761
 
15763
15762
  Enables the agent to retrieve the user's location from runtime context.
@@ -15795,7 +15794,7 @@
15795
15794
  ...existingTools,
15796
15795
  {
15797
15796
  name: GET_USER_LOCATION_TOOL_NAME,
15798
- description: spaceTrim$1.spaceTrim(`
15797
+ description: spacetrim.spaceTrim(`
15799
15798
  Retrieves user location shared by browser runtime (if permission is granted).
15800
15799
  Returns JSON status with coordinates and metadata when available.
15801
15800
  `),
@@ -15813,7 +15812,7 @@
15813
15812
  ...requirements._metadata,
15814
15813
  useUserLocation: content || true,
15815
15814
  },
15816
- }, spaceTrim$1.spaceTrim((block) => `
15815
+ }, spacetrim.spaceTrim((block) => `
15817
15816
  User location:
15818
15817
  - Use "${GET_USER_LOCATION_TOOL_NAME}" only when location is needed for a better answer.
15819
15818
  - If the tool returns "unavailable" or "permission-denied", ask user to share location or provide city manually.
@@ -15890,7 +15889,7 @@
15890
15889
  * Markdown documentation for `WRITING RULES`.
15891
15890
  */
15892
15891
  get documentation() {
15893
- return spaceTrim$1.spaceTrim(`
15892
+ return spacetrim.spaceTrim(`
15894
15893
  # ${this.type}
15895
15894
 
15896
15895
  Adds instructions that apply strictly to how the agent writes.
@@ -15968,7 +15967,7 @@
15968
15967
  * Markdown documentation for `WRITING SAMPLE`.
15969
15968
  */
15970
15969
  get documentation() {
15971
- return spaceTrim$1.spaceTrim(`
15970
+ return spacetrim.spaceTrim(`
15972
15971
  # ${this.type}
15973
15972
 
15974
15973
  Provides explicit 1:1 sample text that demonstrates how the agent should sound.
@@ -16040,7 +16039,7 @@
16040
16039
  * Markdown documentation available at runtime.
16041
16040
  */
16042
16041
  get documentation() {
16043
- return spaceTrim$1.spaceTrim(`
16042
+ return spacetrim.spaceTrim(`
16044
16043
  # ${this.type}
16045
16044
 
16046
16045
  This commitment is not yet fully implemented.
@@ -16281,13 +16280,13 @@
16281
16280
  * Trigger window.prompt dialog
16282
16281
  */
16283
16282
  async promptDialog(options) {
16284
- const answer = window.prompt(spaceTrim$1.spaceTrim((block) => `
16283
+ const answer = window.prompt(spacetrim.spaceTrim((block) => `
16285
16284
  ${block(options.promptTitle)}
16286
16285
 
16287
16286
  ${block(options.promptMessage)}
16288
16287
  `));
16289
16288
  if (this.options.isVerbose) {
16290
- console.info(spaceTrim$1.spaceTrim((block) => `
16289
+ console.info(spacetrim.spaceTrim((block) => `
16291
16290
  📖 ${block(options.promptTitle)}
16292
16291
  👤 ${block(answer || '🚫 User cancelled prompt')}
16293
16292
  `));
@@ -16593,7 +16592,7 @@
16593
16592
  */
16594
16593
  function stringifyPipelineJson(pipeline) {
16595
16594
  if (!isSerializableAsJson(pipeline)) {
16596
- throw new UnexpectedError(spaceTrim__default["default"](`
16595
+ throw new UnexpectedError(spacetrim.spaceTrim(`
16597
16596
  Cannot stringify the pipeline, because it is not serializable as JSON
16598
16597
 
16599
16598
  There can be multiple reasons:
@@ -16753,7 +16752,7 @@
16753
16752
  * @public exported from `@promptbook/core`
16754
16753
  */
16755
16754
  function normalizeAgentName(rawAgentName) {
16756
- return titleToName(spaceTrim__default["default"](rawAgentName));
16755
+ return titleToName(spacetrim.spaceTrim(rawAgentName));
16757
16756
  }
16758
16757
 
16759
16758
  /**
@@ -16874,7 +16873,7 @@
16874
16873
  const fullContent = currentCommitment.contentLines.join('\n');
16875
16874
  commitments.push({
16876
16875
  type: currentCommitment.type,
16877
- content: spaceTrim$1.spaceTrim(fullContent),
16876
+ content: spacetrim.spaceTrim(fullContent),
16878
16877
  originalLine: currentCommitment.originalStartLine,
16879
16878
  lineNumber: currentCommitment.startLineNumber,
16880
16879
  });
@@ -16902,7 +16901,7 @@
16902
16901
  const fullContent = currentCommitment.contentLines.join('\n');
16903
16902
  commitments.push({
16904
16903
  type: currentCommitment.type,
16905
- content: spaceTrim$1.spaceTrim(fullContent),
16904
+ content: spacetrim.spaceTrim(fullContent),
16906
16905
  originalLine: currentCommitment.originalStartLine,
16907
16906
  lineNumber: currentCommitment.startLineNumber,
16908
16907
  });
@@ -16928,7 +16927,7 @@
16928
16927
  const fullContent = currentCommitment.contentLines.join('\n');
16929
16928
  commitments.push({
16930
16929
  type: currentCommitment.type,
16931
- content: spaceTrim$1.spaceTrim(fullContent),
16930
+ content: spacetrim.spaceTrim(fullContent),
16932
16931
  originalLine: currentCommitment.originalStartLine,
16933
16932
  lineNumber: currentCommitment.startLineNumber,
16934
16933
  });
@@ -17161,7 +17160,7 @@
17161
17160
  continue;
17162
17161
  }
17163
17162
  if (commitment.type === 'FROM') {
17164
- const content = spaceTrim__default["default"](commitment.content).split(/\r?\n/)[0] || '';
17163
+ const content = spacetrim.spaceTrim(commitment.content).split(/\r?\n/)[0] || '';
17165
17164
  if (content === 'Adam' || content === '' /* <- Note: Adam is implicit */) {
17166
17165
  continue;
17167
17166
  }
@@ -17184,7 +17183,7 @@
17184
17183
  continue;
17185
17184
  }
17186
17185
  if (commitment.type === 'IMPORT') {
17187
- const content = spaceTrim__default["default"](commitment.content).split(/\r?\n/)[0] || '';
17186
+ const content = spacetrim.spaceTrim(commitment.content).split(/\r?\n/)[0] || '';
17188
17187
  let label = content;
17189
17188
  let iconName = 'ExternalLink'; // Import remote
17190
17189
  try {
@@ -17222,7 +17221,7 @@
17222
17221
  continue;
17223
17222
  }
17224
17223
  if (commitment.type === 'KNOWLEDGE') {
17225
- const content = spaceTrim__default["default"](commitment.content);
17224
+ const content = spacetrim.spaceTrim(commitment.content);
17226
17225
  const extractedUrls = extractUrlsFromText(content);
17227
17226
  let label = content;
17228
17227
  let iconName = 'Book';
@@ -17281,7 +17280,7 @@
17281
17280
  continue;
17282
17281
  }
17283
17282
  if (commitment.type === 'META LINK') {
17284
- const linkValue = spaceTrim__default["default"](commitment.content);
17283
+ const linkValue = spacetrim.spaceTrim(commitment.content);
17285
17284
  links.push(linkValue);
17286
17285
  meta.link = linkValue;
17287
17286
  continue;
@@ -17291,11 +17290,11 @@
17291
17290
  continue;
17292
17291
  }
17293
17292
  if (commitment.type === 'META IMAGE') {
17294
- meta.image = spaceTrim__default["default"](commitment.content);
17293
+ meta.image = spacetrim.spaceTrim(commitment.content);
17295
17294
  continue;
17296
17295
  }
17297
17296
  if (commitment.type === 'META DESCRIPTION') {
17298
- meta.description = spaceTrim__default["default"](commitment.content);
17297
+ meta.description = spacetrim.spaceTrim(commitment.content);
17299
17298
  continue;
17300
17299
  }
17301
17300
  if (commitment.type === 'META DISCLAIMER') {
@@ -17303,7 +17302,7 @@
17303
17302
  continue;
17304
17303
  }
17305
17304
  if (commitment.type === 'META INPUT PLACEHOLDER') {
17306
- meta.inputPlaceholder = spaceTrim__default["default"](commitment.content);
17305
+ meta.inputPlaceholder = spacetrim.spaceTrim(commitment.content);
17307
17306
  continue;
17308
17307
  }
17309
17308
  if (commitment.type === 'MESSAGE SUFFIX') {
@@ -17319,7 +17318,7 @@
17319
17318
  continue;
17320
17319
  }
17321
17320
  if (commitment.type === 'META VOICE') {
17322
- meta.voice = spaceTrim__default["default"](commitment.content);
17321
+ meta.voice = spacetrim.spaceTrim(commitment.content);
17323
17322
  continue;
17324
17323
  }
17325
17324
  if (commitment.type !== 'META') {
@@ -17328,10 +17327,10 @@
17328
17327
  // Parse META commitments - format is "META TYPE content"
17329
17328
  const metaTypeRaw = commitment.content.split(' ')[0] || 'NONE';
17330
17329
  if (metaTypeRaw === 'LINK') {
17331
- links.push(spaceTrim__default["default"](commitment.content.substring(metaTypeRaw.length)));
17330
+ links.push(spacetrim.spaceTrim(commitment.content.substring(metaTypeRaw.length)));
17332
17331
  }
17333
17332
  const metaType = normalizeTo_camelCase(metaTypeRaw);
17334
- meta[metaType] = spaceTrim__default["default"](commitment.content.substring(metaTypeRaw.length));
17333
+ meta[metaType] = spacetrim.spaceTrim(commitment.content.substring(metaTypeRaw.length));
17335
17334
  }
17336
17335
  // Generate fullname fallback if no meta fullname specified
17337
17336
  if (!meta.fullname) {
@@ -17362,7 +17361,7 @@
17362
17361
  * @returns The content with normalized separators
17363
17362
  */
17364
17363
  function normalizeSeparator(content) {
17365
- const trimmed = spaceTrim__default["default"](content);
17364
+ const trimmed = spacetrim.spaceTrim(content);
17366
17365
  if (trimmed.includes(',')) {
17367
17366
  return trimmed;
17368
17367
  }
@@ -17375,7 +17374,7 @@
17375
17374
  * @returns Normalized domain or a trimmed fallback.
17376
17375
  */
17377
17376
  function normalizeMetaDomain(content) {
17378
- const trimmed = spaceTrim__default["default"](content);
17377
+ const trimmed = spacetrim.spaceTrim(content);
17379
17378
  return normalizeDomainForMatching(trimmed) || trimmed.toLowerCase();
17380
17379
  }
17381
17380
  /**
@@ -17586,7 +17585,7 @@
17586
17585
  * @deprecated Use `$generateBookBoilerplate` instead
17587
17586
  * @public exported from `@promptbook/core`
17588
17587
  */
17589
- padBook(validateBook(spaceTrim__default["default"](`
17588
+ padBook(validateBook(spacetrim.spaceTrim(`
17590
17589
  AI Avatar
17591
17590
 
17592
17591
  PERSONA A friendly AI assistant that helps you with your tasks
@@ -17666,7 +17665,7 @@
17666
17665
  const bookString = prompt(strings, ...values).toString();
17667
17666
  if (!isValidPipelineString(bookString)) {
17668
17667
  // TODO: Make the CustomError for this
17669
- throw new Error(spaceTrim__default["default"](`
17668
+ throw new Error(spacetrim.spaceTrim(`
17670
17669
  The string is not a valid pipeline string
17671
17670
 
17672
17671
  book\`
@@ -17676,7 +17675,7 @@
17676
17675
  }
17677
17676
  if (!isValidBook(bookString)) {
17678
17677
  // TODO: Make the CustomError for this
17679
- throw new Error(spaceTrim__default["default"](`
17678
+ throw new Error(spacetrim.spaceTrim(`
17680
17679
  The string is not a valid book
17681
17680
 
17682
17681
  book\`
@@ -18043,14 +18042,14 @@
18043
18042
  if (description === undefined) {
18044
18043
  return headLine;
18045
18044
  }
18046
- return spaceTrim__default["default"]((block) => `
18045
+ return spacetrim.spaceTrim((block) => `
18047
18046
  ${headLine}
18048
18047
 
18049
18048
  ${ /* <- Note: Indenting the description: */block(description)}
18050
18049
  `);
18051
18050
  })
18052
18051
  .join('\n\n');
18053
- return spaceTrim__default["default"]((block) => `
18052
+ return spacetrim.spaceTrim((block) => `
18054
18053
  Multiple LLM Providers:
18055
18054
 
18056
18055
  ${block(innerModelsTitlesAndDescriptions)}
@@ -18152,7 +18151,7 @@
18152
18151
  // 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
18153
18152
  // 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
18154
18153
  // 3) ...
18155
- spaceTrim__default["default"]((block) => `
18154
+ spacetrim.spaceTrim((block) => `
18156
18155
  All execution tools of ${this.title} failed:
18157
18156
 
18158
18157
  ${block(errors
@@ -18165,7 +18164,7 @@
18165
18164
  throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
18166
18165
  }
18167
18166
  else {
18168
- throw new PipelineExecutionError(spaceTrim__default["default"]((block) => `
18167
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
18169
18168
  You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
18170
18169
 
18171
18170
  Available \`LlmExecutionTools\`:
@@ -18202,7 +18201,7 @@
18202
18201
  */
18203
18202
  function joinLlmExecutionTools(title, ...llmExecutionTools) {
18204
18203
  if (llmExecutionTools.length === 0) {
18205
- const warningMessage = spaceTrim__default["default"](`
18204
+ const warningMessage = spacetrim.spaceTrim(`
18206
18205
  You have not provided any \`LlmExecutionTools\`
18207
18206
  This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.
18208
18207
 
@@ -18381,7 +18380,7 @@
18381
18380
  pipelineString += '\n\n';
18382
18381
  pipelineString += '```' + contentLanguage;
18383
18382
  pipelineString += '\n';
18384
- pipelineString += spaceTrim__default["default"](content);
18383
+ pipelineString += spacetrim.spaceTrim(content);
18385
18384
  // <- TODO: [main] !!3 Escape
18386
18385
  // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
18387
18386
  pipelineString += '\n';
@@ -18439,7 +18438,7 @@
18439
18438
  if (!(error instanceof PipelineLogicError)) {
18440
18439
  throw error;
18441
18440
  }
18442
- console.error(spaceTrim$1.spaceTrim((block) => `
18441
+ console.error(spacetrim.spaceTrim((block) => `
18443
18442
  Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
18444
18443
 
18445
18444
  ${block(error.message)}
@@ -18466,7 +18465,7 @@
18466
18465
  })();
18467
18466
  if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
18468
18467
  // <- Note: [🚲]
18469
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
18468
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
18470
18469
  Invalid promptbook URL "${pipeline.pipelineUrl}"
18471
18470
 
18472
18471
  ${block(pipelineIdentification)}
@@ -18474,7 +18473,7 @@
18474
18473
  }
18475
18474
  if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
18476
18475
  // <- Note: [🚲]
18477
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
18476
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
18478
18477
  Invalid Promptbook Version "${pipeline.bookVersion}"
18479
18478
 
18480
18479
  ${block(pipelineIdentification)}
@@ -18483,7 +18482,7 @@
18483
18482
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
18484
18483
  if (!Array.isArray(pipeline.parameters)) {
18485
18484
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
18486
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
18485
+ throw new ParseError(spacetrim.spaceTrim((block) => `
18487
18486
  Pipeline is valid JSON but with wrong structure
18488
18487
 
18489
18488
  \`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
@@ -18494,7 +18493,7 @@
18494
18493
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
18495
18494
  if (!Array.isArray(pipeline.tasks)) {
18496
18495
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
18497
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
18496
+ throw new ParseError(spacetrim.spaceTrim((block) => `
18498
18497
  Pipeline is valid JSON but with wrong structure
18499
18498
 
18500
18499
  \`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
@@ -18520,7 +18519,7 @@
18520
18519
  // Note: Check each parameter individually
18521
18520
  for (const parameter of pipeline.parameters) {
18522
18521
  if (parameter.isInput && parameter.isOutput) {
18523
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
18522
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
18524
18523
 
18525
18524
  Parameter \`{${parameter.name}}\` can not be both input and output
18526
18525
 
@@ -18531,7 +18530,7 @@
18531
18530
  if (!parameter.isInput &&
18532
18531
  !parameter.isOutput &&
18533
18532
  !pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
18534
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
18533
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
18535
18534
  Parameter \`{${parameter.name}}\` is created but not used
18536
18535
 
18537
18536
  You can declare {${parameter.name}} as output parameter by adding in the header:
@@ -18543,7 +18542,7 @@
18543
18542
  }
18544
18543
  // Note: Testing that parameter is either input or result of some task
18545
18544
  if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
18546
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
18545
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
18547
18546
  Parameter \`{${parameter.name}}\` is declared but not defined
18548
18547
 
18549
18548
  You can do one of these:
@@ -18559,14 +18558,14 @@
18559
18558
  // Note: Checking each task individually
18560
18559
  for (const task of pipeline.tasks) {
18561
18560
  if (definedParameters.has(task.resultingParameterName)) {
18562
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
18561
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
18563
18562
  Parameter \`{${task.resultingParameterName}}\` is defined multiple times
18564
18563
 
18565
18564
  ${block(pipelineIdentification)}
18566
18565
  `));
18567
18566
  }
18568
18567
  if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
18569
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
18568
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
18570
18569
  Parameter name {${task.resultingParameterName}} is reserved, please use different name
18571
18570
 
18572
18571
  ${block(pipelineIdentification)}
@@ -18576,7 +18575,7 @@
18576
18575
  if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
18577
18576
  if (!task.format &&
18578
18577
  !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
18579
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
18578
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
18580
18579
  Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
18581
18580
 
18582
18581
  ${block(pipelineIdentification)}
@@ -18584,7 +18583,7 @@
18584
18583
  }
18585
18584
  for (const joker of task.jokerParameterNames) {
18586
18585
  if (!task.dependentParameterNames.includes(joker)) {
18587
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
18586
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
18588
18587
  Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
18589
18588
 
18590
18589
  ${block(pipelineIdentification)}
@@ -18595,21 +18594,21 @@
18595
18594
  if (task.expectations) {
18596
18595
  for (const [unit, { min, max }] of Object.entries(task.expectations)) {
18597
18596
  if (min !== undefined && max !== undefined && min > max) {
18598
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
18597
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
18599
18598
  Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
18600
18599
 
18601
18600
  ${block(pipelineIdentification)}
18602
18601
  `));
18603
18602
  }
18604
18603
  if (min !== undefined && min < 0) {
18605
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
18604
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
18606
18605
  Min expectation of ${unit} must be zero or positive
18607
18606
 
18608
18607
  ${block(pipelineIdentification)}
18609
18608
  `));
18610
18609
  }
18611
18610
  if (max !== undefined && max <= 0) {
18612
- throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
18611
+ throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
18613
18612
  Max expectation of ${unit} must be positive
18614
18613
 
18615
18614
  ${block(pipelineIdentification)}
@@ -18631,7 +18630,7 @@
18631
18630
  while (unresovedTasks.length > 0) {
18632
18631
  if (loopLimit-- < 0) {
18633
18632
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
18634
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
18633
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
18635
18634
  Loop limit reached during detection of circular dependencies in \`validatePipeline\`
18636
18635
 
18637
18636
  ${block(pipelineIdentification)}
@@ -18641,7 +18640,7 @@
18641
18640
  if (currentlyResovedTasks.length === 0) {
18642
18641
  throw new PipelineLogicError(
18643
18642
  // TODO: [🐎] DRY
18644
- spaceTrim$1.spaceTrim((block) => `
18643
+ spacetrim.spaceTrim((block) => `
18645
18644
 
18646
18645
  Can not resolve some parameters:
18647
18646
  Either you are using a parameter that is not defined, or there are some circular dependencies.
@@ -18762,7 +18761,7 @@
18762
18761
  for (const pipeline of pipelines) {
18763
18762
  // TODO: [👠] DRY
18764
18763
  if (pipeline.pipelineUrl === undefined) {
18765
- throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
18764
+ throw new PipelineUrlError(spacetrim.spaceTrim(`
18766
18765
  Pipeline with name "${pipeline.title}" does not have defined URL
18767
18766
 
18768
18767
  File:
@@ -18784,7 +18783,7 @@
18784
18783
  pipelineJsonToString(unpreparePipeline(pipeline)) !==
18785
18784
  pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
18786
18785
  const existing = this.collection.get(pipeline.pipelineUrl);
18787
- throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
18786
+ throw new PipelineUrlError(spacetrim.spaceTrim(`
18788
18787
  Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
18789
18788
 
18790
18789
  Conflicting files:
@@ -18816,13 +18815,13 @@
18816
18815
  const pipeline = this.collection.get(url);
18817
18816
  if (!pipeline) {
18818
18817
  if (this.listPipelines().length === 0) {
18819
- throw new NotFoundError(spaceTrim$1.spaceTrim(`
18818
+ throw new NotFoundError(spacetrim.spaceTrim(`
18820
18819
  Pipeline with url "${url}" not found
18821
18820
 
18822
18821
  No pipelines available
18823
18822
  `));
18824
18823
  }
18825
- throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
18824
+ throw new NotFoundError(spacetrim.spaceTrim((block) => `
18826
18825
  Pipeline with url "${url}" not found
18827
18826
 
18828
18827
  Available pipelines:
@@ -18921,11 +18920,11 @@
18921
18920
  throw deserializeError(errors[0]);
18922
18921
  }
18923
18922
  else {
18924
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
18923
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
18925
18924
  Multiple errors occurred during Promptbook execution
18926
18925
 
18927
18926
  ${block(errors
18928
- .map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
18927
+ .map(({ name, stack, message }, index) => spacetrim.spaceTrim((block) => `
18929
18928
  ${name} ${index + 1}:
18930
18929
  ${block(stack || message)}
18931
18930
  `))
@@ -19407,14 +19406,14 @@
19407
19406
  return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
19408
19407
  });
19409
19408
  if (metadata.length === 0) {
19410
- return spaceTrim__default["default"](`
19409
+ return spacetrim.spaceTrim(`
19411
19410
  **No scrapers are available**
19412
19411
 
19413
19412
  This is a unexpected behavior, you are probably using some broken version of Promptbook
19414
19413
  At least there should be available the metadata of the scrapers
19415
19414
  `);
19416
19415
  }
19417
- return spaceTrim__default["default"]((block) => `
19416
+ return spacetrim.spaceTrim((block) => `
19418
19417
  Available scrapers are:
19419
19418
  ${block(metadata
19420
19419
  .map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
@@ -19541,7 +19540,7 @@
19541
19540
  else if (urlOrRequest instanceof Request) {
19542
19541
  url = urlOrRequest.url;
19543
19542
  }
19544
- throw new PromptbookFetchError(spaceTrim__default["default"]((block) => `
19543
+ throw new PromptbookFetchError(spacetrim.spaceTrim((block) => `
19545
19544
  Can not fetch "${url}"
19546
19545
 
19547
19546
  Fetch error:
@@ -19701,7 +19700,7 @@
19701
19700
  const fileExtension = getFileExtension(filename);
19702
19701
  const mimeType = extensionToMimeType(fileExtension || '');
19703
19702
  if (!(await isFileExisting(filename, tools.fs))) {
19704
- throw new NotFoundError(spaceTrim__default["default"]((block) => `
19703
+ throw new NotFoundError(spacetrim.spaceTrim((block) => `
19705
19704
  Can not make source handler for file which does not exist:
19706
19705
 
19707
19706
  File:
@@ -19794,7 +19793,7 @@
19794
19793
  // <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
19795
19794
  break;
19796
19795
  }
19797
- console.warn(spaceTrim__default["default"]((block) => `
19796
+ console.warn(spacetrim.spaceTrim((block) => `
19798
19797
  Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
19799
19798
 
19800
19799
  The source:
@@ -19810,7 +19809,7 @@
19810
19809
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
19811
19810
  }
19812
19811
  if (partialPieces === null) {
19813
- throw new KnowledgeScrapeError(spaceTrim__default["default"]((block) => `
19812
+ throw new KnowledgeScrapeError(spacetrim.spaceTrim((block) => `
19814
19813
  Cannot scrape knowledge
19815
19814
 
19816
19815
  The source:
@@ -19889,7 +19888,7 @@
19889
19888
  if (task.taskType === 'PROMPT_TASK' &&
19890
19889
  knowledgePiecesCount > 0 &&
19891
19890
  !dependentParameterNames.includes('knowledge')) {
19892
- preparedContent = spaceTrim$1.spaceTrim(`
19891
+ preparedContent = spacetrim.spaceTrim(`
19893
19892
  {content}
19894
19893
 
19895
19894
  ## Knowledge
@@ -20121,7 +20120,7 @@
20121
20120
  }
20122
20121
  catch (error) {
20123
20122
  assertsError(error);
20124
- throw new ParseError(spaceTrim$1.spaceTrim((block) => `
20123
+ throw new ParseError(spacetrim.spaceTrim((block) => `
20125
20124
  Can not extract variables from the script
20126
20125
  ${block(error.stack || error.message)}
20127
20126
 
@@ -20247,7 +20246,7 @@
20247
20246
  const { value, outputParameterName, settings, mapCallback, onProgress } = options;
20248
20247
  const csv = csvParse(value, settings);
20249
20248
  if (csv.errors.length !== 0) {
20250
- throw new CsvFormatError(spaceTrim__default["default"]((block) => `
20249
+ throw new CsvFormatError(spacetrim.spaceTrim((block) => `
20251
20250
  CSV parsing error
20252
20251
 
20253
20252
  Error(s) from CSV parsing:
@@ -20292,7 +20291,7 @@
20292
20291
  const { value, settings, mapCallback, onProgress } = options;
20293
20292
  const csv = csvParse(value, settings);
20294
20293
  if (csv.errors.length !== 0) {
20295
- throw new CsvFormatError(spaceTrim__default["default"]((block) => `
20294
+ throw new CsvFormatError(spacetrim.spaceTrim((block) => `
20296
20295
  CSV parsing error
20297
20296
 
20298
20297
  Error(s) from CSV parsing:
@@ -20478,7 +20477,7 @@
20478
20477
  }
20479
20478
  // Phase 2️⃣: Non-matching mapping
20480
20479
  if (expectedParameterNames.size !== availableParametersNames.size) {
20481
- throw new PipelineExecutionError(spaceTrim__default["default"]((block) => `
20480
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
20482
20481
  Can not map available parameters to expected parameters
20483
20482
 
20484
20483
  Mapped parameters:
@@ -20664,7 +20663,7 @@
20664
20663
  }
20665
20664
  catch (error) {
20666
20665
  keepUnused(error);
20667
- throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
20666
+ throw new ExpectError(spacetrim.spaceTrim((block) => `
20668
20667
  Expected valid JSON string
20669
20668
 
20670
20669
  The expected JSON text:
@@ -20727,7 +20726,7 @@
20727
20726
  const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
20728
20727
  // TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
20729
20728
  if (isJokerAttempt && !jokerParameterName) {
20730
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
20729
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
20731
20730
  Joker not found in attempt ${attemptIndex}
20732
20731
 
20733
20732
  ${block(pipelineIdentification)}
@@ -20738,7 +20737,7 @@
20738
20737
  $ongoingTaskResult.$expectError = null;
20739
20738
  if (isJokerAttempt) {
20740
20739
  if (parameters[jokerParameterName] === undefined) {
20741
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
20740
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
20742
20741
  Joker parameter {${jokerParameterName}} not defined
20743
20742
 
20744
20743
  ${block(pipelineIdentification)}
@@ -20797,7 +20796,7 @@
20797
20796
  break variant;
20798
20797
  case 'EMBEDDING':
20799
20798
  case 'IMAGE_GENERATION':
20800
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
20799
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
20801
20800
  ${modelRequirements.modelVariant} model can not be used in pipeline
20802
20801
 
20803
20802
  This should be catched during parsing
@@ -20808,7 +20807,7 @@
20808
20807
  break variant;
20809
20808
  // <- case [🤖]:
20810
20809
  default:
20811
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
20810
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
20812
20811
  Unknown model variant "${task.modelRequirements.modelVariant}"
20813
20812
 
20814
20813
  ${block(pipelineIdentification)}
@@ -20819,14 +20818,14 @@
20819
20818
  break;
20820
20819
  case 'SCRIPT_TASK':
20821
20820
  if (arrayableToArray(tools.script).length === 0) {
20822
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
20821
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
20823
20822
  No script execution tools are available
20824
20823
 
20825
20824
  ${block(pipelineIdentification)}
20826
20825
  `));
20827
20826
  }
20828
20827
  if (!task.contentLanguage) {
20829
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
20828
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
20830
20829
  Script language is not defined for SCRIPT TASK "${task.name}"
20831
20830
 
20832
20831
  ${block(pipelineIdentification)}
@@ -20857,7 +20856,7 @@
20857
20856
  throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
20858
20857
  }
20859
20858
  else {
20860
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
20859
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
20861
20860
  Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
20862
20861
 
20863
20862
  ${block(pipelineIdentification)}
@@ -20871,7 +20870,7 @@
20871
20870
  break taskType;
20872
20871
  case 'DIALOG_TASK':
20873
20872
  if (tools.userInterface === undefined) {
20874
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
20873
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
20875
20874
  User interface tools are not available
20876
20875
 
20877
20876
  ${block(pipelineIdentification)}
@@ -20889,7 +20888,7 @@
20889
20888
  break taskType;
20890
20889
  // <- case: [🅱]
20891
20890
  default:
20892
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
20891
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
20893
20892
  Unknown execution type "${task.taskType}"
20894
20893
 
20895
20894
  ${block(pipelineIdentification)}
@@ -20987,7 +20986,7 @@
20987
20986
  if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
20988
20987
  // Note: Create a summary of all failures
20989
20988
  const failuresSummary = $ongoingTaskResult.$failedResults
20990
- .map((failure) => spaceTrim$1.spaceTrim((block) => {
20989
+ .map((failure) => spacetrim.spaceTrim((block) => {
20991
20990
  var _a, _b;
20992
20991
  return `
20993
20992
  Attempt ${failure.attemptIndex + 1}:
@@ -20997,14 +20996,14 @@
20997
20996
  Result:
20998
20997
  ${block(failure.result === null
20999
20998
  ? 'null'
21000
- : spaceTrim$1.spaceTrim(failure.result)
20999
+ : spacetrim.spaceTrim(failure.result)
21001
21000
  .split(/\r?\n/)
21002
21001
  .map((line) => `> ${line}`)
21003
21002
  .join('\n'))}
21004
21003
  `;
21005
21004
  }))
21006
21005
  .join('\n\n---\n\n');
21007
- throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
21006
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => {
21008
21007
  var _a;
21009
21008
  return `
21010
21009
  LLM execution failed ${maxExecutionAttempts}x
@@ -21024,7 +21023,7 @@
21024
21023
  }
21025
21024
  }
21026
21025
  if ($ongoingTaskResult.$resultString === null) {
21027
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
21026
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
21028
21027
  Something went wrong and prompt result is null
21029
21028
 
21030
21029
  ${block(pipelineIdentification)}
@@ -21051,7 +21050,7 @@
21051
21050
  return /* not await */ executeAttempts({ ...options, logLlmCall });
21052
21051
  }
21053
21052
  if (jokerParameterNames.length !== 0) {
21054
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
21053
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
21055
21054
  JOKER parameters are not supported together with FOREACH command
21056
21055
 
21057
21056
  [🧞‍♀️] This should be prevented in \`validatePipeline\`
@@ -21064,7 +21063,7 @@
21064
21063
  if (formatDefinition === undefined) {
21065
21064
  throw new UnexpectedError(
21066
21065
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
21067
- spaceTrim__default["default"]((block) => `
21066
+ spacetrim.spaceTrim((block) => `
21068
21067
  Unsupported format "${task.foreach.formatName}"
21069
21068
 
21070
21069
  Available formats:
@@ -21081,7 +21080,7 @@
21081
21080
  if (subvalueParser === undefined) {
21082
21081
  throw new UnexpectedError(
21083
21082
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
21084
- spaceTrim__default["default"]((block) => `
21083
+ spacetrim.spaceTrim((block) => `
21085
21084
  Unsupported subformat name "${task.foreach.subformatName}" for format "${task.foreach.formatName}"
21086
21085
 
21087
21086
  Available subformat names for format "${formatDefinition.formatName}":
@@ -21121,7 +21120,7 @@
21121
21120
  if (!(error instanceof PipelineExecutionError)) {
21122
21121
  throw error;
21123
21122
  }
21124
- const highLevelError = new PipelineExecutionError(spaceTrim__default["default"]((block) => `
21123
+ const highLevelError = new PipelineExecutionError(spacetrim.spaceTrim((block) => `
21125
21124
  ${error.message}
21126
21125
 
21127
21126
  This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -21145,7 +21144,7 @@
21145
21144
  ...options,
21146
21145
  priority: priority + index,
21147
21146
  parameters: allSubparameters,
21148
- pipelineIdentification: spaceTrim__default["default"]((block) => `
21147
+ pipelineIdentification: spacetrim.spaceTrim((block) => `
21149
21148
  ${block(pipelineIdentification)}
21150
21149
  Subparameter index: ${index}
21151
21150
  `),
@@ -21154,7 +21153,7 @@
21154
21153
  }
21155
21154
  catch (error) {
21156
21155
  if (length > BIG_DATASET_TRESHOLD) {
21157
- console.error(spaceTrim__default["default"]((block) => `
21156
+ console.error(spacetrim.spaceTrim((block) => `
21158
21157
  ${error.message}
21159
21158
 
21160
21159
  This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -21330,7 +21329,7 @@
21330
21329
  // Note: Doublecheck that ALL reserved parameters are defined:
21331
21330
  for (const parameterName of RESERVED_PARAMETER_NAMES) {
21332
21331
  if (reservedParameters[parameterName] === undefined) {
21333
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
21332
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
21334
21333
  Reserved parameter {${parameterName}} is not defined
21335
21334
 
21336
21335
  ${block(pipelineIdentification)}
@@ -21356,7 +21355,7 @@
21356
21355
  const dependentParameterNames = new Set(currentTask.dependentParameterNames);
21357
21356
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
21358
21357
  if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
21359
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
21358
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
21360
21359
  Dependent parameters are not consistent with used parameters:
21361
21360
 
21362
21361
  Dependent parameters:
@@ -21400,7 +21399,7 @@
21400
21399
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
21401
21400
  // Houston, we have a problem
21402
21401
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
21403
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
21402
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
21404
21403
  Parameter \`{${parameterName}}\` is NOT defined
21405
21404
  BUT used in task "${currentTask.title || currentTask.name}"
21406
21405
 
@@ -21469,7 +21468,7 @@
21469
21468
  for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
21470
21469
  if (parametersToPass[parameter.name] === undefined) {
21471
21470
  // [4]
21472
- $warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
21471
+ $warnings.push(new PipelineExecutionError(spacetrim.spaceTrim((block) => `
21473
21472
  Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
21474
21473
 
21475
21474
  Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
@@ -21577,7 +21576,7 @@
21577
21576
  for (const parameterName of Object.keys(inputParameters)) {
21578
21577
  const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
21579
21578
  if (parameter === undefined) {
21580
- warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
21579
+ warnings.push(new PipelineExecutionError(spacetrim.spaceTrim((block) => `
21581
21580
  Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
21582
21581
 
21583
21582
  ${block(pipelineIdentification)}
@@ -21592,7 +21591,7 @@
21592
21591
  // TODO: [🧠] This should be also non-critical error
21593
21592
  return exportJson({
21594
21593
  name: 'pipelineExecutorResult',
21595
- message: spaceTrim$1.spaceTrim((block) => `
21594
+ message: spacetrim.spaceTrim((block) => `
21596
21595
  Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
21597
21596
 
21598
21597
  ${block(pipelineIdentification)}
@@ -21601,7 +21600,7 @@
21601
21600
  value: {
21602
21601
  isSuccessful: false,
21603
21602
  errors: [
21604
- new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
21603
+ new PipelineExecutionError(spacetrim.spaceTrim((block) => `
21605
21604
  Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
21606
21605
 
21607
21606
  ${block(pipelineIdentification)}
@@ -21628,7 +21627,7 @@
21628
21627
  while (unresovedTasks.length > 0) {
21629
21628
  if (loopLimit-- < 0) {
21630
21629
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
21631
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
21630
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
21632
21631
  Loop limit reached during resolving parameters pipeline execution
21633
21632
 
21634
21633
  ${block(pipelineIdentification)}
@@ -21638,7 +21637,7 @@
21638
21637
  if (!currentTask && resolving.length === 0) {
21639
21638
  throw new UnexpectedError(
21640
21639
  // TODO: [🐎] DRY
21641
- spaceTrim$1.spaceTrim((block) => `
21640
+ spacetrim.spaceTrim((block) => `
21642
21641
  Can not resolve some parameters:
21643
21642
 
21644
21643
  ${block(pipelineIdentification)}
@@ -21678,7 +21677,7 @@
21678
21677
  tools,
21679
21678
  onProgress(newOngoingResult) {
21680
21679
  if (isReturned) {
21681
- throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
21680
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
21682
21681
  Can not call \`onProgress\` after pipeline execution is finished
21683
21682
 
21684
21683
  ${block(pipelineIdentification)}
@@ -21695,7 +21694,7 @@
21695
21694
  },
21696
21695
  logLlmCall,
21697
21696
  $executionReport: executionReport,
21698
- pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
21697
+ pipelineIdentification: spacetrim.spaceTrim((block) => `
21699
21698
  ${block(pipelineIdentification)}
21700
21699
  Task name: ${currentTask.name}
21701
21700
  Task title: ${currentTask.title}
@@ -21804,7 +21803,7 @@
21804
21803
  preparedPipeline = pipeline;
21805
21804
  }
21806
21805
  else if (isNotPreparedWarningSuppressed !== true) {
21807
- console.warn(spaceTrim$1.spaceTrim((block) => `
21806
+ console.warn(spacetrim.spaceTrim((block) => `
21808
21807
  Pipeline is not prepared
21809
21808
 
21810
21809
  ${block(pipelineIdentification)}
@@ -21829,7 +21828,7 @@
21829
21828
  tools,
21830
21829
  onProgress,
21831
21830
  logLlmCall,
21832
- pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
21831
+ pipelineIdentification: spacetrim.spaceTrim((block) => `
21833
21832
  ${block(pipelineIdentification)}
21834
21833
  ${runCount === 1 ? '' : `Run #${runCount}`}
21835
21834
  `),
@@ -22074,7 +22073,7 @@
22074
22073
  .filter((c) => ['PERSONA', 'RULE', 'KNOWLEDGE'].includes(c.type))
22075
22074
  .map((c) => `${c.type} ${c.content}`)
22076
22075
  .join('\n\n');
22077
- return spaceTrim$1.spaceTrim((block) => `
22076
+ return spacetrim.spaceTrim((block) => `
22078
22077
  ${block(relevantCommitments)}
22079
22078
 
22080
22079
  ${block(corpus)}
@@ -23201,7 +23200,7 @@
23201
23200
  /**
23202
23201
  * List of available OpenAI models with pricing
23203
23202
  *
23204
- * Note: Synced with official API docs at 2025-11-19
23203
+ * Note: Synced with official API docs at 2026-03-22
23205
23204
  *
23206
23205
  * @see https://platform.openai.com/docs/models/
23207
23206
  * @see https://openai.com/api/pricing/
@@ -23323,8 +23322,8 @@
23323
23322
  modelName: 'gpt-4.1',
23324
23323
  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.',
23325
23324
  pricing: {
23326
- prompt: pricing(`$3.00 / 1M tokens`),
23327
- output: pricing(`$12.00 / 1M tokens`),
23325
+ prompt: pricing(`$2.00 / 1M tokens`),
23326
+ output: pricing(`$8.00 / 1M tokens`),
23328
23327
  },
23329
23328
  },
23330
23329
  /**/
@@ -23335,8 +23334,8 @@
23335
23334
  modelName: 'gpt-4.1-mini',
23336
23335
  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.',
23337
23336
  pricing: {
23338
- prompt: pricing(`$0.80 / 1M tokens`),
23339
- output: pricing(`$3.20 / 1M tokens`),
23337
+ prompt: pricing(`$0.40 / 1M tokens`),
23338
+ output: pricing(`$1.60 / 1M tokens`),
23340
23339
  },
23341
23340
  },
23342
23341
  /**/
@@ -23347,8 +23346,8 @@
23347
23346
  modelName: 'gpt-4.1-nano',
23348
23347
  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.',
23349
23348
  pricing: {
23350
- prompt: pricing(`$0.20 / 1M tokens`),
23351
- output: pricing(`$0.80 / 1M tokens`),
23349
+ prompt: pricing(`$0.10 / 1M tokens`),
23350
+ output: pricing(`$0.40 / 1M tokens`),
23352
23351
  },
23353
23352
  },
23354
23353
  /**/
@@ -23359,8 +23358,8 @@
23359
23358
  modelName: 'o3',
23360
23359
  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.',
23361
23360
  pricing: {
23362
- prompt: pricing(`$15.00 / 1M tokens`),
23363
- output: pricing(`$60.00 / 1M tokens`),
23361
+ prompt: pricing(`$2.00 / 1M tokens`),
23362
+ output: pricing(`$8.00 / 1M tokens`),
23364
23363
  },
23365
23364
  },
23366
23365
  /**/
@@ -23371,8 +23370,8 @@
23371
23370
  modelName: 'o3-pro',
23372
23371
  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.',
23373
23372
  pricing: {
23374
- prompt: pricing(`$30.00 / 1M tokens`),
23375
- output: pricing(`$120.00 / 1M tokens`),
23373
+ prompt: pricing(`$20.00 / 1M tokens`),
23374
+ output: pricing(`$80.00 / 1M tokens`),
23376
23375
  },
23377
23376
  },
23378
23377
  /**/
@@ -23383,8 +23382,8 @@
23383
23382
  modelName: 'o4-mini',
23384
23383
  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.',
23385
23384
  pricing: {
23386
- prompt: pricing(`$4.00 / 1M tokens`),
23387
- output: pricing(`$16.00 / 1M tokens`),
23385
+ prompt: pricing(`$1.10 / 1M tokens`),
23386
+ output: pricing(`$4.40 / 1M tokens`),
23388
23387
  },
23389
23388
  },
23390
23389
  /**/
@@ -23742,8 +23741,8 @@
23742
23741
  modelName: 'gpt-4o-2024-05-13',
23743
23742
  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.',
23744
23743
  pricing: {
23745
- prompt: pricing(`$5.00 / 1M tokens`),
23746
- output: pricing(`$15.00 / 1M tokens`),
23744
+ prompt: pricing(`$2.50 / 1M tokens`),
23745
+ output: pricing(`$10.00 / 1M tokens`),
23747
23746
  },
23748
23747
  },
23749
23748
  /**/
@@ -23754,8 +23753,8 @@
23754
23753
  modelName: 'gpt-4o',
23755
23754
  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.",
23756
23755
  pricing: {
23757
- prompt: pricing(`$5.00 / 1M tokens`),
23758
- output: pricing(`$15.00 / 1M tokens`),
23756
+ prompt: pricing(`$2.50 / 1M tokens`),
23757
+ output: pricing(`$10.00 / 1M tokens`),
23759
23758
  },
23760
23759
  },
23761
23760
  /**/
@@ -23826,8 +23825,8 @@
23826
23825
  modelName: 'o3-mini',
23827
23826
  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.',
23828
23827
  pricing: {
23829
- prompt: pricing(`$3.00 / 1M tokens`),
23830
- output: pricing(`$12.00 / 1M tokens`),
23828
+ prompt: pricing(`$1.10 / 1M tokens`),
23829
+ output: pricing(`$4.40 / 1M tokens`),
23831
23830
  },
23832
23831
  },
23833
23832
  /**/
@@ -23927,53 +23926,6 @@
23927
23926
  * TODO: [🤝] DRY Maybe some common abstraction between `computeOpenAiUsage` and `computeAnthropicClaudeUsage`
23928
23927
  */
23929
23928
 
23930
- /**
23931
- * Maps Promptbook tools to OpenAI tools.
23932
- *
23933
- * @private
23934
- */
23935
- function mapToolsToOpenAi(tools) {
23936
- return tools.map((tool) => ({
23937
- type: 'function',
23938
- function: {
23939
- name: tool.name,
23940
- description: tool.description,
23941
- parameters: tool.parameters,
23942
- },
23943
- }));
23944
- }
23945
-
23946
- /**
23947
- * Builds a tool invocation script that injects hidden runtime context into tool args.
23948
- *
23949
- * @private utility of OpenAI tool execution wrappers
23950
- */
23951
- function buildToolInvocationScript(options) {
23952
- const { functionName, functionArgsExpression } = options;
23953
- return `
23954
- const args = ${functionArgsExpression};
23955
- const runtimeContextRaw =
23956
- typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
23957
- ? undefined
23958
- : ${TOOL_RUNTIME_CONTEXT_PARAMETER};
23959
-
23960
- if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
23961
- args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
23962
- }
23963
-
23964
- const toolProgressTokenRaw =
23965
- typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
23966
- ? undefined
23967
- : ${TOOL_PROGRESS_TOKEN_PARAMETER};
23968
-
23969
- if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
23970
- args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
23971
- }
23972
-
23973
- return await ${functionName}(args);
23974
- `;
23975
- }
23976
-
23977
23929
  /**
23978
23930
  * Parses an OpenAI error message to identify which parameter is unsupported
23979
23931
  *
@@ -24030,6 +23982,53 @@
24030
23982
  errorMessage.includes('does not support'));
24031
23983
  }
24032
23984
 
23985
+ /**
23986
+ * Builds a tool invocation script that injects hidden runtime context into tool args.
23987
+ *
23988
+ * @private utility of OpenAI tool execution wrappers
23989
+ */
23990
+ function buildToolInvocationScript(options) {
23991
+ const { functionName, functionArgsExpression } = options;
23992
+ return `
23993
+ const args = ${functionArgsExpression};
23994
+ const runtimeContextRaw =
23995
+ typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
23996
+ ? undefined
23997
+ : ${TOOL_RUNTIME_CONTEXT_PARAMETER};
23998
+
23999
+ if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
24000
+ args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
24001
+ }
24002
+
24003
+ const toolProgressTokenRaw =
24004
+ typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
24005
+ ? undefined
24006
+ : ${TOOL_PROGRESS_TOKEN_PARAMETER};
24007
+
24008
+ if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
24009
+ args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
24010
+ }
24011
+
24012
+ return await ${functionName}(args);
24013
+ `;
24014
+ }
24015
+
24016
+ /**
24017
+ * Maps Promptbook tools to OpenAI tools.
24018
+ *
24019
+ * @private
24020
+ */
24021
+ function mapToolsToOpenAi(tools) {
24022
+ return tools.map((tool) => ({
24023
+ type: 'function',
24024
+ function: {
24025
+ name: tool.name,
24026
+ description: tool.description,
24027
+ parameters: tool.parameters,
24028
+ },
24029
+ }));
24030
+ }
24031
+
24033
24032
  /**
24034
24033
  * Provides access to the structured clone implementation when available.
24035
24034
  */
@@ -24996,7 +24995,7 @@
24996
24995
  // Note: Match exact or prefix for model families
24997
24996
  const model = this.HARDCODED_MODELS.find(({ modelName }) => modelName === defaultModelName || modelName.startsWith(defaultModelName));
24998
24997
  if (model === undefined) {
24999
- throw new PipelineExecutionError(spaceTrim__default["default"]((block) => `
24998
+ throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
25000
24999
  Cannot find model in ${this.title} models with name "${defaultModelName}" which should be used as default.
25001
25000
 
25002
25001
  Available models:
@@ -25922,7 +25921,7 @@
25922
25921
  }
25923
25922
  }
25924
25923
 
25925
- const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5-mini-2025-08-07';
25924
+ const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-nano';
25926
25925
  /**
25927
25926
  * Creates one structured log entry for streamed tool-call updates.
25928
25927
  *
@@ -26417,7 +26416,7 @@
26417
26416
  }),
26418
26417
  ],
26419
26418
  };
26420
- const errorMessage = spaceTrim__default["default"]((block) => `
26419
+ const errorMessage = spacetrim.spaceTrim((block) => `
26421
26420
 
26422
26421
  The invoked tool \`${functionName}\` failed with error:
26423
26422
 
@@ -27135,7 +27134,7 @@
27135
27134
  assertsError(error);
27136
27135
  const serializedError = serializeError(error);
27137
27136
  errors = [serializedError];
27138
- functionResponse = spaceTrim__default["default"]((block) => `
27137
+ functionResponse = spacetrim.spaceTrim((block) => `
27139
27138
 
27140
27139
  The invoked tool \`${functionName}\` failed with error:
27141
27140
 
@@ -28074,7 +28073,7 @@
28074
28073
  if (commitment.type !== 'OPEN') {
28075
28074
  continue;
28076
28075
  }
28077
- const trimmed = spaceTrim$1.spaceTrim(commitment.content);
28076
+ const trimmed = spacetrim.spaceTrim(commitment.content);
28078
28077
  return trimmed || null;
28079
28078
  }
28080
28079
  return null;
@@ -28143,7 +28142,7 @@
28143
28142
  if (isJsonSchemaResponseFormat(responseFormat)) {
28144
28143
  const jsonSchema = responseFormat.json_schema;
28145
28144
  const schemaJson = JSON.stringify(jsonSchema, null, 4);
28146
- userMessageContent = spaceTrim__default["default"]((block) => `
28145
+ userMessageContent = spacetrim.spaceTrim((block) => `
28147
28146
  ${block(prompt.content)}
28148
28147
 
28149
28148
  NOTE Request was made through OpenAI Compatible API with \`response_format\` of type \`json_schema\` with the following schema:
@@ -28174,12 +28173,12 @@
28174
28173
  const formattedAgentMessage = formatAgentMessageForJsonMode(result.content, usesJsonSchemaMode);
28175
28174
  const teacherInstructions = extractOpenTeacherInstructions(agentSource);
28176
28175
  const teacherInstructionsSection = teacherInstructions
28177
- ? spaceTrim__default["default"]((block) => `
28176
+ ? spacetrim.spaceTrim((block) => `
28178
28177
  **Teacher instructions:**
28179
28178
  ${block(teacherInstructions)}
28180
28179
  `)
28181
28180
  : '';
28182
- const teacherPromptContent = spaceTrim__default["default"]((block) => `
28181
+ const teacherPromptContent = spacetrim.spaceTrim((block) => `
28183
28182
 
28184
28183
  You are a teacher agent helping another agent to learn from its interactions.
28185
28184
 
@@ -28212,7 +28211,7 @@
28212
28211
  ? '- This interaction used JSON mode, so the agent answer should stay as a formatted JSON code block.'
28213
28212
  : ''}
28214
28213
  ${block(isInitialMessageMissing
28215
- ? spaceTrim__default["default"](`
28214
+ ? spacetrim.spaceTrim(`
28216
28215
  - The agent source does not have an INITIAL MESSAGE defined, generate one.
28217
28216
  - 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.
28218
28217
  - The quick option looks like \`[👋 Hello](?message=Hello, how are you?)\`
@@ -28255,7 +28254,7 @@
28255
28254
  */
28256
28255
  appendToAgentSource(section) {
28257
28256
  const currentSource = this.options.getAgentSource();
28258
- const newSource = padBook(validateBook(spaceTrim__default["default"](currentSource) + section));
28257
+ const newSource = padBook(validateBook(spacetrim.spaceTrim(currentSource) + section));
28259
28258
  this.options.updateAgentSource(newSource);
28260
28259
  }
28261
28260
  }
@@ -28283,13 +28282,13 @@
28283
28282
  }
28284
28283
  const parsedJson = tryParseJson(content);
28285
28284
  if (parsedJson === null) {
28286
- return spaceTrim__default["default"]((block) => `
28285
+ return spacetrim.spaceTrim((block) => `
28287
28286
  \`\`\`json
28288
28287
  ${block(content)}
28289
28288
  \`\`\`
28290
28289
  `);
28291
28290
  }
28292
- return spaceTrim__default["default"]((block) => `
28291
+ return spacetrim.spaceTrim((block) => `
28293
28292
  \`\`\`json
28294
28293
  ${block(JSON.stringify(parsedJson, null, 4))}
28295
28294
  \`\`\`
@@ -28321,7 +28320,7 @@
28321
28320
  const internalMessagesSection = options.internalMessages
28322
28321
  .map((internalMessage) => formatInternalLearningMessage(internalMessage))
28323
28322
  .join('\n\n');
28324
- return spaceTrim__default["default"]((block) => `
28323
+ return spacetrim.spaceTrim((block) => `
28325
28324
 
28326
28325
  USER MESSAGE
28327
28326
  ${block(options.userMessageContent)}
@@ -28339,7 +28338,7 @@
28339
28338
  * @private function of Agent
28340
28339
  */
28341
28340
  function formatInternalLearningMessage(internalMessage) {
28342
- return spaceTrim__default["default"]((block) => `
28341
+ return spacetrim.spaceTrim((block) => `
28343
28342
  INTERNAL MESSAGE
28344
28343
  ${block(stringifyInternalLearningPayload(internalMessage))}
28345
28344
  `);
@@ -28805,7 +28804,7 @@
28805
28804
  .filter((line) => Boolean(line))
28806
28805
  .join('\n');
28807
28806
  const personaBlock = profile.personaDescription
28808
- ? spaceTrim__default["default"]((block) => `
28807
+ ? spacetrim.spaceTrim((block) => `
28809
28808
  PERSONA
28810
28809
  ${block(profile.personaDescription || '')}
28811
28810
  `)
@@ -28841,7 +28840,7 @@
28841
28840
  // <- TODO: [🐱‍🚀] What about closed-source agents?
28842
28841
  // <- TODO: [🐱‍🚀] Maybe use promptbookFetch
28843
28842
  if (!profileResponse.ok) {
28844
- throw new Error(spaceTrim__default["default"]((block) => `
28843
+ throw new Error(spacetrim.spaceTrim((block) => `
28845
28844
  Failed to fetch remote agent profile:
28846
28845
 
28847
28846
  Agent URL: