@promptbook/node 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
@@ -26,7 +26,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
26
26
  *
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- var PROMPTBOOK_ENGINE_VERSION = '0.78.2';
29
+ var PROMPTBOOK_ENGINE_VERSION = '0.78.4';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
32
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -675,6 +675,9 @@ function forEachAsync(array, options, callbackfunction) {
675
675
  */
676
676
  function $deepFreeze(objectValue) {
677
677
  var e_1, _a;
678
+ if (Array.isArray(objectValue)) {
679
+ return Object.freeze(objectValue.map(function (item) { return $deepFreeze(item); }));
680
+ }
678
681
  var propertyNames = Object.getOwnPropertyNames(objectValue);
679
682
  try {
680
683
  for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
@@ -5603,6 +5606,133 @@ function preparePipeline(pipeline, tools, options) {
5603
5606
  * @see https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/increase-consistency#specify-the-desired-output-format
5604
5607
  */
5605
5608
 
5609
+ /**
5610
+ * @@@
5611
+ *
5612
+ * @deprecated https://github.com/webgptorg/promptbook/pull/186
5613
+ * @see https://github.com/webgptorg/promptbook/discussions/171
5614
+ *
5615
+ * @public exported from `@promptbook/core`
5616
+ */
5617
+ function getPipelineInterface(pipeline) {
5618
+ var e_1, _a, e_2, _b;
5619
+ var pipelineInterface = {
5620
+ inputParameters: [],
5621
+ outputParameters: [],
5622
+ };
5623
+ try {
5624
+ for (var _c = __values(pipeline.parameters), _d = _c.next(); !_d.done; _d = _c.next()) {
5625
+ var parameter = _d.value;
5626
+ var isInput = parameter.isInput, isOutput = parameter.isOutput;
5627
+ if (isInput) {
5628
+ pipelineInterface.inputParameters.push(deepClone(parameter));
5629
+ }
5630
+ if (isOutput) {
5631
+ pipelineInterface.outputParameters.push(deepClone(parameter));
5632
+ }
5633
+ }
5634
+ }
5635
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
5636
+ finally {
5637
+ try {
5638
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
5639
+ }
5640
+ finally { if (e_1) throw e_1.error; }
5641
+ }
5642
+ try {
5643
+ for (var _e = __values(['inputParameters', 'outputParameters']), _f = _e.next(); !_f.done; _f = _e.next()) {
5644
+ var key = _f.value;
5645
+ pipelineInterface[key].sort(function (_a, _b) {
5646
+ var name1 = _a.name;
5647
+ var name2 = _b.name;
5648
+ return name1.localeCompare(name2);
5649
+ });
5650
+ }
5651
+ }
5652
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
5653
+ finally {
5654
+ try {
5655
+ if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
5656
+ }
5657
+ finally { if (e_2) throw e_2.error; }
5658
+ }
5659
+ return $deepFreeze(pipelineInterface);
5660
+ }
5661
+
5662
+ /**
5663
+ * @@@
5664
+ *
5665
+ * @deprecated https://github.com/webgptorg/promptbook/pull/186
5666
+ * @see https://github.com/webgptorg/promptbook/discussions/171
5667
+ *
5668
+ * @public exported from `@promptbook/core`
5669
+ */
5670
+ function isPipelineInterfacesEqual(pipelineInterface1, pipelineInterface2) {
5671
+ var e_1, _a, e_2, _b;
5672
+ try {
5673
+ for (var _c = __values(['inputParameters', 'outputParameters']), _d = _c.next(); !_d.done; _d = _c.next()) {
5674
+ var whichParameters = _d.value;
5675
+ var parameters1 = pipelineInterface1[whichParameters]; // <- Note: `isPipelineInterfacesEqual` is just temporary solution, no need to fix this
5676
+ var parameters2 = pipelineInterface2[whichParameters];
5677
+ if (parameters1.length !== parameters2.length) {
5678
+ return false;
5679
+ }
5680
+ var _loop_1 = function (parameter) {
5681
+ var matchingParameter = parameters2.find(function (_a) {
5682
+ var name = _a.name;
5683
+ return name === parameter.name;
5684
+ });
5685
+ if (!matchingParameter) {
5686
+ return { value: false };
5687
+ }
5688
+ // Note: Do not compare description, it is not relevant for compatibility
5689
+ if (matchingParameter.isInput !== parameter.isInput) {
5690
+ return { value: false };
5691
+ }
5692
+ if (matchingParameter.isOutput !== parameter.isOutput) {
5693
+ return { value: false };
5694
+ }
5695
+ };
5696
+ try {
5697
+ 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()) {
5698
+ var parameter = parameters1_1_1.value;
5699
+ var state_1 = _loop_1(parameter);
5700
+ if (typeof state_1 === "object")
5701
+ return state_1.value;
5702
+ }
5703
+ }
5704
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
5705
+ finally {
5706
+ try {
5707
+ if (parameters1_1_1 && !parameters1_1_1.done && (_b = parameters1_1.return)) _b.call(parameters1_1);
5708
+ }
5709
+ finally { if (e_2) throw e_2.error; }
5710
+ }
5711
+ }
5712
+ }
5713
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
5714
+ finally {
5715
+ try {
5716
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
5717
+ }
5718
+ finally { if (e_1) throw e_1.error; }
5719
+ }
5720
+ return true;
5721
+ }
5722
+
5723
+ /**
5724
+ * @@@
5725
+ *
5726
+ * @deprecated https://github.com/webgptorg/promptbook/pull/186
5727
+ * @see https://github.com/webgptorg/promptbook/discussions/171
5728
+ *
5729
+ * @public exported from `@promptbook/core`
5730
+ */
5731
+ function isPipelineImplementingInterface(options) {
5732
+ var pipeline = options.pipeline, pipelineInterface = options.pipelineInterface;
5733
+ return isPipelineInterfacesEqual(getPipelineInterface(pipeline), pipelineInterface);
5734
+ }
5735
+
5606
5736
  /**
5607
5737
  * All available task types
5608
5738
  *
@@ -6762,7 +6892,13 @@ var GeneratorFormfactorDefinition = {
6762
6892
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/184",
6763
6893
  pipelineInterface: {
6764
6894
  inputParameters: [
6765
- /* @@@ */
6895
+ /* @@@ */
6896
+ {
6897
+ name: 'nonce',
6898
+ description: 'Just to prevent GENERATOR to be set as implicit formfactor',
6899
+ isInput: true,
6900
+ isOutput: false,
6901
+ },
6766
6902
  ],
6767
6903
  outputParameters: [
6768
6904
  /* @@@ */
@@ -6808,7 +6944,13 @@ var MatcherFormfactorDefinition = {
6808
6944
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/177",
6809
6945
  pipelineInterface: {
6810
6946
  inputParameters: [
6811
- /* @@@ */
6947
+ /* @@@ */
6948
+ {
6949
+ name: 'nonce',
6950
+ description: 'Just to prevent EXPERIMENTAL_MATCHER to be set as implicit formfactor',
6951
+ isInput: true,
6952
+ isOutput: false,
6953
+ },
6812
6954
  ],
6813
6955
  outputParameters: [
6814
6956
  /* @@@ */
@@ -6957,6 +7099,9 @@ var formfactorCommandParser = {
6957
7099
  * Note: `$` is used to indicate that this function mutates given `pipelineJson`
6958
7100
  */
6959
7101
  $applyToPipelineJson: function (command, $pipelineJson) {
7102
+ if ($pipelineJson.formfactorName !== undefined && $pipelineJson.formfactorName !== command.formfactorName) {
7103
+ 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 ")));
7104
+ }
6960
7105
  $pipelineJson.formfactorName = command.formfactorName;
6961
7106
  },
6962
7107
  /**
@@ -7144,7 +7289,7 @@ var modelCommandParser = {
7144
7289
  // <- TODO: [🚎][💩] Some better way how to get warnings from pipeline parsing / logic
7145
7290
  }
7146
7291
  else {
7147
- 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 ")));
7292
+ 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 ")));
7148
7293
  }
7149
7294
  }
7150
7295
  $pipelineJson.defaultModelRequirements[command.key] = command.value;
@@ -8237,20 +8382,15 @@ function titleToName(value) {
8237
8382
  * @public exported from `@promptbook/core`
8238
8383
  */
8239
8384
  function pipelineStringToJsonSync(pipelineString) {
8240
- var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e;
8385
+ var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
8241
8386
  var $pipelineJson = {
8242
- title: undefined /* <- Note: [🍙] Putting here placeholder to keep `title` on top at final JSON */,
8243
- pipelineUrl: undefined /* <- Note: Putting here placeholder to keep `pipelineUrl` on top at final JSON */,
8244
- bookVersion: undefined /* <- Note: By default no explicit version */,
8245
- description: undefined /* <- Note: [🍙] Putting here placeholder to keep `description` on top at final JSON */,
8246
- formfactorName: 'GENERIC',
8387
+ title: DEFAULT_TITLE,
8247
8388
  parameters: [],
8248
8389
  tasks: [],
8249
8390
  knowledgeSources: [],
8250
8391
  knowledgePieces: [],
8251
8392
  personas: [],
8252
8393
  preparations: [],
8253
- // <- TODO: [🍙] Some standard order of properties
8254
8394
  };
8255
8395
  function getPipelineIdentification() {
8256
8396
  // Note: This is a 😐 implementation of [🚞]
@@ -8266,7 +8406,7 @@ function pipelineStringToJsonSync(pipelineString) {
8266
8406
  // =============================================================
8267
8407
  // Note: 1️⃣ Parsing of the markdown into object
8268
8408
  if (pipelineString.startsWith('#!')) {
8269
- var _f = __read(pipelineString.split('\n')), shebangLine_1 = _f[0], restLines = _f.slice(1);
8409
+ var _g = __read(pipelineString.split('\n')), shebangLine_1 = _g[0], restLines = _g.slice(1);
8270
8410
  if (!(shebangLine_1 || '').includes('ptbk')) {
8271
8411
  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 "); }));
8272
8412
  }
@@ -8276,7 +8416,7 @@ function pipelineStringToJsonSync(pipelineString) {
8276
8416
  pipelineString = flattenMarkdown(pipelineString) /* <- Note: [🥞] */;
8277
8417
  pipelineString = pipelineString.replaceAll(/`\{(?<parameterName>[a-z0-9_]+)\}`/gi, '{$<parameterName>}');
8278
8418
  pipelineString = pipelineString.replaceAll(/`->\s+\{(?<parameterName>[a-z0-9_]+)\}`/gi, '-> {$<parameterName>}');
8279
- var _g = __read(splitMarkdownIntoSections(pipelineString).map(parseMarkdownSection)), pipelineHead = _g[0], pipelineSections = _g.slice(1); /* <- Note: [🥞] */
8419
+ var _h = __read(splitMarkdownIntoSections(pipelineString).map(parseMarkdownSection)), pipelineHead = _h[0], pipelineSections = _h.slice(1); /* <- Note: [🥞] */
8280
8420
  if (pipelineHead === undefined) {
8281
8421
  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 "); }));
8282
8422
  }
@@ -8398,10 +8538,10 @@ function pipelineStringToJsonSync(pipelineString) {
8398
8538
  return nameWithSuffix;
8399
8539
  };
8400
8540
  var _loop_2 = function (section) {
8401
- var e_6, _m, e_7, _o;
8541
+ var e_7, _o, e_8, _p;
8402
8542
  // TODO: Parse section's description (the content out of the codeblock and lists)
8403
8543
  var listItems_2 = extractAllListItemsFromMarkdown(section.content);
8404
- var _p = extractOneBlockFromMarkdown(section.content), language = _p.language, content = _p.content;
8544
+ var _q = extractOneBlockFromMarkdown(section.content), language = _q.language, content = _q.content;
8405
8545
  // TODO: [🎾][1] DRY description
8406
8546
  var description_1 = section.content;
8407
8547
  // Note: Remove codeblocks - TODO: [🎾]
@@ -8465,17 +8605,17 @@ function pipelineStringToJsonSync(pipelineString) {
8465
8605
  };
8466
8606
  try {
8467
8607
  // TODO [♓️] List commands and before apply order them to achieve order-agnostic commands
8468
- 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()) {
8469
- var _q = commands_1_1.value, listItem = _q.listItem, command = _q.command;
8608
+ 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()) {
8609
+ var _r = commands_1_1.value, listItem = _r.listItem, command = _r.command;
8470
8610
  _loop_4(listItem, command);
8471
8611
  }
8472
8612
  }
8473
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
8613
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
8474
8614
  finally {
8475
8615
  try {
8476
- if (commands_1_1 && !commands_1_1.done && (_m = commands_1.return)) _m.call(commands_1);
8616
+ if (commands_1_1 && !commands_1_1.done && (_o = commands_1.return)) _o.call(commands_1);
8477
8617
  }
8478
- finally { if (e_6) throw e_6.error; }
8618
+ finally { if (e_7) throw e_7.error; }
8479
8619
  }
8480
8620
  // TODO: [🍧] Should be done in SECTION command
8481
8621
  if ($taskJson.taskType === 'SCRIPT_TASK') {
@@ -8489,8 +8629,8 @@ function pipelineStringToJsonSync(pipelineString) {
8489
8629
  }
8490
8630
  $taskJson.dependentParameterNames = Array.from(extractParameterNamesFromTask($taskJson));
8491
8631
  try {
8492
- for (var _r = (e_7 = void 0, __values($taskJson.dependentParameterNames)), _s = _r.next(); !_s.done; _s = _r.next()) {
8493
- var parameterName = _s.value;
8632
+ for (var _s = (e_8 = void 0, __values($taskJson.dependentParameterNames)), _t = _s.next(); !_t.done; _t = _s.next()) {
8633
+ var parameterName = _t.value;
8494
8634
  // TODO: [🧠] This definition should be made first in the task
8495
8635
  defineParam({
8496
8636
  parameterName: parameterName,
@@ -8501,12 +8641,12 @@ function pipelineStringToJsonSync(pipelineString) {
8501
8641
  });
8502
8642
  }
8503
8643
  }
8504
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
8644
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
8505
8645
  finally {
8506
8646
  try {
8507
- if (_s && !_s.done && (_o = _r.return)) _o.call(_r);
8647
+ if (_t && !_t.done && (_p = _s.return)) _p.call(_s);
8508
8648
  }
8509
- finally { if (e_7) throw e_7.error; }
8649
+ finally { if (e_8) throw e_8.error; }
8510
8650
  }
8511
8651
  /*
8512
8652
  // TODO: [🍧] This should be checked in `MODEL` command + better error message
@@ -8555,18 +8695,22 @@ function pipelineStringToJsonSync(pipelineString) {
8555
8695
  var isThisParameterResulting = $pipelineJson.tasks.some(function (task) { return task.resultingParameterName === parameter.name; });
8556
8696
  if (!isThisParameterResulting) {
8557
8697
  parameter.isInput = true;
8698
+ // <- TODO: [💔] Why this is making typescript error in vscode but not in cli
8699
+ // > Type 'true' is not assignable to type 'false'.ts(2322)
8700
+ // > (property) isInput: false
8701
+ // > The parameter is input of the pipeline The parameter is NOT input of the pipeline
8558
8702
  }
8559
8703
  };
8560
8704
  try {
8561
- for (var _h = __values($pipelineJson.parameters), _j = _h.next(); !_j.done; _j = _h.next()) {
8562
- var parameter = _j.value;
8705
+ for (var _j = __values($pipelineJson.parameters), _k = _j.next(); !_k.done; _k = _j.next()) {
8706
+ var parameter = _k.value;
8563
8707
  _loop_3(parameter);
8564
8708
  }
8565
8709
  }
8566
8710
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
8567
8711
  finally {
8568
8712
  try {
8569
- if (_j && !_j.done && (_d = _h.return)) _d.call(_h);
8713
+ if (_k && !_k.done && (_d = _j.return)) _d.call(_j);
8570
8714
  }
8571
8715
  finally { if (e_4) throw e_4.error; }
8572
8716
  }
@@ -8575,17 +8719,18 @@ function pipelineStringToJsonSync(pipelineString) {
8575
8719
  // Note: 7️⃣ Mark all non-INPUT parameters as OUTPUT if any OUTPUT is not set
8576
8720
  if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isOutput; })) {
8577
8721
  try {
8578
- for (var _k = __values($pipelineJson.parameters), _l = _k.next(); !_l.done; _l = _k.next()) {
8579
- var parameter = _l.value;
8722
+ for (var _l = __values($pipelineJson.parameters), _m = _l.next(); !_m.done; _m = _l.next()) {
8723
+ var parameter = _m.value;
8580
8724
  if (!parameter.isInput) {
8581
8725
  parameter.isOutput = true;
8726
+ // <- TODO: [💔]
8582
8727
  }
8583
8728
  }
8584
8729
  }
8585
8730
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
8586
8731
  finally {
8587
8732
  try {
8588
- if (_l && !_l.done && (_e = _k.return)) _e.call(_k);
8733
+ if (_m && !_m.done && (_e = _l.return)) _e.call(_l);
8589
8734
  }
8590
8735
  finally { if (e_5) throw e_5.error; }
8591
8736
  }
@@ -8593,7 +8738,7 @@ function pipelineStringToJsonSync(pipelineString) {
8593
8738
  // =============================================================
8594
8739
  // Note: 8️⃣ Cleanup of undefined values
8595
8740
  $pipelineJson.tasks.forEach(function (tasks) {
8596
- var e_8, _a;
8741
+ var e_9, _a;
8597
8742
  try {
8598
8743
  for (var _b = __values(Object.entries(tasks)), _c = _b.next(); !_c.done; _c = _b.next()) {
8599
8744
  var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
@@ -8602,16 +8747,16 @@ function pipelineStringToJsonSync(pipelineString) {
8602
8747
  }
8603
8748
  }
8604
8749
  }
8605
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
8750
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
8606
8751
  finally {
8607
8752
  try {
8608
8753
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
8609
8754
  }
8610
- finally { if (e_8) throw e_8.error; }
8755
+ finally { if (e_9) throw e_9.error; }
8611
8756
  }
8612
8757
  });
8613
8758
  $pipelineJson.parameters.forEach(function (parameter) {
8614
- var e_9, _a;
8759
+ var e_10, _a;
8615
8760
  try {
8616
8761
  for (var _b = __values(Object.entries(parameter)), _c = _b.next(); !_c.done; _c = _b.next()) {
8617
8762
  var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
@@ -8620,17 +8765,61 @@ function pipelineStringToJsonSync(pipelineString) {
8620
8765
  }
8621
8766
  }
8622
8767
  }
8623
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
8768
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
8624
8769
  finally {
8625
8770
  try {
8626
8771
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
8627
8772
  }
8628
- finally { if (e_9) throw e_9.error; }
8773
+ finally { if (e_10) throw e_10.error; }
8629
8774
  }
8630
8775
  });
8776
+ try {
8777
+ // =============================================================
8778
+ // Note: 9️⃣ Implicit and default formfactor
8779
+ 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()) {
8780
+ var formfactorDefinition = FORMFACTOR_DEFINITIONS_1_1.value;
8781
+ // <- Note: [♓️][💩] This is the order of the formfactors, make some explicit priority
8782
+ var name_2 = formfactorDefinition.name, pipelineInterface = formfactorDefinition.pipelineInterface;
8783
+ // Note: Skip GENERIC formfactor, it will be used as a fallback if no other formfactor is compatible
8784
+ if (name_2 === 'GENERIC') {
8785
+ continue;
8786
+ }
8787
+ var isCompatible = isPipelineImplementingInterface({
8788
+ pipeline: __assign({ formfactorName: name_2 }, $pipelineJson),
8789
+ pipelineInterface: pipelineInterface,
8790
+ });
8791
+ /*/
8792
+ console.log({
8793
+ subject: `${$pipelineJson.title} implements ${name}`,
8794
+ pipelineTitle: $pipelineJson.title,
8795
+ formfactorName: name,
8796
+ isCompatible,
8797
+ formfactorInterface: pipelineInterface,
8798
+ pipelineInterface: getPipelineInterface($pipelineJson as PipelineJson),
8799
+ });
8800
+ /**/
8801
+ if (isCompatible) {
8802
+ $pipelineJson.formfactorName = name_2;
8803
+ break;
8804
+ }
8805
+ }
8806
+ }
8807
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
8808
+ finally {
8809
+ try {
8810
+ if (FORMFACTOR_DEFINITIONS_1_1 && !FORMFACTOR_DEFINITIONS_1_1.done && (_f = FORMFACTOR_DEFINITIONS_1.return)) _f.call(FORMFACTOR_DEFINITIONS_1);
8811
+ }
8812
+ finally { if (e_6) throw e_6.error; }
8813
+ }
8814
+ // Note: [🔆] If formfactor is still not set, set it to 'GENERIC'
8815
+ if ($pipelineJson.formfactorName === undefined) {
8816
+ $pipelineJson.formfactorName = 'GENERIC';
8817
+ }
8631
8818
  // =============================================================
8632
8819
  // TODO: [🍙] Maybe do reorder of `$pipelineJson` here
8633
- return $asDeeplyFrozenSerializableJson('pipelineJson', $pipelineJson);
8820
+ return $asDeeplyFrozenSerializableJson('pipelineJson', __assign({ title: DEFAULT_TITLE, pipelineUrl: undefined, bookVersion: undefined, description: undefined, formfactorName: 'GENERIC',
8821
+ // <- Note: [🔆] Setting `formfactorName` is redundant to satisfy the typescript
8822
+ parameters: [], tasks: [], knowledgeSources: [], knowledgePieces: [], personas: [], preparations: [] }, $pipelineJson));
8634
8823
  }
8635
8824
  /**
8636
8825
  * TODO: [main] !!!! Warn if used only sync version
@@ -10133,7 +10322,7 @@ function createCollectionFromDirectory(path, tools, options) {
10133
10322
  return [3 /*break*/, 7];
10134
10323
  case 6:
10135
10324
  if (isVerbose) {
10136
- 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")));
10325
+ 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")));
10137
10326
  }
10138
10327
  _e.label = 7;
10139
10328
  case 7:
@@ -10180,7 +10369,7 @@ function createCollectionFromDirectory(path, tools, options) {
10180
10369
  if (!(error_1 instanceof Error)) {
10181
10370
  throw error_1;
10182
10371
  }
10183
- 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 "); });
10372
+ 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';
10184
10373
  if (isCrashedOnError) {
10185
10374
  throw new CollectionError(wrappedErrorMessage);
10186
10375
  }