@promptbook/wizard 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.
- package/README.md +1 -0
- package/esm/index.es.js +87 -18
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +24 -0
- package/esm/typings/src/_packages/types.index.d.ts +28 -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 +30 -0
- package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +31 -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 +43 -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 +36 -0
- package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +48 -0
- package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +31 -0
- package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +41 -0
- package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +38 -0
- package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +36 -0
- package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +36 -0
- package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +30 -0
- package/esm/typings/src/book-2.0/commitments/_base/BaseCommitmentDefinition.d.ts +42 -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 +37 -0
- package/esm/typings/src/book-2.0/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +14 -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/pipeline/book-notation.d.ts +2 -1
- package/esm/typings/src/types/typeAliases.d.ts +6 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/esm/typings/src/wizard/wizard.d.ts +14 -4
- package/package.json +2 -2
- package/umd/index.umd.js +87 -18
- 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
@@ -38,7 +38,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
38
38
|
* @generated
|
39
39
|
* @see https://github.com/webgptorg/promptbook
|
40
40
|
*/
|
41
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-
|
41
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-21';
|
42
42
|
/**
|
43
43
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
44
44
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
@@ -2709,6 +2709,18 @@ const _AzureOpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
2709
2709
|
const OPENAI_MODELS = exportJson({
|
2710
2710
|
name: 'OPENAI_MODELS',
|
2711
2711
|
value: [
|
2712
|
+
/**/
|
2713
|
+
{
|
2714
|
+
modelVariant: 'CHAT',
|
2715
|
+
modelTitle: 'gpt-5',
|
2716
|
+
modelName: 'gpt-5',
|
2717
|
+
modelDescription: "OpenAI's most advanced language model with unprecedented reasoning capabilities and 200K context window. Features revolutionary improvements in complex problem-solving, scientific reasoning, and creative tasks. Demonstrates human-level performance across diverse domains with enhanced safety measures and alignment. Represents the next generation of AI with superior understanding, nuanced responses, and advanced multimodal capabilities.",
|
2718
|
+
pricing: {
|
2719
|
+
prompt: pricing(`$10.00 / 1M tokens`),
|
2720
|
+
output: pricing(`$30.00 / 1M tokens`),
|
2721
|
+
},
|
2722
|
+
},
|
2723
|
+
/**/
|
2712
2724
|
/*/
|
2713
2725
|
{
|
2714
2726
|
modelTitle: 'dall-e-3',
|
@@ -5173,7 +5185,7 @@ class OpenAiExecutionTools extends OpenAiCompatibleExecutionTools {
|
|
5173
5185
|
* Default model for chat variant.
|
5174
5186
|
*/
|
5175
5187
|
getDefaultChatModel() {
|
5176
|
-
return this.getDefaultModel('gpt-
|
5188
|
+
return this.getDefaultModel('gpt-5');
|
5177
5189
|
}
|
5178
5190
|
/**
|
5179
5191
|
* Default model for completion variant.
|
@@ -5963,7 +5975,23 @@ async function getScraperIntermediateSource(source, options) {
|
|
5963
5975
|
.join('/') +
|
5964
5976
|
'.' +
|
5965
5977
|
extension;
|
5966
|
-
|
5978
|
+
// Note: Try to create cache directory, but don't fail if filesystem has issues
|
5979
|
+
try {
|
5980
|
+
await mkdir(dirname(cacheFilename), { recursive: true });
|
5981
|
+
}
|
5982
|
+
catch (error) {
|
5983
|
+
// Note: If we can't create cache directory, continue without it
|
5984
|
+
// This handles read-only filesystems, permission issues, and missing parent directories
|
5985
|
+
if (error instanceof Error && (error.message.includes('EROFS') ||
|
5986
|
+
error.message.includes('read-only') ||
|
5987
|
+
error.message.includes('EACCES') ||
|
5988
|
+
error.message.includes('EPERM') ||
|
5989
|
+
error.message.includes('ENOENT'))) ;
|
5990
|
+
else {
|
5991
|
+
// Re-throw other unexpected errors
|
5992
|
+
throw error;
|
5993
|
+
}
|
5994
|
+
}
|
5967
5995
|
let isDestroyed = true;
|
5968
5996
|
const fileHandler = {
|
5969
5997
|
filename: cacheFilename,
|
@@ -7727,7 +7755,23 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
7727
7755
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
7728
7756
|
const rootDirname = join(process.cwd(), DEFAULT_DOWNLOAD_CACHE_DIRNAME);
|
7729
7757
|
const filepath = join(...nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */), `${basename.substring(0, MAX_FILENAME_LENGTH)}.${mimeTypeToExtension(mimeType)}`);
|
7730
|
-
|
7758
|
+
// Note: Try to create cache directory, but don't fail if filesystem has issues
|
7759
|
+
try {
|
7760
|
+
await tools.fs.mkdir(dirname(join(rootDirname, filepath)), { recursive: true });
|
7761
|
+
}
|
7762
|
+
catch (error) {
|
7763
|
+
// Note: If we can't create cache directory, we'll handle it when trying to write the file
|
7764
|
+
// This handles read-only filesystems, permission issues, and missing parent directories
|
7765
|
+
if (error instanceof Error && (error.message.includes('EROFS') ||
|
7766
|
+
error.message.includes('read-only') ||
|
7767
|
+
error.message.includes('EACCES') ||
|
7768
|
+
error.message.includes('EPERM') ||
|
7769
|
+
error.message.includes('ENOENT'))) ;
|
7770
|
+
else {
|
7771
|
+
// Re-throw other unexpected errors
|
7772
|
+
throw error;
|
7773
|
+
}
|
7774
|
+
}
|
7731
7775
|
const fileContent = Buffer.from(await response.arrayBuffer());
|
7732
7776
|
if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
|
7733
7777
|
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.`);
|
@@ -7742,7 +7786,8 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
7742
7786
|
if (error instanceof Error && (error.message.includes('EROFS') ||
|
7743
7787
|
error.message.includes('read-only') ||
|
7744
7788
|
error.message.includes('EACCES') ||
|
7745
|
-
error.message.includes('EPERM')
|
7789
|
+
error.message.includes('EPERM') ||
|
7790
|
+
error.message.includes('ENOENT'))) {
|
7746
7791
|
// Return a handler that works directly with the downloaded content
|
7747
7792
|
return {
|
7748
7793
|
source: name,
|
@@ -10849,7 +10894,8 @@ class MarkitdownScraper {
|
|
10849
10894
|
if (error instanceof Error && (error.message.includes('EROFS') ||
|
10850
10895
|
error.message.includes('read-only') ||
|
10851
10896
|
error.message.includes('EACCES') ||
|
10852
|
-
error.message.includes('EPERM')
|
10897
|
+
error.message.includes('EPERM') ||
|
10898
|
+
error.message.includes('ENOENT'))) ;
|
10853
10899
|
else {
|
10854
10900
|
// Re-throw other unexpected errors
|
10855
10901
|
throw error;
|
@@ -11152,7 +11198,8 @@ class WebsiteScraper {
|
|
11152
11198
|
if (error instanceof Error && (error.message.includes('EROFS') ||
|
11153
11199
|
error.message.includes('read-only') ||
|
11154
11200
|
error.message.includes('EACCES') ||
|
11155
|
-
error.message.includes('EPERM')
|
11201
|
+
error.message.includes('EPERM') ||
|
11202
|
+
error.message.includes('ENOENT'))) ;
|
11156
11203
|
else {
|
11157
11204
|
// Re-throw other unexpected errors
|
11158
11205
|
throw error;
|
@@ -11898,8 +11945,27 @@ class FileCacheStorage {
|
|
11898
11945
|
throw new UnexpectedError(`The "${key}" you want to store in JSON file is not serializable as JSON`);
|
11899
11946
|
}
|
11900
11947
|
const fileContent = stringifyPipelineJson(value);
|
11901
|
-
|
11902
|
-
|
11948
|
+
// Note: Try to create cache directory and write file, but don't fail if filesystem is read-only or has permission issues
|
11949
|
+
try {
|
11950
|
+
await mkdir(dirname(filename), { recursive: true }); // <- [0]
|
11951
|
+
await writeFile(filename, fileContent, 'utf-8');
|
11952
|
+
}
|
11953
|
+
catch (error) {
|
11954
|
+
// Note: If we can't write to cache, silently ignore the error
|
11955
|
+
// This handles read-only filesystems, permission issues, and missing parent directories
|
11956
|
+
if (error instanceof Error && (error.message.includes('EROFS') ||
|
11957
|
+
error.message.includes('read-only') ||
|
11958
|
+
error.message.includes('EACCES') ||
|
11959
|
+
error.message.includes('EPERM') ||
|
11960
|
+
error.message.includes('ENOENT'))) {
|
11961
|
+
// Silently ignore filesystem errors - caching is optional
|
11962
|
+
return;
|
11963
|
+
}
|
11964
|
+
else {
|
11965
|
+
// Re-throw other unexpected errors
|
11966
|
+
throw error;
|
11967
|
+
}
|
11968
|
+
}
|
11903
11969
|
}
|
11904
11970
|
/**
|
11905
11971
|
* Removes the key/value pair with the given key from the storage, if a key/value pair with the given key exists.
|
@@ -16779,7 +16845,8 @@ async function $getCompiledBook(tools, pipelineSource, options) {
|
|
16779
16845
|
if (error instanceof Error && (error.message.includes('EROFS') ||
|
16780
16846
|
error.message.includes('read-only') ||
|
16781
16847
|
error.message.includes('EACCES') ||
|
16782
|
-
error.message.includes('EPERM')
|
16848
|
+
error.message.includes('EPERM') ||
|
16849
|
+
error.message.includes('ENOENT'))) ;
|
16783
16850
|
else {
|
16784
16851
|
// Re-throw other unexpected errors
|
16785
16852
|
throw error;
|
@@ -16906,14 +16973,14 @@ class Wizard {
|
|
16906
16973
|
*
|
16907
16974
|
* Note: This works similar to the `ptbk run` command
|
16908
16975
|
*/
|
16909
|
-
async execute(book, inputParameters) {
|
16976
|
+
async execute(book, inputParameters, options = {}) {
|
16910
16977
|
if (!$isRunningInNode()) {
|
16911
16978
|
throw new EnvironmentMismatchError('Wizard works only in Node.js environment');
|
16912
16979
|
}
|
16913
16980
|
// ▶ Get the tools
|
16914
|
-
const tools = await this.getExecutionTools();
|
16981
|
+
const tools = await this.getExecutionTools(options);
|
16915
16982
|
// ▶ Get the Pipeline
|
16916
|
-
const pipeline = await this.getCompiledBook(book);
|
16983
|
+
const pipeline = await this.getCompiledBook(book, options);
|
16917
16984
|
// ▶ Create executor - the function that will execute the Pipeline
|
16918
16985
|
const pipelineExecutor = createPipelineExecutor({ pipeline, tools });
|
16919
16986
|
// 🚀▶ Execute the Pipeline
|
@@ -16936,15 +17003,16 @@ class Wizard {
|
|
16936
17003
|
/**
|
16937
17004
|
* Provides the tools automatically for the Node.js environment
|
16938
17005
|
*
|
16939
|
-
* @param
|
17006
|
+
* @param options
|
16940
17007
|
*/
|
16941
|
-
async getExecutionTools() {
|
17008
|
+
async getExecutionTools(options = {}) {
|
17009
|
+
var _a;
|
16942
17010
|
if (this.executionTools !== null) {
|
16943
17011
|
return this.executionTools;
|
16944
17012
|
}
|
16945
17013
|
// TODO: DRY [◽]
|
16946
17014
|
const prepareAndScrapeOptions = {
|
16947
|
-
isVerbose: false,
|
17015
|
+
isVerbose: (_a = options.isVerbose) !== null && _a !== void 0 ? _a : false,
|
16948
17016
|
isCacheReloaded: false, // <- TODO: Allow to pass
|
16949
17017
|
}; /* <- TODO: ` satisfies PrepareAndScrapeOptions` */
|
16950
17018
|
const fs = $provideFilesystemForNode();
|
@@ -16974,9 +17042,10 @@ class Wizard {
|
|
16974
17042
|
* 3) As a string
|
16975
17043
|
*
|
16976
17044
|
* @param pipelineSource
|
17045
|
+
* @param options
|
16977
17046
|
*/
|
16978
|
-
async getCompiledBook(pipelineSource) {
|
16979
|
-
const tools = await this.getExecutionTools();
|
17047
|
+
async getCompiledBook(pipelineSource, options = {}) {
|
17048
|
+
const tools = await this.getExecutionTools(options);
|
16980
17049
|
return /* not await */ $getCompiledBook(tools, pipelineSource);
|
16981
17050
|
}
|
16982
17051
|
}
|