@promptbook/markdown-utils 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 +1 -1
  27. package/umd/index.umd.js +25 -17
  28. package/umd/index.umd.js.map +1 -1
package/umd/index.umd.js CHANGED
@@ -24,7 +24,7 @@
24
24
  * @generated
25
25
  * @see https://github.com/webgptorg/promptbook
26
26
  */
27
- const PROMPTBOOK_ENGINE_VERSION = '0.104.0-12';
27
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-14';
28
28
  /**
29
29
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
30
30
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -3428,7 +3428,7 @@
3428
3428
  tasks.push(task);
3429
3429
  runningTasks.push(task);
3430
3430
  /* not await */ Promise.resolve(task).then(() => {
3431
- runningTasks = runningTasks.filter((t) => t !== task);
3431
+ runningTasks = runningTasks.filter((runningTask) => runningTask !== task);
3432
3432
  });
3433
3433
  if (maxParallelCount < runningTasks.length) {
3434
3434
  await Promise.race(runningTasks);
@@ -3485,10 +3485,14 @@
3485
3485
  }
3486
3486
 
3487
3487
  /**
3488
- * Intercepts LLM tools and counts total usage of the tools
3488
+ * Intercepts LLM tools and counts total usage of the tools.
3489
3489
  *
3490
- * @param llmTools LLM tools to be intercepted with usage counting
3491
- * @returns LLM tools with same functionality with added total cost counting
3490
+ * This function wraps the provided `LlmExecutionTools` with a proxy that tracks the cumulative
3491
+ * usage (tokens, cost, etc.) across all model calls. It provides a way to monitor spending
3492
+ * in real-time through an observable.
3493
+ *
3494
+ * @param llmTools - The LLM tools to be intercepted and tracked
3495
+ * @returns An augmented version of the tools that includes usage tracking capabilities
3492
3496
  * @public exported from `@promptbook/core`
3493
3497
  */
3494
3498
  function countUsage(llmTools) {
@@ -3753,17 +3757,21 @@
3753
3757
  */
3754
3758
 
3755
3759
  /**
3756
- * Joins multiple LLM Execution Tools into one
3760
+ * Joins multiple LLM Execution Tools into one.
3757
3761
  *
3758
- * @returns {LlmExecutionTools} Single wrapper for multiple LlmExecutionTools
3762
+ * This function takes a list of `LlmExecutionTools` and returns a single unified
3763
+ * `MultipleLlmExecutionTools` object. It provides failover and aggregation logic:
3759
3764
  *
3760
- * 0) If there is no LlmExecutionTools, it warns and returns valid but empty LlmExecutionTools
3761
- * 1) If there is only one LlmExecutionTools, it returns it wrapped in a proxy object
3762
- * 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.
3763
- * 3) When all LlmExecutionTools fail, it throws an error with a list of all errors merged into one
3765
+ * 1. **Failover**: When a model call is made, it tries providers in the order they were provided.
3766
+ * If the first provider doesn't support the requested model or fails, it tries the next one.
3767
+ * 2. **Aggregation**: `listModels` returns a combined list of all models available from all providers.
3768
+ * 3. **Empty case**: If no tools are provided, it logs a warning (as Promptbook requires LLMs to function).
3764
3769
  *
3770
+ * @param title - A descriptive title for this collection of joined tools
3771
+ * @param llmExecutionTools - An array of execution tools to be joined
3772
+ * @returns A single unified execution tool wrapper
3765
3773
  *
3766
- * Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`
3774
+ * Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`.
3767
3775
  *
3768
3776
  * @public exported from `@promptbook/core`
3769
3777
  */
@@ -4390,8 +4398,8 @@
4390
4398
  */
4391
4399
  function removeDiacritics(input) {
4392
4400
  /*eslint no-control-regex: "off"*/
4393
- return input.replace(/[^\u0000-\u007E]/g, (a) => {
4394
- return DIACRITIC_VARIANTS_LETTERS[a] || a;
4401
+ return input.replace(/[^\u0000-\u007E]/g, (character) => {
4402
+ return DIACRITIC_VARIANTS_LETTERS[character] || character;
4395
4403
  });
4396
4404
  }
4397
4405
  /**
@@ -6590,7 +6598,7 @@
6590
6598
  const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
6591
6599
  const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
6592
6600
  const { index } = knowledgePiece;
6593
- const knowledgePieceIndex = index.find((i) => i.modelName === firstKnowledgeIndex.modelName);
6601
+ const knowledgePieceIndex = index.find((knowledgePieceIndex) => knowledgePieceIndex.modelName === firstKnowledgeIndex.modelName);
6594
6602
  // <- TODO: Do not use just first knowledge piece and first index to determine embedding model
6595
6603
  if (knowledgePieceIndex === undefined) {
6596
6604
  return {
@@ -7038,7 +7046,7 @@
7038
7046
  resovedParameterNames = [...resovedParameterNames, currentTask.resultingParameterName];
7039
7047
  })
7040
7048
  .then(() => {
7041
- resolving = resolving.filter((w) => w !== work);
7049
+ resolving = resolving.filter((workItem) => workItem !== work);
7042
7050
  });
7043
7051
  // <- Note: Errors are catched here [3]
7044
7052
  // 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
@@ -7204,7 +7212,7 @@
7204
7212
  // Calculate and update tldr based on pipeline progress
7205
7213
  const cv = newOngoingResult;
7206
7214
  // Calculate progress based on parameters resolved vs total parameters
7207
- const totalParameters = pipeline.parameters.filter((p) => !p.isInput).length;
7215
+ const totalParameters = pipeline.parameters.filter((parameter) => !parameter.isInput).length;
7208
7216
  let resolvedParameters = 0;
7209
7217
  let currentTaskTitle = '';
7210
7218
  // Get the resolved parameters from output parameters