@promptbook/wizard 0.112.0-43 → 0.112.0-44
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 +95 -36
- package/esm/index.es.js.map +1 -1
- 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/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +95 -36
- package/umd/index.umd.js.map +1 -1
- 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/version.d.ts +1 -1
package/esm/index.es.js
CHANGED
|
@@ -38,7 +38,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
38
38
|
* @generated
|
|
39
39
|
* @see https://github.com/webgptorg/promptbook
|
|
40
40
|
*/
|
|
41
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
41
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-44';
|
|
42
42
|
/**
|
|
43
43
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
44
44
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -19824,7 +19824,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
19824
19824
|
* Short one-line description of GOAL.
|
|
19825
19825
|
*/
|
|
19826
19826
|
get description() {
|
|
19827
|
-
return 'Define
|
|
19827
|
+
return 'Define the effective agent **goal**; when multiple goals exist, only the last one stays effective.';
|
|
19828
19828
|
}
|
|
19829
19829
|
/**
|
|
19830
19830
|
* Icon for this commitment.
|
|
@@ -19839,12 +19839,14 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
19839
19839
|
return spaceTrim$1(`
|
|
19840
19840
|
# ${this.type}
|
|
19841
19841
|
|
|
19842
|
-
Defines the main goal which should be achieved by the AI assistant.
|
|
19842
|
+
Defines the main goal which should be achieved by the AI assistant.
|
|
19843
|
+
There can be multiple goals in source, but after inheritance/source rewriting only the last \`GOAL\` /\`GOALS\` remains effective.
|
|
19843
19844
|
|
|
19844
19845
|
## Key aspects
|
|
19845
19846
|
|
|
19846
19847
|
- Both terms work identically and can be used interchangeably.
|
|
19847
|
-
- Later goals
|
|
19848
|
+
- Later goals overwrite earlier goals.
|
|
19849
|
+
- The public agent profile text is derived from the last goal.
|
|
19848
19850
|
- Goals provide clear direction and purpose for the agent's responses.
|
|
19849
19851
|
- Goals influence decision-making and response prioritization.
|
|
19850
19852
|
|
|
@@ -19857,9 +19859,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
19857
19859
|
\`\`\`book
|
|
19858
19860
|
Customer Support Agent
|
|
19859
19861
|
|
|
19860
|
-
PERSONA You are a helpful customer support representative
|
|
19861
19862
|
GOAL Resolve customer issues quickly and efficiently
|
|
19862
|
-
GOAL Maintain high customer satisfaction scores
|
|
19863
19863
|
GOAL Always follow company policies and procedures
|
|
19864
19864
|
RULE Be polite and professional at all times
|
|
19865
19865
|
\`\`\`
|
|
@@ -19867,9 +19867,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
19867
19867
|
\`\`\`book
|
|
19868
19868
|
Educational Assistant
|
|
19869
19869
|
|
|
19870
|
-
PERSONA You are an educational assistant specializing in mathematics
|
|
19871
19870
|
GOAL Help students understand mathematical concepts clearly
|
|
19872
|
-
GOAL Encourage critical thinking and problem-solving skills
|
|
19873
19871
|
GOAL Ensure all explanations are age-appropriate and accessible
|
|
19874
19872
|
STYLE Use simple language and provide step-by-step explanations
|
|
19875
19873
|
\`\`\`
|
|
@@ -19877,9 +19875,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
19877
19875
|
\`\`\`book
|
|
19878
19876
|
Safety-First Assistant
|
|
19879
19877
|
|
|
19880
|
-
PERSONA You are a general-purpose AI assistant
|
|
19881
19878
|
GOAL Be helpful and informative in all interactions
|
|
19882
|
-
GOAL Provide accurate and reliable information
|
|
19883
19879
|
GOAL Always prioritize user safety and ethical guidelines
|
|
19884
19880
|
RULE Never provide harmful or dangerous advice
|
|
19885
19881
|
\`\`\`
|
|
@@ -22498,7 +22494,16 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
22498
22494
|
* Short one-line description of PERSONA.
|
|
22499
22495
|
*/
|
|
22500
22496
|
get description() {
|
|
22501
|
-
return '
|
|
22497
|
+
return 'Deprecated legacy profile commitment. Prefer `GOAL` for agent profile text and inheritance-safe rewrites.';
|
|
22498
|
+
}
|
|
22499
|
+
/**
|
|
22500
|
+
* Optional UI/docs-only deprecation metadata.
|
|
22501
|
+
*/
|
|
22502
|
+
get deprecation() {
|
|
22503
|
+
return {
|
|
22504
|
+
message: 'Use `GOAL` for agent profile text and inheritance-safe rewrites.',
|
|
22505
|
+
replacedBy: ['GOAL'],
|
|
22506
|
+
};
|
|
22502
22507
|
}
|
|
22503
22508
|
/**
|
|
22504
22509
|
* Icon for this commitment.
|
|
@@ -22513,16 +22518,24 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
22513
22518
|
return spaceTrim$1(`
|
|
22514
22519
|
# ${this.type}
|
|
22515
22520
|
|
|
22516
|
-
|
|
22521
|
+
Deprecated legacy commitment that defines who the agent is, their background, expertise, and personality traits.
|
|
22517
22522
|
|
|
22518
|
-
##
|
|
22523
|
+
## Migration
|
|
22519
22524
|
|
|
22520
|
-
-
|
|
22521
|
-
-
|
|
22522
|
-
-
|
|
22523
|
-
-
|
|
22525
|
+
- Existing \`${this.type}\` books still parse and compile.
|
|
22526
|
+
- New books should prefer \`GOAL\`.
|
|
22527
|
+
- Agent profile rendering now prefers the last \`GOAL\` and only falls back to \`${this.type}\` when no goal exists.
|
|
22528
|
+
- Runtime compilation keeps the legacy multi-\`PERSONA\` merge behavior for backward compatibility.
|
|
22524
22529
|
|
|
22525
|
-
##
|
|
22530
|
+
## Preferred replacement
|
|
22531
|
+
|
|
22532
|
+
\`\`\`book
|
|
22533
|
+
Programming Assistant
|
|
22534
|
+
|
|
22535
|
+
GOAL Help the user solve programming problems with practical TypeScript and React guidance.
|
|
22536
|
+
\`\`\`
|
|
22537
|
+
|
|
22538
|
+
## Legacy compatibility example
|
|
22526
22539
|
|
|
22527
22540
|
\`\`\`book
|
|
22528
22541
|
Programming Assistant
|
|
@@ -23287,7 +23300,7 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
23287
23300
|
\`\`\`book
|
|
23288
23301
|
Legal Assistant
|
|
23289
23302
|
|
|
23290
|
-
|
|
23303
|
+
GOAL Get expert software-development advice from the teammate when legal discussion needs technical context.
|
|
23291
23304
|
TEAM You can talk with http://localhost:4440/agents/GMw67JN8TXxN7y to discuss the legal aspects.
|
|
23292
23305
|
\`\`\`
|
|
23293
23306
|
`);
|
|
@@ -30111,6 +30124,15 @@ const COMMITMENTS_WITH_AGENT_REFERENCES = new Set(['FROM', 'IMPORT', 'IMPORTS',
|
|
|
30111
30124
|
* @private internal constant of `createAgentModelRequirementsWithCommitments`
|
|
30112
30125
|
*/
|
|
30113
30126
|
const DELETE_COMMITMENT_TYPES = new Set(['DELETE', 'CANCEL', 'DISCARD', 'REMOVE']);
|
|
30127
|
+
/**
|
|
30128
|
+
* Commitments whose earlier occurrences are overwritten by the last occurrence in source order.
|
|
30129
|
+
*
|
|
30130
|
+
* @private internal constant of `createAgentModelRequirementsWithCommitments`
|
|
30131
|
+
*/
|
|
30132
|
+
const OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE = new Map([
|
|
30133
|
+
['GOAL', 'GOAL'],
|
|
30134
|
+
['GOALS', 'GOAL'],
|
|
30135
|
+
]);
|
|
30114
30136
|
/**
|
|
30115
30137
|
* Regex pattern matching markdown horizontal lines that should not be copied into the final system message.
|
|
30116
30138
|
*
|
|
@@ -30161,7 +30183,7 @@ function getSafeReferenceCommitmentFallback(commitmentType, originalContent) {
|
|
|
30161
30183
|
*/
|
|
30162
30184
|
async function createAgentModelRequirementsWithCommitments(agentSource, modelName, options) {
|
|
30163
30185
|
const parseResult = parseAgentSourceWithCommitments(agentSource);
|
|
30164
|
-
const filteredCommitments = filterDeletedCommitments(parseResult.commitments);
|
|
30186
|
+
const filteredCommitments = filterOverwrittenCommitments(filterDeletedCommitments(parseResult.commitments));
|
|
30165
30187
|
let requirements = createInitialAgentModelRequirements(parseResult.agentName, modelName);
|
|
30166
30188
|
requirements = await applyCommitmentsToRequirements(requirements, filteredCommitments, options);
|
|
30167
30189
|
requirements = aggregateUseCommitmentSystemMessages(requirements, filteredCommitments);
|
|
@@ -30172,6 +30194,35 @@ async function createAgentModelRequirementsWithCommitments(agentSource, modelNam
|
|
|
30172
30194
|
requirements = await applyPendingInlineKnowledgeSources(requirements, options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader);
|
|
30173
30195
|
return finalizeRequirements(requirements);
|
|
30174
30196
|
}
|
|
30197
|
+
/**
|
|
30198
|
+
* Removes earlier commitments that are overwritten by later commitments of the same semantic group.
|
|
30199
|
+
*
|
|
30200
|
+
* This currently keeps only the last `GOAL` / `GOALS` commitment so inheritance rewrites
|
|
30201
|
+
* and multi-goal sources expose one effective goal to the runtime.
|
|
30202
|
+
*
|
|
30203
|
+
* @param commitments - Parsed commitments after DELETE-like filtering.
|
|
30204
|
+
* @returns Commitments with overwritten entries removed while preserving source order.
|
|
30205
|
+
*
|
|
30206
|
+
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
30207
|
+
*/
|
|
30208
|
+
function filterOverwrittenCommitments(commitments) {
|
|
30209
|
+
const seenOverwriteGroups = new Set();
|
|
30210
|
+
const keptCommitments = [];
|
|
30211
|
+
for (let index = commitments.length - 1; index >= 0; index--) {
|
|
30212
|
+
const commitment = commitments[index];
|
|
30213
|
+
const overwriteGroup = OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE.get(commitment.type);
|
|
30214
|
+
if (!overwriteGroup) {
|
|
30215
|
+
keptCommitments.push(commitment);
|
|
30216
|
+
continue;
|
|
30217
|
+
}
|
|
30218
|
+
if (seenOverwriteGroups.has(overwriteGroup)) {
|
|
30219
|
+
continue;
|
|
30220
|
+
}
|
|
30221
|
+
seenOverwriteGroups.add(overwriteGroup);
|
|
30222
|
+
keptCommitments.push(commitment);
|
|
30223
|
+
}
|
|
30224
|
+
return keptCommitments.reverse();
|
|
30225
|
+
}
|
|
30175
30226
|
/**
|
|
30176
30227
|
* Creates the initial requirements object with the parsed agent name stored in metadata and an optional model override.
|
|
30177
30228
|
*
|
|
@@ -30814,7 +30865,7 @@ function createDefaultAgentName(agentSource) {
|
|
|
30814
30865
|
function parseAgentSource(agentSource) {
|
|
30815
30866
|
const parseResult = parseAgentSourceWithCommitments(agentSource);
|
|
30816
30867
|
const resolvedAgentName = parseResult.agentName || createDefaultAgentName(agentSource);
|
|
30817
|
-
const personaDescription =
|
|
30868
|
+
const personaDescription = extractAgentProfileText(parseResult.commitments);
|
|
30818
30869
|
const initialMessage = extractInitialMessage(parseResult.commitments);
|
|
30819
30870
|
const parsedProfile = extractParsedAgentProfile(parseResult.commitments);
|
|
30820
30871
|
ensureMetaFullname(parsedProfile.meta, resolvedAgentName);
|
|
@@ -30918,25 +30969,33 @@ const META_COMMITMENT_APPLIERS = {
|
|
|
30918
30969
|
*/
|
|
30919
30970
|
const LOCAL_AGENT_REFERENCE_PREFIXES = ['./', '../', '/'];
|
|
30920
30971
|
/**
|
|
30921
|
-
*
|
|
30972
|
+
* Resolves the public agent profile text from the last GOAL/GOALS commitment,
|
|
30973
|
+
* falling back to the deprecated PERSONA/PERSONAE commitments when no goal exists.
|
|
30922
30974
|
*
|
|
30923
30975
|
* @private internal utility of `parseAgentSource`
|
|
30924
30976
|
*/
|
|
30925
|
-
function
|
|
30926
|
-
let
|
|
30977
|
+
function extractAgentProfileText(commitments) {
|
|
30978
|
+
let goalDescription = '';
|
|
30979
|
+
let hasGoalDescription = false;
|
|
30980
|
+
let personaDescription = '';
|
|
30981
|
+
let hasPersonaDescription = false;
|
|
30927
30982
|
for (const commitment of commitments) {
|
|
30928
|
-
if (commitment.type
|
|
30929
|
-
|
|
30983
|
+
if (commitment.type === 'GOAL' || commitment.type === 'GOALS') {
|
|
30984
|
+
goalDescription = commitment.content;
|
|
30985
|
+
hasGoalDescription = true;
|
|
30930
30986
|
}
|
|
30931
|
-
if (
|
|
30932
|
-
personaDescription =
|
|
30987
|
+
if (commitment.type === 'PERSONA' || commitment.type === 'PERSONAE') {
|
|
30988
|
+
personaDescription = commitment.content;
|
|
30989
|
+
hasPersonaDescription = true;
|
|
30933
30990
|
}
|
|
30934
|
-
else {
|
|
30935
|
-
personaDescription += `\n\n${personaDescription}`;
|
|
30936
|
-
}
|
|
30937
|
-
personaDescription += commitment.content;
|
|
30938
30991
|
}
|
|
30939
|
-
|
|
30992
|
+
if (hasGoalDescription) {
|
|
30993
|
+
return goalDescription;
|
|
30994
|
+
}
|
|
30995
|
+
if (hasPersonaDescription) {
|
|
30996
|
+
return personaDescription;
|
|
30997
|
+
}
|
|
30998
|
+
return null;
|
|
30940
30999
|
}
|
|
30941
31000
|
/**
|
|
30942
31001
|
* Resolves the last INITIAL MESSAGE commitment, which is the public initial-message value.
|
|
@@ -31423,7 +31482,7 @@ async function createAgentModelRequirements(agentSource, modelName, availableMod
|
|
|
31423
31482
|
* Selects the best model using the preparePersona function
|
|
31424
31483
|
* This directly uses preparePersona to ensure DRY principle
|
|
31425
31484
|
*
|
|
31426
|
-
* @param agentSource The agent source to derive
|
|
31485
|
+
* @param agentSource The agent source to derive effective profile text from
|
|
31427
31486
|
* @param llmTools LLM tools for preparing persona
|
|
31428
31487
|
* @returns The name of the best selected model
|
|
31429
31488
|
*
|
|
@@ -31431,9 +31490,9 @@ async function createAgentModelRequirements(agentSource, modelName, availableMod
|
|
|
31431
31490
|
*/
|
|
31432
31491
|
async function selectBestModelUsingPersona(agentSource, llmTools) {
|
|
31433
31492
|
var _a;
|
|
31434
|
-
// Parse agent source to get
|
|
31493
|
+
// Parse agent source to get the effective profile description
|
|
31435
31494
|
const { agentName, personaDescription } = parseAgentSource(agentSource);
|
|
31436
|
-
// Use agent name as fallback if no
|
|
31495
|
+
// Use agent name as fallback if no profile description is available
|
|
31437
31496
|
const description = personaDescription || agentName || 'AI Agent';
|
|
31438
31497
|
try {
|
|
31439
31498
|
// Use preparePersona directly
|