@promptbook/browser 0.112.0-43 → 0.112.0-45

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 (35) hide show
  1. package/esm/index.es.js +144 -57
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/src/avatars/Avatar.d.ts +7 -0
  4. package/esm/src/avatars/avatarRenderingUtils.d.ts +117 -0
  5. package/esm/src/avatars/index.d.ts +6 -0
  6. package/esm/src/avatars/renderAvatarVisual.d.ts +9 -0
  7. package/esm/src/avatars/types/AvatarDefinition.d.ts +20 -0
  8. package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +96 -0
  9. package/esm/src/avatars/visuals/avatarVisualRegistry.d.ts +16 -0
  10. package/esm/src/avatars/visuals/minecraftAvatarVisual.d.ts +7 -0
  11. package/esm/src/avatars/visuals/octopusAvatarVisual.d.ts +7 -0
  12. package/esm/src/avatars/visuals/pixelArtAvatarVisual.d.ts +7 -0
  13. package/esm/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -1
  14. package/esm/src/book-2.0/agent-source/TeammateProfileResolver.d.ts +2 -1
  15. package/esm/src/commitments/PERSONA/PERSONA.d.ts +7 -0
  16. package/esm/src/commitments/STYLE/STYLE.d.ts +9 -2
  17. package/esm/src/version.d.ts +1 -1
  18. package/package.json +2 -2
  19. package/umd/index.umd.js +144 -57
  20. package/umd/index.umd.js.map +1 -1
  21. package/umd/src/avatars/Avatar.d.ts +7 -0
  22. package/umd/src/avatars/avatarRenderingUtils.d.ts +117 -0
  23. package/umd/src/avatars/index.d.ts +6 -0
  24. package/umd/src/avatars/renderAvatarVisual.d.ts +9 -0
  25. package/umd/src/avatars/types/AvatarDefinition.d.ts +20 -0
  26. package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +96 -0
  27. package/umd/src/avatars/visuals/avatarVisualRegistry.d.ts +16 -0
  28. package/umd/src/avatars/visuals/minecraftAvatarVisual.d.ts +7 -0
  29. package/umd/src/avatars/visuals/octopusAvatarVisual.d.ts +7 -0
  30. package/umd/src/avatars/visuals/pixelArtAvatarVisual.d.ts +7 -0
  31. package/umd/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -1
  32. package/umd/src/book-2.0/agent-source/TeammateProfileResolver.d.ts +2 -1
  33. package/umd/src/commitments/PERSONA/PERSONA.d.ts +7 -0
  34. package/umd/src/commitments/STYLE/STYLE.d.ts +9 -2
  35. package/umd/src/version.d.ts +1 -1
package/esm/index.es.js CHANGED
@@ -29,7 +29,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
29
29
  * @generated
30
30
  * @see https://github.com/webgptorg/promptbook
31
31
  */
32
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-43';
32
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-45';
33
33
  /**
34
34
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
35
35
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1744,7 +1744,7 @@ class DeleteCommitmentDefinition extends BaseCommitmentDefinition {
1744
1744
  DELETE Casual conversational style
1745
1745
  REMOVE All emoji usage
1746
1746
  GOAL Provide professional business communications
1747
- STYLE Use formal language and proper business etiquette
1747
+ WRITING RULES Use formal language and proper business etiquette
1748
1748
  \`\`\`
1749
1749
 
1750
1750
  \`\`\`book
@@ -1755,7 +1755,7 @@ class DeleteCommitmentDefinition extends BaseCommitmentDefinition {
1755
1755
  DISCARD Technical jargon explanations
1756
1756
  CANCEL Advanced troubleshooting procedures
1757
1757
  GOAL Help users with simple, easy-to-follow solutions
1758
- STYLE Use plain language that anyone can understand
1758
+ WRITING RULES Use plain language that anyone can understand
1759
1759
  \`\`\`
1760
1760
 
1761
1761
  \`\`\`book
@@ -1772,11 +1772,11 @@ class DeleteCommitmentDefinition extends BaseCommitmentDefinition {
1772
1772
  Concise Information Provider
1773
1773
 
1774
1774
  PERSONA You are a helpful assistant who provides detailed explanations
1775
- STYLE Include examples, analogies, and comprehensive context
1775
+ WRITING RULES Include examples, analogies, and comprehensive context
1776
1776
  CANCEL Detailed explanation style
1777
1777
  DISCARD Examples and analogies
1778
1778
  GOAL Provide brief, direct answers without unnecessary elaboration
1779
- STYLE Be concise and to the point
1779
+ WRITING RULES Be concise and to the point
1780
1780
  \`\`\`
1781
1781
  `);
1782
1782
  }
@@ -1960,7 +1960,7 @@ class FormatCommitmentDefinition extends BaseCommitmentDefinition {
1960
1960
  PERSONA You are a data analysis expert
1961
1961
  FORMAT Present results in structured tables
1962
1962
  FORMAT Include confidence scores for all predictions
1963
- STYLE Be concise and precise in explanations
1963
+ WRITING RULES Be concise and precise in explanations
1964
1964
  \`\`\`
1965
1965
  `);
1966
1966
  }
@@ -6481,7 +6481,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
6481
6481
  * Short one-line description of GOAL.
6482
6482
  */
