@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
|
@@ -66,7 +66,8 @@ export type AgentBasicInformation = {
|
|
|
66
66
|
permanentId?: string_agent_permanent_id;
|
|
67
67
|
/**
|
|
68
68
|
* Optional description of the agent
|
|
69
|
-
* This is the
|
|
69
|
+
* This is derived from the last `GOAL` / `GOALS` commitment,
|
|
70
|
+
* falling back to deprecated `PERSONA` / `PERSONAE` for backward compatibility.
|
|
70
71
|
*/
|
|
71
72
|
personaDescription: string | null;
|
|
72
73
|
/**
|
|
@@ -9,7 +9,8 @@ export type TeammateProfile = {
|
|
|
9
9
|
*/
|
|
10
10
|
readonly agentName: string;
|
|
11
11
|
/**
|
|
12
|
-
* Short
|
|
12
|
+
* Short profile text for what the agent does, from the last GOAL commitment
|
|
13
|
+
* or deprecated PERSONA fallback.
|
|
13
14
|
*/
|
|
14
15
|
readonly personaDescription: string | null;
|
|
15
16
|
};
|
|
@@ -29,6 +29,13 @@ export declare class PersonaCommitmentDefinition extends BaseCommitmentDefinitio
|
|
|
29
29
|
* Short one-line description of PERSONA.
|
|
30
30
|
*/
|
|
31
31
|
get description(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Optional UI/docs-only deprecation metadata.
|
|
34
|
+
*/
|
|
35
|
+
get deprecation(): {
|
|
36
|
+
readonly message: "Use `GOAL` for agent profile text and inheritance-safe rewrites.";
|
|
37
|
+
readonly replacedBy: readonly ["GOAL"];
|
|
38
|
+
};
|
|
32
39
|
/**
|
|
33
40
|
* Icon for this commitment.
|
|
34
41
|
*/
|
package/esm/src/version.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.112.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.112.0-43`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-server",
|
|
3
|
-
"version": "0.112.0-
|
|
3
|
+
"version": "0.112.0-44",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"module": "./esm/index.es.js",
|
|
99
99
|
"typings": "./esm/typings/src/_packages/remote-server.index.d.ts",
|
|
100
100
|
"peerDependencies": {
|
|
101
|
-
"@promptbook/core": "0.112.0-
|
|
101
|
+
"@promptbook/core": "0.112.0-44"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
104
|
"@mozilla/readability": "0.6.0",
|
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-44';
|
|
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
|
|
@@ -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,9 +12236,7 @@
|
|
|
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
|
STYLE Use simple language and provide step-by-step explanations
|
|
12244
12242
|
\`\`\`
|
|
@@ -12246,9 +12244,7 @@
|
|
|
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
|
\`\`\`
|
|
@@ -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
|
|
@@ -15896,7 +15909,7 @@
|
|
|
15896
15909
|
\`\`\`book
|
|
15897
15910
|
Legal Assistant
|
|
15898
15911
|
|
|
15899
|
-
|
|
15912
|
+
GOAL Get expert software-development advice from the teammate when legal discussion needs technical context.
|
|
15900
15913
|
TEAM You can talk with http://localhost:4440/agents/GMw67JN8TXxN7y to discuss the legal aspects.
|
|
15901
15914
|
\`\`\`
|
|
15902
15915
|
`);
|
|
@@ -25064,7 +25077,7 @@
|
|
|
25064
25077
|
function parseAgentSource(agentSource) {
|
|
25065
25078
|
const parseResult = parseAgentSourceWithCommitments(agentSource);
|
|
25066
25079
|
const resolvedAgentName = parseResult.agentName || createDefaultAgentName(agentSource);
|
|
25067
|
-
const personaDescription =
|
|
25080
|
+
const personaDescription = extractAgentProfileText(parseResult.commitments);
|
|
25068
25081
|
const initialMessage = extractInitialMessage(parseResult.commitments);
|
|
25069
25082
|
const parsedProfile = extractParsedAgentProfile(parseResult.commitments);
|
|
25070
25083
|
ensureMetaFullname(parsedProfile.meta, resolvedAgentName);
|
|
@@ -25168,25 +25181,33 @@
|
|
|
25168
25181
|
*/
|
|
25169
25182
|
const LOCAL_AGENT_REFERENCE_PREFIXES = ['./', '../', '/'];
|
|
25170
25183
|
/**
|
|
25171
|
-
*
|
|
25184
|
+
* Resolves the public agent profile text from the last GOAL/GOALS commitment,
|
|
25185
|
+
* falling back to the deprecated PERSONA/PERSONAE commitments when no goal exists.
|
|
25172
25186
|
*
|
|
25173
25187
|
* @private internal utility of `parseAgentSource`
|
|
25174
25188
|
*/
|
|
25175
|
-
function
|
|
25176
|
-
let
|
|
25189
|
+
function extractAgentProfileText(commitments) {
|
|
25190
|
+
let goalDescription = '';
|
|
25191
|
+
let hasGoalDescription = false;
|
|
25192
|
+
let personaDescription = '';
|
|
25193
|
+
let hasPersonaDescription = false;
|
|
25177
25194
|
for (const commitment of commitments) {
|
|
25178
|
-
if (commitment.type
|
|
25179
|
-
|
|
25195
|
+
if (commitment.type === 'GOAL' || commitment.type === 'GOALS') {
|
|
25196
|
+
goalDescription = commitment.content;
|
|
25197
|
+
hasGoalDescription = true;
|
|
25180
25198
|
}
|
|
25181
|
-
if (
|
|
25182
|
-
personaDescription =
|
|
25199
|
+
if (commitment.type === 'PERSONA' || commitment.type === 'PERSONAE') {
|
|
25200
|
+
personaDescription = commitment.content;
|
|
25201
|
+
hasPersonaDescription = true;
|
|
25183
25202
|
}
|
|
25184
|
-
else {
|
|
25185
|
-
personaDescription += `\n\n${personaDescription}`;
|
|
25186
|
-
}
|
|
25187
|
-
personaDescription += commitment.content;
|
|
25188
25203
|
}
|
|
25189
|
-
|
|
25204
|
+
if (hasGoalDescription) {
|
|
25205
|
+
return goalDescription;
|
|
25206
|
+
}
|
|
25207
|
+
if (hasPersonaDescription) {
|
|
25208
|
+
return personaDescription;
|
|
25209
|
+
}
|
|
25210
|
+
return null;
|
|
25190
25211
|
}
|
|
25191
25212
|
/**
|
|
25192
25213
|
* Resolves the last INITIAL MESSAGE commitment, which is the public initial-message value.
|
|
@@ -25868,6 +25889,15 @@
|
|
|
25868
25889
|
* @private internal constant of `createAgentModelRequirementsWithCommitments`
|
|
25869
25890
|
*/
|
|
25870
25891
|
const DELETE_COMMITMENT_TYPES = new Set(['DELETE', 'CANCEL', 'DISCARD', 'REMOVE']);
|
|
25892
|
+
/**
|
|
25893
|
+
* Commitments whose earlier occurrences are overwritten by the last occurrence in source order.
|
|
25894
|
+
*
|
|
25895
|
+
* @private internal constant of `createAgentModelRequirementsWithCommitments`
|
|
25896
|
+
*/
|
|
25897
|
+
const OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE = new Map([
|
|
25898
|
+
['GOAL', 'GOAL'],
|
|
25899
|
+
['GOALS', 'GOAL'],
|
|
25900
|
+
]);
|
|
25871
25901
|
/**
|
|
25872
25902
|
* Regex pattern matching markdown horizontal lines that should not be copied into the final system message.
|
|
25873
25903
|
*
|
|
@@ -25918,7 +25948,7 @@
|
|
|
25918
25948
|
*/
|
|
25919
25949
|
async function createAgentModelRequirementsWithCommitments(agentSource, modelName, options) {
|
|
25920
25950
|
const parseResult = parseAgentSourceWithCommitments(agentSource);
|
|
25921
|
-
const filteredCommitments = filterDeletedCommitments(parseResult.commitments);
|
|
25951
|
+
const filteredCommitments = filterOverwrittenCommitments(filterDeletedCommitments(parseResult.commitments));
|
|
25922
25952
|
let requirements = createInitialAgentModelRequirements(parseResult.agentName, modelName);
|
|
25923
25953
|
requirements = await applyCommitmentsToRequirements(requirements, filteredCommitments, options);
|
|
25924
25954
|
requirements = aggregateUseCommitmentSystemMessages(requirements, filteredCommitments);
|
|
@@ -25929,6 +25959,35 @@
|
|
|
25929
25959
|
requirements = await applyPendingInlineKnowledgeSources(requirements, options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader);
|
|
25930
25960
|
return finalizeRequirements(requirements);
|
|
25931
25961
|
}
|
|
25962
|
+
/**
|
|
25963
|
+
* Removes earlier commitments that are overwritten by later commitments of the same semantic group.
|
|
25964
|
+
*
|
|
25965
|
+
* This currently keeps only the last `GOAL` / `GOALS` commitment so inheritance rewrites
|
|
25966
|
+
* and multi-goal sources expose one effective goal to the runtime.
|
|
25967
|
+
*
|
|
25968
|
+
* @param commitments - Parsed commitments after DELETE-like filtering.
|
|
25969
|
+
* @returns Commitments with overwritten entries removed while preserving source order.
|
|
25970
|
+
*
|
|
25971
|
+
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
25972
|
+
*/
|
|
25973
|
+
function filterOverwrittenCommitments(commitments) {
|
|
25974
|
+
const seenOverwriteGroups = new Set();
|
|
25975
|
+
const keptCommitments = [];
|
|
25976
|
+
for (let index = commitments.length - 1; index >= 0; index--) {
|
|
25977
|
+
const commitment = commitments[index];
|
|
25978
|
+
const overwriteGroup = OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE.get(commitment.type);
|
|
25979
|
+
if (!overwriteGroup) {
|
|
25980
|
+
keptCommitments.push(commitment);
|
|
25981
|
+
continue;
|
|
25982
|
+
}
|
|
25983
|
+
if (seenOverwriteGroups.has(overwriteGroup)) {
|
|
25984
|
+
continue;
|
|
25985
|
+
}
|
|
25986
|
+
seenOverwriteGroups.add(overwriteGroup);
|
|
25987
|
+
keptCommitments.push(commitment);
|
|
25988
|
+
}
|
|
25989
|
+
return keptCommitments.reverse();
|
|
25990
|
+
}
|
|
25932
25991
|
/**
|
|
25933
25992
|
* Creates the initial requirements object with the parsed agent name stored in metadata and an optional model override.
|
|
25934
25993
|
*
|
|
@@ -26520,7 +26579,7 @@
|
|
|
26520
26579
|
* Selects the best model using the preparePersona function
|
|
26521
26580
|
* This directly uses preparePersona to ensure DRY principle
|
|
26522
26581
|
*
|
|
26523
|
-
* @param agentSource The agent source to derive
|
|
26582
|
+
* @param agentSource The agent source to derive effective profile text from
|
|
26524
26583
|
* @param llmTools LLM tools for preparing persona
|
|
26525
26584
|
* @returns The name of the best selected model
|
|
26526
26585
|
*
|
|
@@ -26528,9 +26587,9 @@
|
|
|
26528
26587
|
*/
|
|
26529
26588
|
async function selectBestModelUsingPersona(agentSource, llmTools) {
|
|
26530
26589
|
var _a;
|
|
26531
|
-
// Parse agent source to get
|
|
26590
|
+
// Parse agent source to get the effective profile description
|
|
26532
26591
|
const { agentName, personaDescription } = parseAgentSource(agentSource);
|
|
26533
|
-
// Use agent name as fallback if no
|
|
26592
|
+
// Use agent name as fallback if no profile description is available
|
|
26534
26593
|
const description = personaDescription || agentName || 'AI Agent';
|
|
26535
26594
|
try {
|
|
26536
26595
|
// Use preparePersona directly
|