@promptbook/node 0.105.0-1 → 0.105.0-10

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 (67) hide show
  1. package/README.md +36 -77
  2. package/esm/index.es.js +4055 -135
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/browser.index.d.ts +2 -0
  5. package/esm/typings/src/_packages/core.index.d.ts +4 -0
  6. package/esm/typings/src/_packages/types.index.d.ts +16 -0
  7. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  8. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +15 -3
  9. package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +11 -1
  10. package/esm/typings/src/book-2.0/agent-source/communication-samples.test.d.ts +1 -0
  11. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.blocks.test.d.ts +1 -0
  12. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.import.test.d.ts +1 -0
  13. package/esm/typings/src/book-2.0/agent-source/parseAgentSource.import.test.d.ts +1 -0
  14. package/esm/typings/src/book-2.0/agent-source/parseAgentSourceWithCommitments.blocks.test.d.ts +1 -0
  15. package/esm/typings/src/book-components/Chat/AgentChat/AgentChatProps.d.ts +5 -0
  16. package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +15 -1
  17. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +20 -9
  18. package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +5 -0
  19. package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +43 -0
  20. package/esm/typings/src/commitments/NOTE/NOTE.d.ts +2 -2
  21. package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +4 -0
  22. package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +10 -0
  23. package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.test.d.ts +1 -0
  24. package/esm/typings/src/commitments/USE_TIME/USE_TIME.d.ts +44 -0
  25. package/esm/typings/src/commitments/USE_TIME/USE_TIME.test.d.ts +1 -0
  26. package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +14 -0
  27. package/esm/typings/src/commitments/_base/CommitmentDefinition.d.ts +14 -0
  28. package/esm/typings/src/commitments/index.d.ts +17 -2
  29. package/esm/typings/src/config.d.ts +1 -0
  30. package/esm/typings/src/execution/LlmExecutionTools.d.ts +3 -1
  31. package/esm/typings/src/import-plugins/$fileImportPlugins.d.ts +7 -0
  32. package/esm/typings/src/import-plugins/AgentFileImportPlugin.d.ts +7 -0
  33. package/esm/typings/src/import-plugins/FileImportPlugin.d.ts +24 -0
  34. package/esm/typings/src/import-plugins/JsonFileImportPlugin.d.ts +7 -0
  35. package/esm/typings/src/import-plugins/TextFileImportPlugin.d.ts +7 -0
  36. package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +2 -1
  37. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +2 -2
  38. package/esm/typings/src/llm-providers/agent/Agent.d.ts +14 -2
  39. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +3 -1
  40. package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +7 -0
  41. package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +1 -0
  42. package/esm/typings/src/llm-providers/agent/RemoteAgentOptions.d.ts +1 -1
  43. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +10 -0
  44. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +7 -0
  45. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
  46. package/esm/typings/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +6 -1
  47. package/esm/typings/src/search-engines/SearchEngine.d.ts +1 -1
  48. package/esm/typings/src/search-engines/_index.d.ts +6 -0
  49. package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +1 -1
  50. package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +1 -1
  51. package/esm/typings/src/search-engines/google/GoogleSearchEngine.d.ts +18 -0
  52. package/esm/typings/src/search-engines/serp/SerpSearchEngine.d.ts +15 -0
  53. package/esm/typings/src/speech-recognition/BrowserSpeechRecognition.d.ts +21 -0
  54. package/esm/typings/src/speech-recognition/OpenAiSpeechRecognition.d.ts +32 -0
  55. package/esm/typings/src/types/ModelRequirements.d.ts +6 -12
  56. package/esm/typings/src/types/SpeechRecognition.d.ts +58 -0
  57. package/esm/typings/src/types/typeAliases.d.ts +4 -0
  58. package/esm/typings/src/utils/execCommand/$execCommandNormalizeOptions.d.ts +2 -3
  59. package/esm/typings/src/utils/execCommand/ExecCommandOptions.d.ts +7 -1
  60. package/esm/typings/src/utils/misc/linguisticHash.d.ts +6 -0
  61. package/esm/typings/src/utils/misc/linguisticHash.test.d.ts +1 -0
  62. package/esm/typings/src/utils/organization/keepImported.d.ts +9 -0
  63. package/esm/typings/src/utils/organization/keepTypeImported.d.ts +0 -1
  64. package/esm/typings/src/version.d.ts +1 -1
  65. package/package.json +2 -2
  66. package/umd/index.umd.js +4055 -135
  67. package/umd/index.umd.js.map +1 -1
