@promptbook/core 0.100.0-2 → 0.100.0-4
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/esm/index.es.js +20 -3
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/esm/typings/src/wizard/wizard.d.ts +14 -4
- package/package.json +1 -1
- package/umd/index.umd.js +20 -3
- package/umd/index.umd.js.map +1 -1
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.100.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.100.0-3`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
|
@@ -6,6 +6,15 @@ import type { InputParameters } from '../types/typeAliases';
|
|
|
6
6
|
import type { string_filename } from '../types/typeAliases';
|
|
7
7
|
import type { string_parameter_value } from '../types/typeAliases';
|
|
8
8
|
import type { string_pipeline_url } from '../types/typeAliases';
|
|
9
|
+
/**
|
|
10
|
+
* Options for wizard methods
|
|
11
|
+
*/
|
|
12
|
+
interface WizardOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Whether to enable verbose logging
|
|
15
|
+
*/
|
|
16
|
+
isVerbose?: boolean;
|
|
17
|
+
}
|
|
9
18
|
/**
|
|
10
19
|
* Wizard for simple usage of the Promptbook
|
|
11
20
|
* Look at `wizard` for more details
|
|
@@ -26,7 +35,7 @@ declare class Wizard {
|
|
|
26
35
|
*
|
|
27
36
|
* Note: This works similar to the `ptbk run` command
|
|
28
37
|
*/
|
|
29
|
-
execute(book: string_pipeline_url | string_filename | PipelineString, inputParameters: InputParameters): Promise<{
|
|
38
|
+
execute(book: string_pipeline_url | string_filename | PipelineString, inputParameters: InputParameters, options?: WizardOptions): Promise<{
|
|
30
39
|
/**
|
|
31
40
|
* Simple result of the execution
|
|
32
41
|
*/
|
|
@@ -36,9 +45,9 @@ declare class Wizard {
|
|
|
36
45
|
/**
|
|
37
46
|
* Provides the tools automatically for the Node.js environment
|
|
38
47
|
*
|
|
39
|
-
* @param
|
|
48
|
+
* @param options
|
|
40
49
|
*/
|
|
41
|
-
getExecutionTools(): Promise<Required<Pick<ExecutionTools, 'fs' | 'fetch'>>>;
|
|
50
|
+
getExecutionTools(options?: WizardOptions): Promise<Required<Pick<ExecutionTools, 'fs' | 'fetch'>>>;
|
|
42
51
|
/**
|
|
43
52
|
* Load book from the source
|
|
44
53
|
*
|
|
@@ -49,8 +58,9 @@ declare class Wizard {
|
|
|
49
58
|
* 3) As a string
|
|
50
59
|
*
|
|
51
60
|
* @param pipelineSource
|
|
61
|
+
* @param options
|
|
52
62
|
*/
|
|
53
|
-
getCompiledBook(pipelineSource: string_filename | string_pipeline_url | PipelineString): Promise<PipelineJson>;
|
|
63
|
+
getCompiledBook(pipelineSource: string_filename | string_pipeline_url | PipelineString, options?: WizardOptions): Promise<PipelineJson>;
|
|
54
64
|
}
|
|
55
65
|
/**
|
|
56
66
|
* Wizard for simple usage of the Promptbook
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* @generated
|
|
28
28
|
* @see https://github.com/webgptorg/promptbook
|
|
29
29
|
*/
|
|
30
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-
|
|
30
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-4';
|
|
31
31
|
/**
|
|
32
32
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
33
33
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -5920,7 +5920,23 @@
|
|
|
5920
5920
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
5921
5921
|
const rootDirname = path.join(process.cwd(), DEFAULT_DOWNLOAD_CACHE_DIRNAME);
|
|
5922
5922
|
const filepath = path.join(...nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */), `${basename.substring(0, MAX_FILENAME_LENGTH)}.${mimeTypeToExtension(mimeType)}`);
|
|
5923
|
-
|
|
5923
|
+
// Note: Try to create cache directory, but don't fail if filesystem has issues
|
|
5924
|
+
try {
|
|
5925
|
+
await tools.fs.mkdir(path.dirname(path.join(rootDirname, filepath)), { recursive: true });
|
|
5926
|
+
}
|
|
5927
|
+
catch (error) {
|
|
5928
|
+
// Note: If we can't create cache directory, we'll handle it when trying to write the file
|
|
5929
|
+
// This handles read-only filesystems, permission issues, and missing parent directories
|
|
5930
|
+
if (error instanceof Error && (error.message.includes('EROFS') ||
|
|
5931
|
+
error.message.includes('read-only') ||
|
|
5932
|
+
error.message.includes('EACCES') ||
|
|
5933
|
+
error.message.includes('EPERM') ||
|
|
5934
|
+
error.message.includes('ENOENT'))) ;
|
|
5935
|
+
else {
|
|
5936
|
+
// Re-throw other unexpected errors
|
|
5937
|
+
throw error;
|
|
5938
|
+
}
|
|
5939
|
+
}
|
|
5924
5940
|
const fileContent = Buffer.from(await response.arrayBuffer());
|
|
5925
5941
|
if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
|
|
5926
5942
|
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.`);
|
|
@@ -5935,7 +5951,8 @@
|
|
|
5935
5951
|
if (error instanceof Error && (error.message.includes('EROFS') ||
|
|
5936
5952
|
error.message.includes('read-only') ||
|
|
5937
5953
|
error.message.includes('EACCES') ||
|
|
5938
|
-
error.message.includes('EPERM')
|
|
5954
|
+
error.message.includes('EPERM') ||
|
|
5955
|
+
error.message.includes('ENOENT'))) {
|
|
5939
5956
|
// Return a handler that works directly with the downloaded content
|
|
5940
5957
|
return {
|
|
5941
5958
|
source: name,
|