@promptbook/wizard 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.
Files changed (35) hide show
  1. package/esm/index.es.js +144 -57
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/src/avatars/Avatar.d.ts +7 -0
  4. package/esm/src/avatars/avatarRenderingUtils.d.ts +117 -0
  5. package/esm/src/avatars/index.d.ts +6 -0
  6. package/esm/src/avatars/renderAvatarVisual.d.ts +9 -0
  7. package/esm/src/avatars/types/AvatarDefinition.d.ts +20 -0
  8. package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +96 -0
  9. package/esm/src/avatars/visuals/avatarVisualRegistry.d.ts +16 -0
  10. package/esm/src/avatars/visuals/minecraftAvatarVisual.d.ts +7 -0
  11. package/esm/src/avatars/visuals/octopusAvatarVisual.d.ts +7 -0
  12. package/esm/src/avatars/visuals/pixelArtAvatarVisual.d.ts +7 -0
  13. package/esm/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -1
  14. package/esm/src/book-2.0/agent-source/TeammateProfileResolver.d.ts +2 -1
  15. package/esm/src/commitments/PERSONA/PERSONA.d.ts +7 -0
  16. package/esm/src/commitments/STYLE/STYLE.d.ts +9 -2
  17. package/esm/src/version.d.ts +1 -1
  18. package/package.json +2 -2
  19. package/umd/index.umd.js +144 -57
  20. package/umd/index.umd.js.map +1 -1
  21. package/umd/src/avatars/Avatar.d.ts +7 -0
  22. package/umd/src/avatars/avatarRenderingUtils.d.ts +117 -0
  23. package/umd/src/avatars/index.d.ts +6 -0
  24. package/umd/src/avatars/renderAvatarVisual.d.ts +9 -0
  25. package/umd/src/avatars/types/AvatarDefinition.d.ts +20 -0
  26. package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +96 -0
  27. package/umd/src/avatars/visuals/avatarVisualRegistry.d.ts +16 -0
  28. package/umd/src/avatars/visuals/minecraftAvatarVisual.d.ts +7 -0
  29. package/umd/src/avatars/visuals/octopusAvatarVisual.d.ts +7 -0
  30. package/umd/src/avatars/visuals/pixelArtAvatarVisual.d.ts +7 -0
  31. package/umd/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -1
  32. package/umd/src/book-2.0/agent-source/TeammateProfileResolver.d.ts +2 -1
  33. package/umd/src/commitments/PERSONA/PERSONA.d.ts +7 -0
  34. package/umd/src/commitments/STYLE/STYLE.d.ts +9 -2
  35. package/umd/src/version.d.ts +1 -1
package/umd/index.umd.js CHANGED
@@ -49,7 +49,7 @@
49
49
  * @generated
50
50
  * @see https://github.com/webgptorg/promptbook
51
51
  */
52
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-43';
52
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-45';
53
53
  /**
54
54
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
55
55
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -19270,7 +19270,7 @@
19270
19270
  DELETE Casual conversational style
19271
19271
  REMOVE All emoji usage
19272
19272
  GOAL Provide professional business communications
19273
- STYLE Use formal language and proper business etiquette
19273
+ WRITING RULES Use formal language and proper business etiquette
19274
19274
  \`\`\`
19275
19275
 
19276
19276
  \`\`\`book
@@ -19281,7 +19281,7 @@
19281
19281
  DISCARD Technical jargon explanations
19282
19282
  CANCEL Advanced troubleshooting procedures
19283
19283
  GOAL Help users with simple, easy-to-follow solutions
19284
- STYLE Use plain language that anyone can understand
19284
+ WRITING RULES Use plain language that anyone can understand
19285
19285
  \`\`\`
19286
19286
 
19287
19287
  \`\`\`book
@@ -19298,11 +19298,11 @@
19298
19298
  Concise Information Provider
19299
19299
 
19300
19300
  PERSONA You are a helpful assistant who provides detailed explanations
19301
- STYLE Include examples, analogies, and comprehensive context
19301
+ WRITING RULES Include examples, analogies, and comprehensive context
19302
19302
  CANCEL Detailed explanation style
19303
19303
  DISCARD Examples and analogies
19304
19304
  GOAL Provide brief, direct answers without unnecessary elaboration
19305
- STYLE Be concise and to the point
19305
+ WRITING RULES Be concise and to the point
19306
19306
  \`\`\`
19307
19307
  `);
19308
19308
  }
@@ -19486,7 +19486,7 @@
19486
19486
  PERSONA You are a data analysis expert
19487
19487
  FORMAT Present results in structured tables
19488
19488
  FORMAT Include confidence scores for all predictions
19489
- STYLE Be concise and precise in explanations
19489
+ WRITING RULES Be concise and precise in explanations
19490
19490
  \`\`\`
19491
19491
  `);
19492
19492
  }
@@ -19835,7 +19835,7 @@
19835
19835
  * Short one-line description of GOAL.
19836
19836
  */
