@promptbook/components 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 (36) hide show
  1. package/README.md +1 -1
  2. package/esm/index.es.js +144 -57
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/src/avatars/Avatar.d.ts +7 -0
  5. package/esm/src/avatars/avatarRenderingUtils.d.ts +117 -0
  6. package/esm/src/avatars/index.d.ts +6 -0
  7. package/esm/src/avatars/renderAvatarVisual.d.ts +9 -0
  8. package/esm/src/avatars/types/AvatarDefinition.d.ts +20 -0
  9. package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +96 -0
  10. package/esm/src/avatars/visuals/avatarVisualRegistry.d.ts +16 -0
  11. package/esm/src/avatars/visuals/minecraftAvatarVisual.d.ts +7 -0
  12. package/esm/src/avatars/visuals/octopusAvatarVisual.d.ts +7 -0
  13. package/esm/src/avatars/visuals/pixelArtAvatarVisual.d.ts +7 -0
  14. package/esm/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -1
  15. package/esm/src/book-2.0/agent-source/TeammateProfileResolver.d.ts +2 -1
  16. package/esm/src/commitments/PERSONA/PERSONA.d.ts +7 -0
  17. package/esm/src/commitments/STYLE/STYLE.d.ts +9 -2
  18. package/esm/src/version.d.ts +1 -1
  19. package/package.json +1 -1
  20. package/umd/index.umd.js +144 -57
  21. package/umd/index.umd.js.map +1 -1
  22. package/umd/src/avatars/Avatar.d.ts +7 -0
  23. package/umd/src/avatars/avatarRenderingUtils.d.ts +117 -0
  24. package/umd/src/avatars/index.d.ts +6 -0
  25. package/umd/src/avatars/renderAvatarVisual.d.ts +9 -0
  26. package/umd/src/avatars/types/AvatarDefinition.d.ts +20 -0
  27. package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +96 -0
  28. package/umd/src/avatars/visuals/avatarVisualRegistry.d.ts +16 -0
  29. package/umd/src/avatars/visuals/minecraftAvatarVisual.d.ts +7 -0
  30. package/umd/src/avatars/visuals/octopusAvatarVisual.d.ts +7 -0
  31. package/umd/src/avatars/visuals/pixelArtAvatarVisual.d.ts +7 -0
  32. package/umd/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -1
  33. package/umd/src/book-2.0/agent-source/TeammateProfileResolver.d.ts +2 -1
  34. package/umd/src/commitments/PERSONA/PERSONA.d.ts +7 -0
  35. package/umd/src/commitments/STYLE/STYLE.d.ts +9 -2
  36. package/umd/src/version.d.ts +1 -1
package/README.md CHANGED
@@ -130,7 +130,7 @@ interface BookEditorProps {
130
130
  onChange?: (value: string) => void;
131
131
 
132
132
  // Explicit list of commitment keywords to highlight (case-insensitive).
133
- // If omitted, a default set (PERSONA, KNOWLEDGE, MEMORY, STYLE, RULE, RULES, SAMPLE, EXAMPLE, FORMAT, MODEL, ACTION, META IMAGE, META LINK, NOTE, GOAL, MESSAGE, SCENARIO, DELETE, CANCEL, DISCARD, REMOVE, EXPECT, SCENARIOS, BEHAVIOUR, BEHAVIOURS, AVOID, AVOIDANCE, GOALS, CONTEXT) is used.
133
+ // If omitted, a default set (PERSONA, KNOWLEDGE, MEMORY, STYLE, RULE, RULES, WRITING SAMPLE, WRITING RULES, SAMPLE, EXAMPLE, FORMAT, MODEL, ACTION, META IMAGE, META LINK, NOTE, GOAL, MESSAGE, SCENARIO, DELETE, CANCEL, DISCARD, REMOVE, EXPECT, SCENARIOS, BEHAVIOUR, BEHAVIOURS, AVOID, AVOIDANCE, GOALS, CONTEXT) is used.
134
134
  commitmentTypes?: string[];
135
135
  }
