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