@promptbook/core 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 +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
|
@@ -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
|
|
@@ -8342,7 +8342,7 @@
|
|
|
8342
8342
|
DELETE Casual conversational style
|
|
8343
8343
|
REMOVE All emoji usage
|
|
8344
8344
|
GOAL Provide professional business communications
|
|
8345
|
-
|
|
8345
|
+
WRITING RULES Use formal language and proper business etiquette
|
|
8346
8346
|
\`\`\`
|
|
8347
8347
|
|
|
8348
8348
|
\`\`\`book
|
|
@@ -8353,7 +8353,7 @@
|
|
|
8353
8353
|
DISCARD Technical jargon explanations
|
|
8354
8354
|
CANCEL Advanced troubleshooting procedures
|
|
8355
8355
|
GOAL Help users with simple, easy-to-follow solutions
|
|
8356
|
-
|
|
8356
|
+
WRITING RULES Use plain language that anyone can understand
|
|
8357
8357
|
\`\`\`
|
|
8358
8358
|
|
|
8359
8359
|
\`\`\`book
|
|
@@ -8370,11 +8370,11 @@
|
|
|
8370
8370
|
Concise Information Provider
|
|
8371
8371
|
|
|
8372
8372
|
PERSONA You are a helpful assistant who provides detailed explanations
|
|
8373
|
-
|
|
8373
|
+
WRITING RULES Include examples, analogies, and comprehensive context
|
|
8374
8374
|
CANCEL Detailed explanation style
|
|
8375
8375
|
DISCARD Examples and analogies
|
|
8376
8376
|
GOAL Provide brief, direct answers without unnecessary elaboration
|
|
8377
|
-
|
|
8377
|
+
WRITING RULES Be concise and to the point
|
|
8378
8378
|
\`\`\`
|
|
8379
8379
|
`);
|
|
8380
8380
|
}
|
|
@@ -8558,7 +8558,7 @@
|
|
|
8558
8558
|
PERSONA You are a data analysis expert
|
|
8559
8559
|
FORMAT Present results in structured tables
|
|
8560
8560
|
FORMAT Include confidence scores for all predictions
|
|
8561
|
-
|
|
8561
|
+
WRITING RULES Be concise and precise in explanations
|
|
8562
8562
|
\`\`\`
|
|
8563
8563
|
`);
|
|
8564
8564
|
}
|
|
@@ -11409,7 +11409,7 @@
|
|
|
11409
11409
|
* Short one-line description of GOAL.
|
|
11410
11410
|
*/
|
|
11411
11411
|
get description() {
|
|
11412
|
-
return 'Define
|
|
11412
|
+
return 'Define the effective agent **goal**; when multiple goals exist, only the last one stays effective.';
|
|
11413
11413
|
}
|
|
11414
11414
|
/**
|
|
11415
11415
|
* Icon for this commitment.
|
|
@@ -11424,12 +11424,14 @@
|
|
|
11424
11424
|
return spacetrim.spaceTrim(`
|
|
11425
11425
|
# ${this.type}
|
|
11426
11426
|
|
|
11427
|
-
Defines the main goal which should be achieved by the AI assistant.
|
|
11427
|
+
Defines the main goal which should be achieved by the AI assistant.
|
|
11428
|
+
There can be multiple goals in source, but after inheritance/source rewriting only the last \`GOAL\` /\`GOALS\` remains effective.
|
|
11428
11429
|
|
|
11429
11430
|
## Key aspects
|
|
11430
11431
|
|
|
11431
11432
|
- Both terms work identically and can be used interchangeably.
|
|
11432
|
-
- Later goals
|
|
11433
|
+
- Later goals overwrite earlier goals.
|
|
11434
|
+
- The public agent profile text is derived from the last goal.
|
|
11433
11435
|
- Goals provide clear direction and purpose for the agent's responses.
|
|
11434
11436
|
- Goals influence decision-making and response prioritization.
|
|
11435
11437
|
|
|
@@ -11442,9 +11444,7 @@
|
|
|
11442
11444
|
\`\`\`book
|
|
11443
11445
|
Customer Support Agent
|
|
11444
11446
|
|
|
11445
|
-
PERSONA You are a helpful customer support representative
|
|
11446
11447
|
GOAL Resolve customer issues quickly and efficiently
|
|
11447
|
-
GOAL Maintain high customer satisfaction scores
|
|
11448
11448
|
GOAL Always follow company policies and procedures
|
|
11449
11449
|
RULE Be polite and professional at all times
|
|
11450
11450
|
\`\`\`
|
|
@@ -11452,19 +11452,15 @@
|
|
|
11452
11452
|
\`\`\`book
|
|
11453
11453
|
Educational Assistant
|
|
11454
11454
|
|
|
11455
|
-
PERSONA You are an educational assistant specializing in mathematics
|
|
11456
11455
|
GOAL Help students understand mathematical concepts clearly
|
|
11457
|
-
GOAL Encourage critical thinking and problem-solving skills
|
|
11458
11456
|
GOAL Ensure all explanations are age-appropriate and accessible
|
|
11459
|
-
|
|
11457
|
+
WRITING RULES Use simple language and provide step-by-step explanations
|
|
11460
11458
|
\`\`\`
|
|
11461
11459
|
|
|
11462
11460
|
\`\`\`book
|
|
11463
11461
|
Safety-First Assistant
|
|
11464
11462
|
|
|
11465
|
-
PERSONA You are a general-purpose AI assistant
|
|
11466
11463
|
GOAL Be helpful and informative in all interactions
|
|
11467
|
-
GOAL Provide accurate and reliable information
|
|
11468
11464
|
GOAL Always prioritize user safety and ethical guidelines
|
|
11469
11465
|
RULE Never provide harmful or dangerous advice
|
|
11470
11466
|
\`\`\`
|
|
@@ -11872,7 +11868,7 @@
|
|
|
11872
11868
|
KNOWLEDGE Academic research requires careful citation and verification
|
|
11873
11869
|
KNOWLEDGE https://example.com/research-guidelines.pdf
|
|
11874
11870
|
ACTION Can help with literature reviews and data analysis
|
|
11875
|
-
|
|
11871
|
+
WRITING RULES Present information in clear, academic format
|
|
11876
11872
|
\`\`\`
|
|
11877
11873
|
`);
|
|
11878
11874
|
}
|
|
@@ -13623,7 +13619,7 @@
|
|
|
13623
13619
|
|
|
13624
13620
|
META IMAGE https://example.com/professional-avatar.jpg
|
|
13625
13621
|
PERSONA You are a professional business assistant
|
|
13626
|
-
|
|
13622
|
+
WRITING RULES Maintain a formal and courteous tone
|
|
13627
13623
|
\`\`\`
|
|
13628
13624
|
|
|
13629
13625
|
\`\`\`book
|
|
@@ -13631,7 +13627,7 @@
|
|
|
13631
13627
|
|
|
13632
13628
|
META IMAGE /assets/creative-bot-avatar.png
|
|
13633
13629
|
PERSONA You are a creative and inspiring assistant
|
|
13634
|
-
|
|
13630
|
+
WRITING RULES Be enthusiastic and encouraging
|
|
13635
13631
|
ACTION Can help with brainstorming and ideation
|
|
13636
13632
|
\`\`\`
|
|
13637
13633
|
`);
|
|
@@ -13790,7 +13786,7 @@
|
|
|
13790
13786
|
META LINK https://twitter.com/devhandle
|
|
13791
13787
|
PERSONA You are an experienced open source developer
|
|
13792
13788
|
ACTION Can help with code reviews and architecture decisions
|
|
13793
|
-
|
|
13789
|
+
WRITING RULES Be direct and technical in explanations
|
|
13794
13790
|
\`\`\`
|
|
13795
13791
|
`);
|
|
13796
13792
|
}
|
|
@@ -13996,7 +13992,7 @@
|
|
|
13996
13992
|
MODEL TEMPERATURE 0.8
|
|
13997
13993
|
MODEL TOP_P 0.9
|
|
13998
13994
|
MODEL MAX_TOKENS 2048
|
|
13999
|
-
|
|
13995
|
+
WRITING RULES Be imaginative and expressive
|
|
14000
13996
|
ACTION Can help with storytelling and character development
|
|
14001
13997
|
\`\`\`
|
|
14002
13998
|
|
|
@@ -14208,7 +14204,7 @@
|
|
|
14208
14204
|
NOTE Uses RAG for accessing latest research papers
|
|
14209
14205
|
PERSONA You are a knowledgeable research assistant
|
|
14210
14206
|
ACTION Can help with literature reviews and citations
|
|
14211
|
-
|
|
14207
|
+
WRITING RULES Present information in academic format
|
|
14212
14208
|
\`\`\`
|
|
14213
14209
|
`);
|
|
14214
14210
|
}
|
|
@@ -14323,7 +14319,16 @@
|
|
|
14323
14319
|
* Short one-line description of PERSONA.
|
|
14324
14320
|
*/
|
|
14325
14321
|
get description() {
|
|
14326
|
-
return '
|
|
14322
|
+
return 'Deprecated legacy profile commitment. Prefer `GOAL` for agent profile text and inheritance-safe rewrites.';
|
|
14323
|
+
}
|
|
14324
|
+
/**
|
|
14325
|
+
* Optional UI/docs-only deprecation metadata.
|
|
14326
|
+
*/
|
|
14327
|
+
get deprecation() {
|
|
14328
|
+
return {
|
|
14329
|
+
message: 'Use `GOAL` for agent profile text and inheritance-safe rewrites.',
|
|
14330
|
+
replacedBy: ['GOAL'],
|
|
14331
|
+
};
|
|
14327
14332
|
}
|
|
14328
14333
|
/**
|
|
14329
14334
|
* Icon for this commitment.
|
|
@@ -14338,16 +14343,24 @@
|
|
|
14338
14343
|
return spacetrim.spaceTrim(`
|
|
14339
14344
|
# ${this.type}
|
|
14340
14345
|
|
|
14341
|
-
|
|
14346
|
+
Deprecated legacy commitment that defines who the agent is, their background, expertise, and personality traits.
|
|
14342
14347
|
|
|
14343
|
-
##
|
|
14348
|
+
## Migration
|
|
14344
14349
|
|
|
14345
|
-
-
|
|
14346
|
-
-
|
|
14347
|
-
-
|
|
14348
|
-
-
|
|
14350
|
+
- Existing \`${this.type}\` books still parse and compile.
|
|
14351
|
+
- New books should prefer \`GOAL\`.
|
|
14352
|
+
- Agent profile rendering now prefers the last \`GOAL\` and only falls back to \`${this.type}\` when no goal exists.
|
|
14353
|
+
- Runtime compilation keeps the legacy multi-\`PERSONA\` merge behavior for backward compatibility.
|
|
14349
14354
|
|
|
14350
|
-
##
|
|
14355
|
+
## Preferred replacement
|
|
14356
|
+
|
|
14357
|
+
\`\`\`book
|
|
14358
|
+
Programming Assistant
|
|
14359
|
+
|
|
14360
|
+
GOAL Help the user solve programming problems with practical TypeScript and React guidance.
|
|
14361
|
+
\`\`\`
|
|
14362
|
+
|
|
14363
|
+
## Legacy compatibility example
|
|
14351
14364
|
|
|
14352
14365
|
\`\`\`book
|
|
14353
14366
|
Programming Assistant
|
|
@@ -14485,7 +14498,7 @@
|
|
|
14485
14498
|
RULE Always ask for clarification if the user's request is ambiguous
|
|
14486
14499
|
RULE Be polite and professional in all interactions
|
|
14487
14500
|
RULES Never provide medical or legal advice
|
|
14488
|
-
|
|
14501
|
+
WRITING RULES Maintain a friendly and helpful tone
|
|
14489
14502
|
\`\`\`
|
|
14490
14503
|
|
|
14491
14504
|
\`\`\`book
|
|
@@ -14754,8 +14767,8 @@
|
|
|
14754
14767
|
/**
|
|
14755
14768
|
* STYLE commitment definition
|
|
14756
14769
|
*
|
|
14757
|
-
*
|
|
14758
|
-
*
|
|
14770
|
+
* Deprecated legacy writing-style commitment kept for backward compatibility.
|
|
14771
|
+
* New books should prefer `WRITING RULES` for writing-only constraints.
|
|
14759
14772
|
*
|
|
14760
14773
|
* Example usage in agent source:
|
|
14761
14774
|
*
|
|
@@ -14774,7 +14787,16 @@
|
|
|
14774
14787
|
* Short one-line description of STYLE.
|
|
14775
14788
|
*/
|
|
14776
14789
|
get description() {
|
|
14777
|
-
return '
|
|
14790
|
+
return 'Deprecated legacy writing-style commitment. Prefer `WRITING RULES` for new books.';
|
|
14791
|
+
}
|
|
14792
|
+
/**
|
|
14793
|
+
* Optional UI/docs-only deprecation metadata.
|
|
14794
|
+
*/
|
|
14795
|
+
get deprecation() {
|
|
14796
|
+
return {
|
|
14797
|
+
message: 'Use `WRITING RULES` for writing-only constraints such as tone, length, formatting, or emoji usage.',
|
|
14798
|
+
replacedBy: ['WRITING RULES'],
|
|
14799
|
+
};
|
|
14778
14800
|
}
|
|
14779
14801
|
/**
|
|
14780
14802
|
* Icon for this commitment.
|
|
@@ -14789,15 +14811,34 @@
|
|
|
14789
14811
|
return spacetrim.spaceTrim(`
|
|
14790
14812
|
# ${this.type}
|
|
14791
14813
|
|
|
14792
|
-
|
|
14814
|
+
Deprecated legacy commitment for writing and presentation instructions.
|
|
14815
|
+
|
|
14816
|
+
## Migration
|
|
14817
|
+
|
|
14818
|
+
- Existing \`${this.type}\` books still parse and compile.
|
|
14819
|
+
- New books should prefer \`WRITING RULES\`.
|
|
14820
|
+
- Use \`WRITING SAMPLE\` when you want to anchor voice by example instead of stating constraints directly.
|
|
14821
|
+
- The plural alias \`STYLES\` is the same legacy commitment family.
|
|
14793
14822
|
|
|
14794
14823
|
## Key aspects
|
|
14795
14824
|
|
|
14796
|
-
-
|
|
14825
|
+
- \`${this.type}\` remains functional for backward compatibility only.
|
|
14797
14826
|
- Later style instructions can override earlier ones.
|
|
14798
14827
|
- Style affects both tone and presentation format.
|
|
14799
14828
|
|
|
14800
|
-
##
|
|
14829
|
+
## Preferred replacement
|
|
14830
|
+
|
|
14831
|
+
\`\`\`book
|
|
14832
|
+
Technical Writer
|
|
14833
|
+
|
|
14834
|
+
GOAL Help the user understand technical topics with practical, accurate guidance.
|
|
14835
|
+
WRITING RULES Write in a professional but friendly tone.
|
|
14836
|
+
WRITING RULES Use bullet points for lists.
|
|
14837
|
+
WRITING RULES Always provide code examples when explaining programming concepts.
|
|
14838
|
+
FORMAT Use markdown formatting with clear headings
|
|
14839
|
+
\`\`\`
|
|
14840
|
+
|
|
14841
|
+
## Legacy compatibility examples
|
|
14801
14842
|
|
|
14802
14843
|
\`\`\`book
|
|
14803
14844
|
Technical Writer
|
|
@@ -15112,7 +15153,7 @@
|
|
|
15112
15153
|
\`\`\`book
|
|
15113
15154
|
Legal Assistant
|
|
15114
15155
|
|
|
15115
|
-
|
|
15156
|
+
GOAL Get expert software-development advice from the teammate when legal discussion needs technical context.
|
|
15116
15157
|
TEAM You can talk with http://localhost:4440/agents/GMw67JN8TXxN7y to discuss the legal aspects.
|
|
15117
15158
|
\`\`\`
|
|
15118
15159
|
`);
|
|
@@ -15538,7 +15579,7 @@
|
|
|
15538
15579
|
|
|
15539
15580
|
PERSONA You are a helpful customer support representative
|
|
15540
15581
|
TEMPLATE Always structure your response with: 1) Acknowledgment, 2) Solution, 3) Follow-up question
|
|
15541
|
-
|
|
15582
|
+
WRITING RULES Be professional and empathetic
|
|
15542
15583
|
\`\`\`
|
|
15543
15584
|
|
|
15544
15585
|
\`\`\`book
|
|
@@ -15982,7 +16023,7 @@
|
|
|
15982
16023
|
|
|
15983
16024
|
PERSONA You are a news analyst who stays up-to-date with current events
|
|
15984
16025
|
USE BROWSER
|
|
15985
|
-
|
|
16026
|
+
WRITING RULES Present news in a balanced and objective manner
|
|
15986
16027
|
ACTION Can search for and summarize news articles
|
|
15987
16028
|
\`\`\`
|
|
15988
16029
|
|
|
@@ -21983,6 +22024,15 @@
|
|
|
21983
22024
|
* @private internal constant of `createAgentModelRequirementsWithCommitments`
|
|
21984
22025
|
*/
|
|
21985
22026
|
const DELETE_COMMITMENT_TYPES = new Set(['DELETE', 'CANCEL', 'DISCARD', 'REMOVE']);
|
|
22027
|
+
/**
|
|
22028
|
+
* Commitments whose earlier occurrences are overwritten by the last occurrence in source order.
|
|
22029
|
+
*
|
|
22030
|
+
* @private internal constant of `createAgentModelRequirementsWithCommitments`
|
|
22031
|
+
*/
|
|
22032
|
+
const OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE = new Map([
|
|
22033
|
+
['GOAL', 'GOAL'],
|
|
22034
|
+
['GOALS', 'GOAL'],
|
|
22035
|
+
]);
|
|
21986
22036
|
/**
|
|
21987
22037
|
* Regex pattern matching markdown horizontal lines that should not be copied into the final system message.
|
|
21988
22038
|
*
|
|
@@ -22033,7 +22083,7 @@
|
|
|
22033
22083
|
*/
|
|
22034
22084
|
async function createAgentModelRequirementsWithCommitments(agentSource, modelName, options) {
|
|
22035
22085
|
const parseResult = parseAgentSourceWithCommitments(agentSource);
|
|
22036
|
-
const filteredCommitments = filterDeletedCommitments(parseResult.commitments);
|
|
22086
|
+
const filteredCommitments = filterOverwrittenCommitments(filterDeletedCommitments(parseResult.commitments));
|
|
22037
22087
|
let requirements = createInitialAgentModelRequirements(parseResult.agentName, modelName);
|
|
22038
22088
|
requirements = await applyCommitmentsToRequirements(requirements, filteredCommitments, options);
|
|
22039
22089
|
requirements = aggregateUseCommitmentSystemMessages(requirements, filteredCommitments);
|
|
@@ -22044,6 +22094,35 @@
|
|
|
22044
22094
|
requirements = await applyPendingInlineKnowledgeSources(requirements, options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader);
|
|
22045
22095
|
return finalizeRequirements(requirements);
|
|
22046
22096
|
}
|
|
22097
|
+
/**
|
|
22098
|
+
* Removes earlier commitments that are overwritten by later commitments of the same semantic group.
|
|
22099
|
+
*
|
|
22100
|
+
* This currently keeps only the last `GOAL` / `GOALS` commitment so inheritance rewrites
|
|
22101
|
+
* and multi-goal sources expose one effective goal to the runtime.
|
|
22102
|
+
*
|
|
22103
|
+
* @param commitments - Parsed commitments after DELETE-like filtering.
|
|
22104
|
+
* @returns Commitments with overwritten entries removed while preserving source order.
|
|
22105
|
+
*
|
|
22106
|
+
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
22107
|
+
*/
|
|
22108
|
+
function filterOverwrittenCommitments(commitments) {
|
|
22109
|
+
const seenOverwriteGroups = new Set();
|
|
22110
|
+
const keptCommitments = [];
|
|
22111
|
+
for (let index = commitments.length - 1; index >= 0; index--) {
|
|
22112
|
+
const commitment = commitments[index];
|
|
22113
|
+
const overwriteGroup = OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE.get(commitment.type);
|
|
22114
|
+
if (!overwriteGroup) {
|
|
22115
|
+
keptCommitments.push(commitment);
|
|
22116
|
+
continue;
|
|
22117
|
+
}
|
|
22118
|
+
if (seenOverwriteGroups.has(overwriteGroup)) {
|
|
22119
|
+
continue;
|
|
22120
|
+
}
|
|
22121
|
+
seenOverwriteGroups.add(overwriteGroup);
|
|
22122
|
+
keptCommitments.push(commitment);
|
|
22123
|
+
}
|
|
22124
|
+
return keptCommitments.reverse();
|
|
22125
|
+
}
|
|
22047
22126
|
/**
|
|
22048
22127
|
* Creates the initial requirements object with the parsed agent name stored in metadata and an optional model override.
|
|
22049
22128
|
*
|
|
@@ -22677,7 +22756,7 @@
|
|
|
22677
22756
|
function parseAgentSource(agentSource) {
|
|
22678
22757
|
const parseResult = parseAgentSourceWithCommitments(agentSource);
|
|
22679
22758
|
const resolvedAgentName = parseResult.agentName || createDefaultAgentName(agentSource);
|
|
22680
|
-
const personaDescription =
|
|
22759
|
+
const personaDescription = extractAgentProfileText(parseResult.commitments);
|
|
22681
22760
|
const initialMessage = extractInitialMessage(parseResult.commitments);
|
|
22682
22761
|
const parsedProfile = extractParsedAgentProfile(parseResult.commitments);
|
|
22683
22762
|
ensureMetaFullname(parsedProfile.meta, resolvedAgentName);
|
|
@@ -22781,25 +22860,33 @@
|
|
|
22781
22860
|
*/
|
|
22782
22861
|
const LOCAL_AGENT_REFERENCE_PREFIXES = ['./', '../', '/'];
|
|
22783
22862
|
/**
|
|
22784
|
-
*
|
|
22863
|
+
* Resolves the public agent profile text from the last GOAL/GOALS commitment,
|
|
22864
|
+
* falling back to the deprecated PERSONA/PERSONAE commitments when no goal exists.
|
|
22785
22865
|
*
|
|
22786
22866
|
* @private internal utility of `parseAgentSource`
|
|
22787
22867
|
*/
|
|
22788
|
-
function
|
|
22789
|
-
let
|
|
22868
|
+
function extractAgentProfileText(commitments) {
|
|
22869
|
+
let goalDescription = '';
|
|
22870
|
+
let hasGoalDescription = false;
|
|
22871
|
+
let personaDescription = '';
|
|
22872
|
+
let hasPersonaDescription = false;
|
|
22790
22873
|
for (const commitment of commitments) {
|
|
22791
|
-
if (commitment.type
|
|
22792
|
-
|
|
22793
|
-
|
|
22794
|
-
if (personaDescription === null) {
|
|
22795
|
-
personaDescription = '';
|
|
22874
|
+
if (commitment.type === 'GOAL' || commitment.type === 'GOALS') {
|
|
22875
|
+
goalDescription = commitment.content;
|
|
22876
|
+
hasGoalDescription = true;
|
|
22796
22877
|
}
|
|
22797
|
-
|
|
22798
|
-
personaDescription
|
|
22878
|
+
if (commitment.type === 'PERSONA' || commitment.type === 'PERSONAE') {
|
|
22879
|
+
personaDescription = commitment.content;
|
|
22880
|
+
hasPersonaDescription = true;
|
|
22799
22881
|
}
|
|
22800
|
-
personaDescription += commitment.content;
|
|
22801
22882
|
}
|
|
22802
|
-
|
|
22883
|
+
if (hasGoalDescription) {
|
|
22884
|
+
return goalDescription;
|
|
22885
|
+
}
|
|
22886
|
+
if (hasPersonaDescription) {
|
|
22887
|
+
return personaDescription;
|
|
22888
|
+
}
|
|
22889
|
+
return null;
|
|
22803
22890
|
}
|
|
22804
22891
|
/**
|
|
22805
22892
|
* Resolves the last INITIAL MESSAGE commitment, which is the public initial-message value.
|
|
@@ -23286,7 +23373,7 @@
|
|
|
23286
23373
|
* Selects the best model using the preparePersona function
|
|
23287
23374
|
* This directly uses preparePersona to ensure DRY principle
|
|
23288
23375
|
*
|
|
23289
|
-
* @param agentSource The agent source to derive
|
|
23376
|
+
* @param agentSource The agent source to derive effective profile text from
|
|
23290
23377
|
* @param llmTools LLM tools for preparing persona
|
|
23291
23378
|
* @returns The name of the best selected model
|
|
23292
23379
|
*
|
|
@@ -23294,9 +23381,9 @@
|
|
|
23294
23381
|
*/
|
|
23295
23382
|
async function selectBestModelUsingPersona(agentSource, llmTools) {
|
|
23296
23383
|
var _a;
|
|
23297
|
-
// Parse agent source to get
|
|
23384
|
+
// Parse agent source to get the effective profile description
|
|
23298
23385
|
const { agentName, personaDescription } = parseAgentSource(agentSource);
|
|
23299
|
-
// Use agent name as fallback if no
|
|
23386
|
+
// Use agent name as fallback if no profile description is available
|
|
23300
23387
|
const description = personaDescription || agentName || 'AI Agent';
|
|
23301
23388
|
try {
|
|
23302
23389
|
// Use preparePersona directly
|