@promptbook/cli 0.100.0-3 → 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.
@@ -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-3`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/cli",
3
- "version": "0.100.0-3",
3
+ "version": "0.100.0-4",
4
4
  "description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
5
5
  "private": false,
6
6
  "sideEffects": false,
package/umd/index.umd.js CHANGED
@@ -57,7 +57,7 @@
57
57
  * @generated
58
58
  * @see https://github.com/webgptorg/promptbook
59
59
  */
60
- const PROMPTBOOK_ENGINE_VERSION = '0.100.0-3';
60
+ const PROMPTBOOK_ENGINE_VERSION = '0.100.0-4';
61
61
  /**
62
62
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
63
63
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2208,8 +2208,27 @@
2208
2208
  throw new UnexpectedError(`The "${key}" you want to store in JSON file is not serializable as JSON`);
2209
2209
  }
2210
2210
  const fileContent = stringifyPipelineJson(value);
2211
- await promises.mkdir(path.dirname(filename), { recursive: true }); // <- [0]
2212
- await promises.writeFile(filename, fileContent, 'utf-8');
2211
+ // Note: Try to create cache directory and write file, but don't fail if filesystem is read-only or has permission issues
2212
+ try {
2213
+ await promises.mkdir(path.dirname(filename), { recursive: true }); // <- [0]
2214
+ await promises.writeFile(filename, fileContent, 'utf-8');
2215
+ }
2216
+ catch (error) {
2217
+ // Note: If we can't write to cache, silently ignore the error
2218
+ // This handles read-only filesystems, permission issues, and missing parent directories
2219
+ if (error instanceof Error && (error.message.includes('EROFS') ||
2220
+ error.message.includes('read-only') ||
2221
+ error.message.includes('EACCES') ||
2222
+ error.message.includes('EPERM') ||
2223
+ error.message.includes('ENOENT'))) {
2224
+ // Silently ignore filesystem errors - caching is optional
2225
+ return;
2226
+ }
2227
+ else {
2228
+ // Re-throw other unexpected errors
2229
+ throw error;
2230
+ }
2231
+ }
2213
2232
  }
2214
2233
  /**
2215
2234
  * Removes the key/value pair with the given key from the storage, if a key/value pair with the given key exists.
@@ -7716,7 +7735,23 @@
7716
7735
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
7717
7736
  const rootDirname = path.join(process.cwd(), DEFAULT_DOWNLOAD_CACHE_DIRNAME);
7718
7737
  const filepath = path.join(...nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */), `${basename.substring(0, MAX_FILENAME_LENGTH)}.${mimeTypeToExtension(mimeType)}`);
7719
- await tools.fs.mkdir(path.dirname(path.join(rootDirname, filepath)), { recursive: true });
7738
+ // Note: Try to create cache directory, but don't fail if filesystem has issues
7739
+ try {
7740
+ await tools.fs.mkdir(path.dirname(path.join(rootDirname, filepath)), { recursive: true });
7741
+ }
7742
+ catch (error) {
7743
+ // Note: If we can't create cache directory, we'll handle it when trying to write the file
7744
+ // This handles read-only filesystems, permission issues, and missing parent directories
7745
+ if (error instanceof Error && (error.message.includes('EROFS') ||
7746
+ error.message.includes('read-only') ||
7747
+ error.message.includes('EACCES') ||
7748
+ error.message.includes('EPERM') ||
7749
+ error.message.includes('ENOENT'))) ;
7750
+ else {
7751
+ // Re-throw other unexpected errors
7752
+ throw error;
7753
+ }
7754
+ }
7720
7755
  const fileContent = Buffer.from(await response.arrayBuffer());
7721
7756
  if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
7722
7757
  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.`);
@@ -7731,7 +7766,8 @@
7731
7766
  if (error instanceof Error && (error.message.includes('EROFS') ||
7732
7767
  error.message.includes('read-only') ||
7733
7768
  error.message.includes('EACCES') ||
7734
- error.message.includes('EPERM'))) {
7769
+ error.message.includes('EPERM') ||
7770
+ error.message.includes('ENOENT'))) {
7735
7771
  // Return a handler that works directly with the downloaded content
7736
7772
  return {
7737
7773
  source: name,
@@ -13377,7 +13413,8 @@
13377
13413
  if (error instanceof Error && (error.message.includes('EROFS') ||
13378
13414
  error.message.includes('read-only') ||
13379
13415
  error.message.includes('EACCES') ||
13380
- error.message.includes('EPERM'))) ;
13416
+ error.message.includes('EPERM') ||
13417
+ error.message.includes('ENOENT'))) ;
13381
13418
  else {
13382
13419
  // Re-throw other unexpected errors
13383
13420
  throw error;
@@ -18677,7 +18714,23 @@
18677
18714
  .join('/') +
18678
18715
  '.' +
18679
18716
  extension;
18680
- await promises.mkdir(path.dirname(cacheFilename), { recursive: true });
18717
+ // Note: Try to create cache directory, but don't fail if filesystem has issues
18718
+ try {
18719
+ await promises.mkdir(path.dirname(cacheFilename), { recursive: true });
18720
+ }
18721
+ catch (error) {
18722
+ // Note: If we can't create cache directory, continue without it
18723
+ // This handles read-only filesystems, permission issues, and missing parent directories
18724
+ if (error instanceof Error && (error.message.includes('EROFS') ||
18725
+ error.message.includes('read-only') ||
18726
+ error.message.includes('EACCES') ||
18727
+ error.message.includes('EPERM') ||
18728
+ error.message.includes('ENOENT'))) ;
18729
+ else {
18730
+ // Re-throw other unexpected errors
18731
+ throw error;
18732
+ }
18733
+ }
18681
18734
  let isDestroyed = true;
18682
18735
  const fileHandler = {
18683
18736
  filename: cacheFilename,
@@ -19537,7 +19590,8 @@
19537
19590
  if (error instanceof Error && (error.message.includes('EROFS') ||
19538
19591
  error.message.includes('read-only') ||
19539
19592
  error.message.includes('EACCES') ||
19540
- error.message.includes('EPERM'))) ;
19593
+ error.message.includes('EPERM') ||
19594
+ error.message.includes('ENOENT'))) ;
19541
19595
  else {
19542
19596
  // Re-throw other unexpected errors
19543
19597
  throw error;
@@ -19840,7 +19894,8 @@
19840
19894
  if (error instanceof Error && (error.message.includes('EROFS') ||
19841
19895
  error.message.includes('read-only') ||
19842
19896
  error.message.includes('EACCES') ||
19843
- error.message.includes('EPERM'))) ;
19897
+ error.message.includes('EPERM') ||
19898
+ error.message.includes('ENOENT'))) ;
19844
19899
  else {
19845
19900
  // Re-throw other unexpected errors
19846
19901
  throw error;