@promptbook/remote-server 0.104.0-12 → 0.104.0-14

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 (28) hide show
  1. package/esm/index.es.js +25 -17
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/components.index.d.ts +0 -6
  4. package/esm/typings/src/book-components/Chat/save/_common/string_chat_format_name.d.ts +1 -1
  5. package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +4 -1
  6. package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +5 -1
  7. package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +4 -0
  8. package/esm/typings/src/book-components/icons/AboutIcon.d.ts +5 -1
  9. package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +6 -2
  10. package/esm/typings/src/book-components/icons/CameraIcon.d.ts +6 -2
  11. package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +5 -1
  12. package/esm/typings/src/book-components/icons/MenuIcon.d.ts +5 -1
  13. package/esm/typings/src/book-components/icons/SaveIcon.d.ts +6 -2
  14. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +7 -5
  15. package/esm/typings/src/commands/_common/types/Command.d.ts +1 -1
  16. package/esm/typings/src/commitments/_base/BookCommitment.d.ts +1 -1
  17. package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +1 -1
  18. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +7 -3
  19. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +11 -7
  20. package/esm/typings/src/remote-server/ui/ServerApp.d.ts +5 -1
  21. package/esm/typings/src/types/typeAliasEmoji.d.ts +2 -2
  22. package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +4 -0
  23. package/esm/typings/src/utils/random/$randomItem.d.ts +1 -1
  24. package/esm/typings/src/utils/random/$randomSeed.d.ts +1 -1
  25. package/esm/typings/src/version.d.ts +1 -1
  26. package/package.json +2 -2
  27. package/umd/index.umd.js +25 -17
  28. package/umd/index.umd.js.map +1 -1
package/umd/index.umd.js CHANGED
@@ -47,7 +47,7 @@
47
47
  * @generated
48
48
  * @see https://github.com/webgptorg/promptbook
49
49
  */
50
- const PROMPTBOOK_ENGINE_VERSION = '0.104.0-12';
50
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-14';
51
51
  /**
52
52
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
53
53
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -3726,7 +3726,7 @@
3726
3726
  tasks.push(task);
3727
3727
  runningTasks.push(task);
3728
3728
  /* not await */ Promise.resolve(task).then(() => {
3729
- runningTasks = runningTasks.filter((t) => t !== task);
3729
+ runningTasks = runningTasks.filter((runningTask) => runningTask !== task);
3730
3730
  });
3731
3731
  if (maxParallelCount < runningTasks.length) {
3732
3732
  await Promise.race(runningTasks);
@@ -3783,10 +3783,14 @@
3783
3783
  }
3784
3784
 
3785
3785
  /**
3786
- * Intercepts LLM tools and counts total usage of the tools
3786
+ * Intercepts LLM tools and counts total usage of the tools.
3787
3787
  *
3788
- * @param llmTools LLM tools to be intercepted with usage counting
3789
- * @returns LLM tools with same functionality with added total cost counting
3788
+ * This function wraps the provided `LlmExecutionTools` with a proxy that tracks the cumulative
3789
+ * usage (tokens, cost, etc.) across all model calls. It provides a way to monitor spending
3790
+ * in real-time through an observable.
3791
+ *
3792
+ * @param llmTools - The LLM tools to be intercepted and tracked
3793
+ * @returns An augmented version of the tools that includes usage tracking capabilities
3790
3794
  * @public exported from `@promptbook/core`
3791
3795
  */
3792
3796
  function countUsage(llmTools) {
@@ -4051,17 +4055,21 @@
4051
4055
  */
4052
4056
 
4053
4057
  /**
4054
- * Joins multiple LLM Execution Tools into one
4058
+ * Joins multiple LLM Execution Tools into one.
4055
4059
  *
4056
- * @returns {LlmExecutionTools} Single wrapper for multiple LlmExecutionTools
4060
+ * This function takes a list of `LlmExecutionTools` and returns a single unified
4061
+ * `MultipleLlmExecutionTools` object. It provides failover and aggregation logic:
4057
4062
  *
4058
- * 0) If there is no LlmExecutionTools, it warns and returns valid but empty LlmExecutionTools
4059
- * 1) If there is only one LlmExecutionTools, it returns it wrapped in a proxy object
4060
- * 2) If there are multiple LlmExecutionTools, first will be used first, second will be used if the first hasn`t defined model variant or fails, etc.
4061
- * 3) When all LlmExecutionTools fail, it throws an error with a list of all errors merged into one
4063
+ * 1. **Failover**: When a model call is made, it tries providers in the order they were provided.
4064
+ * If the first provider doesn't support the requested model or fails, it tries the next one.
4065
+ * 2. **Aggregation**: `listModels` returns a combined list of all models available from all providers.
4066
+ * 3. **Empty case**: If no tools are provided, it logs a warning (as Promptbook requires LLMs to function).
4062
4067
  *
4068
+ * @param title - A descriptive title for this collection of joined tools
4069
+ * @param llmExecutionTools - An array of execution tools to be joined
4070
+ * @returns A single unified execution tool wrapper
4063
4071
  *
4064
- * Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`
4072
+ * Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`.
4065
4073
  *
4066
4074
  * @public exported from `@promptbook/core`
4067
4075
  */
@@ -4688,8 +4696,8 @@
4688
4696
  */
4689
4697
  function removeDiacritics(input) {
4690
4698
  /*eslint no-control-regex: "off"*/
4691
- return input.replace(/[^\u0000-\u007E]/g, (a) => {
4692
- return DIACRITIC_VARIANTS_LETTERS[a] || a;
4699
+ return input.replace(/[^\u0000-\u007E]/g, (character) => {
4700
+ return DIACRITIC_VARIANTS_LETTERS[character] || character;
4693
4701
  });
4694
4702
  }
4695
4703
  /**
@@ -7007,7 +7015,7 @@
7007
7015
  const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
7008
7016
  const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
7009
7017
  const { index } = knowledgePiece;
7010
- const knowledgePieceIndex = index.find((i) => i.modelName === firstKnowledgeIndex.modelName);
7018
+ const knowledgePieceIndex = index.find((knowledgePieceIndex) => knowledgePieceIndex.modelName === firstKnowledgeIndex.modelName);
7011
7019
  // <- TODO: Do not use just first knowledge piece and first index to determine embedding model
7012
7020
  if (knowledgePieceIndex === undefined) {
7013
7021
  return {
@@ -7455,7 +7463,7 @@
7455
7463
  resovedParameterNames = [...resovedParameterNames, currentTask.resultingParameterName];
7456
7464
  })
7457
7465
  .then(() => {
7458
- resolving = resolving.filter((w) => w !== work);
7466
+ resolving = resolving.filter((workItem) => workItem !== work);
7459
7467
  });
7460
7468
  // <- Note: Errors are catched here [3]
7461
7469
  // TODO: BUT if in multiple tasks are errors, only the first one is catched so maybe we should catch errors here and save them to errors array here
@@ -7621,7 +7629,7 @@
7621
7629
  // Calculate and update tldr based on pipeline progress
7622
7630
  const cv = newOngoingResult;
7623
7631
  // Calculate progress based on parameters resolved vs total parameters
7624
- const totalParameters = pipeline.parameters.filter((p) => !p.isInput).length;
7632
+ const totalParameters = pipeline.parameters.filter((parameter) => !parameter.isInput).length;
7625
7633
  let resolvedParameters = 0;
7626
7634
  let currentTaskTitle = '';
7627
7635
  // Get the resolved parameters from output parameters