@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.
@@ -1,4 +1,4 @@
1
- import type { WritableDeep } from 'type-fest';
1
+ import type { SetOptional, WritableDeep } from 'type-fest';
2
2
  import type { PipelineJson } from '../../../pipeline/PipelineJson/PipelineJson';
3
3
  import type { TaskJson } from '../../../pipeline/PipelineJson/TaskJson';
4
4
  import type { string_markdown_text } from '../../../types/typeAliases';
@@ -140,7 +140,7 @@ export type $TaskJson = {
140
140
  *
141
141
  * @private internal helper for command parsers
142
142
  */
143
- export type $PipelineJson = WritableDeep<PipelineJson>;
143
+ export type $PipelineJson = WritableDeep<SetOptional<PipelineJson, 'formfactorName'>>;
144
144
  /**
145
145
  * @@@
146
146
  */
@@ -8,7 +8,12 @@ export declare const GeneratorFormfactorDefinition: {
8
8
  readonly description: "@@@";
9
9
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/184";
10
10
  readonly pipelineInterface: {
11
- readonly inputParameters: readonly [];
11
+ readonly inputParameters: readonly [{
12
+ readonly name: "nonce";
13
+ readonly description: "Just to prevent GENERATOR to be set as implicit formfactor";
14
+ readonly isInput: true;
15
+ readonly isOutput: false;
16
+ }];
12
17
  readonly outputParameters: readonly [];
13
18
  };
14
19
  };
@@ -96,7 +96,12 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
96
96
  readonly description: "@@@";
97
97
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/177";
98
98
  readonly pipelineInterface: {
99
- readonly inputParameters: readonly [];
99
+ readonly inputParameters: readonly [{
100
+ readonly name: "nonce";
101
+ readonly description: "Just to prevent EXPERIMENTAL_MATCHER to be set as implicit formfactor";
102
+ readonly isInput: true;
103
+ readonly isOutput: false;
104
+ }];
100
105
  readonly outputParameters: readonly [];
101
106
  };
102
107
  }, {
@@ -104,7 +109,12 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
104
109
  readonly description: "@@@";
105
110
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/184";
106
111
  readonly pipelineInterface: {
107
- readonly inputParameters: readonly [];
112
+ readonly inputParameters: readonly [{
113
+ readonly name: "nonce";
114
+ readonly description: "Just to prevent GENERATOR to be set as implicit formfactor";
115
+ readonly isInput: true;
116
+ readonly isOutput: false;
117
+ }];
108
118
  readonly outputParameters: readonly [];
109
119
  };
110
120
  }];
