@promptbook/remote-server 0.82.0 → 0.83.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.
Files changed (44) hide show
  1. package/esm/index.es.js +16 -16
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/editable.index.d.ts +74 -0
  4. package/esm/typings/src/_packages/types.index.d.ts +26 -0
  5. package/esm/typings/src/commands/BOOK_VERSION/BookVersionCommand.d.ts +1 -1
  6. package/esm/typings/src/commands/BOOK_VERSION/bookVersionCommandParser.d.ts +1 -1
  7. package/esm/typings/src/commands/EXPECT/expectCommandParser.d.ts +1 -1
  8. package/esm/typings/src/commands/FOREACH/ForeachCommand.d.ts +1 -1
  9. package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +1 -1
  10. package/esm/typings/src/commands/FORMAT/formatCommandParser.d.ts +1 -1
  11. package/esm/typings/src/commands/FORMFACTOR/FormfactorCommand.d.ts +1 -1
  12. package/esm/typings/src/commands/FORMFACTOR/formfactorCommandParser.d.ts +1 -1
  13. package/esm/typings/src/commands/JOKER/JokerCommand.d.ts +1 -1
  14. package/esm/typings/src/commands/JOKER/jokerCommandParser.d.ts +1 -1
  15. package/esm/typings/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +2 -2
  16. package/esm/typings/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +1 -1
  17. package/esm/typings/src/commands/KNOWLEDGE/utils/{sourceContentToName.d.ts → knowledgeSourceContentToName.d.ts} +2 -2
  18. package/esm/typings/src/commands/MODEL/ModelCommand.d.ts +2 -1
  19. package/esm/typings/src/commands/MODEL/modelCommandParser.d.ts +2 -1
  20. package/esm/typings/src/commands/PARAMETER/ParameterCommand.d.ts +1 -1
  21. package/esm/typings/src/commands/PARAMETER/parameterCommandParser.d.ts +1 -1
  22. package/esm/typings/src/commands/PERSONA/PersonaCommand.d.ts +1 -1
  23. package/esm/typings/src/commands/PERSONA/personaCommandParser.d.ts +1 -1
  24. package/esm/typings/src/commands/POSTPROCESS/PostprocessCommand.d.ts +1 -1
  25. package/esm/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +1 -1
  26. package/esm/typings/src/commands/SECTION/SectionCommand.d.ts +1 -1
  27. package/esm/typings/src/commands/SECTION/sectionCommandParser.d.ts +1 -1
  28. package/esm/typings/src/commands/URL/UrlCommand.d.ts +1 -1
  29. package/esm/typings/src/commands/URL/urlCommandParser.d.ts +1 -1
  30. package/esm/typings/src/commands/X_ACTION/ActionCommand.d.ts +1 -1
  31. package/esm/typings/src/commands/X_ACTION/actionCommandParser.d.ts +1 -1
  32. package/esm/typings/src/commands/X_INSTRUMENT/InstrumentCommand.d.ts +1 -1
  33. package/esm/typings/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +1 -1
  34. package/esm/typings/src/commands/_common/getParserForCommand.d.ts +1 -1
  35. package/esm/typings/src/commands/_common/parseCommand.d.ts +1 -1
  36. package/esm/typings/src/commands/_common/stringifyCommand.d.ts +1 -0
  37. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +8 -0
  38. package/esm/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +2 -0
  39. package/esm/typings/src/commands/index.d.ts +1 -1
  40. package/esm/typings/src/pipeline/PipelineJson/KnowledgeSourceJson.d.ts +1 -1
  41. package/package.json +2 -2
  42. package/umd/index.umd.js +16 -16
  43. package/umd/index.umd.js.map +1 -1
  44. /package/esm/typings/src/commands/KNOWLEDGE/utils/{sourceContentToName.test.d.ts → knowledgeSourceContentToName.test.d.ts} +0 -0
package/umd/index.umd.js CHANGED
@@ -26,7 +26,7 @@
26
26
  * @generated
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- var PROMPTBOOK_ENGINE_VERSION = '0.82.0-3';
29
+ var PROMPTBOOK_ENGINE_VERSION = '0.82.0';
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
@@ -5858,15 +5858,15 @@
5858
5858
  /**
5859
5859
  * Creates unique name for the source
5860
5860
  *
5861
- * @private within the repository
5861
+ * @public exported from `@promptbook/editable`
5862
5862
  */