136
136
  ```
package/esm/index.es.js CHANGED
@@ -40,7 +40,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
40
40
  * @generated
41
41
  * @see https://github.com/webgptorg/promptbook
42
42
  */
43
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-43';
43
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-45';
44
44
  /**
45
45
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
46
46
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -6678,7 +6678,7 @@ class DeleteCommitmentDefinition extends BaseCommitmentDefinition {
6678
6678
  DELETE Casual conversational style
6679
6679
  REMOVE All emoji usage
6680
6680
  GOAL Provide professional business communications
6681
- STYLE Use formal language and proper business etiquette
6681
+ WRITING RULES Use formal language and proper business etiquette
6682
6682
  \`\`\`
6683
6683
 
6684
6684
  \`\`\`book
@@ -6689,7 +6689,7 @@ class DeleteCommitmentDefinition extends BaseCommitmentDefinition {
6689
6689
  DISCARD Technical jargon explanations
6690
6690
  CANCEL Advanced troubleshooting procedures
6691
6691
  GOAL Help users with simple, easy-to-follow solutions
6692
- STYLE Use plain language that anyone can understand
6692
+ WRITING RULES Use plain language that anyone can understand
6693
6693
  \`\`\`
6694
6694
 
6695
6695
  \`\`\`book
@@ -6706,11 +6706,11 @@ class DeleteCommitmentDefinition extends BaseCommitmentDefinition {
6706
6706
  Concise Information Provider
6707
6707
 
6708
6708
  PERSONA You are a helpful assistant who provides detailed explanations
6709
- STYLE Include examples, analogies, and comprehensive context
6709
+ WRITING RULES Include examples, analogies, and comprehensive context
6710
6710
  CANCEL Detailed explanation style
6711
6711
  DISCARD Examples and analogies
6712
6712
  GOAL Provide brief, direct answers without unnecessary elaboration
6713
- STYLE Be concise and to the point
6713
+ WRITING RULES Be concise and to the point
6714
6714
  \`\`\`
6715
6715
  `);
6716
6716
  }
@@ -6894,7 +6894,7 @@ class FormatCommitmentDefinition extends BaseCommitmentDefinition {
6894
6894
  PERSONA You are a data analysis expert
6895
6895
  FORMAT Present results in structured tables
6896
6896
  FORMAT Include confidence scores for all predictions
6897
- STYLE Be concise and precise in explanations
6897
+ WRITING RULES Be concise and precise in explanations
6898
6898
  \`\`\`
6899
6899
  `);
6900
6900
  }
@@ -7254,7 +7254,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
7254
7254
  * Short one-line description of GOAL.
7255
7255
  */
7256
7256
  get description() {
7257
- return 'Define main **goals** the AI assistant should achieve, with later goals having higher priority.';
7257
+ return 'Define the effective agent **goal**; when multiple goals exist, only the last one stays effective.';
7258
7258
  }
