@promptbook/wizard 0.103.0-52 → 0.103.0-53

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 (24) hide show
  1. package/esm/index.es.js +153 -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/MESSAGE/AgentMessageCommitmentDefinition.d.ts +28 -0
  14. package/esm/typings/src/commitments/MESSAGE/UserMessageCommitmentDefinition.d.ts +28 -0
  15. package/esm/typings/src/commitments/index.d.ts +20 -1
  16. package/esm/typings/src/execution/LlmExecutionTools.d.ts +9 -0
  17. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +2 -1
  18. package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +10 -1
  19. package/esm/typings/src/utils/normalization/normalizeMessageText.d.ts +9 -0
  20. package/esm/typings/src/utils/normalization/normalizeMessageText.test.d.ts +1 -0
  21. package/esm/typings/src/version.d.ts +1 -1
  22. package/package.json +2 -2
  23. package/umd/index.umd.js +153 -2
  24. package/umd/index.umd.js.map +1 -1
package/esm/index.es.js CHANGED
@@ -36,12 +36,23 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
36
36
  * @generated
37
37
  * @see https://github.com/webgptorg/promptbook
38
38
  */
39
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-52';
39
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-53';
40
40
  /**
41
41
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
42
42
  * Note: [💞] Ignore a discrepancy between file name and entity name
43
43
  */
44
44
 
45
+ /**
46
+ * Core Promptbook server configuration.
47
+ *
48
+ * This server is also used for auto-federation in the Agents Server.
49
+ */
50
+ const CORE_SERVER = {
51
+ title: 'Promptbook Core',
52
+ description: `Core Promptbook server used for auto-federation`,
53
+ owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
54
+ urls: ['https://core.ptbk.io/'],
55
+ };
45
56
  /**
46
57
  * Available remote servers for the Promptbook
47
58
  *
@@ -63,6 +74,7 @@ const REMOTE_SERVER_URLS = [
63
74
  owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
64
75
  urls: ['https://s6.ptbk.io/'],
65
76
  },
77
+ CORE_SERVER,
66
78
  /*
67
79
  Note: Working on older version of Promptbook and not supported anymore
68
80
  {
@@ -75,7 +87,6 @@ const REMOTE_SERVER_URLS = [
75
87
  */
76
88
  ];
77
89
  /**
78
- * TODO: [🐱‍🚀] Auto-federated server from url in here
79
90
  * Note: [💞] Ignore a discrepancy between file name and entity name
80
91
  */
81
92
 
@@ -7062,12 +7073,15 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
7062
7073
  fileStreams.push(file);
7063
7074
  }
7064
7075
  else {
7076
+ /*
7077
+ TODO: [🐱‍🚀] Resolve problem with browser environment
7065
7078
  // Assume it's a local file path
7066
7079
  // Note: This will work in Node.js environment
7067
7080
  // For browser environments, this would need different handling
7068
7081
  const fs = await import('fs');
7069
7082
  const fileStream = fs.createReadStream(source);
7070
7083
  fileStreams.push(fileStream);
7084
+ */
7071
7085
  }
7072
7086
  }
7073
7087
  catch (error) {
@@ -7156,12 +7170,15 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
7156
7170
  fileStreams.push(file);
7157
7171
  }
7158
7172
  else {
7173
+ /*
7174
+ TODO: [🐱‍🚀] Resolve problem with browser environment
7159
7175
  // Assume it's a local file path
7160
7176
  // Note: This will work in Node.js environment
7161
7177
  // For browser environments, this would need different handling
7162
7178
  const fs = await import('fs');
7163
7179
  const fileStream = fs.createReadStream(source);
7164
7180
  fileStreams.push(fileStream);
7181
+ */
7165
7182
  }
7166
7183
  }
