@promptbook/legacy-documents 0.79.0 → 0.80.0-1

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 (40) hide show
  1. package/README.md +4 -0
  2. package/esm/index.es.js +392 -315
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/books/index.d.ts +6 -6
  5. package/esm/typings/src/_packages/core.index.d.ts +8 -6
  6. package/esm/typings/src/_packages/types.index.d.ts +6 -0
  7. package/esm/typings/src/_packages/utils.index.d.ts +4 -0
  8. package/esm/typings/src/cli/cli-commands/runInteractiveChatbot.d.ts +32 -0
  9. package/esm/typings/src/commands/_common/getParserForCommand.d.ts +1 -1
  10. package/esm/typings/src/commands/_common/parseCommand.d.ts +1 -1
  11. package/esm/typings/src/commands/_common/stringifyCommand.d.ts +1 -1
  12. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +3 -0
  13. package/esm/typings/src/config.d.ts +0 -25
  14. package/esm/typings/src/constants.d.ts +35 -0
  15. package/esm/typings/src/conversion/{pipelineStringToJson.d.ts → compilePipeline.d.ts} +3 -3
  16. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -0
  17. package/esm/typings/src/conversion/{pipelineStringToJsonSync.d.ts → precompilePipeline.d.ts} +4 -3
  18. package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +20 -0
  19. package/esm/typings/src/high-level-abstractions/implicit-formfactor/ImplicitFormfactorHla.d.ts +10 -0
  20. package/esm/typings/src/high-level-abstractions/index.d.ts +44 -0
  21. package/esm/typings/src/high-level-abstractions/quick-chatbot/QuickChatbotHla.d.ts +10 -0
  22. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
  23. package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
  24. package/esm/typings/src/prepare/prepareTasks.d.ts +1 -0
  25. package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -0
  26. package/esm/typings/src/types/typeAliases.d.ts +1 -1
  27. package/esm/typings/src/utils/normalization/orderJson.d.ts +21 -0
  28. package/esm/typings/src/utils/normalization/orderJson.test.d.ts +4 -0
  29. package/esm/typings/src/utils/organization/keepTypeImported.d.ts +9 -0
  30. package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +1 -1
  31. package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +20 -2
  32. package/esm/typings/src/utils/serialization/deepClone.test.d.ts +1 -0
  33. package/esm/typings/src/utils/serialization/exportJson.d.ts +29 -0
  34. package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +2 -1
  35. package/package.json +2 -2
  36. package/umd/index.umd.js +392 -315
  37. package/umd/index.umd.js.map +1 -1
  38. package/esm/typings/src/utils/serialization/$asDeeplyFrozenSerializableJson.d.ts +0 -17
  39. /package/esm/typings/src/conversion/{pipelineStringToJson.test.d.ts → compilePipeline.test.d.ts} +0 -0
  40. /package/esm/typings/src/conversion/{pipelineStringToJsonSync.test.d.ts → precompilePipeline.test.d.ts} +0 -0
package/umd/index.umd.js CHANGED
@@ -23,7 +23,7 @@
23
23
  *
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- var PROMPTBOOK_ENGINE_VERSION = '0.78.4';
26
+ var PROMPTBOOK_ENGINE_VERSION = '0.80.0-0';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
29
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -228,41 +228,6 @@
228
228
  * @public exported from `@promptbook/core`
229
229
  */
230
230
  var DEFAULT_SCRAPE_CACHE_DIRNAME = './.promptbook/scrape-cache';
231
- /**
232
- * Nonce which is used for replacing things in strings
233
- *
234
- * @private within the repository
235
- */
236
- var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
237
- /**
238
- * The names of the parameters that are reserved for special purposes
239
- *
240
- * @public exported from `@promptbook/core`
241
- */
242
- var RESERVED_PARAMETER_NAMES =
243
- /* !!!!!! $asDeeplyFrozenSerializableJson('RESERVED_PARAMETER_NAMES', _____ as const); */ [
244
- 'content',
245
- 'context',
246
- 'knowledge',
247
- 'examples',
248
- 'modelName',
249
- 'currentDate',
250
- // <- TODO: list here all command names
251
- // <- TODO: Add more like 'date', 'modelName',...
252
- // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
253
- ];
254
- /**
255
- * @@@
256
- *
257
- * @private within the repository
258
- */
259
- var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
260
- /**
261
- * @@@
262
- *
263
- * @private within the repository
264
- */
265
- var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
266
231
  // <- TODO: [🧜‍♂️]
267
232
  /**
268
233
  * @@@
@@ -297,7 +262,6 @@
297
262
  // Note: In normal situations, we check the pipeline logic:
298
263
  true);
299
264
  /**
300
- * TODO: Extract `constants.ts` from `config.ts`
301
265
  * Note: [💞] Ignore a discrepancy between file name and entity name
302
266
  * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
303
267
  */
