@promptbook/website-crawler 0.100.0-3 → 0.100.0-32

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 (59) hide show
  1. package/README.md +1 -0
  2. package/esm/index.es.js +44 -6
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/components.index.d.ts +4 -0
  5. package/esm/typings/src/_packages/core.index.d.ts +24 -0
  6. package/esm/typings/src/_packages/types.index.d.ts +30 -0
  7. package/esm/typings/src/book-2.0/agent-source/parseAgentSource.d.ts +30 -0
  8. package/esm/typings/src/book-2.0/agent-source/parseAgentSource.test.d.ts +1 -0
  9. package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +26 -0
  10. package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +38 -0
  11. package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +39 -0
  12. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/FrontendRAGService.d.ts +48 -0
  13. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +51 -0
  14. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/RAGService.d.ts +54 -0
  15. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/BaseKnowledgeProcessor.d.ts +45 -0
  16. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/PdfProcessor.d.ts +31 -0
  17. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/ProcessorFactory.d.ts +23 -0
  18. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/TextProcessor.d.ts +18 -0
  19. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/types.d.ts +56 -0
  20. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/utils/ragHelper.d.ts +34 -0
  21. package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +44 -0
  22. package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +56 -0
  23. package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +39 -0
  24. package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +49 -0
  25. package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +46 -0
  26. package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +44 -0
  27. package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +44 -0
  28. package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +38 -0
  29. package/esm/typings/src/book-2.0/commitments/_base/BaseCommitmentDefinition.d.ts +52 -0
  30. package/esm/typings/src/book-2.0/commitments/_base/BookCommitment.d.ts +5 -0
  31. package/esm/typings/src/book-2.0/commitments/_base/CommitmentDefinition.d.ts +48 -0
  32. package/esm/typings/src/book-2.0/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +22 -0
  33. package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +19 -0
  34. package/esm/typings/src/book-2.0/commitments/_misc/AgentModelRequirements.d.ts +37 -0
  35. package/esm/typings/src/book-2.0/commitments/_misc/AgentSourceParseResult.d.ts +18 -0
  36. package/esm/typings/src/book-2.0/commitments/_misc/ParsedCommitment.d.ts +22 -0
  37. package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirements.d.ts +61 -0
  38. package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirementsWithCommitments.d.ts +35 -0
  39. package/esm/typings/src/book-2.0/commitments/_misc/createCommitmentRegex.d.ts +20 -0
  40. package/esm/typings/src/book-2.0/commitments/_misc/parseAgentSourceWithCommitments.d.ts +24 -0
  41. package/esm/typings/src/book-2.0/commitments/_misc/removeCommentsFromSystemMessage.d.ts +11 -0
  42. package/esm/typings/src/book-2.0/commitments/index.d.ts +56 -0
  43. package/esm/typings/src/book-2.0/utils/profileImageUtils.d.ts +39 -0
  44. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +26 -0
  45. package/esm/typings/src/execution/AvailableModel.d.ts +4 -0
  46. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +6 -1
  47. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +0 -5
  48. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  49. package/esm/typings/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
  50. package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
  51. package/esm/typings/src/llm-providers/ollama/ollama-models.d.ts +1 -1
  52. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
  53. package/esm/typings/src/pipeline/book-notation.d.ts +2 -1
  54. package/esm/typings/src/types/ModelRequirements.d.ts +0 -2
  55. package/esm/typings/src/types/typeAliases.d.ts +6 -0
  56. package/esm/typings/src/version.d.ts +1 -1
  57. package/package.json +2 -2
  58. package/umd/index.umd.js +44 -6
  59. package/umd/index.umd.js.map +1 -1
package/README.md CHANGED
@@ -18,6 +18,7 @@ Write AI applications using plain human language across multiple models and plat
18
18
 
19
19
  ## 🌟 New Features
20
20
 
21
+ - 🚀 **GPT-5 Support** - Now includes OpenAI's most advanced language model with unprecedented reasoning capabilities and 200K context window
21
22
  - 💡 VS Code support for `.book` files with syntax highlighting and IntelliSense
22
23
  - 🐳 Official Docker image (`hejny/promptbook`) for seamless containerized usage
23
24
  - 🔥 Native support for OpenAI `o3-mini`, GPT-4 and other leading LLMs
package/esm/index.es.js CHANGED
@@ -29,7 +29,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
29
29
  * @generated
30
30
  * @see https://github.com/webgptorg/promptbook
31
31
  */
