@promptbook/utils 0.112.0-13 → 0.112.0-16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/esm/index.es.js +18 -18
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/src/cli/cli-commands/coder/{find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags.d.ts} +1 -1
  4. package/esm/src/cli/cli-commands/coder.d.ts +1 -1
  5. package/esm/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +1 -1
  6. package/esm/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  7. package/esm/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
  8. package/esm/src/llm-providers/google/google-models.d.ts +1 -1
  9. package/esm/src/llm-providers/openai/openai-models.d.ts +1 -1
  10. package/esm/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -2
  11. package/esm/src/scrapers/document/DocumentScraper.d.ts +1 -2
  12. package/esm/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -2
  13. package/esm/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
  14. package/esm/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -2
  15. package/esm/src/version.d.ts +1 -1
  16. package/package.json +1 -1
  17. package/umd/index.umd.js +28 -29
  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
@@ -3,7 +3,7 @@ import type { number_usd } from '../../types/typeAliases';
3
3
  /**
4
4
  * List of available Deepseek models with descriptions
5
5
  *
6
- * Note: Synced with official API docs at 2025-08-20
6
+ * Note: Synced with official API docs at 2026-03-22
7
7
  *
8
8
  * @see https://www.deepseek.com/models
9
9
  * @public exported from `@promptbook/deepseek`
@@ -3,7 +3,7 @@ import type { number_usd } from '../../types/typeAliases';
3
3
  /**
4
4
  * List of available Google models with descriptions
5
5
  *
6
- * Note: Synced with official API docs at 2025-11-19
6
+ * Note: Synced with official API docs at 2026-03-22
7
7
  *
8
8
  * @see https://ai.google.dev/models/gemini
9
9
  * @public exported from `@promptbook/google`
@@ -2,7 +2,7 @@ import type { AvailableModel } from '../../execution/AvailableModel';
2
2
  /**
3
3
  * List of available OpenAI models with pricing
4
4
  *
5
- * Note: Synced with official API docs at 2025-11-19
5
+ * Note: Synced with official API docs at 2026-03-22
6
6
  *
7
7
  * @see https://platform.openai.com/docs/models/
8
8
  * @see https://openai.com/api/pricing/
@@ -3,8 +3,7 @@ import type { KnowledgePiecePreparedJson } from '../../pipeline/PipelineJson/Kno
3
3
  import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions';
4
4
  import type { Converter } from '../_common/Converter';
5
5
  import type { ScraperAndConverterMetadata } from '../_common/register/ScraperAndConverterMetadata';
6
- import type { Scraper } from '../_common/Scraper';
7
- import type { ScraperSourceHandler } from '../_common/Scraper';
6
+ import type { Scraper, ScraperSourceHandler } from '../_common/Scraper';
8
7
  import type { ScraperIntermediateSource } from '../_common/ScraperIntermediateSource';
9
8
  /**
10
9
  * Scraper of @@ files
@@ -3,8 +3,7 @@ import type { ExecutionTools } from '../../execution/ExecutionTools';
3
3
  import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions';
4
4
  import type { Converter } from '../_common/Converter';
5
5
  import type { ScraperAndConverterMetadata } from '../_common/register/ScraperAndConverterMetadata';
6
- import type { Scraper } from '../_common/Scraper';
7
- import type { ScraperSourceHandler } from '../_common/Scraper';
6
+ import type { Scraper, ScraperSourceHandler } from '../_common/Scraper';
8
7
  import type { ScraperIntermediateSource } from '../_common/ScraperIntermediateSource';
9
8
  /**
10
9
  * Scraper of .docx and .odt files
@@ -3,8 +3,7 @@ import type { ExecutionTools } from '../../execution/ExecutionTools';
3
3
  import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions';
4
4
  import type { Converter } from '../_common/Converter';
5
5
  import type { ScraperAndConverterMetadata } from '../_common/register/ScraperAndConverterMetadata';
6
- import type { Scraper } from '../_common/Scraper';
7
- import type { ScraperSourceHandler } from '../_common/Scraper';
6
+ import type { Scraper, ScraperSourceHandler } from '../_common/Scraper';
8
7
  import type { ScraperIntermediateSource } from '../_common/ScraperIntermediateSource';
9
8
  /**
10
9
  * Scraper for old document files (like .doc and .rtf)
@@ -1,4 +1,4 @@
1
- import spaceTrim from 'spacetrim';
1
+ import { spaceTrim } from 'spacetrim';
2
2
  import { extractBlock } from '../../postprocessing/utils/extractBlock';
3
3
  import { prettifyMarkdown } from '../../utils/markdown/prettifyMarkdown';
4
4
  import { trimCodeBlock } from '../../utils/markdown/trimCodeBlock';
@@ -1,5 +1,4 @@
1
- import type { string_parameter_name } from '../../types/typeAliases';
2
- import type { string_parameter_value } from '../../types/typeAliases';
1
+ import type { string_parameter_name, string_parameter_value } from '../../types/typeAliases';
3
2
  /**
4
3
  * Options for mapping available parameters to expected parameters in a pipeline task.
5
4
  */
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.112.0-12`).
18
+ * It follows semantic versioning (e.g., `0.112.0-15`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/utils",
3
- "version": "0.112.0-13",
3
+ "version": "0.112.0-16",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
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('path'), require('crypto'), require('crypto-js'), require('crypto-js/enc-hex')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'path', 'crypto', 'crypto-js', 'crypto-js/enc-hex'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-utils"] = {}, global.spaceTrim$1, global.path, global.crypto, global.cryptoJs, global.hexEncoder));
5
- })(this, (function (exports, spaceTrim$1, path, crypto, cryptoJs, hexEncoder) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-utils"] = {}, global.spacetrim, global.path, global.crypto, global.cryptoJs, global.hexEncoder));
5
+ })(this, (function (exports, spacetrim, path, crypto, cryptoJs, hexEncoder) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
- var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
10
9
  var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
11
10
 
12
11
  // ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
@@ -23,7 +22,7 @@
23
22
  * @generated
24
23
  * @see https://github.com/webgptorg/promptbook
25
24
  */
26
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-13';
25
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-16';
27
26
  /**
28
27
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
28
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -38,7 +37,7 @@
38
37
  * @public exported from `@promptbook/utils`
39
38
  * @see https://github.com/hejny/spacetrim#usage
40
39
  */
41
- const spaceTrim = spaceTrim$1.spaceTrim;
40
+ const spaceTrim = spacetrim.spaceTrim;
42
41
 
43
42
  /**
44
43
  * @private util of `@promptbook/color`
@@ -1077,7 +1076,7 @@
1077
1076
  function getErrorReportUrl(error) {
1078
1077
  const report = {
1079
1078
  title: `🐜 Error report from ${NAME}`,
1080
- body: spaceTrim__default["default"]((block) => `
1079
+ body: spacetrim.spaceTrim((block) => `
1081
1080
 
1082
1081
 
1083
1082
  \`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
@@ -1120,7 +1119,7 @@
1120
1119
  */
1121
1120
  class UnexpectedError extends Error {
1122
1121
  constructor(message) {
1123
- super(spaceTrim$1.spaceTrim((block) => `
1122
+ super(spacetrim.spaceTrim((block) => `
1124
1123
  ${block(message)}
1125
1124
 
1126
1125
  Note: This error should not happen.
@@ -1146,7 +1145,7 @@
1146
1145
  constructor(whatWasThrown) {
1147
1146
  const tag = `[🤮]`;
1148
1147
  console.error(tag, whatWasThrown);
1149
- super(spaceTrim$1.spaceTrim(`
1148
+ super(spacetrim.spaceTrim(`
1150
1149
  Non-Error object was thrown
1151
1150
 
1152
1151
  Note: Look for ${tag} in the console for more details
@@ -1235,7 +1234,7 @@
1235
1234
  }
1236
1235
  else if (typeof value === 'object') {
1237
1236
  if (value instanceof Date) {
1238
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
1237
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
1239
1238
  \`${name}\` is Date
1240
1239
 
1241
1240
  Use \`string_date_iso8601\` instead
@@ -1254,7 +1253,7 @@
1254
1253
  throw new UnexpectedError(`${name} is RegExp`);
1255
1254
  }
1256
1255
  else if (value instanceof Error) {
1257
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
1256
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
1258
1257
  \`${name}\` is unserialized Error
1259
1258
 
1260
1259
  Use function \`serializeError\`
@@ -1277,7 +1276,7 @@
1277
1276
  }
1278
1277
  catch (error) {
1279
1278
  assertsError(error);
1280
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
1279
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
1281
1280
  \`${name}\` is not serializable
1282
1281
 
1283
1282
  ${block(error.stack || error.message)}
@@ -1309,7 +1308,7 @@
1309
1308
  }
1310
1309
  }
1311
1310
  else {
1312
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
1311
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
1313
1312
  \`${name}\` is unknown type
1314
1313
 
1315
1314
  Additional message for \`${name}\`:
@@ -1994,7 +1993,7 @@
1994
1993
  .filter(([MERMAID_NAME]) => (inputAndIntermediateParametersMermaid + outputParametersMermaid).includes(MERMAID_NAME))
1995
1994
  .map(([MERMAID_NAME, title]) => `${MERMAID_NAME}((${title})):::${MERMAID_NAME}`)
1996
1995
  .join('\n');
1997
- const promptbookMermaid = spaceTrim$1.spaceTrim((block) => `
1996
+ const promptbookMermaid = spacetrim.spaceTrim((block) => `
1998
1997
 
1999
1998
  %% 🔮 Tip: Open this on GitHub or in the VSCode website to see the Mermaid graph visually
2000
1999
 
@@ -2183,7 +2182,7 @@
2183
2182
  */
2184
2183
  class MissingToolsError extends Error {
2185
2184
  constructor(message) {
2186
- super(spaceTrim$1.spaceTrim((block) => `
2185
+ super(spacetrim.spaceTrim((block) => `
2187
2186
  ${block(message)}
2188
2187
 
2189
2188
  Note: You have probably forgot to provide some tools for pipeline execution or preparation
@@ -2227,7 +2226,7 @@
2227
2226
  */
2228
2227
  class NotYetImplementedError extends Error {
2229
2228
  constructor(message) {
2230
- super(spaceTrim$1.spaceTrim((block) => `
2229
+ super(spacetrim.spaceTrim((block) => `
2231
2230
  ${block(message)}
2232
2231
 
2233
2232
  Note: This feature is not implemented yet but it will be soon.
@@ -2413,7 +2412,7 @@
2413
2412
  message = `${name}: ${message}`;
2414
2413
  }
2415
2414
  if (isStackAddedToMessage && stack !== undefined && stack !== '') {
2416
- message = spaceTrim__default["default"]((block) => `
2415
+ message = spacetrim.spaceTrim((block) => `
2417
2416
  ${block(message)}
2418
2417
 
2419
2418
  Original stack trace:
@@ -2434,7 +2433,7 @@
2434
2433
  const { name, message, stack } = error;
2435
2434
  const { id } = error;
2436
2435
  if (!Object.keys(ALL_ERRORS).includes(name)) {
2437
- console.error(spaceTrim__default["default"]((block) => `
2436
+ console.error(spacetrim.spaceTrim((block) => `
2438
2437
 
2439
2438
  Cannot serialize error with name "${name}"
2440
2439
 
@@ -2540,7 +2539,7 @@
2540
2539
  }
2541
2540
  else if (typeof value !== 'string') {
2542
2541
  console.error('Can not parse JSON from non-string value.', { text: value });
2543
- throw new Error(spaceTrim__default["default"](`
2542
+ throw new Error(spacetrim.spaceTrim(`
2544
2543
  Can not parse JSON from non-string value.
2545
2544
 
2546
2545
  The value type: ${typeof value}
@@ -2554,7 +2553,7 @@
2554
2553
  if (!(error instanceof Error)) {
2555
2554
  throw error;
2556
2555
  }
2557
- throw new Error(spaceTrim__default["default"]((block) => `
2556
+ throw new Error(spacetrim.spaceTrim((block) => `
2558
2557
  ${block(error.message)}
2559
2558
 
2560
2559
  The expected JSON text:
@@ -2995,7 +2994,7 @@
2995
2994
  const entries = items
2996
2995
  .flatMap((item) => formatParameterListItem(item).split(/\r?\n/))
2997
2996
  .filter((line) => line !== '');
2998
- return spaceTrim__default["default"]((block) => `
2997
+ return spacetrim.spaceTrim((block) => `
2999
2998
  **Parameters:**
3000
2999
  ${block(entries.join('\n'))}
3001
3000
 
@@ -3068,7 +3067,7 @@
3068
3067
  */
3069
3068
  function prompt(strings, ...values) {
3070
3069
  if (values.length === 0) {
3071
- return new PromptString(spaceTrim__default["default"](strings.join('')));
3070
+ return new PromptString(spacetrim.spaceTrim(strings.join('')));
3072
3071
  }
3073
3072
  const stringsWithHiddenParameters = strings.map((stringsItem) => ParameterEscaping.hideBrackets(stringsItem));
3074
3073
  const parameterMetadata = values.map((value) => {
@@ -3109,7 +3108,7 @@
3109
3108
  ? `${result}${stringsItem}`
3110
3109
  : `${result}${stringsItem}${ParameterSection.formatParameterPlaceholder(parameterName)}`;
3111
3110
  }, '');
3112
- pipelineString = spaceTrim__default["default"](pipelineString);
3111
+ pipelineString = spacetrim.spaceTrim(pipelineString);
3113
3112
  try {
3114
3113
  pipelineString = templateParameters(pipelineString, parameters);
3115
3114
  }
@@ -3118,7 +3117,7 @@
3118
3117
  throw error;
3119
3118
  }
3120
3119
  console.error({ pipelineString, parameters, parameterNames: parameterNamesOrdered, error });
3121
- throw new UnexpectedError(spaceTrim__default["default"]((block) => `
3120
+ throw new UnexpectedError(spacetrim.spaceTrim((block) => `
3122
3121
  Internal error in prompt template literal
3123
3122
 
3124
3123
  ${block(JSON.stringify({ strings, values }, null, 4))}}
@@ -3208,7 +3207,7 @@
3208
3207
  */
3209
3208
  function formatClientVersionMismatchMessage(clientVersion) {
3210
3209
  const reportedVersion = clientVersion !== null && clientVersion !== void 0 ? clientVersion : 'unknown';
3211
- return spaceTrim__default["default"](`
3210
+ return spacetrim.spaceTrim(`
3212
3211
  A new version of Promptbook is available.
3213
3212
  Please refresh the page to keep using the latest experience (currently using v${reportedVersion}).
3214
3213
  `);
@@ -3511,7 +3510,7 @@
3511
3510
  * @public exported from `@promptbook/utils`
3512
3511
  */
3513
3512
  function computeHash(value) {
3514
- return cryptoJs.SHA256(hexEncoder__default["default"].parse(spaceTrim__default["default"](valueToString(value)))).toString( /* hex */);
3513
+ return cryptoJs.SHA256(hexEncoder__default["default"].parse(spacetrim.spaceTrim(valueToString(value)))).toString( /* hex */);
3515
3514
  }
3516
3515
  /**
3517
3516
  * TODO: [🥬][🥬] Use this ACRY
@@ -5198,7 +5197,7 @@
5198
5197
  * @public exported from `@promptbook/utils`
5199
5198
  */
5200
5199
  function normalizeMessageText(text) {
5201
- return spaceTrim$1.spaceTrim(text);
5200
+ return spacetrim.spaceTrim(text);
5202
5201
  }
5203
5202
 
5204
5203
  /**
@@ -5348,7 +5347,7 @@
5348
5347
  let trimmedText = text;
5349
5348
  // Remove leading and trailing spaces and newlines
5350
5349
  if (isTrimmed) {
5351
- trimmedText = spaceTrim$1.spaceTrim(trimmedText);
5350
+ trimmedText = spacetrim.spaceTrim(trimmedText);
5352
5351
  }
5353
5352
  let processedText = trimmedText;
5354
5353
  // Check for markdown code block
@@ -5367,7 +5366,7 @@
5367
5366
  // Remove the introduce sentence and quotes by replacing it with an empty string
5368
5367
  processedText = processedText.replace(introduceSentenceRegex, '');
5369
5368
  }
5370
- processedText = spaceTrim$1.spaceTrim(processedText);
5369
+ processedText = spacetrim.spaceTrim(processedText);
5371
5370
  // Check again for code block after removing introduce sentence
5372
5371
  const codeBlockMatch2 = processedText.match(codeBlockRegex);
5373
5372
  if (codeBlockMatch2 && codeBlockMatch2[1] !== undefined) {
@@ -5556,7 +5555,7 @@
5556
5555
  imports.push(`import { Color } from '@promptbook/color';`);
5557
5556
  }
5558
5557
  else if (typeof value === 'string') {
5559
- const trimmed = spaceTrim__default["default"](value);
5558
+ const trimmed = spacetrim.spaceTrim(value);
5560
5559
  if (trimmed.includes('\n')) {
5561
5560
  // Multiline string -> use `spaceTrim`
5562
5561
  serializedValue = `spaceTrim(\`\n${value.replace(/`/g, '\\`')}\n\`)`;