@promptbook/browser 0.103.0-52 → 0.103.0-54

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 (46) hide show
  1. package/esm/index.es.js +261 -1
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/servers.d.ts +8 -1
  4. package/esm/typings/src/_packages/components.index.d.ts +2 -0
  5. package/esm/typings/src/_packages/core.index.d.ts +6 -0
  6. package/esm/typings/src/_packages/types.index.d.ts +2 -0
  7. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  8. package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +7 -0
  9. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +4 -0
  10. package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +12 -0
  11. package/esm/typings/src/book-components/icons/MicIcon.d.ts +8 -0
  12. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +17 -0
  13. package/esm/typings/src/commitments/ACTION/ACTION.d.ts +4 -0
  14. package/esm/typings/src/commitments/DELETE/DELETE.d.ts +4 -0
  15. package/esm/typings/src/commitments/FORMAT/FORMAT.d.ts +4 -0
  16. package/esm/typings/src/commitments/GOAL/GOAL.d.ts +4 -0
  17. package/esm/typings/src/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +4 -0
  18. package/esm/typings/src/commitments/MEMORY/MEMORY.d.ts +4 -0
  19. package/esm/typings/src/commitments/MESSAGE/AgentMessageCommitmentDefinition.d.ts +32 -0
  20. package/esm/typings/src/commitments/MESSAGE/InitialMessageCommitmentDefinition.d.ts +4 -0
  21. package/esm/typings/src/commitments/MESSAGE/MESSAGE.d.ts +4 -0
  22. package/esm/typings/src/commitments/MESSAGE/UserMessageCommitmentDefinition.d.ts +32 -0
  23. package/esm/typings/src/commitments/META/META.d.ts +4 -0
  24. package/esm/typings/src/commitments/META_COLOR/META_COLOR.d.ts +4 -0
  25. package/esm/typings/src/commitments/META_IMAGE/META_IMAGE.d.ts +4 -0
  26. package/esm/typings/src/commitments/META_LINK/META_LINK.d.ts +4 -0
  27. package/esm/typings/src/commitments/MODEL/MODEL.d.ts +4 -0
  28. package/esm/typings/src/commitments/NOTE/NOTE.d.ts +4 -0
  29. package/esm/typings/src/commitments/PERSONA/PERSONA.d.ts +4 -0
  30. package/esm/typings/src/commitments/RULE/RULE.d.ts +4 -0
  31. package/esm/typings/src/commitments/SAMPLE/SAMPLE.d.ts +4 -0
  32. package/esm/typings/src/commitments/SCENARIO/SCENARIO.d.ts +4 -0
  33. package/esm/typings/src/commitments/STYLE/STYLE.d.ts +4 -0
  34. package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +5 -0
  35. package/esm/typings/src/commitments/_base/CommitmentDefinition.d.ts +5 -0
  36. package/esm/typings/src/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +4 -0
  37. package/esm/typings/src/commitments/index.d.ts +20 -1
  38. package/esm/typings/src/execution/LlmExecutionTools.d.ts +9 -0
  39. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +2 -1
  40. package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +10 -1
  41. package/esm/typings/src/utils/normalization/normalizeMessageText.d.ts +9 -0
  42. package/esm/typings/src/utils/normalization/normalizeMessageText.test.d.ts +1 -0
  43. package/esm/typings/src/version.d.ts +1 -1
  44. package/package.json +2 -2
  45. package/umd/index.umd.js +261 -1
  46. package/umd/index.umd.js.map +1 -1
package/esm/index.es.js CHANGED
@@ -19,7 +19,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
19
19
  * @generated
20
20
  * @see https://github.com/webgptorg/promptbook
21
21
  */
22
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-52';
22
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-54';
23
23
  /**
24
24
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
25
25
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2783,6 +2783,12 @@ class ActionCommitmentDefinition extends BaseCommitmentDefinition {
2783
2783
  get description() {
2784
2784
  return 'Define agent capabilities and actions it can perform.';
2785
2785
  }
2786
+ /**
2787
+ * Icon for this commitment.
2788
+ */
2789
+ get icon() {
2790
+ return '⚡';
2791
+ }
2786
2792
  /**
2787
2793
  * Markdown documentation for ACTION commitment.
2788
2794
  */
