@promptbook/wizard 0.104.0-0 โ†’ 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 +240 -87
  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 +246 -93
  41. package/umd/index.umd.js.map +1 -1
  42. package/esm/typings/src/book-2.0/utils/generateGravatarUrl.d.ts +0 -10
package/umd/index.umd.js CHANGED
@@ -48,7 +48,7 @@
48
48
  * @generated
49
49
  * @see https://github.com/webgptorg/promptbook
50
50
  */
51
- const PROMPTBOOK_ENGINE_VERSION = '0.104.0-0';
51
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-10';
52
52
  /**
53
53
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
54
54
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
@@ -58,6 +58,8 @@
58
58
  * Core Promptbook server configuration.
59
59
  *
60
60
  * This server is also used for auto-federation in the Agents Server.
61
+ *
62
+ * @public exported from `@promptbook/core`
61
63
  */
62
64
  const CORE_SERVER = {
63
65
  title: 'Promptbook Core',
@@ -2538,6 +2540,7 @@
2538
2540
  }
2539
2541
  }
2540
2542
  /**
2543
+ * TODO: !!!! Deprecate pipeline server and all of its components
2541
2544
  * TODO: Maybe use `$exportJson`
2542
2545
  * TODO: [๐Ÿง ][๐Ÿ›] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
2543
2546
  * TODO: [๐Ÿ“] Allow to list compatible models with each variant
@@ -4711,13 +4714,15 @@
4711
4714
  *
4712
4715
  * @public exported from `@promptbook/utils`
4713
4716
  */
4714
- const $isRunningInJest = new Function(`
4715
- try {
4716
- return process.env.JEST_WORKER_ID !== undefined;
4717
- } catch (e) {
4718
- return false;
4717
+ function $isRunningInJest() {
4718
+ var _a;
4719
+ try {
4720
+ return typeof process !== 'undefined' && ((_a = process.env) === null || _a === void 0 ? void 0 : _a.JEST_WORKER_ID) !== undefined;
4721
+ }
4722
+ catch (e) {
4723
+ return false;
4724
+ }
4719
4725
  }
4720
- `);
4721
4726
  /**
4722
4727
  * TODO: [๐ŸŽบ]
4723
4728
  */
@@ -5577,13 +5582,14 @@
5577
5582
  *
5578
5583
  * @public exported from `@promptbook/utils`
5579
5584
  */
5580
- const $isRunningInBrowser = new Function(`
5581
- try {
5582
- return this === window;
5583
- } catch (e) {
5584
- return false;
5585
+ function $isRunningInBrowser() {
5586
+ try {
5587
+ return typeof window !== 'undefined' && typeof window.document !== 'undefined';
5588
+ }
5589
+ catch (e) {
5590
+ return false;
5591
+ }
5585
5592
  }
5586
- `);
5587
5593
  /**
5588
5594
  * TODO: [๐ŸŽบ]
5589
5595
  */
@@ -5595,17 +5601,17 @@
5595
5601
  *
5596
5602
  * @public exported from `@promptbook/utils`
5597
5603
  */
5598
- const $isRunningInWebWorker = new Function(`
5599
- try {
5600
- if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
5601
- return true;
5602
- } else {
5604
+ function $isRunningInWebWorker() {
5605
+ try {
5606
+ // Note: Check for importScripts which is specific to workers
5607
+ // and not available in the main browser thread
5608
+ return (typeof self !== 'undefined' &&
5609
+ typeof self.importScripts === 'function');
5610
+ }
5611
+ catch (e) {
5603
5612
  return false;
5604
5613
  }
5605
- } catch (e) {
5606
- return false;
5607
5614
  }
5608
- `);
5609
5615
  /**
5610
5616
  * TODO: [๐ŸŽบ]
5611
5617
  */
@@ -5837,7 +5843,7 @@
5837
5843
  let threadMessages = [];
5838
5844
  if ('thread' in prompt && Array.isArray(prompt.thread)) {
5839
5845
  threadMessages = prompt.thread.map((msg) => ({
5840
- role: msg.role === 'assistant' ? 'assistant' : 'user',
5846
+ role: msg.sender === 'assistant' ? 'assistant' : 'user',
5841
5847
  content: msg.content,
5842
5848
  }));
5843
5849
  }