7259
7259
  /**
7260
7260
  * Icon for this commitment.
@@ -7269,12 +7269,14 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
7269
7269
  return spaceTrim$1(`
7270
7270
  # ${this.type}
7271
7271
 
7272
- 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.
7272
+ Defines the main goal which should be achieved by the AI assistant.
7273
+ There can be multiple goals in source, but after inheritance/source rewriting only the last \`GOAL\` /\`GOALS\` remains effective.
7273
7274
 
7274
7275
  ## Key aspects
7275
7276
 
7276
7277
  - Both terms work identically and can be used interchangeably.
7277
- - Later goals have higher priority and can override earlier goals.
7278
+ - Later goals overwrite earlier goals.
7279
+ - The public agent profile text is derived from the last goal.
7278
7280
  - Goals provide clear direction and purpose for the agent's responses.
7279
7281
  - Goals influence decision-making and response prioritization.
7280
7282
 
@@ -7287,9 +7289,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
7287
7289
  \`\`\`book
7288
7290
  Customer Support Agent
7289
7291
 
7290
- PERSONA You are a helpful customer support representative
7291
7292
  GOAL Resolve customer issues quickly and efficiently
7292
- GOAL Maintain high customer satisfaction scores
7293
7293
  GOAL Always follow company policies and procedures
7294
7294
  RULE Be polite and professional at all times
7295
7295
  \`\`\`
@@ -7297,19 +7297,15 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
7297
7297
  \`\`\`book
7298
7298
  Educational Assistant
7299
7299
 
7300
- PERSONA You are an educational assistant specializing in mathematics
7301
7300
  GOAL Help students understand mathematical concepts clearly
7302
- GOAL Encourage critical thinking and problem-solving skills
7303
7301
  GOAL Ensure all explanations are age-appropriate and accessible
7304
- STYLE Use simple language and provide step-by-step explanations
7302
+ WRITING RULES Use simple language and provide step-by-step explanations
7305
7303
  \`\`\`
7306
7304
 
7307
7305
  \`\`\`book
7308
7306
  Safety-First Assistant
7309
7307
 
7310
- PERSONA You are a general-purpose AI assistant
7311
7308
  GOAL Be helpful and informative in all interactions
7312
- GOAL Provide accurate and reliable information
7313
7309
  GOAL Always prioritize user safety and ethical guidelines
7314
7310
  RULE Never provide harmful or dangerous advice
7315
7311
  \`\`\`
@@ -7617,7 +7613,7 @@ class KnowledgeCommitmentDefinition extends BaseCommitmentDefinition {
7617
7613
  KNOWLEDGE Academic research requires careful citation and verification
7618
7614
  KNOWLEDGE https://example.com/research-guidelines.pdf
7619
7615
  ACTION Can help with literature reviews and data analysis
7620
- STYLE Present information in clear, academic format
7616
+ WRITING RULES Present information in clear, academic format
7621
7617
  \`\`\`
7622
7618
  `);
7623
7619
  }
@@ -9368,7 +9364,7 @@ class MetaImageCommitmentDefinition extends BaseCommitmentDefinition {
9368
9364
 
9369
9365
  META IMAGE https://example.com/professional-avatar.jpg
9370
9366
  PERSONA You are a professional business assistant
9371
- STYLE Maintain a formal and courteous tone
9367
+ WRITING RULES Maintain a formal and courteous tone
9372
9368
  \`\`\`
9373
9369
 
9374
9370
  \`\`\`book
@@ -9376,7 +9372,7 @@ class MetaImageCommitmentDefinition extends BaseCommitmentDefinition {
9376
9372
 
9377
9373
  META IMAGE /assets/creative-bot-avatar.png
9378
9374
  PERSONA You are a creative and inspiring assistant
9379
- STYLE Be enthusiastic and encouraging
9375
+ WRITING RULES Be enthusiastic and encouraging
9380
9376
  ACTION Can help with brainstorming and ideation
9381
9377
  \`\`\`
9382
9378
  `);
@@ -9535,7 +9531,7 @@ class MetaLinkCommitmentDefinition extends BaseCommitmentDefinition {
9535
9531
  META LINK https://twitter.com/devhandle
9536
9532
  PERSONA You are an experienced open source developer
9537
9533
  ACTION Can help with code reviews and architecture decisions
9538
- STYLE Be direct and technical in explanations
9534
+ WRITING RULES Be direct and technical in explanations
9539
9535
  \`\`\`
9540
9536
  `);
9541
9537
  }
@@ -9741,7 +9737,7 @@ class ModelCommitmentDefinition extends BaseCommitmentDefinition {
9741
9737
  MODEL TEMPERATURE 0.8
9742
9738
  MODEL TOP_P 0.9
9743
9739
  MODEL MAX_TOKENS 2048
9744
- STYLE Be imaginative and expressive
9740
+ WRITING RULES Be imaginative and expressive
9745
9741
  ACTION Can help with storytelling and character development
9746
9742
  \`\`\`
9747
9743
 
@@ -9953,7 +9949,7 @@ class NoteCommitmentDefinition extends BaseCommitmentDefinition {
9953
9949
  NOTE Uses RAG for accessing latest research papers
9954
9950
  PERSONA You are a knowledgeable research assistant
9955
9951
  ACTION Can help with literature reviews and citations
9956
- STYLE Present information in academic format
9952
+ WRITING RULES Present information in academic format
9957
9953
  \`\`\`
9958
9954
  `);
9959
9955
  }
@@ -10068,7 +10064,16 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
10068
10064
  * Short one-line description of PERSONA.
10069
10065
  */
