@promptbook/core 0.74.0-0 → 0.74.0-12

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.
Files changed (56) hide show
  1. package/README.md +135 -30
  2. package/esm/index.es.js +427 -410
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/anthropic-claude.index.d.ts +2 -2
  5. package/esm/typings/src/_packages/azure-openai.index.d.ts +2 -2
  6. package/esm/typings/src/_packages/browser.index.d.ts +2 -2
  7. package/esm/typings/src/_packages/cli.index.d.ts +2 -2
  8. package/esm/typings/src/_packages/core.index.d.ts +7 -3
  9. package/esm/typings/src/_packages/documents.index.d.ts +2 -2
  10. package/esm/typings/src/_packages/execute-javascript.index.d.ts +2 -2
  11. package/esm/typings/src/_packages/fake-llm.index.d.ts +2 -2
  12. package/esm/typings/src/_packages/langtail.index.d.ts +2 -2
  13. package/esm/typings/src/_packages/legacy-documents.index.d.ts +2 -2
  14. package/esm/typings/src/_packages/markdown-utils.index.d.ts +2 -2
  15. package/esm/typings/src/_packages/node.index.d.ts +2 -2
  16. package/esm/typings/src/_packages/openai.index.d.ts +2 -2
  17. package/esm/typings/src/_packages/pdf.index.d.ts +2 -2
  18. package/esm/typings/src/_packages/remote-client.index.d.ts +2 -2
  19. package/esm/typings/src/_packages/remote-server.index.d.ts +2 -2
  20. package/esm/typings/src/_packages/utils.index.d.ts +2 -2
  21. package/esm/typings/src/_packages/website-crawler.index.d.ts +2 -2
  22. package/esm/typings/src/cli/cli-commands/make.d.ts +0 -1
  23. package/esm/typings/src/cli/cli-commands/run.d.ts +14 -0
  24. package/esm/typings/src/cli/promptbookCli.d.ts +1 -0
  25. package/esm/typings/src/cli/test/ptbk.d.ts +5 -2
  26. package/esm/typings/src/collection/collectionToJson.test.d.ts +1 -1
  27. package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -1
  28. package/esm/typings/src/commands/BOOK_VERSION/BookVersionCommand.d.ts +11 -0
  29. package/esm/typings/src/commands/BOOK_VERSION/bookVersionCommandParser.d.ts +9 -0
  30. package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +2 -2
  31. package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -1
  32. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
  33. package/esm/typings/src/commands/index.d.ts +1 -1
  34. package/esm/typings/src/config.d.ts +6 -0
  35. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +3 -3
  36. package/esm/typings/src/conversion/pipelineStringToJson.d.ts +2 -2
  37. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +2 -2
  38. package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
  39. package/esm/typings/src/conversion/validation/_importPipeline.d.ts +7 -7
  40. package/esm/typings/src/formats/_common/FormatDefinition.d.ts +1 -1
  41. package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +1 -1
  42. package/esm/typings/src/storage/blackhole/BlackholeStorage.d.ts +33 -0
  43. package/esm/typings/src/storage/memory/MemoryStorage.d.ts +1 -1
  44. package/esm/typings/src/storage/{memory/utils → utils}/PrefixStorage.d.ts +1 -1
  45. package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +6 -4
  46. package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -1
  47. package/esm/typings/src/types/Prompt.d.ts +1 -1
  48. package/esm/typings/src/types/typeAliases.d.ts +2 -2
  49. package/esm/typings/src/version.d.ts +13 -2
  50. package/package.json +1 -1
  51. package/umd/index.umd.js +430 -410
  52. package/umd/index.umd.js.map +1 -1
  53. package/esm/typings/src/commands/PROMPTBOOK_VERSION/PromptbookVersionCommand.d.ts +0 -11
  54. package/esm/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommandParser.d.ts +0 -9
  55. /package/esm/typings/src/commands/{PROMPTBOOK_VERSION/promptbookVersionCommand.test.d.ts → BOOK_VERSION/bookVersionCommand.test.d.ts} +0 -0
  56. /package/esm/typings/src/storage/{memory → local-storage}/utils/makePromptbookStorageFromWebStorage.d.ts +0 -0
package/umd/index.umd.js CHANGED
@@ -14,10 +14,20 @@
14
14
 
15
15
  // ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
16
16
  /**
17
- * The version of the Promptbook library
17
+ * The version of the Book language
18
+ *
19
+ * @see https://github.com/webgptorg/book
20
+ */
21
+ var BOOK_LANGUAGE_VERSION = '1.0.0';
22
+ /**
23
+ * The version of the Promptbook engine
24
+ *
25
+ * @see https://github.com/webgptorg/promptbook
26
+ */
27
+ var PROMPTBOOK_ENGINE_VERSION = '0.74.0-11';
28
+ /**
29
+ * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
18
30
  */
19
- var PROMPTBOOK_VERSION = '0.73.0';
20
- // TODO: [main] !!!! List here all the versions and annotate + put into script
21
31
 
22
32
  /*! *****************************************************************************
23
33
  Copyright (c) Microsoft Corporation.
@@ -211,13 +221,13 @@
211
221
  /**
212
222
  * Converts promptbook in JSON format to string format
213
223
  *
214
- * @param pipelineJson Promptbook in JSON format (.ptbk.json)
215
- * @returns Promptbook in string format (.ptbk.md)
224
+ * @param pipelineJson Promptbook in JSON format (.book.json)
225
+ * @returns Promptbook in string format (.book.md)
216
226
  * @public exported from `@promptbook/core`
217
227
  */
