@promptbook/node 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.
@@ -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 line starting with "PERSONA"
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 description of what the agent does, from its PERSONA commitment.
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
  */
@@ -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-42`).
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/node",
3
- "version": "0.112.0-43",
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,
@@ -96,7 +96,7 @@
96
96
  "module": "./esm/index.es.js",
97
97
  "typings": "./esm/typings/src/_packages/node.index.d.ts",
98
98
  "peerDependencies": {
99
- "@promptbook/core": "0.112.0-43"
99
+ "@promptbook/core": "0.112.0-44"
100
100
  },
101
101
  "dependencies": {
102
102
  "@mozilla/readability": "0.6.0",
package/umd/index.umd.js CHANGED
@@ -48,7 +48,7 @@
48
48
  * @generated
49
49
  * @see https://github.com/webgptorg/promptbook
50
50
  */
51
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-43';
51
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-44';
52
52
  /**
53
53
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
54
54
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -15355,7 +15355,7 @@
15355
15355
  * Short one-line description of GOAL.
15356
15356
  */
15357
15357
  get description() {
15358
- return 'Define main **goals** the AI assistant should achieve, with later goals having higher priority.';
15358
+ return 'Define the effective agent **goal**; when multiple goals exist, only the last one stays effective.';
15359
15359
  }
15360
15360
  /**
15361
15361
  * Icon for this commitment.
@@ -15370,12 +15370,14 @@
15370
15370
  return _spaceTrim.spaceTrim(`
15371
15371
  # ${this.type}
15372
15372
 
15373
- Defines the main goal which should be achieved by the AI assistant. There can be multiple goals, and later goals are more important than earlier goals.
15373
+ Defines the main goal which should be achieved by the AI assistant.
15374
+ There can be multiple goals in source, but after inheritance/source rewriting only the last \`GOAL\` /\`GOALS\` remains effective.
15374
15375
 
15375
15376
  ## Key aspects
15376
15377
 
15377
15378
  - Both terms work identically and can be used interchangeably.
15378
- - Later goals have higher priority and can override earlier goals.
15379
+ - Later goals overwrite earlier goals.
15380
+ - The public agent profile text is derived from the last goal.
15379
15381
  - Goals provide clear direction and purpose for the agent's responses.
15380
15382
  - Goals influence decision-making and response prioritization.
15381
15383
 
@@ -15388,9 +15390,7 @@
15388
15390
  \`\`\`book
15389
15391
  Customer Support Agent
15390
15392
 
15391
- PERSONA You are a helpful customer support representative
15392
15393
  GOAL Resolve customer issues quickly and efficiently
15393
- GOAL Maintain high customer satisfaction scores
15394
15394
  GOAL Always follow company policies and procedures
15395
15395
  RULE Be polite and professional at all times
15396
15396
  \`\`\`
@@ -15398,9 +15398,7 @@
15398
15398
  \`\`\`book
15399
15399
  Educational Assistant
15400
15400
 
15401
- PERSONA You are an educational assistant specializing in mathematics
15402
15401
  GOAL Help students understand mathematical concepts clearly
15403
- GOAL Encourage critical thinking and problem-solving skills
15404
15402
  GOAL Ensure all explanations are age-appropriate and accessible
15405
15403
  STYLE Use simple language and provide step-by-step explanations
15406
15404
  \`\`\`
@@ -15408,9 +15406,7 @@
15408
15406
  \`\`\`book
15409
15407
  Safety-First Assistant
15410
15408
 
15411
- PERSONA You are a general-purpose AI assistant
15412
15409
  GOAL Be helpful and informative in all interactions
15413
- GOAL Provide accurate and reliable information
15414
15410
  GOAL Always prioritize user safety and ethical guidelines
15415
15411
  RULE Never provide harmful or dangerous advice
15416
15412
  \`\`\`
@@ -18269,7 +18265,16 @@
18269
18265
  * Short one-line description of PERSONA.
18270
18266
  */
18271
18267
  get description() {
18272
- return 'Define who the agent is: background, expertise, and personality.';
18268
+ return 'Deprecated legacy profile commitment. Prefer `GOAL` for agent profile text and inheritance-safe rewrites.';
18269
+ }
18270
+ /**
18271
+ * Optional UI/docs-only deprecation metadata.
18272
+ */
18273
+ get deprecation() {
18274
+ return {
18275
+ message: 'Use `GOAL` for agent profile text and inheritance-safe rewrites.',
18276
+ replacedBy: ['GOAL'],
18277
+ };
18273
18278
  }
18274
18279
  /**
18275
18280
  * Icon for this commitment.
@@ -18284,16 +18289,24 @@
18284
18289
  return _spaceTrim.spaceTrim(`