@@ -1099,7 +1063,7 @@
1099
1063
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
1100
1064
  */
1101
1065
 
1102
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",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}],tasks:[{taskType:"PROMPT_TASK",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:"./books/prepare-persona.book.md"}];
1066
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sourceFile:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",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}],tasks:[{taskType:"PROMPT_TASK",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"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sourceFile:"./books/prepare-persona.book.md"}];
1103
1067
 
1104
1068
  /**
1105
1069
  * Prettify the html code
@@ -1147,6 +1111,7 @@
1147
1111
  /**
1148
1112
  * Converts promptbook in JSON format to string format
1149
1113
  *
1114
+ * @deprecated TODO: [🥍][🧠] Backup original files in `PipelineJson` same as in Promptbook.studio
1150
1115
  * @param pipelineJson Promptbook in JSON format (.book.json)
1151
1116
  * @returns Promptbook in string format (.book.md)
1152
1117
  * @public exported from `@promptbook/core`
@@ -1350,6 +1315,298 @@
1350
1315
  * TODO: [🧠] Should be in generated .book.md file GENERATOR_WARNING
1351
1316
  */
1352
1317
 
1318
+ /**
1319
+ * Orders JSON object by keys
1320
+ *
1321
+ * @returns The same type of object as the input re-ordered
1322
+ * @public exported from `@promptbook/utils`
1323
+ */
1324
+ function orderJson(options) {
1325
+ var value = options.value, order = options.order;
1326
+ var orderedValue = __assign(__assign({}, (order === undefined ? {} : Object.fromEntries(order.map(function (key) { return [key, undefined]; })))), value);
1327
+ return orderedValue;
1328
+ }
1329
+
1330
+ /**
1331
+ * Freezes the given object and all its nested objects recursively
1332
+ *
1333
+ * Note: `$` is used to indicate that this function is not a pure function - it mutates given object
1334
+ * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
1335
+ *
1336
+ * @returns The same object as the input, but deeply frozen
1337
+ * @public exported from `@promptbook/utils`
1338
+ */
1339
+ function $deepFreeze(objectValue) {
1340
+ var e_1, _a;
1341
+ if (Array.isArray(objectValue)) {
1342
+ return Object.freeze(objectValue.map(function (item) { return $deepFreeze(item); }));
1343
+ }
1344
+ var propertyNames = Object.getOwnPropertyNames(objectValue);
1345
+ try {
1346
+ for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
1347
+ var propertyName = propertyNames_1_1.value;
1348
+ var value = objectValue[propertyName];
1349
+ if (value && typeof value === 'object') {
1350
+ $deepFreeze(value);
1351
+ }
1352
+ }
1353
+ }
1354
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1355
+ finally {
1356
+ try {
1357
+ if (propertyNames_1_1 && !propertyNames_1_1.done && (_a = propertyNames_1.return)) _a.call(propertyNames_1);
1358
+ }
1359
+ finally { if (e_1) throw e_1.error; }
1360
+ }
1361
+ Object.freeze(objectValue);
1362
+ return objectValue;
1363
+ }
1364
+ /**
1365
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
1366
+ */
1367
+
1368
+ /**
1369
+ * Checks if the value is [🚉] serializable as JSON
1370
+ * If not, throws an UnexpectedError with a rich error message and tracking
1371
+ *
1372
+ * - Almost all primitives are serializable BUT:
1373
+ * - `undefined` is not serializable
1374
+ * - `NaN` is not serializable
1375
+ * - Objects and arrays are serializable if all their properties are serializable
1376
+ * - Functions are not serializable
1377
+ * - Circular references are not serializable
1378
+ * - `Date` objects are not serializable
1379
+ * - `Map` and `Set` objects are not serializable
1380
+ * - `RegExp` objects are not serializable
1381
+ * - `Error` objects are not serializable
1382
+ * - `Symbol` objects are not serializable
1383
+ * - And much more...
1384
+ *
1385
+ * @throws UnexpectedError if the value is not serializable as JSON
1386
+ * @public exported from `@promptbook/utils`
1387
+ */
1388
+ function checkSerializableAsJson(options) {
1389
+ var e_1, _a;
1390
+ var value = options.value, name = options.name, message = options.message;
1391
+ if (value === undefined) {
1392
+ throw new UnexpectedError("".concat(name, " is undefined"));
1393
+ }
1394
+ else if (value === null) {
1395
+ return;
1396
+ }
1397
+ else if (typeof value === 'boolean') {
1398
+ return;
1399
+ }
1400
+ else if (typeof value === 'number' && !isNaN(value)) {
1401
+ return;
1402
+ }
1403
+ else if (typeof value === 'string') {
1404
+ return;
1405
+ }
1406
+ else if (typeof value === 'symbol') {
1407
+ throw new UnexpectedError("".concat(name, " is symbol"));
1408
+ }
1409
+ else if (typeof value === 'function') {
1410
+ throw new UnexpectedError("".concat(name, " is function"));
1411
+ }
1412
+ else if (typeof value === 'object' && Array.isArray(value)) {
1413
+ for (var i = 0; i < value.length; i++) {
1414
+ checkSerializableAsJson({ name: "".concat(name, "[").concat(i, "]"), value: value[i], message: message });
1415
+ }
1416
+ }
1417
+ else if (typeof value === 'object') {
1418
+ if (value instanceof Date) {
1419
+ throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n `".concat(name, "` is Date\n\n Use `string_date_iso8601` instead\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n "); }));
1420
+ }
1421
+ else if (value instanceof Map) {
1422
+ throw new UnexpectedError("".concat(name, " is Map"));
1423
+ }
1424
+ else if (value instanceof Set) {
1425
+ throw new UnexpectedError("".concat(name, " is Set"));
1426
+ }
1427
+ else if (value instanceof RegExp) {
1428
+ throw new UnexpectedError("".concat(name, " is RegExp"));
1429
+ }
1430
+ else if (value instanceof Error) {
1431
+ throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n `".concat(name, "` is unserialized Error\n\n Use function `serializeError`\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n\n "); }));
1432
+ }
1433
+ else {
1434
+ try {
1435
+ for (var _b = __values(Object.entries(value)), _c = _b.next(); !_c.done; _c = _b.next()) {
1436
+ var _d = __read(_c.value, 2), subName = _d[0], subValue = _d[1];
1437
+ if (subValue === undefined) {
1438
+ // Note: undefined in object is serializable - it is just omited
1439
+ continue;
1440
+ }
1441
+ checkSerializableAsJson({ name: "".concat(name, ".").concat(subName), value: subValue, message: message });
1442
+ }
1443
+ }
1444
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1445
+ finally {
1446
+ try {
1447
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1448
+ }
1449
+ finally { if (e_1) throw e_1.error; }
1450
+ }
1451
+ try {
1452
+ JSON.stringify(value); // <- TODO: [0]
1453
+ }
1454
+ catch (error) {
1455
+ if (!(error instanceof Error)) {
1456
+ throw error;
1457
+ }
1458
+ throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n `".concat(name, "` is not serializable\n\n ").concat(block(error.toString()), "\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n "); }));
1459
+ }
1460
+ /*
1461
+ TODO: [0] Is there some more elegant way to check circular references?
1462
+ const seen = new Set();
1463
+ const stack = [{ value }];
1464
+ while (stack.length > 0) {
1465
+ const { value } = stack.pop()!;
1466
+ if (typeof value === 'object' && value !== null) {
1467
+ if (seen.has(value)) {
1468
+ throw new UnexpectedError(`${name} has circular reference`);
1469
+ }
1470
+ seen.add(value);
1471
+ if (Array.isArray(value)) {
1472
+ stack.push(...value.map((value) => ({ value })));
1473
+ } else {
1474
+ stack.push(...Object.values(value).map((value) => ({ value })));
1475
+ }
1476
+ }
1477
+ }
1478
+ */
1479
+ return;
1480
+ }
1481
+ }
1482
+ else {
1483
+ throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n `".concat(name, "` is unknown type\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n "); }));
1484
+ }
1485
+ }
1486
+ /**
1487
+ * TODO: Can be return type more type-safe? like `asserts options.value is JsonValue`
1488
+ * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
1489
+ * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
1490
+ */
1491
+
1492
+ /**
1493
+ * @@@
1494
+ *
1495
+ * @public exported from `@promptbook/utils`
1496
+ */
1497
+ function deepClone(objectValue) {
1498
+ return JSON.parse(JSON.stringify(objectValue));
1499
+ /*
1500
+ !!!!!!!!
1501
+ TODO: [🧠] Is there a better implementation?
1502
+ > const propertyNames = Object.getOwnPropertyNames(objectValue);
1503
+ > for (const propertyName of propertyNames) {
1504
+ > const value = (objectValue as really_any)[propertyName];
1505
+ > if (value && typeof value === 'object') {
1506
+ > deepClone(value);
1507
+ > }
1508
+ > }
1509
+ > return Object.assign({}, objectValue);
1510
+ */
1511
+ }
1512
+ /**
1513
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
1514
+ */
1515
+
1516
+ /**
1517
+ * Utility to export a JSON object from a function
1518
+ *
1519
+ * 1) Checks if the value is serializable as JSON
1520
+ * 2) Makes a deep clone of the object
1521
+ * 2) Orders the object properties
1522
+ * 2) Deeply freezes the cloned object
1523
+ *
1524
+ * Note: This function does not mutates the given object
1525
+ *
1526
+ * @returns The same type of object as the input but read-only and re-ordered
1527
+ * @public exported from `@promptbook/utils`
1528
+ */
1529
+ function exportJson(options) {
1530
+ var name = options.name, value = options.value, order = options.order, message = options.message;
1531
+ checkSerializableAsJson({ name: name, value: value, message: message });
1532
+ var orderedValue =
1533
+ // TODO: Fix error "Type instantiation is excessively deep and possibly infinite."
1534
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1535
+ // @ts-ignore
1536
+ order === undefined
1537
+ ? deepClone(value)
1538
+ : orderJson({
1539
+ value: value,
1540
+ // <- Note: checkSerializableAsJson asserts that the value is serializable as JSON
1541
+ order: order,
1542
+ });
1543
+ $deepFreeze(orderedValue);
1544
+ return orderedValue;
1545
+ }
1546
+ /**
1547
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
1548
+ */
1549
+
1550
+ /**
1551
+ * Order of keys in the pipeline JSON
1552
+ *
1553
+ * @public exported from `@promptbook/core`
1554
+ */
1555
+ var ORDER_OF_PIPELINE_JSON = [
1556
+ 'title',
1557
+ 'pipelineUrl',
1558
+ 'bookVersion',
1559
+ 'description',
1560
+ 'formfactorName',
1561
+ 'parameters',
1562
+ 'tasks',
1563
+ 'personas',
1564
+ 'preparations',
1565
+ 'knowledgeSources',
1566
+ 'knowledgePieces',
1567
+ ];
1568
+ /**
1569
+ * Nonce which is used for replacing things in strings
1570
+ *
1571
+ * @private within the repository
1572
+ */
1573
+ var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
1574
+ /**
1575
+ * @@@
1576
+ *
1577
+ * @private within the repository
1578
+ */
1579
+ var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
1580
+ /**
1581
+ * @@@
1582
+ *
1583
+ * @private within the repository
1584
+ */
1585
+ var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
1586
+ /**
1587
+ * The names of the parameters that are reserved for special purposes
1588
+ *
1589
+ * @public exported from `@promptbook/core`
1590
+ */
1591
+ var RESERVED_PARAMETER_NAMES = exportJson({
1592
+ name: 'RESERVED_PARAMETER_NAMES',
1593
+ message: "The names of the parameters that are reserved for special purposes",
1594
+ value: [
1595
+ 'content',
1596
+ 'context',
1597
+ 'knowledge',
1598
+ 'examples',
1599
+ 'modelName',
1600
+ 'currentDate',
1601
+ // <- TODO: list here all command names
1602
+ // <- TODO: Add more like 'date', 'modelName',...
1603
+ // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
1604
+ ],
1605
+ });
1606
+ /**
1607
+ * Note: [💞] Ignore a discrepancy between file name and entity name
1608
+ */
1609
+
1353
1610
  /**
1354
1611
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
1355
1612
  *
@@ -1593,6 +1850,21 @@
1593
1850
  }
1594
1851
  };
1595
1852
  try {
1853
+ /*
1854
+ TODO: [🧠][🅾] Should be empty pipeline valid or not
1855
+ // Note: Check that pipeline has some tasks
1856
+ if (pipeline.tasks.length === 0) {
1857
+ throw new PipelineLogicError(
1858
+ spaceTrim(
1859
+ (block) => `
1860
+ Pipeline must have at least one task
1861
+
1862
+ ${block(pipelineIdentification)}
1863
+ `,
1864
+ ),
1865
+ );
1866
+ }
1867
+ */
1596
1868
  // Note: Check each parameter individually
