@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/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
|
+
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
|
|
@@ -11618,7 +11618,7 @@ class DeleteCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
11618
11618
|
DELETE Casual conversational style
|
|
11619
11619
|
REMOVE All emoji usage
|
|
11620
11620
|
GOAL Provide professional business communications
|
|
11621
|
-
|
|
11621
|
+
WRITING RULES Use formal language and proper business etiquette
|
|
11622
11622
|
\`\`\`
|
|
11623
11623
|
|
|
11624
11624
|
\`\`\`book
|
|
@@ -11629,7 +11629,7 @@ class DeleteCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
11629
11629
|
DISCARD Technical jargon explanations
|
|
11630
11630
|
CANCEL Advanced troubleshooting procedures
|
|
11631
11631
|
GOAL Help users with simple, easy-to-follow solutions
|
|
11632
|
-
|
|
11632
|
+
WRITING RULES Use plain language that anyone can understand
|
|
11633
11633
|
\`\`\`
|
|
11634
11634
|
|
|
11635
11635
|
\`\`\`book
|
|
@@ -11646,11 +11646,11 @@ class DeleteCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
11646
11646
|
Concise Information Provider
|
|
11647
11647
|
|
|
11648
11648
|
PERSONA You are a helpful assistant who provides detailed explanations
|
|
11649
|
-
|
|
11649
|
+
WRITING RULES Include examples, analogies, and comprehensive context
|
|
11650
11650
|
CANCEL Detailed explanation style
|
|
11651
11651
|
DISCARD Examples and analogies
|
|
11652
11652
|
GOAL Provide brief, direct answers without unnecessary elaboration
|
|
11653
|
-
|
|
11653
|
+
WRITING RULES Be concise and to the point
|
|
11654
11654
|
\`\`\`
|
|
11655
11655
|
`);
|
|
11656
11656
|
}
|
|
@@ -11834,7 +11834,7 @@ class FormatCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
11834
11834
|
PERSONA You are a data analysis expert
|
|
11835
11835
|
FORMAT Present results in structured tables
|
|
11836
11836
|
FORMAT Include confidence scores for all predictions
|
|
11837
|
-
|
|
11837
|
+
WRITING RULES Be concise and precise in explanations
|
|
11838
11838
|
\`\`\`
|
|
11839
11839
|
`);
|
|
11840
11840
|
}
|
|
@@ -12183,7 +12183,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
12183
12183
|
* Short one-line description of GOAL.
|
|
12184
12184
|
*/
|
|
12185
12185
|
get description() {
|
|
12186
|
-
return 'Define
|
|
12186
|
+
return 'Define the effective agent **goal**; when multiple goals exist, only the last one stays effective.';
|
|
12187
12187
|
}
|
|
12188
12188
|
/**
|
|
12189
12189
|
* Icon for this commitment.
|
|
@@ -12198,12 +12198,14 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
12198
12198
|
return spaceTrim$1(`
|
|
12199
12199
|
# ${this.type}
|
|
12200
12200
|
|
|
12201
|
-
Defines the main goal which should be achieved by the AI assistant.
|
|
12201
|
+
Defines the main goal which should be achieved by the AI assistant.
|
|
12202
|
+
There can be multiple goals in source, but after inheritance/source rewriting only the last \`GOAL\` /\`GOALS\` remains effective.
|
|
12202
12203
|
|
|
12203
12204
|
## Key aspects
|
|
12204
12205
|
|
|
12205
12206
|
- Both terms work identically and can be used interchangeably.
|
|
12206
|
-
- Later goals
|
|
12207
|
+
- Later goals overwrite earlier goals.
|
|
12208
|
+
- The public agent profile text is derived from the last goal.
|
|
12207
12209
|
- Goals provide clear direction and purpose for the agent's responses.
|
|
12208
12210
|
- Goals influence decision-making and response prioritization.
|
|
12209
12211
|
|
|
@@ -12216,9 +12218,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
12216
12218
|
\`\`\`book
|
|
12217
12219
|
Customer Support Agent
|
|
12218
12220
|
|
|
12219
|
-
PERSONA You are a helpful customer support representative
|
|
12220
12221
|
GOAL Resolve customer issues quickly and efficiently
|
|
12221
|
-
GOAL Maintain high customer satisfaction scores
|
|
12222
12222
|
GOAL Always follow company policies and procedures
|
|
12223
12223
|
RULE Be polite and professional at all times
|
|
12224
12224
|
\`\`\`
|
|
@@ -12226,19 +12226,15 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
12226
12226
|
\`\`\`book
|
|
12227
12227
|
Educational Assistant
|
|
12228
12228
|
|
|
12229
|
-
PERSONA You are an educational assistant specializing in mathematics
|
|
12230
12229
|
GOAL Help students understand mathematical concepts clearly
|
|
12231
|
-
GOAL Encourage critical thinking and problem-solving skills
|
|
12232
12230
|
GOAL Ensure all explanations are age-appropriate and accessible
|
|
12233
|
-
|
|
12231
|
+
WRITING RULES Use simple language and provide step-by-step explanations
|
|
12234
12232
|
\`\`\`
|
|
12235
12233
|
|
|
12236
12234
|
\`\`\`book
|
|
12237
12235
|
Safety-First Assistant
|
|
12238
12236
|
|
|
12239
|
-
PERSONA You are a general-purpose AI assistant
|
|
12240
12237
|
GOAL Be helpful and informative in all interactions
|
|
12241
|
-
GOAL Provide accurate and reliable information
|
|
12242
12238
|
GOAL Always prioritize user safety and ethical guidelines
|
|
12243
12239
|
RULE Never provide harmful or dangerous advice
|
|
12244
12240
|
\`\`\`
|
|
@@ -12646,7 +12642,7 @@ class KnowledgeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
12646
12642
|
KNOWLEDGE Academic research requires careful citation and verification
|
|
12647
12643
|
KNOWLEDGE https://example.com/research-guidelines.pdf
|
|
12648
12644
|
ACTION Can help with literature reviews and data analysis
|
|
12649
|
-
|
|
12645
|
+
WRITING RULES Present information in clear, academic format
|
|
12650
12646
|
\`\`\`
|
|
12651
12647
|
`);
|
|
12652
12648
|
}
|
|
@@ -14397,7 +14393,7 @@ class MetaImageCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
14397
14393
|
|
|
14398
14394
|
META IMAGE https://example.com/professional-avatar.jpg
|
|
14399
14395
|
PERSONA You are a professional business assistant
|
|
14400
|
-
|
|
14396
|
+
WRITING RULES Maintain a formal and courteous tone
|
|
14401
14397
|
\`\`\`
|
|
14402
14398
|
|
|
14403
14399
|
\`\`\`book
|
|
@@ -14405,7 +14401,7 @@ class MetaImageCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
14405
14401
|
|
|
14406
14402
|
META IMAGE /assets/creative-bot-avatar.png
|
|
14407
14403
|
PERSONA You are a creative and inspiring assistant
|
|
14408
|
-
|
|
14404
|
+
WRITING RULES Be enthusiastic and encouraging
|
|
14409
14405
|
ACTION Can help with brainstorming and ideation
|
|
14410
14406
|
\`\`\`
|
|
14411
14407
|
`);
|
|
@@ -14564,7 +14560,7 @@ class MetaLinkCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
14564
14560
|
META LINK https://twitter.com/devhandle
|
|
14565
14561
|
PERSONA You are an experienced open source developer
|
|
14566
14562
|
ACTION Can help with code reviews and architecture decisions
|
|
14567
|
-
|
|
14563
|
+
WRITING RULES Be direct and technical in explanations
|
|
14568
14564
|
\`\`\`
|
|
14569
14565
|
`);
|
|
14570
14566
|
}
|
|
@@ -14770,7 +14766,7 @@ class ModelCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
14770
14766
|
MODEL TEMPERATURE 0.8
|
|
14771
14767
|
MODEL TOP_P 0.9
|
|
14772
14768
|
MODEL MAX_TOKENS 2048
|
|
14773
|
-
|
|
14769
|
+
WRITING RULES Be imaginative and expressive
|
|
14774
14770
|
ACTION Can help with storytelling and character development
|
|
14775
14771
|
\`\`\`
|
|
14776
14772
|
|
|
@@ -14982,7 +14978,7 @@ class NoteCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
14982
14978
|
NOTE Uses RAG for accessing latest research papers
|
|
14983
14979
|
PERSONA You are a knowledgeable research assistant
|
|
14984
14980
|
ACTION Can help with literature reviews and citations
|
|
14985
|
-
|
|
14981
|
+
WRITING RULES Present information in academic format
|
|
14986
14982
|
\`\`\`
|
|
14987
14983
|
`);
|
|
14988
14984
|
}
|
|
@@ -15097,7 +15093,16 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15097
15093
|
* Short one-line description of PERSONA.
|
|
15098
15094
|
*/
|
|
15099
15095
|
get description() {
|
|
15100
|
-
return '
|
|
15096
|
+
return 'Deprecated legacy profile commitment. Prefer `GOAL` for agent profile text and inheritance-safe rewrites.';
|
|
15097
|
+
}
|
|
15098
|
+
/**
|
|
15099
|
+
* Optional UI/docs-only deprecation metadata.
|
|
15100
|
+
*/
|
|
15101
|
+
get deprecation() {
|
|
15102
|
+
return {
|
|
15103
|
+
message: 'Use `GOAL` for agent profile text and inheritance-safe rewrites.',
|
|
15104
|
+
replacedBy: ['GOAL'],
|
|
15105
|
+
};
|
|
15101
15106
|
}
|
|
15102
15107
|
/**
|
|
15103
15108
|
* Icon for this commitment.
|
|
@@ -15112,16 +15117,24 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15112
15117
|
return spaceTrim$1(`
|
|
15113
15118
|
# ${this.type}
|
|
15114
15119
|
|
|
15115
|
-
|
|
15120
|
+
Deprecated legacy commitment that defines who the agent is, their background, expertise, and personality traits.
|
|
15116
15121
|
|
|
15117
|
-
##
|
|
15122
|
+
## Migration
|
|
15118
15123
|
|
|
15119
|
-
-
|
|
15120
|
-
-
|
|
15121
|
-
-
|
|
15122
|
-
-
|
|
15124
|
+
- Existing \`${this.type}\` books still parse and compile.
|
|
15125
|
+
- New books should prefer \`GOAL\`.
|
|
15126
|
+
- Agent profile rendering now prefers the last \`GOAL\` and only falls back to \`${this.type}\` when no goal exists.
|
|
15127
|
+
- Runtime compilation keeps the legacy multi-\`PERSONA\` merge behavior for backward compatibility.
|
|
15123
15128
|
|
|
15124
|
-
##
|
|
15129
|
+
## Preferred replacement
|
|
15130
|
+
|
|
15131
|
+
\`\`\`book
|
|
15132
|
+
Programming Assistant
|
|
15133
|
+
|
|
15134
|
+
GOAL Help the user solve programming problems with practical TypeScript and React guidance.
|
|
15135
|
+
\`\`\`
|
|
15136
|
+
|
|
15137
|
+
## Legacy compatibility example
|
|
15125
15138
|
|
|
15126
15139
|
\`\`\`book
|
|
15127
15140
|
Programming Assistant
|
|
@@ -15259,7 +15272,7 @@ class RuleCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15259
15272
|
RULE Always ask for clarification if the user's request is ambiguous
|
|
15260
15273
|
RULE Be polite and professional in all interactions
|
|
15261
15274
|
RULES Never provide medical or legal advice
|
|
15262
|
-
|
|
15275
|
+
WRITING RULES Maintain a friendly and helpful tone
|
|
15263
15276
|
\`\`\`
|
|
15264
15277
|
|
|
15265
15278
|
\`\`\`book
|
|
@@ -15528,8 +15541,8 @@ class ScenarioCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15528
15541
|
/**
|
|
15529
15542
|
* STYLE commitment definition
|
|
15530
15543
|
*
|
|
15531
|
-
*
|
|
15532
|
-
*
|
|
15544
|
+
* Deprecated legacy writing-style commitment kept for backward compatibility.
|
|
15545
|
+
* New books should prefer `WRITING RULES` for writing-only constraints.
|
|
15533
15546
|
*
|
|
15534
15547
|
* Example usage in agent source:
|
|
15535
15548
|
*
|
|
@@ -15548,7 +15561,16 @@ class StyleCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15548
15561
|
* Short one-line description of STYLE.
|
|
15549
15562
|
*/
|
|
15550
15563
|
get description() {
|
|
15551
|
-
return '
|
|
15564
|
+
return 'Deprecated legacy writing-style commitment. Prefer `WRITING RULES` for new books.';
|
|
15565
|
+
}
|
|
15566
|
+
/**
|
|
15567
|
+
* Optional UI/docs-only deprecation metadata.
|
|
15568
|
+
*/
|
|
15569
|
+
get deprecation() {
|
|
15570
|
+
return {
|
|
15571
|
+
message: 'Use `WRITING RULES` for writing-only constraints such as tone, length, formatting, or emoji usage.',
|
|
15572
|
+
replacedBy: ['WRITING RULES'],
|
|
15573
|
+
};
|
|
15552
15574
|
}
|
|
15553
15575
|
/**
|
|
15554
15576
|
* Icon for this commitment.
|
|
@@ -15563,15 +15585,34 @@ class StyleCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15563
15585
|
return spaceTrim$1(`
|
|
15564
15586
|
# ${this.type}
|
|
15565
15587
|
|
|
15566
|
-
|
|
15588
|
+
Deprecated legacy commitment for writing and presentation instructions.
|
|
15589
|
+
|
|
15590
|
+
## Migration
|
|
15591
|
+
|
|
15592
|
+
- Existing \`${this.type}\` books still parse and compile.
|
|
15593
|
+
- New books should prefer \`WRITING RULES\`.
|
|
15594
|
+
- Use \`WRITING SAMPLE\` when you want to anchor voice by example instead of stating constraints directly.
|
|
15595
|
+
- The plural alias \`STYLES\` is the same legacy commitment family.
|
|
15567
15596
|
|
|
15568
15597
|
## Key aspects
|
|
15569
15598
|
|
|
15570
|
-
-
|
|
15599
|
+
- \`${this.type}\` remains functional for backward compatibility only.
|
|
15571
15600
|
- Later style instructions can override earlier ones.
|
|
15572
15601
|
- Style affects both tone and presentation format.
|
|
15573
15602
|
|
|
15574
|
-
##
|
|
15603
|
+
## Preferred replacement
|
|
15604
|
+
|
|
15605
|
+
\`\`\`book
|
|
15606
|
+
Technical Writer
|
|
15607
|
+
|
|
15608
|
+
GOAL Help the user understand technical topics with practical, accurate guidance.
|
|
15609
|
+
WRITING RULES Write in a professional but friendly tone.
|
|
15610
|
+
WRITING RULES Use bullet points for lists.
|
|
15611
|
+
WRITING RULES Always provide code examples when explaining programming concepts.
|
|
15612
|
+
FORMAT Use markdown formatting with clear headings
|
|
15613
|
+
\`\`\`
|
|
15614
|
+
|
|
15615
|
+
## Legacy compatibility examples
|
|
15575
15616
|
|
|
15576
15617
|
\`\`\`book
|
|
15577
15618
|
Technical Writer
|
|
@@ -15886,7 +15927,7 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15886
15927
|
\`\`\`book
|
|
15887
15928
|
Legal Assistant
|
|
15888
15929
|
|
|
15889
|
-
|
|
15930
|
+
GOAL Get expert software-development advice from the teammate when legal discussion needs technical context.
|
|
15890
15931
|
TEAM You can talk with http://localhost:4440/agents/GMw67JN8TXxN7y to discuss the legal aspects.
|
|
15891
15932
|
\`\`\`
|
|
15892
15933
|
`);
|
|
@@ -16312,7 +16353,7 @@ class TemplateCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
16312
16353
|
|
|
16313
16354
|
PERSONA You are a helpful customer support representative
|
|
16314
16355
|
TEMPLATE Always structure your response with: 1) Acknowledgment, 2) Solution, 3) Follow-up question
|
|
16315
|
-
|
|
16356
|
+
WRITING RULES Be professional and empathetic
|
|
16316
16357
|
\`\`\`
|
|
16317
16358
|
|
|
16318
16359
|
\`\`\`book
|
|
@@ -16756,7 +16797,7 @@ class UseBrowserCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
16756
16797
|
|
|
16757
16798
|
PERSONA You are a news analyst who stays up-to-date with current events
|
|
16758
16799
|
USE BROWSER
|
|
16759
|
-
|
|
16800
|
+
WRITING RULES Present news in a balanced and objective manner
|
|
16760
16801
|
ACTION Can search for and summarize news articles
|
|
16761
16802
|
\`\`\`
|
|
16762
16803
|
|
|
@@ -25054,7 +25095,7 @@ function parseParameters(text) {
|
|
|
25054
25095
|
function parseAgentSource(agentSource) {
|
|
25055
25096
|
const parseResult = parseAgentSourceWithCommitments(agentSource);
|
|
25056
25097
|
const resolvedAgentName = parseResult.agentName || createDefaultAgentName(agentSource);
|
|
25057
|
-
const personaDescription =
|
|
25098
|
+
const personaDescription = extractAgentProfileText(parseResult.commitments);
|
|
25058
25099
|
const initialMessage = extractInitialMessage(parseResult.commitments);
|
|
25059
25100
|
const parsedProfile = extractParsedAgentProfile(parseResult.commitments);
|
|
25060
25101
|
ensureMetaFullname(parsedProfile.meta, resolvedAgentName);
|
|
@@ -25158,25 +25199,33 @@ const META_COMMITMENT_APPLIERS = {
|
|
|
25158
25199
|
*/
|
|
25159
25200
|
const LOCAL_AGENT_REFERENCE_PREFIXES = ['./', '../', '/'];
|
|
25160
25201
|
/**
|
|
25161
|
-
*
|
|
25202
|
+
* Resolves the public agent profile text from the last GOAL/GOALS commitment,
|
|
25203
|
+
* falling back to the deprecated PERSONA/PERSONAE commitments when no goal exists.
|
|
25162
25204
|
*
|
|
25163
25205
|
* @private internal utility of `parseAgentSource`
|
|
25164
25206
|
*/
|
|
25165
|
-
function
|
|
25166
|
-
let
|
|
25207
|
+
function extractAgentProfileText(commitments) {
|
|
25208
|
+
let goalDescription = '';
|
|
25209
|
+
let hasGoalDescription = false;
|
|
25210
|
+
let personaDescription = '';
|
|
25211
|
+
let hasPersonaDescription = false;
|
|
25167
25212
|
for (const commitment of commitments) {
|
|
25168
|
-
if (commitment.type
|
|
25169
|
-
|
|
25213
|
+
if (commitment.type === 'GOAL' || commitment.type === 'GOALS') {
|
|
25214
|
+
goalDescription = commitment.content;
|
|
25215
|
+
hasGoalDescription = true;
|
|
25170
25216
|
}
|
|
25171
|
-
if (
|
|
25172
|
-
personaDescription =
|
|
25173
|
-
|
|
25174
|
-
else {
|
|
25175
|
-
personaDescription += `\n\n${personaDescription}`;
|
|
25217
|
+
if (commitment.type === 'PERSONA' || commitment.type === 'PERSONAE') {
|
|
25218
|
+
personaDescription = commitment.content;
|
|
25219
|
+
hasPersonaDescription = true;
|
|
25176
25220
|
}
|
|
25177
|
-
personaDescription += commitment.content;
|
|
25178
25221
|
}
|
|
25179
|
-
|
|
25222
|
+
if (hasGoalDescription) {
|
|
25223
|
+
return goalDescription;
|
|
25224
|
+
}
|
|
25225
|
+
if (hasPersonaDescription) {
|
|
25226
|
+
return personaDescription;
|
|
25227
|
+
}
|
|
25228
|
+
return null;
|
|
25180
25229
|
}
|
|
25181
25230
|
/**
|
|
25182
25231
|
* Resolves the last INITIAL MESSAGE commitment, which is the public initial-message value.
|
|
@@ -25858,6 +25907,15 @@ const COMMITMENTS_WITH_AGENT_REFERENCES = new Set(['FROM', 'IMPORT', 'IMPORTS',
|
|
|
25858
25907
|
* @private internal constant of `createAgentModelRequirementsWithCommitments`
|
|
25859
25908
|
*/
|
|
25860
25909
|
const DELETE_COMMITMENT_TYPES = new Set(['DELETE', 'CANCEL', 'DISCARD', 'REMOVE']);
|
|
25910
|
+
/**
|
|
25911
|
+
* Commitments whose earlier occurrences are overwritten by the last occurrence in source order.
|
|
25912
|
+
*
|
|
25913
|
+
* @private internal constant of `createAgentModelRequirementsWithCommitments`
|
|
25914
|
+
*/
|
|
25915
|
+
const OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE = new Map([
|
|
25916
|
+
['GOAL', 'GOAL'],
|
|
25917
|
+
['GOALS', 'GOAL'],
|
|
25918
|
+
]);
|
|
25861
25919
|
/**
|
|
25862
25920
|
* Regex pattern matching markdown horizontal lines that should not be copied into the final system message.
|
|
25863
25921
|
*
|
|
@@ -25908,7 +25966,7 @@ function getSafeReferenceCommitmentFallback(commitmentType, originalContent) {
|
|
|
25908
25966
|
*/
|
|
25909
25967
|
async function createAgentModelRequirementsWithCommitments(agentSource, modelName, options) {
|
|
25910
25968
|
const parseResult = parseAgentSourceWithCommitments(agentSource);
|
|
25911
|
-
const filteredCommitments = filterDeletedCommitments(parseResult.commitments);
|
|
25969
|
+
const filteredCommitments = filterOverwrittenCommitments(filterDeletedCommitments(parseResult.commitments));
|
|
25912
25970
|
let requirements = createInitialAgentModelRequirements(parseResult.agentName, modelName);
|
|
25913
25971
|
requirements = await applyCommitmentsToRequirements(requirements, filteredCommitments, options);
|
|
25914
25972
|
requirements = aggregateUseCommitmentSystemMessages(requirements, filteredCommitments);
|
|
@@ -25919,6 +25977,35 @@ async function createAgentModelRequirementsWithCommitments(agentSource, modelNam
|
|
|
25919
25977
|
requirements = await applyPendingInlineKnowledgeSources(requirements, options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader);
|
|
25920
25978
|
return finalizeRequirements(requirements);
|
|
25921
25979
|
}
|
|
25980
|
+
/**
|
|
25981
|
+
* Removes earlier commitments that are overwritten by later commitments of the same semantic group.
|
|
25982
|
+
*
|
|
25983
|
+
* This currently keeps only the last `GOAL` / `GOALS` commitment so inheritance rewrites
|
|
25984
|
+
* and multi-goal sources expose one effective goal to the runtime.
|
|
25985
|
+
*
|
|
25986
|
+
* @param commitments - Parsed commitments after DELETE-like filtering.
|
|
25987
|
+
* @returns Commitments with overwritten entries removed while preserving source order.
|
|
25988
|
+
*
|
|
25989
|
+
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
25990
|
+
*/
|
|
25991
|
+
function filterOverwrittenCommitments(commitments) {
|
|
25992
|
+
const seenOverwriteGroups = new Set();
|
|
25993
|
+
const keptCommitments = [];
|
|
25994
|
+
for (let index = commitments.length - 1; index >= 0; index--) {
|
|
25995
|
+
const commitment = commitments[index];
|
|
25996
|
+
const overwriteGroup = OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE.get(commitment.type);
|
|
25997
|
+
if (!overwriteGroup) {
|
|
25998
|
+
keptCommitments.push(commitment);
|
|
25999
|
+
continue;
|
|
26000
|
+
}
|
|
26001
|
+
if (seenOverwriteGroups.has(overwriteGroup)) {
|
|
26002
|
+
continue;
|
|
26003
|
+
}
|
|
26004
|
+
seenOverwriteGroups.add(overwriteGroup);
|
|
26005
|
+
keptCommitments.push(commitment);
|
|
26006
|
+
}
|
|
26007
|
+
return keptCommitments.reverse();
|
|
26008
|
+
}
|
|
25922
26009
|
/**
|
|
25923
26010
|
* Creates the initial requirements object with the parsed agent name stored in metadata and an optional model override.
|
|
25924
26011
|
*
|
|
@@ -26510,7 +26597,7 @@ async function createAgentModelRequirements(agentSource, modelName, availableMod
|
|
|
26510
26597
|
* Selects the best model using the preparePersona function
|
|
26511
26598
|
* This directly uses preparePersona to ensure DRY principle
|
|
26512
26599
|
*
|
|
26513
|
-
* @param agentSource The agent source to derive
|
|
26600
|
+
* @param agentSource The agent source to derive effective profile text from
|
|
26514
26601
|
* @param llmTools LLM tools for preparing persona
|
|
26515
26602
|
* @returns The name of the best selected model
|
|
26516
26603
|
*
|
|
@@ -26518,9 +26605,9 @@ async function createAgentModelRequirements(agentSource, modelName, availableMod
|
|
|
26518
26605
|
*/
|
|
26519
26606
|
async function selectBestModelUsingPersona(agentSource, llmTools) {
|
|
26520
26607
|
var _a;
|
|
26521
|
-
// Parse agent source to get
|
|
26608
|
+
// Parse agent source to get the effective profile description
|
|
26522
26609
|
const { agentName, personaDescription } = parseAgentSource(agentSource);
|
|
26523
|
-
// Use agent name as fallback if no
|
|
26610
|
+
// Use agent name as fallback if no profile description is available
|
|
26524
26611
|
const description = personaDescription || agentName || 'AI Agent';
|
|
26525
26612
|
try {
|
|
26526
26613
|
// Use preparePersona directly
|