@promptbook/remote-client 0.88.0-11 → 0.88.0-12

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.
package/README.md CHANGED
@@ -58,8 +58,6 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
58
58
 
59
59
  During the computer revolution, we have seen [multiple generations of computer languages](https://github.com/webgptorg/promptbook/discussions/180), from the physical rewiring of the vacuum tubes through low-level machine code to the high-level languages like Python or JavaScript. And now, we're on the edge of the **next revolution**!
60
60
 
61
-
62
-
63
61
  It's a revolution of writing software in **plain human language** that is understandable and executable by both humans and machines – and it's going to change everything!
64
62
 
65
63
  The incredible growth in power of microprocessors and the Moore's Law have been the driving force behind the ever-more powerful languages, and it's been an amazing journey! Similarly, the large language models (like GPT or Claude) are the next big thing in language technology, and they're set to transform the way we interact with computers.
@@ -70,6 +68,9 @@ This shift is going to happen, whether we are ready for it or not. Our mission i
70
68
 
71
69
 
72
70
 
71
+
72
+
73
+
73
74
  ## 🚀 Get started
74
75
 
75
76
  Take a look at the simple starter kit with books integrated into the **Hello World** sample applications:
@@ -81,6 +82,8 @@ Take a look at the simple starter kit with books integrated into the **Hello Wor
81
82
 
82
83
 
83
84
 
85
+
86
+
84
87
  ## 💜 The Promptbook Project
85
88
 
86
89
  Promptbook project is ecosystem of multiple projects and tools, following is a list of most important pieces of the project:
@@ -122,29 +125,22 @@ Hello world examples:
122
125
  - [Hello world in Node.js](https://github.com/webgptorg/hello-world-node-js)
123
126
  - [Hello world in Next.js](https://github.com/webgptorg/hello-world-next-js)
124
127
 
125
-
126
-
127
128
  We also have a community of developers and users of **Promptbook**:
128
129
 
129
130
  - [Discord community](https://discord.gg/x3QWNaa89N)
130
131
  - [Landing page `ptbk.io`](https://ptbk.io)
131
132
  - [Github discussions](https://github.com/webgptorg/promptbook/discussions)
132
133
  - [LinkedIn `Promptbook`](https://linkedin.com/company/promptbook)
133
- - [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
134
+ - [Facebook `Promptbook`](https://www.facebook.com/61560776453536)
134
135
 
135
136
  And **Promptbook.studio** branded socials:
136
137
 
137
-
138
-
139
138
  - [Instagram `@promptbook.studio`](https://www.instagram.com/promptbook.studio/)
140
139
 
141
140
  And **Promptujeme** sub-brand:
142
141
 
143
142
  _/Subbrand for Czech clients/_
144
143
 
145
-
146
-
147
-
148
144
  - [Promptujeme.cz](https://www.promptujeme.cz/)
149
145
  - [Facebook `Promptujeme`](https://www.facebook.com/promptujeme/)
150
146
 
@@ -162,8 +158,6 @@ _/Sub-brand for images and graphics generated via Promptbook prompting/_
162
158
 
163
159
  ## 💙 The Book language
164
160
 
165
-
166
-
167
161
  Following is the documentation and blueprint of the [Book language](https://github.com/webgptorg/book).
168
162
 
169
163
  Book is a language that can be used to write AI applications, agents, workflows, automations, knowledgebases, translators, sheet processors, email automations and more. It allows you to harness the power of AI models in human-like terms, without the need to know the specifics and technicalities of the models.
@@ -213,8 +207,6 @@ Personas can have access to different knowledge, tools and actions. They can als
213
207
 
214
208
  - [PERSONA](https://github.com/webgptorg/promptbook/blob/main/documents/commands/PERSONA.md)
215
209
 
216
-
217
-
218
210
  ### **How:** Knowledge, Instruments and Actions
219
211
 
220
212
  The resources used by the personas are used to do the work.
@@ -303,12 +295,8 @@ The following glossary is used to clarify certain concepts:
303
295
  - **Retrieval-augmented generation** is a machine learning paradigm where a model generates text by retrieving relevant information from a large database of text. This approach combines the benefits of generative models and retrieval models.
304
296
  - **Longtail** refers to non-common or rare events, items, or entities that are not well-represented in the training data of machine learning models. Longtail items are often challenging for models to predict accurately.
305
297
 
306
-
307
-
308
298
  _Note: This section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
309
299
 
310
-
311
-
312
300
  ### 💯 Core concepts
313
301
 
314
302
  - [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
@@ -413,7 +401,7 @@ See [TODO.md](./TODO.md)
413
401
  <a href="https://technologickainkubace.org/en/about-technology-incubation/about-the-project/">
414
402
  <img src="./other/partners/CI-Technology-Incubation.png" alt="Technology Incubation" height="70">
415
403
  </a>
416
-
404
+
417
405
  </div>
418
406
 
419
407
  ## 🖋️ Contributing
package/esm/index.es.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import spaceTrim$1, { spaceTrim } from 'spacetrim';
2
+ import { randomBytes } from 'crypto';
2
3
  import { io } from 'socket.io-client';
3
4
  import { SHA256 } from 'crypto-js';
4
5
  import hexEncoder from 'crypto-js/enc-hex';
@@ -19,7 +20,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
19
20
  * @generated
20
21
  * @see https://github.com/webgptorg/promptbook
21
22
  */
22
- const PROMPTBOOK_ENGINE_VERSION = '0.88.0-11';
23
+ const PROMPTBOOK_ENGINE_VERSION = '0.88.0-12';
23
24
  /**
24
25
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
25
26
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -193,6 +194,21 @@ class ParseError extends Error {
193
194
  * TODO: Maybe split `ParseError` and `ApplyError`
194
195
  */
195
196
 
197
+ /**
198
+ * Generates random token
199
+ *
200
+ * Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
201
+ *
202
+ * @private internal helper function
203
+ * @returns secure random token
204
+ */
205
+ function $randomToken(randomness) {
206
+ return randomBytes(randomness).toString('hex');
207
+ }
208
+ /**
209
+ * TODO: Maybe use nanoid instead https://github.com/ai/nanoid
210
+ */
211
+
196
212
  /**
197
213
  * This error indicates errors during the execution of the pipeline
198
214
  *
@@ -200,11 +216,17 @@ class ParseError extends Error {
200
216
  */
201
217
  class PipelineExecutionError extends Error {
202
218
  constructor(message) {
219
+ // Added id parameter
203
220
  super(message);
204
221
  this.name = 'PipelineExecutionError';
222
+ // TODO: [🐙] DRY - Maybe $randomId
223
+ this.id = `error-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */)}`;
205
224
  Object.setPrototypeOf(this, PipelineExecutionError.prototype);
206
225
  }
207
226
  }
227
+ /**
228
+ * TODO: !!!!!! Add id to all errors
229
+ */
208
230
 
209
231
  /**
210
232
  * This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
@@ -460,7 +482,7 @@ const ALL_ERRORS = {
460
482
  * @public exported from `@promptbook/utils`
461
483
  */
462
484
  function deserializeError(error) {
463
- const { name, stack } = error;
485
+ const { name, stack, id } = error; // Added id
464
486
  let { message } = error;
465
487
  let ErrorClass = ALL_ERRORS[error.name];
466
488
  if (ErrorClass === undefined) {
@@ -475,7 +497,9 @@ function deserializeError(error) {
475
497
  ${block(stack || '')}
476
498
  `);
477
499
  }
478
- return new ErrorClass(message);
500
+ const deserializedError = new ErrorClass(message);
501
+ deserializedError.id = id; // Assign id to the error object
502
+ return deserializedError;
479
503
  }
480
504
 
481
505
  /**