@promptbook/website-crawler 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 +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/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 +93 -94
  18. package/umd/index.umd.js.map +1 -1
  19. package/umd/src/cli/cli-commands/coder/{find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags.d.ts} +1 -1
  20. package/umd/src/cli/cli-commands/coder.d.ts +1 -1
  21. package/umd/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +1 -1
  22. package/umd/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  23. package/umd/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
  24. package/umd/src/llm-providers/google/google-models.d.ts +1 -1
  25. package/umd/src/llm-providers/openai/openai-models.d.ts +1 -1
  26. package/umd/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -2
  27. package/umd/src/scrapers/document/DocumentScraper.d.ts +1 -2
  28. package/umd/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -2
  29. package/umd/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
  30. package/umd/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -2
  31. package/umd/src/version.d.ts +1 -1
package/esm/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import spaceTrim$2, { spaceTrim as spaceTrim$1 } from 'spacetrim';
1
+ import { spaceTrim as spaceTrim$1 } from 'spacetrim';
2
2
  import { Readability } from '@mozilla/readability';
3
3
  import { JSDOM } from 'jsdom';
4
4
  import { SHA256 } from 'crypto-js';
@@ -27,7 +27,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
27
27
  * @generated
28
28
  * @see https://github.com/webgptorg/promptbook
29
29
  */
30
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-13';
30
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-16';
31
31
  /**
32
32
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
33
33
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1230,7 +1230,7 @@ class NotYetImplementedError extends Error {
1230
1230
  function getErrorReportUrl(error) {
1231
1231
  const report = {
1232
1232
  title: `🐜 Error report from ${NAME}`,
1233
- body: spaceTrim$2((block) => `
1233
+ body: spaceTrim$1((block) => `
1234
1234
 
1235
1235
 
1236
1236
  \`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
@@ -2284,7 +2284,7 @@ function pipelineJsonToString(pipelineJson) {
2284
2284
  pipelineString += '\n\n';
2285
2285
  pipelineString += '```' + contentLanguage;
2286
2286
  pipelineString += '\n';
2287
- pipelineString += spaceTrim$2(content);
2287
+ pipelineString += spaceTrim$1(content);
2288
2288
  // <- TODO: [main] !!3 Escape
2289
2289
  // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
2290
2290
  pipelineString += '\n';
@@ -2378,7 +2378,7 @@ function checkSerializableAsJson(options) {
2378
2378
  }
2379
2379
  else if (typeof value === 'object') {
2380
2380
  if (value instanceof Date) {
2381
- throw new UnexpectedError(spaceTrim$2((block) => `
2381
+ throw new UnexpectedError(spaceTrim$1((block) => `
2382
2382
  \`${name}\` is Date
2383
2383
 
2384
2384
  Use \`string_date_iso8601\` instead
@@ -2397,7 +2397,7 @@ function checkSerializableAsJson(options) {
2397
2397
  throw new UnexpectedError(`${name} is RegExp`);
2398
2398
  }
2399
2399
  else if (value instanceof Error) {
2400
- throw new UnexpectedError(spaceTrim$2((block) => `
2400
+ throw new UnexpectedError(spaceTrim$1((block) => `
2401
2401
  \`${name}\` is unserialized Error
2402
2402
 
2403
2403
  Use function \`serializeError\`
@@ -2420,7 +2420,7 @@ function checkSerializableAsJson(options) {
2420
2420
  }
2421
2421
  catch (error) {
2422
2422
  assertsError(error);
2423
- throw new UnexpectedError(spaceTrim$2((block) => `
2423
+ throw new UnexpectedError(spaceTrim$1((block) => `
2424
2424
  \`${name}\` is not serializable
2425
2425
 
2426
2426
  ${block(error.stack || error.message)}
@@ -2452,7 +2452,7 @@ function checkSerializableAsJson(options) {
2452
2452
  }
2453
2453
  }
2454
2454
  else {
2455
- throw new UnexpectedError(spaceTrim$2((block) => `
2455
+ throw new UnexpectedError(spaceTrim$1((block) => `
2456
2456
  \`${name}\` is unknown type
2457
2457
 
2458
2458
  Additional message for \`${name}\`:
@@ -3475,7 +3475,7 @@ function serializeError(error) {
3475
3475
  const { name, message, stack } = error;
3476
3476
  const { id } = error;
3477
3477
  if (!Object.keys(ALL_ERRORS).includes(name)) {
3478
- console.error(spaceTrim$2((block) => `
3478
+ console.error(spaceTrim$1((block) => `
3479
3479
 
3480
3480
  Cannot serialize error with name "${name}"
3481
3481
 
@@ -3508,7 +3508,7 @@ function jsonParse(value) {
3508
3508
  }
3509
3509
  else if (typeof value !== 'string') {
3510
3510
  console.error('Can not parse JSON from non-string value.', { text: value });
3511
- throw new Error(spaceTrim$2(`
3511
+ throw new Error(spaceTrim$1(`
3512
3512
  Can not parse JSON from non-string value.
3513
3513
 
3514
3514
  The value type: ${typeof value}
@@ -3522,7 +3522,7 @@ function jsonParse(value) {
3522
3522
  if (!(error instanceof Error)) {
3523
3523
  throw error;
3524
3524
  }
3525
- throw new Error(spaceTrim$2((block) => `
3525
+ throw new Error(spaceTrim$1((block) => `
3526
3526
  ${block(error.message)}
3527
3527
 
3528
3528
  The expected JSON text:
@@ -3575,7 +3575,7 @@ function deserializeError(error, isStackAddedToMessage = true) {
3575
3575
  message = `${name}: ${message}`;
3576
3576
  }
3577
3577
  if (isStackAddedToMessage && stack !== undefined && stack !== '') {
3578
- message = spaceTrim$2((block) => `
3578
+ message = spaceTrim$1((block) => `
3579
3579
  ${block(message)}
3580
3580
 
3581
3581
  Original stack trace:
@@ -4125,14 +4125,14 @@ class MultipleLlmExecutionTools {
4125
4125
  if (description === undefined) {
4126
4126
  return headLine;
4127
4127
  }
4128
- return spaceTrim$2((block) => `
4128
+ return spaceTrim$1((block) => `
4129
4129
  ${headLine}
4130
4130
 
4131
4131
  ${ /* <- Note: Indenting the description: */block(description)}
