@promptbook/remote-client 0.84.0-9 → 0.84.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 (43) hide show
  1. package/README.md +21 -9
  2. package/esm/index.es.js +62 -9
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/cli.index.d.ts +4 -0
  5. package/esm/typings/src/_packages/core.index.d.ts +12 -2
  6. package/esm/typings/src/_packages/deepseek.index.d.ts +8 -0
  7. package/esm/typings/src/_packages/types.index.d.ts +2 -0
  8. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  9. package/esm/typings/src/_packages/wizzard.index.d.ts +4 -0
  10. package/esm/typings/src/cli/cli-commands/about.d.ts +4 -1
  11. package/esm/typings/src/cli/cli-commands/hello.d.ts +3 -1
  12. package/esm/typings/src/cli/cli-commands/list-models.d.ts +3 -1
  13. package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +13 -0
  14. package/esm/typings/src/cli/cli-commands/make.d.ts +3 -1
  15. package/esm/typings/src/cli/cli-commands/prettify.d.ts +3 -1
  16. package/esm/typings/src/cli/cli-commands/run.d.ts +3 -1
  17. package/esm/typings/src/cli/cli-commands/runInteractiveChatbot.d.ts +1 -1
  18. package/esm/typings/src/cli/cli-commands/test-command.d.ts +3 -1
  19. package/esm/typings/src/config.d.ts +27 -1
  20. package/esm/typings/src/conversion/compilePipelineOnRemoteServer.d.ts +1 -1
  21. package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
  22. package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +3 -1
  23. package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +9 -0
  24. package/esm/typings/src/llm-providers/deepseek/DeepseekExecutionToolsOptions.d.ts +9 -0
  25. package/esm/typings/src/llm-providers/deepseek/createDeepseekExecutionTools.d.ts +14 -0
  26. package/esm/typings/src/llm-providers/deepseek/register-configuration.d.ts +14 -0
  27. package/esm/typings/src/llm-providers/deepseek/register-constructor.d.ts +15 -0
  28. package/esm/typings/src/pipeline/book-notation.d.ts +3 -2
  29. package/esm/typings/src/pipeline/prompt-notation.d.ts +18 -5
  30. package/esm/typings/src/prepare/preparePipelineOnRemoteServer.d.ts +1 -1
  31. package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts +5 -2
  32. package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.test.d.ts +1 -0
  33. package/esm/typings/src/utils/editable/utils/isFlatPipeline.test.d.ts +1 -0
  34. package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +3 -0
  35. package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +3 -0
  36. package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +3 -0
  37. package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +3 -0
  38. package/esm/typings/src/utils/files/mimeTypeToExtension.d.ts +10 -0
  39. package/esm/typings/src/utils/files/mimeTypeToExtension.test.d.ts +1 -0
  40. package/esm/typings/src/wizzard/wizzard.d.ts +7 -1
  41. package/package.json +9 -16
  42. package/umd/index.umd.js +62 -9
  43. package/umd/index.umd.js.map +1 -1
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.84.0-8';
26
+ var PROMPTBOOK_ENGINE_VERSION = '0.84.0-21';
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
@@ -434,6 +434,12 @@
434
434
  * @public exported from `@promptbook/core`
435
435
  */
436
436
  var DEFAULT_TASK_TITLE = "Task";
437
+ /**
438
+ * When the pipeline is flat and no name of return parameter is provided, this name is used
439
+ *
440
+ * @public exported from `@promptbook/core`
441
+ */
442
+ var DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = 'result';
437
443
  /**
438
444
  * Timeout for the connections in milliseconds
439
445
  *
@@ -649,7 +655,7 @@
649
655
  });
650
656
  }
651
657
  /**
652
- * TODO: !!!! Do not return Promise<PipelineJson> But PreparePipelineTask
658
+ * TODO: [🐚] Do not return Promise<PipelineJson> But PreparePipelineTask
653
659
  */
654
660
 
655
661
  /**
@@ -4452,7 +4458,10 @@
4452
4458
  description: 'Chatbot response',
4453
4459
  isInput: false,
4454
4460
  isOutput: true,
4455
- exampleValues: ['Hello, I am a Pavol`s virtual avatar. How can I help you?'],
4461
+ exampleValues: [
4462
+ 'Hello, how can I help you?',
4463
+ // <- TODO: [🧠] Make this dynamic, async, prepare-phase HLAs
4464
+ ],
4456
4465
  });
4457
4466
  // TODO: Use spaceTrim in multiline strings
4458
4467
  $pipelineJson.tasks.push({
@@ -4512,6 +4521,21 @@
4512
4521
  * Note: [💞] Ignore a discrepancy between file name and entity name
4513
4522
  */
4514
4523
 
