@promptbook/remote-server 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
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
* @generated
|
|
51
51
|
* @see https://github.com/webgptorg/promptbook
|
|
52
52
|
*/
|
|
53
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
53
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-45';
|
|
54
54
|
/**
|
|
55
55
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
56
56
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -11628,7 +11628,7 @@
|
|
|
11628
11628
|
DELETE Casual conversational style
|
|
11629
11629
|
REMOVE All emoji usage
|
|
11630
11630
|
GOAL Provide professional business communications
|
|
11631
|
-
|
|
11631
|
+
WRITING RULES Use formal language and proper business etiquette
|
|
11632
11632
|
\`\`\`
|
|
11633
11633
|
|
|
11634
11634
|
\`\`\`book
|
|
@@ -11639,7 +11639,7 @@
|
|
|
11639
11639
|
DISCARD Technical jargon explanations
|
|
11640
11640
|
CANCEL Advanced troubleshooting procedures
|
|
11641
11641
|
GOAL Help users with simple, easy-to-follow solutions
|
|
11642
|
-
|
|
11642
|
+
WRITING RULES Use plain language that anyone can understand
|
|
11643
11643
|
\`\`\`
|
|
11644
11644
|
|
|
11645
11645
|
\`\`\`book
|
|
@@ -11656,11 +11656,11 @@
|
|
|
11656
11656
|
Concise Information Provider
|
|
11657
11657
|
|
|
11658
11658
|
PERSONA You are a helpful assistant who provides detailed explanations
|
|
11659
|
-
|
|
11659
|
+
WRITING RULES Include examples, analogies, and comprehensive context
|
|
11660
11660
|
CANCEL Detailed explanation style
|
|
11661
11661
|
DISCARD Examples and analogies
|
|
11662
11662
|
GOAL Provide brief, direct answers without unnecessary elaboration
|
|
11663
|
-
|
|
11663
|
+
WRITING RULES Be concise and to the point
|
|
11664
11664
|
\`\`\`
|
|
11665
11665
|
`);
|
|
11666
11666
|
}
|
|
@@ -11844,7 +11844,7 @@
|
|
|
11844
11844
|
PERSONA You are a data analysis expert
|
|
11845
11845
|
FORMAT Present results in structured tables
|
|
11846
11846
|
FORMAT Include confidence scores for all predictions
|
|
11847
|
-
|
|
11847
|
+
WRITING RULES Be concise and precise in explanations
|
|
11848
11848
|
\`\`\`
|
|
11849
11849
|
`);
|
|
11850
11850
|
}
|
|
@@ -12193,7 +12193,7 @@
|
|
|
12193
12193
|
* Short one-line description of GOAL.
|
|
12194
12194
|
*/
|
|
12195
12195
|
get description() {
|
|
12196
|
-
return 'Define
|
|
12196
|
+
return 'Define the effective agent **goal**; when multiple goals exist, only the last one stays effective.';
|
|
12197
12197
|
}
|
|
12198
12198
|
/**
|
|
12199
12199
|
* Icon for this commitment.
|
|
@@ -12208,12 +12208,14 @@
|
|
|
12208
12208
|
return _spaceTrim.spaceTrim(`
|
|
12209
12209
|
# ${this.type}
|
|
12210
12210
|
|
|
12211
|
-
Defines the main goal which should be achieved by the AI assistant.
|
|
12211
|
+
Defines the main goal which should be achieved by the AI assistant.
|
|
12212
|
+
There can be multiple goals in source, but after inheritance/source rewriting only the last \`GOAL\` /\`GOALS\` remains effective.
|
|
12212
12213
|
|
|
12213
12214
|
## Key aspects
|
|
12214
12215
|
|
|
12215
12216
|
- Both terms work identically and can be used interchangeably.
|
|
12216
|
-
- Later goals
|
|
12217
|
+
- Later goals overwrite earlier goals.
|
|
12218
|
+
- The public agent profile text is derived from the last goal.
|
|
12217
12219
|
- Goals provide clear direction and purpose for the agent's responses.
|
|
12218
12220
|
- Goals influence decision-making and response prioritization.
|
|
12219
12221
|
|
|
@@ -12226,9 +12228,7 @@
|
|
|
12226
12228
|
\`\`\`book
|
|
12227
12229
|
Customer Support Agent
|
|
12228
12230
|
|
|
12229
|
-
PERSONA You are a helpful customer support representative
|
|
12230
12231
|
GOAL Resolve customer issues quickly and efficiently
|
|
12231
|
-
GOAL Maintain high customer satisfaction scores
|
|
12232
12232
|
GOAL Always follow company policies and procedures
|
|
12233
12233
|
RULE Be polite and professional at all times
|
|
12234
12234
|
\`\`\`
|
|
@@ -12236,19 +12236,15 @@
|
|
|
12236
12236
|
\`\`\`book
|
|
12237
12237
|
Educational Assistant
|
|
12238
12238
|
|
|
12239
|
-
PERSONA You are an educational assistant specializing in mathematics
|
|
12240
12239
|
GOAL Help students understand mathematical concepts clearly
|
|
12241
|
-
GOAL Encourage critical thinking and problem-solving skills
|
|
12242
12240
|
GOAL Ensure all explanations are age-appropriate and accessible
|
|
12243
|
-
|
|
12241
|
+
WRITING RULES Use simple language and provide step-by-step explanations
|
|
12244
12242
|
\`\`\`
|
|
12245
12243
|
|
|
12246
12244
|
\`\`\`book
|
|
12247
12245
|
Safety-First Assistant
|
|
12248
12246
|
|
|
12249
|
-
PERSONA You are a general-purpose AI assistant
|
|
12250
12247
|
GOAL Be helpful and informative in all interactions
|
|
12251
|
-
GOAL Provide accurate and reliable information
|
|
12252
12248
|
GOAL Always prioritize user safety and ethical guidelines
|
|
12253
12249
|
RULE Never provide harmful or dangerous advice
|
|
12254
12250
|
\`\`\`
|
|
@@ -12656,7 +12652,7 @@
|
|
|
12656
12652
|
KNOWLEDGE Academic research requires careful citation and verification
|
|
12657
12653
|
KNOWLEDGE https://example.com/research-guidelines.pdf
|
|
12658
12654
|
ACTION Can help with literature reviews and data analysis
|
|
12659
|
-
|
|
12655
|
+
WRITING RULES Present information in clear, academic format
|
|
12660
12656
|
\`\`\`
|
|
12661
12657
|
`);
|
|
12662
12658
|
}
|
|
@@ -14407,7 +14403,7 @@
|
|
|
14407
14403
|
|
|
14408
14404
|
META IMAGE https://example.com/professional-avatar.jpg
|
|
14409
14405
|
PERSONA You are a professional business assistant
|
|
14410
|
-
|
|
14406
|
+
WRITING RULES Maintain a formal and courteous tone
|
|
14411
14407
|
\`\`\`
|
|
14412
14408
|
|
|
14413
14409
|
\`\`\`book
|
|
@@ -14415,7 +14411,7 @@
|
|
|
14415
14411
|
|
|
14416
14412
|
META IMAGE /assets/creative-bot-avatar.png
|
|
14417
14413
|
PERSONA You are a creative and inspiring assistant
|
|
14418
|
-
|
|
14414
|
+
WRITING RULES Be enthusiastic and encouraging
|
|
14419
14415
|
ACTION Can help with brainstorming and ideation
|
|
14420
14416
|
\`\`\`
|
|
14421
14417
|
`);
|
|
@@ -14574,7 +14570,7 @@
|
|
|
14574
14570
|
META LINK https://twitter.com/devhandle
|
|
14575
14571
|
PERSONA You are an experienced open source developer
|
|
14576
14572
|
ACTION Can help with code reviews and architecture decisions
|
|
14577
|
-
|
|
14573
|
+
WRITING RULES Be direct and technical in explanations
|
|
14578
14574
|
\`\`\`
|
|
14579
14575
|
`);
|
|
14580
14576
|
}
|
|
@@ -14780,7 +14776,7 @@
|
|
|
14780
14776
|
MODEL TEMPERATURE 0.8
|
|
14781
14777
|
MODEL TOP_P 0.9
|
|
14782
14778
|
MODEL MAX_TOKENS 2048
|
|
14783
|
-
|
|
14779
|
+
WRITING RULES Be imaginative and expressive
|
|
14784
14780
|
ACTION Can help with storytelling and character development
|
|
14785
14781
|
\`\`\`
|
|
14786
14782
|
|
|
@@ -14992,7 +14988,7 @@
|
|
|
14992
14988
|
NOTE Uses RAG for accessing latest research papers
|
|
14993
14989
|
PERSONA You are a knowledgeable research assistant
|
|
14994
14990
|
ACTION Can help with literature reviews and citations
|
|
14995
|
-
|
|
14991
|
+
WRITING RULES Present information in academic format
|
|
14996
14992
|
\`\`\`
|
|
14997
14993
|
`);
|
|
14998
14994
|
}
|
|
@@ -15107,7 +15103,16 @@
|
|
|
15107
15103
|
* Short one-line description of PERSONA.
|
|
15108
15104
|
*/
|
|
15109
15105
|
get description() {
|
|
15110
|
-
return '
|
|
15106
|
+
return 'Deprecated legacy profile commitment. Prefer `GOAL` for agent profile text and inheritance-safe rewrites.';
|
|
15107
|
+
}
|
|
15108
|
+
/**
|
|
15109
|
+
* Optional UI/docs-only deprecation metadata.
|
|
15110
|
+
*/
|
|
15111
|
+
get deprecation() {
|
|
15112
|
+
return {
|
|
15113
|
+
message: 'Use `GOAL` for agent profile text and inheritance-safe rewrites.',
|
|
15114
|
+
replacedBy: ['GOAL'],
|
|
15115
|
+
};
|
|
15111
15116
|
}
|
|
15112
15117
|
/**
|
|
15113
15118
|
* Icon for this commitment.
|
|
@@ -15122,16 +15127,24 @@
|
|
|
15122
15127
|
return _spaceTrim.spaceTrim(`
|
|
15123
15128
|
# ${this.type}
|
|
15124
15129
|
|
|
15125
|
-
|
|
15130
|
+
Deprecated legacy commitment that defines who the agent is, their background, expertise, and personality traits.
|
|
15126
15131
|
|
|
15127
|
-
##
|
|
15132
|
+
## Migration
|
|
15128
15133
|
|
|
15129
|
-
-
|
|
15130
|
-
-
|
|
15131
|
-
-
|
|
15132
|
-
-
|
|
15134
|
+
- Existing \`${this.type}\` books still parse and compile.
|
|
15135
|
+
- New books should prefer \`GOAL\`.
|
|
15136
|
+
- Agent profile rendering now prefers the last \`GOAL\` and only falls back to \`${this.type}\` when no goal exists.
|
|
15137
|
+
- Runtime compilation keeps the legacy multi-\`PERSONA\` merge behavior for backward compatibility.
|
|
15133
15138
|
|
|
15134
|
-
##
|
|
15139
|
+
## Preferred replacement
|
|
15140
|
+
|
|
15141
|
+
\`\`\`book
|
|
15142
|
+
Programming Assistant
|
|
15143
|
+
|
|
15144
|
+
GOAL Help the user solve programming problems with practical TypeScript and React guidance.
|
|
15145
|
+
\`\`\`
|
|
15146
|
+
|
|
15147
|
+
## Legacy compatibility example
|
|
15135
15148
|
|
|
15136
15149
|
\`\`\`book
|
|
15137
15150
|
Programming Assistant
|
|
@@ -15269,7 +15282,7 @@
|
|
|
15269
15282
|
RULE Always ask for clarification if the user's request is ambiguous
|
|
15270
15283
|
RULE Be polite and professional in all interactions
|
|
15271
15284
|
RULES Never provide medical or legal advice
|
|
15272
|
-
|
|
15285
|
+
WRITING RULES Maintain a friendly and helpful tone
|
|
15273
15286
|
\`\`\`
|
|
15274
15287
|
|
|
15275
15288
|
\`\`\`book
|
|
@@ -15538,8 +15551,8 @@
|
|
|
15538
15551
|
/**
|
|
15539
15552
|
* STYLE commitment definition
|
|
15540
15553
|
*
|
|
15541
|
-
*
|
|
15542
|
-
*
|
|
15554
|
+
* Deprecated legacy writing-style commitment kept for backward compatibility.
|
|
15555
|
+
* New books should prefer `WRITING RULES` for writing-only constraints.
|
|
15543
15556
|
*
|
|
15544
15557
|
* Example usage in agent source:
|
|
15545
15558
|
*
|
|
@@ -15558,7 +15571,16 @@
|
|
|
15558
15571
|
* Short one-line description of STYLE.
|
|
15559
15572
|
*/
|
|
15560
15573
|
get description() {
|
|
15561
|
-
return '
|
|
15574
|
+
return 'Deprecated legacy writing-style commitment. Prefer `WRITING RULES` for new books.';
|
|
15575
|
+
}
|
|
15576
|
+
/**
|
|
15577
|
+
* Optional UI/docs-only deprecation metadata.
|
|
15578
|
+
*/
|
|
15579
|
+
get deprecation() {
|
|
15580
|
+
return {
|
|
15581
|
+
message: 'Use `WRITING RULES` for writing-only constraints such as tone, length, formatting, or emoji usage.',
|
|
15582
|
+
replacedBy: ['WRITING RULES'],
|
|
15583
|
+
};
|
|
15562
15584
|
}
|
|
15563
15585
|
/**
|
|
15564
15586
|
* Icon for this commitment.
|
|
@@ -15573,15 +15595,34 @@
|
|
|
15573
15595
|
return _spaceTrim.spaceTrim(`
|
|
15574
15596
|
# ${this.type}
|
|
15575
15597
|
|
|
15576
|
-
|
|
15598
|
+
Deprecated legacy commitment for writing and presentation instructions.
|
|
15599
|
+
|
|
15600
|
+
## Migration
|
|
15601
|
+
|
|
15602
|
+
- Existing \`${this.type}\` books still parse and compile.
|
|
15603
|
+
- New books should prefer \`WRITING RULES\`.
|
|
15604
|
+
- Use \`WRITING SAMPLE\` when you want to anchor voice by example instead of stating constraints directly.
|
|
15605
|
+
- The plural alias \`STYLES\` is the same legacy commitment family.
|
|
15577
15606
|
|
|
15578
15607
|
## Key aspects
|
|
15579
15608
|
|
|
15580
|
-
-
|
|
15609
|
+
- \`${this.type}\` remains functional for backward compatibility only.
|
|
15581
15610
|
- Later style instructions can override earlier ones.
|
|
15582
15611
|
- Style affects both tone and presentation format.
|
|
15583
15612
|
|
|
15584
|
-
##
|
|
15613
|
+
## Preferred replacement
|
|
15614
|
+
|
|
15615
|
+
\`\`\`book
|
|
15616
|
+
Technical Writer
|
|
15617
|
+
|
|
15618
|
+
GOAL Help the user understand technical topics with practical, accurate guidance.
|
|
15619
|
+
WRITING RULES Write in a professional but friendly tone.
|
|
15620
|
+
WRITING RULES Use bullet points for lists.
|
|
15621
|
+
WRITING RULES Always provide code examples when explaining programming concepts.
|
|
15622
|
+
FORMAT Use markdown formatting with clear headings
|
|
15623
|
+
\`\`\`
|
|
15624
|
+
|
|
15625
|
+
## Legacy compatibility examples
|
|
15585
15626
|
|
|
15586
15627
|
\`\`\`book
|
|
15587
15628
|
Technical Writer
|
|
@@ -15896,7 +15937,7 @@
|
|
|
15896
15937
|
\`\`\`book
|
|
15897
15938
|
Legal Assistant
|
|
15898
15939
|
|
|
15899
|
-
|
|
15940
|
+
GOAL Get expert software-development advice from the teammate when legal discussion needs technical context.
|
|
15900
15941
|
TEAM You can talk with http://localhost:4440/agents/GMw67JN8TXxN7y to discuss the legal aspects.
|
|
15901
15942
|
\`\`\`
|
|
15902
15943
|
`);
|
|
@@ -16322,7 +16363,7 @@
|
|
|
16322
16363
|
|
|
16323
16364
|
PERSONA You are a helpful customer support representative
|
|
16324
16365
|
TEMPLATE Always structure your response with: 1) Acknowledgment, 2) Solution, 3) Follow-up question
|
|
16325
|
-
|
|
16366
|
+
WRITING RULES Be professional and empathetic
|
|
16326
16367
|
\`\`\`
|
|
16327
16368
|
|
|
16328
16369
|
\`\`\`book
|
|
@@ -16766,7 +16807,7 @@
|
|
|
16766
16807
|
|
|
16767
16808
|
PERSONA You are a news analyst who stays up-to-date with current events
|
|
16768
16809
|
USE BROWSER
|
|
16769
|
-
|
|
16810
|
+
WRITING RULES Present news in a balanced and objective manner
|
|
16770
16811
|
ACTION Can search for and summarize news articles
|
|
16771
16812
|
\`\`\`
|
|
16772
16813
|
|
|
@@ -25064,7 +25105,7 @@
|
|
|
25064
25105
|
function parseAgentSource(agentSource) {
|
|
25065
25106
|
const parseResult = parseAgentSourceWithCommitments(agentSource);
|
|
25066
25107
|
const resolvedAgentName = parseResult.agentName || createDefaultAgentName(agentSource);
|
|
25067
|
-
const personaDescription =
|
|
25108
|
+
const personaDescription = extractAgentProfileText(parseResult.commitments);
|
|
25068
25109
|
const initialMessage = extractInitialMessage(parseResult.commitments);
|
|
25069
25110
|
const parsedProfile = extractParsedAgentProfile(parseResult.commitments);
|
|
25070
25111
|
ensureMetaFullname(parsedProfile.meta, resolvedAgentName);
|
|
@@ -25168,25 +25209,33 @@
|
|
|
25168
25209
|
*/
|
|
25169
25210
|
const LOCAL_AGENT_REFERENCE_PREFIXES = ['./', '../', '/'];
|
|
25170
25211
|
/**
|
|
25171
|
-
*
|
|
25212
|
+
* Resolves the public agent profile text from the last GOAL/GOALS commitment,
|
|
25213
|
+
* falling back to the deprecated PERSONA/PERSONAE commitments when no goal exists.
|
|
25172
25214
|
*
|
|
25173
25215
|
* @private internal utility of `parseAgentSource`
|
|
25174
25216
|
*/
|
|
25175
|
-
function
|
|
25176
|
-
let
|
|
25217
|
+
function extractAgentProfileText(commitments) {
|
|
25218
|
+
let goalDescription = '';
|
|
25219
|
+
let hasGoalDescription = false;
|
|
25220
|
+
let personaDescription = '';
|
|
25221
|
+
let hasPersonaDescription = false;
|
|
25177
25222
|
for (const commitment of commitments) {
|
|
25178
|
-
if (commitment.type
|
|
25179
|
-
|
|
25223
|
+
if (commitment.type === 'GOAL' || commitment.type === 'GOALS') {
|
|
25224
|
+
goalDescription = commitment.content;
|
|
25225
|
+
hasGoalDescription = true;
|
|
25180
25226
|
}
|
|
25181
|
-
if (
|
|
25182
|
-
personaDescription =
|
|
25183
|
-
|
|
25184
|
-
else {
|
|
25185
|
-
personaDescription += `\n\n${personaDescription}`;
|
|
25227
|
+
if (commitment.type === 'PERSONA' || commitment.type === 'PERSONAE') {
|
|
25228
|
+
personaDescription = commitment.content;
|
|
25229
|
+
hasPersonaDescription = true;
|
|
25186
25230
|
}
|
|
25187
|
-
personaDescription += commitment.content;
|
|
25188
25231
|
}
|
|
25189
|
-
|
|
25232
|
+
if (hasGoalDescription) {
|
|
25233
|
+
return goalDescription;
|
|
25234
|
+
}
|
|
25235
|
+
if (hasPersonaDescription) {
|
|
25236
|
+
return personaDescription;
|
|
25237
|
+
}
|
|
25238
|
+
return null;
|
|
25190
25239
|
}
|
|
25191
25240
|
/**
|
|
25192
25241
|
* Resolves the last INITIAL MESSAGE commitment, which is the public initial-message value.
|
|
@@ -25868,6 +25917,15 @@
|
|
|
25868
25917
|
* @private internal constant of `createAgentModelRequirementsWithCommitments`
|
|
25869
25918
|
*/
|
|
25870
25919
|
const DELETE_COMMITMENT_TYPES = new Set(['DELETE', 'CANCEL', 'DISCARD', 'REMOVE']);
|
|
25920
|
+
/**
|
|
25921
|
+
* Commitments whose earlier occurrences are overwritten by the last occurrence in source order.
|
|
25922
|
+
*
|
|
25923
|
+
* @private internal constant of `createAgentModelRequirementsWithCommitments`
|
|
25924
|
+
*/
|
|
25925
|
+
const OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE = new Map([
|
|
25926
|
+
['GOAL', 'GOAL'],
|
|
25927
|
+
['GOALS', 'GOAL'],
|
|
25928
|
+
]);
|
|
25871
25929
|
/**
|
|
25872
25930
|
* Regex pattern matching markdown horizontal lines that should not be copied into the final system message.
|
|
25873
25931
|
*
|
|
@@ -25918,7 +25976,7 @@
|
|
|
25918
25976
|
*/
|
|
25919
25977
|
async function createAgentModelRequirementsWithCommitments(agentSource, modelName, options) {
|
|
25920
25978
|
const parseResult = parseAgentSourceWithCommitments(agentSource);
|
|
25921
|
-
const filteredCommitments = filterDeletedCommitments(parseResult.commitments);
|
|
25979
|
+
const filteredCommitments = filterOverwrittenCommitments(filterDeletedCommitments(parseResult.commitments));
|
|
25922
25980
|
let requirements = createInitialAgentModelRequirements(parseResult.agentName, modelName);
|
|
25923
25981
|
requirements = await applyCommitmentsToRequirements(requirements, filteredCommitments, options);
|
|
25924
25982
|
requirements = aggregateUseCommitmentSystemMessages(requirements, filteredCommitments);
|
|
@@ -25929,6 +25987,35 @@
|
|
|
25929
25987
|
requirements = await applyPendingInlineKnowledgeSources(requirements, options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader);
|
|
25930
25988
|
return finalizeRequirements(requirements);
|
|
25931
25989
|
}
|
|
25990
|
+
/**
|
|
25991
|
+
* Removes earlier commitments that are overwritten by later commitments of the same semantic group.
|
|
25992
|
+
*
|
|
25993
|
+
* This currently keeps only the last `GOAL` / `GOALS` commitment so inheritance rewrites
|
|
25994
|
+
* and multi-goal sources expose one effective goal to the runtime.
|
|
25995
|
+
*
|
|
25996
|
+
* @param commitments - Parsed commitments after DELETE-like filtering.
|
|
25997
|
+
* @returns Commitments with overwritten entries removed while preserving source order.
|
|
25998
|
+
*
|
|
25999
|
+
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
26000
|
+
*/
|
|
26001
|
+
function filterOverwrittenCommitments(commitments) {
|
|
26002
|
+
const seenOverwriteGroups = new Set();
|
|
26003
|
+
const keptCommitments = [];
|
|
26004
|
+
for (let index = commitments.length - 1; index >= 0; index--) {
|
|
26005
|
+
const commitment = commitments[index];
|
|
26006
|
+
const overwriteGroup = OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE.get(commitment.type);
|
|
26007
|
+
if (!overwriteGroup) {
|
|
26008
|
+
keptCommitments.push(commitment);
|
|
26009
|
+
continue;
|
|
26010
|
+
}
|
|
26011
|
+
if (seenOverwriteGroups.has(overwriteGroup)) {
|
|
26012
|
+
continue;
|
|
26013
|
+
}
|
|
26014
|
+
seenOverwriteGroups.add(overwriteGroup);
|
|
26015
|
+
keptCommitments.push(commitment);
|
|
26016
|
+
}
|
|
26017
|
+
return keptCommitments.reverse();
|
|
26018
|
+
}
|
|
25932
26019
|
/**
|
|
25933
26020
|
* Creates the initial requirements object with the parsed agent name stored in metadata and an optional model override.
|
|
25934
26021
|
*
|
|
@@ -26520,7 +26607,7 @@
|
|
|
26520
26607
|
* Selects the best model using the preparePersona function
|
|
26521
26608
|
* This directly uses preparePersona to ensure DRY principle
|
|
26522
26609
|
*
|
|
26523
|
-
* @param agentSource The agent source to derive
|
|
26610
|
+
* @param agentSource The agent source to derive effective profile text from
|
|
26524
26611
|
* @param llmTools LLM tools for preparing persona
|
|
26525
26612
|
* @returns The name of the best selected model
|
|
26526
26613
|
*
|
|
@@ -26528,9 +26615,9 @@
|
|
|
26528
26615
|
*/
|
|
26529
26616
|
async function selectBestModelUsingPersona(agentSource, llmTools) {
|
|
26530
26617
|
var _a;
|
|
26531
|
-
// Parse agent source to get
|
|
26618
|
+
// Parse agent source to get the effective profile description
|
|
26532
26619
|
const { agentName, personaDescription } = parseAgentSource(agentSource);
|
|
26533
|
-
// Use agent name as fallback if no
|
|
26620
|
+
// Use agent name as fallback if no profile description is available
|
|
26534
26621
|
const description = personaDescription || agentName || 'AI Agent';
|
|
26535
26622
|
try {
|
|
26536
26623
|
// Use preparePersona directly
|