package/README.md CHANGED
@@ -116,19 +116,20 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
116
116
 
117
117
  ## 📖 The Book Whitepaper
118
118
 
119
- For most business applications nowadays, the biggest challenge isn't about the raw capabilities of AI models. Large language models like GPT-5 or Claude-4.1 are extremely capable.
119
+ Nowadays, the biggest challenge for most business applications isn't the raw capabilities of AI models. Large language models such as GPT-5.2 and Claude-4.5 are incredibly capable.
120
120
 
121
- The main challenge is to narrow it down, constrain it, set the proper **context, rules, knowledge, and personality**. There are a lot of tools which can do exactly this. On one side, there are no-code platforms which can launch your agent in seconds. On the other side, there are heavy frameworks like Langchain or Semantic Kernel, which can give you deep control.
121
+ The main challenge lies in **managing the context**, providing rules and knowledge, and narrowing the personality.
122
122
 
123
- Promptbook takes the best from both worlds. You are defining your AI behavior by simple **books**, which are very explicit. They are automatically enforced, but they are very easy to understand, very easy to write, and very reliable and portable.
123
+ In Promptbook, you can define your context **using simple Books** that are very explicit, easy to understand and write, reliable, and highly portable.
124
124
 
125
125
  <table style="border: 1px solid #777; border-radius: 10px;"><tr><td>
126
126
 
127
- **<ins>Paul Smith & Associés</ins>**<br/>
127
+ **<ins>Paul Smith</ins>**<br/>
128
128
  <br/>
129
129
  **PERSONA** You are a company lawyer.<br/>
130
130
  Your job is to provide legal advice and support to the company and its employees.<br/>
131
- You are knowledgeable, professional, and detail-oriented.<br/>
131
+ **RULE** You are knowledgeable, professional, and detail-oriented.<br/>
132
+ TEAM You are part of the legal team of Paul Smith & Associés, you discuss with {Emily White}, the head of the compliance department. {George Brown} is expert in corporate law and {Sophia Black} is expert in labor law.<br/>
132
133
 
133
134
  </td></tr></table>
134
135
 
@@ -138,7 +139,9 @@ You are knowledgeable, professional, and detail-oriented.<br/>
138
139
 
139
140
  We have created a language called **Book**, which allows you to write AI agents in their native language and create your own AI persona. Book provides a guide to define all the traits and commitments.
140
141
 
141
- You can look at it as prompting (or writing a system message), but decorated by **commitments**.
142
+ You can look at it as "prompting" _(or writing a system message)_, but decorated by **commitments**.
143
+
144
+ **Commitments** are special syntax elements that define contracts between you and the AI agent. They are transformed by Promptbook Engine into low-level parameters like which model to use, its temperature, system message, RAG index, MCP servers, and many other parameters. For some commitments _(for example `RULE` commitment)_ Promptbook Engine can even create adversary agents and extra checks to enforce the rules.
142
145
 
143
146
  #### `Persona` commitment
144
147
 
@@ -149,8 +152,6 @@ Personas define the character of your AI persona, its role, and how it should in
149
152
  **<ins>Paul Smith & Associés</ins>**<br/>
150
153
  <br/>
151
154
  **PERSONA** You are a company lawyer.<br/>
152
- Your job is to provide legal advice and support to the company and its employees.<br/>
153
- You are knowledgeable, professional, and detail-oriented.<br/>
154
155
 
155
156
  </td></tr></table>
156
157
 
@@ -170,7 +171,7 @@ Promptbook Engine will automatically enforce this knowledge during interactions.
170
171
  Your job is to provide legal advice and support to the company and its employees.<br/>
171
172
  You are knowledgeable, professional, and detail-oriented.<br/>
172
173
  <br/>
173
- **KNOWLEDGE** https://company.com/company-policies.pdf<br/>
174
+ **KNOWLEDGE** https://company.com/company-policies.pdf<br/>
174
175
  **KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
175
176
 
176
177
  </td></tr></table>
@@ -192,14 +193,14 @@ You are knowledgeable, professional, and detail-oriented.<br/>
192
193
  **RULE** Always ensure compliance with laws and regulations.<br/>