@@ -6250,13 +6256,14 @@
6250
6256
  const modelName = currentModelRequirements.modelName || this.getDefaultImageGenerationModel().modelName;
6251
6257
  const modelSettings = {
6252
6258
  model: modelName,
6253
- // size: currentModelRequirements.size,
6254
- // quality: currentModelRequirements.quality,
6255
- // style: currentModelRequirements.style,
6259
+ size: currentModelRequirements.size,
6260
+ quality: currentModelRequirements.quality,
6261
+ style: currentModelRequirements.style,
6256
6262
  };
6257
6263
  const rawPromptContent = templateParameters(content, { ...parameters, modelName });
6258
6264
  const rawRequest = {
6259
6265
  ...modelSettings,
6266
+ size: modelSettings.size || '1024x1024',
6260
6267
  prompt: rawPromptContent,
6261
6268
  user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
6262
6269
  response_format: 'url', // TODO: [๐Ÿง ] Maybe allow b64_json
@@ -6793,10 +6800,10 @@
6793
6800
  // <- TODO: [๐Ÿ›„]
6794
6801
  }
6795
6802
  /**
6796
- * Default model for image generation variant.
6803
+ * Default model for completion variant.
6797
6804
  */
6798
6805
  getDefaultImageGenerationModel() {
6799
- return this.getDefaultModel('!!!'); // <- TODO: [๐Ÿง ] Pick the best default model
6806
+ return this.getDefaultModel('dall-e-3');
6800
6807
  // <- TODO: [๐Ÿ›„]
6801
6808
  }
6802
6809
  }
@@ -7611,11 +7618,10 @@
7611
7618
  throw new PipelineExecutionError(`${this.title} does not support EMBEDDING model variant`);
7612
7619
  }
7613
7620
  /**
7614
- * Default model for image generation variant.
7621
+ * Default model for completion variant.
7615
7622
  */
7616
7623
  getDefaultImageGenerationModel() {
7617
- return this.getDefaultModel('!!!'); // <- TODO: [๐Ÿง ] Pick the best default model
7618
- // <- TODO: [๐Ÿ›„]
7624
+ throw new PipelineExecutionError(`${this.title} does not support IMAGE_GENERATION model variant`);
7619
7625
  }
7620
7626
  }
7621
7627
  /**
@@ -7707,13 +7713,14 @@
7707
7713
  *
7708
7714
  * @public exported from `@promptbook/utils`
7709
7715
  */
7710
- const $isRunningInNode = new Function(`
7711
- try {
7712
- return this === global;
7713
- } catch (e) {
7714
- return false;
7716
+ function $isRunningInNode() {
7717
+ try {
7718
+ return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
7719
+ }
7720
+ catch (e) {
7721
+ return false;
7722
+ }
7715
7723
  }
7716
- `);
7717
7724
  /**
7718
7725
  * TODO: [๐ŸŽบ]
7719
7726
  */
@@ -9426,6 +9433,15 @@
9426
9433
  return promptResult;
9427
9434
  };
9428
9435
  }
9436
+ if (llmTools.callImageGenerationModel !== undefined) {
9437
+ proxyTools.callImageGenerationModel = async (prompt) => {
9438
+ // console.info('[๐Ÿš•] callImageGenerationModel through countTotalUsage');
9439
+ const promptResult = await llmTools.callImageGenerationModel(prompt);
9440
+ totalUsage = addUsage(totalUsage, promptResult.usage);
9441
+ spending.next(promptResult.usage);
9442
+ return promptResult;
9443
+ };
9444
+ }
9429
9445
  // <- Note: [๐Ÿค–]
9430
9446
  return proxyTools;
9431
9447
  }
@@ -9535,6 +9551,12 @@
9535
9551
  callEmbeddingModel(prompt) {
9536
9552
  return this.callCommonModel(prompt);
9537
9553
  }
9554
+ /**
9555
+ * Calls the best available embedding model
9556
+ */
9557
+ callImageGenerationModel(prompt) {
9558
+ return this.callCommonModel(prompt);
9559
+ }
9538
9560
  // <- Note: [๐Ÿค–]