10070
10066
  get description() {
10071
- return 'Define who the agent is: background, expertise, and personality.';
10067
+ return 'Deprecated legacy profile commitment. Prefer `GOAL` for agent profile text and inheritance-safe rewrites.';
10068
+ }
10069
+ /**
10070
+ * Optional UI/docs-only deprecation metadata.
10071
+ */
10072
+ get deprecation() {
10073
+ return {
10074
+ message: 'Use `GOAL` for agent profile text and inheritance-safe rewrites.',
10075
+ replacedBy: ['GOAL'],
10076
+ };
10072
10077
  }
10073
10078
  /**
10074
10079
  * Icon for this commitment.
@@ -10083,16 +10088,24 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
10083
10088
  return spaceTrim$1(`
10084
10089
  # ${this.type}
10085
10090
 
10086
- Defines who the agent is, their background, expertise, and personality traits.
10091
+ Deprecated legacy commitment that defines who the agent is, their background, expertise, and personality traits.
10087
10092
 
10088
- ## Key aspects
10093
+ ## Migration
10089
10094
 
10090
- - Multiple \`PERSONA\` and \`PERSONAE\` commitments are merged together.
10091
- - Both terms work identically and can be used interchangeably.
10092
- - If they are in conflict, the last one takes precedence.
10093
- - You can write persona content in multiple lines.
10095
+ - Existing \`${this.type}\` books still parse and compile.
10096
+ - New books should prefer \`GOAL\`.
10097
+ - Agent profile rendering now prefers the last \`GOAL\` and only falls back to \`${this.type}\` when no goal exists.
10098
+ - Runtime compilation keeps the legacy multi-\`PERSONA\` merge behavior for backward compatibility.
10094
10099
 
10095
- ## Examples
10100
+ ## Preferred replacement
10101
+
10102
+ \`\`\`book
10103
+ Programming Assistant
10104
+
10105
+ GOAL Help the user solve programming problems with practical TypeScript and React guidance.
10106
+ \`\`\`
10107
+
10108
+ ## Legacy compatibility example
10096
10109
 
10097
10110
  \`\`\`book
10098
10111
  Programming Assistant
@@ -10230,7 +10243,7 @@ class RuleCommitmentDefinition extends BaseCommitmentDefinition {
10230
10243
  RULE Always ask for clarification if the user's request is ambiguous
10231
10244
  RULE Be polite and professional in all interactions
10232
10245
  RULES Never provide medical or legal advice
10233
- STYLE Maintain a friendly and helpful tone
10246
+ WRITING RULES Maintain a friendly and helpful tone
10234
10247
  \`\`\`
10235
10248
 
10236
10249
  \`\`\`book
@@ -10499,8 +10512,8 @@ class ScenarioCommitmentDefinition extends BaseCommitmentDefinition {
10499
10512
  /**
10500
10513
  * STYLE commitment definition
10501
10514
  *
10502
- * The STYLE commitment defines how the agent should format and present its responses.
10503
- * This includes tone, writing style, formatting preferences, and communication patterns.
10515
+ * Deprecated legacy writing-style commitment kept for backward compatibility.
10516
+ * New books should prefer `WRITING RULES` for writing-only constraints.
10504
10517
  *
10505
10518
  * Example usage in agent source:
10506
10519
  *
@@ -10519,7 +10532,16 @@ class StyleCommitmentDefinition extends BaseCommitmentDefinition {
10519
10532
  * Short one-line description of STYLE.
10520
10533
  */