7167
7184
  catch (error) {
@@ -14082,6 +14099,77 @@ class MemoryCommitmentDefinition extends BaseCommitmentDefinition {
14082
14099
  * Note: [💞] Ignore a discrepancy between file name and entity name
14083
14100
  */
14084
14101
 
14102
+ /**
14103
+ * AGENT MESSAGE commitment definition
14104
+ *
14105
+ * The AGENT MESSAGE commitment defines a message from the agent in the conversation history.
14106
+ * It is used to pre-fill the chat with a conversation history or to provide few-shot examples.
14107
+ *
14108
+ * Example usage in agent source:
14109
+ *
14110
+ * ```book
14111
+ * AGENT MESSAGE What seems to be the issue?
14112
+ * ```
14113
+ *
14114
+ * @private [🪔] Maybe export the commitments through some package
14115
+ */
14116
+ class AgentMessageCommitmentDefinition extends BaseCommitmentDefinition {
14117
+ constructor() {
14118
+ super('AGENT MESSAGE');
14119
+ }
14120
+ /**
14121
+ * Short one-line description of AGENT MESSAGE.
14122
+ */
14123
+ get description() {
14124
+ return 'Defines a **message from the agent** in the conversation history.';
14125
+ }
14126
+ /**
14127
+ * Markdown documentation for AGENT MESSAGE commitment.
14128
+ */
14129
+ get documentation() {
14130
+ return spaceTrim$1(`
14131
+ # ${this.type}
14132
+
14133
+ 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.
14134
+
14135
+ ## Key aspects
14136
+
14137
+ - Represents a message sent by the agent.
14138
+ - Used for setting up conversation context.
14139
+ - Can be used in conjunction with USER MESSAGE.
14140
+
14141
+ ## Examples
14142
+
14143
+ \`\`\`book
14144
+ Conversation History
14145
+
14146
+ USER MESSAGE Hello, I have a problem.
14147
+ AGENT MESSAGE What seems to be the issue?
14148
+ USER MESSAGE My computer is not starting.
14149
+ \`\`\`
14150
+ `);
14151
+ }
14152
+ applyToAgentModelRequirements(requirements, content) {
14153
+ // AGENT MESSAGE is for UI display purposes / conversation history construction
14154
+ // and typically doesn't need to be added to the system prompt or model requirements directly.
14155
+ // It is extracted separately for the chat interface.
14156
+ var _a;
14157
+ const pendingUserMessage = (_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.pendingUserMessage;
14158
+ if (pendingUserMessage) {
14159
+ const newSample = { question: pendingUserMessage, answer: content };
14160
+ const newSamples = [...(requirements.samples || []), newSample];
14161
+ const newMetadata = { ...requirements.metadata };
14162
+ delete newMetadata.pendingUserMessage;
14163
+ return {
14164
+ ...requirements,
14165
+ samples: newSamples,
14166
+ metadata: newMetadata,
14167
+ };
14168
+ }
14169
+ return requirements;
14170
+ }
14171
+ }
14172
+
14085
14173
  /**
14086
14174
  * INITIAL MESSAGE commitment definition
14087
14175
  *
@@ -14246,6 +14334,67 @@ class MessageCommitmentDefinition extends BaseCommitmentDefinition {
14246
14334
  * Note: [💞] Ignore a discrepancy between file name and entity name
14247
14335
  */
14248
14336
 
14337
+ /**
14338
+ * USER MESSAGE commitment definition
14339
+ *
14340
+ * The USER MESSAGE commitment defines a message from the user in the conversation history.
14341
+ * It is used to pre-fill the chat with a conversation history or to provide few-shot examples.
14342
+ *
14343
+ * Example usage in agent source:
14344
+ *
14345
+ * ```book
14346
+ * USER MESSAGE Hello, I have a problem.
14347
+ * ```
14348
+ *
14349
+ * @private [🪔] Maybe export the commitments through some package
14350
+ */
14351
+ class UserMessageCommitmentDefinition extends BaseCommitmentDefinition {
14352
+ constructor() {
14353
+ super('USER MESSAGE');
14354
+ }
14355
+ /**
14356
+ * Short one-line description of USER MESSAGE.
14357
+ */
14358
+ get description() {
14359
+ return 'Defines a **message from the user** in the conversation history.';
14360
+ }
14361
+ /**
14362
+ * Markdown documentation for USER MESSAGE commitment.
14363
+ */
14364
+ get documentation() {
14365
+ return spaceTrim$1(`
14366
+ # ${this.type}
14367
+
14368
+ 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.
14369
+
14370
+ ## Key aspects
14371
+
14372
+ - Represents a message sent by the user.
14373
+ - Used for setting up conversation context.
14374
+ - Can be used in conjunction with AGENT MESSAGE.
14375
+
14376
+ ## Examples
14377
+
14378
+ \`\`\`book
14379
+ Conversation History
14380
+
14381
+ USER MESSAGE Hello, I have a problem.
14382
+ AGENT MESSAGE What seems to be the issue?
14383
+ USER MESSAGE My computer is not starting.
14384
+ \`\`\`
14385
+ `);
14386
+ }
14387
+ applyToAgentModelRequirements(requirements, content) {
14388
+ return {
14389
+ ...requirements,
14390
+ metadata: {
14391
+ ...requirements.metadata,
14392
+ pendingUserMessage: content,
14393
+ },
14394
+ };
14395
+ }
14396
+ }
14397
+
14249
14398
  /**
14250
14399
  * META commitment definition
14251
14400
  *
@@ -15459,6 +15608,8 @@ const COMMITMENT_REGISTRY = [
15459
15608
  new GoalCommitmentDefinition('GOAL'),
15460
15609
  new GoalCommitmentDefinition('GOALS'),
15461
15610
  new InitialMessageCommitmentDefinition(),
15611
+ new UserMessageCommitmentDefinition(),
15612
+ new AgentMessageCommitmentDefinition(),
15462
15613
  new MessageCommitmentDefinition('MESSAGE'),
15463
15614
  new MessageCommitmentDefinition('MESSAGES'),
15464
15615
  new ScenarioCommitmentDefinition('SCENARIO'),