@promptbook/core 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/core",
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,
package/umd/index.umd.js CHANGED
@@ -24,7 +24,7 @@
24
24
  *
25
25
  * @see https://github.com/webgptorg/promptbook
26
26
  */
27
- var PROMPTBOOK_ENGINE_VERSION = '0.74.0-5';
27
+ var PROMPTBOOK_ENGINE_VERSION = '0.74.0-6';
28
28
  /**
29
29
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
30
30
  */
@@ -8084,11 +8084,18 @@
8084
8084
  }
8085
8085
  // =============================================================
8086
8086
  // Note: 1️⃣ Parsing of the markdown into object
8087
+ if (pipelineString.startsWith('#!')) {
8088
+ var _c = __read(pipelineString.split('\n')), shebangLine_1 = _c[0], restLines = _c.slice(1);
8089
+ if (!(shebangLine_1 || '').includes('ptbk')) {
8090
+ 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 "); }));
8091
+ }
8092
+ pipelineString = restLines.join('\n');
8093
+ }
8087
8094
  pipelineString = removeContentComments(pipelineString);
8088
8095
  pipelineString = flattenMarkdown(pipelineString) /* <- Note: [🥞] */;
8089
8096
  pipelineString = pipelineString.replaceAll(/`\{(?<parameterName>[a-z0-9_]+)\}`/gi, '{$<parameterName>}');
8090
8097
  pipelineString = pipelineString.replaceAll(/`->\s+\{(?<parameterName>[a-z0-9_]+)\}`/gi, '-> {$<parameterName>}');
8091
- var _c = __read(splitMarkdownIntoSections(pipelineString).map(parseMarkdownSection)), pipelineHead = _c[0], pipelineSections = _c.slice(1); /* <- Note: [🥞] */
8098
+ var _d = __read(splitMarkdownIntoSections(pipelineString).map(parseMarkdownSection)), pipelineHead = _d[0], pipelineSections = _d.slice(1); /* <- Note: [🥞] */
8092
8099
  if (pipelineHead === undefined) {
8093
8100
  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 "); }));
8094
8101
  }
@@ -8178,10 +8185,10 @@
8178
8185
  finally { if (e_1) throw e_1.error; }
8179
8186
  }
8180
8187
  var _loop_2 = function (section) {
8181
- var e_3, _d;
8188
+ var e_3, _e;
8182
8189
  // TODO: Parse template description (the content out of the codeblock and lists)
8183
8190
  var listItems_2 = extractAllListItemsFromMarkdown(section.content);
8184
- var _e = extractOneBlockFromMarkdown(section.content), language = _e.language, content = _e.content;
8191
+ var _f = extractOneBlockFromMarkdown(section.content), language = _f.language, content = _f.content;
8185
8192
  // TODO: [🎾][1] DRY description
8186
8193
  var description_1 = section.content;
8187
8194
  // Note: Remove codeblocks - TODO: [🎾]
@@ -8246,14 +8253,14 @@
8246
8253
  try {
8247
8254
  // TODO [♓️] List commands and before apply order them to achieve order-agnostic commands
8248
8255
  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()) {
8249
- var _f = commands_1_1.value, listItem = _f.listItem, command = _f.command;
8256
+ var _g = commands_1_1.value, listItem = _g.listItem, command = _g.command;
8250
8257
  _loop_3(listItem, command);
8251
8258
  }
8252
8259
  }
8253
8260
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
8254
8261
  finally {
8255
8262
  try {
8256
- if (commands_1_1 && !commands_1_1.done && (_d = commands_1.return)) _d.call(commands_1);
8263
+ if (commands_1_1 && !commands_1_1.done && (_e = commands_1.return)) _e.call(commands_1);
8257
8264
  }
8258
8265
  finally { if (e_3) throw e_3.error; }
8259
8266
  }