218
228
  function pipelineJsonToString(pipelineJson) {
219
229
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
220
- var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, promptbookVersion = pipelineJson.promptbookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, templates = pipelineJson.templates;
230
+ var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, templates = pipelineJson.templates;
221
231
  var pipelineString = "# ".concat(title);
222
232
  if (description) {
223
233
  pipelineString += '\n\n';
@@ -227,8 +237,10 @@
227
237
  if (pipelineUrl) {
228
238
  commands.push("PIPELINE URL ".concat(pipelineUrl));
229
239
  }
230
- commands.push("PROMPTBOOK VERSION ".concat(promptbookVersion));
231
- // TODO: [main] !!! This increase size of the bundle and is probbably not necessary
240
+ if (bookVersion !== "undefined") {
241
+ commands.push("BOOK VERSION ".concat(bookVersion));
242
+ }
243
+ // TODO: [main] !!!!!! This increase size of the bundle and is probbably not necessary
232
244
  pipelineString = prettifyMarkdown(pipelineString);
233
245
  try {
234
246
  for (var _g = __values(parameters.filter(function (_a) {
@@ -408,7 +420,7 @@
408
420
  * TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
409
421
  * TODO: [🏛] Maybe make some markdown builder
410
422
  * TODO: [🏛] Escape all
411
- * TODO: [🧠] Should be in generated .ptbk.md file GENERATOR_WARNING
423
+ * TODO: [🧠] Should be in generated .book.md file GENERATOR_WARNING
412
424
  */
413
425
 
414
426
  /**
@@ -638,6 +650,13 @@
638
650
  * @public exported from `@promptbook/core`
639
651
  */
640
652
  var CLAIM = "Build responsible, controlled and transparent applications on top of LLM models!";
653
+ // <- TODO: [🐊] Pick the best claim
654
+ /**
655
+ * When the title is not provided, the default title is used
656
+ *
657
+ * @public exported from `@promptbook/core`
658
+ */
659
+ var DEFAULT_TITLE = "Untitled";
641
660
  // <- TODO: [🧠] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
642
661
  /**
643
662
  * The maximum number of iterations for a loops
@@ -877,7 +896,7 @@
877
896
  if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
878
897
  return false;
879
898
  }
880
- // <- TODO: [main] !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
899
+ // <- TODO: [main] !!! Check isValidPromptbookVersion against PROMPTBOOK_ENGINE_VERSIONS
881
900
  return true;
882
901
  }
883
902
 
@@ -977,7 +996,7 @@
977
996
  if (!url.startsWith('https://')) {
978
997
  return false;
979
998
  }
980
- if (!url.endsWith('.ptbk.md')) {
999
+ if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.book.md') || url.endsWith('.ptbk'))) {
981
1000
  return false;
982
1001
  }
983
1002
  if (url.includes('#')) {
@@ -1046,9 +1065,9 @@
1046
1065
  // <- Note: [🚲]
1047
1066
  throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
1048
1067
  }
1049
- if (pipeline.promptbookVersion !== undefined && !isValidPromptbookVersion(pipeline.promptbookVersion)) {
1068
+ if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
1050
1069
  // <- Note: [🚲]
1051
- throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.promptbookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
1070
+ throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.bookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
1052
1071
  }
1053
1072
  // TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
1054
1073
  if (!Array.isArray(pipeline.parameters)) {
@@ -1805,6 +1824,188 @@
1805
1824
  },
1806
1825
  });
1807
1826
 
1827
+ /**
1828
+ * @@@
1829
+ *
1830
+ * @public exported from `@promptbook/utils`
1831
+ */
1832
+ function deepClone(objectValue) {
1833
+ return JSON.parse(JSON.stringify(objectValue));
1834
+ /*
1835
+ TODO: [🧠] Is there a better implementation?
1836
+ > const propertyNames = Object.getOwnPropertyNames(objectValue);
1837
+ > for (const propertyName of propertyNames) {
1838
+ > const value = (objectValue as really_any)[propertyName];
1839
+ > if (value && typeof value === 'object') {
1840
+ > deepClone(value);
1841
+ > }
1842
+ > }
1843
+ > return Object.assign({}, objectValue);
1844
+ */
1845
+ }
1846
+ /**
1847
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
1848
+ */
1849
+
1850
+ /**
1851
+ * Function `addUsage` will add multiple usages into one
1852
+ *
1853
+ * Note: If you provide 0 values, it returns ZERO_USAGE
1854
+ *
1855
+ * @public exported from `@promptbook/core`
1856
+ */
1857
+ function addUsage() {
1858
+ var usageItems = [];
1859
+ for (var _i = 0; _i < arguments.length; _i++) {
1860
+ usageItems[_i] = arguments[_i];
1861
+ }
1862
+ return usageItems.reduce(function (acc, item) {
1863
+ var e_1, _a, e_2, _b;
1864
+ var _c;
1865
+ acc.price.value += ((_c = item.price) === null || _c === void 0 ? void 0 : _c.value) || 0;
1866
+ try {
1867
+ for (var _d = __values(Object.keys(acc.input)), _e = _d.next(); !_e.done; _e = _d.next()) {
1868
+ var key = _e.value;
1869
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1870
+ //@ts-ignore
1871
+ if (item.input[key]) {
1872
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1873
+ //@ts-ignore
1874
+ acc.input[key].value += item.input[key].value || 0;
1875
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1876
+ //@ts-ignore
1877
+ if (item.input[key].isUncertain) {
1878
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1879
+ //@ts-ignore
1880
+ acc.input[key].isUncertain = true;
1881
+ }
1882
+ }
1883
+ }
1884
+ }
1885
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1886
+ finally {
1887
+ try {
1888
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
1889
+ }
1890
+ finally { if (e_1) throw e_1.error; }
1891
+ }
1892
+ try {
1893
+ for (var _f = __values(Object.keys(acc.output)), _g = _f.next(); !_g.done; _g = _f.next()) {
1894
+ var key = _g.value;
1895
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1896
+ //@ts-ignore
1897
+ if (item.output[key]) {
1898
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1899
+ //@ts-ignore
1900
+ acc.output[key].value += item.output[key].value || 0;
1901
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1902
+ //@ts-ignore
1903
+ if (item.output[key].isUncertain) {
1904
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1905
+ //@ts-ignore
1906
+ acc.output[key].isUncertain = true;
1907
+ }
1908
+ }
1909
+ }
1910
+ }
1911
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1912
+ finally {
1913
+ try {
1914
+ if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
1915
+ }
1916
+ finally { if (e_2) throw e_2.error; }
1917
+ }
1918
+ return acc;
1919
+ }, deepClone(ZERO_USAGE));
1920
+ }
1921
+
1922
+ /**
1923
+ * Intercepts LLM tools and counts total usage of the tools
1924
+ *
1925
+ * @param llmTools LLM tools to be intercepted with usage counting
1926
+ * @returns LLM tools with same functionality with added total cost counting
1927
+ * @public exported from `@promptbook/core`
1928
+ */
1929
+ function countTotalUsage(llmTools) {
1930
+ var _this = this;
1931
+ var totalUsage = ZERO_USAGE;
1932
+ var proxyTools = {
1933
+ get title() {
1934
+ // TODO: [🧠] Maybe put here some suffix
1935
+ return llmTools.title;
1936
+ },
1937
+ get description() {
1938
+ // TODO: [🧠] Maybe put here some suffix
1939
+ return llmTools.description;
1940
+ },
1941
+ checkConfiguration: function () {
1942
+ return __awaiter(this, void 0, void 0, function () {
1943
+ return __generator(this, function (_a) {
1944
+ return [2 /*return*/, /* not await */ llmTools.checkConfiguration()];
1945
+ });
1946
+ });
1947
+ },
1948
+ listModels: function () {
1949
+ return /* not await */ llmTools.listModels();
1950
+ },
1951
+ getTotalUsage: function () {
1952
+ // <- Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
1953
+ return totalUsage;
1954
+ },
1955
+ };
1956
+ if (llmTools.callChatModel !== undefined) {
1957
+ proxyTools.callChatModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
1958
+ var promptResult;
1959
+ return __generator(this, function (_a) {
1960
+ switch (_a.label) {
1961
+ case 0: return [4 /*yield*/, llmTools.callChatModel(prompt)];
1962
+ case 1:
1963
+ promptResult = _a.sent();
1964
+ totalUsage = addUsage(totalUsage, promptResult.usage);
1965
+ return [2 /*return*/, promptResult];
1966
+ }
1967
+ });
1968
+ }); };
1969
+ }
1970
+ if (llmTools.callCompletionModel !== undefined) {
1971
+ proxyTools.callCompletionModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
1972
+ var promptResult;
1973
+ return __generator(this, function (_a) {
1974
+ switch (_a.label) {
1975
+ case 0: return [4 /*yield*/, llmTools.callCompletionModel(prompt)];
1976
+ case 1:
1977
+ promptResult = _a.sent();
1978
+ totalUsage = addUsage(totalUsage, promptResult.usage);
1979
+ return [2 /*return*/, promptResult];
1980
+ }
1981
+ });
1982
+ }); };
1983
+ }
1984
+ if (llmTools.callEmbeddingModel !== undefined) {
1985
+ proxyTools.callEmbeddingModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
1986
+ var promptResult;
1987
+ return __generator(this, function (_a) {
1988
+ switch (_a.label) {
1989
+ case 0: return [4 /*yield*/, llmTools.callEmbeddingModel(prompt)];
1990
+ case 1:
1991
+ promptResult = _a.sent();
1992
+ totalUsage = addUsage(totalUsage, promptResult.usage);
1993
+ return [2 /*return*/, promptResult];
1994
+ }
1995
+ });
1996
+ }); };
1997
+ }
1998
+ // <- Note: [🤖]
1999
+ return proxyTools;
2000
+ }
2001
+ /**
2002
+ * TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
2003
+ * TODO: [🧠] Is there some meaningfull way how to test this util
2004
+ * TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
2005
+ * > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
2006
+ * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
2007
+ */
2008
+
1808
2009
  /**
1809
2010
  * This error indicates errors during the execution of the pipeline
1810
2011
  *
@@ -2113,189 +2314,7 @@
2113
2314
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
2114
2315
  */
2115
2316
 
2116
- /**
2117
- * @@@
2118
- *
2119
- * @public exported from `@promptbook/utils`
2120
- */
2121
- function deepClone(objectValue) {
2122
- return JSON.parse(JSON.stringify(objectValue));
2123
- /*
2124
- TODO: [🧠] Is there a better implementation?
2125
- > const propertyNames = Object.getOwnPropertyNames(objectValue);
2126
- > for (const propertyName of propertyNames) {
2127
- > const value = (objectValue as really_any)[propertyName];
2128
- > if (value && typeof value === 'object') {
2129
- > deepClone(value);
2130
- > }
2131
- > }
2132
- > return Object.assign({}, objectValue);
2133
- */
2134
- }
2135
- /**
2136
- * TODO: [🧠] Is there a way how to meaningfully test this utility
2137
- */
2138
-
2139
- /**
2140
- * Function `addUsage` will add multiple usages into one
2141
- *
2142
- * Note: If you provide 0 values, it returns ZERO_USAGE
2143
- *
2144
- * @public exported from `@promptbook/core`
2145
- */
2146
- function addUsage() {
2147
- var usageItems = [];
2148
- for (var _i = 0; _i < arguments.length; _i++) {
2149
- usageItems[_i] = arguments[_i];
2150
- }
2151
- return usageItems.reduce(function (acc, item) {
2152
- var e_1, _a, e_2, _b;
2153
- var _c;
2154
- acc.price.value += ((_c = item.price) === null || _c === void 0 ? void 0 : _c.value) || 0;
2155
- try {
2156
- for (var _d = __values(Object.keys(acc.input)), _e = _d.next(); !_e.done; _e = _d.next()) {
2157
- var key = _e.value;
2158
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2159
- //@ts-ignore
2160
- if (item.input[key]) {
2161
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2162
- //@ts-ignore
2163
- acc.input[key].value += item.input[key].value || 0;
2164
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2165
- //@ts-ignore
2166
- if (item.input[key].isUncertain) {
2167
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2168
- //@ts-ignore
2169
- acc.input[key].isUncertain = true;
2170
- }
2171
- }
2172
- }
2173
- }
2174
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2175
- finally {
2176
- try {
2177
- if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
2178
- }
2179
- finally { if (e_1) throw e_1.error; }
2180
- }
2181
- try {
2182
- for (var _f = __values(Object.keys(acc.output)), _g = _f.next(); !_g.done; _g = _f.next()) {
2183
- var key = _g.value;
2184
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2185
- //@ts-ignore
2186
- if (item.output[key]) {
2187
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2188
- //@ts-ignore
2189
- acc.output[key].value += item.output[key].value || 0;
2190
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2191
- //@ts-ignore
2192
- if (item.output[key].isUncertain) {
2193
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2194
- //@ts-ignore
2195
- acc.output[key].isUncertain = true;
2196
- }
2197
- }
2198
- }
2199
- }
2200
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2201
- finally {
2202
- try {
2203
- if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
2204
- }
2205
- finally { if (e_2) throw e_2.error; }
2206
- }
2207
- return acc;
2208
- }, deepClone(ZERO_USAGE));
2209
- }
2210
-
2211
- /**
2212
- * Intercepts LLM tools and counts total usage of the tools
2213
- *
2214
- * @param llmTools LLM tools to be intercepted with usage counting
2215
- * @returns LLM tools with same functionality with added total cost counting
2216
- * @public exported from `@promptbook/core`
2217
- */
2218
- function countTotalUsage(llmTools) {
2219
- var _this = this;
2220
- var totalUsage = ZERO_USAGE;
2221
- var proxyTools = {
2222
- get title() {
2223
- // TODO: [🧠] Maybe put here some suffix
2224
- return llmTools.title;
2225
- },
2226
- get description() {
2227
- // TODO: [🧠] Maybe put here some suffix
2228
- return llmTools.description;
2229
- },
2230
- checkConfiguration: function () {
2231
- return __awaiter(this, void 0, void 0, function () {
2232
- return __generator(this, function (_a) {
2233
- return [2 /*return*/, /* not await */ llmTools.checkConfiguration()];
2234
- });
2235
- });
2236
- },
2237
- listModels: function () {
2238
- return /* not await */ llmTools.listModels();
2239
- },
2240
- getTotalUsage: function () {
2241
- // <- Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
2242
- return totalUsage;
2243
- },
2244
- };
2245
- if (llmTools.callChatModel !== undefined) {
2246
- proxyTools.callChatModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
2247
- var promptResult;
2248
- return __generator(this, function (_a) {
2249
- switch (_a.label) {
2250
- case 0: return [4 /*yield*/, llmTools.callChatModel(prompt)];
2251
- case 1:
2252
- promptResult = _a.sent();
2253
- totalUsage = addUsage(totalUsage, promptResult.usage);
2254
- return [2 /*return*/, promptResult];
2255
- }
2256
- });
2257
- }); };
2258
- }
2259
- if (llmTools.callCompletionModel !== undefined) {
2260
- proxyTools.callCompletionModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
2261
- var promptResult;
2262
- return __generator(this, function (_a) {
2263
- switch (_a.label) {
2264
- case 0: return [4 /*yield*/, llmTools.callCompletionModel(prompt)];
2265
- case 1:
2266
- promptResult = _a.sent();
2267
- totalUsage = addUsage(totalUsage, promptResult.usage);
2268
- return [2 /*return*/, promptResult];
2269
- }
2270
- });
2271
- }); };
2272
- }
2273
- if (llmTools.callEmbeddingModel !== undefined) {
2274
- proxyTools.callEmbeddingModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
2275
- var promptResult;
2276
- return __generator(this, function (_a) {
2277
- switch (_a.label) {
2278
- case 0: return [4 /*yield*/, llmTools.callEmbeddingModel(prompt)];
2279
- case 1:
2280
- promptResult = _a.sent();
2281
- totalUsage = addUsage(totalUsage, promptResult.usage);
2282
- return [2 /*return*/, promptResult];
2283
- }
2284
- });
2285
- }); };
2286
- }
2287
- // <- Note: [🤖]
2288
- return proxyTools;
2289
- }
2290
- /**
2291
- * TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
2292
- * TODO: [🧠] Is there some meaningfull way how to test this util
2293
- * TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
2294
- * > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
2295
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
2296
- */
2297
-
2298
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
2317
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.book.md"}];
2299
2318
 
