@promptbook/legacy-documents 0.100.0-1 โ†’ 0.100.0-2

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.
@@ -138,9 +138,6 @@ export declare const SMALL_NUMBER = 0.001;
138
138
  /**
139
139
  * Timeout for the connections in milliseconds
140
140
  *
141
- * Note: Increased from 7 seconds to 30 seconds to accommodate OAuth flows
142
- * like Facebook login which may require user interaction and redirects
143
- *
144
141
  * @private within the repository - too low-level in comparison with other `MAX_...`
145
142
  */
146
143
  export declare const CONNECTION_TIMEOUT_MS: number;
@@ -150,13 +147,6 @@ export declare const CONNECTION_TIMEOUT_MS: number;
150
147
  * @private within the repository - too low-level in comparison with other `MAX_...`
151
148
  */
152
149
  export declare const CONNECTION_RETRIES_LIMIT = 5;
153
- /**
154
- * Timeout specifically for OAuth authentication flows in milliseconds
155
- * OAuth flows typically require more time due to user interaction and redirects
156
- *
157
- * @private within the repository - too low-level in comparison with other `MAX_...`
158
- */
159
- export declare const OAUTH_TIMEOUT_MS: number;
160
150
  /**
161
151
  * Short time interval to prevent race conditions in milliseconds
162
152
  *
@@ -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-0`).
18
+ * It follows semantic versioning (e.g., `0.100.0-1`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/legacy-documents",
3
- "version": "0.100.0-1",
3
+ "version": "0.100.0-2",
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/legacy-documents.index.d.ts",
97
97
  "peerDependencies": {
98
- "@promptbook/core": "0.100.0-1"
98
+ "@promptbook/core": "0.100.0-2"
99
99
  },
100
100
  "dependencies": {
101
101
  "colors": "1.4.0",
package/umd/index.umd.js CHANGED
@@ -26,7 +26,7 @@
26
26
  * @generated
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- const PROMPTBOOK_ENGINE_VERSION = '0.100.0-1';
29
+ const PROMPTBOOK_ENGINE_VERSION = '0.100.0-2';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
32
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
@@ -3651,7 +3651,36 @@
3651
3651
  if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
3652
3652
  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.`);
3653
3653
  }
3654
- await tools.fs.writeFile(path.join(rootDirname, filepath), fileContent);
3654
+ // Note: Try to cache the downloaded file, but don't fail if the filesystem is read-only
3655
+ try {
3656
+ await tools.fs.writeFile(path.join(rootDirname, filepath), fileContent);
3657
+ }
3658
+ catch (error) {
3659
+ // Note: If we can't write to cache, we'll process the file directly from memory
3660
+ // This handles read-only filesystems like Vercel
3661
+ if (error instanceof Error && (error.message.includes('EROFS') ||
3662
+ error.message.includes('read-only') ||
3663
+ error.message.includes('EACCES') ||
3664
+ error.message.includes('EPERM'))) {
3665
+ // Return a handler that works directly with the downloaded content
3666
+ return {
3667
+ source: name,
3668
+ filename: null,
3669
+ url,
3670
+ mimeType,
3671
+ async asJson() {
3672
+ return JSON.parse(fileContent.toString('utf-8'));
3673
+ },
3674
+ async asText() {
3675
+ return fileContent.toString('utf-8');
3676
+ },
3677
+ };
3678
+ }
3679
+ else {
3680
+ // Re-throw other unexpected errors
3681
+ throw error;
3682
+ }
3683
+ }
3655
3684
  // TODO: [๐Ÿ’ต] Check the file security
3656
3685
  // TODO: [๐Ÿงน][๐Ÿง ] Delete the file after the scraping is done
3657
3686
  return makeKnowledgeSourceHandler({ name, knowledgeSourceContent: filepath }, tools, {