@promptbook/wizard 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 +279 -2
  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 +3 -3
  45. package/umd/index.umd.js +279 -2
  46. package/umd/index.umd.js.map +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/wizard",
3
- "version": "0.103.0-52",
3
+ "version": "0.103.0-54",
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-52"
98
+ "@promptbook/core": "0.103.0-54"
99
99
  },
100
100
  "dependencies": {
101
101
  "@ai-sdk/deepseek": "0.1.17",
@@ -104,7 +104,7 @@
104
104
  "@azure/openai": "1.0.0-beta.13",
105
105
  "@mozilla/readability": "0.6.0",
106
106
  "bottleneck": "2.19.5",
107
- "colors": "^1.4.0",
107
+ "colors": "1.4.0",
108
108
  "crypto": "1.0.1",
109
109
  "crypto-js": "4.2.0",
110
110
  "dotenv": "16.3.2",
package/umd/index.umd.js CHANGED
@@ -48,12 +48,23 @@
48
48
  * @generated
49
49
  * @see https://github.com/webgptorg/promptbook
50
50
  */
51
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-52';
51
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-54';
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
55
55
  */
56
56
 
57
+ /**
58
+ * Core Promptbook server configuration.
59
+ *
60
+ * This server is also used for auto-federation in the Agents Server.
61
+ */
62
+ const CORE_SERVER = {
63
+ title: 'Promptbook Core',
64
+ description: `Core Promptbook server used for auto-federation`,
65
+ owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
66
+ urls: ['https://core.ptbk.io/'],
67
+ };
57
68
  /**
58
69
  * Available remote servers for the Promptbook
59
70
  *
@@ -75,6 +86,7 @@
75
86
  owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
76
87
  urls: ['https://s6.ptbk.io/'],
77
88
  },
89
+ CORE_SERVER,
78
90
  /*
79
91
  Note: Working on older version of Promptbook and not supported anymore
80
92
  {
@@ -87,7 +99,6 @@
87
99
  */
88
100
  ];
89
101
  /**
90
- * TODO: [🐱‍🚀] Auto-federated server from url in here
91
102
  * Note: [💞] Ignore a discrepancy between file name and entity name
92
103
  */
93
104
 
@@ -7074,12 +7085,15 @@
7074
7085
  fileStreams.push(file);
7075
7086
  }
7076
7087
  else {
7088
+ /*
7089
+ TODO: [🐱‍🚀] Resolve problem with browser environment
7077
7090
  // Assume it's a local file path
7078
7091
  // Note: This will work in Node.js environment
7079
7092
  // For browser environments, this would need different handling
7080
7093
  const fs = await import('fs');
7081
7094
  const fileStream = fs.createReadStream(source);
7082
7095
  fileStreams.push(fileStream);
7096
+ */
7083
7097
  }
7084
7098
  }
7085
7099
  catch (error) {
@@ -7168,12 +7182,15 @@
7168
7182
  fileStreams.push(file);
7169
7183
  }
7170
7184
  else {
7185
+ /*
7186
+ TODO: [🐱‍🚀] Resolve problem with browser environment
7171
7187
  // Assume it's a local file path
7172
7188
  // Note: This will work in Node.js environment
7173
7189
  // For browser environments, this would need different handling
7174
7190
  const fs = await import('fs');
7175
7191
  const fileStream = fs.createReadStream(source);
7176
7192
  fileStreams.push(fileStream);
7193
+ */
7177
7194
  }
7178
7195
  }