2300
2319
  /**
2301
2320
  * This error indicates that the pipeline collection cannot be propperly loaded
@@ -2699,23 +2718,6 @@
2699
2718
  return union;
2700
2719
  }
2701
2720
 
2702
- /**
2703
- * Just marks a place of place where should be something implemented
2704
- * No side effects.
2705
- *
2706
- * Note: It can be usefull suppressing eslint errors of unused variables
2707
- *
2708
- * @param value any values
2709
- * @returns void
2710
- * @private within the repository
2711
- */
2712
- function TODO_USE() {
2713
- var value = [];
2714
- for (var _i = 0; _i < arguments.length; _i++) {
2715
- value[_i] = arguments[_i];
2716
- }
2717
- }
2718
-
2719
2721
  /**
2720
2722
  * This error indicates problems parsing the format value
2721
2723
  *
@@ -2772,22 +2774,12 @@
2772
2774
  formatName: 'CSV',
2773
2775
  aliases: ['SPREADSHEET', 'TABLE'],
2774
2776
  isValid: function (value, settings, schema) {
2775
- // TODO: Implement CSV validation
2776
- TODO_USE(value /* <- TODO: Use value here */);
2777
- TODO_USE(settings /* <- TODO: Use settings here */);
2778
- TODO_USE(schema /* <- TODO: Use schema here */);
2779
2777
  return true;
2780
2778
  },
2781
2779
  canBeValid: function (partialValue, settings, schema) {
2782
- TODO_USE(partialValue /* <- TODO: Use partialValue here */);
2783
- TODO_USE(settings /* <- TODO: Use settings here */);
2784
- TODO_USE(schema /* <- TODO: Use schema here */);
2785
2780
  return true;
2786
2781
  },
2787
2782
  heal: function (value, settings, schema) {
2788
- TODO_USE(value /* <- TODO: Use partialValue here */);
2789
- TODO_USE(settings /* <- TODO: Use settings here */);
2790
- TODO_USE(schema /* <- TODO: Use schema here */);
2791
2783
  throw new Error('Not implemented');
2792
2784
  },
2793
2785
  subvalueDefinitions: [
@@ -2906,20 +2898,12 @@
2906
2898
  formatName: 'JSON',
2907
2899
  mimeType: 'application/json',
2908
2900
  isValid: function (value, settings, schema) {
2909
- TODO_USE(schema /* <- TODO: Use schema here */);
2910
- TODO_USE(settings /* <- TODO: Use settings here */);
2911
2901
  return isValidJsonString(value);
2912
2902
  },
2913
2903
  canBeValid: function (partialValue, settings, schema) {
2914
- TODO_USE(partialValue /* <- TODO: Use partialValue here */);
2915
- TODO_USE(settings /* <- TODO: Use settings here */);
2916
- TODO_USE(schema /* <- TODO: Use schema here */);
2917
2904
  return true;
2918
2905
  },
2919
2906
  heal: function (value, settings, schema) {
2920
- TODO_USE(value /* <- TODO: Use partialValue here */);
2921
- TODO_USE(settings /* <- TODO: Use settings here */);
2922
- TODO_USE(schema /* <- TODO: Use schema here */);
2923
2907
  throw new Error('Not implemented');
2924
2908
  },
2925
2909
  subvalueDefinitions: [],
@@ -3001,21 +2985,12 @@
3001
2985
  formatName: 'XML',
3002
2986
  mimeType: 'application/xml',
3003
2987
  isValid: function (value, settings, schema) {
3004
- TODO_USE(value /* <- TODO: Use value here */);
3005
- TODO_USE(settings /* <- TODO: Use settings here */);
3006
- TODO_USE(schema /* <- TODO: Use schema here */);
3007
2988
  return true;
3008
2989
  },
3009
2990
  canBeValid: function (partialValue, settings, schema) {
3010
- TODO_USE(partialValue /* <- TODO: Use partialValue here */);
3011
- TODO_USE(settings /* <- TODO: Use settings here */);
3012
- TODO_USE(schema /* <- TODO: Use schema here */);
3013
2991
  return true;
3014
2992
  },
3015
2993
  heal: function (value, settings, schema) {
3016
- TODO_USE(value /* <- TODO: Use partialValue here */);
3017
- TODO_USE(settings /* <- TODO: Use settings here */);
3018
- TODO_USE(schema /* <- TODO: Use schema here */);
3019
2994
  throw new Error('Not implemented');
3020
2995
  },
3021
2996
  subvalueDefinitions: [],
@@ -3248,27 +3223,6 @@
3248
3223
  return [input];
3249
3224
  }
3250
3225
 
3251
- /**
3252
- * Just says that the variable is not used but should be kept
3253
- * No side effects.
3254
- *
3255
- * Note: It can be usefull for:
3256
- *
3257
- * 1) Suppressing eager optimization of unused imports
3258
- * 2) Suppressing eslint errors of unused variables in the tests
3259
- * 3) Keeping the type of the variable for type testing
3260
- *
3261
- * @param value any values
3262
- * @returns void
3263
- * @private within the repository
3264
- */
3265
- function keepUnused() {
3266
- var valuesToKeep = [];
3267
- for (var _i = 0; _i < arguments.length; _i++) {
3268
- valuesToKeep[_i] = arguments[_i];
3269
- }
3270
- }
3271
-
3272
3226
  /**
3273
3227
  * Replaces parameters in template with values from parameters object
3274
3228
  *
@@ -3381,10 +3335,12 @@
3381
3335
  * @public exported from `@promptbook/utils`
3382
3336
  */
3383
3337
  function countPages(text) {
3384
- var sentencesPerPage = 5; // Assuming each page has 5 sentences
3385
- var sentences = text.split(/[.!?]+/).filter(function (sentence) { return sentence.trim() !== ''; });
3386
- var pageCount = Math.ceil(sentences.length / sentencesPerPage);
3387
- return pageCount;
3338
+ if (text === '') {
3339
+ return 0;
3340
+ }
3341
+ var pagesByLinesCount = Math.ceil(countLines(text) / 44);
3342
+ var pagesByCharactersCount = Math.ceil(countCharacters(text) / 2772);
3343
+ return Math.max(pagesByLinesCount, pagesByCharactersCount);
3388
3344
  }
3389
3345
 
3390
3346
  /**
@@ -3947,7 +3903,7 @@
3947
3903
  promptTitle: template.title,
3948
3904
  promptMessage: replaceParameters(template.description || '', parameters),
3949
3905
  defaultValue: replaceParameters(preparedContent, parameters),
3950
- // TODO: [🧠] !! Figure out how to define placeholder in .ptbk.md file
3906
+ // TODO: [🧠] !! Figure out how to define placeholder in .book.md file
3951
3907
  placeholder: undefined,
3952
3908
  priority: priority,
3953
3909
  }))];
@@ -4045,7 +4001,6 @@
4045
4001
  $ongoingTemplateResult.$resultString = extractJsonBlock($ongoingTemplateResult.$resultString || '');
4046
4002
  }
4047
4003
  catch (error) {
4048
- keepUnused(error);
4049
4004
  throw new ExpectError(spaceTrim.spaceTrim(function (block) { return "\n Expected valid JSON string\n\n ".concat(block(
4050
4005
  /*<- Note: No need for `pipelineIdentification`, it will be catched and added later */ ''), "\n "); }));
4051
4006
  }
