@promptbook/markitdown 0.112.0-12 → 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 (43) hide show
  1. package/esm/index.es.js +35 -35
  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/commitments/USE_BROWSER/resolveRunBrowserToolForNode.d.ts +1 -1
  6. package/esm/src/commitments/USE_TIMEOUT/TimeoutToolNames.d.ts +1 -0
  7. package/esm/src/commitments/USE_TIMEOUT/TimeoutToolRuntimeAdapter.d.ts +51 -2
  8. package/esm/src/commitments/USE_TIMEOUT/USE_TIMEOUT.d.ts +2 -2
  9. package/esm/src/commitments/USE_TIMEOUT/getTimeoutToolRuntimeAdapterOrDisabledResult.d.ts +2 -2
  10. package/esm/src/commitments/USE_TIMEOUT/parseTimeoutToolArgs.d.ts +14 -1
  11. package/esm/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +1 -1
  12. package/esm/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  13. package/esm/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
  14. package/esm/src/llm-providers/google/google-models.d.ts +1 -1
  15. package/esm/src/llm-providers/openai/openai-models.d.ts +1 -1
  16. package/esm/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -2
  17. package/esm/src/scrapers/document/DocumentScraper.d.ts +1 -2
  18. package/esm/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -2
  19. package/esm/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
  20. package/esm/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -2
  21. package/esm/src/version.d.ts +1 -1
  22. package/package.json +2 -2
  23. package/umd/index.umd.js +93 -94
  24. package/umd/index.umd.js.map +1 -1
  25. package/umd/src/cli/cli-commands/coder/{find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags.d.ts} +1 -1
  26. package/umd/src/cli/cli-commands/coder.d.ts +1 -1
  27. package/umd/src/commitments/USE_BROWSER/resolveRunBrowserToolForNode.d.ts +1 -1
  28. package/umd/src/commitments/USE_TIMEOUT/TimeoutToolNames.d.ts +1 -0
  29. package/umd/src/commitments/USE_TIMEOUT/TimeoutToolRuntimeAdapter.d.ts +51 -2
  30. package/umd/src/commitments/USE_TIMEOUT/USE_TIMEOUT.d.ts +2 -2
  31. package/umd/src/commitments/USE_TIMEOUT/getTimeoutToolRuntimeAdapterOrDisabledResult.d.ts +2 -2
  32. package/umd/src/commitments/USE_TIMEOUT/parseTimeoutToolArgs.d.ts +14 -1
  33. package/umd/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +1 -1
  34. package/umd/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  35. package/umd/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
  36. package/umd/src/llm-providers/google/google-models.d.ts +1 -1
  37. package/umd/src/llm-providers/openai/openai-models.d.ts +1 -1
  38. package/umd/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -2
  39. package/umd/src/scrapers/document/DocumentScraper.d.ts +1 -2
  40. package/umd/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -2
  41. package/umd/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
  42. package/umd/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -2
  43. package/umd/src/version.d.ts +1 -1
package/esm/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { mkdir, rm, readFile } from 'fs/promises';
2
- import spaceTrim$2, { spaceTrim as spaceTrim$1 } from 'spacetrim';
2
+ import { spaceTrim as spaceTrim$1 } from 'spacetrim';
3
3
  import { SHA256 } from 'crypto-js';
4
4
  import hexEncoder from 'crypto-js/enc-hex';
5
5
  import { basename, join, dirname, isAbsolute } from 'path';
@@ -24,7 +24,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
24
24
  * @generated
25
25
  * @see https://github.com/webgptorg/promptbook
26
26
  */