6483
6483
  get description() {
6484
- return 'Define main **goals** the AI assistant should achieve, with later goals having higher priority.';
6484
+ return 'Define the effective agent **goal**; when multiple goals exist, only the last one stays effective.';
6485
6485
  }
6486
6486
  /**
6487
6487
  * Icon for this commitment.
@@ -6496,12 +6496,14 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
6496
6496
  return spaceTrim$1(`
6497
6497
  # ${this.type}
6498
6498
 
6499
- Defines the main goal which should be achieved by the AI assistant. There can be multiple goals, and later goals are more important than earlier goals.
6499
+ Defines the main goal which should be achieved by the AI assistant.
6500
+ There can be multiple goals in source, but after inheritance/source rewriting only the last \`GOAL\` /\`GOALS\` remains effective.
6500
6501
 
6501
6502
  ## Key aspects
6502
6503
 
6503
6504
  - Both terms work identically and can be used interchangeably.
6504
- - Later goals have higher priority and can override earlier goals.
6505
+ - Later goals overwrite earlier goals.
6506
+ - The public agent profile text is derived from the last goal.
6505
6507
  - Goals provide clear direction and purpose for the agent's responses.
6506
6508
  - Goals influence decision-making and response prioritization.
6507
6509
 
@@ -6514,9 +6516,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
6514
6516
  \`\`\`book
6515
6517
  Customer Support Agent
6516
6518
 
6517
- PERSONA You are a helpful customer support representative
6518
6519
  GOAL Resolve customer issues quickly and efficiently
6519
- GOAL Maintain high customer satisfaction scores
6520
6520
  GOAL Always follow company policies and procedures
6521
6521
  RULE Be polite and professional at all times
6522
6522
  \`\`\`
@@ -6524,19 +6524,15 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
6524
6524
  \`\`\`book
6525
6525
  Educational Assistant
6526
6526
 
6527
- PERSONA You are an educational assistant specializing in mathematics
6528
6527
  GOAL Help students understand mathematical concepts clearly
6529
- GOAL Encourage critical thinking and problem-solving skills
6530
6528
  GOAL Ensure all explanations are age-appropriate and accessible
6531
- STYLE Use simple language and provide step-by-step explanations
6529
+ WRITING RULES Use simple language and provide step-by-step explanations
6532
6530
  \`\`\`
6533
6531
 
6534
6532
  \`\`\`book
6535
6533
  Safety-First Assistant
6536
6534
 
6537
- PERSONA You are a general-purpose AI assistant
6538
6535
  GOAL Be helpful and informative in all interactions
6539
- GOAL Provide accurate and reliable information
6540
6536
  GOAL Always prioritize user safety and ethical guidelines
6541
6537
  RULE Never provide harmful or dangerous advice
6542
6538
  \`\`\`
@@ -6944,7 +6940,7 @@ class KnowledgeCommitmentDefinition extends BaseCommitmentDefinition {
6944
6940
  KNOWLEDGE Academic research requires careful citation and verification
6945
6941
  KNOWLEDGE https://example.com/research-guidelines.pdf
6946
6942
  ACTION Can help with literature reviews and data analysis
6947
- STYLE Present information in clear, academic format
6943
+ WRITING RULES Present information in clear, academic format
6948
6944
  \`\`\`
6949
6945
  `);
6950
6946
  }
@@ -8695,7 +8691,7 @@ class MetaImageCommitmentDefinition extends BaseCommitmentDefinition {
8695
8691
 
8696
8692
  META IMAGE https://example.com/professional-avatar.jpg
8697
8693
  PERSONA You are a professional business assistant
8698
- STYLE Maintain a formal and courteous tone
8694
+ WRITING RULES Maintain a formal and courteous tone
8699
8695
  \`\`\`
8700
8696
 
8701
8697
  \`\`\`book
@@ -8703,7 +8699,7 @@ class MetaImageCommitmentDefinition extends BaseCommitmentDefinition {
8703
8699
 
8704
8700
  META IMAGE /assets/creative-bot-avatar.png
8705
8701
  PERSONA You are a creative and inspiring assistant
8706
- STYLE Be enthusiastic and encouraging
8702
+ WRITING RULES Be enthusiastic and encouraging
8707
8703
  ACTION Can help with brainstorming and ideation
8708
8704
  \`\`\`
8709
8705
  `);
@@ -8862,7 +8858,7 @@ class MetaLinkCommitmentDefinition extends BaseCommitmentDefinition {
8862
8858
  META LINK https://twitter.com/devhandle
8863
8859
  PERSONA You are an experienced open source developer
8864
8860
  ACTION Can help with code reviews and architecture decisions
8865
- STYLE Be direct and technical in explanations
8861
+ WRITING RULES Be direct and technical in explanations
8866
8862
  \`\`\`
8867
8863
  `);
8868
8864
  }
@@ -9068,7 +9064,7 @@ class ModelCommitmentDefinition extends BaseCommitmentDefinition {
9068
9064
  MODEL TEMPERATURE 0.8
9069
9065
  MODEL TOP_P 0.9
9070
9066
  MODEL MAX_TOKENS 2048
9071
- STYLE Be imaginative and expressive
9067
+ WRITING RULES Be imaginative and expressive
9072
9068
  ACTION Can help with storytelling and character development
9073
9069
  \`\`\`
9074
9070
 
@@ -9280,7 +9276,7 @@ class NoteCommitmentDefinition extends BaseCommitmentDefinition {
9280
9276
  NOTE Uses RAG for accessing latest research papers
9281
9277
  PERSONA You are a knowledgeable research assistant
9282
9278
  ACTION Can help with literature reviews and citations
9283
- STYLE Present information in academic format
9279
+ WRITING RULES Present information in academic format
9284
9280
  \`\`\`
9285
9281
  `);
9286
9282
  }
@@ -9395,7 +9391,16 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
9395
9391
  * Short one-line description of PERSONA.
9396
9392
  */