19837
19837
  get description() {
19838
- return 'Define main **goals** the AI assistant should achieve, with later goals having higher priority.';
19838
+ return 'Define the effective agent **goal**; when multiple goals exist, only the last one stays effective.';
19839
19839
  }
19840
19840
  /**
19841
19841
  * Icon for this commitment.
@@ -19850,12 +19850,14 @@
19850
19850
  return _spaceTrim.spaceTrim(`
19851
19851
  # ${this.type}
19852
19852
 
19853
- 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.
19853
+ Defines the main goal which should be achieved by the AI assistant.
19854
+ There can be multiple goals in source, but after inheritance/source rewriting only the last \`GOAL\` /\`GOALS\` remains effective.
19854
19855
 
19855
19856
  ## Key aspects
19856
19857
 
19857
19858
  - Both terms work identically and can be used interchangeably.
19858
- - Later goals have higher priority and can override earlier goals.
19859
+ - Later goals overwrite earlier goals.
19860
+ - The public agent profile text is derived from the last goal.
19859
19861
  - Goals provide clear direction and purpose for the agent's responses.
19860
19862
  - Goals influence decision-making and response prioritization.
19861
19863
 
@@ -19868,9 +19870,7 @@
19868
19870
  \`\`\`book
19869
19871
  Customer Support Agent
19870
19872
 
19871
- PERSONA You are a helpful customer support representative
19872
19873
  GOAL Resolve customer issues quickly and efficiently
19873
- GOAL Maintain high customer satisfaction scores
19874
19874
  GOAL Always follow company policies and procedures
19875
19875
  RULE Be polite and professional at all times
19876
19876
  \`\`\`
@@ -19878,19 +19878,15 @@
19878
19878
  \`\`\`book
19879
19879
  Educational Assistant
19880
19880
 
19881
- PERSONA You are an educational assistant specializing in mathematics
19882
19881
  GOAL Help students understand mathematical concepts clearly
19883
- GOAL Encourage critical thinking and problem-solving skills
19884
19882
  GOAL Ensure all explanations are age-appropriate and accessible
19885
- STYLE Use simple language and provide step-by-step explanations
19883
+ WRITING RULES Use simple language and provide step-by-step explanations
19886
19884
  \`\`\`
19887
19885
 
19888
19886
  \`\`\`book
19889
19887
  Safety-First Assistant
19890
19888
 
19891
- PERSONA You are a general-purpose AI assistant
19892
19889
  GOAL Be helpful and informative in all interactions
19893
- GOAL Provide accurate and reliable information
19894
19890
  GOAL Always prioritize user safety and ethical guidelines
19895
19891
  RULE Never provide harmful or dangerous advice
19896
19892
  \`\`\`
@@ -20162,7 +20158,7 @@
20162
20158
  KNOWLEDGE Academic research requires careful citation and verification
20163
20159
  KNOWLEDGE https://example.com/research-guidelines.pdf
20164
20160
  ACTION Can help with literature reviews and data analysis
20165
- STYLE Present information in clear, academic format
20161
+ WRITING RULES Present information in clear, academic format
20166
20162
  \`\`\`
20167
20163
  `);
20168
20164
  }
@@ -21809,7 +21805,7 @@
21809
21805
 
21810
21806
  META IMAGE https://example.com/professional-avatar.jpg
21811
21807
  PERSONA You are a professional business assistant
21812
- STYLE Maintain a formal and courteous tone
21808
+ WRITING RULES Maintain a formal and courteous tone
21813
21809
  \`\`\`
21814
21810
 
21815
21811
  \`\`\`book
@@ -21817,7 +21813,7 @@
21817
21813
 
21818
21814
  META IMAGE /assets/creative-bot-avatar.png
21819
21815
  PERSONA You are a creative and inspiring assistant
21820
- STYLE Be enthusiastic and encouraging
21816
+ WRITING RULES Be enthusiastic and encouraging
21821
21817
  ACTION Can help with brainstorming and ideation
21822
21818
  \`\`\`
21823
21819
  `);
@@ -21976,7 +21972,7 @@
21976
21972
  META LINK https://twitter.com/devhandle
21977
21973
  PERSONA You are an experienced open source developer
21978
21974
  ACTION Can help with code reviews and architecture decisions
21979
- STYLE Be direct and technical in explanations
21975
+ WRITING RULES Be direct and technical in explanations
21980
21976
  \`\`\`
21981
21977
  `);
21982
21978
  }
@@ -22182,7 +22178,7 @@
22182
22178
  MODEL TEMPERATURE 0.8
22183
22179
  MODEL TOP_P 0.9
22184
22180
  MODEL MAX_TOKENS 2048
22185
- STYLE Be imaginative and expressive
22181
+ WRITING RULES Be imaginative and expressive
22186
22182
  ACTION Can help with storytelling and character development
22187
22183
  \`\`\`
22188
22184
 
@@ -22394,7 +22390,7 @@
22394
22390
  NOTE Uses RAG for accessing latest research papers
22395
22391
  PERSONA You are a knowledgeable research assistant
22396
22392
  ACTION Can help with literature reviews and citations
22397
- STYLE Present information in academic format
22393
+ WRITING RULES Present information in academic format
22398
22394
  \`\`\`
22399
22395
  `);
22400
22396
  }
@@ -22509,7 +22505,16 @@
22509
22505
  * Short one-line description of PERSONA.
22510
22506
  */