5863
- function sourceContentToName(sourceContent) {
5864
- var hash = cryptoJs.SHA256(hexEncoder__default["default"].parse(JSON.stringify(sourceContent)))
5863
+ function knowledgeSourceContentToName(knowledgeSourceContent) {
5864
+ var hash = cryptoJs.SHA256(hexEncoder__default["default"].parse(JSON.stringify(knowledgeSourceContent)))
5865
5865
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
5866
5866
  .toString( /* hex */)
5867
5867
  .substring(0, 20);
5868
5868
  // <- TODO: [🥬] Make some system for hashes and ids of promptbook
5869
- var semanticName = normalizeToKebabCase(sourceContent.substring(0, 20));
5869
+ var semanticName = normalizeToKebabCase(knowledgeSourceContent.substring(0, 20));
5870
5870
  var pieces = ['source', semanticName, hash].filter(function (piece) { return piece !== ''; });
5871
5871
  var name = pieces.join('-').split('--').join('-');
5872
5872
  // <- TODO: Use MAX_FILENAME_LENGTH
@@ -6015,19 +6015,19 @@
6015
6015
  function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
6016
6016
  var _a;
6017
6017
  return __awaiter(this, void 0, void 0, function () {
6018
- var _b, fetch, sourceContent, name, _c, _d, rootDirname, url, response_1, mimeType, filename_1, fileExtension, mimeType;
6018
+ var _b, fetch, knowledgeSourceContent, name, _c, _d, rootDirname, url, response_1, mimeType, filename_1, fileExtension, mimeType;
6019
6019
  return __generator(this, function (_f) {
6020
6020
  switch (_f.label) {
6021
6021
  case 0:
6022
6022
  _b = tools.fetch, fetch = _b === void 0 ? scraperFetch : _b;
6023
- sourceContent = knowledgeSource.sourceContent;
6023
+ knowledgeSourceContent = knowledgeSource.knowledgeSourceContent;
6024
6024
  name = knowledgeSource.name;
6025
6025
  _c = options || {}, _d = _c.rootDirname, rootDirname = _d === void 0 ? null : _d, _c.isVerbose;
6026
6026
  if (!name) {
6027
- name = sourceContentToName(sourceContent);
6027
+ name = knowledgeSourceContentToName(knowledgeSourceContent);
6028
6028
  }
6029
- if (!isValidUrl(sourceContent)) return [3 /*break*/, 2];
6030
- url = sourceContent;
6029
+ if (!isValidUrl(knowledgeSourceContent)) return [3 /*break*/, 2];
6030
+ url = knowledgeSourceContent;
6031
6031
  return [4 /*yield*/, fetch(url)];
6032
6032
  case 1:
6033
6033
  response_1 = _f.sent();
@@ -6073,7 +6073,7 @@
6073
6073
  },
6074
6074
  }];
6075
6075
  case 2:
6076
- if (!isValidFilePath(sourceContent)) return [3 /*break*/, 4];
6076
+ if (!isValidFilePath(knowledgeSourceContent)) return [3 /*break*/, 4];
6077
6077
  if (tools.fs === undefined) {
6078
6078
  throw new EnvironmentMismatchError('Can not import file knowledge without filesystem tools');
6079
6079
  // <- TODO: [🧠] What is the best error type here`
@@ -6082,13 +6082,13 @@
6082
6082
  throw new EnvironmentMismatchError('Can not import file knowledge in non-file pipeline');
6083
6083
  // <- TODO: [🧠] What is the best error type here`
6084
6084
  }
6085
- filename_1 = path.join(rootDirname, sourceContent).split('\\').join('/');
6085
+ filename_1 = path.join(rootDirname, knowledgeSourceContent).split('\\').join('/');
6086
6086
  fileExtension = getFileExtension(filename_1);
6087
6087
  mimeType = extensionToMimeType(fileExtension || '');
6088
6088
  return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
6089
6089
  case 3:
6090
6090
  if (!(_f.sent())) {
6091
- throw new NotFoundError(spaceTrim__default["default"](function (block) { return "\n Can not make source handler for file which does not exist:\n\n File:\n ".concat(block(sourceContent), "\n\n Full file path:\n ").concat(block(filename_1), "\n "); }));
6091
+ throw new NotFoundError(spaceTrim__default["default"](function (block) { return "\n Can not make source handler for file which does not exist:\n\n File:\n ".concat(block(knowledgeSourceContent), "\n\n Full file path:\n ").concat(block(filename_1), "\n "); }));
6092
6092
  }
6093
6093
  // TODO: [🧠][😿] Test security file - file is scoped to the project (BUT maybe do this in `filesystemTools`)
6094
6094
  return [2 /*return*/, {
@@ -6139,7 +6139,7 @@
6139
6139
  url: null,
6140
6140
  mimeType: 'text/markdown',
6141
6141
  asText: function () {
6142
- return knowledgeSource.sourceContent;
6142
+ return knowledgeSource.knowledgeSourceContent;
6143
6143
  },
6144
6144
  asJson: function () {
6145
6145
  throw new UnexpectedError('Did not expect that `markdownScraper` would need to get the content `asJson`');
@@ -6201,7 +6201,7 @@
6201
6201
  partialPieces = __spreadArray([], __read(partialPiecesUnchecked), false);
6202
6202
  return [2 /*return*/, "break"];
6203
6203
  }
6204
- console.warn(spaceTrim__default["default"](function (block) { return "\n Cannot scrape knowledge from source despite the scraper `".concat(scraper.metadata.className, "` supports the mime type \"").concat(sourceHandler.mimeType, "\".\n\n The source:\n ").concat(block(knowledgeSource.sourceContent
6204
+ console.warn(spaceTrim__default["default"](function (block) { return "\n Cannot scrape knowledge from source despite the scraper `".concat(scraper.metadata.className, "` supports the mime type \"").concat(sourceHandler.mimeType, "\".\n\n The source:\n ").concat(block(knowledgeSource.knowledgeSourceContent
6205
6205
  .split('\n')
6206
6206
  .map(function (line) { return "> ".concat(line); })
6207
6207
  .join('\n')), "\n\n ").concat(block($registeredScrapersMessage(scrapers)), "\n\n\n "); }));
@@ -6239,7 +6239,7 @@
6239
6239
  return [7 /*endfinally*/];
6240
6240
  case 9:
6241
6241
  if (partialPieces === null) {
6242
- throw new KnowledgeScrapeError(spaceTrim__default["default"](function (block) { return "\n Cannot scrape knowledge\n\n The source:\n > ".concat(block(knowledgeSource.sourceContent
6242
+ throw new KnowledgeScrapeError(spaceTrim__default["default"](function (block) { return "\n Cannot scrape knowledge\n\n The source:\n > ".concat(block(knowledgeSource.knowledgeSourceContent
6243
6243
  .split('\n')
6244
6244
  .map(function (line) { return "> ".concat(line); })
6245
6245
  .join('\n')), "\n\n No scraper found for the mime type \"").concat(sourceHandler.mimeType, "\"\n\n ").concat(block($registeredScrapersMessage(scrapers)), "\n\n\n "); }));