9397
9393
  get description() {
9398
- return 'Define who the agent is: background, expertise, and personality.';
9394
+ return 'Deprecated legacy profile commitment. Prefer `GOAL` for agent profile text and inheritance-safe rewrites.';
9395
+ }
9396
+ /**
9397
+ * Optional UI/docs-only deprecation metadata.
9398
+ */
9399
+ get deprecation() {
9400
+ return {
9401
+ message: 'Use `GOAL` for agent profile text and inheritance-safe rewrites.',
9402
+ replacedBy: ['GOAL'],
9403
+ };
9399
9404
  }
9400
9405
  /**
9401
9406
  * Icon for this commitment.
@@ -9410,16 +9415,24 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
9410
9415
  return spaceTrim$1(`
9411
9416
  # ${this.type}
9412
9417
 
9413
- Defines who the agent is, their background, expertise, and personality traits.
9418
+ Deprecated legacy commitment that defines who the agent is, their background, expertise, and personality traits.
9414
9419
 
9415
- ## Key aspects
9420
+ ## Migration
9416
9421
 
9417
- - Multiple \`PERSONA\` and \`PERSONAE\` commitments are merged together.
9418
- - Both terms work identically and can be used interchangeably.
9419
- - If they are in conflict, the last one takes precedence.
9420
- - You can write persona content in multiple lines.
9422
+ - Existing \`${this.type}\` books still parse and compile.
9423
+ - New books should prefer \`GOAL\`.
9424
+ - Agent profile rendering now prefers the last \`GOAL\` and only falls back to \`${this.type}\` when no goal exists.
9425
+ - Runtime compilation keeps the legacy multi-\`PERSONA\` merge behavior for backward compatibility.
9421
9426
 
9422
- ## Examples
9427
+ ## Preferred replacement
9428
+
9429
+ \`\`\`book
9430
+ Programming Assistant
9431
+
9432
+ GOAL Help the user solve programming problems with practical TypeScript and React guidance.
9433
+ \`\`\`
9434
+
9435
+ ## Legacy compatibility example
9423
9436
 
9424
9437
  \`\`\`book
9425
9438
  Programming Assistant
@@ -9557,7 +9570,7 @@ class RuleCommitmentDefinition extends BaseCommitmentDefinition {
9557
9570
  RULE Always ask for clarification if the user's request is ambiguous
9558
9571
  RULE Be polite and professional in all interactions
9559
9572
  RULES Never provide medical or legal advice
9560
- STYLE Maintain a friendly and helpful tone
9573
+ WRITING RULES Maintain a friendly and helpful tone
9561
9574
  \`\`\`
9562
9575
 
9563
9576
  \`\`\`book
@@ -9826,8 +9839,8 @@ class ScenarioCommitmentDefinition extends BaseCommitmentDefinition {
9826
9839
  /**
9827
9840
  * STYLE commitment definition
9828
9841
  *
9829
- * The STYLE commitment defines how the agent should format and present its responses.
9830
- * This includes tone, writing style, formatting preferences, and communication patterns.
9842
+ * Deprecated legacy writing-style commitment kept for backward compatibility.
9843
+ * New books should prefer `WRITING RULES` for writing-only constraints.
9831
9844
  *
9832
9845
  * Example usage in agent source:
9833
9846
  *
@@ -9846,7 +9859,16 @@ class StyleCommitmentDefinition extends BaseCommitmentDefinition {
9846
9859
  * Short one-line description of STYLE.
9847
9860
  */
