@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.
- package/README.md +1 -1
- 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 +1 -1
- 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
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* @generated
|
|
31
31
|
* @see https://github.com/webgptorg/promptbook
|
|
32
32
|
*/
|
|
33
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
33
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-45';
|
|
34
34
|
/**
|
|
35
35
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
36
36
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -6668,7 +6668,7 @@
|
|
|
6668
6668
|
DELETE Casual conversational style
|
|
6669
6669
|
REMOVE All emoji usage
|
|
6670
6670
|
GOAL Provide professional business communications
|
|
6671
|
-
|
|
6671
|
+
WRITING RULES Use formal language and proper business etiquette
|
|
6672
6672
|
\`\`\`
|
|
6673
6673
|
|
|
6674
6674
|
\`\`\`book
|
|
@@ -6679,7 +6679,7 @@
|
|
|
6679
6679
|
DISCARD Technical jargon explanations
|
|
6680
6680
|
CANCEL Advanced troubleshooting procedures
|
|
6681
6681
|
GOAL Help users with simple, easy-to-follow solutions
|
|
6682
|
-
|
|
6682
|
+
WRITING RULES Use plain language that anyone can understand
|
|
6683
6683
|
\`\`\`
|
|
6684
6684
|
|
|
6685
6685
|
\`\`\`book
|
|
@@ -6696,11 +6696,11 @@
|
|
|
6696
6696
|
Concise Information Provider
|
|
6697
6697
|
|
|
6698
6698
|
PERSONA You are a helpful assistant who provides detailed explanations
|
|
6699
|
-
|
|
6699
|
+
WRITING RULES Include examples, analogies, and comprehensive context
|
|
6700
6700
|
CANCEL Detailed explanation style
|
|
6701
6701
|
DISCARD Examples and analogies
|
|
6702
6702
|
GOAL Provide brief, direct answers without unnecessary elaboration
|
|
6703
|
-
|
|
6703
|
+
WRITING RULES Be concise and to the point
|
|
6704
6704
|
\`\`\`
|
|
6705
6705
|
`);
|
|
6706
6706
|
}
|
|
@@ -6884,7 +6884,7 @@
|
|
|
6884
6884
|
PERSONA You are a data analysis expert
|
|
6885
6885
|
FORMAT Present results in structured tables
|
|
6886
6886
|
FORMAT Include confidence scores for all predictions
|
|
6887
|
-
|
|
6887
|
+
WRITING RULES Be concise and precise in explanations
|
|
6888
6888
|
\`\`\`
|
|
6889
6889
|
`);
|
|
6890
6890
|
}
|
|
@@ -7244,7 +7244,7 @@
|
|
|
7244
7244
|
* Short one-line description of GOAL.
|
|
7245
7245
|
*/
|
|
7246
7246
|
get description() {
|
|
7247
|
-
return 'Define
|
|
7247
|
+
return 'Define the effective agent **goal**; when multiple goals exist, only the last one stays effective.';
|
|
7248
7248
|
}
|
|
7249
7249
|
/**
|
|
7250
7250
|
* Icon for this commitment.
|
|
@@ -7259,12 +7259,14 @@
|
|
|
7259
7259
|
return spacetrim.spaceTrim(`
|
|
7260
7260
|
# ${this.type}
|
|
7261
7261
|
|
|
7262
|
-
Defines the main goal which should be achieved by the AI assistant.
|
|
7262
|
+
Defines the main goal which should be achieved by the AI assistant.
|
|
7263
|
+
There can be multiple goals in source, but after inheritance/source rewriting only the last \`GOAL\` /\`GOALS\` remains effective.
|
|
7263
7264
|
|
|
7264
7265
|
## Key aspects
|
|
7265
7266
|
|
|
7266
7267
|
- Both terms work identically and can be used interchangeably.
|
|
7267
|
-
- Later goals
|
|
7268
|
+
- Later goals overwrite earlier goals.
|
|
7269
|
+
- The public agent profile text is derived from the last goal.
|
|
7268
7270
|
- Goals provide clear direction and purpose for the agent's responses.
|
|
7269
7271
|
- Goals influence decision-making and response prioritization.
|
|
7270
7272
|
|
|
@@ -7277,9 +7279,7 @@
|
|
|
7277
7279
|
\`\`\`book
|
|
7278
7280
|
Customer Support Agent
|
|
7279
7281
|
|
|
7280
|
-
PERSONA You are a helpful customer support representative
|
|
7281
7282
|
GOAL Resolve customer issues quickly and efficiently
|
|
7282
|
-
GOAL Maintain high customer satisfaction scores
|
|
7283
7283
|
GOAL Always follow company policies and procedures
|
|
7284
7284
|
RULE Be polite and professional at all times
|
|
7285
7285
|
\`\`\`
|
|
@@ -7287,19 +7287,15 @@
|
|
|
7287
7287
|
\`\`\`book
|
|
7288
7288
|
Educational Assistant
|
|
7289
7289
|
|
|
7290
|
-
PERSONA You are an educational assistant specializing in mathematics
|
|
7291
7290
|
GOAL Help students understand mathematical concepts clearly
|
|
7292
|
-
GOAL Encourage critical thinking and problem-solving skills
|
|
7293
7291
|
GOAL Ensure all explanations are age-appropriate and accessible
|
|
7294
|
-
|
|
7292
|
+
WRITING RULES Use simple language and provide step-by-step explanations
|
|
7295
7293
|
\`\`\`
|
|
7296
7294
|
|
|
7297
7295
|
\`\`\`book
|
|
7298
7296
|
Safety-First Assistant
|
|
7299
7297
|
|
|
7300
|
-
PERSONA You are a general-purpose AI assistant
|
|
7301
7298
|
GOAL Be helpful and informative in all interactions
|
|
7302
|
-
GOAL Provide accurate and reliable information
|
|
7303
7299
|
GOAL Always prioritize user safety and ethical guidelines
|
|
7304
7300
|
RULE Never provide harmful or dangerous advice
|
|
7305
7301
|
\`\`\`
|
|
@@ -7607,7 +7603,7 @@
|
|
|
7607
7603
|
KNOWLEDGE Academic research requires careful citation and verification
|
|
7608
7604
|
KNOWLEDGE https://example.com/research-guidelines.pdf
|
|
7609
7605
|
ACTION Can help with literature reviews and data analysis
|
|
7610
|
-
|
|
7606
|
+
WRITING RULES Present information in clear, academic format
|
|
7611
7607
|
\`\`\`
|
|
7612
7608
|
`);
|
|
7613
7609
|
}
|
|
@@ -9358,7 +9354,7 @@
|
|
|
9358
9354
|
|
|
9359
9355
|
META IMAGE https://example.com/professional-avatar.jpg
|
|
9360
9356
|
PERSONA You are a professional business assistant
|
|
9361
|
-
|
|
9357
|
+
WRITING RULES Maintain a formal and courteous tone
|
|
9362
9358
|
\`\`\`
|
|
9363
9359
|
|
|
9364
9360
|
\`\`\`book
|
|
@@ -9366,7 +9362,7 @@
|
|
|
9366
9362
|
|
|
9367
9363
|
META IMAGE /assets/creative-bot-avatar.png
|
|
9368
9364
|
PERSONA You are a creative and inspiring assistant
|
|
9369
|
-
|
|
9365
|
+
WRITING RULES Be enthusiastic and encouraging
|
|
9370
9366
|
ACTION Can help with brainstorming and ideation
|
|
9371
9367
|
\`\`\`
|
|
9372
9368
|
`);
|
|
@@ -9525,7 +9521,7 @@
|
|
|
9525
9521
|
META LINK https://twitter.com/devhandle
|
|
9526
9522
|
PERSONA You are an experienced open source developer
|
|
9527
9523
|
ACTION Can help with code reviews and architecture decisions
|
|
9528
|
-
|
|
9524
|
+
WRITING RULES Be direct and technical in explanations
|
|
9529
9525
|
\`\`\`
|
|
9530
9526
|
`);
|
|
9531
9527
|
}
|
|
@@ -9731,7 +9727,7 @@
|
|
|
9731
9727
|
MODEL TEMPERATURE 0.8
|
|
9732
9728
|
MODEL TOP_P 0.9
|
|
9733
9729
|
MODEL MAX_TOKENS 2048
|
|
9734
|
-
|
|
9730
|
+
WRITING RULES Be imaginative and expressive
|
|
9735
9731
|
ACTION Can help with storytelling and character development
|
|
9736
9732
|
\`\`\`
|
|
9737
9733
|
|
|
@@ -9943,7 +9939,7 @@
|
|
|
9943
9939
|
NOTE Uses RAG for accessing latest research papers
|
|
9944
9940
|
PERSONA You are a knowledgeable research assistant
|
|
9945
9941
|
ACTION Can help with literature reviews and citations
|
|
9946
|
-
|
|
9942
|
+
WRITING RULES Present information in academic format
|
|
9947
9943
|
\`\`\`
|
|
9948
9944
|
`);
|
|
9949
9945
|
}
|
|
@@ -10058,7 +10054,16 @@
|
|
|
10058
10054
|
* Short one-line description of PERSONA.
|
|
10059
10055
|
*/
|
|
10060
10056
|
get description() {
|
|
10061
|
-
return '
|
|
10057
|
+
return 'Deprecated legacy profile commitment. Prefer `GOAL` for agent profile text and inheritance-safe rewrites.';
|
|
10058
|
+
}
|
|
10059
|
+
/**
|
|
10060
|
+
* Optional UI/docs-only deprecation metadata.
|
|
10061
|
+
*/
|
|
10062
|
+
get deprecation() {
|
|
10063
|
+
return {
|
|
10064
|
+
message: 'Use `GOAL` for agent profile text and inheritance-safe rewrites.',
|
|
10065
|
+
replacedBy: ['GOAL'],
|
|
10066
|
+
};
|
|
10062
10067
|
}
|
|
10063
10068
|
/**
|
|
10064
10069
|
* Icon for this commitment.
|
|
@@ -10073,16 +10078,24 @@
|
|
|
10073
10078
|
return spacetrim.spaceTrim(`
|
|
10074
10079
|
# ${this.type}
|
|
10075
10080
|
|
|
10076
|
-
|
|
10081
|
+
Deprecated legacy commitment that defines who the agent is, their background, expertise, and personality traits.
|
|
10077
10082
|
|
|
10078
|
-
##
|
|
10083
|
+
## Migration
|
|
10079
10084
|
|
|
10080
|
-
-
|
|
10081
|
-
-
|
|
10082
|
-
-
|
|
10083
|
-
-
|
|
10085
|
+
- Existing \`${this.type}\` books still parse and compile.
|
|
10086
|
+
- New books should prefer \`GOAL\`.
|
|
10087
|
+
- Agent profile rendering now prefers the last \`GOAL\` and only falls back to \`${this.type}\` when no goal exists.
|
|
10088
|
+
- Runtime compilation keeps the legacy multi-\`PERSONA\` merge behavior for backward compatibility.
|
|
10084
10089
|
|
|
10085
|
-
##
|
|
10090
|
+
## Preferred replacement
|
|
10091
|
+
|
|
10092
|
+
\`\`\`book
|
|
10093
|
+
Programming Assistant
|
|
10094
|
+
|
|
10095
|
+
GOAL Help the user solve programming problems with practical TypeScript and React guidance.
|
|
10096
|
+
\`\`\`
|
|
10097
|
+
|
|
10098
|
+
## Legacy compatibility example
|
|
10086
10099
|
|
|
10087
10100
|
\`\`\`book
|
|
10088
10101
|
Programming Assistant
|
|
@@ -10220,7 +10233,7 @@
|
|
|
10220
10233
|
RULE Always ask for clarification if the user's request is ambiguous
|
|
10221
10234
|
RULE Be polite and professional in all interactions
|
|
10222
10235
|
RULES Never provide medical or legal advice
|
|
10223
|
-
|
|
10236
|
+
WRITING RULES Maintain a friendly and helpful tone
|
|
10224
10237
|
\`\`\`
|
|
10225
10238
|
|
|
10226
10239
|
\`\`\`book
|
|
@@ -10489,8 +10502,8 @@
|
|
|
10489
10502
|
/**
|
|
10490
10503
|
* STYLE commitment definition
|
|
10491
10504
|
*
|
|
10492
|
-
*
|
|
10493
|
-
*
|
|
10505
|
+
* Deprecated legacy writing-style commitment kept for backward compatibility.
|
|
10506
|
+
* New books should prefer `WRITING RULES` for writing-only constraints.
|
|
10494
10507
|
*
|
|
10495
10508
|
* Example usage in agent source:
|
|
10496
10509
|
*
|
|
@@ -10509,7 +10522,16 @@
|
|
|
10509
10522
|
* Short one-line description of STYLE.
|
|
10510
10523
|
*/
|
|
10511
10524
|
get description() {
|
|
10512
|
-
return '
|
|
10525
|
+
return 'Deprecated legacy writing-style commitment. Prefer `WRITING RULES` for new books.';
|
|
10526
|
+
}
|
|
10527
|
+
/**
|
|
10528
|
+
* Optional UI/docs-only deprecation metadata.
|
|
10529
|
+
*/
|
|
10530
|
+
get deprecation() {
|
|
10531
|
+
return {
|
|
10532
|
+
message: 'Use `WRITING RULES` for writing-only constraints such as tone, length, formatting, or emoji usage.',
|
|
10533
|
+
replacedBy: ['WRITING RULES'],
|
|
10534
|
+
};
|
|
10513
10535
|
}
|
|
10514
10536
|
/**
|
|
10515
10537
|
* Icon for this commitment.
|
|
@@ -10524,15 +10546,34 @@
|
|
|
10524
10546
|
return spacetrim.spaceTrim(`
|
|
10525
10547
|
# ${this.type}
|
|
10526
10548
|
|
|
10527
|
-
|
|
10549
|
+
Deprecated legacy commitment for writing and presentation instructions.
|
|
10550
|
+
|
|
10551
|
+
## Migration
|
|
10552
|
+
|
|
10553
|
+
- Existing \`${this.type}\` books still parse and compile.
|
|
10554
|
+
- New books should prefer \`WRITING RULES\`.
|
|
10555
|
+
- Use \`WRITING SAMPLE\` when you want to anchor voice by example instead of stating constraints directly.
|
|
10556
|
+
- The plural alias \`STYLES\` is the same legacy commitment family.
|
|
10528
10557
|
|
|
10529
10558
|
## Key aspects
|
|
10530
10559
|
|
|
10531
|
-
-
|
|
10560
|
+
- \`${this.type}\` remains functional for backward compatibility only.
|
|
10532
10561
|
- Later style instructions can override earlier ones.
|
|
10533
10562
|
- Style affects both tone and presentation format.
|
|
10534
10563
|
|
|
10535
|
-
##
|
|
10564
|
+
## Preferred replacement
|
|
10565
|
+
|
|
10566
|
+
\`\`\`book
|
|
10567
|
+
Technical Writer
|
|
10568
|
+
|
|
10569
|
+
GOAL Help the user understand technical topics with practical, accurate guidance.
|
|
10570
|
+
WRITING RULES Write in a professional but friendly tone.
|
|
10571
|
+
WRITING RULES Use bullet points for lists.
|
|
10572
|
+
WRITING RULES Always provide code examples when explaining programming concepts.
|
|
10573
|
+
FORMAT Use markdown formatting with clear headings
|
|
10574
|
+
\`\`\`
|
|
10575
|
+
|
|
10576
|
+
## Legacy compatibility examples
|
|
10536
10577
|
|
|
10537
10578
|
\`\`\`book
|
|
10538
10579
|
Technical Writer
|
|
@@ -10847,7 +10888,7 @@
|
|
|
10847
10888
|
\`\`\`book
|
|
10848
10889
|
Legal Assistant
|
|
10849
10890
|
|
|
10850
|
-
|
|
10891
|
+
GOAL Get expert software-development advice from the teammate when legal discussion needs technical context.
|
|
10851
10892
|
TEAM You can talk with http://localhost:4440/agents/GMw67JN8TXxN7y to discuss the legal aspects.
|
|
10852
10893
|
\`\`\`
|
|
10853
10894
|
`);
|
|
@@ -11273,7 +11314,7 @@
|
|
|
11273
11314
|
|
|
11274
11315
|
PERSONA You are a helpful customer support representative
|
|
11275
11316
|
TEMPLATE Always structure your response with: 1) Acknowledgment, 2) Solution, 3) Follow-up question
|
|
11276
|
-
|
|
11317
|
+
WRITING RULES Be professional and empathetic
|
|
11277
11318
|
\`\`\`
|
|
11278
11319
|
|
|
11279
11320
|
\`\`\`book
|
|
@@ -11717,7 +11758,7 @@
|
|
|
11717
11758
|
|
|
11718
11759
|
PERSONA You are a news analyst who stays up-to-date with current events
|
|
11719
11760
|
USE BROWSER
|
|
11720
|
-
|
|
11761
|
+
WRITING RULES Present news in a balanced and objective manner
|
|
11721
11762
|
ACTION Can search for and summarize news articles
|
|
11722
11763
|
\`\`\`
|
|
11723
11764
|
|
|
@@ -17436,7 +17477,7 @@
|
|
|
17436
17477
|
function parseAgentSource(agentSource) {
|
|
17437
17478
|
const parseResult = parseAgentSourceWithCommitments(agentSource);
|
|
17438
17479
|
const resolvedAgentName = parseResult.agentName || createDefaultAgentName(agentSource);
|
|
17439
|
-
const personaDescription =
|
|
17480
|
+
const personaDescription = extractAgentProfileText(parseResult.commitments);
|
|
17440
17481
|
const initialMessage = extractInitialMessage(parseResult.commitments);
|
|
17441
17482
|
const parsedProfile = extractParsedAgentProfile(parseResult.commitments);
|
|
17442
17483
|
ensureMetaFullname(parsedProfile.meta, resolvedAgentName);
|
|
@@ -17540,25 +17581,33 @@
|
|
|
17540
17581
|
*/
|
|
17541
17582
|
const LOCAL_AGENT_REFERENCE_PREFIXES = ['./', '../', '/'];
|
|
17542
17583
|
/**
|
|
17543
|
-
*
|
|
17584
|
+
* Resolves the public agent profile text from the last GOAL/GOALS commitment,
|
|
17585
|
+
* falling back to the deprecated PERSONA/PERSONAE commitments when no goal exists.
|
|
17544
17586
|
*
|
|
17545
17587
|
* @private internal utility of `parseAgentSource`
|
|
17546
17588
|
*/
|
|
17547
|
-
function
|
|
17548
|
-
let
|
|
17589
|
+
function extractAgentProfileText(commitments) {
|
|
17590
|
+
let goalDescription = '';
|
|
17591
|
+
let hasGoalDescription = false;
|
|
17592
|
+
let personaDescription = '';
|
|
17593
|
+
let hasPersonaDescription = false;
|
|
17549
17594
|
for (const commitment of commitments) {
|
|
17550
|
-
if (commitment.type
|
|
17551
|
-
|
|
17595
|
+
if (commitment.type === 'GOAL' || commitment.type === 'GOALS') {
|
|
17596
|
+
goalDescription = commitment.content;
|
|
17597
|
+
hasGoalDescription = true;
|
|
17552
17598
|
}
|
|
17553
|
-
if (
|
|
17554
|
-
personaDescription =
|
|
17555
|
-
|
|
17556
|
-
else {
|
|
17557
|
-
personaDescription += `\n\n${personaDescription}`;
|
|
17599
|
+
if (commitment.type === 'PERSONA' || commitment.type === 'PERSONAE') {
|
|
17600
|
+
personaDescription = commitment.content;
|
|
17601
|
+
hasPersonaDescription = true;
|
|
17558
17602
|
}
|
|
17559
|
-
personaDescription += commitment.content;
|
|
17560
17603
|
}
|
|
17561
|
-
|
|
17604
|
+
if (hasGoalDescription) {
|
|
17605
|
+
return goalDescription;
|
|
17606
|
+
}
|
|
17607
|
+
if (hasPersonaDescription) {
|
|
17608
|
+
return personaDescription;
|
|
17609
|
+
}
|
|
17610
|
+
return null;
|
|
17562
17611
|
}
|
|
17563
17612
|
/**
|
|
17564
17613
|
* Resolves the last INITIAL MESSAGE commitment, which is the public initial-message value.
|
|
@@ -31111,6 +31160,15 @@
|
|
|
31111
31160
|
* @private internal constant of `createAgentModelRequirementsWithCommitments`
|
|
31112
31161
|
*/
|
|
31113
31162
|
const DELETE_COMMITMENT_TYPES = new Set(['DELETE', 'CANCEL', 'DISCARD', 'REMOVE']);
|
|
31163
|
+
/**
|
|
31164
|
+
* Commitments whose earlier occurrences are overwritten by the last occurrence in source order.
|
|
31165
|
+
*
|
|
31166
|
+
* @private internal constant of `createAgentModelRequirementsWithCommitments`
|
|
31167
|
+
*/
|
|
31168
|
+
const OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE = new Map([
|
|
31169
|
+
['GOAL', 'GOAL'],
|
|
31170
|
+
['GOALS', 'GOAL'],
|
|
31171
|
+
]);
|
|
31114
31172
|
/**
|
|
31115
31173
|
* Regex pattern matching markdown horizontal lines that should not be copied into the final system message.
|
|
31116
31174
|
*
|
|
@@ -31161,7 +31219,7 @@
|
|
|
31161
31219
|
*/
|
|
31162
31220
|
async function createAgentModelRequirementsWithCommitments(agentSource, modelName, options) {
|
|
31163
31221
|
const parseResult = parseAgentSourceWithCommitments(agentSource);
|
|
31164
|
-
const filteredCommitments = filterDeletedCommitments(parseResult.commitments);
|
|
31222
|
+
const filteredCommitments = filterOverwrittenCommitments(filterDeletedCommitments(parseResult.commitments));
|
|
31165
31223
|
let requirements = createInitialAgentModelRequirements(parseResult.agentName, modelName);
|
|
31166
31224
|
requirements = await applyCommitmentsToRequirements(requirements, filteredCommitments, options);
|
|
31167
31225
|
requirements = aggregateUseCommitmentSystemMessages(requirements, filteredCommitments);
|
|
@@ -31172,6 +31230,35 @@
|
|
|
31172
31230
|
requirements = await applyPendingInlineKnowledgeSources(requirements, options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader);
|
|
31173
31231
|
return finalizeRequirements(requirements);
|
|
31174
31232
|
}
|
|
31233
|
+
/**
|
|
31234
|
+
* Removes earlier commitments that are overwritten by later commitments of the same semantic group.
|
|
31235
|
+
*
|
|
31236
|
+
* This currently keeps only the last `GOAL` / `GOALS` commitment so inheritance rewrites
|
|
31237
|
+
* and multi-goal sources expose one effective goal to the runtime.
|
|
31238
|
+
*
|
|
31239
|
+
* @param commitments - Parsed commitments after DELETE-like filtering.
|
|
31240
|
+
* @returns Commitments with overwritten entries removed while preserving source order.
|
|
31241
|
+
*
|
|
31242
|
+
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
31243
|
+
*/
|
|
31244
|
+
function filterOverwrittenCommitments(commitments) {
|
|
31245
|
+
const seenOverwriteGroups = new Set();
|
|
31246
|
+
const keptCommitments = [];
|
|
31247
|
+
for (let index = commitments.length - 1; index >= 0; index--) {
|
|
31248
|
+
const commitment = commitments[index];
|
|
31249
|
+
const overwriteGroup = OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE.get(commitment.type);
|
|
31250
|
+
if (!overwriteGroup) {
|
|
31251
|
+
keptCommitments.push(commitment);
|
|
31252
|
+
continue;
|
|
31253
|
+
}
|
|
31254
|
+
if (seenOverwriteGroups.has(overwriteGroup)) {
|
|
31255
|
+
continue;
|
|
31256
|
+
}
|
|
31257
|
+
seenOverwriteGroups.add(overwriteGroup);
|
|
31258
|
+
keptCommitments.push(commitment);
|
|
31259
|
+
}
|
|
31260
|
+
return keptCommitments.reverse();
|
|
31261
|
+
}
|
|
31175
31262
|
/**
|
|
31176
31263
|
* Creates the initial requirements object with the parsed agent name stored in metadata and an optional model override.
|
|
31177
31264
|
*
|
|
@@ -31763,7 +31850,7 @@
|
|
|
31763
31850
|
* Selects the best model using the preparePersona function
|
|
31764
31851
|
* This directly uses preparePersona to ensure DRY principle
|
|
31765
31852
|
*
|
|
31766
|
-
* @param agentSource The agent source to derive
|
|
31853
|
+
* @param agentSource The agent source to derive effective profile text from
|
|
31767
31854
|
* @param llmTools LLM tools for preparing persona
|
|
31768
31855
|
* @returns The name of the best selected model
|
|
31769
31856
|
*
|
|
@@ -31771,9 +31858,9 @@
|
|
|
31771
31858
|
*/
|
|
31772
31859
|
async function selectBestModelUsingPersona(agentSource, llmTools) {
|
|
31773
31860
|
var _a;
|
|
31774
|
-
// Parse agent source to get
|
|
31861
|
+
// Parse agent source to get the effective profile description
|
|
31775
31862
|
const { agentName, personaDescription } = parseAgentSource(agentSource);
|
|
31776
|
-
// Use agent name as fallback if no
|
|
31863
|
+
// Use agent name as fallback if no profile description is available
|
|
31777
31864
|
const description = personaDescription || agentName || 'AI Agent';
|
|
31778
31865
|
try {
|
|
31779
31866
|
// Use preparePersona directly
|