18285
18290
  # ${this.type}
18286
18291
 
18287
- Defines who the agent is, their background, expertise, and personality traits.
18292
+ Deprecated legacy commitment that defines who the agent is, their background, expertise, and personality traits.
18288
18293
 
18289
- ## Key aspects
18294
+ ## Migration
18290
18295
 
18291
- - Multiple \`PERSONA\` and \`PERSONAE\` commitments are merged together.
18292
- - Both terms work identically and can be used interchangeably.
18293
- - If they are in conflict, the last one takes precedence.
18294
- - You can write persona content in multiple lines.
18296
+ - Existing \`${this.type}\` books still parse and compile.
18297
+ - New books should prefer \`GOAL\`.
18298
+ - Agent profile rendering now prefers the last \`GOAL\` and only falls back to \`${this.type}\` when no goal exists.
18299
+ - Runtime compilation keeps the legacy multi-\`PERSONA\` merge behavior for backward compatibility.
18295
18300
 
18296
- ## Examples
18301
+ ## Preferred replacement
18302
+
18303
+ \`\`\`book
18304
+ Programming Assistant
18305
+
18306
+ GOAL Help the user solve programming problems with practical TypeScript and React guidance.
18307
+ \`\`\`
18308
+
18309
+ ## Legacy compatibility example
18297
18310
 
18298
18311
  \`\`\`book
18299
18312
  Programming Assistant
@@ -19058,7 +19071,7 @@
19058
19071
  \`\`\`book
19059
19072
  Legal Assistant
19060
19073
 
19061
- PERSONA An expert software developer
19074
+ GOAL Get expert software-development advice from the teammate when legal discussion needs technical context.
19062
19075
  TEAM You can talk with http://localhost:4440/agents/GMw67JN8TXxN7y to discuss the legal aspects.
19063
19076
  \`\`\`
19064
19077
  `);