1597
1869
  for (var _d = __values(pipeline.parameters), _e = _d.next(); !_e.done; _e = _d.next()) {
1598
1870
  var parameter = _e.value;
@@ -1753,6 +2025,9 @@
1753
2025
  while (unresovedTasks.length > 0) {
1754
2026
  _loop_3();
1755
2027
  }
2028
+ // Note: Check that formfactor is corresponding to the pipeline interface
2029
+ // TODO: !!!!!! Implement this
2030
+ // pipeline.formfactorName
1756
2031
  }
1757
2032
  /**
1758
2033
  * TODO: !! [🧞‍♀️] Do not allow joker + foreach
@@ -1836,189 +2111,10 @@
1836
2111
  return parameterNames;
1837
2112
  }
1838
2113
 
1839
- /**
1840
- * @@@
1841
- *
1842
- * Note: `$` is used to indicate that this function is not a pure function - it mutates given object
1843
- * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
1844
- *
1845
- * @returns The same object as the input, but deeply frozen
1846
- * @public exported from `@promptbook/utils`
1847
- */
1848
- function $deepFreeze(objectValue) {
1849
- var e_1, _a;
1850
- if (Array.isArray(objectValue)) {
1851
- return Object.freeze(objectValue.map(function (item) { return $deepFreeze(item); }));
1852
- }
1853
- var propertyNames = Object.getOwnPropertyNames(objectValue);
1854
- try {
1855
- for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
1856
- var propertyName = propertyNames_1_1.value;
1857
- var value = objectValue[propertyName];
1858
- if (value && typeof value === 'object') {
1859
- $deepFreeze(value);
1860
- }
1861
- }
1862
- }
1863
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1864
- finally {
1865
- try {
1866
- if (propertyNames_1_1 && !propertyNames_1_1.done && (_a = propertyNames_1.return)) _a.call(propertyNames_1);
1867
- }
1868
- finally { if (e_1) throw e_1.error; }
1869
- }
1870
- return Object.freeze(objectValue);
1871
- }
1872
- /**
1873
- * TODO: [🧠] Is there a way how to meaningfully test this utility
1874
- */
1875
-
1876
- /**
1877
- * Checks if the value is [🚉] serializable as JSON
1878
- * If not, throws an UnexpectedError with a rich error message and tracking
1879
- *
1880
- * - Almost all primitives are serializable BUT:
1881
- * - `undefined` is not serializable
1882
- * - `NaN` is not serializable
1883
- * - Objects and arrays are serializable if all their properties are serializable
1884
- * - Functions are not serializable
1885
- * - Circular references are not serializable
1886
- * - `Date` objects are not serializable
1887
- * - `Map` and `Set` objects are not serializable
1888
- * - `RegExp` objects are not serializable
1889
- * - `Error` objects are not serializable
1890
- * - `Symbol` objects are not serializable
1891
- * - And much more...
1892
- *
1893
- * @throws UnexpectedError if the value is not serializable as JSON
1894
- * @public exported from `@promptbook/utils`
1895
- */
1896
- function checkSerializableAsJson(name, value) {
1897
- var e_1, _a;
1898
- if (value === undefined) {
1899
- throw new UnexpectedError("".concat(name, " is undefined"));
1900
- }
1901
- else if (value === null) {
1902
- return;
1903
- }
1904
- else if (typeof value === 'boolean') {
1905
- return;
1906
- }
1907
- else if (typeof value === 'number' && !isNaN(value)) {
1908
- return;
1909
- }
1910
- else if (typeof value === 'string') {
1911
- return;
1912
- }
1913
- else if (typeof value === 'symbol') {
1914
- throw new UnexpectedError("".concat(name, " is symbol"));
1915
- }
1916
- else if (typeof value === 'function') {
1917
- throw new UnexpectedError("".concat(name, " is function"));
1918
- }
1919
- else if (typeof value === 'object' && Array.isArray(value)) {
1920
- for (var i = 0; i < value.length; i++) {
1921
- checkSerializableAsJson("".concat(name, "[").concat(i, "]"), value[i]);
1922
- }
1923
- }
1924
- else if (typeof value === 'object') {
1925
- if (value instanceof Date) {
1926
- throw new UnexpectedError(spaceTrim__default["default"]("\n ".concat(name, " is Date\n\n Use `string_date_iso8601` instead\n ")));
1927
- }
1928
- else if (value instanceof Map) {
1929
- throw new UnexpectedError("".concat(name, " is Map"));
1930
- }
1931
- else if (value instanceof Set) {
1932
- throw new UnexpectedError("".concat(name, " is Set"));
1933
- }
1934
- else if (value instanceof RegExp) {
1935
- throw new UnexpectedError("".concat(name, " is RegExp"));
1936
- }
1937
- else if (value instanceof Error) {
1938
- throw new UnexpectedError(spaceTrim__default["default"]("\n ".concat(name, " is unserialized Error\n\n Use function `serializeError`\n ")));
1939
- }
1940
- else {
1941
- try {
1942
- for (var _b = __values(Object.entries(value)), _c = _b.next(); !_c.done; _c = _b.next()) {
1943
- var _d = __read(_c.value, 2), subName = _d[0], subValue = _d[1];
1944
- if (subValue === undefined) {
1945
- // Note: undefined in object is serializable - it is just omited
1946
- continue;
1947
- }
1948
- checkSerializableAsJson("".concat(name, ".").concat(subName), subValue);
1949
- }
1950
- }
1951
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1952
- finally {
1953
- try {
1954
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1955
- }
1956
- finally { if (e_1) throw e_1.error; }
1957
- }
1958
- try {
1959
- JSON.stringify(value); // <- TODO: [0]
1960
- }
1961
- catch (error) {
1962
- if (!(error instanceof Error)) {
1963
- throw error;
1964
- }
1965
- throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n ".concat(name, " is not serializable\n\n ").concat(block(error.toString()), "\n "); }));
1966
- }
1967
- /*
1968
- TODO: [0] Is there some more elegant way to check circular references?
1969
- const seen = new Set();
1970
- const stack = [{ value }];
1971
- while (stack.length > 0) {
1972
- const { value } = stack.pop()!;
1973
- if (typeof value === 'object' && value !== null) {
1974
- if (seen.has(value)) {
1975
- throw new UnexpectedError(`${name} has circular reference`);
1976
- }
1977
- seen.add(value);
1978
- if (Array.isArray(value)) {
1979
- stack.push(...value.map((value) => ({ value })));
1980
- } else {
1981
- stack.push(...Object.values(value).map((value) => ({ value })));
1982
- }
1983
- }
1984
- }
1985
- */
1986
- return;
1987
- }
1988
- }
1989
- else {
1990
- throw new UnexpectedError("".concat(name, " is unknown"));
1991
- }
1992
- }
1993
- /**
1994
- * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
1995
- * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
1996
- * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
1997
- */
1998
-
1999
- /**
2000
- * @@@
2001
- * @@@
2002
- *
2003
- * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
2004
- *
2005
- * @param name - Name of the object for debugging purposes
2006
- * @param objectValue - Object to be deeply frozen
2007
- * @returns The same object as the input, but deeply frozen
2008
- * @private this is in comparison to `deepFreeze` a more specific utility and maybe not very good practice to use without specific reason and considerations
2009
- */
2010
- function $asDeeplyFrozenSerializableJson(name, objectValue) {
2011
- checkSerializableAsJson(name, objectValue);
2012
- return $deepFreeze(objectValue);
2013
- }
2014
- /**
2015
- * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
2016
- * TODO: [🧠] Is there a way how to meaningfully test this utility
2017
- */
2018
-
2019
2114
  /**
2020
2115
  * Unprepare just strips the preparation data of the pipeline
2021
2116
  *
2117
+ * @deprecated In future version this function will be removed or deprecated
2022
2118
  * @public exported from `@promptbook/core`
2023
2119
  */
