@promptbook/node 0.100.0-3 → 0.100.0-31
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.
- package/README.md +1 -0
- package/esm/index.es.js +46 -6
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +4 -0
- package/esm/typings/src/_packages/core.index.d.ts +24 -0
- package/esm/typings/src/_packages/types.index.d.ts +30 -0
- package/esm/typings/src/book-2.0/agent-source/parseAgentSource.d.ts +30 -0
- package/esm/typings/src/book-2.0/agent-source/parseAgentSource.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +26 -0
- package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +38 -0
- package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +39 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/FrontendRAGService.d.ts +48 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +51 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/RAGService.d.ts +54 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/BaseKnowledgeProcessor.d.ts +45 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/PdfProcessor.d.ts +31 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/ProcessorFactory.d.ts +23 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/TextProcessor.d.ts +18 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/types.d.ts +56 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/utils/ragHelper.d.ts +34 -0
- package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +44 -0
- package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +56 -0
- package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +39 -0
- package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +49 -0
- package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +46 -0
- package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +44 -0
- package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +44 -0
- package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +38 -0
- package/esm/typings/src/book-2.0/commitments/_base/BaseCommitmentDefinition.d.ts +52 -0
- package/esm/typings/src/book-2.0/commitments/_base/BookCommitment.d.ts +5 -0
- package/esm/typings/src/book-2.0/commitments/_base/CommitmentDefinition.d.ts +48 -0
- package/esm/typings/src/book-2.0/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +22 -0
- package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +19 -0
- package/esm/typings/src/book-2.0/commitments/_misc/AgentModelRequirements.d.ts +37 -0
- package/esm/typings/src/book-2.0/commitments/_misc/AgentSourceParseResult.d.ts +18 -0
- package/esm/typings/src/book-2.0/commitments/_misc/ParsedCommitment.d.ts +22 -0
- package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirements.d.ts +61 -0
- package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirementsWithCommitments.d.ts +35 -0
- package/esm/typings/src/book-2.0/commitments/_misc/createCommitmentRegex.d.ts +20 -0
- package/esm/typings/src/book-2.0/commitments/_misc/parseAgentSourceWithCommitments.d.ts +24 -0
- package/esm/typings/src/book-2.0/commitments/_misc/removeCommentsFromSystemMessage.d.ts +11 -0
- package/esm/typings/src/book-2.0/commitments/index.d.ts +56 -0
- package/esm/typings/src/book-2.0/utils/profileImageUtils.d.ts +39 -0
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +26 -0
- package/esm/typings/src/execution/AvailableModel.d.ts +4 -0
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +6 -1
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +0 -5
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/ollama/ollama-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/typings/src/pipeline/book-notation.d.ts +2 -1
- package/esm/typings/src/types/ModelRequirements.d.ts +0 -2
- package/esm/typings/src/types/typeAliases.d.ts +6 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +46 -6
- 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-
|
|
33
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-31';
|
|
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
|
|
@@ -3808,7 +3808,7 @@ function validatePromptResult(options) {
|
|
|
3808
3808
|
*/
|
|
3809
3809
|
async function executeAttempts(options) {
|
|
3810
3810
|
const { jokerParameterNames, priority, maxAttempts, // <- Note: [💂]
|
|
3811
|
-
preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, } = options;
|
|
3811
|
+
preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, } = options;
|
|
3812
3812
|
const $ongoingTaskResult = {
|
|
3813
3813
|
$result: null,
|
|
3814
3814
|
$resultString: null,
|
|
@@ -4052,6 +4052,10 @@ async function executeAttempts(options) {
|
|
|
4052
4052
|
result: $ongoingTaskResult.$resultString,
|
|
4053
4053
|
error: error,
|
|
4054
4054
|
});
|
|
4055
|
+
// Report failed attempt
|
|
4056
|
+
onProgress({
|
|
4057
|
+
errors: [error],
|
|
4058
|
+
});
|
|
4055
4059
|
}
|
|
4056
4060
|
finally {
|
|
4057
4061
|
if (!isJokerAttempt &&
|
|
@@ -5610,7 +5614,23 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5610
5614
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
5611
5615
|
const rootDirname = join(process.cwd(), DEFAULT_DOWNLOAD_CACHE_DIRNAME);
|
|
5612
5616
|
const filepath = join(...nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */), `${basename.substring(0, MAX_FILENAME_LENGTH)}.${mimeTypeToExtension(mimeType)}`);
|
|
5613
|
-
|
|
5617
|
+
// Note: Try to create cache directory, but don't fail if filesystem has issues
|
|
5618
|
+
try {
|
|
5619
|
+
await tools.fs.mkdir(dirname(join(rootDirname, filepath)), { recursive: true });
|
|
5620
|
+
}
|
|
5621
|
+
catch (error) {
|
|
5622
|
+
// Note: If we can't create cache directory, we'll handle it when trying to write the file
|
|
5623
|
+
// This handles read-only filesystems, permission issues, and missing parent directories
|
|
5624
|
+
if (error instanceof Error && (error.message.includes('EROFS') ||
|
|
5625
|
+
error.message.includes('read-only') ||
|
|
5626
|
+
error.message.includes('EACCES') ||
|
|
5627
|
+
error.message.includes('EPERM') ||
|
|
5628
|
+
error.message.includes('ENOENT'))) ;
|
|
5629
|
+
else {
|
|
5630
|
+
// Re-throw other unexpected errors
|
|
5631
|
+
throw error;
|
|
5632
|
+
}
|
|
5633
|
+
}
|
|
5614
5634
|
const fileContent = Buffer.from(await response.arrayBuffer());
|
|
5615
5635
|
if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
|
|
5616
5636
|
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 +5645,8 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5625
5645
|
if (error instanceof Error && (error.message.includes('EROFS') ||
|
|
5626
5646
|
error.message.includes('read-only') ||
|
|
5627
5647
|
error.message.includes('EACCES') ||
|
|
5628
|
-
error.message.includes('EPERM')
|
|
5648
|
+
error.message.includes('EPERM') ||
|
|
5649
|
+
error.message.includes('ENOENT'))) {
|
|
5629
5650
|
// Return a handler that works directly with the downloaded content
|
|
5630
5651
|
return {
|
|
5631
5652
|
source: name,
|
|
@@ -11321,8 +11342,27 @@ class FileCacheStorage {
|
|
|
11321
11342
|
throw new UnexpectedError(`The "${key}" you want to store in JSON file is not serializable as JSON`);
|
|
11322
11343
|
}
|
|
11323
11344
|
const fileContent = stringifyPipelineJson(value);
|
|
11324
|
-
|
|
11325
|
-
|
|
11345
|
+
// Note: Try to create cache directory and write file, but don't fail if filesystem is read-only or has permission issues
|
|
11346
|
+
try {
|
|
11347
|
+
await mkdir(dirname(filename), { recursive: true }); // <- [0]
|
|
11348
|
+
await writeFile(filename, fileContent, 'utf-8');
|
|
11349
|
+
}
|
|
11350
|
+
catch (error) {
|
|
11351
|
+
// Note: If we can't write to cache, silently ignore the error
|
|
11352
|
+
// This handles read-only filesystems, permission issues, and missing parent directories
|
|
11353
|
+
if (error instanceof Error && (error.message.includes('EROFS') ||
|
|
11354
|
+
error.message.includes('read-only') ||
|
|
11355
|
+
error.message.includes('EACCES') ||
|
|
11356
|
+
error.message.includes('EPERM') ||
|
|
11357
|
+
error.message.includes('ENOENT'))) {
|
|
11358
|
+
// Silently ignore filesystem errors - caching is optional
|
|
11359
|
+
return;
|
|
11360
|
+
}
|
|
11361
|
+
else {
|
|
11362
|
+
// Re-throw other unexpected errors
|
|
11363
|
+
throw error;
|
|
11364
|
+
}
|
|
11365
|
+
}
|
|
11326
11366
|
}
|
|
11327
11367
|
/**
|
|
11328
11368
|
* Removes the key/value pair with the given key from the storage, if a key/value pair with the given key exists.
|