@promptbook/documents 0.104.0-1 → 0.104.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.
Files changed (42) hide show
  1. package/esm/index.es.js +28 -6
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/servers.d.ts +8 -0
  4. package/esm/typings/src/_packages/core.index.d.ts +2 -0
  5. package/esm/typings/src/_packages/types.index.d.ts +10 -2
  6. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +6 -1
  7. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +6 -6
  8. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.closed.test.d.ts +1 -0
  9. package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +3 -3
  10. package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +5 -1
  11. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
  12. package/esm/typings/src/book-components/Chat/CodeBlock/CodeBlock.d.ts +13 -0
  13. package/esm/typings/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -0
  14. package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +7 -11
  15. package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +2 -2
  16. package/esm/typings/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +56 -0
  17. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +21 -11
  18. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +80 -14
  19. package/esm/typings/src/commitments/DICTIONARY/DICTIONARY.d.ts +46 -0
  20. package/esm/typings/src/commitments/index.d.ts +2 -1
  21. package/esm/typings/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +6 -2
  22. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
  23. package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +1 -1
  24. package/esm/typings/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +1 -1
  25. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -0
  26. package/esm/typings/src/types/Message.d.ts +49 -0
  27. package/esm/typings/src/types/ModelRequirements.d.ts +38 -14
  28. package/esm/typings/src/types/typeAliases.d.ts +23 -1
  29. package/esm/typings/src/utils/color/utils/colorToDataUrl.d.ts +2 -1
  30. package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +4 -4
  31. package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +1 -1
  32. package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +1 -1
  33. package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +1 -1
  34. package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +1 -1
  35. package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +2 -2
  36. package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +2 -2
  37. package/esm/typings/src/utils/random/$randomBase58.d.ts +12 -0
  38. package/esm/typings/src/version.d.ts +1 -1
  39. package/package.json +2 -2
  40. package/umd/index.umd.js +30 -8
  41. package/umd/index.umd.js.map +1 -1
  42. package/esm/typings/src/book-2.0/utils/generateGravatarUrl.d.ts +0 -10
package/esm/index.es.js CHANGED
@@ -26,7 +26,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
26
26
  * @generated
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- const PROMPTBOOK_ENGINE_VERSION = '0.104.0-1';
29
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-10';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
32
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1282,13 +1282,14 @@ class UnexpectedError extends Error {
1282
1282
  *
1283
1283
  * @public exported from `@promptbook/utils`
1284
1284
  */
1285
- const $isRunningInNode = new Function(`
1285
+ function $isRunningInNode() {
1286
1286
  try {
1287
- return this === global;
1288
- } catch (e) {
1287
+ return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
1288
+ }
1289
+ catch (e) {
1289
1290
  return false;
1290
1291
  }
1291
- `);
1292
+ }
1292
1293
  /**
1293
1294
  * TODO: [🎺]
1294
1295
  */
@@ -4045,6 +4046,15 @@ function countUsage(llmTools) {
4045
4046
  return promptResult;
4046
4047
  };
4047
4048
  }
4049
+ if (llmTools.callImageGenerationModel !== undefined) {
4050
+ proxyTools.callImageGenerationModel = async (prompt) => {
4051
+ // console.info('[🚕] callImageGenerationModel through countTotalUsage');
4052
+ const promptResult = await llmTools.callImageGenerationModel(prompt);
4053
+ totalUsage = addUsage(totalUsage, promptResult.usage);
4054
+ spending.next(promptResult.usage);
4055
+ return promptResult;
4056
+ };
4057
+ }
4048
4058
  // <- Note: [🤖]
4049
4059
  return proxyTools;
4050
4060
  }
@@ -4154,6 +4164,12 @@ class MultipleLlmExecutionTools {
4154
4164
  callEmbeddingModel(prompt) {
4155
4165
  return this.callCommonModel(prompt);
4156
4166
  }
4167
+ /**
4168
+ * Calls the best available embedding model
4169
+ */
4170
+ callImageGenerationModel(prompt) {
4171
+ return this.callCommonModel(prompt);
4172
+ }
4157
4173
  // <- Note: [🤖]
4158
4174
  /**
4159
4175
  * Calls the best available model
@@ -4180,6 +4196,11 @@ class MultipleLlmExecutionTools {
4180
4196
  continue llm;
4181
4197
  }
4182
4198
  return await llmExecutionTools.callEmbeddingModel(prompt);
4199
+ case 'IMAGE_GENERATION':
4200
+ if (llmExecutionTools.callImageGenerationModel === undefined) {
4201
+ continue llm;
4202
+ }
4203
+ return await llmExecutionTools.callImageGenerationModel(prompt);
4183
4204
  // <- case [🤖]:
4184
4205
  default:
4185
4206
  throw new UnexpectedError(`Unknown model variant "${prompt.modelRequirements.modelVariant}" in ${llmExecutionTools.title}`);
@@ -6304,8 +6325,9 @@ async function executeAttempts(options) {
6304
6325
  $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
6305
6326
  break variant;
6306
6327
  case 'EMBEDDING':
6328
+ case 'IMAGE_GENERATION':
6307
6329
  throw new PipelineExecutionError(spaceTrim$1((block) => `
6308
- Embedding model can not be used in pipeline
6330
+ ${modelRequirements.modelVariant} model can not be used in pipeline
6309
6331
 
6310
6332
  This should be catched during parsing
6311
6333