22511
22507
  get description() {
22512
- return 'Define who the agent is: background, expertise, and personality.';
22508
+ return 'Deprecated legacy profile commitment. Prefer `GOAL` for agent profile text and inheritance-safe rewrites.';
22509
+ }
22510
+ /**
22511
+ * Optional UI/docs-only deprecation metadata.
22512
+ */
22513
+ get deprecation() {
22514
+ return {
22515
+ message: 'Use `GOAL` for agent profile text and inheritance-safe rewrites.',
22516
+ replacedBy: ['GOAL'],
22517
+ };
22513
22518
  }
22514
22519
  /**
22515
22520
  * Icon for this commitment.
@@ -22524,16 +22529,24 @@
22524
22529
  return _spaceTrim.spaceTrim(`
22525
22530
  # ${this.type}
22526
22531
 
22527
- Defines who the agent is, their background, expertise, and personality traits.
22532
+ Deprecated legacy commitment that defines who the agent is, their background, expertise, and personality traits.
22528
22533
 
22529
- ## Key aspects
22534
+ ## Migration
22530
22535
 
22531
- - Multiple \`PERSONA\` and \`PERSONAE\` commitments are merged together.
22532
- - Both terms work identically and can be used interchangeably.
22533
- - If they are in conflict, the last one takes precedence.
22534
- - You can write persona content in multiple lines.
22536
+ - Existing \`${this.type}\` books still parse and compile.
22537
+ - New books should prefer \`GOAL\`.
22538
+ - Agent profile rendering now prefers the last \`GOAL\` and only falls back to \`${this.type}\` when no goal exists.
22539
+ - Runtime compilation keeps the legacy multi-\`PERSONA\` merge behavior for backward compatibility.
22535
22540
 
22536
- ## Examples
22541
+ ## Preferred replacement
22542
+
22543
+ \`\`\`book
22544
+ Programming Assistant
22545
+
22546
+ GOAL Help the user solve programming problems with practical TypeScript and React guidance.
22547
+ \`\`\`
22548
+
22549
+ ## Legacy compatibility example
22537
22550
 
22538
22551
  \`\`\`book
22539
22552
  Programming Assistant
@@ -22671,7 +22684,7 @@
22671
22684
  RULE Always ask for clarification if the user's request is ambiguous
22672
22685
  RULE Be polite and professional in all interactions
22673
22686
  RULES Never provide medical or legal advice
22674
- STYLE Maintain a friendly and helpful tone
22687
+ WRITING RULES Maintain a friendly and helpful tone
22675
22688
  \`\`\`
22676
22689
 
22677
22690
  \`\`\`book
@@ -22940,8 +22953,8 @@
22940
22953
  /**
22941
22954
  * STYLE commitment definition
22942
22955
  *
22943
- * The STYLE commitment defines how the agent should format and present its responses.
22944
- * This includes tone, writing style, formatting preferences, and communication patterns.
22956
+ * Deprecated legacy writing-style commitment kept for backward compatibility.
22957
+ * New books should prefer `WRITING RULES` for writing-only constraints.
22945
22958
  *
22946
22959
  * Example usage in agent source:
22947
22960
  *
@@ -22960,7 +22973,16 @@
22960
22973
  * Short one-line description of STYLE.
22961
22974
  */