@@ -8,7 +8,12 @@ export declare const MatcherFormfactorDefinition: {
8
8
  readonly description: "@@@";
9
9
  readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/177";
10
10
  readonly pipelineInterface: {
11
- readonly inputParameters: readonly [];
11
+ readonly inputParameters: readonly [{
12
+ readonly name: "nonce";
13
+ readonly description: "Just to prevent EXPERIMENTAL_MATCHER to be set as implicit formfactor";
14
+ readonly isInput: true;
15
+ readonly isOutput: false;
16
+ }];
12
17
  readonly outputParameters: readonly [];
13
18
  };
14
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/node",
3
- "version": "0.78.3",
3
+ "version": "0.79.0",
4
4
  "description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
5
5
  "--note-0": " <- [🐊]",
6
6
  "private": false,
@@ -54,7 +54,7 @@
54
54
  "module": "./esm/index.es.js",
55
55
  "typings": "./esm/typings/src/_packages/node.index.d.ts",
56
56
  "peerDependencies": {
57
- "@promptbook/core": "0.78.3"
57
+ "@promptbook/core": "0.79.0"
58
58
  },
59
59
  "dependencies": {
60
60
  "colors": "1.4.0",
package/umd/index.umd.js CHANGED
@@ -43,7 +43,7 @@
43
43
  *
44
44
  * @see https://github.com/webgptorg/promptbook
45
45
  */
46
- var PROMPTBOOK_ENGINE_VERSION = '0.78.2';
46
+ var PROMPTBOOK_ENGINE_VERSION = '0.78.4';
47
47
  /**
48
48
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
49
49
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -692,6 +692,9 @@
692
692
  */
693
693
  function $deepFreeze(objectValue) {
694
694
  var e_1, _a;
695
+ if (Array.isArray(objectValue)) {
696
+ return Object.freeze(objectValue.map(function (item) { return $deepFreeze(item); }));
697
+ }
695
698
  var propertyNames = Object.getOwnPropertyNames(objectValue);
696
699
  try {
697
700
  for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
@@ -5620,6 +5623,133 @@
5620
5623
  * @see https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/increase-consistency#specify-the-desired-output-format
5621
5624
  */
5622
5625
 
5626
+ /**
5627
+ * @@@
5628
+ *
5629
+ * @deprecated https://github.com/webgptorg/promptbook/pull/186
5630
+ * @see https://github.com/webgptorg/promptbook/discussions/171
5631
+ *
5632
+ * @public exported from `@promptbook/core`
5633
+ */
5634
+ function getPipelineInterface(pipeline) {
5635
+ var e_1, _a, e_2, _b;
5636
+ var pipelineInterface = {
5637
+ inputParameters: [],
5638
+ outputParameters: [],
5639
+ };
5640
+ try {
5641
+ for (var _c = __values(pipeline.parameters), _d = _c.next(); !_d.done; _d = _c.next()) {
5642
+ var parameter = _d.value;
5643
+ var isInput = parameter.isInput, isOutput = parameter.isOutput;
5644
+ if (isInput) {
5645
+ pipelineInterface.inputParameters.push(deepClone(parameter));
5646
+ }
5647
+ if (isOutput) {
5648
+ pipelineInterface.outputParameters.push(deepClone(parameter));
5649
+ }
5650
+ }
5651
+ }
5652
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
5653
+ finally {
5654
+ try {
5655
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
5656
+ }
5657
+ finally { if (e_1) throw e_1.error; }
5658
+ }
5659
+ try {
5660
+ for (var _e = __values(['inputParameters', 'outputParameters']), _f = _e.next(); !_f.done; _f = _e.next()) {
5661
+ var key = _f.value;
5662
+ pipelineInterface[key].sort(function (_a, _b) {
5663
+ var name1 = _a.name;
5664
+ var name2 = _b.name;
5665
+ return name1.localeCompare(name2);
5666
+ });
5667
+ }
5668
+ }
5669
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
5670
+ finally {
5671
+ try {
5672
+ if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
5673
+ }
5674
+ finally { if (e_2) throw e_2.error; }
5675
+ }
5676
+ return $deepFreeze(pipelineInterface);
5677
+ }
5678
+
5679
+ /**
5680
+ * @@@
5681
+ *
5682
+ * @deprecated https://github.com/webgptorg/promptbook/pull/186
5683
+ * @see https://github.com/webgptorg/promptbook/discussions/171
5684
+ *
5685
+ * @public exported from `@promptbook/core`
5686
+ */
5687
+ function isPipelineInterfacesEqual(pipelineInterface1, pipelineInterface2) {
5688
+ var e_1, _a, e_2, _b;
5689
+ try {
5690
+ for (var _c = __values(['inputParameters', 'outputParameters']), _d = _c.next(); !_d.done; _d = _c.next()) {
5691
+ var whichParameters = _d.value;
5692
+ var parameters1 = pipelineInterface1[whichParameters]; // <- Note: `isPipelineInterfacesEqual` is just temporary solution, no need to fix this
5693
+ var parameters2 = pipelineInterface2[whichParameters];
5694
+ if (parameters1.length !== parameters2.length) {
5695
+ return false;
5696
+ }
5697
+ var _loop_1 = function (parameter) {
5698
+ var matchingParameter = parameters2.find(function (_a) {
5699
+ var name = _a.name;
5700
+ return name === parameter.name;
5701
+ });
5702
+ if (!matchingParameter) {
5703
+ return { value: false };
5704
+ }
5705
+ // Note: Do not compare description, it is not relevant for compatibility
5706
+ if (matchingParameter.isInput !== parameter.isInput) {
5707
+ return { value: false };
5708
+ }
5709
+ if (matchingParameter.isOutput !== parameter.isOutput) {
5710
+ return { value: false };
5711
+ }
5712
+ };
5713
+ try {
5714
+ 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()) {
5715
+ var parameter = parameters1_1_1.value;
5716
+ var state_1 = _loop_1(parameter);
5717
+ if (typeof state_1 === "object")
5718
+ return state_1.value;
5719
+ }
5720
+ }
5721
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
5722
+ finally {
5723
+ try {
5724
+ if (parameters1_1_1 && !parameters1_1_1.done && (_b = parameters1_1.return)) _b.call(parameters1_1);
5725
+ }
5726
+ finally { if (e_2) throw e_2.error; }
5727
+ }
5728
+ }
5729
+ }
5730
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
5731
+ finally {
5732
+ try {
5733
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
5734
+ }
5735
+ finally { if (e_1) throw e_1.error; }
5736
+ }
5737
+ return true;
5738
+ }
5739
+
5740
+ /**
5741
+ * @@@
5742
+ *
5743
+ * @deprecated https://github.com/webgptorg/promptbook/pull/186
5744
+ * @see https://github.com/webgptorg/promptbook/discussions/171
5745
+ *
5746
+ * @public exported from `@promptbook/core`
5747
+ */
5748
+ function isPipelineImplementingInterface(options) {
5749
+ var pipeline = options.pipeline, pipelineInterface = options.pipelineInterface;
5750
+ return isPipelineInterfacesEqual(getPipelineInterface(pipeline), pipelineInterface);
5751
+ }
5752
+
5623
5753
  /**
5624
5754
  * All available task types
5625
5755
  *
@@ -6779,7 +6909,13 @@
6779
6909
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/184",
6780
6910
  pipelineInterface: {
6781
6911
  inputParameters: [
6782
- /* @@@ */
6912
+ /* @@@ */
6913
+ {
6914
+ name: 'nonce',
6915
+ description: 'Just to prevent GENERATOR to be set as implicit formfactor',
6916
+ isInput: true,
6917
+ isOutput: false,
6918
+ },
6783
6919
  ],
6784
6920
  outputParameters: [
6785
6921
  /* @@@ */
@@ -6825,7 +6961,13 @@
6825
6961
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/177",
6826
6962
  pipelineInterface: {
6827
6963
  inputParameters: [
6828
- /* @@@ */
6964
+ /* @@@ */
6965
+ {
6966
+ name: 'nonce',
6967
+ description: 'Just to prevent EXPERIMENTAL_MATCHER to be set as implicit formfactor',
6968
+ isInput: true,
6969
+ isOutput: false,
6970
+ },
6829
6971
  ],
6830
6972
  outputParameters: [
6831
6973
  /* @@@ */
@@ -6974,6 +7116,9 @@
6974
7116
  * Note: `$` is used to indicate that this function mutates given `pipelineJson`
6975
7117
  */
6976
7118
  $applyToPipelineJson: function (command, $pipelineJson) {
7119
+ if ($pipelineJson.formfactorName !== undefined && $pipelineJson.formfactorName !== command.formfactorName) {
7120
+ throw new ParseError(spaceTrim__default["default"]("\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 ")));
7121
+ }
6977
7122
  $pipelineJson.formfactorName = command.formfactorName;
6978
7123
  },
6979
7124
  /**
@@ -7161,7 +7306,7 @@
7161
7306
  // <- TODO: [🚎][💩] Some better way how to get warnings from pipeline parsing / logic
7162
7307
  }
7163
7308
  else {
7164
- throw new ParseError(spaceTrim__default["default"]("\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 ")));
7309
+ throw new ParseError(spaceTrim__default["default"]("\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 ")));
7165
7310
  }
7166
7311
  }
7167
7312
  $pipelineJson.defaultModelRequirements[command.key] = command.value;
@@ -8254,20 +8399,15 @@
8254
8399
  * @public exported from `@promptbook/core`
8255
8400
  */
8256
8401
  function pipelineStringToJsonSync(pipelineString) {
8257
- var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e;
8402
+ var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
8258
8403
  var $pipelineJson = {
8259
- title: undefined /* <- Note: [🍙] Putting here placeholder to keep `title` on top at final JSON */,
8260
- pipelineUrl: undefined /* <- Note: Putting here placeholder to keep `pipelineUrl` on top at final JSON */,
8261
- bookVersion: undefined /* <- Note: By default no explicit version */,
8262
- description: undefined /* <- Note: [🍙] Putting here placeholder to keep `description` on top at final JSON */,
8263
- formfactorName: 'GENERIC',
8404
+ title: DEFAULT_TITLE,
8264
8405
  parameters: [],
8265
8406
  tasks: [],
8266
8407
  knowledgeSources: [],
8267
8408
  knowledgePieces: [],
8268
8409
  personas: [],
8269
8410
  preparations: [],
8270
- // <- TODO: [🍙] Some standard order of properties
8271
8411
  };
8272
8412
  function getPipelineIdentification() {
8273
8413
  // Note: This is a 😐 implementation of [🚞]
@@ -8283,7 +8423,7 @@
8283
8423
  // =============================================================
8284
8424
  // Note: 1️⃣ Parsing of the markdown into object
8285
8425
  if (pipelineString.startsWith('#!')) {
8286
- var _f = __read(pipelineString.split('\n')), shebangLine_1 = _f[0], restLines = _f.slice(1);
8426
+ var _g = __read(pipelineString.split('\n')), shebangLine_1 = _g[0], restLines = _g.slice(1);
8287
8427
  if (!(shebangLine_1 || '').includes('ptbk')) {
8288
8428
  throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n It seems that you try to parse a book file which has non-standard shebang line for book files:\n Shebang line must contain 'ptbk'\n\n You have:\n ".concat(block(shebangLine_1 || '(empty line)'), "\n\n It should look like this:\n #!/usr/bin/env ptbk\n\n ").concat(block(getPipelineIdentification()), "\n "); }));
8289
8429
  }
@@ -8293,7 +8433,7 @@
8293
8433
  pipelineString = flattenMarkdown(pipelineString) /* <- Note: [🥞] */;
8294
8434
  pipelineString = pipelineString.replaceAll(/`\{(?<parameterName>[a-z0-9_]+)\}`/gi, '{$<parameterName>}');
8295
8435
  pipelineString = pipelineString.replaceAll(/`->\s+\{(?<parameterName>[a-z0-9_]+)\}`/gi, '-> {$<parameterName>}');
8296
- var _g = __read(splitMarkdownIntoSections(pipelineString).map(parseMarkdownSection)), pipelineHead = _g[0], pipelineSections = _g.slice(1); /* <- Note: [🥞] */
8436
+ var _h = __read(splitMarkdownIntoSections(pipelineString).map(parseMarkdownSection)), pipelineHead = _h[0], pipelineSections = _h.slice(1); /* <- Note: [🥞] */
8297
8437
  if (pipelineHead === undefined) {
8298
8438
  throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Pipeline head is not defined\n\n ".concat(block(getPipelineIdentification()), "\n\n This should never happen, because the pipeline already flattened\n "); }));
8299
8439
  }
@@ -8415,10 +8555,10 @@
8415
8555
  return nameWithSuffix;
8416
8556
  };
8417
8557
  var _loop_2 = function (section) {
8418
- var e_6, _m, e_7, _o;
8558
+ var e_7, _o, e_8, _p;
8419
8559
  // TODO: Parse section's description (the content out of the codeblock and lists)
8420
8560
  var listItems_2 = extractAllListItemsFromMarkdown(section.content);
8421
- var _p = extractOneBlockFromMarkdown(section.content), language = _p.language, content = _p.content;
8561
+ var _q = extractOneBlockFromMarkdown(section.content), language = _q.language, content = _q.content;
8422
8562
  // TODO: [🎾][1] DRY description
8423
8563
  var description_1 = section.content;
8424
8564
  // Note: Remove codeblocks - TODO: [🎾]
@@ -8482,17 +8622,17 @@
8482
8622
  };
8483
8623
  try {
8484
8624
  // TODO [♓️] List commands and before apply order them to achieve order-agnostic commands
8485
- 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()) {
8486
- var _q = commands_1_1.value, listItem = _q.listItem, command = _q.command;
8625
+ 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()) {
8626
+ var _r = commands_1_1.value, listItem = _r.listItem, command = _r.command;
8487
8627
  _loop_4(listItem, command);
8488
8628
  }
8489
8629
  }
8490
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
8630
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
8491
8631
  finally {
8492
8632
  try {
8493
- if (commands_1_1 && !commands_1_1.done && (_m = commands_1.return)) _m.call(commands_1);
8633
+ if (commands_1_1 && !commands_1_1.done && (_o = commands_1.return)) _o.call(commands_1);
8494
8634
  }
8495
- finally { if (e_6) throw e_6.error; }
8635
+ finally { if (e_7) throw e_7.error; }
8496
8636
  }
8497
8637
  // TODO: [🍧] Should be done in SECTION command
8498
8638
  if ($taskJson.taskType === 'SCRIPT_TASK') {
@@ -8506,8 +8646,8 @@
8506
8646
  }
8507
8647
  $taskJson.dependentParameterNames = Array.from(extractParameterNamesFromTask($taskJson));
8508
8648
  try {
8509
- for (var _r = (e_7 = void 0, __values($taskJson.dependentParameterNames)), _s = _r.next(); !_s.done; _s = _r.next()) {
8510
- var parameterName = _s.value;
8649
+ for (var _s = (e_8 = void 0, __values($taskJson.dependentParameterNames)), _t = _s.next(); !_t.done; _t = _s.next()) {
8650
+ var parameterName = _t.value;
8511
8651
  // TODO: [🧠] This definition should be made first in the task
8512
8652
  defineParam({
8513
8653
  parameterName: parameterName,
@@ -8518,12 +8658,12 @@
8518
8658
  });
8519
8659
  }
8520
8660
  }
8521
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
8661
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
8522
8662
  finally {
8523
8663
  try {
8524
- if (_s && !_s.done && (_o = _r.return)) _o.call(_r);
8664
+ if (_t && !_t.done && (_p = _s.return)) _p.call(_s);
8525
8665
  }
8526
- finally { if (e_7) throw e_7.error; }
8666
+ finally { if (e_8) throw e_8.error; }
8527
8667
  }
8528
8668
  /*
8529
8669
  // TODO: [🍧] This should be checked in `MODEL` command + better error message
@@ -8572,18 +8712,22 @@
8572
8712
  var isThisParameterResulting = $pipelineJson.tasks.some(function (task) { return task.resultingParameterName === parameter.name; });
8573
8713
  if (!isThisParameterResulting) {
8574
8714
  parameter.isInput = true;
8715
+ // <- TODO: [💔] Why this is making typescript error in vscode but not in cli
8716
+ // > Type 'true' is not assignable to type 'false'.ts(2322)
8717
+ // > (property) isInput: false
8718
+ // > The parameter is input of the pipeline The parameter is NOT input of the pipeline
8575
8719
  }
8576
8720
  };
8577
8721
  try {
8578
- for (var _h = __values($pipelineJson.parameters), _j = _h.next(); !_j.done; _j = _h.next()) {
8579
- var parameter = _j.value;
8722
+ for (var _j = __values($pipelineJson.parameters), _k = _j.next(); !_k.done; _k = _j.next()) {
8723
+ var parameter = _k.value;
8580
8724
  _loop_3(parameter);
8581
8725
  }
8582
8726
  }
8583
8727
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
8584
8728
  finally {
8585
8729
  try {
8586
- if (_j && !_j.done && (_d = _h.return)) _d.call(_h);
8730
+ if (_k && !_k.done && (_d = _j.return)) _d.call(_j);
8587
8731
  }
8588
8732
  finally { if (e_4) throw e_4.error; }
8589
8733
  }
@@ -8592,17 +8736,18 @@
8592
8736
  // Note: 7️⃣ Mark all non-INPUT parameters as OUTPUT if any OUTPUT is not set
8593
8737
  if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isOutput; })) {
8594
8738
  try {
8595
- for (var _k = __values($pipelineJson.parameters), _l = _k.next(); !_l.done; _l = _k.next()) {
8596
- var parameter = _l.value;
8739
+ for (var _l = __values($pipelineJson.parameters), _m = _l.next(); !_m.done; _m = _l.next()) {
8740
+ var parameter = _m.value;
8597
8741
  if (!parameter.isInput) {
8598
8742
  parameter.isOutput = true;
8743
+ // <- TODO: [💔]
8599
8744
  }
8600
8745
  }
8601
8746
  }
8602
8747
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
8603
8748
  finally {
8604
8749
  try {
8605
- if (_l && !_l.done && (_e = _k.return)) _e.call(_k);
8750
+ if (_m && !_m.done && (_e = _l.return)) _e.call(_l);
8606
8751
  }
8607
8752
  finally { if (e_5) throw e_5.error; }
8608
8753
  }
@@ -8610,7 +8755,7 @@
8610
8755
  // =============================================================
8611
8756
  // Note: 8️⃣ Cleanup of undefined values
8612
8757
  $pipelineJson.tasks.forEach(function (tasks) {
8613
- var e_8, _a;
8758
+ var e_9, _a;
8614
8759
  try {
8615
8760
  for (var _b = __values(Object.entries(tasks)), _c = _b.next(); !_c.done; _c = _b.next()) {
8616
8761
  var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
@@ -8619,16 +8764,16 @@
8619
8764
  }
8620
8765
  }
8621
8766
  }
8622
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
8767
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
8623
8768
  finally {
8624
8769
  try {
8625
8770
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
8626
8771
  }
8627
- finally { if (e_8) throw e_8.error; }
8772
+ finally { if (e_9) throw e_9.error; }
8628
8773
  }
8629
8774
  });
8630
8775
  $pipelineJson.parameters.forEach(function (parameter) {
8631
- var e_9, _a;
8776
+ var e_10, _a;
8632
8777
  try {
8633
8778
  for (var _b = __values(Object.entries(parameter)), _c = _b.next(); !_c.done; _c = _b.next()) {
8634
8779
  var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
@@ -8637,17 +8782,61 @@
8637
8782
  }
8638
8783
  }
8639
8784
  }
8640
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
8785
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
8641
8786
  finally {
8642
8787
  try {
8643
8788
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
8644
8789
  }
8645
- finally { if (e_9) throw e_9.error; }
8790
+ finally { if (e_10) throw e_10.error; }
8646
8791
  }
8647
8792
  });
8793
+ try {
8794
+ // =============================================================
8795
+ // Note: 9️⃣ Implicit and default formfactor
8796
+ 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()) {
8797
+ var formfactorDefinition = FORMFACTOR_DEFINITIONS_1_1.value;
8798
+ // <- Note: [♓️][💩] This is the order of the formfactors, make some explicit priority
8799
+ var name_2 = formfactorDefinition.name, pipelineInterface = formfactorDefinition.pipelineInterface;
8800
+ // Note: Skip GENERIC formfactor, it will be used as a fallback if no other formfactor is compatible
8801
+ if (name_2 === 'GENERIC') {
8802
+ continue;
8803
+ }
8804
+ var isCompatible = isPipelineImplementingInterface({
8805
+ pipeline: __assign({ formfactorName: name_2 }, $pipelineJson),
8806
+ pipelineInterface: pipelineInterface,
8807
+ });
8808
+ /*/
8809
+ console.log({
8810
+ subject: `${$pipelineJson.title} implements ${name}`,
8811
+ pipelineTitle: $pipelineJson.title,
8812
+ formfactorName: name,
8813
+ isCompatible,
8814
+ formfactorInterface: pipelineInterface,
8815
+ pipelineInterface: getPipelineInterface($pipelineJson as PipelineJson),
8816
+ });
8817
+ /**/
8818
+ if (isCompatible) {
8819
+ $pipelineJson.formfactorName = name_2;
8820
+ break;
8821
+ }
8822
+ }
8823
+ }
8824
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
8825
+ finally {
8826
+ try {
8827
+ if (FORMFACTOR_DEFINITIONS_1_1 && !FORMFACTOR_DEFINITIONS_1_1.done && (_f = FORMFACTOR_DEFINITIONS_1.return)) _f.call(FORMFACTOR_DEFINITIONS_1);
8828
+ }
8829
+ finally { if (e_6) throw e_6.error; }
8830
+ }
8831
+ // Note: [🔆] If formfactor is still not set, set it to 'GENERIC'
8832
+ if ($pipelineJson.formfactorName === undefined) {
8833
+ $pipelineJson.formfactorName = 'GENERIC';
8834
+ }
8648
8835
  // =============================================================
8649
8836
  // TODO: [🍙] Maybe do reorder of `$pipelineJson` here
8650
- return $asDeeplyFrozenSerializableJson('pipelineJson', $pipelineJson);
8837
+ return $asDeeplyFrozenSerializableJson('pipelineJson', __assign({ title: DEFAULT_TITLE, pipelineUrl: undefined, bookVersion: undefined, description: undefined, formfactorName: 'GENERIC',
8838
+ // <- Note: [🔆] Setting `formfactorName` is redundant to satisfy the typescript
8839
+ parameters: [], tasks: [], knowledgeSources: [], knowledgePieces: [], personas: [], preparations: [] }, $pipelineJson));
8651
8840
  }
8652
8841
  /**
8653
8842
  * TODO: [main] !!!! Warn if used only sync version
@@ -10150,7 +10339,7 @@
10150
10339
  return [3 /*break*/, 7];
10151
10340
  case 6:
10152
10341
  if (isVerbose) {
10153
- console.info(colors__default["default"].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")));
10342
+ console.info(colors__default["default"].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")));
10154
10343
  }
10155
10344
  _e.label = 7;
10156
10345
  case 7:
@@ -10197,7 +10386,7 @@
10197
10386
  if (!(error_1 instanceof Error)) {
10198
10387
  throw error_1;
10199
10388
  }
10200
- wrappedErrorMessage = spaceTrim__default["default"](function (block) { return "\n ".concat(error_1.name, " in pipeline ").concat(fileName.split('\\').join('/'), "\u2060:\n\n ").concat(block(error_1.message), "\n\n "); });
10389
+ wrappedErrorMessage = spaceTrim__default["default"](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';
10201
10390
  if (isCrashedOnError) {
10202
10391
  throw new CollectionError(wrappedErrorMessage);
10203
10392
  }