@@ -2862,6 +2868,12 @@ class DeleteCommitmentDefinition extends BaseCommitmentDefinition {
2862
2868
  get description() {
2863
2869
  return 'Remove or **disregard** certain information, context, or previous commitments.';
2864
2870
  }
2871
+ /**
2872
+ * Icon for this commitment.
2873
+ */
2874
+ get icon() {
2875
+ return 'đŸ—‘ī¸';
2876
+ }
2865
2877
  /**
2866
2878
  * Markdown documentation for DELETE commitment.
2867
2879
  */
@@ -2978,6 +2990,12 @@ class FormatCommitmentDefinition extends BaseCommitmentDefinition {
2978
2990
  get description() {
2979
2991
  return 'Specify output structure or formatting requirements.';
2980
2992
  }
2993
+ /**
2994
+ * Icon for this commitment.
2995
+ */
2996
+ get icon() {
2997
+ return '📜';
2998
+ }
2981
2999
  /**
2982
3000
  * Markdown documentation for FORMAT commitment.
2983
3001
  */
@@ -3053,6 +3071,12 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
3053
3071
  get description() {
3054
3072
  return 'Define main **goals** the AI assistant should achieve, with later goals having higher priority.';
3055
3073
  }
3074
+ /**
3075
+ * Icon for this commitment.
3076
+ */
3077
+ get icon() {
3078
+ return 'đŸŽ¯';
3079
+ }
3056
3080
  /**
3057
3081
  * Markdown documentation for GOAL commitment.
3058
3082
  */
@@ -3149,6 +3173,12 @@ class KnowledgeCommitmentDefinition extends BaseCommitmentDefinition {
3149
3173
  get description() {
3150
3174
  return 'Add domain **knowledge** via direct text or external sources (RAG).';
3151
3175
  }
3176
+ /**
3177
+ * Icon for this commitment.
3178
+ */
3179
+ get icon() {
3180
+ return '🧠';
3181
+ }
3152
3182
  /**
3153
3183
  * Markdown documentation for KNOWLEDGE commitment.
3154
3184
  */
@@ -3250,6 +3280,12 @@ class MemoryCommitmentDefinition extends BaseCommitmentDefinition {
3250
3280
  get description() {
3251
3281
  return 'Remember past interactions and user **preferences** for personalized responses.';
3252
3282
  }
3283
+ /**
3284
+ * Icon for this commitment.
3285
+ */
3286
+ get icon() {
3287
+ return '🧠';
3288
+ }
3253
3289
  /**
3254
3290
  * Markdown documentation for MEMORY commitment.
3255
3291
  */
@@ -3324,6 +3360,83 @@ class MemoryCommitmentDefinition extends BaseCommitmentDefinition {
3324
3360
  * Note: [💞] Ignore a discrepancy between file name and entity name
3325
3361
  */
3326
3362
 
3363
+ /**
3364
+ * AGENT MESSAGE commitment definition
3365
+ *
3366
+ * The AGENT MESSAGE commitment defines a message from the agent in the conversation history.
3367
+ * It is used to pre-fill the chat with a conversation history or to provide few-shot examples.
3368
+ *
3369
+ * Example usage in agent source:
3370
+ *
3371
+ * ```book
3372
+ * AGENT MESSAGE What seems to be the issue?
3373
+ * ```
3374
+ *
3375
+ * @private [đŸĒ”] Maybe export the commitments through some package
3376
+ */
3377
+ class AgentMessageCommitmentDefinition extends BaseCommitmentDefinition {
3378
+ constructor() {
3379
+ super('AGENT MESSAGE');
3380
+ }
3381
+ /**
3382
+ * Short one-line description of AGENT MESSAGE.
3383
+ */
3384
+ get description() {
3385
+ return 'Defines a **message from the agent** in the conversation history.';
3386
+ }
3387
+ /**
3388
+ * Icon for this commitment.
3389
+ */
3390
+ get icon() {
3391
+ return '🤖';
3392
+ }
3393
+ /**
3394
+ * Markdown documentation for AGENT MESSAGE commitment.
3395
+ */
3396
+ get documentation() {
3397
+ return spaceTrim(`
3398
+ # ${this.type}
3399
+
3400
+ Defines a message from the agent in the conversation history. This is used to pre-fill the chat with a conversation history or to provide few-shot examples.
3401
+
3402
+ ## Key aspects
3403
+
3404
+ - Represents a message sent by the agent.
3405
+ - Used for setting up conversation context.
3406
+ - Can be used in conjunction with USER MESSAGE.
3407
+
3408
+ ## Examples
3409
+
3410
+ \`\`\`book
3411
+ Conversation History
3412
+
3413
+ USER MESSAGE Hello, I have a problem.
3414
+ AGENT MESSAGE What seems to be the issue?
3415
+ USER MESSAGE My computer is not starting.
3416
+ \`\`\`
3417
+ `);
3418
+ }
3419
+ applyToAgentModelRequirements(requirements, content) {
3420
+ // AGENT MESSAGE is for UI display purposes / conversation history construction
3421
+ // and typically doesn't need to be added to the system prompt or model requirements directly.
3422
+ // It is extracted separately for the chat interface.
3423
+ var _a;
3424
+ const pendingUserMessage = (_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.pendingUserMessage;
3425
+ if (pendingUserMessage) {
3426
+ const newSample = { question: pendingUserMessage, answer: content };
3427
+ const newSamples = [...(requirements.samples || []), newSample];
3428
+ const newMetadata = { ...requirements.metadata };
3429
+ delete newMetadata.pendingUserMessage;
3430
+ return {
3431
+ ...requirements,
3432
+ samples: newSamples,
3433
+ metadata: newMetadata,
3434
+ };
3435
+ }
3436
+ return requirements;
3437
+ }
3438
+ }
3439
+
3327
3440
  /**
3328
3441
  * INITIAL MESSAGE commitment definition
3329
3442
  *
@@ -3348,6 +3461,12 @@ class InitialMessageCommitmentDefinition extends BaseCommitmentDefinition {
3348
3461
  get description() {
3349
3462
  return 'Defines the **initial message** shown to the user when the chat starts.';
3350
3463
  }
3464
+ /**
3465
+ * Icon for this commitment.
3466
+ */
3467
+ get icon() {
3468
+ return '👋';
3469
+ }
3351
3470
  /**
3352
3471
  * Markdown documentation for INITIAL MESSAGE commitment.
3353
3472
  */
@@ -3406,6 +3525,12 @@ class MessageCommitmentDefinition extends BaseCommitmentDefinition {
3406
3525
  get description() {
3407
3526
  return 'Include actual **messages** the AI assistant has sent during conversation history.';
3408
3527
  }
3528
+ /**
3529
+ * Icon for this commitment.
3530
+ */
3531
+ get icon() {
3532
+ return 'đŸ’Ŧ';
3533
+ }
3409
3534
  /**
3410
3535
  * Markdown documentation for MESSAGE commitment.
3411
3536
  */
@@ -3488,6 +3613,73 @@ class MessageCommitmentDefinition extends BaseCommitmentDefinition {
3488
3613
  * Note: [💞] Ignore a discrepancy between file name and entity name
3489
3614
  */
3490
3615
 
3616
+ /**
3617
+ * USER MESSAGE commitment definition
3618
+ *
3619
+ * The USER MESSAGE commitment defines a message from the user in the conversation history.
3620
+ * It is used to pre-fill the chat with a conversation history or to provide few-shot examples.
3621
+ *
3622
+ * Example usage in agent source:
3623
+ *
3624
+ * ```book
3625
+ * USER MESSAGE Hello, I have a problem.
3626
+ * ```
3627
+ *
3628
+ * @private [đŸĒ”] Maybe export the commitments through some package
3629
+ */
3630
+ class UserMessageCommitmentDefinition extends BaseCommitmentDefinition {
3631
+ constructor() {
3632
+ super('USER MESSAGE');
3633
+ }
3634
+ /**
3635
+ * Short one-line description of USER MESSAGE.
3636
+ */
3637
+ get description() {
3638
+ return 'Defines a **message from the user** in the conversation history.';
3639
+ }
3640
+ /**
3641
+ * Icon for this commitment.
3642
+ */
3643
+ get icon() {
3644
+ return '🧑';
3645
+ }
3646
+ /**
3647
+ * Markdown documentation for USER MESSAGE commitment.
3648
+ */
3649
+ get documentation() {
3650
+ return spaceTrim(`
3651
+ # ${this.type}
3652
+
3653
+ Defines a message from the user in the conversation history. This is used to pre-fill the chat with a conversation history or to provide few-shot examples.
3654
+
3655
+ ## Key aspects
3656
+
3657
+ - Represents a message sent by the user.
3658
+ - Used for setting up conversation context.
3659
+ - Can be used in conjunction with AGENT MESSAGE.
3660
+
3661
+ ## Examples
3662
+
3663
+ \`\`\`book
3664
+ Conversation History
3665
+
3666
+ USER MESSAGE Hello, I have a problem.
3667
+ AGENT MESSAGE What seems to be the issue?
3668
+ USER MESSAGE My computer is not starting.
3669
+ \`\`\`
3670
+ `);
3671
+ }
3672
+ applyToAgentModelRequirements(requirements, content) {
3673
+ return {
3674
+ ...requirements,
3675
+ metadata: {
3676
+ ...requirements.metadata,
3677
+ pendingUserMessage: content,
3678
+ },
3679
+ };
3680
+ }
3681
+ }
3682
+
3491
3683
  /**
3492
3684
  * META commitment definition
3493
3685
  *
@@ -3524,6 +3716,12 @@ class MetaCommitmentDefinition extends BaseCommitmentDefinition {
3524
3716
  get description() {
3525
3717
  return 'Set meta-information about the agent (IMAGE, LINK, TITLE, DESCRIPTION, etc.).';
3526
3718
  }
3719
+ /**
3720
+ * Icon for this commitment.
3721
+ */
3722
+ get icon() {
3723
+ return 'â„šī¸';
3724
+ }
3527
3725
  /**
3528
3726
  * Markdown documentation for META commitment.
3529
3727
  */
@@ -3651,6 +3849,12 @@ class MetaColorCommitmentDefinition extends BaseCommitmentDefinition {
3651
3849
  get description() {
3652
3850
  return "Set the agent's accent color.";
3653
3851
  }
3852
+ /**
3853
+ * Icon for this commitment.
3854
+ */
3855
+ get icon() {
3856
+ return '🎨';
3857
+ }
3654
3858
  /**
3655
3859
  * Markdown documentation for META COLOR commitment.
3656
3860
  */
@@ -3729,6 +3933,12 @@ class MetaImageCommitmentDefinition extends BaseCommitmentDefinition {
3729
3933
  get description() {
3730
3934
  return "Set the agent's profile image URL.";
3731
3935
  }
3936
+ /**
3937
+ * Icon for this commitment.
3938
+ */
3939
+ get icon() {
3940
+ return 'đŸ–ŧī¸';
3941
+ }
3732
3942
  /**
3733
3943
  * Markdown documentation for META IMAGE commitment.
3734
3944
  */
@@ -3819,6 +4029,12 @@ class ModelCommitmentDefinition extends BaseCommitmentDefinition {
3819
4029
  get description() {
3820
4030
  return 'Enforce AI model requirements including name and technical parameters.';
3821
4031
  }
4032
+ /**
4033
+ * Icon for this commitment.
4034
+ */
4035
+ get icon() {
4036
+ return 'âš™ī¸';
4037
+ }
3822
4038
  /**
3823
4039
  * Markdown documentation for MODEL commitment.
3824
4040
  */
@@ -4054,6 +4270,12 @@ class NoteCommitmentDefinition extends BaseCommitmentDefinition {
4054
4270
  get description() {
4055
4271
  return 'Add developer-facing notes without changing behavior or output.';
4056
4272
  }
4273
+ /**
4274
+ * Icon for this commitment.
4275
+ */
4276
+ get icon() {
4277
+ return '📝';
4278
+ }
4057
4279
  /**
4058
4280
  * Markdown documentation for NOTE commitment.
4059
4281
  */
@@ -4156,6 +4378,12 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
4156
4378
  get description() {
4157
4379
  return 'Define who the agent is: background, expertise, and personality.';
4158
4380
  }
4381
+ /**
4382
+ * Icon for this commitment.
4383
+ */
4384
+ get icon() {
4385
+ return '👤';
4386
+ }
4159
4387
  /**
4160
4388
  * Markdown documentation for PERSONA commitment.
4161
4389
  */
@@ -4283,6 +4511,12 @@ class RuleCommitmentDefinition extends BaseCommitmentDefinition {
4283
4511
  get description() {
4284
4512
  return 'Add behavioral rules the agent must follow.';
4285
4513
  }
4514
+ /**
4515
+ * Icon for this commitment.
4516
+ */
4517
+ get icon() {
4518
+ return 'âš–ī¸';
4519
+ }
4286
4520
  /**
4287
4521
  * Markdown documentation for RULE/RULES commitment.
4288
4522
  */
@@ -4359,6 +4593,12 @@ class SampleCommitmentDefinition extends BaseCommitmentDefinition {
4359
4593
  get description() {
4360
4594
  return 'Provide example responses to guide behavior.';
4361
4595
  }
4596
+ /**
4597
+ * Icon for this commitment.
4598
+ */
4599
+ get icon() {
4600
+ return '🔍';
4601
+ }
4362
4602
  /**
4363
4603
  * Markdown documentation for SAMPLE/EXAMPLE commitment.
4364
4604
  */
@@ -4436,6 +4676,12 @@ class ScenarioCommitmentDefinition extends BaseCommitmentDefinition {
4436
4676
  get description() {
4437
4677
  return 'Define specific **situations** or contexts for AI responses, with later scenarios having higher priority.';
4438
4678
  }
4679
+ /**
4680
+ * Icon for this commitment.
4681
+ */
4682
+ get icon() {
4683
+ return '🎭';
4684
+ }
4439
4685
  /**
4440
4686
  * Markdown documentation for SCENARIO commitment.
4441
4687
  */
@@ -4552,6 +4798,12 @@ class StyleCommitmentDefinition extends BaseCommitmentDefinition {
4552
4798
  get description() {
4553
4799
  return 'Control the tone and writing style of responses.';
4554
4800
  }
4801
+ /**
4802
+ * Icon for this commitment.
4803
+ */
4804
+ get icon() {
4805
+ return 'đŸ–‹ī¸';
4806
+ }
4555
4807
  /**
4556
4808
  * Markdown documentation for STYLE commitment.
4557
4809
  */
@@ -4621,6 +4873,12 @@ class NotYetImplementedCommitmentDefinition extends BaseCommitmentDefinition {
4621
4873
  get description() {
4622
4874
  return 'Placeholder commitment that appends content verbatim to the system message.';
4623
4875
  }
4876
+ /**
4877
+ * Icon for this commitment.
4878
+ */
4879
+ get icon() {
4880
+ return '🚧';
4881
+ }
4624
4882
  /**
4625
4883
  * Markdown documentation available at runtime.
4626
4884
  */
@@ -4701,6 +4959,8 @@ const COMMITMENT_REGISTRY = [
4701
4959
  new GoalCommitmentDefinition('GOAL'),
4702
4960
  new GoalCommitmentDefinition('GOALS'),
4703
4961
  new InitialMessageCommitmentDefinition(),
4962
+ new UserMessageCommitmentDefinition(),
4963
+ new AgentMessageCommitmentDefinition(),
4704
4964
  new MessageCommitmentDefinition('MESSAGE'),
4705
4965
  new MessageCommitmentDefinition('MESSAGES'),
4706
4966
  new ScenarioCommitmentDefinition('SCENARIO'),