22962
22975
  get description() {
22963
- return 'Control the tone and writing style of responses.';
22976
+ return 'Deprecated legacy writing-style commitment. Prefer `WRITING RULES` for new books.';
22977
+ }
22978
+ /**
22979
+ * Optional UI/docs-only deprecation metadata.
22980
+ */
22981
+ get deprecation() {
22982
+ return {
22983
+ message: 'Use `WRITING RULES` for writing-only constraints such as tone, length, formatting, or emoji usage.',
22984
+ replacedBy: ['WRITING RULES'],
22985
+ };
22964
22986
  }
22965
22987
  /**
22966
22988
  * Icon for this commitment.
@@ -22975,15 +22997,34 @@
22975
22997
  return _spaceTrim.spaceTrim(`
22976
22998
  # ${this.type}
22977
22999
 
22978
- Defines how the agent should format and present its responses (tone, writing style, formatting).
23000
+ Deprecated legacy commitment for writing and presentation instructions.
23001
+
23002
+ ## Migration
23003
+
23004
+ - Existing \`${this.type}\` books still parse and compile.
23005
+ - New books should prefer \`WRITING RULES\`.
23006
+ - Use \`WRITING SAMPLE\` when you want to anchor voice by example instead of stating constraints directly.
23007
+ - The plural alias \`STYLES\` is the same legacy commitment family.
22979
23008
 
22980
23009
  ## Key aspects
22981
23010
 
22982
- - Both terms work identically and can be used interchangeably.
23011
+ - \`${this.type}\` remains functional for backward compatibility only.
22983
23012
  - Later style instructions can override earlier ones.
22984
23013
  - Style affects both tone and presentation format.
22985
23014
 
22986
- ## Examples
23015
+ ## Preferred replacement
23016
+
23017
+ \`\`\`book
23018
+ Technical Writer
23019
+
23020
+ GOAL Help the user understand technical topics with practical, accurate guidance.
23021
+ WRITING RULES Write in a professional but friendly tone.
23022
+ WRITING RULES Use bullet points for lists.
23023
+ WRITING RULES Always provide code examples when explaining programming concepts.
23024
+ FORMAT Use markdown formatting with clear headings
23025
+ \`\`\`
23026
+
23027
+ ## Legacy compatibility examples
22987
23028
 
22988
23029
  \`\`\`book
22989
23030
  Technical Writer
@@ -23298,7 +23339,7 @@
23298
23339
  \`\`\`book
23299
23340
  Legal Assistant
23300
23341
 
23301
- PERSONA An expert software developer
23342
+ GOAL Get expert software-development advice from the teammate when legal discussion needs technical context.
23302
23343
  TEAM You can talk with http://localhost:4440/agents/GMw67JN8TXxN7y to discuss the legal aspects.
23303
23344
  \`\`\`
23304
23345
  `);
@@ -23724,7 +23765,7 @@
23724
23765
 
23725
23766
  PERSONA You are a helpful customer support representative
23726
23767
  TEMPLATE Always structure your response with: 1) Acknowledgment, 2) Solution, 3) Follow-up question
23727
- STYLE Be professional and empathetic
23768
+ WRITING RULES Be professional and empathetic
23728
23769
  \`\`\`
23729
23770
 
23730
23771
  \`\`\`book
@@ -24168,7 +24209,7 @@
24168
24209
 
24169
24210
  PERSONA You are a news analyst who stays up-to-date with current events
24170
24211
  USE BROWSER
24171
- STYLE Present news in a balanced and objective manner
24212
+ WRITING RULES Present news in a balanced and objective manner
24172
24213
  ACTION Can search for and summarize news articles
24173
24214
  \`\`\`
24174
24215
 
@@ -30122,6 +30163,15 @@
30122
30163
  * @private internal constant of `createAgentModelRequirementsWithCommitments`
30123
30164
  */