2024
2120
  function unpreparePipeline(pipeline) {
@@ -2033,7 +2129,12 @@
2033
2129
  delete taskUnprepared.preparedContent;
2034
2130
  return taskUnprepared;
2035
2131
  });
2036
- return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
2132
+ return exportJson({
2133
+ name: 'pipelineJson',
2134
+ message: "Result of `unpreparePipeline`",
2135
+ order: ORDER_OF_PIPELINE_JSON,
2136
+ value: __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }),
2137
+ });
2037
2138
  }
2038
2139
  /**
2039
2140
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
@@ -2547,29 +2648,6 @@
2547
2648
  * Note: [💞] Ignore a discrepancy between file name and entity name
2548
2649
  */
2549
2650
 
2550
- /**
2551
- * @@@
2552
- *
2553
- * @public exported from `@promptbook/utils`
2554
- */
2555
- function deepClone(objectValue) {
2556
- return JSON.parse(JSON.stringify(objectValue));
2557
- /*
2558
- TODO: [🧠] Is there a better implementation?
2559
- > const propertyNames = Object.getOwnPropertyNames(objectValue);
2560
- > for (const propertyName of propertyNames) {
2561
- > const value = (objectValue as really_any)[propertyName];
2562
- > if (value && typeof value === 'object') {
2563
- > deepClone(value);
2564
- > }
2565
- > }
2566
- > return Object.assign({}, objectValue);
2567
- */
2568
- }
2569
- /**
2570
- * TODO: [🧠] Is there a way how to meaningfully test this utility
2571
- */
2572
-
2573
2651
  /**
2574
2652
  * Function `addUsage` will add multiple usages into one
2575
2653
  *
@@ -3700,36 +3778,6 @@
3700
3778
  * [ ] One piece can have multiple sources
3701
3779
  */