4132
4132
  `);
4133
4133
  })
4134
4134
  .join('\n\n');
4135
- return spaceTrim$2((block) => `
4135
+ return spaceTrim$1((block) => `
4136
4136
  Multiple LLM Providers:
4137
4137
 
4138
4138
  ${block(innerModelsTitlesAndDescriptions)}
@@ -4234,7 +4234,7 @@ class MultipleLlmExecutionTools {
4234
4234
  // 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
4235
4235
  // 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
4236
4236
  // 3) ...
4237
- spaceTrim$2((block) => `
4237
+ spaceTrim$1((block) => `
4238
4238
  All execution tools of ${this.title} failed:
4239
4239
 
4240
4240
  ${block(errors
@@ -4247,7 +4247,7 @@ class MultipleLlmExecutionTools {
4247
4247
  throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
4248
4248
  }
4249
4249
  else {
4250
- throw new PipelineExecutionError(spaceTrim$2((block) => `
4250
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
4251
4251
  You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
4252
4252
 
4253
4253
  Available \`LlmExecutionTools\`:
@@ -4284,7 +4284,7 @@ class MultipleLlmExecutionTools {
4284
4284
  */
4285
4285
  function joinLlmExecutionTools(title, ...llmExecutionTools) {
4286
4286
  if (llmExecutionTools.length === 0) {
4287
- const warningMessage = spaceTrim$2(`
4287
+ const warningMessage = spaceTrim$1(`
4288
4288
  You have not provided any \`LlmExecutionTools\`
4289
4289
  This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.
4290
4290
 
@@ -4457,14 +4457,14 @@ function $registeredScrapersMessage(availableScrapers) {
4457
4457
  return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
4458
4458
  });
4459
4459
  if (metadata.length === 0) {
4460
- return spaceTrim$2(`
4460
+ return spaceTrim$1(`
4461
4461
  **No scrapers are available**
4462
4462
 
4463
4463
  This is a unexpected behavior, you are probably using some broken version of Promptbook
4464
4464
  At least there should be available the metadata of the scrapers
4465
4465
  `);
4466
4466
  }
4467
- return spaceTrim$2((block) => `
4467
+ return spaceTrim$1((block) => `
4468
4468
  Available scrapers are:
4469
4469
  ${block(metadata
4470
4470
  .map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
@@ -4600,7 +4600,7 @@ const promptbookFetch = async (urlOrRequest, init) => {
4600
4600
  else if (urlOrRequest instanceof Request) {
4601
4601
  url = urlOrRequest.url;
4602
4602
  }
4603
- throw new PromptbookFetchError(spaceTrim$2((block) => `
4603
+ throw new PromptbookFetchError(spaceTrim$1((block) => `
4604
4604
  Can not fetch "${url}"
4605
4605
 
4606
4606
  Fetch error:
@@ -4760,7 +4760,7 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
4760
4760
  const fileExtension = getFileExtension(filename);
4761
4761
  const mimeType = extensionToMimeType(fileExtension || '');
4762
4762
  if (!(await isFileExisting(filename, tools.fs))) {
4763
- throw new NotFoundError(spaceTrim$2((block) => `
4763
+ throw new NotFoundError(spaceTrim$1((block) => `
4764
4764
  Can not make source handler for file which does not exist:
4765
4765
 
4766
4766
  File:
@@ -4853,7 +4853,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
4853
4853
  // <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
4854
4854
  break;
4855
4855
  }
4856
- console.warn(spaceTrim$2((block) => `
4856
+ console.warn(spaceTrim$1((block) => `
4857
4857
  Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
4858
4858
 
4859
4859
  The source:
@@ -4869,7 +4869,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
4869
4869
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
4870
4870
  }
4871
4871
  if (partialPieces === null) {
4872
- throw new KnowledgeScrapeError(spaceTrim$2((block) => `
4872
+ throw new KnowledgeScrapeError(spaceTrim$1((block) => `
4873
4873
  Cannot scrape knowledge
4874
4874
 
4875
4875
  The source:
@@ -5444,7 +5444,7 @@ const CsvFormatParser = {
5444
5444
  const { value, outputParameterName, settings, mapCallback, onProgress } = options;
5445
5445
  const csv = csvParse(value, settings);
5446
5446
  if (csv.errors.length !== 0) {
5447
- throw new CsvFormatError(spaceTrim$2((block) => `
5447
+ throw new CsvFormatError(spaceTrim$1((block) => `
5448
5448
  CSV parsing error
5449
5449
 
5450
5450
  Error(s) from CSV parsing:
@@ -5489,7 +5489,7 @@ const CsvFormatParser = {
5489
5489
  const { value, settings, mapCallback, onProgress } = options;
5490
5490
  const csv = csvParse(value, settings);
5491
5491
  if (csv.errors.length !== 0) {
5492
- throw new CsvFormatError(spaceTrim$2((block) => `
5492
+ throw new CsvFormatError(spaceTrim$1((block) => `
5493
5493
  CSV parsing error
5494
5494
 
5495
5495
  Error(s) from CSV parsing:
@@ -5699,7 +5699,7 @@ function mapAvailableToExpectedParameters(options) {
5699
5699
  }
5700
5700
  // Phase 2️⃣: Non-matching mapping
5701
5701
  if (expectedParameterNames.size !== availableParametersNames.size) {
5702
- throw new PipelineExecutionError(spaceTrim$2((block) => `
5702
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
5703
5703
  Can not map available parameters to expected parameters
5704
5704
 
5705
5705
  Mapped parameters:
@@ -6485,7 +6485,7 @@ async function executeFormatSubvalues(options) {
6485
6485
  return /* not await */ executeAttempts({ ...options, logLlmCall });
6486
6486
  }
6487
6487
  if (jokerParameterNames.length !== 0) {
6488
- throw new UnexpectedError(spaceTrim$2((block) => `
6488
+ throw new UnexpectedError(spaceTrim$1((block) => `
6489
6489
  JOKER parameters are not supported together with FOREACH command
6490
6490
 
6491
6491
  [🧞‍♀️] This should be prevented in \`validatePipeline\`
@@ -6498,7 +6498,7 @@ async function executeFormatSubvalues(options) {
6498
6498
  if (formatDefinition === undefined) {
6499
6499
  throw new UnexpectedError(
6500
6500
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6501
- spaceTrim$2((block) => `
6501
+ spaceTrim$1((block) => `
6502
6502
  Unsupported format "${task.foreach.formatName}"
6503
6503
 
6504
6504
  Available formats:
@@ -6515,7 +6515,7 @@ async function executeFormatSubvalues(options) {
6515
6515
  if (subvalueParser === undefined) {
6516
6516
  throw new UnexpectedError(
6517
6517
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6518
- spaceTrim$2((block) => `
6518
+ spaceTrim$1((block) => `
6519
6519
  Unsupported subformat name "${task.foreach.subformatName}" for format "${task.foreach.formatName}"
6520
6520
 
6521
6521
  Available subformat names for format "${formatDefinition.formatName}":
@@ -6555,7 +6555,7 @@ async function executeFormatSubvalues(options) {
6555
6555
  if (!(error instanceof PipelineExecutionError)) {
6556
6556
  throw error;
6557
6557
  }
6558
- const highLevelError = new PipelineExecutionError(spaceTrim$2((block) => `
6558
+ const highLevelError = new PipelineExecutionError(spaceTrim$1((block) => `
6559
6559
  ${error.message}
6560
6560
 
6561
6561
  This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -6579,7 +6579,7 @@ async function executeFormatSubvalues(options) {
6579
6579
  ...options,
6580
6580
  priority: priority + index,
6581
6581
  parameters: allSubparameters,
6582
- pipelineIdentification: spaceTrim$2((block) => `
6582
+ pipelineIdentification: spaceTrim$1((block) => `
6583
6583
  ${block(pipelineIdentification)}
6584
6584
  Subparameter index: ${index}
6585
6585
  `),
@@ -6588,7 +6588,7 @@ async function executeFormatSubvalues(options) {
6588
6588
  }
6589
6589
  catch (error) {
6590
6590
  if (length > BIG_DATASET_TRESHOLD) {
6591
- console.error(spaceTrim$2((block) => `
6591
+ console.error(spaceTrim$1((block) => `
6592
6592
  ${error.message}
6593
6593
 
6594
6594
  This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -7460,8 +7460,8 @@ class MarkdownScraper {
7460
7460
  knowledgeTextPieces.map(async (knowledgeTextPiece, i) => {
7461
7461
  // Note: These are just default values, they will be overwritten by the actual values:
7462
7462
  let name = `piece-${i}`;
7463
- let title = spaceTrim$2(knowledgeTextPiece.substring(0, 100));
7464
- const knowledgePieceContent = spaceTrim$2(knowledgeTextPiece);
7463
+ let title = spaceTrim$1(knowledgeTextPiece.substring(0, 100));
7464
+ const knowledgePieceContent = spaceTrim$1(knowledgeTextPiece);
7465
7465
  let keywords = [];
7466
7466
  const index = [];
7467
7467
  /*
@@ -7474,7 +7474,7 @@ class MarkdownScraper {
7474
7474
  isCrashedOnError: true,
7475
7475
  });
7476
7476
  const { title: titleRaw = 'Untitled' } = titleResult.outputParameters;
7477
- title = spaceTrim$2(titleRaw) /* <- TODO: Maybe do in pipeline */;
7477
+ title = spaceTrim$1(titleRaw) /* <- TODO: Maybe do in pipeline */;
7478
7478
  name = titleToName(title);
7479
7479
  // --- Keywords
7480
7480
  const keywordsResult = await prepareKeywordsExecutor({ knowledgePieceContent }).asPromise({