9539
9561
  /**
9540
9562
  * Calls the best available model
@@ -9561,6 +9583,11 @@
9561
9583
  continue llm;
9562
9584
  }
9563
9585
  return await llmExecutionTools.callEmbeddingModel(prompt);
9586
+ case 'IMAGE_GENERATION':
9587
+ if (llmExecutionTools.callImageGenerationModel === undefined) {
9588
+ continue llm;
9589
+ }
9590
+ return await llmExecutionTools.callImageGenerationModel(prompt);
9564
9591
  // <- case [๐Ÿค–]:
9565
9592
  default:
9566
9593
  throw new UnexpectedError(`Unknown model variant "${prompt.modelRequirements.modelVariant}" in ${llmExecutionTools.title}`);
@@ -11264,8 +11291,9 @@
11264
11291
  $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
11265
11292
  break variant;
11266
11293
  case 'EMBEDDING':
11294
+ case 'IMAGE_GENERATION':
11267
11295
  throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
11268
- Embedding model can not be used in pipeline
11296
+ ${modelRequirements.modelVariant} model can not be used in pipeline
11269
11297
 
11270
11298
  This should be catched during parsing
11271
11299
 
@@ -14133,6 +14161,114 @@
14133
14161
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
14134
14162
  */
14135
14163
 
