@promptbook/remote-server 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
|
@@ -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-44';
|
|
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
|
|
@@ -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,9 +12226,7 @@ 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
|
STYLE Use simple language and provide step-by-step explanations
|
|
12234
12232
|
\`\`\`
|
|
@@ -12236,9 +12234,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
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
|
\`\`\`
|
|
@@ -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
|
|
@@ -15886,7 +15899,7 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15886
15899
|
\`\`\`book
|
|
15887
15900
|
Legal Assistant
|
|
15888
15901
|
|
|
15889
|
-
|
|
15902
|
+
GOAL Get expert software-development advice from the teammate when legal discussion needs technical context.
|
|
15890
15903
|
TEAM You can talk with http://localhost:4440/agents/GMw67JN8TXxN7y to discuss the legal aspects.
|
|
15891
15904
|
\`\`\`
|
|
15892
15905
|
`);
|
|
@@ -25054,7 +25067,7 @@ function parseParameters(text) {
|
|
|
25054
25067
|
function parseAgentSource(agentSource) {
|
|
25055
25068
|
const parseResult = parseAgentSourceWithCommitments(agentSource);
|
|
25056
25069
|
const resolvedAgentName = parseResult.agentName || createDefaultAgentName(agentSource);
|
|
25057
|
-
const personaDescription =
|
|
25070
|
+
const personaDescription = extractAgentProfileText(parseResult.commitments);
|
|
25058
25071
|
const initialMessage = extractInitialMessage(parseResult.commitments);
|
|
25059
25072
|
const parsedProfile = extractParsedAgentProfile(parseResult.commitments);
|
|
25060
25073
|
ensureMetaFullname(parsedProfile.meta, resolvedAgentName);
|
|
@@ -25158,25 +25171,33 @@ const META_COMMITMENT_APPLIERS = {
|
|
|
25158
25171
|
*/
|
|
25159
25172
|
const LOCAL_AGENT_REFERENCE_PREFIXES = ['./', '../', '/'];
|
|
25160
25173
|
/**
|
|
25161
|
-
*
|
|
25174
|
+
* Resolves the public agent profile text from the last GOAL/GOALS commitment,
|
|
25175
|
+
* falling back to the deprecated PERSONA/PERSONAE commitments when no goal exists.
|
|
25162
25176
|
*
|
|
25163
25177
|
* @private internal utility of `parseAgentSource`
|
|
25164
25178
|
*/
|
|
25165
|
-
function
|
|
25166
|
-
let
|
|
25179
|
+
function extractAgentProfileText(commitments) {
|
|
25180
|
+
let goalDescription = '';
|
|
25181
|
+
let hasGoalDescription = false;
|
|
25182
|
+
let personaDescription = '';
|
|
25183
|
+
let hasPersonaDescription = false;
|
|
25167
25184
|
for (const commitment of commitments) {
|
|
25168
|
-
if (commitment.type
|
|
25169
|
-
|
|
25185
|
+
if (commitment.type === 'GOAL' || commitment.type === 'GOALS') {
|
|
25186
|
+
goalDescription = commitment.content;
|
|
25187
|
+
hasGoalDescription = true;
|
|
25170
25188
|
}
|
|
25171
|
-
if (
|
|
25172
|
-
personaDescription =
|
|
25189
|
+
if (commitment.type === 'PERSONA' || commitment.type === 'PERSONAE') {
|
|
25190
|
+
personaDescription = commitment.content;
|
|
25191
|
+
hasPersonaDescription = true;
|
|
25173
25192
|
}
|
|
25174
|
-
else {
|
|
25175
|
-
personaDescription += `\n\n${personaDescription}`;
|
|
25176
|
-
}
|
|
25177
|
-
personaDescription += commitment.content;
|
|
25178
25193
|
}
|
|
25179
|
-
|
|
25194
|
+
if (hasGoalDescription) {
|
|
25195
|
+
return goalDescription;
|
|
25196
|
+
}
|
|
25197
|
+
if (hasPersonaDescription) {
|
|
25198
|
+
return personaDescription;
|
|
25199
|
+
}
|
|
25200
|
+
return null;
|
|
25180
25201
|
}
|
|
25181
25202
|
/**
|
|
25182
25203
|
* Resolves the last INITIAL MESSAGE commitment, which is the public initial-message value.
|
|
@@ -25858,6 +25879,15 @@ const COMMITMENTS_WITH_AGENT_REFERENCES = new Set(['FROM', 'IMPORT', 'IMPORTS',
|
|
|
25858
25879
|
* @private internal constant of `createAgentModelRequirementsWithCommitments`
|
|
25859
25880
|
*/
|
|
25860
25881
|
const DELETE_COMMITMENT_TYPES = new Set(['DELETE', 'CANCEL', 'DISCARD', 'REMOVE']);
|
|
25882
|
+
/**
|
|
25883
|
+
* Commitments whose earlier occurrences are overwritten by the last occurrence in source order.
|
|
25884
|
+
*
|
|
25885
|
+
* @private internal constant of `createAgentModelRequirementsWithCommitments`
|
|
25886
|
+
*/
|
|
25887
|
+
const OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE = new Map([
|
|
25888
|
+
['GOAL', 'GOAL'],
|
|
25889
|
+
['GOALS', 'GOAL'],
|
|
25890
|
+
]);
|
|
25861
25891
|
/**
|
|
25862
25892
|
* Regex pattern matching markdown horizontal lines that should not be copied into the final system message.
|
|
25863
25893
|
*
|
|
@@ -25908,7 +25938,7 @@ function getSafeReferenceCommitmentFallback(commitmentType, originalContent) {
|
|
|
25908
25938
|
*/
|
|
25909
25939
|
async function createAgentModelRequirementsWithCommitments(agentSource, modelName, options) {
|
|
25910
25940
|
const parseResult = parseAgentSourceWithCommitments(agentSource);
|
|
25911
|
-
const filteredCommitments = filterDeletedCommitments(parseResult.commitments);
|
|
25941
|
+
const filteredCommitments = filterOverwrittenCommitments(filterDeletedCommitments(parseResult.commitments));
|
|
25912
25942
|
let requirements = createInitialAgentModelRequirements(parseResult.agentName, modelName);
|
|
25913
25943
|
requirements = await applyCommitmentsToRequirements(requirements, filteredCommitments, options);
|
|
25914
25944
|
requirements = aggregateUseCommitmentSystemMessages(requirements, filteredCommitments);
|
|
@@ -25919,6 +25949,35 @@ async function createAgentModelRequirementsWithCommitments(agentSource, modelNam
|
|
|
25919
25949
|
requirements = await applyPendingInlineKnowledgeSources(requirements, options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader);
|
|
25920
25950
|
return finalizeRequirements(requirements);
|
|
25921
25951
|
}
|
|
25952
|
+
/**
|
|
25953
|
+
* Removes earlier commitments that are overwritten by later commitments of the same semantic group.
|
|
25954
|
+
*
|
|
25955
|
+
* This currently keeps only the last `GOAL` / `GOALS` commitment so inheritance rewrites
|
|
25956
|
+
* and multi-goal sources expose one effective goal to the runtime.
|
|
25957
|
+
*
|
|
25958
|
+
* @param commitments - Parsed commitments after DELETE-like filtering.
|
|
25959
|
+
* @returns Commitments with overwritten entries removed while preserving source order.
|
|
25960
|
+
*
|
|
25961
|
+
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
25962
|
+
*/
|
|
25963
|
+
function filterOverwrittenCommitments(commitments) {
|
|
25964
|
+
const seenOverwriteGroups = new Set();
|
|
25965
|
+
const keptCommitments = [];
|
|
25966
|
+
for (let index = commitments.length - 1; index >= 0; index--) {
|
|
25967
|
+
const commitment = commitments[index];
|
|
25968
|
+
const overwriteGroup = OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE.get(commitment.type);
|
|
25969
|
+
if (!overwriteGroup) {
|
|
25970
|
+
keptCommitments.push(commitment);
|
|
25971
|
+
continue;
|
|
25972
|
+
}
|
|
25973
|
+
if (seenOverwriteGroups.has(overwriteGroup)) {
|
|
25974
|
+
continue;
|
|
25975
|
+
}
|
|
25976
|
+
seenOverwriteGroups.add(overwriteGroup);
|
|
25977
|
+
keptCommitments.push(commitment);
|
|
25978
|
+
}
|
|
25979
|
+
return keptCommitments.reverse();
|
|
25980
|
+
}
|
|
25922
25981
|
/**
|
|
25923
25982
|
* Creates the initial requirements object with the parsed agent name stored in metadata and an optional model override.
|
|
25924
25983
|
*
|
|
@@ -26510,7 +26569,7 @@ async function createAgentModelRequirements(agentSource, modelName, availableMod
|
|
|
26510
26569
|
* Selects the best model using the preparePersona function
|
|
26511
26570
|
* This directly uses preparePersona to ensure DRY principle
|
|
26512
26571
|
*
|
|
26513
|
-
* @param agentSource The agent source to derive
|
|
26572
|
+
* @param agentSource The agent source to derive effective profile text from
|
|
26514
26573
|
* @param llmTools LLM tools for preparing persona
|
|
26515
26574
|
* @returns The name of the best selected model
|
|
26516
26575
|
*
|
|
@@ -26518,9 +26577,9 @@ async function createAgentModelRequirements(agentSource, modelName, availableMod
|
|
|
26518
26577
|
*/
|
|
26519
26578
|
async function selectBestModelUsingPersona(agentSource, llmTools) {
|
|
26520
26579
|
var _a;
|
|
26521
|
-
// Parse agent source to get
|
|
26580
|
+
// Parse agent source to get the effective profile description
|
|
26522
26581
|
const { agentName, personaDescription } = parseAgentSource(agentSource);
|
|
26523
|
-
// Use agent name as fallback if no
|
|
26582
|
+
// Use agent name as fallback if no profile description is available
|
|
26524
26583
|
const description = personaDescription || agentName || 'AI Agent';
|
|
26525
26584
|
try {
|
|
26526
26585
|
// Use preparePersona directly
|