27
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-12';
27
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-15';
28
28
  /**
29
29
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
30
30
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1203,7 +1203,7 @@ class KnowledgeScrapeError extends Error {
1203
1203
  function getErrorReportUrl(error) {
1204
1204
  const report = {
1205
1205
  title: `🐜 Error report from ${NAME}`,
1206
- body: spaceTrim$2((block) => `
1206
+ body: spaceTrim$1((block) => `
1207
1207
 
1208
1208
 
1209
1209
  \`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
@@ -2102,7 +2102,7 @@ function pipelineJsonToString(pipelineJson) {
2102
2102
  pipelineString += '\n\n';
2103
2103
  pipelineString += '```' + contentLanguage;
2104
2104
  pipelineString += '\n';
2105
- pipelineString += spaceTrim$2(content);
2105
+ pipelineString += spaceTrim$1(content);
2106
2106
  // <- TODO: [main] !!3 Escape
2107
2107
  // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
2108
2108
  pipelineString += '\n';
@@ -2223,7 +2223,7 @@ function checkSerializableAsJson(options) {
2223
2223
  }
2224
2224
  else if (typeof value === 'object') {
2225
2225
  if (value instanceof Date) {
2226
- throw new UnexpectedError(spaceTrim$2((block) => `
2226
+ throw new UnexpectedError(spaceTrim$1((block) => `
2227
2227
  \`${name}\` is Date
2228
2228
 
2229
2229
  Use \`string_date_iso8601\` instead
@@ -2242,7 +2242,7 @@ function checkSerializableAsJson(options) {
2242
2242
  throw new UnexpectedError(`${name} is RegExp`);
2243
2243
  }
2244
2244
  else if (value instanceof Error) {
2245
- throw new UnexpectedError(spaceTrim$2((block) => `
2245
+ throw new UnexpectedError(spaceTrim$1((block) => `
2246
2246
  \`${name}\` is unserialized Error
2247
2247
 
2248
2248
  Use function \`serializeError\`
@@ -2265,7 +2265,7 @@ function checkSerializableAsJson(options) {
2265
2265
  }
2266
2266
  catch (error) {
2267
2267
  assertsError(error);
2268
- throw new UnexpectedError(spaceTrim$2((block) => `
2268
+ throw new UnexpectedError(spaceTrim$1((block) => `
2269
2269
  \`${name}\` is not serializable
2270
2270
 
2271
2271
  ${block(error.stack || error.message)}
@@ -2297,7 +2297,7 @@ function checkSerializableAsJson(options) {
2297
2297
  }
2298
2298
  }
2299
2299
  else {
2300
- throw new UnexpectedError(spaceTrim$2((block) => `
2300
+ throw new UnexpectedError(spaceTrim$1((block) => `
2301
2301
  \`${name}\` is unknown type
2302
2302
 
2303
2303
  Additional message for \`${name}\`:
@@ -3343,7 +3343,7 @@ function serializeError(error) {
3343
3343
  const { name, message, stack } = error;
3344
3344
  const { id } = error;
3345
3345
  if (!Object.keys(ALL_ERRORS).includes(name)) {
3346
- console.error(spaceTrim$2((block) => `
3346
+ console.error(spaceTrim$1((block) => `
3347
3347
 
3348
3348
  Cannot serialize error with name "${name}"
3349
3349
 
@@ -3376,7 +3376,7 @@ function jsonParse(value) {
3376
3376
  }
3377
3377
  else if (typeof value !== 'string') {
3378
3378
  console.error('Can not parse JSON from non-string value.', { text: value });
3379
- throw new Error(spaceTrim$2(`
3379
+ throw new Error(spaceTrim$1(`
3380
3380
  Can not parse JSON from non-string value.
3381
3381
 
3382
3382
  The value type: ${typeof value}
@@ -3390,7 +3390,7 @@ function jsonParse(value) {
3390
3390
  if (!(error instanceof Error)) {
3391
3391
  throw error;
3392
3392
  }
3393
- throw new Error(spaceTrim$2((block) => `
3393
+ throw new Error(spaceTrim$1((block) => `
3394
3394
  ${block(error.message)}
3395
3395
 
3396
3396
  The expected JSON text:
@@ -3443,7 +3443,7 @@ function deserializeError(error, isStackAddedToMessage = true) {
3443
3443
  message = `${name}: ${message}`;
3444
3444
  }
3445
3445
  if (isStackAddedToMessage && stack !== undefined && stack !== '') {
3446
- message = spaceTrim$2((block) => `
3446
+ message = spaceTrim$1((block) => `
3447
3447
  ${block(message)}
3448
3448
 
3449
3449
  Original stack trace:
@@ -3993,14 +3993,14 @@ class MultipleLlmExecutionTools {
3993
3993
  if (description === undefined) {
3994
3994
  return headLine;
3995
3995
  }
3996
- return spaceTrim$2((block) => `
3996
+ return spaceTrim$1((block) => `
3997
3997
  ${headLine}
3998
3998
 
3999
3999
  ${ /* <- Note: Indenting the description: */block(description)}