@@ -28085,7 +28098,7 @@
28085
28098
  function parseAgentSource(agentSource) {
28086
28099
  const parseResult = parseAgentSourceWithCommitments(agentSource);
28087
28100
  const resolvedAgentName = parseResult.agentName || createDefaultAgentName(agentSource);
28088
- const personaDescription = extractPersonaDescription(parseResult.commitments);
28101
+ const personaDescription = extractAgentProfileText(parseResult.commitments);
28089
28102
  const initialMessage = extractInitialMessage(parseResult.commitments);
28090
28103
  const parsedProfile = extractParsedAgentProfile(parseResult.commitments);
28091
28104
  ensureMetaFullname(parsedProfile.meta, resolvedAgentName);
@@ -28189,25 +28202,33 @@
28189
28202
  */
28190
28203
  const LOCAL_AGENT_REFERENCE_PREFIXES = ['./', '../', '/'];
28191
28204
  /**
28192
- * Builds the combined persona description from PERSONA commitments.
28205
+ * Resolves the public agent profile text from the last GOAL/GOALS commitment,
28206
+ * falling back to the deprecated PERSONA/PERSONAE commitments when no goal exists.
28193
28207
  *
28194
28208
  * @private internal utility of `parseAgentSource`
28195
28209
  */
28196
- function extractPersonaDescription(commitments) {
28197
- let personaDescription = null;
28210
+ function extractAgentProfileText(commitments) {
28211
+ let goalDescription = '';
28212
+ let hasGoalDescription = false;
28213
+ let personaDescription = '';
28214
+ let hasPersonaDescription = false;
28198
28215
  for (const commitment of commitments) {
28199
- if (commitment.type !== 'PERSONA') {
28200
- continue;
28216
+ if (commitment.type === 'GOAL' || commitment.type === 'GOALS') {
28217
+ goalDescription = commitment.content;
28218
+ hasGoalDescription = true;
28201
28219
  }
28202
- if (personaDescription === null) {
28203
- personaDescription = '';
28220
+ if (commitment.type === 'PERSONA' || commitment.type === 'PERSONAE') {
28221
+ personaDescription = commitment.content;
28222
+ hasPersonaDescription = true;
28204
28223
  }
28205
- else {
28206
- personaDescription += `\n\n${personaDescription}`;
28207
- }
28208
- personaDescription += commitment.content;
28209
28224
  }
28210
- return personaDescription;
28225
+ if (hasGoalDescription) {
28226
+ return goalDescription;
28227
+ }
28228
+ if (hasPersonaDescription) {
28229
+ return personaDescription;
28230
+ }
28231
+ return null;
28211
28232
  }
28212
28233
  /**
28213
28234
  * Resolves the last INITIAL MESSAGE commitment, which is the public initial-message value.
@@ -28889,6 +28910,15 @@
28889
28910
  * @private internal constant of `createAgentModelRequirementsWithCommitments`
28890
28911
  */
28891
28912
  const DELETE_COMMITMENT_TYPES = new Set(['DELETE', 'CANCEL', 'DISCARD', 'REMOVE']);
28913
+ /**
28914
+ * Commitments whose earlier occurrences are overwritten by the last occurrence in source order.
28915
+ *
28916
+ * @private internal constant of `createAgentModelRequirementsWithCommitments`
28917
+ */
28918
+ const OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE = new Map([
28919
+ ['GOAL', 'GOAL'],
28920
+ ['GOALS', 'GOAL'],
28921
+ ]);
28892
28922
  /**
28893
28923
  * Regex pattern matching markdown horizontal lines that should not be copied into the final system message.
28894
28924
  *
@@ -28939,7 +28969,7 @@
28939
28969
  */
28940
28970
  async function createAgentModelRequirementsWithCommitments(agentSource, modelName, options) {
28941
28971
  const parseResult = parseAgentSourceWithCommitments(agentSource);
28942
- const filteredCommitments = filterDeletedCommitments(parseResult.commitments);
28972
+ const filteredCommitments = filterOverwrittenCommitments(filterDeletedCommitments(parseResult.commitments));
28943
28973
  let requirements = createInitialAgentModelRequirements(parseResult.agentName, modelName);
28944
28974
  requirements = await applyCommitmentsToRequirements(requirements, filteredCommitments, options);
28945
28975
  requirements = aggregateUseCommitmentSystemMessages(requirements, filteredCommitments);
@@ -28950,6 +28980,35 @@
28950
28980
  requirements = await applyPendingInlineKnowledgeSources(requirements, options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader);
28951
28981
  return finalizeRequirements(requirements);
28952
28982
  }
28983
+ /**
28984
+ * Removes earlier commitments that are overwritten by later commitments of the same semantic group.
28985
+ *
28986
+ * This currently keeps only the last `GOAL` / `GOALS` commitment so inheritance rewrites
28987
+ * and multi-goal sources expose one effective goal to the runtime.
28988
+ *
28989
+ * @param commitments - Parsed commitments after DELETE-like filtering.
28990
+ * @returns Commitments with overwritten entries removed while preserving source order.
28991
+ *
28992
+ * @private internal utility of `createAgentModelRequirementsWithCommitments`
28993
+ */
28994
+ function filterOverwrittenCommitments(commitments) {
28995
+ const seenOverwriteGroups = new Set();
28996
+ const keptCommitments = [];
28997
+ for (let index = commitments.length - 1; index >= 0; index--) {
28998
+ const commitment = commitments[index];
28999
+ const overwriteGroup = OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE.get(commitment.type);
29000
+ if (!overwriteGroup) {
29001
+ keptCommitments.push(commitment);
29002
+ continue;
29003
+ }
29004
+ if (seenOverwriteGroups.has(overwriteGroup)) {
29005
+ continue;
29006
+ }
29007
+ seenOverwriteGroups.add(overwriteGroup);
29008
+ keptCommitments.push(commitment);
29009
+ }
29010
+ return keptCommitments.reverse();
29011
+ }
28953
29012
  /**
28954
29013
  * Creates the initial requirements object with the parsed agent name stored in metadata and an optional model override.
28955
29014
  *
@@ -29541,7 +29600,7 @@
29541
29600
  * Selects the best model using the preparePersona function
29542
29601
  * This directly uses preparePersona to ensure DRY principle
29543
29602
  *
29544
- * @param agentSource The agent source to derive persona description from
29603
+ * @param agentSource The agent source to derive effective profile text from
29545
29604
  * @param llmTools LLM tools for preparing persona
29546
29605
  * @returns The name of the best selected model
29547
29606
  *
@@ -29549,9 +29608,9 @@
29549
29608
  */
29550
29609
  async function selectBestModelUsingPersona(agentSource, llmTools) {
29551
29610
  var _a;
29552
- // Parse agent source to get persona description
29611
+ // Parse agent source to get the effective profile description
29553
29612
  const { agentName, personaDescription } = parseAgentSource(agentSource);
29554
- // Use agent name as fallback if no persona description is available
29613
+ // Use agent name as fallback if no profile description is available
29555
29614
  const description = personaDescription || agentName || 'AI Agent';
29556
29615
  try {
29557
29616
  // Use preparePersona directly