3702
3780
 
3703
- /**
3704
- * @@@
3705
- *
3706
- * Note: It is usefull @@@
3707
- *
3708
- * @param pipeline
3709
- * @public exported from `@promptbook/utils`
3710
- */
3711
- function clonePipeline(pipeline) {
3712
- // Note: Not using spread operator (...) because @@@
3713
- var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, bookVersion = pipeline.bookVersion, description = pipeline.description, formfactorName = pipeline.formfactorName, parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
3714
- return {
3715
- pipelineUrl: pipelineUrl,
3716
- sourceFile: sourceFile,
3717
- title: title,
3718
- bookVersion: bookVersion,
3719
- description: description,
3720
- formfactorName: formfactorName,
3721
- parameters: parameters,
3722
- tasks: tasks,
3723
- knowledgeSources: knowledgeSources,
3724
- knowledgePieces: knowledgePieces,
3725
- personas: personas,
3726
- preparations: preparations,
3727
- };
3728
- }
3729
- /**
3730
- * TODO: [🍙] Make some standard order of json properties
3731
- */
3732
-
3733
3781
  /**
3734
3782
  * @@@
3735
3783
  *
@@ -3770,6 +3818,7 @@
3770
3818
  });
3771
3819
  }
3772
3820
  /**
3821
+ * TODO: [😂] Adding knowledge should be convert to async high-level abstractions, simmilar thing with expectations to sync high-level abstractions
3773
3822
  * TODO: [🧠] Add context to each task (if missing)
3774
3823
  * TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
3775
3824
  * TODO: [♨][main] !!! Prepare index the examples and maybe tasks
@@ -3858,11 +3907,19 @@
3858
3907
  case 3:
3859
3908
  tasksPrepared = (_c.sent()).tasksPrepared;
3860
3909
  // ----- /Tasks preparation -----
3910
+ // TODO: [😂] Use here all `AsyncHighLevelAbstraction`
3861
3911
  // Note: Count total usage
3862
3912
  currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
3863
- return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { tasks: __spreadArray([], __read(tasksPrepared), false),
3864
- // <- TODO: [🪓] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
3865
- knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }))];
3913
+ return [2 /*return*/, exportJson({
3914
+ name: 'pipelineJson',
3915
+ message: "Result of `preparePipeline`",
3916
+ order: ORDER_OF_PIPELINE_JSON,
3917
+ value: __assign(__assign({}, pipeline), {
3918
+ // <- TODO: Probbably deeply clone the pipeline because `$exportJson` freezes the subobjects
3919
+ knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, tasks: __spreadArray([], __read(tasksPrepared), false),
3920
+ // <- TODO: [🪓] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
3921
+ personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }),
3922
+ })];
3866
3923
  }