9848
9861
  get description() {
9849
- return 'Control the tone and writing style of responses.';
9862
+ return 'Deprecated legacy writing-style commitment. Prefer `WRITING RULES` for new books.';
9863
+ }
9864
+ /**
9865
+ * Optional UI/docs-only deprecation metadata.
9866
+ */
9867
+ get deprecation() {
9868
+ return {
9869
+ message: 'Use `WRITING RULES` for writing-only constraints such as tone, length, formatting, or emoji usage.',
9870
+ replacedBy: ['WRITING RULES'],
9871
+ };
9850
9872
  }
9851
9873
  /**
9852
9874
  * Icon for this commitment.
@@ -9861,15 +9883,34 @@ class StyleCommitmentDefinition extends BaseCommitmentDefinition {
9861
9883
  return spaceTrim$1(`
9862
9884
  # ${this.type}
9863
9885
 
9864
- Defines how the agent should format and present its responses (tone, writing style, formatting).
9886
+ Deprecated legacy commitment for writing and presentation instructions.
9887
+
9888
+ ## Migration
9889
+
9890
+ - Existing \`${this.type}\` books still parse and compile.
9891
+ - New books should prefer \`WRITING RULES\`.
9892
+ - Use \`WRITING SAMPLE\` when you want to anchor voice by example instead of stating constraints directly.
9893
+ - The plural alias \`STYLES\` is the same legacy commitment family.
9865
9894
 
9866
9895
  ## Key aspects
9867
9896
 
9868
- - Both terms work identically and can be used interchangeably.
9897
+ - \`${this.type}\` remains functional for backward compatibility only.
9869
9898
  - Later style instructions can override earlier ones.
9870
9899
  - Style affects both tone and presentation format.
9871
9900
 
9872
- ## Examples
9901
+ ## Preferred replacement
9902
+
9903
+ \`\`\`book
9904
+ Technical Writer
9905
+
9906
+ GOAL Help the user understand technical topics with practical, accurate guidance.
9907
+ WRITING RULES Write in a professional but friendly tone.
9908
+ WRITING RULES Use bullet points for lists.
9909
+ WRITING RULES Always provide code examples when explaining programming concepts.
9910
+ FORMAT Use markdown formatting with clear headings
9911
+ \`\`\`
9912
+
9913
+ ## Legacy compatibility examples
9873
9914
 
9874
9915
  \`\`\`book
9875
9916
  Technical Writer
@@ -10184,7 +10225,7 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
10184
10225
  \`\`\`book
10185
10226
  Legal Assistant
10186
10227
 
10187
- PERSONA An expert software developer
10228
+ GOAL Get expert software-development advice from the teammate when legal discussion needs technical context.
10188
10229
  TEAM You can talk with http://localhost:4440/agents/GMw67JN8TXxN7y to discuss the legal aspects.
10189
10230
  \`\`\`
10190
10231
  `);
@@ -10610,7 +10651,7 @@ class TemplateCommitmentDefinition extends BaseCommitmentDefinition {
10610
10651
 
10611
10652
  PERSONA You are a helpful customer support representative
10612
10653
  TEMPLATE Always structure your response with: 1) Acknowledgment, 2) Solution, 3) Follow-up question
10613
- STYLE Be professional and empathetic
10654
+ WRITING RULES Be professional and empathetic
10614
10655
  \`\`\`
10615
10656
 
10616
10657
  \`\`\`book
@@ -11054,7 +11095,7 @@ class UseBrowserCommitmentDefinition extends BaseCommitmentDefinition {
11054
11095
 
11055
11096
  PERSONA You are a news analyst who stays up-to-date with current events
11056
11097
  USE BROWSER
11057
- STYLE Present news in a balanced and objective manner
11098
+ WRITING RULES Present news in a balanced and objective manner
11058
11099
  ACTION Can search for and summarize news articles
11059
11100
  \`\`\`
11060
11101
 
@@ -17530,7 +17571,7 @@ function parseParameters(text) {
17530
17571
  function parseAgentSource(agentSource) {
17531
17572
  const parseResult = parseAgentSourceWithCommitments(agentSource);
17532
17573
  const resolvedAgentName = parseResult.agentName || createDefaultAgentName(agentSource);
17533
- const personaDescription = extractPersonaDescription(parseResult.commitments);
17574
+ const personaDescription = extractAgentProfileText(parseResult.commitments);
17534
17575
  const initialMessage = extractInitialMessage(parseResult.commitments);
17535
17576
  const parsedProfile = extractParsedAgentProfile(parseResult.commitments);
17536
17577
  ensureMetaFullname(parsedProfile.meta, resolvedAgentName);
@@ -17634,25 +17675,33 @@ const META_COMMITMENT_APPLIERS = {
17634
17675
  */