4524
+ /**
4525
+ * Checks if value is valid email
4526
+ *
4527
+ * @public exported from `@promptbook/utils`
4528
+ */
4529
+ function isValidEmail(email) {
4530
+ if (typeof email !== 'string') {
4531
+ return false;
4532
+ }
4533
+ if (email.split('\n').length > 1) {
4534
+ return false;
4535
+ }
4536
+ return /^.+@.+\..+$/.test(email);
4537
+ }
4538
+
4515
4539
  /**
4516
4540
  * Function `validatePipelineString` will validate the if the string is a valid pipeline string
4517
4541
  * 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.
@@ -4525,6 +4549,15 @@
4525
4549
  if (isValidJsonString(pipelineString)) {
4526
4550
  throw new ParseError('Expected a book, but got a JSON string');
4527
4551
  }
4552
+ else if (isValidUrl(pipelineString)) {
4553
+ throw new ParseError("Expected a book, but got just the URL \"".concat(pipelineString, "\""));
4554
+ }
4555
+ else if (isValidFilePath(pipelineString)) {
4556
+ throw new ParseError("Expected a book, but got just the file path \"".concat(pipelineString, "\""));
4557
+ }
4558
+ else if (isValidEmail(pipelineString)) {
4559
+ throw new ParseError("Expected a book, but got just the email \"".concat(pipelineString, "\""));
4560
+ }
4528
4561
  // <- TODO: Implement the validation + add tests when the pipeline logic considered as invalid
4529
4562
  return pipelineString;
4530
4563
  }
@@ -4560,12 +4593,15 @@
4560
4593
  pipelineString = removeMarkdownComments(pipelineString);
4561
4594
  pipelineString = spaceTrim__default["default"](pipelineString);
4562
4595
  var isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
4563
- var isLastLineReturnStatement = pipelineString.split('\n').pop().split('`').join('').startsWith('->');
4564
- // TODO: Also (double)check
4596
+ //const isLastLineReturnStatement = pipelineString.split('\n').pop()!.split('`').join('').startsWith('->');
4597
+ var isBacktickBlockUsed = pipelineString.includes('```');
4598
+ var isQuoteBlocksUsed = /^>\s+/m.test(pipelineString);
4599
+ var isBlocksUsed = isBacktickBlockUsed || isQuoteBlocksUsed;
4600
+ // TODO: [🧉] Also (double)check
4565
4601
  // > const usedCommands
4566
4602
  // > const isBlocksUsed
4567
4603
  // > const returnStatementCount
4568
- var isFlat = !isMarkdownBeginningWithHeadline && isLastLineReturnStatement;
4604
+ var isFlat = !isMarkdownBeginningWithHeadline && !isBlocksUsed; /* && isLastLineReturnStatement */
4569
4605
  return isFlat;
4570
4606
  }
4571
4607
 
@@ -4579,9 +4615,26 @@
4579
4615
  return pipelineString;
4580
4616
  }
4581
4617
  var pipelineStringLines = pipelineString.split('\n');
4582
- var returnStatement = pipelineStringLines.pop();
4618
+ var potentialReturnStatement = pipelineStringLines.pop();
4619
+ var returnStatement;
4620
+ if (/(-|=)>\s*\{.*\}/.test(potentialReturnStatement)) {
4621
+ // Note: Last line is return statement
4622
+ returnStatement = potentialReturnStatement;
4623
+ }
4624
+ else {
4625
+ // Note: Last line is not a return statement
4626
+ returnStatement = "-> {".concat(DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, "}");
4627
+ pipelineStringLines.push(potentialReturnStatement);
4628
+ }
4583
4629
  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 "); }));
4630
+ var quotedPrompt;
4631
+ if (prompt.split('\n').length <= 1) {
4632
+ quotedPrompt = "> ".concat(prompt);
4633
+ }
4634
+ else {
4635
+ quotedPrompt = spaceTrim__default["default"](function (block) { return "\n ```\n ".concat(block(prompt.split('`').join('\\`')), "\n ```\n "); });
4636
+ }
4637
+ pipelineString = validatePipelineString(spaceTrim__default["default"](function (block) { return "\n # ".concat(DEFAULT_BOOK_TITLE, "\n\n ## Prompt\n\n ").concat(block(quotedPrompt), "\n\n ").concat(returnStatement, "\n "); }));
4585
4638
  // <- TODO: Maybe use book` notation
4586
4639
  return pipelineString;
4587
4640
  }
@@ -5587,7 +5640,7 @@
5587
5640
  });
5588
5641
  }
5589
5642
  /**
5590
- * TODO: !!!! Do not return Promise<PipelineJson> But PreparePipelineTask
5643
+ * TODO: [🐚] Do not return Promise<PipelineJson> But PreparePipelineTask
5591
5644
  */
5592
5645
 
5593
5646
  /**