3867
3924
  });
3868
3925
  });
@@ -5559,16 +5616,21 @@
5559
5616
  // Note: Wait a short time to prevent race conditions
5560
5617
  _g.sent();
5561
5618
  _g.label = 6;
5562
- case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
5563
- isSuccessful: false,
5564
- errors: __spreadArray([
5565
- new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
5566
- ], __read(errors), false).map(serializeError),
5567
- warnings: [],
5568
- executionReport: executionReport,
5569
- outputParameters: {},
5570
- usage: ZERO_USAGE,
5571
- preparedPipeline: preparedPipeline,
5619
+ case 6: return [2 /*return*/, exportJson({
5620
+ name: "executionReport",
5621
+ message: "Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"),
5622
+ order: [],
5623
+ value: {
5624
+ isSuccessful: false,
5625
+ errors: __spreadArray([
5626
+ new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
5627
+ ], __read(errors), false).map(serializeError),
5628
+ warnings: [],
5629
+ executionReport: executionReport,
5630
+ outputParameters: {},
5631
+ usage: ZERO_USAGE,
5632
+ preparedPipeline: preparedPipeline,
5633
+ },
5572
5634
  })];
5573
5635
  case 7:
5574
5636
  _b = _a.next();
@@ -5607,16 +5669,21 @@
5607
5669
  // Note: Wait a short time to prevent race conditions
