@promptbook/pdf 0.112.0-65 โ†’ 0.112.0-66

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  import { mkdir, rm, readFile } from 'fs/promises';
2
2
  import { spaceTrim as spaceTrim$1 } from 'spacetrim';
3
+ import { posix, basename, join, dirname, isAbsolute } from 'path';
3
4
  import { SHA256 } from 'crypto-js';
4
5
  import hexEncoder from 'crypto-js/enc-hex';
5
- import { basename, join, dirname, isAbsolute } from 'path';
6
6
  import { randomBytes } from 'crypto';
7
7
  import { Subject } from 'rxjs';
8
8
  import { forTime } from 'waitasecond';
@@ -24,7 +24,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
24
24
  * @generated
25
25
  * @see https://github.com/webgptorg/promptbook
26
26
  */
27
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-65';
27
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-66';
28
28
  /**
29
29
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
30
30
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
@@ -975,6 +975,29 @@ function saturate(amount) {
975
975
  }
976
976
  // TODO: Maybe implement by mix+hsl
977
977
 
978
+ /**
979
+ * Relative directory name without the `./` prefix for Git ignore rules and glob patterns.
980
+ *
981
+ * @private internal utility for Promptbook-owned temp files
982
+ */
983
+ const PROMPTBOOK_TEMP_DIRECTORY_NAME = '.promptbook';
984
+ /**
985
+ * Builds one project-relative path inside the shared Promptbook working directory.
986
+ *
987
+ * @private internal utility for Promptbook-owned temp files
988
+ */
989
+ function getPromptbookTempPath(...pathSegments) {
990
+ return `./${getPromptbookTempPosixPath(...pathSegments)}`;
991
+ }
992
+ /**
993
+ * Builds one POSIX path fragment inside the shared Promptbook working directory for globs and generated text files.
994
+ *
995
+ * @private internal utility for Promptbook-owned temp files
996
+ */
997
+ function getPromptbookTempPosixPath(...pathSegments) {
998
+ return posix.join(PROMPTBOOK_TEMP_DIRECTORY_NAME, ...pathSegments);
999
+ }
1000
+
978
1001
  /**
979
1002
  * Returns the same value that is passed as argument.
980
1003
  * No side effects.
@@ -1150,7 +1173,6 @@ const DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [๐Ÿคนโ€โ™‚๏ธ]
1150
1173
  */
1151
1174
  const DEFAULT_MAX_EXECUTION_ATTEMPTS = 7; // <- TODO: [๐Ÿคนโ€โ™‚๏ธ]
1152
1175
  // <- TODO: [๐Ÿ•] Make also `AGENTS_DIRNAME_ALTERNATIVES`
1153
- // TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
1154
1176
  /**
1155
1177
  * Where to store the temporary downloads
1156
1178
  *
@@ -1158,7 +1180,15 @@ const DEFAULT_MAX_EXECUTION_ATTEMPTS = 7; // <- TODO: [๐Ÿคนโ€โ™‚๏ธ]
1158
1180
  *
1159
1181
  * @public exported from `@promptbook/core`
1160
1182
  */
1161
- const DEFAULT_DOWNLOAD_CACHE_DIRNAME = './.promptbook/download-cache';
1183
+ const DEFAULT_DOWNLOAD_CACHE_DIRNAME = getPromptbookTempPath('download-cache');
1184
+ /**
1185
+ * Where to store the cache of executions for promptbook CLI
1186
+ *
1187
+ * Note: When the folder does not exist, it is created recursively
1188
+ *
1189
+ * @public exported from `@promptbook/core`
1190
+ */
1191
+ getPromptbookTempPath('execution-cache');
1162
1192
  /**
1163
1193
  * Where to store the scrape cache
1164
1194
  *
@@ -1166,7 +1196,7 @@ const DEFAULT_DOWNLOAD_CACHE_DIRNAME = './.promptbook/download-cache';
1166
1196
  *
1167
1197
  * @public exported from `@promptbook/core`
1168
1198
  */
1169
- const DEFAULT_SCRAPE_CACHE_DIRNAME = './.promptbook/scrape-cache';
1199
+ const DEFAULT_SCRAPE_CACHE_DIRNAME = getPromptbookTempPath('scrape-cache');
1170
1200
  // <- TODO: [๐Ÿงœโ€โ™‚๏ธ]
1171
1201
  /**
1172
1202
  * Default settings for parsing and generating CSV files in Promptbook.