@promptbook/cli 0.78.3 → 0.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <!-- ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten -->
2
2
 
3
- # ![Promptbook logo - cube with letters P and B](./other/design/logo-h1.png) Promptbook
3
+ # Promptbook
4
4
 
5
5
 
6
6
 
@@ -14,7 +14,7 @@
14
14
 
15
15
 
16
16
 
17
- ## New Features
17
+ ## New Features
18
18
 
19
19
  - 💙 Working [the **Book** language v1.0.0](https://github.com/webgptorg/book)
20
20
  - 🖤 Run books from CLI - `npx ptbk run path/to/your/book`
package/esm/index.es.js CHANGED
@@ -37,7 +37,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
37
37
  *
38
38
  * @see https://github.com/webgptorg/promptbook
39
39
  */
40
- var PROMPTBOOK_ENGINE_VERSION = '0.78.2';
40
+ var PROMPTBOOK_ENGINE_VERSION = '0.78.4';
41
41
  /**
42
42
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
43
43
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1534,6 +1534,9 @@ function deepClone(objectValue) {
1534
1534
  */
1535
1535
  function $deepFreeze(objectValue) {
1536
1536
  var e_1, _a;
1537
+ if (Array.isArray(objectValue)) {
1538
+ return Object.freeze(objectValue.map(function (item) { return $deepFreeze(item); }));
1539
+ }
1537
1540
  var propertyNames = Object.getOwnPropertyNames(objectValue);
1538
1541
  try {
1539
1542
  for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
@@ -6533,6 +6536,133 @@ function preparePipeline(pipeline, tools, options) {
6533
6536
  * @see https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/increase-consistency#specify-the-desired-output-format
6534
6537
  */
6535
6538
 
6539
+ /**
6540
+ * @@@
6541
+ *
6542
+ * @deprecated https://github.com/webgptorg/promptbook/pull/186
6543
+ * @see https://github.com/webgptorg/promptbook/discussions/171
6544
+ *
6545
+ * @public exported from `@promptbook/core`
6546
+ */
6547
+ function getPipelineInterface(pipeline) {
6548
+ var e_1, _a, e_2, _b;
6549
+ var pipelineInterface = {
6550
+ inputParameters: [],
6551
+ outputParameters: [],
6552
+ };
6553
+ try {
6554
+ for (var _c = __values(pipeline.parameters), _d = _c.next(); !_d.done; _d = _c.next()) {
6555
+ var parameter = _d.value;
6556
+ var isInput = parameter.isInput, isOutput = parameter.isOutput;
6557
+ if (isInput) {
6558
+ pipelineInterface.inputParameters.push(deepClone(parameter));
6559
+ }
6560
+ if (isOutput) {
6561
+ pipelineInterface.outputParameters.push(deepClone(parameter));
6562
+ }
6563
+ }
6564
+ }
6565
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
6566
+ finally {
6567
+ try {
6568
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
6569
+ }
6570
+ finally { if (e_1) throw e_1.error; }
6571
+ }
6572
+ try {
6573
+ for (var _e = __values(['inputParameters', 'outputParameters']), _f = _e.next(); !_f.done; _f = _e.next()) {
6574
+ var key = _f.value;
6575
+ pipelineInterface[key].sort(function (_a, _b) {
6576
+ var name1 = _a.name;
6577
+ var name2 = _b.name;
6578
+ return name1.localeCompare(name2);
6579
+ });
6580
+ }
6581
+ }
6582
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
6583
+ finally {
6584
+ try {
6585
+ if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
6586
+ }
6587
+ finally { if (e_2) throw e_2.error; }
6588
+ }
6589
+ return $deepFreeze(pipelineInterface);
6590
+ }
6591
+
6592
+ /**
6593
+ * @@@
6594
+ *
6595
+ * @deprecated https://github.com/webgptorg/promptbook/pull/186
6596
+ * @see https://github.com/webgptorg/promptbook/discussions/171
6597
+ *
6598
+ * @public exported from `@promptbook/core`
6599
+ */
6600
+ function isPipelineInterfacesEqual(pipelineInterface1, pipelineInterface2) {
6601
+ var e_1, _a, e_2, _b;
6602
+ try {
6603
+ for (var _c = __values(['inputParameters', 'outputParameters']), _d = _c.next(); !_d.done; _d = _c.next()) {
6604
+ var whichParameters = _d.value;
6605
+ var parameters1 = pipelineInterface1[whichParameters]; // <- Note: `isPipelineInterfacesEqual` is just temporary solution, no need to fix this
6606
+ var parameters2 = pipelineInterface2[whichParameters];
6607
+ if (parameters1.length !== parameters2.length) {
6608
+ return false;
6609
+ }
6610
+ var _loop_1 = function (parameter) {
6611
+ var matchingParameter = parameters2.find(function (_a) {
6612
+ var name = _a.name;
6613
+ return name === parameter.name;
6614
+ });
6615
+ if (!matchingParameter) {
6616
+ return { value: false };
6617
+ }
6618
+ // Note: Do not compare description, it is not relevant for compatibility
6619
+ if (matchingParameter.isInput !== parameter.isInput) {
6620
+ return { value: false };
6621
+ }
6622
+ if (matchingParameter.isOutput !== parameter.isOutput) {
6623
+ return { value: false };
6624
+ }
6625
+ };
6626
+ try {
6627
+ for (var parameters1_1 = (e_2 = void 0, __values(parameters1)), parameters1_1_1 = parameters1_1.next(); !parameters1_1_1.done; parameters1_1_1 = parameters1_1.next()) {
6628
+ var parameter = parameters1_1_1.value;
6629
+ var state_1 = _loop_1(parameter);
6630
+ if (typeof state_1 === "object")
6631
+ return state_1.value;
6632
+ }
6633
+ }
6634
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
6635
+ finally {
6636
+ try {
6637
+ if (parameters1_1_1 && !parameters1_1_1.done && (_b = parameters1_1.return)) _b.call(parameters1_1);
6638
+ }
6639
+ finally { if (e_2) throw e_2.error; }
6640
+ }
6641
+ }
6642
+ }
6643
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
6644
+ finally {
6645
+ try {
6646
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
6647
+ }
6648
+ finally { if (e_1) throw e_1.error; }
6649
+ }
6650
+ return true;
6651
+ }
6652
+
6653
+ /**
6654
+ * @@@
6655
+ *
6656
+ * @deprecated https://github.com/webgptorg/promptbook/pull/186
6657
+ * @see https://github.com/webgptorg/promptbook/discussions/171
6658
+ *
6659
+ * @public exported from `@promptbook/core`
6660
+ */
6661
+ function isPipelineImplementingInterface(options) {
6662
+ var pipeline = options.pipeline, pipelineInterface = options.pipelineInterface;
6663
+ return isPipelineInterfacesEqual(getPipelineInterface(pipeline), pipelineInterface);
6664
+ }
6665
+
6536
6666
  /**
6537
6667
  * All available task types
6538
6668
  *
@@ -7676,7 +7806,13 @@ var GeneratorFormfactorDefinition = {
7676
7806
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/184",
7677
7807
  pipelineInterface: {
7678
7808
  inputParameters: [
7679
- /* @@@ */
7809
+ /* @@@ */
7810
+ {
7811
+ name: 'nonce',
7812
+ description: 'Just to prevent GENERATOR to be set as implicit formfactor',
7813
+ isInput: true,
7814
+ isOutput: false,
7815
+ },
7680
7816
  ],
7681
7817
  outputParameters: [
7682
7818
  /* @@@ */
@@ -7722,7 +7858,13 @@ var MatcherFormfactorDefinition = {
7722
7858
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/177",
7723
7859
  pipelineInterface: {
7724
7860
  inputParameters: [
7725
- /* @@@ */
7861
+ /* @@@ */
7862
+ {
7863
+ name: 'nonce',
7864
+ description: 'Just to prevent EXPERIMENTAL_MATCHER to be set as implicit formfactor',
7865
+ isInput: true,
7866
+ isOutput: false,
7867
+ },
7726
7868
  ],
7727
7869
  outputParameters: [
7728
7870
  /* @@@ */
@@ -7871,6 +8013,9 @@ var formfactorCommandParser = {
7871
8013
  * Note: `$` is used to indicate that this function mutates given `pipelineJson`
7872
8014
  */
7873
8015
  $applyToPipelineJson: function (command, $pipelineJson) {
8016
+ if ($pipelineJson.formfactorName !== undefined && $pipelineJson.formfactorName !== command.formfactorName) {
8017
+ throw new ParseError(spaceTrim("\n Redefinition of `FORMFACTOR` in the pipeline head\n\n You have used:\n 1) FORMFACTOR `".concat($pipelineJson.formfactorName, "`\n 2) FORMFACTOR `").concat(command.formfactorName, "`\n ")));
8018
+ }
7874
8019
  $pipelineJson.formfactorName = command.formfactorName;
7875
8020
  },
7876
8021
  /**
@@ -8058,7 +8203,7 @@ var modelCommandParser = {
8058
8203
  // <- TODO: [🚎][💩] Some better way how to get warnings from pipeline parsing / logic
8059
8204
  }
8060
8205
  else {
8061
- throw new ParseError(spaceTrim("\n Redefinition of MODEL `".concat(command.key, "` in the pipeline head\n\n You have used:\n - MODEL ").concat(command.key, " ").concat($pipelineJson.defaultModelRequirements[command.key], "\n - MODEL ").concat(command.key, " ").concat(command.value, "\n ")));
8206
+ throw new ParseError(spaceTrim("\n Redefinition of `MODEL ".concat(command.key, "` in the pipeline head\n\n You have used:\n 1) `MODEL ").concat(command.key, " ").concat($pipelineJson.defaultModelRequirements[command.key], "`\n 2) `MODEL ").concat(command.key, " ").concat(command.value, "`\n ")));
8062
8207
  }
8063
8208
  }
8064
8209
  $pipelineJson.defaultModelRequirements[command.key] = command.value;
@@ -9127,20 +9272,15 @@ function removeContentComments(content) {
9127
9272
  * @public exported from `@promptbook/core`
9128
9273
  */
9129
9274
  function pipelineStringToJsonSync(pipelineString) {
9130
- var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e;
9275
+ var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
9131
9276
  var $pipelineJson = {
9132
- title: undefined /* <- Note: [🍙] Putting here placeholder to keep `title` on top at final JSON */,
9133
- pipelineUrl: undefined /* <- Note: Putting here placeholder to keep `pipelineUrl` on top at final JSON */,
9134
- bookVersion: undefined /* <- Note: By default no explicit version */,
9135
- description: undefined /* <- Note: [🍙] Putting here placeholder to keep `description` on top at final JSON */,
9136
- formfactorName: 'GENERIC',
9277
+ title: DEFAULT_TITLE,
9137
9278
  parameters: [],
9138
9279
  tasks: [],
9139
9280
  knowledgeSources: [],
9140
9281
  knowledgePieces: [],
9141
9282
  personas: [],
9142
9283
  preparations: [],
9143
- // <- TODO: [🍙] Some standard order of properties
9144
9284
  };
9145
9285
  function getPipelineIdentification() {
9146
9286
  // Note: This is a 😐 implementation of [🚞]
@@ -9156,7 +9296,7 @@ function pipelineStringToJsonSync(pipelineString) {
9156
9296
  // =============================================================
9157
9297
  // Note: 1️⃣ Parsing of the markdown into object
9158
9298
  if (pipelineString.startsWith('#!')) {
9159
- var _f = __read(pipelineString.split('\n')), shebangLine_1 = _f[0], restLines = _f.slice(1);
9299
+ var _g = __read(pipelineString.split('\n')), shebangLine_1 = _g[0], restLines = _g.slice(1);
9160
9300
  if (!(shebangLine_1 || '').includes('ptbk')) {
9161
9301
  throw new ParseError(spaceTrim$1(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 "); }));
9162
9302
  }
@@ -9166,7 +9306,7 @@ function pipelineStringToJsonSync(pipelineString) {
9166
9306
  pipelineString = flattenMarkdown(pipelineString) /* <- Note: [🥞] */;
9167
9307
  pipelineString = pipelineString.replaceAll(/`\{(?<parameterName>[a-z0-9_]+)\}`/gi, '{$<parameterName>}');
9168
9308
  pipelineString = pipelineString.replaceAll(/`->\s+\{(?<parameterName>[a-z0-9_]+)\}`/gi, '-> {$<parameterName>}');
9169
- var _g = __read(splitMarkdownIntoSections(pipelineString).map(parseMarkdownSection)), pipelineHead = _g[0], pipelineSections = _g.slice(1); /* <- Note: [🥞] */
9309
+ var _h = __read(splitMarkdownIntoSections(pipelineString).map(parseMarkdownSection)), pipelineHead = _h[0], pipelineSections = _h.slice(1); /* <- Note: [🥞] */
9170
9310
  if (pipelineHead === undefined) {
9171
9311
  throw new UnexpectedError(spaceTrim$1(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 "); }));
9172
9312
  }
@@ -9288,10 +9428,10 @@ function pipelineStringToJsonSync(pipelineString) {
9288
9428
  return nameWithSuffix;
9289
9429
  };
9290
9430
  var _loop_2 = function (section) {
9291
- var e_6, _m, e_7, _o;
9431
+ var e_7, _o, e_8, _p;
9292
9432
  // TODO: Parse section's description (the content out of the codeblock and lists)
9293
9433
  var listItems_2 = extractAllListItemsFromMarkdown(section.content);
9294
- var _p = extractOneBlockFromMarkdown(section.content), language = _p.language, content = _p.content;
9434
+ var _q = extractOneBlockFromMarkdown(section.content), language = _q.language, content = _q.content;
9295
9435
  // TODO: [🎾][1] DRY description
9296
9436
  var description_1 = section.content;
9297
9437
  // Note: Remove codeblocks - TODO: [🎾]
@@ -9355,17 +9495,17 @@ function pipelineStringToJsonSync(pipelineString) {
9355
9495
  };
9356
9496
  try {
9357
9497
  // TODO [♓️] List commands and before apply order them to achieve order-agnostic commands
9358
- for (var commands_1 = (e_6 = void 0, __values(commands)), commands_1_1 = commands_1.next(); !commands_1_1.done; commands_1_1 = commands_1.next()) {
9359
- var _q = commands_1_1.value, listItem = _q.listItem, command = _q.command;
9498
+ for (var commands_1 = (e_7 = void 0, __values(commands)), commands_1_1 = commands_1.next(); !commands_1_1.done; commands_1_1 = commands_1.next()) {
9499
+ var _r = commands_1_1.value, listItem = _r.listItem, command = _r.command;
9360
9500
  _loop_4(listItem, command);
9361
9501
  }
9362
9502
  }
9363
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
9503
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
9364
9504
  finally {
9365
9505
  try {
9366
- if (commands_1_1 && !commands_1_1.done && (_m = commands_1.return)) _m.call(commands_1);
9506
+ if (commands_1_1 && !commands_1_1.done && (_o = commands_1.return)) _o.call(commands_1);
9367
9507
  }
9368
- finally { if (e_6) throw e_6.error; }
9508
+ finally { if (e_7) throw e_7.error; }
9369
9509
  }
9370
9510
  // TODO: [🍧] Should be done in SECTION command
9371
9511
  if ($taskJson.taskType === 'SCRIPT_TASK') {
@@ -9379,8 +9519,8 @@ function pipelineStringToJsonSync(pipelineString) {
9379
9519
  }
9380
9520
  $taskJson.dependentParameterNames = Array.from(extractParameterNamesFromTask($taskJson));
9381
9521
  try {
9382
- for (var _r = (e_7 = void 0, __values($taskJson.dependentParameterNames)), _s = _r.next(); !_s.done; _s = _r.next()) {
9383
- var parameterName = _s.value;
9522
+ for (var _s = (e_8 = void 0, __values($taskJson.dependentParameterNames)), _t = _s.next(); !_t.done; _t = _s.next()) {
9523
+ var parameterName = _t.value;
9384
9524
  // TODO: [🧠] This definition should be made first in the task
9385
9525
  defineParam({
9386
9526
  parameterName: parameterName,
@@ -9391,12 +9531,12 @@ function pipelineStringToJsonSync(pipelineString) {
9391
9531
  });
9392
9532
  }
9393
9533
  }
9394
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
9534
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
9395
9535
  finally {
9396
9536
  try {
9397
- if (_s && !_s.done && (_o = _r.return)) _o.call(_r);
9537
+ if (_t && !_t.done && (_p = _s.return)) _p.call(_s);
9398
9538
  }
9399
- finally { if (e_7) throw e_7.error; }
9539
+ finally { if (e_8) throw e_8.error; }
9400
9540
  }
9401
9541
  /*
9402
9542
  // TODO: [🍧] This should be checked in `MODEL` command + better error message
@@ -9445,18 +9585,22 @@ function pipelineStringToJsonSync(pipelineString) {
9445
9585
  var isThisParameterResulting = $pipelineJson.tasks.some(function (task) { return task.resultingParameterName === parameter.name; });
9446
9586
  if (!isThisParameterResulting) {
9447
9587
  parameter.isInput = true;
9588
+ // <- TODO: [💔] Why this is making typescript error in vscode but not in cli
9589
+ // > Type 'true' is not assignable to type 'false'.ts(2322)
9590
+ // > (property) isInput: false
9591
+ // > The parameter is input of the pipeline The parameter is NOT input of the pipeline
9448
9592
  }
9449
9593
  };
9450
9594
  try {
9451
- for (var _h = __values($pipelineJson.parameters), _j = _h.next(); !_j.done; _j = _h.next()) {
9452
- var parameter = _j.value;
9595
+ for (var _j = __values($pipelineJson.parameters), _k = _j.next(); !_k.done; _k = _j.next()) {
9596
+ var parameter = _k.value;
9453
9597
  _loop_3(parameter);
9454
9598
  }
9455
9599
  }
9456
9600
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
9457
9601
  finally {
9458
9602
  try {
9459
- if (_j && !_j.done && (_d = _h.return)) _d.call(_h);
9603
+ if (_k && !_k.done && (_d = _j.return)) _d.call(_j);
9460
9604
  }
9461
9605
  finally { if (e_4) throw e_4.error; }
9462
9606
  }
@@ -9465,17 +9609,18 @@ function pipelineStringToJsonSync(pipelineString) {
9465
9609
  // Note: 7️⃣ Mark all non-INPUT parameters as OUTPUT if any OUTPUT is not set
9466
9610
  if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isOutput; })) {
9467
9611
  try {
9468
- for (var _k = __values($pipelineJson.parameters), _l = _k.next(); !_l.done; _l = _k.next()) {
9469
- var parameter = _l.value;
9612
+ for (var _l = __values($pipelineJson.parameters), _m = _l.next(); !_m.done; _m = _l.next()) {
9613
+ var parameter = _m.value;
9470
9614
  if (!parameter.isInput) {
9471
9615
  parameter.isOutput = true;
9616
+ // <- TODO: [💔]
9472
9617
  }
9473
9618
  }
9474
9619
  }
9475
9620
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
9476
9621
  finally {
9477
9622
  try {
9478
- if (_l && !_l.done && (_e = _k.return)) _e.call(_k);
9623
+ if (_m && !_m.done && (_e = _l.return)) _e.call(_l);
9479
9624
  }
9480
9625
  finally { if (e_5) throw e_5.error; }
9481
9626
  }
@@ -9483,7 +9628,7 @@ function pipelineStringToJsonSync(pipelineString) {
9483
9628
  // =============================================================
9484
9629
  // Note: 8️⃣ Cleanup of undefined values
9485
9630
  $pipelineJson.tasks.forEach(function (tasks) {
9486
- var e_8, _a;
9631
+ var e_9, _a;
9487
9632
  try {
9488
9633
  for (var _b = __values(Object.entries(tasks)), _c = _b.next(); !_c.done; _c = _b.next()) {
9489
9634
  var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
@@ -9492,16 +9637,16 @@ function pipelineStringToJsonSync(pipelineString) {
9492
9637
  }
9493
9638
  }
9494
9639
  }
9495
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
9640
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
9496
9641
  finally {
9497
9642
  try {
9498
9643
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
9499
9644
  }
9500
- finally { if (e_8) throw e_8.error; }
9645
+ finally { if (e_9) throw e_9.error; }
9501
9646
  }
9502
9647
  });
9503
9648
  $pipelineJson.parameters.forEach(function (parameter) {
9504
- var e_9, _a;
9649
+ var e_10, _a;
9505
9650
  try {
9506
9651
  for (var _b = __values(Object.entries(parameter)), _c = _b.next(); !_c.done; _c = _b.next()) {
9507
9652
  var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
@@ -9510,17 +9655,61 @@ function pipelineStringToJsonSync(pipelineString) {
9510
9655
  }
9511
9656
  }
9512
9657
  }
9513
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
9658
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
9514
9659
  finally {
9515
9660
  try {
9516
9661
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
9517
9662
  }
9518
- finally { if (e_9) throw e_9.error; }
9663
+ finally { if (e_10) throw e_10.error; }
9519
9664
  }
9520
9665
  });
9666
+ try {
9667
+ // =============================================================
9668
+ // Note: 9️⃣ Implicit and default formfactor
9669
+ for (var FORMFACTOR_DEFINITIONS_1 = __values(FORMFACTOR_DEFINITIONS), FORMFACTOR_DEFINITIONS_1_1 = FORMFACTOR_DEFINITIONS_1.next(); !FORMFACTOR_DEFINITIONS_1_1.done; FORMFACTOR_DEFINITIONS_1_1 = FORMFACTOR_DEFINITIONS_1.next()) {
9670
+ var formfactorDefinition = FORMFACTOR_DEFINITIONS_1_1.value;
9671
+ // <- Note: [♓️][💩] This is the order of the formfactors, make some explicit priority
9672
+ var name_2 = formfactorDefinition.name, pipelineInterface = formfactorDefinition.pipelineInterface;
9673
+ // Note: Skip GENERIC formfactor, it will be used as a fallback if no other formfactor is compatible
9674
+ if (name_2 === 'GENERIC') {
9675
+ continue;
9676
+ }
9677
+ var isCompatible = isPipelineImplementingInterface({
9678
+ pipeline: __assign({ formfactorName: name_2 }, $pipelineJson),
9679
+ pipelineInterface: pipelineInterface,
9680
+ });
9681
+ /*/
9682
+ console.log({
9683
+ subject: `${$pipelineJson.title} implements ${name}`,
9684
+ pipelineTitle: $pipelineJson.title,
9685
+ formfactorName: name,
9686
+ isCompatible,
9687
+ formfactorInterface: pipelineInterface,
9688
+ pipelineInterface: getPipelineInterface($pipelineJson as PipelineJson),
9689
+ });
9690
+ /**/
9691
+ if (isCompatible) {
9692
+ $pipelineJson.formfactorName = name_2;
9693
+ break;
9694
+ }
9695
+ }
9696
+ }
9697
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
9698
+ finally {
9699
+ try {
9700
+ if (FORMFACTOR_DEFINITIONS_1_1 && !FORMFACTOR_DEFINITIONS_1_1.done && (_f = FORMFACTOR_DEFINITIONS_1.return)) _f.call(FORMFACTOR_DEFINITIONS_1);
9701
+ }
9702
+ finally { if (e_6) throw e_6.error; }
9703
+ }
9704
+ // Note: [🔆] If formfactor is still not set, set it to 'GENERIC'
9705
+ if ($pipelineJson.formfactorName === undefined) {
9706
+ $pipelineJson.formfactorName = 'GENERIC';
9707
+ }
9521
9708
  // =============================================================
9522
9709
  // TODO: [🍙] Maybe do reorder of `$pipelineJson` here
9523
- return $asDeeplyFrozenSerializableJson('pipelineJson', $pipelineJson);
9710
+ return $asDeeplyFrozenSerializableJson('pipelineJson', __assign({ title: DEFAULT_TITLE, pipelineUrl: undefined, bookVersion: undefined, description: undefined, formfactorName: 'GENERIC',
9711
+ // <- Note: [🔆] Setting `formfactorName` is redundant to satisfy the typescript
9712
+ parameters: [], tasks: [], knowledgeSources: [], knowledgePieces: [], personas: [], preparations: [] }, $pipelineJson));
9524
9713
  }
9525
9714
  /**
9526
9715
  * TODO: [main] !!!! Warn if used only sync version
@@ -10712,7 +10901,7 @@ function createCollectionFromDirectory(path, tools, options) {
10712
10901
  return [3 /*break*/, 7];
10713
10902
  case 6:
10714
10903
  if (isVerbose) {
10715
- console.info(colors.gray("Skipped file ".concat(fileName.split('\\').join('/'), " \u2013\u2060\u2060\u2060\u2060\u2060\u2060\u2060\u2060\u2060\u2060\u2060\u2060\u2060\u2060\u2060\u2060 Not a pipeline")));
10904
+ console.info(colors.gray("Skipped file ".concat(fileName.split('\\').join('/'), " \u2013\u2060\u2060\u2060\u2060\u2060\u2060\u2060\u2060\u2060\u2060\u2060\u2060\u2060\u2060\u2060\u2060 Not a book")));
10716
10905
  }
10717
10906
  _e.label = 7;
10718
10907
  case 7:
@@ -10759,7 +10948,7 @@ function createCollectionFromDirectory(path, tools, options) {
10759
10948
  if (!(error_1 instanceof Error)) {
10760
10949
  throw error_1;
10761
10950
  }
10762
- wrappedErrorMessage = spaceTrim(function (block) { return "\n ".concat(error_1.name, " in pipeline ").concat(fileName.split('\\').join('/'), "\u2060:\n\n ").concat(block(error_1.message), "\n\n "); });
10951
+ wrappedErrorMessage = spaceTrim(function (block) { return "\n ".concat(error_1.name, " in pipeline ").concat(fileName.split('\\').join('/'), "\u2060:\n\n Original error message:\n ").concat(block(error_1.message), "\n\n Original stack trace:\n ").concat(block(error_1.stack || ''), "\n\n ---\n\n "); }) + '\n';
10763
10952
  if (isCrashedOnError) {
10764
10953
  throw new CollectionError(wrappedErrorMessage);
10765
10954
  }