@promptbook/node 0.74.0-6 → 0.74.0-7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/node",
3
- "version": "0.74.0-6",
3
+ "version": "0.74.0-7",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -53,7 +53,7 @@
53
53
  "module": "./esm/index.es.js",
54
54
  "typings": "./esm/typings/src/_packages/node.index.d.ts",
55
55
  "peerDependencies": {
56
- "@promptbook/core": "0.74.0-6"
56
+ "@promptbook/core": "0.74.0-7"
57
57
  },
58
58
  "dependencies": {
59
59
  "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.74.0-5';
46
+ var PROMPTBOOK_ENGINE_VERSION = '0.74.0-6';
47
47
  /**
48
48
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
49
49
  */
@@ -7775,11 +7775,18 @@
7775
7775
  }
7776
7776
  // =============================================================
7777
7777
  // Note: 1️⃣ Parsing of the markdown into object
7778
+ if (pipelineString.startsWith('#!')) {
7779
+ var _c = __read(pipelineString.split('\n')), shebangLine_1 = _c[0], restLines = _c.slice(1);
7780
+ if (!(shebangLine_1 || '').includes('ptbk')) {
7781
+ 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 "); }));
7782
+ }
7783
+ pipelineString = restLines.join('\n');
7784
+ }
7778
7785
  pipelineString = removeContentComments(pipelineString);
7779
7786
  pipelineString = flattenMarkdown(pipelineString) /* <- Note: [🥞] */;
7780
7787
  pipelineString = pipelineString.replaceAll(/`\{(?<parameterName>[a-z0-9_]+)\}`/gi, '{$<parameterName>}');
7781
7788
  pipelineString = pipelineString.replaceAll(/`->\s+\{(?<parameterName>[a-z0-9_]+)\}`/gi, '-> {$<parameterName>}');
7782
- var _c = __read(splitMarkdownIntoSections(pipelineString).map(parseMarkdownSection)), pipelineHead = _c[0], pipelineSections = _c.slice(1); /* <- Note: [🥞] */
7789
+ var _d = __read(splitMarkdownIntoSections(pipelineString).map(parseMarkdownSection)), pipelineHead = _d[0], pipelineSections = _d.slice(1); /* <- Note: [🥞] */
7783
7790
  if (pipelineHead === undefined) {
7784
7791
  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 "); }));
7785
7792
  }
@@ -7869,10 +7876,10 @@
7869
7876
  finally { if (e_1) throw e_1.error; }
7870
7877
  }
7871
7878
  var _loop_2 = function (section) {
7872
- var e_3, _d;
7879
+ var e_3, _e;
7873
7880
  // TODO: Parse template description (the content out of the codeblock and lists)
7874
7881
  var listItems_2 = extractAllListItemsFromMarkdown(section.content);
7875
- var _e = extractOneBlockFromMarkdown(section.content), language = _e.language, content = _e.content;
7882
+ var _f = extractOneBlockFromMarkdown(section.content), language = _f.language, content = _f.content;
7876
7883
  // TODO: [🎾][1] DRY description
7877
7884
  var description_1 = section.content;
7878
7885
  // Note: Remove codeblocks - TODO: [🎾]
@@ -7937,14 +7944,14 @@
7937
7944
  try {
7938
7945
  // TODO [♓️] List commands and before apply order them to achieve order-agnostic commands
7939
7946
  for (var commands_1 = (e_3 = void 0, __values(commands)), commands_1_1 = commands_1.next(); !commands_1_1.done; commands_1_1 = commands_1.next()) {
7940
- var _f = commands_1_1.value, listItem = _f.listItem, command = _f.command;
7947
+ var _g = commands_1_1.value, listItem = _g.listItem, command = _g.command;
7941
7948
  _loop_3(listItem, command);
7942
7949
  }
7943
7950
  }
7944
7951
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
7945
7952
  finally {
7946
7953
  try {
7947
- if (commands_1_1 && !commands_1_1.done && (_d = commands_1.return)) _d.call(commands_1);
7954
+ if (commands_1_1 && !commands_1_1.done && (_e = commands_1.return)) _e.call(commands_1);
7948
7955
  }
7949
7956
  finally { if (e_3) throw e_3.error; }
7950
7957
  }
@@ -9814,12 +9821,9 @@
9814
9821
  })
9815
9822
  .filter(function (arg) { return arg !== ''; });
9816
9823
  if (_.length > 1) {
9817
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9818
9824
  _a = __read(_), command = _a[0], args = _a.slice(1);
9819
9825
  }
9820
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9821
9826
  if (options.args) {
9822
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9823
9827
  args = __spreadArray(__spreadArray([], __read(args), false), __read(options.args), false);
9824
9828
  }
9825
9829
  var humanReadableCommand = !['npx', 'npm'].includes(command) ? command : args[0];