32
- const PROMPTBOOK_ENGINE_VERSION = '0.100.0-3';
32
+ const PROMPTBOOK_ENGINE_VERSION = '0.100.0-32';
33
33
  /**
34
34
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
35
35
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1013,7 +1013,23 @@ async function getScraperIntermediateSource(source, options) {
1013
1013
  .join('/') +
1014
1014
  '.' +
1015
1015
  extension;
1016
- await mkdir(dirname(cacheFilename), { recursive: true });
1016
+ // Note: Try to create cache directory, but don't fail if filesystem has issues
1017
+ try {
1018
+ await mkdir(dirname(cacheFilename), { recursive: true });
1019
+ }
1020
+ catch (error) {
1021
+ // Note: If we can't create cache directory, continue without it
1022
+ // This handles read-only filesystems, permission issues, and missing parent directories
1023
+ if (error instanceof Error && (error.message.includes('EROFS') ||
1024
+ error.message.includes('read-only') ||
1025
+ error.message.includes('EACCES') ||
1026
+ error.message.includes('EPERM') ||
1027
+ error.message.includes('ENOENT'))) ;
1028
+ else {
1029
+ // Re-throw other unexpected errors
1030
+ throw error;
1031
+ }
1032
+ }
1017
1033
  let isDestroyed = true;
1018
1034
  const fileHandler = {
1019
1035
  filename: cacheFilename,
@@ -3498,7 +3514,23 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3498
3514
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
3499
3515
  const rootDirname = join(process.cwd(), DEFAULT_DOWNLOAD_CACHE_DIRNAME);
3500
3516
  const filepath = join(...nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */), `${basename.substring(0, MAX_FILENAME_LENGTH)}.${mimeTypeToExtension(mimeType)}`);
3501
- await tools.fs.mkdir(dirname(join(rootDirname, filepath)), { recursive: true });
3517
+ // Note: Try to create cache directory, but don't fail if filesystem has issues
3518
+ try {
3519
+ await tools.fs.mkdir(dirname(join(rootDirname, filepath)), { recursive: true });
3520
+ }
3521
+ catch (error) {
3522
+ // Note: If we can't create cache directory, we'll handle it when trying to write the file
3523
+ // This handles read-only filesystems, permission issues, and missing parent directories
3524
+ if (error instanceof Error && (error.message.includes('EROFS') ||
3525
+ error.message.includes('read-only') ||
3526
+ error.message.includes('EACCES') ||
3527
+ error.message.includes('EPERM') ||
3528
+ error.message.includes('ENOENT'))) ;
3529
+ else {
3530
+ // Re-throw other unexpected errors
3531
+ throw error;
3532
+ }
3533
+ }
3502
3534
  const fileContent = Buffer.from(await response.arrayBuffer());
3503
3535
  if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
3504
3536
  throw new LimitReachedError(`File is too large (${Math.round(fileContent.length / 1024 / 1024)}MB). Maximum allowed size is ${Math.round(DEFAULT_MAX_FILE_SIZE / 1024 / 1024)}MB.`);
@@ -3513,7 +3545,8 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3513
3545
  if (error instanceof Error && (error.message.includes('EROFS') ||
3514
3546
  error.message.includes('read-only') ||
3515
3547
  error.message.includes('EACCES') ||
3516
- error.message.includes('EPERM'))) {
3548
+ error.message.includes('EPERM') ||
3549
+ error.message.includes('ENOENT'))) {
3517
3550
  // Return a handler that works directly with the downloaded content
3518
3551
  return {
3519
3552
  source: name,
@@ -4924,7 +4957,7 @@ function validatePromptResult(options) {
4924
4957
  */
4925
4958
  async function executeAttempts(options) {
4926
4959
  const { jokerParameterNames, priority, maxAttempts, // <- Note: [💂]
4927
- preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, } = options;
4960
+ preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, } = options;
4928
4961
  const $ongoingTaskResult = {
4929
4962
  $result: null,
4930
4963
  $resultString: null,
@@ -5168,6 +5201,10 @@ async function executeAttempts(options) {
5168
5201
  result: $ongoingTaskResult.$resultString,
5169
5202
  error: error,
5170
5203
  });
5204
+ // Report failed attempt
5205
+ onProgress({
5206
+ errors: [error],
5207
+ });
5171
5208
  }
5172
5209
  finally {
5173
5210
  if (!isJokerAttempt &&
@@ -6309,7 +6346,8 @@ class WebsiteScraper {
6309
6346
  if (error instanceof Error && (error.message.includes('EROFS') ||
6310
6347
  error.message.includes('read-only') ||
6311
6348
  error.message.includes('EACCES') ||
6312
- error.message.includes('EPERM'))) ;
6349
+ error.message.includes('EPERM') ||
6350
+ error.message.includes('ENOENT'))) ;
6313
6351
  else {
6314
6352
  // Re-throw other unexpected errors
6315
6353
  throw error;