@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/README.md
CHANGED
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
+
<blockquote style="color: #ff8811">
|
|
27
|
+
<b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
28
|
+
</blockquote>
|
|
29
|
+
|
|
26
30
|
## 📦 Package `@promptbook/remote-client`
|
|
27
31
|
|
|
28
32
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
|
@@ -265,6 +269,7 @@ Or you can install them separately:
|
|
|
265
269
|
- **[@promptbook/remote-client](https://www.npmjs.com/package/@promptbook/remote-client)** - Remote client for remote execution of promptbooks
|
|
266
270
|
- **[@promptbook/remote-server](https://www.npmjs.com/package/@promptbook/remote-server)** - Remote server for remote execution of promptbooks
|
|
267
271
|
- **[@promptbook/pdf](https://www.npmjs.com/package/@promptbook/pdf)** - Read knowledge from `.pdf` documents
|
|
272
|
+
- **[@promptbook/documents](https://www.npmjs.com/package/@promptbook/markitdown)** - Integration of [Markitdown by Microsoft](https://github.com/microsoft/markitdown)
|
|
268
273
|
- **[@promptbook/documents](https://www.npmjs.com/package/@promptbook/documents)** - Read knowledge from documents like `.docx`, `.odt`,…
|
|
269
274
|
- **[@promptbook/legacy-documents](https://www.npmjs.com/package/@promptbook/legacy-documents)** - Read knowledge from legacy documents like `.doc`, `.rtf`,…
|
|
270
275
|
- **[@promptbook/website-crawler](https://www.npmjs.com/package/@promptbook/website-crawler)** - Crawl knowledge from the web
|
package/esm/index.es.js
CHANGED
|
@@ -19,7 +19,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
19
19
|
* @generated
|
|
20
20
|
* @see https://github.com/webgptorg/promptbook
|
|
21
21
|
*/
|
|
22
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
22
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-9';
|
|
23
23
|
/**
|
|
24
24
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
25
25
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -303,7 +303,7 @@ var NotFoundError = /** @class */ (function (_super) {
|
|
|
303
303
|
var NotYetImplementedError = /** @class */ (function (_super) {
|
|
304
304
|
__extends(NotYetImplementedError, _super);
|
|
305
305
|
function NotYetImplementedError(message) {
|
|
306
|
-
var _this = _super.call(this, 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
|
|
306
|
+
var _this = _super.call(this, 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;
|
|
307
307
|
_this.name = 'NotYetImplementedError';
|
|
308
308
|
Object.setPrototypeOf(_this, NotYetImplementedError.prototype);
|
|
309
309
|
return _this;
|
|
@@ -411,7 +411,7 @@ var NAME = "Promptbook";
|
|
|
411
411
|
*
|
|
412
412
|
* @public exported from `@promptbook/core`
|
|
413
413
|
*/
|
|
414
|
-
var ADMIN_EMAIL = '
|
|
414
|
+
var ADMIN_EMAIL = 'pavol@ptbk.io';
|
|
415
415
|
/**
|
|
416
416
|
* Name of the responsible person for the Promptbook on GitHub
|
|
417
417
|
*
|
|
@@ -4536,6 +4536,55 @@ function validatePipelineString(pipelineString) {
|
|
|
4536
4536
|
var SUPPORTED_SCRIPT_LANGUAGES = ['javascript', 'typescript', 'python'];
|
|
4537
4537
|
// <- TODO: [🏥] DRY
|
|
4538
4538
|
|
|
4539
|
+
/**
|
|
4540
|
+
* Removes Markdown (or HTML) comments
|
|
4541
|
+
*
|
|
4542
|
+
* @param {string} content - The string to remove comments from.
|
|
4543
|
+
* @returns {string} The input string with all comments removed.
|
|
4544
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
4545
|
+
*/
|
|
4546
|
+
function removeMarkdownComments(content) {
|
|
4547
|
+
return spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
|
|
4548
|
+
}
|
|
4549
|
+
|
|
4550
|
+
/**
|
|
4551
|
+
* @@@
|
|
4552
|
+
*
|
|
4553
|
+
* @public exported from `@promptbook/editable`
|
|
4554
|
+
*/
|
|
4555
|
+
function isFlatPipeline(pipelineString) {
|
|
4556
|
+
pipelineString = removeMarkdownComments(pipelineString);
|
|
4557
|
+
pipelineString = spaceTrim$1(pipelineString);
|
|
4558
|
+
var isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
|
|
4559
|
+
var isLastLineReturnStatement = pipelineString.split('\n').pop().split('`').join('').startsWith('->');
|
|
4560
|
+
// TODO: Also (double)check
|
|
4561
|
+
// > const usedCommands
|
|
4562
|
+
// > const isBlocksUsed
|
|
4563
|
+
// > const returnStatementCount
|
|
4564
|
+
var isFlat = !isMarkdownBeginningWithHeadline && isLastLineReturnStatement;
|
|
4565
|
+
return isFlat;
|
|
4566
|
+
}
|
|
4567
|
+
|
|
4568
|
+
/**
|
|
4569
|
+
* @@@
|
|
4570
|
+
*
|
|
4571
|
+
* @public exported from `@promptbook/editable`
|
|
4572
|
+
*/
|
|
4573
|
+
function deflatePipeline(pipelineString) {
|
|
4574
|
+
if (!isFlatPipeline(pipelineString)) {
|
|
4575
|
+
return pipelineString;
|
|
4576
|
+
}
|
|
4577
|
+
var pipelineStringLines = pipelineString.split('\n');
|
|
4578
|
+
var returnStatement = pipelineStringLines.pop();
|
|
4579
|
+
var prompt = spaceTrim$1(pipelineStringLines.join('\n'));
|
|
4580
|
+
pipelineString = validatePipelineString(spaceTrim$1(function (block) { return "\n # ".concat(DEFAULT_BOOK_TITLE, "\n\n ## Prompt\n\n ```\n ").concat(block(prompt), "\n ```\n\n ").concat(returnStatement, "\n "); }));
|
|
4581
|
+
// <- TODO: Maybe use book` notation
|
|
4582
|
+
return pipelineString;
|
|
4583
|
+
}
|
|
4584
|
+
/**
|
|
4585
|
+
* TODO: Unit test
|
|
4586
|
+
*/
|
|
4587
|
+
|
|
4539
4588
|
/**
|
|
4540
4589
|
* Utility function to extract all list items from markdown
|
|
4541
4590
|
*
|
|
@@ -4837,17 +4886,6 @@ function flattenMarkdown(markdown) {
|
|
|
4837
4886
|
* NOW we are working just with markdown string and its good enough
|
|
4838
4887
|
*/
|
|
4839
4888
|
|
|
4840
|
-
/**
|
|
4841
|
-
* Removes Markdown (or HTML) comments
|
|
4842
|
-
*
|
|
4843
|
-
* @param {string} content - The string to remove comments from.
|
|
4844
|
-
* @returns {string} The input string with all comments removed.
|
|
4845
|
-
* @public exported from `@promptbook/markdown-utils`
|
|
4846
|
-
*/
|
|
4847
|
-
function removeMarkdownComments(content) {
|
|
4848
|
-
return spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
|
|
4849
|
-
}
|
|
4850
|
-
|
|
4851
4889
|
/**
|
|
4852
4890
|
* @@@
|
|
4853
4891
|
*
|
|
@@ -5105,26 +5143,9 @@ function parsePipeline(pipelineString) {
|
|
|
5105
5143
|
pipelineString = removeMarkdownComments(pipelineString);
|
|
5106
5144
|
pipelineString = spaceTrim(pipelineString);
|
|
5107
5145
|
// <- TODO: [😧] `spaceTrim` should preserve discriminated type *(or at lease `PipelineString`)*
|
|
5146
|
+
pipelineString = deflatePipeline(pipelineString);
|
|
5108
5147
|
// ==============
|
|
5109
|
-
// Note: 1️⃣◽2️⃣
|
|
5110
|
-
var isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
|
|
5111
|
-
var isLastLineReturnStatement = pipelineString.split('\n').pop().split('`').join('').startsWith('->');
|
|
5112
|
-
// TODO: Also (double)check
|
|
5113
|
-
// > const usedCommands
|
|
5114
|
-
// > const isBlocksUsed
|
|
5115
|
-
// > const returnStatementCount
|
|
5116
|
-
var isFlatPipeline = !isMarkdownBeginningWithHeadline && isLastLineReturnStatement;
|
|
5117
|
-
// console.log({ isMarkdownBeginningWithHeadline, isLastLineReturnStatement, isFlatPipeline });
|
|
5118
|
-
if (isFlatPipeline) {
|
|
5119
|
-
var pipelineStringLines = pipelineString.split('\n');
|
|
5120
|
-
var returnStatement_1 = pipelineStringLines.pop();
|
|
5121
|
-
var prompt_1 = spaceTrim(pipelineStringLines.join('\n'));
|
|
5122
|
-
pipelineString = validatePipelineString(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 "); }));
|
|
5123
|
-
// <- TODO: Maybe use book` notation
|
|
5124
|
-
// console.log(pipelineString);
|
|
5125
|
-
}
|
|
5126
|
-
// ==============
|
|
5127
|
-
// Note: 1️⃣◽3️⃣ Parse the markdown
|
|
5148
|
+
// Note: 1️⃣◽2️⃣ Parse the markdown
|
|
5128
5149
|
pipelineString = flattenMarkdown(pipelineString) /* <- Note: [🥞] */;
|
|
5129
5150
|
pipelineString = pipelineString.replaceAll(/`\{(?<parameterName>[a-z0-9_]+)\}`/gi, '{$<parameterName>}');
|
|
5130
5151
|
pipelineString = pipelineString.replaceAll(/`->\s+\{(?<parameterName>[a-z0-9_]+)\}`/gi, '-> {$<parameterName>}');
|