14164
+ /**
14165
+ * DICTIONARY commitment definition
14166
+ *
14167
+ * The DICTIONARY commitment defines specific terms and their meanings that the agent should use correctly
14168
+ * in its reasoning and responses. This ensures consistent terminology usage.
14169
+ *
14170
+ * Key features:
14171
+ * - Multiple DICTIONARY commitments are automatically merged into one
14172
+ * - Content is placed in a dedicated section of the system message
14173
+ * - Terms and definitions are stored in metadata.DICTIONARY for debugging
14174
+ * - Agent should use the defined terms correctly in responses
14175
+ *
14176
+ * Example usage in agent source:
14177
+ *
14178
+ * ```book
14179
+ * Legal Assistant
14180
+ *
14181
+ * PERSONA You are a knowledgeable legal assistant
14182
+ * DICTIONARY Misdemeanor is a minor wrongdoing or criminal offense
14183
+ * DICTIONARY Felony is a serious crime usually punishable by imprisonment for more than one year
14184
+ * DICTIONARY Tort is a civil wrong that causes harm or loss to another person, leading to legal liability
14185
+ * ```
14186
+ *
14187
+ * @private [๐Ÿช”] Maybe export the commitments through some package
14188
+ */
14189
+ class DictionaryCommitmentDefinition extends BaseCommitmentDefinition {
14190
+ constructor() {
14191
+ super('DICTIONARY');
14192
+ }
14193
+ /**
14194
+ * Short one-line description of DICTIONARY.
14195
+ */
14196
+ get description() {
14197
+ return 'Define terms and their meanings for consistent terminology usage.';
14198
+ }
14199
+ /**
14200
+ * Icon for this commitment.
14201
+ */
14202
+ get icon() {
14203
+ return '๐Ÿ“š';
14204
+ }
14205
+ /**
14206
+ * Markdown documentation for DICTIONARY commitment.
14207
+ */
14208
+ get documentation() {
14209
+ return spaceTrim$1.spaceTrim(`
14210
+ # DICTIONARY
14211
+
14212
+ Defines specific terms and their meanings that the agent should use correctly in reasoning and responses.
14213
+
14214
+ ## Key aspects
14215
+
14216
+ - Multiple \`DICTIONARY\` commitments are merged together.
14217
+ - Terms are defined in the format: "Term is definition"
14218
+ - The agent should use these terms consistently in responses.
14219
+ - Definitions help ensure accurate and consistent terminology.
14220
+
14221
+ ## Examples
14222
+
14223
+ \`\`\`book
14224
+ Legal Assistant
14225
+
14226
+ PERSONA You are a knowledgeable legal assistant specializing in criminal law
14227
+ DICTIONARY Misdemeanor is a minor wrongdoing or criminal offense
14228
+ DICTIONARY Felony is a serious crime usually punishable by imprisonment for more than one year
14229
+ DICTIONARY Tort is a civil wrong that causes harm or loss to another person, leading to legal liability
14230
+ \`\`\`
14231
+
14232
+ \`\`\`book
14233
+ Medical Assistant
14234
+
14235
+ PERSONA You are a helpful medical assistant
14236
+ DICTIONARY Hypertension is persistently high blood pressure
14237
+ DICTIONARY Diabetes is a chronic condition that affects how the body processes blood sugar
14238
+ DICTIONARY Vaccine is a biological preparation that provides active immunity to a particular disease
14239
+ \`\`\`
14240
+ `);
14241
+ }
14242
+ applyToAgentModelRequirements(requirements, content) {
14243
+ var _a;
14244
+ const trimmedContent = content.trim();
14245
+ if (!trimmedContent) {
14246
+ return requirements;
14247
+ }
14248
+ // Get existing dictionary entries from metadata
14249
+ const existingDictionary = ((_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.DICTIONARY) || '';
14250
+ // Merge the new dictionary entry with existing entries
14251
+ const mergedDictionary = existingDictionary
14252
+ ? `${existingDictionary}\n${trimmedContent}`
14253
+ : trimmedContent;
14254
+ // Store the merged dictionary in metadata for debugging and inspection
14255
+ const updatedMetadata = {
14256
+ ...requirements.metadata,
14257
+ DICTIONARY: mergedDictionary,
14258
+ };
14259
+ // Create the dictionary section for the system message
14260
+ // Format: "# DICTIONARY\nTerm: definition\nTerm: definition..."
14261
+ const dictionarySection = `# DICTIONARY\n${mergedDictionary}`;
14262
+ return {
14263
+ ...this.appendToSystemMessage(requirements, dictionarySection),
14264
+ metadata: updatedMetadata,
14265
+ };
14266
+ }
14267
+ }
14268
+ /**
14269
+ * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
14270
+ */
14271
+
14136
14272
  /**
14137
14273
  * FORMAT commitment definition
14138
14274
  *
@@ -16953,6 +17089,7 @@
16953
17089
  new DeleteCommitmentDefinition('CANCEL'),
16954
17090
  new DeleteCommitmentDefinition('DISCARD'),
16955
17091
  new DeleteCommitmentDefinition('REMOVE'),
17092
+ new DictionaryCommitmentDefinition(),
16956
17093
  new OpenCommitmentDefinition(),
16957
17094
  new ClosedCommitmentDefinition(),
16958
17095
  new UseBrowserCommitmentDefinition(),
@@ -17037,17 +17174,64 @@
17037
17174
  };
17038
17175
  }
17039
17176
  const lines = agentSource.split('\n');
17040
- const agentName = (((_a = lines[0]) === null || _a === void 0 ? void 0 : _a.trim()) || null);
17177
+ let agentName = null;
17178
+ let agentNameLineIndex = -1;
17179
+ // Find the agent name: first non-empty line that is not a commitment and not a horizontal line
17180
+ for (let i = 0; i < lines.length; i++) {
17181
+ const line = lines[i];
17182
+ if (line === undefined) {
17183
+ continue;
17184
+ }
17185
+ const trimmed = line.trim();
17186
+ if (!trimmed) {
17187
+ continue;
17188
+ }
17189
+ const isHorizontal = HORIZONTAL_LINE_PATTERN.test(line);
17190
+ if (isHorizontal) {
17191
+ continue;
17192
+ }
17193
+ let isCommitment = false;
17194
+ for (const definition of COMMITMENT_REGISTRY) {
17195
+ const typeRegex = definition.createTypeRegex();
17196
+ const match = typeRegex.exec(trimmed);
17197
+ if (match && ((_a = match.groups) === null || _a === void 0 ? void 0 : _a.type)) {
17198
+ isCommitment = true;
17199
+ break;
17200
+ }
17201
+ }
17202
+ if (!isCommitment) {
17203
+ agentName = trimmed;
17204
+ agentNameLineIndex = i;
17205
+ break;
17206
+ }
17207
+ }
17041
17208
  const commitments = [];
17042
17209
  const nonCommitmentLines = [];
17043
- // Always add the first line (agent name) to non-commitment lines
17044
- if (lines[0] !== undefined) {
17045
- nonCommitmentLines.push(lines[0]);
17210
+ // Add lines before agentName that are horizontal lines (they are non-commitment)
17211
+ for (let i = 0; i < agentNameLineIndex; i++) {
17212
+ const line = lines[i];
17213
+ if (line === undefined) {
17214
+ continue;
17215
+ }
17216
+ const trimmed = line.trim();
17217
+ if (!trimmed) {
17218
+ continue;
17219
+ }
17220
+ const isHorizontal = HORIZONTAL_LINE_PATTERN.test(line);
17221
+ if (isHorizontal) {
17222
+ nonCommitmentLines.push(line);
17223
+ }
17224
+ // Note: Commitments before agentName are not added to nonCommitmentLines
17225
+ }
17226
+ // Add the agent name line to non-commitment lines
17227
+ if (agentNameLineIndex >= 0) {
17228
+ nonCommitmentLines.push(lines[agentNameLineIndex]);
17046
17229
  }
17047
17230
  // Parse commitments with multiline support
17048
17231
  let currentCommitment = null;
17049
- // Process lines starting from the second line (skip agent name)
17050
- for (let i = 1; i < lines.length; i++) {
17232
+ // Process lines starting from after the agent name line
17233
+ const startIndex = agentNameLineIndex >= 0 ? agentNameLineIndex + 1 : 0;
17234
+ for (let i = startIndex; i < lines.length; i++) {
17051
17235
  const line = lines[i];
17052
17236
  if (line === undefined) {
17053
17237
  continue;
@@ -17267,7 +17451,12 @@
17267
17451
  };
17268
17452
  }
17269
17453
  // Apply each commitment in order using reduce-like pattern
17270
- for (const commitment of filteredCommitments) {
17454
+ for (let i = 0; i < filteredCommitments.length; i++) {
17455
+ const commitment = filteredCommitments[i];
17456
+ // CLOSED commitment should work only if its the last commitment in the book
17457
+ if (commitment.type === 'CLOSED' && i !== filteredCommitments.length - 1) {
17458
+ continue;
17459
+ }
17271
17460
  const definition = getCommitmentDefinition(commitment.type);
17272
17461
  if (definition) {
17273
17462
  try {
@@ -17362,44 +17551,6 @@
17362
17551
  * TODO: [๐ŸŒบ] Use some intermediate util splitWords
17363
17552
  */
17364
17553
 
17365
- /**
17366
- * Generates a gravatar URL based on agent name for fallback avatar
17367
- *
17368
- * @param agentName The agent name to generate avatar for
17369
- * @returns Gravatar URL
17370
- *
17371
- * @private - [๐Ÿคน] The fact that profile image is Gravatar is just implementation detail which should be hidden for consumer
17372
- */
17373
- function generateGravatarUrl(agentName) {
17374
- // Use a default name if none provided
17375
- const safeName = agentName || 'Anonymous Agent';
17376
- // Create a simple hash from the name for consistent avatar
17377
- let hash = 0;
17378
- for (let i = 0; i < safeName.length; i++) {
17379
- const char = safeName.charCodeAt(i);
17380
- hash = (hash << 5) - hash + char;
17381
- hash = hash & hash; // Convert to 32bit integer
17382
- }
17383
- const avatarId = Math.abs(hash).toString();
17384
- return `https://www.gravatar.com/avatar/${avatarId}?default=robohash&size=200&rating=x`;
17385
- }
17386
-
17387
- /**
17388
- * Generates an image for the agent to use as profile image
17389
- *
17390
- * @param agentName The agent name to generate avatar for
17391
- * @returns The placeholder profile image URL for the agent
17392
- *
17393
- * @public exported from `@promptbook/core`
17394
- */
17395
- function generatePlaceholderAgentProfileImageUrl(agentName) {
17396
- // Note: [๐Ÿคน] The fact that profile image is Gravatar is just implementation detail which should be hidden for consumer
17397
- return generateGravatarUrl(agentName);
17398
- }
17399
- /**
17400
- * TODO: [๐Ÿคน] Figure out best placeholder image generator https://i.pravatar.cc/1000?u=568
17401
- */
17402
-
17403
17554
  /**
17404
17555
  * Computes SHA-256 hash of the given object
17405
17556
  *
@@ -17824,10 +17975,6 @@
17824
17975
  const metaType = normalizeTo_camelCase(metaTypeRaw);
17825
17976
  meta[metaType] = spaceTrim__default["default"](commitment.content.substring(metaTypeRaw.length));
17826
17977
  }
17827
- // Generate gravatar fallback if no meta image specified
17828
- if (!meta.image) {
17829
- meta.image = generatePlaceholderAgentProfileImageUrl(parseResult.agentName || '!!');
17830
- }
17831
17978
  // Generate fullname fallback if no meta fullname specified
17832
17979
  if (!meta.fullname) {
17833
17980
  meta.fullname = parseResult.agentName || createDefaultAgentName(agentSource);
@@ -17839,6 +17986,7 @@
17839
17986
  return {
17840
17987
  agentName: normalizeAgentName(parseResult.agentName || createDefaultAgentName(agentSource)),
17841
17988
  agentHash,
17989
+ permanentId: meta.id,
17842
17990
  personaDescription,
17843
17991
  initialMessage,
17844
17992
  meta,
@@ -18564,7 +18712,7 @@
18564
18712
  ${i + 1}) **${title}** \`${className}\` from \`${packageName}\`
18565
18713
  ${morePieces.join('; ')}
18566
18714
  `);
18567
- if ($isRunningInNode) {
18715
+ if ($isRunningInNode()) {
18568
18716
  if (isInstalled && isFullyConfigured) {
18569
18717
  providerMessage = colors__default["default"].green(providerMessage);
18570
18718
  }
@@ -18961,6 +19109,9 @@
18961
19109
  case 'EMBEDDING':
18962
19110
  promptResult = await llmTools.callEmbeddingModel(prompt);
18963
19111
  break variant;
19112
+ case 'IMAGE_GENERATION':
19113
+ promptResult = await llmTools.callImageGenerationModel(prompt);
19114
+ break variant;
18964
19115
  // <- case [๐Ÿค–]:
18965
19116
  default:
18966
19117
  throw new PipelineExecutionError(`Unknown model variant "${prompt.modelRequirements.modelVariant}"`);
@@ -18997,12 +19148,13 @@
18997
19148
  }
18998
19149
  }
18999
19150
  catch (error) {
19151
+ assertsError(error);
19000
19152
  // If validation throws an unexpected error, don't cache
19001
19153
  shouldCache = false;
19002
19154
  if (isVerbose) {
19003
19155
  console.info('Not caching result due to validation error for key:', key, {
19004
19156
  content: promptResult.content,
19005
- validationError: error instanceof Error ? error.message : String(error),
19157
+ validationError: serializeError(error),
19006
19158
  });
19007
19159
  }
19008
19160
  }
@@ -19048,6 +19200,11 @@
19048
19200
  return /* not await */ callCommonModel(prompt);
19049
19201
  };
19050
19202
  }
19203
+ if (llmTools.callImageGenerationModel !== undefined) {
19204
+ proxyTools.callImageGenerationModel = async (prompt) => {
19205
+ return /* not await */ callCommonModel(prompt);
19206
+ };
19207
+ }
19051
19208
  // <- Note: [๐Ÿค–]
19052
19209
  return proxyTools;
19053
19210
  }
@@ -21177,11 +21334,7 @@
21177
21334
  // TODO: [๐Ÿšœ] DRY
21178
21335
  if ($taskJson.modelRequirements[command.key] !== undefined) {
21179
21336
  if ($taskJson.modelRequirements[command.key] === command.value) {
21180
- console.warn(`Multiple commands \`MODEL ${{
21181
- modelName: 'NAME',
21182
- modelVariant: 'VARIANT',
21183
- maxTokens: '???',
21184
- }[command.key]} ${command.value}\` in the task "${$taskJson.title || $taskJson.name}"`);
21337
+ console.warn(`Multiple commands \`MODEL ${command.key} ${command.value}\` in the task "${$taskJson.title || $taskJson.name}"`);
21185
21338
  // <- TODO: [๐Ÿฎ] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
21186
21339
  }
21187
21340
  else {