@promptbook/remote-server 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/remote-server",
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/remote-server.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
  "colors": "1.4.0",
package/umd/index.umd.js CHANGED
@@ -48,7 +48,7 @@
48
48
  * @generated
49
49
  * @see https://github.com/webgptorg/promptbook
50
50
  */
51
- const PROMPTBOOK_ENGINE_VERSION = '0.100.0-3';
51
+ const PROMPTBOOK_ENGINE_VERSION = '0.100.0-5';
52
52
  /**
53
53
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
54
54
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -3837,7 +3837,23 @@
3837
3837
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
3838
3838
  const rootDirname = path.join(process.cwd(), DEFAULT_DOWNLOAD_CACHE_DIRNAME);
3839
3839
  const filepath = path.join(...nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */), `${basename.substring(0, MAX_FILENAME_LENGTH)}.${mimeTypeToExtension(mimeType)}`);
3840
- await tools.fs.mkdir(path.dirname(path.join(rootDirname, filepath)), { recursive: true });
3840
+ // Note: Try to create cache directory, but don't fail if filesystem has issues
3841
+ try {
3842
+ await tools.fs.mkdir(path.dirname(path.join(rootDirname, filepath)), { recursive: true });
3843
+ }
3844
+ catch (error) {
3845
+ // Note: If we can't create cache directory, we'll handle it when trying to write the file
3846
+ // This handles read-only filesystems, permission issues, and missing parent directories
3847
+ if (error instanceof Error && (error.message.includes('EROFS') ||
3848
+ error.message.includes('read-only') ||
3849
+ error.message.includes('EACCES') ||
3850
+ error.message.includes('EPERM') ||
3851
+ error.message.includes('ENOENT'))) ;
3852
+ else {
3853
+ // Re-throw other unexpected errors
3854
+ throw error;
3855
+ }
3856
+ }
3841
3857
  const fileContent = Buffer.from(await response.arrayBuffer());
3842
3858
  if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
3843
3859
  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.`);
@@ -3852,7 +3868,8 @@
3852
3868
  if (error instanceof Error && (error.message.includes('EROFS') ||
3853
3869
  error.message.includes('read-only') ||
3854
3870
  error.message.includes('EACCES') ||
3855
- error.message.includes('EPERM'))) {
3871
+ error.message.includes('EPERM') ||
3872
+ error.message.includes('ENOENT'))) {
3856
3873
  // Return a handler that works directly with the downloaded content
3857
3874
  return {
3858
3875
  source: name,