193
194
  **RULE** Never provide legal advice outside your area of expertise.<br/>
194
195
  **RULE** Never provide legal advice about criminal law.<br/>
195
- **KNOWLEDGE** https://company.com/company-policies.pdf<br/>
196
+ **KNOWLEDGE** https://company.com/company-policies.pdf<br/>
196
197
  **KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
197
198
 
198
199
  </td></tr></table>
199
200
 
200
- #### `Action` commitment
201
+ #### `Team` commitment
201
202
 
202
- Action Commitment allows you to define specific actions that the AI can take during interactions. This can include things like posting on a social media platform, sending emails, creating calendar events, or interacting with your internal systems.
203
+ Team commitment allows you to define the team structure and advisory fellow members the AI can consult with. This allows the AI to simulate collaboration and consultation with other experts, enhancing the quality of its responses.
203
204
 
204
205
  <table style="border: 1px solid #777; border-radius: 10px;"><tr><td>
205
206
 
@@ -212,81 +213,36 @@ You are knowledgeable, professional, and detail-oriented.<br/>
212
213
  **RULE** Always ensure compliance with laws and regulations.<br/>
213
214
  **RULE** Never provide legal advice outside your area of expertise.<br/>
214
215
  **RULE** Never provide legal advice about criminal law.<br/>
215
- **KNOWLEDGE** https://company.com/company-policies.pdf<br/>
216
+ **KNOWLEDGE** https://company.com/company-policies.pdf<br/>
216
217
  **KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
217
- **ACTION** When a user asks about an issue that could be treated as a crime, notify legal@company.com.<br/>
218
+ TEAM You are part of the legal team of Paul Smith & Associés, you discuss with {Emily White}, the head of the compliance department. {George Brown} is expert in corporate law and {Sophia Black} is expert in labor law.<br/>
218
219
 
219
220
  </td></tr></table>
220
221
 
221
- [Read more about the language](./BLUEPRINT.md)
222
-
223
- <div style="page-break-after: always;"></div>
224
-
225
- ### Where to use your AI agent in book
226
-
227
- Books can be useful in various applications and scenarios. Here are some examples:
228
-
229
- #### Chat apps:
230
222
 
231
- Create your own chat shopping assistant and place it in your eShop.
232
- You will be able to answer customer questions, help them find products, and provide personalized recommendations. Everything is tightly controlled by the book you have written.
233
223
 
234
- #### Reply Agent:
224
+ ### Promptbook Ecosystem
235
225
 
236
- Create your own AI agent, which will look at your emails and reply to them. It can even create drafts for you to review before sending.
226
+ !!!@@@
237
227
 
238
- #### Coding Agent:
239
-
240
- Do you love Vibecoding, but the AI code is not always aligned with your coding style and architecture, rules, security, etc.? Create your own coding agent to help enforce your specific coding standards and practices.
241
-
242
- This can be integrated to almost any Vibecoding platform, like GitHub Copilot, Amazon CodeWhisperer, Cursor, Cline, Kilocode, Roocode,...
243
-
244
- They will work the same as you are used to, but with your specific rules written in book.
245
-
246
- #### Internal Expertise
247
-
248
- Do you have an app written in TypeScript, Python, C#, Java, or any other language, and you are integrating the AI.
249
-
250
- You can avoid struggle with choosing the best model, its settings like temperature, max tokens, etc., by writing a book agent and using it as your AI expertise.
251
-
252
- Doesn't matter if you do automations, data analysis, customer support, sentiment analysis, classification, or any other task. Your AI agent will be tailored to your specific needs and requirements.
253
-
254
- Even works in no-code platforms!
255
-
256
- <div style="page-break-after: always;"></div>
228
+ #### Promptbook Server
257
229
 
258
- ### How to create your AI agent in book
230
+ !!!@@@
259
231
 
260
- Now you want to use it. There are several ways how to write your first book:
232
+ #### Promptbook Engine
261
233
 
262
- #### From scratch with help from Paul
234
+ !!!@@@
263
235
 
264
- We have written ai asistant in book who can help you with writing your first book.
265
236
 
266
- #### Your AI twin
267
237
 
268
- Copy your own behavior, personality, and knowledge into book and create your AI twin. It can help you with your work, personal life, or any other task.
269
238
 
270
- #### AI persona workpool
271
239
 
