@promptbook/node 0.100.0-2 → 0.100.0-21

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 (49) hide show
  1. package/README.md +1 -0
  2. package/esm/index.es.js +41 -5
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/core.index.d.ts +24 -0
  5. package/esm/typings/src/_packages/types.index.d.ts +28 -0
  6. package/esm/typings/src/book-2.0/agent-source/parseAgentSource.d.ts +30 -0
  7. package/esm/typings/src/book-2.0/agent-source/parseAgentSource.test.d.ts +1 -0
  8. package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +26 -0
  9. package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +30 -0
  10. package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +31 -0
  11. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/FrontendRAGService.d.ts +48 -0
  12. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +43 -0
  13. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/RAGService.d.ts +54 -0
  14. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/BaseKnowledgeProcessor.d.ts +45 -0
  15. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/PdfProcessor.d.ts +31 -0
  16. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/ProcessorFactory.d.ts +23 -0
  17. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/TextProcessor.d.ts +18 -0
  18. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/types.d.ts +56 -0
  19. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/utils/ragHelper.d.ts +34 -0
  20. package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +36 -0
  21. package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +48 -0
  22. package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +31 -0
  23. package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +41 -0
  24. package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +38 -0
  25. package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +36 -0
  26. package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +36 -0
  27. package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +30 -0
  28. package/esm/typings/src/book-2.0/commitments/_base/BaseCommitmentDefinition.d.ts +42 -0
  29. package/esm/typings/src/book-2.0/commitments/_base/BookCommitment.d.ts +5 -0
  30. package/esm/typings/src/book-2.0/commitments/_base/CommitmentDefinition.d.ts +37 -0
  31. package/esm/typings/src/book-2.0/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +14 -0
  32. package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +19 -0
  33. package/esm/typings/src/book-2.0/commitments/_misc/AgentModelRequirements.d.ts +37 -0
  34. package/esm/typings/src/book-2.0/commitments/_misc/AgentSourceParseResult.d.ts +18 -0
  35. package/esm/typings/src/book-2.0/commitments/_misc/ParsedCommitment.d.ts +22 -0
  36. package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirements.d.ts +61 -0
  37. package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirementsWithCommitments.d.ts +35 -0
  38. package/esm/typings/src/book-2.0/commitments/_misc/createCommitmentRegex.d.ts +20 -0
  39. package/esm/typings/src/book-2.0/commitments/_misc/parseAgentSourceWithCommitments.d.ts +24 -0
  40. package/esm/typings/src/book-2.0/commitments/_misc/removeCommentsFromSystemMessage.d.ts +11 -0
  41. package/esm/typings/src/book-2.0/commitments/index.d.ts +56 -0
  42. package/esm/typings/src/book-2.0/utils/profileImageUtils.d.ts +39 -0
  43. package/esm/typings/src/pipeline/book-notation.d.ts +2 -1
  44. package/esm/typings/src/types/typeAliases.d.ts +6 -0
  45. package/esm/typings/src/version.d.ts +1 -1
  46. package/esm/typings/src/wizard/wizard.d.ts +14 -4
  47. package/package.json +2 -2
  48. package/umd/index.umd.js +41 -5
  49. 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
@@ -30,7 +30,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
30
30
  * @generated
31
31
  * @see https://github.com/webgptorg/promptbook
32
32
  */
33
- const PROMPTBOOK_ENGINE_VERSION = '0.100.0-2';
33
+ const PROMPTBOOK_ENGINE_VERSION = '0.100.0-21';
34
34
  /**
35
35
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
36
36
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -5610,7 +5610,23 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
5610
5610
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
5611
5611
  const rootDirname = join(process.cwd(), DEFAULT_DOWNLOAD_CACHE_DIRNAME);
5612
5612
  const filepath = join(...nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */), `${basename.substring(0, MAX_FILENAME_LENGTH)}.${mimeTypeToExtension(mimeType)}`);
5613
- await tools.fs.mkdir(dirname(join(rootDirname, filepath)), { recursive: true });
5613
+ // Note: Try to create cache directory, but don't fail if filesystem has issues
5614
+ try {
5615
+ await tools.fs.mkdir(dirname(join(rootDirname, filepath)), { recursive: true });
5616
+ }
5617
+ catch (error) {
5618
+ // Note: If we can't create cache directory, we'll handle it when trying to write the file
5619
+ // This handles read-only filesystems, permission issues, and missing parent directories
5620
+ if (error instanceof Error && (error.message.includes('EROFS') ||
5621
+ error.message.includes('read-only') ||
5622
+ error.message.includes('EACCES') ||
5623
+ error.message.includes('EPERM') ||
5624
+ error.message.includes('ENOENT'))) ;
5625
+ else {
5626
+ // Re-throw other unexpected errors
5627
+ throw error;
5628
+ }
5629
+ }
5614
5630
  const fileContent = Buffer.from(await response.arrayBuffer());
5615
5631
  if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
5616
5632
  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.`);
@@ -5625,7 +5641,8 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
5625
5641
  if (error instanceof Error && (error.message.includes('EROFS') ||
5626
5642
  error.message.includes('read-only') ||
5627
5643
  error.message.includes('EACCES') ||
5628
- error.message.includes('EPERM'))) {
5644
+ error.message.includes('EPERM') ||
5645
+ error.message.includes('ENOENT'))) {
5629
5646
  // Return a handler that works directly with the downloaded content
5630
5647
  return {
5631
5648
  source: name,
@@ -11321,8 +11338,27 @@ class FileCacheStorage {
11321
11338
  throw new UnexpectedError(`The "${key}" you want to store in JSON file is not serializable as JSON`);
11322
11339
  }
11323
11340
  const fileContent = stringifyPipelineJson(value);
11324
- await mkdir(dirname(filename), { recursive: true }); // <- [0]
11325
- await writeFile(filename, fileContent, 'utf-8');
11341
+ // Note: Try to create cache directory and write file, but don't fail if filesystem is read-only or has permission issues
11342
+ try {
11343
+ await mkdir(dirname(filename), { recursive: true }); // <- [0]
11344
+ await writeFile(filename, fileContent, 'utf-8');
11345
+ }
11346
+ catch (error) {
11347
+ // Note: If we can't write to cache, silently ignore the error
11348
+ // This handles read-only filesystems, permission issues, and missing parent directories
11349
+ if (error instanceof Error && (error.message.includes('EROFS') ||
11350
+ error.message.includes('read-only') ||
11351
+ error.message.includes('EACCES') ||
11352
+ error.message.includes('EPERM') ||
11353
+ error.message.includes('ENOENT'))) {
11354
+ // Silently ignore filesystem errors - caching is optional
11355
+ return;
11356
+ }
11357
+ else {
11358
+ // Re-throw other unexpected errors
11359
+ throw error;
11360
+ }
11361
+ }
11326
11362
  }
11327
11363
  /**
11328
11364
  * Removes the key/value pair with the given key from the storage, if a key/value pair with the given key exists.