@promptbook/remote-server 0.66.0-9 → 0.67.0-0

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 (59) hide show
  1. package/esm/index.es.js +402 -40
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/core.index.d.ts +6 -4
  4. package/esm/typings/src/_packages/types.index.d.ts +7 -1
  5. package/esm/typings/src/_packages/utils.index.d.ts +14 -8
  6. package/esm/typings/src/commands/EXPECT/ExpectFormatCommand.d.ts +2 -0
  7. package/esm/typings/src/config.d.ts +6 -0
  8. package/esm/typings/src/errors/{ReferenceError.d.ts → PipelineUrlError.d.ts} +2 -2
  9. package/esm/typings/src/errors/index.d.ts +27 -0
  10. package/esm/typings/src/errors/utils/ErrorJson.d.ts +20 -0
  11. package/esm/typings/src/errors/utils/deserializeError.d.ts +7 -0
  12. package/esm/typings/src/errors/utils/deserializeError.test.d.ts +1 -0
  13. package/esm/typings/src/errors/utils/serializeError.d.ts +7 -0
  14. package/esm/typings/src/errors/utils/serializeError.test.d.ts +1 -0
  15. package/esm/typings/src/execution/ExecutionTools.d.ts +4 -1
  16. package/esm/typings/src/execution/PipelineExecutor.d.ts +1 -47
  17. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +49 -0
  18. package/esm/typings/src/execution/PromptResult.d.ts +5 -4
  19. package/esm/typings/src/execution/PromptResultUsage.d.ts +4 -0
  20. package/esm/typings/src/execution/UncertainNumber.d.ts +1 -0
  21. package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +2 -2
  22. package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +0 -1
  23. package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +2 -2
  24. package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +3 -3
  25. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -0
  26. package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Error.d.ts +2 -6
  27. package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -0
  28. package/esm/typings/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +2 -2
  29. package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -1
  30. package/esm/typings/src/types/ModelRequirements.d.ts +5 -5
  31. package/esm/typings/src/types/PipelineJson/Expectations.d.ts +3 -1
  32. package/esm/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +2 -0
  33. package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +4 -0
  34. package/esm/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +2 -0
  35. package/esm/typings/src/types/PipelineJson/PersonaJson.d.ts +4 -0
  36. package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +2 -0
  37. package/esm/typings/src/types/PipelineJson/PromptDialogJson.d.ts +1 -0
  38. package/esm/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +2 -0
  39. package/esm/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +2 -2
  40. package/esm/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +2 -0
  41. package/esm/typings/src/types/PipelineJson/ScriptJson.d.ts +1 -0
  42. package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +1 -0
  43. package/esm/typings/src/types/Prompt.d.ts +7 -7
  44. package/esm/typings/src/types/ScriptLanguage.d.ts +2 -0
  45. package/esm/typings/src/types/execution-report/ExecutionPromptReportJson.d.ts +24 -0
  46. package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +3 -20
  47. package/esm/typings/src/types/typeAliases.d.ts +7 -0
  48. package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +1 -4
  49. package/esm/typings/src/utils/serialization/$asDeeplyFrozenSerializableJson.d.ts +17 -0
  50. package/esm/typings/src/utils/{deepFreeze.d.ts → serialization/$deepFreeze.d.ts} +0 -10
  51. package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +27 -0
  52. package/esm/typings/src/utils/{clonePipeline.d.ts → serialization/clonePipeline.d.ts} +1 -1
  53. package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +24 -0
  54. package/esm/typings/src/utils/serialization/isSerializableAsJson.test.d.ts +1 -0
  55. package/package.json +2 -2
  56. package/umd/index.umd.js +402 -40
  57. package/umd/index.umd.js.map +1 -1
  58. package/esm/typings/src/errors/VersionMismatchError.d.ts +0 -10
  59. /package/esm/typings/src/utils/{deepClone.d.ts → serialization/deepClone.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/remote-server",
3
- "version": "0.66.0-9",
3
+ "version": "0.67.0-0",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -47,7 +47,7 @@
47
47
  "module": "./esm/index.es.js",
48
48
  "typings": "./esm/typings/src/_packages/remote-server.index.d.ts",
49
49
  "peerDependencies": {
50
- "@promptbook/core": "0.66.0-9"
50
+ "@promptbook/core": "0.67.0-0"
51
51
  },
52
52
  "dependencies": {
53
53
  "colors": "1.4.0",
package/umd/index.umd.js CHANGED
@@ -14,7 +14,7 @@
14
14
  /**
15
15
  * The version of the Promptbook library
16
16
  */
17
- var PROMPTBOOK_VERSION = '0.66.0-8';
17
+ var PROMPTBOOK_VERSION = '0.66.0';
18
18
  // TODO: !!!! List here all the versions and annotate + put into script
19
19
 
20
20
  /*! *****************************************************************************
@@ -136,6 +136,245 @@
136
136
  return to.concat(ar || Array.prototype.slice.call(from));
137
137
  }
138
138
 
139
+ /**
140
+ * Returns the same value that is passed as argument.
141
+ * No side effects.
142
+ *
143
+ * Note: It can be usefull for:
144
+ *
145
+ * 1) Leveling indentation
146
+ * 2) Putting always-true or always-false conditions without getting eslint errors
147
+ *
148
+ * @param value any values
149
+ * @returns the same values
150
+ * @private within the repository
151
+ */
152
+ function just(value) {
153
+ if (value === undefined) {
154
+ return undefined;
155
+ }
156
+ return value;
157
+ }
158
+
159
+ /**
160
+ * @@@
161
+ *
162
+ * Note: `$` is used to indicate that this function is not a pure function - it mutates given object
163
+ * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
164
+ *
165
+ * @returns The same object as the input, but deeply frozen
166
+ * @public exported from `@promptbook/utils`
167
+ */
168
+ function $deepFreeze(objectValue) {
169
+ var e_1, _a;
170
+ var propertyNames = Object.getOwnPropertyNames(objectValue);
171
+ try {
172
+ for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
173
+ var propertyName = propertyNames_1_1.value;
174
+ var value = objectValue[propertyName];
175
+ if (value && typeof value === 'object') {
176
+ $deepFreeze(value);
177
+ }
178
+ }
179
+ }
180
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
181
+ finally {
182
+ try {
183
+ if (propertyNames_1_1 && !propertyNames_1_1.done && (_a = propertyNames_1.return)) _a.call(propertyNames_1);
184
+ }
185
+ finally { if (e_1) throw e_1.error; }
186
+ }
187
+ return Object.freeze(objectValue);
188
+ }
189
+ /**
190
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
191
+ */
192
+
193
+ /**
194
+ * This error type indicates that the error should not happen and its last check before crashing with some other error
195
+ *
196
+ * @public exported from `@promptbook/core`
197
+ */
198
+ var UnexpectedError = /** @class */ (function (_super) {
199
+ __extends(UnexpectedError, _super);
200
+ function UnexpectedError(message) {
201
+ var _this = _super.call(this, spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This error should not happen.\n It's probbably a bug in the pipeline collection\n\n Please report issue:\n https://github.com/webgptorg/promptbook/issues\n\n Or contact us on me@pavolhejny.com\n\n "); })) || this;
202
+ _this.name = 'UnexpectedError';
203
+ Object.setPrototypeOf(_this, UnexpectedError.prototype);
204
+ return _this;
205
+ }
206
+ return UnexpectedError;
207
+ }(Error));
208
+
209
+ /**
210
+ * Checks if the value is [🚉] serializable as JSON
211
+ * If not, throws an UnexpectedError with a rich error message and tracking
212
+ *
213
+ * - Almost all primitives are serializable BUT:
214
+ * - `undefined` is not serializable
215
+ * - `NaN` is not serializable
216
+ * - Objects and arrays are serializable if all their properties are serializable
217
+ * - Functions are not serializable
218
+ * - Circular references are not serializable
219
+ * - `Date` objects are not serializable
220
+ * - `Map` and `Set` objects are not serializable
221
+ * - `RegExp` objects are not serializable
222
+ * - `Error` objects are not serializable
223
+ * - `Symbol` objects are not serializable
224
+ * - And much more...
225
+ *
226
+ * @throws UnexpectedError if the value is not serializable as JSON
227
+ * @public exported from `@promptbook/utils`
228
+ */
229
+ function checkSerializableAsJson(name, value) {
230
+ var e_1, _a;
231
+ if (value === undefined) {
232
+ throw new UnexpectedError("".concat(name, " is undefined"));
233
+ }
234
+ else if (value === null) {
235
+ return;
236
+ }
237
+ else if (typeof value === 'boolean') {
238
+ return;
239
+ }
240
+ else if (typeof value === 'number' && !isNaN(value)) {
241
+ return;
242
+ }
243
+ else if (typeof value === 'string') {
244
+ return;
245
+ }
246
+ else if (typeof value === 'symbol') {
247
+ throw new UnexpectedError("".concat(name, " is symbol"));
248
+ }
249
+ else if (typeof value === 'function') {
250
+ throw new UnexpectedError("".concat(name, " is function"));
251
+ }
252
+ else if (typeof value === 'object' && Array.isArray(value)) {
253
+ for (var i = 0; i < value.length; i++) {
254
+ checkSerializableAsJson("".concat(name, "[").concat(i, "]"), value[i]);
255
+ }
256
+ }
257
+ else if (typeof value === 'object') {
258
+ if (value instanceof Date) {
259
+ throw new UnexpectedError(spaceTrim__default["default"]("\n ".concat(name, " is Date\n\n Use `string_date_iso8601` instead\n ")));
260
+ }
261
+ else if (value instanceof Map) {
262
+ throw new UnexpectedError("".concat(name, " is Map"));
263
+ }
264
+ else if (value instanceof Set) {
265
+ throw new UnexpectedError("".concat(name, " is Set"));
266
+ }
267
+ else if (value instanceof RegExp) {
268
+ throw new UnexpectedError("".concat(name, " is RegExp"));
269
+ }
270
+ else if (value instanceof Error) {
271
+ throw new UnexpectedError(spaceTrim__default["default"]("\n ".concat(name, " is unserialized Error\n\n Use function `serializeError`\n ")));
272
+ }
273
+ else {
274
+ try {
275
+ for (var _b = __values(Object.entries(value)), _c = _b.next(); !_c.done; _c = _b.next()) {
276
+ var _d = __read(_c.value, 2), subName = _d[0], subValue = _d[1];
277
+ if (subValue === undefined) {
278
+ // Note: undefined in object is serializable - it is just omited
279
+ continue;
280
+ }
281
+ checkSerializableAsJson("".concat(name, ".").concat(subName), subValue);
282
+ }
283
+ }
284
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
285
+ finally {
286
+ try {
287
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
288
+ }
289
+ finally { if (e_1) throw e_1.error; }
290
+ }
291
+ try {
292
+ JSON.stringify(value); // <- TODO: [0]
293
+ }
294
+ catch (error) {
295
+ if (!(error instanceof Error)) {
296
+ throw error;
297
+ }
298
+ throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n ".concat(name, " is not serializable\n\n ").concat(block(error.toString()), "\n "); }));
299
+ }
300
+ /*
301
+ TODO: [0] Is there some more elegant way to check circular references?
302
+ const seen = new Set();
303
+ const stack = [{ value }];
304
+ while (stack.length > 0) {
305
+ const { value } = stack.pop()!;
306
+ if (typeof value === 'object' && value !== null) {
307
+ if (seen.has(value)) {
308
+ throw new UnexpectedError(`${name} has circular reference`);
309
+ }
310
+ seen.add(value);
311
+ if (Array.isArray(value)) {
312
+ stack.push(...value.map((value) => ({ value })));
313
+ } else {
314
+ stack.push(...Object.values(value).map((value) => ({ value })));
315
+ }
316
+ }
317
+ }
318
+ */
319
+ return;
320
+ }
321
+ }
322
+ else {
323
+ throw new UnexpectedError("".concat(name, " is unknown"));
324
+ }
325
+ }
326
+ /**
327
+ * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
328
+ * TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
329
+ * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
330
+ */
331
+
332
+ /**
333
+ * @@@
334
+ * @@@
335
+ *
336
+ * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
337
+ *
338
+ * @param name - Name of the object for debugging purposes
339
+ * @param objectValue - Object to be deeply frozen
340
+ * @returns The same object as the input, but deeply frozen
341
+ * @private this is in comparison to `deepFreeze` a more specific utility and maybe not very good practice to use without specific reason and considerations
342
+ */
343
+ function $asDeeplyFrozenSerializableJson(name, objectValue) {
344
+ checkSerializableAsJson(name, objectValue);
345
+ return $deepFreeze(objectValue);
346
+ }
347
+ /**
348
+ * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
349
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
350
+ */
351
+
352
+ /**
353
+ * The names of the parameters that are reserved for special purposes
354
+ *
355
+ * @public exported from `@promptbook/core`
356
+ */
357
+ $asDeeplyFrozenSerializableJson('RESERVED_PARAMETER_NAMES', [
358
+ 'content',
359
+ 'context',
360
+ 'knowledge',
361
+ 'samples',
362
+ 'modelName',
363
+ 'currentDate',
364
+ // <- TODO: Add more like 'date', 'modelName',...
365
+ // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
366
+ ]);
367
+ // <- TODO: [🧜‍♂️]
368
+ /**
369
+ * @@@
370
+ *
371
+ * @public exported from `@promptbook/core`
372
+ */
373
+ var IS_VERBOSE = false;
374
+ /**
375
+ * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
376
+ */
377
+
139
378
  /**
140
379
  * This error indicates errors during the execution of the pipeline
141
380
  *
@@ -153,21 +392,169 @@
153
392
  }(Error));
154
393
 
155
394
  /**
156
- * This error type indicates that the error should not happen and its last check before crashing with some other error
395
+ * This error indicates that the pipeline collection cannot be propperly loaded
157
396
  *
158
397
  * @public exported from `@promptbook/core`
159
398
  */
160
- var UnexpectedError = /** @class */ (function (_super) {
161
- __extends(UnexpectedError, _super);
162
- function UnexpectedError(message) {
163
- var _this = _super.call(this, spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This error should not happen.\n It's probbably a bug in the pipeline collection\n\n Please report issue:\n https://github.com/webgptorg/promptbook/issues\n\n Or contact us on me@pavolhejny.com\n\n "); })) || this;
164
- _this.name = 'UnexpectedError';
165
- Object.setPrototypeOf(_this, UnexpectedError.prototype);
399
+ var CollectionError = /** @class */ (function (_super) {
400
+ __extends(CollectionError, _super);
401
+ function CollectionError(message) {
402
+ var _this = _super.call(this, message) || this;
403
+ _this.name = 'CollectionError';
404
+ Object.setPrototypeOf(_this, CollectionError.prototype);
166
405
  return _this;
167
406
  }
168
- return UnexpectedError;
407
+ return CollectionError;
408
+ }(Error));
409
+
410
+ /**
411
+ * This error type indicates that you try to use a feature that is not available in the current environment
412
+ *
413
+ * @public exported from `@promptbook/core`
414
+ */
415
+ var EnvironmentMismatchError = /** @class */ (function (_super) {
416
+ __extends(EnvironmentMismatchError, _super);
417
+ function EnvironmentMismatchError(message) {
418
+ var _this = _super.call(this, message) || this;
419
+ _this.name = 'EnvironmentMismatchError';
420
+ Object.setPrototypeOf(_this, EnvironmentMismatchError.prototype);
421
+ return _this;
422
+ }
423
+ return EnvironmentMismatchError;
424
+ }(Error));
425
+
426
+ /**
427
+ * This error type indicates that some limit was reached
428
+ *
429
+ * @public exported from `@promptbook/core`
430
+ */
431
+ var LimitReachedError = /** @class */ (function (_super) {
432
+ __extends(LimitReachedError, _super);
433
+ function LimitReachedError(message) {
434
+ var _this = _super.call(this, message) || this;
435
+ _this.name = 'LimitReachedError';
436
+ Object.setPrototypeOf(_this, LimitReachedError.prototype);
437
+ return _this;
438
+ }
439
+ return LimitReachedError;
440
+ }(Error));
441
+
442
+ /**
443
+ * This error indicates that promptbook not found in the collection
444
+ *
445
+ * @public exported from `@promptbook/core`
446
+ */
447
+ var NotFoundError = /** @class */ (function (_super) {
448
+ __extends(NotFoundError, _super);
449
+ function NotFoundError(message) {
450
+ var _this = _super.call(this, message) || this;
451
+ _this.name = 'NotFoundError';
452
+ Object.setPrototypeOf(_this, NotFoundError.prototype);
453
+ return _this;
454
+ }
455
+ return NotFoundError;
456
+ }(Error));
457
+
458
+ /**
459
+ * This error type indicates that some part of the code is not implemented yet
460
+ *
461
+ * @public exported from `@promptbook/core`
462
+ */
463
+ var NotYetImplementedError = /** @class */ (function (_super) {
464
+ __extends(NotYetImplementedError, _super);
465
+ function NotYetImplementedError(message) {
466
+ var _this = _super.call(this, spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This feature is not implemented yet but it will be soon.\n\n If you want speed up the implementation or just read more, look here:\n https://github.com/webgptorg/promptbook\n\n Or contact us on me@pavolhejny.com\n\n "); })) || this;
467
+ _this.name = 'NotYetImplementedError';
468
+ Object.setPrototypeOf(_this, NotYetImplementedError.prototype);
469
+ return _this;
470
+ }
471
+ return NotYetImplementedError;
472
+ }(Error));
473
+
474
+ /**
475
+ * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
476
+ *
477
+ * @public exported from `@promptbook/core`
478
+ */
479
+ var ParsingError = /** @class */ (function (_super) {
480
+ __extends(ParsingError, _super);
481
+ function ParsingError(message) {
482
+ var _this = _super.call(this, message) || this;
483
+ _this.name = 'ParsingError';
484
+ Object.setPrototypeOf(_this, ParsingError.prototype);
485
+ return _this;
486
+ }
487
+ return ParsingError;
488
+ }(Error));
489
+
490
+ /**
491
+ * This error indicates that the promptbook object has valid syntax but contains logical errors (like circular dependencies)
492
+ *
493
+ * @public exported from `@promptbook/core`
494
+ */
495
+ var PipelineLogicError = /** @class */ (function (_super) {
496
+ __extends(PipelineLogicError, _super);
497
+ function PipelineLogicError(message) {
498
+ var _this = _super.call(this, message) || this;
499
+ _this.name = 'PipelineLogicError';
500
+ Object.setPrototypeOf(_this, PipelineLogicError.prototype);
501
+ return _this;
502
+ }
503
+ return PipelineLogicError;
504
+ }(Error));
505
+
506
+ /**
507
+ * This error indicates errors in referencing promptbooks between each other
508
+ *
509
+ * @public exported from `@promptbook/core`
510
+ */
511
+ var PipelineUrlError = /** @class */ (function (_super) {
512
+ __extends(PipelineUrlError, _super);
513
+ function PipelineUrlError(message) {
514
+ var _this = _super.call(this, message) || this;
515
+ _this.name = 'PipelineUrlError';
516
+ Object.setPrototypeOf(_this, PipelineUrlError.prototype);
517
+ return _this;
518
+ }
519
+ return PipelineUrlError;
169
520
  }(Error));
170
521
 
522
+ /**
523
+ * Index of all custom errors
524
+ *
525
+ * @public exported from `@promptbook/core`
526
+ */
527
+ var ERRORS = {
528
+ CollectionError: CollectionError,
529
+ EnvironmentMismatchError: EnvironmentMismatchError,
530
+ LimitReachedError: LimitReachedError,
531
+ NotFoundError: NotFoundError,
532
+ NotYetImplementedError: NotYetImplementedError,
533
+ ParsingError: ParsingError,
534
+ PipelineExecutionError: PipelineExecutionError,
535
+ PipelineLogicError: PipelineLogicError,
536
+ PipelineUrlError: PipelineUrlError,
537
+ UnexpectedError: UnexpectedError,
538
+ // TODO: [🪑]> VersionMismatchError,
539
+ };
540
+
541
+ /**
542
+ * Serializes an error into a [🚉] JSON-serializable object
543
+ *
544
+ * @public exported from `@promptbook/utils`
545
+ */
546
+ function serializeError(error) {
547
+ var name = error.name, message = error.message, stack = error.stack;
548
+ if (!__spreadArray(['Error'], __read(Object.keys(ERRORS)), false).includes(name)) {
549
+ throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n \n Cannot serialize error with name \"".concat(name, "\"\n\n ").concat(block(stack || message), "\n \n "); }));
550
+ }
551
+ return {
552
+ name: name,
553
+ message: message,
554
+ stack: stack,
555
+ };
556
+ }
557
+
171
558
  /**
172
559
  * Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
173
560
  *
@@ -466,14 +853,11 @@
466
853
  *
467
854
  * Note: `$` is used to indicate that this function is not a pure function - it access global scope
468
855
  *
469
- * @public exported from `@promptbook/utils`
856
+ * @private internal function of `$Register`
470
857
  */
471
858
  function $getGlobalScope() {
472
859
  return Function('return this')();
473
860
  }
474
- /***
475
- * TODO: !!!!! Make private and promptbook registry from this
476
- */
477
861
 
478
862
  /**
479
863
  * Register is @@@
@@ -504,13 +888,10 @@
504
888
  var packageName = registered.packageName, className = registered.className;
505
889
  var existingRegistrationIndex = this.storage.findIndex(function (item) { return item.packageName === packageName && item.className === className; });
506
890
  var existingRegistration = this.storage[existingRegistrationIndex];
507
- // TODO: !!!!!! Global IS_VERBOSE mode
508
891
  if (!existingRegistration) {
509
- console.warn("[\uD83D\uDCE6] Registering `".concat(packageName, ".").concat(className, "` to `").concat(this.storageName, "`"));
510
892
  this.storage.push(registered);
511
893
  }
512
894
  else {
513
- console.warn("[\uD83D\uDCE6] Re-registering `".concat(packageName, ".").concat(className, "` to `").concat(this.storageName, "`"));
514
895
  this.storage[existingRegistrationIndex] = registered;
515
896
  }
516
897
  };
@@ -526,26 +907,6 @@
526
907
  */
527
908
  var $llmToolsRegister = new $Register('llm_execution_tools_constructors');
528
909
 
529
- /**
530
- * Returns the same value that is passed as argument.
531
- * No side effects.
532
- *
533
- * Note: It can be usefull for:
534
- *
535
- * 1) Leveling indentation
536
- * 2) Putting always-true or always-false conditions without getting eslint errors
537
- *
538
- * @param value any values
539
- * @returns the same values
540
- * @private within the repository
541
- */
542
- function just(value) {
543
- if (value === undefined) {
544
- return undefined;
545
- }
546
- return value;
547
- }
548
-
549
910
  /**
550
911
  * @@@
551
912
  *
@@ -660,7 +1021,7 @@
660
1021
  */
661
1022
  function createLlmToolsFromConfiguration(configuration, options) {
662
1023
  if (options === void 0) { options = {}; }
663
- var _a = options.isVerbose, isVerbose = _a === void 0 ? false : _a;
1024
+ var _a = options.isVerbose, isVerbose = _a === void 0 ? IS_VERBOSE : _a;
664
1025
  var llmTools = configuration.map(function (llmConfiguration) {
665
1026
  var registeredItem = $llmToolsRegister
666
1027
  .list()
@@ -697,7 +1058,7 @@
697
1058
  var _this = this;
698
1059
  var _a = __assign({ isAnonymousModeAllowed: false, isCollectionModeAllowed: false, collection: null, createLlmExecutionTools: null }, options), port = _a.port, path = _a.path, collection = _a.collection, createLlmExecutionTools = _a.createLlmExecutionTools,
699
1060
  // <- TODO: [🧠][🤺] Remove `createLlmExecutionTools`, pass just `llmExecutionTools`
700
- isAnonymousModeAllowed = _a.isAnonymousModeAllowed, isCollectionModeAllowed = _a.isCollectionModeAllowed, _b = _a.isVerbose, isVerbose = _b === void 0 ? false : _b;
1061
+ isAnonymousModeAllowed = _a.isAnonymousModeAllowed, isCollectionModeAllowed = _a.isCollectionModeAllowed, _b = _a.isVerbose, isVerbose = _b === void 0 ? IS_VERBOSE : _b;
701
1062
  // <- TODO: [🦪] Some helper type to be able to use discriminant union types with destructuring
702
1063
  var httpServer = http__default["default"].createServer({}, function (request, response) { return __awaiter(_this, void 0, void 0, function () {
703
1064
  var _a, _b;
@@ -836,7 +1197,7 @@
836
1197
  if (!(error_1 instanceof Error)) {
837
1198
  throw error_1;
838
1199
  }
839
- socket.emit('error', { errorMessage: error_1.message });
1200
+ socket.emit('error', serializeError(error_1));
840
1201
  return [3 /*break*/, 16];
841
1202
  case 15:
842
1203
  socket.disconnect();
@@ -885,7 +1246,7 @@
885
1246
  if (!(error_2 instanceof Error)) {
886
1247
  throw error_2;
887
1248
  }
888
- socket.emit('error', { errorMessage: error_2.message });
1249
+ socket.emit('error', serializeError(error_2));
889
1250
  return [3 /*break*/, 5];
890
1251
  case 4:
891
1252
  socket.disconnect();
@@ -923,6 +1284,7 @@
923
1284
  };
924
1285
  }
925
1286
  /**
1287
+ * TODO: Maybe use `$asDeeplyFrozenSerializableJson`
926
1288
  * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
927
1289
  * TODO: [⚖] Expose the collection to be able to connect to same collection via createCollectionFromUrl
928
1290
  * TODO: Handle progress - support streaming