@promptbook/wizard 0.100.0-3 → 0.100.0-5

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.
@@ -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-2`).
18
+ * It follows semantic versioning (e.g., `0.100.0-4`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/wizard",
3
- "version": "0.100.0-3",
3
+ "version": "0.100.0-5",
4
4
  "description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -95,7 +95,7 @@
95
95
  "module": "./esm/index.es.js",
96
96
  "typings": "./esm/typings/src/_packages/wizard.index.d.ts",
97
97
  "peerDependencies": {
98
- "@promptbook/core": "0.100.0-3"
98
+ "@promptbook/core": "0.100.0-5"
99
99
  },
100
100
  "dependencies": {
101
101
  "@ai-sdk/deepseek": "0.1.6",
package/umd/index.umd.js CHANGED
@@ -49,7 +49,7 @@
49
49
  * @generated
50
50
  * @see https://github.com/webgptorg/promptbook
51
51
  */
52
- const PROMPTBOOK_ENGINE_VERSION = '0.100.0-3';
52
+ const PROMPTBOOK_ENGINE_VERSION = '0.100.0-5';
53
53
  /**
54
54
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
55
55
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -5974,7 +5974,23 @@
5974
5974
  .join('/') +
5975
5975
  '.' +
5976
5976
  extension;
5977
- await promises.mkdir(path.dirname(cacheFilename), { recursive: true });
5977
+ // Note: Try to create cache directory, but don't fail if filesystem has issues
5978
+ try {
5979
+ await promises.mkdir(path.dirname(cacheFilename), { recursive: true });
5980
+ }
5981
+ catch (error) {
5982
+ // Note: If we can't create cache directory, continue without it
5983
+ // This handles read-only filesystems, permission issues, and missing parent directories
5984
+ if (error instanceof Error && (error.message.includes('EROFS') ||
5985
+ error.message.includes('read-only') ||
5986
+ error.message.includes('EACCES') ||
5987
+ error.message.includes('EPERM') ||
5988
+ error.message.includes('ENOENT'))) ;
5989
+ else {
5990
+ // Re-throw other unexpected errors
5991
+ throw error;
5992
+ }
5993
+ }
5978
5994
  let isDestroyed = true;
5979
5995
  const fileHandler = {
5980
5996
  filename: cacheFilename,
@@ -7738,7 +7754,23 @@
7738
7754
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
7739
7755
  const rootDirname = path.join(process.cwd(), DEFAULT_DOWNLOAD_CACHE_DIRNAME);
7740
7756
  const filepath = path.join(...nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */), `${basename.substring(0, MAX_FILENAME_LENGTH)}.${mimeTypeToExtension(mimeType)}`);
7741
- await tools.fs.mkdir(path.dirname(path.join(rootDirname, filepath)), { recursive: true });
7757
+ // Note: Try to create cache directory, but don't fail if filesystem has issues
7758
+ try {
7759
+ await tools.fs.mkdir(path.dirname(path.join(rootDirname, filepath)), { recursive: true });
7760
+ }
7761
+ catch (error) {
7762
+ // Note: If we can't create cache directory, we'll handle it when trying to write the file
7763
+ // This handles read-only filesystems, permission issues, and missing parent directories
7764
+ if (error instanceof Error && (error.message.includes('EROFS') ||
7765
+ error.message.includes('read-only') ||
7766
+ error.message.includes('EACCES') ||
7767
+ error.message.includes('EPERM') ||
7768
+ error.message.includes('ENOENT'))) ;
7769
+ else {
7770
+ // Re-throw other unexpected errors
7771
+ throw error;
7772
+ }
7773
+ }
7742
7774
  const fileContent = Buffer.from(await response.arrayBuffer());
7743
7775
  if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
7744
7776
  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.`);
@@ -7753,7 +7785,8 @@
7753
7785
  if (error instanceof Error && (error.message.includes('EROFS') ||
7754
7786
  error.message.includes('read-only') ||
7755
7787
  error.message.includes('EACCES') ||
7756
- error.message.includes('EPERM'))) {
7788
+ error.message.includes('EPERM') ||
7789
+ error.message.includes('ENOENT'))) {
7757
7790
  // Return a handler that works directly with the downloaded content
7758
7791
  return {
7759
7792
  source: name,
@@ -10860,7 +10893,8 @@
10860
10893
  if (error instanceof Error && (error.message.includes('EROFS') ||
10861
10894
  error.message.includes('read-only') ||
10862
10895
  error.message.includes('EACCES') ||
10863
- error.message.includes('EPERM'))) ;
10896
+ error.message.includes('EPERM') ||
10897
+ error.message.includes('ENOENT'))) ;
10864
10898
  else {
10865
10899
  // Re-throw other unexpected errors
10866
10900
  throw error;
@@ -11163,7 +11197,8 @@
11163
11197
  if (error instanceof Error && (error.message.includes('EROFS') ||
11164
11198
  error.message.includes('read-only') ||
11165
11199
  error.message.includes('EACCES') ||
11166
- error.message.includes('EPERM'))) ;
11200
+ error.message.includes('EPERM') ||
11201
+ error.message.includes('ENOENT'))) ;
11167
11202
  else {
11168
11203
  // Re-throw other unexpected errors
11169
11204
  throw error;
@@ -11909,8 +11944,27 @@
11909
11944
  throw new UnexpectedError(`The "${key}" you want to store in JSON file is not serializable as JSON`);
11910
11945
  }
11911
11946
  const fileContent = stringifyPipelineJson(value);
11912
- await promises.mkdir(path.dirname(filename), { recursive: true }); // <- [0]
11913
- await promises.writeFile(filename, fileContent, 'utf-8');
11947
+ // Note: Try to create cache directory and write file, but don't fail if filesystem is read-only or has permission issues
11948
+ try {
11949
+ await promises.mkdir(path.dirname(filename), { recursive: true }); // <- [0]
11950
+ await promises.writeFile(filename, fileContent, 'utf-8');
11951
+ }
11952
+ catch (error) {
11953
+ // Note: If we can't write to cache, silently ignore the error
11954
+ // This handles read-only filesystems, permission issues, and missing parent directories
11955
+ if (error instanceof Error && (error.message.includes('EROFS') ||
11956
+ error.message.includes('read-only') ||
11957
+ error.message.includes('EACCES') ||
11958
+ error.message.includes('EPERM') ||
11959
+ error.message.includes('ENOENT'))) {
11960
+ // Silently ignore filesystem errors - caching is optional
11961
+ return;
11962
+ }
11963
+ else {
11964
+ // Re-throw other unexpected errors
11965
+ throw error;
11966
+ }
11967
+ }
11914
11968
  }
11915
11969
  /**
11916
11970
  * Removes the key/value pair with the given key from the storage, if a key/value pair with the given key exists.
@@ -16790,7 +16844,8 @@
16790
16844
  if (error instanceof Error && (error.message.includes('EROFS') ||
16791
16845
  error.message.includes('read-only') ||
16792
16846
  error.message.includes('EACCES') ||
16793
- error.message.includes('EPERM'))) ;
16847
+ error.message.includes('EPERM') ||
16848
+ error.message.includes('ENOENT'))) ;
16794
16849
  else {
16795
16850
  // Re-throw other unexpected errors
16796
16851
  throw error;