7179
7196
  catch (error) {
@@ -13553,6 +13570,12 @@
13553
13570
  get description() {
13554
13571
  return 'Define agent capabilities and actions it can perform.';
13555
13572
  }
13573
+ /**
13574
+ * Icon for this commitment.
13575
+ */
13576
+ get icon() {
13577
+ return '⚡';
13578
+ }
13556
13579
  /**
13557
13580
  * Markdown documentation for ACTION commitment.
13558
13581
  */
@@ -13632,6 +13655,12 @@
13632
13655
  get description() {
13633
13656
  return 'Remove or **disregard** certain information, context, or previous commitments.';
13634
13657
  }
13658
+ /**
13659
+ * Icon for this commitment.
13660
+ */
13661
+ get icon() {
13662
+ return 'đŸ—‘ī¸';
13663
+ }
13635
13664
  /**
13636
13665
  * Markdown documentation for DELETE commitment.
13637
13666
  */
@@ -13748,6 +13777,12 @@
13748
13777
  get description() {
13749
13778
  return 'Specify output structure or formatting requirements.';
13750
13779
  }
13780
+ /**
13781
+ * Icon for this commitment.
13782
+ */
13783
+ get icon() {
13784
+ return '📜';
13785
+ }
13751
13786
  /**
13752
13787
  * Markdown documentation for FORMAT commitment.
13753
13788
  */
@@ -13823,6 +13858,12 @@
13823
13858
  get description() {
13824
13859
  return 'Define main **goals** the AI assistant should achieve, with later goals having higher priority.';
13825
13860
  }
13861
+ /**
13862
+ * Icon for this commitment.
13863
+ */
13864
+ get icon() {
13865
+ return 'đŸŽ¯';
13866
+ }
13826
13867
  /**
13827
13868
  * Markdown documentation for GOAL commitment.
13828
13869
  */
@@ -13919,6 +13960,12 @@
13919
13960
  get description() {
13920
13961
  return 'Add domain **knowledge** via direct text or external sources (RAG).';
13921
13962
  }
13963
+ /**
13964
+ * Icon for this commitment.
13965
+ */
13966
+ get icon() {
13967
+ return '🧠';
13968
+ }
13922
13969
  /**
13923
13970
  * Markdown documentation for KNOWLEDGE commitment.
13924
13971
  */
@@ -14020,6 +14067,12 @@
14020
14067
  get description() {
14021
14068
  return 'Remember past interactions and user **preferences** for personalized responses.';
14022
14069
  }
14070
+ /**
14071
+ * Icon for this commitment.
14072
+ */
14073
+ get icon() {
14074
+ return '🧠';
14075
+ }
14023
14076
  /**
14024
14077
  * Markdown documentation for MEMORY commitment.
14025
14078
  */
@@ -14094,6 +14147,83 @@
14094
14147
  * Note: [💞] Ignore a discrepancy between file name and entity name
14095
14148
  */
14096
14149
 
14150
+ /**
14151
+ * AGENT MESSAGE commitment definition
14152
+ *
14153
+ * The AGENT MESSAGE commitment defines a message from the agent in the conversation history.
14154
+ * It is used to pre-fill the chat with a conversation history or to provide few-shot examples.
14155
+ *
14156
+ * Example usage in agent source:
14157
+ *
14158
+ * ```book
14159
+ * AGENT MESSAGE What seems to be the issue?
14160
+ * ```
14161
+ *
14162
+ * @private [đŸĒ”] Maybe export the commitments through some package
14163
+ */
14164
+ class AgentMessageCommitmentDefinition extends BaseCommitmentDefinition {
14165
+ constructor() {
14166
+ super('AGENT MESSAGE');
14167
+ }
14168
+ /**
14169
+ * Short one-line description of AGENT MESSAGE.
14170
+ */
14171
+ get description() {
14172
+ return 'Defines a **message from the agent** in the conversation history.';
14173
+ }
14174
+ /**
14175
+ * Icon for this commitment.
14176
+ */
14177
+ get icon() {
14178
+ return '🤖';
14179
+ }
14180
+ /**
14181
+ * Markdown documentation for AGENT MESSAGE commitment.
14182
+ */
14183
+ get documentation() {
14184
+ return spaceTrim.spaceTrim(`
14185
+ # ${this.type}
14186
+
14187
+ 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.
14188
+
14189
+ ## Key aspects
14190
+
14191
+ - Represents a message sent by the agent.
14192
+ - Used for setting up conversation context.
14193
+ - Can be used in conjunction with USER MESSAGE.
14194
+
14195
+ ## Examples
14196
+
14197
+ \`\`\`book
14198
+ Conversation History
14199
+
14200
+ USER MESSAGE Hello, I have a problem.
14201
+ AGENT MESSAGE What seems to be the issue?
14202
+ USER MESSAGE My computer is not starting.
14203
+ \`\`\`
14204
+ `);
14205
+ }
14206
+ applyToAgentModelRequirements(requirements, content) {
14207
+ // AGENT MESSAGE is for UI display purposes / conversation history construction
14208
+ // and typically doesn't need to be added to the system prompt or model requirements directly.
14209
+ // It is extracted separately for the chat interface.
14210
+ var _a;
14211
+ const pendingUserMessage = (_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.pendingUserMessage;
14212
+ if (pendingUserMessage) {
14213
+ const newSample = { question: pendingUserMessage, answer: content };
14214
+ const newSamples = [...(requirements.samples || []), newSample];
14215
+ const newMetadata = { ...requirements.metadata };
14216
+ delete newMetadata.pendingUserMessage;
14217
+ return {
14218
+ ...requirements,
14219
+ samples: newSamples,
14220
+ metadata: newMetadata,
14221
+ };
14222
+ }
14223
+ return requirements;
14224
+ }
14225
+ }
14226
+
14097
14227
  /**
14098
14228
  * INITIAL MESSAGE commitment definition
14099
14229
  *
@@ -14118,6 +14248,12 @@
14118
14248
  get description() {
14119
14249
  return 'Defines the **initial message** shown to the user when the chat starts.';
14120
14250
  }
14251
+ /**
14252
+ * Icon for this commitment.
14253
+ */
14254
+ get icon() {
14255
+ return '👋';
14256
+ }
14121
14257
  /**
14122
14258
  * Markdown documentation for INITIAL MESSAGE commitment.
14123
14259
  */
@@ -14176,6 +14312,12 @@
14176
14312
  get description() {
14177
14313
  return 'Include actual **messages** the AI assistant has sent during conversation history.';
14178
14314
  }
14315
+ /**
14316
+ * Icon for this commitment.
14317
+ */
14318
+ get icon() {
14319
+ return 'đŸ’Ŧ';
14320
+ }
14179
14321
  /**
14180
14322
  * Markdown documentation for MESSAGE commitment.
14181
14323
  */
@@ -14258,6 +14400,73 @@
14258
14400
  * Note: [💞] Ignore a discrepancy between file name and entity name
14259
14401
  */
14260
14402
 
14403
+ /**
14404
+ * USER MESSAGE commitment definition
14405
+ *
14406
+ * The USER MESSAGE commitment defines a message from the user in the conversation history.
14407
+ * It is used to pre-fill the chat with a conversation history or to provide few-shot examples.
14408
+ *
14409
+ * Example usage in agent source:
14410
+ *
14411
+ * ```book
14412
+ * USER MESSAGE Hello, I have a problem.
14413
+ * ```
14414
+ *
14415
+ * @private [đŸĒ”] Maybe export the commitments through some package
14416
+ */
14417
+ class UserMessageCommitmentDefinition extends BaseCommitmentDefinition {
14418
+ constructor() {
14419
+ super('USER MESSAGE');
14420
+ }
14421
+ /**
14422
+ * Short one-line description of USER MESSAGE.
14423
+ */
14424
+ get description() {
14425
+ return 'Defines a **message from the user** in the conversation history.';
14426
+ }
14427
+ /**
14428
+ * Icon for this commitment.
14429
+ */
14430
+ get icon() {
14431
+ return '🧑';
14432
+ }
14433
+ /**
14434
+ * Markdown documentation for USER MESSAGE commitment.
14435
+ */
14436
+ get documentation() {
14437
+ return spaceTrim.spaceTrim(`
14438
+ # ${this.type}
14439
+
14440
+ 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.
14441
+
14442
+ ## Key aspects
14443
+
14444
+ - Represents a message sent by the user.
14445
+ - Used for setting up conversation context.
14446
+ - Can be used in conjunction with AGENT MESSAGE.
14447
+
14448
+ ## Examples
14449
+
14450
+ \`\`\`book
14451
+ Conversation History
14452
+
14453
+ USER MESSAGE Hello, I have a problem.
14454
+ AGENT MESSAGE What seems to be the issue?
14455
+ USER MESSAGE My computer is not starting.
14456
+ \`\`\`
14457
+ `);
14458
+ }
14459
+ applyToAgentModelRequirements(requirements, content) {
14460
+ return {
14461
+ ...requirements,
14462
+ metadata: {
14463
+ ...requirements.metadata,
14464
+ pendingUserMessage: content,
14465
+ },
14466
+ };
14467
+ }
14468
+ }
14469
+
14261
14470
  /**
14262
14471
  * META commitment definition
14263
14472
  *
@@ -14294,6 +14503,12 @@
14294
14503
  get description() {
14295
14504
  return 'Set meta-information about the agent (IMAGE, LINK, TITLE, DESCRIPTION, etc.).';
14296
14505
  }
14506
+ /**
14507
+ * Icon for this commitment.
14508
+ */
14509
+ get icon() {
14510
+ return 'â„šī¸';
14511
+ }
14297
14512
  /**
14298
14513
  * Markdown documentation for META commitment.
14299
14514
  */
@@ -14421,6 +14636,12 @@
14421
14636
  get description() {
14422
14637
  return "Set the agent's accent color.";
14423
14638
  }
14639
+ /**
14640
+ * Icon for this commitment.
14641
+ */
14642
+ get icon() {
14643
+ return '🎨';
14644
+ }
14424
14645
  /**
14425
14646
  * Markdown documentation for META COLOR commitment.
14426
14647
  */
@@ -14499,6 +14720,12 @@
14499
14720
  get description() {
14500
14721
  return "Set the agent's profile image URL.";
14501
14722
  }
14723
+ /**
14724
+ * Icon for this commitment.
14725
+ */
14726
+ get icon() {
14727
+ return 'đŸ–ŧī¸';
14728
+ }
14502
14729
  /**
14503
14730
  * Markdown documentation for META IMAGE commitment.
14504
14731
  */
@@ -14589,6 +14816,12 @@
14589
14816
  get description() {
14590
14817
  return 'Enforce AI model requirements including name and technical parameters.';
14591
14818
  }
14819
+ /**
14820
+ * Icon for this commitment.
14821
+ */
14822
+ get icon() {
14823
+ return 'âš™ī¸';
14824
+ }
14592
14825
  /**
14593
14826
  * Markdown documentation for MODEL commitment.
14594
14827
  */
@@ -14824,6 +15057,12 @@
14824
15057
  get description() {
14825
15058
  return 'Add developer-facing notes without changing behavior or output.';
14826
15059
  }
15060
+ /**
15061
+ * Icon for this commitment.
15062
+ */
15063
+ get icon() {
15064
+ return '📝';
15065
+ }
14827
15066
  /**
14828
15067
  * Markdown documentation for NOTE commitment.
14829
15068
  */
@@ -14926,6 +15165,12 @@
14926
15165
  get description() {
14927
15166
  return 'Define who the agent is: background, expertise, and personality.';
14928
15167
  }
15168
+ /**
15169
+ * Icon for this commitment.
15170
+ */
15171
+ get icon() {
15172
+ return '👤';
15173
+ }
14929
15174
  /**
14930
15175
  * Markdown documentation for PERSONA commitment.
14931
15176
  */
@@ -15053,6 +15298,12 @@
15053
15298
  get description() {
15054
15299
  return 'Add behavioral rules the agent must follow.';
15055
15300
  }
15301
+ /**
15302
+ * Icon for this commitment.
15303
+ */
15304
+ get icon() {
15305
+ return 'âš–ī¸';
15306
+ }
15056
15307
  /**
15057
15308
  * Markdown documentation for RULE/RULES commitment.
15058
15309
  */
@@ -15129,6 +15380,12 @@
15129
15380
  get description() {
15130
15381
  return 'Provide example responses to guide behavior.';
15131
15382
  }
15383
+ /**
15384
+ * Icon for this commitment.
15385
+ */
15386
+ get icon() {
15387
+ return '🔍';
15388
+ }
15132
15389
  /**
15133
15390
  * Markdown documentation for SAMPLE/EXAMPLE commitment.
15134
15391
  */
@@ -15206,6 +15463,12 @@
15206
15463
  get description() {
15207
15464
  return 'Define specific **situations** or contexts for AI responses, with later scenarios having higher priority.';
15208
15465
  }
15466
+ /**
15467
+ * Icon for this commitment.
15468
+ */
15469
+ get icon() {
15470
+ return '🎭';
15471
+ }
15209
15472
  /**
15210
15473
  * Markdown documentation for SCENARIO commitment.
15211
15474
  */
@@ -15322,6 +15585,12 @@
15322
15585
  get description() {
15323
15586
  return 'Control the tone and writing style of responses.';
15324
15587
  }
15588
+ /**
15589
+ * Icon for this commitment.
15590
+ */
15591
+ get icon() {
15592
+ return 'đŸ–‹ī¸';
15593
+ }
15325
15594
  /**
15326
15595
  * Markdown documentation for STYLE commitment.
15327
15596
  */
@@ -15391,6 +15660,12 @@
15391
15660
  get description() {
15392
15661
  return 'Placeholder commitment that appends content verbatim to the system message.';
15393
15662
  }
15663
+ /**
15664
+ * Icon for this commitment.
15665
+ */
15666
+ get icon() {
15667
+ return '🚧';
15668
+ }
15394
15669
  /**
15395
15670
  * Markdown documentation available at runtime.
15396
15671
  */
@@ -15471,6 +15746,8 @@
15471
15746
  new GoalCommitmentDefinition('GOAL'),
15472
15747
  new GoalCommitmentDefinition('GOALS'),
15473
15748
  new InitialMessageCommitmentDefinition(),
15749
+ new UserMessageCommitmentDefinition(),
15750
+ new AgentMessageCommitmentDefinition(),
15474
15751
  new MessageCommitmentDefinition('MESSAGE'),
15475
15752
  new MessageCommitmentDefinition('MESSAGES'),
15476
15753
  new ScenarioCommitmentDefinition('SCENARIO'),