@@ -4223,7 +4178,6 @@
4223
4178
  function getContextForTemplate(template) {
4224
4179
  return __awaiter(this, void 0, void 0, function () {
4225
4180
  return __generator(this, function (_a) {
4226
- TODO_USE(template);
4227
4181
  return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
4228
4182
  });
4229
4183
  });
@@ -4236,11 +4190,9 @@
4236
4190
  */
4237
4191
  function getKnowledgeForTemplate(options) {
4238
4192
  return __awaiter(this, void 0, void 0, function () {
4239
- var preparedPipeline, template;
4193
+ var preparedPipeline;
4240
4194
  return __generator(this, function (_a) {
4241
- preparedPipeline = options.preparedPipeline, template = options.template;
4242
- // TODO: [♨] Implement Better - use real index and keyword search from `template` and {examples}
4243
- TODO_USE(template);
4195
+ preparedPipeline = options.preparedPipeline, options.template;
4244
4196
  return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
4245
4197
  var content = _a.content;
4246
4198
  return "- ".concat(content);
@@ -4257,8 +4209,6 @@
4257
4209
  function getExamplesForTemplate(template) {
4258
4210
  return __awaiter(this, void 0, void 0, function () {
4259
4211
  return __generator(this, function (_a) {
4260
- // TODO: [♨] Implement Better - use real index and keyword search
4261
- TODO_USE(template);
4262
4212
  return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
4263
4213
  });
4264
4214
  });
@@ -4277,13 +4227,13 @@
4277
4227
  switch (_b.label) {
4278
4228
  case 0:
4279
4229
  preparedPipeline = options.preparedPipeline, template = options.template, pipelineIdentification = options.pipelineIdentification;
4280
- return [4 /*yield*/, getContextForTemplate(template)];
4230
+ return [4 /*yield*/, getContextForTemplate()];
4281
4231
  case 1:
4282
4232
  context = _b.sent();
4283
4233
  return [4 /*yield*/, getKnowledgeForTemplate({ preparedPipeline: preparedPipeline, template: template })];
4284
4234
  case 2:
4285
4235
  knowledge = _b.sent();
4286
- return [4 /*yield*/, getExamplesForTemplate(template)];
4236
+ return [4 /*yield*/, getExamplesForTemplate()];
4287
4237
  case 3:
4288
4238
  examples = _b.sent();
4289
4239
  currentDate = new Date().toISOString();
@@ -4518,8 +4468,8 @@
4518
4468
  executionReport = {
4519
4469
  pipelineUrl: preparedPipeline.pipelineUrl,
4520
4470
  title: preparedPipeline.title,
4521
- promptbookUsedVersion: PROMPTBOOK_VERSION,
4522
- promptbookRequestedVersion: preparedPipeline.promptbookVersion,
4471
+ promptbookUsedVersion: PROMPTBOOK_ENGINE_VERSION,
4472
+ promptbookRequestedVersion: preparedPipeline.bookVersion,
4523
4473
  description: preparedPipeline.description,
4524
4474
  promptExecutions: [],
4525
4475
  };
@@ -4868,7 +4818,7 @@
4868
4818
  collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
4869
4819
  _b = createPipelineExecutor;
4870
4820
  _c = {};
4871
- return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.ptbk.md')];
4821
+ return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book.md')];
4872
4822
  case 1:
4873
4823
  preparePersonaExecutor = _b.apply(void 0, [(_c.pipeline = _d.sent(),
4874
4824
  _c.tools = tools,
@@ -5365,16 +5315,13 @@
5365
5315
  function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
5366
5316
  var _a;
5367
5317
  return __awaiter(this, void 0, void 0, function () {
5368
- var sourceContent, name, _b, _c, rootDirname, _d,
5369
- // <- TODO: process.cwd() if running in Node.js
5370
- isVerbose, url, response_1, mimeType, filename_1, fileExtension, mimeType;
5318
+ var sourceContent, name, _b, _c, rootDirname, url, response_1, mimeType, filename_1, fileExtension, mimeType;
5371
5319
  return __generator(this, function (_e) {
5372
5320
  switch (_e.label) {
5373
5321
  case 0:
5374
5322
  sourceContent = knowledgeSource.sourceContent;
5375
5323
  name = knowledgeSource.name;
5376
- _b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c, _d = _b.isVerbose, isVerbose = _d === void 0 ? DEFAULT_IS_VERBOSE : _d;
5377
- TODO_USE(isVerbose);
5324
+ _b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c, _b.isVerbose;
5378
5325
  if (!name) {
5379
5326
  name = sourceContentToName(sourceContent);
5380
5327
  }
@@ -5628,12 +5575,12 @@
5628
5575
  */
5629
5576
  function clonePipeline(pipeline) {
5630
5577
  // Note: Not using spread operator (...) because @@@
5631
- var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, promptbookVersion = pipeline.promptbookVersion, description = pipeline.description, parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
5578
+ var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, bookVersion = pipeline.bookVersion, description = pipeline.description, parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
5632
5579
  return {
5633
5580
  pipelineUrl: pipelineUrl,
5634
5581
  sourceFile: sourceFile,
5635
5582
  title: title,
5636
- promptbookVersion: promptbookVersion,
5583
+ bookVersion: bookVersion,
5637
5584
  description: description,
5638
5585
  parameters: parameters,
5639
5586
  templates: templates,
@@ -5654,15 +5601,13 @@
5654
5601
  */
5655
5602
  function prepareTemplates(pipeline, tools, options) {
5656
5603
  return __awaiter(this, void 0, void 0, function () {
5657
- var _a, maxParallelCount, templates, parameters, knowledgePiecesCount, templatesPrepared;
5604
+ var _a, maxParallelCount, templates, knowledgePiecesCount, templatesPrepared;
5658
5605
  var _this = this;
5659
5606
  return __generator(this, function (_b) {
5660
5607
  switch (_b.label) {
5661
5608
  case 0:
5662
5609
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
5663
- templates = pipeline.templates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
5664
- // TODO: [main] !! Apply examples to each template (if missing and is for the template defined)
5665
- TODO_USE(parameters);
5610
+ templates = pipeline.templates, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
5666
5611
  templatesPrepared = new Array(templates.length);
5667
5612
  return [4 /*yield*/, forEachAsync(templates, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (template, index) { return __awaiter(_this, void 0, void 0, function () {
5668
5613
  var dependentParameterNames, preparedContent, preparedTemplate;
@@ -5732,7 +5677,7 @@
5732
5677
  currentPreparation = {
5733
5678
  id: 1,
5734
5679
  // TODO: [🍥]> date: $currentDate(),
5735
- promptbookVersion: PROMPTBOOK_VERSION,
5680
+ promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
5736
5681
  usage: ZERO_USAGE,
5737
5682
  };
5738
5683
  preparations = [
@@ -5847,7 +5792,7 @@
5847
5792
  throw new ParseError("Source not valid");
5848
5793
  }
5849
5794
  if (sourceContent.startsWith('../') || sourceContent.startsWith('/') || /^[A-Z]:[\\/]+/i.test(sourceContent)) {
5850
- throw new ParseError("Source cannot be outside of the .ptbk.md folder");
5795
+ throw new ParseError("Source cannot be outside of the .book.md folder");
5851
5796
  }
5852
5797
  return {
5853
5798
  type: 'KNOWLEDGE',
@@ -5872,7 +5817,6 @@
5872
5817
  * Note: This is used in `pipelineJsonToString` utility
5873
5818
  */
5874
5819
  stringify: function (command) {
5875
- keepUnused(command);
5876
5820
  return "---"; // <- TODO: [🛋] Implement
5877
5821
  },
5878
5822
  /**
@@ -5881,7 +5825,6 @@
5881
5825
  * Note: This is used in `pipelineJsonToString` utility
5882
5826
  */
5883
5827
  takeFromPipelineJson: function (pipelineJson) {
5884
- keepUnused(pipelineJson);
5885
5828
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
5886
5829
  },
5887
5830
  };
@@ -6046,7 +5989,6 @@
6046
5989
  * Note: This is used in `pipelineJsonToString` utility
6047
5990
  */
6048
5991
  stringify: function (command) {
6049
- keepUnused(command);
6050
5992
  return "---"; // <- TODO: [🛋] Implement
6051
5993
  },
6052
5994
  /**
@@ -6055,7 +5997,6 @@
6055
5997
  * Note: This is used in `pipelineJsonToString` utility
6056
5998
  */
6057
5999
  takeFromTemplateJson: function ($templateJson) {
6058
- keepUnused($templateJson);
6059
6000
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
6060
6001
  },
6061
6002
  };
@@ -6287,7 +6228,6 @@
6287
6228
  * Note: This is used in `pipelineJsonToString` utility
6288
6229
  */
6289
6230
  stringify: function (command) {
6290
- keepUnused(command);
6291
6231
  return "---"; // <- TODO: [🛋] Implement
6292
6232
  },
6293
6233
  /**
@@ -6296,7 +6236,6 @@
6296
6236
  * Note: This is used in `pipelineJsonToString` utility
6297
6237
  */
6298
6238
  takeFromTemplateJson: function ($templateJson) {
6299
- keepUnused($templateJson);
6300
6239
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
6301
6240
  },
6302
6241
  };
@@ -6485,7 +6424,7 @@
6485
6424
  /**
6486
6425
  * Parses the foreach command
6487
6426
  *
6488
- * Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.ptbk.md` file
6427
+ * Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.book.md` file
6489
6428
  *
6490
6429
  * @see `documentationUrl` for more details
6491
6430
  * @private within the commands folder
@@ -6615,7 +6554,6 @@
6615
6554
  inputSubparameterNames: inputSubparameterNames,
6616
6555
  outputSubparameterName: outputSubparameterName,
6617
6556
  };
6618
- keepUnused($pipelineJson); // <- TODO: [🧠] Maybe register subparameter from foreach into parameters of the pipeline
6619
6557
  // Note: [🍭] FOREACH apply has some sideeffects on different places in codebase
6620
6558
  },
6621
6559
  /**
@@ -6624,7 +6562,6 @@
6624
6562
  * Note: This is used in `pipelineJsonToString` utility
6625
6563
  */
6626
6564
  stringify: function (command) {
6627
- keepUnused(command);
6628
6565
  return "---"; // <- TODO: [🛋] Implement
6629
6566
  },
6630
6567
  /**
@@ -6633,12 +6570,11 @@
6633
6570
  * Note: This is used in `pipelineJsonToString` utility
6634
6571
  */
6635
6572
  takeFromTemplateJson: function ($templateJson) {
6636
- keepUnused($templateJson);
6637
6573
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
6638
6574
  },
6639
6575
  };
6640
6576
  /**
6641
- * TODO: [🍭] Make .ptbk.md file with examples of the FOREACH with wrong parsing and logic
6577
+ * TODO: [🍭] Make .book.md file with examples of the FOREACH with wrong parsing and logic
6642
6578
  */
6643
6579
 
6644
6580
  /**
@@ -6701,7 +6637,6 @@
6701
6637
  * Note: This is used in `pipelineJsonToString` utility
6702
6638
  */
6703
6639
  stringify: function (command) {
6704
- keepUnused(command);
6705
6640
  return "---"; // <- TODO: [🛋] Implement
6706
6641
  },
6707
6642
  /**
@@ -6710,7 +6645,6 @@
6710
6645
  * Note: This is used in `pipelineJsonToString` utility
6711
6646
  */
6712
6647
  takeFromTemplateJson: function ($templateJson) {
6713
- keepUnused($templateJson);
6714
6648
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
6715
6649
  },
6716
6650
  };
@@ -6773,7 +6707,6 @@
6773
6707
  * Note: This is used in `pipelineJsonToString` utility
6774
6708
  */
6775
6709
  stringify: function (command) {
6776
- keepUnused(command);
6777
6710
  return "---"; // <- TODO: [🛋] Implement
6778
6711
  },
6779
6712
  /**
@@ -6782,7 +6715,6 @@
6782
6715
  * Note: This is used in `pipelineJsonToString` utility
6783
6716
  */
6784
6717
  takeFromTemplateJson: function ($templateJson) {
6785
- keepUnused($templateJson);
6786
6718
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
6787
6719
  },
6788
6720
  };
@@ -6918,7 +6850,6 @@
6918
6850
  * Note: This is used in `pipelineJsonToString` utility
6919
6851
  */
6920
6852
  stringify: function (command) {
6921
- keepUnused(command);
6922
6853
  return "---"; // <- TODO: [🛋] Implement
6923
6854
  },
6924
6855
  /**
@@ -6927,7 +6858,6 @@
6927
6858
  * Note: This is used in `pipelineJsonToString` utility
6928
6859
  */
6929
6860
  takeFromPipelineJson: function (pipelineJson) {
6930
- keepUnused(pipelineJson);
6931
6861
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
6932
6862
  },
6933
6863
  /**
@@ -6936,7 +6866,6 @@
6936
6866
  * Note: This is used in `pipelineJsonToString` utility
6937
6867
  */
6938
6868
  takeFromTemplateJson: function ($templateJson) {
6939
- keepUnused($templateJson);
6940
6869
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
6941
6870
  },
6942
6871
  };
@@ -7010,7 +6939,6 @@
7010
6939
  * Note: `$` is used to indicate that this function mutates given `pipelineJson`
7011
6940
  */
7012
6941
  $applyToPipelineJson: function (command, $pipelineJson) {
7013
- keepUnused(command, $pipelineJson);
7014
6942
  // Note: [🍣] Do nothing, its application is implemented separately in `pipelineStringToJsonSync`
7015
6943
  },
7016
6944
  /**
@@ -7019,7 +6947,6 @@
7019
6947
  * Note: `$` is used to indicate that this function mutates given `templateJson`
7020
6948
  */
7021
6949
  $applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
7022
- keepUnused(command, $templateJson, $pipelineJson);
7023
6950
  // Note: [🍣] Do nothing, its application is implemented separately in `pipelineStringToJsonSync`
7024
6951
  },
7025
6952
  /**
@@ -7028,7 +6955,6 @@
7028
6955
  * Note: This is used in `pipelineJsonToString` utility
7029
6956
  */
7030
6957
  stringify: function (command) {
7031
- keepUnused(command);
7032
6958
  return "---"; // <- TODO: [🛋] Implement
7033
6959
  },
7034
6960
  /**
@@ -7037,7 +6963,6 @@
7037
6963
  * Note: This is used in `pipelineJsonToString` utility
7038
6964
  */
7039
6965
  takeFromPipelineJson: function (pipelineJson) {
7040
- keepUnused(pipelineJson);
7041
6966
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7042
6967
  },
7043
6968
  /**
@@ -7046,7 +6971,6 @@
7046
6971
  * Note: This is used in `pipelineJsonToString` utility
7047
6972
  */
7048
6973
  takeFromTemplateJson: function ($templateJson) {
7049
- keepUnused($templateJson);
7050
6974
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7051
6975
  },
7052
6976
  };
@@ -7118,7 +7042,6 @@
7118
7042
  * Note: This is used in `pipelineJsonToString` utility
7119
7043
  */
7120
7044
  stringify: function (command) {
7121
- keepUnused(command);
7122
7045
  return "---"; // <- TODO: [🛋] Implement
7123
7046
  },
7124
7047
  /**
@@ -7127,7 +7050,6 @@
7127
7050
  * Note: This is used in `pipelineJsonToString` utility
7128
7051
  */
7129
7052
  takeFromPipelineJson: function (pipelineJson) {
7130
- keepUnused(pipelineJson);
7131
7053
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7132
7054
  },
7133
7055
  /**
@@ -7136,7 +7058,6 @@
7136
7058
  * Note: This is used in `pipelineJsonToString` utility
7137
7059
  */
7138
7060
  takeFromTemplateJson: function ($templateJson) {
7139
- keepUnused($templateJson);
7140
7061
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7141
7062
  },
7142
7063
  };
@@ -7255,7 +7176,6 @@
7255
7176
  * Note: This is used in `pipelineJsonToString` utility
7256
7177
  */
7257
7178
  stringify: function (command) {
7258
- keepUnused(command);
7259
7179
  return "---"; // <- TODO: [🛋] Implement
7260
7180
  },
7261
7181
  /**
@@ -7264,85 +7184,82 @@
7264
7184
  * Note: This is used in `pipelineJsonToString` utility
7265
7185
  */
7266
7186
  takeFromTemplateJson: function ($templateJson) {
7267
- keepUnused($templateJson);
7268
7187
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7269
7188
  },
7270
7189
  };
7271
7190
 
7272
7191
  /**
7273
- * Parses the PROMPTBOOK_VERSION command
7192
+ * Parses the BOOK_VERSION command
7274
7193
  *
7275
7194
  * @see `documentationUrl` for more details
7276
7195
  * @private within the commands folder
7277
7196
  */
7278
- var promptbookVersionCommandParser = {
7197
+ var bookVersionCommandParser = {
7279
7198
  /**
7280
7199
  * Name of the command
7281
7200
  */
7282
- name: 'PROMPTBOOK_VERSION',
7283
- aliasNames: ['PTBK_VERSION', 'PTBK_V', 'PTBKV'],
7201
+ name: 'BOOK_VERSION',
7202
+ aliasNames: ['PTBK_VERSION', 'PROMPTBOOK_VERSION', 'BOOK'],
7284
7203
  /**
7285
7204
  * BOILERPLATE command can be used in:
7286
7205
  */
7287
7206
  isUsedInPipelineHead: true,
7288
7207
  isUsedInPipelineTemplate: false,
7289
7208
  /**
7290
- * Description of the PROMPTBOOK_VERSION command
7209
+ * Description of the BOOK_VERSION command
7291
7210
  */
7292
- description: "Which version of the promptbook is the .ptbk.md using",
7211
+ description: "Which version of the Book language is the .book.md using",
7293
7212
  /**
7294
7213
  * Link to documentation
7295
7214
  */
7296
7215
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/69',
7297
7216
  /**
7298
- * Example usages of the PROMPTBOOK_VERSION command
7217
+ * Example usages of the BOOK_VERSION command
7299
7218
  */
7300
- examples: ["PROMPTBOOK VERSION ".concat(PROMPTBOOK_VERSION), "PTBKV ".concat(PROMPTBOOK_VERSION)],
7219
+ examples: ["BOOK VERSION ".concat(BOOK_LANGUAGE_VERSION), "BOOK ".concat(BOOK_LANGUAGE_VERSION)],
7301
7220
  /**
7302
- * Parses the PROMPTBOOK_VERSION command
7221
+ * Parses the BOOK_VERSION command
7303
7222
  */
7304
7223
  parse: function (input) {
7305
7224
  var args = input.args;
7306
- var promptbookVersion = args.pop();
7307
- if (promptbookVersion === undefined) {
7225
+ var bookVersion = args.pop();
7226
+ if (bookVersion === undefined) {
7308
7227
  throw new ParseError("Version is required");
7309
7228
  }
7310
- if (!isValidPromptbookVersion(promptbookVersion)) {
7311
- throw new ParseError("Invalid Promptbook version \"".concat(promptbookVersion, "\""));
7229
+ if (!isValidPromptbookVersion(bookVersion)) {
7230
+ throw new ParseError("Invalid Promptbook version \"".concat(bookVersion, "\""));
7312
7231
  }
7313
- if (args.length > 0) {
7232
+ if (args.length > 0 && !(((args.length === 1 && args[0]) || '').toUpperCase() === 'VERSION')) {
7314
7233
  throw new ParseError("Can not have more than one Promptbook version");
7315
7234
  }
7316
7235
  return {
7317
- type: 'PROMPTBOOK_VERSION',
7318
- promptbookVersion: promptbookVersion,
7236
+ type: 'BOOK_VERSION',
7237
+ bookVersion: bookVersion,
7319
7238
  };
7320
7239
  },
7321
7240
  /**
7322
- * Apply the PROMPTBOOK_VERSION command to the `pipelineJson`
7241
+ * Apply the BOOK_VERSION command to the `pipelineJson`
7323
7242
  *
7324
7243
  * Note: `$` is used to indicate that this function mutates given `pipelineJson`
7325
7244
  */
7326
7245
  $applyToPipelineJson: function (command, $pipelineJson) {
7327
7246
  // TODO: Warn if the version is overridden
7328
- $pipelineJson.promptbookVersion = command.promptbookVersion;
7247
+ $pipelineJson.bookVersion = command.bookVersion;
7329
7248
  },
7330
7249
  /**
7331
- * Converts the PROMPTBOOK_VERSION command back to string
7250
+ * Converts the BOOK_VERSION command back to string
7332
7251
  *
7333
7252
  * Note: This is used in `pipelineJsonToString` utility
7334
7253
  */
7335
7254
  stringify: function (command) {
7336
- keepUnused(command);
7337
7255
  return "---"; // <- TODO: [🛋] Implement
7338
7256
  },
7339
7257
  /**
7340
- * Reads the PROMPTBOOK_VERSION command from the `PipelineJson`
7258
+ * Reads the BOOK_VERSION command from the `PipelineJson`
7341
7259
  *
7342
7260
  * Note: This is used in `pipelineJsonToString` utility
7343
7261
  */
7344
7262
  takeFromPipelineJson: function (pipelineJson) {
7345
- keepUnused(pipelineJson);
7346
7263
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7347
7264
  },
7348
7265
  };
@@ -7380,9 +7297,9 @@
7380
7297
  * Example usages of the URL command
7381
7298
  */
7382
7299
  examples: [
7383
- 'PIPELINE URL https://promptbook.studio/library/write-cv.ptbk.md',
7384
- 'URL https://promptbook.studio/library/write-cv.ptbk.md',
7385
- 'https://promptbook.studio/library/write-cv.ptbk.md',
7300
+ 'PIPELINE URL https://promptbook.studio/library/write-cv.book.md',
7301
+ 'URL https://promptbook.studio/library/write-cv.book.md',
7302
+ 'https://promptbook.studio/library/write-cv.book.md',
7386
7303
  ],
7387
7304
  /**
7388
7305
  * Parses the URL command
@@ -7436,7 +7353,6 @@
7436
7353
  * Note: This is used in `pipelineJsonToString` utility
7437
7354
  */
7438
7355
  stringify: function (command) {
7439
- keepUnused(command);
7440
7356
  return "---"; // <- TODO: [🛋] Implement
7441
7357
  },
7442
7358
  /**
@@ -7445,7 +7361,6 @@
7445
7361
  * Note: This is used in `pipelineJsonToString` utility
7446
7362
  */
7447
7363
  takeFromPipelineJson: function (pipelineJson) {
7448
- keepUnused(pipelineJson);
7449
7364
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7450
7365
  },
7451
7366
  };
@@ -7482,8 +7397,7 @@
7482
7397
  * Parses the ACTION command
7483
7398
  */
7484
7399
  parse: function (input) {
7485
- var args = input.args;
7486
- TODO_USE(args);
7400
+ input.args;
7487
7401
  return {
7488
7402
  type: 'ACTION',
7489
7403
  };
@@ -7494,7 +7408,6 @@
7494
7408
  * Note: `$` is used to indicate that this function mutates given `pipelineJson`
7495
7409
  */
7496
7410
  $applyToPipelineJson: function (command, $pipelineJson) {
7497
- keepUnused(command, $pipelineJson);
7498
7411
  console.error(new NotYetImplementedError('[🛠] Actions are not implemented yet'));
7499
7412
  },
7500
7413
  /**
@@ -7503,7 +7416,6 @@
7503
7416
  * Note: This is used in `pipelineJsonToString` utility
7504
7417
  */
7505
7418
  stringify: function (command) {
7506
- keepUnused(command);
7507
7419
  throw new NotYetImplementedError('[🛠] Actions are not implemented yet');
7508
7420
  },
7509
7421
  /**
@@ -7512,7 +7424,6 @@
7512
7424
  * Note: This is used in `pipelineJsonToString` utility
7513
7425
  */
7514
7426
  takeFromPipelineJson: function (pipelineJson) {
7515
- keepUnused(pipelineJson);
7516
7427
  throw new NotYetImplementedError('[🛠] Actions are not implemented yet');
7517
7428
  },
7518
7429
  };
@@ -7552,9 +7463,7 @@
7552
7463
  * Parses the INSTRUMENT command
7553
7464
  */
7554
7465
  parse: function (input) {
7555
- var args = input.args;
7556
- // TODO: [🛠] Implement
7557
- TODO_USE(args);
7466
+ input.args;
7558
7467
  return {
7559
7468
  type: 'INSTRUMENT',
7560
7469
  };
@@ -7565,7 +7474,6 @@
7565
7474
  * Note: `$` is used to indicate that this function mutates given `pipelineJson`
7566
7475
  */
7567
7476
  $applyToPipelineJson: function (command, $pipelineJson) {
7568
- keepUnused(command, $pipelineJson);
7569
7477
  console.error(new NotYetImplementedError('[🛠] Instruments are not implemented yet'));
7570
7478
  },
7571
7479
  /**
@@ -7574,7 +7482,6 @@
7574
7482
  * Note: This is used in `pipelineJsonToString` utility
7575
7483
  */
7576
7484
  stringify: function (command) {
7577
- keepUnused(command);
7578
7485
  throw new NotYetImplementedError('[🛠] Instruments are not implemented yet');
7579
7486
  },
7580
7487
  /**
@@ -7583,7 +7490,6 @@
7583
7490
  * Note: This is used in `pipelineJsonToString` utility
7584
7491
  */
7585
7492
  takeFromPipelineJson: function (pipelineJson) {
7586
- keepUnused(pipelineJson);
7587
7493
  throw new NotYetImplementedError('[🛠] Instruments are not implemented yet');
7588
7494
  },
7589
7495
  };
@@ -7594,7 +7500,7 @@
7594
7500
  /**
7595
7501
  * Parses the boilerplate command
7596
7502
  *
7597
- * Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.ptbk.md` file
7503
+ * Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.book.md` file
7598
7504
  *
7599
7505
  * @see `documentationUrl` for more details
7600
7506
  * @private within the commands folder
@@ -7648,8 +7554,7 @@
7648
7554
  * Note: `$` is used to indicate that this function mutates given `pipelineJson`
7649
7555
  */
7650
7556
  $applyToPipelineJson: function (command, $pipelineJson) {
7651
- keepUnused(command, $pipelineJson);
7652
- throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
7557
+ throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
7653
7558
  },
7654
7559
  /**
7655
7560
  * Apply the BOILERPLATE command to the `pipelineJson`
@@ -7657,8 +7562,7 @@
7657
7562
  * Note: `$` is used to indicate that this function mutates given `templateJson`
7658
7563
  */
7659
7564
  $applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
7660
- keepUnused(command, $templateJson, $pipelineJson);
7661
- throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
7565
+ throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
7662
7566
  },
7663
7567
  /**
7664
7568
  * Converts the BOILERPLATE command back to string
@@ -7666,7 +7570,6 @@
7666
7570
  * Note: This is used in `pipelineJsonToString` utility
7667
7571
  */
7668
7572
  stringify: function (command) {
7669
- keepUnused(command);
7670
7573
  return "---"; // <- TODO: [🛋] Implement
7671
7574
  },
7672
7575
  /**
@@ -7675,8 +7578,7 @@
7675
7578
  * Note: This is used in `pipelineJsonToString` utility
7676
7579
  */
7677
7580
  takeFromPipelineJson: function (pipelineJson) {
7678
- keepUnused(pipelineJson);
7679
- throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
7581
+ throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
7680
7582
  },
7681
7583
  /**
7682
7584
  * Reads the BOILERPLATE command from the `TemplateJson`
@@ -7684,8 +7586,7 @@
7684
7586
  * Note: This is used in `pipelineJsonToString` utility
7685
7587
  */
7686
7588
  takeFromTemplateJson: function ($templateJson) {
7687
- keepUnused($templateJson);
7688
- throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
7589
+ throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
7689
7590
  },
7690
7591
  };
7691
7592
 
@@ -7702,7 +7603,7 @@
7702
7603
  modelCommandParser,
7703
7604
  parameterCommandParser,
7704
7605
  postprocessCommandParser,
7705
- promptbookVersionCommandParser,
7606
+ bookVersionCommandParser,
7706
7607
  urlCommandParser,
7707
7608
  knowledgeCommandParser,
7708
7609
  actionCommandParser,
@@ -7854,9 +7755,7 @@
7854
7755
  var _loop_1 = function (commandParser) {
7855
7756
  // <- Note: [🦦] Its strange that this type assertion is needed
7856
7757
  var name_1 = commandParser.name, isUsedInPipelineHead = commandParser.isUsedInPipelineHead, isUsedInPipelineTemplate = commandParser.isUsedInPipelineTemplate, aliasNames = commandParser.aliasNames, deprecatedNames = commandParser.deprecatedNames, parse = commandParser.parse;
7857
- if (just(false)) {
7858
- keepUnused( /* for better indentation */);
7859
- }
7758
+ if (just(false)) ;
7860
7759
  else if (usagePlace === 'PIPELINE_HEAD' && !isUsedInPipelineHead) {
7861
7760
  return "continue";
7862
7761
  }
@@ -8016,7 +7915,7 @@
8016
7915
  return;
8017
7916
  }
8018
7917
  if (!section.startsWith('#')) {
8019
- section = "# Untitled\n\n".concat(section);
7918
+ section = "# ".concat(DEFAULT_TITLE, "\n\n").concat(section);
8020
7919
  }
8021
7920
  sections.push(section);
8022
7921
  buffer = [];
@@ -8080,7 +7979,7 @@
8080
7979
  var e_1, _a;
8081
7980
  var sections = splitMarkdownIntoSections(markdown);
8082
7981
  if (sections.length === 0) {
8083
- return '# Untitled';
7982
+ return "# ".concat(DEFAULT_TITLE);
8084
7983
  }
8085
7984
  var flattenedMarkdown = '';
8086
7985
  var parsedSections = sections.map(parseMarkdownSection);
@@ -8091,7 +7990,7 @@
8091
7990
  }
8092
7991
  else {
8093
7992
  parsedSections.unshift(firstSection);
8094
- flattenedMarkdown += "# Untitled" + "\n\n"; // <- [🧠] Maybe 3 new lines?
7993
+ flattenedMarkdown += "# ".concat(DEFAULT_TITLE) + "\n\n"; // <- [🧠] Maybe 3 new lines?
8095
7994
  }
8096
7995
  try {
8097
7996
  for (var parsedSections_1 = __values(parsedSections), parsedSections_1_1 = parsedSections_1.next(); !parsedSections_1_1.done; parsedSections_1_1 = parsedSections_1.next()) {
@@ -8163,17 +8062,17 @@
8163
8062
  * Note: This function does not validate logic of the pipeline only the parsing
8164
8063
  * Note: This function acts as compilation process
8165
8064
  *
8166
- * @param pipelineString {Promptbook} in string markdown format (.ptbk.md)
8167
- * @returns {Promptbook} compiled in JSON format (.ptbk.json)
8065
+ * @param pipelineString {Promptbook} in string markdown format (.book.md)
8066
+ * @returns {Promptbook} compiled in JSON format (.book.json)
8168
8067
  * @throws {ParseError} if the promptbook string is not valid
8169
8068
  * @public exported from `@promptbook/core`
8170
8069
  */
8171
8070
  function pipelineStringToJsonSync(pipelineString) {
8172
- var e_1, _a, e_2, _b;
8071
+ var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
8173
8072
  var $pipelineJson = {
8174
8073
  title: undefined /* <- Note: [🍙] Putting here placeholder to keep `title` on top at final JSON */,
8175
8074
  pipelineUrl: undefined /* <- Note: Putting here placeholder to keep `pipelineUrl` on top at final JSON */,
8176
- promptbookVersion: undefined /* <- Note: By default no explicit version */,
8075
+ bookVersion: undefined /* <- Note: By default no explicit version */,
8177
8076
  description: undefined /* <- Note: [🍙] Putting here placeholder to keep `description` on top at final JSON */,
8178
8077
  parameters: [],
8179
8078
  templates: [],
@@ -8196,11 +8095,18 @@
8196
8095
  }
8197
8096
  // =============================================================
8198
8097
  // Note: 1️⃣ Parsing of the markdown into object
8098
+ if (pipelineString.startsWith('#!')) {
8099
+ var _e = __read(pipelineString.split('\n')), shebangLine_1 = _e[0], restLines = _e.slice(1);
8100
+ if (!(shebangLine_1 || '').includes('ptbk')) {
8101
+ throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n It seems that you try to parse a book file which has non-standard shebang line for book files:\n Shebang line must contain 'ptbk'\n\n You have:\n ".concat(block(shebangLine_1 || '(empty line)'), "\n\n It should look like this:\n #!/usr/bin/env ptbk\n\n ").concat(block(getPipelineIdentification()), "\n "); }));
8102
+ }
8103
+ pipelineString = restLines.join('\n');
8104
+ }
8199
8105
  pipelineString = removeContentComments(pipelineString);
8200
8106
  pipelineString = flattenMarkdown(pipelineString) /* <- Note: [🥞] */;
8201
8107
  pipelineString = pipelineString.replaceAll(/`\{(?<parameterName>[a-z0-9_]+)\}`/gi, '{$<parameterName>}');
8202
8108
  pipelineString = pipelineString.replaceAll(/`->\s+\{(?<parameterName>[a-z0-9_]+)\}`/gi, '-> {$<parameterName>}');
8203
- var _c = __read(splitMarkdownIntoSections(pipelineString).map(parseMarkdownSection)), pipelineHead = _c[0], pipelineSections = _c.slice(1); /* <- Note: [🥞] */
8109
+ var _f = __read(splitMarkdownIntoSections(pipelineString).map(parseMarkdownSection)), pipelineHead = _f[0], pipelineSections = _f.slice(1); /* <- Note: [🥞] */
8204
8110
  if (pipelineHead === undefined) {
8205
8111
  throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Pipeline head is not defined\n\n ".concat(block(getPipelineIdentification()), "\n\n This should never happen, because the pipeline already flattened\n "); }));
8206
8112
  }
@@ -8228,6 +8134,8 @@
8228
8134
  if (parameterDescription) {
8229
8135
  existingParameter.description = parameterDescription;
8230
8136
  }
8137
+ existingParameter.isInput = existingParameter.isInput || isInput;
8138
+ existingParameter.isOutput = existingParameter.isOutput || isOutput;
8231
8139
  }
8232
8140
  else {
8233
8141
  $pipelineJson.parameters.push({
@@ -8290,10 +8198,10 @@
8290
8198
  finally { if (e_1) throw e_1.error; }
8291
8199
  }
8292
8200
  var _loop_2 = function (section) {
8293
- var e_3, _d;
8201
+ var e_5, _l, e_6, _m;
8294
8202
  // TODO: Parse template description (the content out of the codeblock and lists)
8295
8203
  var listItems_2 = extractAllListItemsFromMarkdown(section.content);
8296
- var _e = extractOneBlockFromMarkdown(section.content), language = _e.language, content = _e.content;
8204
+ var _o = extractOneBlockFromMarkdown(section.content), language = _o.language, content = _o.content;
8297
8205
  // TODO: [🎾][1] DRY description
8298
8206
  var description_1 = section.content;
8299
8207
  // Note: Remove codeblocks - TODO: [🎾]
@@ -8334,7 +8242,7 @@
8334
8242
  }) === false) {
8335
8243
  templateCommandParser.$applyToTemplateJson({ type: 'TEMPLATE', templateType: 'PROMPT_TEMPLATE' }, $templateJson, $pipelineJson);
8336
8244
  }
8337
- var _loop_3 = function (listItem, command) {
8245
+ var _loop_4 = function (listItem, command) {
8338
8246
  var commandParser = getParserForCommand(command);
8339
8247
  if (commandParser.isUsedInPipelineTemplate !== true /* <- Note: [🦦][4] */) {
8340
8248
  throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Command ".concat(command.type, " is not allowed in the template of the promptbook ONLY at the pipeline head\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
@@ -8357,17 +8265,17 @@
8357
8265
  };
8358
8266
  try {
8359
8267
  // TODO [♓️] List commands and before apply order them to achieve order-agnostic commands
8360
- for (var commands_1 = (e_3 = void 0, __values(commands)), commands_1_1 = commands_1.next(); !commands_1_1.done; commands_1_1 = commands_1.next()) {
8361
- var _f = commands_1_1.value, listItem = _f.listItem, command = _f.command;
8362
- _loop_3(listItem, command);
8268
+ for (var commands_1 = (e_5 = void 0, __values(commands)), commands_1_1 = commands_1.next(); !commands_1_1.done; commands_1_1 = commands_1.next()) {
8269
+ var _p = commands_1_1.value, listItem = _p.listItem, command = _p.command;
8270
+ _loop_4(listItem, command);
8363
8271
  }
8364
8272
  }
8365
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
8273
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
8366
8274
  finally {
8367
8275
  try {
8368
- if (commands_1_1 && !commands_1_1.done && (_d = commands_1.return)) _d.call(commands_1);
8276
+ if (commands_1_1 && !commands_1_1.done && (_l = commands_1.return)) _l.call(commands_1);
8369
8277
  }
8370
- finally { if (e_3) throw e_3.error; }
8278
+ finally { if (e_5) throw e_5.error; }
8371
8279
  }
8372
8280
  // TODO: [🍧] Should be done in TEMPLATE command
8373
8281
  if ($templateJson.templateType === 'SCRIPT_TEMPLATE') {
@@ -8381,6 +8289,26 @@
8381
8289
  language;
8382
8290
  }
8383
8291
  $templateJson.dependentParameterNames = Array.from(extractParameterNamesFromTemplate($templateJson));
8292
+ try {
8293
+ for (var _q = (e_6 = void 0, __values($templateJson.dependentParameterNames)), _r = _q.next(); !_r.done; _r = _q.next()) {
8294
+ var parameterName = _r.value;
8295
+ // TODO: [🧠] This definition should be made first in the template
8296
+ defineParam({
8297
+ parameterName: parameterName,
8298
+ parameterDescription: null,
8299
+ isInput: false,
8300
+ isOutput: false,
8301
+ // <- Note: In this case null+false+false means that we do not know yet if it is input or output and we will set it later
8302
+ });
8303
+ }
8304
+ }
8305
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
8306
+ finally {
8307
+ try {
8308
+ if (_r && !_r.done && (_m = _q.return)) _m.call(_q);
8309
+ }
8310
+ finally { if (e_6) throw e_6.error; }
8311
+ }
8384
8312
  /*
8385
8313
  // TODO: [🍧] This should be checked in `MODEL` command + better error message
8386
8314
  if ($templateJson.templateType !== 'PROMPT_TEMPLATE' && $templateJson.modelRequirements !== undefined) {
@@ -8422,9 +8350,51 @@
8422
8350
  finally { if (e_2) throw e_2.error; }
8423
8351
  }
8424
8352
  // =============================================================
8425
- // Note: 5️⃣ Cleanup of undefined values
8353
+ // Note: 5️⃣ Mark parameters as INPUT if not explicitly set
8354
+ if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isInput; })) {
8355
+ var _loop_3 = function (parameter) {
8356
+ var isThisParameterResulting = $pipelineJson.templates.some(function (template) { return template.resultingParameterName === parameter.name; });
8357
+ if (!isThisParameterResulting) {
8358
+ parameter.isInput = true;
8359
+ }
8360
+ };
8361
+ try {
8362
+ for (var _g = __values($pipelineJson.parameters), _h = _g.next(); !_h.done; _h = _g.next()) {
8363
+ var parameter = _h.value;
8364
+ _loop_3(parameter);
8365
+ }
8366
+ }
8367
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
8368
+ finally {
8369
+ try {
8370
+ if (_h && !_h.done && (_c = _g.return)) _c.call(_g);
8371
+ }
8372
+ finally { if (e_3) throw e_3.error; }
8373
+ }
8374
+ }
8375
+ // =============================================================
8376
+ // Note: 6️⃣ Mark all non-INPUT parameters as OUTPUT if any OUTPUT is not set
8377
+ if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isOutput; })) {
8378
+ try {
8379
+ for (var _j = __values($pipelineJson.parameters), _k = _j.next(); !_k.done; _k = _j.next()) {
8380
+ var parameter = _k.value;
8381
+ if (!parameter.isInput) {
8382
+ parameter.isOutput = true;
8383
+ }
8384
+ }
8385
+ }
8386
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
8387
+ finally {
8388
+ try {
8389
+ if (_k && !_k.done && (_d = _j.return)) _d.call(_j);
8390
+ }
8391
+ finally { if (e_4) throw e_4.error; }
8392
+ }
8393
+ }
8394
+ // =============================================================
8395
+ // Note: 7️⃣ Cleanup of undefined values
8426
8396
  $pipelineJson.templates.forEach(function (templates) {
8427
- var e_4, _a;
8397
+ var e_7, _a;
8428
8398
  try {
8429
8399
  for (var _b = __values(Object.entries(templates)), _c = _b.next(); !_c.done; _c = _b.next()) {
8430
8400
  var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
@@ -8433,16 +8403,16 @@
8433
8403
  }
8434
8404
  }
8435
8405
  }
8436
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
8406
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
8437
8407
  finally {
8438
8408
  try {
8439
8409
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
8440
8410
  }
8441
- finally { if (e_4) throw e_4.error; }
8411
+ finally { if (e_7) throw e_7.error; }
8442
8412
  }
8443
8413
  });
8444
8414
  $pipelineJson.parameters.forEach(function (parameter) {
8445
- var e_5, _a;
8415
+ var e_8, _a;
8446
8416
  try {
8447
8417
  for (var _b = __values(Object.entries(parameter)), _c = _b.next(); !_c.done; _c = _b.next()) {
8448
8418
  var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
@@ -8451,12 +8421,12 @@
8451
8421
  }
8452
8422
  }
8453
8423
  }
8454
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
8424
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
8455
8425
  finally {
8456
8426
  try {
8457
8427
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
8458
8428
  }
8459
- finally { if (e_5) throw e_5.error; }
8429
+ finally { if (e_8) throw e_8.error; }
8460
8430
  }
8461
8431
  });
8462
8432
  // =============================================================
@@ -8485,10 +8455,10 @@
8485
8455
  * Note: This function does not validate logic of the pipeline only the parsing
8486
8456
  * Note: This function acts as compilation process
8487
8457
  *
8488
- * @param pipelineString {Promptbook} in string markdown format (.ptbk.md)
8458
+ * @param pipelineString {Promptbook} in string markdown format (.book.md)
8489
8459
  * @param tools - Tools for the preparation and scraping - if not provided together with `llm`, the preparation will be skipped
8490
8460
  * @param options - Options and tools for the compilation
8491
- * @returns {Promptbook} compiled in JSON format (.ptbk.json)
8461
+ * @returns {Promptbook} compiled in JSON format (.book.json)
8492
8462
  * @throws {ParseError} if the promptbook string is not valid
8493
8463
  * @public exported from `@promptbook/core`
8494
8464
  */
@@ -8704,7 +8674,7 @@
8704
8674
  return pipelineJsonStringified;
8705
8675
  }
8706
8676
  /**
8707
- * TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.ptbk.md
8677
+ * TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.book.md
8708
8678
  * TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
8709
8679
  * TODO: [🧠] Maybe more elegant solution than replacing via regex
8710
8680
  * TODO: [🍙] Make some standard order of json properties
@@ -8978,7 +8948,7 @@
8978
8948
  */
8979
8949
 
8980
8950
  /**
8981
- * Stores
8951
+ * Stores data in memory (HEAP)
8982
8952
  *
8983
8953
  * @public exported from `@promptbook/core`
8984
8954
  */
@@ -9108,13 +9078,18 @@
9108
9078
  promptResult = _c.sent();
9109
9079
  return [3 /*break*/, 11];
9110
9080
  case 10: throw new PipelineExecutionError("Unknown model variant \"".concat(prompt.modelRequirements.modelVariant, "\""));
9111
- case 11: return [4 /*yield*/, storage.setItem(key, {
9081
+ case 11:
9082
+ // TODO: [🧠] !!!!!! How to do timing in mixed cache / non-cache situation
9083
+ // promptResult.timing: FromtoItems
9084
+ return [4 /*yield*/, storage.setItem(key, {
9112
9085
  date: $currentDate(),
9113
- promptbookVersion: PROMPTBOOK_VERSION,
9086
+ promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
9114
9087
  prompt: prompt,
9115
9088
  promptResult: promptResult,
9116
9089
  })];
9117
9090
  case 12:
9091
+ // TODO: [🧠] !!!!!! How to do timing in mixed cache / non-cache situation
9092
+ // promptResult.timing: FromtoItems
9118
9093
  _c.sent();
9119
9094
  return [2 /*return*/, promptResult];
9120
9095
  }
@@ -9160,8 +9135,7 @@
9160
9135
  function limitTotalUsage(llmTools, options) {
9161
9136
  var _this = this;
9162
9137
  if (options === void 0) { options = {}; }
9163
- var _a = options.maxTotalUsage, maxTotalUsage = _a === void 0 ? ZERO_USAGE : _a, _b = options.storage, storage = _b === void 0 ? new MemoryStorage() : _b;
9164
- TODO_USE(storage);
9138
+ var _a = options.maxTotalUsage, maxTotalUsage = _a === void 0 ? ZERO_USAGE : _a, _b = options.storage; _b === void 0 ? new MemoryStorage() : _b;
9165
9139
  var proxyTools = countTotalUsage(llmTools);
9166
9140
  if (maxTotalUsage.price.value !== 0) {
9167
9141
  throw new NotYetImplementedError('`limitTotalUsage` is not yet implemented for non-zero price');
@@ -9170,7 +9144,6 @@
9170
9144
  if (proxyTools.callChatModel !== undefined) {
9171
9145
  proxyTools.callChatModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
9172
9146
  return __generator(this, function (_a) {
9173
- TODO_USE(prompt);
9174
9147
  throw new LimitReachedError('Cannot call `callChatModel` because you are not allowed to spend any cost');
9175
9148
  });
9176
9149
  }); };
@@ -9178,7 +9151,6 @@
9178
9151
  if (proxyTools.callCompletionModel !== undefined) {
9179
9152
  proxyTools.callCompletionModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
9180
9153
  return __generator(this, function (_a) {
9181
- TODO_USE(prompt);
9182
9154
  throw new LimitReachedError('Cannot call `callCompletionModel` because you are not allowed to spend any cost');
9183
9155
  });
9184
9156
  }); };
@@ -9186,7 +9158,6 @@
9186
9158
  if (proxyTools.callEmbeddingModel !== undefined) {
9187
9159
  proxyTools.callEmbeddingModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
9188
9160
  return __generator(this, function (_a) {
9189
- TODO_USE(prompt);
9190
9161
  throw new LimitReachedError('Cannot call `callEmbeddingModel` because you are not allowed to spend any cost');
9191
9162
  });
9192
9163
  }); };
@@ -9351,8 +9322,6 @@
9351
9322
  };
9352
9323
  },
9353
9324
  createConfigurationFromEnv: function (env) {
9354
- // TODO: Maybe auto-configure (multiple) assistants from env variables
9355
- keepUnused(env);
9356
9325
  return null;
9357
9326
  /*
9358
9327
  if (typeof env.OPENAI_API_KEY === 'string' || typeof env.OPENAI_XXX === 'string') {
@@ -9496,6 +9465,54 @@
9496
9465
  */
9497
9466
  var _WebsiteScraperMetadataRegistration = $scrapersMetadataRegister.register(websiteScraperMetadata);
9498
9467
 
9468
+ /**
9469
+ * Behaves like a storage but forgets everything you put in it
9470
+ *
9471
+ * @public exported from `@promptbook/core`
9472
+ */
9473
+ var BlackholeStorage = /** @class */ (function () {
9474
+ function BlackholeStorage() {
9475
+ }
9476
+ Object.defineProperty(BlackholeStorage.prototype, "length", {
9477
+ /**
9478
+ * Returns the number of key/value pairs currently present in the list associated with the object.
9479
+ */
9480
+ get: function () {
9481
+ return 0;
9482
+ },
9483
+ enumerable: false,
9484
+ configurable: true
9485
+ });
9486
+ /**
9487
+ * Empties the list associated with the object of all key/value pairs, if there are any.
9488
+ */
9489
+ BlackholeStorage.prototype.clear = function () { };
9490
+ /**
9491
+ * Returns the current value associated with the given key, or null if the given key does not exist in the list associated with the object.
9492
+ * @param key
9493
+ */
9494
+ BlackholeStorage.prototype.getItem = function (key) {
9495
+ return null;
9496
+ };
9497
+ /**
9498
+ * Returns the name of the nth key in the list, or null if n is greater than or equal to the number of key/value pairs in the object.
9499
+ */
9500
+ BlackholeStorage.prototype.key = function (index) {
9501
+ return null;
9502
+ };
9503
+ /**
9504
+ * Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
9505
+ */
9506
+ BlackholeStorage.prototype.setItem = function (key, value) {
9507
+ };
9508
+ /**
9509
+ * Removes the key/value pair with the given key from the list associated with the object, if a key/value pair with the given key exists.
9510
+ */
9511
+ BlackholeStorage.prototype.removeItem = function (key) {
9512
+ };
9513
+ return BlackholeStorage;
9514
+ }());
9515
+
9499
9516
  /**
9500
9517
  * This class behaves like LocalStorage but separates keys by prefix
9501
9518
  *
@@ -9851,6 +9868,8 @@
9851
9868
  exports.$scrapersMetadataRegister = $scrapersMetadataRegister;
9852
9869
  exports.$scrapersRegister = $scrapersRegister;
9853
9870
  exports.AbstractFormatError = AbstractFormatError;
9871
+ exports.BOOK_LANGUAGE_VERSION = BOOK_LANGUAGE_VERSION;
9872
+ exports.BlackholeStorage = BlackholeStorage;
9854
9873
  exports.CLAIM = CLAIM;
9855
9874
  exports.CallbackInterfaceTools = CallbackInterfaceTools;
9856
9875
  exports.CollectionError = CollectionError;
@@ -9869,6 +9888,7 @@
9869
9888
  exports.DEFAULT_REMOTE_URL = DEFAULT_REMOTE_URL;
9870
9889
  exports.DEFAULT_REMOTE_URL_PATH = DEFAULT_REMOTE_URL_PATH;
9871
9890
  exports.DEFAULT_SCRAPE_CACHE_DIRNAME = DEFAULT_SCRAPE_CACHE_DIRNAME;
9891
+ exports.DEFAULT_TITLE = DEFAULT_TITLE;
9872
9892
  exports.ERRORS = ERRORS;
9873
9893
  exports.EXPECTATION_UNITS = EXPECTATION_UNITS;
9874
9894
  exports.EnvironmentMismatchError = EnvironmentMismatchError;
@@ -9884,7 +9904,7 @@
9884
9904
  exports.MultipleLlmExecutionTools = MultipleLlmExecutionTools;
9885
9905
  exports.NotFoundError = NotFoundError;
9886
9906
  exports.NotYetImplementedError = NotYetImplementedError;
9887
- exports.PROMPTBOOK_VERSION = PROMPTBOOK_VERSION;
9907
+ exports.PROMPTBOOK_ENGINE_VERSION = PROMPTBOOK_ENGINE_VERSION;
9888
9908
  exports.ParseError = ParseError;
9889
9909
  exports.PipelineExecutionError = PipelineExecutionError;
9890
9910
  exports.PipelineLogicError = PipelineLogicError;