272
- Or you can pick from our library of pre-written books for various roles and tasks. You can find books for customer support, coding, marketing, sales, HR, legal, and many other roles.
273
240
 
274
241
 
275
242
 
276
243
 
277
244
 
278
245
 
279
- ## 🚀 Get started
280
-
281
- Take a look at the simple starter kit with books integrated into the **Hello World** sample applications:
282
-
283
- - [Hello Book](https://github.com/webgptorg/hello-world)
284
- - [Hello Book in Node.js](https://github.com/webgptorg/hello-world-node-js)
285
- - [Hello Book in Next.js](https://github.com/webgptorg/hello-world-next-js)
286
-
287
-
288
-
289
-
290
246
 
291
247
 
292
248
  ## 💜 The Promptbook Project
@@ -302,33 +258,32 @@ Promptbook project is ecosystem of multiple projects and tools, following is a l
302
258
  </thead>
303
259
  <tbody>
304
260
  <tr>
305
- <td><a href="https://github.com/webgptorg/book">Book language</a></td>
261
+ <td><a href="https://gallery.ptbk.io/">Agents Server</a></td>
306
262
  <td>
307
- Book is a human-understandable markup language for writing AI applications such as chatbots, knowledge bases, agents, avarars, translators, automations and more.
308
- <hr>
309
- There is also <a href="https://github.com/webgptorg/book-extension">a plugin for VSCode</a> to support <code>.book</code> file extension
263
+ Place where you "AI agents live". It allows to create, manage, deploy, and interact with AI agents created in Book language.
310
264
  </td>
311
265
  </tr>
312
266
  <tr>
313
- <td><a href="https://github.com/webgptorg/promptbook">Promptbook Engine</a></td>
267
+ <td><a href="https://github.com/webgptorg/book">Book language</a></td>
314
268
  <td>
315
- Promptbook engine can run applications written in Book language. It is released as <a href="https://www.npmjs.com/package/@promptbook/core#-packages-for-developers">multiple NPM packages</a> and <a href="https://hub.docker.com/r/hejny/promptbook">Docker HUB</a>
269
+ Human-friendly, high-level language that abstracts away low-level details of AI. It allows to focus on personality, behavior, knowledge, and rules of AI agents rather than on models, parameters, and prompt engineering.
270
+ <hr>
271
+ There is also <a href="https://github.com/webgptorg/book-extension">a plugin for VSCode</a> to support <code>.book</code> file extension
316
272
  </td>
317
273
  </tr>
318
274
  <tr>
319
- <td><a href="https://promptbook.studio">Promptbook Studio</a></td>
275
+ <td><a href="https://github.com/webgptorg/promptbook">Promptbook Engine</a></td>
320
276
  <td>
321
- Promptbook.studio is a web-based editor and runner for book applications. It is still in the experimental MVP stage.
277
+ Promptbook engine can run AI agents based on Book language.
278
+ It is released as <a href="https://www.npmjs.com/package/@promptbook/core#-packages-for-developers">multiple NPM packages</a> and <a href="https://hub.docker.com/r/hejny/promptbook">Promptbook Agent Server as Docker Package</a>
279
+ Agent Server is based on Promptbook Engine.
322
280
  </td>
323
281
  </tr>
282
+
324
283
  </tbody>
325
284
  </table>
326
285
 
327
- Hello world examples:
328
286
 
329
- - [Hello world](https://github.com/webgptorg/hello-world)
330
- - [Hello world in Node.js](https://github.com/webgptorg/hello-world-node-js)
331
- - [Hello world in Next.js](https://github.com/webgptorg/hello-world-next-js)
332
287
 
333
288
  ### 🌐 Community & Social Media
334
289
 
@@ -386,6 +341,8 @@ Join our growing community of developers and users:
386
341
 
387
342
 
388
343
 
344
+
345
+
389
346
  ## 📚 Documentation
390
347
 
391
348
  See detailed guides and API reference in the [docs](https://github.com/webgptorg/promptbook/discussions/categories/concepts) or [online](https://discord.gg/x3QWNaa89N).
@@ -462,6 +419,8 @@ The following glossary is used to clarify certain concepts:
462
419
 
463
420
  _Note: This section is not a complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
464
421
 
422
+
423
+
465
424
  ### 💯 Core concepts
466
425
 
467
426
  - [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)