30124
30165
  const DELETE_COMMITMENT_TYPES = new Set(['DELETE', 'CANCEL', 'DISCARD', 'REMOVE']);
30166
+ /**
30167
+ * Commitments whose earlier occurrences are overwritten by the last occurrence in source order.
30168
+ *
30169
+ * @private internal constant of `createAgentModelRequirementsWithCommitments`
30170
+ */
30171
+ const OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE = new Map([
30172
+ ['GOAL', 'GOAL'],
30173
+ ['GOALS', 'GOAL'],
30174
+ ]);
30125
30175
  /**
30126
30176
  * Regex pattern matching markdown horizontal lines that should not be copied into the final system message.
30127
30177
  *
@@ -30172,7 +30222,7 @@
30172
30222
  */
30173
30223
  async function createAgentModelRequirementsWithCommitments(agentSource, modelName, options) {
30174
30224
  const parseResult = parseAgentSourceWithCommitments(agentSource);
30175
- const filteredCommitments = filterDeletedCommitments(parseResult.commitments);
30225
+ const filteredCommitments = filterOverwrittenCommitments(filterDeletedCommitments(parseResult.commitments));
30176
30226
  let requirements = createInitialAgentModelRequirements(parseResult.agentName, modelName);
30177
30227
  requirements = await applyCommitmentsToRequirements(requirements, filteredCommitments, options);
30178
30228
  requirements = aggregateUseCommitmentSystemMessages(requirements, filteredCommitments);
@@ -30183,6 +30233,35 @@
30183
30233
  requirements = await applyPendingInlineKnowledgeSources(requirements, options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader);
30184
30234
  return finalizeRequirements(requirements);
30185
30235
  }
30236
+ /**
30237
+ * Removes earlier commitments that are overwritten by later commitments of the same semantic group.
30238
+ *
30239
+ * This currently keeps only the last `GOAL` / `GOALS` commitment so inheritance rewrites
30240
+ * and multi-goal sources expose one effective goal to the runtime.
30241
+ *
30242
+ * @param commitments - Parsed commitments after DELETE-like filtering.
30243
+ * @returns Commitments with overwritten entries removed while preserving source order.
30244
+ *
30245
+ * @private internal utility of `createAgentModelRequirementsWithCommitments`
30246
+ */
30247
+ function filterOverwrittenCommitments(commitments) {
30248
+ const seenOverwriteGroups = new Set();
30249
+ const keptCommitments = [];
30250
+ for (let index = commitments.length - 1; index >= 0; index--) {
30251
+ const commitment = commitments[index];
30252
+ const overwriteGroup = OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE.get(commitment.type);
30253
+ if (!overwriteGroup) {
30254
+ keptCommitments.push(commitment);
30255
+ continue;
30256
+ }
30257
+ if (seenOverwriteGroups.has(overwriteGroup)) {
30258
+ continue;
30259
+ }
30260
+ seenOverwriteGroups.add(overwriteGroup);
30261
+ keptCommitments.push(commitment);
30262
+ }
30263
+ return keptCommitments.reverse();
30264
+ }
30186
30265
  /**
30187
30266
  * Creates the initial requirements object with the parsed agent name stored in metadata and an optional model override.
30188
30267
  *
@@ -30825,7 +30904,7 @@
30825
30904
  function parseAgentSource(agentSource) {
30826
30905
  const parseResult = parseAgentSourceWithCommitments(agentSource);
30827
30906
  const resolvedAgentName = parseResult.agentName || createDefaultAgentName(agentSource);
30828
- const personaDescription = extractPersonaDescription(parseResult.commitments);
30907
+ const personaDescription = extractAgentProfileText(parseResult.commitments);
30829
30908
  const initialMessage = extractInitialMessage(parseResult.commitments);
30830
30909
  const parsedProfile = extractParsedAgentProfile(parseResult.commitments);
30831
30910
  ensureMetaFullname(parsedProfile.meta, resolvedAgentName);
@@ -30929,25 +31008,33 @@
30929
31008
  */
