@promptbook/pdf 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
@@ -26,7 +26,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
26
26
  * @generated
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- const PROMPTBOOK_ENGINE_VERSION = '0.100.0-3';
29
+ const PROMPTBOOK_ENGINE_VERSION = '0.100.0-32';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
32
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -847,7 +847,23 @@ async function getScraperIntermediateSource(source, options) {
847
847
  .join('/') +
848
848
  '.' +
849
849
  extension;
850
- await mkdir(dirname(cacheFilename), { recursive: true });
850
+ // Note: Try to create cache directory, but don't fail if filesystem has issues
851
+ try {
852
+ await mkdir(dirname(cacheFilename), { recursive: true });
853
+ }
854
+ catch (error) {
855
+ // Note: If we can't create cache directory, continue without it
856
+ // This handles read-only filesystems, permission issues, and missing parent directories
857
+ if (error instanceof Error && (error.message.includes('EROFS') ||
858
+ error.message.includes('read-only') ||
859
+ error.message.includes('EACCES') ||
860
+ error.message.includes('EPERM') ||
861
+ error.message.includes('ENOENT'))) ;
862
+ else {
863
+ // Re-throw other unexpected errors
864
+ throw error;
865
+ }
866
+ }
851
867
  let isDestroyed = true;
852
868
  const fileHandler = {
853
869
  filename: cacheFilename,
@@ -3497,7 +3513,23 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3497
3513
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
3498
3514
  const rootDirname = join(process.cwd(), DEFAULT_DOWNLOAD_CACHE_DIRNAME);
3499
3515
  const filepath = join(...nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */), `${basename.substring(0, MAX_FILENAME_LENGTH)}.${mimeTypeToExtension(mimeType)}`);
3500
- await tools.fs.mkdir(dirname(join(rootDirname, filepath)), { recursive: true });
3516
+ // Note: Try to create cache directory, but don't fail if filesystem has issues
3517
+ try {
3518
+ await tools.fs.mkdir(dirname(join(rootDirname, filepath)), { recursive: true });
3519
+ }
3520
+ catch (error) {
3521
+ // Note: If we can't create cache directory, we'll handle it when trying to write the file
3522
+ // This handles read-only filesystems, permission issues, and missing parent directories
3523
+ if (error instanceof Error && (error.message.includes('EROFS') ||
3524
+ error.message.includes('read-only') ||
3525
+ error.message.includes('EACCES') ||
3526
+ error.message.includes('EPERM') ||
3527
+ error.message.includes('ENOENT'))) ;
3528
+ else {
3529
+ // Re-throw other unexpected errors
3530
+ throw error;
3531
+ }
3532
+ }
3501
3533
  const fileContent = Buffer.from(await response.arrayBuffer());
3502
3534
  if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
3503
3535
  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.`);
@@ -3512,7 +3544,8 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
3512
3544
  if (error instanceof Error && (error.message.includes('EROFS') ||
3513
3545
  error.message.includes('read-only') ||
3514
3546
  error.message.includes('EACCES') ||
3515
- error.message.includes('EPERM'))) {
3547
+ error.message.includes('EPERM') ||
3548
+ error.message.includes('ENOENT'))) {
3516
3549
  // Return a handler that works directly with the downloaded content
3517
3550
  return {
3518
3551
  source: name,
@@ -4923,7 +4956,7 @@ function validatePromptResult(options) {
4923
4956
  */
4924
4957
  async function executeAttempts(options) {
4925
4958
  const { jokerParameterNames, priority, maxAttempts, // <- Note: [💂]
4926
- preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, } = options;
4959
+ preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, } = options;
4927
4960
  const $ongoingTaskResult = {
4928
4961
  $result: null,
4929
4962
  $resultString: null,
@@ -5167,6 +5200,10 @@ async function executeAttempts(options) {
5167
5200
  result: $ongoingTaskResult.$resultString,
5168
5201
  error: error,
5169
5202
  });
5203
+ // Report failed attempt
5204
+ onProgress({
5205
+ errors: [error],
5206
+ });
5170
5207
  }
5171
5208
  finally {
5172
5209
  if (!isJokerAttempt &&
@@ -6327,7 +6364,8 @@ class MarkitdownScraper {
6327
6364
  if (error instanceof Error && (error.message.includes('EROFS') ||
6328
6365
  error.message.includes('read-only') ||
6329
6366
  error.message.includes('EACCES') ||
6330
- error.message.includes('EPERM'))) ;
6367
+ error.message.includes('EPERM') ||
6368
+ error.message.includes('ENOENT'))) ;
6331
6369
  else {
6332
6370
  // Re-throw other unexpected errors
6333
6371
  throw error;