10521
10534
  get description() {
10522
- return 'Control the tone and writing style of responses.';
10535
+ return 'Deprecated legacy writing-style commitment. Prefer `WRITING RULES` for new books.';
10536
+ }
10537
+ /**
10538
+ * Optional UI/docs-only deprecation metadata.
10539
+ */
10540
+ get deprecation() {
10541
+ return {
10542
+ message: 'Use `WRITING RULES` for writing-only constraints such as tone, length, formatting, or emoji usage.',
10543
+ replacedBy: ['WRITING RULES'],
10544
+ };
10523
10545
  }
10524
10546
  /**
10525
10547
  * Icon for this commitment.
@@ -10534,15 +10556,34 @@ class StyleCommitmentDefinition extends BaseCommitmentDefinition {
10534
10556
  return spaceTrim$1(`
10535
10557
  # ${this.type}
10536
10558
 
10537
- Defines how the agent should format and present its responses (tone, writing style, formatting).
10559
+ Deprecated legacy commitment for writing and presentation instructions.
10560
+
10561
+ ## Migration
10562
+
10563
+ - Existing \`${this.type}\` books still parse and compile.
10564
+ - New books should prefer \`WRITING RULES\`.
10565
+ - Use \`WRITING SAMPLE\` when you want to anchor voice by example instead of stating constraints directly.
10566
+ - The plural alias \`STYLES\` is the same legacy commitment family.
10538
10567
 
10539
10568
  ## Key aspects
10540
10569
 
10541
- - Both terms work identically and can be used interchangeably.
10570
+ - \`${this.type}\` remains functional for backward compatibility only.
10542
10571
  - Later style instructions can override earlier ones.
10543
10572
  - Style affects both tone and presentation format.
10544
10573
 
10545
- ## Examples
10574
+ ## Preferred replacement
10575
+
10576
+ \`\`\`book
10577
+ Technical Writer
10578
+
10579
+ GOAL Help the user understand technical topics with practical, accurate guidance.
10580
+ WRITING RULES Write in a professional but friendly tone.
10581
+ WRITING RULES Use bullet points for lists.
10582
+ WRITING RULES Always provide code examples when explaining programming concepts.
10583
+ FORMAT Use markdown formatting with clear headings
10584
+ \`\`\`
10585
+
10586
+ ## Legacy compatibility examples
10546
10587
 
10547
10588
  \`\`\`book
10548
10589
  Technical Writer
@@ -10857,7 +10898,7 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
10857
10898
  \`\`\`book
10858
10899
  Legal Assistant
10859
10900
 
10860
- PERSONA An expert software developer
10901
+ GOAL Get expert software-development advice from the teammate when legal discussion needs technical context.
10861
10902
  TEAM You can talk with http://localhost:4440/agents/GMw67JN8TXxN7y to discuss the legal aspects.
10862
10903
  \`\`\`
10863
10904
  `);
@@ -11283,7 +11324,7 @@ class TemplateCommitmentDefinition extends BaseCommitmentDefinition {
11283
11324
 
11284
11325
  PERSONA You are a helpful customer support representative
11285
11326
  TEMPLATE Always structure your response with: 1) Acknowledgment, 2) Solution, 3) Follow-up question
11286
- STYLE Be professional and empathetic
11327
+ WRITING RULES Be professional and empathetic
11287
11328
  \`\`\`
11288
11329
 
11289
11330
  \`\`\`book
@@ -11727,7 +11768,7 @@ class UseBrowserCommitmentDefinition extends BaseCommitmentDefinition {
11727
11768
 
11728
11769
  PERSONA You are a news analyst who stays up-to-date with current events
11729
11770
  USE BROWSER
11730
- STYLE Present news in a balanced and objective manner
11771
+ WRITING RULES Present news in a balanced and objective manner
11731
11772
  ACTION Can search for and summarize news articles
11732
11773
  \`\`\`
11733
11774
 
@@ -17446,7 +17487,7 @@ function parseParameters(text) {
17446
17487
  function parseAgentSource(agentSource) {
17447
17488
  const parseResult = parseAgentSourceWithCommitments(agentSource);
17448
17489
  const resolvedAgentName = parseResult.agentName || createDefaultAgentName(agentSource);
17449
- const personaDescription = extractPersonaDescription(parseResult.commitments);
17490
+ const personaDescription = extractAgentProfileText(parseResult.commitments);
17450
17491
  const initialMessage = extractInitialMessage(parseResult.commitments);
17451
17492
  const parsedProfile = extractParsedAgentProfile(parseResult.commitments);
17452
17493
  ensureMetaFullname(parsedProfile.meta, resolvedAgentName);
@@ -17550,25 +17591,33 @@ const META_COMMITMENT_APPLIERS = {
17550
17591
  */
