@promptbook/wizard 0.103.0-51 → 0.103.0-52

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.
@@ -49,6 +49,7 @@ export type AgentBasicInformation = {
49
49
  * When there are multiple meta commitments of the same type, later overrides earlier
50
50
  */
51
51
  meta: {
52
+ fullname?: string;
52
53
  image?: string_url_image;
53
54
  color?: string_color;
54
55
  [key: string]: string | undefined;
@@ -7,7 +7,7 @@ import type { BookCommitment } from '../../commitments/_base/BookCommitment';
7
7
  *
8
8
  * @private - TODO: [🧠] Maybe should be public?
9
9
  */
10
- export declare function createCommitmentRegex(commitment: BookCommitment): RegExp;
10
+ export declare function createCommitmentRegex(commitment: BookCommitment, aliases?: BookCommitment[]): RegExp;
11
11
  /**
12
12
  * Generates a regex pattern to match a specific commitment type
13
13
  *
@@ -17,4 +17,4 @@ export declare function createCommitmentRegex(commitment: BookCommitment): RegEx
17
17
  *
18
18
  * @private
19
19
  */
20
- export declare function createCommitmentTypeRegex(commitment: BookCommitment): RegExp;
20
+ export declare function createCommitmentTypeRegex(commitment: BookCommitment, aliases?: BookCommitment[]): RegExp;
@@ -77,6 +77,12 @@ export type ChatProps = {
77
77
  * adding feature–specific controls (e.g. Pause / Resume in MockedChat).
78
78
  */
79
79
  readonly extraActions?: ReactNode;
80
+ /**
81
+ * Optional container to render the actions into (using React Portal).
82
+ * If provided, the actions toolbar will be rendered inside this element
83
+ * instead of its default position within the chat.
84
+ */
85
+ readonly actionsContainer?: HTMLElement | null;
80
86
  /**
81
87
  * Optional CSS class name which will be added to root <div/> element
82
88
  */
@@ -1,3 +1,4 @@
1
+ import type { AgentBasicInformation } from '../../book-2.0/agent-source/AgentBasicInformation';
1
2
  type PromptbookAgentProps = {
2
3
  /**
3
4
  * URL of the agent to connect to
@@ -5,6 +6,11 @@ type PromptbookAgentProps = {
5
6
  * @example "http://s6.ptbk.io/benjamin-white"
6
7
  */
7
8
  agentUrl: string;
9
+ /**
10
+ * Optional metadata to show before the agent is connected
11
+ * Or to override the agent metadata if the agent does not provide it
12
+ */
13
+ meta?: Partial<AgentBasicInformation['meta']>;
8
14
  /**
9
15
  * Callback when the window is opened or closed
10
16
  */
@@ -0,0 +1,38 @@
1
+ import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
2
+ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
3
+ /**
4
+ * META COLOR commitment definition
5
+ *
6
+ * The META COLOR commitment sets the agent's accent color.
7
+ * This commitment is special because it doesn't affect the system message,
8
+ * but is handled separately in the parsing logic.
9
+ *
10
+ * Example usage in agent source:
11
+ *
12
+ * ```book
13
+ * META COLOR #ff0000
14
+ * META COLOR #00ff00
15
+ * ```
16
+ *
17
+ * @private [🪔] Maybe export the commitments through some package
18
+ */
19
+ export declare class MetaColorCommitmentDefinition extends BaseCommitmentDefinition<'META COLOR'> {
20
+ constructor();
21
+ /**
22
+ * Short one-line description of META COLOR.
23
+ */
24
+ get description(): string;
25
+ /**
26
+ * Markdown documentation for META COLOR commitment.
27
+ */
28
+ get documentation(): string;
29
+ applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
30
+ /**
31
+ * Extracts the profile color from the content
32
+ * This is used by the parsing logic
33
+ */
34
+ extractProfileColor(content: string): string | null;
35
+ }
36
+ /**
37
+ * Note: [💞] Ignore a discrepancy between file name and entity name
38
+ */
@@ -8,7 +8,8 @@ import type { CommitmentDefinition } from './CommitmentDefinition';
8
8
  */
9
9
  export declare abstract class BaseCommitmentDefinition<TBookCommitment extends string> implements CommitmentDefinition {
10
10
  readonly type: TBookCommitment;
11
- constructor(type: TBookCommitment);
11
+ readonly aliases: string[];
12
+ constructor(type: TBookCommitment, aliases?: string[]);
12
13
  /**
13
14
  * Short one-line markdown description; concise, may use inline **markdown**.
14
15
  * Must be implemented by each concrete commitment.
@@ -9,6 +9,8 @@ import { MemoryCommitmentDefinition } from './MEMORY/MEMORY';
9
9
  import { InitialMessageCommitmentDefinition } from './MESSAGE/InitialMessageCommitmentDefinition';
10
10
  import { MessageCommitmentDefinition } from './MESSAGE/MESSAGE';
11
11
  import { MetaCommitmentDefinition } from './META/META';
12
+ import { MetaColorCommitmentDefinition } from './META_COLOR/META_COLOR';
13
+ import { MetaImageCommitmentDefinition } from './META_IMAGE/META_IMAGE';
12
14
  import { ModelCommitmentDefinition } from './MODEL/MODEL';
13
15
  import { NoteCommitmentDefinition } from './NOTE/NOTE';
14
16
  import { PersonaCommitmentDefinition } from './PERSONA/PERSONA';
@@ -24,7 +26,7 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
24
26
  *
25
27
  * @private Use functions to access commitments instead of this array directly
26
28
  */
27
- export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
29
+ export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
28
30
  /**
29
31
  * Gets a commitment definition by its type
30
32
  * @param type The commitment type to look up
@@ -45,6 +45,7 @@ export declare class Agent extends AgentLlmExecutionTools implements LlmExecutio
45
45
  * Metadata like image or color
46
46
  */
47
47
  meta: {
48
+ fullname?: string;
48
49
  image?: string_url_image;
49
50
  link?: string;
50
51
  title?: string;
@@ -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.103.0-50`).
18
+ * It follows semantic versioning (e.g., `0.103.0-51`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/wizard",
3
- "version": "0.103.0-51",
3
+ "version": "0.103.0-52",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -95,7 +95,7 @@
95
95
  "module": "./esm/index.es.js",
96
96
  "typings": "./esm/typings/src/_packages/wizard.index.d.ts",
97
97
  "peerDependencies": {
98
- "@promptbook/core": "0.103.0-51"
98
+ "@promptbook/core": "0.103.0-52"
99
99
  },
100
100
  "dependencies": {
101
101
  "@ai-sdk/deepseek": "0.1.17",
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.103.0-51';
51
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-52';
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
@@ -13430,9 +13430,13 @@
13430
13430
  *
13431
13431
  * @private - TODO: [🧠] Maybe should be public?
13432
13432
  */
13433
- function createCommitmentRegex(commitment) {
13434
- const escapedCommitment = commitment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
13435
- const keywordPattern = escapedCommitment.split(/\s+/).join('\\s+');
13433
+ function createCommitmentRegex(commitment, aliases = []) {
13434
+ const allCommitments = [commitment, ...aliases];
13435
+ const patterns = allCommitments.map((c) => {
13436
+ const escapedCommitment = c.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
13437
+ return escapedCommitment.split(/\s+/).join('\\s+');
13438
+ });
13439
+ const keywordPattern = patterns.join('|');
13436
13440
  const regex = new RegExp(`^\\s*(?<type>${keywordPattern})\\b\\s+(?<contents>.+)$`, 'gim');
13437
13441
  return regex;
13438
13442
  }
@@ -13445,9 +13449,13 @@
13445
13449
  *
13446
13450
  * @private
13447
13451
  */
13448
- function createCommitmentTypeRegex(commitment) {
13449
- const escapedCommitment = commitment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
13450
- const keywordPattern = escapedCommitment.split(/\s+/).join('\\s+');
13452
+ function createCommitmentTypeRegex(commitment, aliases = []) {
13453
+ const allCommitments = [commitment, ...aliases];
13454
+ const patterns = allCommitments.map((c) => {
13455
+ const escapedCommitment = c.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
13456
+ return escapedCommitment.split(/\s+/).join('\\s+');
13457
+ });
13458
+ const keywordPattern = patterns.join('|');
13451
13459
  const regex = new RegExp(`^\\s*(?<type>${keywordPattern})\\b`, 'gim');
13452
13460
  return regex;
13453
13461
  }
@@ -13459,22 +13467,23 @@
13459
13467
  * @private
13460
13468
  */
13461
13469
  class BaseCommitmentDefinition {
13462
- constructor(type) {
13470
+ constructor(type, aliases = []) {
13463
13471
  this.type = type;
13472
+ this.aliases = aliases;
13464
13473
  }
13465
13474
  /**
13466
13475
  * Creates a regex pattern to match this commitment in agent source
13467
13476
  * Uses the existing createCommitmentRegex function as internal helper
13468
13477
  */
13469
13478
  createRegex() {
13470
- return createCommitmentRegex(this.type);
13479
+ return createCommitmentRegex(this.type, this.aliases);
13471
13480
  }
13472
13481
  /**
13473
13482
  * Creates a regex pattern to match just the commitment type
13474
13483
  * Uses the existing createCommitmentTypeRegex function as internal helper
13475
13484
  */
13476
13485
  createTypeRegex() {
13477
- return createCommitmentTypeRegex(this.type);
13486
+ return createCommitmentTypeRegex(this.type, this.aliases);
13478
13487
  }
13479
13488
  /**
13480
13489
  * Helper method to create a new requirements object with updated system message
@@ -14386,6 +14395,165 @@
14386
14395
  * Note: [💞] Ignore a discrepancy between file name and entity name
14387
14396
  */
14388
14397
 
14398
+ /**
14399
+ * META COLOR commitment definition
14400
+ *
14401
+ * The META COLOR commitment sets the agent's accent color.
14402
+ * This commitment is special because it doesn't affect the system message,
14403
+ * but is handled separately in the parsing logic.
14404
+ *
14405
+ * Example usage in agent source:
14406
+ *
14407
+ * ```book
14408
+ * META COLOR #ff0000
14409
+ * META COLOR #00ff00
14410
+ * ```
14411
+ *
14412
+ * @private [🪔] Maybe export the commitments through some package
14413
+ */
14414
+ class MetaColorCommitmentDefinition extends BaseCommitmentDefinition {
14415
+ constructor() {
14416
+ super('META COLOR', ['COLOR']);
14417
+ }
14418
+ /**
14419
+ * Short one-line description of META COLOR.
14420
+ */
14421
+ get description() {
14422
+ return "Set the agent's accent color.";
14423
+ }
14424
+ /**
14425
+ * Markdown documentation for META COLOR commitment.
14426
+ */
14427
+ get documentation() {
14428
+ return spaceTrim.spaceTrim(`
14429
+ # META COLOR
14430
+
14431
+ Sets the agent's accent color.
14432
+
14433
+ ## Key aspects
14434
+
14435
+ - Does not modify the agent's behavior or responses.
14436
+ - Only one \`META COLOR\` should be used per agent.
14437
+ - If multiple are specified, the last one takes precedence.
14438
+ - Used for visual representation in user interfaces.
14439
+
14440
+ ## Examples
14441
+
14442
+ \`\`\`book
14443
+ Professional Assistant
14444
+
14445
+ META COLOR #3498db
14446
+ PERSONA You are a professional business assistant
14447
+ \`\`\`
14448
+
14449
+ \`\`\`book
14450
+ Creative Helper
14451
+
14452
+ META COLOR #e74c3c
14453
+ PERSONA You are a creative and inspiring assistant
14454
+ \`\`\`
14455
+ `);
14456
+ }
14457
+ applyToAgentModelRequirements(requirements, content) {
14458
+ // META COLOR doesn't modify the system message or model requirements
14459
+ // It's handled separately in the parsing logic for profile color extraction
14460
+ // This method exists for consistency with the CommitmentDefinition interface
14461
+ return requirements;
14462
+ }
14463
+ /**
14464
+ * Extracts the profile color from the content
14465
+ * This is used by the parsing logic
14466
+ */
14467
+ extractProfileColor(content) {
14468
+ const trimmedContent = content.trim();
14469
+ return trimmedContent || null;
14470
+ }
14471
+ }
14472
+ /**
14473
+ * Note: [💞] Ignore a discrepancy between file name and entity name
14474
+ */
14475
+
14476
+ /**
14477
+ * META IMAGE commitment definition
14478
+ *
14479
+ * The META IMAGE commitment sets the agent's avatar/profile image URL.
14480
+ * This commitment is special because it doesn't affect the system message,
14481
+ * but is handled separately in the parsing logic.
14482
+ *
14483
+ * Example usage in agent source:
14484
+ *
14485
+ * ```book
14486
+ * META IMAGE https://example.com/avatar.jpg
14487
+ * META IMAGE /assets/agent-avatar.png
14488
+ * ```
14489
+ *
14490
+ * @private [🪔] Maybe export the commitments through some package
14491
+ */
14492
+ class MetaImageCommitmentDefinition extends BaseCommitmentDefinition {
14493
+ constructor() {
14494
+ super('META IMAGE', ['IMAGE']);
14495
+ }
14496
+ /**
14497
+ * Short one-line description of META IMAGE.
14498
+ */
14499
+ get description() {
14500
+ return "Set the agent's profile image URL.";
14501
+ }
14502
+ /**
14503
+ * Markdown documentation for META IMAGE commitment.
14504
+ */
14505
+ get documentation() {
14506
+ return spaceTrim.spaceTrim(`
14507
+ # META IMAGE
14508
+
14509
+ Sets the agent's avatar/profile image URL.
14510
+
14511
+ ## Key aspects
14512
+
14513
+ - Does not modify the agent's behavior or responses.
14514
+ - Only one \`META IMAGE\` should be used per agent.
14515
+ - If multiple are specified, the last one takes precedence.
14516
+ - Used for visual representation in user interfaces.
14517
+
14518
+ ## Examples
14519
+
14520
+ \`\`\`book
14521
+ Professional Assistant
14522
+
14523
+ META IMAGE https://example.com/professional-avatar.jpg
14524
+ PERSONA You are a professional business assistant
14525
+ STYLE Maintain a formal and courteous tone
14526
+ \`\`\`
14527
+
14528
+ \`\`\`book
14529
+ Creative Helper
14530
+
14531
+ META IMAGE /assets/creative-bot-avatar.png
14532
+ PERSONA You are a creative and inspiring assistant
14533
+ STYLE Be enthusiastic and encouraging
14534
+ ACTION Can help with brainstorming and ideation
14535
+ \`\`\`
14536
+ `);
14537
+ }
14538
+ applyToAgentModelRequirements(requirements, content) {
14539
+ // META IMAGE doesn't modify the system message or model requirements
14540
+ // It's handled separately in the parsing logic for profile image extraction
14541
+ // This method exists for consistency with the CommitmentDefinition interface
14542
+ return requirements;
14543
+ }
14544
+ /**
14545
+ * Extracts the profile image URL from the content
14546
+ * This is used by the parsing logic
14547
+ */
14548
+ extractProfileImageUrl(content) {
14549
+ const trimmedContent = content.trim();
14550
+ return trimmedContent || null;
14551
+ }
14552
+ }
14553
+ /**
14554
+ * Note: [💞] Ignore a discrepancy between file name and entity name
14555
+ */
14556
+
14389
14557
  /**
14390
14558
  * MODEL commitment definition
14391
14559
  *
@@ -15293,6 +15461,8 @@
15293
15461
  new ModelCommitmentDefinition('MODELS'),
15294
15462
  new ActionCommitmentDefinition('ACTION'),
15295
15463
  new ActionCommitmentDefinition('ACTIONS'),
15464
+ new MetaImageCommitmentDefinition(),
15465
+ new MetaColorCommitmentDefinition(),
15296
15466
  new MetaCommitmentDefinition(),
15297
15467
  new NoteCommitmentDefinition('NOTE'),
15298
15468
  new NoteCommitmentDefinition('NOTES'),
@@ -16126,6 +16296,14 @@
16126
16296
  links.push(spaceTrim__default["default"](commitment.content));
16127
16297
  continue;
16128
16298
  }
16299
+ if (commitment.type === 'META IMAGE') {
16300
+ meta.image = spaceTrim__default["default"](commitment.content);
16301
+ continue;
16302
+ }
16303
+ if (commitment.type === 'META COLOR') {
16304
+ meta.color = spaceTrim__default["default"](commitment.content);
16305
+ continue;
16306
+ }
16129
16307
  if (commitment.type !== 'META') {
16130
16308
  continue;
16131
16309
  }
@@ -16141,6 +16319,10 @@
16141
16319
  if (!meta.image) {
16142
16320
  meta.image = generatePlaceholderAgentProfileImageUrl(parseResult.agentName || '!!');
16143
16321
  }
16322
+ // Generate fullname fallback if no meta fullname specified
16323
+ if (!meta.fullname) {
16324
+ meta.fullname = parseResult.agentName || createDefaultAgentName(agentSource);
16325
+ }
16144
16326
  // Parse parameters using unified approach - both @Parameter and {parameter} notations
16145
16327
  // are treated as the same syntax feature with unified representation
16146
16328
  const parameters = parseParameters(agentSource);