5608
5670
  _h.sent();
5609
5671
  _h.label = 3;
5610
- case 3: return [2 /*return*/, { value: $asDeeplyFrozenSerializableJson(spaceTrim.spaceTrim(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }), {
5611
- isSuccessful: false,
5612
- errors: __spreadArray([
5613
- new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
5614
- ], __read(errors), false).map(serializeError),
5615
- warnings: warnings.map(serializeError),
5616
- executionReport: executionReport,
5617
- outputParameters: {},
5618
- usage: ZERO_USAGE,
5619
- preparedPipeline: preparedPipeline,
5672
+ case 3: return [2 /*return*/, { value: exportJson({
5673
+ name: 'pipelineExecutorResult',
5674
+ message: spaceTrim.spaceTrim(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }),
5675
+ order: [],
5676
+ value: {
5677
+ isSuccessful: false,
5678
+ errors: __spreadArray([
5679
+ new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
5680
+ ], __read(errors), false).map(serializeError),
5681
+ warnings: warnings.map(serializeError),
5682
+ executionReport: executionReport,
5683
+ outputParameters: {},
5684
+ usage: ZERO_USAGE,
5685
+ preparedPipeline: preparedPipeline,
5686
+ },
5620
5687
  }) }];
5621
5688
  case 4: return [2 /*return*/];
5622
5689
  }
@@ -5770,14 +5837,19 @@
5770
5837
  // Note: Wait a short time to prevent race conditions
5771
5838
  _g.sent();
5772
5839
  _g.label = 27;
5773
- case 27: return [2 /*return*/, $asDeeplyFrozenSerializableJson('Unuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult', {
5774
- isSuccessful: false,
5775
- errors: __spreadArray([error_1], __read(errors), false).map(serializeError),
5776
- warnings: warnings.map(serializeError),
5777
- usage: usage_1,
5778
- executionReport: executionReport,
5779
- outputParameters: outputParameters_1,
5780
- preparedPipeline: preparedPipeline,
5840
+ case 27: return [2 /*return*/, exportJson({
5841
+ name: 'pipelineExecutorResult',
5842
+ message: "Unuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult",
5843
+ order: [],
5844
+ value: {
5845
+ isSuccessful: false,
5846
+ errors: __spreadArray([error_1], __read(errors), false).map(serializeError),
5847
+ warnings: warnings.map(serializeError),
5848
+ usage: usage_1,
5849
+ executionReport: executionReport,
5850
+ outputParameters: outputParameters_1,
5851
+ preparedPipeline: preparedPipeline,
5852
+ },
5781
5853
  })];
5782
5854
  case 28:
5783
5855
  usage = addUsage.apply(void 0, __spreadArray([], __read(executionReport.promptExecutions.map(function (_a) {
@@ -5798,14 +5870,19 @@
5798
5870
  // Note: Wait a short time to prevent race conditions
5799
5871
  _g.sent();
5800
5872
  _g.label = 30;
5801
- case 30: return [2 /*return*/, $asDeeplyFrozenSerializableJson('Successful PipelineExecutorResult', {
5802
- isSuccessful: true,
5803
- errors: errors.map(serializeError),
5804
- warnings: warnings.map(serializeError),
5805
- usage: usage,
5806
- executionReport: executionReport,
5807
- outputParameters: outputParameters,
5808
- preparedPipeline: preparedPipeline,
5873
+ case 30: return [2 /*return*/, exportJson({
5874
+ name: 'pipelineExecutorResult',
5875
+ message: "Successful PipelineExecutorResult",
5876
+ order: [],
5877
+ value: {
5878
+ isSuccessful: true,
5879
+ errors: errors.map(serializeError),
5880
+ warnings: warnings.map(serializeError),
5881
+ usage: usage,
5882
+ executionReport: executionReport,
5883
+ outputParameters: outputParameters,
5884
+ preparedPipeline: preparedPipeline,
5885
+ },
5809
5886
  })];
5810
5887
  }
5811
5888
  });
@@ -5889,7 +5966,7 @@
5889
5966
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
5890
5967
  isAvilableInBrowser: true,
5891
5968
  requiredExecutables: [],
5892
- }); /* <- TODO: [🤛] */
5969
+ }); /* <- Note: [🤛] */
5893
5970
  /**
5894
5971
  * Registration of known scraper metadata
5895
5972
  *
@@ -6086,7 +6163,7 @@
6086
6163
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
6087
6164
  isAvilableInBrowser: false,
6088
6165
  requiredExecutables: ['Pandoc'],
6089
- }); /* <- TODO: [🤛] */
6166
+ }); /* <- Note: [🤛] */
6090
6167
  /**
6091
6168
  * Registration of known scraper metadata
6092
6169
  *
@@ -6253,7 +6330,7 @@
6253
6330
  'LibreOffice',
6254
6331
  // <- TODO: [🧠] Should be 'LibreOffice' here, its dependency of dependency
6255
6332
  ],
6256
- }); /* <- TODO: [🤛] */
6333
+ }); /* <- Note: [🤛] */
6257
6334
  /**
6258
6335
  * Registration of known scraper metadata
6259
6336
  *
@@ -6419,7 +6496,7 @@
6419
6496
  */
6420
6497
  var createLegacyDocumentScraper = Object.assign(function (tools, options) {
6421
6498
  return new LegacyDocumentScraper(tools, options);
6422
- }, legacyDocumentScraperMetadata); /* <- TODO: [🤛] */
6499
+ }, legacyDocumentScraperMetadata); /* <- Note: [🤛] */
6423
6500
  /**
6424
6501
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
6425
6502
  */