30930
31009
  const LOCAL_AGENT_REFERENCE_PREFIXES = ['./', '../', '/'];
30931
31010
  /**
30932
- * Builds the combined persona description from PERSONA commitments.
31011
+ * Resolves the public agent profile text from the last GOAL/GOALS commitment,
31012
+ * falling back to the deprecated PERSONA/PERSONAE commitments when no goal exists.
30933
31013
  *
30934
31014
  * @private internal utility of `parseAgentSource`
30935
31015
  */
30936
- function extractPersonaDescription(commitments) {
30937
- let personaDescription = null;
31016
+ function extractAgentProfileText(commitments) {
31017
+ let goalDescription = '';
31018
+ let hasGoalDescription = false;
31019
+ let personaDescription = '';
31020
+ let hasPersonaDescription = false;
30938
31021
  for (const commitment of commitments) {
30939
- if (commitment.type !== 'PERSONA') {
30940
- continue;
30941
- }
30942
- if (personaDescription === null) {
30943
- personaDescription = '';
31022
+ if (commitment.type === 'GOAL' || commitment.type === 'GOALS') {
31023
+ goalDescription = commitment.content;
31024
+ hasGoalDescription = true;
30944
31025
  }
30945
- else {
30946
- personaDescription += `\n\n${personaDescription}`;
31026
+ if (commitment.type === 'PERSONA' || commitment.type === 'PERSONAE') {
31027
+ personaDescription = commitment.content;
31028
+ hasPersonaDescription = true;
30947
31029
  }
30948
- personaDescription += commitment.content;
30949
31030
  }
30950
- return personaDescription;
31031
+ if (hasGoalDescription) {
31032
+ return goalDescription;
31033
+ }
31034
+ if (hasPersonaDescription) {
31035
+ return personaDescription;
31036
+ }
31037
+ return null;
30951
31038
  }
30952
31039
  /**
30953
31040
  * Resolves the last INITIAL MESSAGE commitment, which is the public initial-message value.
@@ -31434,7 +31521,7 @@
31434
31521
  * Selects the best model using the preparePersona function
31435
31522
  * This directly uses preparePersona to ensure DRY principle
31436
31523
  *
31437
- * @param agentSource The agent source to derive persona description from
31524
+ * @param agentSource The agent source to derive effective profile text from
31438
31525
  * @param llmTools LLM tools for preparing persona
31439
31526
  * @returns The name of the best selected model
31440
31527
  *
@@ -31442,9 +31529,9 @@
31442
31529
  */
31443
31530
  async function selectBestModelUsingPersona(agentSource, llmTools) {
31444
31531
  var _a;
31445
- // Parse agent source to get persona description
31532
+ // Parse agent source to get the effective profile description
31446
31533
  const { agentName, personaDescription } = parseAgentSource(agentSource);
31447
- // Use agent name as fallback if no persona description is available
31534
+ // Use agent name as fallback if no profile description is available
31448
31535
  const description = personaDescription || agentName || 'AI Agent';
31449
31536
  try {
31450
31537
  // Use preparePersona directly