17551
17592
  const LOCAL_AGENT_REFERENCE_PREFIXES = ['./', '../', '/'];
17552
17593
  /**
17553
- * Builds the combined persona description from PERSONA commitments.
17594
+ * Resolves the public agent profile text from the last GOAL/GOALS commitment,
17595
+ * falling back to the deprecated PERSONA/PERSONAE commitments when no goal exists.
17554
17596
  *
17555
17597
  * @private internal utility of `parseAgentSource`
17556
17598
  */
17557
- function extractPersonaDescription(commitments) {
17558
- let personaDescription = null;
17599
+ function extractAgentProfileText(commitments) {
17600
+ let goalDescription = '';
17601
+ let hasGoalDescription = false;
17602
+ let personaDescription = '';
17603
+ let hasPersonaDescription = false;
17559
17604
  for (const commitment of commitments) {
17560
- if (commitment.type !== 'PERSONA') {
17561
- continue;
17605
+ if (commitment.type === 'GOAL' || commitment.type === 'GOALS') {
17606
+ goalDescription = commitment.content;
17607
+ hasGoalDescription = true;
17562
17608
  }
17563
- if (personaDescription === null) {
17564
- personaDescription = '';
17565
- }
17566
- else {
17567
- personaDescription += `\n\n${personaDescription}`;
17609
+ if (commitment.type === 'PERSONA' || commitment.type === 'PERSONAE') {
17610
+ personaDescription = commitment.content;
17611
+ hasPersonaDescription = true;
17568
17612
  }
17569
- personaDescription += commitment.content;
17570
17613
  }
17571
- return personaDescription;
17614
+ if (hasGoalDescription) {
17615
+ return goalDescription;
17616
+ }
17617
+ if (hasPersonaDescription) {
17618
+ return personaDescription;
17619
+ }
17620
+ return null;
17572
17621
  }
17573
17622
  /**
17574
17623
  * Resolves the last INITIAL MESSAGE commitment, which is the public initial-message value.
@@ -31121,6 +31170,15 @@ const COMMITMENTS_WITH_AGENT_REFERENCES = new Set(['FROM', 'IMPORT', 'IMPORTS',
31121
31170
  * @private internal constant of `createAgentModelRequirementsWithCommitments`
31122
31171
  */
31123
31172
  const DELETE_COMMITMENT_TYPES = new Set(['DELETE', 'CANCEL', 'DISCARD', 'REMOVE']);
31173
+ /**
31174
+ * Commitments whose earlier occurrences are overwritten by the last occurrence in source order.
31175
+ *
31176
+ * @private internal constant of `createAgentModelRequirementsWithCommitments`
31177
+ */
31178
+ const OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE = new Map([
31179
+ ['GOAL', 'GOAL'],
31180
+ ['GOALS', 'GOAL'],
31181
+ ]);
31124
31182
  /**
31125
31183
  * Regex pattern matching markdown horizontal lines that should not be copied into the final system message.
31126
31184
  *
@@ -31171,7 +31229,7 @@ function getSafeReferenceCommitmentFallback(commitmentType, originalContent) {
31171
31229
  */
31172
31230
  async function createAgentModelRequirementsWithCommitments(agentSource, modelName, options) {
31173
31231
  const parseResult = parseAgentSourceWithCommitments(agentSource);
31174
- const filteredCommitments = filterDeletedCommitments(parseResult.commitments);
31232
+ const filteredCommitments = filterOverwrittenCommitments(filterDeletedCommitments(parseResult.commitments));
31175
31233
  let requirements = createInitialAgentModelRequirements(parseResult.agentName, modelName);
31176
31234
  requirements = await applyCommitmentsToRequirements(requirements, filteredCommitments, options);
31177
31235
  requirements = aggregateUseCommitmentSystemMessages(requirements, filteredCommitments);
@@ -31182,6 +31240,35 @@ async function createAgentModelRequirementsWithCommitments(agentSource, modelNam
31182
31240
  requirements = await applyPendingInlineKnowledgeSources(requirements, options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader);
31183
31241
  return finalizeRequirements(requirements);
31184
31242
  }
31243
+ /**
31244
+ * Removes earlier commitments that are overwritten by later commitments of the same semantic group.
31245
+ *
31246
+ * This currently keeps only the last `GOAL` / `GOALS` commitment so inheritance rewrites
31247
+ * and multi-goal sources expose one effective goal to the runtime.
31248
+ *
31249
+ * @param commitments - Parsed commitments after DELETE-like filtering.
31250
+ * @returns Commitments with overwritten entries removed while preserving source order.
31251
+ *
31252
+ * @private internal utility of `createAgentModelRequirementsWithCommitments`
31253
+ */
31254
+ function filterOverwrittenCommitments(commitments) {
31255
+ const seenOverwriteGroups = new Set();
31256
+ const keptCommitments = [];
31257
+ for (let index = commitments.length - 1; index >= 0; index--) {
31258
+ const commitment = commitments[index];
31259
+ const overwriteGroup = OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE.get(commitment.type);
31260
+ if (!overwriteGroup) {
31261
+ keptCommitments.push(commitment);
31262
+ continue;
31263
+ }
31264
+ if (seenOverwriteGroups.has(overwriteGroup)) {
31265
+ continue;
31266
+ }
31267
+ seenOverwriteGroups.add(overwriteGroup);
31268
+ keptCommitments.push(commitment);
31269
+ }
31270
+ return keptCommitments.reverse();
31271
+ }
31185
31272
  /**
31186
31273
  * Creates the initial requirements object with the parsed agent name stored in metadata and an optional model override.
31187
31274
  *
@@ -31773,7 +31860,7 @@ async function createAgentModelRequirements(agentSource, modelName, availableMod
31773
31860
  * Selects the best model using the preparePersona function
31774
31861
  * This directly uses preparePersona to ensure DRY principle
31775
31862
  *
31776
- * @param agentSource The agent source to derive persona description from
31863
+ * @param agentSource The agent source to derive effective profile text from
31777
31864
  * @param llmTools LLM tools for preparing persona
31778
31865
  * @returns The name of the best selected model
31779
31866
  *
@@ -31781,9 +31868,9 @@ async function createAgentModelRequirements(agentSource, modelName, availableMod
31781
31868
  */
31782
31869
  async function selectBestModelUsingPersona(agentSource, llmTools) {
31783
31870
  var _a;
31784
- // Parse agent source to get persona description
31871
+ // Parse agent source to get the effective profile description
31785
31872
  const { agentName, personaDescription } = parseAgentSource(agentSource);
31786
- // Use agent name as fallback if no persona description is available
31873
+ // Use agent name as fallback if no profile description is available
31787
31874
  const description = personaDescription || agentName || 'AI Agent';
31788
31875
  try {
31789
31876
  // Use preparePersona directly