4000
4000
  `);
4001
4001
  })
4002
4002
  .join('\n\n');
4003
- return spaceTrim$2((block) => `
4003
+ return spaceTrim$1((block) => `
4004
4004
  Multiple LLM Providers:
4005
4005
 
4006
4006
  ${block(innerModelsTitlesAndDescriptions)}
@@ -4102,7 +4102,7 @@ class MultipleLlmExecutionTools {
4102
4102
  // 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
4103
4103
  // 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
4104
4104
  // 3) ...
4105
- spaceTrim$2((block) => `
4105
+ spaceTrim$1((block) => `
4106
4106
  All execution tools of ${this.title} failed:
4107
4107
 
4108
4108
  ${block(errors
@@ -4115,7 +4115,7 @@ class MultipleLlmExecutionTools {
4115
4115
  throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
4116
4116
  }
4117
4117
  else {
4118
- throw new PipelineExecutionError(spaceTrim$2((block) => `
4118
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
4119
4119
  You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
4120
4120
 
4121
4121
  Available \`LlmExecutionTools\`:
@@ -4152,7 +4152,7 @@ class MultipleLlmExecutionTools {
4152
4152
  */
4153
4153
  function joinLlmExecutionTools(title, ...llmExecutionTools) {
4154
4154
  if (llmExecutionTools.length === 0) {
4155
- const warningMessage = spaceTrim$2(`
4155
+ const warningMessage = spaceTrim$1(`
4156
4156
  You have not provided any \`LlmExecutionTools\`
4157
4157
  This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.
4158
4158
 
@@ -4469,14 +4469,14 @@ function $registeredScrapersMessage(availableScrapers) {
4469
4469
  return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
4470
4470
  });
4471
4471
  if (metadata.length === 0) {
4472
- return spaceTrim$2(`
4472
+ return spaceTrim$1(`
4473
4473
  **No scrapers are available**
4474
4474
 
4475
4475
  This is a unexpected behavior, you are probably using some broken version of Promptbook
4476
4476
  At least there should be available the metadata of the scrapers
4477
4477
  `);
4478
4478
  }
4479
- return spaceTrim$2((block) => `
4479
+ return spaceTrim$1((block) => `
4480
4480
  Available scrapers are:
4481
4481
  ${block(metadata
4482
4482
  .map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
@@ -4587,7 +4587,7 @@ const promptbookFetch = async (urlOrRequest, init) => {
4587
4587
  else if (urlOrRequest instanceof Request) {
4588
4588
  url = urlOrRequest.url;
4589
4589
  }
4590
- throw new PromptbookFetchError(spaceTrim$2((block) => `
4590
+ throw new PromptbookFetchError(spaceTrim$1((block) => `
4591
4591
  Can not fetch "${url}"
4592
4592
 
4593
4593
  Fetch error:
@@ -4747,7 +4747,7 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
4747
4747
  const fileExtension = getFileExtension(filename);
4748
4748
  const mimeType = extensionToMimeType(fileExtension || '');
4749
4749
  if (!(await isFileExisting(filename, tools.fs))) {
4750
- throw new NotFoundError(spaceTrim$2((block) => `
4750
+ throw new NotFoundError(spaceTrim$1((block) => `
4751
4751
  Can not make source handler for file which does not exist:
4752
4752
 
4753
4753
  File:
@@ -4840,7 +4840,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
4840
4840
  // <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
4841
4841
  break;
4842
4842
  }
4843
- console.warn(spaceTrim$2((block) => `
4843
+ console.warn(spaceTrim$1((block) => `
4844
4844
  Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
4845
4845
 
4846
4846
  The source:
@@ -4856,7 +4856,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
4856
4856
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
4857
4857
  }
4858
4858
  if (partialPieces === null) {
4859
- throw new KnowledgeScrapeError(spaceTrim$2((block) => `
4859
+ throw new KnowledgeScrapeError(spaceTrim$1((block) => `
4860
4860
  Cannot scrape knowledge
4861
4861
 
4862
4862
  The source:
@@ -5431,7 +5431,7 @@ const CsvFormatParser = {
5431
5431
  const { value, outputParameterName, settings, mapCallback, onProgress } = options;
5432
5432
  const csv = csvParse(value, settings);
5433
5433
  if (csv.errors.length !== 0) {
5434
- throw new CsvFormatError(spaceTrim$2((block) => `
5434
+ throw new CsvFormatError(spaceTrim$1((block) => `
5435
5435
  CSV parsing error
5436
5436
 
5437
5437
  Error(s) from CSV parsing:
@@ -5476,7 +5476,7 @@ const CsvFormatParser = {
5476
5476
  const { value, settings, mapCallback, onProgress } = options;
5477
5477
  const csv = csvParse(value, settings);
5478
5478
  if (csv.errors.length !== 0) {
5479
- throw new CsvFormatError(spaceTrim$2((block) => `
5479
+ throw new CsvFormatError(spaceTrim$1((block) => `
5480
5480
  CSV parsing error
5481
5481
 
5482
5482
  Error(s) from CSV parsing:
@@ -5686,7 +5686,7 @@ function mapAvailableToExpectedParameters(options) {
5686
5686
  }
5687
5687
  // Phase 2️⃣: Non-matching mapping
5688
5688
  if (expectedParameterNames.size !== availableParametersNames.size) {
5689
- throw new PipelineExecutionError(spaceTrim$2((block) => `
5689
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
5690
5690
  Can not map available parameters to expected parameters
5691
5691
 
5692
5692
  Mapped parameters:
@@ -6472,7 +6472,7 @@ async function executeFormatSubvalues(options) {
6472
6472
  return /* not await */ executeAttempts({ ...options, logLlmCall });
6473
6473
  }
6474
6474
  if (jokerParameterNames.length !== 0) {
6475
- throw new UnexpectedError(spaceTrim$2((block) => `
6475
+ throw new UnexpectedError(spaceTrim$1((block) => `
6476
6476
  JOKER parameters are not supported together with FOREACH command
6477
6477
 
6478
6478
  [🧞‍♀️] This should be prevented in \`validatePipeline\`
@@ -6485,7 +6485,7 @@ async function executeFormatSubvalues(options) {
6485
6485
  if (formatDefinition === undefined) {
6486
6486
  throw new UnexpectedError(
6487
6487
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6488
- spaceTrim$2((block) => `
6488
+ spaceTrim$1((block) => `
6489
6489
  Unsupported format "${task.foreach.formatName}"
6490
6490
 
6491
6491
  Available formats:
@@ -6502,7 +6502,7 @@ async function executeFormatSubvalues(options) {
6502
6502
  if (subvalueParser === undefined) {
6503
6503
  throw new UnexpectedError(
6504
6504
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6505
- spaceTrim$2((block) => `
6505
+ spaceTrim$1((block) => `
6506
6506
  Unsupported subformat name "${task.foreach.subformatName}" for format "${task.foreach.formatName}"
6507
6507
 
6508
6508
  Available subformat names for format "${formatDefinition.formatName}":
@@ -6542,7 +6542,7 @@ async function executeFormatSubvalues(options) {
6542
6542
  if (!(error instanceof PipelineExecutionError)) {
6543
6543
  throw error;
6544
6544
  }
6545
- const highLevelError = new PipelineExecutionError(spaceTrim$2((block) => `
6545
+ const highLevelError = new PipelineExecutionError(spaceTrim$1((block) => `
6546
6546
  ${error.message}
6547
6547
 
6548
6548
  This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -6566,7 +6566,7 @@ async function executeFormatSubvalues(options) {
6566
6566
  ...options,
6567
6567
  priority: priority + index,
6568
6568
  parameters: allSubparameters,
6569
- pipelineIdentification: spaceTrim$2((block) => `
6569
+ pipelineIdentification: spaceTrim$1((block) => `
6570
6570
  ${block(pipelineIdentification)}
6571
6571
  Subparameter index: ${index}
6572
6572
  `),
@@ -6575,7 +6575,7 @@ async function executeFormatSubvalues(options) {
6575
6575
  }
6576
6576
  catch (error) {
6577
6577
  if (length > BIG_DATASET_TRESHOLD) {
6578
- console.error(spaceTrim$2((block) => `
6578
+ console.error(spaceTrim$1((block) => `
6579
6579
  ${error.message}
6580
6580
 
6581
6581
  This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -7447,8 +7447,8 @@ class MarkdownScraper {
7447
7447
  knowledgeTextPieces.map(async (knowledgeTextPiece, i) => {
7448
7448
  // Note: These are just default values, they will be overwritten by the actual values:
7449
7449
  let name = `piece-${i}`;
7450
- let title = spaceTrim$2(knowledgeTextPiece.substring(0, 100));
7451
- const knowledgePieceContent = spaceTrim$2(knowledgeTextPiece);
7450
+ let title = spaceTrim$1(knowledgeTextPiece.substring(0, 100));
7451
+ const knowledgePieceContent = spaceTrim$1(knowledgeTextPiece);
7452
7452
  let keywords = [];
7453
7453
  const index = [];
7454
7454
  /*
@@ -7461,7 +7461,7 @@ class MarkdownScraper {
7461
7461
  isCrashedOnError: true,
7462
7462
  });
7463
7463
  const { title: titleRaw = 'Untitled' } = titleResult.outputParameters;
7464
- title = spaceTrim$2(titleRaw) /* <- TODO: Maybe do in pipeline */;
7464
+ title = spaceTrim$1(titleRaw) /* <- TODO: Maybe do in pipeline */;
7465
7465
  name = titleToName(title);
7466
7466
  // --- Keywords
7467
7467
  const keywordsResult = await prepareKeywordsExecutor({ knowledgePieceContent }).asPromise({