17635
17676
  const LOCAL_AGENT_REFERENCE_PREFIXES = ['./', '../', '/'];
17636
17677
  /**
17637
- * Builds the combined persona description from PERSONA commitments.
17678
+ * Resolves the public agent profile text from the last GOAL/GOALS commitment,
17679
+ * falling back to the deprecated PERSONA/PERSONAE commitments when no goal exists.
17638
17680
  *
17639
17681
  * @private internal utility of `parseAgentSource`
17640
17682
  */
17641
- function extractPersonaDescription(commitments) {
17642
- let personaDescription = null;
17683
+ function extractAgentProfileText(commitments) {
17684
+ let goalDescription = '';
17685
+ let hasGoalDescription = false;
17686
+ let personaDescription = '';
17687
+ let hasPersonaDescription = false;
17643
17688
  for (const commitment of commitments) {
17644
- if (commitment.type !== 'PERSONA') {
17645
- continue;
17689
+ if (commitment.type === 'GOAL' || commitment.type === 'GOALS') {
17690
+ goalDescription = commitment.content;
17691
+ hasGoalDescription = true;
17646
17692
  }
17647
- if (personaDescription === null) {
17648
- personaDescription = '';
17649
- }
17650
- else {
17651
- personaDescription += `\n\n${personaDescription}`;
17693
+ if (commitment.type === 'PERSONA' || commitment.type === 'PERSONAE') {
17694
+ personaDescription = commitment.content;
17695
+ hasPersonaDescription = true;
17652
17696
  }
17653
- personaDescription += commitment.content;
17654
17697
  }
17655
- return personaDescription;
17698
+ if (hasGoalDescription) {
17699
+ return goalDescription;
17700
+ }
17701
+ if (hasPersonaDescription) {
17702
+ return personaDescription;
17703
+ }
17704
+ return null;
17656
17705
  }
17657
17706
  /**
17658
17707
  * Resolves the last INITIAL MESSAGE commitment, which is the public initial-message value.
@@ -23097,6 +23146,15 @@ const COMMITMENTS_WITH_AGENT_REFERENCES = new Set(['FROM', 'IMPORT', 'IMPORTS',
23097
23146
  * @private internal constant of `createAgentModelRequirementsWithCommitments`
23098
23147
  */
23099
23148
  const DELETE_COMMITMENT_TYPES = new Set(['DELETE', 'CANCEL', 'DISCARD', 'REMOVE']);
23149
+ /**
23150
+ * Commitments whose earlier occurrences are overwritten by the last occurrence in source order.
23151
+ *
23152
+ * @private internal constant of `createAgentModelRequirementsWithCommitments`
23153
+ */
23154
+ const OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE = new Map([
23155
+ ['GOAL', 'GOAL'],
23156
+ ['GOALS', 'GOAL'],
23157
+ ]);
23100
23158
  /**
23101
23159
  * Regex pattern matching markdown horizontal lines that should not be copied into the final system message.
23102
23160
  *
@@ -23147,7 +23205,7 @@ function getSafeReferenceCommitmentFallback(commitmentType, originalContent) {
23147
23205
  */
23148
23206
  async function createAgentModelRequirementsWithCommitments(agentSource, modelName, options) {
23149
23207
  const parseResult = parseAgentSourceWithCommitments(agentSource);
23150
- const filteredCommitments = filterDeletedCommitments(parseResult.commitments);
23208
+ const filteredCommitments = filterOverwrittenCommitments(filterDeletedCommitments(parseResult.commitments));
23151
23209
  let requirements = createInitialAgentModelRequirements(parseResult.agentName, modelName);
23152
23210
  requirements = await applyCommitmentsToRequirements(requirements, filteredCommitments, options);
23153
23211
  requirements = aggregateUseCommitmentSystemMessages(requirements, filteredCommitments);
@@ -23158,6 +23216,35 @@ async function createAgentModelRequirementsWithCommitments(agentSource, modelNam
23158
23216
  requirements = await applyPendingInlineKnowledgeSources(requirements, options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader);
23159
23217
  return finalizeRequirements(requirements);
23160
23218
  }
23219
+ /**
23220
+ * Removes earlier commitments that are overwritten by later commitments of the same semantic group.
23221
+ *
23222
+ * This currently keeps only the last `GOAL` / `GOALS` commitment so inheritance rewrites
23223
+ * and multi-goal sources expose one effective goal to the runtime.
23224
+ *
23225
+ * @param commitments - Parsed commitments after DELETE-like filtering.
23226
+ * @returns Commitments with overwritten entries removed while preserving source order.
23227
+ *
23228
+ * @private internal utility of `createAgentModelRequirementsWithCommitments`
23229
+ */
23230
+ function filterOverwrittenCommitments(commitments) {
23231
+ const seenOverwriteGroups = new Set();
23232
+ const keptCommitments = [];
23233
+ for (let index = commitments.length - 1; index >= 0; index--) {
23234
+ const commitment = commitments[index];
23235
+ const overwriteGroup = OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE.get(commitment.type);
23236
+ if (!overwriteGroup) {
23237
+ keptCommitments.push(commitment);
23238
+ continue;
23239
+ }
23240
+ if (seenOverwriteGroups.has(overwriteGroup)) {
23241
+ continue;
23242
+ }
23243
+ seenOverwriteGroups.add(overwriteGroup);
23244
+ keptCommitments.push(commitment);
23245
+ }
23246
+ return keptCommitments.reverse();
23247
+ }
23161
23248
  /**
23162
23249
  * Creates the initial requirements object with the parsed agent name stored in metadata and an optional model override.
23163
23250
  *
@@ -23749,7 +23836,7 @@ async function createAgentModelRequirements(agentSource, modelName, availableMod
23749
23836
  * Selects the best model using the preparePersona function
23750
23837
  * This directly uses preparePersona to ensure DRY principle
23751
23838
  *
23752
- * @param agentSource The agent source to derive persona description from
23839
+ * @param agentSource The agent source to derive effective profile text from
23753
23840
  * @param llmTools LLM tools for preparing persona
23754
23841
  * @returns The name of the best selected model
23755
23842
  *
@@ -23757,9 +23844,9 @@ async function createAgentModelRequirements(agentSource, modelName, availableMod
23757
23844
  */
23758
23845
  async function selectBestModelUsingPersona(agentSource, llmTools) {
23759
23846
  var _a;
23760
- // Parse agent source to get persona description
23847
+ // Parse agent source to get the effective profile description
23761
23848
  const { agentName, personaDescription } = parseAgentSource(agentSource);
23762
- // Use agent name as fallback if no persona description is available
23849
+ // Use agent name as fallback if no profile description is available
23763
23850
  const description = personaDescription || agentName || 'AI Agent';
23764
23851
  try {
23765
23852
  // Use preparePersona directly