@promptbook/remote-client 0.83.0 → 0.84.0-10
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 +5 -0
- package/esm/index.es.js +54 -33
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/cli.index.d.ts +8 -0
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/_packages/editable.index.d.ts +8 -2
- package/esm/typings/src/_packages/markitdown.index.d.ts +8 -0
- package/esm/typings/src/_packages/pdf.index.d.ts +6 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/_packages/wizzard.index.d.ts +8 -0
- package/esm/typings/src/constants.d.ts +1 -1
- package/esm/typings/src/executables/platforms/locateAppOnLinux.d.ts +1 -1
- package/esm/typings/src/executables/platforms/locateAppOnMacOs.d.ts +1 -1
- package/esm/typings/src/pipeline/book-notation.d.ts +4 -0
- package/esm/typings/src/pipeline/prompt-notation.d.ts +18 -0
- package/esm/typings/src/pipeline/prompt-notation.test.d.ts +4 -0
- package/esm/typings/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +43 -0
- package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +20 -0
- package/esm/typings/src/scrapers/_boilerplate/playground/boilerplate-scraper-playground.d.ts +5 -0
- package/esm/typings/src/scrapers/_boilerplate/register-constructor.d.ts +15 -0
- package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +28 -0
- package/esm/typings/src/scrapers/markitdown/MarkitdownScraper.d.ts +50 -0
- package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +22 -0
- package/esm/typings/src/scrapers/markitdown/playground/markitdown-scraper-playground.d.ts +5 -0
- package/esm/typings/src/scrapers/markitdown/register-constructor.d.ts +17 -0
- package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +28 -0
- package/esm/typings/src/types/typeAliases.d.ts +1 -1
- package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +17 -0
- package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.d.ts +10 -0
- package/esm/typings/src/utils/editable/{utils → edit-pipeline-string}/removePipelineCommand.d.ts +1 -1
- package/esm/typings/src/utils/editable/edit-pipeline-string/removePipelineCommand.test.d.ts +1 -0
- package/esm/typings/src/utils/editable/utils/isFlatPipeline.d.ts +7 -0
- package/esm/typings/src/utils/editable/utils/renamePipelineParameter.d.ts +3 -0
- package/package.json +3 -3
- package/umd/index.umd.js +54 -33
- package/umd/index.umd.js.map +1 -1
- /package/esm/typings/src/utils/editable/{utils/removePipelineCommand.test.d.ts → edit-pipeline-string/addPipelineCommand.test.d.ts} +0 -0
package/umd/index.umd.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
26
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-9';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -307,7 +307,7 @@
|
|
|
307
307
|
var NotYetImplementedError = /** @class */ (function (_super) {
|
|
308
308
|
__extends(NotYetImplementedError, _super);
|
|
309
309
|
function NotYetImplementedError(message) {
|
|
310
|
-
var _this = _super.call(this, spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This feature is not implemented yet but it will be soon.\n\n If you want speed up the implementation or just read more, look here:\n https://github.com/webgptorg/promptbook\n\n Or contact us on
|
|
310
|
+
var _this = _super.call(this, spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This feature is not implemented yet but it will be soon.\n\n If you want speed up the implementation or just read more, look here:\n https://github.com/webgptorg/promptbook\n\n Or contact us on pavol@ptbk.io\n\n "); })) || this;
|
|
311
311
|
_this.name = 'NotYetImplementedError';
|
|
312
312
|
Object.setPrototypeOf(_this, NotYetImplementedError.prototype);
|
|
313
313
|
return _this;
|
|
@@ -415,7 +415,7 @@
|
|
|
415
415
|
*
|
|
416
416
|
* @public exported from `@promptbook/core`
|
|
417
417
|
*/
|
|
418
|
-
var ADMIN_EMAIL = '
|
|
418
|
+
var ADMIN_EMAIL = 'pavol@ptbk.io';
|
|
419
419
|
/**
|
|
420
420
|
* Name of the responsible person for the Promptbook on GitHub
|
|
421
421
|
*
|
|
@@ -4540,6 +4540,55 @@
|
|
|
4540
4540
|
var SUPPORTED_SCRIPT_LANGUAGES = ['javascript', 'typescript', 'python'];
|
|
4541
4541
|
// <- TODO: [🏥] DRY
|
|
4542
4542
|
|
|
4543
|
+
/**
|
|
4544
|
+
* Removes Markdown (or HTML) comments
|
|
4545
|
+
*
|
|
4546
|
+
* @param {string} content - The string to remove comments from.
|
|
4547
|
+
* @returns {string} The input string with all comments removed.
|
|
4548
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
4549
|
+
*/
|
|
4550
|
+
function removeMarkdownComments(content) {
|
|
4551
|
+
return spaceTrim.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
|
|
4552
|
+
}
|
|
4553
|
+
|
|
4554
|
+
/**
|
|
4555
|
+
* @@@
|
|
4556
|
+
*
|
|
4557
|
+
* @public exported from `@promptbook/editable`
|
|
4558
|
+
*/
|
|
4559
|
+
function isFlatPipeline(pipelineString) {
|
|
4560
|
+
pipelineString = removeMarkdownComments(pipelineString);
|
|
4561
|
+
pipelineString = spaceTrim__default["default"](pipelineString);
|
|
4562
|
+
var isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
|
|
4563
|
+
var isLastLineReturnStatement = pipelineString.split('\n').pop().split('`').join('').startsWith('->');
|
|
4564
|
+
// TODO: Also (double)check
|
|
4565
|
+
// > const usedCommands
|
|
4566
|
+
// > const isBlocksUsed
|
|
4567
|
+
// > const returnStatementCount
|
|
4568
|
+
var isFlat = !isMarkdownBeginningWithHeadline && isLastLineReturnStatement;
|
|
4569
|
+
return isFlat;
|
|
4570
|
+
}
|
|
4571
|
+
|
|
4572
|
+
/**
|
|
4573
|
+
* @@@
|
|
4574
|
+
*
|
|
4575
|
+
* @public exported from `@promptbook/editable`
|
|
4576
|
+
*/
|
|
4577
|
+
function deflatePipeline(pipelineString) {
|
|
4578
|
+
if (!isFlatPipeline(pipelineString)) {
|
|
4579
|
+
return pipelineString;
|
|
4580
|
+
}
|
|
4581
|
+
var pipelineStringLines = pipelineString.split('\n');
|
|
4582
|
+
var returnStatement = pipelineStringLines.pop();
|
|
4583
|
+
var prompt = spaceTrim__default["default"](pipelineStringLines.join('\n'));
|
|
4584
|
+
pipelineString = validatePipelineString(spaceTrim__default["default"](function (block) { return "\n # ".concat(DEFAULT_BOOK_TITLE, "\n\n ## Prompt\n\n ```\n ").concat(block(prompt), "\n ```\n\n ").concat(returnStatement, "\n "); }));
|
|
4585
|
+
// <- TODO: Maybe use book` notation
|
|
4586
|
+
return pipelineString;
|
|
4587
|
+
}
|
|
4588
|
+
/**
|
|
4589
|
+
* TODO: Unit test
|
|
4590
|
+
*/
|
|
4591
|
+
|
|
4543
4592
|
/**
|
|
4544
4593
|
* Utility function to extract all list items from markdown
|
|
4545
4594
|
*
|
|
@@ -4841,17 +4890,6 @@
|
|
|
4841
4890
|
* NOW we are working just with markdown string and its good enough
|
|
4842
4891
|
*/
|
|
4843
4892
|
|
|
4844
|
-
/**
|
|
4845
|
-
* Removes Markdown (or HTML) comments
|
|
4846
|
-
*
|
|
4847
|
-
* @param {string} content - The string to remove comments from.
|
|
4848
|
-
* @returns {string} The input string with all comments removed.
|
|
4849
|
-
* @public exported from `@promptbook/markdown-utils`
|
|
4850
|
-
*/
|
|
4851
|
-
function removeMarkdownComments(content) {
|
|
4852
|
-
return spaceTrim.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
|
|
4853
|
-
}
|
|
4854
|
-
|
|
4855
4893
|
/**
|
|
4856
4894
|
* @@@
|
|
4857
4895
|
*
|
|
@@ -5109,26 +5147,9 @@
|
|
|
5109
5147
|
pipelineString = removeMarkdownComments(pipelineString);
|
|
5110
5148
|
pipelineString = spaceTrim.spaceTrim(pipelineString);
|
|
5111
5149
|
// <- TODO: [😧] `spaceTrim` should preserve discriminated type *(or at lease `PipelineString`)*
|
|
5150
|
+
pipelineString = deflatePipeline(pipelineString);
|
|
5112
5151
|
// ==============
|
|
5113
|
-
// Note: 1️⃣◽2️⃣
|
|
5114
|
-
var isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
|
|
5115
|
-
var isLastLineReturnStatement = pipelineString.split('\n').pop().split('`').join('').startsWith('->');
|
|
5116
|
-
// TODO: Also (double)check
|
|
5117
|
-
// > const usedCommands
|
|
5118
|
-
// > const isBlocksUsed
|
|
5119
|
-
// > const returnStatementCount
|
|
5120
|
-
var isFlatPipeline = !isMarkdownBeginningWithHeadline && isLastLineReturnStatement;
|
|
5121
|
-
// console.log({ isMarkdownBeginningWithHeadline, isLastLineReturnStatement, isFlatPipeline });
|
|
5122
|
-
if (isFlatPipeline) {
|
|
5123
|
-
var pipelineStringLines = pipelineString.split('\n');
|
|
5124
|
-
var returnStatement_1 = pipelineStringLines.pop();
|
|
5125
|
-
var prompt_1 = spaceTrim.spaceTrim(pipelineStringLines.join('\n'));
|
|
5126
|
-
pipelineString = validatePipelineString(spaceTrim.spaceTrim(function (block) { return "\n # ".concat(DEFAULT_BOOK_TITLE, "\n\n ## Prompt\n\n ```\n ").concat(block(prompt_1), "\n ```\n\n ").concat(returnStatement_1, "\n "); }));
|
|
5127
|
-
// <- TODO: Maybe use book` notation
|
|
5128
|
-
// console.log(pipelineString);
|
|
5129
|
-
}
|
|
5130
|
-
// ==============
|
|
5131
|
-
// Note: 1️⃣◽3️⃣ Parse the markdown
|
|
5152
|
+
// Note: 1️⃣◽2️⃣ Parse the markdown
|
|
5132
5153
|
pipelineString = flattenMarkdown(pipelineString) /* <- Note: [🥞] */;
|
|
5133
5154
|
pipelineString = pipelineString.replaceAll(/`\{(?<parameterName>[a-z0-9_]+)\}`/gi, '{$<parameterName>}');
|
|
5134
5155
|
pipelineString = pipelineString.replaceAll(/`->\s+\{(?<parameterName>[a-z0-9_]+)\}`/gi, '-> {$<parameterName>}');
|