@promptbook/remote-client 0.84.0-9 → 0.85.0-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.
- package/README.md +21 -5
- package/esm/index.es.js +62 -9
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/cli.index.d.ts +4 -0
- package/esm/typings/src/_packages/core.index.d.ts +12 -4
- package/esm/typings/src/_packages/deepseek.index.d.ts +8 -0
- package/esm/typings/src/_packages/types.index.d.ts +16 -2
- package/esm/typings/src/_packages/utils.index.d.ts +2 -2
- package/esm/typings/src/_packages/wizzard.index.d.ts +4 -0
- package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +13 -0
- package/esm/typings/src/cli/cli-commands/about.d.ts +4 -1
- package/esm/typings/src/cli/cli-commands/hello.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/list-models.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +13 -0
- package/esm/typings/src/cli/cli-commands/make.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/run.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/runInteractiveChatbot.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/start-server.d.ts +13 -0
- package/esm/typings/src/cli/cli-commands/test-command.d.ts +3 -1
- package/esm/typings/src/config.d.ts +27 -1
- package/esm/typings/src/conversion/compilePipelineOnRemoteServer.d.ts +1 -1
- package/esm/typings/src/execution/AbstractTaskResult.d.ts +25 -0
- package/esm/typings/src/execution/ExecutionTask.d.ts +71 -0
- package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
- package/esm/typings/src/execution/PipelineExecutor.d.ts +2 -5
- package/esm/typings/src/execution/PipelineExecutorResult.d.ts +2 -15
- package/esm/typings/src/execution/PromptbookFetch.d.ts +8 -1
- package/esm/typings/src/execution/{assertsExecutionSuccessful.d.ts → assertsTaskSuccessful.d.ts} +4 -3
- package/esm/typings/src/execution/createPipelineExecutor/00-createPipelineExecutor.d.ts +0 -3
- package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +2 -6
- package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +3 -6
- package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +9 -0
- package/esm/typings/src/llm-providers/deepseek/DeepseekExecutionToolsOptions.d.ts +9 -0
- package/esm/typings/src/llm-providers/deepseek/createDeepseekExecutionTools.d.ts +14 -0
- package/esm/typings/src/llm-providers/deepseek/register-configuration.d.ts +14 -0
- package/esm/typings/src/llm-providers/deepseek/register-constructor.d.ts +15 -0
- package/esm/typings/src/pipeline/book-notation.d.ts +3 -2
- package/esm/typings/src/pipeline/prompt-notation.d.ts +18 -5
- package/esm/typings/src/prepare/preparePipelineOnRemoteServer.d.ts +1 -1
- package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts +5 -2
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -0
- package/esm/typings/src/types/typeAliases.d.ts +2 -0
- package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.test.d.ts +1 -0
- package/esm/typings/src/utils/editable/utils/isFlatPipeline.test.d.ts +1 -0
- package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +3 -0
- package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +3 -0
- package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +3 -0
- package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +3 -0
- package/esm/typings/src/utils/files/mimeTypeToExtension.d.ts +10 -0
- package/esm/typings/src/utils/files/mimeTypeToExtension.test.d.ts +1 -0
- package/esm/typings/src/utils/random/$randomSeed.d.ts +2 -1
- package/esm/typings/src/utils/random/$randomToken.d.ts +13 -0
- package/esm/typings/src/wizzard/wizzard.d.ts +8 -3
- package/package.json +9 -16
- package/umd/index.umd.js +62 -9
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/remote-server/socket-types/_common/PromptbookServer_Progress.d.ts +0 -10
- package/esm/typings/src/types/TaskProgress.d.ts +0 -43
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten -->
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# ✨ Promptbook
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -14,12 +14,13 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## 🌟 New Features
|
|
18
18
|
|
|
19
|
+
- 💫 Support of [`o3-mini` model by OpenAI](https://openai.com/index/openai-o3-mini/)
|
|
20
|
+
- 🐋 **Support of [DeepSeek models](https://www.npmjs.com/package/@promptbook/deepseek)**
|
|
19
21
|
- 💙 Working [the **Book** language v1.0.0](https://github.com/webgptorg/book)
|
|
20
22
|
- 🖤 Run books from CLI - `npx ptbk run path/to/your/book`
|
|
21
|
-
- 📚 Support of `.docx`, `.doc` and `.pdf` documents
|
|
22
|
-
- ✨ **Support of [OpenAI o1 model](https://openai.com/o1/)**
|
|
23
|
+
- 📚 Support of `.docx`, `.doc` and `.pdf` documents as knowledge
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
|
|
@@ -263,8 +264,9 @@ Or you can install them separately:
|
|
|
263
264
|
- **[@promptbook/anthropic-claude](https://www.npmjs.com/package/@promptbook/anthropic-claude)** - Execution tools for Anthropic Claude API, wrapper around Anthropic Claude SDK
|
|
264
265
|
- **[@promptbook/vercel](https://www.npmjs.com/package/@promptbook/vercel)** - Adapter for Vercel functionalities
|
|
265
266
|
- **[@promptbook/google](https://www.npmjs.com/package/@promptbook/google)** - Integration with Google's Gemini API
|
|
267
|
+
- **[@promptbook/deepseek](https://www.npmjs.com/package/@promptbook/deepseek)** - Integration with [DeepSeek API](https://www.deepseek.com/)
|
|
266
268
|
- **[@promptbook/azure-openai](https://www.npmjs.com/package/@promptbook/azure-openai)** - Execution tools for Azure OpenAI API
|
|
267
|
-
|
|
269
|
+
|
|
268
270
|
- **[@promptbook/fake-llm](https://www.npmjs.com/package/@promptbook/fake-llm)** - Mocked execution tools for testing the library and saving the tokens
|
|
269
271
|
- **[@promptbook/remote-client](https://www.npmjs.com/package/@promptbook/remote-client)** - Remote client for remote execution of promptbooks
|
|
270
272
|
- **[@promptbook/remote-server](https://www.npmjs.com/package/@promptbook/remote-server)** - Remote server for remote execution of promptbooks
|
|
@@ -434,6 +436,20 @@ See [TODO.md](./TODO.md)
|
|
|
434
436
|
|
|
435
437
|
|
|
436
438
|
|
|
439
|
+
## 🤝 Partners
|
|
440
|
+
|
|
441
|
+
<div style="display: flex; align-items: center; gap: 20px;">
|
|
442
|
+
|
|
443
|
+
<a href="https://promptbook.studio/">
|
|
444
|
+
<img src="./other/design/promptbook-studio-logo.png" alt="Partner 3" height="100">
|
|
445
|
+
</a>
|
|
446
|
+
|
|
447
|
+
<a href="https://technologickainkubace.org/en/about-technology-incubation/about-the-project/">
|
|
448
|
+
<img src="./other/partners/CI-Technology-Incubation.png" alt="Technology Incubation" height="100">
|
|
449
|
+
</a>
|
|
450
|
+
|
|
451
|
+
</div>
|
|
452
|
+
|
|
437
453
|
## 🖋️ Contributing
|
|
438
454
|
|
|
439
455
|
I am open to pull requests, feedback, and suggestions. Or if you like this utility, you can [☕ buy me a coffee](https://www.buymeacoffee.com/hejny) or [donate via cryptocurrencies](https://github.com/hejny/hejny/blob/main/documents/crypto.md).
|
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.84.0
|
|
22
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.84.0';
|
|
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
|
|
@@ -430,6 +430,12 @@ var DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
|
|
|
430
430
|
* @public exported from `@promptbook/core`
|
|
431
431
|
*/
|
|
432
432
|
var DEFAULT_TASK_TITLE = "Task";
|
|
433
|
+
/**
|
|
434
|
+
* When the pipeline is flat and no name of return parameter is provided, this name is used
|
|
435
|
+
*
|
|
436
|
+
* @public exported from `@promptbook/core`
|
|
437
|
+
*/
|
|
438
|
+
var DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = 'result';
|
|
433
439
|
/**
|
|
434
440
|
* Timeout for the connections in milliseconds
|
|
435
441
|
*
|
|
@@ -645,7 +651,7 @@ function preparePipelineOnRemoteServer(pipeline, options) {
|
|
|
645
651
|
});
|
|
646
652
|
}
|
|
647
653
|
/**
|
|
648
|
-
* TODO:
|
|
654
|
+
* TODO: [🐚] Do not return `Promise<PipelineJson>` But `PreparationTask`
|
|
649
655
|
*/
|
|
650
656
|
|
|
651
657
|
/**
|
|
@@ -4448,7 +4454,10 @@ var QuickChatbotHla = {
|
|
|
4448
4454
|
description: 'Chatbot response',
|
|
4449
4455
|
isInput: false,
|
|
4450
4456
|
isOutput: true,
|
|
4451
|
-
exampleValues: [
|
|
4457
|
+
exampleValues: [
|
|
4458
|
+
'Hello, how can I help you?',
|
|
4459
|
+
// <- TODO: [🧠] Make this dynamic, async, prepare-phase HLAs
|
|
4460
|
+
],
|
|
4452
4461
|
});
|
|
4453
4462
|
// TODO: Use spaceTrim in multiline strings
|
|
4454
4463
|
$pipelineJson.tasks.push({
|
|
@@ -4508,6 +4517,21 @@ var HIGH_LEVEL_ABSTRACTIONS = [
|
|
|
4508
4517
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
4509
4518
|
*/
|
|
4510
4519
|
|
|
4520
|
+
/**
|
|
4521
|
+
* Checks if value is valid email
|
|
4522
|
+
*
|
|
4523
|
+
* @public exported from `@promptbook/utils`
|
|
4524
|
+
*/
|
|
4525
|
+
function isValidEmail(email) {
|
|
4526
|
+
if (typeof email !== 'string') {
|
|
4527
|
+
return false;
|
|
4528
|
+
}
|
|
4529
|
+
if (email.split('\n').length > 1) {
|
|
4530
|
+
return false;
|
|
4531
|
+
}
|
|
4532
|
+
return /^.+@.+\..+$/.test(email);
|
|
4533
|
+
}
|
|
4534
|
+
|
|
4511
4535
|
/**
|
|
4512
4536
|
* Function `validatePipelineString` will validate the if the string is a valid pipeline string
|
|
4513
4537
|
* It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
|
|
@@ -4521,6 +4545,15 @@ function validatePipelineString(pipelineString) {
|
|
|
4521
4545
|
if (isValidJsonString(pipelineString)) {
|
|
4522
4546
|
throw new ParseError('Expected a book, but got a JSON string');
|
|
4523
4547
|
}
|
|
4548
|
+
else if (isValidUrl(pipelineString)) {
|
|
4549
|
+
throw new ParseError("Expected a book, but got just the URL \"".concat(pipelineString, "\""));
|
|
4550
|
+
}
|
|
4551
|
+
else if (isValidFilePath(pipelineString)) {
|
|
4552
|
+
throw new ParseError("Expected a book, but got just the file path \"".concat(pipelineString, "\""));
|
|
4553
|
+
}
|
|
4554
|
+
else if (isValidEmail(pipelineString)) {
|
|
4555
|
+
throw new ParseError("Expected a book, but got just the email \"".concat(pipelineString, "\""));
|
|
4556
|
+
}
|
|
4524
4557
|
// <- TODO: Implement the validation + add tests when the pipeline logic considered as invalid
|
|
4525
4558
|
return pipelineString;
|
|
4526
4559
|
}
|
|
@@ -4556,12 +4589,15 @@ function isFlatPipeline(pipelineString) {
|
|
|
4556
4589
|
pipelineString = removeMarkdownComments(pipelineString);
|
|
4557
4590
|
pipelineString = spaceTrim$1(pipelineString);
|
|
4558
4591
|
var isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
|
|
4559
|
-
|
|
4560
|
-
|
|
4592
|
+
//const isLastLineReturnStatement = pipelineString.split('\n').pop()!.split('`').join('').startsWith('->');
|
|
4593
|
+
var isBacktickBlockUsed = pipelineString.includes('```');
|
|
4594
|
+
var isQuoteBlocksUsed = /^>\s+/m.test(pipelineString);
|
|
4595
|
+
var isBlocksUsed = isBacktickBlockUsed || isQuoteBlocksUsed;
|
|
4596
|
+
// TODO: [🧉] Also (double)check
|
|
4561
4597
|
// > const usedCommands
|
|
4562
4598
|
// > const isBlocksUsed
|
|
4563
4599
|
// > const returnStatementCount
|
|
4564
|
-
var isFlat = !isMarkdownBeginningWithHeadline && isLastLineReturnStatement
|
|
4600
|
+
var isFlat = !isMarkdownBeginningWithHeadline && !isBlocksUsed; /* && isLastLineReturnStatement */
|
|
4565
4601
|
return isFlat;
|
|
4566
4602
|
}
|
|
4567
4603
|
|
|
@@ -4575,9 +4611,26 @@ function deflatePipeline(pipelineString) {
|
|
|
4575
4611
|
return pipelineString;
|
|
4576
4612
|
}
|
|
4577
4613
|
var pipelineStringLines = pipelineString.split('\n');
|
|
4578
|
-
var
|
|
4614
|
+
var potentialReturnStatement = pipelineStringLines.pop();
|
|
4615
|
+
var returnStatement;
|
|
4616
|
+
if (/(-|=)>\s*\{.*\}/.test(potentialReturnStatement)) {
|
|
4617
|
+
// Note: Last line is return statement
|
|
4618
|
+
returnStatement = potentialReturnStatement;
|
|
4619
|
+
}
|
|
4620
|
+
else {
|
|
4621
|
+
// Note: Last line is not a return statement
|
|
4622
|
+
returnStatement = "-> {".concat(DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, "}");
|
|
4623
|
+
pipelineStringLines.push(potentialReturnStatement);
|
|
4624
|
+
}
|
|
4579
4625
|
var prompt = spaceTrim$1(pipelineStringLines.join('\n'));
|
|
4580
|
-
|
|
4626
|
+
var quotedPrompt;
|
|
4627
|
+
if (prompt.split('\n').length <= 1) {
|
|
4628
|
+
quotedPrompt = "> ".concat(prompt);
|
|
4629
|
+
}
|
|
4630
|
+
else {
|
|
4631
|
+
quotedPrompt = spaceTrim$1(function (block) { return "\n ```\n ".concat(block(prompt.split('`').join('\\`')), "\n ```\n "); });
|
|
4632
|
+
}
|
|
4633
|
+
pipelineString = validatePipelineString(spaceTrim$1(function (block) { return "\n # ".concat(DEFAULT_BOOK_TITLE, "\n\n ## Prompt\n\n ").concat(block(quotedPrompt), "\n\n ").concat(returnStatement, "\n "); }));
|
|
4581
4634
|
// <- TODO: Maybe use book` notation
|
|
4582
4635
|
return pipelineString;
|
|
4583
4636
|
}
|
|
@@ -5583,7 +5636,7 @@ function compilePipelineOnRemoteServer(pipelineString, options) {
|
|
|
5583
5636
|
});
|
|
5584
5637
|
}
|
|
5585
5638
|
/**
|
|
5586
|
-
* TODO:
|
|
5639
|
+
* TODO: [🐚] Do not return `Promise<PipelineJson>` But `PreparationTask`
|
|
5587
5640
|
*/
|
|
5588
5641
|
|
|
5589
5642
|
/**
|